src/HOL/Hyperreal/HyperDef.thy
author paulson
Thu Dec 25 22:48:32 2003 +0100 (2003-12-25)
changeset 14329 ff3210fe968f
parent 14305 f17ca9f6dc8c
child 14331 8dbbb7cf3637
permissions -rw-r--r--
re-organized some hyperreal and real lemmas
paulson@10751
     1
(*  Title       : HOL/Real/Hyperreal/HyperDef.thy
paulson@10751
     2
    ID          : $Id$
paulson@10751
     3
    Author      : Jacques D. Fleuriot
paulson@10751
     4
    Copyright   : 1998  University of Cambridge
paulson@10751
     5
    Description : Construction of hyperreals using ultrafilters
wenzelm@13487
     6
*)
paulson@10751
     7
paulson@14299
     8
theory HyperDef = Filter + Real
paulson@14299
     9
files ("fuf.ML"):  (*Warning: file fuf.ML refers to the name Hyperdef!*)
paulson@10751
    10
paulson@10751
    11
paulson@10751
    12
constdefs
paulson@14299
    13
paulson@14299
    14
  FreeUltrafilterNat   :: "nat set set"    ("\\<U>")
paulson@14299
    15
    "FreeUltrafilterNat == (SOME U. U \<in> FreeUltrafilter (UNIV:: nat set))"
paulson@14299
    16
paulson@14299
    17
  hyprel :: "((nat=>real)*(nat=>real)) set"
paulson@14299
    18
    "hyprel == {p. \<exists>X Y. p = ((X::nat=>real),Y) &
paulson@10751
    19
                   {n::nat. X(n) = Y(n)}: FreeUltrafilterNat}"
paulson@10751
    20
paulson@14299
    21
typedef hypreal = "UNIV//hyprel" 
paulson@14299
    22
    by (auto simp add: quotient_def) 
paulson@10751
    23
paulson@14299
    24
instance hypreal :: ord ..
paulson@14299
    25
instance hypreal :: zero ..
paulson@14299
    26
instance hypreal :: one ..
paulson@14299
    27
instance hypreal :: plus ..
paulson@14299
    28
instance hypreal :: times ..
paulson@14299
    29
instance hypreal :: minus ..
paulson@14299
    30
instance hypreal :: inverse ..
paulson@10751
    31
paulson@10751
    32
paulson@14299
    33
defs (overloaded)
paulson@14299
    34
paulson@14299
    35
  hypreal_zero_def:
paulson@12018
    36
  "0 == Abs_hypreal(hyprel``{%n::nat. (0::real)})"
paulson@10751
    37
paulson@14299
    38
  hypreal_one_def:
paulson@12018
    39
  "1 == Abs_hypreal(hyprel``{%n::nat. (1::real)})"
paulson@10751
    40
paulson@14299
    41
  hypreal_minus_def:
paulson@14299
    42
  "- P == Abs_hypreal(\<Union>X \<in> Rep_hypreal(P). hyprel``{%n::nat. - (X n)})"
paulson@10751
    43
paulson@14299
    44
  hypreal_diff_def:
paulson@10751
    45
  "x - y == x + -(y::hypreal)"
paulson@10751
    46
paulson@14299
    47
  hypreal_inverse_def:
paulson@14299
    48
  "inverse P == Abs_hypreal(\<Union>X \<in> Rep_hypreal(P).
paulson@12018
    49
                    hyprel``{%n. if X n = 0 then 0 else inverse (X n)})"
paulson@10751
    50
paulson@14299
    51
  hypreal_divide_def:
paulson@10751
    52
  "P / Q::hypreal == P * inverse Q"
wenzelm@13487
    53
paulson@10751
    54
constdefs
paulson@10751
    55
paulson@14299
    56
  hypreal_of_real  :: "real => hypreal"
nipkow@10834
    57
  "hypreal_of_real r         == Abs_hypreal(hyprel``{%n::nat. r})"
paulson@10751
    58
paulson@10919
    59
  omega   :: hypreal   (*an infinite number = [<1,2,3,...>] *)
paulson@10919
    60
  "omega == Abs_hypreal(hyprel``{%n::nat. real (Suc n)})"
wenzelm@13487
    61
paulson@10919
    62
  epsilon :: hypreal   (*an infinitesimal number = [<1,1/2,1/3,...>] *)
paulson@10919
    63
  "epsilon == Abs_hypreal(hyprel``{%n::nat. inverse (real (Suc n))})"
paulson@10919
    64
paulson@10919
    65
syntax (xsymbols)
paulson@14299
    66
  omega   :: hypreal   ("\<omega>")
paulson@14299
    67
  epsilon :: hypreal   ("\<epsilon>")
paulson@10919
    68
paulson@10751
    69
wenzelm@13487
    70
defs
wenzelm@13487
    71
paulson@14299
    72
  hypreal_add_def:
paulson@14299
    73
  "P + Q == Abs_hypreal(\<Union>X \<in> Rep_hypreal(P). \<Union>Y \<in> Rep_hypreal(Q).
nipkow@10834
    74
                hyprel``{%n::nat. X n + Y n})"
paulson@10751
    75
paulson@14299
    76
  hypreal_mult_def:
paulson@14299
    77
  "P * Q == Abs_hypreal(\<Union>X \<in> Rep_hypreal(P). \<Union>Y \<in> Rep_hypreal(Q).
nipkow@10834
    78
                hyprel``{%n::nat. X n * Y n})"
paulson@10751
    79
paulson@14299
    80
  hypreal_less_def:
paulson@14299
    81
  "P < (Q::hypreal) == \<exists>X Y. X \<in> Rep_hypreal(P) &
paulson@14299
    82
                               Y \<in> Rep_hypreal(Q) &
paulson@14299
    83
                               {n::nat. X n < Y n} \<in> FreeUltrafilterNat"
paulson@14299
    84
  hypreal_le_def:
wenzelm@13487
    85
  "P <= (Q::hypreal) == ~(Q < P)"
paulson@10751
    86
paulson@14329
    87
  hrabs_def:  "abs (r::hypreal) == (if 0 \<le> r then r else -r)"
paulson@14329
    88
paulson@14329
    89
paulson@14329
    90
subsection{*The Set of Naturals is not Finite*}
paulson@14299
    91
paulson@14299
    92
(*** based on James' proof that the set of naturals is not finite ***)
paulson@14329
    93
lemma finite_exhausts [rule_format]:
paulson@14329
    94
     "finite (A::nat set) --> (\<exists>n. \<forall>m. Suc (n + m) \<notin> A)"
paulson@14299
    95
apply (rule impI)
paulson@14301
    96
apply (erule_tac F = A in finite_induct)
paulson@14301
    97
apply (blast, erule exE)
paulson@14299
    98
apply (rule_tac x = "n + x" in exI)
paulson@14301
    99
apply (rule allI, erule_tac x = "x + m" in allE)
paulson@14299
   100
apply (auto simp add: add_ac)
paulson@14299
   101
done
paulson@14299
   102
paulson@14329
   103
lemma finite_not_covers [rule_format (no_asm)]:
paulson@14329
   104
     "finite (A :: nat set) --> (\<exists>n. n \<notin>A)"
paulson@14301
   105
by (rule impI, drule finite_exhausts, blast)
paulson@14299
   106
paulson@14299
   107
lemma not_finite_nat: "~ finite(UNIV:: nat set)"
paulson@14301
   108
by (fast dest!: finite_exhausts)
paulson@14299
   109
paulson@14329
   110
paulson@14329
   111
subsection{*Existence of Free Ultrafilter over the Naturals*}
paulson@14329
   112
paulson@14329
   113
text{*Also, proof of various properties of @{term FreeUltrafilterNat}: 
paulson@14329
   114
an arbitrary free ultrafilter*}
paulson@14299
   115
paulson@14299
   116
lemma FreeUltrafilterNat_Ex: "\<exists>U. U: FreeUltrafilter (UNIV::nat set)"
paulson@14301
   117
by (rule not_finite_nat [THEN FreeUltrafilter_Ex])
paulson@14299
   118
paulson@14301
   119
lemma FreeUltrafilterNat_mem [simp]: 
paulson@14299
   120
     "FreeUltrafilterNat: FreeUltrafilter(UNIV:: nat set)"
paulson@14299
   121
apply (unfold FreeUltrafilterNat_def)
paulson@14299
   122
apply (rule FreeUltrafilterNat_Ex [THEN exE])
paulson@14301
   123
apply (rule someI2, assumption+)
paulson@14299
   124
done
paulson@14299
   125
paulson@14299
   126
lemma FreeUltrafilterNat_finite: "finite x ==> x \<notin> FreeUltrafilterNat"
paulson@14299
   127
apply (unfold FreeUltrafilterNat_def)
paulson@14299
   128
apply (rule FreeUltrafilterNat_Ex [THEN exE])
paulson@14301
   129
apply (rule someI2, assumption)
paulson@14299
   130
apply (blast dest: mem_FreeUltrafiltersetD1)
paulson@14299
   131
done
paulson@14299
   132
paulson@14299
   133
lemma FreeUltrafilterNat_not_finite: "x: FreeUltrafilterNat ==> ~ finite x"
paulson@14301
   134
by (blast dest: FreeUltrafilterNat_finite)
paulson@14299
   135
paulson@14301
   136
lemma FreeUltrafilterNat_empty [simp]: "{} \<notin> FreeUltrafilterNat"
paulson@14299
   137
apply (unfold FreeUltrafilterNat_def)
paulson@14299
   138
apply (rule FreeUltrafilterNat_Ex [THEN exE])
paulson@14301
   139
apply (rule someI2, assumption)
paulson@14301
   140
apply (blast dest: FreeUltrafilter_Ultrafilter Ultrafilter_Filter 
paulson@14301
   141
                   Filter_empty_not_mem)
paulson@14299
   142
done
paulson@14299
   143
paulson@14329
   144
lemma FreeUltrafilterNat_Int:
paulson@14329
   145
     "[| X: FreeUltrafilterNat;  Y: FreeUltrafilterNat |]   
paulson@14299
   146
      ==> X Int Y \<in> FreeUltrafilterNat"
paulson@14299
   147
apply (cut_tac FreeUltrafilterNat_mem)
paulson@14299
   148
apply (blast dest: FreeUltrafilter_Ultrafilter Ultrafilter_Filter mem_FiltersetD1)
paulson@14299
   149
done
paulson@14299
   150
paulson@14329
   151
lemma FreeUltrafilterNat_subset:
paulson@14329
   152
     "[| X: FreeUltrafilterNat;  X <= Y |]  
paulson@14299
   153
      ==> Y \<in> FreeUltrafilterNat"
paulson@14299
   154
apply (cut_tac FreeUltrafilterNat_mem)
paulson@14299
   155
apply (blast dest: FreeUltrafilter_Ultrafilter Ultrafilter_Filter mem_FiltersetD2)
paulson@14299
   156
done
paulson@14299
   157
paulson@14329
   158
lemma FreeUltrafilterNat_Compl:
paulson@14329
   159
     "X: FreeUltrafilterNat ==> -X \<notin> FreeUltrafilterNat"
paulson@14301
   160
apply safe
paulson@14301
   161
apply (drule FreeUltrafilterNat_Int, assumption, auto)
paulson@14299
   162
done
paulson@14299
   163
paulson@14329
   164
lemma FreeUltrafilterNat_Compl_mem:
paulson@14329
   165
     "X\<notin> FreeUltrafilterNat ==> -X \<in> FreeUltrafilterNat"
paulson@14299
   166
apply (cut_tac FreeUltrafilterNat_mem [THEN FreeUltrafilter_iff [THEN iffD1]])
paulson@14301
   167
apply (safe, drule_tac x = X in bspec)
paulson@14299
   168
apply (auto simp add: UNIV_diff_Compl)
paulson@14299
   169
done
paulson@14299
   170
paulson@14329
   171
lemma FreeUltrafilterNat_Compl_iff1:
paulson@14329
   172
     "(X \<notin> FreeUltrafilterNat) = (-X: FreeUltrafilterNat)"
paulson@14301
   173
by (blast dest: FreeUltrafilterNat_Compl FreeUltrafilterNat_Compl_mem)
paulson@14299
   174
paulson@14329
   175
lemma FreeUltrafilterNat_Compl_iff2:
paulson@14329
   176
     "(X: FreeUltrafilterNat) = (-X \<notin> FreeUltrafilterNat)"
paulson@14301
   177
by (auto simp add: FreeUltrafilterNat_Compl_iff1 [symmetric])
paulson@14299
   178
paulson@14301
   179
lemma FreeUltrafilterNat_UNIV [simp]: "(UNIV::nat set) \<in> FreeUltrafilterNat"
paulson@14301
   180
by (rule FreeUltrafilterNat_mem [THEN FreeUltrafilter_Ultrafilter, THEN Ultrafilter_Filter, THEN mem_FiltersetD4])
paulson@14299
   181
paulson@14301
   182
lemma FreeUltrafilterNat_Nat_set [simp]: "UNIV \<in> FreeUltrafilterNat"
paulson@14301
   183
by auto
paulson@14299
   184
paulson@14329
   185
lemma FreeUltrafilterNat_Nat_set_refl [intro]:
paulson@14329
   186
     "{n. P(n) = P(n)} \<in> FreeUltrafilterNat"
paulson@14301
   187
by simp
paulson@14299
   188
paulson@14299
   189
lemma FreeUltrafilterNat_P: "{n::nat. P} \<in> FreeUltrafilterNat ==> P"
paulson@14301
   190
by (rule ccontr, simp)
paulson@14299
   191
paulson@14299
   192
lemma FreeUltrafilterNat_Ex_P: "{n. P(n)} \<in> FreeUltrafilterNat ==> \<exists>n. P(n)"
paulson@14301
   193
by (rule ccontr, simp)
paulson@14299
   194
paulson@14299
   195
lemma FreeUltrafilterNat_all: "\<forall>n. P(n) ==> {n. P(n)} \<in> FreeUltrafilterNat"
paulson@14301
   196
by (auto intro: FreeUltrafilterNat_Nat_set)
paulson@14299
   197
paulson@14329
   198
paulson@14329
   199
text{*Define and use Ultrafilter tactics*}
paulson@14299
   200
use "fuf.ML"
paulson@14299
   201
paulson@14299
   202
method_setup fuf = {*
paulson@14299
   203
    Method.ctxt_args (fn ctxt =>
paulson@14299
   204
        Method.METHOD (fn facts =>
paulson@14299
   205
            fuf_tac (Classical.get_local_claset ctxt,
paulson@14299
   206
                     Simplifier.get_local_simpset ctxt) 1)) *}
paulson@14299
   207
    "free ultrafilter tactic"
paulson@14299
   208
paulson@14299
   209
method_setup ultra = {*
paulson@14299
   210
    Method.ctxt_args (fn ctxt =>
paulson@14299
   211
        Method.METHOD (fn facts =>
paulson@14299
   212
            ultra_tac (Classical.get_local_claset ctxt,
paulson@14299
   213
                       Simplifier.get_local_simpset ctxt) 1)) *}
paulson@14299
   214
    "ultrafilter tactic"
paulson@14299
   215
paulson@14299
   216
paulson@14329
   217
text{*One further property of our free ultrafilter*}
paulson@14329
   218
lemma FreeUltrafilterNat_Un:
paulson@14329
   219
     "X Un Y: FreeUltrafilterNat  
paulson@14299
   220
      ==> X: FreeUltrafilterNat | Y: FreeUltrafilterNat"
paulson@14299
   221
apply auto
paulson@14301
   222
apply ultra
paulson@14299
   223
done
paulson@14299
   224
paulson@14299
   225
paulson@14329
   226
subsection{*Properties of @{term hyprel}*}
paulson@14329
   227
paulson@14329
   228
text{*Proving that @{term hyprel} is an equivalence relation*}
paulson@14299
   229
paulson@14299
   230
lemma hyprel_iff: "((X,Y): hyprel) = ({n. X n = Y n}: FreeUltrafilterNat)"
paulson@14301
   231
by (unfold hyprel_def, fast)
paulson@14299
   232
paulson@14299
   233
lemma hyprel_refl: "(x,x): hyprel"
paulson@14299
   234
apply (unfold hyprel_def)
paulson@14299
   235
apply (auto simp add: FreeUltrafilterNat_Nat_set)
paulson@14299
   236
done
paulson@14299
   237
paulson@14299
   238
lemma hyprel_sym [rule_format (no_asm)]: "(x,y): hyprel --> (y,x):hyprel"
paulson@14301
   239
by (simp add: hyprel_def eq_commute)
paulson@14299
   240
paulson@14299
   241
lemma hyprel_trans: 
paulson@14299
   242
      "[|(x,y): hyprel; (y,z):hyprel|] ==> (x,z):hyprel"
paulson@14301
   243
apply (unfold hyprel_def, auto, ultra)
paulson@14299
   244
done
paulson@14299
   245
paulson@14299
   246
lemma equiv_hyprel: "equiv UNIV hyprel"
paulson@14299
   247
apply (simp add: equiv_def refl_def sym_def trans_def hyprel_refl)
paulson@14299
   248
apply (blast intro: hyprel_sym hyprel_trans) 
paulson@14299
   249
done
paulson@14299
   250
paulson@14299
   251
(* (hyprel `` {x} = hyprel `` {y}) = ((x,y) \<in> hyprel) *)
paulson@14299
   252
lemmas equiv_hyprel_iff =
paulson@14299
   253
    eq_equiv_class_iff [OF equiv_hyprel UNIV_I UNIV_I, simp] 
paulson@14299
   254
paulson@14301
   255
lemma hyprel_in_hypreal [simp]: "hyprel``{x}:hypreal"
paulson@14301
   256
by (unfold hypreal_def hyprel_def quotient_def, blast)
paulson@14299
   257
paulson@14299
   258
lemma inj_on_Abs_hypreal: "inj_on Abs_hypreal hypreal"
paulson@14299
   259
apply (rule inj_on_inverseI)
paulson@14299
   260
apply (erule Abs_hypreal_inverse)
paulson@14299
   261
done
paulson@14299
   262
paulson@14299
   263
declare inj_on_Abs_hypreal [THEN inj_on_iff, simp] 
paulson@14301
   264
        Abs_hypreal_inverse [simp]
paulson@14299
   265
paulson@14299
   266
declare equiv_hyprel [THEN eq_equiv_class_iff, simp]
paulson@14299
   267
paulson@14299
   268
declare hyprel_iff [iff]
paulson@14299
   269
paulson@14299
   270
lemmas eq_hyprelD = eq_equiv_class [OF _ equiv_hyprel]
paulson@14299
   271
paulson@14299
   272
lemma inj_Rep_hypreal: "inj(Rep_hypreal)"
paulson@14299
   273
apply (rule inj_on_inverseI)
paulson@14299
   274
apply (rule Rep_hypreal_inverse)
paulson@14299
   275
done
paulson@14299
   276
paulson@14301
   277
lemma lemma_hyprel_refl [simp]: "x \<in> hyprel `` {x}"
paulson@14301
   278
apply (unfold hyprel_def, safe)
paulson@14299
   279
apply (auto intro!: FreeUltrafilterNat_Nat_set)
paulson@14299
   280
done
paulson@14299
   281
paulson@14301
   282
lemma hypreal_empty_not_mem [simp]: "{} \<notin> hypreal"
paulson@14299
   283
apply (unfold hypreal_def)
paulson@14299
   284
apply (auto elim!: quotientE equalityCE)
paulson@14299
   285
done
paulson@14299
   286
paulson@14301
   287
lemma Rep_hypreal_nonempty [simp]: "Rep_hypreal x \<noteq> {}"
paulson@14301
   288
by (cut_tac x = x in Rep_hypreal, auto)
paulson@14299
   289
paulson@14299
   290
paulson@14329
   291
subsection{*@{term hypreal_of_real}: 
paulson@14329
   292
            the Injection from @{typ real} to @{typ hypreal}*}
paulson@14299
   293
paulson@14299
   294
lemma inj_hypreal_of_real: "inj(hypreal_of_real)"
paulson@14299
   295
apply (rule inj_onI)
paulson@14299
   296
apply (unfold hypreal_of_real_def)
paulson@14299
   297
apply (drule inj_on_Abs_hypreal [THEN inj_onD])
paulson@14299
   298
apply (rule hyprel_in_hypreal)+
paulson@14299
   299
apply (drule eq_equiv_class)
paulson@14299
   300
apply (rule equiv_hyprel)
paulson@14299
   301
apply (simp_all add: split: split_if_asm) 
paulson@14299
   302
done
paulson@14299
   303
paulson@14299
   304
lemma eq_Abs_hypreal:
paulson@14299
   305
    "(!!x y. z = Abs_hypreal(hyprel``{x}) ==> P) ==> P"
paulson@14299
   306
apply (rule_tac x1=z in Rep_hypreal [unfolded hypreal_def, THEN quotientE])
paulson@14301
   307
apply (drule_tac f = Abs_hypreal in arg_cong)
paulson@14299
   308
apply (force simp add: Rep_hypreal_inverse)
paulson@14299
   309
done
paulson@14299
   310
paulson@14329
   311
paulson@14329
   312
subsection{*Hyperreal Addition*}
paulson@14329
   313
paulson@14329
   314
lemma hypreal_add_congruent2: 
paulson@14329
   315
    "congruent2 hyprel (%X Y. hyprel``{%n. X n + Y n})"
paulson@14329
   316
apply (unfold congruent2_def, auto, ultra)
paulson@14329
   317
done
paulson@14329
   318
paulson@14329
   319
lemma hypreal_add: 
paulson@14329
   320
  "Abs_hypreal(hyprel``{%n. X n}) + Abs_hypreal(hyprel``{%n. Y n}) =  
paulson@14329
   321
   Abs_hypreal(hyprel``{%n. X n + Y n})"
paulson@14329
   322
apply (unfold hypreal_add_def)
paulson@14329
   323
apply (simp add: UN_equiv_class2 [OF equiv_hyprel hypreal_add_congruent2])
paulson@14329
   324
done
paulson@14329
   325
paulson@14329
   326
lemma hypreal_add_commute: "(z::hypreal) + w = w + z"
paulson@14329
   327
apply (rule_tac z = z in eq_Abs_hypreal)
paulson@14329
   328
apply (rule_tac z = w in eq_Abs_hypreal)
paulson@14329
   329
apply (simp add: real_add_ac hypreal_add)
paulson@14329
   330
done
paulson@14329
   331
paulson@14329
   332
lemma hypreal_add_assoc: "((z1::hypreal) + z2) + z3 = z1 + (z2 + z3)"
paulson@14329
   333
apply (rule_tac z = z1 in eq_Abs_hypreal)
paulson@14329
   334
apply (rule_tac z = z2 in eq_Abs_hypreal)
paulson@14329
   335
apply (rule_tac z = z3 in eq_Abs_hypreal)
paulson@14329
   336
apply (simp add: hypreal_add real_add_assoc)
paulson@14329
   337
done
paulson@14329
   338
paulson@14329
   339
(*For AC rewriting*)
paulson@14329
   340
lemma hypreal_add_left_commute: "(x::hypreal)+(y+z)=y+(x+z)"
paulson@14329
   341
  apply (rule mk_left_commute [of "op +"])
paulson@14329
   342
  apply (rule hypreal_add_assoc)
paulson@14329
   343
  apply (rule hypreal_add_commute)
paulson@14329
   344
  done
paulson@14329
   345
paulson@14329
   346
(* hypreal addition is an AC operator *)
paulson@14329
   347
lemmas hypreal_add_ac =
paulson@14329
   348
       hypreal_add_assoc hypreal_add_commute hypreal_add_left_commute
paulson@14329
   349
paulson@14329
   350
lemma hypreal_add_zero_left [simp]: "(0::hypreal) + z = z"
paulson@14329
   351
apply (unfold hypreal_zero_def)
paulson@14329
   352
apply (rule_tac z = z in eq_Abs_hypreal)
paulson@14329
   353
apply (simp add: hypreal_add)
paulson@14329
   354
done
paulson@14329
   355
paulson@14329
   356
instance hypreal :: plus_ac0
paulson@14329
   357
  by (intro_classes,
paulson@14329
   358
      (assumption | 
paulson@14329
   359
       rule hypreal_add_commute hypreal_add_assoc hypreal_add_zero_left)+)
paulson@14329
   360
paulson@14329
   361
lemma hypreal_add_zero_right [simp]: "z + (0::hypreal) = z"
paulson@14329
   362
by (simp add: hypreal_add_zero_left hypreal_add_commute)
paulson@14329
   363
paulson@14329
   364
paulson@14329
   365
subsection{*Additive inverse on @{typ hypreal}*}
paulson@14299
   366
paulson@14299
   367
lemma hypreal_minus_congruent: 
paulson@14299
   368
  "congruent hyprel (%X. hyprel``{%n. - (X n)})"
paulson@14299
   369
by (force simp add: congruent_def)
paulson@14299
   370
paulson@14299
   371
lemma hypreal_minus: 
paulson@14299
   372
   "- (Abs_hypreal(hyprel``{%n. X n})) = Abs_hypreal(hyprel `` {%n. -(X n)})"
paulson@14299
   373
apply (unfold hypreal_minus_def)
paulson@14301
   374
apply (rule_tac f = Abs_hypreal in arg_cong)
paulson@14301
   375
apply (simp add: hyprel_in_hypreal [THEN Abs_hypreal_inverse] 
paulson@14299
   376
               UN_equiv_class [OF equiv_hyprel hypreal_minus_congruent])
paulson@14299
   377
done
paulson@14299
   378
paulson@14301
   379
lemma hypreal_minus_minus [simp]: "- (- z) = (z::hypreal)"
paulson@14301
   380
apply (rule_tac z = z in eq_Abs_hypreal)
paulson@14301
   381
apply (simp add: hypreal_minus)
paulson@14299
   382
done
paulson@14299
   383
paulson@14299
   384
lemma inj_hypreal_minus: "inj(%r::hypreal. -r)"
paulson@14299
   385
apply (rule inj_onI)
paulson@14301
   386
apply (drule_tac f = uminus in arg_cong)
paulson@14299
   387
apply (simp add: hypreal_minus_minus)
paulson@14299
   388
done
paulson@14299
   389
paulson@14301
   390
lemma hypreal_minus_zero [simp]: "- 0 = (0::hypreal)"
paulson@14299
   391
apply (unfold hypreal_zero_def)
paulson@14301
   392
apply (simp add: hypreal_minus)
paulson@14299
   393
done
paulson@14299
   394
paulson@14301
   395
lemma hypreal_minus_zero_iff [simp]: "(-x = 0) = (x = (0::hypreal))"
paulson@14301
   396
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14299
   397
apply (auto simp add: hypreal_zero_def hypreal_minus)
paulson@14299
   398
done
paulson@14299
   399
paulson@14329
   400
lemma hypreal_diff:
paulson@14329
   401
     "Abs_hypreal(hyprel``{%n. X n}) - Abs_hypreal(hyprel``{%n. Y n}) =  
paulson@14299
   402
      Abs_hypreal(hyprel``{%n. X n - Y n})"
paulson@14301
   403
apply (simp add: hypreal_diff_def hypreal_minus hypreal_add)
paulson@14299
   404
done
paulson@14299
   405
paulson@14301
   406
lemma hypreal_add_minus [simp]: "z + -z = (0::hypreal)"
paulson@14299
   407
apply (unfold hypreal_zero_def)
paulson@14301
   408
apply (rule_tac z = z in eq_Abs_hypreal)
paulson@14299
   409
apply (simp add: hypreal_minus hypreal_add)
paulson@14299
   410
done
paulson@14299
   411
paulson@14301
   412
lemma hypreal_add_minus_left [simp]: "-z + z = (0::hypreal)"
paulson@14301
   413
by (simp add: hypreal_add_commute hypreal_add_minus)
paulson@14299
   414
paulson@14299
   415
lemma hypreal_add_left_cancel: "((x::hypreal) + y = x + z) = (y = z)"
paulson@14301
   416
apply safe
paulson@14299
   417
apply (drule_tac f = "%t.-x + t" in arg_cong)
paulson@14299
   418
apply (simp add: hypreal_add_assoc [symmetric])
paulson@14299
   419
done
paulson@14299
   420
paulson@14299
   421
lemma hypreal_add_right_cancel: "(y + (x::hypreal)= z + x) = (y = z)"
paulson@14301
   422
by (simp add: hypreal_add_commute hypreal_add_left_cancel)
paulson@14299
   423
paulson@14301
   424
lemma hypreal_add_minus_cancelA [simp]: "z + ((- z) + w) = (w::hypreal)"
paulson@14301
   425
by (simp add: hypreal_add_assoc [symmetric])
paulson@14299
   426
paulson@14301
   427
lemma hypreal_minus_add_cancelA [simp]: "(-z) + (z + w) = (w::hypreal)"
paulson@14301
   428
by (simp add: hypreal_add_assoc [symmetric])
paulson@14299
   429
paulson@14329
   430
paulson@14329
   431
subsection{*Hyperreal Multiplication*}
paulson@14299
   432
paulson@14299
   433
lemma hypreal_mult_congruent2: 
paulson@14299
   434
    "congruent2 hyprel (%X Y. hyprel``{%n. X n * Y n})"
paulson@14301
   435
apply (unfold congruent2_def, auto, ultra)
paulson@14299
   436
done
paulson@14299
   437
paulson@14299
   438
lemma hypreal_mult: 
paulson@14299
   439
  "Abs_hypreal(hyprel``{%n. X n}) * Abs_hypreal(hyprel``{%n. Y n}) =  
paulson@14299
   440
   Abs_hypreal(hyprel``{%n. X n * Y n})"
paulson@14299
   441
apply (unfold hypreal_mult_def)
paulson@14299
   442
apply (simp add: UN_equiv_class2 [OF equiv_hyprel hypreal_mult_congruent2])
paulson@14299
   443
done
paulson@14299
   444
paulson@14299
   445
lemma hypreal_mult_commute: "(z::hypreal) * w = w * z"
paulson@14301
   446
apply (rule_tac z = z in eq_Abs_hypreal)
paulson@14301
   447
apply (rule_tac z = w in eq_Abs_hypreal)
paulson@14301
   448
apply (simp add: hypreal_mult real_mult_ac)
paulson@14299
   449
done
paulson@14299
   450
paulson@14299
   451
lemma hypreal_mult_assoc: "((z1::hypreal) * z2) * z3 = z1 * (z2 * z3)"
paulson@14301
   452
apply (rule_tac z = z1 in eq_Abs_hypreal)
paulson@14301
   453
apply (rule_tac z = z2 in eq_Abs_hypreal)
paulson@14301
   454
apply (rule_tac z = z3 in eq_Abs_hypreal)
paulson@14301
   455
apply (simp add: hypreal_mult real_mult_assoc)
paulson@14299
   456
done
paulson@14299
   457
paulson@14299
   458
lemma hypreal_mult_left_commute: "(z1::hypreal) * (z2 * z3) = z2 * (z1 * z3)"
paulson@14299
   459
  apply (rule mk_left_commute [of "op *"])
paulson@14299
   460
  apply (rule hypreal_mult_assoc)
paulson@14299
   461
  apply (rule hypreal_mult_commute)
paulson@14299
   462
  done
paulson@14299
   463
paulson@14299
   464
(* hypreal multiplication is an AC operator *)
paulson@14299
   465
lemmas hypreal_mult_ac =
paulson@14299
   466
       hypreal_mult_assoc hypreal_mult_commute hypreal_mult_left_commute
paulson@14299
   467
paulson@14301
   468
lemma hypreal_mult_1 [simp]: "(1::hypreal) * z = z"
paulson@14299
   469
apply (unfold hypreal_one_def)
paulson@14301
   470
apply (rule_tac z = z in eq_Abs_hypreal)
paulson@14299
   471
apply (simp add: hypreal_mult)
paulson@14299
   472
done
paulson@14301
   473
paulson@14301
   474
lemma hypreal_mult_1_right [simp]: "z * (1::hypreal) = z"
paulson@14301
   475
by (simp add: hypreal_mult_commute hypreal_mult_1)
paulson@14299
   476
paulson@14301
   477
lemma hypreal_mult_0 [simp]: "0 * z = (0::hypreal)"
paulson@14299
   478
apply (unfold hypreal_zero_def)
paulson@14301
   479
apply (rule_tac z = z in eq_Abs_hypreal)
paulson@14299
   480
apply (simp add: hypreal_mult)
paulson@14299
   481
done
paulson@14299
   482
paulson@14301
   483
lemma hypreal_mult_0_right [simp]: "z * 0 = (0::hypreal)"
paulson@14301
   484
by (simp add: hypreal_mult_commute)
paulson@14299
   485
paulson@14299
   486
lemma hypreal_minus_mult_eq1: "-(x * y) = -x * (y::hypreal)"
paulson@14301
   487
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14301
   488
apply (rule_tac z = y in eq_Abs_hypreal)
paulson@14299
   489
apply (auto simp add: hypreal_minus hypreal_mult real_mult_ac real_add_ac)
paulson@14299
   490
done
paulson@14299
   491
paulson@14299
   492
lemma hypreal_minus_mult_eq2: "-(x * y) = (x::hypreal) * -y"
paulson@14301
   493
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14301
   494
apply (rule_tac z = y in eq_Abs_hypreal)
paulson@14299
   495
apply (auto simp add: hypreal_minus hypreal_mult real_mult_ac real_add_ac)
paulson@14299
   496
done
paulson@14299
   497
paulson@14299
   498
(*Pull negations out*)
paulson@14301
   499
declare hypreal_minus_mult_eq2 [symmetric, simp] 
paulson@14301
   500
        hypreal_minus_mult_eq1 [symmetric, simp]
paulson@14299
   501
paulson@14301
   502
lemma hypreal_mult_minus_1 [simp]: "(- (1::hypreal)) * z = -z"
paulson@14301
   503
by simp
paulson@14299
   504
paulson@14301
   505
lemma hypreal_mult_minus_1_right [simp]: "z * (- (1::hypreal)) = -z"
paulson@14301
   506
by (subst hypreal_mult_commute, simp)
paulson@14299
   507
paulson@14299
   508
lemma hypreal_minus_mult_commute: "(-x) * y = (x::hypreal) * -y"
paulson@14301
   509
by auto
paulson@14299
   510
paulson@14329
   511
subsection{*A few more theorems *}
paulson@14299
   512
paulson@14329
   513
lemma hypreal_add_mult_distrib:
paulson@14329
   514
     "((z1::hypreal) + z2) * w = (z1 * w) + (z2 * w)"
paulson@14301
   515
apply (rule_tac z = z1 in eq_Abs_hypreal)
paulson@14301
   516
apply (rule_tac z = z2 in eq_Abs_hypreal)
paulson@14301
   517
apply (rule_tac z = w in eq_Abs_hypreal)
paulson@14301
   518
apply (simp add: hypreal_mult hypreal_add real_add_mult_distrib)
paulson@14299
   519
done
paulson@14299
   520
paulson@14329
   521
lemma hypreal_add_mult_distrib2:
paulson@14329
   522
     "(w::hypreal) * (z1 + z2) = (w * z1) + (w * z2)"
paulson@14301
   523
by (simp add: hypreal_mult_commute [of w] hypreal_add_mult_distrib)
paulson@14299
   524
paulson@14299
   525
paulson@14329
   526
lemma hypreal_diff_mult_distrib:
paulson@14329
   527
     "((z1::hypreal) - z2) * w = (z1 * w) - (z2 * w)"
paulson@14299
   528
paulson@14299
   529
apply (unfold hypreal_diff_def)
paulson@14301
   530
apply (simp add: hypreal_add_mult_distrib)
paulson@14299
   531
done
paulson@14299
   532
paulson@14329
   533
lemma hypreal_diff_mult_distrib2:
paulson@14329
   534
     "(w::hypreal) * (z1 - z2) = (w * z1) - (w * z2)"
paulson@14301
   535
by (simp add: hypreal_mult_commute [of w] hypreal_diff_mult_distrib)
paulson@14299
   536
paulson@14299
   537
(*** one and zero are distinct ***)
paulson@14299
   538
lemma hypreal_zero_not_eq_one: "0 \<noteq> (1::hypreal)"
paulson@14299
   539
apply (unfold hypreal_zero_def hypreal_one_def)
paulson@14299
   540
apply (auto simp add: real_zero_not_eq_one)
paulson@14299
   541
done
paulson@14299
   542
paulson@14299
   543
paulson@14329
   544
subsection{*Multiplicative Inverse on @{typ hypreal} *}
paulson@14299
   545
paulson@14299
   546
lemma hypreal_inverse_congruent: 
paulson@14299
   547
  "congruent hyprel (%X. hyprel``{%n. if X n = 0 then 0 else inverse(X n)})"
paulson@14299
   548
apply (unfold congruent_def)
paulson@14301
   549
apply (auto, ultra)
paulson@14299
   550
done
paulson@14299
   551
paulson@14299
   552
lemma hypreal_inverse: 
paulson@14299
   553
      "inverse (Abs_hypreal(hyprel``{%n. X n})) =  
paulson@14299
   554
       Abs_hypreal(hyprel `` {%n. if X n = 0 then 0 else inverse(X n)})"
paulson@14299
   555
apply (unfold hypreal_inverse_def)
paulson@14301
   556
apply (rule_tac f = Abs_hypreal in arg_cong)
paulson@14301
   557
apply (simp add: hyprel_in_hypreal [THEN Abs_hypreal_inverse] 
paulson@14299
   558
           UN_equiv_class [OF equiv_hyprel hypreal_inverse_congruent])
paulson@14299
   559
done
paulson@14299
   560
paulson@14299
   561
lemma HYPREAL_INVERSE_ZERO: "inverse 0 = (0::hypreal)"
paulson@14301
   562
by (simp add: hypreal_inverse hypreal_zero_def)
paulson@14299
   563
paulson@14299
   564
lemma HYPREAL_DIVISION_BY_ZERO: "a / (0::hypreal) = 0"
paulson@14301
   565
by (simp add: hypreal_divide_def HYPREAL_INVERSE_ZERO)
paulson@14301
   566
paulson@14329
   567
instance hypreal :: division_by_zero
paulson@14329
   568
proof
paulson@14329
   569
  fix x :: hypreal
paulson@14329
   570
  show "inverse 0 = (0::hypreal)" by (rule HYPREAL_INVERSE_ZERO)
paulson@14329
   571
  show "x/0 = 0" by (rule HYPREAL_DIVISION_BY_ZERO) 
paulson@14329
   572
qed
paulson@14299
   573
paulson@14299
   574
paulson@14329
   575
subsection{*Existence of Inverse*}
paulson@14299
   576
paulson@14301
   577
lemma hypreal_mult_inverse [simp]: 
paulson@14299
   578
     "x \<noteq> 0 ==> x*inverse(x) = (1::hypreal)"
paulson@14299
   579
apply (unfold hypreal_one_def hypreal_zero_def)
paulson@14301
   580
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14299
   581
apply (simp add: hypreal_inverse hypreal_mult)
paulson@14299
   582
apply (drule FreeUltrafilterNat_Compl_mem)
paulson@14299
   583
apply (blast intro!: real_mult_inv_right FreeUltrafilterNat_subset)
paulson@14299
   584
done
paulson@14299
   585
paulson@14329
   586
lemma hypreal_mult_inverse_left [simp]:
paulson@14329
   587
     "x \<noteq> 0 ==> inverse(x)*x = (1::hypreal)"
paulson@14301
   588
by (simp add: hypreal_mult_inverse hypreal_mult_commute)
paulson@14299
   589
paulson@14329
   590
paulson@14329
   591
subsection{*Theorems for Ordering*}
paulson@14329
   592
paulson@14329
   593
text{*TODO: define @{text "\<le>"} as the primitive concept and quickly 
paulson@14329
   594
establish membership in class @{text linorder}. Then proofs could be
paulson@14329
   595
simplified, since properties of @{text "<"} would be generic.*}
paulson@14299
   596
paulson@14329
   597
text{*TODO: The following theorem should be used througout the proofs
paulson@14329
   598
  as it probably makes many of them more straightforward.*}
paulson@14329
   599
lemma hypreal_less: 
paulson@14329
   600
      "(Abs_hypreal(hyprel``{%n. X n}) < Abs_hypreal(hyprel``{%n. Y n})) =  
paulson@14329
   601
       ({n. X n < Y n} \<in> FreeUltrafilterNat)"
paulson@14329
   602
apply (unfold hypreal_less_def)
paulson@14329
   603
apply (auto intro!: lemma_hyprel_refl, ultra)
paulson@14299
   604
done
paulson@14299
   605
paulson@14299
   606
(* prove introduction and elimination rules for hypreal_less *)
paulson@14299
   607
paulson@14299
   608
lemma hypreal_less_not_refl: "~ (R::hypreal) < R"
paulson@14301
   609
apply (rule_tac z = R in eq_Abs_hypreal)
paulson@14301
   610
apply (auto simp add: hypreal_less_def, ultra)
paulson@14299
   611
done
paulson@14299
   612
paulson@14299
   613
lemmas hypreal_less_irrefl = hypreal_less_not_refl [THEN notE, standard]
paulson@14299
   614
declare hypreal_less_irrefl [elim!]
paulson@14299
   615
paulson@14299
   616
lemma hypreal_not_refl2: "!!(x::hypreal). x < y ==> x \<noteq> y"
paulson@14301
   617
by (auto simp add: hypreal_less_not_refl)
paulson@14299
   618
paulson@14299
   619
lemma hypreal_less_trans: "!!(R1::hypreal). [| R1 < R2; R2 < R3 |] ==> R1 < R3"
paulson@14301
   620
apply (rule_tac z = R1 in eq_Abs_hypreal)
paulson@14301
   621
apply (rule_tac z = R2 in eq_Abs_hypreal)
paulson@14301
   622
apply (rule_tac z = R3 in eq_Abs_hypreal)
paulson@14301
   623
apply (auto intro!: exI simp add: hypreal_less_def, ultra)
paulson@14299
   624
done
paulson@14299
   625
paulson@14299
   626
lemma hypreal_less_asym: "!! (R1::hypreal). [| R1 < R2; R2 < R1 |] ==> P"
paulson@14301
   627
apply (drule hypreal_less_trans, assumption)
paulson@14299
   628
apply (simp add: hypreal_less_not_refl)
paulson@14299
   629
done
paulson@14299
   630
paulson@14299
   631
paulson@14329
   632
subsection{*Trichotomy: the hyperreals are Linearly Ordered*}
paulson@14299
   633
paulson@14299
   634
lemma lemma_hyprel_0_mem: "\<exists>x. x: hyprel `` {%n. 0}"
paulson@14299
   635
apply (unfold hyprel_def)
paulson@14301
   636
apply (rule_tac x = "%n. 0" in exI, safe)
paulson@14299
   637
apply (auto intro!: FreeUltrafilterNat_Nat_set)
paulson@14299
   638
done
paulson@14299
   639
paulson@14299
   640
lemma hypreal_trichotomy: "0 <  x | x = 0 | x < (0::hypreal)"
paulson@14299
   641
apply (unfold hypreal_zero_def)
paulson@14301
   642
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14299
   643
apply (auto simp add: hypreal_less_def)
paulson@14301
   644
apply (cut_tac lemma_hyprel_0_mem, erule exE)
paulson@14301
   645
apply (drule_tac x = xa in spec)
paulson@14301
   646
apply (drule_tac x = x in spec)
paulson@14301
   647
apply (cut_tac x = x in lemma_hyprel_refl, auto)
paulson@14301
   648
apply (drule_tac x = x in spec)
paulson@14301
   649
apply (drule_tac x = xa in spec, auto, ultra)
paulson@14299
   650
done
paulson@14299
   651
paulson@14299
   652
lemma hypreal_trichotomyE:
paulson@14299
   653
     "[| (0::hypreal) < x ==> P;  
paulson@14299
   654
         x = 0 ==> P;  
paulson@14299
   655
         x < 0 ==> P |] ==> P"
paulson@14301
   656
apply (insert hypreal_trichotomy [of x], blast) 
paulson@14299
   657
done
paulson@14299
   658
paulson@14329
   659
subsection{*More properties of Less Than*}
paulson@14299
   660
paulson@14299
   661
lemma hypreal_less_minus_iff: "((x::hypreal) < y) = (0 < y + -x)"
paulson@14301
   662
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14301
   663
apply (rule_tac z = y in eq_Abs_hypreal)
paulson@14299
   664
apply (auto simp add: hypreal_add hypreal_zero_def hypreal_minus hypreal_less)
paulson@14299
   665
done
paulson@14299
   666
paulson@14299
   667
lemma hypreal_less_minus_iff2: "((x::hypreal) < y) = (x + -y < 0)"
paulson@14301
   668
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14301
   669
apply (rule_tac z = y in eq_Abs_hypreal)
paulson@14299
   670
apply (auto simp add: hypreal_add hypreal_zero_def hypreal_minus hypreal_less)
paulson@14299
   671
done
paulson@14299
   672
paulson@14299
   673
lemma hypreal_eq_minus_iff: "((x::hypreal) = y) = (x + - y = 0)"
paulson@14299
   674
apply auto
paulson@14301
   675
apply (rule_tac x1 = "-y" in hypreal_add_right_cancel [THEN iffD1], auto)
paulson@14299
   676
done
paulson@14299
   677
paulson@14299
   678
lemma hypreal_eq_minus_iff2: "((x::hypreal) = y) = (0 = y + - x)"
paulson@14299
   679
apply auto
paulson@14301
   680
apply (rule_tac x1 = "-x" in hypreal_add_right_cancel [THEN iffD1], auto)
paulson@14299
   681
done
paulson@14299
   682
paulson@14299
   683
paulson@14329
   684
subsection{*Linearity*}
paulson@14299
   685
paulson@14299
   686
lemma hypreal_linear: "(x::hypreal) < y | x = y | y < x"
paulson@14299
   687
apply (subst hypreal_eq_minus_iff2)
paulson@14301
   688
apply (rule_tac x1 = x in hypreal_less_minus_iff [THEN ssubst])
paulson@14301
   689
apply (rule_tac x1 = y in hypreal_less_minus_iff2 [THEN ssubst])
paulson@14301
   690
apply (rule hypreal_trichotomyE, auto)
paulson@14299
   691
done
paulson@14299
   692
paulson@14299
   693
lemma hypreal_neq_iff: "((w::hypreal) \<noteq> z) = (w<z | z<w)"
paulson@14301
   694
by (cut_tac hypreal_linear, blast)
paulson@14299
   695
paulson@14299
   696
lemma hypreal_linear_less2: "!!(x::hypreal). [| x < y ==> P;  x = y ==> P;  
paulson@14299
   697
           y < x ==> P |] ==> P"
paulson@14301
   698
apply (cut_tac x = x and y = y in hypreal_linear, auto)
paulson@14299
   699
done
paulson@14299
   700
paulson@14329
   701
paulson@14329
   702
subsection{*Properties of The @{text "\<le>"} Relation*}
paulson@14299
   703
paulson@14299
   704
lemma hypreal_le: 
paulson@14299
   705
      "(Abs_hypreal(hyprel``{%n. X n}) <=  
paulson@14299
   706
            Abs_hypreal(hyprel``{%n. Y n})) =  
paulson@14299
   707
       ({n. X n <= Y n} \<in> FreeUltrafilterNat)"
paulson@14299
   708
apply (unfold hypreal_le_def real_le_def)
paulson@14299
   709
apply (auto simp add: hypreal_less)
paulson@14299
   710
apply (ultra+)
paulson@14299
   711
done
paulson@14299
   712
paulson@14299
   713
lemma hypreal_leI: 
paulson@14299
   714
     "~(w < z) ==> z <= (w::hypreal)"
paulson@14301
   715
apply (unfold hypreal_le_def, assumption)
paulson@14299
   716
done
paulson@14299
   717
paulson@14299
   718
lemma hypreal_leD: 
paulson@14299
   719
      "z<=w ==> ~(w<(z::hypreal))"
paulson@14301
   720
apply (unfold hypreal_le_def, assumption)
paulson@14299
   721
done
paulson@14299
   722
paulson@14299
   723
lemma hypreal_less_le_iff: "(~(w < z)) = (z <= (w::hypreal))"
paulson@14301
   724
by (fast intro!: hypreal_leI hypreal_leD)
paulson@14299
   725
paulson@14299
   726
lemma not_hypreal_leE: "~ z <= w ==> w<(z::hypreal)"
paulson@14301
   727
by (unfold hypreal_le_def, fast)
paulson@14299
   728
paulson@14299
   729
lemma hypreal_le_imp_less_or_eq: "!!(x::hypreal). x <= y ==> x < y | x = y"
paulson@14299
   730
apply (unfold hypreal_le_def)
paulson@14299
   731
apply (cut_tac hypreal_linear)
paulson@14299
   732
apply (fast elim: hypreal_less_irrefl hypreal_less_asym)
paulson@14299
   733
done
paulson@14299
   734
paulson@14299
   735
lemma hypreal_less_or_eq_imp_le: "z<w | z=w ==> z <=(w::hypreal)"
paulson@14299
   736
apply (unfold hypreal_le_def)
paulson@14299
   737
apply (cut_tac hypreal_linear)
paulson@14299
   738
apply (fast elim: hypreal_less_irrefl hypreal_less_asym)
paulson@14299
   739
done
paulson@14299
   740
paulson@14299
   741
lemma hypreal_le_eq_less_or_eq: "(x <= (y::hypreal)) = (x < y | x=y)"
paulson@14299
   742
by (blast intro!: hypreal_less_or_eq_imp_le dest: hypreal_le_imp_less_or_eq) 
paulson@14299
   743
paulson@14299
   744
lemmas hypreal_le_less = hypreal_le_eq_less_or_eq
paulson@14299
   745
paulson@14299
   746
lemma hypreal_le_refl: "w <= (w::hypreal)"
paulson@14301
   747
by (simp add: hypreal_le_eq_less_or_eq)
paulson@14299
   748
paulson@14299
   749
(* Axiom 'linorder_linear' of class 'linorder': *)
paulson@14299
   750
lemma hypreal_le_linear: "(z::hypreal) <= w | w <= z"
paulson@14301
   751
apply (simp add: hypreal_le_less)
paulson@14301
   752
apply (cut_tac hypreal_linear, blast)
paulson@14299
   753
done
paulson@14299
   754
paulson@14299
   755
lemma hypreal_le_trans: "[| i <= j; j <= k |] ==> i <= (k::hypreal)"
paulson@14299
   756
apply (drule hypreal_le_imp_less_or_eq) 
paulson@14299
   757
apply (drule hypreal_le_imp_less_or_eq) 
paulson@14299
   758
apply (rule hypreal_less_or_eq_imp_le) 
paulson@14299
   759
apply (blast intro: hypreal_less_trans) 
paulson@14299
   760
done
paulson@14299
   761
paulson@14299
   762
lemma hypreal_le_anti_sym: "[| z <= w; w <= z |] ==> z = (w::hypreal)"
paulson@14299
   763
apply (drule hypreal_le_imp_less_or_eq) 
paulson@14299
   764
apply (drule hypreal_le_imp_less_or_eq) 
paulson@14299
   765
apply (fast elim: hypreal_less_irrefl hypreal_less_asym)
paulson@14299
   766
done
paulson@14299
   767
paulson@14299
   768
(* Axiom 'order_less_le' of class 'order': *)
paulson@14299
   769
lemma hypreal_less_le: "((w::hypreal) < z) = (w <= z & w \<noteq> z)"
paulson@14301
   770
apply (simp add: hypreal_le_def hypreal_neq_iff)
paulson@14299
   771
apply (blast intro: hypreal_less_asym)
paulson@14299
   772
done
paulson@14299
   773
paulson@14329
   774
instance hypreal :: order
paulson@14329
   775
  by (intro_classes,
paulson@14329
   776
      (assumption | 
paulson@14329
   777
       rule hypreal_le_refl hypreal_le_trans hypreal_le_anti_sym
paulson@14329
   778
            hypreal_less_le)+)
paulson@14329
   779
paulson@14329
   780
instance hypreal :: linorder 
paulson@14329
   781
  by (intro_classes, rule hypreal_le_linear)
paulson@14329
   782
paulson@14301
   783
lemma hypreal_minus_zero_less_iff [simp]: "(0 < -R) = (R < (0::hypreal))"
paulson@14301
   784
apply (rule_tac z = R in eq_Abs_hypreal)
paulson@14299
   785
apply (auto simp add: hypreal_zero_def hypreal_less hypreal_minus)
paulson@14299
   786
done
paulson@14299
   787
paulson@14301
   788
lemma hypreal_minus_zero_less_iff2 [simp]: "(-R < 0) = ((0::hypreal) < R)"
paulson@14301
   789
apply (rule_tac z = R in eq_Abs_hypreal)
paulson@14299
   790
apply (auto simp add: hypreal_zero_def hypreal_less hypreal_minus)
paulson@14299
   791
done
paulson@14299
   792
paulson@14301
   793
lemma hypreal_minus_zero_le_iff [simp]: "((0::hypreal) <= -r) = (r <= 0)"
paulson@14299
   794
apply (unfold hypreal_le_def)
paulson@14301
   795
apply (simp add: hypreal_minus_zero_less_iff2)
paulson@14299
   796
done
paulson@14299
   797
paulson@14301
   798
lemma hypreal_minus_zero_le_iff2 [simp]: "(-r <= (0::hypreal)) = (0 <= r)"
paulson@14299
   799
apply (unfold hypreal_le_def)
paulson@14301
   800
apply (simp add: hypreal_minus_zero_less_iff2)
paulson@14299
   801
done
paulson@14299
   802
paulson@14329
   803
paulson@14329
   804
lemma hypreal_self_eq_minus_self_zero: "x = -x ==> x = (0::hypreal)"
paulson@14329
   805
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14329
   806
apply (auto simp add: hypreal_minus hypreal_zero_def, ultra)
paulson@14329
   807
done
paulson@14329
   808
paulson@14329
   809
lemma hypreal_add_self_zero_cancel [simp]: "(x + x = 0) = (x = (0::hypreal))"
paulson@14329
   810
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14329
   811
apply (auto simp add: hypreal_add hypreal_zero_def)
paulson@14329
   812
done
paulson@14329
   813
paulson@14329
   814
lemma hypreal_add_self_zero_cancel2 [simp]:
paulson@14329
   815
     "(x + x + y = y) = (x = (0::hypreal))"
paulson@14329
   816
apply auto
paulson@14329
   817
apply (drule hypreal_eq_minus_iff [THEN iffD1])
paulson@14329
   818
apply (auto simp add: hypreal_add_assoc hypreal_self_eq_minus_self_zero)
paulson@14329
   819
done
paulson@14329
   820
paulson@14329
   821
lemma hypreal_minus_eq_swap: "(b = -a) = (-b = (a::hypreal))"
paulson@14329
   822
by auto
paulson@14329
   823
paulson@14329
   824
lemma hypreal_minus_eq_cancel [simp]: "(-b = -a) = (b = (a::hypreal))"
paulson@14329
   825
by (simp add: hypreal_minus_eq_swap)
paulson@14329
   826
paulson@14329
   827
lemma hypreal_add_less_mono1: "(A::hypreal) < B ==> A + C < B + C"
paulson@14329
   828
apply (rule_tac z = A in eq_Abs_hypreal)
paulson@14329
   829
apply (rule_tac z = B in eq_Abs_hypreal)
paulson@14329
   830
apply (rule_tac z = C in eq_Abs_hypreal)
paulson@14329
   831
apply (auto intro!: exI simp add: hypreal_less_def hypreal_add, ultra)
paulson@14329
   832
done
paulson@14329
   833
paulson@14329
   834
lemma hypreal_mult_order: "[| 0 < x; 0 < y |] ==> (0::hypreal) < x * y"
paulson@14329
   835
apply (unfold hypreal_zero_def)
paulson@14329
   836
apply (rule_tac z = x in eq_Abs_hypreal)
paulson@14329
   837
apply (rule_tac z = y in eq_Abs_hypreal)
paulson@14329
   838
apply (auto intro!: exI simp add: hypreal_less_def hypreal_mult, ultra)
paulson@14329
   839
apply (auto intro: real_mult_order)
paulson@14329
   840
done
paulson@14329
   841
paulson@14329
   842
lemma hypreal_add_left_le_mono1: "(q1::hypreal) \<le> q2  ==> x + q1 \<le> x + q2"
paulson@14329
   843
apply (drule order_le_imp_less_or_eq)
paulson@14329
   844
apply (auto intro: order_less_imp_le hypreal_add_less_mono1 simp add: hypreal_add_commute)
paulson@14329
   845
done
paulson@14329
   846
paulson@14329
   847
lemma hypreal_mult_less_mono1: "[| (0::hypreal) < z; x < y |] ==> x*z < y*z"
paulson@14329
   848
apply (rotate_tac 1)
paulson@14329
   849
apply (drule hypreal_less_minus_iff [THEN iffD1])
paulson@14329
   850
apply (rule hypreal_less_minus_iff [THEN iffD2])
paulson@14329
   851
apply (drule hypreal_mult_order, assumption)
paulson@14329
   852
apply (simp add: hypreal_add_mult_distrib2 hypreal_mult_commute)
paulson@14329
   853
done
paulson@14329
   854
paulson@14329
   855
lemma hypreal_mult_less_mono2: "[| (0::hypreal)<z; x<y |] ==> z*x<z*y"
paulson@14329
   856
apply (simp (no_asm_simp) add: hypreal_mult_commute hypreal_mult_less_mono1)
paulson@14329
   857
done
paulson@14329
   858
paulson@14329
   859
subsection{*The Hyperreals Form an Ordered Field*}
paulson@14329
   860
paulson@14329
   861
instance hypreal :: inverse ..
paulson@14329
   862
paulson@14329
   863
instance hypreal :: ordered_field
paulson@14329
   864
proof
paulson@14329
   865
  fix x y z :: hypreal
paulson@14329
   866
  show "(x + y) + z = x + (y + z)" by (rule hypreal_add_assoc)
paulson@14329
   867
  show "x + y = y + x" by (rule hypreal_add_commute)
paulson@14329
   868
  show "0 + x = x" by simp
paulson@14329
   869
  show "- x + x = 0" by simp
paulson@14329
   870
  show "x - y = x + (-y)" by (simp add: hypreal_diff_def)
paulson@14329
   871
  show "(x * y) * z = x * (y * z)" by (rule hypreal_mult_assoc)
paulson@14329
   872
  show "x * y = y * x" by (rule hypreal_mult_commute)
paulson@14329
   873
  show "1 * x = x" by simp
paulson@14329
   874
  show "(x + y) * z = x * z + y * z" by (simp add: hypreal_add_mult_distrib)
paulson@14329
   875
  show "0 \<noteq> (1::hypreal)" by (rule hypreal_zero_not_eq_one)
paulson@14329
   876
  show "x \<le> y ==> z + x \<le> z + y" by (rule hypreal_add_left_le_mono1)
paulson@14329
   877
  show "x < y ==> 0 < z ==> z * x < z * y" by (simp add: hypreal_mult_less_mono2)
paulson@14329
   878
  show "\<bar>x\<bar> = (if x < 0 then -x else x)"
paulson@14329
   879
    by (auto dest: order_le_less_trans simp add: hrabs_def linorder_not_le)
paulson@14329
   880
  show "x \<noteq> 0 ==> inverse x * x = 1" by simp
paulson@14329
   881
  show "y \<noteq> 0 ==> x / y = x * inverse y" by (simp add: hypreal_divide_def)
paulson@14329
   882
qed
paulson@14329
   883
paulson@14329
   884
lemma hypreal_minus_add_distrib [simp]: "-(x + (y::hypreal)) = -x + -y"
paulson@14329
   885
  by (rule Ring_and_Field.minus_add_distrib)
paulson@14329
   886
paulson@14329
   887
(*Used ONCE: in NSA.ML*)
paulson@14329
   888
lemma hypreal_minus_distrib1: "-(y + -(x::hypreal)) = x + -y"
paulson@14329
   889
by (simp add: hypreal_add_commute)
paulson@14329
   890
paulson@14329
   891
(*Used ONCE: in Lim.ML*)
paulson@14329
   892
lemma hypreal_eq_minus_iff3: "(x = y + z) = (x + -z = (y::hypreal))"
paulson@14329
   893
by (auto simp add: hypreal_add_assoc)
paulson@14329
   894
paulson@14329
   895
lemma hypreal_not_eq_minus_iff: "(x \<noteq> a) = (x + -a \<noteq> (0::hypreal))"
paulson@14329
   896
by (auto dest: hypreal_eq_minus_iff [THEN iffD2])
paulson@14329
   897
paulson@14329
   898
lemma hypreal_mult_left_cancel: "(c::hypreal) \<noteq> 0 ==> (c*a=c*b) = (a=b)"
paulson@14329
   899
apply auto
paulson@14329
   900
done
paulson@14329
   901
    
paulson@14329
   902
lemma hypreal_mult_right_cancel: "(c::hypreal) \<noteq> 0 ==> (a*c=b*c) = (a=b)"
paulson@14329
   903
apply auto
paulson@14329
   904
done
paulson@14329
   905
paulson@14329
   906
lemma hypreal_inverse_not_zero: "x \<noteq> 0 ==> inverse (x::hypreal) \<noteq> 0"
paulson@14329
   907
  by (rule Ring_and_Field.nonzero_imp_inverse_nonzero)
paulson@14329
   908
paulson@14329
   909
lemma hypreal_mult_not_0: "[| x \<noteq> 0; y \<noteq> 0 |] ==> x * y \<noteq> (0::hypreal)"
paulson@14329
   910
by simp
paulson@14329
   911
paulson@14329
   912
lemma hypreal_minus_inverse: "inverse(-x) = -inverse(x::hypreal)"
paulson@14329
   913
  by (rule Ring_and_Field.inverse_minus_eq)
paulson@14329
   914
paulson@14329
   915
lemma hypreal_inverse_distrib: "inverse(x*y) = inverse(x)*inverse(y::hypreal)"
paulson@14329
   916
  by (rule Ring_and_Field.inverse_mult_distrib)
paulson@14329
   917
paulson@14329
   918
paulson@14329
   919
subsection{* Division lemmas *}
paulson@14329
   920
paulson@14329
   921
lemma hypreal_divide_one: "x/(1::hypreal) = x"
paulson@14329
   922
by (simp add: hypreal_divide_def)
paulson@14329
   923
paulson@14329
   924
paulson@14329
   925
(** As with multiplication, pull minus signs OUT of the / operator **)
paulson@14329
   926
paulson@14329
   927
lemma hypreal_add_divide_distrib: "(x+y)/(z::hypreal) = x/z + y/z"
paulson@14329
   928
  by (rule Ring_and_Field.add_divide_distrib)
paulson@14329
   929
paulson@14329
   930
lemma hypreal_inverse_add:
paulson@14329
   931
     "[|(x::hypreal) \<noteq> 0;  y \<noteq> 0 |]   
paulson@14329
   932
      ==> inverse(x) + inverse(y) = (x + y)*inverse(x*y)"
paulson@14329
   933
by (simp add: Ring_and_Field.inverse_add mult_assoc)
paulson@14329
   934
paulson@14329
   935
paulson@14329
   936
subsection{*@{term hypreal_of_real} Preserves Field and Order Properties*}
paulson@14329
   937
paulson@14301
   938
lemma hypreal_of_real_add [simp]: 
paulson@14299
   939
     "hypreal_of_real (z1 + z2) = hypreal_of_real z1 + hypreal_of_real z2"
paulson@14299
   940
apply (unfold hypreal_of_real_def)
paulson@14301
   941
apply (simp add: hypreal_add hypreal_add_mult_distrib)
paulson@14299
   942
done
paulson@14299
   943
paulson@14301
   944
lemma hypreal_of_real_mult [simp]: 
paulson@14299
   945
     "hypreal_of_real (z1 * z2) = hypreal_of_real z1 * hypreal_of_real z2"
paulson@14299
   946
apply (unfold hypreal_of_real_def)
paulson@14301
   947
apply (simp add: hypreal_mult hypreal_add_mult_distrib2)
paulson@14299
   948
done
paulson@14299
   949
paulson@14301
   950
lemma hypreal_of_real_less_iff [simp]: 
paulson@14299
   951
     "(hypreal_of_real z1 <  hypreal_of_real z2) = (z1 < z2)"
paulson@14301
   952
apply (unfold hypreal_less_def hypreal_of_real_def, auto)
paulson@14301
   953
apply (rule_tac [2] x = "%n. z1" in exI, safe)
paulson@14301
   954
apply (rule_tac [3] x = "%n. z2" in exI, auto)
paulson@14301
   955
apply (rule FreeUltrafilterNat_P, ultra)
paulson@14299
   956
done
paulson@14299
   957
paulson@14301
   958
lemma hypreal_of_real_le_iff [simp]: 
paulson@14299
   959
     "(hypreal_of_real z1 <= hypreal_of_real z2) = (z1 <= z2)"
paulson@14301
   960
apply (unfold hypreal_le_def real_le_def, auto)
paulson@14299
   961
done
paulson@14299
   962
paulson@14329
   963
lemma hypreal_of_real_eq_iff [simp]:
paulson@14329
   964
     "(hypreal_of_real z1 = hypreal_of_real z2) = (z1 = z2)"
paulson@14301
   965
by (force intro: order_antisym hypreal_of_real_le_iff [THEN iffD1])
paulson@14299
   966
paulson@14329
   967
lemma hypreal_of_real_minus [simp]:
paulson@14329
   968
     "hypreal_of_real (-r) = - hypreal_of_real  r"
paulson@14299
   969
apply (unfold hypreal_of_real_def)
paulson@14299
   970
apply (auto simp add: hypreal_minus)
paulson@14299
   971
done
paulson@14299
   972
paulson@14301
   973
lemma hypreal_of_real_one [simp]: "hypreal_of_real 1 = (1::hypreal)"
paulson@14301
   974
by (unfold hypreal_of_real_def hypreal_one_def, simp)
paulson@14299
   975
paulson@14301
   976
lemma hypreal_of_real_zero [simp]: "hypreal_of_real 0 = 0"
paulson@14301
   977
by (unfold hypreal_of_real_def hypreal_zero_def, simp)
paulson@14299
   978
paulson@14299
   979
lemma hypreal_of_real_zero_iff: "(hypreal_of_real r = 0) = (r = 0)"
paulson@14301
   980
by (auto intro: FreeUltrafilterNat_P simp add: hypreal_of_real_def hypreal_zero_def FreeUltrafilterNat_Nat_set)
paulson@14299
   981
paulson@14329
   982
lemma hypreal_of_real_inverse [simp]:
paulson@14329
   983
     "hypreal_of_real (inverse r) = inverse (hypreal_of_real r)"
paulson@14299
   984
apply (case_tac "r=0")
paulson@14301
   985
apply (simp add: DIVISION_BY_ZERO INVERSE_ZERO HYPREAL_INVERSE_ZERO)
paulson@14299
   986
apply (rule_tac c1 = "hypreal_of_real r" in hypreal_mult_left_cancel [THEN iffD1])
paulson@14299
   987
apply (auto simp add: hypreal_of_real_zero_iff hypreal_of_real_mult [symmetric])
paulson@14299
   988
done
paulson@14299
   989
paulson@14329
   990
lemma hypreal_of_real_divide [simp]:
paulson@14329
   991
     "hypreal_of_real (z1 / z2) = hypreal_of_real z1 / hypreal_of_real z2"
paulson@14301
   992
by (simp add: hypreal_divide_def real_divide_def)
paulson@14299
   993
paulson@14299
   994
paulson@14329
   995
subsection{*Misc Others*}
paulson@14299
   996
paulson@14299
   997
lemma hypreal_zero_num: "0 = Abs_hypreal (hyprel `` {%n. 0})"
paulson@14301
   998
by (simp add: hypreal_zero_def [THEN meta_eq_to_obj_eq, symmetric])
paulson@14299
   999
paulson@14299
  1000
lemma hypreal_one_num: "1 = Abs_hypreal (hyprel `` {%n. 1})"
paulson@14301
  1001
by (simp add: hypreal_one_def [THEN meta_eq_to_obj_eq, symmetric])
paulson@14299
  1002
paulson@14301
  1003
lemma hypreal_omega_gt_zero [simp]: "0 < omega"
paulson@14299
  1004
apply (unfold omega_def)
paulson@14299
  1005
apply (auto simp add: hypreal_less hypreal_zero_num)
paulson@14299
  1006
done
paulson@14299
  1007
paulson@14329
  1008
paulson@14329
  1009
lemma hypreal_hrabs:
paulson@14329
  1010
     "abs (Abs_hypreal (hyprel `` {X})) = 
paulson@14329
  1011
      Abs_hypreal(hyprel `` {%n. abs (X n)})"
paulson@14329
  1012
apply (auto simp add: hrabs_def hypreal_zero_def hypreal_le hypreal_minus)
paulson@14329
  1013
apply (ultra, arith)+
paulson@14329
  1014
done
paulson@14329
  1015
paulson@14299
  1016
ML
paulson@14299
  1017
{*
paulson@14329
  1018
val hrabs_def = thm "hrabs_def";
paulson@14329
  1019
val hypreal_hrabs = thm "hypreal_hrabs";
paulson@14329
  1020
paulson@14299
  1021
val hypreal_zero_def = thm "hypreal_zero_def";
paulson@14299
  1022
val hypreal_one_def = thm "hypreal_one_def";
paulson@14299
  1023
val hypreal_minus_def = thm "hypreal_minus_def";
paulson@14299
  1024
val hypreal_diff_def = thm "hypreal_diff_def";
paulson@14299
  1025
val hypreal_inverse_def = thm "hypreal_inverse_def";
paulson@14299
  1026
val hypreal_divide_def = thm "hypreal_divide_def";
paulson@14299
  1027
val hypreal_of_real_def = thm "hypreal_of_real_def";
paulson@14299
  1028
val omega_def = thm "omega_def";
paulson@14299
  1029
val epsilon_def = thm "epsilon_def";
paulson@14299
  1030
val hypreal_add_def = thm "hypreal_add_def";
paulson@14299
  1031
val hypreal_mult_def = thm "hypreal_mult_def";
paulson@14299
  1032
val hypreal_less_def = thm "hypreal_less_def";
paulson@14299
  1033
val hypreal_le_def = thm "hypreal_le_def";
paulson@14299
  1034
paulson@14299
  1035
val finite_exhausts = thm "finite_exhausts";
paulson@14299
  1036
val finite_not_covers = thm "finite_not_covers";
paulson@14299
  1037
val not_finite_nat = thm "not_finite_nat";
paulson@14299
  1038
val FreeUltrafilterNat_Ex = thm "FreeUltrafilterNat_Ex";
paulson@14299
  1039
val FreeUltrafilterNat_mem = thm "FreeUltrafilterNat_mem";
paulson@14299
  1040
val FreeUltrafilterNat_finite = thm "FreeUltrafilterNat_finite";
paulson@14299
  1041
val FreeUltrafilterNat_not_finite = thm "FreeUltrafilterNat_not_finite";
paulson@14299
  1042
val FreeUltrafilterNat_empty = thm "FreeUltrafilterNat_empty";
paulson@14299
  1043
val FreeUltrafilterNat_Int = thm "FreeUltrafilterNat_Int";
paulson@14299
  1044
val FreeUltrafilterNat_subset = thm "FreeUltrafilterNat_subset";
paulson@14299
  1045
val FreeUltrafilterNat_Compl = thm "FreeUltrafilterNat_Compl";
paulson@14299
  1046
val FreeUltrafilterNat_Compl_mem = thm "FreeUltrafilterNat_Compl_mem";
paulson@14299
  1047
val FreeUltrafilterNat_Compl_iff1 = thm "FreeUltrafilterNat_Compl_iff1";
paulson@14299
  1048
val FreeUltrafilterNat_Compl_iff2 = thm "FreeUltrafilterNat_Compl_iff2";
paulson@14299
  1049
val FreeUltrafilterNat_UNIV = thm "FreeUltrafilterNat_UNIV";
paulson@14299
  1050
val FreeUltrafilterNat_Nat_set = thm "FreeUltrafilterNat_Nat_set";
paulson@14299
  1051
val FreeUltrafilterNat_Nat_set_refl = thm "FreeUltrafilterNat_Nat_set_refl";
paulson@14299
  1052
val FreeUltrafilterNat_P = thm "FreeUltrafilterNat_P";
paulson@14299
  1053
val FreeUltrafilterNat_Ex_P = thm "FreeUltrafilterNat_Ex_P";
paulson@14299
  1054
val FreeUltrafilterNat_all = thm "FreeUltrafilterNat_all";
paulson@14299
  1055
val FreeUltrafilterNat_Un = thm "FreeUltrafilterNat_Un";
paulson@14299
  1056
val hyprel_iff = thm "hyprel_iff";
paulson@14299
  1057
val hyprel_refl = thm "hyprel_refl";
paulson@14299
  1058
val hyprel_sym = thm "hyprel_sym";
paulson@14299
  1059
val hyprel_trans = thm "hyprel_trans";
paulson@14299
  1060
val equiv_hyprel = thm "equiv_hyprel";
paulson@14299
  1061
val hyprel_in_hypreal = thm "hyprel_in_hypreal";
paulson@14299
  1062
val Abs_hypreal_inverse = thm "Abs_hypreal_inverse";
paulson@14299
  1063
val inj_on_Abs_hypreal = thm "inj_on_Abs_hypreal";
paulson@14299
  1064
val inj_Rep_hypreal = thm "inj_Rep_hypreal";
paulson@14299
  1065
val lemma_hyprel_refl = thm "lemma_hyprel_refl";
paulson@14299
  1066
val hypreal_empty_not_mem = thm "hypreal_empty_not_mem";
paulson@14299
  1067
val Rep_hypreal_nonempty = thm "Rep_hypreal_nonempty";
paulson@14299
  1068
val inj_hypreal_of_real = thm "inj_hypreal_of_real";
paulson@14299
  1069
val eq_Abs_hypreal = thm "eq_Abs_hypreal";
paulson@14299
  1070
val hypreal_minus_congruent = thm "hypreal_minus_congruent";
paulson@14299
  1071
val hypreal_minus = thm "hypreal_minus";
paulson@14299
  1072
val hypreal_minus_minus = thm "hypreal_minus_minus";
paulson@14299
  1073
val inj_hypreal_minus = thm "inj_hypreal_minus";
paulson@14299
  1074
val hypreal_minus_zero = thm "hypreal_minus_zero";
paulson@14299
  1075
val hypreal_minus_zero_iff = thm "hypreal_minus_zero_iff";
paulson@14299
  1076
val hypreal_add_congruent2 = thm "hypreal_add_congruent2";
paulson@14299
  1077
val hypreal_add = thm "hypreal_add";
paulson@14299
  1078
val hypreal_diff = thm "hypreal_diff";
paulson@14299
  1079
val hypreal_add_commute = thm "hypreal_add_commute";
paulson@14299
  1080
val hypreal_add_assoc = thm "hypreal_add_assoc";
paulson@14299
  1081
val hypreal_add_left_commute = thm "hypreal_add_left_commute";
paulson@14299
  1082
val hypreal_add_zero_left = thm "hypreal_add_zero_left";
paulson@14299
  1083
val hypreal_add_zero_right = thm "hypreal_add_zero_right";
paulson@14299
  1084
val hypreal_add_minus = thm "hypreal_add_minus";
paulson@14299
  1085
val hypreal_add_minus_left = thm "hypreal_add_minus_left";
paulson@14299
  1086
val hypreal_minus_add_distrib = thm "hypreal_minus_add_distrib";
paulson@14299
  1087
val hypreal_minus_distrib1 = thm "hypreal_minus_distrib1";
paulson@14299
  1088
val hypreal_add_left_cancel = thm "hypreal_add_left_cancel";
paulson@14299
  1089
val hypreal_add_right_cancel = thm "hypreal_add_right_cancel";
paulson@14299
  1090
val hypreal_add_minus_cancelA = thm "hypreal_add_minus_cancelA";
paulson@14299
  1091
val hypreal_minus_add_cancelA = thm "hypreal_minus_add_cancelA";
paulson@14299
  1092
val hypreal_mult_congruent2 = thm "hypreal_mult_congruent2";
paulson@14299
  1093
val hypreal_mult = thm "hypreal_mult";
paulson@14299
  1094
val hypreal_mult_commute = thm "hypreal_mult_commute";
paulson@14299
  1095
val hypreal_mult_assoc = thm "hypreal_mult_assoc";
paulson@14299
  1096
val hypreal_mult_left_commute = thm "hypreal_mult_left_commute";
paulson@14299
  1097
val hypreal_mult_1 = thm "hypreal_mult_1";
paulson@14299
  1098
val hypreal_mult_1_right = thm "hypreal_mult_1_right";
paulson@14299
  1099
val hypreal_mult_0 = thm "hypreal_mult_0";
paulson@14299
  1100
val hypreal_mult_0_right = thm "hypreal_mult_0_right";
paulson@14299
  1101
val hypreal_minus_mult_eq1 = thm "hypreal_minus_mult_eq1";
paulson@14299
  1102
val hypreal_minus_mult_eq2 = thm "hypreal_minus_mult_eq2";
paulson@14299
  1103
val hypreal_mult_minus_1 = thm "hypreal_mult_minus_1";
paulson@14299
  1104
val hypreal_mult_minus_1_right = thm "hypreal_mult_minus_1_right";
paulson@14299
  1105
val hypreal_minus_mult_commute = thm "hypreal_minus_mult_commute";
paulson@14299
  1106
val hypreal_add_mult_distrib = thm "hypreal_add_mult_distrib";
paulson@14299
  1107
val hypreal_add_mult_distrib2 = thm "hypreal_add_mult_distrib2";
paulson@14299
  1108
val hypreal_diff_mult_distrib = thm "hypreal_diff_mult_distrib";
paulson@14299
  1109
val hypreal_diff_mult_distrib2 = thm "hypreal_diff_mult_distrib2";
paulson@14299
  1110
val hypreal_zero_not_eq_one = thm "hypreal_zero_not_eq_one";
paulson@14299
  1111
val hypreal_inverse_congruent = thm "hypreal_inverse_congruent";
paulson@14299
  1112
val hypreal_inverse = thm "hypreal_inverse";
paulson@14299
  1113
val HYPREAL_INVERSE_ZERO = thm "HYPREAL_INVERSE_ZERO";
paulson@14299
  1114
val HYPREAL_DIVISION_BY_ZERO = thm "HYPREAL_DIVISION_BY_ZERO";
paulson@14299
  1115
val hypreal_mult_inverse = thm "hypreal_mult_inverse";
paulson@14299
  1116
val hypreal_mult_inverse_left = thm "hypreal_mult_inverse_left";
paulson@14299
  1117
val hypreal_mult_left_cancel = thm "hypreal_mult_left_cancel";
paulson@14299
  1118
val hypreal_mult_right_cancel = thm "hypreal_mult_right_cancel";
paulson@14299
  1119
val hypreal_inverse_not_zero = thm "hypreal_inverse_not_zero";
paulson@14299
  1120
val hypreal_mult_not_0 = thm "hypreal_mult_not_0";
paulson@14299
  1121
val hypreal_minus_inverse = thm "hypreal_minus_inverse";
paulson@14299
  1122
val hypreal_inverse_distrib = thm "hypreal_inverse_distrib";
paulson@14299
  1123
val hypreal_less_not_refl = thm "hypreal_less_not_refl";
paulson@14299
  1124
val hypreal_not_refl2 = thm "hypreal_not_refl2";
paulson@14299
  1125
val hypreal_less_trans = thm "hypreal_less_trans";
paulson@14299
  1126
val hypreal_less_asym = thm "hypreal_less_asym";
paulson@14299
  1127
val hypreal_less = thm "hypreal_less";
paulson@14299
  1128
val hypreal_trichotomy = thm "hypreal_trichotomy";
paulson@14299
  1129
val hypreal_less_minus_iff = thm "hypreal_less_minus_iff";
paulson@14299
  1130
val hypreal_less_minus_iff2 = thm "hypreal_less_minus_iff2";
paulson@14299
  1131
val hypreal_eq_minus_iff = thm "hypreal_eq_minus_iff";
paulson@14299
  1132
val hypreal_eq_minus_iff2 = thm "hypreal_eq_minus_iff2";
paulson@14299
  1133
val hypreal_eq_minus_iff3 = thm "hypreal_eq_minus_iff3";
paulson@14299
  1134
val hypreal_not_eq_minus_iff = thm "hypreal_not_eq_minus_iff";
paulson@14299
  1135
val hypreal_linear = thm "hypreal_linear";
paulson@14299
  1136
val hypreal_neq_iff = thm "hypreal_neq_iff";
paulson@14299
  1137
val hypreal_linear_less2 = thm "hypreal_linear_less2";
paulson@14299
  1138
val hypreal_le = thm "hypreal_le";
paulson@14299
  1139
val hypreal_leI = thm "hypreal_leI";
paulson@14299
  1140
val hypreal_leD = thm "hypreal_leD";
paulson@14299
  1141
val hypreal_less_le_iff = thm "hypreal_less_le_iff";
paulson@14299
  1142
val not_hypreal_leE = thm "not_hypreal_leE";
paulson@14299
  1143
val hypreal_le_imp_less_or_eq = thm "hypreal_le_imp_less_or_eq";
paulson@14299
  1144
val hypreal_less_or_eq_imp_le = thm "hypreal_less_or_eq_imp_le";
paulson@14299
  1145
val hypreal_le_eq_less_or_eq = thm "hypreal_le_eq_less_or_eq";
paulson@14299
  1146
val hypreal_le_refl = thm "hypreal_le_refl";
paulson@14299
  1147
val hypreal_le_linear = thm "hypreal_le_linear";
paulson@14299
  1148
val hypreal_le_trans = thm "hypreal_le_trans";
paulson@14299
  1149
val hypreal_le_anti_sym = thm "hypreal_le_anti_sym";
paulson@14299
  1150
val hypreal_less_le = thm "hypreal_less_le";
paulson@14299
  1151
val hypreal_minus_zero_less_iff = thm "hypreal_minus_zero_less_iff";
paulson@14299
  1152
val hypreal_minus_zero_less_iff2 = thm "hypreal_minus_zero_less_iff2";
paulson@14299
  1153
val hypreal_minus_zero_le_iff = thm "hypreal_minus_zero_le_iff";
paulson@14299
  1154
val hypreal_minus_zero_le_iff2 = thm "hypreal_minus_zero_le_iff2";
paulson@14299
  1155
val hypreal_of_real_add = thm "hypreal_of_real_add";
paulson@14299
  1156
val hypreal_of_real_mult = thm "hypreal_of_real_mult";
paulson@14299
  1157
val hypreal_of_real_less_iff = thm "hypreal_of_real_less_iff";
paulson@14299
  1158
val hypreal_of_real_le_iff = thm "hypreal_of_real_le_iff";
paulson@14299
  1159
val hypreal_of_real_eq_iff = thm "hypreal_of_real_eq_iff";
paulson@14299
  1160
val hypreal_of_real_minus = thm "hypreal_of_real_minus";
paulson@14299
  1161
val hypreal_of_real_one = thm "hypreal_of_real_one";
paulson@14299
  1162
val hypreal_of_real_zero = thm "hypreal_of_real_zero";
paulson@14299
  1163
val hypreal_of_real_zero_iff = thm "hypreal_of_real_zero_iff";
paulson@14299
  1164
val hypreal_of_real_inverse = thm "hypreal_of_real_inverse";
paulson@14299
  1165
val hypreal_of_real_divide = thm "hypreal_of_real_divide";
paulson@14299
  1166
val hypreal_divide_one = thm "hypreal_divide_one";
paulson@14299
  1167
val hypreal_add_divide_distrib = thm "hypreal_add_divide_distrib";
paulson@14299
  1168
val hypreal_inverse_add = thm "hypreal_inverse_add";
paulson@14299
  1169
val hypreal_self_eq_minus_self_zero = thm "hypreal_self_eq_minus_self_zero";
paulson@14299
  1170
val hypreal_add_self_zero_cancel = thm "hypreal_add_self_zero_cancel";
paulson@14299
  1171
val hypreal_add_self_zero_cancel2 = thm "hypreal_add_self_zero_cancel2";
paulson@14299
  1172
val hypreal_minus_eq_swap = thm "hypreal_minus_eq_swap";
paulson@14299
  1173
val hypreal_minus_eq_cancel = thm "hypreal_minus_eq_cancel";
paulson@14299
  1174
val hypreal_zero_num = thm "hypreal_zero_num";
paulson@14299
  1175
val hypreal_one_num = thm "hypreal_one_num";
paulson@14299
  1176
val hypreal_omega_gt_zero = thm "hypreal_omega_gt_zero";
paulson@14299
  1177
*}
paulson@14299
  1178
paulson@14299
  1179
paulson@10751
  1180
end