I have a query about inductively defined relation eq
in Coq. Consider the following definition of eq
in Coq:
Inductive eq (A : Type) (x : A) : A -> Prop := eq_refl : x = x
This is an inductively defined relation just like le
(<=
). Therefore I should be able to do case analysis on any evidence of this type.
However, when I tried proving the following result I could not succeed.
Lemma true_num: forall m :nat, forall x y: m=m, x=y.
Proof. intros. destruct x.
(// Error: Abstracting over the terms "m" and "x" leads to a term
fun (m0 : nat) (x0 : m0 = m0) => x0 = y
which is ill-typed.
Reason is: Illegal application:
The term "@eq" of type "forall A : Type, A -> A -> Prop"
cannot be applied to the terms
"m0 = m0" : "Prop"
"x0" : "m0 = m0"
"y" : "m = m"
The 3rd term has type "m = m" which should be coercible to
"m0 = m0". )
I am unable to decode this error.
The only proof for m=m
should be @eq_refl nat m
since eq_refl
is the only constructor. Hence one should be able to prove the equality of x
and y
by doing case analysis.
What is wrong with this line of reasoning?