(*===============================================================*)
(********************* Setoids  *******************)
(*===============================================================*)
(* allow to define appropriate structures for use of N_rewrite, the last argument must be the variable that is involved in the  weak_equality a ≡≡≡ b *)
Parameter def_eq_N   : forall a b,  eq_N a b ≡≡ forall A, (A ε a ≡≡ A ε b).
(*****  Extensionality of type Protothetic: examples  ******)
Structure Morphism_NS  : Type := {
F1       :> N->Prop ;
compatN  : forall (a b:N), eq_N a b ≡≡ (F1 a ≡≡ (F1 b))}.
Add Parametric Morphism  (M : Morphism_NS) :
(@F1 M) with signature (@eq_N ==> @eqP) as extensional_propN.
(*******  Extensionality of type Ontologic:  morphism with different relation structures *************)
Parameter star      : (N->N)-> Prop.
Parameter D27       : forall alpha:N->N,  star alpha ≡≡ ¬ forall A a, ¬(A ε (alpha a)).
Parameter eq_NN     : (N->N)->(N->N)->Prop.
Parameter def_eq_NN : forall (alpha beta:N->N), eq_NN alpha beta ≡≡ forall A a:N, (A ε (alpha a) ≡≡ (A ε (beta a))).
Structure Morphism_NNS  : Type := {
F2       :> (N->N)->Prop ;
compatNN  : forall (alpha beta:N->N), (eq_NN alpha beta ≡≡ (F2 alpha ≡≡ (F2 beta)))}.
Add Parametric Morphism  (M : Morphism_NNS) :
(@F2 M) with signature (@eq_NN ==> @eqP ) as extensional_prop2.
Definition Psi (E1:N->N->Prop)(E2:N)(E3:N->N)(E4:N) := E1 E2 (E3 E4).
Definition Psi' (E1:N->N->Prop)(E3:N->N)(E4:N->N)(E5:N)(E2:N) := E1 E2 (E3 (E4 E5)).
Definition Psi'' (E1:N->N->Prop)(E3:N->N)(E5:N)(E2:N) := E1 E2 (E3 E5).
Structure Morphism_N_N : Type := {
phi        :> N->N;
compat_N_1 : forall (a b A: N), eq_N a b ≡≡ (epsilon A (phi a) ≡≡ epsilon A (phi b));
compat_N_2 : forall (A B a: N), eq_N A B ≡≡ (epsilon A (phi (phi a)) ≡≡ epsilon B (phi (phi a)));
compat_N_3 : forall (A B a: N), eq_N A B ≡≡ (epsilon A (phi a) ≡≡ epsilon B (phi a))}.
Add Parametric Morphism (M : Morphism_N_N) :
(Psi epsilon _ (@phi M)) with signature (@eq_N ==> @eqP) as extensional_N_1.
Add Parametric Morphism (M : Morphism_N_N) :
(Psi' epsilon (@phi M)(@phi M) _ ) with signature (@eq_N ==> @eqP) as extensional_N_2.
Add Parametric Morphism (M : Morphism_N_N) :
(Psi'' epsilon (@phi M) _) with signature (@eq_N ==> @eqP) as extensional_N_3.
(*============================================================*)

Lemma OntoT29 : forall A B, (singular_equality A B ⊃ weak_equality A B).