1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2A/notation/relations/lrsubeqc_2.ma".
16 include "basic_2A/substitution/drop.ma".
18 (* RESTRICTED LOCAL ENVIRONMENT REFINEMENT **********************************)
20 inductive lsubr: relation lenv ≝
21 | lsubr_atom: ∀L. lsubr L (⋆)
22 | lsubr_pair: ∀I,L1,L2,V. lsubr L1 L2 → lsubr (L1.ⓑ{I}V) (L2.ⓑ{I}V)
23 | lsubr_beta: ∀L1,L2,V,W. lsubr L1 L2 → lsubr (L1.ⓓⓝW.V) (L2.ⓛW)
27 "local environment refinement (restricted)"
28 'LRSubEqC L1 L2 = (lsubr L1 L2).
30 (* Basic properties *********************************************************)
32 lemma lsubr_refl: ∀L. L ⫃ L.
33 #L elim L -L /2 width=1 by lsubr_atom, lsubr_pair/
36 (* Basic inversion lemmas ***************************************************)
38 fact lsubr_inv_atom1_aux: ∀L1,L2. L1 ⫃ L2 → L1 = ⋆ → L2 = ⋆.
40 [ #I #L1 #L2 #V #_ #H destruct
41 | #L1 #L2 #V #W #_ #H destruct
45 lemma lsubr_inv_atom1: ∀L2. ⋆ ⫃ L2 → L2 = ⋆.
46 /2 width=3 by lsubr_inv_atom1_aux/ qed-.
48 fact lsubr_inv_abst1_aux: ∀L1,L2. L1 ⫃ L2 → ∀K1,W. L1 = K1.ⓛW →
49 L2 = ⋆ ∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓛW.
51 [ #L #K1 #W #H destruct /2 width=1 by or_introl/
52 | #I #L1 #L2 #V #HL12 #K1 #W #H destruct /3 width=3 by ex2_intro, or_intror/
53 | #L1 #L2 #V1 #V2 #_ #K1 #W #H destruct
57 lemma lsubr_inv_abst1: ∀K1,L2,W. K1.ⓛW ⫃ L2 →
58 L2 = ⋆ ∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓛW.
59 /2 width=3 by lsubr_inv_abst1_aux/ qed-.
61 fact lsubr_inv_abbr2_aux: ∀L1,L2. L1 ⫃ L2 → ∀K2,W. L2 = K2.ⓓW →
62 ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓓW.
64 [ #L #K2 #W #H destruct
65 | #I #L1 #L2 #V #HL12 #K2 #W #H destruct /2 width=3 by ex2_intro/
66 | #L1 #L2 #V1 #V2 #_ #K2 #W #H destruct
70 lemma lsubr_inv_abbr2: ∀L1,K2,W. L1 ⫃ K2.ⓓW →
71 ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓓW.
72 /2 width=3 by lsubr_inv_abbr2_aux/ qed-.
74 (* Basic forward lemmas *****************************************************)
76 lemma lsubr_fwd_length: ∀L1,L2. L1 ⫃ L2 → |L2| ≤ |L1|.
77 #L1 #L2 #H elim H -L1 -L2 /2 width=1 by monotonic_le_plus_l/
80 lemma lsubr_fwd_drop2_pair: ∀L1,L2. L1 ⫃ L2 →
81 ∀I,K2,W,s,i. ⬇[s, 0, i] L2 ≡ K2.ⓑ{I}W →
82 (∃∃K1. K1 ⫃ K2 & ⬇[s, 0, i] L1 ≡ K1.ⓑ{I}W) ∨
83 ∃∃K1,V. K1 ⫃ K2 & ⬇[s, 0, i] L1 ≡ K1.ⓓⓝW.V & I = Abst.
84 #L1 #L2 #H elim H -L1 -L2
85 [ #L #I #K2 #W #s #i #H
86 elim (drop_inv_atom1 … H) -H #H destruct
87 | #J #L1 #L2 #V #HL12 #IHL12 #I #K2 #W #s #i #H
88 elim (drop_inv_O1_pair1 … H) -H * #Hi #HLK2 destruct [ -IHL12 | -HL12 ]
89 [ /3 width=3 by drop_pair, ex2_intro, or_introl/
90 | elim (IHL12 … HLK2) -IHL12 -HLK2 *
91 /4 width=4 by drop_drop_lt, ex3_2_intro, ex2_intro, or_introl, or_intror/
93 | #L1 #L2 #V1 #V2 #HL12 #IHL12 #I #K2 #W #s #i #H
94 elim (drop_inv_O1_pair1 … H) -H * #Hi #HLK2 destruct [ -IHL12 | -HL12 ]
95 [ /3 width=4 by drop_pair, ex3_2_intro, or_intror/
96 | elim (IHL12 … HLK2) -IHL12 -HLK2 *
97 /4 width=4 by drop_drop_lt, ex3_2_intro, ex2_intro, or_introl, or_intror/
102 lemma lsubr_fwd_drop2_abbr: ∀L1,L2. L1 ⫃ L2 →
103 ∀K2,V,s,i. ⬇[s, 0, i] L2 ≡ K2.ⓓV →
104 ∃∃K1. K1 ⫃ K2 & ⬇[s, 0, i] L1 ≡ K1.ⓓV.
105 #L1 #L2 #HL12 #K2 #V #s #i #HLK2 elim (lsubr_fwd_drop2_pair … HL12 … HLK2) -L2 // *
106 #K1 #W #_ #_ #H destruct