Zulip Chat Archive

Stream: new members

Topic: Show two structs are equal when all fields are equal


Fingy Soupy (May 09 2022 at 20:28):

I have two structs and I'd like to show that they are equal if all their fields are equal. I thought no_confusion might come into play here but I can't figure out how to use it.

structure thing :=
(a : nat)
(b : nat)

lemma things_eq (x y : thing) (q : x.a = y.a) (q2 : x.b = y.b) : x = y := begin
  sorry
end

Eric Wieser (May 09 2022 at 20:30):

cases x, cases y makes progress

Eric Wieser (May 09 2022 at 20:30):

Better yet, add @[ext] to the structure

Eric Wieser (May 09 2022 at 20:31):

Which generates precisely your lemma

Fingy Soupy (May 09 2022 at 20:37):

Thanks! :)


Last updated: Dec 20 2023 at 11:08 UTC