]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/basic_2/reduction/cpr.ma
notational change of lift, drop, and gget
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / reduction / cpr.ma
index bbb13d14e0b2b4e72a6460757b787a7c10d0bc0b..dc92035250dbd4da6e9699e4949eb3f54c85c7cd 100644 (file)
@@ -13,8 +13,8 @@
 (**************************************************************************)
 
 include "basic_2/notation/relations/pred_4.ma".
-include "basic_2/grammar/genv.ma".
 include "basic_2/static/lsubr.ma".
+include "basic_2/unfold/lstas.ma".
 
 (* CONTEXT-SENSITIVE PARALLEL REDUCTION FOR TERMS ***************************)
 
@@ -24,8 +24,8 @@ include "basic_2/static/lsubr.ma".
 inductive cpr: relation4 genv lenv term term ≝
 | cpr_atom : ∀I,G,L. cpr G L (⓪{I}) (⓪{I})
 | cpr_delta: ∀G,L,K,V,V2,W2,i.
-             â\87©[i] L ≡ K. ⓓV → cpr G K V V2 →
-             â\87§[0, i + 1] V2 ≡ W2 → cpr G L (#i) W2
+             â¬\87[i] L ≡ K. ⓓV → cpr G K V V2 →
+             â¬\86[0, i + 1] V2 ≡ W2 → cpr G L (#i) W2
 | cpr_bind : ∀a,I,G,L,V1,V2,T1,T2.
              cpr G L V1 V2 → cpr G (L.ⓑ{I}V1) T1 T2 →
              cpr G L (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
@@ -33,13 +33,13 @@ inductive cpr: relation4 genv lenv term term ≝
              cpr G L V1 V2 → cpr G L T1 T2 →
              cpr G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
 | cpr_zeta : ∀G,L,V,T1,T,T2. cpr G (L.ⓓV) T1 T →
-             â\87§[0, 1] T2 ≡ T → cpr G L (+ⓓV.T1) T2
+             â¬\86[0, 1] T2 ≡ T → cpr G L (+ⓓV.T1) T2
 | cpr_eps  : ∀G,L,V,T1,T2. cpr G L T1 T2 → cpr G L (ⓝV.T1) T2
 | cpr_beta : ∀a,G,L,V1,V2,W1,W2,T1,T2.
              cpr G L V1 V2 → cpr G L W1 W2 → cpr G (L.ⓛW1) T1 T2 →
              cpr G L (ⓐV1.ⓛ{a}W1.T1) (ⓓ{a}ⓝW2.V2.T2)
 | cpr_theta: ∀a,G,L,V1,V,V2,W1,W2,T1,T2.
-             cpr G L V1 V â\86\92 â\87§[0, 1] V ≡ V2 → cpr G L W1 W2 → cpr G (L.ⓓW1) T1 T2 →
+             cpr G L V1 V â\86\92 â¬\86[0, 1] V ≡ V2 → cpr G L W1 W2 → cpr G (L.ⓓW1) T1 T2 →
              cpr G L (ⓐV1.ⓓ{a}W1.T1) (ⓓ{a}W2.ⓐV2.T2)
 .
 
@@ -52,11 +52,11 @@ lemma lsubr_cpr_trans: ∀G. lsub_trans … (cpr G) lsubr.
 #G #L1 #T1 #T2 #H elim H -G -L1 -T1 -T2
 [ //
 | #G #L1 #K1 #V1 #V2 #W2 #i #HLK1 #_ #HVW2 #IHV12 #L2 #HL12
-  elim (lsubr_fwd_ldrop2_abbr … HL12 … HLK1) -L1 *
+  elim (lsubr_fwd_drop2_abbr … HL12 … HLK1) -L1 *
   /3 width=6 by cpr_delta/
-|3,7: /4 width=1 by lsubr_bind, cpr_bind, cpr_beta/
+|3,7: /4 width=1 by lsubr_pair, cpr_bind, cpr_beta/
 |4,6: /3 width=1 by cpr_flat, cpr_eps/
-|5,8: /4 width=3 by lsubr_bind, cpr_zeta, cpr_theta/
+|5,8: /4 width=3 by lsubr_pair, cpr_zeta, cpr_theta/
 ]
 qed-.
 
@@ -76,8 +76,8 @@ lemma cpr_pair_sn: ∀I,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡ V2 →
                    ∀T. ⦃G, L⦄ ⊢ ②{I}V1.T ➡ ②{I}V2.T.
 * /2 width=1 by cpr_bind, cpr_flat/ qed.
 
-lemma cpr_delift: â\88\80G,K,V,T1,L,d. â\87©[d] L ≡ (K.ⓓV) →
-                  â\88\83â\88\83T2,T. â¦\83G, Lâ¦\84 â\8a¢ T1 â\9e¡ T2 & â\87§[d, 1] T ≡ T2.
+lemma cpr_delift: â\88\80G,K,V,T1,L,d. â¬\87[d] L ≡ (K.ⓓV) →
+                  â\88\83â\88\83T2,T. â¦\83G, Lâ¦\84 â\8a¢ T1 â\9e¡ T2 & â¬\86[d, 1] T ≡ T2.
 #G #K #V #T1 elim T1 -T1
 [ * /2 width=4 by cpr_atom, lift_sort, lift_gref, ex2_2_intro/
   #i #L #d #HLK elim (lt_or_eq_or_gt i d)
@@ -87,18 +87,32 @@ lemma cpr_delift: ∀G,K,V,T1,L,d. ⇩[d] L ≡ (K.ⓓV) →
   elim (lift_split … HVW i i) /3 width=6 by cpr_delta, ex2_2_intro/
 | * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #d #HLK
   elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
-  [ elim (IHU1 (L. ⓑ{I}W1) (d+1)) -IHU1 /3 width=9 by ldrop_drop, cpr_bind, lift_bind, ex2_2_intro/
+  [ elim (IHU1 (L. ⓑ{I}W1) (d+1)) -IHU1 /3 width=9 by drop_drop, cpr_bind, lift_bind, ex2_2_intro/
   | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpr_flat, lift_flat, ex2_2_intro/
   ]
 ]
 qed-.
 
+fact lstas_cpr_aux: ∀h,G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 •*[h, l] T2 →
+                    l = 0 → ⦃G, L⦄ ⊢ T1 ➡ T2.
+#h #G #L #T1 #T2 #l #H elim H -G -L -T1 -T2 -l
+/3 width=1 by cpr_eps, cpr_flat, cpr_bind/
+[ #G #L #l #k #H0 destruct normalize //
+| #G #L #K #V1 #V2 #W2 #i #l #HLK #_ #HVW2 #IHV12 #H destruct
+  /3 width=6 by cpr_delta/
+| #G #L #K #V1 #V2 #W2 #i #l #_ #_ #_ #_ <plus_n_Sm #H destruct
+]
+qed-.
+
+lemma lstas_cpr: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 •*[h, 0] T2 → ⦃G, L⦄ ⊢ T1 ➡ T2.
+/2 width=4 by lstas_cpr_aux/ qed.
+
 (* Basic inversion lemmas ***************************************************)
 
 fact cpr_inv_atom1_aux: ∀G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡ T2 → ∀I. T1 = ⓪{I} →
                         T2 = ⓪{I} ∨
-                        â\88\83â\88\83K,V,V2,i. â\87©[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
-                                    â\87§[O, i + 1] V2 ≡ T2 & I = LRef i.
+                        â\88\83â\88\83K,V,V2,i. â¬\87[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
+                                    â¬\86[O, i + 1] V2 ≡ T2 & I = LRef i.
 #G #L #T1 #T2 * -G -L -T1 -T2
 [ #I #G #L #J #H destruct /2 width=1 by or_introl/
 | #L #G #K #V #V2 #T2 #i #HLK #HV2 #HVT2 #J #H destruct /3 width=8 by ex4_4_intro, or_intror/
@@ -113,8 +127,8 @@ qed-.
 
 lemma cpr_inv_atom1: ∀I,G,L,T2. ⦃G, L⦄ ⊢ ⓪{I} ➡ T2 →
                      T2 = ⓪{I} ∨
-                     â\88\83â\88\83K,V,V2,i. â\87©[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
-                                 â\87§[O, i + 1] V2 ≡ T2 & I = LRef i.
+                     â\88\83â\88\83K,V,V2,i. â¬\87[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
+                                 â¬\86[O, i + 1] V2 ≡ T2 & I = LRef i.
 /2 width=3 by cpr_inv_atom1_aux/ qed-.
 
 (* Basic_1: includes: pr0_gen_sort pr2_gen_sort *)
@@ -127,8 +141,8 @@ qed-.
 (* Basic_1: includes: pr0_gen_lref pr2_gen_lref *)
 lemma cpr_inv_lref1: ∀G,L,T2,i. ⦃G, L⦄ ⊢ #i ➡ T2 →
                      T2 = #i ∨
-                     â\88\83â\88\83K,V,V2. â\87©[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
-                               â\87§[O, i + 1] V2 ≡ T2.
+                     â\88\83â\88\83K,V,V2. â¬\87[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
+                               â¬\86[O, i + 1] V2 ≡ T2.
 #G #L #T2 #i #H
 elim (cpr_inv_atom1 … H) -H /2 width=1 by or_introl/
 * #K #V #V2 #j #HLK #HV2 #HVT2 #H destruct /3 width=6 by ex3_3_intro, or_intror/
@@ -145,7 +159,7 @@ fact cpr_inv_bind1_aux: ∀G,L,U1,U2. ⦃G, L⦄ ⊢ U1 ➡ U2 →
                         ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡ T2 &
                                  U2 = ⓑ{a,I}V2.T2
                         ) ∨
-                        â\88\83â\88\83T. â¦\83G, L.â\93\93V1â¦\84 â\8a¢ T1 â\9e¡ T & â\87§[0, 1] U2 ≡ T &
+                        â\88\83â\88\83T. â¦\83G, L.â\93\93V1â¦\84 â\8a¢ T1 â\9e¡ T & â¬\86[0, 1] U2 ≡ T &
                              a = true & I = Abbr.
 #G #L #U1 #U2 * -L -U1 -U2
 [ #I #G #L #b #J #W1 #U1 #H destruct
@@ -163,7 +177,7 @@ lemma cpr_inv_bind1: ∀a,I,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡ U2 
                      ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡ T2 &
                               U2 = ⓑ{a,I}V2.T2
                      ) ∨
-                     â\88\83â\88\83T. â¦\83G, L.â\93\93V1â¦\84 â\8a¢ T1 â\9e¡ T & â\87§[0, 1] U2 ≡ T &
+                     â\88\83â\88\83T. â¦\83G, L.â\93\93V1â¦\84 â\8a¢ T1 â\9e¡ T & â¬\86[0, 1] U2 ≡ T &
                           a = true & I = Abbr.
 /2 width=3 by cpr_inv_bind1_aux/ qed-.
 
@@ -172,7 +186,7 @@ lemma cpr_inv_abbr1: ∀a,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓓ{a}V1.T1 ➡ U2 → (
                      ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L. ⓓV1⦄ ⊢ T1 ➡ T2 &
                               U2 = ⓓ{a}V2.T2
                      ) ∨
-                     â\88\83â\88\83T. â¦\83G, L.â\93\93V1â¦\84 â\8a¢ T1 â\9e¡ T & â\87§[0, 1] U2 ≡ T & a = true.
+                     â\88\83â\88\83T. â¦\83G, L.â\93\93V1â¦\84 â\8a¢ T1 â\9e¡ T & â¬\86[0, 1] U2 ≡ T & a = true.
 #a #G #L #V1 #T1 #U2 #H
 elim (cpr_inv_bind1 … H) -H *
 /3 width=5 by ex3_2_intro, ex3_intro, or_introl, or_intror/
@@ -197,7 +211,7 @@ fact cpr_inv_flat1_aux: ∀G,L,U,U2. ⦃G, L⦄ ⊢ U ➡ U2 →
                          | ∃∃a,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ W1 ➡ W2 &
                                                ⦃G, L.ⓛW1⦄ ⊢ T1 ➡ T2 & U1 = ⓛ{a}W1.T1 &
                                                U2 = ⓓ{a}ⓝW2.V2.T2 & I = Appl
-                         | â\88\83â\88\83a,V,V2,W1,W2,T1,T2. â¦\83G, Lâ¦\84 â\8a¢ V1 â\9e¡ V & â\87§[0,1] V ≡ V2 &
+                         | â\88\83â\88\83a,V,V2,W1,W2,T1,T2. â¦\83G, Lâ¦\84 â\8a¢ V1 â\9e¡ V & â¬\86[0,1] V ≡ V2 &
                                                  ⦃G, L⦄ ⊢ W1 ➡ W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ➡ T2 &
                                                  U1 = ⓓ{a}W1.T1 &
                                                  U2 = ⓓ{a}W2.ⓐV2.T2 & I = Appl.
@@ -220,7 +234,7 @@ lemma cpr_inv_flat1: ∀I,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓕ{I}V1.U1 ➡ U2 →
                       | ∃∃a,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ W1 ➡ W2 &
                                             ⦃G, L.ⓛW1⦄ ⊢ T1 ➡ T2 & U1 = ⓛ{a}W1.T1 &
                                             U2 = ⓓ{a}ⓝW2.V2.T2 & I = Appl
-                      | â\88\83â\88\83a,V,V2,W1,W2,T1,T2. â¦\83G, Lâ¦\84 â\8a¢ V1 â\9e¡ V & â\87§[0,1] V ≡ V2 &
+                      | â\88\83â\88\83a,V,V2,W1,W2,T1,T2. â¦\83G, Lâ¦\84 â\8a¢ V1 â\9e¡ V & â¬\86[0,1] V ≡ V2 &
                                               ⦃G, L⦄ ⊢ W1 ➡ W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ➡ T2 &
                                               U1 = ⓓ{a}W1.T1 &
                                               U2 = ⓓ{a}W2.ⓐV2.T2 & I = Appl.
@@ -233,7 +247,7 @@ lemma cpr_inv_appl1: ∀G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓐV1.U1 ➡ U2 →
                       | ∃∃a,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ W1 ➡ W2 &
                                             ⦃G, L.ⓛW1⦄ ⊢ T1 ➡ T2 &
                                             U1 = ⓛ{a}W1.T1 & U2 = ⓓ{a}ⓝW2.V2.T2
-                      | â\88\83â\88\83a,V,V2,W1,W2,T1,T2. â¦\83G, Lâ¦\84 â\8a¢ V1 â\9e¡ V & â\87§[0,1] V ≡ V2 &
+                      | â\88\83â\88\83a,V,V2,W1,W2,T1,T2. â¦\83G, Lâ¦\84 â\8a¢ V1 â\9e¡ V & â¬\86[0,1] V ≡ V2 &
                                               ⦃G, L⦄ ⊢ W1 ➡ W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ➡ T2 &
                                               U1 = ⓓ{a}W1.T1 & U2 = ⓓ{a}W2.ⓐV2.T2.
 #G #L #V1 #U1 #U2 #H elim (cpr_inv_flat1 … H) -H *