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/lifts_vector.ma".
17 include "Basic_2/computation/acp.ma".
19 (* ABSTRACT COMPUTATION PROPERTIES ******************************************)
21 (* Note: this is Girard's CR1 *)
22 definition S1 ≝ λRP,C:lenv→predicate term.
25 (* Note: this is Tait's iii, or Girard's CR4 *)
26 definition S2 ≝ λRR:lenv→relation term. λRS:relation term. λRP,C:lenv→predicate term.
27 ∀L,Vs. all … (RP L) Vs →
28 ∀T. 𝕊[T] → NF … (RR L) RS T → C L (ⒶVs.T).
30 (* Note: this is Tait's ii *)
31 definition S3 ≝ λRP,C:lenv→predicate term.
32 ∀L,Vs,V,T,W. C L (ⒶVs. 𝕔{Abbr}V. T) → RP L W → C L (ⒶVs. 𝕔{Appl}V. 𝕔{Abst}W. T).
34 definition S5 ≝ λRP,C:lenv→predicate term.
35 ∀L,V1s,V2s. ⇑[0, 1] V1s ≡ V2s →
36 ∀V,T. C (L. 𝕓{Abbr}V) (ⒶV2s. T) → RP L V → C L (ⒶV1s. 𝕔{Abbr}V. T).
38 definition S6 ≝ λRP,C:lenv→predicate term.
39 ∀L,Vs,T,W. C L (ⒶVs. T) → RP L W → C L (ⒶVs. 𝕔{Cast}W. T).
41 definition S7 ≝ λC:lenv→predicate term. ∀L1,L2,T1,T2,d,e.
42 C L1 T1 → ⇓[d, e] L2 ≡ L1 → ⇑[d, e] T1 ≡ T2 → C L2 T2.
44 definition S7s ≝ λC:lenv→predicate term.
45 ∀L1,L2,des. ⇓[des] L2 ≡ L1 →
46 ∀T1,T2. ⇑[des] T1 ≡ T2 → C L1 T1 → C L2 T2.
48 (* properties of the abstract candidate of reducibility *)
49 record acr (RR:lenv->relation term) (RS:relation term) (RP,C:lenv→predicate term) : Prop ≝
58 (* the abstract candidate of reducibility associated to an atomic arity *)
59 let rec aacr (RP:lenv→predicate term) (A:aarity) (L:lenv) on A: predicate term ≝
62 | APair B A ⇒ ∀L0,V0,T0,des. aacr RP B L0 V0 → ⇓[des] L0 ≡ L → ⇑[des] T ≡ T0 →
63 aacr RP A L0 (𝕔{Appl} V0. T0)
67 "candidate of reducibility of an atomic arity (abstract)"
68 'InEInt RP L T A = (aacr RP A L T).
70 (* Basic properties *********************************************************)
72 lemma acr_lifts: ∀C. S7 C → S7s C.
73 #C #HC #L1 #L2 #des #H elim H -L1 -L2 -des
75 <(lifts_inv_nil … H) -H //
76 | #L1 #L #L2 #des #d #e #_ #HL2 #IHL #T2 #T1 #H #HLT2
77 elim (lifts_inv_cons … H) -H /3 width=9/
81 lemma rp_lifts: ∀RR,RS,RP. acr RR RS RP (λL,T. RP L T) →
82 ∀des,L0,L,V,V0. ⇓[des] L0 ≡ L → ⇑[des] V ≡ V0 →
84 #RR #RS #RP #HRP #des #L0 #L #V #V0 #HL0 #HV0 #HV
89 lemma rp_liftsv_all: ∀RR,RS,RP. acr RR RS RP (λL,T. RP L T) →
90 ∀des,L0,L,Vs,V0s. ⇑[des] Vs ≡ V0s → ⇓[des] L0 ≡ L →
91 all … (RP L) Vs → all … (RP L0) V0s.
92 #RR #RS #RP #HRP #des #L0 #L #Vs #V0s #H elim H -Vs -V0s normalize //
93 #T1s #T2s #T1 #T2 #HT12 #_ #IHT2s #HL0 * #HT1 #HT1s
94 @conj /2 width=1/ /2 width=6 by rp_lifts/
97 axiom aacr_acr: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
98 ∀A. acr RR RS RP (aacr RP A).
100 #RR #RS #RP #H1RP #H2RP #A elim A -A normalize //
101 #B #A #IHB #IHA @mk_acr normalize
103 lapply (H ? (⋆0) ? ⟠ ? ? ?) -H
105 | @(s2 … IHB … ◊) // /2 width=2/
106 | #H @(cp3 … H1RP … 0) @(s1 … IHA) //
108 | #L #Vs #HVs #T #H1T #H2T #L0 #V0 #X #des #HB #HL0 #H
109 elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
110 lapply (s1 … IHB … HB) #HV0
111 @(s2 … IHA … (V0 :: V0s)) /2 width=4 by lifts_simple_dx/ /3 width=6/
112 | #L #Vs #U #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
113 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
114 elim (lifts_inv_flat1 … HY) -HY #U0 #X #HU0 #HX #H destruct
115 elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
116 @(s3 … IHA … (V0 :: V0s)) /2 width=6 by rp_lifts/ /4 width=5/
117 | #L #V1s #V2s #HV12s #V #T #HA #HV #L0 #V10 #X #des #HB #HL0 #H
118 elim (lifts_inv_applv1 … H) -H #V10s #Y #HV10s #HY #H destruct
119 elim (lifts_inv_bind1 … HY) -HY #V0 #T0 #HV0 #HT0 #H destruct
120 elim (lift_total V10 0 1) #V20 #HV120
121 elim (liftv_total 0 1 V10s) #V20s #HV120s
122 @(s5 … IHA … (V10 :: V10s) (V20 :: V20s)) /2 width=1/ /2 width=6 by rp_lifts/
123 @(HA … (ss des)) /2 width=1/
124 [ @(s7 … IHB … HB … HV120) /2 width=1/
127 | #L #Vs #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
128 elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
129 elim (lifts_inv_flat1 … HY) -HY #W0 #T0 #HW0 #HT0 #H destruct
130 @(s6 … IHA … (V0 :: V0s)) /2 width=6 by rp_lifts/ /3 width=4/
135 lemma aacr_abst: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
136 ∀L,W,T,A,B. RP L W → (
137 ∀L0,V0,T0,des. ⇓[des] L0 ≡ L → ⇑[ss des] T ≡ T0 →
138 ⦃L0, V0⦄ [RP] ϵ 〚B〛→ ⦃L0. 𝕓{Abbr} V0, T0⦄ [RP] ϵ 〚A〛
140 ⦃L, 𝕓{Abst} W. T⦄ [RP] ϵ 〚𝕔 B. A〛.
141 #RR #RS #RP #H1RP #H2RP #L #W #T #A #B #HW #HA #L0 #V0 #X #des #HB #HL0 #H
142 lapply (aacr_acr … H1RP H2RP A) #HCA
143 lapply (aacr_acr … H1RP H2RP B) #HCB
144 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
145 lapply (s1 … HCB) -HCB #HCB
146 @(s3 … HCA … ◊) /2 width=6 by rp_lifts/
147 @(s5 … HCA … ◊ ◊) // /2 width=1/ /2 width=3/