Zulip Chat Archive
Stream: Is there code for X?
Topic: Dual to `option.mem_unique`?
Stuart Presnell (Dec 28 2021 at 10:25):
Do we already have something like this, a kind of dual to docs#option.mem_unique? I tried library_search
and it couldn't find anything.
example (o1 o2 : option α) (a : α) (h1 : a ∈ o1) (h2 : a ∈ o2) : o1 = o2 :=
by { rw option.mem_def at *, exact eq.trans h1 h2.symm }
If not, is it worth adding to data/option/basic
? Under what name?
Johan Commelin (Dec 28 2021 at 10:27):
I would call it docs#option.eq_of_mem_of_mem
Johan Commelin (Dec 28 2021 at 10:27):
Which doesn't exist yet...
Stuart Presnell (Dec 28 2021 at 10:40):
Mario Carneiro (Dec 28 2021 at 10:41):
it can be written more simply as h1.trans h2.symm
Mario Carneiro (Dec 28 2021 at 10:43):
I think this theorem is more useful in the one sided form,
example {α} {o : option α} {a : α} (h : a ∈ o) : o = some a := h
Stuart Presnell (Dec 28 2021 at 10:52):
Ah, h1.trans h2.symm
is what I was looking for! I didn't realise I could treat an expression of the form a ∈ o1
like an equality without rewriting it first.
Stuart Presnell (Dec 28 2021 at 10:55):
In that case I guess eq_of_mem_of_mem
(or the one-sided version) is too trivial to be worth naming?
Yury G. Kudryashov (Dec 28 2021 at 17:17):
I don't mind having option.mem.bi_unique
Yury G. Kudryashov (Dec 28 2021 at 17:17):
(and option.mem.right_unique
)
Eric Wieser (Dec 28 2021 at 21:23):
I like eq_of_mem_of_mem
better as a name.
Yury G. Kudryashov (Dec 28 2021 at 22:09):
I meant docs#relator.bi_unique
Last updated: Dec 20 2023 at 11:08 UTC