Zulip Chat Archive
Stream: lean4
Topic: Extending `exists`?
François G. Dorais (Apr 25 2022 at 21:38):
It's not unusual to have to use the exists tactic a few times in a row. It would be nice to extend the exists tactic to accept a comma separated list of terms instead of just one at a time.
Such an extension seems to fit the "low work and low maintenance" criteria. Should this be a feature request? Or would a pull request be welcome here? Or is there a reason why this is undesirable?
Alex J. Best (Apr 25 2022 at 21:40):
In mathlib 3 we use use for this, but I do not know if mathlib4 has implemented this already
François G. Dorais (Apr 25 2022 at 21:46):
I would contend this extension belongs in core. I think mathlib's use handles much more than that but it wouldn't fit the "low work and low maintenance" criteria.
Kyle Miller (Apr 25 2022 at 23:01):
The next best thing is refine', which is in core Lean 4.
example : ∃ n m, n = m + 1 := by
refine' ⟨2, 1, _⟩
rfl
Leonardo de Moura (Apr 25 2022 at 23:02):
Pushed the exists es:term,+ extension.
Kyle Miller (Apr 25 2022 at 23:06):
What is the difference between a placeholder _ and an "unnamed hole" ?_? I see I can do refine ⟨2, 1, ?_⟩ but not refine ⟨2, 1, _⟩. (Being able to do refine ⟨2, 1, ?foo⟩ to name a goal is a neat feature.)
Leonardo de Moura (Apr 25 2022 at 23:13):
The Lean 4 refine' is the Lean 3 refine. Note that refine' ⟨2, 1, _⟩ also works in Lean 4.
We changed refine in Lean 4, and it only accepts "named holes": ?<id> and ?_. Reasons:
1- It motivates users to have structured proofs. They can fill the named holes using case <id> => ...
2- Helps users catch mistakes. refine fails if some implicit hole could not be filled. I think @Reid Barton suggested this feature. May be mistaken.
Last updated: May 02 2025 at 03:31 UTC