]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/ground_2/star.ma
- degree assignment, static type assignment, iterated static type
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / star.ma
index 431ef80a8af7ca851d3bd773459bba3b34735657..8345cbe42ac0d0cf72756ea2059a278306672389 100644 (file)
@@ -35,6 +35,18 @@ definition bi_confluent:  ∀A,B. ∀R: bi_relation A B. Prop ≝ λA,B,R.
                           ∀a0,a1,b0,b1. R a0 b0 a1 b1 → ∀a2,b2. R a0 b0 a2 b2 →
                           ∃∃a,b. R a1 b1 a b & R a2 b2 a b.
 
+definition LTC: ∀A:Type[0]. ∀B. (A→relation B) → (A→relation B) ≝
+                λA,B,R,a. TC … (R a).
+
+definition lsub_trans: ∀A,B. relation2 (A→relation B) (relation A) ≝ λA,B,R1,R2.
+                       ∀L2,T1,T2. R1 L2 T1 T2 → ∀L1. R2 L1 L2 → R1 L1 T1 T2.
+
+definition s_r_trans: ∀A,B. relation2 (A→relation B) (relation A) ≝ λA,B,R1,R2.
+                      ∀L2,T1,T2. R1 L2 T1 T2 → ∀L1. R2 L1 L2 → LTC … R1 L1 T1 T2.
+
+definition s_rs_trans: ∀A,B. relation2 (A→relation B) (relation A) ≝ λA,B,R1,R2.
+                       ∀L2,T1,T2. LTC … R1 L2 T1 T2 → ∀L1. R2 L1 L2 → LTC … R1 L1 T1 T2.
+
 lemma TC_strip1: ∀A,R1,R2. confluent2 A R1 R2 →
                  ∀a0,a1. TC … R1 a0 a1 → ∀a2. R2 a0 a2 →
                  ∃∃a. R2 a1 a & TC … R1 a2 a.
@@ -108,6 +120,10 @@ qed.
 definition NF: ∀A. relation A → relation A → predicate A ≝
    λA,R,S,a1. ∀a2. R a1 a2 → S a2 a1.
 
+definition NF_dec: ∀A. relation A → relation A → Prop ≝
+                   λA,R,S. ∀a1. NF A R S a1 ∨
+                   ∃∃a2. R … a1 a2 & (S a2 a1 → ⊥).
+
 inductive SN (A) (R,S:relation A): predicate A ≝
 | SN_intro: ∀a1. (∀a2. R a1 a2 → (S a2 a1 → ⊥) → SN A R S a2) → SN A R S a1
 .
@@ -115,9 +131,17 @@ inductive SN (A) (R,S:relation A): predicate A ≝
 lemma NF_to_SN: ∀A,R,S,a. NF A R S a → SN A R S a.
 #A #R #S #a1 #Ha1
 @SN_intro #a2 #HRa12 #HSa12
-elim (HSa12 ?) -HSa12 /2 width=1/
+elim HSa12 -HSa12 /2 width=1/
 qed.
 
+lemma SN_to_NF: ∀A,R,S. NF_dec A R S →
+                ∀a1. SN A R S a1 →
+                ∃∃a2. star … R a1 a2 & NF A R S a2.
+#A #R #S #HRS #a1 #H elim H -a1
+#a1 #_ #IHa1 elim (HRS a1) -HRS /2 width=3/
+* #a0 #Ha10 #Ha01 elim (IHa1 … Ha10 Ha01) -IHa1 -Ha01 /3 width=3/
+qed-.
+
 definition NF_sn: ∀A. relation A → relation A → predicate A ≝
    λA,R,S,a2. ∀a1. R a1 a2 → S a2 a1.
 
@@ -128,9 +152,27 @@ inductive SN_sn (A) (R,S:relation A): predicate A ≝
 lemma NF_to_SN_sn: ∀A,R,S,a. NF_sn A R S a → SN_sn A R S a.
 #A #R #S #a2 #Ha2
 @SN_sn_intro #a1 #HRa12 #HSa12
-elim (HSa12 ?) -HSa12 /2 width=1/
+elim HSa12 -HSa12 /2 width=1/
 qed.
 
+lemma TC_lsub_trans: ∀A,B,R,S. lsub_trans A B R S → lsub_trans A B (LTC … R) S.
+#A #B #R #S #HRS #L2 #T1 #T2 #H elim H -T2 [ /3 width=3/ ]
+#T #T2 #_ #HT2 #IHT1 #L1 #HL12
+lapply (HRS … HT2 … HL12) -HRS -HT2 /3 width=3/
+qed-.
+
+lemma s_r_trans_TC1: ∀A,B,R,S. s_r_trans A B R S → s_rs_trans A B R S.
+#A #B #R #S #HRS #L2 #T1 #T2 #H elim H -T2 [ /3 width=3/ ]
+#T #T2 #_ #HT2 #IHT1 #L1 #HL12
+lapply (HRS … HT2 … HL12) -HRS -HT2 /3 width=3/
+qed-.
+
+lemma s_r_trans_TC2: ∀A,B,R,S. s_rs_trans A B R S → s_r_trans A B R (TC … S).
+#A #B #R #S #HRS #L2 #T1 #T2 #HT12 #L1 #H @(TC_ind_dx … L1 H) -L1 /2 width=3/ /3 width=3/
+qed-.
+
+(* relations on unboxed pairs ***********************************************)
+
 lemma bi_TC_strip: ∀A,B,R. bi_confluent A B R →
                    ∀a0,a1,b0,b1. R a0 b0 a1 b1 → ∀a2,b2. bi_TC … R a0 b0 a2 b2 →
                    ∃∃a,b. bi_TC … R a1 b1 a b & R a2 b2 a b.
@@ -164,8 +206,95 @@ lemma bi_TC_decomp_l: ∀A,B. ∀R:bi_relation A B.
                       ∀a1,a2,b1,b2. bi_TC … R a1 b1 a2 b2 →
                       R a1 b1 a2 b2 ∨
                       ∃∃a,b. R a1 b1 a b & bi_TC … R a b a2 b2.
-#A #B #R #a1 #a2 #b1 #b2 #H @(bi_TC_ind_dx ?????????? H) -a1 -b1
+#A #B #R #a1 #a2 #b1 #b2 #H @(bi_TC_ind_dx … a1 b1 H) -a1 -b1
 [ /2 width=1/
 | #a1 #a #b1 #b #Hab1 #Hab2 #_ /3 width=4/
 ]
 qed-.
+
+(* relations on unboxed triples *********************************************)
+
+definition tri_RC: ∀A,B,C. tri_relation A B C → tri_relation A B C ≝
+                   λA,B,C,R,a1,b1,c1,a2,b2,c2. R … a1 b1 c1 a2 b2 c2 ∨
+                   ∧∧ a1 = a2 & b1 = b2 & c1 = c2.
+
+lemma tri_RC_reflexive: ∀A,B,C,R. tri_reflexive A B C (tri_RC … R).
+/3 width=1/ qed.
+
+definition tri_star: ∀A,B,C,R. tri_relation A B C ≝
+                     λA,B,C,R. tri_RC A B C (tri_TC … R).
+
+lemma tri_star_tri_reflexive: ∀A,B,C,R. tri_reflexive A B C (tri_star … R).
+/2 width=1/ qed.
+
+lemma tri_TC_to_tri_star: ∀A,B,C,R,a1,b1,c1,a2,b2,c2.
+                          tri_TC A B C R a1 b1 c1 a2 b2 c2 →
+                          tri_star A B C R a1 b1 c1 a2 b2 c2.
+/2 width=1/ qed.
+
+lemma tri_R_to_tri_star: ∀A,B,C,R,a1,b1,c1,a2,b2,c2.
+                         R a1 b1 c1 a2 b2 c2 → tri_star A B C R a1 b1 c1 a2 b2 c2.
+/3 width=1/ qed.
+
+lemma tri_star_strap1: ∀A,B,C,R,a1,a,a2,b1,b,b2,c1,c,c2.
+                       tri_star A B C R a1 b1 c1 a b c →
+                       R a b c a2 b2 c2 → tri_star A B C R a1 b1 c1 a2 b2 c2.
+#A #B #C #R #a1 #a #a2 #b1 #b #b2 #c1 #c #c2 *
+[ /3 width=5/
+| * #H1 #H2 #H3 destruct /2 width=1/
+]
+qed.
+
+lemma tri_star_strap2: ∀A,B,C,R,a1,a,a2,b1,b,b2,c1,c,c2. R a1 b1 c1 a b c →
+                       tri_star A B C R a b c a2 b2 c2 →
+                       tri_star A B C R a1 b1 c1 a2 b2 c2.
+#A #B #C #R #a1 #a #a2 #b1 #b #b2 #c1 #c #c2 #H *
+[ /3 width=5/
+| * #H1 #H2 #H3 destruct /2 width=1/
+]
+qed.
+
+lemma tri_star_to_tri_TC_to_tri_TC: ∀A,B,C,R,a1,a,a2,b1,b,b2,c1,c,c2.
+                                    tri_star A B C R a1 b1 c1 a b c →
+                                    tri_TC A B C R a b c a2 b2 c2 →
+                                    tri_TC A B C R a1 b1 c1 a2 b2 c2.
+#A #B #C #R #a1 #a #a2 #b1 #b #b2 #c1 #c #c2 *
+[ /2 width=5/
+| * #H1 #H2 #H3 destruct /2 width=1/
+]
+qed.
+
+lemma tri_TC_to_tri_star_to_tri_TC: ∀A,B,C,R,a1,a,a2,b1,b,b2,c1,c,c2.
+                                    tri_TC A B C R a1 b1 c1 a b c →
+                                    tri_star A B C R a b c a2 b2 c2 →
+                                    tri_TC A B C R a1 b1 c1 a2 b2 c2.
+#A #B #C #R #a1 #a #a2 #b1 #b #b2 #c1 #c #c2 #H *
+[ /2 width=5/
+| * #H1 #H2 #H3 destruct /2 width=1/
+]
+qed.
+
+lemma tri_tansitive_tri_star: ∀A,B,C,R. tri_transitive A B C (tri_star … R).
+#A #B #C #R #a1 #a #b1 #b #c1 #c #H #a2 #b2 #c2 *
+[ /3 width=5/
+| * #H1 #H2 #H3 destruct /2 width=1/
+]
+qed.
+
+lemma tri_star_ind: ∀A,B,C,R,a1,b1,c1. ∀P:relation3 A B C. P a1 b1 c1 →
+                    (∀a,a2,b,b2,c,c2. tri_star … R a1 b1 c1 a b c → R a b c a2 b2 c2 → P a b c → P a2 b2 c2) →
+                    ∀a2,b2,c2. tri_star … R a1 b1 c1 a2 b2 c2 → P a2 b2 c2.
+#A #B #C #R #a1 #b1 #c1 #P #H #IH #a2 #b2 #c2 *
+[ #H12 elim H12 -a2 -b2 -c2 /2 width=6/ -H /3 width=6/
+| * #H1 #H2 #H3 destruct //
+]
+qed-.
+
+lemma tri_star_ind_dx: ∀A,B,C,R,a2,b2,c2. ∀P:relation3 A B C. P a2 b2 c2 →
+                       (∀a1,a,b1,b,c1,c. R a1 b1 c1 a b c → tri_star … R a b c a2 b2 c2 → P a b c → P a1 b1 c1) →
+                       ∀a1,b1,c1. tri_star … R a1 b1 c1 a2 b2 c2 → P a1 b1 c1.
+#A #B #C #R #a2 #b2 #c2 #P #H #IH #a1 #b1 #c1 *
+[ #H12 @(tri_TC_ind_dx … a1 b1 c1 H12) -a1 -b1 -c1 /2 width=6/ -H /3 width=6/
+| * #H1 #H2 #H3 destruct //
+]
+qed-.