]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/reduction/cnr.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / 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_2A/notation/relations/prednormal_3.ma".
16 include "basic_2A/reduction/cpr.ma".
17
18 (* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
19
20 definition cnr: relation3 genv lenv term ≝ λG,L. NF … (cpr G L) (eq …).
21
22 interpretation
23    "normality for context-sensitive reduction (term)"
24    'PRedNormal G L T = (cnr G L T).
25
26 (* Basic inversion lemmas ***************************************************)
27
28 lemma cnr_inv_delta: ∀G,L,K,V,i. ⬇[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 by cpr_delta/ ] -HLK #H destruct
32 elim (lift_inv_lref2_be … HVW) -HVW //
33 qed-.
34
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 by cpr_pair_sn/ -HV2 #H destruct //
38 | #T2 #HT2 lapply (HVT1 (ⓛ{a}V1.T2) ?) -HVT1 /2 width=2 by cpr_bind/ -HT2 #H destruct //
39 ]
40 qed-.
41
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 by cpr_pair_sn/ -HV2 #H destruct //
45 | #T2 #HT2 lapply (HVT1 (-ⓓV1.T2) ?) -HVT1 /2 width=2 by cpr_bind/ -HT2 #H destruct //
46 ]
47 qed-.
48
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)
51 [ * #U #HTU
52   lapply (H U ?) -H /2 width=3 by cpr_zeta/ #H destruct
53   elim (lift_inv_pair_xy_y … HTU)
54 | #HT
55   elim (cpr_delift G (⋆) V T (⋆. ⓓV) 0) //
56   #T2 #T1 #HT2 #HT12 lapply (H (+ⓓV.T2) ?) -H /4 width=1 by tpr_cpr, cpr_bind/ -HT2
57   #H destruct /3 width=2 by ex_intro/
58 ]
59 qed-.
60
61 lemma cnr_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓐV.T⦄ → ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ & ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ & 𝐒⦃T⦄.
62 #G #L #V1 #T1 #HVT1 @and3_intro
63 [ #V2 #HV2 lapply (HVT1 (ⓐV2.T1) ?) -HVT1 /2 width=1 by cpr_pair_sn/ -HV2 #H destruct //
64 | #T2 #HT2 lapply (HVT1 (ⓐV1.T2) ?) -HVT1 /2 width=1 by cpr_flat/ -HT2 #H destruct //
65 | generalize in match HVT1; -HVT1 elim T1 -T1 * // #a * #W1 #U1 #_ #_ #H
66   [ elim (lift_total V1 0 1) #V2 #HV12
67     lapply (H (ⓓ{a}W1.ⓐV2.U1) ?) -H /3 width=3 by tpr_cpr, cpr_theta/ -HV12 #H destruct
68   | lapply (H (ⓓ{a}ⓝW1.V1.U1) ?) -H /3 width=1 by tpr_cpr, cpr_beta/ #H destruct
69 ]
70 qed-.
71
72 lemma cnr_inv_eps: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓝV.T⦄ → ⊥.
73 #G #L #V #T #H lapply (H T ?) -H
74 /2 width=4 by cpr_eps, discr_tpair_xy_y/
75 qed-.
76
77 (* Basic properties *********************************************************)
78
79 (* Basic_1: was: nf2_sort *)
80 lemma cnr_sort: ∀G,L,k. ⦃G, L⦄ ⊢ ➡ 𝐍⦃⋆k⦄.
81 #G #L #k #X #H
82 >(cpr_inv_sort1 … H) //
83 qed.
84
85 lemma cnr_lref_free: ∀G,L,i. |L| ≤ i → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄.
86 #G #L #i #Hi #X #H elim (cpr_inv_lref1 … H) -H // *
87 #K #V1 #V2 #HLK lapply (drop_fwd_length_lt2 … HLK) -HLK
88 #H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
89 qed.
90
91 (* Basic_1: was only: nf2_csort_lref *)
92 lemma cnr_lref_atom: ∀G,L,i. ⬇[i] L ≡ ⋆ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄.
93 #G #L #i #HL @cnr_lref_free >(drop_fwd_length … HL) -HL //
94 qed.
95
96 (* Basic_1: was: nf2_abst *)
97 lemma cnr_abst: ∀a,G,L,W,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃W⦄ → ⦃G, L.ⓛW⦄ ⊢ ➡ 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓛ{a}W.T⦄.
98 #a #G #L #W #T #HW #HT #X #H
99 elim (cpr_inv_abst1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
100 >(HW … HW0) -W0 >(HT … HT0) -T0 //
101 qed.
102
103 (* Basic_1: was only: nf2_appl_lref *)
104 lemma cnr_appl_simple: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ → 𝐒⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓐV.T⦄.
105 #G #L #V #T #HV #HT #HS #X #H
106 elim (cpr_inv_appl1_simple … H) -H // #V0 #T0 #HV0 #HT0 #H destruct
107 >(HV … HV0) -V0 >(HT … HT0) -T0 //
108 qed.
109
110 (* Basic_1: was: nf2_dec *)
111 axiom cnr_dec: ∀G,L,T1. ⦃G, L⦄ ⊢ ➡ 𝐍⦃T1⦄ ∨
112                ∃∃T2. ⦃G, L⦄ ⊢ T1 ➡ T2 & (T1 = T2 → ⊥).
113
114 (* Basic_1: removed theorems 1: nf2_abst_shift *)