]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/dynamic/snv_preserve.etc
update in static_2 and basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / dynamic / snv_preserve.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/fsb_aaa.ma".
16 include "basic_2/dynamic/snv_da_lpr.ma".
17 include "basic_2/dynamic/snv_lstas.ma".
18 include "basic_2/dynamic/snv_lstas_lpr.ma".
19 include "basic_2/dynamic/snv_lpr.ma".
20
21 (* STRATIFIED NATIVE VALIDITY FOR TERMS *************************************)
22
23 (* Main preservation properties *********************************************)
24
25 lemma snv_preserve: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ T ¡[h, o] →
26                     ∧∧ IH_da_cpr_lpr h o G L T
27                      & IH_snv_cpr_lpr h o G L T
28                      & IH_snv_lstas h o G L T
29                      & IH_lstas_cpr_lpr h o G L T.
30 #h #o #G #L #T #HT elim (snv_fwd_aaa … HT) -HT
31 #A #HT @(aaa_ind_fpbg h o … HT) -G -L -T -A
32 #G #L #T #A #_ #IH -A @and4_intro
33 [ letin aux ≝ da_cpr_lpr_aux | letin aux ≝ snv_cpr_lpr_aux
34 | letin aux ≝ snv_lstas_aux | letin aux ≝ lstas_cpr_lpr_aux
35 ]
36 @(aux … G L T) // #G0 #L0 #T0 #H elim (IH … H) -IH -H //
37 qed-.
38
39 theorem da_cpr_lpr: ∀h,o,G,L,T. IH_da_cpr_lpr h o G L T.
40 #h #o #G #L #T #HT elim (snv_preserve … HT) /2 width=1 by/
41 qed-.
42
43 theorem snv_cpr_lpr: ∀h,o,G,L,T. IH_snv_cpr_lpr h o G L T.
44 #h #o #G #L #T #HT elim (snv_preserve … HT) /2 width=1 by/
45 qed-.
46
47 theorem snv_lstas: ∀h,o,G,L,T. IH_snv_lstas h o G L T.
48 #h #o #G #L #T #HT elim (snv_preserve … HT) /2 width=5 by/
49 qed-.
50
51 theorem lstas_cpr_lpr: ∀h,o,G,L,T. IH_lstas_cpr_lpr h o G L T.
52 #h #o #G #L #T #HT elim (snv_preserve … HT) /2 width=3 by/
53 qed-.
54
55 (* Advanced preservation properties *****************************************)
56
57 lemma snv_cprs_lpr: ∀h,o,G,L1,T1. ⦃G, L1⦄ ⊢ T1 ¡[h, o] →
58                     ∀T2. ⦃G, L1⦄ ⊢ T1 ➡* T2 → ∀L2. ⦃G, L1⦄ ⊢ ➡ L2 → ⦃G, L2⦄ ⊢ T2 ¡[h, o].
59 #h #o #G #L1 #T1 #HT1 #T2 #H
60 @(cprs_ind … H) -T2 /3 width=5 by snv_cpr_lpr/
61 qed-.
62
63 lemma da_cprs_lpr: ∀h,o,G,L1,T1. ⦃G, L1⦄ ⊢ T1 ¡[h, o] →
64                    ∀d. ⦃G, L1⦄ ⊢ T1 ▪[h, o] d →
65                    ∀T2. ⦃G, L1⦄ ⊢ T1 ➡* T2 → ∀L2. ⦃G, L1⦄ ⊢ ➡ L2 → ⦃G, L2⦄ ⊢ T2 ▪[h, o] d.
66 #h #o #G #L1 #T1 #HT1 #d #Hd #T2 #H
67 @(cprs_ind … H) -T2 /3 width=6 by snv_cprs_lpr, da_cpr_lpr/
68 qed-.
69
70 lemma lstas_cprs_lpr: ∀h,o,G,L1,T1. ⦃G, L1⦄ ⊢ T1 ¡[h, o] →
71                       ∀d1,d2. d2 ≤ d1 → ⦃G, L1⦄ ⊢ T1 ▪[h, o] d1 →
72                       ∀U1. ⦃G, L1⦄ ⊢ T1 •*[h, d2] U1 →
73                       ∀T2. ⦃G, L1⦄ ⊢ T1 ➡* T2 → ∀L2. ⦃G, L1⦄ ⊢ ➡ L2 →
74                       ∃∃U2. ⦃G, L2⦄ ⊢ T2 •*[h, d2] U2 & ⦃G, L2⦄ ⊢ U1 ⬌* U2.
75 #h #o #G #L1 #T1 #HT1 #d1 #d2 #Hd21 #Hd1 #U1 #HTU1 #T2 #H
76 @(cprs_ind … H) -T2 [ /2 width=10 by lstas_cpr_lpr/ ]
77 #T #T2 #HT1T #HTT2 #IHT1 #L2 #HL12
78 elim (IHT1 L1) // -IHT1 #U #HTU #HU1
79 elim (lstas_cpr_lpr … o … Hd21 … HTU … HTT2 … HL12) -HTU -HTT2
80 [2,3: /2 width=7 by snv_cprs_lpr, da_cprs_lpr/ ] -T1 -T -d1
81 /4 width=5 by lpr_cpcs_conf, cpcs_trans, ex2_intro/
82 qed-.
83
84 lemma lstas_cpcs_lpr: ∀h,o,G,L1,T1. ⦃G, L1⦄ ⊢ T1 ¡[h, o] →
85                       ∀d,d1. d ≤ d1 → ⦃G, L1⦄ ⊢ T1 ▪[h, o] d1 → ∀U1. ⦃G, L1⦄ ⊢ T1 •*[h, d] U1 →
86                       ∀T2. ⦃G, L1⦄ ⊢ T2 ¡[h, o] →
87                       ∀d2. d ≤ d2 → ⦃G, L1⦄ ⊢ T2 ▪[h, o] d2 → ∀U2. ⦃G, L1⦄ ⊢ T2 •*[h, d] U2 →
88                       ⦃G, L1⦄ ⊢ T1 ⬌* T2 → ∀L2. ⦃G, L1⦄ ⊢ ➡ L2 → ⦃G, L2⦄ ⊢ U1 ⬌* U2.
89 #h #o #G #L1 #T1 #HT1 #d #d1 #Hd1 #HTd1 #U1 #HTU1 #T2 #HT2 #d2 #Hd2 #HTd2 #U2 #HTU2 #H #L2 #HL12
90 elim (cpcs_inv_cprs … H) -H #T #H1 #H2
91 elim (lstas_cprs_lpr … HT1 … Hd1 HTd1 … HTU1 … H1 … HL12) -T1 #W1 #H1 #HUW1
92 elim (lstas_cprs_lpr … HT2 … Hd2 HTd2 … HTU2 … H2 … HL12) -T2 #W2 #H2 #HUW2
93 lapply (lstas_mono … H1 … H2) -h -T -d #H destruct /2 width=3 by cpcs_canc_dx/
94 qed-.