]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/Basic_2/computation/acp_cr.ma
closure property S4 added to abstract candidates of reducibility ...
[helm.git] / matita / matita / contribs / lambda_delta / Basic_2 / computation / acp_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_2/grammar/aarity.ma".
16 include "Basic_2/unfold/lifts_lift_vector.ma".
17 include "Basic_2/computation/acp.ma".
18
19 (* ABSTRACT COMPUTATION PROPERTIES ******************************************)
20
21 (* Note: this is Girard's CR1 *)
22 definition S1 ≝ λRP,C:lenv→predicate term.
23                 ∀L,T. C L T → RP L T.
24
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).
29
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).
33
34 definition S4 ≝ λRP,C:lenv→predicate term. ∀L,K,Vs,V1,V2,i.
35                 C L (ⒶVs. V2) → ⇧[0, i + 1] V1 ≡ V2 →
36                 ⇩[0, i] L ≡ K. 𝕓{Abbr} V1 → C L (Ⓐ Vs. #i).
37
38 definition S5 ≝ λRP,C:lenv→predicate term.
39                 ∀L,V1s,V2s. ⇧[0, 1] V1s ≡ V2s →
40                 ∀V,T. C (L. 𝕓{Abbr}V) (ⒶV2s. T) → RP L V → C L (ⒶV1s. 𝕔{Abbr}V. T).
41
42 definition S6 ≝ λRP,C:lenv→predicate term.
43                 ∀L,Vs,T,W. C L (ⒶVs. T) → RP L W → C L (ⒶVs. 𝕔{Cast}W. T).
44
45 definition S7 ≝ λC:lenv→predicate term. ∀L1,L2,T1,T2,d,e.
46                 C L1 T1 → ⇩[d, e] L2 ≡ L1 → ⇧[d, e] T1 ≡ T2 → C L2 T2.
47
48 definition S7s ≝ λC:lenv→predicate term.
49                  ∀L1,L2,des. ⇩*[des] L2 ≡ L1 →
50                  ∀T1,T2. ⇧*[des] T1 ≡ T2 → C L1 T1 → C L2 T2.
51
52 (* properties of the abstract candidate of reducibility *)
53 record acr (RR:lenv->relation term) (RS:relation term) (RP,C:lenv→predicate term) : Prop ≝
54 { s1: S1 RP C;
55   s2: S2 RR RS RP C;
56   s3: S3 RP C;
57   s4: S4 RP C;
58   s5: S5 RP C;
59   s6: S6 RP C;
60   s7: S7 C
61 }.
62
63 (* the abstract candidate of reducibility associated to an atomic arity *)
64 let rec aacr (RP:lenv→predicate term) (A:aarity) (L:lenv) on A: predicate term ≝
65 λT. match A with
66 [ AAtom     ⇒ RP L T
67 | APair B A ⇒ ∀L0,V0,T0,des. aacr RP B L0 V0 → ⇩*[des] L0 ≡ L → ⇧*[des] T ≡ T0 →
68               aacr RP A L0 (𝕔{Appl} V0. T0)
69 ].
70
71 interpretation
72    "candidate of reducibility of an atomic arity (abstract)"
73    'InEInt RP L T A = (aacr RP A L T).
74
75 (* Basic properties *********************************************************)
76
77 lemma acr_lifts: ∀C. S7 C → S7s C.
78 #C #HC #L1 #L2 #des #H elim H -L1 -L2 -des
79 [ #L #T1 #T2 #H #HT1
80   <(lifts_inv_nil … H) -H //
81 | #L1 #L #L2 #des #d #e #_ #HL2 #IHL #T2 #T1 #H #HLT2
82   elim (lifts_inv_cons … H) -H /3 width=9/
83 ]
84 qed.
85
86 lemma rp_lifts: ∀RR,RS,RP. acr RR RS RP (λL,T. RP L T) →
87                 ∀des,L0,L,V,V0. ⇩*[des] L0 ≡ L → ⇧*[des] V ≡ V0 →
88                 RP L V → RP L0 V0.
89 #RR #RS #RP #HRP #des #L0 #L #V #V0 #HL0 #HV0 #HV 
90 @acr_lifts /width=6/
91 @(s7 … HRP)
92 qed.
93
94 lemma rp_liftsv_all: ∀RR,RS,RP. acr RR RS RP (λL,T. RP L T) →
95                      ∀des,L0,L,Vs,V0s. ⇧*[des] Vs ≡ V0s →  ⇩*[des] L0 ≡ L →
96                      all … (RP L) Vs → all … (RP L0) V0s.
97 #RR #RS #RP #HRP #des #L0 #L #Vs #V0s #H elim H -Vs -V0s normalize //
98 #T1s #T2s #T1 #T2 #HT12 #_ #IHT2s #HL0 * #HT1 #HT1s
99 @conj /2 width=1/ /2 width=6 by rp_lifts/
100 qed.
101
102 axiom aacr_acr: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
103                 ∀A. acr RR RS RP (aacr RP A).
104 (*
105 #RR #RS #RP #H1RP #H2RP #A elim A -A normalize //
106 #B #A #IHB #IHA @mk_acr normalize
107 [ #L #T #H
108   lapply (H ? (⋆0) ? ⟠ ? ? ?) -H
109   [1,3: // |2,4: skip
110   | @(s2 … IHB … ◊) // /2 width=2/
111   | #H @(cp3 … H1RP … 0) @(s1 … IHA) //
112   ]
113 | #L #Vs #HVs #T #H1T #H2T #L0 #V0 #X #des #HB #HL0 #H
114   elim (lifts_inv_applv1 … H) -H #V0s #T0 #HV0s #HT0 #H destruct
115   lapply (s1 … IHB … HB) #HV0
116   @(s2 … IHA … (V0 :: V0s)) /2 width=4 by lifts_simple_dx/ /3 width=6/
117 | #L #Vs #U #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
118   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
119   elim (lifts_inv_flat1 … HY) -HY #U0 #X #HU0 #HX #H destruct
120   elim (lifts_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT0 #H destruct
121   @(s3 … IHA … (V0 :: V0s)) /2 width=6 by rp_lifts/ /4 width=5/
122 | #L #V1s #V2s #HV12s #V #T #HA #HV #L0 #V10 #X #des #HB #HL0 #H
123   elim (lifts_inv_applv1 … H) -H #V10s #Y #HV10s #HY #H destruct
124   elim (lifts_inv_bind1 … HY) -HY #V0 #T0 #HV0 #HT0 #H destruct
125   elim (lift_total V10 0 1) #V20 #HV120
126   elim (liftv_total 0 1 V10s) #V20s #HV120s
127   @(s5 … IHA … (V10 :: V10s) (V20 :: V20s)) /2 width=1/ /2 width=6 by rp_lifts/
128   @(HA … (des + 1)) /2 width=1/
129   [ @(s7 … IHB … HB … HV120) /2 width=1/
130   | @liftsv_applv //
131     elim (liftsv_liftv_trans_le … HV10s … HV120s) -V10s #V10s #HV10s #HV120s
132     >(liftv_mono … HV12s … HV10s) -V1s //
133   ]
134 | #L #Vs #T #W #HA #HW #L0 #V0 #X #des #HB #HL0 #H
135   elim (lifts_inv_applv1 … H) -H #V0s #Y #HV0s #HY #H destruct
136   elim (lifts_inv_flat1 … HY) -HY #W0 #T0 #HW0 #HT0 #H destruct
137   @(s6 … IHA … (V0 :: V0s)) /2 width=6 by rp_lifts/ /3 width=4/
138 | /3 width=7/
139 ]
140 qed.
141 *)
142 lemma aacr_abst: ∀RR,RS,RP. acp RR RS RP → acr RR RS RP (λL,T. RP L T) →
143                  ∀L,W,T,A,B. RP L W → (
144                     ∀L0,V0,T0,des. ⇩*[des] L0 ≡ L → ⇧*[des + 1] T ≡ T0 →
145                                    ⦃L0, V0⦄ [RP] ϵ 〚B〛 → ⦃L0. 𝕓{Abbr} V0, T0⦄ [RP] ϵ 〚A〛
146                  ) →
147                  ⦃L, 𝕓{Abst} W. T⦄ [RP] ϵ 〚𝕔 B. A〛.
148 #RR #RS #RP #H1RP #H2RP #L #W #T #A #B #HW #HA #L0 #V0 #X #des #HB #HL0 #H
149 lapply (aacr_acr … H1RP H2RP A) #HCA
150 lapply (aacr_acr … H1RP H2RP B) #HCB
151 elim (lifts_inv_bind1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
152 lapply (s1 … HCB) -HCB #HCB
153 @(s3 … HCA … ◊) /2 width=6 by rp_lifts/
154 @(s5 … HCA … ◊ ◊) // /2 width=1/ /2 width=3/
155 qed.