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
[Merged by Bors] - feat(frontends/lean/brackets): notation for set replacement #402
Conversation
I like it, and the implementation looks good. Is |
Too bad they are not definitionally equal. But I guess we can have simp lemmas rewriting them. |
The issue is that the notation expands to |
Another option would be to move bors r+ |
[As discussed on Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Lean.204.20notation). This PR introduces notation for set replacement, so that `{(f x) | x ∈ s}` is equivalent to `set.image f s`. More generally, `{(expr) | binders}` parses to something like `set_of (λ _x, ∃ binders, expr = _x)`. The expression needs to be between parentheses to ensure it is not ambiguous with the `{ id | predicate }` notation for separation and to decrease the amount of backtracking. Expressions of the form `{(x, y) | (x y : ℕ) (p : x + y < 10)}` also work as expected.
Pull request successfully merged into master. Build succeeded: |
Correct, then you get something definitionally equal, but presumably you want to actually rewrite it to |
As discussed on Zulip.
This PR introduces notation for set replacement, so that
{(f x) | x ∈ s}
is equivalent toset.image f s
. More generally,{(expr) | binders}
parses to something likeset_of (λ _x, ∃ binders, expr = _x)
. The expression needs to be between parentheses to ensure it is not ambiguous with the{ id | predicate }
notation for separation and to decrease the amount of backtracking. Expressions of the form{(x, y) | (x y : ℕ) (p : x + y < 10)}
also work as expected.