Global Set Automatic Coercions Import.
Set Implicit Arguments.
Require Compare_dec.
Require EqNat.
Fixpoint cond_eq (T: nat -> Set) n m {struct n}: forall c, T (c + n) -> T (c + m) -> Prop :=
match n, m return forall c, T (c + n) -> T (c + m) -> Prop with
| 0, 0 => fun c x y => x = y
| S n', S m' => fun c x y => cond_eq T n' m' (S c)
(eq_rec_r T x (plus_n_Sm c n'))
(eq_rec_r T y (plus_n_Sm c m'))
| _, _ => fun _ _ _ => True
end.
Proof with auto.
induction n in c, x, y |- *...
simpl.
intros.
rewrite IHn.
unfold eq_rec_r.
unfold eq_rec.
unfold eq_rect.
simpl plus.
case (sym_eq (plus_n_Sm c n))...
Qed.

Lemma cond_eq_neq (T: nat -> Set) n m c (x: T (c + n)) (y: T (c + m)): n <> m -> cond_eq T n m c x y = True.