]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/reduction/cnr.ma
7bd1ad6d1dcef53157ff45e3614e39e2ef555cfd
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / reduction / cnr.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/cpr.ma".
16
17 (* CONTEXT-SENSITIVE NORMAL TERMS *******************************************)
18
19 definition cnr: lenv → predicate term ≝ λL. NF … (cpr L) (eq …).
20
21 interpretation
22    "context-sensitive normality (term)"
23    'Normal L T = (cnr L T).
24
25 (* Basic inversion lemmas ***************************************************)
26
27 lemma cnr_inv_delta: ∀L,K,V,i. ⇩[0, i] L ≡ K.ⓓV → L ⊢ 𝐍⦃#i⦄ → ⊥.
28 #L #K #V #i #HLK #H
29 elim (lift_total V 0 (i+1)) #W #HVW
30 lapply (H W ?) -H [ /3 width=6/ ] -HLK #H destruct
31 elim (lift_inv_lref2_be … HVW) -HVW //
32 qed-.
33
34 lemma cnr_inv_abst: ∀a,L,V,T. L ⊢ 𝐍⦃ⓛ{a}V.T⦄ → L ⊢ 𝐍⦃V⦄ ∧ L.ⓛV ⊢ 𝐍⦃T⦄.
35 #a #L #V1 #T1 #HVT1 @conj
36 [ #V2 #HV2 lapply (HVT1 (ⓛ{a}V2.T1) ?) -HVT1 /2 width=2/ -HV2 #H destruct //
37 | #T2 #HT2 lapply (HVT1 (ⓛ{a}V1.T2) ?) -HVT1 /2 width=2/ -HT2 #H destruct //
38 ]
39 qed-.
40
41 lemma cnr_inv_abbr: ∀L,V,T. L ⊢ 𝐍⦃-ⓓV.T⦄ → L ⊢ 𝐍⦃V⦄ ∧ L.ⓓV ⊢ 𝐍⦃T⦄.
42 #L #V1 #T1 #HVT1 @conj
43 [ #V2 #HV2 lapply (HVT1 (-ⓓV2.T1) ?) -HVT1 /2 width=2/ -HV2 #H destruct //
44 | #T2 #HT2 lapply (HVT1 (-ⓓV1.T2) ?) -HVT1 /2 width=2/ -HT2 #H destruct //
45 ]
46 qed-.
47
48 lemma cnr_inv_zeta: ∀L,V,T. L ⊢ 𝐍⦃+ⓓV.T⦄ → ⊥.
49 #L #V #T #H elim (is_lift_dec T 0 1)
50 [ * #U #HTU
51   lapply (H U ?) -H /2 width=3/ #H destruct
52   elim (lift_inv_pair_xy_y … HTU)
53 | #HT
54   elim (cpss_delift (⋆) V T (⋆. ⓓV) 0 ?) // #T2 #T1 #HT2 #HT12
55   lapply (H (+ⓓV.T2) ?) -H /4 width=1/ -HT2 #H destruct /3 width=2/
56 ]
57 qed-.
58
59 lemma cnr_inv_appl: ∀L,V,T. L ⊢ 𝐍⦃ⓐV.T⦄ → ∧∧ L ⊢ 𝐍⦃V⦄ & L ⊢ 𝐍⦃T⦄ & 𝐒⦃T⦄.
60 #L #V1 #T1 #HVT1 @and3_intro
61 [ #V2 #HV2 lapply (HVT1 (ⓐV2.T1) ?) -HVT1 /2 width=1/ -HV2 #H destruct //
62 | #T2 #HT2 lapply (HVT1 (ⓐV1.T2) ?) -HVT1 /2 width=1/ -HT2 #H destruct //
63 | generalize in match HVT1; -HVT1 elim T1 -T1 * // #a * #W1 #U1 #_ #_ #H
64   [ elim (lift_total V1 0 1) #V2 #HV12
65     lapply (H (ⓓ{a}W1.ⓐV2.U1) ?) -H /3 width=3/ -HV12 #H destruct
66   | lapply (H (ⓓ{a}V1.U1) ?) -H /3 width=1/ #H destruct
67 ]
68 qed-.
69
70 lemma cnr_inv_tau: ∀L,V,T. L ⊢ 𝐍⦃ⓝV.T⦄ → ⊥.
71 #L #V #T #H lapply (H T ?) -H /2 width=1/ #H
72 @discr_tpair_xy_y //
73 qed-.
74
75 (* Basic properties *********************************************************)
76
77 (* Basic_1: was: nf2_sort *)
78 lemma cnr_sort: ∀L,k. L ⊢ 𝐍⦃⋆k⦄.
79 #L #k #X #H
80 >(cpr_inv_sort1 … H) //
81 qed.
82
83 (* Basic_1: was: nf2_abst *)
84 lemma cnr_abst: ∀a,I,L,V,W,T. L ⊢ 𝐍⦃W⦄ → L. ⓑ{I} V ⊢ 𝐍⦃T⦄ → L ⊢ 𝐍⦃ⓛ{a}W.T⦄.
85 #a #I #L #V #W #T #HW #HT #X #H
86 elim (cpr_fwd_abst1 … H I V) -H #W0 #T0 #HW0 #HT0 #H destruct
87 >(HW … HW0) -W0 >(HT … HT0) -T0 //
88 qed.
89
90 (* Basic_1: was only: nf2_appl_lref *)
91 lemma cnr_appl_simple: ∀L,V,T. L ⊢ 𝐍⦃V⦄ → L ⊢ 𝐍⦃T⦄ → 𝐒⦃T⦄ → L ⊢ 𝐍⦃ⓐV.T⦄.
92 #L #V #T #HV #HT #HS #X #H
93 elim (cpr_inv_appl1_simple … H ?) -H // #V0 #T0 #HV0 #HT0 #H destruct
94 >(HV … HV0) -V0 >(HT … HT0) -T0 //
95 qed.
96
97 (* Basic_1: was: nf2_dec *)
98 axiom cnr_dec: ∀L,T1. L ⊢ 𝐍⦃T1⦄ ∨
99                ∃∃T2. L ⊢ T1 ➡ T2 & (T1 = T2 → ⊥).
100
101 (* Basic_1: removed theorems 1: nf2_abst_shift *)