]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/basic_2/computation/acp_cr.ma
lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / acp_cr.ma
index b0b15e6655d0897977405ff99ee2d109933295c8..3f219ba86843be073438836c9b982709e0dfb894 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
+include "basic_2/notation/relations/ineint_4.ma".
 include "basic_2/grammar/aarity.ma".
-include "basic_2/unfold/gr2_gr2.ma".
-include "basic_2/unfold/lifts_lift_vector.ma".
-include "basic_2/unfold/ldrops_ldrop.ma".
+include "basic_2/substitution/gr2_gr2.ma".
+include "basic_2/substitution/lifts_lift_vector.ma".
+include "basic_2/substitution/ldrops_ldrop.ma".
 include "basic_2/computation/acp.ma".
 
 (* ABSTRACT COMPUTATION PROPERTIES ******************************************)
@@ -29,25 +30,28 @@ definition S2 ≝ λRR:lenv→relation term. λRS:relation term. λRP,C:lenv→p
                 ∀L,Vs. all … (RP L) Vs →
                 ∀T. 𝐒⦃T⦄ → NF … (RR L) RS T → C L (ⒶVs.T).
 
-(* Note: this is Tait's ii *)
-definition S3 ≝ λRP,C:lenv→predicate term.
-                ∀a,L,Vs,V,T,W. C L (ⒶVs. ⓓ{a}V. T) → RP L W → C L (ⒶVs. ⓐV. ⓛ{a}W. T).
+(* Note: this generalizes Tait's ii *)
+definition S3 ≝ λC:lenv→predicate term.
+                ∀a,L,Vs,V,T,W. C L (ⒶVs.ⓓ{a}ⓝW.V.T) → C L (ⒶVs.ⓐV.ⓛ{a}W.T).
 
-definition S4 ≝ λRP,C:lenv→predicate term. ∀L,K,Vs,V1,V2,i.
-                C L (ⒶVs. V2) → ⇧[0, i + 1] V1 ≡ V2 →
-                ⇩[0, i] L ≡ K. ⓓV1 → C L (Ⓐ Vs. #i).
+definition S4 ≝ λRP,C:lenv→predicate term.
+                ∀L,Vs. all … (RP L) Vs → ∀k. C L (ⒶVs.⋆k).
 
-definition S5 ≝ λRP,C:lenv→predicate term.
-                ∀L,V1s,V2s. ⇧[0, 1] V1s ≡ V2s →
-                â\88\80a,V,T. C (L. â\93\93V) (â\92¶V2s. T) â\86\92 RP L V â\86\92 C L (â\92¶V1s. â\93\93{a}V. T).
+definition S5 ≝ λC:lenv→predicate term. ∀I,L,K,Vs,V1,V2,i.
+                C L (ⒶVs.V2) → ⇧[0, i + 1] V1 ≡ V2 →
+                â\87©[0, i] L â\89¡ K.â\93\91{I}V1 â\86\92 C L (â\92¶ Vs.#i).
 
 definition S6 ≝ λRP,C:lenv→predicate term.
-                ∀L,Vs,T,W. C L (ⒶVs. T) → RP L W → C L (ⒶVs. ⓝW. T).
+                ∀L,V1s,V2s. ⇧[0, 1] V1s ≡ V2s →
+                ∀a,V,T. C (L.ⓓV) (ⒶV2s.T) → RP L V → C L (ⒶV1s.ⓓ{a}V.T).
+
+definition S7 ≝ λC:lenv→predicate term.
+                ∀L,Vs,T,W. C L (ⒶVs.T) → C L (ⒶVs.W) → C L (ⒶVs.ⓝW.T).
 
-definition S7 ≝ λC:lenv→predicate term. ∀L2,L1,T1,d,e.
+definition S8 ≝ λC:lenv→predicate term. ∀L2,L1,T1,d,e.
                 C L1 T1 → ∀T2. ⇩[d, e] L2 ≡ L1 → ⇧[d, e] T1 ≡ T2 → C L2 T2.
 
-definition S7s ≝ λC:lenv→predicate term.
+definition S8s ≝ λC:lenv→predicate term.
                  ∀L1,L2,des. ⇩*[des] L2 ≡ L1 →
                  ∀T1,T2. ⇧*[des] T1 ≡ T2 → C L1 T1 → C L2 T2.
 
@@ -55,11 +59,12 @@ definition S7s ≝ λC:lenv→predicate term.
 record acr (RR:lenv->relation term) (RS:relation term) (RP,C:lenv→predicate term) : Prop ≝
 { s1: S1 RP C;
   s2: S2 RR RS RP C;
-  s3: S3 RP C;
+  s3: S3 C;
   s4: S4 RP C;
-  s5: S5 RP C;
+  s5: S5 C;
   s6: S6 RP C;
-  s7: S7 C
+  s7: S7 C;
+  s8: S8 C
 }.
 
 (* the abstract candidate of reducibility associated to an atomic arity *)
@@ -67,7 +72,7 @@ let rec aacr (RP:lenv→predicate term) (A:aarity) (L:lenv) on A: predicate term
 λT. match A with
 [ AAtom     ⇒ RP L T
 | APair B A ⇒ ∀L0,V0,T0,des. aacr RP B L0 V0 → ⇩*[des] L0 ≡ L → ⇧*[des] T ≡ T0 →
-              aacr RP A L0 (ⓐV0. T0)
+              aacr RP A L0 (ⓐV0.T0)
 ].
 
 interpretation
@@ -77,7 +82,7 @@ interpretation
 (* Basic properties *********************************************************)
 
 (* Basic_1: was: sc3_lift1 *)
-lemma acr_lifts: ∀C. S7 C → S7s C.
+lemma acr_lifts: ∀C. S8 C → S8s C.
 #C #HC #L1 #L2 #des #H elim H -L1 -L2 -des
 [ #L #T1 #T2 #H #HT1
   <(lifts_inv_nil … H) -H //
@@ -89,9 +94,9 @@ qed.
 lemma rp_lifts: ∀RR,RS,RP. acr RR RS RP (λL,T. RP L T) →
                 ∀des,L0,L,V,V0. ⇩*[des] L0 ≡ L → ⇧*[des] V ≡ V0 →
                 RP L V → RP L0 V0.
-#RR #RS #RP #HRP #des #L0 #L #V #V0 #HL0 #HV0 #HV 
+#RR #RS #RP #HRP #des #L0 #L #V #V0 #HL0 #HV0 #HV
 @acr_lifts /width=6/
-@(s7 … HRP)
+@(s8 … HRP)
 qed.
 
 (* Basic_1: was only: sns3_lifts1 *)
@@ -103,29 +108,35 @@ lemma rp_liftsv_all: ∀RR,RS,RP. acr RR RS RP (λL,T. RP L T) →
 @conj /2 width=1/ /2 width=6 by rp_lifts/
 qed.
 
-(* Basic_1: was: 
+(* Basic_1: was:
    sc3_sn3 sc3_abst sc3_appl sc3_abbr sc3_bind sc3_cast sc3_lift
-*) 
+*)
 lemma aacr_acr: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
                 ∀A. acr RR RS RP (aacr RP A).
 #RR #RS #RP #H1RP #H2RP #A elim A -A normalize //
 #B #A #IHB #IHA @mk_acr normalize
 [ #L #T #H
-  lapply (H ? (⋆0) ? ⟠ ? ? ?) -H
+  elim (cp1 … H1RP L) #k #HK
+  lapply (H ? (⋆k) ? ⟠ ? ? ?) -H
   [1,3: // |2,4: skip
-  | @(s2 … IHB … ◊) // /2 width=2/
-  | #H @(cp3 … H1RP … 0) @(s1 … IHA) //
+  | @(s2 … IHB … ◊) //
+  | #H @(cp3 … H1RP … k) @(s1 … IHA) //
   ]
 | #L #Vs #HVs #T #H1T #H2T #L0 #V0 #X #des #HB #HL0 #H
   elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
   lapply (s1 … IHB … HB) #HV0
   @(s2 … IHA … (V0 @ V0s)) /2 width=4 by lifts_simple_dx/ /3 width=6/
-| #a #L #Vs #U #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
+| #a #L #Vs #U #T #W #HA #L0 #V0 #X #des #HB #HL0 #H
   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
   elim (lifts_inv_flat1 … HY) -HY #U0 #X #HU0 #HX #H destruct
   elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
-  @(s3 … IHA … (V0 @ V0s)) /2 width=6 by rp_lifts/ /4 width=5/
-| #L #K #Vs #V1 #V2 #i #HA #HV12 #HLK #L0 #V0 #X #des #HB #HL0 #H
+  @(s3 … IHA … (V0 @ V0s)) /5 width=5/
+| #L #Vs #HVs #k #L0 #V0 #X #hdes #HB #HL0 #H
+  elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
+  >(lifts_inv_sort1 … HY) -Y
+  lapply (s1 … IHB … HB) #HV0
+  @(s4 … IHA … (V0 @ V0s)) /3 width=6/
+| #I #L #K #Vs #V1 #V2 #i #HA #HV12 #HLK #L0 #V0 #X #des #HB #HL0 #H
   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
   elim (lifts_inv_lref1 … HY) -HY #i0 #Hi0 #H destruct
   elim (ldrops_ldrop_trans … HL0 … HLK) #X #des0 #i1 #HL02 #H #Hi1 #Hdes0
@@ -134,15 +145,15 @@ lemma aacr_acr: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
   elim (lift_total W1 0 (i0 + 1)) #W2 #HW12
   elim (lifts_lift_trans  … Hdes0 … HVW1 … HW12) // -Hdes0 -Hi0 #V3 #HV13 #HVW2
   >(lift_mono … HV13 … HV12) in HVW2; -V3 #HVW2
-  @(s4 … IHA … (V0 @ V0s) … HW12 HL02) /3 width=4/
+  @(s5 … IHA … (V0 @ V0s) … HW12 HL02) /3 width=4/
 | #L #V1s #V2s #HV12s #a #V #T #HA #HV #L0 #V10 #X #des #HB #HL0 #H
   elim (lifts_inv_applv1 … H) -H #V10s #Y #HV10s #HY #H destruct
   elim (lifts_inv_bind1 … HY) -HY #V0 #T0 #HV0 #HT0 #H destruct
   elim (lift_total V10 0 1) #V20 #HV120
   elim (liftv_total 0 1 V10s) #V20s #HV120s
-  @(s5 … IHA … (V10 @ V10s) (V20 @ V20s)) /2 width=1/ /2 width=6 by rp_lifts/
+  @(s6 … IHA … (V10 @ V10s) (V20 @ V20s)) /2 width=1/ /3 width=6 by rp_lifts/
   @(HA … (des + 1)) /2 width=1/
-  [ @(s7 … IHB … HB … HV120) /2 width=1/
+  [ @(s8 … IHB … HB … HV120) /2 width=1/
   | @lifts_applv //
     elim (liftsv_liftv_trans_le … HV10s … HV120s) -V10s #V10s #HV10s #HV120s
     >(liftv_mono … HV12s … HV10s) -V1s //
@@ -150,24 +161,28 @@ lemma aacr_acr: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
 | #L #Vs #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
   elim (lifts_inv_flat1 … HY) -HY #W0 #T0 #HW0 #HT0 #H destruct
-  @(s6 … IHA … (V0 @ V0s)) /2 width=6 by rp_lifts/ /3 width=4/
+  @(s7 … IHA … (V0 @ V0s)) /3 width=4/
 | /3 width=7/
 ]
 qed.
 
 lemma aacr_abst: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
-                 ∀a,L,W,T,A,B. RP L W → (
-                    ∀L0,V0,T0,des. ⇩*[des] L0 ≡ L → ⇧*[des + 1] T ≡ T0 →
-                                   ⦃L0, V0⦄ ϵ[RP] 〚B〛 → ⦃L0. ⓓV0, T0⦄ ϵ[RP] 〚A〛
+                 ∀a,L,W,T,A,B. ⦃L, W⦄ ϵ[RP] 〚B〛 → (
+                    ∀L0,V0,W0,T0,des. ⇩*[des] L0 ≡ L → ⇧*[des ] W ≡ W0 → ⇧*[des + 1] T ≡ T0 →
+                                   ⦃L0, V0⦄ ϵ[RP] 〚B〛 → ⦃L0, W0⦄ ϵ[RP] 〚B〛 → ⦃L0.ⓓⓝW0.V0, T0⦄ ϵ[RP] 〚A〛
                  ) →
-                 ⦃L, ⓛ{a}W. T⦄ ϵ[RP] 〚②B. A〛.
+                 ⦃L, ⓛ{a}W.T⦄ ϵ[RP] 〚②B.A〛.
 #RR #RS #RP #H1RP #H2RP #a #L #W #T #A #B #HW #HA #L0 #V0 #X #des #HB #HL0 #H
 lapply (aacr_acr … H1RP H2RP A) #HCA
 lapply (aacr_acr … H1RP H2RP B) #HCB
 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
-lapply (s1 … HCB) -HCB #HCB
-@(s3 … HCA … ◊) /2 width=6 by rp_lifts/
-@(s5 … HCA … ◊ ◊) // /2 width=1/ /2 width=3/
+lapply (acr_lifts … HL0 … HW0 HW) -HW [ @(s8 … HCB) ] #HW0
+@(s3 … HCA … ◊)
+@(s6 … HCA … ◊ ◊) //
+[ @(HA … HL0) //
+| lapply (s1 … HCB) -HCB #HCB
+  @(cp4 … H1RP) /2 width=1/
+]
 qed.
 
 (* Basic_1: removed theorems 2: sc3_arity_gen sc3_repl *)