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.

Axiom Z_Suc : forall n : posint, Z <> Suc n.
Axiom Suc_Z : forall n : posint, Suc n <> Z.
Axiom n_Sucn : forall n : posint, n <> Suc n.
Axiom Sucn_n : forall n : posint, Suc n <> n.
Axiom eqT_symt : forall a b : posint, a <> b -> b <> a.