]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/frsup/frsups.etc
- ynat: some additions
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / frsup / frsups.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 @{ 'RestSupTermStar $L1 $T1 $L2 $T2 }.
18
19 include "basic_2/unfold/frsupp.ma".
20
21 (* STAR-ITERATED RESTRICTED SUPCLOSURE **************************************)
22
23 definition frsups: bi_relation lenv term ≝ bi_star … frsup.
24
25 interpretation "star-iterated restricted structural predecessor (closure)"
26    'RestSupTermStar L1 T1 L2 T2 = (frsups L1 T1 L2 T2).
27
28 (* Basic eliminators ********************************************************)
29
30 lemma frsups_ind: ∀L1,T1. ∀R:relation2 lenv term. R L1 T1 →
31                   (∀L,L2,T,T2. ⦃L1, T1⦄ ⧁* ⦃L, T⦄ → ⦃L, T⦄ ⧁ ⦃L2, T2⦄ → R L T → R L2 T2) →
32                   ∀L2,T2. ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄ → R L2 T2.
33 #L1 #T1 #R #IH1 #IH2 #L2 #T2 #H
34 @(bi_star_ind … IH1 IH2 ? ? H)
35 qed-.
36
37 lemma frsups_ind_dx: ∀L2,T2. ∀R:relation2 lenv term. R L2 T2 →
38                      (∀L1,L,T1,T. ⦃L1, T1⦄ ⧁ ⦃L, T⦄ → ⦃L, T⦄ ⧁* ⦃L2, T2⦄ → R L T → R L1 T1) →
39                      ∀L1,T1. ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄ → R L1 T1.
40 #L2 #T2 #R #IH1 #IH2 #L1 #T1 #H
41 @(bi_star_ind_dx … IH1 IH2 ? ? H)
42 qed-.
43
44 (* Basic properties *********************************************************)
45
46 lemma frsups_refl: bi_reflexive … frsups.
47 /2 width=1/ qed.
48
49 lemma frsupp_frsups: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄.
50 /2 width=1/ qed.
51
52 lemma frsup_frsups: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄.
53 /2 width=1/ qed.
54
55 lemma frsups_strap1: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁* ⦃L, T⦄ → ⦃L, T⦄ ⧁ ⦃L2, T2⦄ →
56                      ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄.
57 /2 width=4/ qed.
58
59 lemma frsups_strap2: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁ ⦃L, T⦄ → ⦃L, T⦄ ⧁* ⦃L2, T2⦄ →
60                      ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄.
61 /2 width=4/ qed.
62
63 lemma frsups_frsupp_frsupp: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁* ⦃L, T⦄ →
64                             ⦃L, T⦄ ⧁+ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
65 /2 width=4/ qed.
66
67 lemma frsupp_frsups_frsupp: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁+ ⦃L, T⦄ →
68                             ⦃L, T⦄ ⧁* ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
69 /2 width=4/ qed.
70
71 (* Basic inversion lemmas ***************************************************)
72
73 lemma frsups_inv_all: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄ →
74                       (L1 = L2 ∧ T1 = T2) ∨ ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
75 #L1 #L2 #T1 #T2 * /2 width=1/
76 qed-.
77
78 (* Basic forward lemmas *****************************************************)
79
80 lemma frsups_fwd_fw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄ → ♯{L2, T2} ≤ ♯{L1, T1}.
81 #L1 #L2 #T1 #T2 #H elim (frsups_inv_all … H) -H [ * // ]
82 /3 width=1 by frsupp_fwd_fw, lt_to_le/
83 qed-.
84
85 lemma frsups_fwd_lw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄ → ♯{L1} ≤ ♯{L2}.
86 #L1 #L2 #T1 #T2 #H elim (frsups_inv_all … H) -H [ * // ]
87 /2 width=3 by frsupp_fwd_lw/
88 qed-.
89
90 lemma frsups_fwd_tw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄ → ♯{T2} ≤ ♯{T1}.
91 #L1 #L2 #T1 #T2 #H elim (frsups_inv_all … H) -H [ * // ]
92 /3 width=3 by frsupp_fwd_tw, lt_to_le/
93 qed-.
94
95 lemma frsups_fwd_append: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁* ⦃L2, T2⦄ → ∃L. L2 = L1 @@ L.
96 #L1 #L2 #T1 #T2 #H elim (frsups_inv_all … H) -H
97 [ * #H1 #H2 destruct
98   @(ex_intro … (⋆)) //
99 | /2 width=3 by frsupp_fwd_append/
100 qed-.
101
102 (* Advanced forward lemmas ***************************************************)
103
104 lemma lift_frsups_trans: ∀T1,U1,d,e. ⇧[d, e] T1 ≡ U1 →
105                          ∀L,K,U2. ⦃L, U1⦄ ⧁* ⦃L @@ K, U2⦄ →
106                          ∃T2. ⇧[d + |K|, e] T2 ≡ U2.
107 #T1 #U1 #d #e #HTU1 #L #K #U2 #H elim (frsups_inv_all … H) -H
108 [ * #H1 #H2 destruct
109   >(append_inv_refl_dx … (sym_eq … H1)) -H1 normalize /2 width=2/
110 | /2 width=5 by lift_frsupp_trans/
111 ]
112 qed-.
113
114 (* Advanced inversion lemmas for frsupp **************************************)
115
116 lemma frsupp_inv_atom1_frsups: ∀J,L1,L2,T2. ⦃L1, ⓪{J}⦄ ⧁+ ⦃L2, T2⦄ → ⊥.
117 #J #L1 #L2 #T2 #H @(frsupp_ind … H) -L2 -T2 //
118 #L2 #T2 #H elim (frsup_inv_atom1 … H)
119 qed-.
120
121 lemma frsupp_inv_bind1_frsups: ∀b,J,L1,L2,W,U,T2. ⦃L1, ⓑ{b,J}W.U⦄ ⧁+ ⦃L2, T2⦄ →
122                                ⦃L1, W⦄ ⧁* ⦃L2, T2⦄ ∨ ⦃L1.ⓑ{J}W, U⦄ ⧁* ⦃L2, T2⦄.
123 #b #J #L1 #L2 #W #U #T2 #H @(frsupp_ind … H) -L2 -T2
124 [ #L2 #T2 #H
125   elim (frsup_inv_bind1 … H) -H * #H1 #H2 destruct /2 width=1/
126 | #L #T #L2 #T2 #_ #HT2 * /3 width=4/
127 ]
128 qed-.
129
130 lemma frsupp_inv_flat1_frsups: ∀J,L1,L2,W,U,T2. ⦃L1, ⓕ{J}W.U⦄ ⧁+ ⦃L2, T2⦄ →
131                                ⦃L1, W⦄ ⧁* ⦃L2, T2⦄ ∨ ⦃L1, U⦄ ⧁* ⦃L2, T2⦄.
132 #J #L1 #L2 #W #U #T2 #H @(frsupp_ind … H) -L2 -T2
133 [ #L2 #T2 #H
134   elim (frsup_inv_flat1 … H) -H #H1 * #H2 destruct /2 width=1/
135 | #L #T #L2 #T2 #_ #HT2 * /3 width=4/
136 ]
137 qed-.