]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/basic_2A/etc/llpx_sn/llpx_sn_tc.etc
milestone update in ground_2 and basic_2A
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / etc / llpx_sn / llpx_sn_tc.etc
diff --git a/matita/matita/contribs/lambdadelta/basic_2A/etc/llpx_sn/llpx_sn_tc.etc b/matita/matita/contribs/lambdadelta/basic_2A/etc/llpx_sn/llpx_sn_tc.etc
new file mode 100644 (file)
index 0000000..682b48c
--- /dev/null
@@ -0,0 +1,160 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "basic_2/relocation/ldrop_leq.ma".
+include "basic_2/relocation/llpx_sn.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+definition TC_llpx_sn_confluent1: relation (relation3 lenv term term) ≝ λS,R.
+                                  ∀Ls,T1,T2. S Ls T1 T2 →
+                                  ∀Ld. TC … (llpx_sn R 0 T1) Ls Ld → TC … (llpx_sn R 0 T2) Ls Ld.
+
+lemma TC_llpx_sn_s_confluent: ∀S,R. (llpx_sn_confluent1 S R) → TC_llpx_sn_confluent1 S R.
+#S #R #HSR #Ls #T1 #T2 #HT12 #Ld #H
+generalize in match HT12; -HT12
+@(TC_ind_dx … Ls H) -Ls
+[ /3 width=3 by inj/
+| #Ls #L #HLs #_ #IHLd #HT12
+  @(TC_strap … L) /2 width=3 by/ @IHLd -IHLd
+
+lemma TC_llpx_sn_lref_refl: ∀R. (∀L.reflexive … (R L)) →
+                            ∀I,L1,K1,K2,V,d,i. d ≤ yinj i → ⇩[i] L1 ≡ K1.ⓑ{I}V →
+                            TC lenv (llpx_sn R 0 V) K1 K2 →
+                            ∀L2. ⇩[i] L2 ≡ K2.ⓑ{I}V → TC … (llpx_sn R d (#i)) L1 L2.
+#R #HR #I #L1 #K1 #K2 #V #d #i #Hdi #HLK1 #H @(TC_star_ind … K2 H) -K2
+[ /2 width=1 by llpx_sn_refl/
+| /4 width=9 by llpx_sn_refl, llpx_sn_lref, inj/
+| #K #K2 #_ #HV #IHK1 #L2 #HLK2 lapply (ldrop_fwd_length … HLK2)
+  #H elim (ldrop_O1_ex (K.ⓑ{I}V) i L2) [2: normalize in H ⊢ %; >(llpx_sn_fwd_length … HV) ]
+  /4 width=11 by llpx_sn_lref, step/
+]
+qed-.
+
+lemma TC_llpx_sn_lref: ∀R. (∀L.reflexive … (R L)) → (llpx_sn_confluent1 R R) →
+                       ∀I,K1,V1,V2,d,i. d ≤ yinj i → LTC … R K1 V1 V2 →
+                       ∀K2. TC lenv (llpx_sn R 0 V1) K1 K2 → ∀L1. ⇩[i] L1 ≡ K1.ⓑ{I}V1 →
+                       ∀L2. ⇩[i] L2 ≡ K2.ⓑ{I}V2 → TC … (llpx_sn R d (#i)) L1 L2.
+#R #H1R #H2R #I #K1 #V1 #V2 #d #i #Hdi #H @(TC_star_ind_dx … V1 H) -V1
+[ /2 width=1 by llpx_sn_refl/
+| /2 width=7 by TC_llpx_sn_lref_refl/
+| #V1 #V #HV1 #_ #IHV2 #K2 #HK12 #L1 #HLK1 #L2 #HLK2
+  lapply (ldrop_fwd_length … HLK1)
+  #H elim (ldrop_O1_ex (K1.ⓑ{I}V) i L1) [2: normalize in H ⊢ %; // ] -H
+  #L #_ #HLK @(TC_strap … L)
+  [ @(llpx_sn_lref … HLK1 … HLK) /2 width=1 by llpx_sn_refl/
+  | @(IHV2 … HLK … HLK2)
+    -HLK1 -HLK2 -HLK -IHV2 -Hdi @(TC_llpx_sn_s_confluent R R … HK12) //
+  ]
+]
+
+
+lemma llpx_sn_LTC_TC_llpx_sn: ∀R. (∀L. reflexive … (R L)) →
+                              ∀L1,L2,T,d. llpx_sn (LTC … R) d T L1 L2 →
+                              TC … (llpx_sn R d T) L1 L2.
+#R #HR #L1 #L2 #T #d #H elim H -L1 -L2
+/3 width=3 by llpx_sn_gref, llpx_sn_free, llpx_sn_skip, llpx_sn_sort, inj/
+[ #I #L1 #L2 #K1 #K2 #V1 #V2 #d #i #Hdi #HLK1 #HLK2 #_ #HV12 #IHV1   
+
+(* Properties on transitive_closure *****************************************)
+
+lemma TC_lpx_sn_pair: ∀R. (∀L. reflexive … (R L)) →
+                      ∀I,L1,L2. TC … (lpx_sn R) L1 L2 →
+                      ∀V1,V2. LTC … R L1 V1 V2 →
+                      TC … (lpx_sn R) (L1. ⓑ{I} V1) (L2. ⓑ{I} V2).
+#R #HR #I #L1 #L2 #HL12 #V1 #V2 #H @(TC_star_ind_dx … V1 H) -V1 //
+[ /2 width=1 by TC_lpx_sn_pair_refl/
+| /4 width=3 by TC_strap, lpx_sn_pair, lpx_sn_refl/
+]
+qed-.
+
+lemma lpx_sn_LTC_TC_lpx_sn: ∀R. (∀L. reflexive … (R L)) →
+                            ∀L1,L2. lpx_sn (LTC … R) L1 L2 →
+                            TC … (lpx_sn R) L1 L2.
+#R #HR #L1 #L2 #H elim H -L1 -L2
+/2 width=1 by TC_lpx_sn_pair, lpx_sn_atom, inj/
+qed-.
+
+(* Inversion lemmas on transitive closure ***********************************)
+
+lemma TC_lpx_sn_inv_atom2: ∀R,L1. TC … (lpx_sn R) L1 (⋆) → L1 = ⋆.
+#R #L1 #H @(TC_ind_dx … L1 H) -L1
+[ /2 width=2 by lpx_sn_inv_atom2/
+| #L1 #L #HL1 #_ #IHL2 destruct /2 width=2 by lpx_sn_inv_atom2/
+]
+qed-.
+
+lemma TC_lpx_sn_inv_pair2: ∀R. s_rs_trans … R (lpx_sn R) →
+                           ∀I,L1,K2,V2. TC  … (lpx_sn R) L1 (K2.ⓑ{I}V2) →
+                           ∃∃K1,V1. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L1 = K1. ⓑ{I} V1.
+#R #HR #I #L1 #K2 #V2 #H @(TC_ind_dx … L1 H) -L1
+[ #L1 #H elim (lpx_sn_inv_pair2 … H) -H /3 width=5 by inj, ex3_2_intro/
+| #L1 #L #HL1 #_ * #K #V #HK2 #HV2 #H destruct
+  elim (lpx_sn_inv_pair2 … HL1) -HL1 #K1 #V1 #HK1 #HV1 #H destruct
+  lapply (HR … HV2 … HK1) -HR -HV2 /3 width=5 by TC_strap, ex3_2_intro/
+]
+qed-.
+
+lemma TC_lpx_sn_ind: ∀R. s_rs_trans … R (lpx_sn R) →
+                     ∀S:relation lenv.
+                     S (⋆) (⋆) → (
+                        ∀I,K1,K2,V1,V2.
+                        TC … (lpx_sn R) K1 K2 → LTC … R K1 V1 V2 →
+                        S K1 K2 → S (K1.ⓑ{I}V1) (K2.ⓑ{I}V2)
+                     ) →
+                     ∀L2,L1. TC … (lpx_sn R) L1 L2 → S L1 L2.
+#R #HR #S #IH1 #IH2 #L2 elim L2 -L2
+[ #X #H >(TC_lpx_sn_inv_atom2 … H) -X //
+| #L2 #I #V2 #IHL2 #X #H
+  elim (TC_lpx_sn_inv_pair2 … H) // -H -HR
+  #L1 #V1 #HL12 #HV12 #H destruct /3 width=1 by/
+]
+qed-.
+
+lemma TC_lpx_sn_inv_atom1: ∀R,L2. TC … (lpx_sn R) (⋆) L2 → L2 = ⋆.
+#R #L2 #H elim H -L2
+[ /2 width=2 by lpx_sn_inv_atom1/
+| #L #L2 #_ #HL2 #IHL1 destruct /2 width=2 by lpx_sn_inv_atom1/
+]
+qed-.
+
+fact TC_lpx_sn_inv_pair1_aux: ∀R. s_rs_trans … R (lpx_sn R) →
+                              ∀L1,L2. TC … (lpx_sn R) L1 L2 →
+                              ∀I,K1,V1. L1 = K1.ⓑ{I}V1 →
+                              ∃∃K2,V2. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
+#R #HR #L1 #L2 #H @(TC_lpx_sn_ind … H) // -HR -L1 -L2
+[ #J #K #W #H destruct
+| #I #L1 #L2 #V1 #V2 #HL12 #HV12 #_ #J #K #W #H destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma TC_lpx_sn_inv_pair1: ∀R. s_rs_trans … R (lpx_sn R) →
+                           ∀I,K1,L2,V1. TC … (lpx_sn R) (K1.ⓑ{I}V1) L2 →
+                           ∃∃K2,V2. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
+/2 width=3 by TC_lpx_sn_inv_pair1_aux/ qed-.
+
+lemma TC_lpx_sn_inv_lpx_sn_LTC: ∀R. s_rs_trans … R (lpx_sn R) →
+                                ∀L1,L2. TC … (lpx_sn R) L1 L2 →
+                                lpx_sn (LTC … R) L1 L2.
+/3 width=4 by TC_lpx_sn_ind, lpx_sn_pair/ qed-.
+
+(* Forward lemmas on transitive closure *************************************)
+
+lemma TC_lpx_sn_fwd_length: ∀R,L1,L2. TC … (lpx_sn R) L1 L2 → |L1| = |L2|.
+#R #L1 #L2 #H elim H -L2
+[ #L2 #HL12 >(lpx_sn_fwd_length … HL12) -HL12 //
+| #L #L2 #_ #HL2 #IHL1
+  >IHL1 -L1 >(lpx_sn_fwd_length … HL2) -HL2 //
+]
+qed-.