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/notation/relations/ineint_5.ma".
16 include "basic_2/grammar/aarity.ma".
17 include "basic_2/substitution/lift_vector.ma".
18 include "basic_2/computation/gcp.ma".
20 (* GENERIC COMPUTATION PROPERTIES *******************************************)
22 definition S0 ≝ λC:candidate. ∀G,L1,L2,T1,T2. ⦃L1, T1⦄ ⇳[Ⓕ] ⦃L2, T2⦄ →
23 C G L1 T1 → C G L2 T2.
25 definition S0s ≝ λC:candidate. ∀G,L1,L2,T1,T2. ⦃L1, T1⦄ ⇳*[Ⓕ] ⦃L2, T2⦄ →
26 C G L1 T1 → C G L2 T2.
28 (* Note: this is Girard's CR1 *)
29 definition S1 ≝ λRP,C:candidate.
30 ∀G,L,T. C G L T → RP G L T.
32 (* Note: this is Tait's iii, or Girard's CR4 *)
33 definition S2 ≝ λRR:relation4 genv lenv term term. λRS:relation term. λRP,C:candidate.
34 ∀G,L,Vs. all … (RP G L) Vs →
35 ∀T. 𝐒⦃T⦄ → NF … (RR G L) RS T → C G L (ⒶVs.T).
37 (* Note: this generalizes Tait's ii *)
38 definition S3 ≝ λC:candidate.
40 C G L (ⒶVs.ⓓ{a}ⓝW.V.T) → C G L (ⒶVs.ⓐV.ⓛ{a}W.T).
42 definition S4 ≝ λRP,C:candidate.
43 ∀G,L,Vs. all … (RP G L) Vs → ∀k. C G L (ⒶVs.⋆k).
45 definition S5 ≝ λC:candidate. ∀I,G,L,K,Vs,V1,V2,i.
46 C G L (ⒶVs.V2) → ⇧[0, i+1] V1 ≡ V2 →
47 ⇩[i] L ≡ K.ⓑ{I}V1 → C G L (ⒶVs.#i).
49 definition S6 ≝ λRP,C:candidate.
50 ∀G,L,V1s,V2s. ⇧[0, 1] V1s ≡ V2s →
51 ∀a,V,T. C G (L.ⓓV) (ⒶV2s.T) → RP G L V → C G L (ⒶV1s.ⓓ{a}V.T).
53 definition S7 ≝ λC:candidate.
54 ∀G,L,Vs,T,W. C G L (ⒶVs.T) → C G L (ⒶVs.W) → C G L (ⒶVs.ⓝW.T).
56 (* requirements for the generic reducibility candidate *)
57 record gcr (RR:relation4 genv lenv term term) (RS:relation term) (RP,C:candidate) : Prop ≝
68 (* the functional construction for candidates *)
69 definition cfun: candidate → candidate → candidate ≝
70 λC1,C2,G,K,T. ∀L,V,U. ⦃K, T⦄ ⇳*[Ⓕ] ⦃L, U⦄ →
71 C1 G L V → C2 G L (ⓐV.U).
73 (* the reducibility candidate associated to an atomic arity *)
74 let rec acr (RP:candidate) (A:aarity) on A: candidate ≝
77 | APair B A ⇒ cfun (acr RP B) (acr RP A)
81 "candidate of reducibility of an atomic arity (abstract)"
82 'InEInt RP G L T A = (acr RP A G L T).
84 (* Basic properties *********************************************************)
86 (* Basic_1: was just: sc3_lift1 *)
87 lemma gcr_fpas: ∀C. S0 C → S0s C.
88 #C #HC #G #L1 #L2 #T1 #T2 #H @(fpas_ind … H) -L2 -T2 /3 width=5 by/
91 lemma rp_lifts: ∀RR,RS,RP. gcr RR RS RP RP →
92 ∀des,G,L0,L,V,V0. ⇩*[Ⓕ, des] L0 ≡ L → ⇧*[des] V ≡ V0 →
93 RP G L V → RP G L0 V0.
94 #RR #RS #RP #HRP #des #G #L0 #L #V #V0 #HL0 #HV0 #HV
95 @gcr_lifts /width=7 by/
99 (* Basic_1: was only: sns3_lifts1 *)
100 lemma rp_liftsv_all: ∀RR,RS,RP. gcr RR RS RP RP →
101 ∀des,G,L0,L,Vs,V0s. ⇩*[Ⓕ, des] L0 ≡ L → ⇧*[des] Vs ≡ V0s →
102 all … (RP G L) Vs → all … (RP G L0) V0s.
103 #RR #RS #RP #HRP #des #G #L0 #L #Vs #V0s #HL0 #H elim H -Vs -V0s normalize //
104 #T1s #T2s #T1 #T2 #HT12 #_ #IHT2s * /3 width=7 by rp_lifts, conj/
108 sc3_sn3 sc3_abst sc3_appl sc3_abbr sc3_bind sc3_cast sc3_lift
110 lemma acr_gcr: ∀RR,RS,RP. gcp RR RS RP → gcr RR RS RP RP →
111 ∀A. gcr RR RS RP (acr RP A).
112 #RR #RS #RP #H1RP #H2RP #A elim A -A //
113 #B #A #IHB #IHA @mk_gcr
114 [ /3 width=4 by fpas_strap2/
116 elim (cp1 … H1RP G L) #k #HK
117 lapply (H L (⋆k) T ? ?) -H //
118 [ @(s2 … IHB … (◊)) //
119 | #H @(cp2 … H1RP … k) @(s1 … IHA) //
121 | #G #L #Vs #HVs #T #H1T #H2T #L0 #V0 #X #H #HB
122 elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
123 lapply (s1 … IHB … HB) #HV0
124 @(s2 … IHA … (V0 @ V0s))
125 /3 width=14 by rp_liftsv_all, gcp_lifts, cp0, lifts_simple_dx, conj/
126 | #a #G #L #Vs #U #T #W #HA #L0 #V0 #X #des #HL0 #H #HB
127 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
128 elim (lifts_inv_flat1 … HY) -HY #U0 #X #HU0 #HX #H destruct
129 elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
130 @(s3 … IHA … (V0 @ V0s)) /5 width=6 by lifts_applv, lifts_flat, lifts_bind/
131 | #G #L #Vs #HVs #k #L0 #V0 #X #des #HL0 #H #HB
132 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
133 >(lifts_inv_sort1 … HY) -Y
134 lapply (s1 … IHB … HB) #HV0
135 @(s4 … IHA … (V0 @ V0s)) /3 width=7 by rp_liftsv_all, conj/
136 | #I #G #L #K #Vs #V1 #V2 #i #HA #HV12 #HLK #L0 #V0 #X #des #HL0 #H #HB
137 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
138 elim (lifts_inv_lref1 … HY) -HY #i0 #Hi0 #H destruct
139 elim (drops_drop_trans … HL0 … HLK) #X #des0 #i1 #HL02 #H #Hi1 #Hdes0
140 >(at_mono … Hi1 … Hi0) in HL02; -i1 #HL02
141 elim (drops_inv_skip2 … Hdes0 … H) -H -des0 #L2 #W1 #des0 #Hdes0 #HLK #HVW1 #H destruct
142 elim (lift_total W1 0 (i0 + 1)) #W2 #HW12
143 elim (lifts_lift_trans … Hdes0 … HVW1 … HW12) // -Hdes0 -Hi0 #V3 #HV13 #HVW2
144 >(lift_mono … HV13 … HV12) in HVW2; -V3 #HVW2
145 @(s5 … IHA … (V0 @ V0s) … HW12 HL02) /3 width=5 by lifts_applv/
146 | #G #L #V1s #V2s #HV12s #a #V #T #HA #HV #L0 #V10 #X #des #HL0 #H #HB
147 elim (lifts_inv_applv1 … H) -H #V10s #Y #HV10s #HY #H destruct
148 elim (lifts_inv_bind1 … HY) -HY #V0 #T0 #HV0 #HT0 #H destruct
149 elim (lift_total V10 0 1) #V20 #HV120
150 elim (liftv_total 0 1 V10s) #V20s #HV120s
151 @(s6 … IHA … (V10 @ V10s) (V20 @ V20s)) /3 width=7 by rp_lifts, liftv_cons/
152 @(HA … (des + 1)) /2 width=2 by drops_skip/
154 elim (liftsv_liftv_trans_le … HV10s … HV120s) -V10s #V10s #HV10s #HV120s
155 >(liftv_mono … HV12s … HV10s) -V1s //
156 | @(s0 … IHB … HB … HV120) /2 width=2 by drop_drop/
158 | #G #L #Vs #T #W #HA #HW #L0 #V0 #X #des #HL0 #H #HB
159 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
160 elim (lifts_inv_flat1 … HY) -HY #W0 #T0 #HW0 #HT0 #H destruct
161 @(s7 … IHA … (V0 @ V0s)) /3 width=5 by lifts_applv/
165 lemma acr_abst: ∀RR,RS,RP. gcp RR RS RP → gcr RR RS RP RP →
166 ∀a,G,L,W,T,A,B. ⦃G, L, W⦄ ϵ[RP] 〚B〛 → (
167 ∀L0,V0,W0,T0,des. ⇩*[Ⓕ, des] L0 ≡ L → ⇧*[des] W ≡ W0 → ⇧*[des + 1] T ≡ T0 →
168 ⦃G, L0, V0⦄ ϵ[RP] 〚B〛 → ⦃G, L0, W0⦄ ϵ[RP] 〚B〛 → ⦃G, L0.ⓓⓝW0.V0, T0⦄ ϵ[RP] 〚A〛
170 ⦃G, L, ⓛ{a}W.T⦄ ϵ[RP] 〚②B.A〛.
171 #RR #RS #RP #H1RP #H2RP #a #G #L #W #T #A #B #HW #HA #L0 #V0 #X #des #HL0 #H #HB
172 lapply (acr_gcr … H1RP H2RP A) #HCA
173 lapply (acr_gcr … H1RP H2RP B) #HCB
174 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
175 lapply (gcr_lifts … HL0 … HW0 HW) -HW [ @(s0 … HCB) ] #HW0
177 @(s6 … HCA … (◊) (◊)) //
179 | lapply (s1 … HCB) -HCB #HCB
180 @(s7 … H2RP … (◊)) /2 width=1 by/
184 (* Basic_1: removed theorems 2: sc3_arity_gen sc3_repl *)
185 (* Basic_1: removed local theorems 1: sc3_sn3_abst *)