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