| author | berghofe | 
| Fri, 30 Dec 2011 18:14:56 +0100 | |
| changeset 46060 | f94b7179a75d | 
| parent 45495 | c55a07526dbe | 
| permissions | -rw-r--r-- | 
| 41959 | 1 | (* Title: HOL/Matrix/ComputeFloat.thy | 
| 2 | Author: Steven Obua | |
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 3 | *) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 4 | |
| 20717 | 5 | header {* Floating Point Representation of the Reals *}
 | 
| 6 | ||
| 29804 
e15b74577368
Added new Float theory and moved old Library/Float.thy to ComputeFloat
 hoelzl parents: 
29667diff
changeset | 7 | theory ComputeFloat | 
| 41413 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 wenzelm parents: 
38273diff
changeset | 8 | imports Complex_Main "~~/src/HOL/Library/Lattice_Algebras" | 
| 28952 
15a4b2cf8c34
made repository layout more coherent with logical distribution structure; stripped some $Id$s
 haftmann parents: 
27366diff
changeset | 9 | uses "~~/src/Tools/float.ML" ("~~/src/HOL/Tools/float_arith.ML")
 | 
| 20485 | 10 | begin | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 11 | |
| 38273 | 12 | definition int_of_real :: "real \<Rightarrow> int" | 
| 13 | where "int_of_real x = (SOME y. real y = x)" | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21256diff
changeset | 14 | |
| 38273 | 15 | definition real_is_int :: "real \<Rightarrow> bool" | 
| 16 | where "real_is_int x = (EX (u::int). x = real u)" | |
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 17 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 18 | lemma real_is_int_def2: "real_is_int x = (x = real (int_of_real x))" | 
| 45495 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 19 | by (auto simp add: real_is_int_def int_of_real_def) | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 20 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 21 | lemma real_is_int_real[simp]: "real_is_int (real (x::int))" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 22 | by (auto simp add: real_is_int_def int_of_real_def) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 23 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 24 | lemma int_of_real_real[simp]: "int_of_real (real x) = x" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 25 | by (simp add: int_of_real_def) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 26 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 27 | lemma real_int_of_real[simp]: "real_is_int x \<Longrightarrow> real (int_of_real x) = x" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 28 | by (auto simp add: int_of_real_def real_is_int_def) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 29 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 30 | 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)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 31 | by (auto simp add: int_of_real_def real_is_int_def) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 32 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 33 | lemma real_is_int_add[simp]: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> real_is_int (a+b)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 34 | apply (subst real_is_int_def2) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 35 | apply (simp add: real_is_int_add_int_of_real real_int_of_real) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 36 | done | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 37 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 38 | 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)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 39 | by (auto simp add: int_of_real_def real_is_int_def) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 40 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 41 | lemma real_is_int_sub[simp]: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> real_is_int (a-b)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 42 | apply (subst real_is_int_def2) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 43 | apply (simp add: int_of_real_sub real_int_of_real) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 44 | done | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 45 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 46 | lemma real_is_int_rep: "real_is_int x \<Longrightarrow> ?! (a::int). real a = x" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 47 | by (auto simp add: real_is_int_def) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 48 | |
| 19765 | 49 | lemma int_of_real_mult: | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 50 | assumes "real_is_int a" "real_is_int b" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 51 | shows "(int_of_real (a*b)) = (int_of_real a) * (int_of_real b)" | 
| 45495 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 52 | using assms | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 53 | by (auto simp add: real_is_int_def real_of_int_mult[symmetric] | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 54 | simp del: real_of_int_mult) | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 55 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 56 | lemma real_is_int_mult[simp]: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> real_is_int (a*b)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 57 | apply (subst real_is_int_def2) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 58 | apply (simp add: int_of_real_mult) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 59 | done | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 60 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 61 | lemma real_is_int_0[simp]: "real_is_int (0::real)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 62 | by (simp add: real_is_int_def int_of_real_def) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 63 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 64 | lemma real_is_int_1[simp]: "real_is_int (1::real)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 65 | proof - | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 66 | have "real_is_int (1::real) = real_is_int(real (1::int))" by auto | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 67 | also have "\<dots> = True" by (simp only: real_is_int_real) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 68 | ultimately show ?thesis by auto | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 69 | qed | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 70 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 71 | lemma real_is_int_n1: "real_is_int (-1::real)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 72 | proof - | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 73 | have "real_is_int (-1::real) = real_is_int(real (-1::int))" by auto | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 74 | also have "\<dots> = True" by (simp only: real_is_int_real) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 75 | ultimately show ?thesis by auto | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 76 | qed | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 77 | |
| 20485 | 78 | lemma real_is_int_number_of[simp]: "real_is_int ((number_of \<Colon> int \<Rightarrow> real) x)" | 
| 45495 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 79 | by (auto simp: real_is_int_def intro!: exI[of _ "number_of x"]) | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 80 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 81 | lemma int_of_real_0[simp]: "int_of_real (0::real) = (0::int)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 82 | by (simp add: int_of_real_def) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 83 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 84 | lemma int_of_real_1[simp]: "int_of_real (1::real) = (1::int)" | 
| 19765 | 85 | proof - | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 86 | have 1: "(1::real) = real (1::int)" by auto | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 87 | show ?thesis by (simp only: 1 int_of_real_real) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 88 | qed | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 89 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 90 | lemma int_of_real_number_of[simp]: "int_of_real (number_of b) = number_of b" | 
| 45495 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 91 | unfolding int_of_real_def | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 92 | by (intro some_equality) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 93 | (auto simp add: real_of_int_inject[symmetric] simp del: real_of_int_inject) | 
| 19765 | 94 | |
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 95 | lemma int_div_zdiv: "int (a div b) = (int a) div (int b)" | 
| 23431 
25ca91279a9b
change simp rules for of_nat to work like int did previously (reorient of_nat_Suc, remove of_nat_mult [simp]); preserve original variable names in legacy int theorems
 huffman parents: 
23365diff
changeset | 96 | by (rule zdiv_int) | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 97 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 98 | lemma int_mod_zmod: "int (a mod b) = (int a) mod (int b)" | 
| 23431 
25ca91279a9b
change simp rules for of_nat to work like int did previously (reorient of_nat_Suc, remove of_nat_mult [simp]); preserve original variable names in legacy int theorems
 huffman parents: 
23365diff
changeset | 99 | by (rule zmod_int) | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 100 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 101 | lemma abs_div_2_less: "a \<noteq> 0 \<Longrightarrow> a \<noteq> -1 \<Longrightarrow> abs((a::int) div 2) < abs a" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 102 | by arith | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 103 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 104 | lemma norm_0_1: "(0::_::number_ring) = Numeral0 & (1::_::number_ring) = Numeral1" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 105 | by auto | 
| 19765 | 106 | |
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 107 | lemma add_left_zero: "0 + a = (a::'a::comm_monoid_add)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 108 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 109 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 110 | lemma add_right_zero: "a + 0 = (a::'a::comm_monoid_add)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 111 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 112 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 113 | lemma mult_left_one: "1 * a = (a::'a::semiring_1)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 114 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 115 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 116 | lemma mult_right_one: "a * 1 = (a::'a::semiring_1)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 117 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 118 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 119 | lemma int_pow_0: "(a::int)^(Numeral0) = 1" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 120 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 121 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 122 | lemma int_pow_1: "(a::int)^(Numeral1) = a" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 123 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 124 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 125 | lemma zero_eq_Numeral0_nring: "(0::'a::number_ring) = Numeral0" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 126 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 127 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 128 | lemma one_eq_Numeral1_nring: "(1::'a::number_ring) = Numeral1" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 129 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 130 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 131 | lemma zero_eq_Numeral0_nat: "(0::nat) = Numeral0" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 132 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 133 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 134 | lemma one_eq_Numeral1_nat: "(1::nat) = Numeral1" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 135 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 136 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 137 | lemma zpower_Pls: "(z::int)^Numeral0 = Numeral1" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 138 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 139 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 140 | lemma zpower_Min: "(z::int)^((-1)::nat) = Numeral1" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 141 | proof - | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 142 | have 1:"((-1)::nat) = 0" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 143 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 144 | show ?thesis by (simp add: 1) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 145 | qed | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 146 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 147 | lemma fst_cong: "a=a' \<Longrightarrow> fst (a,b) = fst (a',b)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 148 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 149 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 150 | lemma snd_cong: "b=b' \<Longrightarrow> snd (a,b) = snd (a,b')" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 151 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 152 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 153 | lemma lift_bool: "x \<Longrightarrow> x=True" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 154 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 155 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 156 | lemma nlift_bool: "~x \<Longrightarrow> x=False" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 157 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 158 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 159 | lemma not_false_eq_true: "(~ False) = True" by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 160 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 161 | lemma not_true_eq_false: "(~ True) = False" by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 162 | |
| 19765 | 163 | lemmas binarith = | 
| 26076 
b9c716a9fb5f
added lemma lists {normalize,succ,pred,minus,add,mult}_bin_simps
 huffman parents: 
24653diff
changeset | 164 | normalize_bin_simps | 
| 
b9c716a9fb5f
added lemma lists {normalize,succ,pred,minus,add,mult}_bin_simps
 huffman parents: 
24653diff
changeset | 165 | pred_bin_simps succ_bin_simps | 
| 
b9c716a9fb5f
added lemma lists {normalize,succ,pred,minus,add,mult}_bin_simps
 huffman parents: 
24653diff
changeset | 166 | add_bin_simps minus_bin_simps mult_bin_simps | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 167 | |
| 20485 | 168 | lemma int_eq_number_of_eq: | 
| 169 | "(((number_of v)::int)=(number_of w)) = iszero ((number_of (v + uminus w))::int)" | |
| 28967 
3bdb1eae352c
enable eq_bin_simps for simplifying equalities on numerals
 huffman parents: 
28963diff
changeset | 170 | by (rule eq_number_of_eq) | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 171 | |
| 19765 | 172 | lemma int_iszero_number_of_Pls: "iszero (Numeral0::int)" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 173 | by (simp only: iszero_number_of_Pls) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 174 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 175 | lemma int_nonzero_number_of_Min: "~(iszero ((-1)::int))" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 176 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 177 | |
| 26086 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 178 | lemma int_iszero_number_of_Bit0: "iszero ((number_of (Int.Bit0 w))::int) = iszero ((number_of w)::int)" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 179 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 180 | |
| 26086 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 181 | lemma int_iszero_number_of_Bit1: "\<not> iszero ((number_of (Int.Bit1 w))::int)" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 182 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 183 | |
| 20485 | 184 | lemma int_less_number_of_eq_neg: "(((number_of x)::int) < number_of y) = neg ((number_of (x + (uminus y)))::int)" | 
| 29040 
286c669d3a7a
move all neg-related lemmas to NatBin; make type of neg specific to int
 huffman parents: 
28967diff
changeset | 185 | unfolding neg_def number_of_is_id by simp | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 186 | |
| 19765 | 187 | lemma int_not_neg_number_of_Pls: "\<not> (neg (Numeral0::int))" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 188 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 189 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 190 | lemma int_neg_number_of_Min: "neg (-1::int)" | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 191 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 192 | |
| 26086 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 193 | lemma int_neg_number_of_Bit0: "neg ((number_of (Int.Bit0 w))::int) = neg ((number_of w)::int)" | 
| 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 194 | by simp | 
| 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 195 | |
| 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 196 | lemma int_neg_number_of_Bit1: "neg ((number_of (Int.Bit1 w))::int) = neg ((number_of w)::int)" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 197 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 198 | |
| 20485 | 199 | lemma int_le_number_of_eq: "(((number_of x)::int) \<le> number_of y) = (\<not> neg ((number_of (y + (uminus x)))::int))" | 
| 28963 
f6d9e0e0b153
fix proofs related to simplification of inequalities on numerals
 huffman parents: 
28952diff
changeset | 200 | unfolding neg_def number_of_is_id by (simp add: not_less) | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 201 | |
| 19765 | 202 | lemmas intarithrel = | 
| 203 | int_eq_number_of_eq | |
| 26086 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 204 | lift_bool[OF int_iszero_number_of_Pls] nlift_bool[OF int_nonzero_number_of_Min] int_iszero_number_of_Bit0 | 
| 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 205 | lift_bool[OF int_iszero_number_of_Bit1] int_less_number_of_eq_neg nlift_bool[OF int_not_neg_number_of_Pls] lift_bool[OF int_neg_number_of_Min] | 
| 
3c243098b64a
New simpler representation of numerals, using Bit0 and Bit1 instead of BIT, B0, and B1
 huffman parents: 
26076diff
changeset | 206 | int_neg_number_of_Bit0 int_neg_number_of_Bit1 int_le_number_of_eq | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 207 | |
| 20485 | 208 | lemma int_number_of_add_sym: "((number_of v)::int) + number_of w = number_of (v + w)" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 209 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 210 | |
| 20485 | 211 | lemma int_number_of_diff_sym: "((number_of v)::int) - number_of w = number_of (v + (uminus w))" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 212 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 213 | |
| 20485 | 214 | lemma int_number_of_mult_sym: "((number_of v)::int) * number_of w = number_of (v * w)" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 215 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 216 | |
| 20485 | 217 | lemma int_number_of_minus_sym: "- ((number_of v)::int) = number_of (uminus v)" | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 218 | by simp | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 219 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 220 | lemmas intarith = int_number_of_add_sym int_number_of_minus_sym int_number_of_diff_sym int_number_of_mult_sym | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 221 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 222 | lemmas natarith = add_nat_number_of diff_nat_number_of mult_nat_number_of eq_nat_number_of less_nat_number_of | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 223 | |
| 19765 | 224 | lemmas powerarith = nat_number_of zpower_number_of_even | 
| 225 | zpower_number_of_odd[simplified zero_eq_Numeral0_nring one_eq_Numeral1_nring] | |
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 226 | zpower_Pls zpower_Min | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 227 | |
| 45495 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 228 | definition float :: "(int \<times> int) \<Rightarrow> real" where | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 229 | "float = (\<lambda>(a, b). real a * 2 powr real b)" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 230 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 231 | lemma float_add_l0: "float (0, e) + x = x" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 232 | by (simp add: float_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 233 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 234 | lemma float_add_r0: "x + float (0, e) = x" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 235 | by (simp add: float_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 236 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 237 | lemma float_add: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 238 | "float (a1, e1) + float (a2, e2) = | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 239 | (if e1<=e2 then float (a1+a2*2^(nat(e2-e1)), e1) else float (a1*2^(nat (e1-e2))+a2, e2))" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 240 | by (simp add: float_def algebra_simps powr_realpow[symmetric] powr_divide2[symmetric]) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 241 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 242 | lemma float_mult_l0: "float (0, e) * x = float (0, 0)" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 243 | by (simp add: float_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 244 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 245 | lemma float_mult_r0: "x * float (0, e) = float (0, 0)" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 246 | by (simp add: float_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 247 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 248 | lemma float_mult: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 249 | "float (a1, e1) * float (a2, e2) = (float (a1 * a2, e1 + e2))" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 250 | by (simp add: float_def powr_add) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 251 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 252 | lemma float_minus: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 253 | "- (float (a,b)) = float (-a, b)" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 254 | by (simp add: float_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 255 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 256 | lemma zero_le_float: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 257 | "(0 <= float (a,b)) = (0 <= a)" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 258 | using powr_gt_zero[of 2 "real b", arith] | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 259 | by (simp add: float_def zero_le_mult_iff) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 260 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 261 | lemma float_le_zero: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 262 | "(float (a,b) <= 0) = (a <= 0)" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 263 | using powr_gt_zero[of 2 "real b", arith] | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 264 | by (simp add: float_def mult_le_0_iff) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 265 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 266 | lemma float_abs: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 267 | "abs (float (a,b)) = (if 0 <= a then (float (a,b)) else (float (-a,b)))" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 268 | using powr_gt_zero[of 2 "real b", arith] | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 269 | by (simp add: float_def abs_if mult_less_0_iff) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 270 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 271 | lemma float_zero: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 272 | "float (0, b) = 0" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 273 | by (simp add: float_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 274 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 275 | lemma float_pprt: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 276 | "pprt (float (a, b)) = (if 0 <= a then (float (a,b)) else (float (0, b)))" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 277 | by (auto simp add: zero_le_float float_le_zero float_zero) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 278 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 279 | lemma float_nprt: | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 280 | "nprt (float (a, b)) = (if 0 <= a then (float (0,b)) else (float (a, b)))" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 281 | by (auto simp add: zero_le_float float_le_zero float_zero) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 282 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 283 | definition lbound :: "real \<Rightarrow> real" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 284 | where "lbound x = min 0 x" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 285 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 286 | definition ubound :: "real \<Rightarrow> real" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 287 | where "ubound x = max 0 x" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 288 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 289 | lemma lbound: "lbound x \<le> x" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 290 | by (simp add: lbound_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 291 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 292 | lemma ubound: "x \<le> ubound x" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 293 | by (simp add: ubound_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 294 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 295 | lemma pprt_lbound: "pprt (lbound x) = float (0, 0)" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 296 | by (auto simp: float_def lbound_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 297 | |
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 298 | lemma nprt_ubound: "nprt (ubound x) = float (0, 0)" | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 299 | by (auto simp: float_def ubound_def) | 
| 
c55a07526dbe
cleaned up float theories; removed duplicate definitions and theorems
 hoelzl parents: 
42676diff
changeset | 300 | |
| 24301 | 301 | lemmas floatarith[simplified norm_0_1] = float_add float_add_l0 float_add_r0 float_mult float_mult_l0 float_mult_r0 | 
| 24653 | 302 | float_minus float_abs zero_le_float float_pprt float_nprt pprt_lbound nprt_ubound | 
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 303 | |
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 304 | (* for use with the compute oracle *) | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 305 | lemmas arith = binarith intarith intarithrel natarith powerarith floatarith not_false_eq_true not_true_eq_false | 
| 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 306 | |
| 28952 
15a4b2cf8c34
made repository layout more coherent with logical distribution structure; stripped some $Id$s
 haftmann parents: 
27366diff
changeset | 307 | use "~~/src/HOL/Tools/float_arith.ML" | 
| 20771 | 308 | |
| 16782 
b214f21ae396
- use TableFun instead of homebrew binary tree in am_interpreter.ML
 obua parents: diff
changeset | 309 | end |