Zulip Chat Archive

Stream: new members

Topic: definitional equality making my head spin


Eric Rodriguez (Feb 17 2021 at 15:36):

Heya! I'm Eric, and I'm hoping to formalise some combinatorial statements for my undergrad thesis. I've been working through all the examples from the books, and I'm confused as to why this doesn't work:

theorem self_sub_error (a : R) : a - a = 0 :=
begin
  rw add_comm a (-a), exact add_left_neg _
end

complaining about no instance of a + -a but as far as I understood, a - a and a + -a are the same thing within Lean. it works just fine if I prepend it with suffices h: a + -a = 0, by exact h, , which makes sense, but I'm not sure why I have to do this at all.

Yakov Pechersky (Feb 17 2021 at 15:37):

What constraints to you have on R?

Johan Commelin (Feb 17 2021 at 15:37):

They are not the same. rw sub_eq_add_neg should help you

Yakov Pechersky (Feb 17 2021 at 15:37):

For example. add_left_neg wouldn't work unless [add_group R]

Johan Commelin (Feb 17 2021 at 15:37):

Until two months ago they were defeq, but mathlib was refactored to solve some hairy issues.

Eric Rodriguez (Feb 17 2021 at 15:38):

Yakov, this is just from 2.2 in Mathematics in Lean

Eric Rodriguez (Feb 17 2021 at 15:38):

Ahh I see, but then why does exact h solve it?

Johan Commelin (Feb 17 2021 at 15:38):

hmm, MiL is still using an old mathlib, I guess.

Johan Commelin (Feb 17 2021 at 15:39):

Anyway, the reason rw doesn't work is because it looks at syntax, not just up to defeq

Eric Rodriguez (Feb 17 2021 at 15:39):

makes sense, thanks!


Last updated: Dec 20 2023 at 11:08 UTC