]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/lsx_lpxs.ma
reaxiomatized lleq fixes a bug in it and allows to park substitution in etc
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / lsx_lpxs.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/relocation/lleq_lleq.ma".
16 include "basic_2/computation/lpxs_lleq.ma".
17 include "basic_2/computation/lpxs_lpxs.ma".
18 include "basic_2/computation/lsx.ma".
19
20 (* SN EXTENDED STRONGLY NORMALIZING LOCAL ENVIRONMENTS **********************)
21
22 (* Advanced properties ******************************************************)
23
24 lemma lsx_leq_conf: ∀h,g,G,L1,T,d. G ⊢ ⋕⬊*[h, g, T, d] L1 →
25                     ∀L2. L1 ≃[d, ∞] L2 → G ⊢ ⋕⬊*[h, g, T, d] L2.
26 #h #g #G #L1 #T #d #H @(lsx_ind … H) -L1
27 #L1 #_ #IHL1 #L2 #HL12 @lsx_intro
28 #L3 #HL23 #HnL23 elim (leq_lpxs_trans_lleq … HL12 … HL23) -HL12 -HL23
29 #L0 #HL03 #HL10 #H elim (H T) -H /4 width=4 by/
30 qed-.
31
32 lemma lsx_ge: ∀h,g,G,L,T,d1,d2. d1 ≤ d2 →
33               G ⊢ ⋕⬊*[h, g, T, d1] L → G ⊢ ⋕⬊*[h, g, T, d2] L.
34 #h #g #G #L #T #d1 #d2 #Hd12 #H @(lsx_ind … H) -L
35 /5 width=7 by lsx_intro, lleq_ge/
36 qed-.
37
38 lemma lsx_lleq_trans: ∀h,g,T,G,L1,d. G ⊢ ⋕⬊*[h, g, T, d] L1 →
39                       ∀L2. L1 ⋕[T, d] L2 → G ⊢ ⋕⬊*[h, g, T, d] L2.
40 #h #g #T #G #L1 #d #H @(lsx_ind … H) -L1
41 #L1 #_ #IHL1 #L2 #HL12 @lsx_intro
42 #K2 #HLK2 #HnLK2 elim (lleq_lpxs_trans … HLK2 … HL12) -HLK2
43 /5 width=4 by lleq_canc_sn, lleq_trans/
44 qed-.
45
46 lemma lsx_lpxs_trans: ∀h,g,T,G,L1,d. G ⊢ ⋕⬊*[h, g, T, d] L1 →
47                       ∀L2. ⦃G, L1⦄ ⊢ ➡*[h, g] L2 → G ⊢ ⋕⬊*[h, g, T, d] L2.
48 #h #g #T #G #L1 #d #H @(lsx_ind … H) -L1 #L1 #HL1 #IHL1 #L2 #HL12
49 elim (lleq_dec T L1 L2 d) /3 width=4 by lsx_lleq_trans/
50 qed-.
51
52 fact lsx_bind_lpxs_aux: ∀h,g,a,I,G,L1,V,d. G ⊢ ⋕⬊*[h, g, V, d] L1 →
53                         ∀Y,T. G ⊢ ⋕⬊*[h, g, T, ⫯d] Y →
54                         ∀L2. Y = L2.ⓑ{I}V → ⦃G, L1⦄ ⊢ ➡*[h, g] L2 →
55                         G ⊢ ⋕⬊*[h, g, ⓑ{a,I}V.T, d] L2.
56 #h #g #a #I #G #L1 #V #d #H @(lsx_ind … H) -L1
57 #L1 #HL1 #IHL1 #Y #T #H @(lsx_ind … H) -Y
58 #Y #HY #IHY #L2 #H #HL12 destruct @lsx_intro
59 #L0 #HL20 lapply (lpxs_trans … HL12 … HL20)
60 #HL10 #H elim (nlleq_inv_bind … H) -H [ -HL1 -IHY | -HY -IHL1 ]
61 [ #HnV elim (lleq_dec V L1 L2 d)
62   [ #HV @(IHL1 … L0) /3 width=5 by lsx_lpxs_trans, lpxs_pair, lleq_canc_sn/ (**) (* full auto too slow *)
63   | -HnV -HL10 /4 width=5 by lsx_lpxs_trans, lpxs_pair/
64   ]
65 | /3 width=4 by lpxs_pair/
66 ]
67 qed-.
68
69 lemma lsx_bind: ∀h,g,a,I,G,L,V,d. G ⊢ ⋕⬊*[h, g, V, d] L →
70                 ∀T. G ⊢ ⋕⬊*[h, g, T, ⫯d] L.ⓑ{I}V →
71                 G ⊢ ⋕⬊*[h, g, ⓑ{a,I}V.T, d] L.
72 /2 width=3 by lsx_bind_lpxs_aux/ qed.
73
74 lemma lsx_flat_lpxs: ∀h,g,I,G,L1,V,d. G ⊢ ⋕⬊*[h, g, V, d] L1 →
75                      ∀L2,T. G ⊢ ⋕⬊*[h, g, T, d] L2 → ⦃G, L1⦄ ⊢ ➡*[h, g] L2 →
76                      G ⊢ ⋕⬊*[h, g, ⓕ{I}V.T, d] L2.
77 #h #g #I #G #L1 #V #d #H @(lsx_ind … H) -L1
78 #L1 #HL1 #IHL1 #L2 #T #H @(lsx_ind … H) -L2
79 #L2 #HL2 #IHL2 #HL12 @lsx_intro
80 #L0 #HL20 lapply (lpxs_trans … HL12 … HL20)
81 #HL10 #H elim (nlleq_inv_flat … H) -H [ -HL1 -IHL2 | -HL2 -IHL1 ]
82 [ #HnV elim (lleq_dec V L1 L2 d)
83   [ #HV @(IHL1 … L0) /3 width=3 by lsx_lpxs_trans, lleq_canc_sn/ (**) (* full auto too slow: 47s *)
84   | -HnV -HL10 /3 width=4 by lsx_lpxs_trans/
85   ]
86 | /3 width=1 by/
87 ]
88 qed-.
89
90 lemma lsx_flat: ∀h,g,I,G,L,V,d. G ⊢ ⋕⬊*[h, g, V, d] L →
91                 ∀T. G ⊢ ⋕⬊*[h, g, T, d] L → G ⊢ ⋕⬊*[h, g, ⓕ{I}V.T, d] L.
92 /2 width=3 by lsx_flat_lpxs/ qed.
93
94 (* Advanced forward lemmas **************************************************)
95
96 lemma lsx_fwd_lref_be: ∀h,g,I,G,L,d,i. d ≤ yinj i → G ⊢ ⋕⬊*[h, g, #i, d] L →
97                        ∀K,V. ⇩[i] L ≡ K.ⓑ{I}V → G ⊢ ⋕⬊*[h, g, V, 0] K.
98 #h #g #I #G #L #d #i #Hdi #H @(lsx_ind … H) -L
99 #L1 #_ #IHL1 #K1 #V #HLK1 @lsx_intro
100 #K2 #HK12 #HnK12 lapply (ldrop_fwd_drop2 … HLK1)
101 #H2LK1 elim (ldrop_lpxs_trans … H2LK1 … HK12) -H2LK1 -HK12
102 #L2 #HL12 #H2LK2 #H elim (leq_ldrop_conf_be … H … HLK1) -H /2 width=1 by ylt_inj/
103 #Y #_ #HLK2 lapply (ldrop_fwd_drop2 … HLK2)
104 #HY lapply (ldrop_mono … HY … H2LK2) -HY -H2LK2 #H destruct
105 /4 width=10 by lleq_inv_lref_ge/
106 qed-.
107
108 lemma lsx_fwd_bind_dx: ∀h,g,a,I,G,L,V,T,d. G ⊢ ⋕⬊*[h, g, ⓑ{a,I}V.T, d] L →
109                        G ⊢ ⋕⬊*[h, g, T, ⫯d] L.ⓑ{I}V.
110 #h #g #a #I #G #L #V1 #T #d #H @(lsx_ind … H) -L
111 #L1 #_ #IHL1 @lsx_intro
112 #Y #H #HT elim (lpxs_inv_pair1 … H) -H
113 #L2 #V2 #HL12 #_ #H destruct
114 @(lsx_leq_conf … (L2.ⓑ{I}V1)) /2 width=1 by leq_succ/
115 @IHL1 // #H @HT -IHL1 -HL12 -HT
116 @(lleq_leq_trans … (L2.ⓑ{I}V1))
117 /2 width=2 by lleq_fwd_bind_dx, leq_succ/
118 qed-.
119
120 (* Advanced inversion lemmas ************************************************)
121
122 lemma lsx_inv_bind: ∀h,g,a,I,G,L,V,T,d. G ⊢ ⋕⬊*[h, g, ⓑ{a, I}V.T, d] L →
123                     G ⊢ ⋕⬊*[h, g, V, d] L ∧ G ⊢ ⋕⬊*[h, g, T, ⫯d] L.ⓑ{I}V.
124 /3 width=4 by lsx_fwd_bind_sn, lsx_fwd_bind_dx, conj/ qed-.