src/HOL/SPARK/SPARK.thy
changeset 47108 2a1953f0d20d
parent 41561 d1318f3c86ba
child 50788 fec14e8fefb8
equal deleted inserted replaced
47107:35807a5d8dc2 47108:2a1953f0d20d
   143       case 0
   143       case 0
   144       with 3 have "bin BIT bit = 0" by simp
   144       with 3 have "bin BIT bit = 0" by simp
   145       then have "bin = 0" "bit = 0"
   145       then have "bin = 0" "bit = 0"
   146         by (auto simp add: Bit_def bitval_def split add: bit.split_asm) arith
   146         by (auto simp add: Bit_def bitval_def split add: bit.split_asm) arith
   147       then show ?thesis using 0 1 `y < 2 ^ n`
   147       then show ?thesis using 0 1 `y < 2 ^ n`
   148         by simp (simp add: Bit0_def int_or_Pls [unfolded Pls_def])
   148         by simp
   149     next
   149     next
   150       case (Suc m)
   150       case (Suc m)
   151       from 3 have "0 \<le> bin"
   151       from 3 have "0 \<le> bin"
   152         by (simp add: Bit_def bitval_def split add: bit.split_asm)
   152         by (simp add: Bit_def bitval_def split add: bit.split_asm)
   153       moreover from 3 Suc have "bin < 2 ^ m"
   153       moreover from 3 Suc have "bin < 2 ^ m"
   186       case 0
   186       case 0
   187       with 3 have "bin BIT bit = 0" by simp
   187       with 3 have "bin BIT bit = 0" by simp
   188       then have "bin = 0" "bit = 0"
   188       then have "bin = 0" "bit = 0"
   189         by (auto simp add: Bit_def bitval_def split add: bit.split_asm) arith
   189         by (auto simp add: Bit_def bitval_def split add: bit.split_asm) arith
   190       then show ?thesis using 0 1 `y < 2 ^ n`
   190       then show ?thesis using 0 1 `y < 2 ^ n`
   191         by simp (simp add: Bit0_def int_xor_Pls [unfolded Pls_def])
   191         by simp
   192     next
   192     next
   193       case (Suc m)
   193       case (Suc m)
   194       from 3 have "0 \<le> bin"
   194       from 3 have "0 \<le> bin"
   195         by (simp add: Bit_def bitval_def split add: bit.split_asm)
   195         by (simp add: Bit_def bitval_def split add: bit.split_asm)
   196       moreover from 3 Suc have "bin < 2 ^ m"
   196       moreover from 3 Suc have "bin < 2 ^ m"
   255   fixes x :: int
   255   fixes x :: int
   256   shows "x AND 2 ^ n - 1 = x mod 2 ^ n"
   256   shows "x AND 2 ^ n - 1 = x mod 2 ^ n"
   257 proof (induct x arbitrary: n rule: bin_induct)
   257 proof (induct x arbitrary: n rule: bin_induct)
   258   case 1
   258   case 1
   259   then show ?case
   259   then show ?case
   260     by simp (simp add: Pls_def)
   260     by simp
   261 next
   261 next
   262   case 2
   262   case 2
   263   then show ?case
   263   then show ?case
   264     by (simp, simp only: Min_def, simp add: m1mod2k)
   264     by (simp, simp add: m1mod2k)
   265 next
   265 next
   266   case (3 bin bit)
   266   case (3 bin bit)
   267   show ?case
   267   show ?case
   268   proof (cases n)
   268   proof (cases n)
   269     case 0
   269     case 0
   270     then show ?thesis by (simp add: int_and_extra_simps [unfolded Pls_def])
   270     then show ?thesis by (simp add: int_and_extra_simps)
   271   next
   271   next
   272     case (Suc m)
   272     case (Suc m)
   273     with 3 show ?thesis
   273     with 3 show ?thesis
   274       by (simp only: power_BIT mod_BIT int_and_Bits) simp
   274       by (simp only: power_BIT mod_BIT int_and_Bits) simp
   275   qed
   275   qed