]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/csn.ma
08709419ce002ad2f121c1603618a654e7ce747c
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / csn.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.ma".
16
17 (* CONTEXT-SENSITIVE EXTENDED STRONGLY NORMALIZING TERMS ********************)
18
19 definition csn: ∀h. sd h → lenv → predicate term ≝
20                 λh,g,L. SN … (cpx h g L) (eq …).
21
22 interpretation
23    "context-sensitive extended strong normalization (term)"
24    'SN h g L T = (csn h g L T).
25
26 (* Basic eliminators ********************************************************)
27
28 lemma csn_ind: ∀h,g,L. ∀R:predicate term.
29                (∀T1. ⦃h, L⦄ ⊢ ⬊*[g] T1 →
30                      (∀T2. ⦃h, L⦄ ⊢ T1 ➡[g] T2 → (T1 = T2 → ⊥) → R T2) →
31                      R T1
32                ) →
33                ∀T. ⦃h, L⦄ ⊢ ⬊*[g] T → R T.
34 #h #g #L #R #H0 #T1 #H elim H -T1 #T1 #HT1 #IHT1
35 @H0 -H0 /3 width=1/ -IHT1 /4 width=1/
36 qed-.
37
38 (* Basic properties *********************************************************)
39
40 (* Basic_1: was just: sn3_pr2_intro *)
41 lemma csn_intro: ∀h,g,L,T1.
42                  (∀T2. ⦃h, L⦄ ⊢ T1 ➡[g] T2 → (T1 = T2 → ⊥) → ⦃h, L⦄ ⊢ ⬊*[g] T2) →
43                  ⦃h, L⦄ ⊢ ⬊*[g] T1.
44 /4 width=1/ qed.
45
46 lemma csn_cpx_trans: ∀h,g,L,T1. ⦃h, L⦄ ⊢ ⬊*[g] T1 →
47                      ∀T2. ⦃h, L⦄ ⊢ T1 ➡[g] T2 → ⦃h, L⦄ ⊢ ⬊*[g] T2.
48 #h #g #L #T1 #H elim H -T1 #T1 #HT1 #IHT1 #T2 #HLT12
49 @csn_intro #T #HLT2 #HT2
50 elim (term_eq_dec T1 T2) #HT12
51 [ -IHT1 -HLT12 destruct /3 width=1/
52 | -HT1 -HT2 /3 width=4/
53 qed-.
54
55 (* Basic_1: was just: sn3_nf2 *)
56 lemma cnx_csn: ∀h,g,L,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃T⦄ → ⦃h, L⦄ ⊢ ⬊*[g] T.
57 /2 width=1/ qed.
58
59 lemma cnx_sort: ∀h,g,L,k. ⦃h, L⦄ ⊢ ⬊*[g] ⋆k.
60 #h #g #L #k elim (deg_total h g k)
61 #l generalize in match k; -k @(nat_ind_plus … l) -l /3 width=1/
62 #l #IHl #k #Hkl lapply (deg_next_SO … Hkl) -Hkl
63 #Hkl @csn_intro #X #H #HX elim (cpx_inv_sort1 … H) -H
64 [ #H destruct elim HX //
65 | -HX * #l0 #_ #H destruct -l0 /2 width=1/
66 ]
67 qed.
68
69 (* Basic_1: was just: sn3_cast *)
70 lemma csn_cast: ∀h,g,L,W. ⦃h, L⦄ ⊢ ⬊*[g] W →
71                 ∀T. ⦃h, L⦄ ⊢ ⬊*[g] T → ⦃h, L⦄ ⊢ ⬊*[g] ⓝW.T.
72 #h #g #L #W #HW @(csn_ind … HW) -W #W #HW #IHW #T #HT @(csn_ind … HT) -T #T #HT #IHT
73 @csn_intro #X #H1 #H2
74 elim (cpx_inv_cast1 … H1) -H1
75 [ * #W0 #T0 #HLW0 #HLT0 #H destruct
76   elim (eq_false_inv_tpair_sn … H2) -H2
77   [ /3 width=3 by csn_cpx_trans/
78   | -HLW0 * #H destruct /3 width=1/
79   ]
80 |2,3: /3 width=3 by csn_cpx_trans/
81 ]
82 qed.
83
84 (* Basic forward lemmas *****************************************************)
85
86 fact csn_fwd_pair_sn_aux: ∀h,g,L,U. ⦃h, L⦄ ⊢ ⬊*[g] U →
87                           ∀I,V,T. U = ②{I}V.T → ⦃h, L⦄ ⊢ ⬊*[g] V.
88 #h #g #L #U #H elim H -H #U0 #_ #IH #I #V #T #H destruct
89 @csn_intro #V2 #HLV2 #HV2
90 @(IH (②{I}V2.T)) -IH // /2 width=1/ -HLV2 #H destruct /2 width=1/
91 qed-.
92
93 (* Basic_1: was just: sn3_gen_head *)
94 lemma csn_fwd_pair_sn: ∀h,g,I,L,V,T. ⦃h, L⦄ ⊢ ⬊*[g] ②{I}V.T → ⦃h, L⦄ ⊢ ⬊*[g] V.
95 /2 width=5 by csn_fwd_pair_sn_aux/ qed-.
96
97 fact csn_fwd_bind_dx_aux: ∀h,g,L,U. ⦃h, L⦄ ⊢ ⬊*[g] U →
98                           ∀a,I,V,T. U = ⓑ{a,I}V.T → ⦃h, L.ⓑ{I}V⦄ ⊢ ⬊*[g] T.
99 #h #g #L #U #H elim H -H #U0 #_ #IH #a #I #V #T #H destruct
100 @csn_intro #T2 #HLT2 #HT2
101 @(IH (ⓑ{a,I} V. T2)) -IH // /2 width=1/ -HLT2 #H destruct /2 width=1/
102 qed-.
103
104 (* Basic_1: was just: sn3_gen_bind *)
105 lemma csn_fwd_bind_dx: ∀h,g,a,I,L,V,T. ⦃h, L⦄ ⊢ ⬊*[g] ⓑ{a,I}V.T → ⦃h, L.ⓑ{I}V⦄ ⊢ ⬊*[g] T.
106 /2 width=4 by csn_fwd_bind_dx_aux/ qed-.
107
108 fact csn_fwd_flat_dx_aux: ∀h,g,L,U. ⦃h, L⦄ ⊢ ⬊*[g] U →
109                           ∀I,V,T. U = ⓕ{I}V.T → ⦃h, L⦄ ⊢ ⬊*[g] T.
110 #h #g #L #U #H elim H -H #U0 #_ #IH #I #V #T #H destruct
111 @csn_intro #T2 #HLT2 #HT2
112 @(IH (ⓕ{I}V.T2)) -IH // /2 width=1/ -HLT2 #H destruct /2 width=1/
113 qed-.
114
115 (* Basic_1: was just: sn3_gen_flat *)
116 lemma csn_fwd_flat_dx: ∀h,g,I,L,V,T. ⦃h, L⦄ ⊢ ⬊*[g] ⓕ{I}V.T → ⦃h, L⦄ ⊢ ⬊*[g] T.
117 /2 width=5 by csn_fwd_flat_dx_aux/ qed-.
118
119 (* Basic_1: removed theorems 14:
120             sn3_cdelta
121             sn3_gen_cflat sn3_cflat sn3_cpr3_trans sn3_shift sn3_change
122             sn3_appl_cast sn3_appl_beta sn3_appl_lref sn3_appl_abbr
123             sn3_appl_appls sn3_bind sn3_appl_bind sn3_appls_bind
124 *)