]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/unfold/frsupp.ma
- we introduced the pointer_step rc in the perspective of proving
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / unfold / frsupp.ma
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 include "basic_2/substitution/frsup.ma".
16
17 (* PLUS-ITERATED RESTRICTED SUPCLOSURE **************************************)
18
19 definition frsupp: bi_relation lenv term ≝ bi_TC … frsup.
20
21 interpretation "plus-iterated restricted structural predecessor (closure)"
22    'RestSupTermPlus L1 T1 L2 T2 = (frsupp L1 T1 L2 T2).
23
24 (* Basic eliminators ********************************************************)
25
26 lemma frsupp_ind: ∀L1,T1. ∀R:relation2 lenv term.
27                   (∀L2,T2. ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ → R L2 T2) →
28                   (∀L,T,L2,T2. ⦃L1, T1⦄ ⧁+ ⦃L, T⦄ → ⦃L, T⦄ ⧁ ⦃L2, T2⦄ → R L T → R L2 T2) →
29                   ∀L2,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → R L2 T2.
30 #L1 #T1 #R #IH1 #IH2 #L2 #T2 #H
31 @(bi_TC_ind … IH1 IH2 ? ? H)
32 qed-.
33
34 lemma frsupp_ind_dx: ∀L2,T2. ∀R:relation2 lenv term.
35                      (∀L1,T1. ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ → R L1 T1) →
36                      (∀L1,L,T1,T. ⦃L1, T1⦄ ⧁ ⦃L, T⦄ → ⦃L, T⦄ ⧁+ ⦃L2, T2⦄ → R L T → R L1 T1) →
37                      ∀L1,T1. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → R L1 T1.
38 #L2 #T2 #R #IH1 #IH2 #L1 #T1 #H
39 @(bi_TC_ind_dx … IH1 IH2 ? ? H)
40 qed-.
41
42 (* Basic properties *********************************************************)
43
44 lemma frsup_frsupp: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
45 /2 width=1/ qed.
46
47 lemma frsupp_strap1: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁+ ⦃L, T⦄ → ⦃L, T⦄ ⧁ ⦃L2, T2⦄ →
48                      ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
49 /2 width=4/ qed.
50
51 lemma frsupp_strap2: ∀L1,L,L2,T1,T,T2. ⦃L1, T1⦄ ⧁ ⦃L, T⦄ → ⦃L, T⦄ ⧁+ ⦃L2, T2⦄ →
52                      ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄.
53 /2 width=4/ qed.
54
55 (* Basic forward lemmas *****************************************************)
56
57 lemma frsupp_fwd_fw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → #{L2, T2} < #{L1, T1}.
58 #L1 #L2 #T1 #T2 #H @(frsupp_ind … H) -L2 -T2
59 /3 width=3 by frsup_fwd_fw, transitive_lt/
60 qed-.
61
62 lemma frsupp_fwd_lw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → #{L1} ≤ #{L2}.
63 #L1 #L2 #T1 #T2 #H @(frsupp_ind … H) -L2 -T2
64 /2 width=3 by frsup_fwd_lw/ (**) (* /3 width=5 by frsup_fwd_lw, transitive_le/ is too slow *)
65 #L #T #L2 #T2 #_ #HL2 #HL1
66 lapply (frsup_fwd_lw … HL2) -HL2 /2 width=3 by transitive_le/
67 qed-.
68
69 lemma frsupp_fwd_tw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → #{T2} < #{T1}.
70 #L1 #L2 #T1 #T2 #H @(frsupp_ind … H) -L2 -T2
71 /3 width=3 by frsup_fwd_tw, transitive_lt/
72 qed-.
73
74 lemma frsupp_fwd_append: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⧁+ ⦃L2, T2⦄ → ∃L. L2 = L1 @@ L.
75 #L1 #L2 #T1 #T2 #H @(frsupp_ind … H) -L2 -T2 /2 width=3 by frsup_fwd_append/
76 #L #T #L2 #T2 #_ #HL2 * #K1 #H destruct
77 elim (frsup_fwd_append … HL2) -HL2 #K2 #H destruct /2 width=2/
78 qed-.
79
80 (* Advanced forward lemmas **************************************************)
81
82 fact lift_frsupp_trans_aux: ∀L2,U0. (
83                                ∀L,K,U1,U2. ⦃L, U1⦄ ⧁+ ⦃L @@ K, U2⦄ →
84                                ∀T1,d,e. ⇧[d, e] T1 ≡ U1 →
85                                #{L, U1} < #{L2, U0} → 
86                                ∃T2. ⇧[d + |K|, e] T2 ≡ U2
87                             ) →
88                             ∀L1,K,U1,U2. ⦃L1, U1⦄ ⧁+ ⦃L2 @@ K, U2⦄ →
89                             ∀T1,d,e. ⇧[d, e] T1 ≡ U1 →
90                             L2 = L1 → U0 = U1 →
91                             ∃T2. ⇧[d + |K|, e] T2 ≡ U2.
92 #L2 #U0 #IH #L1 #X #U1 #U2 #H @(frsupp_ind_dx … H) -L1 -U1 /2 width=5 by lift_frsup_trans/
93 #L1 #L #U1 #U #HL1 #HL2 #_ #T1 #d #e #HTU1 #H1 #H2 destruct
94 elim (frsup_fwd_append … HL1) #K1 #H destruct
95 elim (frsupp_fwd_append … HL2) #K >append_assoc #H
96 elim (append_inj_dx … H ?) -H // #_ #H destruct
97 <append_assoc in HL2; #HL2
98 elim (lift_frsup_trans … HTU1 … HL1) -T1 #T #HTU
99 lapply (frsup_fwd_fw … HL1) -HL1 #HL1
100 elim (IH … HL2 … HTU ?) -IH -HL2 -T // -L1 -U1 -U /2 width=2/
101 qed-.
102
103 lemma lift_frsupp_trans: ∀L,U1,K,U2. ⦃L, U1⦄ ⧁+ ⦃L @@ K, U2⦄ →
104                          ∀T1,d,e. ⇧[d, e] T1 ≡ U1 →
105                          ∃T2. ⇧[d + |K|, e] T2 ≡ U2.
106 #L #U1 @(fw_ind … L U1) -L -U1 /3 width=10 by lift_frsupp_trans_aux/
107 qed-.