author | bulwahn |
Tue, 28 Jun 2011 16:43:44 +0200 | |
changeset 43586 | eb64d8e00a62 |
parent 41842 | d8f76db6a207 |
child 44939 | 5930d35c976d |
permissions | -rw-r--r-- |
24333 | 1 |
(* |
2 |
Author: Jeremy Dawson, NICTA |
|
3 |
||
4 |
contains theorems to do with integers, expressed using Pls, Min, BIT, |
|
5 |
theorems linking them to lists of booleans, and repeated splitting |
|
6 |
and concatenation. |
|
7 |
*) |
|
8 |
||
9 |
header "Bool lists and integers" |
|
10 |
||
37658 | 11 |
theory Bool_List_Representation |
12 |
imports Bit_Int |
|
26557 | 13 |
begin |
24333 | 14 |
|
37657 | 15 |
subsection {* Operations on lists of booleans *} |
16 |
||
17 |
primrec bl_to_bin_aux :: "bool list \<Rightarrow> int \<Rightarrow> int" where |
|
18 |
Nil: "bl_to_bin_aux [] w = w" |
|
19 |
| Cons: "bl_to_bin_aux (b # bs) w = |
|
20 |
bl_to_bin_aux bs (w BIT (if b then 1 else 0))" |
|
21 |
||
22 |
definition bl_to_bin :: "bool list \<Rightarrow> int" where |
|
23 |
bl_to_bin_def : "bl_to_bin bs = bl_to_bin_aux bs Int.Pls" |
|
24 |
||
37667 | 25 |
lemma [code]: |
26 |
"bl_to_bin bs = bl_to_bin_aux bs 0" |
|
27 |
by (simp add: bl_to_bin_def Pls_def) |
|
28 |
||
37657 | 29 |
primrec bin_to_bl_aux :: "nat \<Rightarrow> int \<Rightarrow> bool list \<Rightarrow> bool list" where |
30 |
Z: "bin_to_bl_aux 0 w bl = bl" |
|
31 |
| Suc: "bin_to_bl_aux (Suc n) w bl = |
|
32 |
bin_to_bl_aux n (bin_rest w) ((bin_last w = 1) # bl)" |
|
33 |
||
34 |
definition bin_to_bl :: "nat \<Rightarrow> int \<Rightarrow> bool list" where |
|
35 |
bin_to_bl_def : "bin_to_bl n w = bin_to_bl_aux n w []" |
|
36 |
||
37 |
primrec bl_of_nth :: "nat \<Rightarrow> (nat \<Rightarrow> bool) \<Rightarrow> bool list" where |
|
38 |
Suc: "bl_of_nth (Suc n) f = f n # bl_of_nth n f" |
|
39 |
| Z: "bl_of_nth 0 f = []" |
|
40 |
||
41 |
primrec takefill :: "'a \<Rightarrow> nat \<Rightarrow> 'a list \<Rightarrow> 'a list" where |
|
42 |
Z: "takefill fill 0 xs = []" |
|
43 |
| Suc: "takefill fill (Suc n) xs = ( |
|
44 |
case xs of [] => fill # takefill fill n xs |
|
45 |
| y # ys => y # takefill fill n ys)" |
|
46 |
||
47 |
definition map2 :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'a list \<Rightarrow> 'b list \<Rightarrow> 'c list" where |
|
48 |
"map2 f as bs = map (split f) (zip as bs)" |
|
49 |
||
50 |
lemma map2_Nil [simp]: "map2 f [] ys = []" |
|
51 |
unfolding map2_def by auto |
|
52 |
||
53 |
lemma map2_Nil2 [simp]: "map2 f xs [] = []" |
|
54 |
unfolding map2_def by auto |
|
55 |
||
56 |
lemma map2_Cons [simp]: |
|
57 |
"map2 f (x # xs) (y # ys) = f x y # map2 f xs ys" |
|
58 |
unfolding map2_def by auto |
|
59 |
||
60 |
||
24465 | 61 |
subsection "Arithmetic in terms of bool lists" |
62 |
||
26557 | 63 |
(* arithmetic operations in terms of the reversed bool list, |
24465 | 64 |
assuming input list(s) the same length, and don't extend them *) |
65 |
||
26557 | 66 |
primrec rbl_succ :: "bool list => bool list" where |
24465 | 67 |
Nil: "rbl_succ Nil = Nil" |
26557 | 68 |
| Cons: "rbl_succ (x # xs) = (if x then False # rbl_succ xs else True # xs)" |
24465 | 69 |
|
26557 | 70 |
primrec rbl_pred :: "bool list => bool list" where |
71 |
Nil: "rbl_pred Nil = Nil" |
|
72 |
| Cons: "rbl_pred (x # xs) = (if x then False # xs else True # rbl_pred xs)" |
|
24465 | 73 |
|
26557 | 74 |
primrec rbl_add :: "bool list => bool list => bool list" where |
75 |
(* result is length of first arg, second arg may be longer *) |
|
76 |
Nil: "rbl_add Nil x = Nil" |
|
77 |
| Cons: "rbl_add (y # ys) x = (let ws = rbl_add ys (tl x) in |
|
24465 | 78 |
(y ~= hd x) # (if hd x & y then rbl_succ ws else ws))" |
79 |
||
26557 | 80 |
primrec rbl_mult :: "bool list => bool list => bool list" where |
81 |
(* result is length of first arg, second arg may be longer *) |
|
82 |
Nil: "rbl_mult Nil x = Nil" |
|
83 |
| Cons: "rbl_mult (y # ys) x = (let ws = False # rbl_mult ys x in |
|
24465 | 84 |
if y then rbl_add ws x else ws)" |
24333 | 85 |
|
86 |
lemma butlast_power: |
|
30971 | 87 |
"(butlast ^^ n) bl = take (length bl - n) bl" |
24333 | 88 |
by (induct n) (auto simp: butlast_take) |
89 |
||
26086
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
90 |
lemma bin_to_bl_aux_Pls_minus_simp [simp]: |
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
91 |
"0 < n ==> bin_to_bl_aux n Int.Pls bl = |
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
92 |
bin_to_bl_aux (n - 1) Int.Pls (False # bl)" |
24333 | 93 |
by (cases n) auto |
94 |
||
26086
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
95 |
lemma bin_to_bl_aux_Min_minus_simp [simp]: |
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
96 |
"0 < n ==> bin_to_bl_aux n Int.Min bl = |
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
97 |
bin_to_bl_aux (n - 1) Int.Min (True # bl)" |
24333 | 98 |
by (cases n) auto |
99 |
||
26086
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
100 |
lemma bin_to_bl_aux_Bit_minus_simp [simp]: |
24333 | 101 |
"0 < n ==> bin_to_bl_aux n (w BIT b) bl = |
37654 | 102 |
bin_to_bl_aux (n - 1) w ((b = 1) # bl)" |
24333 | 103 |
by (cases n) auto |
104 |
||
26086
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
105 |
lemma bin_to_bl_aux_Bit0_minus_simp [simp]: |
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
106 |
"0 < n ==> bin_to_bl_aux n (Int.Bit0 w) bl = |
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
107 |
bin_to_bl_aux (n - 1) w (False # bl)" |
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
108 |
by (cases n) auto |
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
109 |
|
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
110 |
lemma bin_to_bl_aux_Bit1_minus_simp [simp]: |
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
111 |
"0 < n ==> bin_to_bl_aux n (Int.Bit1 w) bl = |
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
112 |
bin_to_bl_aux (n - 1) w (True # bl)" |
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
huffman
parents:
26008
diff
changeset
|
113 |
by (cases n) auto |
24333 | 114 |
|
24465 | 115 |
(** link between bin and bool list **) |
116 |
||
26557 | 117 |
lemma bl_to_bin_aux_append: |
118 |
"bl_to_bin_aux (bs @ cs) w = bl_to_bin_aux cs (bl_to_bin_aux bs w)" |
|
119 |
by (induct bs arbitrary: w) auto |
|
24465 | 120 |
|
26557 | 121 |
lemma bin_to_bl_aux_append: |
122 |
"bin_to_bl_aux n w bs @ cs = bin_to_bl_aux n w (bs @ cs)" |
|
123 |
by (induct n arbitrary: w bs) auto |
|
24333 | 124 |
|
24465 | 125 |
lemma bl_to_bin_append: |
26557 | 126 |
"bl_to_bin (bs @ cs) = bl_to_bin_aux cs (bl_to_bin bs)" |
24465 | 127 |
unfolding bl_to_bin_def by (rule bl_to_bin_aux_append) |
128 |
||
24333 | 129 |
lemma bin_to_bl_aux_alt: |
130 |
"bin_to_bl_aux n w bs = bin_to_bl n w @ bs" |
|
131 |
unfolding bin_to_bl_def by (simp add : bin_to_bl_aux_append) |
|
132 |
||
24465 | 133 |
lemma bin_to_bl_0: "bin_to_bl 0 bs = []" |
24333 | 134 |
unfolding bin_to_bl_def by auto |
135 |
||
26557 | 136 |
lemma size_bin_to_bl_aux: |
137 |
"size (bin_to_bl_aux n w bs) = n + length bs" |
|
138 |
by (induct n arbitrary: w bs) auto |
|
24333 | 139 |
|
24465 | 140 |
lemma size_bin_to_bl: "size (bin_to_bl n w) = n" |
24333 | 141 |
unfolding bin_to_bl_def by (simp add : size_bin_to_bl_aux) |
142 |
||
26557 | 143 |
lemma bin_bl_bin': |
144 |
"bl_to_bin (bin_to_bl_aux n w bs) = |
|
145 |
bl_to_bin_aux bs (bintrunc n w)" |
|
146 |
by (induct n arbitrary: w bs) (auto simp add : bl_to_bin_def) |
|
24465 | 147 |
|
148 |
lemma bin_bl_bin: "bl_to_bin (bin_to_bl n w) = bintrunc n w" |
|
149 |
unfolding bin_to_bl_def bin_bl_bin' by auto |
|
150 |
||
26557 | 151 |
lemma bl_bin_bl': |
152 |
"bin_to_bl (n + length bs) (bl_to_bin_aux bs w) = |
|
24465 | 153 |
bin_to_bl_aux n w bs" |
26557 | 154 |
apply (induct bs arbitrary: w n) |
24465 | 155 |
apply auto |
156 |
apply (simp_all only : add_Suc [symmetric]) |
|
157 |
apply (auto simp add : bin_to_bl_def) |
|
158 |
done |
|
159 |
||
160 |
lemma bl_bin_bl: "bin_to_bl (length bs) (bl_to_bin bs) = bs" |
|
161 |
unfolding bl_to_bin_def |
|
162 |
apply (rule box_equals) |
|
163 |
apply (rule bl_bin_bl') |
|
164 |
prefer 2 |
|
165 |
apply (rule bin_to_bl_aux.Z) |
|
166 |
apply simp |
|
167 |
done |
|
168 |
||
169 |
declare |
|
170 |
bin_to_bl_0 [simp] |
|
171 |
size_bin_to_bl [simp] |
|
172 |
bin_bl_bin [simp] |
|
173 |
bl_bin_bl [simp] |
|
174 |
||
175 |
lemma bl_to_bin_inj: |
|
176 |
"bl_to_bin bs = bl_to_bin cs ==> length bs = length cs ==> bs = cs" |
|
177 |
apply (rule_tac box_equals) |
|
178 |
defer |
|
179 |
apply (rule bl_bin_bl) |
|
180 |
apply (rule bl_bin_bl) |
|
181 |
apply simp |
|
182 |
done |
|
183 |
||
184 |
lemma bl_to_bin_False: "bl_to_bin (False # bl) = bl_to_bin bl" |
|
185 |
unfolding bl_to_bin_def by auto |
|
186 |
||
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
187 |
lemma bl_to_bin_Nil: "bl_to_bin [] = Int.Pls" |
24465 | 188 |
unfolding bl_to_bin_def by auto |
189 |
||
26557 | 190 |
lemma bin_to_bl_Pls_aux: |
191 |
"bin_to_bl_aux n Int.Pls bl = replicate n False @ bl" |
|
192 |
by (induct n arbitrary: bl) (auto simp: replicate_app_Cons_same) |
|
24333 | 193 |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
194 |
lemma bin_to_bl_Pls: "bin_to_bl n Int.Pls = replicate n False" |
24333 | 195 |
unfolding bin_to_bl_def by (simp add : bin_to_bl_Pls_aux) |
196 |
||
197 |
lemma bin_to_bl_Min_aux [rule_format] : |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
198 |
"ALL bl. bin_to_bl_aux n Int.Min bl = replicate n True @ bl" |
24333 | 199 |
by (induct n) (auto simp: replicate_app_Cons_same) |
200 |
||
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
201 |
lemma bin_to_bl_Min: "bin_to_bl n Int.Min = replicate n True" |
24333 | 202 |
unfolding bin_to_bl_def by (simp add : bin_to_bl_Min_aux) |
203 |
||
24465 | 204 |
lemma bl_to_bin_rep_F: |
205 |
"bl_to_bin (replicate n False @ bl) = bl_to_bin bl" |
|
206 |
apply (simp add: bin_to_bl_Pls_aux [symmetric] bin_bl_bin') |
|
207 |
apply (simp add: bl_to_bin_def) |
|
208 |
done |
|
209 |
||
210 |
lemma bin_to_bl_trunc: |
|
211 |
"n <= m ==> bin_to_bl n (bintrunc m w) = bin_to_bl n w" |
|
212 |
by (auto intro: bl_to_bin_inj) |
|
213 |
||
214 |
declare |
|
215 |
bin_to_bl_trunc [simp] |
|
216 |
bl_to_bin_False [simp] |
|
217 |
bl_to_bin_Nil [simp] |
|
218 |
||
24333 | 219 |
lemma bin_to_bl_aux_bintr [rule_format] : |
220 |
"ALL m bin bl. bin_to_bl_aux n (bintrunc m bin) bl = |
|
221 |
replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl" |
|
27105
5f139027c365
slightly tuning of some proofs involving case distinction and induction on natural numbers and similar
haftmann
parents:
26584
diff
changeset
|
222 |
apply (induct n) |
24333 | 223 |
apply clarsimp |
224 |
apply clarsimp |
|
225 |
apply (case_tac "m") |
|
226 |
apply (clarsimp simp: bin_to_bl_Pls_aux) |
|
227 |
apply (erule thin_rl) |
|
228 |
apply (induct_tac n) |
|
229 |
apply auto |
|
230 |
done |
|
231 |
||
232 |
lemmas bin_to_bl_bintr = |
|
233 |
bin_to_bl_aux_bintr [where bl = "[]", folded bin_to_bl_def] |
|
234 |
||
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
235 |
lemma bl_to_bin_rep_False: "bl_to_bin (replicate n False) = Int.Pls" |
24465 | 236 |
by (induct n) auto |
237 |
||
26557 | 238 |
lemma len_bin_to_bl_aux: |
239 |
"length (bin_to_bl_aux n w bs) = n + length bs" |
|
240 |
by (induct n arbitrary: w bs) auto |
|
24333 | 241 |
|
242 |
lemma len_bin_to_bl [simp]: "length (bin_to_bl n w) = n" |
|
243 |
unfolding bin_to_bl_def len_bin_to_bl_aux by auto |
|
244 |
||
26557 | 245 |
lemma sign_bl_bin': |
246 |
"bin_sign (bl_to_bin_aux bs w) = bin_sign w" |
|
247 |
by (induct bs arbitrary: w) auto |
|
24333 | 248 |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
249 |
lemma sign_bl_bin: "bin_sign (bl_to_bin bs) = Int.Pls" |
24333 | 250 |
unfolding bl_to_bin_def by (simp add : sign_bl_bin') |
251 |
||
26557 | 252 |
lemma bl_sbin_sign_aux: |
253 |
"hd (bin_to_bl_aux (Suc n) w bs) = |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
254 |
(bin_sign (sbintrunc n w) = Int.Min)" |
26557 | 255 |
apply (induct n arbitrary: w bs) |
24333 | 256 |
apply clarsimp |
26557 | 257 |
apply (cases w rule: bin_exhaust) |
24333 | 258 |
apply (simp split add : bit.split) |
259 |
apply clarsimp |
|
260 |
done |
|
261 |
||
262 |
lemma bl_sbin_sign: |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
263 |
"hd (bin_to_bl (Suc n) w) = (bin_sign (sbintrunc n w) = Int.Min)" |
24333 | 264 |
unfolding bin_to_bl_def by (rule bl_sbin_sign_aux) |
265 |
||
26557 | 266 |
lemma bin_nth_of_bl_aux [rule_format]: |
267 |
"\<forall>w. bin_nth (bl_to_bin_aux bl w) n = |
|
24333 | 268 |
(n < size bl & rev bl ! n | n >= length bl & bin_nth w (n - size bl))" |
269 |
apply (induct_tac bl) |
|
270 |
apply clarsimp |
|
271 |
apply clarsimp |
|
272 |
apply (cut_tac x=n and y="size list" in linorder_less_linear) |
|
273 |
apply (erule disjE, simp add: nth_append)+ |
|
26557 | 274 |
apply auto |
24333 | 275 |
done |
276 |
||
277 |
lemma bin_nth_of_bl: "bin_nth (bl_to_bin bl) n = (n < length bl & rev bl ! n)"; |
|
278 |
unfolding bl_to_bin_def by (simp add : bin_nth_of_bl_aux) |
|
279 |
||
280 |
lemma bin_nth_bl [rule_format] : "ALL m w. n < m --> |
|
281 |
bin_nth w n = nth (rev (bin_to_bl m w)) n" |
|
282 |
apply (induct n) |
|
283 |
apply clarsimp |
|
284 |
apply (case_tac m, clarsimp) |
|
285 |
apply (clarsimp simp: bin_to_bl_def) |
|
286 |
apply (simp add: bin_to_bl_aux_alt) |
|
287 |
apply clarsimp |
|
288 |
apply (case_tac m, clarsimp) |
|
289 |
apply (clarsimp simp: bin_to_bl_def) |
|
290 |
apply (simp add: bin_to_bl_aux_alt) |
|
291 |
done |
|
292 |
||
24465 | 293 |
lemma nth_rev [rule_format] : |
294 |
"n < length xs --> rev xs ! n = xs ! (length xs - 1 - n)" |
|
295 |
apply (induct_tac "xs") |
|
296 |
apply simp |
|
297 |
apply (clarsimp simp add : nth_append nth.simps split add : nat.split) |
|
298 |
apply (rule_tac f = "%n. list ! n" in arg_cong) |
|
299 |
apply arith |
|
300 |
done |
|
301 |
||
25350
a5fcf6d12a53
eliminated illegal schematic variables in where/of;
wenzelm
parents:
25134
diff
changeset
|
302 |
lemmas nth_rev_alt = nth_rev [where xs = "rev ys", simplified, standard] |
24465 | 303 |
|
24333 | 304 |
lemma nth_bin_to_bl_aux [rule_format] : |
305 |
"ALL w n bl. n < m + length bl --> (bin_to_bl_aux m w bl) ! n = |
|
306 |
(if n < m then bin_nth w (m - 1 - n) else bl ! (n - m))" |
|
27105
5f139027c365
slightly tuning of some proofs involving case distinction and induction on natural numbers and similar
haftmann
parents:
26584
diff
changeset
|
307 |
apply (induct m) |
24333 | 308 |
apply clarsimp |
309 |
apply clarsimp |
|
310 |
apply (case_tac w rule: bin_exhaust) |
|
311 |
apply simp |
|
312 |
done |
|
313 |
||
314 |
lemma nth_bin_to_bl: "n < m ==> (bin_to_bl m w) ! n = bin_nth w (m - Suc n)" |
|
315 |
unfolding bin_to_bl_def by (simp add : nth_bin_to_bl_aux) |
|
316 |
||
26557 | 317 |
lemma bl_to_bin_lt2p_aux [rule_format]: |
318 |
"\<forall>w. bl_to_bin_aux bs w < (w + 1) * (2 ^ length bs)" |
|
319 |
apply (induct bs) |
|
24333 | 320 |
apply clarsimp |
321 |
apply clarsimp |
|
322 |
apply safe |
|
26557 | 323 |
apply (erule allE, erule xtr8 [rotated], |
29667 | 324 |
simp add: numeral_simps algebra_simps cong add : number_of_False_cong)+ |
24333 | 325 |
done |
326 |
||
327 |
lemma bl_to_bin_lt2p: "bl_to_bin bs < (2 ^ length bs)" |
|
328 |
apply (unfold bl_to_bin_def) |
|
329 |
apply (rule xtr1) |
|
330 |
prefer 2 |
|
331 |
apply (rule bl_to_bin_lt2p_aux) |
|
332 |
apply simp |
|
333 |
done |
|
334 |
||
335 |
lemma bl_to_bin_ge2p_aux [rule_format] : |
|
26557 | 336 |
"\<forall>w. bl_to_bin_aux bs w >= w * (2 ^ length bs)" |
24333 | 337 |
apply (induct bs) |
338 |
apply clarsimp |
|
339 |
apply clarsimp |
|
340 |
apply safe |
|
28059 | 341 |
apply (erule allE, erule preorder_class.order_trans [rotated], |
29667 | 342 |
simp add: numeral_simps algebra_simps cong add : number_of_False_cong)+ |
24333 | 343 |
done |
344 |
||
345 |
lemma bl_to_bin_ge0: "bl_to_bin bs >= 0" |
|
346 |
apply (unfold bl_to_bin_def) |
|
347 |
apply (rule xtr4) |
|
348 |
apply (rule bl_to_bin_ge2p_aux) |
|
349 |
apply simp |
|
350 |
done |
|
351 |
||
352 |
lemma butlast_rest_bin: |
|
353 |
"butlast (bin_to_bl n w) = bin_to_bl (n - 1) (bin_rest w)" |
|
354 |
apply (unfold bin_to_bl_def) |
|
355 |
apply (cases w rule: bin_exhaust) |
|
356 |
apply (cases n, clarsimp) |
|
357 |
apply clarsimp |
|
358 |
apply (auto simp add: bin_to_bl_aux_alt) |
|
359 |
done |
|
360 |
||
361 |
lemmas butlast_bin_rest = butlast_rest_bin |
|
25350
a5fcf6d12a53
eliminated illegal schematic variables in where/of;
wenzelm
parents:
25134
diff
changeset
|
362 |
[where w="bl_to_bin bl" and n="length bl", simplified, standard] |
24333 | 363 |
|
26557 | 364 |
lemma butlast_rest_bl2bin_aux: |
365 |
"bl ~= [] \<Longrightarrow> |
|
366 |
bl_to_bin_aux (butlast bl) w = bin_rest (bl_to_bin_aux bl w)" |
|
367 |
by (induct bl arbitrary: w) auto |
|
24333 | 368 |
|
369 |
lemma butlast_rest_bl2bin: |
|
370 |
"bl_to_bin (butlast bl) = bin_rest (bl_to_bin bl)" |
|
371 |
apply (unfold bl_to_bin_def) |
|
372 |
apply (cases bl) |
|
373 |
apply (auto simp add: butlast_rest_bl2bin_aux) |
|
374 |
done |
|
375 |
||
26557 | 376 |
lemma trunc_bl2bin_aux [rule_format]: |
377 |
"ALL w. bintrunc m (bl_to_bin_aux bl w) = |
|
378 |
bl_to_bin_aux (drop (length bl - m) bl) (bintrunc (m - length bl) w)" |
|
24333 | 379 |
apply (induct_tac bl) |
380 |
apply clarsimp |
|
381 |
apply clarsimp |
|
382 |
apply safe |
|
383 |
apply (case_tac "m - size list") |
|
384 |
apply (simp add : diff_is_0_eq [THEN iffD1, THEN Suc_diff_le]) |
|
385 |
apply simp |
|
26557 | 386 |
apply (rule_tac f = "%nat. bl_to_bin_aux list (Int.Bit1 (bintrunc nat w))" |
24333 | 387 |
in arg_cong) |
388 |
apply simp |
|
389 |
apply (case_tac "m - size list") |
|
390 |
apply (simp add: diff_is_0_eq [THEN iffD1, THEN Suc_diff_le]) |
|
391 |
apply simp |
|
26557 | 392 |
apply (rule_tac f = "%nat. bl_to_bin_aux list (Int.Bit0 (bintrunc nat w))" |
24333 | 393 |
in arg_cong) |
394 |
apply simp |
|
395 |
done |
|
396 |
||
397 |
lemma trunc_bl2bin: |
|
398 |
"bintrunc m (bl_to_bin bl) = bl_to_bin (drop (length bl - m) bl)" |
|
399 |
unfolding bl_to_bin_def by (simp add : trunc_bl2bin_aux) |
|
400 |
||
401 |
lemmas trunc_bl2bin_len [simp] = |
|
402 |
trunc_bl2bin [of "length bl" bl, simplified, standard] |
|
403 |
||
404 |
lemma bl2bin_drop: |
|
405 |
"bl_to_bin (drop k bl) = bintrunc (length bl - k) (bl_to_bin bl)" |
|
406 |
apply (rule trans) |
|
407 |
prefer 2 |
|
408 |
apply (rule trunc_bl2bin [symmetric]) |
|
409 |
apply (cases "k <= length bl") |
|
410 |
apply auto |
|
411 |
done |
|
412 |
||
413 |
lemma nth_rest_power_bin [rule_format] : |
|
30971 | 414 |
"ALL n. bin_nth ((bin_rest ^^ k) w) n = bin_nth w (n + k)" |
24333 | 415 |
apply (induct k, clarsimp) |
416 |
apply clarsimp |
|
417 |
apply (simp only: bin_nth.Suc [symmetric] add_Suc) |
|
418 |
done |
|
419 |
||
420 |
lemma take_rest_power_bin: |
|
30971 | 421 |
"m <= n ==> take m (bin_to_bl n w) = bin_to_bl m ((bin_rest ^^ (n - m)) w)" |
24333 | 422 |
apply (rule nth_equalityI) |
423 |
apply simp |
|
424 |
apply (clarsimp simp add: nth_bin_to_bl nth_rest_power_bin) |
|
425 |
done |
|
426 |
||
24465 | 427 |
lemma hd_butlast: "size xs > 1 ==> hd (butlast xs) = hd xs" |
428 |
by (cases xs) auto |
|
24333 | 429 |
|
26557 | 430 |
lemma last_bin_last': |
37654 | 431 |
"size xs > 0 \<Longrightarrow> last xs = (bin_last (bl_to_bin_aux xs w) = 1)" |
26557 | 432 |
by (induct xs arbitrary: w) auto |
24333 | 433 |
|
434 |
lemma last_bin_last: |
|
37654 | 435 |
"size xs > 0 ==> last xs = (bin_last (bl_to_bin xs) = 1)" |
24333 | 436 |
unfolding bl_to_bin_def by (erule last_bin_last') |
437 |
||
438 |
lemma bin_last_last: |
|
37654 | 439 |
"bin_last w = (if last (bin_to_bl (Suc n) w) then 1 else 0)" |
24333 | 440 |
apply (unfold bin_to_bl_def) |
441 |
apply simp |
|
442 |
apply (auto simp add: bin_to_bl_aux_alt) |
|
443 |
done |
|
444 |
||
24465 | 445 |
(** links between bit-wise operations and operations on bool lists **) |
446 |
||
24333 | 447 |
lemma bl_xor_aux_bin [rule_format] : "ALL v w bs cs. |
26557 | 448 |
map2 (%x y. x ~= y) (bin_to_bl_aux n v bs) (bin_to_bl_aux n w cs) = |
449 |
bin_to_bl_aux n (v XOR w) (map2 (%x y. x ~= y) bs cs)" |
|
24333 | 450 |
apply (induct_tac n) |
451 |
apply safe |
|
452 |
apply simp |
|
453 |
apply (case_tac v rule: bin_exhaust) |
|
454 |
apply (case_tac w rule: bin_exhaust) |
|
455 |
apply clarsimp |
|
456 |
apply (case_tac b) |
|
457 |
apply (case_tac ba, safe, simp_all)+ |
|
458 |
done |
|
459 |
||
460 |
lemma bl_or_aux_bin [rule_format] : "ALL v w bs cs. |
|
26557 | 461 |
map2 (op | ) (bin_to_bl_aux n v bs) (bin_to_bl_aux n w cs) = |
462 |
bin_to_bl_aux n (v OR w) (map2 (op | ) bs cs)" |
|
24333 | 463 |
apply (induct_tac n) |
464 |
apply safe |
|
465 |
apply simp |
|
466 |
apply (case_tac v rule: bin_exhaust) |
|
467 |
apply (case_tac w rule: bin_exhaust) |
|
468 |
apply clarsimp |
|
469 |
apply (case_tac b) |
|
470 |
apply (case_tac ba, safe, simp_all)+ |
|
471 |
done |
|
472 |
||
473 |
lemma bl_and_aux_bin [rule_format] : "ALL v w bs cs. |
|
26557 | 474 |
map2 (op & ) (bin_to_bl_aux n v bs) (bin_to_bl_aux n w cs) = |
475 |
bin_to_bl_aux n (v AND w) (map2 (op & ) bs cs)" |
|
24333 | 476 |
apply (induct_tac n) |
477 |
apply safe |
|
478 |
apply simp |
|
479 |
apply (case_tac v rule: bin_exhaust) |
|
480 |
apply (case_tac w rule: bin_exhaust) |
|
481 |
apply clarsimp |
|
482 |
apply (case_tac b) |
|
483 |
apply (case_tac ba, safe, simp_all)+ |
|
484 |
done |
|
485 |
||
486 |
lemma bl_not_aux_bin [rule_format] : |
|
487 |
"ALL w cs. map Not (bin_to_bl_aux n w cs) = |
|
24353 | 488 |
bin_to_bl_aux n (NOT w) (map Not cs)" |
24333 | 489 |
apply (induct n) |
490 |
apply clarsimp |
|
491 |
apply clarsimp |
|
492 |
apply (case_tac w rule: bin_exhaust) |
|
493 |
apply (case_tac b) |
|
494 |
apply auto |
|
495 |
done |
|
496 |
||
497 |
lemmas bl_not_bin = bl_not_aux_bin |
|
498 |
[where cs = "[]", unfolded bin_to_bl_def [symmetric] map.simps] |
|
499 |
||
500 |
lemmas bl_and_bin = bl_and_aux_bin [where bs="[]" and cs="[]", |
|
26557 | 501 |
unfolded map2_Nil, folded bin_to_bl_def] |
24333 | 502 |
|
503 |
lemmas bl_or_bin = bl_or_aux_bin [where bs="[]" and cs="[]", |
|
26557 | 504 |
unfolded map2_Nil, folded bin_to_bl_def] |
24333 | 505 |
|
506 |
lemmas bl_xor_bin = bl_xor_aux_bin [where bs="[]" and cs="[]", |
|
26557 | 507 |
unfolded map2_Nil, folded bin_to_bl_def] |
24333 | 508 |
|
509 |
lemma drop_bin2bl_aux [rule_format] : |
|
510 |
"ALL m bin bs. drop m (bin_to_bl_aux n bin bs) = |
|
511 |
bin_to_bl_aux (n - m) bin (drop (m - n) bs)" |
|
512 |
apply (induct n, clarsimp) |
|
513 |
apply clarsimp |
|
514 |
apply (case_tac bin rule: bin_exhaust) |
|
515 |
apply (case_tac "m <= n", simp) |
|
516 |
apply (case_tac "m - n", simp) |
|
517 |
apply simp |
|
518 |
apply (rule_tac f = "%nat. drop nat bs" in arg_cong) |
|
519 |
apply simp |
|
520 |
done |
|
521 |
||
522 |
lemma drop_bin2bl: "drop m (bin_to_bl n bin) = bin_to_bl (n - m) bin" |
|
523 |
unfolding bin_to_bl_def by (simp add : drop_bin2bl_aux) |
|
524 |
||
525 |
lemma take_bin2bl_lem1 [rule_format] : |
|
526 |
"ALL w bs. take m (bin_to_bl_aux m w bs) = bin_to_bl m w" |
|
527 |
apply (induct m, clarsimp) |
|
528 |
apply clarsimp |
|
529 |
apply (simp add: bin_to_bl_aux_alt) |
|
530 |
apply (simp add: bin_to_bl_def) |
|
531 |
apply (simp add: bin_to_bl_aux_alt) |
|
532 |
done |
|
533 |
||
534 |
lemma take_bin2bl_lem [rule_format] : |
|
535 |
"ALL w bs. take m (bin_to_bl_aux (m + n) w bs) = |
|
536 |
take m (bin_to_bl (m + n) w)" |
|
537 |
apply (induct n) |
|
538 |
apply clarify |
|
539 |
apply (simp_all (no_asm) add: bin_to_bl_def take_bin2bl_lem1) |
|
540 |
apply simp |
|
541 |
done |
|
542 |
||
543 |
lemma bin_split_take [rule_format] : |
|
544 |
"ALL b c. bin_split n c = (a, b) --> |
|
545 |
bin_to_bl m a = take m (bin_to_bl (m + n) c)" |
|
546 |
apply (induct n) |
|
547 |
apply clarsimp |
|
548 |
apply (clarsimp simp: Let_def split: ls_splits) |
|
549 |
apply (simp add: bin_to_bl_def) |
|
550 |
apply (simp add: take_bin2bl_lem) |
|
551 |
done |
|
552 |
||
553 |
lemma bin_split_take1: |
|
554 |
"k = m + n ==> bin_split n c = (a, b) ==> |
|
555 |
bin_to_bl m a = take m (bin_to_bl k c)" |
|
556 |
by (auto elim: bin_split_take) |
|
557 |
||
558 |
lemma nth_takefill [rule_format] : "ALL m l. m < n --> |
|
559 |
takefill fill n l ! m = (if m < length l then l ! m else fill)" |
|
560 |
apply (induct n, clarsimp) |
|
561 |
apply clarsimp |
|
562 |
apply (case_tac m) |
|
563 |
apply (simp split: list.split) |
|
564 |
apply clarsimp |
|
565 |
apply (erule allE)+ |
|
566 |
apply (erule (1) impE) |
|
567 |
apply (simp split: list.split) |
|
568 |
done |
|
569 |
||
570 |
lemma takefill_alt [rule_format] : |
|
571 |
"ALL l. takefill fill n l = take n l @ replicate (n - length l) fill" |
|
572 |
by (induct n) (auto split: list.split) |
|
573 |
||
574 |
lemma takefill_replicate [simp]: |
|
575 |
"takefill fill n (replicate m fill) = replicate n fill" |
|
576 |
by (simp add : takefill_alt replicate_add [symmetric]) |
|
577 |
||
578 |
lemma takefill_le' [rule_format] : |
|
579 |
"ALL l n. n = m + k --> takefill x m (takefill x n l) = takefill x m l" |
|
580 |
by (induct m) (auto split: list.split) |
|
581 |
||
582 |
lemma length_takefill [simp]: "length (takefill fill n l) = n" |
|
583 |
by (simp add : takefill_alt) |
|
584 |
||
585 |
lemma take_takefill': |
|
586 |
"!!w n. n = k + m ==> take k (takefill fill n w) = takefill fill k w" |
|
587 |
by (induct k) (auto split add : list.split) |
|
588 |
||
589 |
lemma drop_takefill: |
|
590 |
"!!w. drop k (takefill fill (m + k) w) = takefill fill m (drop k w)" |
|
591 |
by (induct k) (auto split add : list.split) |
|
592 |
||
593 |
lemma takefill_le [simp]: |
|
594 |
"m \<le> n \<Longrightarrow> takefill x m (takefill x n l) = takefill x m l" |
|
595 |
by (auto simp: le_iff_add takefill_le') |
|
596 |
||
597 |
lemma take_takefill [simp]: |
|
598 |
"m \<le> n \<Longrightarrow> take m (takefill fill n w) = takefill fill m w" |
|
599 |
by (auto simp: le_iff_add take_takefill') |
|
600 |
||
601 |
lemma takefill_append: |
|
602 |
"takefill fill (m + length xs) (xs @ w) = xs @ (takefill fill m w)" |
|
603 |
by (induct xs) auto |
|
604 |
||
605 |
lemma takefill_same': |
|
606 |
"l = length xs ==> takefill fill l xs = xs" |
|
607 |
by clarify (induct xs, auto) |
|
608 |
||
609 |
lemmas takefill_same [simp] = takefill_same' [OF refl] |
|
610 |
||
611 |
lemma takefill_bintrunc: |
|
612 |
"takefill False n bl = rev (bin_to_bl n (bl_to_bin (rev bl)))" |
|
613 |
apply (rule nth_equalityI) |
|
614 |
apply simp |
|
615 |
apply (clarsimp simp: nth_takefill nth_rev nth_bin_to_bl bin_nth_of_bl) |
|
616 |
done |
|
617 |
||
618 |
lemma bl_bin_bl_rtf: |
|
619 |
"bin_to_bl n (bl_to_bin bl) = rev (takefill False n (rev bl))" |
|
620 |
by (simp add : takefill_bintrunc) |
|
621 |
||
622 |
lemmas bl_bin_bl_rep_drop = |
|
623 |
bl_bin_bl_rtf [simplified takefill_alt, |
|
624 |
simplified, simplified rev_take, simplified] |
|
625 |
||
626 |
lemma tf_rev: |
|
627 |
"n + k = m + length bl ==> takefill x m (rev (takefill y n bl)) = |
|
628 |
rev (takefill y m (rev (takefill x k (rev bl))))" |
|
629 |
apply (rule nth_equalityI) |
|
630 |
apply (auto simp add: nth_takefill nth_rev) |
|
631 |
apply (rule_tac f = "%n. bl ! n" in arg_cong) |
|
632 |
apply arith |
|
633 |
done |
|
634 |
||
635 |
lemma takefill_minus: |
|
636 |
"0 < n ==> takefill fill (Suc (n - 1)) w = takefill fill n w" |
|
637 |
by auto |
|
638 |
||
639 |
lemmas takefill_Suc_cases = |
|
640 |
list.cases [THEN takefill.Suc [THEN trans], standard] |
|
641 |
||
642 |
lemmas takefill_Suc_Nil = takefill_Suc_cases (1) |
|
643 |
lemmas takefill_Suc_Cons = takefill_Suc_cases (2) |
|
644 |
||
645 |
lemmas takefill_minus_simps = takefill_Suc_cases [THEN [2] |
|
646 |
takefill_minus [symmetric, THEN trans], standard] |
|
647 |
||
648 |
lemmas takefill_pred_simps [simp] = |
|
649 |
takefill_minus_simps [where n="number_of bin", simplified nobm1, standard] |
|
650 |
||
651 |
(* links with function bl_to_bin *) |
|
652 |
||
653 |
lemma bl_to_bin_aux_cat: |
|
26557 | 654 |
"!!nv v. bl_to_bin_aux bs (bin_cat w nv v) = |
655 |
bin_cat w (nv + length bs) (bl_to_bin_aux bs v)" |
|
24333 | 656 |
apply (induct bs) |
657 |
apply simp |
|
658 |
apply (simp add: bin_cat_Suc_Bit [symmetric] del: bin_cat.simps) |
|
659 |
done |
|
660 |
||
661 |
lemma bin_to_bl_aux_cat: |
|
662 |
"!!w bs. bin_to_bl_aux (nv + nw) (bin_cat v nw w) bs = |
|
663 |
bin_to_bl_aux nv v (bin_to_bl_aux nw w bs)" |
|
664 |
by (induct nw) auto |
|
665 |
||
666 |
lemmas bl_to_bin_aux_alt = |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
667 |
bl_to_bin_aux_cat [where nv = "0" and v = "Int.Pls", |
24333 | 668 |
simplified bl_to_bin_def [symmetric], simplified] |
669 |
||
670 |
lemmas bin_to_bl_cat = |
|
671 |
bin_to_bl_aux_cat [where bs = "[]", folded bin_to_bl_def] |
|
672 |
||
673 |
lemmas bl_to_bin_aux_app_cat = |
|
674 |
trans [OF bl_to_bin_aux_append bl_to_bin_aux_alt] |
|
675 |
||
676 |
lemmas bin_to_bl_aux_cat_app = |
|
677 |
trans [OF bin_to_bl_aux_cat bin_to_bl_aux_alt] |
|
678 |
||
679 |
lemmas bl_to_bin_app_cat = bl_to_bin_aux_app_cat |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
680 |
[where w = "Int.Pls", folded bl_to_bin_def] |
24333 | 681 |
|
682 |
lemmas bin_to_bl_cat_app = bin_to_bl_aux_cat_app |
|
683 |
[where bs = "[]", folded bin_to_bl_def] |
|
684 |
||
685 |
(* bl_to_bin_app_cat_alt and bl_to_bin_app_cat are easily interderivable *) |
|
686 |
lemma bl_to_bin_app_cat_alt: |
|
687 |
"bin_cat (bl_to_bin cs) n w = bl_to_bin (cs @ bin_to_bl n w)" |
|
688 |
by (simp add : bl_to_bin_app_cat) |
|
689 |
||
690 |
lemma mask_lem: "(bl_to_bin (True # replicate n False)) = |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
691 |
Int.succ (bl_to_bin (replicate n True))" |
24333 | 692 |
apply (unfold bl_to_bin_def) |
693 |
apply (induct n) |
|
694 |
apply simp |
|
31790 | 695 |
apply (simp only: Suc_eq_plus1 replicate_add |
24333 | 696 |
append_Cons [symmetric] bl_to_bin_aux_append) |
697 |
apply simp |
|
698 |
done |
|
699 |
||
24465 | 700 |
(* function bl_of_nth *) |
24333 | 701 |
lemma length_bl_of_nth [simp]: "length (bl_of_nth n f) = n" |
702 |
by (induct n) auto |
|
703 |
||
704 |
lemma nth_bl_of_nth [simp]: |
|
705 |
"m < n \<Longrightarrow> rev (bl_of_nth n f) ! m = f m" |
|
706 |
apply (induct n) |
|
707 |
apply simp |
|
708 |
apply (clarsimp simp add : nth_append) |
|
709 |
apply (rule_tac f = "f" in arg_cong) |
|
710 |
apply simp |
|
711 |
done |
|
712 |
||
713 |
lemma bl_of_nth_inj: |
|
714 |
"(!!k. k < n ==> f k = g k) ==> bl_of_nth n f = bl_of_nth n g" |
|
715 |
by (induct n) auto |
|
716 |
||
717 |
lemma bl_of_nth_nth_le [rule_format] : "ALL xs. |
|
718 |
length xs >= n --> bl_of_nth n (nth (rev xs)) = drop (length xs - n) xs"; |
|
719 |
apply (induct n, clarsimp) |
|
720 |
apply clarsimp |
|
721 |
apply (rule trans [OF _ hd_Cons_tl]) |
|
722 |
apply (frule Suc_le_lessD) |
|
723 |
apply (simp add: nth_rev trans [OF drop_Suc drop_tl, symmetric]) |
|
724 |
apply (subst hd_drop_conv_nth) |
|
725 |
apply force |
|
726 |
apply simp_all |
|
727 |
apply (rule_tac f = "%n. drop n xs" in arg_cong) |
|
728 |
apply simp |
|
729 |
done |
|
730 |
||
731 |
lemmas bl_of_nth_nth [simp] = order_refl [THEN bl_of_nth_nth_le, simplified] |
|
732 |
||
733 |
lemma size_rbl_pred: "length (rbl_pred bl) = length bl" |
|
734 |
by (induct bl) auto |
|
735 |
||
736 |
lemma size_rbl_succ: "length (rbl_succ bl) = length bl" |
|
737 |
by (induct bl) auto |
|
738 |
||
739 |
lemma size_rbl_add: |
|
740 |
"!!cl. length (rbl_add bl cl) = length bl" |
|
741 |
by (induct bl) (auto simp: Let_def size_rbl_succ) |
|
742 |
||
743 |
lemma size_rbl_mult: |
|
744 |
"!!cl. length (rbl_mult bl cl) = length bl" |
|
745 |
by (induct bl) (auto simp add : Let_def size_rbl_add) |
|
746 |
||
747 |
lemmas rbl_sizes [simp] = |
|
748 |
size_rbl_pred size_rbl_succ size_rbl_add size_rbl_mult |
|
749 |
||
750 |
lemmas rbl_Nils = |
|
751 |
rbl_pred.Nil rbl_succ.Nil rbl_add.Nil rbl_mult.Nil |
|
752 |
||
753 |
lemma rbl_pred: |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
754 |
"!!bin. rbl_pred (rev (bin_to_bl n bin)) = rev (bin_to_bl n (Int.pred bin))" |
24333 | 755 |
apply (induct n, simp) |
756 |
apply (unfold bin_to_bl_def) |
|
757 |
apply clarsimp |
|
758 |
apply (case_tac bin rule: bin_exhaust) |
|
759 |
apply (case_tac b) |
|
760 |
apply (clarsimp simp: bin_to_bl_aux_alt)+ |
|
761 |
done |
|
762 |
||
763 |
lemma rbl_succ: |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
764 |
"!!bin. rbl_succ (rev (bin_to_bl n bin)) = rev (bin_to_bl n (Int.succ bin))" |
24333 | 765 |
apply (induct n, simp) |
766 |
apply (unfold bin_to_bl_def) |
|
767 |
apply clarsimp |
|
768 |
apply (case_tac bin rule: bin_exhaust) |
|
769 |
apply (case_tac b) |
|
770 |
apply (clarsimp simp: bin_to_bl_aux_alt)+ |
|
771 |
done |
|
772 |
||
773 |
lemma rbl_add: |
|
774 |
"!!bina binb. rbl_add (rev (bin_to_bl n bina)) (rev (bin_to_bl n binb)) = |
|
775 |
rev (bin_to_bl n (bina + binb))" |
|
776 |
apply (induct n, simp) |
|
777 |
apply (unfold bin_to_bl_def) |
|
778 |
apply clarsimp |
|
779 |
apply (case_tac bina rule: bin_exhaust) |
|
780 |
apply (case_tac binb rule: bin_exhaust) |
|
781 |
apply (case_tac b) |
|
782 |
apply (case_tac [!] "ba") |
|
783 |
apply (auto simp: rbl_succ succ_def bin_to_bl_aux_alt Let_def add_ac) |
|
784 |
done |
|
785 |
||
786 |
lemma rbl_add_app2: |
|
787 |
"!!blb. length blb >= length bla ==> |
|
788 |
rbl_add bla (blb @ blc) = rbl_add bla blb" |
|
789 |
apply (induct bla, simp) |
|
790 |
apply clarsimp |
|
791 |
apply (case_tac blb, clarsimp) |
|
792 |
apply (clarsimp simp: Let_def) |
|
793 |
done |
|
794 |
||
795 |
lemma rbl_add_take2: |
|
796 |
"!!blb. length blb >= length bla ==> |
|
797 |
rbl_add bla (take (length bla) blb) = rbl_add bla blb" |
|
798 |
apply (induct bla, simp) |
|
799 |
apply clarsimp |
|
800 |
apply (case_tac blb, clarsimp) |
|
801 |
apply (clarsimp simp: Let_def) |
|
802 |
done |
|
803 |
||
804 |
lemma rbl_add_long: |
|
805 |
"m >= n ==> rbl_add (rev (bin_to_bl n bina)) (rev (bin_to_bl m binb)) = |
|
806 |
rev (bin_to_bl n (bina + binb))" |
|
807 |
apply (rule box_equals [OF _ rbl_add_take2 rbl_add]) |
|
808 |
apply (rule_tac f = "rbl_add (rev (bin_to_bl n bina))" in arg_cong) |
|
809 |
apply (rule rev_swap [THEN iffD1]) |
|
810 |
apply (simp add: rev_take drop_bin2bl) |
|
811 |
apply simp |
|
812 |
done |
|
813 |
||
814 |
lemma rbl_mult_app2: |
|
815 |
"!!blb. length blb >= length bla ==> |
|
816 |
rbl_mult bla (blb @ blc) = rbl_mult bla blb" |
|
817 |
apply (induct bla, simp) |
|
818 |
apply clarsimp |
|
819 |
apply (case_tac blb, clarsimp) |
|
820 |
apply (clarsimp simp: Let_def rbl_add_app2) |
|
821 |
done |
|
822 |
||
823 |
lemma rbl_mult_take2: |
|
824 |
"length blb >= length bla ==> |
|
825 |
rbl_mult bla (take (length bla) blb) = rbl_mult bla blb" |
|
826 |
apply (rule trans) |
|
827 |
apply (rule rbl_mult_app2 [symmetric]) |
|
828 |
apply simp |
|
829 |
apply (rule_tac f = "rbl_mult bla" in arg_cong) |
|
830 |
apply (rule append_take_drop_id) |
|
831 |
done |
|
832 |
||
833 |
lemma rbl_mult_gt1: |
|
834 |
"m >= length bl ==> rbl_mult bl (rev (bin_to_bl m binb)) = |
|
835 |
rbl_mult bl (rev (bin_to_bl (length bl) binb))" |
|
836 |
apply (rule trans) |
|
837 |
apply (rule rbl_mult_take2 [symmetric]) |
|
838 |
apply simp_all |
|
839 |
apply (rule_tac f = "rbl_mult bl" in arg_cong) |
|
840 |
apply (rule rev_swap [THEN iffD1]) |
|
841 |
apply (simp add: rev_take drop_bin2bl) |
|
842 |
done |
|
843 |
||
844 |
lemma rbl_mult_gt: |
|
845 |
"m > n ==> rbl_mult (rev (bin_to_bl n bina)) (rev (bin_to_bl m binb)) = |
|
846 |
rbl_mult (rev (bin_to_bl n bina)) (rev (bin_to_bl n binb))" |
|
847 |
by (auto intro: trans [OF rbl_mult_gt1]) |
|
848 |
||
849 |
lemmas rbl_mult_Suc = lessI [THEN rbl_mult_gt] |
|
850 |
||
851 |
lemma rbbl_Cons: |
|
37654 | 852 |
"b # rev (bin_to_bl n x) = rev (bin_to_bl (Suc n) (x BIT If b 1 0))" |
24333 | 853 |
apply (unfold bin_to_bl_def) |
854 |
apply simp |
|
855 |
apply (simp add: bin_to_bl_aux_alt) |
|
856 |
done |
|
857 |
||
858 |
lemma rbl_mult: "!!bina binb. |
|
859 |
rbl_mult (rev (bin_to_bl n bina)) (rev (bin_to_bl n binb)) = |
|
860 |
rev (bin_to_bl n (bina * binb))" |
|
861 |
apply (induct n) |
|
862 |
apply simp |
|
863 |
apply (unfold bin_to_bl_def) |
|
864 |
apply clarsimp |
|
865 |
apply (case_tac bina rule: bin_exhaust) |
|
866 |
apply (case_tac binb rule: bin_exhaust) |
|
867 |
apply (case_tac b) |
|
868 |
apply (case_tac [!] "ba") |
|
869 |
apply (auto simp: bin_to_bl_aux_alt Let_def) |
|
870 |
apply (auto simp: rbbl_Cons rbl_mult_Suc rbl_add) |
|
871 |
done |
|
872 |
||
873 |
lemma rbl_add_split: |
|
874 |
"P (rbl_add (y # ys) (x # xs)) = |
|
875 |
(ALL ws. length ws = length ys --> ws = rbl_add ys xs --> |
|
26008 | 876 |
(y --> ((x --> P (False # rbl_succ ws)) & (~ x --> P (True # ws)))) & |
24333 | 877 |
(~ y --> P (x # ws)))" |
878 |
apply (auto simp add: Let_def) |
|
879 |
apply (case_tac [!] "y") |
|
880 |
apply auto |
|
881 |
done |
|
882 |
||
883 |
lemma rbl_mult_split: |
|
884 |
"P (rbl_mult (y # ys) xs) = |
|
885 |
(ALL ws. length ws = Suc (length ys) --> ws = False # rbl_mult ys xs --> |
|
886 |
(y --> P (rbl_add ws xs)) & (~ y --> P ws))" |
|
887 |
by (clarsimp simp add : Let_def) |
|
888 |
||
889 |
lemma and_len: "xs = ys ==> xs = ys & length xs = length ys" |
|
890 |
by auto |
|
891 |
||
892 |
lemma size_if: "size (if p then xs else ys) = (if p then size xs else size ys)" |
|
893 |
by auto |
|
894 |
||
895 |
lemma tl_if: "tl (if p then xs else ys) = (if p then tl xs else tl ys)" |
|
896 |
by auto |
|
897 |
||
898 |
lemma hd_if: "hd (if p then xs else ys) = (if p then hd xs else hd ys)" |
|
899 |
by auto |
|
900 |
||
24465 | 901 |
lemma if_Not_x: "(if p then ~ x else x) = (p = (~ x))" |
902 |
by auto |
|
903 |
||
904 |
lemma if_x_Not: "(if p then x else ~ x) = (p = x)" |
|
905 |
by auto |
|
906 |
||
24333 | 907 |
lemma if_same_and: "(If p x y & If p u v) = (if p then x & u else y & v)" |
908 |
by auto |
|
909 |
||
910 |
lemma if_same_eq: "(If p x y = (If p u v)) = (if p then x = (u) else y = (v))" |
|
911 |
by auto |
|
912 |
||
913 |
lemma if_same_eq_not: |
|
914 |
"(If p x y = (~ If p u v)) = (if p then x = (~u) else y = (~v))" |
|
915 |
by auto |
|
916 |
||
917 |
(* note - if_Cons can cause blowup in the size, if p is complex, |
|
918 |
so make a simproc *) |
|
919 |
lemma if_Cons: "(if p then x # xs else y # ys) = If p x y # If p xs ys" |
|
920 |
by auto |
|
921 |
||
922 |
lemma if_single: |
|
923 |
"(if xc then [xab] else [an]) = [if xc then xab else an]" |
|
924 |
by auto |
|
925 |
||
24465 | 926 |
lemma if_bool_simps: |
927 |
"If p True y = (p | y) & If p False y = (~p & y) & |
|
928 |
If p y True = (p --> y) & If p y False = (p & y)" |
|
929 |
by auto |
|
930 |
||
931 |
lemmas if_simps = if_x_Not if_Not_x if_cancel if_True if_False if_bool_simps |
|
932 |
||
25350
a5fcf6d12a53
eliminated illegal schematic variables in where/of;
wenzelm
parents:
25134
diff
changeset
|
933 |
lemmas seqr = eq_reflection [where x = "size w", standard] |
24333 | 934 |
|
935 |
lemmas tl_Nil = tl.simps (1) |
|
936 |
lemmas tl_Cons = tl.simps (2) |
|
937 |
||
938 |
||
24350 | 939 |
subsection "Repeated splitting or concatenation" |
24333 | 940 |
|
941 |
lemma sclem: |
|
942 |
"size (concat (map (bin_to_bl n) xs)) = length xs * n" |
|
943 |
by (induct xs) auto |
|
944 |
||
945 |
lemma bin_cat_foldl_lem [rule_format] : |
|
946 |
"ALL x. foldl (%u. bin_cat u n) x xs = |
|
947 |
bin_cat x (size xs * n) (foldl (%u. bin_cat u n) y xs)" |
|
948 |
apply (induct xs) |
|
949 |
apply simp |
|
950 |
apply clarify |
|
951 |
apply (simp (no_asm)) |
|
952 |
apply (frule asm_rl) |
|
953 |
apply (drule spec) |
|
954 |
apply (erule trans) |
|
32439 | 955 |
apply (drule_tac x = "bin_cat y n a" in spec) |
32642
026e7c6a6d08
be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents:
32439
diff
changeset
|
956 |
apply (simp add : bin_cat_assoc_sym min_max.inf_absorb2) |
24333 | 957 |
done |
958 |
||
959 |
lemma bin_rcat_bl: |
|
960 |
"(bin_rcat n wl) = bl_to_bin (concat (map (bin_to_bl n) wl))" |
|
961 |
apply (unfold bin_rcat_def) |
|
962 |
apply (rule sym) |
|
963 |
apply (induct wl) |
|
964 |
apply (auto simp add : bl_to_bin_append) |
|
965 |
apply (simp add : bl_to_bin_aux_alt sclem) |
|
966 |
apply (simp add : bin_cat_foldl_lem [symmetric]) |
|
967 |
done |
|
968 |
||
969 |
lemmas bin_rsplit_aux_simps = bin_rsplit_aux.simps bin_rsplitl_aux.simps |
|
970 |
lemmas rsplit_aux_simps = bin_rsplit_aux_simps |
|
971 |
||
25350
a5fcf6d12a53
eliminated illegal schematic variables in where/of;
wenzelm
parents:
25134
diff
changeset
|
972 |
lemmas th_if_simp1 = split_if [where P = "op = l", |
24333 | 973 |
THEN iffD1, THEN conjunct1, THEN mp, standard] |
25350
a5fcf6d12a53
eliminated illegal schematic variables in where/of;
wenzelm
parents:
25134
diff
changeset
|
974 |
lemmas th_if_simp2 = split_if [where P = "op = l", |
24333 | 975 |
THEN iffD1, THEN conjunct2, THEN mp, standard] |
976 |
||
977 |
lemmas rsplit_aux_simp1s = rsplit_aux_simps [THEN th_if_simp1] |
|
978 |
||
979 |
lemmas rsplit_aux_simp2ls = rsplit_aux_simps [THEN th_if_simp2] |
|
980 |
(* these safe to [simp add] as require calculating m - n *) |
|
981 |
lemmas bin_rsplit_aux_simp2s [simp] = rsplit_aux_simp2ls [unfolded Let_def] |
|
982 |
lemmas rbscl = bin_rsplit_aux_simp2s (2) |
|
983 |
||
984 |
lemmas rsplit_aux_0_simps [simp] = |
|
985 |
rsplit_aux_simp1s [OF disjI1] rsplit_aux_simp1s [OF disjI2] |
|
986 |
||
987 |
lemma bin_rsplit_aux_append: |
|
26557 | 988 |
"bin_rsplit_aux n m c (bs @ cs) = bin_rsplit_aux n m c bs @ cs" |
989 |
apply (induct n m c bs rule: bin_rsplit_aux.induct) |
|
24333 | 990 |
apply (subst bin_rsplit_aux.simps) |
991 |
apply (subst bin_rsplit_aux.simps) |
|
992 |
apply (clarsimp split: ls_splits) |
|
26557 | 993 |
apply auto |
24333 | 994 |
done |
995 |
||
996 |
lemma bin_rsplitl_aux_append: |
|
26557 | 997 |
"bin_rsplitl_aux n m c (bs @ cs) = bin_rsplitl_aux n m c bs @ cs" |
998 |
apply (induct n m c bs rule: bin_rsplitl_aux.induct) |
|
24333 | 999 |
apply (subst bin_rsplitl_aux.simps) |
1000 |
apply (subst bin_rsplitl_aux.simps) |
|
1001 |
apply (clarsimp split: ls_splits) |
|
26557 | 1002 |
apply auto |
24333 | 1003 |
done |
1004 |
||
1005 |
lemmas rsplit_aux_apps [where bs = "[]"] = |
|
1006 |
bin_rsplit_aux_append bin_rsplitl_aux_append |
|
1007 |
||
1008 |
lemmas rsplit_def_auxs = bin_rsplit_def bin_rsplitl_def |
|
1009 |
||
1010 |
lemmas rsplit_aux_alts = rsplit_aux_apps |
|
1011 |
[unfolded append_Nil rsplit_def_auxs [symmetric]] |
|
1012 |
||
1013 |
lemma bin_split_minus: "0 < n ==> bin_split (Suc (n - 1)) w = bin_split n w" |
|
1014 |
by auto |
|
1015 |
||
1016 |
lemmas bin_split_minus_simp = |
|
1017 |
bin_split.Suc [THEN [2] bin_split_minus [symmetric, THEN trans], standard] |
|
1018 |
||
1019 |
lemma bin_split_pred_simp [simp]: |
|
1020 |
"(0::nat) < number_of bin \<Longrightarrow> |
|
1021 |
bin_split (number_of bin) w = |
|
25919
8b1c0d434824
joined theories IntDef, Numeral, IntArith to theory Int
haftmann
parents:
25350
diff
changeset
|
1022 |
(let (w1, w2) = bin_split (number_of (Int.pred bin)) (bin_rest w) |
24333 | 1023 |
in (w1, w2 BIT bin_last w))" |
1024 |
by (simp only: nobm1 bin_split_minus_simp) |
|
1025 |
||
24465 | 1026 |
declare bin_split_pred_simp [simp] |
1027 |
||
24333 | 1028 |
lemma bin_rsplit_aux_simp_alt: |
26557 | 1029 |
"bin_rsplit_aux n m c bs = |
24333 | 1030 |
(if m = 0 \<or> n = 0 |
1031 |
then bs |
|
1032 |
else let (a, b) = bin_split n c in bin_rsplit n (m - n, a) @ b # bs)" |
|
26557 | 1033 |
unfolding bin_rsplit_aux.simps [of n m c bs] |
1034 |
apply simp |
|
1035 |
apply (subst rsplit_aux_alts) |
|
1036 |
apply (simp add: bin_rsplit_def) |
|
24333 | 1037 |
done |
1038 |
||
1039 |
lemmas bin_rsplit_simp_alt = |
|
26557 | 1040 |
trans [OF bin_rsplit_def |
24333 | 1041 |
bin_rsplit_aux_simp_alt, standard] |
1042 |
||
1043 |
lemmas bthrs = bin_rsplit_simp_alt [THEN [2] trans] |
|
1044 |
||
1045 |
lemma bin_rsplit_size_sign' [rule_format] : |
|
1046 |
"n > 0 ==> (ALL nw w. rev sw = bin_rsplit n (nw, w) --> |
|
1047 |
(ALL v: set sw. bintrunc n v = v))" |
|
1048 |
apply (induct sw) |
|
1049 |
apply clarsimp |
|
1050 |
apply clarsimp |
|
1051 |
apply (drule bthrs) |
|
1052 |
apply (simp (no_asm_use) add: Let_def split: ls_splits) |
|
1053 |
apply clarify |
|
1054 |
apply (erule impE, rule exI, erule exI) |
|
1055 |
apply (drule split_bintrunc) |
|
1056 |
apply simp |
|
1057 |
done |
|
1058 |
||
1059 |
lemmas bin_rsplit_size_sign = bin_rsplit_size_sign' [OF asm_rl |
|
1060 |
rev_rev_ident [THEN trans] set_rev [THEN equalityD2 [THEN subsetD]], |
|
1061 |
standard] |
|
1062 |
||
1063 |
lemma bin_nth_rsplit [rule_format] : |
|
1064 |
"n > 0 ==> m < n ==> (ALL w k nw. rev sw = bin_rsplit n (nw, w) --> |
|
1065 |
k < size sw --> bin_nth (sw ! k) m = bin_nth w (k * n + m))" |
|
1066 |
apply (induct sw) |
|
1067 |
apply clarsimp |
|
1068 |
apply clarsimp |
|
1069 |
apply (drule bthrs) |
|
1070 |
apply (simp (no_asm_use) add: Let_def split: ls_splits) |
|
1071 |
apply clarify |
|
1072 |
apply (erule allE, erule impE, erule exI) |
|
1073 |
apply (case_tac k) |
|
1074 |
apply clarsimp |
|
1075 |
prefer 2 |
|
1076 |
apply clarsimp |
|
1077 |
apply (erule allE) |
|
1078 |
apply (erule (1) impE) |
|
1079 |
apply (drule bin_nth_split, erule conjE, erule allE, |
|
1080 |
erule trans, simp add : add_ac)+ |
|
1081 |
done |
|
1082 |
||
1083 |
lemma bin_rsplit_all: |
|
1084 |
"0 < nw ==> nw <= n ==> bin_rsplit n (nw, w) = [bintrunc n w]" |
|
1085 |
unfolding bin_rsplit_def |
|
1086 |
by (clarsimp dest!: split_bintrunc simp: rsplit_aux_simp2ls split: ls_splits) |
|
1087 |
||
1088 |
lemma bin_rsplit_l [rule_format] : |
|
1089 |
"ALL bin. bin_rsplitl n (m, bin) = bin_rsplit n (m, bintrunc m bin)" |
|
1090 |
apply (rule_tac a = "m" in wf_less_than [THEN wf_induct]) |
|
1091 |
apply (simp (no_asm) add : bin_rsplitl_def bin_rsplit_def) |
|
1092 |
apply (rule allI) |
|
1093 |
apply (subst bin_rsplitl_aux.simps) |
|
1094 |
apply (subst bin_rsplit_aux.simps) |
|
26557 | 1095 |
apply (clarsimp simp: Let_def split: ls_splits) |
24333 | 1096 |
apply (drule bin_split_trunc) |
1097 |
apply (drule sym [THEN trans], assumption) |
|
26557 | 1098 |
apply (subst rsplit_aux_alts(1)) |
1099 |
apply (subst rsplit_aux_alts(2)) |
|
1100 |
apply clarsimp |
|
1101 |
unfolding bin_rsplit_def bin_rsplitl_def |
|
1102 |
apply simp |
|
24333 | 1103 |
done |
26557 | 1104 |
|
24333 | 1105 |
lemma bin_rsplit_rcat [rule_format] : |
1106 |
"n > 0 --> bin_rsplit n (n * size ws, bin_rcat n ws) = map (bintrunc n) ws" |
|
1107 |
apply (unfold bin_rsplit_def bin_rcat_def) |
|
1108 |
apply (rule_tac xs = "ws" in rev_induct) |
|
1109 |
apply clarsimp |
|
1110 |
apply clarsimp |
|
26557 | 1111 |
apply (subst rsplit_aux_alts) |
1112 |
unfolding bin_split_cat |
|
1113 |
apply simp |
|
24333 | 1114 |
done |
1115 |
||
1116 |
lemma bin_rsplit_aux_len_le [rule_format] : |
|
26557 | 1117 |
"\<forall>ws m. n \<noteq> 0 \<longrightarrow> ws = bin_rsplit_aux n nw w bs \<longrightarrow> |
1118 |
length ws \<le> m \<longleftrightarrow> nw + length bs * n \<le> m * n" |
|
1119 |
apply (induct n nw w bs rule: bin_rsplit_aux.induct) |
|
24333 | 1120 |
apply (subst bin_rsplit_aux.simps) |
26557 | 1121 |
apply (simp add: lrlem Let_def split: ls_splits) |
24333 | 1122 |
done |
1123 |
||
1124 |
lemma bin_rsplit_len_le: |
|
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
1125 |
"n \<noteq> 0 --> ws = bin_rsplit n (nw, w) --> (length ws <= m) = (nw <= m * n)" |
24333 | 1126 |
unfolding bin_rsplit_def by (clarsimp simp add : bin_rsplit_aux_len_le) |
1127 |
||
1128 |
lemma bin_rsplit_aux_len [rule_format] : |
|
26557 | 1129 |
"n\<noteq>0 --> length (bin_rsplit_aux n nw w cs) = |
24333 | 1130 |
(nw + n - 1) div n + length cs" |
26557 | 1131 |
apply (induct n nw w cs rule: bin_rsplit_aux.induct) |
24333 | 1132 |
apply (subst bin_rsplit_aux.simps) |
1133 |
apply (clarsimp simp: Let_def split: ls_splits) |
|
1134 |
apply (erule thin_rl) |
|
27651
16a26996c30e
moved op dvd to theory Ring_and_Field; generalized a couple of lemmas
haftmann
parents:
27105
diff
changeset
|
1135 |
apply (case_tac m) |
16a26996c30e
moved op dvd to theory Ring_and_Field; generalized a couple of lemmas
haftmann
parents:
27105
diff
changeset
|
1136 |
apply simp |
24333 | 1137 |
apply (case_tac "m <= n") |
27677 | 1138 |
apply auto |
24333 | 1139 |
done |
1140 |
||
1141 |
lemma bin_rsplit_len: |
|
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
1142 |
"n\<noteq>0 ==> length (bin_rsplit n (nw, w)) = (nw + n - 1) div n" |
24333 | 1143 |
unfolding bin_rsplit_def by (clarsimp simp add : bin_rsplit_aux_len) |
1144 |
||
26557 | 1145 |
lemma bin_rsplit_aux_len_indep: |
1146 |
"n \<noteq> 0 \<Longrightarrow> length bs = length cs \<Longrightarrow> |
|
1147 |
length (bin_rsplit_aux n nw v bs) = |
|
1148 |
length (bin_rsplit_aux n nw w cs)" |
|
1149 |
proof (induct n nw w cs arbitrary: v bs rule: bin_rsplit_aux.induct) |
|
1150 |
case (1 n m w cs v bs) show ?case |
|
1151 |
proof (cases "m = 0") |
|
28298 | 1152 |
case True then show ?thesis using `length bs = length cs` by simp |
26557 | 1153 |
next |
1154 |
case False |
|
1155 |
from "1.hyps" `m \<noteq> 0` `n \<noteq> 0` have hyp: "\<And>v bs. length bs = Suc (length cs) \<Longrightarrow> |
|
1156 |
length (bin_rsplit_aux n (m - n) v bs) = |
|
1157 |
length (bin_rsplit_aux n (m - n) (fst (bin_split n w)) (snd (bin_split n w) # cs))" |
|
1158 |
by auto |
|
1159 |
show ?thesis using `length bs = length cs` `n \<noteq> 0` |
|
1160 |
by (auto simp add: bin_rsplit_aux_simp_alt Let_def bin_rsplit_len |
|
1161 |
split: ls_splits) |
|
1162 |
qed |
|
1163 |
qed |
|
24333 | 1164 |
|
1165 |
lemma bin_rsplit_len_indep: |
|
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
1166 |
"n\<noteq>0 ==> length (bin_rsplit n (nw, v)) = length (bin_rsplit n (nw, w))" |
24333 | 1167 |
apply (unfold bin_rsplit_def) |
26557 | 1168 |
apply (simp (no_asm)) |
24333 | 1169 |
apply (erule bin_rsplit_aux_len_indep) |
1170 |
apply (rule refl) |
|
1171 |
done |
|
1172 |
||
1173 |
end |