Skip to content
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

fixes related to bounding of declarees in quantification and function definitions #60

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

johnyf
Copy link
Contributor

@johnyf johnyf commented Jan 10, 2022

In constant quantification, either:

  • all declarees are bounded, or
  • all declarees are unbounded.

In function definitions, all declarees are bounded.
Tests also that in function constructors, all declarees are bounded.

@johnyf johnyf force-pushed the fixes_bounding_declarations branch from 277211a to 228691b Compare February 3, 2022 05:24
and update the code throughout `tlapm`,
because this commit changes the existing types in the
module `Expr.T`.
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.
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.
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.
@johnyf johnyf force-pushed the fixes_bounding_declarations branch from 228691b to 3845b04 Compare June 21, 2022 05:50
@johnyf johnyf changed the base branch from main to main_ June 28, 2022 17:54
@johnyf johnyf changed the base branch from main_ to main June 28, 2022 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant