1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2/notation/relations/normal_3.ma".
16 include "basic_2/reduction/cpr.ma".
18 (* CONTEXT-SENSITIVE NORMAL TERMS *******************************************)
20 definition cnr: relation3 genv lenv term ≝ λG,L. NF … (cpr G L) (eq …).
23 "context-sensitive normality (term)"
24 'Normal G L T = (cnr G L T).
26 (* Basic inversion lemmas ***************************************************)
28 lemma cnr_inv_delta: ∀G,L,K,V,i. ⇩[0, i] L ≡ K.ⓓV → ⦃G, L⦄ ⊢ 𝐍⦃#i⦄ → ⊥.
29 #G #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 //
35 lemma cnr_inv_abst: ∀a,G,L,V,T. ⦃G, L⦄ ⊢ 𝐍⦃ⓛ{a}V.T⦄ → ⦃G, L⦄ ⊢ 𝐍⦃V⦄ ∧ ⦃G, L.ⓛV⦄ ⊢ 𝐍⦃T⦄.
36 #a #G #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 //
42 lemma cnr_inv_abbr: ∀G,L,V,T. ⦃G, L⦄ ⊢ 𝐍⦃-ⓓV.T⦄ → ⦃G, L⦄ ⊢ 𝐍⦃V⦄ ∧ ⦃G, L.ⓓV⦄ ⊢ 𝐍⦃T⦄.
43 #G #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 //
49 lemma cnr_inv_zeta: ∀G,L,V,T. ⦃G, L⦄ ⊢ 𝐍⦃+ⓓV.T⦄ → ⊥.
50 #G #L #V #T #H elim (is_lift_dec T 0 1)
52 lapply (H U ?) -H /2 width=3/ #H destruct
53 elim (lift_inv_pair_xy_y … HTU)
55 elim (cpr_delift G (⋆) V T (⋆. ⓓV) 0) // #T2 #T1 #HT2 #HT12
56 lapply (H (+ⓓV.T2) ?) -H /4 width=1/ -HT2 #H destruct /3 width=2/
60 lemma cnr_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ 𝐍⦃ⓐV.T⦄ → ∧∧ ⦃G, L⦄ ⊢ 𝐍⦃V⦄ & ⦃G, L⦄ ⊢ 𝐍⦃T⦄ & 𝐒⦃T⦄.
61 #G #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
71 lemma cnr_inv_tau: ∀G,L,V,T. ⦃G, L⦄ ⊢ 𝐍⦃ⓝV.T⦄ → ⊥.
72 #G #L #V #T #H lapply (H T ?) -H /2 width=1/ #H
76 (* Basic properties *********************************************************)
78 (* Basic_1: was: nf2_sort *)
79 lemma cnr_sort: ∀G,L,k. ⦃G, L⦄ ⊢ 𝐍⦃⋆k⦄.
81 >(cpr_inv_sort1 … H) //
84 (* Basic_1: was: nf2_abst *)
85 lemma cnr_abst: ∀a,G,L,W,T. ⦃G, L⦄ ⊢ 𝐍⦃W⦄ → ⦃G, L.ⓛW⦄ ⊢ 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ 𝐍⦃ⓛ{a}W.T⦄.
86 #a #G #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 //
91 (* Basic_1: was only: nf2_appl_lref *)
92 lemma cnr_appl_simple: ∀G,L,V,T. ⦃G, L⦄ ⊢ 𝐍⦃V⦄ → ⦃G, L⦄ ⊢ 𝐍⦃T⦄ → 𝐒⦃T⦄ → ⦃G, L⦄ ⊢ 𝐍⦃ⓐV.T⦄.
93 #G #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 //
98 (* Basic_1: was: nf2_dec *)
99 axiom cnr_dec: ∀G,L,T1. ⦃G, L⦄ ⊢ 𝐍⦃T1⦄ ∨
100 ∃∃T2. ⦃G, L⦄ ⊢ T1 ➡ T2 & (T1 = T2 → ⊥).
102 (* Basic_1: removed theorems 1: nf2_abst_shift *)