3 lemma vdrop_refl: ∀M,v,l. ↓[l, 0] v ≐⦋M⦌ v.
4 #M #v #l #i elim (lt_or_ge … i l) #Hil
10 (* Main properties **********************************************************)
12 theorem vdrop_vdrop_le_sym: ∀M,v,l1,l2,m1,m2. l1 ≤ l2 →
13 ↓[l1, m1] ↓[l2+m1, m2] v ≐⦋M⦌ ↓[l2, m2] ↓[l1, m1] v.
14 #M #v #l1 #l2 #m1 #m2 #Hl12 #j elim (lt_or_ge … j l1) #Hjl1
15 [ lapply (lt_to_le_to_lt … Hjl1 Hl12) -Hl12 #Hjl2
16 >vdrop_lt // >vdrop_lt /2 width=3 by lt_to_le_to_lt/
17 >vdrop_lt // >vdrop_lt //
18 | >vdrop_ge // elim (lt_or_ge … j l2) #Hjl2 -Hl12
19 [ >vdrop_lt /2 width=1 by lt_minus_to_plus/
20 >vdrop_lt // >vdrop_ge //
21 | >vdrop_ge /2 width=1 by monotonic_le_plus_l/
22 >vdrop_ge // >vdrop_ge /2 width=1 by le_plus/
27 lemma vdrop_vdrop_le: ∀M,v,l1,l2,m1,m2. l1 ≤ l2 →
28 ↓[l2, m2] ↓[l1, m1] v ≐⦋M⦌ ↓[l1, m1] ↓[l2+m1, m2] v.
29 /3 width=1 by vdrop_vdrop_le_sym, veq_sym/ qed-.
31 (* Properties on raise ******************************************************)
33 lemma vdrop_raise_lt: ∀M,v,d,l,m,i. i ≤ l → ↓[l+1, m] [i⬐d] v ≐⦋M⦌ [i⬐d] ↓[l, m] v.
34 #M #v #d #l #m #i #Hil #j elim (lt_or_eq_or_gt … j i) #Hij destruct
35 [ lapply (lt_to_le_to_lt … Hij Hil) -Hil #Hjl
36 >vdrop_lt /2 width=1 by le_S/ >raise_lt // >raise_lt // >vdrop_lt //
37 | >vdrop_lt /2 width=1 by le_S_S/ >raise_eq >raise_eq //
38 | lapply (ltn_to_ltO … Hij) #Hj
39 >raise_gt // elim (lt_or_ge … j (l+1)) #Hlj
40 [ -Hil >vdrop_lt // >vdrop_lt /2 width=2 by lt_plus_to_minus/ >raise_gt //
41 | >vdrop_ge // >vdrop_ge /2 width=1 by le_plus_to_minus_r/
42 >raise_gt /2 width=1 by le_plus/ >plus_minus //
47 lemma raise_vdrop_lt: ∀M,v,d,l,m,i. i ≤ l → [i⬐d] ↓[l, m] v ≐⦋M⦌ ↓[l+1, m] [i⬐d] v.
48 /3 width=1 by vdrop_raise_lt, veq_sym/ qed.
50 lemma vdrop_raise_be: ∀M,v,d,l,m,i. l ≤ i → i ≤ l + m → ↓[l, m+1] [i⬐d] v ≐⦋M⦌ ↓[l, m] v.
51 #M #v #d #l #m #i #Hli #Hilm #j elim (lt_or_ge … j l) #Hlj
52 [ lapply (lt_to_le_to_lt … Hlj Hli) -Hli -Hilm #Hij
53 >vdrop_lt // >vdrop_lt // >raise_lt //
54 | lapply (transitive_le … (j+m) Hilm ?) -Hli -Hilm /2 width=1 by monotonic_le_plus_l/ #Hijm
55 >vdrop_ge // >vdrop_ge // >raise_gt /2 width=1 by le_S_S/
59 lemma vdrop_raise_be_sym: ∀M,v,d,l,m,i. l ≤ i → i ≤ l + m → ↓[l, m] v ≐⦋M⦌ ↓[l, m+1] [i⬐d] v.
60 /3 width=1 by vdrop_raise_be, veq_sym/ qed.
62 lemma vdrop_raise: ∀M,v,d,l. ↓[l, 1] [l⬐d] v ≐⦋M⦌ v.
63 /3 width=3 by vdrop_raise_be, veq_trans/ qed.
65 lemma vdrop_raise_sym: ∀M,v,d,l. v ≐⦋M⦌ ↓[l, 1] [l⬐d] v.
66 /2 width=1 by veq_sym/ qed.
68 lemma raise_vdrop: ∀M,v,i. [i⬐v i] ↓[i,1] v ≐⦋M⦌ v.
69 #M #V #i #j elim (lt_or_eq_or_gt j i) #Hij destruct
70 [ >raise_lt // >vdrop_lt //
72 | >raise_gt // >vdrop_ge /2 width=1 by monotonic_pred/
73 <plus_minus_m_m /2 width=2 by ltn_to_ltO/
77 lemma raise_vdrop_sym: ∀M,v,i. v ≐⦋M⦌ [i⬐v i] ↓[i,1] v.
78 /3 width=1 by raise_vdrop, veq_sym/ qed.
80 lemma raise_vdrop_be: ∀M,v,l,m. ↓[l, m] v ≐⦋M⦌ [l⬐v (l+m)] ↓[l, m+1] v.
81 #M #v #l #m #j elim (lt_or_eq_or_gt j l) #Hlj destruct
82 [ >vdrop_lt // >raise_lt // >vdrop_lt //
83 | >vdrop_ge // >raise_eq //
84 | lapply (ltn_to_ltO … Hlj) #Hj
85 >vdrop_ge /2 width=1 by lt_to_le/ >raise_gt //
86 >vdrop_ge /4 width=1 by plus_minus, monotonic_pred, eq_f/
90 lemma raise_vdrop_be_sym: ∀M,v,l,m. [l⬐v (l+m)] ↓[l, m+1] v ≐⦋M⦌ ↓[l, m] v.
91 /3 width=1 by raise_vdrop_be, veq_sym/ qed.
93 (* Forward lemmas on raise **************************************************)
95 lemma vdrop_fwd_raise_be_S: ∀M,v1,v2,d,l,m. ↓[l, m] v1 ≐⦋M⦌ [l⬐d] v2 →
97 #M #v1 #v2 #d #l #m #Hv12 #j elim (lt_or_ge j l) #Hlj
98 [ lapply (Hv12 j) -Hv12
99 >vdrop_lt // >vdrop_lt // >raise_lt //
100 | lapply (Hv12 (j+1))
101 >vdrop_ge /2 width=1 by le_S/ >vdrop_ge // >raise_gt /2 width=1 by le_S_S/
105 lemma raise_fwd_vdrop_be_S: ∀M,v1,v2,d,l,m. [l⬐d] v2 ≐⦋M⦌ ↓[l, m] v1 →
107 /3 width=2 by vdrop_fwd_raise_be_S, veq_sym/ qed-.
109 lemma vdrop_fwd_raise_be_O: ∀M,v1,v2,d,l,m. ↓[l, m] v1 ≐⦋M⦌ [l⬐d] v2 → v1 (l+m) = d.
110 #M #v1 #v2 #d #l #m #Hv12 lapply (Hv12 l)
111 >vdrop_ge // >raise_eq //
114 lemma raise_fwd_vdrop_be_O: ∀M,v1,v2,d,l,m. [l⬐d] v2 ≐⦋M⦌ ↓[l, m] v1 → d = v1 (l+m).
115 /4 width=7 by vdrop_fwd_raise_be_O, veq_sym, sym_eq/ qed-.
117 (* Inversion lemmas on raise ************************************************)
119 lemma raise_inv_vdrop_lt: ∀M,v1,v2,d,l,m,i. i ≤ l → [i⬐d] v1 ≐⦋M⦌ ↓[l+1, m] v2 →
120 ∃∃v. v1 ≐ ↓[l, m] v & v2 ≐ [i⬐d] v.
121 #M #v1 #v2 #d #l #m #i #Hil #Hv12
122 lapply (Hv12 i) >raise_eq >vdrop_lt /2 width=1 by le_S_S/ #H destruct
123 @(ex2_intro … (↓[i, 1] v2)) //
124 @(veq_trans … (↓[i, 1] ↓[l+1, m] v2))
125 /3 width=3 by vdrop_vdrop_le_sym, vdrop_veq, veq_trans/
128 lemma vdrop_inv_raise_lt: ∀M,v1,v2,d,l,m,i. i ≤ l → ↓[l+1, m] v2 ≐⦋M⦌ [i⬐d] v1 →
129 ∃∃v. v1 ≐ ↓[l, m] v & v2 ≐ [i⬐d] v.
130 /3 width=1 by raise_inv_vdrop_lt, veq_sym/ qed-.
132 lemma vdrop_inv_raise_be: ∀M,v1,v2,d,l,m. ↓[l, m] v1 ≐⦋M⦌ [l⬐d] v2 →
133 v1 (l+m) = d ∧ ↓[l, m+1] v1 ≐ v2.
134 /3 width=2 by vdrop_fwd_raise_be_O, vdrop_fwd_raise_be_S, conj/ qed-.
136 lemma raise_inv_vdrop_be: ∀M,v1,v2,d,l,m. [l⬐d] v2 ≐⦋M⦌ ↓[l, m] v1 →
137 d = v1 (l+m) ∧ v2 ≐ ↓[l, m+1] v1.
138 /3 width=2 by raise_fwd_vdrop_be_O, raise_fwd_vdrop_be_S, conj/ qed-.