Zulip Chat Archive

Stream: general

Topic: exists with member constraint confusion


Bernd Losert (Dec 15 2021 at 22:30):

What does ∃ x ∈ xs, p x translate to? The lean output shows ∃ (x : a) (_h : x ∈ xs), p x, but what does this translate to? What does a value of this type look like?

Mario Carneiro (Dec 15 2021 at 22:31):

it literally means ∃ (x : a), ∃ (_h : x ∈ xs), p x

Bernd Losert (Dec 15 2021 at 22:31):

Ah, so it's iterated.

Bernd Losert (Dec 15 2021 at 22:32):

So values are triples then.

Mario Carneiro (Dec 15 2021 at 22:32):

The part that is weird there is the second existential, which says that there exists a proof of x in xs such that p x holds. This is just the same as x ∈ xs /\ p x

Mario Carneiro (Dec 15 2021 at 22:32):

All binders like this are iterated when you use multiple variables in the binder group

Bernd Losert (Dec 15 2021 at 22:33):

It's not exactly the same as that though because I tried giving it that type and it didn't work.

Mario Carneiro (Dec 15 2021 at 22:33):

in surprisingly many cases this turns out to be the right thing

Mario Carneiro (Dec 15 2021 at 22:33):

right, it's not defeq but it is logically equivalent

Bernd Losert (Dec 15 2021 at 22:33):

Right.

Mario Carneiro (Dec 15 2021 at 22:34):

and there is a simp lemma that will rewrite it to a conjunction if you prefer

Bernd Losert (Dec 15 2021 at 22:34):

Which?

Mario Carneiro (Dec 15 2021 at 22:34):

but you can construct and destruct it with \<h1, h2\> either way

Mario Carneiro (Dec 15 2021 at 22:34):

the simp lemma will turn the existential into a conjunction

Mario Carneiro (Dec 15 2021 at 22:35):

docs#exists_prop

Bernd Losert (Dec 15 2021 at 22:36):

Cool. Thanks.


Last updated: Dec 20 2023 at 11:08 UTC