]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/Basic_2/computation/acp_cr.ma
the support for reducibility candidates evolves ,,,,
[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_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 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).
37
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).
40
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.
43
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.
47
48 (* properties of the abstract candidate of reducibility *)
49 record acr (RR:lenv->relation term) (RS:relation term) (RP,C:lenv→predicate term) : Prop ≝
50 { s1: S1 RP C;
51   s2: S2 RR RS RP C;
52   s3: S3 RP C;
53   s5: S5 RP C;
54   s6: S6 RP C;
55   s7: S7 C
56 }.
57
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 ≝
60 λT. match A with
61 [ AAtom     ⇒ RP L T
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)
64 ].
65
66 interpretation
67    "candidate of reducibility of an atomic arity (abstract)"
68    'InEInt RP L T A = (aacr RP A L T).
69
70 (* Basic properties *********************************************************)
71
72 lemma acr_lifts: ∀C. S7 C → S7s C.
73 #C #HC #L1 #L2 #des #H elim H -L1 -L2 -des
74 [ #L #T1 #T2 #H #HT1
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/
78 ]
79 qed.
80
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 →
83                 RP L V → RP L0 V0.
84 #RR #RS #RP #HRP #des #L0 #L #V #V0 #HL0 #HV0 #HV 
85 @acr_lifts /width=6/
86 @(s7 … HRP)
87 qed.
88
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/
95 qed.
96
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).
99 (*
100 #RR #RS #RP #H1RP #H2RP #A elim A -A normalize //
101 #B #A #IHB #IHA @mk_acr normalize
102 [ #L #T #H
103   lapply (H ? (⋆0) ? ⟠ ? ? ?) -H 
104   [1,3: // |2,4: skip
105   | @(s2 … IHB … ◊) // /2 width=2/
106   | #H @(cp3 … H1RP … 0) @(s1 … IHA) //
107   ]
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/
125   | @liftsv_applv //
126   ]
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/ 
131 | /3 width=7/
132 ]
133 qed.
134 *)
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〛
139                  ) →
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/
148 qed.