]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/lsubr/lsubr.etc
- extended multiple substitutions now uses bounds in ynat (ie. they
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / lsubr / lsubr.etc
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 notation "hvbox( L1 ⓝ ⊑ break term 46 L2 )"
16    non associative with precedence 45
17    for @{ 'LRSubEqT $L1 $L2 }.
18
19 include "basic_2/relocation/ldrop.ma".
20
21 (* LOCAL ENVIRONMENT REFINEMENT FOR SUBSTITUTION ****************************)
22
23 inductive lsubr: relation lenv ≝
24 | lsubr_sort: ∀L. lsubr L (⋆)
25 | lsubr_abbr: ∀L1,L2,V. lsubr L1 L2 → lsubr (L1. ⓓV) (L2.ⓓV)
26 | lsubr_abst: ∀I,L1,L2,V1,V2. lsubr L1 L2 → lsubr (L1. ⓑ{I}V1) (L2. ⓛV2)
27 .
28
29 interpretation
30   "local environment refinement (substitution)"
31   'CrSubEq L1 L2 = (lsubr L1 L2).
32
33 (* Basic properties *********************************************************)
34
35 lemma lsubr_bind: ∀I,L1,L2,V. L1 ⊑ L2 → L1. ⓑ{I} V ⊑ L2.ⓑ{I} V.
36 * /2 width=1/ qed.
37
38 lemma lsubr_abbr: ∀I,L1,L2,V. L1 ⊑ L2 → L1. ⓓV ⊑ L2. ⓑ{I}V.
39 * /2 width=1/ qed.
40
41 lemma lsubr_refl: ∀L. L ⊑ L.
42 #L elim L -L // /2 width=1/
43 qed.
44
45 (* Basic inversion lemmas ***************************************************)
46
47 fact lsubr_inv_atom1_aux: ∀L1,L2. L1 ⊑ L2 → L1 = ⋆ → L2 = ⋆.
48 #L1 #L2 * -L1 -L2 //
49 [ #L1 #L2 #V #_ #H destruct
50 | #I #L1 #L2 #V1 #V2 #_ #H destruct
51 ]
52 qed-.
53
54 lemma lsubr_inv_atom1: ∀L2. ⋆ ⊑ L2 → L2 = ⋆.
55 /2 width=3 by lsubr_inv_atom1_aux/ qed-.
56
57 fact lsubr_inv_abbr2_aux: ∀L1,L2. L1 ⊑ L2 → ∀K2,W. L2 = K2.ⓓW →
58                           ∃∃K1. K1 ⊑ K2 & L1 = K1.ⓓW.
59 #L1 #L2 * -L1 -L2
60 [ #L #K2 #W #H destruct
61 | #L1 #L2 #V #HL12 #K2 #W #H destruct /2 width=3/
62 | #I #L1 #L2 #V1 #V2 #_ #K2 #W #H destruct
63 ]
64 qed-.
65
66 lemma lsubr_inv_abbr2: ∀L1,K2,W. L1 ⊑ K2.ⓓW →
67                        ∃∃K1. K1 ⊑ K2 & L1 = K1.ⓓW.
68 /2 width=3 by lsubr_inv_abbr2_aux/ qed-.
69
70 fact lsubr_inv_abst2_aux: ∀L1,L2. L1 ⊑ L2 → ∀K2,W2. L2 = K2.ⓛW2 →
71                           ∃∃I,K1,W1. K1 ⊑ K2 & L1 = K1.ⓑ{I}W1.
72 #L1 #L2 * -L1 -L2
73 [ #L #K2 #W2 #H destruct
74 | #L1 #L2 #V #_ #K2 #W2 #H destruct
75 | #I #L1 #L2 #V1 #V2 #HL12 #K2 #W2 #H destruct /2 width=5/
76 ]
77 qed-.
78
79 lemma lsubr_inv_abst2: ∀L1,K2,W2. L1 ⊑ K2.ⓛW2 →
80                        ∃∃I,K1,W1. K1 ⊑ K2 & L1 = K1.ⓑ{I}W1.
81 /2 width=4 by lsubr_inv_abst2_aux/ qed-.
82
83 (* Basic forward lemmas *****************************************************)
84
85 lemma lsubr_fwd_length: ∀L1,L2. L1 ⊑ L2 → |L2| ≤ |L1|.
86 #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
87 qed-.
88
89 lemma lsubr_fwd_ldrop2_abbr: ∀L1,L2. L1 ⊑ L2 →
90                              ∀K2,W,i. ⇩[0, i] L2 ≡ K2. ⓓW →
91                              ∃∃K1. K1 ⊑ K2 & ⇩[0, i] L1 ≡ K1. ⓓW.
92 #L1 #L2 #H elim H -L1 -L2
93 [ #L #K2 #W #i #H
94   elim (ldrop_inv_atom1 … H) -H #H destruct
95 | #L1 #L2 #V #HL12 #IHL12 #K2 #W #i #H
96   elim (ldrop_inv_O1_pair1 … H) -H * #Hi #HLK2 destruct [ -IHL12 | -HL12 ]
97   [ /2 width=3/
98   | elim (IHL12 … HLK2) -IHL12 -HLK2 /3 width=3/
99   ]
100 | #I #L1 #L2 #V1 #V2 #_ #IHL12 #K2 #W #i #H
101   elim (ldrop_inv_O1_pair1 … H) -H * #Hi #HLK2 destruct
102   elim (IHL12 … HLK2) -IHL12 -HLK2 /3 width=3/
103 ]
104 qed-.