I am wondering about definition of functions in Lean and proving equality (in some sense to be defined) of two functions.
Note: I have consulted the answer to the following related question but it does not answer my doubts: Definitional vs propositional equality.
Concretely, I am considering the following:
variables {X : Type}
def id1 (x : X) : X :=
x
def id2 : X → X :=
λ x, x
The commands print id1
and print id2
then return
def id1 : Π {X : Type}, X → X :=
λ {X : Type} (x : X), x
and
def id2 : Π {X : Type}, X → X :=
λ {X : Type} (x : X), x
My first question then is:
Does this mean that
id1
andid2
are definitionally equal?
What I can do is prove
example : ∀ x : X, id1 x = id2 x := by {intro x, refl}
which suggests that id1
and id2
are indeed definitionally equal (because, as I understand, refl
will only work on definitionally equal terms).
However, even if the above is correct, I am puzzled by the following: the command #check id1 = id2
returns id1 = id2 : Prop
but if I try
example : id1 = id2 := by {sorry}
I get a
don't know how to synthetize placeholder
context:
⊢ Type
and a
tactic failed, result contains meta-variables
so I guess that the statement id1 = id2
does not quite make sense. Hence my second question:
Is it possible to give meaning to the statement
id1 = id2
and prove it?
Note: I believe this could be related to $\eta$-equivalence of terms, but I do really understand what this means.