Section EqdepDec.
Variable A : Type.
Let comp (x y y':A) (eq1:x = y) (eq2:x = y') : y = y' :=
eq_ind _ (fun a => a = y') eq2 _ eq1.
Remark trans_sym_eq : forall (x y:A) (u:x = y), comp u u = eq_refl y.
Variable x : A.
Variable eq_dec : forall y:A, x = y \/ x <> y.
Let nu (y:A) (u:x = y) : x = y :=
match eq_dec y with
| or_introl eqxy => eqxy
| or_intror neqxy => False_ind _ (neqxy u)
end.
Let nu_constant : forall (y:A) (u v:x = y), nu u = nu v.
intros.
unfold nu.
destruct (eq_dec y) as [Heq|Hneq].
- reflexivity.
- case Hneq; trivial.
Qed.
Let nu_inv (y:A) (v:x = y) : x = y := comp (nu (eq_refl x)) v.
Remark nu_left_inv_on : forall (y:A) (u:x = y), nu_inv (nu u) = u.
(** The corollary *)
Let proj (P:A -> Prop) (exP:ex P) (def:P x) : P x :=
match exP with
| ex_intro _ x' prf =>
match eq_dec x' with
| or_introl eqprf => eq_ind x' P prf x (eq_sym eqprf)
| _ => def
end
end.

Theorem inj_right_pair_on :
forall (P:A -> Prop) (y y':P x),
ex_intro P x y = ex_intro P x y' -> y = y'.