]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/rex_length.ma
renaming in basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / rex_length.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/relocation/sex_length.ma".
16 include "basic_2/static/rex_drops.ma".
17
18 (* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
19
20 (* Forward lemmas with length for local environments ************************)
21
22 (* Basic_2A1: uses: llpx_sn_fwd_length *)
23 lemma rex_fwd_length (R): ∀L1,L2,T. L1 ⪤[R, T] L2 → |L1| = |L2|.
24 #R #L1 #L2 #T * /2 width=4 by sex_fwd_length/
25 qed-.
26
27 (* Properties with length for local environments ****************************)
28
29 (* Basic_2A1: uses: llpx_sn_sort *)
30 lemma rex_sort_length (R): ∀L1,L2. |L1| = |L2| → ∀s. L1 ⪤[R, ⋆s] L2.
31 #R #L1 elim L1 -L1
32 [ #Y #H #s >(length_inv_zero_sn … H) -H //
33 | #K1 #I1 #IH #Y #H #s
34   elim (length_inv_succ_sn … H) -H #I2 #K2 #HK12 #H destruct
35   /3 width=1 by rex_sort/
36 ]
37 qed.
38
39 (* Basic_2A1: uses: llpx_sn_gref *)
40 lemma rex_gref_length (R): ∀L1,L2. |L1| = |L2| → ∀l. L1 ⪤[R, §l] L2.
41 #R #L1 elim L1 -L1
42 [ #Y #H #s >(length_inv_zero_sn … H) -H //
43 | #K1 #I1 #IH #Y #H #s
44   elim (length_inv_succ_sn … H) -H #I2 #K2 #HK12 #H destruct
45   /3 width=1 by rex_gref/
46 ]
47 qed.
48
49 lemma rex_unit_length (R): ∀L1,L2. |L1| = |L2| → ∀I. L1.ⓤ{I} ⪤[R, #0] L2.ⓤ{I}.
50 /3 width=3 by rex_unit, sex_length_isid/ qed.
51
52 (* Basic_2A1: uses: llpx_sn_lift_le llpx_sn_lift_ge *)
53 lemma rex_lifts_bi (R): d_liftable2_sn … lifts R →
54                         ∀L1,L2. |L1| = |L2| → ∀K1,K2,T. K1 ⪤[R, T] K2 →
55                         ∀b,f. ⬇*[b, f] L1 ≘ K1 → ⬇*[b, f] L2 ≘ K2 →
56                         ∀U. ⬆*[f] T ≘ U → L1 ⪤[R, U] L2.
57 #R #HR #L1 #L2 #HL12 #K1 #K2 #T * #f1 #Hf1 #HK12 #b #f #HLK1 #HLK2 #U #HTU
58 elim (frees_total L1 U) #f2 #Hf2
59 lapply (frees_fwd_coafter … Hf2 … HLK1 … HTU … Hf1) -HTU #Hf
60 /4 width=12 by sex_length_cfull, sex_liftable_co_dedropable_bi, cext2_d_liftable2_sn, cfull_lift_sn, ex2_intro/
61 qed-.
62
63 (* Inversion lemmas with length for local environment ***********************)
64
65 lemma rex_inv_zero_length (R): ∀Y1,Y2. Y1 ⪤[R, #0] Y2 →
66                                ∨∨ ∧∧ Y1 = ⋆ & Y2 = ⋆
67                                 | ∃∃I,L1,L2,V1,V2. L1 ⪤[R, V1] L2 & R L1 V1 V2 &
68                                                    Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2
69                                 | ∃∃I,L1,L2. |L1| = |L2| & Y1 = L1.ⓤ{I} & Y2 = L2.ⓤ{I}.
70 #R #Y1 #Y2 #H elim (rex_inv_zero … H) -H *
71 /4 width=9 by sex_fwd_length, ex4_5_intro, ex3_3_intro, or3_intro2, or3_intro1, or3_intro0, conj/
72 qed-.