]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/acp_cr.ma
8c00d3a99d2911003f1f57a0f430e0e190221f1b
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / acp_cr.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "basic_2/notation/relations/ineint_5.ma".
16 include "basic_2/grammar/aarity.ma".
17 include "basic_2/grammar/genv.ma". (**) (* not needed, disambiguation error *)
18 include "basic_2/substitution/gr2_gr2.ma". 
19 include "basic_2/substitution/lifts_lift_vector.ma".
20 include "basic_2/substitution/ldrops_ldrop.ma".
21 include "basic_2/computation/acp.ma".
22
23 (* ABSTRACT COMPUTATION PROPERTIES ******************************************)
24
25 (* Note: this is Girard's CR1 *)
26 definition S1 ≝ λRP,C:relation3 genv lenv term.
27                 ∀G,L,T. C G L T → RP G L T.
28
29 (* Note: this is Tait's iii, or Girard's CR4 *)
30 definition S2 ≝ λRR:relation4 genv lenv term term. λRS:relation term. λRP,C:relation3 genv lenv term.
31                 ∀G,L,Vs. all … (RP G L) Vs →
32                 ∀T. 𝐒⦃T⦄ → NF … (RR G L) RS T → C G L (ⒶVs.T).
33
34 (* Note: this generalizes Tait's ii *)
35 definition S3 ≝ λC:relation3 genv lenv term.
36                 ∀a,G,L,Vs,V,T,W.
37                 C G L (ⒶVs.ⓓ{a}ⓝW.V.T) → C G L (ⒶVs.ⓐV.ⓛ{a}W.T).
38
39 definition S4 ≝ λRP,C:relation3 genv lenv term.
40                 ∀G,L,Vs. all … (RP G L) Vs → ∀k. C G L (ⒶVs.⋆k).
41
42 definition S5 ≝ λC:relation3 genv lenv term. ∀I,G,L,K,Vs,V1,V2,i.
43                 C G L (ⒶVs.V2) → ⇧[0, i + 1] V1 ≡ V2 →
44                 ⇩[0, i] L ≡ K.ⓑ{I}V1 → C G L (ⒶVs.#i).
45
46 definition S6 ≝ λRP,C:relation3 genv lenv term.
47                 ∀G,L,V1s,V2s. ⇧[0, 1] V1s ≡ V2s →
48                 ∀a,V,T. C G (L.ⓓV) (ⒶV2s.T) → RP G L V → C G L (ⒶV1s.ⓓ{a}V.T).
49
50 definition S7 ≝ λC:relation3 genv lenv term.
51                 ∀G,L,Vs,T,W. C G L (ⒶVs.T) → C G L (ⒶVs.W) → C G L (ⒶVs.ⓝW.T).
52
53 definition S8 ≝ λC:relation3 genv lenv term. ∀G,L2,L1,T1,d,e.
54                 C G L1 T1 → ∀T2. ⇩[d, e] L2 ≡ L1 → ⇧[d, e] T1 ≡ T2 → C G L2 T2.
55
56 definition S8s ≝ λC:relation3 genv lenv term.
57                  ∀G,L1,L2,des. ⇩*[des] L2 ≡ L1 →
58                  ∀T1,T2. ⇧*[des] T1 ≡ T2 → C G L1 T1 → C G L2 T2.
59
60 (* properties of the abstract candidate of reducibility *)
61 record acr (RR:relation4 genv lenv term term) (RS:relation term) (RP,C:relation3 genv lenv term) : Prop ≝
62 { s1: S1 RP C;
63   s2: S2 RR RS RP C;
64   s3: S3 C;
65   s4: S4 RP C;
66   s5: S5 C;
67   s6: S6 RP C;
68   s7: S7 C;
69   s8: S8 C
70 }.
71
72 (* the abstract candidate of reducibility associated to an atomic arity *)
73 let rec aacr (RP:relation3 genv lenv term) (A:aarity) (G:genv) (L:lenv) on A: predicate term ≝
74 λT. match A with
75 [ AAtom     ⇒ RP G L T
76 | APair B A ⇒ ∀L0,V0,T0,des.
77               aacr RP B G L0 V0 → ⇩*[des] L0 ≡ L → ⇧*[des] T ≡ T0 →
78               aacr RP A G L0 (ⓐV0.T0)
79 ].
80
81 interpretation
82    "candidate of reducibility of an atomic arity (abstract)"
83    'InEInt RP G L T A = (aacr RP A G L T).
84
85 (* Basic properties *********************************************************)
86
87 (* Basic_1: was: sc3_lift1 *)
88 lemma acr_lifts: ∀C. S8 C → S8s C.
89 #C #HC #G #L1 #L2 #des #H elim H -L1 -L2 -des
90 [ #L #T1 #T2 #H #HT1
91   <(lifts_inv_nil … H) -H //
92 | #L1 #L #L2 #des #d #e #_ #HL2 #IHL #T2 #T1 #H #HLT2
93   elim (lifts_inv_cons … H) -H /3 width=9/
94 ]
95 qed.
96
97 lemma rp_lifts: ∀RR,RS,RP. acr RR RS RP (λG,L,T. RP G L T) →
98                 ∀des,G,L0,L,V,V0. ⇩*[des] L0 ≡ L → ⇧*[des] V ≡ V0 →
99                 RP G L V → RP G L0 V0.
100 #RR #RS #RP #HRP #des #G #L0 #L #V #V0 #HL0 #HV0 #HV
101 @acr_lifts /width=6/
102 @(s8 … HRP)
103 qed.
104
105 (* Basic_1: was only: sns3_lifts1 *)
106 lemma rp_liftsv_all: ∀RR,RS,RP. acr RR RS RP (λG,L,T. RP G L T) →
107                      ∀des,G,L0,L,Vs,V0s. ⇧*[des] Vs ≡ V0s → ⇩*[des] L0 ≡ L →
108                      all … (RP G L) Vs → all … (RP G L0) V0s.
109 #RR #RS #RP #HRP #des #G #L0 #L #Vs #V0s #H elim H -Vs -V0s normalize //
110 #T1s #T2s #T1 #T2 #HT12 #_ #IHT2s #HL0 * #HT1 #HT1s
111 @conj /2 width=1/ /2 width=6 by rp_lifts/
112 qed.
113
114 (* Basic_1: was:
115    sc3_sn3 sc3_abst sc3_appl sc3_abbr sc3_bind sc3_cast sc3_lift
116 *)
117 lemma aacr_acr: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λG,L,T. RP G L T) →
118                 ∀A. acr RR RS RP (aacr RP A).
119 #RR #RS #RP #H1RP #H2RP #A elim A -A normalize //
120 #B #A #IHB #IHA @mk_acr normalize
121 [ #G #L #T #H
122   elim (cp1 … H1RP G L) #k #HK
123   lapply (H ? (⋆k) ? ⟠ ? ? ?) -H
124   [1,3: // |2,4: skip
125   | @(s2 … IHB … ◊) //
126   | #H @(cp3 … H1RP … k) @(s1 … IHA) //
127   ]
128 | #G #L #Vs #HVs #T #H1T #H2T #L0 #V0 #X #des #HB #HL0 #H
129   elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
130   lapply (s1 … IHB … HB) #HV0
131   @(s2 … IHA … (V0 @ V0s)) /2 width=4 by lifts_simple_dx/ /3 width=6/
132 | #a #G #L #Vs #U #T #W #HA #L0 #V0 #X #des #HB #HL0 #H
133   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
134   elim (lifts_inv_flat1 … HY) -HY #U0 #X #HU0 #HX #H destruct
135   elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
136   @(s3 … IHA … (V0 @ V0s)) /5 width=5/
137 | #G #L #Vs #HVs #k #L0 #V0 #X #hdes #HB #HL0 #H
138   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
139   >(lifts_inv_sort1 … HY) -Y
140   lapply (s1 … IHB … HB) #HV0
141   @(s4 … IHA … (V0 @ V0s)) /3 width=6/
142 | #I #G #L #K #Vs #V1 #V2 #i #HA #HV12 #HLK #L0 #V0 #X #des #HB #HL0 #H
143   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
144   elim (lifts_inv_lref1 … HY) -HY #i0 #Hi0 #H destruct
145   elim (ldrops_ldrop_trans … HL0 … HLK) #X #des0 #i1 #HL02 #H #Hi1 #Hdes0
146   >(at_mono … Hi1 … Hi0) in HL02; -i1 #HL02
147   elim (ldrops_inv_skip2 … Hdes0 … H) -H -des0 #L2 #W1 #des0 #Hdes0 #HLK #HVW1 #H destruct
148   elim (lift_total W1 0 (i0 + 1)) #W2 #HW12
149   elim (lifts_lift_trans  … Hdes0 … HVW1 … HW12) // -Hdes0 -Hi0 #V3 #HV13 #HVW2
150   >(lift_mono … HV13 … HV12) in HVW2; -V3 #HVW2
151   @(s5 … IHA … (V0 @ V0s) … HW12 HL02) /3 width=4/
152 | #G #L #V1s #V2s #HV12s #a #V #T #HA #HV #L0 #V10 #X #des #HB #HL0 #H
153   elim (lifts_inv_applv1 … H) -H #V10s #Y #HV10s #HY #H destruct
154   elim (lifts_inv_bind1 … HY) -HY #V0 #T0 #HV0 #HT0 #H destruct
155   elim (lift_total V10 0 1) #V20 #HV120
156   elim (liftv_total 0 1 V10s) #V20s #HV120s
157   @(s6 … IHA … (V10 @ V10s) (V20 @ V20s)) /2 width=1/ /3 width=6 by rp_lifts/
158   @(HA … (des + 1)) /2 width=1/
159   [ @(s8 … IHB … HB … HV120) /2 width=1/
160   | @lifts_applv //
161     elim (liftsv_liftv_trans_le … HV10s … HV120s) -V10s #V10s #HV10s #HV120s
162     >(liftv_mono … HV12s … HV10s) -V1s //
163   ]
164 | #G #L #Vs #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
165   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
166   elim (lifts_inv_flat1 … HY) -HY #W0 #T0 #HW0 #HT0 #H destruct
167   @(s7 … IHA … (V0 @ V0s)) /3 width=4/
168 | /3 width=7/
169 ]
170 qed.
171
172 lemma aacr_abst: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λG,L,T. RP G L T) →
173                  ∀a,G,L,W,T,A,B. ⦃G, L, W⦄ ϵ[RP] 〚B〛 → (
174                     ∀L0,V0,W0,T0,des. ⇩*[des] L0 ≡ L → ⇧*[des ] W ≡ W0 → ⇧*[des + 1] T ≡ T0 →
175                                    ⦃G, L0, V0⦄ ϵ[RP] 〚B〛 → ⦃G, L0, W0⦄ ϵ[RP] 〚B〛 → ⦃G, L0.ⓓⓝW0.V0, T0⦄ ϵ[RP] 〚A〛
176                  ) →
177                  ⦃G, L, ⓛ{a}W.T⦄ ϵ[RP] 〚②B.A〛.
178 #RR #RS #RP #H1RP #H2RP #a #G #L #W #T #A #B #HW #HA #L0 #V0 #X #des #HB #HL0 #H
179 lapply (aacr_acr … H1RP H2RP A) #HCA
180 lapply (aacr_acr … H1RP H2RP B) #HCB
181 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
182 lapply (acr_lifts … HL0 … HW0 HW) -HW [ @(s8 … HCB) ] #HW0
183 @(s3 … HCA … ◊)
184 @(s6 … HCA … ◊ ◊) //
185 [ @(HA … HL0) //
186 | lapply (s1 … HCB) -HCB #HCB
187   @(cp4 … H1RP) /2 width=1/
188 ]
189 qed.
190
191 (* Basic_1: removed theorems 2: sc3_arity_gen sc3_repl *)
192 (* Basic_1: removed local theorems 1: sc3_sn3_abst *)