src/HOL/Hyperreal/HyperDef.thy
changeset 14329 ff3210fe968f
parent 14305 f17ca9f6dc8c
child 14331 8dbbb7cf3637
--- a/src/HOL/Hyperreal/HyperDef.thy	Wed Dec 24 08:54:30 2003 +0100
+++ b/src/HOL/Hyperreal/HyperDef.thy	Thu Dec 25 22:48:32 2003 +0100
@@ -84,12 +84,14 @@
   hypreal_le_def:
   "P <= (Q::hypreal) == ~(Q < P)"
 
-(*------------------------------------------------------------------------
-             Proof that the set of naturals is not finite
- ------------------------------------------------------------------------*)
+  hrabs_def:  "abs (r::hypreal) == (if 0 \<le> r then r else -r)"
+
+
+subsection{*The Set of Naturals is not Finite*}
 
 (*** based on James' proof that the set of naturals is not finite ***)
-lemma finite_exhausts [rule_format (no_asm)]: "finite (A::nat set) --> (\<exists>n. \<forall>m. Suc (n + m) \<notin> A)"
+lemma finite_exhausts [rule_format]:
+     "finite (A::nat set) --> (\<exists>n. \<forall>m. Suc (n + m) \<notin> A)"
 apply (rule impI)
 apply (erule_tac F = A in finite_induct)
 apply (blast, erule exE)
@@ -98,16 +100,18 @@
 apply (auto simp add: add_ac)
 done
 
-lemma finite_not_covers [rule_format (no_asm)]: "finite (A :: nat set) --> (\<exists>n. n \<notin>A)"
+lemma finite_not_covers [rule_format (no_asm)]:
+     "finite (A :: nat set) --> (\<exists>n. n \<notin>A)"
 by (rule impI, drule finite_exhausts, blast)
 
 lemma not_finite_nat: "~ finite(UNIV:: nat set)"
 by (fast dest!: finite_exhausts)
 
-(*------------------------------------------------------------------------
-   Existence of free ultrafilter over the naturals and proof of various 
-   properties of the FreeUltrafilterNat- an arbitrary free ultrafilter
- ------------------------------------------------------------------------*)
+
+subsection{*Existence of Free Ultrafilter over the Naturals*}
+
+text{*Also, proof of various properties of @{term FreeUltrafilterNat}: 
+an arbitrary free ultrafilter*}
 
 lemma FreeUltrafilterNat_Ex: "\<exists>U. U: FreeUltrafilter (UNIV::nat set)"
 by (rule not_finite_nat [THEN FreeUltrafilter_Ex])
@@ -137,33 +141,39 @@
                    Filter_empty_not_mem)
 done
 
-lemma FreeUltrafilterNat_Int: "[| X: FreeUltrafilterNat;  Y: FreeUltrafilterNat |]   
+lemma FreeUltrafilterNat_Int:
+     "[| X: FreeUltrafilterNat;  Y: FreeUltrafilterNat |]   
       ==> X Int Y \<in> FreeUltrafilterNat"
 apply (cut_tac FreeUltrafilterNat_mem)
 apply (blast dest: FreeUltrafilter_Ultrafilter Ultrafilter_Filter mem_FiltersetD1)
 done
 
-lemma FreeUltrafilterNat_subset: "[| X: FreeUltrafilterNat;  X <= Y |]  
+lemma FreeUltrafilterNat_subset:
+     "[| X: FreeUltrafilterNat;  X <= Y |]  
       ==> Y \<in> FreeUltrafilterNat"
 apply (cut_tac FreeUltrafilterNat_mem)
 apply (blast dest: FreeUltrafilter_Ultrafilter Ultrafilter_Filter mem_FiltersetD2)
 done
 
-lemma FreeUltrafilterNat_Compl: "X: FreeUltrafilterNat ==> -X \<notin> FreeUltrafilterNat"
+lemma FreeUltrafilterNat_Compl:
+     "X: FreeUltrafilterNat ==> -X \<notin> FreeUltrafilterNat"
 apply safe
 apply (drule FreeUltrafilterNat_Int, assumption, auto)
 done
 
-lemma FreeUltrafilterNat_Compl_mem: "X\<notin> FreeUltrafilterNat ==> -X \<in> FreeUltrafilterNat"
+lemma FreeUltrafilterNat_Compl_mem:
+     "X\<notin> FreeUltrafilterNat ==> -X \<in> FreeUltrafilterNat"
 apply (cut_tac FreeUltrafilterNat_mem [THEN FreeUltrafilter_iff [THEN iffD1]])
 apply (safe, drule_tac x = X in bspec)
 apply (auto simp add: UNIV_diff_Compl)
 done
 
-lemma FreeUltrafilterNat_Compl_iff1: "(X \<notin> FreeUltrafilterNat) = (-X: FreeUltrafilterNat)"
+lemma FreeUltrafilterNat_Compl_iff1:
+     "(X \<notin> FreeUltrafilterNat) = (-X: FreeUltrafilterNat)"
 by (blast dest: FreeUltrafilterNat_Compl FreeUltrafilterNat_Compl_mem)
 
-lemma FreeUltrafilterNat_Compl_iff2: "(X: FreeUltrafilterNat) = (-X \<notin> FreeUltrafilterNat)"
+lemma FreeUltrafilterNat_Compl_iff2:
+     "(X: FreeUltrafilterNat) = (-X \<notin> FreeUltrafilterNat)"
 by (auto simp add: FreeUltrafilterNat_Compl_iff1 [symmetric])
 
 lemma FreeUltrafilterNat_UNIV [simp]: "(UNIV::nat set) \<in> FreeUltrafilterNat"
@@ -172,7 +182,8 @@
 lemma FreeUltrafilterNat_Nat_set [simp]: "UNIV \<in> FreeUltrafilterNat"
 by auto
 
-lemma FreeUltrafilterNat_Nat_set_refl [intro]: "{n. P(n) = P(n)} \<in> FreeUltrafilterNat"
+lemma FreeUltrafilterNat_Nat_set_refl [intro]:
+     "{n. P(n) = P(n)} \<in> FreeUltrafilterNat"
 by simp
 
 lemma FreeUltrafilterNat_P: "{n::nat. P} \<in> FreeUltrafilterNat ==> P"
@@ -184,9 +195,8 @@
 lemma FreeUltrafilterNat_all: "\<forall>n. P(n) ==> {n. P(n)} \<in> FreeUltrafilterNat"
 by (auto intro: FreeUltrafilterNat_Nat_set)
 
-(*-------------------------------------------------------
-     Define and use Ultrafilter tactics
- -------------------------------------------------------*)
+
+text{*Define and use Ultrafilter tactics*}
 use "fuf.ML"
 
 method_setup fuf = {*
@@ -204,21 +214,18 @@
     "ultrafilter tactic"
 
 
-(*-------------------------------------------------------
-  Now prove one further property of our free ultrafilter
- -------------------------------------------------------*)
-lemma FreeUltrafilterNat_Un: "X Un Y: FreeUltrafilterNat  
+text{*One further property of our free ultrafilter*}
+lemma FreeUltrafilterNat_Un:
+     "X Un Y: FreeUltrafilterNat  
       ==> X: FreeUltrafilterNat | Y: FreeUltrafilterNat"
 apply auto
 apply ultra
 done
 
-(*-------------------------------------------------------
-   Properties of hyprel
- -------------------------------------------------------*)
 
-(** Proving that hyprel is an equivalence relation **)
-(** Natural deduction for hyprel **)
+subsection{*Properties of @{term hyprel}*}
+
+text{*Proving that @{term hyprel} is an equivalence relation*}
 
 lemma hyprel_iff: "((X,Y): hyprel) = ({n. X n = Y n}: FreeUltrafilterNat)"
 by (unfold hyprel_def, fast)
@@ -281,9 +288,8 @@
 by (cut_tac x = x in Rep_hypreal, auto)
 
 
-(*------------------------------------------------------------------------
-   hypreal_of_real: the injection from real to hypreal
- ------------------------------------------------------------------------*)
+subsection{*@{term hypreal_of_real}: 
+            the Injection from @{typ real} to @{typ hypreal}*}
 
 lemma inj_hypreal_of_real: "inj(hypreal_of_real)"
 apply (rule inj_onI)
@@ -302,7 +308,61 @@
 apply (force simp add: Rep_hypreal_inverse)
 done
 
-(**** hypreal_minus: additive inverse on hypreal ****)
+
+subsection{*Hyperreal Addition*}
+
+lemma hypreal_add_congruent2: 
+    "congruent2 hyprel (%X Y. hyprel``{%n. X n + Y n})"
+apply (unfold congruent2_def, auto, ultra)
+done
+
+lemma hypreal_add: 
+  "Abs_hypreal(hyprel``{%n. X n}) + Abs_hypreal(hyprel``{%n. Y n}) =  
+   Abs_hypreal(hyprel``{%n. X n + Y n})"
+apply (unfold hypreal_add_def)
+apply (simp add: UN_equiv_class2 [OF equiv_hyprel hypreal_add_congruent2])
+done
+
+lemma hypreal_add_commute: "(z::hypreal) + w = w + z"
+apply (rule_tac z = z in eq_Abs_hypreal)
+apply (rule_tac z = w in eq_Abs_hypreal)
+apply (simp add: real_add_ac hypreal_add)
+done
+
+lemma hypreal_add_assoc: "((z1::hypreal) + z2) + z3 = z1 + (z2 + z3)"
+apply (rule_tac z = z1 in eq_Abs_hypreal)
+apply (rule_tac z = z2 in eq_Abs_hypreal)
+apply (rule_tac z = z3 in eq_Abs_hypreal)
+apply (simp add: hypreal_add real_add_assoc)
+done
+
+(*For AC rewriting*)
+lemma hypreal_add_left_commute: "(x::hypreal)+(y+z)=y+(x+z)"
+  apply (rule mk_left_commute [of "op +"])
+  apply (rule hypreal_add_assoc)
+  apply (rule hypreal_add_commute)
+  done
+
+(* hypreal addition is an AC operator *)
+lemmas hypreal_add_ac =
+       hypreal_add_assoc hypreal_add_commute hypreal_add_left_commute
+
+lemma hypreal_add_zero_left [simp]: "(0::hypreal) + z = z"
+apply (unfold hypreal_zero_def)
+apply (rule_tac z = z in eq_Abs_hypreal)
+apply (simp add: hypreal_add)
+done
+
+instance hypreal :: plus_ac0
+  by (intro_classes,
+      (assumption | 
+       rule hypreal_add_commute hypreal_add_assoc hypreal_add_zero_left)+)
+
+lemma hypreal_add_zero_right [simp]: "z + (0::hypreal) = z"
+by (simp add: hypreal_add_zero_left hypreal_add_commute)
+
+
+subsection{*Additive inverse on @{typ hypreal}*}
 
 lemma hypreal_minus_congruent: 
   "congruent hyprel (%X. hyprel``{%n. - (X n)})"
@@ -337,59 +397,12 @@
 apply (auto simp add: hypreal_zero_def hypreal_minus)
 done
 
-
-(**** hyperreal addition: hypreal_add  ****)
-
-lemma hypreal_add_congruent2: 
-    "congruent2 hyprel (%X Y. hyprel``{%n. X n + Y n})"
-apply (unfold congruent2_def, auto, ultra)
-done
-
-lemma hypreal_add: 
-  "Abs_hypreal(hyprel``{%n. X n}) + Abs_hypreal(hyprel``{%n. Y n}) =  
-   Abs_hypreal(hyprel``{%n. X n + Y n})"
-apply (unfold hypreal_add_def)
-apply (simp add: UN_equiv_class2 [OF equiv_hyprel hypreal_add_congruent2])
-done
-
-lemma hypreal_diff: "Abs_hypreal(hyprel``{%n. X n}) - Abs_hypreal(hyprel``{%n. Y n}) =  
+lemma hypreal_diff:
+     "Abs_hypreal(hyprel``{%n. X n}) - Abs_hypreal(hyprel``{%n. Y n}) =  
       Abs_hypreal(hyprel``{%n. X n - Y n})"
 apply (simp add: hypreal_diff_def hypreal_minus hypreal_add)
 done
 
-lemma hypreal_add_commute: "(z::hypreal) + w = w + z"
-apply (rule_tac z = z in eq_Abs_hypreal)
-apply (rule_tac z = w in eq_Abs_hypreal)
-apply (simp add: real_add_ac hypreal_add)
-done
-
-lemma hypreal_add_assoc: "((z1::hypreal) + z2) + z3 = z1 + (z2 + z3)"
-apply (rule_tac z = z1 in eq_Abs_hypreal)
-apply (rule_tac z = z2 in eq_Abs_hypreal)
-apply (rule_tac z = z3 in eq_Abs_hypreal)
-apply (simp add: hypreal_add real_add_assoc)
-done
-
-(*For AC rewriting*)
-lemma hypreal_add_left_commute: "(x::hypreal)+(y+z)=y+(x+z)"
-  apply (rule mk_left_commute [of "op +"])
-  apply (rule hypreal_add_assoc)
-  apply (rule hypreal_add_commute)
-  done
-
-(* hypreal addition is an AC operator *)
-lemmas hypreal_add_ac =
-       hypreal_add_assoc hypreal_add_commute hypreal_add_left_commute
-
-lemma hypreal_add_zero_left [simp]: "(0::hypreal) + z = z"
-apply (unfold hypreal_zero_def)
-apply (rule_tac z = z in eq_Abs_hypreal)
-apply (simp add: hypreal_add)
-done
-
-lemma hypreal_add_zero_right [simp]: "z + (0::hypreal) = z"
-by (simp add: hypreal_add_zero_left hypreal_add_commute)
-
 lemma hypreal_add_minus [simp]: "z + -z = (0::hypreal)"
 apply (unfold hypreal_zero_def)
 apply (rule_tac z = z in eq_Abs_hypreal)
@@ -399,42 +412,6 @@
 lemma hypreal_add_minus_left [simp]: "-z + z = (0::hypreal)"
 by (simp add: hypreal_add_commute hypreal_add_minus)
 
-lemma hypreal_minus_ex: "\<exists>y. (x::hypreal) + y = 0"
-by (fast intro: hypreal_add_minus)
-
-lemma hypreal_minus_ex1: "EX! y. (x::hypreal) + y = 0"
-apply (auto intro: hypreal_add_minus)
-apply (drule_tac f = "%x. ya+x" in arg_cong)
-apply (simp add: hypreal_add_assoc [symmetric])
-apply (simp add: hypreal_add_commute)
-done
-
-lemma hypreal_minus_left_ex1: "EX! y. y + (x::hypreal) = 0"
-apply (auto intro: hypreal_add_minus_left)
-apply (drule_tac f = "%x. x+ya" in arg_cong)
-apply (simp add: hypreal_add_assoc)
-apply (simp add: hypreal_add_commute)
-done
-
-lemma hypreal_add_minus_eq_minus: "x + y = (0::hypreal) ==> x = -y"
-apply (cut_tac z = y in hypreal_add_minus_left)
-apply (rule_tac x1 = y in hypreal_minus_left_ex1 [THEN ex1E], blast)
-done
-
-lemma hypreal_as_add_inverse_ex: "\<exists>y::hypreal. x = -y"
-apply (cut_tac x = x in hypreal_minus_ex)
-apply (erule exE, drule hypreal_add_minus_eq_minus, fast)
-done
-
-lemma hypreal_minus_add_distrib [simp]: "-(x + (y::hypreal)) = -x + -y"
-apply (rule_tac z = x in eq_Abs_hypreal)
-apply (rule_tac z = y in eq_Abs_hypreal)
-apply (auto simp add: hypreal_minus hypreal_add real_minus_add_distrib)
-done
-
-lemma hypreal_minus_distrib1: "-(y + -(x::hypreal)) = x + -y"
-by (simp add: hypreal_add_commute)
-
 lemma hypreal_add_left_cancel: "((x::hypreal) + y = x + z) = (y = z)"
 apply safe
 apply (drule_tac f = "%t.-x + t" in arg_cong)
@@ -450,7 +427,8 @@
 lemma hypreal_minus_add_cancelA [simp]: "(-z) + (z + w) = (w::hypreal)"
 by (simp add: hypreal_add_assoc [symmetric])
 
-(**** hyperreal multiplication: hypreal_mult  ****)
+
+subsection{*Hyperreal Multiplication*}
 
 lemma hypreal_mult_congruent2: 
     "congruent2 hyprel (%X Y. hyprel``{%n. X n * Y n})"
@@ -530,30 +508,30 @@
 lemma hypreal_minus_mult_commute: "(-x) * y = (x::hypreal) * -y"
 by auto
 
-(*-----------------------------------------------------------------------------
-    A few more theorems
- ----------------------------------------------------------------------------*)
-lemma hypreal_add_assoc_cong: "(z::hypreal) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"
-by (simp add: hypreal_add_assoc [symmetric])
+subsection{*A few more theorems *}
 
-lemma hypreal_add_mult_distrib: "((z1::hypreal) + z2) * w = (z1 * w) + (z2 * w)"
+lemma hypreal_add_mult_distrib:
+     "((z1::hypreal) + z2) * w = (z1 * w) + (z2 * w)"
 apply (rule_tac z = z1 in eq_Abs_hypreal)
 apply (rule_tac z = z2 in eq_Abs_hypreal)
 apply (rule_tac z = w in eq_Abs_hypreal)
 apply (simp add: hypreal_mult hypreal_add real_add_mult_distrib)
 done
 
-lemma hypreal_add_mult_distrib2: "(w::hypreal) * (z1 + z2) = (w * z1) + (w * z2)"
+lemma hypreal_add_mult_distrib2:
+     "(w::hypreal) * (z1 + z2) = (w * z1) + (w * z2)"
 by (simp add: hypreal_mult_commute [of w] hypreal_add_mult_distrib)
 
 
-lemma hypreal_diff_mult_distrib: "((z1::hypreal) - z2) * w = (z1 * w) - (z2 * w)"
+lemma hypreal_diff_mult_distrib:
+     "((z1::hypreal) - z2) * w = (z1 * w) - (z2 * w)"
 
 apply (unfold hypreal_diff_def)
 apply (simp add: hypreal_add_mult_distrib)
 done
 
-lemma hypreal_diff_mult_distrib2: "(w::hypreal) * (z1 - z2) = (w * z1) - (w * z2)"
+lemma hypreal_diff_mult_distrib2:
+     "(w::hypreal) * (z1 - z2) = (w * z1) - (w * z2)"
 by (simp add: hypreal_mult_commute [of w] hypreal_diff_mult_distrib)
 
 (*** one and zero are distinct ***)
@@ -563,7 +541,7 @@
 done
 
 
-(**** multiplicative inverse on hypreal ****)
+subsection{*Multiplicative Inverse on @{typ hypreal} *}
 
 lemma hypreal_inverse_congruent: 
   "congruent hyprel (%X. hyprel``{%n. if X n = 0 then 0 else inverse(X n)})"
@@ -586,19 +564,15 @@
 lemma HYPREAL_DIVISION_BY_ZERO: "a / (0::hypreal) = 0"
 by (simp add: hypreal_divide_def HYPREAL_INVERSE_ZERO)
 
-lemma hypreal_inverse_inverse [simp]: "inverse (inverse (z::hypreal)) = z"
-apply (case_tac "z=0", simp add: HYPREAL_INVERSE_ZERO)
-apply (rule_tac z = z in eq_Abs_hypreal)
-apply (simp add: hypreal_inverse hypreal_zero_def)
-done
-
-lemma hypreal_inverse_1 [simp]: "inverse((1::hypreal)) = (1::hypreal)"
-apply (unfold hypreal_one_def)
-apply (simp add: hypreal_inverse real_zero_not_eq_one [THEN not_sym])
-done
+instance hypreal :: division_by_zero
+proof
+  fix x :: hypreal
+  show "inverse 0 = (0::hypreal)" by (rule HYPREAL_INVERSE_ZERO)
+  show "x/0 = 0" by (rule HYPREAL_DIVISION_BY_ZERO) 
+qed
 
 
-(*** existence of inverse ***)
+subsection{*Existence of Inverse*}
 
 lemma hypreal_mult_inverse [simp]: 
      "x \<noteq> 0 ==> x*inverse(x) = (1::hypreal)"
@@ -609,99 +583,33 @@
 apply (blast intro!: real_mult_inv_right FreeUltrafilterNat_subset)
 done
 
-lemma hypreal_mult_inverse_left [simp]: "x \<noteq> 0 ==> inverse(x)*x = (1::hypreal)"
+lemma hypreal_mult_inverse_left [simp]:
+     "x \<noteq> 0 ==> inverse(x)*x = (1::hypreal)"
 by (simp add: hypreal_mult_inverse hypreal_mult_commute)
 
-lemma hypreal_mult_left_cancel: "(c::hypreal) \<noteq> 0 ==> (c*a=c*b) = (a=b)"
-apply auto
-apply (drule_tac f = "%x. x*inverse c" in arg_cong)
-apply (simp add: hypreal_mult_inverse hypreal_mult_ac)
-done
-    
-lemma hypreal_mult_right_cancel: "(c::hypreal) \<noteq> 0 ==> (a*c=b*c) = (a=b)"
-apply safe
-apply (drule_tac f = "%x. x*inverse c" in arg_cong)
-apply (simp add: hypreal_mult_inverse hypreal_mult_ac)
-done
+
+subsection{*Theorems for Ordering*}
+
+text{*TODO: define @{text "\<le>"} as the primitive concept and quickly 
+establish membership in class @{text linorder}. Then proofs could be
+simplified, since properties of @{text "<"} would be generic.*}
 
-lemma hypreal_inverse_not_zero: "x \<noteq> 0 ==> inverse (x::hypreal) \<noteq> 0"
-apply (unfold hypreal_zero_def)
-apply (rule_tac z = x in eq_Abs_hypreal)
-apply (simp add: hypreal_inverse hypreal_mult)
-done
-
-
-lemma hypreal_mult_not_0: "[| x \<noteq> 0; y \<noteq> 0 |] ==> x * y \<noteq> (0::hypreal)"
-apply safe
-apply (drule_tac f = "%z. inverse x*z" in arg_cong)
-apply (simp add: hypreal_mult_assoc [symmetric])
-done
-
-lemma hypreal_mult_zero_disj: "x*y = (0::hypreal) ==> x = 0 | y = 0"
-by (auto intro: ccontr dest: hypreal_mult_not_0)
-
-lemma hypreal_minus_inverse: "inverse(-x) = -inverse(x::hypreal)"
-apply (case_tac "x=0", simp add: HYPREAL_INVERSE_ZERO)
-apply (rule hypreal_mult_right_cancel [of "-x", THEN iffD1], simp) 
-apply (subst hypreal_mult_inverse_left, auto)
+text{*TODO: The following theorem should be used througout the proofs
+  as it probably makes many of them more straightforward.*}
+lemma hypreal_less: 
+      "(Abs_hypreal(hyprel``{%n. X n}) < Abs_hypreal(hyprel``{%n. Y n})) =  
+       ({n. X n < Y n} \<in> FreeUltrafilterNat)"
+apply (unfold hypreal_less_def)
+apply (auto intro!: lemma_hyprel_refl, ultra)
 done
 
-lemma hypreal_inverse_distrib: "inverse(x*y) = inverse(x)*inverse(y::hypreal)"
-apply (case_tac "x=0", simp add: HYPREAL_INVERSE_ZERO)
-apply (case_tac "y=0", simp add: HYPREAL_INVERSE_ZERO)
-apply (frule_tac y = y in hypreal_mult_not_0, assumption)
-apply (rule_tac c1 = x in hypreal_mult_left_cancel [THEN iffD1])
-apply (auto simp add: hypreal_mult_assoc [symmetric])
-apply (rule_tac c1 = y in hypreal_mult_left_cancel [THEN iffD1])
-apply (auto simp add: hypreal_mult_left_commute)
-apply (simp add: hypreal_mult_assoc [symmetric])
-done
-
-(*------------------------------------------------------------------
-                   Theorems for ordering 
- ------------------------------------------------------------------*)
-
 (* prove introduction and elimination rules for hypreal_less *)
 
-lemma hypreal_less_iff: 
- "(P < (Q::hypreal)) = (\<exists>X Y. X \<in> Rep_hypreal(P) &  
-                              Y \<in> Rep_hypreal(Q) &  
-                              {n. X n < Y n} \<in> FreeUltrafilterNat)"
-
-apply (unfold hypreal_less_def, fast)
-done
-
-lemma hypreal_lessI: 
- "[| {n. X n < Y n} \<in> FreeUltrafilterNat;  
-          X \<in> Rep_hypreal(P);  
-          Y \<in> Rep_hypreal(Q) |] ==> P < (Q::hypreal)"
-apply (unfold hypreal_less_def, fast)
-done
-
-
-lemma hypreal_lessE: 
-     "!! R1. [| R1 < (R2::hypreal);  
-          !!X Y. {n. X n < Y n} \<in> FreeUltrafilterNat ==> P;  
-          !!X. X \<in> Rep_hypreal(R1) ==> P;   
-          !!Y. Y \<in> Rep_hypreal(R2) ==> P |]  
-      ==> P"
-
-apply (unfold hypreal_less_def, auto)
-done
-
-lemma hypreal_lessD: 
- "R1 < (R2::hypreal) ==> (\<exists>X Y. {n. X n < Y n} \<in> FreeUltrafilterNat &  
-                                   X \<in> Rep_hypreal(R1) &  
-                                   Y \<in> Rep_hypreal(R2))"
-apply (unfold hypreal_less_def, fast)
-done
-
 lemma hypreal_less_not_refl: "~ (R::hypreal) < R"
 apply (rule_tac z = R in eq_Abs_hypreal)
 apply (auto simp add: hypreal_less_def, ultra)
 done
 
-(*** y < y ==> P ***)
 lemmas hypreal_less_irrefl = hypreal_less_not_refl [THEN notE, standard]
 declare hypreal_less_irrefl [elim!]
 
@@ -720,25 +628,10 @@
 apply (simp add: hypreal_less_not_refl)
 done
 
-(*-------------------------------------------------------
-  TODO: The following theorem should have been proved 
-  first and then used througout the proofs as it probably 
-  makes many of them more straightforward. 
- -------------------------------------------------------*)
-lemma hypreal_less: 
-      "(Abs_hypreal(hyprel``{%n. X n}) <  
-            Abs_hypreal(hyprel``{%n. Y n})) =  
-       ({n. X n < Y n} \<in> FreeUltrafilterNat)"
-apply (unfold hypreal_less_def)
-apply (auto intro!: lemma_hyprel_refl, ultra)
-done
 
-(*----------------------------------------------------------------------------
-		 Trichotomy: the hyperreals are linearly ordered
-  ---------------------------------------------------------------------------*)
+subsection{*Trichotomy: the hyperreals are Linearly Ordered*}
 
 lemma lemma_hyprel_0_mem: "\<exists>x. x: hyprel `` {%n. 0}"
-
 apply (unfold hyprel_def)
 apply (rule_tac x = "%n. 0" in exI, safe)
 apply (auto intro!: FreeUltrafilterNat_Nat_set)
@@ -763,9 +656,7 @@
 apply (insert hypreal_trichotomy [of x], blast) 
 done
 
-(*----------------------------------------------------------------------------
-            More properties of <
- ----------------------------------------------------------------------------*)
+subsection{*More properties of Less Than*}
 
 lemma hypreal_less_minus_iff: "((x::hypreal) < y) = (0 < y + -x)"
 apply (rule_tac z = x in eq_Abs_hypreal)
@@ -789,24 +680,8 @@
 apply (rule_tac x1 = "-x" in hypreal_add_right_cancel [THEN iffD1], auto)
 done
 
-(* 07/00 *)
-lemma hypreal_diff_zero [simp]: "(0::hypreal) - x = -x"
-by (simp add: hypreal_diff_def)
 
-lemma hypreal_diff_zero_right [simp]: "x - (0::hypreal) = x"
-by (simp add: hypreal_diff_def)
-
-lemma hypreal_diff_self [simp]: "x - x = (0::hypreal)"
-by (simp add: hypreal_diff_def)
-
-lemma hypreal_eq_minus_iff3: "(x = y + z) = (x + -z = (y::hypreal))"
-by (auto simp add: hypreal_add_assoc)
-
-lemma hypreal_not_eq_minus_iff: "(x \<noteq> a) = (x + -a \<noteq> (0::hypreal))"
-by (auto dest: hypreal_eq_minus_iff [THEN iffD2])
-
-
-(*** linearity ***)
+subsection{*Linearity*}
 
 lemma hypreal_linear: "(x::hypreal) < y | x = y | y < x"
 apply (subst hypreal_eq_minus_iff2)
@@ -823,10 +698,8 @@
 apply (cut_tac x = x and y = y in hypreal_linear, auto)
 done
 
-(*------------------------------------------------------------------------------
-                            Properties of <=
- ------------------------------------------------------------------------------*)
-(*------ hypreal le iff reals le a.e ------*)
+
+subsection{*Properties of The @{text "\<le>"} Relation*}
 
 lemma hypreal_le: 
       "(Abs_hypreal(hyprel``{%n. X n}) <=  
@@ -837,8 +710,6 @@
 apply (ultra+)
 done
 
-(*---------------------------------------------------------*)
-(*---------------------------------------------------------*)
 lemma hypreal_leI: 
      "~(w < z) ==> z <= (w::hypreal)"
 apply (unfold hypreal_le_def, assumption)
@@ -894,17 +765,21 @@
 apply (fast elim: hypreal_less_irrefl hypreal_less_asym)
 done
 
-lemma not_less_not_eq_hypreal_less: "[| ~ y < x; y \<noteq> x |] ==> x < (y::hypreal)"
-apply (rule not_hypreal_leE)
-apply (fast dest: hypreal_le_imp_less_or_eq)
-done
-
 (* Axiom 'order_less_le' of class 'order': *)
 lemma hypreal_less_le: "((w::hypreal) < z) = (w <= z & w \<noteq> z)"
 apply (simp add: hypreal_le_def hypreal_neq_iff)
 apply (blast intro: hypreal_less_asym)
 done
 
+instance hypreal :: order
+  by (intro_classes,
+      (assumption | 
+       rule hypreal_le_refl hypreal_le_trans hypreal_le_anti_sym
+            hypreal_less_le)+)
+
+instance hypreal :: linorder 
+  by (intro_classes, rule hypreal_le_linear)
+
 lemma hypreal_minus_zero_less_iff [simp]: "(0 < -R) = (R < (0::hypreal))"
 apply (rule_tac z = R in eq_Abs_hypreal)
 apply (auto simp add: hypreal_zero_def hypreal_less hypreal_minus)
@@ -925,9 +800,141 @@
 apply (simp add: hypreal_minus_zero_less_iff2)
 done
 
-(*----------------------------------------------------------
-  hypreal_of_real preserves field and order properties
- -----------------------------------------------------------*)
+
+lemma hypreal_self_eq_minus_self_zero: "x = -x ==> x = (0::hypreal)"
+apply (rule_tac z = x in eq_Abs_hypreal)
+apply (auto simp add: hypreal_minus hypreal_zero_def, ultra)
+done
+
+lemma hypreal_add_self_zero_cancel [simp]: "(x + x = 0) = (x = (0::hypreal))"
+apply (rule_tac z = x in eq_Abs_hypreal)
+apply (auto simp add: hypreal_add hypreal_zero_def)
+done
+
+lemma hypreal_add_self_zero_cancel2 [simp]:
+     "(x + x + y = y) = (x = (0::hypreal))"
+apply auto
+apply (drule hypreal_eq_minus_iff [THEN iffD1])
+apply (auto simp add: hypreal_add_assoc hypreal_self_eq_minus_self_zero)
+done
+
+lemma hypreal_minus_eq_swap: "(b = -a) = (-b = (a::hypreal))"
+by auto
+
+lemma hypreal_minus_eq_cancel [simp]: "(-b = -a) = (b = (a::hypreal))"
+by (simp add: hypreal_minus_eq_swap)
+
+lemma hypreal_add_less_mono1: "(A::hypreal) < B ==> A + C < B + C"
+apply (rule_tac z = A in eq_Abs_hypreal)
+apply (rule_tac z = B in eq_Abs_hypreal)
+apply (rule_tac z = C in eq_Abs_hypreal)
+apply (auto intro!: exI simp add: hypreal_less_def hypreal_add, ultra)
+done
+
+lemma hypreal_mult_order: "[| 0 < x; 0 < y |] ==> (0::hypreal) < x * y"
+apply (unfold hypreal_zero_def)
+apply (rule_tac z = x in eq_Abs_hypreal)
+apply (rule_tac z = y in eq_Abs_hypreal)
+apply (auto intro!: exI simp add: hypreal_less_def hypreal_mult, ultra)
+apply (auto intro: real_mult_order)
+done
+
+lemma hypreal_add_left_le_mono1: "(q1::hypreal) \<le> q2  ==> x + q1 \<le> x + q2"
+apply (drule order_le_imp_less_or_eq)
+apply (auto intro: order_less_imp_le hypreal_add_less_mono1 simp add: hypreal_add_commute)
+done
+
+lemma hypreal_mult_less_mono1: "[| (0::hypreal) < z; x < y |] ==> x*z < y*z"
+apply (rotate_tac 1)
+apply (drule hypreal_less_minus_iff [THEN iffD1])
+apply (rule hypreal_less_minus_iff [THEN iffD2])
+apply (drule hypreal_mult_order, assumption)
+apply (simp add: hypreal_add_mult_distrib2 hypreal_mult_commute)
+done
+
+lemma hypreal_mult_less_mono2: "[| (0::hypreal)<z; x<y |] ==> z*x<z*y"
+apply (simp (no_asm_simp) add: hypreal_mult_commute hypreal_mult_less_mono1)
+done
+
+subsection{*The Hyperreals Form an Ordered Field*}
+
+instance hypreal :: inverse ..
+
+instance hypreal :: ordered_field
+proof
+  fix x y z :: hypreal
+  show "(x + y) + z = x + (y + z)" by (rule hypreal_add_assoc)
+  show "x + y = y + x" by (rule hypreal_add_commute)
+  show "0 + x = x" by simp
+  show "- x + x = 0" by simp
+  show "x - y = x + (-y)" by (simp add: hypreal_diff_def)
+  show "(x * y) * z = x * (y * z)" by (rule hypreal_mult_assoc)
+  show "x * y = y * x" by (rule hypreal_mult_commute)
+  show "1 * x = x" by simp
+  show "(x + y) * z = x * z + y * z" by (simp add: hypreal_add_mult_distrib)
+  show "0 \<noteq> (1::hypreal)" by (rule hypreal_zero_not_eq_one)
+  show "x \<le> y ==> z + x \<le> z + y" by (rule hypreal_add_left_le_mono1)
+  show "x < y ==> 0 < z ==> z * x < z * y" by (simp add: hypreal_mult_less_mono2)
+  show "\<bar>x\<bar> = (if x < 0 then -x else x)"
+    by (auto dest: order_le_less_trans simp add: hrabs_def linorder_not_le)
+  show "x \<noteq> 0 ==> inverse x * x = 1" by simp
+  show "y \<noteq> 0 ==> x / y = x * inverse y" by (simp add: hypreal_divide_def)
+qed
+
+lemma hypreal_minus_add_distrib [simp]: "-(x + (y::hypreal)) = -x + -y"
+  by (rule Ring_and_Field.minus_add_distrib)
+
+(*Used ONCE: in NSA.ML*)
+lemma hypreal_minus_distrib1: "-(y + -(x::hypreal)) = x + -y"
+by (simp add: hypreal_add_commute)
+
+(*Used ONCE: in Lim.ML*)
+lemma hypreal_eq_minus_iff3: "(x = y + z) = (x + -z = (y::hypreal))"
+by (auto simp add: hypreal_add_assoc)
+
+lemma hypreal_not_eq_minus_iff: "(x \<noteq> a) = (x + -a \<noteq> (0::hypreal))"
+by (auto dest: hypreal_eq_minus_iff [THEN iffD2])
+
+lemma hypreal_mult_left_cancel: "(c::hypreal) \<noteq> 0 ==> (c*a=c*b) = (a=b)"
+apply auto
+done
+    
+lemma hypreal_mult_right_cancel: "(c::hypreal) \<noteq> 0 ==> (a*c=b*c) = (a=b)"
+apply auto
+done
+
+lemma hypreal_inverse_not_zero: "x \<noteq> 0 ==> inverse (x::hypreal) \<noteq> 0"
+  by (rule Ring_and_Field.nonzero_imp_inverse_nonzero)
+
+lemma hypreal_mult_not_0: "[| x \<noteq> 0; y \<noteq> 0 |] ==> x * y \<noteq> (0::hypreal)"
+by simp
+
+lemma hypreal_minus_inverse: "inverse(-x) = -inverse(x::hypreal)"
+  by (rule Ring_and_Field.inverse_minus_eq)
+
+lemma hypreal_inverse_distrib: "inverse(x*y) = inverse(x)*inverse(y::hypreal)"
+  by (rule Ring_and_Field.inverse_mult_distrib)
+
+
+subsection{* Division lemmas *}
+
+lemma hypreal_divide_one: "x/(1::hypreal) = x"
+by (simp add: hypreal_divide_def)
+
+
+(** As with multiplication, pull minus signs OUT of the / operator **)
+
+lemma hypreal_add_divide_distrib: "(x+y)/(z::hypreal) = x/z + y/z"
+  by (rule Ring_and_Field.add_divide_distrib)
+
+lemma hypreal_inverse_add:
+     "[|(x::hypreal) \<noteq> 0;  y \<noteq> 0 |]   
+      ==> inverse(x) + inverse(y) = (x + y)*inverse(x*y)"
+by (simp add: Ring_and_Field.inverse_add mult_assoc)
+
+
+subsection{*@{term hypreal_of_real} Preserves Field and Order Properties*}
+
 lemma hypreal_of_real_add [simp]: 
      "hypreal_of_real (z1 + z2) = hypreal_of_real z1 + hypreal_of_real z2"
 apply (unfold hypreal_of_real_def)
@@ -953,10 +960,12 @@
 apply (unfold hypreal_le_def real_le_def, auto)
 done
 
-lemma hypreal_of_real_eq_iff [simp]: "(hypreal_of_real z1 = hypreal_of_real z2) = (z1 = z2)"
+lemma hypreal_of_real_eq_iff [simp]:
+     "(hypreal_of_real z1 = hypreal_of_real z2) = (z1 = z2)"
 by (force intro: order_antisym hypreal_of_real_le_iff [THEN iffD1])
 
-lemma hypreal_of_real_minus [simp]: "hypreal_of_real (-r) = - hypreal_of_real  r"
+lemma hypreal_of_real_minus [simp]:
+     "hypreal_of_real (-r) = - hypreal_of_real  r"
 apply (unfold hypreal_of_real_def)
 apply (auto simp add: hypreal_minus)
 done
@@ -970,146 +979,20 @@
 lemma hypreal_of_real_zero_iff: "(hypreal_of_real r = 0) = (r = 0)"
 by (auto intro: FreeUltrafilterNat_P simp add: hypreal_of_real_def hypreal_zero_def FreeUltrafilterNat_Nat_set)
 
-lemma hypreal_of_real_inverse [simp]: "hypreal_of_real (inverse r) = inverse (hypreal_of_real r)"
+lemma hypreal_of_real_inverse [simp]:
+     "hypreal_of_real (inverse r) = inverse (hypreal_of_real r)"
 apply (case_tac "r=0")
 apply (simp add: DIVISION_BY_ZERO INVERSE_ZERO HYPREAL_INVERSE_ZERO)
 apply (rule_tac c1 = "hypreal_of_real r" in hypreal_mult_left_cancel [THEN iffD1])
 apply (auto simp add: hypreal_of_real_zero_iff hypreal_of_real_mult [symmetric])
 done
 
-lemma hypreal_of_real_divide [simp]: "hypreal_of_real (z1 / z2) = hypreal_of_real z1 / hypreal_of_real z2"
+lemma hypreal_of_real_divide [simp]:
+     "hypreal_of_real (z1 / z2) = hypreal_of_real z1 / hypreal_of_real z2"
 by (simp add: hypreal_divide_def real_divide_def)
 
 
-(*** Division lemmas ***)
-
-lemma hypreal_zero_divide: "(0::hypreal)/x = 0"
-by (simp add: hypreal_divide_def)
-
-lemma hypreal_divide_one: "x/(1::hypreal) = x"
-by (simp add: hypreal_divide_def)
-declare hypreal_zero_divide [simp] hypreal_divide_one [simp]
-
-lemma hypreal_divide_divide1_eq [simp]: "(x::hypreal) / (y/z) = (x*z)/y"
-by (simp add: hypreal_divide_def hypreal_inverse_distrib hypreal_mult_ac)
-
-lemma hypreal_divide_divide2_eq [simp]: "((x::hypreal) / y) / z = x/(y*z)"
-by (simp add: hypreal_divide_def hypreal_inverse_distrib hypreal_mult_assoc)
-
-
-(** As with multiplication, pull minus signs OUT of the / operator **)
-
-lemma hypreal_minus_divide_eq [simp]: "(-x) / (y::hypreal) = - (x/y)"
-by (simp add: hypreal_divide_def)
-
-lemma hypreal_divide_minus_eq [simp]: "(x / -(y::hypreal)) = - (x/y)"
-by (simp add: hypreal_divide_def hypreal_minus_inverse)
-
-lemma hypreal_add_divide_distrib: "(x+y)/(z::hypreal) = x/z + y/z"
-by (simp add: hypreal_divide_def hypreal_add_mult_distrib)
-
-lemma hypreal_inverse_add: "[|(x::hypreal) \<noteq> 0;  y \<noteq> 0 |]   
-      ==> inverse(x) + inverse(y) = (x + y)*inverse(x*y)"
-apply (simp add: hypreal_inverse_distrib hypreal_add_mult_distrib hypreal_mult_assoc [symmetric])
-apply (subst hypreal_mult_assoc)
-apply (rule hypreal_mult_left_commute [THEN subst])
-apply (simp add: hypreal_add_commute)
-done
-
-lemma hypreal_self_eq_minus_self_zero: "x = -x ==> x = (0::hypreal)"
-apply (rule_tac z = x in eq_Abs_hypreal)
-apply (auto simp add: hypreal_minus hypreal_zero_def, ultra)
-done
-
-lemma hypreal_add_self_zero_cancel [simp]: "(x + x = 0) = (x = (0::hypreal))"
-apply (rule_tac z = x in eq_Abs_hypreal)
-apply (auto simp add: hypreal_add hypreal_zero_def)
-done
-
-lemma hypreal_add_self_zero_cancel2 [simp]: "(x + x + y = y) = (x = (0::hypreal))"
-apply auto
-apply (drule hypreal_eq_minus_iff [THEN iffD1])
-apply (auto simp add: hypreal_add_assoc hypreal_self_eq_minus_self_zero)
-done
-
-lemma hypreal_add_self_zero_cancel2a [simp]: "(x + (x + y) = y) = (x = (0::hypreal))"
-by (simp add: hypreal_add_assoc [symmetric])
-
-lemma hypreal_minus_eq_swap: "(b = -a) = (-b = (a::hypreal))"
-by auto
-
-lemma hypreal_minus_eq_cancel [simp]: "(-b = -a) = (b = (a::hypreal))"
-by (simp add: hypreal_minus_eq_swap)
-
-lemma hypreal_less_eq_diff: "(x<y) = (x-y < (0::hypreal))"
-apply (unfold hypreal_diff_def)
-apply (rule hypreal_less_minus_iff2)
-done
-
-(*** Subtraction laws ***)
-
-lemma hypreal_add_diff_eq: "x + (y - z) = (x + y) - (z::hypreal)"
-by (simp add: hypreal_diff_def hypreal_add_ac)
-
-lemma hypreal_diff_add_eq: "(x - y) + z = (x + z) - (y::hypreal)"
-by (simp add: hypreal_diff_def hypreal_add_ac)
-
-lemma hypreal_diff_diff_eq: "(x - y) - z = x - (y + (z::hypreal))"
-by (simp add: hypreal_diff_def hypreal_add_ac)
-
-lemma hypreal_diff_diff_eq2: "x - (y - z) = (x + z) - (y::hypreal)"
-by (simp add: hypreal_diff_def hypreal_add_ac)
-
-lemma hypreal_diff_less_eq: "(x-y < z) = (x < z + (y::hypreal))"
-apply (subst hypreal_less_eq_diff)
-apply (rule_tac y1 = z in hypreal_less_eq_diff [THEN ssubst])
-apply (simp add: hypreal_diff_def hypreal_add_ac)
-done
-
-lemma hypreal_less_diff_eq: "(x < z-y) = (x + (y::hypreal) < z)"
-apply (subst hypreal_less_eq_diff)
-apply (rule_tac y1 = "z-y" in hypreal_less_eq_diff [THEN ssubst])
-apply (simp add: hypreal_diff_def hypreal_add_ac)
-done
-
-lemma hypreal_diff_le_eq: "(x-y <= z) = (x <= z + (y::hypreal))"
-apply (unfold hypreal_le_def)
-apply (simp add: hypreal_less_diff_eq)
-done
-
-lemma hypreal_le_diff_eq: "(x <= z-y) = (x + (y::hypreal) <= z)"
-apply (unfold hypreal_le_def)
-apply (simp add: hypreal_diff_less_eq)
-done
-
-lemma hypreal_diff_eq_eq: "(x-y = z) = (x = z + (y::hypreal))"
-apply (unfold hypreal_diff_def)
-apply (auto simp add: hypreal_add_assoc)
-done
-
-lemma hypreal_eq_diff_eq: "(x = z-y) = (x + (y::hypreal) = z)"
-apply (unfold hypreal_diff_def)
-apply (auto simp add: hypreal_add_assoc)
-done
-
-
-(** For the cancellation simproc.
-    The idea is to cancel like terms on opposite sides by subtraction **)
-
-lemma hypreal_less_eqI: "(x::hypreal) - y = x' - y' ==> (x<y) = (x'<y')"
-apply (subst hypreal_less_eq_diff)
-apply (rule_tac y1 = y in hypreal_less_eq_diff [THEN ssubst], simp)
-done
-
-lemma hypreal_le_eqI: "(x::hypreal) - y = x' - y' ==> (y<=x) = (y'<=x')"
-apply (drule hypreal_less_eqI)
-apply (simp add: hypreal_le_def)
-done
-
-lemma hypreal_eq_eqI: "(x::hypreal) - y = x' - y' ==> (x=y) = (x'=y')"
-apply safe
-apply (simp_all add: hypreal_eq_diff_eq hypreal_diff_eq_eq)
-done
+subsection{*Misc Others*}
 
 lemma hypreal_zero_num: "0 = Abs_hypreal (hyprel `` {%n. 0})"
 by (simp add: hypreal_zero_def [THEN meta_eq_to_obj_eq, symmetric])
@@ -1122,8 +1005,19 @@
 apply (auto simp add: hypreal_less hypreal_zero_num)
 done
 
+
+lemma hypreal_hrabs:
+     "abs (Abs_hypreal (hyprel `` {X})) = 
+      Abs_hypreal(hyprel `` {%n. abs (X n)})"
+apply (auto simp add: hrabs_def hypreal_zero_def hypreal_le hypreal_minus)
+apply (ultra, arith)+
+done
+
 ML
 {*
+val hrabs_def = thm "hrabs_def";
+val hypreal_hrabs = thm "hypreal_hrabs";
+
 val hypreal_zero_def = thm "hypreal_zero_def";
 val hypreal_one_def = thm "hypreal_one_def";
 val hypreal_minus_def = thm "hypreal_minus_def";
@@ -1189,11 +1083,6 @@
 val hypreal_add_zero_right = thm "hypreal_add_zero_right";
 val hypreal_add_minus = thm "hypreal_add_minus";
 val hypreal_add_minus_left = thm "hypreal_add_minus_left";
-val hypreal_minus_ex = thm "hypreal_minus_ex";
-val hypreal_minus_ex1 = thm "hypreal_minus_ex1";
-val hypreal_minus_left_ex1 = thm "hypreal_minus_left_ex1";
-val hypreal_add_minus_eq_minus = thm "hypreal_add_minus_eq_minus";
-val hypreal_as_add_inverse_ex = thm "hypreal_as_add_inverse_ex";
 val hypreal_minus_add_distrib = thm "hypreal_minus_add_distrib";
 val hypreal_minus_distrib1 = thm "hypreal_minus_distrib1";
 val hypreal_add_left_cancel = thm "hypreal_add_left_cancel";
@@ -1214,7 +1103,6 @@
 val hypreal_mult_minus_1 = thm "hypreal_mult_minus_1";
 val hypreal_mult_minus_1_right = thm "hypreal_mult_minus_1_right";
 val hypreal_minus_mult_commute = thm "hypreal_minus_mult_commute";
-val hypreal_add_assoc_cong = thm "hypreal_add_assoc_cong";
 val hypreal_add_mult_distrib = thm "hypreal_add_mult_distrib";
 val hypreal_add_mult_distrib2 = thm "hypreal_add_mult_distrib2";
 val hypreal_diff_mult_distrib = thm "hypreal_diff_mult_distrib";
@@ -1224,35 +1112,24 @@
 val hypreal_inverse = thm "hypreal_inverse";
 val HYPREAL_INVERSE_ZERO = thm "HYPREAL_INVERSE_ZERO";
 val HYPREAL_DIVISION_BY_ZERO = thm "HYPREAL_DIVISION_BY_ZERO";
-val hypreal_inverse_inverse = thm "hypreal_inverse_inverse";
-val hypreal_inverse_1 = thm "hypreal_inverse_1";
 val hypreal_mult_inverse = thm "hypreal_mult_inverse";
 val hypreal_mult_inverse_left = thm "hypreal_mult_inverse_left";
 val hypreal_mult_left_cancel = thm "hypreal_mult_left_cancel";
 val hypreal_mult_right_cancel = thm "hypreal_mult_right_cancel";
 val hypreal_inverse_not_zero = thm "hypreal_inverse_not_zero";
 val hypreal_mult_not_0 = thm "hypreal_mult_not_0";
-val hypreal_mult_zero_disj = thm "hypreal_mult_zero_disj";
 val hypreal_minus_inverse = thm "hypreal_minus_inverse";
 val hypreal_inverse_distrib = thm "hypreal_inverse_distrib";
-val hypreal_less_iff = thm "hypreal_less_iff";
-val hypreal_lessI = thm "hypreal_lessI";
-val hypreal_lessE = thm "hypreal_lessE";
-val hypreal_lessD = thm "hypreal_lessD";
 val hypreal_less_not_refl = thm "hypreal_less_not_refl";
 val hypreal_not_refl2 = thm "hypreal_not_refl2";
 val hypreal_less_trans = thm "hypreal_less_trans";
 val hypreal_less_asym = thm "hypreal_less_asym";
 val hypreal_less = thm "hypreal_less";
 val hypreal_trichotomy = thm "hypreal_trichotomy";
-val hypreal_trichotomyE = thm "hypreal_trichotomyE";
 val hypreal_less_minus_iff = thm "hypreal_less_minus_iff";
 val hypreal_less_minus_iff2 = thm "hypreal_less_minus_iff2";
 val hypreal_eq_minus_iff = thm "hypreal_eq_minus_iff";
 val hypreal_eq_minus_iff2 = thm "hypreal_eq_minus_iff2";
-val hypreal_diff_zero = thm "hypreal_diff_zero";
-val hypreal_diff_zero_right = thm "hypreal_diff_zero_right";
-val hypreal_diff_self = thm "hypreal_diff_self";
 val hypreal_eq_minus_iff3 = thm "hypreal_eq_minus_iff3";
 val hypreal_not_eq_minus_iff = thm "hypreal_not_eq_minus_iff";
 val hypreal_linear = thm "hypreal_linear";
@@ -1270,7 +1147,6 @@
 val hypreal_le_linear = thm "hypreal_le_linear";
 val hypreal_le_trans = thm "hypreal_le_trans";
 val hypreal_le_anti_sym = thm "hypreal_le_anti_sym";
-val not_less_not_eq_hypreal_less = thm "not_less_not_eq_hypreal_less";
 val hypreal_less_le = thm "hypreal_less_le";
 val hypreal_minus_zero_less_iff = thm "hypreal_minus_zero_less_iff";
 val hypreal_minus_zero_less_iff2 = thm "hypreal_minus_zero_less_iff2";
@@ -1287,34 +1163,14 @@
 val hypreal_of_real_zero_iff = thm "hypreal_of_real_zero_iff";
 val hypreal_of_real_inverse = thm "hypreal_of_real_inverse";
 val hypreal_of_real_divide = thm "hypreal_of_real_divide";
-val hypreal_zero_divide = thm "hypreal_zero_divide";
 val hypreal_divide_one = thm "hypreal_divide_one";
-val hypreal_divide_divide1_eq = thm "hypreal_divide_divide1_eq";
-val hypreal_divide_divide2_eq = thm "hypreal_divide_divide2_eq";
-val hypreal_minus_divide_eq = thm "hypreal_minus_divide_eq";
-val hypreal_divide_minus_eq = thm "hypreal_divide_minus_eq";
 val hypreal_add_divide_distrib = thm "hypreal_add_divide_distrib";
 val hypreal_inverse_add = thm "hypreal_inverse_add";
 val hypreal_self_eq_minus_self_zero = thm "hypreal_self_eq_minus_self_zero";
 val hypreal_add_self_zero_cancel = thm "hypreal_add_self_zero_cancel";
 val hypreal_add_self_zero_cancel2 = thm "hypreal_add_self_zero_cancel2";
-val hypreal_add_self_zero_cancel2a = thm "hypreal_add_self_zero_cancel2a";
 val hypreal_minus_eq_swap = thm "hypreal_minus_eq_swap";
 val hypreal_minus_eq_cancel = thm "hypreal_minus_eq_cancel";
-val hypreal_less_eq_diff = thm "hypreal_less_eq_diff";
-val hypreal_add_diff_eq = thm "hypreal_add_diff_eq";
-val hypreal_diff_add_eq = thm "hypreal_diff_add_eq";
-val hypreal_diff_diff_eq = thm "hypreal_diff_diff_eq";
-val hypreal_diff_diff_eq2 = thm "hypreal_diff_diff_eq2";
-val hypreal_diff_less_eq = thm "hypreal_diff_less_eq";
-val hypreal_less_diff_eq = thm "hypreal_less_diff_eq";
-val hypreal_diff_le_eq = thm "hypreal_diff_le_eq";
-val hypreal_le_diff_eq = thm "hypreal_le_diff_eq";
-val hypreal_diff_eq_eq = thm "hypreal_diff_eq_eq";
-val hypreal_eq_diff_eq = thm "hypreal_eq_diff_eq";
-val hypreal_less_eqI = thm "hypreal_less_eqI";
-val hypreal_le_eqI = thm "hypreal_le_eqI";
-val hypreal_eq_eqI = thm "hypreal_eq_eqI";
 val hypreal_zero_num = thm "hypreal_zero_num";
 val hypreal_one_num = thm "hypreal_one_num";
 val hypreal_omega_gt_zero = thm "hypreal_omega_gt_zero";