X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Flib%2Fbasics%2Frelations.ma;h=9da779ee45db629c6994b682d7852c011e553701;hb=3a4509b8e569181979f5b15808361c83eb1ae49a;hp=8b746ef6896d4f58bb4efa17728a27b7f8bba0e7;hpb=5e24c923ea53c31c3e167c4ff7851877ded646c1;p=helm.git diff --git a/matita/matita/lib/basics/relations.ma b/matita/matita/lib/basics/relations.ma index 8b746ef68..9da779ee4 100644 --- a/matita/matita/lib/basics/relations.ma +++ b/matita/matita/lib/basics/relations.ma @@ -10,6 +10,8 @@ V_______________________________________________________________ *) include "basics/logic.ma". +include "basics/core_notation/compose_2.ma". +include "basics/core_notation/subseteq_2.ma". (********** predicates *********) @@ -26,6 +28,9 @@ definition relation2 : Type[0] → Type[0] → Type[0] definition relation3 : Type[0] → Type[0] → Type[0] → Type[0] ≝ λA,B,C.A→B→C→Prop. +definition relation4 : Type[0] → Type[0] → Type[0] → Type[0] → Type[0] +≝ λA,B,C,D.A→B→C→D→Prop. + definition reflexive: ∀A.∀R :relation A.Prop ≝ λA.λR.∀x:A.R x x. @@ -51,6 +56,17 @@ definition antisymmetric: ∀A.∀R:relation A.Prop definition singlevalued: ∀A,B. predicate (relation2 A B) ≝ λA,B,R. ∀a,b1. R a b1 → ∀b2. R a b2 → b1 = b2. +definition pw_confluent: ∀A. relation A → predicate A ≝ λA,R,a0. + ∀a1. R a0 a1 → ∀a2. R a0 a2 → + ∃∃a. R a1 a & R a2 a. + +definition confluent: ∀A. predicate (relation A) ≝ λA,R. + ∀a0. pw_confluent … R a0. + +(* triangular confluence of two relations *) +definition Conf3: ∀A,B. relation2 A B → relation A → Prop ≝ λA,B,S,R. + ∀b,a1. S a1 b → ∀a2. R a1 a2 → S a2 b. + (* Reflexive closure ************) definition RC: ∀A:Type[0]. relation A → relation A ≝ @@ -176,7 +192,7 @@ definition bi_relation: Type[0] → Type[0] → Type[0] ≝ λA,B.A→B→A→B→Prop. definition bi_reflexive: ∀A,B. ∀R:bi_relation A B. Prop -≝ λA,B,R. ∀x,y. R x y x y. +≝ λA,B,R. ∀a,b. R a b a b. definition bi_symmetric: ∀A,B. ∀R: bi_relation A B. Prop ≝ λA,B,R. ∀a1,a2,b1,b2. R a2 b2 a1 b1 → R a1 b1 a2 b2. @@ -184,3 +200,25 @@ definition bi_symmetric: ∀A,B. ∀R: bi_relation A B. Prop ≝ λA,B,R. definition bi_transitive: ∀A,B. ∀R: bi_relation A B. Prop ≝ λA,B,R. ∀a1,a,b1,b. R a1 b1 a b → ∀a2,b2. R a b a2 b2 → R a1 b1 a2 b2. + +definition bi_RC: ∀A,B:Type[0]. bi_relation A B → bi_relation A B ≝ + λA,B,R,a1,b1,a2,b2. R … a1 b1 a2 b2 ∨ (a1 = a2 ∧ b1 = b2). + +lemma bi_RC_reflexive: ∀A,B,R. bi_reflexive A B (bi_RC … R). +/3 width=1/ qed. + +(********** relations on unboxed triples **********) + +definition tri_relation: Type[0] → Type[0] → Type[0] → Type[0] +≝ λA,B,C.A→B→C→A→B→C→Prop. + +definition tri_reflexive: ∀A,B,C. ∀R:tri_relation A B C. Prop +≝ λA,B,C,R. ∀a,b,c. R a b c a b c. + +definition tri_symmetric: ∀A,B,C. ∀R: tri_relation A B C. Prop ≝ λA,B,C,R. + ∀a1,a2,b1,b2,c1,c2. + R a2 b2 c2 a1 b1 c1 → R a1 b1 c1 a2 b2 c2. + +definition tri_transitive: ∀A,B,C. ∀R: tri_relation A B C. Prop ≝ λA,B,C,R. + ∀a1,a,b1,b,c1,c. R a1 b1 c1 a b c → + ∀a2,b2,c2. R a b c a2 b2 c2 → R a1 b1 c1 a2 b2 c2.