I have a situation that is kind of like this:
Parameter I : Type.
Parameter V : I -> Type.
Definition convert {k i} (A : V k) (eq : k = i) : V i.
destruct eq.
exact A.
Defined.
Theorem convert_eq : forall (i : I) (u : V i) (eq : i = i), convert u eq = u.
Proof.
intros i u eq.
unfold convert.
(* Now what? *)
Usually, when working with convert
, you can call destruct
on the equality being used. However, in this case, trying to use destruct eq
gives an error:
Abstracting over the terms "i" and "eq" leads to a term
fun (i0 : I) (eq0 : i0 = i0) => match eq0 in (_ = a) return (V a) with
| eq_refl => u
end = u
which is ill-typed.
Reason is: In pattern-matching on term "eq0" the branch for constructor "eq_refl" has type "V i" which should be
"V i0".
I'll be honest that I've never really been good with these weird uses of equality in definitions, so maybe my whole approach is just wrong. But I feel like convert_eq
should be provable somehow. Is there any way to do it?