Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tlc4b
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tlc4b
Commits
c49b3a42
Verified
Commit
c49b3a42
authored
2 weeks ago
by
Miles Vella
Browse files
Options
Downloads
Patches
Plain Diff
Also improve type inference of Relations.tla for TLA2B
parent
f4efe3ed
No related branches found
No related tags found
No related merge requests found
Pipeline
#157766
passed
2 weeks ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/resources/de/tlc4b/standardModules/FunctionsAsRelations.tla
+4
-2
4 additions, 2 deletions
...sources/de/tlc4b/standardModules/FunctionsAsRelations.tla
src/main/resources/de/tlc4b/standardModules/Relations.tla
+6
-4
6 additions, 4 deletions
src/main/resources/de/tlc4b/standardModules/Relations.tla
with
10 additions
and
6 deletions
src/main/resources/de/tlc4b/standardModules/FunctionsAsRelations.tla
+
4
−
2
View file @
c49b3a42
------------------------ MODULE FunctionsAsRelations ----------------------------------
EXTENDS FiniteSets, Functions, TLC, Sequences
LOCAL RelDom(f) == { <<x[1], x[2]>>[1] : x \in f } \* The domain of the function, syntax is weird to help TLA2B typechecker
LOCAL RelRan(f) == { <<x[1], x[2]>>[2] : x \in f } \* The range of the function, syntax is weird to help TLA2B typechecker
LOCAL GetKey(x) == <<x[1], x[2]>>[1] \* Get key of relational pair, also used as a type hint for TLA2B
LOCAL RelDom(f) == {GetKey(x): x \in f} \* The domain of the function
LOCAL RelRan(f) == {x[2]: x \in f} \* The range of the function
LOCAL MakeRel(f) == {<<x, f[x]>>: x \in DOMAIN f}
\* Converting a TLA+ function to a set of pairs
LOCAL Rel(S, T) == SUBSET (S \times T) \* The set of relations
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/de/tlc4b/standardModules/Relations.tla
+
6
−
4
View file @
c49b3a42
---------------------------- MODULE Relations ----------------------------
EXTENDS FiniteSets, Naturals, Sequences, TLC
LOCAL GetKey(x) == <<x[1], x[2]>>[1] \* Get key of relational pair, also used as a type hint for TLA2B
Relations(S, T) == SUBSET (S \times T)
\* The set of all relations
RelDomain(R) == {
x[1]
: x \in R}
RelDomain(R) == {
GetKey(x)
: x \in R}
\* The domain of the relation R
RelRange(R) == {x[2]: x \in R}
...
...
@@ -13,10 +15,10 @@ RelRange(R) == {x[2]: x \in R}
RelId(S) == {<<x,x>>: x \in S}
\* The identity relation of set S
RelDomRes(S, R) == {x \in R:
x[1]
\in S}
RelDomRes(S, R) == {x \in R:
GetKey(x)
\in S}
\* The restriction on the domain of R for set S
RelDomSub(S, R) == {x \in R:
x[1]
\notin S}
RelDomSub(S, R) == {x \in R:
GetKey(x)
\notin S}
\* The subtraction on the domain of R for set S
RelRanRes(R, S) == {x \in R: x[2] \in S}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment