Section Maps.
Variable A B : Setoid.
Definition Map_law (f : elem A -> elem B) :=
forall x y : elem A, equal _ x y -> equal _ (f x) (f y).
Inductive Map : Type :=
Build_Map : forall (f : elem A -> elem B) (p : Map_law f), Map.
Definition explicit_ap (m : Map) :=
match m return (elem A -> elem B) with
| Build_Map f p => f
end.
Definition ext (f g : Map) :=
forall x : elem A, equal _ (explicit_ap f x) (explicit_ap g x).
Definition Map_setoid := Build_Setoid Map ext Equiv_map_eq.
End Maps.
Notation ap := (explicit_ap _ _).
(* <Warning> : Grammar is replaced by Notation *)
Definition ap2 (A B C : Setoid) (f : elem (Map_setoid A (Map_setoid B C)))
(a : elem A) := ap (ap f a).
(*****    posint     ******)
Inductive posint : Type :=
| Z : posint
| Suc : posint -> posint.
Axiom
f_equal : forall (A B : Type) (f : A -> B) (x y : A), x = y -> f x = f y.
(* The predecessor function *)
Definition pred (n : posint) : posint :=
match n return posint with
| Z => (* Z *)  Z
(* Suc u *)
| Suc u => u
end.
Definition IsSuc (n : posint) : Prop :=
match n return Prop with
| Z => (* Z *)  False
(* Suc p *)
| Suc p => True
end.
Definition IsZero (n : posint) : Prop :=
match n with
| Z => True
| Suc _ => False
end.
(*******  Dsetoid *****)
Definition Decidable (A : Type) (R : Relation A) :=
forall x y : A, R x y \/ ~ R x y.
Record DSetoid : Type :=
{Set_of : Setoid; prf_decid : Decidable (elem Set_of) (equal Set_of)}.
(* example de Dsetoide d'entiers *)

Axiom eqT_equiv : Equivalence posint (eq (A:=posint)).
Axiom Eq_posint_deci : Decidable posint (eq (A:=posint)).