]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/csn_lift.ma
- test.ma on the disambiguation bug moved to ONAG (just out of the way)
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / csn_lift.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/reduction/cnx_lift.ma".
16 include "basic_2/computation/acp.ma".
17 include "basic_2/computation/csn.ma".
18
19 (* CONTEXT-SENSITIVE EXTENDED STRONGLY NORMALIZING TERMS ********************)
20
21 (* Relocation properties ****************************************************)
22
23 (* Basic_1: was just: sn3_lift *)
24 lemma csn_lift: ∀h,g,G,L2,L1,T1,d,e. ⦃G, L1⦄ ⊢ ⬊*[h, g] T1 →
25                 ∀T2. ⇩[d, e] L2 ≡ L1 → ⇧[d, e] T1 ≡ T2 → ⦃G, L2⦄ ⊢ ⬊*[h, g] T2.
26 #h #g #G #L2 #L1 #T1 #d #e #H elim H -T1 #T1 #_ #IHT1 #T2 #HL21 #HT12
27 @csn_intro #T #HLT2 #HT2
28 elim (cpx_inv_lift1 … HLT2 … HL21 … HT12) -HLT2 #T0 #HT0 #HLT10
29 @(IHT1 … HLT10) // -L1 -L2 #H destruct
30 >(lift_mono … HT0 … HT12) in HT2; -T1 /2 width=1/
31 qed.
32
33 (* Basic_1: was just: sn3_gen_lift *)
34 lemma csn_inv_lift: ∀h,g,G,L2,L1,T1,d,e. ⦃G, L1⦄ ⊢ ⬊*[h, g] T1 →
35                     ∀T2. ⇩[d, e] L1 ≡ L2 → ⇧[d, e] T2 ≡ T1 → ⦃G, L2⦄ ⊢ ⬊*[h, g] T2.
36 #h #g #G #L2 #L1 #T1 #d #e #H elim H -T1 #T1 #_ #IHT1 #T2 #HL12 #HT21
37 @csn_intro #T #HLT2 #HT2
38 elim (lift_total T d e) #T0 #HT0
39 lapply (cpx_lift … HLT2 … HL12 … HT21 … HT0) -HLT2 #HLT10
40 @(IHT1 … HLT10) // -L1 -L2 #H destruct
41 >(lift_inj … HT0 … HT21) in HT2; -T1 /2 width=1/
42 qed.
43
44 (* Advanced properties ******************************************************)
45
46 (* Basic_1: was just: sn3_abbr *)
47 lemma csn_lref_bind: ∀h,g,I,G,L,K,V,i. ⇩[0, i] L ≡ K.ⓑ{I}V → ⦃G, K⦄ ⊢ ⬊*[h, g] V → ⦃G, L⦄ ⊢ ⬊*[h, g] #i.
48 #h #g #I #G #L #K #V #i #HLK #HV
49 @csn_intro #X #H #Hi
50 elim (cpx_inv_lref1 … H) -H
51 [ #H destruct elim Hi //
52 | -Hi * #I0 #K0 #V0 #V1 #HLK0 #HV01 #HV1
53   lapply (ldrop_mono … HLK0 … HLK) -HLK #H destruct
54   lapply (ldrop_fwd_ldrop2 … HLK0) -HLK0 #HLK
55   @(csn_lift … HLK HV1) -HLK -HV1
56   @(csn_cpx_trans … HV) -HV //
57 ]
58 qed.
59
60 lemma csn_appl_simple: ∀h,g,G,L,V. ⦃G, L⦄ ⊢ ⬊*[h, g] V → ∀T1.
61                        (∀T2. ⦃G, L⦄ ⊢ T1 ➡[h, g] T2 → (T1 = T2 → ⊥) → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓐV.T2) →
62                        𝐒⦃T1⦄ → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓐV.T1.
63 #h #g #G #L #V #H @(csn_ind … H) -V #V #_ #IHV #T1 #IHT1 #HT1
64 @csn_intro #X #H1 #H2
65 elim (cpx_inv_appl1_simple … H1) // -H1
66 #V0 #T0 #HLV0 #HLT10 #H destruct
67 elim (eq_false_inv_tpair_dx … H2) -H2
68 [ -IHV -HT1 #HT10
69   @(csn_cpx_trans … (ⓐV.T0)) /2 width=1/ -HLV0
70   @IHT1 -IHT1 // /2 width=1/
71 | -HLT10 * #H #HV0 destruct
72   @IHV -IHV // -HT1 /2 width=1/ -HV0
73   #T2 #HLT02 #HT02
74   @(csn_cpx_trans … (ⓐV.T2)) /2 width=1/ -HLV0
75   @IHT1 -IHT1 // -HLT02 /2 width=1/
76 ]
77 qed.
78
79 (* Advanced inversion lemmas ************************************************)
80
81 (* Basic_1: was: sn3_gen_def *)
82 lemma csn_inv_lref_bind: ∀h,g,I,G,L,K,V,i. ⇩[0, i] L ≡ K.ⓑ{I}V →
83                          ⦃G, L⦄ ⊢ ⬊*[h, g] #i → ⦃G, K⦄ ⊢ ⬊*[h, g] V.
84 #h #g #I #G #L #K #V #i #HLK #Hi
85 elim (lift_total V 0 (i+1)) #V0 #HV0
86 lapply (ldrop_fwd_ldrop2 … HLK) #H0LK
87 @(csn_inv_lift … H0LK … HV0) -H0LK
88 @(csn_cpx_trans … Hi) -Hi /2 width=7/
89 qed-.
90
91 (* Main properties **********************************************************)
92
93 theorem csn_acp: ∀h,g. acp (cpx h g) (eq …) (csn h g).
94 #h #g @mk_acp
95 [ #G #L elim (deg_total h g 0)
96   #l #Hl lapply (cnx_sort_iter … L … Hl) /2 width=2/
97 | @cnx_lift
98 | /2 width=3 by csn_fwd_flat_dx/
99 | /2 width=1/
100 ]
101 qed.