Zulip Chat Archive

Stream: lean4

Topic: congr' in Lean 4


Bhavik Mehta (Oct 23 2023 at 18:33):

Is there a replacement to Lean 3 congr' in Lean 4? docs#congr doesn't look inside iff goals, seemingly
Lean 3:

import tactic.congr

example {V K : Type} {P : Π (V : Type), (K  nat)  Prop} {n n' : K  nat} : P V n  P V n' :=
begin
  congr' 2,
  show n = n', --works
end

Lean 4:

example {V K : Type} {P : (V : Type)  (K  Nat)  Prop} {n n' : K  Nat} : P V n  P V n' := by
  congr 2
  show n = n' -- error

Mauricio Collares (Oct 23 2023 at 18:34):

Did you try congr!?

Bhavik Mehta (Oct 23 2023 at 18:35):

It seems to go too far, like Lean 3 rcongr - it starts using ext lemmas where I didn't want to

Bhavik Mehta (Oct 23 2023 at 18:36):

Ah, congr' 2 apparently corresponds to congr! 1, got it. Thanks!

Kyle Miller (Oct 23 2023 at 18:54):

Yeah, mathlib4's congr! is meant to be an analogue for mathlib3's congr'. Unlike rcongr it doesn't use ext lemmas (though it does know about funext and it does intro for you, and you can give congr! a with clause to name introduced variables).

Bhavik Mehta (Oct 23 2023 at 22:40):

Right, it was the fact that it uses ext on functions and does intro (both of which mathlib3 congr' don't do) that made my life difficult here :)


Last updated: Dec 20 2023 at 11:08 UTC