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_2/multiple/frees_append.ma".
16 include "basic_2/multiple/llor.ma".
18 (* POINTWISE UNION FOR LOCAL ENVIRONMENTS ***********************************)
20 (* Alternative definition ***************************************************)
22 lemma llor_tail_frees: ∀L1,L2,L,U,l. L1 ⋓[U, l] L2 ≡ L → l ≤ yinj (|L1|) →
23 ∀I1,W1. ⓑ{I1}W1.L1 ⊢ |L1| ϵ 𝐅*[l]⦃U⦄ →
24 ∀I2,W2. ⓑ{I1}W1.L1 ⋓[U, l] ⓑ{I2}W2.L2 ≡ ⓑ{I2}W2.L.
25 #L1 #L2 #L #U #l * #HL12 #HL1 #IH #Hl #I1 #W1 #HU #I2 #W2
26 @and3_intro [1,2: >ltail_length /2 width=1 by le_S_S/ ]
27 #J1 #J2 #J #K1 #K2 #K #V1 #V2 #V #i #HLK1 #HLK2 #HLK
28 lapply (drop_fwd_length_lt2 … HLK1) >ltail_length #H
29 lapply (lt_plus_SO_to_le … H) -H #H
30 elim (le_to_or_lt_eq … H) -H #H
31 [ elim (drop_O1_lt (Ⓕ) … H) #Z1 #Y1 #X1 #HLY1
32 elim (drop_O1_lt (Ⓕ) L2 i) // #Z2 #Y2 #X2 #HLY2
33 elim (drop_O1_lt (Ⓕ) L i) // #Z #Y #X #HLY
34 lapply (drop_O1_inv_append1_le … HLK1 … HLY1) /2 width=1 by lt_to_le/ -HLK1 normalize #H destruct
35 lapply (drop_O1_inv_append1_le … HLK2 … HLY2) /2 width=1 by lt_to_le/ -HLK2 normalize #H destruct
36 lapply (drop_O1_inv_append1_le … HLK … HLY) /2 width=1 by lt_to_le/ -HLK normalize #H destruct
37 elim (IH … HLY1 HLY2 HLY) -IH -HLY1 -HLY2 -HLY *
38 [ /3 width=1 by and3_intro, or3_intro0/
39 | /7 width=2 by frees_inv_append, yle_inj, lt_to_le, or3_intro1, and3_intro/
40 | /6 width=1 by frees_append, yle_inj, lt_to_le, or3_intro2, and4_intro/
43 lapply (drop_O1_inv_append1_le … HLK2 … (⋆) ?) // -HLK2 normalize #H destruct
44 lapply (drop_O1_inv_append1_le … HLK … (⋆) ?) // -HLK normalize #H destruct
45 /3 width=1 by or3_intro2, and4_intro/
49 lemma llor_tail_cofrees: ∀L1,L2,L,U,l. L1 ⋓[U, l] L2 ≡ L →
50 ∀I1,W1. (ⓑ{I1}W1.L1 ⊢ |L1| ϵ 𝐅*[l]⦃U⦄ → ⊥) →
51 ∀I2,W2. ⓑ{I1}W1.L1 ⋓[U, l] ⓑ{I2}W2.L2 ≡ ⓑ{I1}W1.L.
52 #L1 #L2 #L #U #l * #HL12 #HL1 #IH #I1 #W1 #HU #I2 #W2
53 @and3_intro [1,2: >ltail_length /2 width=1 by le_S_S/ ]
54 #J1 #J2 #J #K1 #K2 #K #V1 #V2 #V #i #HLK1 #HLK2 #HLK
55 lapply (drop_fwd_length_lt2 … HLK1) >ltail_length #H
56 lapply (lt_plus_SO_to_le … H) -H #H
57 elim (le_to_or_lt_eq … H) -H #H
58 [ elim (drop_O1_lt (Ⓕ) … H) #Z1 #Y1 #X1 #HLY1
59 elim (drop_O1_lt (Ⓕ) L2 i) // #Z2 #Y2 #X2 #HLY2
60 elim (drop_O1_lt (Ⓕ) L i) // #Z #Y #X #HLY
61 lapply (drop_O1_inv_append1_le … HLK1 … HLY1) /2 width=1 by lt_to_le/ -HLK1 normalize #H destruct
62 lapply (drop_O1_inv_append1_le … HLK2 … HLY2) /2 width=1 by lt_to_le/ -HLK2 normalize #H destruct
63 lapply (drop_O1_inv_append1_le … HLK … HLY) /2 width=1 by lt_to_le/ -HLK normalize #H destruct
64 elim (IH … HLY1 HLY2 HLY) -IH -HLY1 -HLY2 -HLY *
65 [ /3 width=1 by and3_intro, or3_intro0/
66 | /7 width=2 by frees_inv_append, yle_inj, lt_to_le, or3_intro1, and3_intro/
67 | /6 width=1 by frees_append, yle_inj, lt_to_le, or3_intro2, and4_intro/
70 lapply (drop_O1_inv_append1_le … HLK1 … (⋆) ?) // -HLK1 normalize #H destruct
71 lapply (drop_O1_inv_append1_le … HLK … (⋆) ?) // -HLK normalize #H destruct
72 /4 width=1 by or3_intro1, and3_intro/