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 "static_2/notation/relations/inwbrackets_5.ma".
16 include "static_2/syntax/aarity.ma".
17 include "static_2/relocation/lifts_simple.ma".
18 include "static_2/relocation/lifts_lifts_vector.ma".
19 include "static_2/relocation/drops_drops.ma".
20 include "static_2/static/gcp.ma".
22 (* GENERIC COMPUTATION PROPERTIES *******************************************)
24 (* Note: this is Girard's CR1 *)
25 definition S1 ≝ λRP,C:candidate.
26 ∀G,L,T. C G L T → RP G L T.
28 (* Note: this is Tait's iii, or Girard's CR4 *)
29 definition S2 ≝ λRR:relation4 genv lenv term term. λRS:relation term. λRP,C:candidate.
30 ∀G,L,Vs. all … (RP G L) Vs →
31 ∀T. 𝐒❨T❩ → nf RR RS G L T → C G L (ⒶVs.T).
33 (* Note: this generalizes Tait's ii, or Girard's CR3 *)
34 definition S3 ≝ λC:candidate.
36 C G L (ⒶVs.ⓓ[a]ⓝW.V.T) → C G L (ⒶVs.ⓐV.ⓛ[a]W.T).
38 definition S5 ≝ λC:candidate. ∀I,G,L,K,Vs,V1,V2,i.
39 C G L (ⒶVs.V2) → ⇧[↑i] V1 ≘ V2 →
40 ⇩[i] L ≘ K.ⓑ[I]V1 → C G L (ⒶVs.#i).
42 definition S6 ≝ λRP,C:candidate.
43 ∀G,L,V1b,V2b. ⇧[1] V1b ≘ V2b →
44 ∀a,V,T. C G (L.ⓓV) (ⒶV2b.T) → RP G L V → C G L (ⒶV1b.ⓓ[a]V.T).
46 definition S7 ≝ λC:candidate.
47 ∀G,L,Vs,T,W. C G L (ⒶVs.T) → C G L (ⒶVs.W) → C G L (ⒶVs.ⓝW.T).
49 (* requirements for the generic reducibility candidate *)
50 record gcr (RR:relation4 genv lenv term term) (RS:relation term) (RP,C:candidate) : Prop ≝
59 (* the functional construction for candidates *)
60 definition cfun: candidate → candidate → candidate ≝
61 λC1,C2,G,K,T. ∀f,L,W,U.
62 ⇩*[Ⓕ,f] L ≘ K → ⇧*[f] T ≘ U → C1 G L W → C2 G L (ⓐW.U).
64 (* the reducibility candidate associated to an atomic arity *)
65 rec definition acr (RP:candidate) (A:aarity) on A: candidate ≝
68 | APair B A ⇒ cfun (acr RP B) (acr RP A)
72 "reducibility candidate of an atomic arity (abstract)"
73 'InWBrackets RP G L T A = (acr RP A G L T).
75 (* Basic properties *********************************************************)
77 (* Note: this requires Ⓕ-slicing in cfun since b is unknown in d_liftable_1 *)
78 (* Note: this requires multiple relocation *)
79 (* Basic 1: includes: sc3_lift *)
80 (* Basic 2A1: includes: gcr_lift *)
81 (* Basic 2A1: note: gcr_lift should be acr_lift *)
82 (* Basic_1: was: sc3_lift1 *)
83 (* Basic 2A1: was: gcr_lifts *)
84 (* Basic 2A1: note: gcr_lifts should be acr_lifts *)
85 lemma acr_lifts: ∀RR,RS,RP. gcp RR RS RP → ∀A,G. d_liftable1 (acr RP A G).
86 #RR #RS #RP #H #A #G elim A -A
88 | #B #A #HB #HA #K #T #HKT #b #f #L #HLK #U #HTU #f0 #L0 #W #U0 #HL0 #HU0 #HW
89 lapply (drops_trans … HL0 … HLK ??) [3:|*: // ] -L #HL0K
90 lapply (lifts_trans … HTU … HU0 ??) [3:|*: // ] -U #HTU0
91 /2 width=3 by/ (**) (* full auto fails *)
96 sc3_sn3 sc3_abst sc3_appl sc3_abbr sc3_bind sc3_cast
98 (* Note: one sort must exist *)
99 lemma acr_gcr: ∀RR,RS,RP. gcp RR RS RP → gcr RR RS RP RP →
100 ∀A. gcr RR RS RP (acr RP A).
101 #RR #RS #RP #H1RP #H2RP #A elim A -A //
102 #B #A #IHB #IHA @mk_gcr
104 letin s ≝ 0 (* one sort must exist *)
105 lapply (cp1 … H1RP G L s) #HK
106 lapply (s2 … IHB G L (ⓔ) … HK) // #HB
107 lapply (H (𝐢) L (⋆s) T ? ? ?) -H
108 /3 width=6 by s1, cp3, drops_refl, lifts_refl/
109 | #G #L #Vs #HVs #T #H1T #H2T #f #L0 #V0 #X #HL0 #H #HB
110 elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
111 lapply (s1 … IHB … HB) #HV0
112 @(s2 … IHA … (V0⨮V0s)) /3 width=13 by cp0, gcp2_all, lifts_simple_dx, conj/
113 | #p #G #L #Vs #U #T #W #HA #f #L0 #V0 #X #HL0 #H #HB
114 elim (lifts_inv_applv1 … H) -H #V0s #X0 #HV0s #H0 #H destruct
115 elim (lifts_inv_flat1 … H0) -H0 #U0 #X #HU0 #HX #H destruct
116 elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
117 @(s3 … IHA … (V0⨮V0s)) /5 width=6 by lifts_applv, lifts_flat, lifts_bind/
118 | #I #G #L #K #Vs #V1 #V2 #i #HA #HV12 #HLK #f #L0 #V0 #X #HL0 #H #HB
119 elim (lifts_inv_applv1 … H) -H #V0s #X0 #HV0s #H0 #H destruct
120 elim (lifts_inv_lref1 … H0) -H0 #j #Hf #H destruct
121 lapply (drops_trans … HL0 … HLK ??) [3: |*: // ] -HLK #H
122 elim (drops_split_trans … H) -H [ |*: /2 width=6 by pr_after_nat_uni/ ] #Y #HLK0 #HY
123 lapply (drops_tls_at … Hf … HY) -HY #HY
124 elim (drops_inv_skip2 … HY) -HY #Z #K0 #HK0 #HZ #H destruct
125 elim (liftsb_inv_pair_sn … HZ) -HZ #W1 #HVW1 #H destruct
126 elim (lifts_total W1 (𝐔❨↑j❩)) #W2 #HW12
127 lapply (lifts_trans … HVW1 … HW12 ??) -HVW1 [3: |*: // ] #H
128 lapply (lifts_conf … HV12 … H f ?) -V1 [ /2 width=3 by pr_pat_after_uni_tls/ ] #HVW2
129 @(s5 … IHA … (V0⨮V0s) … HW12) /3 width=4 by drops_inv_gen, lifts_applv/
130 | #G #L #V1s #V2s #HV12s #p #V #T #HA #HV #f #L0 #V10 #X #HL0 #H #HB
131 elim (lifts_inv_applv1 … H) -H #V10s #X0 #HV10s #H0 #H destruct
132 elim (lifts_inv_bind1 … H0) -H0 #V0 #T0 #HV0 #HT0 #H destruct
133 elim (lifts_total V10 (𝐔❨1❩)) #V20 #HV120
134 elim (liftsv_total (𝐔❨1❩) V10s) #V20s #HV120s
135 @(s6 … IHA … (V10⨮V10s) (V20⨮V20s)) /3 width=7 by cp2, liftsv_cons/
136 @(HA … (⫯f)) /3 width=2 by drops_skip, ext2_pair/
138 lapply (liftsv_trans … HV10s … HV120s ??) -V10s [3: |*: // ] #H
139 elim (liftsv_split_trans … H (𝐔❨1❩) (⫯f)) /2 width=1 by pr_after_unit_sn/ #V10s #HV10s #HV120s
140 >(liftsv_mono … HV12s … HV10s) -V1s //
141 | @(acr_lifts … H1RP … HB … HV120) /3 width=2 by drops_refl, drops_drop/
143 | #G #L #Vs #T #W #HA #HW #f #L0 #V0 #X #HL0 #H #HB
144 elim (lifts_inv_applv1 … H) -H #V0s #X0 #HV0s #H0 #H destruct
145 elim (lifts_inv_flat1 … H0) -H0 #W0 #T0 #HW0 #HT0 #H destruct
146 @(s7 … IHA … (V0⨮V0s)) /3 width=5 by lifts_applv/
150 lemma acr_abst: ∀RR,RS,RP. gcp RR RS RP → gcr RR RS RP RP →
151 ∀p,G,L,W,T,A,B. ❨G,L,W❩ ϵ ⟦B⟧[RP] → (
152 ∀b,f,L0,V0,W0,T0. ⇩*[b,f] L0 ≘ L → ⇧*[f] W ≘ W0 → ⇧*[⫯f] T ≘ T0 →
153 ❨G,L0,V0❩ ϵ ⟦B⟧[RP] → ❨G,L0,W0❩ ϵ ⟦B⟧[RP] → ❨G,L0.ⓓⓝW0.V0,T0❩ ϵ ⟦A⟧[RP]
155 ❨G,L,ⓛ[p]W.T❩ ϵ ⟦②B.A⟧[RP].
156 #RR #RS #RP #H1RP #H2RP #p #G #L #W #T #A #B #HW #HA #f #L0 #V0 #X #HL0 #H #HB
157 lapply (acr_gcr … H1RP H2RP A) #HCA
158 lapply (acr_gcr … H1RP H2RP B) #HCB
159 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
160 lapply (acr_lifts … H1RP … HW … HL0 … HW0) -HW #HW0
161 lapply (s3 … HCA … p G L0 (ⓔ)) #H @H -H
162 lapply (s6 … HCA G L0 (ⓔ) (ⓔ) ?) // #H @H -H
164 | lapply (s1 … HCB) -HCB #HCB
165 lapply (s7 … H2RP G L0 (ⓔ)) /3 width=1 by/
169 (* Basic_1: removed theorems 2: sc3_arity_gen sc3_repl *)
170 (* Basic_1: removed local theorems 1: sc3_sn3_abst *)