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