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