Module Type Mereology (dolce:DOLCE_root)(proto:Protothetic dolce).
Set Typeclasses Axioms Are Instances.
(* ====================== ONTOLOGICAL AXIOM  ============================= *)
Parameter epsilon : relation N.
(* no typing on singulars and plurals *)
Notation "A 'ε' b" := (epsilon A b)  (at level 40).
(************** Meta rules of existential introduction/elimination  ********)
(* ==================================== ONTOLOGICAL DEFINITIONS =============================== *)
Parameter exist_at_least      : N->Prop.
Parameter D1                  : forall a, exist_at_least a ≡≡ ¬forall A, ¬(A ε a).                  (* D1 *)
Parameter exist_at_most       : N -> Prop.
Parameter D2                  : forall a:N, exist_at_most a ≡≡ forall B C, B ε a ∧ C ε a ⊃ B ε C.   (* D2 *)
Parameter exist_exactly       : N -> Prop.
Parameter D3                  : forall A, exist_exactly A ≡≡ forall b, A ε b.                       (* D3 *)
Parameter singular_equality   : N -> N -> Prop.
Parameter D4                  : forall A B,  singular_equality A B ≡≡ (A ε B ∧ B ε A).              (* D4 *)
Parameter singular_difference : N -> N -> Prop.
Parameter D5                  : forall A B, singular_difference A B ≡≡ (A ε A ∧ B ε B ∧
¬singular_equality A B).   (* D5 *)
Parameter weak_equality       : N -> N -> Prop.
Parameter D6                  : forall a b,  weak_equality a b ≡≡ forall A, (A ε a ≡≡ A ε b).       (* D6 *)
Parameter strong_equality     : N -> N -> Prop.
Parameter D7                  : forall a b, strong_equality a b ≡≡ ((¬forall G, ¬(G ε a)) ∧
forall G, (G ε a) ≡≡ (G ε b)).   (* D7 *)
Parameter weak_inclusion      : N -> N -> Prop.
Parameter D8                  : forall a b, weak_inclusion a b ≡≡ forall A, (A ε a) ⊃ (A ε b).      (* D8 *)
Parameter strong_inclusion    : N -> N -> Prop.
Parameter D9                  : forall a b, strong_inclusion a b ≡≡ (¬forall A, ¬(A ε a)) ∧ (forall C, C ε a ⊃ C ε b).    (* D9 *)
Parameter partial_inclusion   : N -> N -> Prop.
Parameter D10                 : forall a b, partial_inclusion a b ≡≡ ¬forall G, ¬(G ε a ∧ G ε b).   (* D10 *)
Parameter empty               : N.
Parameter D13                 : forall A, A ε empty ≡≡ (A ε A ∧ ¬(A ε A)).                          (* D13 *)
Parameter universal           : N.
Parameter D14                 : forall A, A ε universal ≡≡ (A ε A).                                 (* D14 *)
Parameter distinct            : N -> N.
Parameter D15                 : forall A b, A ε (distinct b) ≡≡ (A ε A ∧ ¬(A ε b)).                 (* D15 *)
Parameter meet                : N -> N -> N.
Parameter D16                 : forall A a b,  A ε (meet a b) ≡≡ (A ε A ∧ A ε a ∧ A ε b).           (* D16 *)
(* =========================== ONTOLOGICAL THEOREMS =============================== *)
Class Antisymmetric  (R:relation N) :=
antisymmetry : forall a b, R a b ∧ R b a ⊃ singular_equality a b.
Class Reflexive  (R:relation N) :=
reflexivity : forall A, A ε A ⊃ R A A.
Class Transitive  (R:relation N) :=
transitivity : forall A B C, R A B ∧ R B C ⊃ R A C.
Class POrder (R:relation N) := {
por_refl    :> Reflexive R;
por_antisym :> Antisymmetric R;
por_trans   :> Transitive R}.
(* =================================================================== *)
(* If A is something, then A is a singular *)
(* characteristic thesis of the ontology  *)
(* contradictory name *)
(* empty name is not a singular *)
(* it is false that any name is a singular - creativity *)
(*===============================================================*)
(********************* 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 eq_N       : N -> N -> Prop.
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.
(*============================================================*)
(* ====================== MEREOLOGICAL DEFINITIONS & AXIOMS ============================= *)
Parameter pt       : Morphism_N_N.
Parameter el       : Morphism_N_N.
Parameter Kl       : Morphism_N_N.
Parameter coll     : N -> N.
Parameter subcoll  : N -> N.
Parameter ext      : N -> N.
Parameter compl    : N -> N -> N.
Parameter ov       : N -> N.
Parameter union    : N -> N -> N.
Parameter discrete : N -> Prop.
Parameter U        : N.
Parameter MD2                : forall A a, A ε Kl a ≡≡ (A ε A ∧
(¬forall B, ¬(B ε a)) ∧
(forall B, (B ε a ⊃ B ε el A)) ∧
(forall B, B ε el A ⊃ ¬forall C D, ¬((C ε a) ∧ (D ε el C) ∧ (D ε el B)))).
(* P is a collection of a *)
Parameter MD3                : forall P a, P ε coll a ≡≡ (P ε P ∧ forall Q, Q ε el P ⊃ ¬forall C D,
¬(C ε a ∧ C ε el P ∧ D ε el C ∧ D ε el Q)).
(* P is a sub-collection of Q *)
Parameter MD4                : forall P Q, P ε subcoll Q ≡≡ (P ε P ∧ forall C, (C ε el P ⊃ C ε el Q)).
(* P is a external to Q *)
Parameter MD5                : forall P Q, P ε ext Q ≡≡ (P ε P ∧ forall C, ¬(C ε el P ∧ C ε el Q)).
(* P is a complement of Q relative to collection R *)
Parameter MD6                : forall P Q R, P ε compl Q R ≡≡ (P ε P ∧ Q ε subcoll R ∧ P ε (Kl (meet (el R)(ext Q)))).
(* P and Q overlap *)
Parameter MD7                : forall P Q, P ε ov Q ≡≡ (P ε P ∧ ¬forall C, ¬(C ε el P ∧ C ε el Q)).
(* The a's are discrete  *)
Parameter MD8                : forall a, discrete a ≡≡ forall P Q, (P ε a ∧ Q ε a) ⊃ singular_equality P Q ∨ P ε ext Q. (*MD8*)
(* A is the universe *)
Parameter MD9                : forall A, A ε U ≡≡ (A ε Kl universal).
(* A belongs to the union of a and b *)
Parameter MD10               : forall A a b, A ε (union a b) ≡≡ (A ε A ∧ (A ε a ∨ A ε b)).
(* =========================== Eliminations for complex existentials  ========================== *)
(* =========================== MEREOLOGICAL THEOREMS ========================== *)
(* Lemma MereoT20 : forall A B C, A ε el B /\ B ε el C -> A ε el C. --> Lemma Transitive_Element_of *)
(* Lemma MereoT21 : forall A, A ε A -> A ε el A.  --> Lemma Reflexive_Element_of Cf. MereoT7 *)
(* Theorems 26 and 27 show that in mereology, the class of a and the class of the class of a stand for the same object, which is in contrast with set theory *)
(* identical classes do not yield identical plurals a and b *)
(********************* De Morgan  ****************************)
(* if A is element of B, then the extension of elements of A is included into the extension of elements of B *)

Lemma MereoT45 : forall A B, A ε el B ⊃ weak_inclusion (el A) (el B). (* TM19 *)