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