]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/basic_2/rt_computation/cpxs.ma
milestone update in basic_2, update in ground and static_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_computation / cpxs.ma
index d21a9042710095a8e18dc330a738be00764eef94..a8afc2c236d8c458b705d60e4cd9b6f2b9ee7138 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
-include "basic_2/notation/relations/predstar_6.ma".
-include "basic_2/reduction/cnx.ma".
-include "basic_2/computation/cprs.ma".
+include "ground/lib/star.ma".
+include "basic_2/notation/relations/predtystar_4.ma".
+include "basic_2/rt_transition/cpx.ma".
 
-(* CONTEXT-SENSITIVE EXTENDED PARALLEL COMPUTATION ON TERMS *****************)
+(* EXTENDED CONTEXT-SENSITIVE PARALLEL RT-COMPUTATION FOR TERMS *************)
 
-definition cpxs: ∀h. sd h → relation4 genv lenv term term ≝
-                 λh,o,G. LTC … (cpx h o G).
+definition cpxs (G): relation3 lenv term term ≝
+           CTC … (cpx G).
 
-interpretation "extended context-sensitive parallel computation (term)"
-   'PRedStar h o G L T1 T2 = (cpxs h o G L T1 T2).
+interpretation
+  "extended context-sensitive parallel rt-computation (term)"
+  'PRedTyStar G L T1 T2 = (cpxs G L T1 T2).
 
 (* Basic eliminators ********************************************************)
 
-lemma cpxs_ind: ∀h,o,G,L,T1. ∀R:predicate term. R T1 →
-                (∀T,T2. ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T → ⦃G, L⦄ ⊢ T ⬈[h, o] T2 → R T → R T2) →
-                ∀T2. ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2 → R T2.
-#h #o #L #G #T1 #R #HT1 #IHT1 #T2 #HT12
+lemma cpxs_ind (G) (L) (T1) (Q:predicate …):
+      Q T1 →
+      (∀T,T2. ❪G,L❫ ⊢ T1 ⬈* T → ❪G,L❫ ⊢ T ⬈ T2 → Q T → Q T2) →
+      ∀T2. ❪G,L❫ ⊢ T1 ⬈* T2 → Q T2.
+#L #G #T1 #Q #HT1 #IHT1 #T2 #HT12
 @(TC_star_ind … HT1 IHT1 … HT12) //
 qed-.
 
-lemma cpxs_ind_dx: ∀h,o,G,L,T2. ∀R:predicate term. R T2 →
-                   (∀T1,T. ⦃G, L⦄ ⊢ T1 ⬈[h, o] T → ⦃G, L⦄ ⊢ T ⬈*[h, o] T2 → R T → R T1) →
-                   ∀T1. ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2 → R T1.
-#h #o #G #L #T2 #R #HT2 #IHT2 #T1 #HT12
+lemma cpxs_ind_dx (G) (L) (T2) (Q:predicate …):
+      Q T2 →
+      (∀T1,T. ❪G,L❫ ⊢ T1 ⬈ T → ❪G,L❫ ⊢ T ⬈* T2 → Q T → Q T1) →
+      ∀T1. ❪G,L❫ ⊢ T1 ⬈* T2 → Q T1.
+#G #L #T2 #Q #HT2 #IHT2 #T1 #HT12
 @(TC_star_ind_dx … HT2 IHT2 … HT12) //
 qed-.
 
 (* Basic properties *********************************************************)
 
-lemma cpxs_refl: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ T ⬈*[h, o] T.
+lemma cpxs_refl (G) (L):
+      ∀T. ❪G,L❫ ⊢ T ⬈* T.
 /2 width=1 by inj/ qed.
 
-lemma cpx_cpxs: ∀h,o,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈[h, o] T2 → ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2.
+lemma cpx_cpxs (G) (L): ∀T1,T2. ❪G,L❫ ⊢ T1 ⬈ T2 → ❪G,L❫ ⊢ T1 ⬈* T2.
 /2 width=1 by inj/ qed.
 
-lemma cpxs_strap1: ∀h,o,G,L,T1,T. ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T →
-                   ∀T2. ⦃G, L⦄ ⊢ T ⬈[h, o] T2 → ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2.
-normalize /2 width=3 by step/ qed.
-
-lemma cpxs_strap2: ∀h,o,G,L,T1,T. ⦃G, L⦄ ⊢ T1 ⬈[h, o] T →
-                   ∀T2. ⦃G, L⦄ ⊢ T ⬈*[h, o] T2 → ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2.
-normalize /2 width=3 by TC_strap/ qed.
-
-lemma lsubr_cpxs_trans: ∀h,o,G. lsub_trans … (cpxs h o G) lsubr.
-/3 width=5 by lsubr_cpx_trans, LTC_lsub_trans/
-qed-.
-
-lemma cprs_cpxs: ∀h,o,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈* T2 → ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2.
-#h #o #G #L #T1 #T2 #H @(cprs_ind … H) -T2 /3 width=3 by cpxs_strap1, cpr_cpx/
-qed.
-
-lemma cpxs_sort: ∀h,o,G,L,s,d1. deg h o s d1 →
-                 ∀d2. d2 ≤ d1 → ⦃G, L⦄ ⊢ ⋆s ⬈*[h, o] ⋆((next h)^d2 s).
-#h #o #G #L #s #d1 #Hkd1 #d2 @(nat_ind_plus … d2) -d2 /2 width=1 by cpx_cpxs/
-#d2 #IHd2 #Hd21 >iter_SO
-@(cpxs_strap1 … (⋆(iter d2 ℕ (next h) s)))
-[ /3 width=3 by lt_to_le/
-| @(cpx_st … (d1-d2-1)) <plus_minus_k_k
-  /2 width=1 by deg_iter, monotonic_le_minus_c/
-]
-qed.
-
-lemma cpxs_bind_dx: ∀h,o,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈[h, o] V2 →
-                    ∀I,T1,T2. ⦃G, L. ⓑ{I}V1⦄ ⊢ T1 ⬈*[h, o] T2 →
-                    ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ⬈*[h, o] ⓑ{a,I}V2.T2.
-#h #o #G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12 #a @(cpxs_ind_dx … HT12) -T1
+lemma cpxs_strap1 (G) (L):
+      ∀T1,T. ❪G,L❫ ⊢ T1 ⬈* T →
+      ∀T2. ❪G,L❫ ⊢ T ⬈ T2 → ❪G,L❫ ⊢ T1 ⬈* T2.
+normalize /2 width=3 by step/ qed-.
+
+lemma cpxs_strap2 (G) (L):
+      ∀T1,T. ❪G,L❫ ⊢ T1 ⬈ T →
+      ∀T2. ❪G,L❫ ⊢ T ⬈* T2 → ❪G,L❫ ⊢ T1 ⬈* T2.
+normalize /2 width=3 by TC_strap/ qed-.
+
+(* Basic_2A1: was just: cpxs_sort *)
+lemma cpxs_qu (G) (L):
+      ∀s1,s2. ❪G,L❫ ⊢ ⋆s1 ⬈* ⋆s2.
+/2 width=1 by cpx_cpxs/ qed.
+
+lemma cpxs_bind_dx (G) (L):
+      ∀V1,V2. ❪G,L❫ ⊢ V1 ⬈ V2 →
+      ∀I,T1,T2. ❪G,L. ⓑ[I]V1❫ ⊢ T1 ⬈* T2 →
+      ∀p. ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ⬈* ⓑ[p,I]V2.T2.
+#G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12 #a @(cpxs_ind_dx … HT12) -T1
 /3 width=3 by cpxs_strap2, cpx_cpxs, cpx_pair_sn, cpx_bind/
 qed.
 
-lemma cpxs_flat_dx: ∀h,o,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈[h, o] V2 →
-                    ∀T1,T2. ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2 →
-                    ∀I. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ⬈*[h, o] ⓕ{I}V2.T2.
-#h #o #G #L #V1 #V2 #HV12 #T1 #T2 #HT12 @(cpxs_ind … HT12) -T2
+lemma cpxs_flat_dx (G) (L):
+      ∀V1,V2. ❪G,L❫ ⊢ V1 ⬈ V2 →
+      ∀T1,T2. ❪G,L❫ ⊢ T1 ⬈* T2 →
+      ∀I. ❪G,L❫ ⊢ ⓕ[I]V1.T1 ⬈* ⓕ[I]V2.T2.
+#G #L #V1 #V2 #HV12 #T1 #T2 #HT12 @(cpxs_ind … HT12) -T2
 /3 width=5 by cpxs_strap1, cpx_cpxs, cpx_pair_sn, cpx_flat/
 qed.
 
-lemma cpxs_flat_sn: ∀h,o,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈[h, o] T2 →
-                    ∀V1,V2. ⦃G, L⦄ ⊢ V1 ⬈*[h, o] V2 →
-                    ∀I. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ⬈*[h, o] ⓕ{I}V2.T2.
-#h #o #G #L #T1 #T2 #HT12 #V1 #V2 #H @(cpxs_ind … H) -V2
+lemma cpxs_flat_sn (G) (L):
+      ∀T1,T2. ❪G,L❫ ⊢ T1 ⬈ T2 →
+      ∀V1,V2. ❪G,L❫ ⊢ V1 ⬈* V2 →
+      ∀I. ❪G,L❫ ⊢ ⓕ[I]V1.T1 ⬈* ⓕ[I]V2.T2.
+#G #L #T1 #T2 #HT12 #V1 #V2 #H @(cpxs_ind … H) -V2
 /3 width=5 by cpxs_strap1, cpx_cpxs, cpx_pair_sn, cpx_flat/
 qed.
 
-lemma cpxs_pair_sn: ∀h,o,I,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈*[h, o] V2 →
-                    ∀T. ⦃G, L⦄ ⊢ ②{I}V1.T ⬈*[h, o] ②{I}V2.T.
-#h #o #I #G #L #V1 #V2 #H @(cpxs_ind … H) -V2
+lemma cpxs_pair_sn (G) (L):
+      ∀I,V1,V2. ❪G,L❫ ⊢ V1 ⬈* V2 →
+      ∀T. ❪G,L❫ ⊢ ②[I]V1.T ⬈* ②[I]V2.T.
+#G #L #I #V1 #V2 #H @(cpxs_ind … H) -V2
 /3 width=3 by cpxs_strap1, cpx_pair_sn/
 qed.
 
-lemma cpxs_zeta: ∀h,o,G,L,V,T1,T,T2. ⬆[0, 1] T2 ≡ T →
-                 ⦃G, L.ⓓV⦄ ⊢ T1 ⬈*[h, o] T → ⦃G, L⦄ ⊢ +ⓓV.T1 ⬈*[h, o] T2.
-#h #o #G #L #V #T1 #T #T2 #HT2 #H @(cpxs_ind_dx … H) -T1
+lemma cpxs_zeta (G) (L) (V):
+      ∀T1,T. ⇧[1] T ≘ T1 →
+      ∀T2. ❪G,L❫ ⊢ T ⬈* T2 → ❪G,L❫ ⊢ +ⓓV.T1 ⬈* T2.
+#G #L #V #T1 #T #HT1 #T2 #H @(cpxs_ind … H) -T2
+/3 width=3 by cpxs_strap1, cpx_cpxs, cpx_zeta/
+qed.
+
+(* Basic_2A1: was: cpxs_zeta *)
+lemma cpxs_zeta_dx (G) (L) (V):
+      ∀T2,T. ⇧[1] T2 ≘ T →
+      ∀T1. ❪G,L.ⓓV❫ ⊢ T1 ⬈* T → ❪G,L❫ ⊢ +ⓓV.T1 ⬈* T2.
+#G #L #V #T2 #T #HT2 #T1 #H @(cpxs_ind_dx … H) -T1
 /3 width=3 by cpxs_strap2, cpx_cpxs, cpx_bind, cpx_zeta/
 qed.
 
-lemma cpxs_eps: ∀h,o,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2 →
-                ∀V. ⦃G, L⦄ ⊢ ⓝV.T1 ⬈*[h, o] T2.
-#h #o #G #L #T1 #T2 #H @(cpxs_ind … H) -T2
+lemma cpxs_eps (G) (L):
+      ∀T1,T2. ❪G,L❫ ⊢ T1 ⬈* T2 →
+      ∀V. ❪G,L❫ ⊢ ⓝV.T1 ⬈* T2.
+#G #L #T1 #T2 #H @(cpxs_ind … H) -T2
 /3 width=3 by cpxs_strap1, cpx_cpxs, cpx_eps/
 qed.
 
-lemma cpxs_ct: ∀h,o,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈*[h, o] V2 →
-               ∀T. ⦃G, L⦄ ⊢ ⓝV1.T ⬈*[h, o] V2.
-#h #o #G #L #V1 #V2 #H @(cpxs_ind … H) -V2
-/3 width=3 by cpxs_strap1, cpx_cpxs, cpx_ct/
+(* Basic_2A1: was: cpxs_ct *)
+lemma cpxs_ee (G) (L):
+      ∀V1,V2. ❪G,L❫ ⊢ V1 ⬈* V2 →
+      ∀T. ❪G,L❫ ⊢ ⓝV1.T ⬈* V2.
+#G #L #V1 #V2 #H @(cpxs_ind … H) -V2
+/3 width=3 by cpxs_strap1, cpx_cpxs, cpx_ee/
 qed.
 
-lemma cpxs_beta_dx: ∀h,o,a,G,L,V1,V2,W1,W2,T1,T2.
-                    ⦃G, L⦄ ⊢ V1 ⬈[h, o] V2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ⬈*[h, o] T2 → ⦃G, L⦄ ⊢ W1 ⬈[h, o] W2 →
-                    ⦃G, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ⬈*[h, o] ⓓ{a}ⓝW2.V2.T2.
-#h #o #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 * -T2
+lemma cpxs_beta_dx (G) (L):
+      ∀p,V1,V2,W1,W2,T1,T2.
+      ❪G,L❫ ⊢ V1 ⬈ V2 → ❪G,L.ⓛW1❫ ⊢ T1 ⬈* T2 → ❪G,L❫ ⊢ W1 ⬈ W2 →
+      ❪G,L❫ ⊢ ⓐV1.ⓛ[p]W1.T1 ⬈* ⓓ[p]ⓝW2.V2.T2.
+#G #L #p #V1 #V2 #W1 #W2 #T1 #T2 #HV12 * -T2
 /4 width=7 by cpx_cpxs, cpxs_strap1, cpxs_bind_dx, cpxs_flat_dx, cpx_beta/
 qed.
 
-lemma cpxs_theta_dx: ∀h,o,a,G,L,V1,V,V2,W1,W2,T1,T2.
-                     ⦃G, L⦄ ⊢ V1 ⬈[h, o] V → ⬆[0, 1] V ≡ V2 → ⦃G, L.ⓓW1⦄ ⊢ T1 ⬈*[h, o] T2 →
-                     ⦃G, L⦄ ⊢ W1 ⬈[h, o] W2 → ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ⬈*[h, o] ⓓ{a}W2.ⓐV2.T2.
-#h #o #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 * -T2 
+lemma cpxs_theta_dx (G) (L):
+      ∀p,V1,V,V2,W1,W2,T1,T2.
+      ❪G,L❫ ⊢ V1 ⬈ V → ⇧[1] V ≘ V2 → ❪G,L.ⓓW1❫ ⊢ T1 ⬈* T2 →
+      ❪G,L❫ ⊢ W1 ⬈ W2 → ❪G,L❫ ⊢ ⓐV1.ⓓ[p]W1.T1 ⬈* ⓓ[p]W2.ⓐV2.T2.
+#G #L #p #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 * -T2
 /4 width=9 by cpx_cpxs, cpxs_strap1, cpxs_bind_dx, cpxs_flat_dx, cpx_theta/
 qed.
 
 (* Basic inversion lemmas ***************************************************)
 
-lemma cpxs_inv_sort1: ∀h,o,G,L,U2,s. ⦃G, L⦄ ⊢ ⋆s ⬈*[h, o] U2 →
-                      ∃∃n,d. deg h o s (n+d) & U2 = ⋆((next h)^n s).
-#h #o #G #L #U2 #s #H @(cpxs_ind … H) -U2
-[ elim (deg_total h o s) #d #Hkd
-  @(ex2_2_intro … 0 … Hkd) -Hkd //
-| #U #U2 #_ #HU2 * #n #d #Hknd #H destruct
-  elim (cpx_inv_sort1 … HU2) -HU2
-  [ #H destruct /2 width=4 by ex2_2_intro/
-  | * #d0 #Hkd0 #H destruct -d
-    @(ex2_2_intro … (n+1) d0) /2 width=1 by deg_inv_prec/ >iter_SO //
-  ]
-]
+(* Basic_2A1: wa just: cpxs_inv_sort1 *)
+lemma cpxs_inv_sort1 (G) (L):
+      ∀X2,s1. ❪G,L❫ ⊢ ⋆s1 ⬈* X2 →
+      ∃s2. X2 = ⋆s2.
+#G #L #X2 #s1 #H @(cpxs_ind … H) -X2 /2 width=2 by ex_intro/
+#X #X2 #_ #HX2 * #s #H destruct
+elim (cpx_inv_sort1 … HX2) -HX2 #s2 #H destruct /2 width=2 by ex_intro/
 qed-.
 
-lemma cpxs_inv_cast1: ∀h,o,G,L,W1,T1,U2. ⦃G, L⦄ ⊢ ⓝW1.T1 ⬈*[h, o] U2 →
-                      ∨∨ ∃∃W2,T2. ⦃G, L⦄ ⊢ W1 ⬈*[h, o] W2 & ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2 & U2 = ⓝW2.T2
-                       | ⦃G, L⦄ ⊢ T1 ⬈*[h, o] U2
-                       | ⦃G, L⦄ ⊢ W1 ⬈*[h, o] U2.
-#h #o #G #L #W1 #T1 #U2 #H @(cpxs_ind … H) -U2 /3 width=5 by or3_intro0, ex3_2_intro/
+lemma cpxs_inv_cast1 (G) (L):
+      ∀W1,T1,U2. ❪G,L❫ ⊢ ⓝW1.T1 ⬈* U2 →
+      ∨∨ ∃∃W2,T2. ❪G,L❫ ⊢ W1 ⬈* W2 & ❪G,L❫ ⊢ T1 ⬈* T2 & U2 = ⓝW2.T2
+       | ❪G,L❫ ⊢ T1 ⬈* U2
+       | ❪G,L❫ ⊢ W1 ⬈* U2.
+#G #L #W1 #T1 #U2 #H @(cpxs_ind … H) -U2 /3 width=5 by or3_intro0, ex3_2_intro/
 #U2 #U #_ #HU2 * /3 width=3 by cpxs_strap1, or3_intro1, or3_intro2/ *
 #W #T #HW1 #HT1 #H destruct
 elim (cpx_inv_cast1 … HU2) -HU2 /3 width=3 by cpxs_strap1, or3_intro1, or3_intro2/ *
@@ -162,20 +168,3 @@ elim (cpx_inv_cast1 … HU2) -HU2 /3 width=3 by cpxs_strap1, or3_intro1, or3_int
 lapply (cpxs_strap1 … HW1 … HW2) -W
 lapply (cpxs_strap1 … HT1 … HT2) -T /3 width=5 by or3_intro0, ex3_2_intro/
 qed-.
-
-lemma cpxs_inv_cnx1: ∀h,o,G,L,T,U. ⦃G, L⦄ ⊢ T ⬈*[h, o] U → ⦃G, L⦄ ⊢ ⬈[h, o] 𝐍⦃T⦄ → T = U.
-#h #o #G #L #T #U #H @(cpxs_ind_dx … H) -T //
-#T0 #T #H1T0 #_ #IHT #H2T0
-lapply (H2T0 … H1T0) -H1T0 #H destruct /2 width=1 by/
-qed-.
-
-lemma cpxs_neq_inv_step_sn: ∀h,o,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈*[h, o] T2 → (T1 = T2 → ⊥) →
-                            ∃∃T. ⦃G, L⦄ ⊢ T1 ⬈[h, o] T & T1 = T → ⊥ & ⦃G, L⦄ ⊢ T ⬈*[h, o] T2.
-#h #o #G #L #T1 #T2 #H @(cpxs_ind_dx … H) -T1
-[ #H elim H -H //
-| #T1 #T #H1 #H2 #IH2 #H12 elim (eq_term_dec T1 T) #H destruct
-  [ -H1 -H2 /3 width=1 by/
-  | -IH2 /3 width=4 by ex3_intro/ (**) (* auto fails without clear *)
-  ]
-]
-qed-.