Zulip Chat Archive
Stream: general
Topic: structure equality
Patrick Massot (Jul 06 2018 at 18:55):
How do we prove equality of two terms whose type is a structure mixing data and Prop? I would like to prove each data holding field matches. I thought this has something to do with no_confusion
but I can't get it to work.
Patrick Massot (Jul 06 2018 at 19:01):
Hum, it seems I can uses cases to access stuff here again.
Chris Hughes (Jul 06 2018 at 19:03):
structure thing := (a : ℕ) (b : ℕ) example (a b c d : ℕ) : thing.mk a b = thing.mk c d := begin rw thing.mk.inj_eq, end
simp
also works.
Chris Hughes (Jul 06 2018 at 19:05):
I'm not sure what to do if you haven't done cases.
Simon Hudon (Jul 06 2018 at 19:13):
You can also use congr
or congr'
Chris Hughes (Jul 06 2018 at 19:14):
What's the difference between congr
and congr'
?
Simon Hudon (Jul 06 2018 at 19:15):
congr'
takes an argument like congr' 3
to ask for three iterations of congruence. congr
just keeps going until it can't anymore. Often, congr
goes too far
Patrick Massot (Jul 06 2018 at 20:03):
Thanks Chris and Simon. congr
and simp
do nothing, cases
both sides and rw pequiv.mk.inj_eq ; cc
did the trick
Simon Hudon (Jul 06 2018 at 20:06):
Sorry, I didn't mention, in either case, you need to cases
both sides
Patrick Massot (Jul 06 2018 at 20:11):
Correction, after cases both sides, congr ; cc
also works
Patrick Massot (Jul 06 2018 at 20:12):
and congr ; tauto
of course
Simon Hudon (Jul 06 2018 at 20:22):
I'm wrapping up a round of optimization of tauto
. When it works, it should be faster than cc
Simon Hudon (Jul 06 2018 at 20:23):
(and now, it should work more often than before)
Patrick Massot (Jul 06 2018 at 20:23):
Great!
Last updated: Dec 20 2023 at 11:08 UTC