]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/frsup/frsupp.etc
- ynat: some additions
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / frsup / frsupp.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( ⦃ 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 }.
18
19 include "basic_2/substitution/frsup.ma".
20
21 (* PLUS-ITERATED RESTRICTED SUPCLOSURE **************************************)
22
23 definition frsupp: bi_relation lenv term ≝ bi_TC … frsup.
24
25 interpretation "plus-iterated restricted structural predecessor (closure)"
26    'RestSupTermPlus L1 T1 L2 T2 = (frsupp L1 T1 L2 T2).
27
28 (* Basic eliminators ********************************************************)
29
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)
36 qed-.
37
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)
44 qed-.
45
46 (* Baic inversion lemmas ****************************************************)
47
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-.
51
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-.
55
56 (* Basic properties *********************************************************)
57
58 lemma frsup_frsupp: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
59 /2 width=1/ qed.
60
61 lemma frsupp_strap1: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁+ ⦃L, T⦄ → ⦃L, T⦄ ⧁ ⦃L2, T2⦄ →
62                      ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
63 /2 width=4/ qed.
64
65 lemma frsupp_strap2: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁ ⦃L, T⦄ → ⦃L, T⦄ ⧁+ ⦃L2, T2⦄ →
66                      ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
67 /2 width=4/ qed.
68
69 (* Basic forward lemmas *****************************************************)
70
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/
74 qed-.
75
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/
81 qed-.
82
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/
86 qed-.
87
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/
92 qed-.
93
94 (* Advanced forward lemmas **************************************************)
95
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/ *
102 #L0 #U0 #HL0 #HL
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/
110 qed-.