]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/lsx_lpxs.ma
- improved definition of lsx allows more invariants
[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_lleq_trans: ∀h,g,T,G,L1,d. G ⊢ ⋕⬊*[h, g, T, d] L1 →
35                       ∀L2. L1 ⋕[T, d] L2 → G ⊢ ⋕⬊*[h, g, T, d] L2.
36 #h #g #T #G #L1 #d #H @(lsx_ind … H) -L1
37 #L1 #_ #IHL1 #L2 #HL12 @lsx_intro
38 #K2 #HLK2 #HnLK2 elim (lleq_lpxs_trans … HLK2 … HL12) -HLK2
39 /5 width=4 by lleq_canc_sn, lleq_trans/
40 qed-.
41
42 lemma lsx_lpxs_trans: ∀h,g,T,G,L1,d. G ⊢ ⋕⬊*[h, g, T, d] L1 →
43                       ∀L2. ⦃G, L1⦄ ⊢ ➡*[h, g] L2 → G ⊢ ⋕⬊*[h, g, T, d] L2.
44 #h #g #T #G #L1 #d #H @(lsx_ind … H) -L1 #L1 #HL1 #IHL1 #L2 #HL12
45 elim (lleq_dec T L1 L2 d) /3 width=4 by lsx_lleq_trans/
46 qed-.
47
48 fact lsx_bind_lpxs_aux: ∀h,g,a,I,G,L1,V,d. G ⊢ ⋕⬊*[h, g, V, d] L1 →
49                         ∀Y,T. G ⊢ ⋕⬊*[h, g, T, ⫯d] Y →
50                         ∀L2. Y = L2.ⓑ{I}V → ⦃G, L1⦄ ⊢ ➡*[h, g] L2 →
51                         G ⊢ ⋕⬊*[h, g, ⓑ{a,I}V.T, d] L2.
52 #h #g #a #I #G #L1 #V #d #H @(lsx_ind … H) -L1
53 #L1 #HL1 #IHL1 #Y #T #H @(lsx_ind … H) -Y
54 #Y #HY #IHY #L2 #H #HL12 destruct @lsx_intro
55 #L0 #HL20 lapply (lpxs_trans … HL12 … HL20)
56 #HL10 #H elim (nlleq_inv_bind … H) -H [ -HL1 -IHY | -HY -IHL1 ]
57 [ #HnV elim (lleq_dec V L1 L2 d)
58   [ #HV @(IHL1 … L0) /3 width=5 by lsx_lpxs_trans, lpxs_pair, lleq_canc_sn/ (**) (* full auto too slow *)
59   | -HnV -HL10 /4 width=5 by lsx_lpxs_trans, lpxs_pair/
60   ]
61 | /3 width=4 by lpxs_pair/
62 ]
63 qed-.
64
65 lemma lsx_bind: ∀h,g,a,I,G,L,V,d. G ⊢ ⋕⬊*[h, g, V, d] L →
66                 ∀T. G ⊢ ⋕⬊*[h, g, T, ⫯d] L.ⓑ{I}V →
67                 G ⊢ ⋕⬊*[h, g, ⓑ{a,I}V.T, d] L.
68 /2 width=3 by lsx_bind_lpxs_aux/ qed.
69
70 lemma lsx_flat_lpxs: ∀h,g,I,G,L1,V,d. G ⊢ ⋕⬊*[h, g, V, d] L1 →
71                      ∀L2,T. G ⊢ ⋕⬊*[h, g, T, d] L2 → ⦃G, L1⦄ ⊢ ➡*[h, g] L2 →
72                      G ⊢ ⋕⬊*[h, g, ⓕ{I}V.T, d] L2.
73 #h #g #I #G #L1 #V #d #H @(lsx_ind … H) -L1
74 #L1 #HL1 #IHL1 #L2 #T #H @(lsx_ind … H) -L2
75 #L2 #HL2 #IHL2 #HL12 @lsx_intro
76 #L0 #HL20 lapply (lpxs_trans … HL12 … HL20)
77 #HL10 #H elim (nlleq_inv_flat … H) -H [ -HL1 -IHL2 | -HL2 -IHL1 ]
78 [ #HnV elim (lleq_dec V L1 L2 d)
79   [ #HV @(IHL1 … L0) /3 width=3 by lsx_lpxs_trans, lleq_canc_sn/ (**) (* full auto too slow: 47s *)
80   | -HnV -HL10 /3 width=4 by lsx_lpxs_trans/
81   ]
82 | /3 width=1 by/
83 ]
84 qed-.
85
86 lemma lsx_flat: ∀h,g,I,G,L,V,d. G ⊢ ⋕⬊*[h, g, V, d] L →
87                 ∀T. G ⊢ ⋕⬊*[h, g, T, d] L → G ⊢ ⋕⬊*[h, g, ⓕ{I}V.T, d] L.
88 /2 width=3 by lsx_flat_lpxs/ qed.
89
90 (* Advanced forward lemmas **************************************************)
91
92 lemma lsx_fwd_bind_dx: ∀h,g,a,I,G,L,V,T,d. G ⊢ ⋕⬊*[h, g, ⓑ{a,I}V.T, d] L →
93                        G ⊢ ⋕⬊*[h, g, T, ⫯d] L.ⓑ{I}V.
94 #h #g #a #I #G #L #V1 #T #d #H @(lsx_ind … H) -L
95 #L1 #_ #IHL1 @lsx_intro
96 #Y #H #HT elim (lpxs_inv_pair1 … H) -H
97 #L2 #V2 #HL12 #_ #H destruct
98 @(lsx_leqy_conf … (L2.ⓑ{I}V1)) /2 width=1 by lsuby_succ/
99 @IHL1 // #H @HT -IHL1 -HL12 -HT
100 @(lleq_lsuby_trans … (L2.ⓑ{I}V1))
101 /2 width=2 by lleq_fwd_bind_dx, lsuby_succ/
102 qed-.
103
104 (* Advanced inversion lemmas ************************************************)
105
106 lemma lsx_inv_bind: ∀h,g,a,I,G,L,V,T,d. G ⊢ ⋕⬊*[h, g, ⓑ{a, I}V.T, d] L →
107                     G ⊢ ⋕⬊*[h, g, V, d] L ∧ G ⊢ ⋕⬊*[h, g, T, ⫯d] L.ⓑ{I}V.
108 /3 width=4 by lsx_fwd_bind_sn, lsx_fwd_bind_dx, conj/ qed-.