equal
deleted
inserted
replaced
598 |
598 |
599 lemma of_int_word_less_iff: |
599 lemma of_int_word_less_iff: |
600 \<open>of_int k < (of_int l :: 'a::len word) \<longleftrightarrow> take_bit LENGTH('a) k < take_bit LENGTH('a) l\<close> |
600 \<open>of_int k < (of_int l :: 'a::len word) \<longleftrightarrow> take_bit LENGTH('a) k < take_bit LENGTH('a) l\<close> |
601 by transfer rule |
601 by transfer rule |
602 |
602 |
|
603 instantiation word :: (len) order_bot |
|
604 begin |
|
605 |
|
606 lift_definition bot_word :: \<open>'a word\<close> |
|
607 is 0 . |
|
608 |
|
609 instance |
|
610 by (standard; transfer) simp |
|
611 |
|
612 end |
|
613 |
|
614 lemma bot_word_eq: |
|
615 \<open>bot = (0 :: 'a::len word)\<close> |
|
616 by transfer rule |
|
617 |
|
618 instantiation word :: (len) order_top |
|
619 begin |
|
620 |
|
621 lift_definition top_word :: \<open>'a word\<close> |
|
622 is \<open>- 1\<close> . |
|
623 |
|
624 instance |
|
625 by (standard; transfer) (simp add: take_bit_int_less_eq_mask) |
|
626 |
|
627 end |
|
628 |
|
629 lemma top_word_eq: |
|
630 \<open>top = (- 1 :: 'a::len word)\<close> |
|
631 by transfer rule |
603 |
632 |
604 |
633 |
605 subsection \<open>Enumeration\<close> |
634 subsection \<open>Enumeration\<close> |
606 |
635 |
607 lemma inj_on_word_of_nat: |
636 lemma inj_on_word_of_nat: |
3216 |
3245 |
3217 lemma inc_i: "1 \<le> i \<Longrightarrow> i < m \<Longrightarrow> 1 \<le> i + 1 \<and> i + 1 \<le> m" |
3246 lemma inc_i: "1 \<le> i \<Longrightarrow> i < m \<Longrightarrow> 1 \<le> i + 1 \<and> i + 1 \<le> m" |
3218 for i m :: "'a::len word" |
3247 for i m :: "'a::len word" |
3219 by uint_arith |
3248 by uint_arith |
3220 |
3249 |
|
3250 lemma dec_less_imp_less_eq: |
|
3251 \<open>v \<le> w\<close> if \<open>v - 1 < w\<close> for v w :: \<open>'a::len word\<close> |
|
3252 using that inc_le [of \<open>v - 1\<close> w] by simp |
|
3253 |
|
3254 lemma less_inc_imp_less_eq: |
|
3255 \<open>v \<le> w\<close> if \<open>v < w + 1\<close> for v w :: \<open>'a::len word\<close> |
|
3256 using that less_imp_less_eq_dec [of v \<open>w + 1\<close>] by simp |
|
3257 |
|
3258 lemma less_eq_dec_self_iff_eq: |
|
3259 \<open>w \<le> w - 1 \<longleftrightarrow> w = 0\<close> for w :: \<open>'a::len word\<close> |
|
3260 using less_eq_dec_iff [of w w] by simp |
|
3261 |
|
3262 lemma inc_less_eq_self_iff_eq: |
|
3263 \<open>w + 1 \<le> w \<longleftrightarrow> w = - 1\<close> for w :: \<open>'a::len word\<close> |
|
3264 using inc_less_eq_triv_imp [of w] by auto |
|
3265 |
3221 lemma udvd_incr_lem: |
3266 lemma udvd_incr_lem: |
3222 "\<lbrakk>up < uq; up = ua + n * uint K; uq = ua + n' * uint K\<rbrakk> |
3267 "\<lbrakk>up < uq; up = ua + n * uint K; uq = ua + n' * uint K\<rbrakk> |
3223 \<Longrightarrow> up + uint K \<le> uq" |
3268 \<Longrightarrow> up + uint K \<le> uq" |
3224 by auto (metis int_distrib(1) linorder_not_less mult.left_neutral mult_right_mono uint_nonnegative zless_imp_add1_zle) |
3269 by auto (metis int_distrib(1) linorder_not_less mult.left_neutral mult_right_mono uint_nonnegative zless_imp_add1_zle) |
3225 |
3270 |