]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_computation/cnuw_cnuw.ma
update in ground_2, static_2, basic_2, apps_2, alpha_1
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_computation / cnuw_cnuw.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/rt_computation/cnuw_simple.ma".
16 include "basic_2/rt_computation/cnuw_drops.ma".
17 include "basic_2/rt_computation/cprs_tweq.ma".
18 include "basic_2/rt_computation/lprs_cpms.ma".
19
20 (* NORMAL TERMS FOR T-UNUNBOUND WHD RT-TRANSITION ***************************)
21
22 (* Advanced inversion lemmas ************************************************)
23
24 lemma cnuw_inv_abbr_pos (h) (G) (L):
25       ∀V,T. ❪G,L❫ ⊢ ➡𝐍𝐖*[h] +ⓓV.T → ⊥.
26 #h #G #L #V #T1 #H
27 elim (cprs_abbr_pos_twneq h G L V T1) #T2 #HT12 #HnT12
28 /3 width=2 by/
29 qed-.
30
31 (* Advanced properties ******************************************************)
32
33 lemma cnuw_abbr_neg (h) (G) (L): ∀V,T. ❪G,L❫ ⊢ ➡𝐍𝐖*[h] -ⓓV.T.
34 #h #G #L #V1 #T1 #n #X #H
35 elim (cpms_inv_abbr_sn_dx … H) -H *
36 [ #V2 #T2 #_ #_ #H destruct /1 width=1 by tweq_abbr_neg/
37 | #X1 #_ #_ #H destruct
38 ]
39 qed.
40
41 lemma cnuw_abst (h) (p) (G) (L): ∀W,T. ❪G,L❫ ⊢ ➡𝐍𝐖*[h] ⓛ[p]W.T.
42 #h #p #G #L #W1 #T1 #n #X #H
43 elim (cpms_inv_abst_sn … H) -H #W2 #T2 #_ #_ #H destruct
44 /1 width=1 by tweq_abst/
45 qed.
46
47 lemma cnuw_cpms_trans (h) (n) (G) (L):
48       ∀T1. ❪G,L❫ ⊢ ➡𝐍𝐖*[h] T1 →
49       ∀T2. ❪G,L❫ ⊢ T1 ➡*[n,h] T2 → ❪G,L❫ ⊢ ➡𝐍𝐖*[h] T2.
50 #h #n1 #G #L #T1 #HT1 #T2 #HT12 #n2 #T3 #HT23
51 /4 width=5 by cpms_trans, tweq_canc_sn/
52 qed-.
53
54 lemma cnuw_dec_ex (h) (G) (L):
55       ∀T1. ∨∨ ❪G,L❫ ⊢ ➡𝐍𝐖*[h] T1
56             | ∃∃n,T2. ❪G,L❫ ⊢ T1 ➡*[n,h] T2 & (T1 ≅ T2 → ⊥).
57 #h #G #L #T1 elim T1 -T1 *
58 [ #s /3 width=5 by cnuw_sort, or_introl/
59 | #i elim (drops_F_uni L i)
60   [ /3 width=7 by cnuw_atom_drops, or_introl/
61   | * * [ #I | * #V ] #K #HLK
62     [ /3 width=8 by cnuw_unit_drops, or_introl/
63     | elim (lifts_total V 𝐔❨↑i❩) #W #HVW
64       @or_intror @(ex2_2_intro … W) [1,2: /2 width=7 by cpms_delta_drops/ ] #H
65       lapply (tweq_inv_lref_sn … H) -H #H destruct
66       /2 width=5 by lifts_inv_lref2_uni_lt/
67     | elim (lifts_total V 𝐔❨↑i❩) #W #HVW
68       @or_intror @(ex2_2_intro … W) [1,2: /2 width=7 by cpms_ell_drops/ ] #H
69       lapply (tweq_inv_lref_sn … H) -H #H destruct
70       /2 width=5 by lifts_inv_lref2_uni_lt/
71     ]
72   ]
73 | #l /3 width=5 by cnuw_gref, or_introl/
74 | #p * [ cases p ] #V1 #T1 #_ #_
75   [ elim (cprs_abbr_pos_twneq h G L V1 T1) #T2 #HT12 #HnT12
76     /4 width=4 by ex2_2_intro, or_intror/
77   | /3 width=5 by cnuw_abbr_neg, or_introl/
78   | /3 width=5 by cnuw_abst, or_introl/
79   ]
80 | * #V1 #T1 #_ #IH
81   [ elim (simple_dec_ex T1) [ #HT1 | * #p * #W1 #U1 #H destruct ]
82     [ elim IH -IH
83       [ /3 width=6 by cnuw_appl_simple, or_introl/
84       | * #n #T2 #HT12 #HnT12 -HT1
85         @or_intror @(ex2_2_intro … n (ⓐV1.T2)) [ /2 width=1 by cpms_appl_dx/ ] #H
86         lapply (tweq_inv_appl_bi … H) -H /2 width=1 by/
87       ]
88     | elim (lifts_total V1 𝐔❨1❩) #X1 #HVX1
89       @or_intror @(ex2_2_intro … (ⓓ[p]W1.ⓐX1.U1)) [1,2: /2 width=3 by cpms_theta/ ] #H
90       elim (tweq_inv_appl_sn … H) -H #X1 #X2 #_ #H destruct
91     | @or_intror @(ex2_2_intro … (ⓓ[p]ⓝW1.V1.U1)) [1,2: /2 width=2 by cpms_beta/ ] #H
92       elim (tweq_inv_appl_sn … H) -H #X1 #X2 #_ #H destruct
93     ]
94   | @or_intror @(ex2_2_intro … T1) [1,2: /2 width=2 by cpms_eps/ ] #H
95     /2 width=4 by tweq_inv_cast_xy_y/
96   ]
97 ]
98 qed-.
99
100 lemma cnuw_dec (h) (G) (L): ∀T. Decidable (❪G,L❫ ⊢ ➡𝐍𝐖*[h] T).
101 #h #G #L #T1
102 elim (cnuw_dec_ex h G L T1)
103 [ /2 width=1 by or_introl/
104 | * #n #T2 #HT12 #nT12 /4 width=2 by or_intror/
105 ]
106 qed-.