Skip to content

Operator unfolding when applied to enough arguments#431

Merged
strub merged 1 commit into
mainfrom
red-arguments
Sep 6, 2023
Merged

Operator unfolding when applied to enough arguments#431
strub merged 1 commit into
mainfrom
red-arguments

Conversation

@strub
Copy link
Copy Markdown
Member

@strub strub commented Aug 28, 2023

Operator unfolding when applied to enough arguments

When declaring an operator, it is now possible to specify which
arguments are mandatory before an operator application is
automtically unfolded during simplification.

Syntax is:

op name (x1 : t1) (xp : tp) / (x_p+1 : t_p+1) ... = ...

where the optional / indicated that the operator name will
be automatically unfolded when applied to at least p
arguments.

@strub strub requested review from bgregoir and fdupress August 28, 2023 15:40
@strub strub self-assigned this Aug 28, 2023
When declaring an operator, it is now possible to specify which
arguments are mandatory before an operator application is
automtically unfolded during simplification.

Syntax is:

```
op name (x1 : t1) (xp : tp) / (x_p+1 : t_p+1) ... = ...
```

where the optional `/` indicated that the operator `name` will
be automatically unfolded when applied to at least `p`
arguments.
@strub strub added this to the Release 2022.07 milestone Sep 4, 2023
@strub strub marked this pull request as ready for review September 4, 2023 09:19
@fdupress
Copy link
Copy Markdown
Member

fdupress commented Sep 4, 2023

Will you be looking for a review related to maintained proofs?

I have a couple where this looks like it could be massively useful. (The get_as_Constructor operators not evaluating even when fully applied to a constructor-headed value... Those are annoying.)

Conversely, it looks like this will make a lot of proofs a lot less pleasant to step through and learn from unless some operators are made opaque or manually locked.

@fdupress
Copy link
Copy Markdown
Member

fdupress commented Sep 4, 2023

Just saw the updated description. This helps a bit.

The question still stands, though.

@strub
Copy link
Copy Markdown
Member Author

strub commented Sep 4, 2023

The PR does not change the default behaviour, so it is safe w.r.t. existing proofs. The next step would be to mark some operators of the standard library as auto-unfoldable. Not that this should be done only for cases where you do not want the folded version of the operator (e.g. predT x or (f \o g) x). If needed (e.g. for the tutorials), we can add an option to disable auto-unfold.

@strub strub merged commit 480c0ea into main Sep 6, 2023
@strub strub deleted the red-arguments branch September 6, 2023 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants