]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/reducibility/cpr_lift.ma
- renaming completed!
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / reducibility / cpr_lift.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/unfold/tpss_lift.ma".
16 include "basic_2/reducibility/tpr_lift.ma".
17 include "basic_2/reducibility/cpr.ma".
18
19 (* CONTEXT-SENSITIVE PARALLEL REDUCTION ON TERMS ****************************)
20
21 (* Advanced properties ******************************************************)
22
23 lemma cpr_cdelta: ∀L,K,V1,W1,W2,i.
24                   ⇩[0, i] L ≡ K. ⓓV1 → K ⊢ V1 [0, |L| - i - 1] ▶* W1 →
25                   ⇧[0, i + 1] W1 ≡ W2 → L ⊢ #i ➡ W2.
26 #L #K #V1 #W1 #W2 #i #HLK #HVW1 #HW12
27 lapply (ldrop_fwd_ldrop2_length … HLK) #Hi
28 @ex2_1_intro [2: // | skip | @tpss_subst /width=6/ ] (**) (* /3 width=6/ is too slow *)
29 qed.
30
31 (* Advanced inversion lemmas ************************************************)
32
33 (* Basic_1: was: pr2_gen_lref *)
34 lemma cpr_inv_lref1: ∀L,T2,i. L ⊢ #i ➡ T2 →
35                      T2 = #i ∨
36                      ∃∃K,V1,T1. ⇩[0, i] L ≡ K. ⓓV1 &
37                                 K ⊢ V1 [0, |L| - i - 1] ▶* T1 &
38                                 ⇧[0, i + 1] T1 ≡ T2 &
39                                 i < |L|.
40 #L #T2 #i * #X #H
41 >(tpr_inv_atom1 … H) -H #H
42 elim (tpss_inv_lref1 … H) -H /2 width=1/
43 * /3 width=6/
44 qed-.
45
46 (* Basic_1: was: pr2_gen_abst *)
47 lemma cpr_inv_abst1: ∀L,V1,T1,U2. L ⊢ ⓛV1. T1 ➡ U2 → ∀I,W.
48                      ∃∃V2,T2. L ⊢ V1 ➡ V2 & L. ⓑ{I} W ⊢ T1 ➡ T2 & U2 = ⓛV2. T2.
49 #L #V1 #T1 #Y * #X #H1 #H2 #I #W
50 elim (tpr_inv_abst1 … H1) -H1 #V #T #HV1 #HT1 #H destruct
51 elim (tpss_inv_bind1 … H2) -H2 #V2 #T2 #HV2 #HT2 #H destruct
52 lapply (tpss_lsubs_conf … HT2 (L. ⓑ{I} W) ?) -HT2 /2 width=1/ /4 width=5/
53 qed-.
54
55 (* Basic_1: was pr2_gen_appl *)
56 lemma cpr_inv_appl1: ∀L,V1,U0,U2. L ⊢ ⓐV1. U0 ➡ U2 →
57                      ∨∨ ∃∃V2,T2.            L ⊢ V1 ➡ V2 & L ⊢ U0 ➡ T2 &
58                                             U2 = ⓐV2. T2
59                       | ∃∃V2,W,T1,T2.       L ⊢ V1 ➡ V2 & L. ⓓV2 ⊢ T1 ➡ T2 &
60                                             U0 = ⓛW. T1 &
61                                             U2 = ⓓV2. T2
62                       | ∃∃V2,V,W1,W2,T1,T2. L ⊢ V1 ➡ V2 & L ⊢ W1 ➡ W2 & L. ⓓW2 ⊢ T1 ➡ T2 &
63                                             ⇧[0,1] V2 ≡ V &
64                                             U0 = ⓓW1. T1 &
65                                             U2 = ⓓW2. ⓐV. T2.
66 #L #V1 #U0 #Y * #X #H1 #H2
67 elim (tpr_inv_appl1 … H1) -H1 *
68 [ #V #U #HV1 #HU0 #H destruct
69   elim (tpss_inv_flat1 … H2) -H2 #V2 #U2 #HV2 #HU2 #H destruct /4 width=5/
70 | #V #W #T0 #T #HV1 #HT0 #H #H1 destruct
71   elim (tpss_inv_bind1 … H2) -H2 #V2 #T2 #HV2 #HT2 #H destruct
72   lapply (tpss_weak … HT2 0 (|L|+1) ? ?) -HT2 // /4 width=8/
73 | #V0 #V #W #W0 #T #T0 #HV10 #HW0 #HT0 #HV0 #H #H1 destruct
74   elim (tpss_inv_bind1 … H2) -H2 #W2 #X #HW02 #HX #HY destruct
75   elim (tpss_inv_flat1 … HX) -HX #V2 #T2 #HV2 #HT2 #H destruct
76   elim (tpss_inv_lift1_ge … HV2 … HV0 ?) -V // [3: /2 width=1/ |2: skip ] #V <minus_plus_m_m
77   lapply (tpss_weak … HT2 0 (|L|+1) ? ?) -HT2 // /4 width=12/
78 ]
79 qed-.
80
81 (* Note: the main property of simple terms *)
82 lemma cpr_inv_appl1_simple: ∀L,V1,T1,U. L ⊢ ⓐV1. T1 ➡ U → 𝐒[T1] →
83                             ∃∃V2,T2. L ⊢ V1 ➡ V2 & L ⊢ T1 ➡ T2 &
84                                      U = ⓐV2. T2.
85 #L #V1 #T1 #U #H #HT1
86 elim (cpr_inv_appl1 … H) -H *
87 [ /2 width=5/
88 | #V2 #W #W1 #W2 #_ #_ #H #_ destruct
89   elim (simple_inv_bind … HT1)
90 | #V2 #V #W1 #W2 #U1 #U2 #_ #_ #_ #_ #H #_ destruct
91   elim (simple_inv_bind … HT1)
92 ]
93 qed-.
94
95 (* Relocation properties ****************************************************)
96
97 (* Basic_1: was: pr2_lift *)
98 lemma cpr_lift: ∀L,K,d,e. ⇩[d, e] L ≡ K →
99                 ∀T1,U1. ⇧[d, e] T1 ≡ U1 → ∀T2,U2. ⇧[d, e] T2 ≡ U2 →
100                 K ⊢ T1 ➡ T2 → L ⊢ U1 ➡ U2.
101 #L #K #d #e #HLK #T1 #U1 #HTU1 #T2 #U2 #HTU2 * #T #HT1 #HT2
102 elim (lift_total T d e) #U #HTU 
103 lapply (tpr_lift … HT1 … HTU1 … HTU) -T1 #HU1
104 elim (lt_or_ge (|K|) d) #HKd
105 [ lapply (tpss_lift_le … HT2 … HLK HTU … HTU2) -T2 -T -HLK [ /2 width=2/ | /3 width=4/ ]
106 | lapply (tpss_lift_be … HT2 … HLK HTU … HTU2) -T2 -T -HLK // /3 width=4/
107 ]
108 qed.
109
110 (* Basic_1: was: pr2_gen_lift *)
111 lemma cpr_inv_lift: ∀L,K,d,e. ⇩[d, e] L ≡ K →
112                     ∀T1,U1. ⇧[d, e] T1 ≡ U1 → ∀U2. L ⊢ U1 ➡ U2 →
113                     ∃∃T2. ⇧[d, e] T2 ≡ U2 & K ⊢ T1 ➡ T2.
114 #L #K #d #e #HLK #T1 #U1 #HTU1 #U2 * #U #HU1 #HU2
115 elim (tpr_inv_lift … HU1 … HTU1) -U1 #T #HTU #T1
116 elim (lt_or_ge (|L|) d) #HLd
117 [ elim (tpss_inv_lift1_le … HU2 … HLK … HTU ?) -U -HLK [ /5 width=4/ | /2 width=2/ ]
118 | elim (lt_or_ge (|L|) (d + e)) #HLde
119   [ elim (tpss_inv_lift1_be_up … HU2 … HLK … HTU ? ?) -U -HLK // [ /5 width=4/ | /2 width=2/ ] 
120   | elim (tpss_inv_lift1_be … HU2 … HLK … HTU ? ?) -U -HLK // /5 width=4/
121   ]
122 ]
123 qed.