]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/reduction/cnx.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / 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_2A/notation/relations/prednormal_5.ma".
16 include "basic_2A/reduction/cnr.ma".
17 include "basic_2A/reduction/cpx.ma".
18
19 (* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
20
21 definition cnx: ∀h. sd h → relation3 genv lenv term ≝
22                 λh,g,G,L. NF … (cpx h g G L) (eq …).
23
24 interpretation
25    "normality for context-sensitive extended reduction (term)"
26    'PRedNormal h g L T = (cnx h g L T).
27
28 (* Basic inversion lemmas ***************************************************)
29
30 lemma cnx_inv_sort: ∀h,g,G,L,k. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃⋆k⦄ → deg h g k 0.
31 #h #g #G #L #k #H elim (deg_total h g k)
32 #d @(nat_ind_plus … d) -d // #d #_ #Hkd
33 lapply (H (⋆(next h k)) ?) -H /2 width=2 by cpx_st/ -L -d #H
34 lapply (destruct_tatom_tatom_aux … H) -H #H (**) (* destruct lemma needed *)
35 lapply (destruct_sort_sort_aux … H) -H #H (**) (* destruct lemma needed *)
36 lapply (next_lt h k) >H -H #H elim (lt_refl_false … H)
37 qed-.
38
39 lemma cnx_inv_delta: ∀h,g,I,G,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃#i⦄ → ⊥.
40 #h #g #I #G #L #K #V #i #HLK #H
41 elim (lift_total V 0 (i+1)) #W #HVW
42 lapply (H W ?) -H [ /3 width=7 by cpx_delta/ ] -HLK #H destruct
43 elim (lift_inv_lref2_be … HVW) -HVW //
44 qed-.
45
46 lemma cnx_inv_abst: ∀h,g,a,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃ⓛ{a}V.T⦄ →
47                     ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃V⦄ ∧ ⦃G, L.ⓛV⦄ ⊢ ➡[h, g] 𝐍⦃T⦄.
48 #h #g #a #G #L #V1 #T1 #HVT1 @conj
49 [ #V2 #HV2 lapply (HVT1 (ⓛ{a}V2.T1) ?) -HVT1 /2 width=2 by cpx_pair_sn/ -HV2 #H destruct //
50 | #T2 #HT2 lapply (HVT1 (ⓛ{a}V1.T2) ?) -HVT1 /2 width=2 by cpx_bind/ -HT2 #H destruct //
51 ]
52 qed-.
53
54 lemma cnx_inv_abbr: ∀h,g,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃-ⓓV.T⦄ →
55                     ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃V⦄ ∧ ⦃G, L.ⓓV⦄ ⊢ ➡[h, g] 𝐍⦃T⦄.
56 #h #g #G #L #V1 #T1 #HVT1 @conj
57 [ #V2 #HV2 lapply (HVT1 (-ⓓV2.T1) ?) -HVT1 /2 width=2 by cpx_pair_sn/ -HV2 #H destruct //
58 | #T2 #HT2 lapply (HVT1 (-ⓓV1.T2) ?) -HVT1 /2 width=2 by cpx_bind/ -HT2 #H destruct //
59 ]
60 qed-.
61
62 lemma cnx_inv_zeta: ∀h,g,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃+ⓓV.T⦄ → ⊥.
63 #h #g #G #L #V #T #H elim (is_lift_dec T 0 1)
64 [ * #U #HTU
65   lapply (H U ?) -H /2 width=3 by cpx_zeta/ #H destruct
66   elim (lift_inv_pair_xy_y … HTU)
67 | #HT
68   elim (cpr_delift G(⋆) V T (⋆.ⓓV) 0) // #T2 #T1 #HT2 #HT12
69   lapply (H (+ⓓV.T2) ?) -H /5 width=1 by cpr_cpx, tpr_cpr, cpr_bind/ -HT2
70   #H destruct /3 width=2 by ex_intro/
71 ]
72 qed-.
73
74 lemma cnx_inv_appl: ∀h,g,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃ⓐV.T⦄ →
75                     ∧∧ ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃V⦄ & ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃T⦄ & 𝐒⦃T⦄.
76 #h #g #G #L #V1 #T1 #HVT1 @and3_intro
77 [ #V2 #HV2 lapply (HVT1 (ⓐV2.T1) ?) -HVT1 /2 width=1 by cpx_pair_sn/ -HV2 #H destruct //
78 | #T2 #HT2 lapply (HVT1 (ⓐV1.T2) ?) -HVT1 /2 width=1 by cpx_flat/ -HT2 #H destruct //
79 | generalize in match HVT1; -HVT1 elim T1 -T1 * // #a * #W1 #U1 #_ #_ #H
80   [ elim (lift_total V1 0 1) #V2 #HV12
81     lapply (H (ⓓ{a}W1.ⓐV2.U1) ?) -H /3 width=3 by cpr_cpx, cpr_theta/ -HV12 #H destruct
82   | lapply (H (ⓓ{a}ⓝW1.V1.U1) ?) -H /3 width=1 by cpr_cpx, cpr_beta/ #H destruct
83   ]
84 ]
85 qed-.
86
87 lemma cnx_inv_eps: ∀h,g,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃ⓝV.T⦄ → ⊥.
88 #h #g #G #L #V #T #H lapply (H T ?) -H
89 /2 width=4 by cpx_eps, discr_tpair_xy_y/
90 qed-.
91
92 (* Basic forward lemmas *****************************************************)
93
94 lemma cnx_fwd_cnr: ∀h,g,G,L,T. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄.
95 #h #g #G #L #T #H #U #HTU
96 @H /2 width=1 by cpr_cpx/ (**) (* auto fails because a δ-expansion gets in the way *)
97 qed-.
98
99 (* Basic properties *********************************************************)
100
101 lemma cnx_sort: ∀h,g,G,L,k. deg h g k 0 → ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃⋆k⦄.
102 #h #g #G #L #k #Hk #X #H elim (cpx_inv_sort1 … H) -H // * #d #Hkd #_
103 lapply (deg_mono … Hkd Hk) -h -L <plus_n_Sm #H destruct
104 qed.
105
106 lemma cnx_sort_iter: ∀h,g,G,L,k,d. deg h g k d → ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃⋆((next h)^d k)⦄.
107 #h #g #G #L #k #d #Hkd
108 lapply (deg_iter … d Hkd) -Hkd <minus_n_n /2 width=6 by cnx_sort/
109 qed.
110
111 lemma cnx_lref_free: ∀h,g,G,L,i. |L| ≤ i → ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃#i⦄.
112 #h #g #G #L #i #Hi #X #H elim (cpx_inv_lref1 … H) -H // *
113 #I #K #V1 #V2 #HLK lapply (drop_fwd_length_lt2 … HLK) -HLK
114 #H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
115 qed.
116
117 lemma cnx_lref_atom: ∀h,g,G,L,i. ⬇[i] L ≡ ⋆ → ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃#i⦄.
118 #h #g #G #L #i #HL @cnx_lref_free >(drop_fwd_length … HL) -HL //
119 qed.
120
121 lemma cnx_abst: ∀h,g,a,G,L,W,T. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃W⦄ → ⦃G, L.ⓛW⦄ ⊢ ➡[h, g] 𝐍⦃T⦄ →
122                 ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃ⓛ{a}W.T⦄.
123 #h #g #a #G #L #W #T #HW #HT #X #H
124 elim (cpx_inv_abst1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
125 >(HW … HW0) -W0 >(HT … HT0) -T0 //
126 qed.
127
128 lemma cnx_appl_simple: ∀h,g,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃V⦄ → ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃T⦄ → 𝐒⦃T⦄ →
129                        ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃ⓐV.T⦄.
130 #h #g #G #L #V #T #HV #HT #HS #X #H
131 elim (cpx_inv_appl1_simple … H) -H // #V0 #T0 #HV0 #HT0 #H destruct
132 >(HV … HV0) -V0 >(HT … HT0) -T0 //
133 qed.
134
135 axiom cnx_dec: ∀h,g,G,L,T1. ⦃G, L⦄ ⊢ ➡[h, g] 𝐍⦃T1⦄ ∨
136                ∃∃T2. ⦃G, L⦄ ⊢ T1 ➡[h, g] T2 & (T1 = T2 → ⊥).