]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/static/gcp_cr.ma
syntactic components detached from basic_2 become static_2
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / static / gcp_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 "static_2/notation/relations/ineint_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".
21
22 (* GENERIC COMPUTATION PROPERTIES *******************************************)
23
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.
27
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 G L) RS T → C G L (ⒶVs.T).
32
33 (* Note: this generalizes Tait's ii *)
34 definition S3 ≝ λC:candidate.
35                 ∀a,G,L,Vs,V,T,W.
36                 C G L (ⒶVs.ⓓ{a}ⓝW.V.T) → C G L (ⒶVs.ⓐV.ⓛ{a}W.T).
37
38 definition S4 ≝ λRP,C:candidate.
39                 ∀G,L,Vs. all … (RP G L) Vs → ∀s. C G L (ⒶVs.⋆s).
40
41 definition S5 ≝ λC:candidate. ∀I,G,L,K,Vs,V1,V2,i.
42                 C G L (ⒶVs.V2) → ⬆*[↑i] V1 ≘ V2 →
43                 ⬇*[i] L ≘ K.ⓑ{I}V1 → C G L (ⒶVs.#i).
44
45 definition S6 ≝ λRP,C:candidate.
46                 ∀G,L,V1b,V2b. ⬆*[1] V1b ≘ V2b →
47                 ∀a,V,T. C G (L.ⓓV) (ⒶV2b.T) → RP G L V → C G L (ⒶV1b.ⓓ{a}V.T).
48
49 definition S7 ≝ λC:candidate.
50                 ∀G,L,Vs,T,W. C G L (ⒶVs.T) → C G L (ⒶVs.W) → C G L (ⒶVs.ⓝW.T).
51
52 (* requirements for the generic reducibility candidate *)
53 record gcr (RR:relation4 genv lenv term term) (RS:relation term) (RP,C:candidate) : Prop ≝
54 { s1: S1 RP C;
55   s2: S2 RR RS RP C;
56   s3: S3 C;
57   s4: S4 RP C;
58   s5: S5 C;
59   s6: S6 RP C;
60   s7: S7 C
61 }.
62
63 (* the functional construction for candidates *)
64 definition cfun: candidate → candidate → candidate ≝
65                  λC1,C2,G,K,T. ∀f,L,W,U.
66                  ⬇*[Ⓕ, f] L ≘ K → ⬆*[f] T ≘ U → C1 G L W → C2 G L (ⓐW.U).
67
68 (* the reducibility candidate associated to an atomic arity *)
69 rec definition acr (RP:candidate) (A:aarity) on A: candidate ≝
70 match A with
71 [ AAtom     ⇒ RP
72 | APair B A ⇒ cfun (acr RP B) (acr RP A)
73 ].
74
75 interpretation
76    "reducibility candidate of an atomic arity (abstract)"
77    'InEInt RP G L T A = (acr RP A G L T).
78
79 (* Basic properties *********************************************************)
80
81 (* Note: this requires Ⓕ-slicing in cfun since b is unknown in d_liftable_1 *) 
82 (* Note: this requires multiple relocation *)
83 (* Basic 1: includes: sc3_lift *)
84 (* Basic 2A1: includes: gcr_lift *)
85 (* Basic 2A1: note: gcr_lift should be acr_lift *)
86 (* Basic_1: was: sc3_lift1 *)
87 (* Basic 2A1: was: gcr_lifts *)
88 (* Basic 2A1: note: gcr_lifts should be acr_lifts *)
89 lemma acr_lifts: ∀RR,RS,RP. gcp RR RS RP → ∀A,G. d_liftable1 (acr RP A G).
90 #RR #RS #RP #H #A #G elim A -A
91 [ /2 width=7 by cp2/
92 | #B #A #HB #HA #K #T #HKT #b #f #L #HLK #U #HTU #f0 #L0 #W #U0 #HL0 #HU0 #HW
93   lapply (drops_trans … HL0 … HLK ??) [3:|*: // ] -L #HL0K
94   lapply (lifts_trans … HTU … HU0 ??) [3:|*: // ] -U #HTU0
95   /2 width=3 by/ (**) (* full auto fails *)
96 ]
97 qed-.
98
99 (* Basic_1: was:
100    sc3_sn3 sc3_abst sc3_appl sc3_abbr sc3_bind sc3_cast
101 *)
102 lemma acr_gcr: ∀RR,RS,RP. gcp RR RS RP → gcr RR RS RP RP →
103                ∀A. gcr RR RS RP (acr RP A).
104 #RR #RS #RP #H1RP #H2RP #A elim A -A //
105 #B #A #IHB #IHA @mk_gcr
106 [ #G #L #T #H
107   elim (cp1 … H1RP G L) #s #HK
108   lapply (s2 … IHB G L (Ⓔ) … HK) // #HB
109   lapply (H (𝐈𝐝) L (⋆s) T ? ? ?) -H
110   /3 width=6 by s1, cp3, drops_refl, lifts_refl/
111 | #G #L #Vs #HVs #T #H1T #H2T #f #L0 #V0 #X #HL0 #H #HB
112   elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
113   lapply (s1 … IHB … HB) #HV0
114   @(s2 … IHA  … (V0⨮V0s)) /3 width=13 by cp0, gcp2_all, lifts_simple_dx, conj/
115 | #p #G #L #Vs #U #T #W #HA #f #L0 #V0 #X #HL0 #H #HB
116   elim (lifts_inv_applv1 … H) -H #V0s #X0 #HV0s #H0 #H destruct
117   elim (lifts_inv_flat1 … H0) -H0 #U0 #X #HU0 #HX #H destruct
118   elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
119   @(s3 … IHA … (V0⨮V0s)) /5 width=6 by lifts_applv, lifts_flat, lifts_bind/
120 | #G #L #Vs #HVs #s #f #L0 #V0 #X #HL0 #H #HB
121   elim (lifts_inv_applv1 … H) -H #V0s #X0 #HV0s #H0 #H destruct
122   >(lifts_inv_sort1 … H0) -X0
123   lapply (s1 … IHB … HB) #HV0
124   @(s4 … IHA … (V0⨮V0s)) /3 width=7 by gcp2_all, conj/
125 | #I #G #L #K #Vs #V1 #V2 #i #HA #HV12 #HLK #f #L0 #V0 #X #HL0 #H #HB
126   elim (lifts_inv_applv1 … H) -H #V0s #X0 #HV0s #H0 #H destruct
127   elim (lifts_inv_lref1 … H0) -H0 #j #Hf #H destruct
128   lapply (drops_trans … HL0 … HLK ??) [3: |*: // ] -HLK #H
129   elim (drops_split_trans … H) -H [ |*: /2 width=6 by after_uni_dx/ ] #Y #HLK0 #HY
130   lapply (drops_tls_at … Hf … HY) -HY #HY
131   elim (drops_inv_skip2 … HY) -HY #Z #K0 #HK0 #HZ #H destruct
132   elim (liftsb_inv_pair_sn … HZ) -HZ #W1 #HVW1 #H destruct
133   elim (lifts_total W1 (𝐔❴↑j❵)) #W2 #HW12
134   lapply (lifts_trans … HVW1 … HW12 ??) -HVW1 [3: |*: // ] #H
135   lapply (lifts_conf … HV12 … H f ?) -V1 [ /2 width=3 by after_uni_succ_sn/ ] #HVW2
136   @(s5 … IHA … (V0⨮V0s) … HW12) /3 width=4 by drops_inv_gen, lifts_applv/
137 | #G #L #V1s #V2s #HV12s #p #V #T #HA #HV #f #L0 #V10 #X #HL0 #H #HB
138   elim (lifts_inv_applv1 … H) -H #V10s #X0 #HV10s #H0 #H destruct
139   elim (lifts_inv_bind1 … H0) -H0 #V0 #T0 #HV0 #HT0 #H destruct
140   elim (lifts_total V10 (𝐔❴1❵)) #V20 #HV120
141   elim (liftsv_total (𝐔❴1❵) V10s) #V20s #HV120s
142   @(s6 … IHA … (V10⨮V10s) (V20⨮V20s)) /3 width=7 by cp2, liftsv_cons/
143   @(HA … (⫯f)) /3 width=2 by drops_skip, ext2_pair/
144   [ @lifts_applv //
145     lapply (liftsv_trans … HV10s … HV120s ??) -V10s [3: |*: // ] #H
146     elim (liftsv_split_trans … H (𝐔❴1❵) (⫯f)) /2 width=1 by after_uni_one_sn/ #V10s #HV10s #HV120s
147     >(liftsv_mono … HV12s … HV10s) -V1s //
148   | @(acr_lifts … H1RP … HB … HV120) /3 width=2 by drops_refl, drops_drop/
149   ]
150 | #G #L #Vs #T #W #HA #HW #f #L0 #V0 #X #HL0 #H #HB
151   elim (lifts_inv_applv1 … H) -H #V0s #X0 #HV0s #H0 #H destruct
152   elim (lifts_inv_flat1 … H0) -H0 #W0 #T0 #HW0 #HT0 #H destruct
153   @(s7 … IHA … (V0⨮V0s)) /3 width=5 by lifts_applv/
154 ]
155 qed.
156
157 lemma acr_abst: ∀RR,RS,RP. gcp RR RS RP → gcr RR RS RP RP →
158                 ∀p,G,L,W,T,A,B. ⦃G, L, W⦄ ϵ[RP] 〚B〛 → (
159                    ∀b,f,L0,V0,W0,T0. ⬇*[b, f] L0 ≘ L → ⬆*[f] W ≘ W0 → ⬆*[⫯f] T ≘ T0 →
160                                    ⦃G, L0, V0⦄ ϵ[RP] 〚B〛 → ⦃G, L0, W0⦄ ϵ[RP] 〚B〛 → ⦃G, L0.ⓓⓝW0.V0, T0⦄ ϵ[RP] 〚A〛
161                 ) →
162                 ⦃G, L, ⓛ{p}W.T⦄ ϵ[RP] 〚②B.A〛.
163 #RR #RS #RP #H1RP #H2RP #p #G #L #W #T #A #B #HW #HA #f #L0 #V0 #X #HL0 #H #HB
164 lapply (acr_gcr … H1RP H2RP A) #HCA
165 lapply (acr_gcr … H1RP H2RP B) #HCB
166 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
167 lapply (acr_lifts … H1RP … HW … HL0 … HW0) -HW #HW0
168 lapply (s3 … HCA … p G L0 (Ⓔ)) #H @H -H
169 lapply (s6 … HCA G L0 (Ⓔ) (Ⓔ) ?) // #H @H -H
170 [ @(HA … HL0) //
171 | lapply (s1 … HCB) -HCB #HCB
172   lapply (s7 … H2RP G L0 (Ⓔ)) /3 width=1 by/
173 ]
174 qed.
175
176 (* Basic_1: removed theorems 2: sc3_arity_gen sc3_repl *)
177 (* Basic_1: removed local theorems 1: sc3_sn3_abst *)