equal
deleted
inserted
replaced
453 \<open>take_bit n (horner_sum of_bool 2 bs) = horner_sum of_bool 2 (take n bs)\<close> |
453 \<open>take_bit n (horner_sum of_bool 2 bs) = horner_sum of_bool 2 (take n bs)\<close> |
454 by (auto simp add: bit_eq_iff bit_take_bit_iff bit_horner_sum_bit_iff) |
454 by (auto simp add: bit_eq_iff bit_take_bit_iff bit_horner_sum_bit_iff) |
455 |
455 |
456 end |
456 end |
457 |
457 |
|
458 lemma horner_sum_of_bool_2_less: |
|
459 \<open>(horner_sum of_bool 2 bs :: int) < 2 ^ length bs\<close> |
|
460 proof - |
|
461 have \<open>(\<Sum>n = 0..<length bs. of_bool (bs ! n) * (2::int) ^ n) \<le> (\<Sum>n = 0..<length bs. 2 ^ n)\<close> |
|
462 by (rule sum_mono) simp |
|
463 also have \<open>\<dots> = 2 ^ length bs - 1\<close> |
|
464 by (induction bs) simp_all |
|
465 finally show ?thesis |
|
466 by (simp add: horner_sum_eq_sum) |
|
467 qed |
|
468 |
458 |
469 |
459 subsection \<open>Further facts about \<^const>\<open>List.n_lists\<close>\<close> |
470 subsection \<open>Further facts about \<^const>\<open>List.n_lists\<close>\<close> |
460 |
471 |
461 lemma length_n_lists: "length (List.n_lists n xs) = length xs ^ n" |
472 lemma length_n_lists: "length (List.n_lists n xs) = length xs ^ n" |
462 by (induct n) (auto simp add: comp_def length_concat sum_list_triv) |
473 by (induct n) (auto simp add: comp_def length_concat sum_list_triv) |