161 |
161 |
162 lemma bin_nth_Bit: "bin_nth (w BIT b) n \<longleftrightarrow> n = 0 \<and> b \<or> (\<exists>m. n = Suc m \<and> bin_nth w m)" |
162 lemma bin_nth_Bit: "bin_nth (w BIT b) n \<longleftrightarrow> n = 0 \<and> b \<or> (\<exists>m. n = Suc m \<and> bin_nth w m)" |
163 by (cases n) auto |
163 by (cases n) auto |
164 |
164 |
165 lemmas sbintrunc_Suc_BIT [simp] = |
165 lemmas sbintrunc_Suc_BIT [simp] = |
166 sbintrunc.Suc [where bin="w BIT b", simplified bin_last_BIT bin_rest_BIT] for w b |
166 signed_take_bit_Suc [where k="w BIT b", simplified bin_last_BIT bin_rest_BIT] for w b |
167 |
167 |
168 lemmas sbintrunc_0_BIT_B0 [simp] = |
168 lemmas sbintrunc_0_BIT_B0 [simp] = |
169 sbintrunc.Z [where bin="w BIT False", simplified bin_last_numeral_simps bin_rest_numeral_simps] |
169 signed_take_bit_0 [where k="w BIT False", simplified bin_last_numeral_simps bin_rest_numeral_simps] |
170 for w |
170 for w |
171 |
171 |
172 lemmas sbintrunc_0_BIT_B1 [simp] = |
172 lemmas sbintrunc_0_BIT_B1 [simp] = |
173 sbintrunc.Z [where bin="w BIT True", simplified bin_last_BIT bin_rest_numeral_simps] |
173 signed_take_bit_0 [where k="w BIT True", simplified bin_last_BIT bin_rest_numeral_simps] |
174 for w |
174 for w |
175 |
175 |
176 lemma sbintrunc_Suc_minus_Is: |
176 lemma sbintrunc_Suc_minus_Is: |
177 \<open>0 < n \<Longrightarrow> |
177 \<open>0 < n \<Longrightarrow> |
178 sbintrunc (n - 1) w = y \<Longrightarrow> |
178 sbintrunc (n - 1) w = y \<Longrightarrow> |
179 sbintrunc n (w BIT b) = y BIT b\<close> |
179 sbintrunc n (w BIT b) = y BIT b\<close> |
180 by (cases n) (simp_all add: Bit_def) |
180 by (cases n) (simp_all add: Bit_def signed_take_bit_Suc) |
181 |
181 |
182 lemma bin_cat_Suc_Bit: "bin_cat w (Suc n) (v BIT b) = bin_cat w n v BIT b" |
182 lemma bin_cat_Suc_Bit: "bin_cat w (Suc n) (v BIT b) = bin_cat w n v BIT b" |
183 by (auto simp add: Bit_def) |
183 by (auto simp add: Bit_def) |
184 |
184 |
185 lemma int_not_BIT [simp]: "NOT (w BIT b) = (NOT w) BIT (\<not> b)" |
185 lemma int_not_BIT [simp]: "NOT (w BIT b) = (NOT w) BIT (\<not> b)" |