src/HOL/Real/Float.thy
 changeset 16782 b214f21ae396 child 16890 c4e5afaba440
```     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/HOL/Real/Float.thy	Tue Jul 12 21:49:38 2005 +0200
1.3 @@ -0,0 +1,525 @@
1.4 +(*  Title: HOL/Real/Float.thy
1.5 +    ID:    \$Id\$
1.6 +    Author: Steven Obua
1.7 +*)
1.8 +
1.9 +theory Float = Real:
1.10 +
1.11 +constdefs
1.12 +  pow2 :: "int \<Rightarrow> real"
1.13 +  "pow2 a == if (0 <= a) then (2^(nat a)) else (inverse (2^(nat (-a))))"
1.14 +  float :: "int * int \<Rightarrow> real"
1.15 +  "float x == (real (fst x)) * (pow2 (snd x))"
1.16 +
1.17 +lemma pow2_0[simp]: "pow2 0 = 1"
1.19 +
1.20 +lemma pow2_1[simp]: "pow2 1 = 2"
1.22 +
1.23 +lemma pow2_neg: "pow2 x = inverse (pow2 (-x))"
1.25 +
1.26 +lemma pow2_add1: "pow2 (1 + a) = 2 * (pow2 a)"
1.27 +proof -
1.28 +  have h: "! n. nat (2 + int n) - Suc 0 = nat (1 + int n)" by arith
1.29 +  have g: "! a b. a - -1 = a + (1::int)" by arith
1.30 +  have pos: "! n. pow2 (int n + 1) = 2 * pow2 (int n)"
1.31 +    apply (auto, induct_tac n)
1.32 +    apply (simp_all add: pow2_def)
1.33 +    apply (rule_tac m1="2" and n1="nat (2 + int na)" in ssubst[OF realpow_num_eq_if])
1.34 +    apply (auto simp add: h)
1.35 +    apply arith
1.36 +    done
1.37 +  show ?thesis
1.38 +  proof (induct a)
1.39 +    case (1 n)
1.40 +    from pos show ?case by (simp add: ring_eq_simps)
1.41 +  next
1.42 +    case (2 n)
1.43 +    show ?case
1.44 +      apply (auto)
1.45 +      apply (subst pow2_neg[of "- int n"])
1.46 +      apply (subst pow2_neg[of "-1 - int n"])
1.47 +      apply (auto simp add: g pos)
1.48 +      done
1.49 +  qed
1.50 +qed
1.51 +
1.52 +lemma pow2_add: "pow2 (a+b) = (pow2 a) * (pow2 b)"
1.53 +proof (induct b)
1.54 +  case (1 n)
1.55 +  show ?case
1.56 +  proof (induct n)
1.57 +    case 0
1.58 +    show ?case by simp
1.59 +  next
1.60 +    case (Suc m)
1.62 +  qed
1.63 +next
1.64 +  case (2 n)
1.65 +  show ?case
1.66 +  proof (induct n)
1.67 +    case 0
1.68 +    show ?case
1.69 +      apply (auto)
1.70 +      apply (subst pow2_neg[of "a + -1"])
1.71 +      apply (subst pow2_neg[of "-1"])
1.72 +      apply (simp)
1.73 +      apply (insert pow2_add1[of "-a"])
1.74 +      apply (simp add: ring_eq_simps)
1.75 +      apply (subst pow2_neg[of "-a"])
1.76 +      apply (simp)
1.77 +      done
1.78 +    case (Suc m)
1.79 +    have a: "int m - (a + -2) =  1 + (int m - a + 1)" by arith
1.80 +    have b: "int m - -2 = 1 + (int m + 1)" by arith
1.81 +    show ?case
1.82 +      apply (auto)
1.83 +      apply (subst pow2_neg[of "a + (-2 - int m)"])
1.84 +      apply (subst pow2_neg[of "-2 - int m"])
1.85 +      apply (auto simp add: ring_eq_simps)
1.86 +      apply (subst a)
1.87 +      apply (subst b)
1.88 +      apply (simp only: pow2_add1)
1.89 +      apply (subst pow2_neg[of "int m - a + 1"])
1.90 +      apply (subst pow2_neg[of "int m + 1"])
1.91 +      apply auto
1.92 +      apply (insert prems)
1.93 +      apply (auto simp add: ring_eq_simps)
1.94 +      done
1.95 +  qed
1.96 +qed
1.97 +
1.98 +lemma "float (a, e) + float (b, e) = float (a + b, e)"
1.99 +by (simp add: float_def ring_eq_simps)
1.100 +
1.101 +constdefs
1.102 +  int_of_real :: "real \<Rightarrow> int"
1.103 +  "int_of_real x == SOME y. real y = x"
1.104 +  real_is_int :: "real \<Rightarrow> bool"
1.105 +  "real_is_int x == ? (u::int). x = real u"
1.106 +
1.107 +lemma real_is_int_def2: "real_is_int x = (x = real (int_of_real x))"
1.108 +by (auto simp add: real_is_int_def int_of_real_def)
1.109 +
1.110 +lemma float_transfer: "real_is_int ((real a)*(pow2 c)) \<Longrightarrow> float (a, b) = float (int_of_real ((real a)*(pow2 c)), b - c)"
1.112 +
1.113 +lemma pow2_int: "pow2 (int c) = (2::real)^c"
1.115 +
1.116 +lemma float_transfer_nat: "float (a, b) = float (a * 2^c, b - int c)"
1.118 +
1.119 +lemma real_is_int_real[simp]: "real_is_int (real (x::int))"
1.120 +by (auto simp add: real_is_int_def int_of_real_def)
1.121 +
1.122 +lemma int_of_real_real[simp]: "int_of_real (real x) = x"
1.124 +
1.125 +lemma real_int_of_real[simp]: "real_is_int x \<Longrightarrow> real (int_of_real x) = x"
1.126 +by (auto simp add: int_of_real_def real_is_int_def)
1.127 +
1.128 +lemma real_is_int_add_int_of_real: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> (int_of_real (a+b)) = (int_of_real a) + (int_of_real b)"
1.129 +by (auto simp add: int_of_real_def real_is_int_def)
1.130 +
1.131 +lemma real_is_int_add[simp]: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> real_is_int (a+b)"
1.132 +apply (subst real_is_int_def2)
1.134 +done
1.135 +
1.136 +lemma int_of_real_sub: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> (int_of_real (a-b)) = (int_of_real a) - (int_of_real b)"
1.137 +by (auto simp add: int_of_real_def real_is_int_def)
1.138 +
1.139 +lemma real_is_int_sub[simp]: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> real_is_int (a-b)"
1.140 +apply (subst real_is_int_def2)
1.141 +apply (simp add: int_of_real_sub real_int_of_real)
1.142 +done
1.143 +
1.144 +lemma real_is_int_rep: "real_is_int x \<Longrightarrow> ?! (a::int). real a = x"
1.145 +by (auto simp add: real_is_int_def)
1.146 +
1.147 +lemma int_of_real_mult:
1.148 +  assumes "real_is_int a" "real_is_int b"
1.149 +  shows "(int_of_real (a*b)) = (int_of_real a) * (int_of_real b)"
1.150 +proof -
1.151 +  from prems have a: "?! (a'::int). real a' = a" by (rule_tac real_is_int_rep, auto)
1.152 +  from prems have b: "?! (b'::int). real b' = b" by (rule_tac real_is_int_rep, auto)
1.153 +  from a obtain a'::int where a':"a = real a'" by auto
1.154 +  from b obtain b'::int where b':"b = real b'" by auto
1.155 +  have r: "real a' * real b' = real (a' * b')" by auto
1.156 +  show ?thesis
1.157 +    apply (simp add: a' b')
1.158 +    apply (subst r)
1.159 +    apply (simp only: int_of_real_real)
1.160 +    done
1.161 +qed
1.162 +
1.163 +lemma real_is_int_mult[simp]: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> real_is_int (a*b)"
1.164 +apply (subst real_is_int_def2)
1.166 +done
1.167 +
1.168 +lemma real_is_int_0[simp]: "real_is_int (0::real)"
1.169 +by (simp add: real_is_int_def int_of_real_def)
1.170 +
1.171 +lemma real_is_int_1[simp]: "real_is_int (1::real)"
1.172 +proof -
1.173 +  have "real_is_int (1::real) = real_is_int(real (1::int))" by auto
1.174 +  also have "\<dots> = True" by (simp only: real_is_int_real)
1.175 +  ultimately show ?thesis by auto
1.176 +qed
1.177 +
1.178 +lemma real_is_int_n1: "real_is_int (-1::real)"
1.179 +proof -
1.180 +  have "real_is_int (-1::real) = real_is_int(real (-1::int))" by auto
1.181 +  also have "\<dots> = True" by (simp only: real_is_int_real)
1.182 +  ultimately show ?thesis by auto
1.183 +qed
1.184 +
1.185 +lemma real_is_int_number_of[simp]: "real_is_int ((number_of::bin\<Rightarrow>real) x)"
1.186 +proof -
1.187 +  have neg1: "real_is_int (-1::real)"
1.188 +  proof -
1.189 +    have "real_is_int (-1::real) = real_is_int(real (-1::int))" by auto
1.190 +    also have "\<dots> = True" by (simp only: real_is_int_real)
1.191 +    ultimately show ?thesis by auto
1.192 +  qed
1.193 +
1.194 +  {
1.195 +    fix x::int
1.196 +    have "!! y. real_is_int ((number_of::bin\<Rightarrow>real) (Abs_Bin x))"
1.197 +      apply (simp add: number_of_eq)
1.198 +      apply (subst Abs_Bin_inverse)
1.199 +      apply (simp add: Bin_def)
1.200 +      apply (induct x)
1.201 +      apply (induct_tac n)
1.202 +      apply (simp)
1.203 +      apply (simp)
1.204 +      apply (induct_tac n)
1.205 +      apply (simp add: neg1)
1.206 +    proof -
1.207 +      fix n :: nat
1.208 +      assume rn: "(real_is_int (of_int (- (int (Suc n)))))"
1.209 +      have s: "-(int (Suc (Suc n))) = -1 + - (int (Suc n))" by simp
1.210 +      show "real_is_int (of_int (- (int (Suc (Suc n)))))"
1.211 +	apply (simp only: s of_int_add)
1.213 +	apply (simp add: neg1)
1.214 +	apply (simp only: rn)
1.215 +	done
1.216 +    qed
1.217 +  }
1.218 +  note Abs_Bin = this
1.219 +  {
1.220 +    fix x :: bin
1.221 +    have "? u. x = Abs_Bin u"
1.222 +      apply (rule exI[where x = "Rep_Bin x"])
1.223 +      apply (simp add: Rep_Bin_inverse)
1.224 +      done
1.225 +  }
1.226 +  then obtain u::int where "x = Abs_Bin u" by auto
1.227 +  with Abs_Bin show ?thesis by auto
1.228 +qed
1.229 +
1.230 +lemma int_of_real_0[simp]: "int_of_real (0::real) = (0::int)"
1.232 +
1.233 +lemma int_of_real_1[simp]: "int_of_real (1::real) = (1::int)"
1.234 +proof -
1.235 +  have 1: "(1::real) = real (1::int)" by auto
1.236 +  show ?thesis by (simp only: 1 int_of_real_real)
1.237 +qed
1.238 +
1.239 +lemma int_of_real_number_of[simp]: "int_of_real (number_of b) = number_of b"
1.240 +proof -
1.241 +  have "real_is_int (number_of b)" by simp
1.242 +  then have uu: "?! u::int. number_of b = real u" by (auto simp add: real_is_int_rep)
1.243 +  then obtain u::int where u:"number_of b = real u" by auto
1.244 +  have "number_of b = real ((number_of b)::int)"
1.245 +    by (simp add: number_of_eq real_of_int_def)
1.246 +  have ub: "number_of b = real ((number_of b)::int)"
1.247 +    by (simp add: number_of_eq real_of_int_def)
1.248 +  from uu u ub have unb: "u = number_of b"
1.249 +    by blast
1.250 +  have "int_of_real (number_of b) = u" by (simp add: u)
1.251 +  with unb show ?thesis by simp
1.252 +qed
1.253 +
1.254 +lemma float_transfer_even: "even a \<Longrightarrow> float (a, b) = float (a div 2, b+1)"
1.255 +  apply (subst float_transfer[where a="a" and b="b" and c="-1", simplified])
1.256 +  apply (simp_all add: pow2_def even_def real_is_int_def ring_eq_simps)
1.257 +  apply (auto)
1.258 +proof -
1.259 +  fix q::int
1.260 +  have a:"b - (-1\<Colon>int) = (1\<Colon>int) + b" by arith
1.261 +  show "(float (q, (b - (-1\<Colon>int)))) = (float (q, ((1\<Colon>int) + b)))"
1.262 +    by (simp add: a)
1.263 +qed
1.264 +
1.265 +consts
1.266 +  norm_float :: "int*int \<Rightarrow> int*int"
1.267 +
1.268 +lemma int_div_zdiv: "int (a div b) = (int a) div (int b)"
1.269 +apply (subst split_div, auto)
1.270 +apply (subst split_zdiv, auto)
1.271 +apply (rule_tac a="int (b * i) + int j" and b="int b" and r="int j" and r'=ja in IntDiv.unique_quotient)
1.272 +apply (auto simp add: IntDiv.quorem_def int_eq_of_nat)
1.273 +done
1.274 +
1.275 +lemma int_mod_zmod: "int (a mod b) = (int a) mod (int b)"
1.276 +apply (subst split_mod, auto)
1.277 +apply (subst split_zmod, auto)
1.278 +apply (rule_tac a="int (b * i) + int j" and b="int b" and q="int i" and q'=ia in IntDiv.unique_remainder)
1.279 +apply (auto simp add: IntDiv.quorem_def int_eq_of_nat)
1.280 +done
1.281 +
1.282 +lemma abs_div_2_less: "a \<noteq> 0 \<Longrightarrow> a \<noteq> -1 \<Longrightarrow> abs((a::int) div 2) < abs a"
1.283 +by arith
1.284 +
1.285 +lemma terminating_norm_float: "\<forall>a. (a::int) \<noteq> 0 \<and> even a \<longrightarrow> a \<noteq> 0 \<and> \<bar>a div 2\<bar> < \<bar>a\<bar>"
1.286 +apply (auto)
1.287 +apply (rule abs_div_2_less)
1.288 +apply (auto)
1.289 +done
1.290 +
1.291 +ML {* simp_depth_limit := 2 *}
1.292 +recdef norm_float "measure (% (a,b). nat (abs a))"
1.293 +  "norm_float (a,b) = (if (a \<noteq> 0) & (even a) then norm_float (a div 2, b+1) else (if a=0 then (0,0) else (a,b)))"
1.294 +(hints simp: terminating_norm_float)
1.295 +ML {* simp_depth_limit := 1000 *}
1.296 +
1.297 +lemma norm_float: "float x = float (norm_float x)"
1.298 +proof -
1.299 +  {
1.300 +    fix a b :: int
1.301 +    have norm_float_pair: "float (a,b) = float (norm_float (a,b))"
1.302 +    proof (induct a b rule: norm_float.induct)
1.303 +      case (1 u v)
1.304 +      show ?case
1.305 +      proof cases
1.306 +	assume u: "u \<noteq> 0 \<and> even u"
1.307 +	with prems have ind: "float (u div 2, v + 1) = float (norm_float (u div 2, v + 1))" by auto
1.308 +	with u have "float (u,v) = float (u div 2, v+1)" by (simp add: float_transfer_even)
1.309 +	then show ?thesis
1.310 +	  apply (subst norm_float.simps)
1.311 +	  apply (simp add: ind)
1.312 +	  done
1.313 +      next
1.314 +	assume "~(u \<noteq> 0 \<and> even u)"
1.315 +	then show ?thesis
1.316 +	  by (simp add: prems float_def)
1.317 +      qed
1.318 +    qed
1.319 +  }
1.320 +  note helper = this
1.321 +  have "? a b. x = (a,b)" by auto
1.322 +  then obtain a b where "x = (a, b)" by blast
1.323 +  then show ?thesis by (simp only: helper)
1.324 +qed
1.325 +
1.326 +lemma pow2_int: "pow2 (int n) = 2^n"
1.327 +  by (simp add: pow2_def)
1.328 +
1.330 +  "float (a1, e1) + float (a2, e2) =
1.331 +  (if e1<=e2 then float (a1+a2*2^(nat(e2-e1)), e1)
1.332 +  else float (a1*2^(nat (e1-e2))+a2, e2))"
1.333 +  apply (simp add: float_def ring_eq_simps)
1.335 +  done
1.336 +
1.337 +lemma float_mult:
1.338 +  "float (a1, e1) * float (a2, e2) =
1.339 +  (float (a1 * a2, e1 + e2))"
1.341 +
1.342 +lemma float_minus:
1.343 +  "- (float (a,b)) = float (-a, b)"
1.344 +  by (simp add: float_def)
1.345 +
1.346 +lemma zero_less_pow2:
1.347 +  "0 < pow2 x"
1.348 +proof -
1.349 +  {
1.350 +    fix y
1.351 +    have "0 <= y \<Longrightarrow> 0 < pow2 y"
1.353 +  }
1.354 +  note helper=this
1.355 +  show ?thesis
1.356 +    apply (case_tac "0 <= x")
1.357 +    apply (simp add: helper)
1.358 +    apply (subst pow2_neg)
1.359 +    apply (simp add: helper)
1.360 +    done
1.361 +qed
1.362 +
1.363 +lemma zero_le_float:
1.364 +  "(0 <= float (a,b)) = (0 <= a)"
1.365 +  apply (auto simp add: float_def)
1.366 +  apply (auto simp add: zero_le_mult_iff zero_less_pow2)
1.367 +  apply (insert zero_less_pow2[of b])
1.368 +  apply (simp_all)
1.369 +  done
1.370 +
1.371 +lemma float_le_zero:
1.372 +  "(float (a,b) <= 0) = (a <= 0)"
1.373 +  apply (auto simp add: float_def)
1.374 +  apply (auto simp add: mult_le_0_iff)
1.375 +  apply (insert zero_less_pow2[of b])
1.376 +  apply auto
1.377 +  done
1.378 +
1.379 +lemma float_abs:
1.380 +  "abs (float (a,b)) = (if 0 <= a then (float (a,b)) else (float (-a,b)))"
1.381 +  apply (auto simp add: abs_if)
1.382 +  apply (simp_all add: zero_le_float[symmetric, of a b] float_minus)
1.383 +  done
1.384 +
1.385 +lemma float_zero:
1.386 +  "float (0, b) = 0"
1.387 +  by (simp add: float_def)
1.388 +
1.389 +lemma float_pprt:
1.390 +  "pprt (float (a, b)) = (if 0 <= a then (float (a,b)) else (float (0, b)))"
1.391 +  by (auto simp add: zero_le_float float_le_zero float_zero)
1.392 +
1.393 +lemma float_nprt:
1.394 +  "nprt (float (a, b)) = (if 0 <= a then (float (0,b)) else (float (a, b)))"
1.395 +  by (auto simp add: zero_le_float float_le_zero float_zero)
1.396 +
1.397 +lemma norm_0_1: "(0::_::number_ring) = Numeral0 & (1::_::number_ring) = Numeral1"
1.398 +  by auto
1.399 +
1.401 +  by simp
1.402 +
1.404 +  by simp
1.405 +
1.406 +lemma mult_left_one: "1 * a = (a::'a::semiring_1)"
1.407 +  by simp
1.408 +
1.409 +lemma mult_right_one: "a * 1 = (a::'a::semiring_1)"
1.410 +  by simp
1.411 +
1.412 +lemma int_pow_0: "(a::int)^(Numeral0) = 1"
1.413 +  by simp
1.414 +
1.415 +lemma int_pow_1: "(a::int)^(Numeral1) = a"
1.416 +  by simp
1.417 +
1.418 +lemma zero_eq_Numeral0_nring: "(0::'a::number_ring) = Numeral0"
1.419 +  by simp
1.420 +
1.421 +lemma one_eq_Numeral1_nring: "(1::'a::number_ring) = Numeral1"
1.422 +  by simp
1.423 +
1.424 +lemma zero_eq_Numeral0_nat: "(0::nat) = Numeral0"
1.425 +  by simp
1.426 +
1.427 +lemma one_eq_Numeral1_nat: "(1::nat) = Numeral1"
1.428 +  by simp
1.429 +
1.430 +lemma zpower_Pls: "(z::int)^Numeral0 = Numeral1"
1.431 +  by simp
1.432 +
1.433 +lemma zpower_Min: "(z::int)^((-1)::nat) = Numeral1"
1.434 +proof -
1.435 +  have 1:"((-1)::nat) = 0"
1.436 +    by simp
1.437 +  show ?thesis by (simp add: 1)
1.438 +qed
1.439 +
1.440 +lemma fst_cong: "a=a' \<Longrightarrow> fst (a,b) = fst (a',b)"
1.441 +  by simp
1.442 +
1.443 +lemma snd_cong: "b=b' \<Longrightarrow> snd (a,b) = snd (a,b')"
1.444 +  by simp
1.445 +
1.446 +lemma lift_bool: "x \<Longrightarrow> x=True"
1.447 +  by simp
1.448 +
1.449 +lemma nlift_bool: "~x \<Longrightarrow> x=False"
1.450 +  by simp
1.451 +
1.452 +lemma not_false_eq_true: "(~ False) = True" by simp
1.453 +
1.454 +lemma not_true_eq_false: "(~ True) = False" by simp
1.455 +
1.456 +
1.457 +lemmas binarith =
1.458 +  Pls_0_eq Min_1_eq
1.459 +  bin_pred_Pls bin_pred_Min bin_pred_1 bin_pred_0
1.460 +  bin_succ_Pls bin_succ_Min bin_succ_1 bin_succ_0
1.462 +  bin_add_BIT_11 bin_minus_Pls bin_minus_Min bin_minus_1
1.463 +  bin_minus_0 bin_mult_Pls bin_mult_Min bin_mult_1 bin_mult_0
1.465 +
1.466 +lemma int_eq_number_of_eq: "(((number_of v)::int)=(number_of w)) = iszero ((number_of (bin_add v (bin_minus w)))::int)"
1.467 +  by simp
1.468 +
1.469 +lemma int_iszero_number_of_Pls: "iszero (Numeral0::int)"
1.470 +  by (simp only: iszero_number_of_Pls)
1.471 +
1.472 +lemma int_nonzero_number_of_Min: "~(iszero ((-1)::int))"
1.473 +  by simp
1.474 +
1.475 +lemma int_iszero_number_of_0: "iszero ((number_of (w BIT bit.B0))::int) = iszero ((number_of w)::int)"
1.476 +  by simp
1.477 +
1.478 +lemma int_iszero_number_of_1: "\<not> iszero ((number_of (w BIT bit.B1))::int)"
1.479 +  by simp
1.480 +
1.481 +lemma int_less_number_of_eq_neg: "(((number_of x)::int) < number_of y) = neg ((number_of (bin_add x (bin_minus y)))::int)"
1.482 +  by simp
1.483 +
1.484 +lemma int_not_neg_number_of_Pls: "\<not> (neg (Numeral0::int))"
1.485 +  by simp
1.486 +
1.487 +lemma int_neg_number_of_Min: "neg (-1::int)"
1.488 +  by simp
1.489 +
1.490 +lemma int_neg_number_of_BIT: "neg ((number_of (w BIT x))::int) = neg ((number_of w)::int)"
1.491 +  by simp
1.492 +
1.493 +lemma int_le_number_of_eq: "(((number_of x)::int) \<le> number_of y) = (\<not> neg ((number_of (bin_add y (bin_minus x)))::int))"
1.494 +  by simp
1.495 +
1.496 +lemmas intarithrel =
1.497 +  int_eq_number_of_eq
1.498 +  lift_bool[OF int_iszero_number_of_Pls] nlift_bool[OF int_nonzero_number_of_Min] int_iszero_number_of_0
1.499 +  lift_bool[OF int_iszero_number_of_1] int_less_number_of_eq_neg nlift_bool[OF int_not_neg_number_of_Pls] lift_bool[OF int_neg_number_of_Min]
1.500 +  int_neg_number_of_BIT int_le_number_of_eq
1.501 +
1.502 +lemma int_number_of_add_sym: "((number_of v)::int) + number_of w = number_of (bin_add v w)"
1.503 +  by simp
1.504 +
1.505 +lemma int_number_of_diff_sym: "((number_of v)::int) - number_of w = number_of (bin_add v (bin_minus w))"
1.506 +  by simp
1.507 +
1.508 +lemma int_number_of_mult_sym: "((number_of v)::int) * number_of w = number_of (bin_mult v w)"
1.509 +  by simp
1.510 +
1.511 +lemma int_number_of_minus_sym: "- ((number_of v)::int) = number_of (bin_minus v)"
1.512 +  by simp
1.513 +
1.514 +lemmas intarith = int_number_of_add_sym int_number_of_minus_sym int_number_of_diff_sym int_number_of_mult_sym
1.515 +
1.516 +lemmas natarith = add_nat_number_of diff_nat_number_of mult_nat_number_of eq_nat_number_of less_nat_number_of
1.517 +
1.518 +lemmas powerarith = nat_number_of zpower_number_of_even
1.519 +  zpower_number_of_odd[simplified zero_eq_Numeral0_nring one_eq_Numeral1_nring]
1.520 +  zpower_Pls zpower_Min
1.521 +
1.522 +lemmas floatarith[simplified norm_0_1] = float_add float_mult float_minus float_abs zero_le_float float_pprt float_nprt
1.523 +
1.524 +(* for use with the compute oracle *)
1.525 +lemmas arith = binarith intarith intarithrel natarith powerarith floatarith not_false_eq_true not_true_eq_false
1.526 +
1.527 +end
1.528 +
```