]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/cnr_teqx.ma
update in ground_2, static_2, basic_2, apps_2, alpha_1
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_transition / cnr_teqx.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 "static_2/relocation/lifts_teqx.ma".
16 include "basic_2/rt_transition/cpr_drops_basic.ma".
17 include "basic_2/rt_transition/cnr_simple.ma".
18 include "basic_2/rt_transition/cnr_drops.ma".
19
20 (* NORMAL TERMS FOR CONTEXT-SENSITIVE R-TRANSITION **************************)
21
22 (* Properties with context-free sort-irrelevant equivalence for terms *******)
23
24 (* Basic_1: was: nf2_dec *)
25 (* Basic_2A1: uses: cnr_dec *)
26 lemma cnr_dec_teqx (h) (G) (L):
27       ∀T1. ∨∨ ❪G,L❫ ⊢ ➡[h] 𝐍❪T1❫
28             | ∃∃T2. ❪G,L❫ ⊢ T1 ➡[h] T2 & (T1 ≛ T2 → ⊥).
29 #h #G #L #T1
30 @(fqup_wf_ind_eq (Ⓣ) … G L T1) -G -L -T1 #G0 #L0 #T0 #IH #G #L * *
31 [ #s #HG #HL #HT destruct -IH
32   /3 width=4 by cnr_sort, or_introl/
33 | #i #HG #HL #HT destruct -IH
34   elim (drops_F_uni L i)
35   [ /3 width=6 by cnr_lref_atom, or_introl/
36   | * * [ #I | * #V ] #K #HLK
37     [ /3 width=7 by cnr_lref_unit, or_introl/
38     | elim (lifts_total V 𝐔❨↑i❩) #W #HVW
39       @or_intror @(ex2_intro … W) [ /2 width=6 by cpm_delta_drops/ ] #H
40       lapply (teqx_inv_lref1 … H) -H #H destruct
41       /2 width=5 by lifts_inv_lref2_uni_lt/
42     | /3 width=7 by cnr_lref_abst, or_introl/
43     ]
44   ]
45 | #l #HG #HL #HT destruct -IH
46   /3 width=4 by cnr_gref, or_introl/
47 | #p * [ cases p ] #V1 #T1 #HG #HL #HT destruct
48   [ elim (cpr_subst h G (L.ⓓV1) T1 0 L V1) [| /2 width=1 by drops_refl/ ] #T2 #X2 #HT12 #HXT2 -IH
49     elim (teqx_dec T1 T2) [ -HT12 #HT12 | #HnT12 ]
50     [ elim (teqx_inv_lifts_dx … HT12 … HXT2) -T2 #X1 #HXT1 #_ -X2
51       @or_intror @(ex2_intro … X1) [ /2 width=3 by cpm_zeta/ ] #H
52       /2 width=7 by teqx_lifts_inv_pair_sn/
53     | @or_intror @(ex2_intro … (+ⓓV1.T2)) [ /2 width=1 by cpm_bind/ ] #H
54       elim (teqx_inv_pair … H) -H /2 width=1 by/
55     ]
56   | elim (IH G L V1) [ elim (IH G (L.ⓓV1) T1) [| * | // ] | * | // ] -IH
57     [ #HT1 #HV1 /3 width=6 by cnr_abbr_neg, or_introl/
58     | #T2 #HT12 #HnT12 #_
59       @or_intror @(ex2_intro … (-ⓓV1.T2)) [ /2 width=1 by cpm_bind/ ] #H
60       elim (teqx_inv_pair … H) -H /2 width=1 by/
61     | #V2 #HV12 #HnV12
62       @or_intror @(ex2_intro … (-ⓓV2.T1)) [ /2 width=1 by cpr_pair_sn/ ] #H
63       elim (teqx_inv_pair … H) -H /2 width=1 by/
64     ]
65   | elim (IH G L V1) [ elim (IH G (L.ⓛV1) T1) [| * | // ] | * | // ] -IH
66     [ #HT1 #HV1 /3 width=6 by cnr_abst, or_introl/
67     | #T2 #HT12 #HnT12 #_
68       @or_intror @(ex2_intro … (ⓛ[p]V1.T2)) [ /2 width=1 by cpm_bind/ ] #H
69       elim (teqx_inv_pair … H) -H /2 width=1 by/
70     | #V2 #HV12 #HnV12
71       @or_intror @(ex2_intro … (ⓛ[p]V2.T1)) [ /2 width=1 by cpr_pair_sn/ ] #H
72       elim (teqx_inv_pair … H) -H /2 width=1 by/
73     ]
74   ]
75 | * #V1 #T1 #HG #HL #HT destruct [| -IH ]
76   [ elim (IH G L V1) [ elim (IH G L T1) [| * | // ] | * | // ] -IH
77     [ #HT1 #HV1
78       elim (simple_dec_ex T1) [| * #p * #W1 #U1 #H destruct ]
79       [ /3 width=6 by cnr_appl_simple, or_introl/
80       | elim (lifts_total V1 𝐔❨1❩) #X1 #HVX1
81         @or_intror @(ex2_intro … (ⓓ[p]W1.ⓐX1.U1)) [ /2 width=3 by cpm_theta/ ] #H
82         elim (teqx_inv_pair … H) -H #H destruct
83       | @or_intror @(ex2_intro … (ⓓ[p]ⓝW1.V1.U1)) [ /2 width=1 by cpm_beta/ ] #H
84         elim (teqx_inv_pair … H) -H #H destruct
85       ]
86     | #T2 #HT12 #HnT12 #_
87       @or_intror @(ex2_intro … (ⓐV1.T2)) [ /2 width=1 by cpm_appl/ ] #H
88       elim (teqx_inv_pair … H) -H /2 width=1 by/
89     | #V2 #HV12 #HnV12
90       @or_intror @(ex2_intro … (ⓐV2.T1)) [ /2 width=1 by cpr_pair_sn/ ] #H
91       elim (teqx_inv_pair … H) -H /2 width=1 by/
92     ]
93   | @or_intror @(ex2_intro … T1) [ /2 width=1 by cpm_eps/ ] #H
94     /2 width=4 by teqx_inv_pair_xy_y/
95   ]
96 ]
97 qed-.