add simp rules for bin_rest and bin_last applied to numerals
authorhuffman
Tue, 13 Dec 2011 13:21:48 +0100
changeset 45851 19f7ac6cf3cc
parent 45850 50488b8abd58
child 45852 24f563d94497
add simp rules for bin_rest and bin_last applied to numerals
src/HOL/Word/Bit_Representation.thy
--- a/src/HOL/Word/Bit_Representation.thy	Tue Dec 13 13:10:25 2011 +0100
+++ b/src/HOL/Word/Bit_Representation.thy	Tue Dec 13 13:21:48 2011 +0100
@@ -55,6 +55,22 @@
   shows "0 BIT 0 = 0" and "0 BIT 1 = 1" and "1 BIT 0 = 2" and "1 BIT 1 = 3"
   unfolding Bit_def by simp_all
 
+lemma bin_last_numeral_simps [simp]:
+  "bin_last 0 = 0"
+  "bin_last 1 = 1"
+  "bin_last -1 = 1"
+  "bin_last (number_of (Int.Bit0 w)) = 0"
+  "bin_last (number_of (Int.Bit1 w)) = 1"
+  unfolding bin_last_def by simp_all
+
+lemma bin_rest_numeral_simps [simp]:
+  "bin_rest 0 = 0"
+  "bin_rest 1 = 0"
+  "bin_rest -1 = -1"
+  "bin_rest (number_of (Int.Bit0 w)) = number_of w"
+  "bin_rest (number_of (Int.Bit1 w)) = number_of w"
+  unfolding bin_rest_def by simp_all
+
 lemma BIT_B0_eq_Bit0: "w BIT 0 = Int.Bit0 w"
   unfolding Bit_def Bit0_def by simp
 
@@ -207,17 +223,6 @@
   "bin_last (w BIT b) = b"
   using bin_rl_simps bin_rl_def by auto
 
-lemma bin_r_l_extras [simp]:
-  "bin_last 0 = (0::bit)"
-  "bin_last (- 1) = (1::bit)"
-  "bin_last -1 = (1::bit)"
-  "bin_last 1 = (1::bit)"
-  "bin_rest 1 = 0"
-  "bin_rest 0 = 0"
-  "bin_rest (- 1) = - 1"
-  "bin_rest -1 = -1"
-  by (simp_all add: bin_last_def bin_rest_def)
-
 lemma Bit_div2 [simp]: "(w BIT b) div 2 = w"
   unfolding bin_rest_def [symmetric] by auto