]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/computation/gcp_cr.ma
milestone update in ground_2 and basic_2A
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / computation / 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 "basic_2A/notation/relations/ineint_5.ma".
16 include "basic_2A/grammar/aarity.ma".
17 include "basic_2A/multiple/lifts_lift_vector.ma".
18 include "basic_2A/multiple/drops_drop.ma".
19 include "basic_2A/computation/gcp.ma".
20
21 (* GENERIC COMPUTATION PROPERTIES *******************************************)
22
23 (* Note: this is Girard's CR1 *)
24 definition S1 ≝ λRP,C:candidate.
25                 ∀G,L,T. C G L T → RP G L T.
26
27 (* Note: this is Tait's iii, or Girard's CR4 *)
28 definition S2 ≝ λRR:relation4 genv lenv term term. λRS:relation term. λRP,C:candidate.
29                 ∀G,L,Vs. all … (RP G L) Vs →
30                 ∀T. 𝐒⦃T⦄ → NF … (RR G L) RS T → C G L (ⒶVs.T).
31
32 (* Note: this generalizes Tait's ii *)
33 definition S3 ≝ λC:candidate.
34                 ∀a,G,L,Vs,V,T,W.
35                 C G L (ⒶVs.ⓓ{a}ⓝW.V.T) → C G L (ⒶVs.ⓐV.ⓛ{a}W.T).
36
37 definition S4 ≝ λRP,C:candidate.
38                 ∀G,L,Vs. all … (RP G L) Vs → ∀k. C G L (ⒶVs.⋆k).
39
40 definition S5 ≝ λC:candidate. ∀I,G,L,K,Vs,V1,V2,i.
41                 C G L (ⒶVs.V2) → ⬆[0, i+1] V1 ≡ V2 →
42                 ⬇[i] L ≡ K.ⓑ{I}V1 → C G L (ⒶVs.#i).
43
44 definition S6 ≝ λRP,C:candidate.
45                 ∀G,L,V1s,V2s. ⬆[0, 1] V1s ≡ V2s →
46                 ∀a,V,T. C G (L.ⓓV) (ⒶV2s.T) → RP G L V → C G L (ⒶV1s.ⓓ{a}V.T).
47
48 definition S7 ≝ λC:candidate.
49                 ∀G,L,Vs,T,W. C G L (ⒶVs.T) → C G L (ⒶVs.W) → C G L (ⒶVs.ⓝW.T).
50
51 (* requirements for the generic reducibility candidate *)
52 record gcr (RR:relation4 genv lenv term term) (RS:relation term) (RP,C:candidate) : Prop ≝
53 { s1: S1 RP C;
54   s2: S2 RR RS RP C;
55   s3: S3 C;
56   s4: S4 RP C;
57   s5: S5 C;
58   s6: S6 RP C;
59   s7: S7 C
60 }.
61
62 (* the functional construction for candidates *)
63 definition cfun: candidate → candidate → candidate ≝
64                  λC1,C2,G,K,T. ∀L,W,U,cs.
65                  ⬇*[Ⓕ, cs] L ≡ K → ⬆*[cs] T ≡ U → C1 G L W → C2 G L (ⓐW.U).
66
67 (* the reducibility candidate associated to an atomic arity *)
68 let rec acr (RP:candidate) (A:aarity) on A: candidate ≝
69 match A with
70 [ AAtom     ⇒ RP
71 | APair B A ⇒ cfun (acr RP B) (acr RP A)
72 ].
73
74 interpretation
75    "candidate of reducibility of an atomic arity (abstract)"
76    'InEInt RP G L T A = (acr RP A G L T).
77
78 (* Basic properties *********************************************************)
79
80 (* Basic 1: was: sc3_lift *)
81 lemma gcr_lift: ∀RR,RS,RP. gcp RR RS RP → ∀A,G. d_liftable1 (acr RP A G) (Ⓕ).
82 #RR #RS #RP #H #A elim A -A
83 /3 width=8 by cp2, drops_cons, lifts_cons/
84 qed.
85
86 (* Basic_1: was: sc3_lift1 *)
87 lemma gcr_lifts: ∀RR,RS,RP. gcp RR RS RP → ∀A,G. d_liftables1 (acr RP A G) (Ⓕ).
88 #RR #RS #RP #H #A #G @d1_liftable_liftables /2 width=7 by gcr_lift/
89 qed.
90
91 (* Basic_1: was:
92    sc3_sn3 sc3_abst sc3_appl sc3_abbr sc3_bind sc3_cast
93 *)
94 lemma acr_gcr: ∀RR,RS,RP. gcp RR RS RP → gcr RR RS RP RP →
95                ∀A. gcr RR RS RP (acr RP A).
96 #RR #RS #RP #H1RP #H2RP #A elim A -A //
97 #B #A #IHB #IHA @mk_gcr
98 [ #G #L #T #H
99   elim (cp1 … H1RP G L) #k #HK
100   lapply (H L (⋆k) T (◊) ? ? ?) -H //
101   [ lapply (s2 … IHB G L (Ⓔ) … HK) //
102   | /3 width=6 by s1, cp3/
103   ]
104 | #G #L #Vs #HVs #T #H1T #H2T #L0 #V0 #X #cs #HL0 #H #HB
105   elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
106   lapply (s1 … IHB … HB) #HV0
107   @(s2 … IHA … (V0 ⨮ V0s))
108   /3 width=14 by gcp2_lifts_all, gcp2_lifts, gcp0_lifts, lifts_simple_dx, conj/
109 | #a #G #L #Vs #U #T #W #HA #L0 #V0 #X #cs #HL0 #H #HB
110   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
111   elim (lifts_inv_flat1 … HY) -HY #U0 #X #HU0 #HX #H destruct
112   elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
113   @(s3 … IHA … (V0 ⨮ V0s)) /5 width=6 by lifts_applv, lifts_flat, lifts_bind/
114 | #G #L #Vs #HVs #k #L0 #V0 #X #cs #HL0 #H #HB
115   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
116   >(lifts_inv_sort1 … HY) -Y
117   lapply (s1 … IHB … HB) #HV0
118   @(s4 … IHA … (V0 ⨮ V0s)) /3 width=7 by gcp2_lifts_all, conj/
119 | #I #G #L #K #Vs #V1 #V2 #i #HA #HV12 #HLK #L0 #V0 #X #cs #HL0 #H #HB
120   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
121   elim (lifts_inv_lref1 … HY) -HY #i0 #Hi0 #H destruct
122   elim (drops_drop_trans … HL0 … HLK) #X #cs0 #i1 #HL02 #H #Hi1 #Hcs0
123   >(at_mono … Hi1 … Hi0) in HL02; -i1 #HL02
124   elim (drops_inv_skip2 … Hcs0 … H) -H -cs0 #L2 #W1 #cs0 #Hcs0 #HLK #HVW1 #H destruct
125   elim (lift_total W1 0 (i0 + 1)) #W2 #HW12
126   elim (lifts_lift_trans  … Hcs0 … HVW1 … HW12) // -Hcs0 -Hi0 #V3 #HV13 #HVW2
127   >(lift_mono … HV13 … HV12) in HVW2; -V3 #HVW2
128   @(s5 … IHA … (V0 ⨮ V0s) … HW12 HL02) /3 width=5 by lifts_applv/
129 | #G #L #V1s #V2s #HV12s #a #V #T #HA #HV #L0 #V10 #X #cs #HL0 #H #HB
130   elim (lifts_inv_applv1 … H) -H #V10s #Y #HV10s #HY #H destruct
131   elim (lifts_inv_bind1 … HY) -HY #V0 #T0 #HV0 #HT0 #H destruct
132   elim (lift_total V10 0 1) #V20 #HV120
133   elim (liftv_total 0 1 V10s) #V20s #HV120s
134   @(s6 … IHA … (V10 ⨮ V10s) (V20 ⨮ V20s)) /3 width=7 by gcp2_lifts, liftv_cons/
135   @(HA … (cs + 1)) /2 width=2 by drops_skip/
136   [ @lifts_applv //
137     elim (liftsv_liftv_trans_le … HV10s … HV120s) -V10s #V10s #HV10s #HV120s
138     >(liftv_mono … HV12s … HV10s) -V1s //
139   | @(gcr_lift … H1RP … HB … HV120) /2 width=2 by drop_drop/
140   ]
141 | #G #L #Vs #T #W #HA #HW #L0 #V0 #X #cs #HL0 #H #HB
142   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
143   elim (lifts_inv_flat1 … HY) -HY #W0 #T0 #HW0 #HT0 #H destruct
144   @(s7 … IHA … (V0 ⨮ V0s)) /3 width=5 by lifts_applv/
145 ]
146 qed.
147
148 lemma acr_abst: ∀RR,RS,RP. gcp RR RS RP → gcr RR RS RP RP →
149                 ∀a,G,L,W,T,A,B. ⦃G, L, W⦄ ϵ[RP] 〚B〛 → (
150                    ∀L0,V0,W0,T0,cs. ⬇*[Ⓕ, cs] L0 ≡ L → ⬆*[cs] W ≡ W0 → ⬆*[cs + 1] T ≡ T0 →
151                                    ⦃G, L0, V0⦄ ϵ[RP] 〚B〛 → ⦃G, L0, W0⦄ ϵ[RP] 〚B〛 → ⦃G, L0.ⓓⓝW0.V0, T0⦄ ϵ[RP] 〚A〛
152                 ) →
153                 ⦃G, L, ⓛ{a}W.T⦄ ϵ[RP] 〚②B.A〛.
154 #RR #RS #RP #H1RP #H2RP #a #G #L #W #T #A #B #HW #HA #L0 #V0 #X #cs #HL0 #H #HB
155 lapply (acr_gcr … H1RP H2RP A) #HCA
156 lapply (acr_gcr … H1RP H2RP B) #HCB
157 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
158 lapply (gcr_lifts … H1RP … HL0 … HW0 HW) -HW #HW0
159 lapply (s3 … HCA … a G L0 (Ⓔ)) #H @H -H
160 lapply (s6 … HCA G L0 (Ⓔ) (Ⓔ) ?) // #H @H -H
161 [ @(HA … HL0) //
162 | lapply (s1 … HCB) -HCB #HCB
163   lapply (s7 … H2RP G L0 (Ⓔ)) /3 width=1 by/
164 ]
165 qed.
166
167 (* Basic_1: removed theorems 2: sc3_arity_gen sc3_repl *)
168 (* Basic_1: removed local theorems 1: sc3_sn3_abst *)