1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2/grammar/aarity.ma".
16 include "basic_2/unfold/gr2_gr2.ma".
17 include "basic_2/unfold/lifts_lift_vector.ma".
18 include "basic_2/unfold/ldrops_ldrop.ma".
19 include "basic_2/computation/acp.ma".
21 (* ABSTRACT COMPUTATION PROPERTIES ******************************************)
23 (* Note: this is Girard's CR1 *)
24 definition S1 ≝ λRP,C:lenv→predicate term.
27 (* Note: this is Tait's iii, or Girard's CR4 *)
28 definition S2 ≝ λRR:lenv→relation term. λRS:relation term. λRP,C:lenv→predicate term.
29 ∀L,Vs. all … (RP L) Vs →
30 ∀T. 𝐒⦃T⦄ → NF … (RR L) RS T → C L (ⒶVs.T).
32 (* Note: this is Tait's ii *)
33 definition S3 ≝ λRP,C:lenv→predicate term.
34 ∀a,L,Vs,V,T,W. C L (ⒶVs. ⓓ{a}V. T) → RP L W → C L (ⒶVs. ⓐV. ⓛ{a}W. T).
36 definition S4 ≝ λRP,C:lenv→predicate term. ∀L,K,Vs,V1,V2,i.
37 C L (ⒶVs. V2) → ⇧[0, i + 1] V1 ≡ V2 →
38 ⇩[0, i] L ≡ K. ⓓV1 → C L (Ⓐ Vs. #i).
40 definition S5 ≝ λRP,C:lenv→predicate term.
41 ∀L,V1s,V2s. ⇧[0, 1] V1s ≡ V2s →
42 ∀a,V,T. C (L. ⓓV) (ⒶV2s. T) → RP L V → C L (ⒶV1s. ⓓ{a}V. T).
44 definition S6 ≝ λRP,C:lenv→predicate term.
45 ∀L,Vs,T,W. C L (ⒶVs. T) → RP L W → C L (ⒶVs. ⓝW. T).
47 definition S7 ≝ λC:lenv→predicate term. ∀L2,L1,T1,d,e.
48 C L1 T1 → ∀T2. ⇩[d, e] L2 ≡ L1 → ⇧[d, e] T1 ≡ T2 → C L2 T2.
50 definition S7s ≝ λC:lenv→predicate term.
51 ∀L1,L2,des. ⇩*[des] L2 ≡ L1 →
52 ∀T1,T2. ⇧*[des] T1 ≡ T2 → C L1 T1 → C L2 T2.
54 (* properties of the abstract candidate of reducibility *)
55 record acr (RR:lenv->relation term) (RS:relation term) (RP,C:lenv→predicate term) : Prop ≝
65 (* the abstract candidate of reducibility associated to an atomic arity *)
66 let rec aacr (RP:lenv→predicate term) (A:aarity) (L:lenv) on A: predicate term ≝
69 | APair B A ⇒ ∀L0,V0,T0,des. aacr RP B L0 V0 → ⇩*[des] L0 ≡ L → ⇧*[des] T ≡ T0 →
70 aacr RP A L0 (ⓐV0. T0)
74 "candidate of reducibility of an atomic arity (abstract)"
75 'InEInt RP L T A = (aacr RP A L T).
77 (* Basic properties *********************************************************)
79 (* Basic_1: was: sc3_lift1 *)
80 lemma acr_lifts: ∀C. S7 C → S7s C.
81 #C #HC #L1 #L2 #des #H elim H -L1 -L2 -des
83 <(lifts_inv_nil … H) -H //
84 | #L1 #L #L2 #des #d #e #_ #HL2 #IHL #T2 #T1 #H #HLT2
85 elim (lifts_inv_cons … H) -H /3 width=9/
89 lemma rp_lifts: ∀RR,RS,RP. acr RR RS RP (λL,T. RP L T) →
90 ∀des,L0,L,V,V0. ⇩*[des] L0 ≡ L → ⇧*[des] V ≡ V0 →
92 #RR #RS #RP #HRP #des #L0 #L #V #V0 #HL0 #HV0 #HV
97 (* Basic_1: was only: sns3_lifts1 *)
98 lemma rp_liftsv_all: ∀RR,RS,RP. acr RR RS RP (λL,T. RP L T) →
99 ∀des,L0,L,Vs,V0s. ⇧*[des] Vs ≡ V0s → ⇩*[des] L0 ≡ L →
100 all … (RP L) Vs → all … (RP L0) V0s.
101 #RR #RS #RP #HRP #des #L0 #L #Vs #V0s #H elim H -Vs -V0s normalize //
102 #T1s #T2s #T1 #T2 #HT12 #_ #IHT2s #HL0 * #HT1 #HT1s
103 @conj /2 width=1/ /2 width=6 by rp_lifts/
107 sc3_sn3 sc3_abst sc3_appl sc3_abbr sc3_bind sc3_cast sc3_lift
109 lemma aacr_acr: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
110 ∀A. acr RR RS RP (aacr RP A).
111 #RR #RS #RP #H1RP #H2RP #A elim A -A normalize //
112 #B #A #IHB #IHA @mk_acr normalize
114 lapply (H ? (⋆0) ? ⟠ ? ? ?) -H
116 | @(s2 … IHB … ◊) // /2 width=2/
117 | #H @(cp3 … H1RP … 0) @(s1 … IHA) //
119 | #L #Vs #HVs #T #H1T #H2T #L0 #V0 #X #des #HB #HL0 #H
120 elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
121 lapply (s1 … IHB … HB) #HV0
122 @(s2 … IHA … (V0 @ V0s)) /2 width=4 by lifts_simple_dx/ /3 width=6/
123 | #a #L #Vs #U #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
124 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
125 elim (lifts_inv_flat1 … HY) -HY #U0 #X #HU0 #HX #H destruct
126 elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
127 @(s3 … IHA … (V0 @ V0s)) /2 width=6 by rp_lifts/ /4 width=5/
128 | #L #K #Vs #V1 #V2 #i #HA #HV12 #HLK #L0 #V0 #X #des #HB #HL0 #H
129 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
130 elim (lifts_inv_lref1 … HY) -HY #i0 #Hi0 #H destruct
131 elim (ldrops_ldrop_trans … HL0 … HLK) #X #des0 #i1 #HL02 #H #Hi1 #Hdes0
132 >(at_mono … Hi1 … Hi0) in HL02; -i1 #HL02
133 elim (ldrops_inv_skip2 … Hdes0 … H) -H -des0 #L2 #W1 #des0 #Hdes0 #HLK #HVW1 #H destruct
134 elim (lift_total W1 0 (i0 + 1)) #W2 #HW12
135 elim (lifts_lift_trans … Hdes0 … HVW1 … HW12) // -Hdes0 -Hi0 #V3 #HV13 #HVW2
136 >(lift_mono … HV13 … HV12) in HVW2; -V3 #HVW2
137 @(s4 … IHA … (V0 @ V0s) … HW12 HL02) /3 width=4/
138 | #L #V1s #V2s #HV12s #a #V #T #HA #HV #L0 #V10 #X #des #HB #HL0 #H
139 elim (lifts_inv_applv1 … H) -H #V10s #Y #HV10s #HY #H destruct
140 elim (lifts_inv_bind1 … HY) -HY #V0 #T0 #HV0 #HT0 #H destruct
141 elim (lift_total V10 0 1) #V20 #HV120
142 elim (liftv_total 0 1 V10s) #V20s #HV120s
143 @(s5 … IHA … (V10 @ V10s) (V20 @ V20s)) /2 width=1/ /2 width=6 by rp_lifts/
144 @(HA … (des + 1)) /2 width=1/
145 [ @(s7 … IHB … HB … HV120) /2 width=1/
147 elim (liftsv_liftv_trans_le … HV10s … HV120s) -V10s #V10s #HV10s #HV120s
148 >(liftv_mono … HV12s … HV10s) -V1s //
150 | #L #Vs #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
151 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
152 elim (lifts_inv_flat1 … HY) -HY #W0 #T0 #HW0 #HT0 #H destruct
153 @(s6 … IHA … (V0 @ V0s)) /2 width=6 by rp_lifts/ /3 width=4/
158 lemma aacr_abst: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
159 ∀a,L,W,T,A,B. RP L W → (
160 ∀L0,V0,T0,des. ⇩*[des] L0 ≡ L → ⇧*[des + 1] T ≡ T0 →
161 ⦃L0, V0⦄ ϵ[RP] 〚B〛 → ⦃L0. ⓓV0, T0⦄ ϵ[RP] 〚A〛
163 ⦃L, ⓛ{a}W. T⦄ ϵ[RP] 〚②B. A〛.
164 #RR #RS #RP #H1RP #H2RP #a #L #W #T #A #B #HW #HA #L0 #V0 #X #des #HB #HL0 #H
165 lapply (aacr_acr … H1RP H2RP A) #HCA
166 lapply (aacr_acr … H1RP H2RP B) #HCB
167 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
168 lapply (s1 … HCB) -HCB #HCB
169 @(s3 … HCA … ◊) /2 width=6 by rp_lifts/
170 @(s5 … HCA … ◊ ◊) // /2 width=1/ /2 width=3/
173 (* Basic_1: removed theorems 2: sc3_arity_gen sc3_repl *)
174 (* Basic_1: removed local theorems 1: sc3_sn3_abst *)