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 notation "hvbox( ⦃ term 46 L1, break term 46 T1 ⦄ ⧁ + break ⦃ term 46 L2 , break term 46 T2 ⦄ )"
16 non associative with precedence 45
17 for @{ 'RestSupTermPlus $L1 $T1 $L2 $T2 }.
19 include "basic_2/substitution/frsup.ma".
21 (* PLUS-ITERATED RESTRICTED SUPCLOSURE **************************************)
23 definition frsupp: bi_relation lenv term ≝ bi_TC … frsup.
25 interpretation "plus-iterated restricted structural predecessor (closure)"
26 'RestSupTermPlus L1 T1 L2 T2 = (frsupp L1 T1 L2 T2).
28 (* Basic eliminators ********************************************************)
30 lemma frsupp_ind: ∀L1,T1. ∀R:relation2 lenv term.
31 (∀L2,T2. ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ → R L2 T2) →
32 (∀L,T,L2,T2. ⦃L1, T1⦄ ⧁+ ⦃L, T⦄ → ⦃L, T⦄ ⧁ ⦃L2, T2⦄ → R L T → R L2 T2) →
33 ∀L2,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → R L2 T2.
34 #L1 #T1 #R #IH1 #IH2 #L2 #T2 #H
35 @(bi_TC_ind … IH1 IH2 ? ? H)
38 lemma frsupp_ind_dx: ∀L2,T2. ∀R:relation2 lenv term.
39 (∀L1,T1. ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ → R L1 T1) →
40 (∀L1,L,T1,T. ⦃L1, T1⦄ ⧁ ⦃L, T⦄ → ⦃L, T⦄ ⧁+ ⦃L2, T2⦄ → R L T → R L1 T1) →
41 ∀L1,T1. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → R L1 T1.
42 #L2 #T2 #R #IH1 #IH2 #L1 #T1 #H
43 @(bi_TC_ind_dx … IH1 IH2 ? ? H)
46 (* Baic inversion lemmas ****************************************************)
48 lemma frsupp_inv_dx: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ ∨
49 ∃∃L,T. ⦃L1, T1⦄ ⧁+ ⦃L, T⦄ & ⦃L, T⦄ ⧁ ⦃L2, T2⦄.
50 /2 width=1 by bi_TC_decomp_r/ qed-.
52 lemma frsupp_inv_sn: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ ∨
53 ∃∃L,T. ⦃L1, T1⦄ ⧁ ⦃L, T⦄ & ⦃L, T⦄ ⧁+ ⦃L2, T2⦄.
54 /2 width=1 by bi_TC_decomp_l/ qed-.
56 (* Basic properties *********************************************************)
58 lemma frsup_frsupp: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
61 lemma frsupp_strap1: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁+ ⦃L, T⦄ → ⦃L, T⦄ ⧁ ⦃L2, T2⦄ →
65 lemma frsupp_strap2: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁ ⦃L, T⦄ → ⦃L, T⦄ ⧁+ ⦃L2, T2⦄ →
69 (* Basic forward lemmas *****************************************************)
71 lemma frsupp_fwd_fw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → ♯{L2, T2} < ♯{L1, T1}.
72 #L1 #L2 #T1 #T2 #H @(frsupp_ind … H) -L2 -T2
73 /3 width=3 by frsup_fwd_fw, transitive_lt/
76 lemma frsupp_fwd_lw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → ♯{L1} ≤ ♯{L2}.
77 #L1 #L2 #T1 #T2 #H @(frsupp_ind … H) -L2 -T2
78 /2 width=3 by frsup_fwd_lw/ (**) (* /3 width=5 by frsup_fwd_lw, transitive_le/ is too slow *)
79 #L #T #L2 #T2 #_ #HL2 #HL1
80 lapply (frsup_fwd_lw … HL2) -HL2 /2 width=3 by transitive_le/
83 lemma frsupp_fwd_tw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → ♯{T2} < ♯{T1}.
84 #L1 #L2 #T1 #T2 #H @(frsupp_ind … H) -L2 -T2
85 /3 width=3 by frsup_fwd_tw, transitive_lt/
88 lemma frsupp_fwd_append: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → ∃L. L2 = L1 @@ L.
89 #L1 #L2 #T1 #T2 #H @(frsupp_ind … H) -L2 -T2 /2 width=3 by frsup_fwd_append/
90 #L #T #L2 #T2 #_ #HL2 * #K1 #H destruct
91 elim (frsup_fwd_append … HL2) -HL2 #K2 #H destruct /2 width=2/
94 (* Advanced forward lemmas **************************************************)
96 lemma lift_frsupp_trans: ∀L,U1,K,U2. ⦃L, U1⦄ ⧁+ ⦃L @@ K, U2⦄ →
97 ∀T1,d,e. ⇧[d, e] T1 ≡ U1 →
98 ∃T2. ⇧[d + |K|, e] T2 ≡ U2.
99 #L #U1 @(f2_ind … fw … L U1) -L -U1 #n #IH
100 #L #U1 #Hn #K #U2 #H #T1 #d #e #HTU1 destruct
101 elim (frsupp_inv_sn … H) -H /2 width=5 by lift_frsup_trans/ *
103 elim (frsup_fwd_append … HL0) #K0 #H destruct
104 elim (frsupp_fwd_append … HL) #L0 >append_assoc #H
105 elim (append_inj_dx … H ?) -H // #_ #H destruct
106 <append_assoc in HL; #HL
107 elim (lift_frsup_trans … HTU1 … HL0) -T1 #T #HTU
108 lapply (frsup_fwd_fw … HL0) -HL0 #HL0
109 elim (IH … HL … HTU) -IH -HL -T // -L -U1 -U0 /2 width=2/