src/HOL/Fields.thy
changeset 35090 88cc65ae046e
parent 35084 e25eedfc15ce
child 35216 7641e8d831d2
--- a/src/HOL/Fields.thy	Wed Feb 10 08:54:56 2010 +0100
+++ b/src/HOL/Fields.thy	Wed Feb 10 14:12:02 2010 +0100
@@ -1035,6 +1035,31 @@
   apply (simp add: order_less_imp_le)
 done
 
+
+lemma field_le_epsilon:
+  fixes x y :: "'a :: {division_by_zero,linordered_field}"
+  assumes e: "\<And>e. 0 < e \<Longrightarrow> x \<le> y + e"
+  shows "x \<le> y"
+proof (rule ccontr)
+  obtain two :: 'a where two: "two = 1 + 1" by simp
+  assume "\<not> x \<le> y"
+  then have yx: "y < x" by simp
+  then have "y + - y < x + - y" by (rule add_strict_right_mono)
+  then have "x - y > 0" by (simp add: diff_minus)
+  then have "(x - y) / two > 0"
+    by (rule divide_pos_pos) (simp add: two)
+  then have "x \<le> y + (x - y) / two" by (rule e)
+  also have "... = (x - y + two * y) / two"
+    by (simp add: add_divide_distrib two)
+  also have "... = (x + y) / two" 
+    by (simp add: two algebra_simps)
+  also have "... < x" using yx
+    by (simp add: two pos_divide_less_eq algebra_simps)
+  finally have "x < x" .
+  then show False ..
+qed
+
+
 code_modulename SML
   Fields Arith