]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/reduction/cnx.ma
partial commit of the components before "conversion"
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / reduction / cnx.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/cnr.ma".
16 include "basic_2/reduction/cpx.ma".
17
18 (* CONTEXT-SENSITIVE EXTENDED NORMAL TERMS **********************************)
19
20 definition cnx: ∀h. sd h → lenv → predicate term ≝
21                 λh,g,L. NF … (cpx h g L) (eq …).
22
23 interpretation
24    "context-sensitive extended normality (term)"
25    'Normal h g L T = (cnx h g L T).
26
27 (* Basic inversion lemmas ***************************************************)
28
29 lemma cnx_inv_sort: ∀h,g,L,k. ⦃h, L⦄ ⊢ 𝐍[g]⦃⋆k⦄ → deg h g k 0.
30 #h #g #L #k #H elim (deg_total h g k)
31 #l @(nat_ind_plus … l) -l // #l #_ #Hkl
32 lapply (H (⋆(next h k)) ?) -H /2 width=2/ -L -l #H destruct -H -e0 (**) (* destruct does not remove some premises *)
33 lapply (next_lt h k) >e1 -e1 #H elim (lt_refl_false … H)
34 qed-.
35
36 lemma cnx_inv_delta: ∀h,g,I,L,K,V,i. ⇩[0, i] L ≡ K.ⓑ{I}V → ⦃h, L⦄ ⊢ 𝐍[g]⦃#i⦄ → ⊥.
37 #h #g #I #L #K #V #i #HLK #H
38 elim (lift_total V 0 (i+1)) #W #HVW
39 lapply (H W ?) -H [ /3 width=7/ ] -HLK #H destruct
40 elim (lift_inv_lref2_be … HVW) -HVW //
41 qed-.
42
43 lemma cnx_inv_abst: ∀h,g,a,L,V,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃ⓛ{a}V.T⦄ →
44                     ⦃h, L⦄ ⊢ 𝐍[g]⦃V⦄ ∧ ⦃h, L.ⓛV⦄ ⊢ 𝐍[g]⦃T⦄.
45 #h #g #a #L #V1 #T1 #HVT1 @conj
46 [ #V2 #HV2 lapply (HVT1 (ⓛ{a}V2.T1) ?) -HVT1 /2 width=2/ -HV2 #H destruct //
47 | #T2 #HT2 lapply (HVT1 (ⓛ{a}V1.T2) ?) -HVT1 /2 width=2/ -HT2 #H destruct //
48 ]
49 qed-.
50
51 lemma cnx_inv_abbr: ∀h,g,L,V,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃-ⓓV.T⦄ →
52                     ⦃h, L⦄ ⊢ 𝐍[g]⦃V⦄ ∧ ⦃h, L.ⓓV⦄ ⊢ 𝐍[g]⦃T⦄.
53 #h #g #L #V1 #T1 #HVT1 @conj
54 [ #V2 #HV2 lapply (HVT1 (-ⓓV2.T1) ?) -HVT1 /2 width=2/ -HV2 #H destruct //
55 | #T2 #HT2 lapply (HVT1 (-ⓓV1.T2) ?) -HVT1 /2 width=2/ -HT2 #H destruct //
56 ]
57 qed-.
58
59 lemma cnx_inv_zeta: ∀h,g,L,V,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃+ⓓV.T⦄ → ⊥.
60 #h #g #L #V #T #H elim (is_lift_dec T 0 1)
61 [ * #U #HTU
62   lapply (H U ?) -H /2 width=3/ #H destruct
63   elim (lift_inv_pair_xy_y … HTU)
64 | #HT
65   elim (cpss_delift (⋆) V T (⋆. ⓓV) 0 ?) // #T2 #T1 #HT2 #HT12
66   lapply (H (+ⓓV.T2) ?) -H /5 width=1/ -HT2 #H destruct /3 width=2/
67 ]
68 qed-.
69
70 lemma cnx_inv_appl: ∀h,g,L,V,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃ⓐV.T⦄ →
71                     ∧∧ ⦃h, L⦄ ⊢ 𝐍[g]⦃V⦄ & ⦃h, L⦄ ⊢ 𝐍[g]⦃T⦄ & 𝐒⦃T⦄.
72 #h #g #L #V1 #T1 #HVT1 @and3_intro
73 [ #V2 #HV2 lapply (HVT1 (ⓐV2.T1) ?) -HVT1 /2 width=1/ -HV2 #H destruct //
74 | #T2 #HT2 lapply (HVT1 (ⓐV1.T2) ?) -HVT1 /2 width=1/ -HT2 #H destruct //
75 | generalize in match HVT1; -HVT1 elim T1 -T1 * // #a * #W1 #U1 #_ #_ #H
76   [ elim (lift_total V1 0 1) #V2 #HV12
77     lapply (H (ⓓ{a}W1.ⓐV2.U1) ?) -H /3 width=3/ -HV12 #H destruct
78   | lapply (H (ⓓ{a}V1.U1) ?) -H /3 width=1/ #H destruct
79 ]
80 qed-.
81
82 lemma cnx_inv_tau: ∀h,g,L,V,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃ⓝV.T⦄ → ⊥.
83 #h #g #L #V #T #H lapply (H T ?) -H /2 width=1/ #H
84 @discr_tpair_xy_y //
85 qed-.
86
87 (* Basic forward lemmas *****************************************************)
88
89 lemma cnx_fwd_cnr: ∀h,g,L,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃T⦄ → L ⊢ 𝐍⦃T⦄.
90 #h #g #L #T #H #U #HTU
91 @H /2 width=1/ (**) (* auto fails because a δ-expansion gets in the way *)
92 qed-.
93
94 (* Basic properties *********************************************************)
95
96 lemma cnx_sort: ∀h,g,L,k. deg h g k 0 → ⦃h, L⦄ ⊢ 𝐍[g]⦃⋆k⦄.
97 #h #g #L #k #Hk #X #H elim (cpx_inv_sort1 … H) -H // * #l #Hkl #_
98 lapply (deg_mono … Hkl Hk) -h -L <plus_n_Sm #H destruct 
99 qed.
100
101 lemma cnx_sort_iter: ∀h,g,L,k,l. deg h g k l → ⦃h, L⦄ ⊢ 𝐍[g]⦃⋆((next h)^l k)⦄.
102 #h #g #L #k #l #Hkl
103 lapply (deg_iter … l Hkl) -Hkl <minus_n_n /2 width=1/
104 qed.
105
106 lemma cnx_abst: ∀h,g,a,L,W,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃W⦄ → ⦃h, L.ⓛW⦄ ⊢ 𝐍[g]⦃T⦄ →
107                 ⦃h, L⦄ ⊢ 𝐍[g]⦃ⓛ{a}W.T⦄.
108 #h #g #a #L #W #T #HW #HT #X #H
109 elim (cpx_inv_abst1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
110 >(HW … HW0) -W0 >(HT … HT0) -T0 //
111 qed.
112
113 lemma cnx_appl_simple: ∀h,g,L,V,T. ⦃h, L⦄ ⊢ 𝐍[g]⦃V⦄ → ⦃h, L⦄ ⊢ 𝐍[g]⦃T⦄ → 𝐒⦃T⦄ →
114                        ⦃h, L⦄ ⊢ 𝐍[g]⦃ⓐV.T⦄.
115 #h #g #L #V #T #HV #HT #HS #X #H
116 elim (cpx_inv_appl1_simple … H ?) -H // #V0 #T0 #HV0 #HT0 #H destruct
117 >(HV … HV0) -V0 >(HT … HT0) -T0 //
118 qed.
119
120 axiom cnx_dec: ∀h,g,L,T1. ⦃h, L⦄ ⊢ 𝐍[g]⦃T1⦄ ∨
121                ∃∃T2. ⦃h, L⦄ ⊢ T1 ➡[g] T2 & (T1 = T2 → ⊥).