Section Acc_irrelevance.
Variable (X : Type) (R : X -> X -> Prop).
(* Equivalence of two accessibility proofs kind of hereditary closure under FunExt *)
Inductive Acc_eq : forall x, Acc R x -> Acc R x -> Prop :=
| in_Acc_eq : forall x A1 A2, (forall y H, @Acc_eq y (A1 y H) (A2 y H))
-> @Acc_eq x (Acc_intro _ A1) (Acc_intro _ A2).
(* All accessibility proofs are equivalent !! But equality between those proofs cannot be proved w/o FunExt Notice that we use a dependent induction principle here *)
Fact Acc_eq_total x H1 H2 : @Acc_eq x H1 H2.
(* This provides a way to show that a dependent function forall x, Acc R x -> P x is Acc irrelevant *)
Variables (P : X -> Type) (f : forall x, Acc R x -> P x)
(Hf : forall x H1 H2, (forall y Hy, f (H1 y Hy) =  f (H2 _ Hy))
->  f (Acc_intro x H1) = f (Acc_intro x H2)).

Theorem Acc_irrelevance x H1 H2 : @f x H1 = f H2.