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