-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: parse and expand bound tuples #140
Commits on Nov 4, 2024
-
API: change syntax tree to represent also tuply declarations
and update the code throughout `tlapm`, because this commit changes the existing types in the module `Expr.T`. Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 893431d - Browse repository at this point
Copy the full SHA 893431dView commit details -
BUG: do not allow unbounded declarations in function definitions
The change in this commit corrects a bug with function definitions. Parsing of function definitions allowed using unbounded declarations (and also mixing bounded and unbounded declarations). For example, before this change, parsing allowed: ```tla f[x \in S, y] == TRUE ``` and even: ```tla f[x] == TRUE ``` These syntax errors are detected by SANY. In any case, this change ensures that `tlapm` does not parse such definitions. The error was due to calling the function `bounds` within the function `ophead`, instead of calling the function `boundeds` (which was called before commit 5958dfa in order to handle function constructors within the function `atomic_expr`). This commit also adds tests for this bug. Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e09abe5 - Browse repository at this point
Copy the full SHA e09abe5View commit details -
BUG: do not allow both bounded and unbounded declarations in \E, \A
because TLA+ does not allow this kind of syntax. A single rigid quantifier can include either: - only unbounded declarations, for example `\E x, y, z: ...`, or - only bounded declarations, for example `\A x \in A, y \in B, z \in C: ...`. A single rigid quantifier cannot include both bounded and unbounded declarations. This syntax is caught by SANY. Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b4b68af - Browse repository at this point
Copy the full SHA b4b68afView commit details -
TST: that function constructors allow only bounded declarations
in other words, that the following expression is not allowed: ```tla [x \in S, y |-> TRUE] ``` and the following expression is allowed: ```tla [x \in S, y \in S |-> TRUE] ``` Also, add a reminder in a comment in the parser code. Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for aee119e - Browse repository at this point
Copy the full SHA aee119eView commit details -
REF: cons during fold, and reverse upon completion
instead of appending during the fold. This approach is more efficient. Also: - STY: blankspace formatting Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2c61f99 - Browse repository at this point
Copy the full SHA 2c61f99View commit details -
ENH: add class
Module.deep_map
Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 371fd71 - Browse repository at this point
Copy the full SHA 371fd71View commit details -
ENH: parse and expand tuply declarations
## ENH: tuply declarations This commit adds parsing and translation support for tuply declarations that appear in: - rigid quantification `\E ... here ...: ` and `\A ... here ...: ` - choose expressions `CHOOSE ... here ...: ` - set constructors `{... here ... \in ...: ...}` - set constructors `{...: ... here ...}` - function definitions `f[...here...] = ...` - function constructors `[... here ... |-> ...]` Commit 5958dfa introduced parsing of tuple declarations in function constructors, for example for expressions of the form: ```tla [<<x, y>> \in A \X B |-> x + y] ``` This commit rewrites that functionality, and uses the new functionality to parse tuple declarations that can appear in function definitions, i.e., definitions of the form: ```tla f[<<x, y>> \in A \X B] == x + y ``` The parsed tuply declarations are then transformed to either: - optimized expressions that are simplified and do not contain additional `CHOOSE` operators, in the presence of a syntactically-recognizable Cartesian product of suitable length, or - the expressions defined by TLA+ semantics (in most cases these expressions contain `CHOOSE`), otherwise. This commit also adds tests for the above functionality. ## BUG: correctly represent tuple declarations in function constructors In general, tuple declarations in function constructors are defined using `CHOOSE` with tuple declarations, which in turn is defined using unbounded `CHOOSE` and quantification. This was not how function constructors were implemented in commit 5958dfa. This commit corrects this error. The previous encoding is closer to what is currently done when a Cartesian product of the appropriate length is recognized in syntax. ## Tuplification This commit adds a translation of function constructor signatures that tuplifies comma-separated declarations, and fuses the domain-bounds of such declarations into a Cartesian product. The motivation for doing so is that it enables passing such functions (of tuples) to Isabelle and Zenon with the existing support that is available in those backends (for tuples and Cartesian products), and the proofs succeed. ## Other changes - DOC: update file `todo.txt` - ENH: add function `E_visit.name_operators` for converting syntax trees with positional operator references to syntax trees with operator references by name (i.e., conversion of `Ix` nodes to `Opaque` nodes). Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 11ef1b0 - Browse repository at this point
Copy the full SHA 11ef1b0View commit details
Commits on Nov 6, 2024
-
TST: update parser tests for cases now parsed
Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5aea669 - Browse repository at this point
Copy the full SHA 5aea669View commit details -
MNT: add tuple-declaration cases to patterns
Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 303e7f8 - Browse repository at this point
Copy the full SHA 303e7f8View commit details
Commits on Nov 13, 2024
-
MNT: apply changes from pull request review
<tlaplus#140> Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3b69928 - Browse repository at this point
Copy the full SHA 3b69928View commit details -
MNT: complete implementation of
M_visit.deep_map
Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e702c3f - Browse repository at this point
Copy the full SHA e702c3fView commit details
Commits on Nov 27, 2024
-
Signed-off-by: Ioannis Filippidis <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7af4592 - Browse repository at this point
Copy the full SHA 7af4592View commit details