]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/llpx/llsx_csx.etc
small improvements and corrections ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / llpx / llsx_csx.etc
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/csx_lift.ma".
16 include "basic_2/computation/csx_llpxs.ma".
17 include "basic_2/computation/llsx_ldrop.ma".
18 include "basic_2/computation/llsx_llpx.ma".
19 include "basic_2/computation/llsx_llpxs.ma".
20 (*
21 axiom cpx_llpx_trans: ∀h,g,G,L1,T1,T2. ⦃G, L1⦄ ⊢ T1 ➡[h, g] T2 →
22                       ∀L2. ⦃G, L1⦄⊢ ➡[h, g, T2, O] L2 → 
23                       ∃∃L. ⦃G, L1⦄⊢ ➡[h, g, T1, O] L & L ⋕[T2, 0] L2.
24 (*
25 fact llsx_cpx_trans_aux: ∀h,g,G,L0,T1,T2. ⦃G, L0⦄ ⊢ T1 ➡[h, g] T2 →
26                          ∀L1,d. G ⊢ ⋕⬊*[h, g, T1, d] L1 → d = 0 → 
27                          L0 ⋕[T1, d] L1 → ∀L2. L1 ⋕[T2, d] L2 →
28                          G ⊢ ⋕⬊*[h, g, T2, d] L2.
29 #h #g #G #L0 #T1 #T2 #HT12 #L1 #d #H @(llsx_ind … H) -L1
30 #L1 #_ #IHL1 #Hd #He011 #L2 #He122 @llsx_intro
31 #L3 #Hx223 #Hn223 destruct
32 lapply (lleq_cpx_conf_sn … HT12 … He011) #He021
33 lapply (lleq_cpx_conf … HT12 … He011) -HT12 #HT12
34 lapply (lleq_llpx_trans … He122 … Hx223) -Hx223 #Hx123
35 elim (cpx_llpx_trans … HT12 … Hx123) -Hx123 #L4 #Hx114 #He423
36 (* lapply (lleq_cpx_conf … Hx114 … He011) #He120 *)
37 @(IHL1 … Hx114) // -IHL1
38 [ #HL13 @HnL2 -HnL2  
39 *)
40
41 fact llsx_cpx_trans_aux: ∀h,g,G,L1,T1,d. G ⊢ ⋕⬊*[h, g, T1, d] L1 → d = 0 →
42                          ∀T2. ⦃G, L1⦄ ⊢ T1 ➡[h, g] T2 →
43                          ∀L2. L1 ⋕[T1, d] L2 → G ⊢ ⋕⬊*[h, g, T2, 0] L2.
44 #h #g #G #L1 #T1 #d #H @(llsx_ind … H) -L1
45 #L1 #_ #IHL1 #Hd #T2 #HT12 #L2 #He112 @llsx_intro
46 #L3 #Hx223 #Hn223 destruct
47 lapply (lleq_cpx_conf_sn … HT12 … He112) #He122
48 lapply (lleq_cpx_conf … HT12 … He112) -HT12 #HT12
49 elim (cpx_llpx_trans … HT12 … Hx223) #L4 #Hx214 #He423
50 @(IHL1 … L4) //
51 *)
52 axiom llsx_cpx_trans_O: ∀h,g,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡[h, g] T2 →
53                         G ⊢ ⋕⬊*[h, g, T1, 0] L → G ⊢ ⋕⬊*[h, g, T2, 0] L.
54
55 (* LAZY SN EXTENDED STRONGLY NORMALIZING LOCAL ENVIRONMENTS *****************)
56
57 (* Advanced properties ******************************************************)
58
59 lemma llsx_lref_be_lpxs: ∀h,g,I,G,K1,V,i,d. d ≤ yinj i → ⦃G, K1⦄ ⊢ ⬊*[h, g] V →
60                          ∀K2. G ⊢ ⋕⬊*[h, g, V, 0] K2 → ⦃G, K1⦄ ⊢ ➡*[h, g, V, 0] K2 →
61                          ∀L2. ⇩[i] L2 ≡ K2.ⓑ{I}V → G ⊢ ⋕⬊*[h, g, #i, d] L2.
62 #h #g #I #G #K1 #V #i #d #Hdi #H @(csx_ind_alt … H) -V
63 #V0 #_ #IHV0 #K2 #H @(llsx_ind … H) -K2
64 #K0 #HK0 #IHK0 #HK10 #L0 #HLK0 @llsx_intro
65 #L2 #HL02 #HnL02 elim (llpx_inv_lref_ge_sn … HL02 … HLK0) // -HL02
66 #K2 #V2 #HLK2 #HK02 #HV02 elim (eq_term_dec V0 V2)
67 #HnV02 destruct [ -IHV0 -HV02 -HK0 | -IHK0 -HnL02 -HLK0 ]
68 [ /4 width=7 by llpxs_strap1, lleq_lref/
69 | lapply (llpx_cpx_conf … HV02 … HK02) -HK02 #HK02
70   @(IHV0 … HnV02 … HLK2) -IHV0 -HnV02 -HLK2
71   /3 width=3 by llsx_cpx_trans_O, llpxs_cpx_conf_dx, llsx_llpx_trans, llpxs_cpx_trans, llpxs_strap1/
72 ]
73 qed.
74
75 lemma llsx_lref_be: ∀h,g,I,G,K,V,i,d. d ≤ yinj i → ⦃G, K⦄ ⊢ ⬊*[h, g] V →
76                     G ⊢ ⋕⬊*[h, g, V, 0] K →
77                     ∀L. ⇩[i] L ≡ K.ⓑ{I}V → G ⊢ ⋕⬊*[h, g, #i, d] L.
78 /2 width=8 by llsx_lref_be_lpxs/ qed.
79
80 (* Main properties **********************************************************)
81
82 theorem csx_llsx: ∀h,g,G,L,T. ⦃G, L⦄ ⊢ ⬊*[h, g] T → ∀d. G ⊢ ⋕⬊*[h, g, T, d] L.
83 #h #g #G #L #T @(fqup_wf_ind_eq … G L T) -G -L -T
84 #Z #Y #X #IH #G #L * * //
85 [ #i #HG #HL #HT #H #d destruct
86   elim (lt_or_ge i (|L|)) /2 width=1 by llsx_lref_free/
87   elim (ylt_split i d) /2 width=1 by llsx_lref_skip/
88   #Hdi #Hi elim (ldrop_O1_lt … Hi) -Hi
89   #I #K #V #HLK lapply (csx_inv_lref_bind … HLK … H) -H
90   /4 width=6 by llsx_lref_be, fqup_lref/
91 | #a #I #V #T #HG #HL #HT #H #d destruct
92   elim (csx_fwd_bind … H) -H /3 width=1 by llsx_bind/
93 | #I #V #T #HG #HL #HT #H #d destruct
94   elim (csx_fwd_flat … H) -H /3 width=1 by llsx_flat/
95 ]
96 qed.