(* Transport equality, only matching on eq_refl in contradictory cases, to make sure
   terms using this function reduce *)
Fixpoint nat_cast (P : nat -> Type) {n m} : n = m -> P n -> P m.

Lemma nat_cast_cast ni no (pf: ni = no) (P: nat -> Type) (x : P ni): nat_cast P pf x = match pf in _ = Y return P Y with | eq_refl => x end.