Zulip Chat Archive

Stream: mathlib4

Topic: existential binding


Jireh Loreaux (Dec 13 2022 at 22:54):

In mathlib4#993 I ran into an issue which seems like a bug. The statement of SetLike.exists had massaged from ∃ x ∈ p, q ⟨x, ‹_›⟩ to ∃ (x : B) (h : x ∈ p), q ⟨x, ‹_›⟩. The former worked in Lean 3 (and it expands to the latter).

Jireh Loreaux (Dec 14 2022 at 02:50):

@Scott Morrison do you know what the expected behavior is here?

Scott Morrison (Dec 14 2022 at 03:00):

As far as I'm aware we aspire in mathport to translate from ∃ x ∈ p to ∃ (x : B) (h : x ∈ p), but don't always succeed, and don't currently have support for the former in lean4/mathlib4.

Mario Carneiro (Dec 14 2022 at 03:10):

It's rather the opposite: mathport will expand all binders by default but it tries to use the existing binder collection support where possible for things like exists

Mario Carneiro (Dec 14 2022 at 03:12):

import Std
#check  s,  x  s, x = x

Scott Morrison (Dec 14 2022 at 03:16):

Indeed, grepping for ∃.*:.*∈ turns up less than I remembered, and all the ones I looked at are necessary.

Mario Carneiro (Dec 14 2022 at 03:29):

The reason why the original example doesn't work is because ∃ x ∈ p, q x is now sugar for ∃ x, x ∈ p /\ q x, not ∃ x, ∃ h : x ∈ p, q

Winston Yin (Dec 14 2022 at 10:01):

Why was this syntactic sugar changed from mathlib3 to 4? I imagine it’ll break a lot of proofs during porting.

How will Lean elaborate ∃ (x : A) (p x) (y : B) (q y), r x y now? Will it be ∃ (h : p x) or p x ∧ ...?

Yaël Dillies (Dec 14 2022 at 10:41):

Hmm, this is a bit annoying indeed, because there are some proofs that rely on swapping pairs of existential quantifiers.


Last updated: Dec 20 2023 at 11:08 UTC