Zulip Chat Archive

Stream: general

Topic: How to prove (z-1)/(z-1)=1 ?


Jiatong Yang (Jul 26 2022 at 04:50):

import algebra
example (z : ) (H : z  1) : (z - 1) / (z - 1) = 1 := begin
  apply div_self,
end

This apply tactic fails.

Heather Macbeth (Jul 26 2022 at 05:20):

@Jiatong Yang You can use docs#int.div_self instead of docs#div_self. The main div_self lemma requires that the type be a docs#group_with_zero, which is not.

Jiatong Yang (Jul 26 2022 at 05:32):

Thank you very much! I thought lean couldn't identify (z-1) with itself. :joy: :joy:

Winston Yin (Aug 04 2022 at 17:13):

I find that in such cases where the expressions look the same but Lean fails to apply the lemma, it is helpful to use @ and explicitly type out every single argument, leaving the typeclass arguments as _. Lean will tell you exactly which _ cannot be synthesised.


Last updated: Dec 20 2023 at 11:08 UTC