Section Orderings.
Variable U : Type.
Definition Relation := U -> U -> Prop.
Variable R : Relation.
Definition Reflexive : Prop := forall x : U, R x x.
Definition Transitive : Prop := forall x y z : U, R x y -> R y z -> R x z.
Definition Symmetric : Prop := forall x y : U, R x y -> R y x.
Definition Antisymmetric : Prop := forall x y : U, R x y -> R y x -> x = y.
Definition contains (R R' : Relation) : Prop :=
forall x y : U, R' x y -> R x y.
Definition same_relation (R R' : Relation) : Prop :=
contains R R' /\ contains R' R.
Inductive Equivalence : Prop :=
Build_Equivalence : Reflexive -> Transitive -> Symmetric -> Equivalence.
Inductive PER : Prop :=
Build_PER : Symmetric -> Transitive -> PER.
End Orderings.
(***** Setoid  *******)
Inductive Setoid : Type :=
Build_Setoid :
forall (S : Type) (R : Relation S), Equivalence _ R -> Setoid.
Definition elem (A : Setoid) := let (S, R, e) := A in S.
Definition equal (A : Setoid) :=
let (S, R, e) as s return (Relation (elem s)) := A in R.

Axiom prf_equiv : forall A : Setoid, Equivalence (elem A) (equal A).
Axiom prf_refl : forall A : Setoid, Reflexive (elem A) (equal A).
Axiom prf_sym : forall A : Setoid, Symmetric (elem A) (equal A).
Axiom prf_trans : forall A : Setoid, Transitive (elem A) (equal A).