session
stringclasses
1 value
dependency
listlengths
0
0
context
stringlengths
31
38.1k
proof
stringlengths
31
38.1k
proof_state
stringlengths
38
24.6M
statement
stringlengths
22
5.17k
name
stringlengths
13
17
theory_name
stringclasses
518 values
num_steps
int64
1
963
[]
lemma and_mask_arith: "w AND mask n = (w * 2^(size w - n)) div 2^(size w - n)" for w :: \<open>'a::len word\<close> by (rule bit_word_eqI) (auto simp add: bit_simps word_size simp flip: push_bit_eq_mult drop_bit_eq_div)
lemma and_mask_arith: "w AND mask n = (w * 2^(size w - n)) div 2^(size w - n)" for w :: \<open>'a::len word\<close> by (rule bit_word_eqI) (auto simp add: bit_simps word_size simp flip: push_bit_eq_mult drop_bit_eq_div)
proof (prove) goal (1 subgoal): 1. w AND mask n = w * 2 ^ (size w - n) div 2 ^ (size w - n)
lemma and_mask_arith: "w AND mask n = (w * 2^(size w - n)) div 2^(size w - n)" for w :: \<open>'a::len word\<close>
unnamed_thy_107
More_Word
1
[]
lemma and_mask_arith': "0 < n \<Longrightarrow> w AND mask n = (w * 2^(size w - n)) div 2^(size w - n)" for w :: \<open>'a::len word\<close> by (rule and_mask_arith)
lemma and_mask_arith': "0 < n \<Longrightarrow> w AND mask n = (w * 2^(size w - n)) div 2^(size w - n)" for w :: \<open>'a::len word\<close> by (rule and_mask_arith)
proof (prove) goal (1 subgoal): 1. 0 < n \<Longrightarrow> w AND mask n = w * 2 ^ (size w - n) div 2 ^ (size w - n)
lemma and_mask_arith': "0 < n \<Longrightarrow> w AND mask n = (w * 2^(size w - n)) div 2^(size w - n)" for w :: \<open>'a::len word\<close>
unnamed_thy_108
More_Word
1
[]
lemma mask_2pm1: "mask n = 2 ^ n - (1 :: 'a::len word)" by (fact mask_eq_decr_exp)
lemma mask_2pm1: "mask n = 2 ^ n - (1 :: 'a::len word)" by (fact mask_eq_decr_exp)
proof (prove) goal (1 subgoal): 1. mask n = 2 ^ n - 1
lemma mask_2pm1: "mask n = 2 ^ n - (1 :: 'a::len word)"
unnamed_thy_109
More_Word
1
[]
lemma word_and_mask_le_2pm1: "w AND mask n \<le> 2 ^ n - 1" for w :: \<open>'a::len word\<close> by (simp add: mask_2pm1[symmetric] word_and_le1)
lemma word_and_mask_le_2pm1: "w AND mask n \<le> 2 ^ n - 1" for w :: \<open>'a::len word\<close> by (simp add: mask_2pm1[symmetric] word_and_le1)
proof (prove) goal (1 subgoal): 1. w AND mask n \<le> 2 ^ n - 1
lemma word_and_mask_le_2pm1: "w AND mask n \<le> 2 ^ n - 1" for w :: \<open>'a::len word\<close>
unnamed_thy_111
More_Word
1
[]
lemma is_aligned_AND_less_0: "u AND mask n = 0 \<Longrightarrow> v < 2^n \<Longrightarrow> u AND v = 0" for u v :: \<open>'a::len word\<close> apply (drule less_mask_eq) apply (simp flip: take_bit_eq_mask) apply (simp add: bit_eq_iff) apply (auto simp add: bit_simps) done
lemma is_aligned_AND_less_0: "u AND mask n = 0 \<Longrightarrow> v < 2^n \<Longrightarrow> u AND v = 0" for u v :: \<open>'a::len word\<close> apply (drule less_mask_eq) apply (simp flip: take_bit_eq_mask) apply (simp add: bit_eq_iff) apply (auto simp add: bit_simps) done
proof (prove) goal (1 subgoal): 1. \<lbrakk>u AND mask n = 0; v < 2 ^ n\<rbrakk> \<Longrightarrow> u AND v = 0 proof (prove) goal (1 subgoal): 1. \<lbrakk>u AND mask n = 0; v AND mask n = v\<rbrakk> \<Longrightarrow> u AND v = 0 proof (prove) goal (1 subgoal): 1. \<lbrakk>take_bit n u = 0; take_bit n v = v\<rbrakk> ...
lemma is_aligned_AND_less_0: "u AND mask n = 0 \<Longrightarrow> v < 2^n \<Longrightarrow> u AND v = 0" for u v :: \<open>'a::len word\<close>
unnamed_thy_112
More_Word
5
[]
lemma and_mask_eq_iff_le_mask: \<open>w AND mask n = w \<longleftrightarrow> w \<le> mask n\<close> for w :: \<open>'a::len word\<close> apply (simp flip: take_bit_eq_mask) apply (cases \<open>n \<ge> LENGTH('a)\<close>; transfer) apply (simp_all add: not_le min_def) apply (simp_all add: mask_eq_exp_minus_1) apply ...
lemma and_mask_eq_iff_le_mask: \<open>w AND mask n = w \<longleftrightarrow> w \<le> mask n\<close> for w :: \<open>'a::len word\<close> apply (simp flip: take_bit_eq_mask) apply (cases \<open>n \<ge> LENGTH('a)\<close>; transfer) apply (simp_all add: not_le min_def) apply (simp_all add: mask_eq_exp_minus_1) apply ...
proof (prove) goal (1 subgoal): 1. (w AND mask n = w) = (w \<le> mask n) proof (prove) goal (1 subgoal): 1. (take_bit n w = w) = (w \<le> mask n) proof (prove) goal (2 subgoals): 1. \<And>n w. LENGTH('a) \<le> n \<Longrightarrow> (take_bit LENGTH('a) (take_bit (min LENGTH('a) n) w) = take_bit LENGTH('a) w) = (take_b...
lemma and_mask_eq_iff_le_mask: \<open>w AND mask n = w \<longleftrightarrow> w \<le> mask n\<close> for w :: \<open>'a::len word\<close>
unnamed_thy_113
More_Word
8
[]
lemma less_eq_mask_iff_take_bit_eq_self: \<open>w \<le> mask n \<longleftrightarrow> take_bit n w = w\<close> for w :: \<open>'a::len word\<close> by (simp add: and_mask_eq_iff_le_mask take_bit_eq_mask)
lemma less_eq_mask_iff_take_bit_eq_self: \<open>w \<le> mask n \<longleftrightarrow> take_bit n w = w\<close> for w :: \<open>'a::len word\<close> by (simp add: and_mask_eq_iff_le_mask take_bit_eq_mask)
proof (prove) goal (1 subgoal): 1. (w \<le> mask n) = (take_bit n w = w)
lemma less_eq_mask_iff_take_bit_eq_self: \<open>w \<le> mask n \<longleftrightarrow> take_bit n w = w\<close> for w :: \<open>'a::len word\<close>
unnamed_thy_114
More_Word
1
[]
lemma NOT_eq: "NOT (x :: 'a :: len word) = - x - 1" by (fact not_eq_complement)
lemma NOT_eq: "NOT (x :: 'a :: len word) = - x - 1" by (fact not_eq_complement)
proof (prove) goal (1 subgoal): 1. NOT x = - x - 1
lemma NOT_eq: "NOT (x :: 'a :: len word) = - x - 1"
unnamed_thy_115
More_Word
1
[]
lemma NOT_mask: "NOT (mask n :: 'a::len word) = - (2 ^ n)" by (simp add : NOT_eq mask_2pm1)
lemma NOT_mask: "NOT (mask n :: 'a::len word) = - (2 ^ n)" by (simp add : NOT_eq mask_2pm1)
proof (prove) goal (1 subgoal): 1. NOT (mask n) = - (2 ^ n)
lemma NOT_mask: "NOT (mask n :: 'a::len word) = - (2 ^ n)"
unnamed_thy_116
More_Word
1
[]
lemma le_m1_iff_lt: "(x > (0 :: 'a :: len word)) = ((y \<le> x - 1) = (y < x))" by uint_arith
lemma le_m1_iff_lt: "(x > (0 :: 'a :: len word)) = ((y \<le> x - 1) = (y < x))" by uint_arith
proof (prove) goal (1 subgoal): 1. (0 < x) = ((y \<le> x - 1) = (y < x))
lemma le_m1_iff_lt: "(x > (0 :: 'a :: len word)) = ((y \<le> x - 1) = (y < x))"
unnamed_thy_117
More_Word
1
[]
lemma gt0_iff_gem1: \<open>0 < x \<longleftrightarrow> x - 1 < x\<close> for x :: \<open>'a::len word\<close> by (metis add.right_neutral diff_add_cancel less_irrefl measure_unat unat_arith_simps(2) word_neq_0_conv word_sub_less_iff)
lemma gt0_iff_gem1: \<open>0 < x \<longleftrightarrow> x - 1 < x\<close> for x :: \<open>'a::len word\<close> by (metis add.right_neutral diff_add_cancel less_irrefl measure_unat unat_arith_simps(2) word_neq_0_conv word_sub_less_iff)
proof (prove) goal (1 subgoal): 1. (0 < x) = (x - 1 < x)
lemma gt0_iff_gem1: \<open>0 < x \<longleftrightarrow> x - 1 < x\<close> for x :: \<open>'a::len word\<close>
unnamed_thy_118
More_Word
1
[]
lemma power_2_ge_iff: \<open>2 ^ n - (1 :: 'a::len word) < 2 ^ n \<longleftrightarrow> n < LENGTH('a)\<close> using gt0_iff_gem1 p2_gt_0 by blast
lemma power_2_ge_iff: \<open>2 ^ n - (1 :: 'a::len word) < 2 ^ n \<longleftrightarrow> n < LENGTH('a)\<close> using gt0_iff_gem1 p2_gt_0 by blast
proof (prove) goal (1 subgoal): 1. (2 ^ n - 1 < 2 ^ n) = (n < LENGTH('a)) proof (prove) using this: (0 < ?x) = (?x - 1 < ?x) (0 < 2 ^ ?n) = (?n < LENGTH(?'a)) goal (1 subgoal): 1. (2 ^ n - 1 < 2 ^ n) = (n < LENGTH('a))
lemma power_2_ge_iff: \<open>2 ^ n - (1 :: 'a::len word) < 2 ^ n \<longleftrightarrow> n < LENGTH('a)\<close>
unnamed_thy_119
More_Word
2
[]
lemma le_mask_iff_lt_2n: "n < len_of TYPE ('a) = (((w :: 'a :: len word) \<le> mask n) = (w < 2 ^ n))" unfolding mask_2pm1 by (rule trans [OF p2_gt_0 [THEN sym] le_m1_iff_lt])
lemma le_mask_iff_lt_2n: "n < len_of TYPE ('a) = (((w :: 'a :: len word) \<le> mask n) = (w < 2 ^ n))" unfolding mask_2pm1 by (rule trans [OF p2_gt_0 [THEN sym] le_m1_iff_lt])
proof (prove) goal (1 subgoal): 1. (n < LENGTH('a)) = ((w \<le> mask n) = (w < 2 ^ n)) proof (prove) goal (1 subgoal): 1. (n < LENGTH('a)) = ((w \<le> 2 ^ n - 1) = (w < 2 ^ n))
lemma le_mask_iff_lt_2n: "n < len_of TYPE ('a) = (((w :: 'a :: len word) \<le> mask n) = (w < 2 ^ n))"
unnamed_thy_120
More_Word
2
[]
lemma mask_lt_2pn: \<open>n < LENGTH('a) \<Longrightarrow> mask n < (2 :: 'a::len word) ^ n\<close> by (simp add: mask_eq_exp_minus_1 power_2_ge_iff)
lemma mask_lt_2pn: \<open>n < LENGTH('a) \<Longrightarrow> mask n < (2 :: 'a::len word) ^ n\<close> by (simp add: mask_eq_exp_minus_1 power_2_ge_iff)
proof (prove) goal (1 subgoal): 1. n < LENGTH('a) \<Longrightarrow> mask n < 2 ^ n
lemma mask_lt_2pn: \<open>n < LENGTH('a) \<Longrightarrow> mask n < (2 :: 'a::len word) ^ n\<close>
unnamed_thy_121
More_Word
1
[]
lemma word_unat_power: "(2 :: 'a :: len word) ^ n = of_nat (2 ^ n)" by simp
lemma word_unat_power: "(2 :: 'a :: len word) ^ n = of_nat (2 ^ n)" by simp
proof (prove) goal (1 subgoal): 1. 2 ^ n = word_of_nat (2 ^ n)
lemma word_unat_power: "(2 :: 'a :: len word) ^ n = of_nat (2 ^ n)"
unnamed_thy_122
More_Word
1
[]
lemma of_nat_mono_maybe: assumes xlt: "x < 2 ^ len_of TYPE ('a)" shows "y < x \<Longrightarrow> of_nat y < (of_nat x :: 'a :: len word)" apply (subst word_less_nat_alt) apply (subst unat_of_nat)+ apply (subst mod_less) apply (erule order_less_trans [OF _ xlt]) apply (subst mod_less [OF xlt]) apply assumption done
lemma of_nat_mono_maybe: assumes xlt: "x < 2 ^ len_of TYPE ('a)" shows "y < x \<Longrightarrow> of_nat y < (of_nat x :: 'a :: len word)" apply (subst word_less_nat_alt) apply (subst unat_of_nat)+ apply (subst mod_less) apply (erule order_less_trans [OF _ xlt]) apply (subst mod_less [OF xlt]) apply assumption done
proof (prove) goal (1 subgoal): 1. y < x \<Longrightarrow> word_of_nat y < word_of_nat x proof (prove) goal (1 subgoal): 1. y < x \<Longrightarrow> unat (word_of_nat y) < unat (word_of_nat x) proof (prove) goal (1 subgoal): 1. y < x \<Longrightarrow> y mod 2 ^ LENGTH('a) < x mod 2 ^ LENGTH('a) proof (prove) goal (2 ...
lemma of_nat_mono_maybe: assumes xlt: "x < 2 ^ len_of TYPE ('a)" shows "y < x \<Longrightarrow> of_nat y < (of_nat x :: 'a :: len word)"
unnamed_thy_123
More_Word
7
[]
lemma word_and_max_word: fixes a::"'a::len word" shows "x = - 1 \<Longrightarrow> a AND x = a" by simp
lemma word_and_max_word: fixes a::"'a::len word" shows "x = - 1 \<Longrightarrow> a AND x = a" by simp
proof (prove) goal (1 subgoal): 1. x = - 1 \<Longrightarrow> a AND x = a
lemma word_and_max_word: fixes a::"'a::len word" shows "x = - 1 \<Longrightarrow> a AND x = a"
unnamed_thy_124
More_Word
1
[]
lemma word_and_full_mask_simp: \<open>x AND mask LENGTH('a) = x\<close> for x :: \<open>'a::len word\<close> by (simp add: bit_eq_iff bit_simps)
lemma word_and_full_mask_simp: \<open>x AND mask LENGTH('a) = x\<close> for x :: \<open>'a::len word\<close> by (simp add: bit_eq_iff bit_simps)
proof (prove) goal (1 subgoal): 1. x AND mask LENGTH('a) = x
lemma word_and_full_mask_simp: \<open>x AND mask LENGTH('a) = x\<close> for x :: \<open>'a::len word\<close>
unnamed_thy_125
More_Word
1
[]
lemma of_int_uint: "of_int (uint x) = x" by (fact word_of_int_uint)
lemma of_int_uint: "of_int (uint x) = x" by (fact word_of_int_uint)
proof (prove) goal (1 subgoal): 1. word_of_int (uint x) = x
lemma of_int_uint: "of_int (uint x) = x"
unnamed_thy_126
More_Word
1
[]
lemma unat_mask_eq: \<open>unat (mask n :: 'a::len word) = mask (min LENGTH('a) n)\<close> by transfer (simp add: nat_mask_eq)
lemma unat_mask_eq: \<open>unat (mask n :: 'a::len word) = mask (min LENGTH('a) n)\<close> by transfer (simp add: nat_mask_eq)
proof (prove) goal (1 subgoal): 1. unat (mask n) = mask (min LENGTH('a) n)
lemma unat_mask_eq: \<open>unat (mask n :: 'a::len word) = mask (min LENGTH('a) n)\<close>
unnamed_thy_129
More_Word
1
[]
lemma word_plus_mono_left: fixes x :: "'a :: len word" shows "\<lbrakk>y \<le> z; x \<le> x + z\<rbrakk> \<Longrightarrow> y + x \<le> z + x" by unat_arith
lemma word_plus_mono_left: fixes x :: "'a :: len word" shows "\<lbrakk>y \<le> z; x \<le> x + z\<rbrakk> \<Longrightarrow> y + x \<le> z + x" by unat_arith
proof (prove) goal (1 subgoal): 1. \<lbrakk>y \<le> z; x \<le> x + z\<rbrakk> \<Longrightarrow> y + x \<le> z + x
lemma word_plus_mono_left: fixes x :: "'a :: len word" shows "\<lbrakk>y \<le> z; x \<le> x + z\<rbrakk> \<Longrightarrow> y + x \<le> z + x"
unnamed_thy_130
More_Word
1
[]
lemma less_Suc_unat_less_bound: "n < Suc (unat (x :: 'a :: len word)) \<Longrightarrow> n < 2 ^ LENGTH('a)" by (auto elim!: order_less_le_trans intro: Suc_leI)
lemma less_Suc_unat_less_bound: "n < Suc (unat (x :: 'a :: len word)) \<Longrightarrow> n < 2 ^ LENGTH('a)" by (auto elim!: order_less_le_trans intro: Suc_leI)
proof (prove) goal (1 subgoal): 1. n < Suc (unat x) \<Longrightarrow> n < 2 ^ LENGTH('a)
lemma less_Suc_unat_less_bound: "n < Suc (unat (x :: 'a :: len word)) \<Longrightarrow> n < 2 ^ LENGTH('a)"
unnamed_thy_131
More_Word
1
[]
lemma up_ucast_inj: "\<lbrakk> ucast x = (ucast y::'b::len word); LENGTH('a) \<le> len_of TYPE ('b) \<rbrakk> \<Longrightarrow> x = (y::'a::len word)" by transfer (simp add: min_def split: if_splits)
lemma up_ucast_inj: "\<lbrakk> ucast x = (ucast y::'b::len word); LENGTH('a) \<le> len_of TYPE ('b) \<rbrakk> \<Longrightarrow> x = (y::'a::len word)" by transfer (simp add: min_def split: if_splits)
proof (prove) goal (1 subgoal): 1. \<lbrakk>ucast x = ucast y; LENGTH('a) \<le> LENGTH('b)\<rbrakk> \<Longrightarrow> x = y
lemma up_ucast_inj: "\<lbrakk> ucast x = (ucast y::'b::len word); LENGTH('a) \<le> len_of TYPE ('b) \<rbrakk> \<Longrightarrow> x = (y::'a::len word)"
unnamed_thy_132
More_Word
1
[]
lemma up_ucast_inj_eq: "LENGTH('a) \<le> len_of TYPE ('b) \<Longrightarrow> (ucast x = (ucast y::'b::len word)) = (x = (y::'a::len word))" by (fastforce dest: up_ucast_inj)
lemma up_ucast_inj_eq: "LENGTH('a) \<le> len_of TYPE ('b) \<Longrightarrow> (ucast x = (ucast y::'b::len word)) = (x = (y::'a::len word))" by (fastforce dest: up_ucast_inj)
proof (prove) goal (1 subgoal): 1. LENGTH('a) \<le> LENGTH('b) \<Longrightarrow> (ucast x = ucast y) = (x = y)
lemma up_ucast_inj_eq: "LENGTH('a) \<le> len_of TYPE ('b) \<Longrightarrow> (ucast x = (ucast y::'b::len word)) = (x = (y::'a::len word))"
unnamed_thy_133
More_Word
1
[]
lemma no_plus_overflow_neg: "(x :: 'a :: len word) < -y \<Longrightarrow> x \<le> x + y" by (metis diff_minus_eq_add less_imp_le sub_wrap_lt)
lemma no_plus_overflow_neg: "(x :: 'a :: len word) < -y \<Longrightarrow> x \<le> x + y" by (metis diff_minus_eq_add less_imp_le sub_wrap_lt)
proof (prove) goal (1 subgoal): 1. x < - y \<Longrightarrow> x \<le> x + y
lemma no_plus_overflow_neg: "(x :: 'a :: len word) < -y \<Longrightarrow> x \<le> x + y"
unnamed_thy_134
More_Word
1
[]
lemma ucast_ucast_eq: "\<lbrakk> ucast x = (ucast (ucast y::'a word)::'c::len word); LENGTH('a) \<le> LENGTH('b); LENGTH('b) \<le> LENGTH('c) \<rbrakk> \<Longrightarrow> x = ucast y" for x :: "'a::len word" and y :: "'b::len word" apply transfer apply (cases \<open>LENGTH('c) = LENGTH('a)\<close>) apply (auto...
lemma ucast_ucast_eq: "\<lbrakk> ucast x = (ucast (ucast y::'a word)::'c::len word); LENGTH('a) \<le> LENGTH('b); LENGTH('b) \<le> LENGTH('c) \<rbrakk> \<Longrightarrow> x = ucast y" for x :: "'a::len word" and y :: "'b::len word" apply transfer apply (cases \<open>LENGTH('c) = LENGTH('a)\<close>) apply (auto...
proof (prove) goal (1 subgoal): 1. \<lbrakk>ucast x = ucast (ucast y); LENGTH('a) \<le> LENGTH('b); LENGTH('b) \<le> LENGTH('c)\<rbrakk> \<Longrightarrow> x = ucast y proof (prove) goal (1 subgoal): 1. \<And>x y. \<lbrakk>take_bit LENGTH('c) (take_bit LENGTH('a) x) = take_bit LENGTH('c) (take_bit LENGTH('a) (take_bit...
lemma ucast_ucast_eq: "\<lbrakk> ucast x = (ucast (ucast y::'a word)::'c::len word); LENGTH('a) \<le> LENGTH('b); LENGTH('b) \<le> LENGTH('c) \<rbrakk> \<Longrightarrow> x = ucast y" for x :: "'a::len word" and y :: "'b::len word"
unnamed_thy_135
More_Word
4
[]
lemma ucast_0_I: "x = 0 \<Longrightarrow> ucast x = 0" by simp
lemma ucast_0_I: "x = 0 \<Longrightarrow> ucast x = 0" by simp
proof (prove) goal (1 subgoal): 1. x = 0 \<Longrightarrow> ucast x = 0
lemma ucast_0_I: "x = 0 \<Longrightarrow> ucast x = 0"
unnamed_thy_136
More_Word
1
[]
lemma word_add_offset_less: fixes x :: "'a :: len word" assumes yv: "y < 2 ^ n" and xv: "x < 2 ^ m" and mnv: "sz < LENGTH('a :: len)" and xv': "x < 2 ^ (LENGTH('a :: len) - n)" and mn: "sz = m + n" shows "x * 2 ^ n + y < 2 ^ sz" proof (subst mn) from mnv mn have nv: "n < LENGTH('a)" and m...
lemma word_add_offset_less: fixes x :: "'a :: len word" assumes yv: "y < 2 ^ n" and xv: "x < 2 ^ m" and mnv: "sz < LENGTH('a :: len)" and xv': "x < 2 ^ (LENGTH('a :: len) - n)" and mn: "sz = m + n" shows "x * 2 ^ n + y < 2 ^ sz" proof (subst mn) from mnv mn have nv: "n < LENGTH('a)" and m...
proof (prove) goal (1 subgoal): 1. x * 2 ^ n + y < 2 ^ sz proof (state) goal (1 subgoal): 1. x * 2 ^ n + y < 2 ^ (m + n) proof (chain) picking this: sz < LENGTH('a) sz = m + n proof (prove) using this: sz < LENGTH('a) sz = m + n goal (1 subgoal): 1. n < LENGTH('a) &&& m < LENGTH('a) proof (state) this: n < LENGTH('...
lemma word_add_offset_less: fixes x :: "'a :: len word" assumes yv: "y < 2 ^ n" and xv: "x < 2 ^ m" and mnv: "sz < LENGTH('a :: len)" and xv': "x < 2 ^ (LENGTH('a :: len) - n)" and mn: "sz = m + n" shows "x * 2 ^ n + y < 2 ^ sz"
unnamed_thy_137
More_Word
28
[]
lemma word_less_power_trans: fixes n :: "'a :: len word" assumes nv: "n < 2 ^ (m - k)" and kv: "k \<le> m" and mv: "m < len_of TYPE ('a)" shows "2 ^ k * n < 2 ^ m" using nv kv mv apply - apply (subst word_less_nat_alt) apply (subst unat_word_ariths) apply (subst mod_less) apply simp apply (rule nat_le...
lemma word_less_power_trans: fixes n :: "'a :: len word" assumes nv: "n < 2 ^ (m - k)" and kv: "k \<le> m" and mv: "m < len_of TYPE ('a)" shows "2 ^ k * n < 2 ^ m" using nv kv mv apply - apply (subst word_less_nat_alt) apply (subst unat_word_ariths) apply (subst mod_less) apply simp apply (rule nat_le...
proof (prove) goal (1 subgoal): 1. 2 ^ k * n < 2 ^ m proof (prove) using this: n < 2 ^ (m - k) k \<le> m m < LENGTH('a) goal (1 subgoal): 1. 2 ^ k * n < 2 ^ m proof (prove) goal (1 subgoal): 1. \<lbrakk>n < 2 ^ (m - k); k \<le> m; m < LENGTH('a)\<rbrakk> \<Longrightarrow> 2 ^ k * n < 2 ^ m proof (prove) goal (1 sub...
lemma word_less_power_trans: fixes n :: "'a :: len word" assumes nv: "n < 2 ^ (m - k)" and kv: "k \<le> m" and mv: "m < len_of TYPE ('a)" shows "2 ^ k * n < 2 ^ m"
unnamed_thy_138
More_Word
17
[]
lemma word_less_power_trans2: fixes n :: "'a::len word" shows "\<lbrakk>n < 2 ^ (m - k); k \<le> m; m < LENGTH('a)\<rbrakk> \<Longrightarrow> n * 2 ^ k < 2 ^ m" by (subst field_simps, rule word_less_power_trans)
lemma word_less_power_trans2: fixes n :: "'a::len word" shows "\<lbrakk>n < 2 ^ (m - k); k \<le> m; m < LENGTH('a)\<rbrakk> \<Longrightarrow> n * 2 ^ k < 2 ^ m" by (subst field_simps, rule word_less_power_trans)
proof (prove) goal (1 subgoal): 1. \<lbrakk>n < 2 ^ (m - k); k \<le> m; m < LENGTH('a)\<rbrakk> \<Longrightarrow> n * 2 ^ k < 2 ^ m
lemma word_less_power_trans2: fixes n :: "'a::len word" shows "\<lbrakk>n < 2 ^ (m - k); k \<le> m; m < LENGTH('a)\<rbrakk> \<Longrightarrow> n * 2 ^ k < 2 ^ m"
unnamed_thy_139
More_Word
1
[]
lemma Suc_unat_diff_1: fixes x :: "'a :: len word" assumes lt: "1 \<le> x" shows "Suc (unat (x - 1)) = unat x" proof - have "0 < unat x" by (rule order_less_le_trans [where y = 1], simp, subst unat_1 [symmetric], rule iffD1 [OF word_le_nat_alt lt]) then show ?thesis by ((subst unat_sub [OF lt])+, simp onl...
lemma Suc_unat_diff_1: fixes x :: "'a :: len word" assumes lt: "1 \<le> x" shows "Suc (unat (x - 1)) = unat x" proof - have "0 < unat x" by (rule order_less_le_trans [where y = 1], simp, subst unat_1 [symmetric], rule iffD1 [OF word_le_nat_alt lt]) then show ?thesis by ((subst unat_sub [OF lt])+, simp onl...
proof (prove) goal (1 subgoal): 1. Suc (unat (x - 1)) = unat x proof (state) goal (1 subgoal): 1. Suc (unat (x - 1)) = unat x proof (prove) goal (1 subgoal): 1. 0 < unat x proof (state) this: 0 < unat x goal (1 subgoal): 1. Suc (unat (x - 1)) = unat x proof (chain) picking this: 0 < unat x proof (prove) using this...
lemma Suc_unat_diff_1: fixes x :: "'a :: len word" assumes lt: "1 \<le> x" shows "Suc (unat (x - 1)) = unat x"
unnamed_thy_140
More_Word
7
[]
lemma word_eq_unatI: \<open>v = w\<close> if \<open>unat v = unat w\<close> using that by transfer (simp add: nat_eq_iff)
lemma word_eq_unatI: \<open>v = w\<close> if \<open>unat v = unat w\<close> using that by transfer (simp add: nat_eq_iff)
proof (prove) goal (1 subgoal): 1. v = w proof (prove) using this: unat v = unat w goal (1 subgoal): 1. v = w
lemma word_eq_unatI: \<open>v = w\<close> if \<open>unat v = unat w\<close>
unnamed_thy_141
More_Word
2
[]
lemma word_mult_less_mono1: fixes i :: "'a :: len word" assumes ij: "i < j" and knz: "0 < k" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i * k < j * k" proof - from ij ujk knz have jk: "unat i * unat k < 2 ^ len_of TYPE ('a)" by (auto intro: order_less_subst2 simp: word_less_nat_alt elim: ...
lemma word_mult_less_mono1: fixes i :: "'a :: len word" assumes ij: "i < j" and knz: "0 < k" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i * k < j * k" proof - from ij ujk knz have jk: "unat i * unat k < 2 ^ len_of TYPE ('a)" by (auto intro: order_less_subst2 simp: word_less_nat_alt elim: ...
proof (prove) goal (1 subgoal): 1. i * k < j * k proof (state) goal (1 subgoal): 1. i * k < j * k proof (chain) picking this: i < j unat j * unat k < 2 ^ LENGTH('a) 0 < k proof (prove) using this: i < j unat j * unat k < 2 ^ LENGTH('a) 0 < k goal (1 subgoal): 1. unat i * unat k < 2 ^ LENGTH('a) proof (state) this: ...
lemma word_mult_less_mono1: fixes i :: "'a :: len word" assumes ij: "i < j" and knz: "0 < k" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i * k < j * k"
unnamed_thy_143
More_Word
9
[]
lemma word_mult_less_dest: fixes i :: "'a :: len word" assumes ij: "i * k < j * k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i < j" using uik ujk ij by (auto simp: word_less_nat_alt iffD1 [OF unat_mult_lem] elim: mult_less_mono1)
lemma word_mult_less_dest: fixes i :: "'a :: len word" assumes ij: "i * k < j * k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i < j" using uik ujk ij by (auto simp: word_less_nat_alt iffD1 [OF unat_mult_lem] elim: mult_less_mono1)
proof (prove) goal (1 subgoal): 1. i < j proof (prove) using this: unat i * unat k < 2 ^ LENGTH('a) unat j * unat k < 2 ^ LENGTH('a) i * k < j * k goal (1 subgoal): 1. i < j
lemma word_mult_less_dest: fixes i :: "'a :: len word" assumes ij: "i * k < j * k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i < j"
unnamed_thy_144
More_Word
2
[]
lemma word_mult_less_cancel: fixes k :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k < j * k) = (i < j)" by (rule iffI [OF word_mult_less_dest [OF _ uik ujk] word_mult_less_mono1 [OF _ knz ujk]])
lemma word_mult_less_cancel: fixes k :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k < j * k) = (i < j)" by (rule iffI [OF word_mult_less_dest [OF _ uik ujk] word_mult_less_mono1 [OF _ knz ujk]])
proof (prove) goal (1 subgoal): 1. (i * k < j * k) = (i < j)
lemma word_mult_less_cancel: fixes k :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k < j * k) = (i < j)"
unnamed_thy_145
More_Word
1
[]
lemma Suc_div_unat_helper: assumes szv: "sz < LENGTH('a :: len)" and usszv: "us \<le> sz" shows "2 ^ (sz - us) = Suc (unat (((2::'a :: len word) ^ sz - 1) div 2 ^ us))" proof - note usv = order_le_less_trans [OF usszv szv] from usszv obtain q where qv: "sz = us + q" by (auto simp: le_iff_add) have "Suc (unat ((...
lemma Suc_div_unat_helper: assumes szv: "sz < LENGTH('a :: len)" and usszv: "us \<le> sz" shows "2 ^ (sz - us) = Suc (unat (((2::'a :: len word) ^ sz - 1) div 2 ^ us))" proof - note usv = order_le_less_trans [OF usszv szv] from usszv obtain q where qv: "sz = us + q" by (auto simp: le_iff_add) have "Suc (unat ((...
proof (prove) goal (1 subgoal): 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us)) proof (state) goal (1 subgoal): 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us)) proof (state) this: us < LENGTH('a) goal (1 subgoal): 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us)) proof (chain) picking this: us...
lemma Suc_div_unat_helper: assumes szv: "sz < LENGTH('a :: len)" and usszv: "us \<le> sz" shows "2 ^ (sz - us) = Suc (unat (((2::'a :: len word) ^ sz - 1) div 2 ^ us))"
unnamed_thy_146
More_Word
27
[]
lemma enum_word_nth_eq: \<open>(Enum.enum :: 'a::len word list) ! n = word_of_nat n\<close> if \<open>n < 2 ^ LENGTH('a)\<close> for n using that by (simp add: enum_word_def)
lemma enum_word_nth_eq: \<open>(Enum.enum :: 'a::len word list) ! n = word_of_nat n\<close> if \<open>n < 2 ^ LENGTH('a)\<close> for n using that by (simp add: enum_word_def)
proof (prove) goal (1 subgoal): 1. enum_class.enum ! n = word_of_nat n proof (prove) using this: n < 2 ^ LENGTH('a) goal (1 subgoal): 1. enum_class.enum ! n = word_of_nat n
lemma enum_word_nth_eq: \<open>(Enum.enum :: 'a::len word list) ! n = word_of_nat n\<close> if \<open>n < 2 ^ LENGTH('a)\<close> for n
unnamed_thy_147
More_Word
2
[]
lemma length_enum_word_eq: \<open>length (Enum.enum :: 'a::len word list) = 2 ^ LENGTH('a)\<close> by (simp add: enum_word_def)
lemma length_enum_word_eq: \<open>length (Enum.enum :: 'a::len word list) = 2 ^ LENGTH('a)\<close> by (simp add: enum_word_def)
proof (prove) goal (1 subgoal): 1. length enum_class.enum = 2 ^ LENGTH('a)
lemma length_enum_word_eq: \<open>length (Enum.enum :: 'a::len word list) = 2 ^ LENGTH('a)\<close>
unnamed_thy_148
More_Word
1
[]
lemma unat_lt2p [iff]: \<open>unat x < 2 ^ LENGTH('a)\<close> for x :: \<open>'a::len word\<close> by transfer simp
lemma unat_lt2p [iff]: \<open>unat x < 2 ^ LENGTH('a)\<close> for x :: \<open>'a::len word\<close> by transfer simp
proof (prove) goal (1 subgoal): 1. unat x < 2 ^ LENGTH('a)
lemma unat_lt2p [iff]: \<open>unat x < 2 ^ LENGTH('a)\<close> for x :: \<open>'a::len word\<close>
unnamed_thy_149
More_Word
1
[]
lemma Suc_unat_minus_one [simp]: "x \<noteq> 0 \<Longrightarrow> Suc (unat (x - 1)) = unat x" by (metis Suc_diff_1 unat_gt_0 unat_minus_one)
lemma Suc_unat_minus_one [simp]: "x \<noteq> 0 \<Longrightarrow> Suc (unat (x - 1)) = unat x" by (metis Suc_diff_1 unat_gt_0 unat_minus_one)
proof (prove) goal (1 subgoal): 1. x \<noteq> 0 \<Longrightarrow> Suc (unat (x - 1)) = unat x
lemma Suc_unat_minus_one [simp]: "x \<noteq> 0 \<Longrightarrow> Suc (unat (x - 1)) = unat x"
unnamed_thy_151
More_Word
1
[]
lemma word_add_le_dest: fixes i :: "'a :: len word" assumes le: "i + k \<le> j + k" and uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i \<le> j" using uik ujk le by (auto simp: word_le_nat_alt iffD1 [OF unat_add_lem] elim: add_le_mono1)
lemma word_add_le_dest: fixes i :: "'a :: len word" assumes le: "i + k \<le> j + k" and uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i \<le> j" using uik ujk le by (auto simp: word_le_nat_alt iffD1 [OF unat_add_lem] elim: add_le_mono1)
proof (prove) goal (1 subgoal): 1. i \<le> j proof (prove) using this: unat i + unat k < 2 ^ LENGTH('a) unat j + unat k < 2 ^ LENGTH('a) i + k \<le> j + k goal (1 subgoal): 1. i \<le> j
lemma word_add_le_dest: fixes i :: "'a :: len word" assumes le: "i + k \<le> j + k" and uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i \<le> j"
unnamed_thy_152
More_Word
2
[]
lemma word_add_le_mono1: fixes i :: "'a :: len word" assumes ij: "i \<le> j" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i + k \<le> j + k" proof - from ij ujk have jk: "unat i + unat k < 2 ^ len_of TYPE ('a)" by (auto elim: order_le_less_subst2 simp: word_le_nat_alt elim: add_le_mono1) then sh...
lemma word_add_le_mono1: fixes i :: "'a :: len word" assumes ij: "i \<le> j" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i + k \<le> j + k" proof - from ij ujk have jk: "unat i + unat k < 2 ^ len_of TYPE ('a)" by (auto elim: order_le_less_subst2 simp: word_le_nat_alt elim: add_le_mono1) then sh...
proof (prove) goal (1 subgoal): 1. i + k \<le> j + k proof (state) goal (1 subgoal): 1. i + k \<le> j + k proof (chain) picking this: i \<le> j unat j + unat k < 2 ^ LENGTH('a) proof (prove) using this: i \<le> j unat j + unat k < 2 ^ LENGTH('a) goal (1 subgoal): 1. unat i + unat k < 2 ^ LENGTH('a) proof (state) th...
lemma word_add_le_mono1: fixes i :: "'a :: len word" assumes ij: "i \<le> j" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i + k \<le> j + k"
unnamed_thy_153
More_Word
9
[]
lemma word_add_le_mono2: fixes i :: "'a :: len word" shows "\<lbrakk>i \<le> j; unat j + unat k < 2 ^ LENGTH('a)\<rbrakk> \<Longrightarrow> k + i \<le> k + j" by (subst field_simps, subst field_simps, erule (1) word_add_le_mono1)
lemma word_add_le_mono2: fixes i :: "'a :: len word" shows "\<lbrakk>i \<le> j; unat j + unat k < 2 ^ LENGTH('a)\<rbrakk> \<Longrightarrow> k + i \<le> k + j" by (subst field_simps, subst field_simps, erule (1) word_add_le_mono1)
proof (prove) goal (1 subgoal): 1. \<lbrakk>i \<le> j; unat j + unat k < 2 ^ LENGTH('a)\<rbrakk> \<Longrightarrow> k + i \<le> k + j
lemma word_add_le_mono2: fixes i :: "'a :: len word" shows "\<lbrakk>i \<le> j; unat j + unat k < 2 ^ LENGTH('a)\<rbrakk> \<Longrightarrow> k + i \<le> k + j"
unnamed_thy_154
More_Word
1
[]
lemma word_add_le_iff: fixes i :: "'a :: len word" assumes uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "(i + k \<le> j + k) = (i \<le> j)" proof assume "i \<le> j" show "i + k \<le> j + k" by (rule word_add_le_mono1) fact+ next assume "i + k \<le> j...
lemma word_add_le_iff: fixes i :: "'a :: len word" assumes uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "(i + k \<le> j + k) = (i \<le> j)" proof assume "i \<le> j" show "i + k \<le> j + k" by (rule word_add_le_mono1) fact+ next assume "i + k \<le> j...
proof (prove) goal (1 subgoal): 1. (i + k \<le> j + k) = (i \<le> j) proof (state) goal (2 subgoals): 1. i + k \<le> j + k \<Longrightarrow> i \<le> j 2. i \<le> j \<Longrightarrow> i + k \<le> j + k proof (state) this: i \<le> j goal (2 subgoals): 1. i + k \<le> j + k \<Longrightarrow> i \<le> j 2. i \<le> j \<L...
lemma word_add_le_iff: fixes i :: "'a :: len word" assumes uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "(i + k \<le> j + k) = (i \<le> j)"
unnamed_thy_155
More_Word
9
[]
lemma word_add_less_mono1: fixes i :: "'a :: len word" assumes ij: "i < j" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i + k < j + k" proof - from ij ujk have jk: "unat i + unat k < 2 ^ len_of TYPE ('a)" by (auto elim: order_le_less_subst2 simp: word_less_nat_alt elim: add_less_mono1) then show...
lemma word_add_less_mono1: fixes i :: "'a :: len word" assumes ij: "i < j" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i + k < j + k" proof - from ij ujk have jk: "unat i + unat k < 2 ^ len_of TYPE ('a)" by (auto elim: order_le_less_subst2 simp: word_less_nat_alt elim: add_less_mono1) then show...
proof (prove) goal (1 subgoal): 1. i + k < j + k proof (state) goal (1 subgoal): 1. i + k < j + k proof (chain) picking this: i < j unat j + unat k < 2 ^ LENGTH('a) proof (prove) using this: i < j unat j + unat k < 2 ^ LENGTH('a) goal (1 subgoal): 1. unat i + unat k < 2 ^ LENGTH('a) proof (state) this: unat i + una...
lemma word_add_less_mono1: fixes i :: "'a :: len word" assumes ij: "i < j" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i + k < j + k"
unnamed_thy_156
More_Word
9
[]
lemma word_add_less_dest: fixes i :: "'a :: len word" assumes le: "i + k < j + k" and uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i < j" using uik ujk le by (auto simp: word_less_nat_alt iffD1 [OF unat_add_lem] elim: add_less_mono1)
lemma word_add_less_dest: fixes i :: "'a :: len word" assumes le: "i + k < j + k" and uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i < j" using uik ujk le by (auto simp: word_less_nat_alt iffD1 [OF unat_add_lem] elim: add_less_mono1)
proof (prove) goal (1 subgoal): 1. i < j proof (prove) using this: unat i + unat k < 2 ^ LENGTH('a) unat j + unat k < 2 ^ LENGTH('a) i + k < j + k goal (1 subgoal): 1. i < j
lemma word_add_less_dest: fixes i :: "'a :: len word" assumes le: "i + k < j + k" and uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "i < j"
unnamed_thy_157
More_Word
2
[]
lemma word_add_less_iff: fixes i :: "'a :: len word" assumes uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "(i + k < j + k) = (i < j)" proof assume "i < j" show "i + k < j + k" by (rule word_add_less_mono1) fact+ next assume "i + k < j + k" show "i < ...
lemma word_add_less_iff: fixes i :: "'a :: len word" assumes uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "(i + k < j + k) = (i < j)" proof assume "i < j" show "i + k < j + k" by (rule word_add_less_mono1) fact+ next assume "i + k < j + k" show "i < ...
proof (prove) goal (1 subgoal): 1. (i + k < j + k) = (i < j) proof (state) goal (2 subgoals): 1. i + k < j + k \<Longrightarrow> i < j 2. i < j \<Longrightarrow> i + k < j + k proof (state) this: i < j goal (2 subgoals): 1. i + k < j + k \<Longrightarrow> i < j 2. i < j \<Longrightarrow> i + k < j + k proof (prov...
lemma word_add_less_iff: fixes i :: "'a :: len word" assumes uik: "unat i + unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)" shows "(i + k < j + k) = (i < j)"
unnamed_thy_158
More_Word
9
[]
lemma word_mult_less_iff: fixes i :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k < j * k) = (i < j)" using assms by (rule word_mult_less_cancel)
lemma word_mult_less_iff: fixes i :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k < j * k) = (i < j)" using assms by (rule word_mult_less_cancel)
proof (prove) goal (1 subgoal): 1. (i * k < j * k) = (i < j) proof (prove) using this: 0 < k unat i * unat k < 2 ^ LENGTH('a) unat j * unat k < 2 ^ LENGTH('a) goal (1 subgoal): 1. (i * k < j * k) = (i < j)
lemma word_mult_less_iff: fixes i :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k < j * k) = (i < j)"
unnamed_thy_159
More_Word
2
[]
lemma word_le_imp_diff_le: fixes n :: "'a::len word" shows "\<lbrakk>k \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> n - k \<le> m" by (auto simp: unat_sub word_le_nat_alt)
lemma word_le_imp_diff_le: fixes n :: "'a::len word" shows "\<lbrakk>k \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> n - k \<le> m" by (auto simp: unat_sub word_le_nat_alt)
proof (prove) goal (1 subgoal): 1. \<lbrakk>k \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> n - k \<le> m
lemma word_le_imp_diff_le: fixes n :: "'a::len word" shows "\<lbrakk>k \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> n - k \<le> m"
unnamed_thy_160
More_Word
1
[]
lemma word_less_imp_diff_less: fixes n :: "'a::len word" shows "\<lbrakk>k \<le> n; n < m\<rbrakk> \<Longrightarrow> n - k < m" by (clarsimp simp: unat_sub word_less_nat_alt intro!: less_imp_diff_less)
lemma word_less_imp_diff_less: fixes n :: "'a::len word" shows "\<lbrakk>k \<le> n; n < m\<rbrakk> \<Longrightarrow> n - k < m" by (clarsimp simp: unat_sub word_less_nat_alt intro!: less_imp_diff_less)
proof (prove) goal (1 subgoal): 1. \<lbrakk>k \<le> n; n < m\<rbrakk> \<Longrightarrow> n - k < m
lemma word_less_imp_diff_less: fixes n :: "'a::len word" shows "\<lbrakk>k \<le> n; n < m\<rbrakk> \<Longrightarrow> n - k < m"
unnamed_thy_161
More_Word
1
[]
lemma word_mult_le_mono1: fixes i :: "'a :: len word" assumes ij: "i \<le> j" and knz: "0 < k" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i * k \<le> j * k" proof - from ij ujk knz have jk: "unat i * unat k < 2 ^ len_of TYPE ('a)" by (auto elim: order_le_less_subst2 simp: word_le_nat_alt ...
lemma word_mult_le_mono1: fixes i :: "'a :: len word" assumes ij: "i \<le> j" and knz: "0 < k" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i * k \<le> j * k" proof - from ij ujk knz have jk: "unat i * unat k < 2 ^ len_of TYPE ('a)" by (auto elim: order_le_less_subst2 simp: word_le_nat_alt ...
proof (prove) goal (1 subgoal): 1. i * k \<le> j * k proof (state) goal (1 subgoal): 1. i * k \<le> j * k proof (chain) picking this: i \<le> j unat j * unat k < 2 ^ LENGTH('a) 0 < k proof (prove) using this: i \<le> j unat j * unat k < 2 ^ LENGTH('a) 0 < k goal (1 subgoal): 1. unat i * unat k < 2 ^ LENGTH('a) proo...
lemma word_mult_le_mono1: fixes i :: "'a :: len word" assumes ij: "i \<le> j" and knz: "0 < k" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "i * k \<le> j * k"
unnamed_thy_162
More_Word
9
[]
lemma word_mult_le_iff: fixes i :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k \<le> j * k) = (i \<le> j)" proof assume "i \<le> j" show "i * k \<le> j * k" by (rule word_mult_le_mono1) fact+ n...
lemma word_mult_le_iff: fixes i :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k \<le> j * k) = (i \<le> j)" proof assume "i \<le> j" show "i * k \<le> j * k" by (rule word_mult_le_mono1) fact+ n...
proof (prove) goal (1 subgoal): 1. (i * k \<le> j * k) = (i \<le> j) proof (state) goal (2 subgoals): 1. i * k \<le> j * k \<Longrightarrow> i \<le> j 2. i \<le> j \<Longrightarrow> i * k \<le> j * k proof (state) this: i \<le> j goal (2 subgoals): 1. i * k \<le> j * k \<Longrightarrow> i \<le> j 2. i \<le> j \<L...
lemma word_mult_le_iff: fixes i :: "'a :: len word" assumes knz: "0 < k" and uik: "unat i * unat k < 2 ^ len_of TYPE ('a)" and ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)" shows "(i * k \<le> j * k) = (i \<le> j)"
unnamed_thy_163
More_Word
14
[]
lemma word_diff_less: fixes n :: "'a :: len word" shows "\<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> m - n < m" apply (subst word_less_nat_alt) apply (subst unat_sub) apply assumption apply (rule diff_less) apply (simp_all add: word_less_nat_alt) done
lemma word_diff_less: fixes n :: "'a :: len word" shows "\<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> m - n < m" apply (subst word_less_nat_alt) apply (subst unat_sub) apply assumption apply (rule diff_less) apply (simp_all add: word_less_nat_alt) done
proof (prove) goal (1 subgoal): 1. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> m - n < m proof (prove) goal (1 subgoal): 1. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> unat (m - n) < unat m proof (prove) goal (2 subgoals): 1. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow>...
lemma word_diff_less: fixes n :: "'a :: len word" shows "\<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> m - n < m"
unnamed_thy_164
More_Word
6
[]
lemma word_add_increasing: fixes x :: "'a :: len word" shows "\<lbrakk> p + w \<le> x; p \<le> p + w \<rbrakk> \<Longrightarrow> p \<le> x" by unat_arith
lemma word_add_increasing: fixes x :: "'a :: len word" shows "\<lbrakk> p + w \<le> x; p \<le> p + w \<rbrakk> \<Longrightarrow> p \<le> x" by unat_arith
proof (prove) goal (1 subgoal): 1. \<lbrakk>p + w \<le> x; p \<le> p + w\<rbrakk> \<Longrightarrow> p \<le> x
lemma word_add_increasing: fixes x :: "'a :: len word" shows "\<lbrakk> p + w \<le> x; p \<le> p + w \<rbrakk> \<Longrightarrow> p \<le> x"
unnamed_thy_165
More_Word
1
[]
lemma word_random: fixes x :: "'a :: len word" shows "\<lbrakk> p \<le> p + x'; x \<le> x' \<rbrakk> \<Longrightarrow> p \<le> p + x" by unat_arith
lemma word_random: fixes x :: "'a :: len word" shows "\<lbrakk> p \<le> p + x'; x \<le> x' \<rbrakk> \<Longrightarrow> p \<le> p + x" by unat_arith
proof (prove) goal (1 subgoal): 1. \<lbrakk>p \<le> p + x'; x \<le> x'\<rbrakk> \<Longrightarrow> p \<le> p + x
lemma word_random: fixes x :: "'a :: len word" shows "\<lbrakk> p \<le> p + x'; x \<le> x' \<rbrakk> \<Longrightarrow> p \<le> p + x"
unnamed_thy_166
More_Word
1
[]
lemma word_sub_mono: "\<lbrakk> a \<le> c; d \<le> b; a - b \<le> a; c - d \<le> c \<rbrakk> \<Longrightarrow> (a - b) \<le> (c - d :: 'a :: len word)" by unat_arith
lemma word_sub_mono: "\<lbrakk> a \<le> c; d \<le> b; a - b \<le> a; c - d \<le> c \<rbrakk> \<Longrightarrow> (a - b) \<le> (c - d :: 'a :: len word)" by unat_arith
proof (prove) goal (1 subgoal): 1. \<lbrakk>a \<le> c; d \<le> b; a - b \<le> a; c - d \<le> c\<rbrakk> \<Longrightarrow> a - b \<le> c - d
lemma word_sub_mono: "\<lbrakk> a \<le> c; d \<le> b; a - b \<le> a; c - d \<le> c \<rbrakk> \<Longrightarrow> (a - b) \<le> (c - d :: 'a :: len word)"
unnamed_thy_167
More_Word
1
[]
lemma power_not_zero: "n < LENGTH('a::len) \<Longrightarrow> (2 :: 'a word) ^ n \<noteq> 0" by (metis p2_gt_0 word_neq_0_conv)
lemma power_not_zero: "n < LENGTH('a::len) \<Longrightarrow> (2 :: 'a word) ^ n \<noteq> 0" by (metis p2_gt_0 word_neq_0_conv)
proof (prove) goal (1 subgoal): 1. n < LENGTH('a) \<Longrightarrow> 2 ^ n \<noteq> 0
lemma power_not_zero: "n < LENGTH('a::len) \<Longrightarrow> (2 :: 'a word) ^ n \<noteq> 0"
unnamed_thy_168
More_Word
1
[]
lemma word_gt_a_gt_0: "a < n \<Longrightarrow> (0 :: 'a::len word) < n" apply (case_tac "n = 0") apply clarsimp apply (clarsimp simp: word_neq_0_conv) done
lemma word_gt_a_gt_0: "a < n \<Longrightarrow> (0 :: 'a::len word) < n" apply (case_tac "n = 0") apply clarsimp apply (clarsimp simp: word_neq_0_conv) done
proof (prove) goal (1 subgoal): 1. a < n \<Longrightarrow> 0 < n proof (prove) goal (2 subgoals): 1. \<lbrakk>a < n; n = 0\<rbrakk> \<Longrightarrow> 0 < n 2. \<lbrakk>a < n; n \<noteq> 0\<rbrakk> \<Longrightarrow> 0 < n proof (prove) goal (1 subgoal): 1. \<lbrakk>a < n; n \<noteq> 0\<rbrakk> \<Longrightarrow> 0 < ...
lemma word_gt_a_gt_0: "a < n \<Longrightarrow> (0 :: 'a::len word) < n"
unnamed_thy_169
More_Word
4
[]
lemma word_power_less_1 [simp]: "sz < LENGTH('a::len) \<Longrightarrow> (2::'a word) ^ sz - 1 < 2 ^ sz" apply (simp add: word_less_nat_alt) apply (subst unat_minus_one) apply simp_all done
lemma word_power_less_1 [simp]: "sz < LENGTH('a::len) \<Longrightarrow> (2::'a word) ^ sz - 1 < 2 ^ sz" apply (simp add: word_less_nat_alt) apply (subst unat_minus_one) apply simp_all done
proof (prove) goal (1 subgoal): 1. sz < LENGTH('a) \<Longrightarrow> 2 ^ sz - 1 < 2 ^ sz proof (prove) goal (1 subgoal): 1. sz < LENGTH('a) \<Longrightarrow> unat (2 ^ sz - 1) < 2 ^ sz proof (prove) goal (2 subgoals): 1. sz < LENGTH('a) \<Longrightarrow> 2 ^ sz \<noteq> 0 2. sz < LENGTH('a) \<Longrightarrow> unat (...
lemma word_power_less_1 [simp]: "sz < LENGTH('a::len) \<Longrightarrow> (2::'a word) ^ sz - 1 < 2 ^ sz"
unnamed_thy_170
More_Word
4
[]
lemma word_sub_1_le: "x \<noteq> 0 \<Longrightarrow> x - 1 \<le> (x :: 'a :: len word)" apply (subst no_ulen_sub) apply simp apply (cases "uint x = 0") apply (simp add: uint_0_iff) apply (insert uint_ge_0[where x=x]) apply arith done
lemma word_sub_1_le: "x \<noteq> 0 \<Longrightarrow> x - 1 \<le> (x :: 'a :: len word)" apply (subst no_ulen_sub) apply simp apply (cases "uint x = 0") apply (simp add: uint_0_iff) apply (insert uint_ge_0[where x=x]) apply arith done
proof (prove) goal (1 subgoal): 1. x \<noteq> 0 \<Longrightarrow> x - 1 \<le> x proof (prove) goal (1 subgoal): 1. x \<noteq> 0 \<Longrightarrow> uint 1 \<le> uint x proof (prove) goal (1 subgoal): 1. x \<noteq> 0 \<Longrightarrow> 1 \<le> uint x proof (prove) goal (2 subgoals): 1. \<lbrakk>x \<noteq> 0; uint x = 0...
lemma word_sub_1_le: "x \<noteq> 0 \<Longrightarrow> x - 1 \<le> (x :: 'a :: len word)"
unnamed_thy_171
More_Word
7
[]
lemma push_bit_word_eq_nonzero: \<open>push_bit n w \<noteq> 0\<close> if \<open>w < 2 ^ m\<close> \<open>m + n < LENGTH('a)\<close> \<open>w \<noteq> 0\<close> for w :: \<open>'a::len word\<close> using that apply (simp only: word_neq_0_conv word_less_nat_alt mod_0 unat_word_ariths ...
lemma push_bit_word_eq_nonzero: \<open>push_bit n w \<noteq> 0\<close> if \<open>w < 2 ^ m\<close> \<open>m + n < LENGTH('a)\<close> \<open>w \<noteq> 0\<close> for w :: \<open>'a::len word\<close> using that apply (simp only: word_neq_0_conv word_less_nat_alt mod_0 unat_word_ariths ...
proof (prove) goal (1 subgoal): 1. push_bit n w \<noteq> 0 proof (prove) using this: w < 2 ^ m m + n < LENGTH('a) w \<noteq> 0 goal (1 subgoal): 1. push_bit n w \<noteq> 0 proof (prove) goal (1 subgoal): 1. \<lbrakk>unat w < 2 ^ m; m + n < LENGTH('a); 0 < unat w\<rbrakk> \<Longrightarrow> 0 < unat (push_bit n w) pr...
lemma push_bit_word_eq_nonzero: \<open>push_bit n w \<noteq> 0\<close> if \<open>w < 2 ^ m\<close> \<open>m + n < LENGTH('a)\<close> \<open>w \<noteq> 0\<close> for w :: \<open>'a::len word\<close>
unnamed_thy_172
More_Word
4
[]
lemma unat_less_power: fixes k :: "'a::len word" assumes szv: "sz < LENGTH('a)" and kv: "k < 2 ^ sz" shows "unat k < 2 ^ sz" using szv unat_mono [OF kv] by simp
lemma unat_less_power: fixes k :: "'a::len word" assumes szv: "sz < LENGTH('a)" and kv: "k < 2 ^ sz" shows "unat k < 2 ^ sz" using szv unat_mono [OF kv] by simp
proof (prove) goal (1 subgoal): 1. unat k < 2 ^ sz proof (prove) using this: sz < LENGTH('a) unat k < unat (2 ^ sz) goal (1 subgoal): 1. unat k < 2 ^ sz
lemma unat_less_power: fixes k :: "'a::len word" assumes szv: "sz < LENGTH('a)" and kv: "k < 2 ^ sz" shows "unat k < 2 ^ sz"
unnamed_thy_173
More_Word
2
[]
lemma unat_mult_power_lem: assumes kv: "k < 2 ^ (LENGTH('a::len) - sz)" shows "unat (2 ^ sz * of_nat k :: (('a::len) word)) = 2 ^ sz * k" proof (cases \<open>sz < LENGTH('a)\<close>) case True with assms show ?thesis by (simp add: unat_word_ariths take_bit_eq_mod mod_simps unsigned_of_nat) (simp add: take_bit...
lemma unat_mult_power_lem: assumes kv: "k < 2 ^ (LENGTH('a::len) - sz)" shows "unat (2 ^ sz * of_nat k :: (('a::len) word)) = 2 ^ sz * k" proof (cases \<open>sz < LENGTH('a)\<close>) case True with assms show ?thesis by (simp add: unat_word_ariths take_bit_eq_mod mod_simps unsigned_of_nat) (simp add: take_bit...
proof (prove) goal (1 subgoal): 1. unat (2 ^ sz * word_of_nat k) = 2 ^ sz * k proof (state) goal (2 subgoals): 1. sz < LENGTH('a) \<Longrightarrow> unat (2 ^ sz * word_of_nat k) = 2 ^ sz * k 2. \<not> sz < LENGTH('a) \<Longrightarrow> unat (2 ^ sz * word_of_nat k) = 2 ^ sz * k proof (state) this: sz < LENGTH('a) go...
lemma unat_mult_power_lem: assumes kv: "k < 2 ^ (LENGTH('a::len) - sz)" shows "unat (2 ^ sz * of_nat k :: (('a::len) word)) = 2 ^ sz * k"
unnamed_thy_174
More_Word
11
[]
lemma word_plus_mcs_4: "\<lbrakk>v + x \<le> w + x; x \<le> v + x\<rbrakk> \<Longrightarrow> v \<le> (w::'a::len word)" by uint_arith
lemma word_plus_mcs_4: "\<lbrakk>v + x \<le> w + x; x \<le> v + x\<rbrakk> \<Longrightarrow> v \<le> (w::'a::len word)" by uint_arith
proof (prove) goal (1 subgoal): 1. \<lbrakk>v + x \<le> w + x; x \<le> v + x\<rbrakk> \<Longrightarrow> v \<le> w
lemma word_plus_mcs_4: "\<lbrakk>v + x \<le> w + x; x \<le> v + x\<rbrakk> \<Longrightarrow> v \<le> (w::'a::len word)"
unnamed_thy_175
More_Word
1
[]
lemma word_plus_mcs_3: "\<lbrakk>v \<le> w; x \<le> w + x\<rbrakk> \<Longrightarrow> v + x \<le> w + (x::'a::len word)" by unat_arith
lemma word_plus_mcs_3: "\<lbrakk>v \<le> w; x \<le> w + x\<rbrakk> \<Longrightarrow> v + x \<le> w + (x::'a::len word)" by unat_arith
proof (prove) goal (1 subgoal): 1. \<lbrakk>v \<le> w; x \<le> w + x\<rbrakk> \<Longrightarrow> v + x \<le> w + x
lemma word_plus_mcs_3: "\<lbrakk>v \<le> w; x \<le> w + x\<rbrakk> \<Longrightarrow> v + x \<le> w + (x::'a::len word)"
unnamed_thy_176
More_Word
1
[]
lemma word_le_minus_one_leq: "x < y \<Longrightarrow> x \<le> y - 1" for x :: "'a :: len word" by transfer (metis le_less_trans less_irrefl take_bit_decr_eq take_bit_nonnegative zle_diff1_eq)
lemma word_le_minus_one_leq: "x < y \<Longrightarrow> x \<le> y - 1" for x :: "'a :: len word" by transfer (metis le_less_trans less_irrefl take_bit_decr_eq take_bit_nonnegative zle_diff1_eq)
proof (prove) goal (1 subgoal): 1. x < y \<Longrightarrow> x \<le> y - 1
lemma word_le_minus_one_leq: "x < y \<Longrightarrow> x \<le> y - 1" for x :: "'a :: len word"
unnamed_thy_177
More_Word
1
[]
lemma word_less_sub_le[simp]: fixes x :: "'a :: len word" assumes nv: "n < LENGTH('a)" shows "(x \<le> 2 ^ n - 1) = (x < 2 ^ n)" using le_less_trans word_le_minus_one_leq nv power_2_ge_iff by blast
lemma word_less_sub_le[simp]: fixes x :: "'a :: len word" assumes nv: "n < LENGTH('a)" shows "(x \<le> 2 ^ n - 1) = (x < 2 ^ n)" using le_less_trans word_le_minus_one_leq nv power_2_ge_iff by blast
proof (prove) goal (1 subgoal): 1. (x \<le> 2 ^ n - 1) = (x < 2 ^ n) proof (prove) using this: \<lbrakk>?x \<le> ?y; ?y < ?z\<rbrakk> \<Longrightarrow> ?x < ?z ?x < ?y \<Longrightarrow> ?x \<le> ?y - 1 n < LENGTH('a) (2 ^ ?n - 1 < 2 ^ ?n) = (?n < LENGTH(?'a)) goal (1 subgoal): 1. (x \<le> 2 ^ n - 1) = (x < 2 ^ n)
lemma word_less_sub_le[simp]: fixes x :: "'a :: len word" assumes nv: "n < LENGTH('a)" shows "(x \<le> 2 ^ n - 1) = (x < 2 ^ n)"
unnamed_thy_178
More_Word
2
[]
lemma unat_of_nat_len: "x < 2 ^ LENGTH('a) \<Longrightarrow> unat (of_nat x :: 'a::len word) = x" by (simp add: unsigned_of_nat take_bit_nat_eq_self_iff)
lemma unat_of_nat_len: "x < 2 ^ LENGTH('a) \<Longrightarrow> unat (of_nat x :: 'a::len word) = x" by (simp add: unsigned_of_nat take_bit_nat_eq_self_iff)
proof (prove) goal (1 subgoal): 1. x < 2 ^ LENGTH('a) \<Longrightarrow> unat (word_of_nat x) = x
lemma unat_of_nat_len: "x < 2 ^ LENGTH('a) \<Longrightarrow> unat (of_nat x :: 'a::len word) = x"
unnamed_thy_179
More_Word
1
[]
lemma unat_of_nat_eq: "x < 2 ^ LENGTH('a) \<Longrightarrow> unat (of_nat x ::'a::len word) = x" by (rule unat_of_nat_len)
lemma unat_of_nat_eq: "x < 2 ^ LENGTH('a) \<Longrightarrow> unat (of_nat x ::'a::len word) = x" by (rule unat_of_nat_len)
proof (prove) goal (1 subgoal): 1. x < 2 ^ LENGTH('a) \<Longrightarrow> unat (word_of_nat x) = x
lemma unat_of_nat_eq: "x < 2 ^ LENGTH('a) \<Longrightarrow> unat (of_nat x ::'a::len word) = x"
unnamed_thy_180
More_Word
1
[]
lemma unat_eq_of_nat: "n < 2 ^ LENGTH('a) \<Longrightarrow> (unat (x :: 'a::len word) = n) = (x = of_nat n)" by transfer (auto simp add: take_bit_of_nat nat_eq_iff take_bit_nat_eq_self_iff intro: sym)
lemma unat_eq_of_nat: "n < 2 ^ LENGTH('a) \<Longrightarrow> (unat (x :: 'a::len word) = n) = (x = of_nat n)" by transfer (auto simp add: take_bit_of_nat nat_eq_iff take_bit_nat_eq_self_iff intro: sym)
proof (prove) goal (1 subgoal): 1. n < 2 ^ LENGTH('a) \<Longrightarrow> (unat x = n) = (x = word_of_nat n)
lemma unat_eq_of_nat: "n < 2 ^ LENGTH('a) \<Longrightarrow> (unat (x :: 'a::len word) = n) = (x = of_nat n)"
unnamed_thy_181
More_Word
1
[]
lemma alignUp_div_helper: fixes a :: "'a::len word" assumes kv: "k < 2 ^ (LENGTH('a) - n)" and xk: "x = 2 ^ n * of_nat k" and le: "a \<le> x" and sz: "n < LENGTH('a)" and anz: "a mod 2 ^ n \<noteq> 0" shows "a div 2 ^ n < of_nat k" proof - have kn: "unat (of_nat k :: 'a word) * unat ((2::'a wo...
lemma alignUp_div_helper: fixes a :: "'a::len word" assumes kv: "k < 2 ^ (LENGTH('a) - n)" and xk: "x = 2 ^ n * of_nat k" and le: "a \<le> x" and sz: "n < LENGTH('a)" and anz: "a mod 2 ^ n \<noteq> 0" shows "a div 2 ^ n < of_nat k" proof - have kn: "unat (of_nat k :: 'a word) * unat ((2::'a wo...
proof (prove) goal (1 subgoal): 1. a div 2 ^ n < word_of_nat k proof (state) goal (1 subgoal): 1. a div 2 ^ n < word_of_nat k proof (prove) goal (1 subgoal): 1. unat (word_of_nat k) * unat (2 ^ n) < 2 ^ LENGTH('a) proof (prove) using this: x = 2 ^ n * word_of_nat k k < 2 ^ (LENGTH('a) - n) n < LENGTH('a) goal (1 su...
lemma alignUp_div_helper: fixes a :: "'a::len word" assumes kv: "k < 2 ^ (LENGTH('a) - n)" and xk: "x = 2 ^ n * of_nat k" and le: "a \<le> x" and sz: "n < LENGTH('a)" and anz: "a mod 2 ^ n \<noteq> 0" shows "a div 2 ^ n < of_nat k"
unnamed_thy_182
More_Word
48
[]
lemma mask_out_sub_mask: "(x AND NOT (mask n)) = x - (x AND (mask n))" for x :: \<open>'a::len word\<close> by (fact and_not_eq_minus_and)
lemma mask_out_sub_mask: "(x AND NOT (mask n)) = x - (x AND (mask n))" for x :: \<open>'a::len word\<close> by (fact and_not_eq_minus_and)
proof (prove) goal (1 subgoal): 1. x AND NOT (mask n) = x - (x AND mask n)
lemma mask_out_sub_mask: "(x AND NOT (mask n)) = x - (x AND (mask n))" for x :: \<open>'a::len word\<close>
unnamed_thy_183
More_Word
1
[]
lemma subtract_mask: "p - (p AND mask n) = (p AND NOT (mask n))" "p - (p AND NOT (mask n)) = (p AND mask n)" for p :: \<open>'a::len word\<close> by (auto simp: and_not_eq_minus_and)
lemma subtract_mask: "p - (p AND mask n) = (p AND NOT (mask n))" "p - (p AND NOT (mask n)) = (p AND mask n)" for p :: \<open>'a::len word\<close> by (auto simp: and_not_eq_minus_and)
proof (prove) goal (1 subgoal): 1. p - (p AND mask n) = p AND NOT (mask n) &&& p - (p AND NOT (mask n)) = p AND mask n
lemma subtract_mask: "p - (p AND mask n) = (p AND NOT (mask n))" "p - (p AND NOT (mask n)) = (p AND mask n)" for p :: \<open>'a::len word\<close>
unnamed_thy_184
More_Word
1
[]
lemma take_bit_word_eq_self_iff: \<open>take_bit n w = w \<longleftrightarrow> n \<ge> LENGTH('a) \<or> w < 2 ^ n\<close> for w :: \<open>'a::len word\<close> using take_bit_int_eq_self_iff [of n \<open>take_bit LENGTH('a) (uint w)\<close>] by (transfer fixing: n) auto
lemma take_bit_word_eq_self_iff: \<open>take_bit n w = w \<longleftrightarrow> n \<ge> LENGTH('a) \<or> w < 2 ^ n\<close> for w :: \<open>'a::len word\<close> using take_bit_int_eq_self_iff [of n \<open>take_bit LENGTH('a) (uint w)\<close>] by (transfer fixing: n) auto
proof (prove) goal (1 subgoal): 1. (take_bit n w = w) = (LENGTH('a) \<le> n \<or> w < 2 ^ n) proof (prove) using this: (take_bit n (take_bit LENGTH('a) (uint w)) = take_bit LENGTH('a) (uint w)) = (0 \<le> take_bit LENGTH('a) (uint w) \<and> take_bit LENGTH('a) (uint w) < 2 ^ n) goal (1 subgoal): 1. (take_bit n w = w...
lemma take_bit_word_eq_self_iff: \<open>take_bit n w = w \<longleftrightarrow> n \<ge> LENGTH('a) \<or> w < 2 ^ n\<close> for w :: \<open>'a::len word\<close>
unnamed_thy_185
More_Word
2
[]
lemma word_power_increasing: assumes x: "2 ^ x < (2 ^ y::'a::len word)" "x < LENGTH('a)" "y < LENGTH('a)" shows "x < y" using x using assms by transfer simp
lemma word_power_increasing: assumes x: "2 ^ x < (2 ^ y::'a::len word)" "x < LENGTH('a)" "y < LENGTH('a)" shows "x < y" using x using assms by transfer simp
proof (prove) goal (1 subgoal): 1. x < y proof (prove) using this: 2 ^ x < 2 ^ y x < LENGTH('a) y < LENGTH('a) goal (1 subgoal): 1. x < y proof (prove) using this: 2 ^ x < 2 ^ y x < LENGTH('a) y < LENGTH('a) 2 ^ x < 2 ^ y x < LENGTH('a) y < LENGTH('a) goal (1 subgoal): 1. x < y
lemma word_power_increasing: assumes x: "2 ^ x < (2 ^ y::'a::len word)" "x < LENGTH('a)" "y < LENGTH('a)" shows "x < y"
unnamed_thy_186
More_Word
3
[]
lemma plus_one_helper[elim!]: "x < n + (1 :: 'a :: len word) \<Longrightarrow> x \<le> n" apply (simp add: word_less_nat_alt word_le_nat_alt field_simps) apply (case_tac "1 + n = 0") apply simp_all apply (subst(asm) unatSuc, assumption) apply arith done
lemma plus_one_helper[elim!]: "x < n + (1 :: 'a :: len word) \<Longrightarrow> x \<le> n" apply (simp add: word_less_nat_alt word_le_nat_alt field_simps) apply (case_tac "1 + n = 0") apply simp_all apply (subst(asm) unatSuc, assumption) apply arith done
proof (prove) goal (1 subgoal): 1. x < n + 1 \<Longrightarrow> x \<le> n proof (prove) goal (1 subgoal): 1. unat x < unat (1 + n) \<Longrightarrow> unat x \<le> unat n proof (prove) goal (2 subgoals): 1. \<lbrakk>unat x < unat (1 + n); 1 + n = 0\<rbrakk> \<Longrightarrow> unat x \<le> unat n 2. \<lbrakk>unat x < un...
lemma plus_one_helper[elim!]: "x < n + (1 :: 'a :: len word) \<Longrightarrow> x \<le> n"
unnamed_thy_188
More_Word
6
[]
lemma plus_one_helper2: "\<lbrakk> x \<le> n; n + 1 \<noteq> 0 \<rbrakk> \<Longrightarrow> x < n + (1 :: 'a :: len word)" by (simp add: word_less_nat_alt word_le_nat_alt field_simps unatSuc)
lemma plus_one_helper2: "\<lbrakk> x \<le> n; n + 1 \<noteq> 0 \<rbrakk> \<Longrightarrow> x < n + (1 :: 'a :: len word)" by (simp add: word_less_nat_alt word_le_nat_alt field_simps unatSuc)
proof (prove) goal (1 subgoal): 1. \<lbrakk>x \<le> n; n + 1 \<noteq> 0\<rbrakk> \<Longrightarrow> x < n + 1
lemma plus_one_helper2: "\<lbrakk> x \<le> n; n + 1 \<noteq> 0 \<rbrakk> \<Longrightarrow> x < n + (1 :: 'a :: len word)"
unnamed_thy_189
More_Word
1
[]
lemma less_x_plus_1: "x \<noteq> - 1 \<Longrightarrow> (y < x + 1) = (y < x \<or> y = x)" for x :: "'a::len word" by (meson max_word_wrap plus_one_helper plus_one_helper2 word_le_less_eq)
lemma less_x_plus_1: "x \<noteq> - 1 \<Longrightarrow> (y < x + 1) = (y < x \<or> y = x)" for x :: "'a::len word" by (meson max_word_wrap plus_one_helper plus_one_helper2 word_le_less_eq)
proof (prove) goal (1 subgoal): 1. x \<noteq> - 1 \<Longrightarrow> (y < x + 1) = (y < x \<or> y = x)
lemma less_x_plus_1: "x \<noteq> - 1 \<Longrightarrow> (y < x + 1) = (y < x \<or> y = x)" for x :: "'a::len word"
unnamed_thy_190
More_Word
1
[]
lemma word_Suc_leq: fixes k::"'a::len word" shows "k \<noteq> - 1 \<Longrightarrow> x < k + 1 \<longleftrightarrow> x \<le> k" using less_x_plus_1 word_le_less_eq by auto
lemma word_Suc_leq: fixes k::"'a::len word" shows "k \<noteq> - 1 \<Longrightarrow> x < k + 1 \<longleftrightarrow> x \<le> k" using less_x_plus_1 word_le_less_eq by auto
proof (prove) goal (1 subgoal): 1. k \<noteq> - 1 \<Longrightarrow> (x < k + 1) = (x \<le> k) proof (prove) using this: ?x \<noteq> - 1 \<Longrightarrow> (?y < ?x + 1) = (?y < ?x \<or> ?y = ?x) (?x \<le> ?y) = (?x = ?y \<or> ?x < ?y) goal (1 subgoal): 1. k \<noteq> - 1 \<Longrightarrow> (x < k + 1) = (x \<le> k)
lemma word_Suc_leq: fixes k::"'a::len word" shows "k \<noteq> - 1 \<Longrightarrow> x < k + 1 \<longleftrightarrow> x \<le> k"
unnamed_thy_191
More_Word
2
[]
lemma word_Suc_le: fixes k::"'a::len word" shows "x \<noteq> - 1 \<Longrightarrow> x + 1 \<le> k \<longleftrightarrow> x < k" by (meson not_less word_Suc_leq)
lemma word_Suc_le: fixes k::"'a::len word" shows "x \<noteq> - 1 \<Longrightarrow> x + 1 \<le> k \<longleftrightarrow> x < k" by (meson not_less word_Suc_leq)
proof (prove) goal (1 subgoal): 1. x \<noteq> - 1 \<Longrightarrow> (x + 1 \<le> k) = (x < k)
lemma word_Suc_le: fixes k::"'a::len word" shows "x \<noteq> - 1 \<Longrightarrow> x + 1 \<le> k \<longleftrightarrow> x < k"
unnamed_thy_192
More_Word
1
[]
lemma word_lessThan_Suc_atMost: \<open>{..< k + 1} = {..k}\<close> if \<open>k \<noteq> - 1\<close> for k :: \<open>'a::len word\<close> using that by (simp add: lessThan_def atMost_def word_Suc_leq)
lemma word_lessThan_Suc_atMost: \<open>{..< k + 1} = {..k}\<close> if \<open>k \<noteq> - 1\<close> for k :: \<open>'a::len word\<close> using that by (simp add: lessThan_def atMost_def word_Suc_leq)
proof (prove) goal (1 subgoal): 1. {..<k + 1} = {..k} proof (prove) using this: k \<noteq> - 1 goal (1 subgoal): 1. {..<k + 1} = {..k}
lemma word_lessThan_Suc_atMost: \<open>{..< k + 1} = {..k}\<close> if \<open>k \<noteq> - 1\<close> for k :: \<open>'a::len word\<close>
unnamed_thy_193
More_Word
2
[]
lemma word_atLeastLessThan_Suc_atLeastAtMost: \<open>{l ..< u + 1} = {l..u}\<close> if \<open>u \<noteq> - 1\<close> for l :: \<open>'a::len word\<close> using that by (simp add: atLeastAtMost_def atLeastLessThan_def word_lessThan_Suc_atMost)
lemma word_atLeastLessThan_Suc_atLeastAtMost: \<open>{l ..< u + 1} = {l..u}\<close> if \<open>u \<noteq> - 1\<close> for l :: \<open>'a::len word\<close> using that by (simp add: atLeastAtMost_def atLeastLessThan_def word_lessThan_Suc_atMost)
proof (prove) goal (1 subgoal): 1. {l..<u + 1} = {l..u} proof (prove) using this: u \<noteq> - 1 goal (1 subgoal): 1. {l..<u + 1} = {l..u}
lemma word_atLeastLessThan_Suc_atLeastAtMost: \<open>{l ..< u + 1} = {l..u}\<close> if \<open>u \<noteq> - 1\<close> for l :: \<open>'a::len word\<close>
unnamed_thy_194
More_Word
2
[]
lemma word_atLeastAtMost_Suc_greaterThanAtMost: \<open>{m<..u} = {m + 1..u}\<close> if \<open>m \<noteq> - 1\<close> for m :: \<open>'a::len word\<close> using that by (simp add: greaterThanAtMost_def greaterThan_def atLeastAtMost_def atLeast_def word_Suc_le)
lemma word_atLeastAtMost_Suc_greaterThanAtMost: \<open>{m<..u} = {m + 1..u}\<close> if \<open>m \<noteq> - 1\<close> for m :: \<open>'a::len word\<close> using that by (simp add: greaterThanAtMost_def greaterThan_def atLeastAtMost_def atLeast_def word_Suc_le)
proof (prove) goal (1 subgoal): 1. {m<..u} = {m + 1..u} proof (prove) using this: m \<noteq> - 1 goal (1 subgoal): 1. {m<..u} = {m + 1..u}
lemma word_atLeastAtMost_Suc_greaterThanAtMost: \<open>{m<..u} = {m + 1..u}\<close> if \<open>m \<noteq> - 1\<close> for m :: \<open>'a::len word\<close>
unnamed_thy_195
More_Word
2
[]
lemma word_atLeastLessThan_Suc_atLeastAtMost_union: fixes l::"'a::len word" assumes "m \<noteq> - 1" and "l \<le> m" and "m \<le> u" shows "{l..m} \<union> {m+1..u} = {l..u}" proof - from ivl_disj_un_two(8)[OF assms(2) assms(3)] have "{l..u} = {l..m} \<union> {m<..u}" by blast with assms show ?thesis by(simp add:...
lemma word_atLeastLessThan_Suc_atLeastAtMost_union: fixes l::"'a::len word" assumes "m \<noteq> - 1" and "l \<le> m" and "m \<le> u" shows "{l..m} \<union> {m+1..u} = {l..u}" proof - from ivl_disj_un_two(8)[OF assms(2) assms(3)] have "{l..u} = {l..m} \<union> {m<..u}" by blast with assms show ?thesis by(simp add:...
proof (prove) goal (1 subgoal): 1. {l..m} \<union> {m + 1..u} = {l..u} proof (state) goal (1 subgoal): 1. {l..m} \<union> {m + 1..u} = {l..u} proof (chain) picking this: {l..m} \<union> {m<..u} = {l..u} proof (prove) using this: {l..m} \<union> {m<..u} = {l..u} goal (1 subgoal): 1. {l..u} = {l..m} \<union> {m<..u} ...
lemma word_atLeastLessThan_Suc_atLeastAtMost_union: fixes l::"'a::len word" assumes "m \<noteq> - 1" and "l \<le> m" and "m \<le> u" shows "{l..m} \<union> {m+1..u} = {l..u}"
unnamed_thy_196
More_Word
8
[]
lemma max_word_less_eq_iff [simp]: \<open>- 1 \<le> w \<longleftrightarrow> w = - 1\<close> for w :: \<open>'a::len word\<close> by (fact word_order.extremum_unique)
lemma max_word_less_eq_iff [simp]: \<open>- 1 \<le> w \<longleftrightarrow> w = - 1\<close> for w :: \<open>'a::len word\<close> by (fact word_order.extremum_unique)
proof (prove) goal (1 subgoal): 1. (- 1 \<le> w) = (w = - 1)
lemma max_word_less_eq_iff [simp]: \<open>- 1 \<le> w \<longleftrightarrow> w = - 1\<close> for w :: \<open>'a::len word\<close>
unnamed_thy_197
More_Word
1
[]
lemma word_or_zero: "(a OR b = 0) = (a = 0 \<and> b = 0)" for a b :: \<open>'a::len word\<close> by (fact or_eq_0_iff)
lemma word_or_zero: "(a OR b = 0) = (a = 0 \<and> b = 0)" for a b :: \<open>'a::len word\<close> by (fact or_eq_0_iff)
proof (prove) goal (1 subgoal): 1. (a OR b = 0) = (a = 0 \<and> b = 0)
lemma word_or_zero: "(a OR b = 0) = (a = 0 \<and> b = 0)" for a b :: \<open>'a::len word\<close>
unnamed_thy_198
More_Word
1
[]
lemma word_2p_mult_inc: assumes x: "2 * 2 ^ n < (2::'a::len word) * 2 ^ m" assumes suc_n: "Suc n < LENGTH('a::len)" shows "2^n < (2::'a::len word)^m" by (smt suc_n le_less_trans lessI nat_less_le nat_mult_less_cancel_disj p2_gt_0 power_Suc power_Suc unat_power_lower word_less_nat_alt x)
lemma word_2p_mult_inc: assumes x: "2 * 2 ^ n < (2::'a::len word) * 2 ^ m" assumes suc_n: "Suc n < LENGTH('a::len)" shows "2^n < (2::'a::len word)^m" by (smt suc_n le_less_trans lessI nat_less_le nat_mult_less_cancel_disj p2_gt_0 power_Suc power_Suc unat_power_lower word_less_nat_alt x)
proof (prove) goal (1 subgoal): 1. 2 ^ n < 2 ^ m
lemma word_2p_mult_inc: assumes x: "2 * 2 ^ n < (2::'a::len word) * 2 ^ m" assumes suc_n: "Suc n < LENGTH('a::len)" shows "2^n < (2::'a::len word)^m"
unnamed_thy_199
More_Word
1
[]
lemma power_overflow: "n \<ge> LENGTH('a) \<Longrightarrow> 2 ^ n = (0 :: 'a::len word)" by simp
lemma power_overflow: "n \<ge> LENGTH('a) \<Longrightarrow> 2 ^ n = (0 :: 'a::len word)" by simp
proof (prove) goal (1 subgoal): 1. LENGTH('a) \<le> n \<Longrightarrow> 2 ^ n = 0
lemma power_overflow: "n \<ge> LENGTH('a) \<Longrightarrow> 2 ^ n = (0 :: 'a::len word)"
unnamed_thy_200
More_Word
1
[]
lemma word_sint_1: "sint (1::'a::len word) = (if LENGTH('a) = 1 then -1 else 1)" by (fact signed_1)
lemma word_sint_1: "sint (1::'a::len word) = (if LENGTH('a) = 1 then -1 else 1)" by (fact signed_1)
proof (prove) goal (1 subgoal): 1. sint 1 = (if LENGTH('a) = 1 then - 1 else 1)
lemma word_sint_1: "sint (1::'a::len word) = (if LENGTH('a) = 1 then -1 else 1)"
unnamed_thy_201
More_Word
1
[]
lemma ucast_of_nat: "is_down (ucast :: 'a :: len word \<Rightarrow> 'b :: len word) \<Longrightarrow> ucast (of_nat n :: 'a word) = (of_nat n :: 'b word)" by transfer simp
lemma ucast_of_nat: "is_down (ucast :: 'a :: len word \<Rightarrow> 'b :: len word) \<Longrightarrow> ucast (of_nat n :: 'a word) = (of_nat n :: 'b word)" by transfer simp
proof (prove) goal (1 subgoal): 1. is_down ucast \<Longrightarrow> ucast (word_of_nat n) = word_of_nat n
lemma ucast_of_nat: "is_down (ucast :: 'a :: len word \<Rightarrow> 'b :: len word) \<Longrightarrow> ucast (of_nat n :: 'a word) = (of_nat n :: 'b word)"
unnamed_thy_202
More_Word
1
[]
lemma scast_1': "(scast (1::'a::len word) :: 'b::len word) = (word_of_int (signed_take_bit (LENGTH('a::len) - Suc 0) (1::int)))" by transfer simp
lemma scast_1': "(scast (1::'a::len word) :: 'b::len word) = (word_of_int (signed_take_bit (LENGTH('a::len) - Suc 0) (1::int)))" by transfer simp
proof (prove) goal (1 subgoal): 1. scast 1 = word_of_int (signed_take_bit (LENGTH('a) - Suc 0) 1)
lemma scast_1': "(scast (1::'a::len word) :: 'b::len word) = (word_of_int (signed_take_bit (LENGTH('a::len) - Suc 0) (1::int)))"
unnamed_thy_203
More_Word
1
[]
lemma scast_1: "(scast (1::'a::len word) :: 'b::len word) = (if LENGTH('a) = 1 then -1 else 1)" by (fact signed_1)
lemma scast_1: "(scast (1::'a::len word) :: 'b::len word) = (if LENGTH('a) = 1 then -1 else 1)" by (fact signed_1)
proof (prove) goal (1 subgoal): 1. scast 1 = (if LENGTH('a) = 1 then - 1 else 1)
lemma scast_1: "(scast (1::'a::len word) :: 'b::len word) = (if LENGTH('a) = 1 then -1 else 1)"
unnamed_thy_204
More_Word
1
[]
lemma unat_minus_one_word: "unat (-1 :: 'a :: len word) = 2 ^ LENGTH('a) - 1" by (simp add: mask_eq_exp_minus_1 unsigned_minus_1_eq_mask)
lemma unat_minus_one_word: "unat (-1 :: 'a :: len word) = 2 ^ LENGTH('a) - 1" by (simp add: mask_eq_exp_minus_1 unsigned_minus_1_eq_mask)
proof (prove) goal (1 subgoal): 1. unat (- 1) = 2 ^ LENGTH('a) - 1
lemma unat_minus_one_word: "unat (-1 :: 'a :: len word) = 2 ^ LENGTH('a) - 1"
unnamed_thy_205
More_Word
1
[]
lemma two_power_increasing: "\<lbrakk> n \<le> m; m < LENGTH('a) \<rbrakk> \<Longrightarrow> (2 :: 'a :: len word) ^ n \<le> 2 ^ m" by (simp add: word_le_nat_alt)
lemma two_power_increasing: "\<lbrakk> n \<le> m; m < LENGTH('a) \<rbrakk> \<Longrightarrow> (2 :: 'a :: len word) ^ n \<le> 2 ^ m" by (simp add: word_le_nat_alt)
proof (prove) goal (1 subgoal): 1. \<lbrakk>n \<le> m; m < LENGTH('a)\<rbrakk> \<Longrightarrow> 2 ^ n \<le> 2 ^ m
lemma two_power_increasing: "\<lbrakk> n \<le> m; m < LENGTH('a) \<rbrakk> \<Longrightarrow> (2 :: 'a :: len word) ^ n \<le> 2 ^ m"
unnamed_thy_206
More_Word
1
[]
lemma word_leq_le_minus_one: "\<lbrakk> x \<le> y; x \<noteq> 0 \<rbrakk> \<Longrightarrow> x - 1 < (y :: 'a :: len word)" apply (simp add: word_less_nat_alt word_le_nat_alt) apply (subst unat_minus_one) apply assumption apply (cases "unat x") apply (simp add: unat_eq_zero) apply arith done
lemma word_leq_le_minus_one: "\<lbrakk> x \<le> y; x \<noteq> 0 \<rbrakk> \<Longrightarrow> x - 1 < (y :: 'a :: len word)" apply (simp add: word_less_nat_alt word_le_nat_alt) apply (subst unat_minus_one) apply assumption apply (cases "unat x") apply (simp add: unat_eq_zero) apply arith done
proof (prove) goal (1 subgoal): 1. \<lbrakk>x \<le> y; x \<noteq> 0\<rbrakk> \<Longrightarrow> x - 1 < y proof (prove) goal (1 subgoal): 1. \<lbrakk>unat x \<le> unat y; x \<noteq> 0\<rbrakk> \<Longrightarrow> unat (x - 1) < unat y proof (prove) goal (2 subgoals): 1. \<lbrakk>unat x \<le> unat y; x \<noteq> 0\<rbrak...
lemma word_leq_le_minus_one: "\<lbrakk> x \<le> y; x \<noteq> 0 \<rbrakk> \<Longrightarrow> x - 1 < (y :: 'a :: len word)"
unnamed_thy_207
More_Word
7
[]
lemma neg_mask_combine: "NOT(mask a) AND NOT(mask b) = NOT(mask (max a b) :: 'a::len word)" by (rule bit_word_eqI) (auto simp add: bit_simps)
lemma neg_mask_combine: "NOT(mask a) AND NOT(mask b) = NOT(mask (max a b) :: 'a::len word)" by (rule bit_word_eqI) (auto simp add: bit_simps)
proof (prove) goal (1 subgoal): 1. NOT (mask a) AND NOT (mask b) = NOT (mask (max a b))
lemma neg_mask_combine: "NOT(mask a) AND NOT(mask b) = NOT(mask (max a b) :: 'a::len word)"
unnamed_thy_208
More_Word
1
[]
lemma neg_mask_twice: "x AND NOT(mask n) AND NOT(mask m) = x AND NOT(mask (max n m))" for x :: \<open>'a::len word\<close> by (rule bit_word_eqI) (auto simp add: bit_simps)
lemma neg_mask_twice: "x AND NOT(mask n) AND NOT(mask m) = x AND NOT(mask (max n m))" for x :: \<open>'a::len word\<close> by (rule bit_word_eqI) (auto simp add: bit_simps)
proof (prove) goal (1 subgoal): 1. x AND NOT (mask n) AND NOT (mask m) = x AND NOT (mask (max n m))
lemma neg_mask_twice: "x AND NOT(mask n) AND NOT(mask m) = x AND NOT(mask (max n m))" for x :: \<open>'a::len word\<close>
unnamed_thy_209
More_Word
1
[]
lemma multiple_mask_trivia: "n \<ge> m \<Longrightarrow> (x AND NOT(mask n)) + (x AND mask n AND NOT(mask m)) = x AND NOT(mask m)" for x :: \<open>'a::len word\<close> apply (rule trans[rotated], rule_tac w="mask n" in word_plus_and_or_coroll2) apply (simp add: word_bw_assocs word_bw_comms word_bw_lcs neg_mask_twic...
lemma multiple_mask_trivia: "n \<ge> m \<Longrightarrow> (x AND NOT(mask n)) + (x AND mask n AND NOT(mask m)) = x AND NOT(mask m)" for x :: \<open>'a::len word\<close> apply (rule trans[rotated], rule_tac w="mask n" in word_plus_and_or_coroll2) apply (simp add: word_bw_assocs word_bw_comms word_bw_lcs neg_mask_twic...
proof (prove) goal (1 subgoal): 1. m \<le> n \<Longrightarrow> (x AND NOT (mask n)) + (x AND mask n AND NOT (mask m)) = x AND NOT (mask m) proof (prove) goal (1 subgoal): 1. m \<le> n \<Longrightarrow> (x AND NOT (mask n)) + (x AND mask n AND NOT (mask m)) = ((x AND NOT (mask m)) AND mask n) + ((x AND NOT (mask m)) A...
lemma multiple_mask_trivia: "n \<ge> m \<Longrightarrow> (x AND NOT(mask n)) + (x AND mask n AND NOT(mask m)) = x AND NOT(mask m)" for x :: \<open>'a::len word\<close>
unnamed_thy_210
More_Word
3
[]
lemma word_of_nat_less: "\<lbrakk> n < unat x \<rbrakk> \<Longrightarrow> of_nat n < x" apply (simp add: word_less_nat_alt) apply (erule order_le_less_trans[rotated]) apply (simp add: unsigned_of_nat take_bit_eq_mod) done
lemma word_of_nat_less: "\<lbrakk> n < unat x \<rbrakk> \<Longrightarrow> of_nat n < x" apply (simp add: word_less_nat_alt) apply (erule order_le_less_trans[rotated]) apply (simp add: unsigned_of_nat take_bit_eq_mod) done
proof (prove) goal (1 subgoal): 1. n < unat x \<Longrightarrow> word_of_nat n < x proof (prove) goal (1 subgoal): 1. n < unat x \<Longrightarrow> unat (word_of_nat n) < unat x proof (prove) goal (1 subgoal): 1. unat (word_of_nat n) \<le> n proof (prove) goal: No subgoals!
lemma word_of_nat_less: "\<lbrakk> n < unat x \<rbrakk> \<Longrightarrow> of_nat n < x"
unnamed_thy_211
More_Word
4
[]
lemma unat_mask: "unat (mask n :: 'a :: len word) = 2 ^ (min n (LENGTH('a))) - 1" apply (subst min.commute) apply (simp add: mask_eq_decr_exp not_less min_def split: if_split_asm) apply (intro conjI impI) apply (simp add: unat_sub_if_size) apply (simp add: power_overflow word_size) apply (simp add: unat_sub_if_size)...
lemma unat_mask: "unat (mask n :: 'a :: len word) = 2 ^ (min n (LENGTH('a))) - 1" apply (subst min.commute) apply (simp add: mask_eq_decr_exp not_less min_def split: if_split_asm) apply (intro conjI impI) apply (simp add: unat_sub_if_size) apply (simp add: power_overflow word_size) apply (simp add: unat_sub_if_size)...
proof (prove) goal (1 subgoal): 1. unat (mask n) = 2 ^ min n LENGTH('a) - 1 proof (prove) goal (1 subgoal): 1. unat (mask n) = 2 ^ min LENGTH('a) n - 1 proof (prove) goal (1 subgoal): 1. (LENGTH('a) \<le> n \<longrightarrow> unat (2 ^ n - 1) = 2 ^ LENGTH('a) - Suc 0) \<and> (\<not> LENGTH('a) \<le> n \<longrightarro...
lemma unat_mask: "unat (mask n :: 'a :: len word) = 2 ^ (min n (LENGTH('a))) - 1"
unnamed_thy_212
More_Word
7