X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Flib%2Fbasics%2Frelations.ma;h=8b6a79be5deec90a9f7820287174045f277bb533;hb=0460fd3dc2909efe0baa6592281d0cf0527165ff;hp=a1bae198b707723b66f5ba16db61ac1cac58deab;hpb=24fc5e5485245fe879e17d46176530b688930b3b;p=helm.git diff --git a/matita/matita/lib/basics/relations.ma b/matita/matita/lib/basics/relations.ma index a1bae198b..8b6a79be5 100644 --- a/matita/matita/lib/basics/relations.ma +++ b/matita/matita/lib/basics/relations.ma @@ -11,10 +11,18 @@ include "basics/logic.ma". +(********** predicates *********) + +definition predicate: Type[0] → Type[0] +≝ λA.A→Prop. + (********** relations **********) definition relation : Type[0] → Type[0] ≝ λA.A→A→Prop. +definition relation2 : Type[0] → Type[0] → Type[0] +≝ λA,B.A→B→Prop. + definition reflexive: ∀A.∀R :relation A.Prop ≝ λA.λR.∀x:A.R x x. @@ -37,7 +45,44 @@ definition tight_apart: ∀A.∀eq,ap:relation A.Prop definition antisymmetric: ∀A.∀R:relation A.Prop ≝ λA.λR.∀x,y:A. R x y → ¬(R y x). -(********** functions **********) +(********** operations **********) +definition Rcomp ≝ λA.λR1,R2:relation A.λa1,a2. + ∃am.R1 a1 am ∧ R2 am a2. +interpretation "relation composition" 'compose R1 R2 = (Rcomp ? R1 R2). + +definition Runion ≝ λA.λR1,R2:relation A.λa,b. R1 a b ∨ R2 a b. +interpretation "union of relations" 'union R1 R2 = (Runion ? R1 R2). + +definition Rintersection ≝ λA.λR1,R2:relation A.λa,b.R1 a b ∧ R2 a b. +interpretation "interesecion of relations" 'intersects R1 R2 = (Rintersection ? R1 R2). + +definition inv ≝ λA.λR:relation A.λa,b.R b a. + +(*********** sub relation ***********) +definition subR ≝ λA.λR,S:relation A.(∀a,b. R a b → S a b). +interpretation "relation inclusion" 'subseteq R S = (subR ? R S). + +lemma sub_comp_l: ∀A.∀R,R1,R2:relation A. + R1 ⊆ R2 → R1 ∘ R ⊆ R2 ∘ R. +#A #R #R1 #R2 #Hsub #a #b * #c * /4/ +qed. + +lemma sub_comp_r: ∀A.∀R,R1,R2:relation A. + R1 ⊆ R2 → R ∘ R1 ⊆ R ∘ R2. +#A #R #R1 #R2 #Hsub #a #b * #c * /4/ +qed. + +lemma sub_assoc_l: ∀A.∀R1,R2,R3:relation A. + R1 ∘ (R2 ∘ R3) ⊆ (R1 ∘ R2) ∘ R3. +#A #R1 #R2 #R3 #a #b * #c * #Hac * #d * /5/ +qed. + +lemma sub_assoc_r: ∀A.∀R1,R2,R3:relation A. + (R1 ∘ R2) ∘ R3 ⊆ R1 ∘ (R2 ∘ R3). +#A #R1 #R2 #R3 #a #b * #c * * #d * /5 width=5/ +qed. + +(************* functions ************) definition compose ≝ λA,B,C:Type[0].λf:B→C.λg:A→B.λx:A.f (g x).