Zulip Chat Archive

Stream: general

Topic: id in proofs generated by tactics


Gihan Marasingha (Jul 18 2021 at 13:03):

Printing the proof of foo below gives foo1. In this case, id can be removed. Are there cases where it's important that the proof generated by rw employs id?

Or, to rephrase the question, why does the generated proof use id?

lemma foo (x y : nat): x + y = y + x :=
by rw nat.add_comm

lemma foo1 :  (x y : ), x + y = y + x :=
λ (x y : ),
  @eq.mpr (x + y = y + x) (y + x = y + x)
    (@id (x + y = y + x = (y + x = y + x))
       (@eq.rec  (x + y) (λ (_a : ), x + y = y + x = (_a = y + x)) (@eq.refl Prop (x + y = y + x)) (y + x)
          (@nat.add_comm x y)))
    (@eq.refl  (y + x))

Floris van Doorn (Jul 18 2021 at 13:05):

I believe the id is to help the type-checker, by giving exactly the expected type of the term it is applied to.

Mario Carneiro (Jul 18 2021 at 13:09):

It's especially important in long proofs by dsimp, because without it the kernel can get lost figuring out why a long transitivity chain is defeq


Last updated: Dec 20 2023 at 11:08 UTC