src/HOL/Hyperreal/HyperDef.thy
author berghofe
Fri, 01 Jul 2005 13:54:12 +0200
changeset 16633 208ebc9311f2
parent 16417 9bc16273c2d4
child 17290 a39d1430d271
permissions -rw-r--r--
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification of premises of congruence rules.
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
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
     5
    Conversion to Isar and new proofs by Lawrence C Paulson, 2004
13487
wenzelm
parents: 12018
diff changeset
     6
*)
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     7
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
     8
header{*Construction of Hyperreals Using Ultrafilters*}
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
     9
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15085
diff changeset
    10
theory HyperDef
15140
322485b816ac import -> imports
nipkow
parents: 15131
diff changeset
    11
imports Filter "../Real/Real"
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 15539
diff changeset
    12
uses ("fuf.ML")  (*Warning: file fuf.ML refers to the name Hyperdef!*)
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15085
diff changeset
    13
begin
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    14
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    15
constdefs
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    16
14361
ad2f5da643b4 * Support for raw latex output in control symbols: \<^raw...>
schirmer
parents: 14348
diff changeset
    17
  FreeUltrafilterNat   :: "nat set set"    ("\<U>")
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    18
    "FreeUltrafilterNat == (SOME U. U \<in> FreeUltrafilter (UNIV:: nat set))"
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    19
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    20
  hyprel :: "((nat=>real)*(nat=>real)) set"
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    21
    "hyprel == {p. \<exists>X Y. p = ((X::nat=>real),Y) &
14705
paulson
parents: 14691
diff changeset
    22
                   {n::nat. X(n) = Y(n)} \<in> FreeUltrafilterNat}"
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
typedef hypreal = "UNIV//hyprel" 
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    25
    by (auto simp add: quotient_def) 
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    26
14691
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
    27
instance hypreal :: "{ord, zero, one, plus, times, minus, inverse}" ..
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    28
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    29
defs (overloaded)
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    30
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    31
  hypreal_zero_def:
14705
paulson
parents: 14691
diff changeset
    32
  "0 == Abs_hypreal(hyprel``{%n. 0})"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    33
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    34
  hypreal_one_def:
14705
paulson
parents: 14691
diff changeset
    35
  "1 == Abs_hypreal(hyprel``{%n. 1})"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    36
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    37
  hypreal_minus_def:
14705
paulson
parents: 14691
diff changeset
    38
  "- P == Abs_hypreal(\<Union>X \<in> Rep_hypreal(P). hyprel``{%n. - (X n)})"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    39
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    40
  hypreal_diff_def:
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    41
  "x - y == x + -(y::hypreal)"
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    42
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    43
  hypreal_inverse_def:
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    44
  "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
    45
                    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
    46
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    47
  hypreal_divide_def:
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    48
  "P / Q::hypreal == P * inverse Q"
13487
wenzelm
parents: 12018
diff changeset
    49
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    50
constdefs
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    51
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    52
  hypreal_of_real  :: "real => hypreal"
14705
paulson
parents: 14691
diff changeset
    53
  "hypreal_of_real r         == Abs_hypreal(hyprel``{%n. r})"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    54
14691
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
    55
  omega   :: hypreal   -- {*an infinite number @{text "= [<1,2,3,...>]"} *}
14705
paulson
parents: 14691
diff changeset
    56
  "omega == Abs_hypreal(hyprel``{%n. real (Suc n)})"
13487
wenzelm
parents: 12018
diff changeset
    57
14691
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
    58
  epsilon :: hypreal   -- {*an infinitesimal number @{text "= [<1,1/2,1/3,...>]"} *}
14705
paulson
parents: 14691
diff changeset
    59
  "epsilon == Abs_hypreal(hyprel``{%n. inverse (real (Suc n))})"
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    60
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    61
syntax (xsymbols)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    62
  omega   :: hypreal   ("\<omega>")
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    63
  epsilon :: hypreal   ("\<epsilon>")
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    64
14565
c6dc17aab88a use more symbols in HTML output
kleing
parents: 14477
diff changeset
    65
syntax (HTML output)
c6dc17aab88a use more symbols in HTML output
kleing
parents: 14477
diff changeset
    66
  omega   :: hypreal   ("\<omega>")
c6dc17aab88a use more symbols in HTML output
kleing
parents: 14477
diff changeset
    67
  epsilon :: hypreal   ("\<epsilon>")
c6dc17aab88a use more symbols in HTML output
kleing
parents: 14477
diff changeset
    68
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    69
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
    70
defs (overloaded)
13487
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).
14705
paulson
parents: 14691
diff changeset
    74
                hyprel``{%n. 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).
14705
paulson
parents: 14691
diff changeset
    78
                hyprel``{%n. X n * Y n})"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    79
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
    80
  hypreal_le_def:
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
    81
  "P \<le> (Q::hypreal) == \<exists>X Y. X \<in> Rep_hypreal(P) &
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
    82
                               Y \<in> Rep_hypreal(Q) &
14705
paulson
parents: 14691
diff changeset
    83
                               {n. X n \<le> Y n} \<in> FreeUltrafilterNat"
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
    84
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
    85
  hypreal_less_def: "(x < (y::hypreal)) == (x \<le> y & x \<noteq> y)"
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
14705
paulson
parents: 14691
diff changeset
   116
lemma FreeUltrafilterNat_Ex: "\<exists>U. U \<in> 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]: 
14705
paulson
parents: 14691
diff changeset
   120
     "FreeUltrafilterNat \<in> FreeUltrafilter(UNIV:: nat set)"
14299
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
14705
paulson
parents: 14691
diff changeset
   133
lemma FreeUltrafilterNat_not_finite: "x \<in> 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:
14705
paulson
parents: 14691
diff changeset
   145
     "[| X \<in> FreeUltrafilterNat;  Y \<in> FreeUltrafilterNat |]   
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   146
      ==> X Int Y \<in> FreeUltrafilterNat"
14705
paulson
parents: 14691
diff changeset
   147
apply (insert FreeUltrafilterNat_mem)
14299
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:
14705
paulson
parents: 14691
diff changeset
   152
     "[| X \<in> FreeUltrafilterNat;  X \<subseteq> Y |]  
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   153
      ==> Y \<in> FreeUltrafilterNat"
14705
paulson
parents: 14691
diff changeset
   154
apply (insert FreeUltrafilterNat_mem)
14299
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:
14705
paulson
parents: 14691
diff changeset
   159
     "X \<in> FreeUltrafilterNat ==> -X \<notin> FreeUltrafilterNat"
paulson
parents: 14691
diff changeset
   160
proof
paulson
parents: 14691
diff changeset
   161
  assume "X \<in> \<U>" and "- X \<in> \<U>"
paulson
parents: 14691
diff changeset
   162
  hence "X Int - X \<in> \<U>" by (rule FreeUltrafilterNat_Int) 
paulson
parents: 14691
diff changeset
   163
  thus False by force
paulson
parents: 14691
diff changeset
   164
qed
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   165
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   166
lemma FreeUltrafilterNat_Compl_mem:
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   167
     "X\<notin> FreeUltrafilterNat ==> -X \<in> FreeUltrafilterNat"
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   168
apply (cut_tac FreeUltrafilterNat_mem [THEN FreeUltrafilter_iff [THEN iffD1]])
14301
paulson
parents: 14299
diff changeset
   169
apply (safe, drule_tac x = X in bspec)
15539
333a88244569 comprehensive cleanup, replacing sumr by setsum
nipkow
parents: 15413
diff changeset
   170
apply (auto)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   171
done
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   172
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   173
lemma FreeUltrafilterNat_Compl_iff1:
14705
paulson
parents: 14691
diff changeset
   174
     "(X \<notin> FreeUltrafilterNat) = (-X \<in> FreeUltrafilterNat)"
14301
paulson
parents: 14299
diff changeset
   175
by (blast dest: FreeUltrafilterNat_Compl FreeUltrafilterNat_Compl_mem)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   176
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   177
lemma FreeUltrafilterNat_Compl_iff2:
14705
paulson
parents: 14691
diff changeset
   178
     "(X \<in> FreeUltrafilterNat) = (-X \<notin> FreeUltrafilterNat)"
14301
paulson
parents: 14299
diff changeset
   179
by (auto simp add: FreeUltrafilterNat_Compl_iff1 [symmetric])
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   180
14378
69c4d5997669 generic of_nat and of_int functions, and generalization of iszero
paulson
parents: 14371
diff changeset
   181
lemma cofinite_mem_FreeUltrafilterNat: "finite (-X) ==> X \<in> FreeUltrafilterNat"
69c4d5997669 generic of_nat and of_int functions, and generalization of iszero
paulson
parents: 14371
diff changeset
   182
apply (drule FreeUltrafilterNat_finite)  
69c4d5997669 generic of_nat and of_int functions, and generalization of iszero
paulson
parents: 14371
diff changeset
   183
apply (simp add: FreeUltrafilterNat_Compl_iff2 [symmetric])
69c4d5997669 generic of_nat and of_int functions, and generalization of iszero
paulson
parents: 14371
diff changeset
   184
done
69c4d5997669 generic of_nat and of_int functions, and generalization of iszero
paulson
parents: 14371
diff changeset
   185
15539
333a88244569 comprehensive cleanup, replacing sumr by setsum
nipkow
parents: 15413
diff changeset
   186
lemma FreeUltrafilterNat_UNIV [iff]: "UNIV \<in> FreeUltrafilterNat"
14301
paulson
parents: 14299
diff changeset
   187
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
   188
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   189
lemma FreeUltrafilterNat_Nat_set_refl [intro]:
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   190
     "{n. P(n) = P(n)} \<in> FreeUltrafilterNat"
14301
paulson
parents: 14299
diff changeset
   191
by simp
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   192
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   193
lemma FreeUltrafilterNat_P: "{n::nat. P} \<in> FreeUltrafilterNat ==> P"
14301
paulson
parents: 14299
diff changeset
   194
by (rule ccontr, simp)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   195
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   196
lemma FreeUltrafilterNat_Ex_P: "{n. P(n)} \<in> FreeUltrafilterNat ==> \<exists>n. P(n)"
14301
paulson
parents: 14299
diff changeset
   197
by (rule ccontr, simp)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   198
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   199
lemma FreeUltrafilterNat_all: "\<forall>n. P(n) ==> {n. P(n)} \<in> FreeUltrafilterNat"
15539
333a88244569 comprehensive cleanup, replacing sumr by setsum
nipkow
parents: 15413
diff changeset
   200
by (auto)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   201
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   202
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   203
text{*Define and use Ultrafilter tactics*}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   204
use "fuf.ML"
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   205
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   206
method_setup fuf = {*
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   207
    Method.ctxt_args (fn ctxt =>
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   208
        Method.METHOD (fn facts =>
15032
02aed07e01bf local_cla/simpset_of;
wenzelm
parents: 15013
diff changeset
   209
            fuf_tac (local_clasimpset_of ctxt) 1)) *}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   210
    "free ultrafilter tactic"
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   211
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   212
method_setup ultra = {*
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   213
    Method.ctxt_args (fn ctxt =>
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   214
        Method.METHOD (fn facts =>
15032
02aed07e01bf local_cla/simpset_of;
wenzelm
parents: 15013
diff changeset
   215
            ultra_tac (local_clasimpset_of ctxt) 1)) *}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   216
    "ultrafilter tactic"
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   217
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   218
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   219
text{*One further property of our free ultrafilter*}
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   220
lemma FreeUltrafilterNat_Un:
14705
paulson
parents: 14691
diff changeset
   221
     "X Un Y \<in> FreeUltrafilterNat  
paulson
parents: 14691
diff changeset
   222
      ==> X \<in> FreeUltrafilterNat | Y \<in> FreeUltrafilterNat"
paulson
parents: 14691
diff changeset
   223
by (auto, ultra)
14299
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
14705
paulson
parents: 14691
diff changeset
   230
lemma hyprel_iff: "((X,Y) \<in> hyprel) = ({n. X n = Y n} \<in> FreeUltrafilterNat)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   231
by (simp add: hyprel_def)
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"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   234
by (simp add: hyprel_def)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   235
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14361
diff changeset
   236
lemma hyprel_sym [rule_format (no_asm)]: "(x,y) \<in> hyprel --> (y,x) \<in> hyprel"
14301
paulson
parents: 14299
diff changeset
   237
by (simp add: hyprel_def eq_commute)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   238
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   239
lemma hyprel_trans: 
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14361
diff changeset
   240
      "[|(x,y) \<in> hyprel; (y,z) \<in> hyprel|] ==> (x,z) \<in> hyprel"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   241
by (simp add: hyprel_def, ultra)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   242
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   243
lemma equiv_hyprel: "equiv UNIV hyprel"
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   244
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
   245
apply (blast intro: hyprel_sym hyprel_trans) 
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   246
done
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   247
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   248
(* (hyprel `` {x} = hyprel `` {y}) = ((x,y) \<in> hyprel) *)
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   249
lemmas equiv_hyprel_iff =
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   250
    eq_equiv_class_iff [OF equiv_hyprel UNIV_I UNIV_I, simp] 
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   251
14301
paulson
parents: 14299
diff changeset
   252
lemma hyprel_in_hypreal [simp]: "hyprel``{x}:hypreal"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   253
by (simp add: hypreal_def hyprel_def quotient_def, blast)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   254
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   255
15413
901d1bfedf09 removal of archaic Abs/Rep proofs
paulson
parents: 15234
diff changeset
   256
declare Abs_hypreal_inject [simp] Abs_hypreal_inverse [simp]
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   257
declare equiv_hyprel [THEN eq_equiv_class_iff, simp]
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   258
declare hyprel_iff [iff]
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   259
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   260
lemmas eq_hyprelD = eq_equiv_class [OF _ equiv_hyprel]
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   261
14301
paulson
parents: 14299
diff changeset
   262
lemma lemma_hyprel_refl [simp]: "x \<in> hyprel `` {x}"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   263
by (simp add: hyprel_def)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   264
14301
paulson
parents: 14299
diff changeset
   265
lemma hypreal_empty_not_mem [simp]: "{} \<notin> hypreal"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   266
apply (simp add: hypreal_def)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   267
apply (auto elim!: quotientE equalityCE)
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   268
done
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   269
14301
paulson
parents: 14299
diff changeset
   270
lemma Rep_hypreal_nonempty [simp]: "Rep_hypreal x \<noteq> {}"
14705
paulson
parents: 14691
diff changeset
   271
by (insert Rep_hypreal [of x], auto)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   272
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   273
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   274
subsection{*@{term hypreal_of_real}: 
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   275
            the Injection from @{typ real} to @{typ hypreal}*}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   276
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   277
lemma inj_hypreal_of_real: "inj(hypreal_of_real)"
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   278
apply (rule inj_onI)
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   279
apply (simp add: hypreal_of_real_def split: split_if_asm)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   280
done
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   281
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   282
lemma eq_Abs_hypreal:
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   283
    "(!!x. z = Abs_hypreal(hyprel``{x}) ==> P) ==> P"
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   284
apply (rule_tac x1=z in Rep_hypreal [unfolded hypreal_def, THEN quotientE])
14301
paulson
parents: 14299
diff changeset
   285
apply (drule_tac f = Abs_hypreal in arg_cong)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   286
apply (force simp add: Rep_hypreal_inverse)
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   287
done
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   288
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   289
theorem hypreal_cases [case_names Abs_hypreal, cases type: hypreal]:
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   290
    "(!!x. z = Abs_hypreal(hyprel``{x}) ==> P) ==> P"
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   291
by (rule eq_Abs_hypreal [of z], blast)
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   292
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   293
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   294
subsection{*Hyperreal Addition*}
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   295
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   296
lemma hypreal_add_congruent2: 
14658
b1293d0f8d5f congruent2 now allows different equiv relations
paulson
parents: 14565
diff changeset
   297
    "congruent2 hyprel hyprel (%X Y. hyprel``{%n. X n + Y n})"
14705
paulson
parents: 14691
diff changeset
   298
by (simp add: congruent2_def, auto, ultra)
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   299
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   300
lemma hypreal_add: 
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   301
  "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
   302
   Abs_hypreal(hyprel``{%n. X n + Y n})"
14658
b1293d0f8d5f congruent2 now allows different equiv relations
paulson
parents: 14565
diff changeset
   303
by (simp add: hypreal_add_def 
b1293d0f8d5f congruent2 now allows different equiv relations
paulson
parents: 14565
diff changeset
   304
         UN_equiv_class2 [OF equiv_hyprel equiv_hyprel hypreal_add_congruent2])
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   305
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   306
lemma hypreal_add_commute: "(z::hypreal) + w = w + z"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   307
apply (cases z, cases w)
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14331
diff changeset
   308
apply (simp add: add_ac hypreal_add)
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   309
done
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
lemma hypreal_add_assoc: "((z1::hypreal) + z2) + z3 = z1 + (z2 + z3)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   312
apply (cases z1, cases z2, cases z3)
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   313
apply (simp add: hypreal_add real_add_assoc)
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   314
done
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   315
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   316
lemma hypreal_add_zero_left: "(0::hypreal) + z = z"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   317
by (cases z, simp add: hypreal_zero_def hypreal_add)
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   318
14738
83f1a514dcb4 changes made due to new Ring_and_Field theory
obua
parents: 14705
diff changeset
   319
instance hypreal :: comm_monoid_add
14691
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
   320
  by intro_classes
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
   321
    (assumption | 
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
   322
      rule hypreal_add_commute hypreal_add_assoc hypreal_add_zero_left)+
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   323
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   324
lemma hypreal_add_zero_right [simp]: "z + (0::hypreal) = z"
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   325
by (simp add: hypreal_add_zero_left hypreal_add_commute)
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   326
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   327
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   328
subsection{*Additive inverse on @{typ hypreal}*}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   329
15169
2b5da07a0b89 new "respects" syntax for quotienting
paulson
parents: 15140
diff changeset
   330
lemma hypreal_minus_congruent: "(%X. hyprel``{%n. - (X n)}) respects hyprel"
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   331
by (force simp add: congruent_def)
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   332
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   333
lemma hypreal_minus: 
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   334
   "- (Abs_hypreal(hyprel``{%n. X n})) = Abs_hypreal(hyprel `` {%n. -(X n)})"
15539
333a88244569 comprehensive cleanup, replacing sumr by setsum
nipkow
parents: 15413
diff changeset
   335
by (simp add: hypreal_minus_def hyprel_in_hypreal [THEN Abs_hypreal_inverse] 
14705
paulson
parents: 14691
diff changeset
   336
              UN_equiv_class [OF equiv_hyprel hypreal_minus_congruent])
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   337
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   338
lemma hypreal_diff:
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   339
     "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
   340
      Abs_hypreal(hyprel``{%n. X n - Y n})"
14705
paulson
parents: 14691
diff changeset
   341
by (simp add: hypreal_diff_def hypreal_minus hypreal_add)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   342
14301
paulson
parents: 14299
diff changeset
   343
lemma hypreal_add_minus [simp]: "z + -z = (0::hypreal)"
14705
paulson
parents: 14691
diff changeset
   344
by (cases z, simp add: hypreal_zero_def hypreal_minus hypreal_add)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   345
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   346
lemma hypreal_add_minus_left: "-z + z = (0::hypreal)"
15539
333a88244569 comprehensive cleanup, replacing sumr by setsum
nipkow
parents: 15413
diff changeset
   347
by (simp add: hypreal_add_commute)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   348
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   349
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   350
subsection{*Hyperreal Multiplication*}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   351
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   352
lemma hypreal_mult_congruent2: 
14658
b1293d0f8d5f congruent2 now allows different equiv relations
paulson
parents: 14565
diff changeset
   353
    "congruent2 hyprel hyprel (%X Y. hyprel``{%n. X n * Y n})"
b1293d0f8d5f congruent2 now allows different equiv relations
paulson
parents: 14565
diff changeset
   354
by (simp add: congruent2_def, auto, ultra)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   355
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   356
lemma hypreal_mult: 
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   357
  "Abs_hypreal(hyprel``{%n. X n}) * Abs_hypreal(hyprel``{%n. Y n}) =  
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   358
   Abs_hypreal(hyprel``{%n. X n * Y n})"
14658
b1293d0f8d5f congruent2 now allows different equiv relations
paulson
parents: 14565
diff changeset
   359
by (simp add: hypreal_mult_def
b1293d0f8d5f congruent2 now allows different equiv relations
paulson
parents: 14565
diff changeset
   360
        UN_equiv_class2 [OF equiv_hyprel equiv_hyprel hypreal_mult_congruent2])
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   361
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   362
lemma hypreal_mult_commute: "(z::hypreal) * w = w * z"
14705
paulson
parents: 14691
diff changeset
   363
by (cases z, cases w, simp add: hypreal_mult mult_ac)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   364
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   365
lemma hypreal_mult_assoc: "((z1::hypreal) * z2) * z3 = z1 * (z2 * z3)"
14705
paulson
parents: 14691
diff changeset
   366
by (cases z1, cases z2, cases z3, simp add: hypreal_mult mult_assoc)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   367
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   368
lemma hypreal_mult_1: "(1::hypreal) * z = z"
14705
paulson
parents: 14691
diff changeset
   369
by (cases z, simp add: hypreal_one_def hypreal_mult)
14301
paulson
parents: 14299
diff changeset
   370
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   371
lemma hypreal_add_mult_distrib:
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   372
     "((z1::hypreal) + z2) * w = (z1 * w) + (z2 * w)"
14705
paulson
parents: 14691
diff changeset
   373
by (cases z1, cases z2, cases w, simp add: hypreal_mult hypreal_add left_distrib)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   374
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   375
text{*one and zero are distinct*}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   376
lemma hypreal_zero_not_eq_one: "0 \<noteq> (1::hypreal)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   377
by (simp add: hypreal_zero_def hypreal_one_def)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   378
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   379
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   380
subsection{*Multiplicative Inverse on @{typ hypreal} *}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   381
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   382
lemma hypreal_inverse_congruent: 
15169
2b5da07a0b89 new "respects" syntax for quotienting
paulson
parents: 15140
diff changeset
   383
  "(%X. hyprel``{%n. if X n = 0 then 0 else inverse(X n)}) respects hyprel"
14705
paulson
parents: 14691
diff changeset
   384
by (auto simp add: congruent_def, ultra)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   385
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   386
lemma hypreal_inverse: 
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   387
      "inverse (Abs_hypreal(hyprel``{%n. X n})) =  
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   388
       Abs_hypreal(hyprel `` {%n. if X n = 0 then 0 else inverse(X n)})"
15539
333a88244569 comprehensive cleanup, replacing sumr by setsum
nipkow
parents: 15413
diff changeset
   389
by (simp add: hypreal_inverse_def hyprel_in_hypreal [THEN Abs_hypreal_inverse] 
14705
paulson
parents: 14691
diff changeset
   390
              UN_equiv_class [OF equiv_hyprel hypreal_inverse_congruent])
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   391
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   392
lemma hypreal_mult_inverse: 
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   393
     "x \<noteq> 0 ==> x*inverse(x) = (1::hypreal)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   394
apply (cases x)
14705
paulson
parents: 14691
diff changeset
   395
apply (simp add: hypreal_one_def hypreal_zero_def hypreal_inverse hypreal_mult)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   396
apply (drule FreeUltrafilterNat_Compl_mem)
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14331
diff changeset
   397
apply (blast intro!: right_inverse FreeUltrafilterNat_subset)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   398
done
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   399
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   400
lemma hypreal_mult_inverse_left:
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   401
     "x \<noteq> 0 ==> inverse(x)*x = (1::hypreal)"
14301
paulson
parents: 14299
diff changeset
   402
by (simp add: hypreal_mult_inverse hypreal_mult_commute)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   403
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   404
instance hypreal :: field
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   405
proof
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   406
  fix x y z :: hypreal
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   407
  show "- x + x = 0" by (simp add: hypreal_add_minus_left)
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   408
  show "x - y = x + (-y)" by (simp add: hypreal_diff_def)
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   409
  show "(x * y) * z = x * (y * z)" by (rule hypreal_mult_assoc)
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   410
  show "x * y = y * x" by (rule hypreal_mult_commute)
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   411
  show "1 * x = x" by (simp add: hypreal_mult_1)
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   412
  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
   413
  show "0 \<noteq> (1::hypreal)" by (rule hypreal_zero_not_eq_one)
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   414
  show "x \<noteq> 0 ==> inverse x * x = 1" by (simp add: hypreal_mult_inverse_left)
14430
5cb24165a2e1 new material from Avigad, and simplified treatment of division by 0
paulson
parents: 14421
diff changeset
   415
  show "x / y = x * inverse y" by (simp add: hypreal_divide_def)
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   416
qed
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   417
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   418
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   419
instance hypreal :: division_by_zero
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   420
proof
14430
5cb24165a2e1 new material from Avigad, and simplified treatment of division by 0
paulson
parents: 14421
diff changeset
   421
  show "inverse 0 = (0::hypreal)" 
14421
ee97b6463cb4 new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents: 14387
diff changeset
   422
    by (simp add: hypreal_inverse hypreal_zero_def)
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   423
qed
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   424
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   425
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   426
subsection{*Properties of The @{text "\<le>"} Relation*}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   427
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   428
lemma hypreal_le: 
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14361
diff changeset
   429
      "(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
   430
       ({n. X n \<le> Y n} \<in> FreeUltrafilterNat)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   431
apply (simp add: hypreal_le_def)
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   432
apply (auto intro!: lemma_hyprel_refl, ultra)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   433
done
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   434
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14361
diff changeset
   435
lemma hypreal_le_refl: "w \<le> (w::hypreal)"
14705
paulson
parents: 14691
diff changeset
   436
by (cases w, simp add: hypreal_le)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   437
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14361
diff changeset
   438
lemma hypreal_le_trans: "[| i \<le> j; j \<le> k |] ==> i \<le> (k::hypreal)"
14705
paulson
parents: 14691
diff changeset
   439
by (cases i, cases j, cases k, simp add: hypreal_le, ultra)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   440
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14361
diff changeset
   441
lemma hypreal_le_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::hypreal)"
14705
paulson
parents: 14691
diff changeset
   442
by (cases z, cases w, simp add: hypreal_le, ultra)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   443
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   444
(* Axiom 'order_less_le' of class 'order': *)
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14361
diff changeset
   445
lemma hypreal_less_le: "((w::hypreal) < z) = (w \<le> z & w \<noteq> z)"
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   446
by (simp add: hypreal_less_def)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   447
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   448
instance hypreal :: order
14691
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
   449
  by intro_classes
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
   450
    (assumption |
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
   451
      rule hypreal_le_refl hypreal_le_trans hypreal_le_anti_sym hypreal_less_le)+
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   452
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   453
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   454
(* Axiom 'linorder_linear' of class 'linorder': *)
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   455
lemma hypreal_le_linear: "(z::hypreal) \<le> w | w \<le> z"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   456
apply (cases z, cases w)
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   457
apply (auto simp add: hypreal_le, ultra)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   458
done
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   459
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   460
instance hypreal :: linorder 
14691
e1eedc8cad37 tuned instance statements;
wenzelm
parents: 14658
diff changeset
   461
  by intro_classes (rule hypreal_le_linear)
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   462
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   463
lemma hypreal_not_refl2: "!!(x::hypreal). x < y ==> x \<noteq> y"
15539
333a88244569 comprehensive cleanup, replacing sumr by setsum
nipkow
parents: 15413
diff changeset
   464
by (auto)
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   465
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   466
lemma hypreal_add_left_mono: "x \<le> y ==> z + x \<le> z + (y::hypreal)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   467
apply (cases x, cases y, cases z)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   468
apply (auto simp add: hypreal_le hypreal_add) 
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   469
done
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   470
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   471
lemma hypreal_mult_less_mono2: "[| (0::hypreal)<z; x<y |] ==> z*x<z*y"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   472
apply (cases x, cases y, cases z)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   473
apply (auto simp add: hypreal_zero_def hypreal_le hypreal_mult 
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   474
                      linorder_not_le [symmetric], ultra) 
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   475
done
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   476
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   477
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   478
subsection{*The Hyperreals Form an Ordered Field*}
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   479
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   480
instance hypreal :: ordered_field
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   481
proof
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   482
  fix x y z :: hypreal
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 14341
diff changeset
   483
  show "x \<le> y ==> z + x \<le> z + y" 
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   484
    by (rule hypreal_add_left_mono)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 14341
diff changeset
   485
  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
   486
    by (simp add: hypreal_mult_less_mono2)
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   487
  show "\<bar>x\<bar> = (if x < 0 then -x else x)"
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   488
    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
   489
qed
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   490
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   491
lemma hypreal_eq_minus_iff: "((x::hypreal) = y) = (x + - y = 0)"
15234
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15229
diff changeset
   492
by auto
14331
8dbbb7cf3637 re-organized numeric lemmas
paulson
parents: 14329
diff changeset
   493
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   494
lemma hypreal_mult_left_cancel: "(c::hypreal) \<noteq> 0 ==> (c*a=c*b) = (a=b)"
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   495
by auto
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
lemma hypreal_mult_right_cancel: "(c::hypreal) \<noteq> 0 ==> (a*c=b*c) = (a=b)"
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   498
by auto
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   499
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   500
14371
c78c7da09519 Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents: 14370
diff changeset
   501
subsection{*The Embedding @{term hypreal_of_real} Preserves Field and 
c78c7da09519 Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents: 14370
diff changeset
   502
      Order Properties*}
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   503
14301
paulson
parents: 14299
diff changeset
   504
lemma hypreal_of_real_add [simp]: 
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   505
     "hypreal_of_real (w + z) = hypreal_of_real w + hypreal_of_real z"
14705
paulson
parents: 14691
diff changeset
   506
by (simp add: hypreal_of_real_def, simp add: hypreal_add left_distrib)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   507
15013
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   508
lemma hypreal_of_real_minus [simp]:
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   509
     "hypreal_of_real (-r) = - hypreal_of_real  r"
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   510
by (auto simp add: hypreal_of_real_def hypreal_minus)
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   511
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   512
lemma hypreal_of_real_diff [simp]: 
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   513
     "hypreal_of_real (w - z) = hypreal_of_real w - hypreal_of_real z"
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   514
by (simp add: diff_minus) 
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   515
14301
paulson
parents: 14299
diff changeset
   516
lemma hypreal_of_real_mult [simp]: 
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   517
     "hypreal_of_real (w * z) = hypreal_of_real w * hypreal_of_real z"
14705
paulson
parents: 14691
diff changeset
   518
by (simp add: hypreal_of_real_def, simp add: hypreal_mult right_distrib)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   519
14301
paulson
parents: 14299
diff changeset
   520
lemma hypreal_of_real_one [simp]: "hypreal_of_real 1 = (1::hypreal)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   521
by (simp add: hypreal_of_real_def hypreal_one_def)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   522
14301
paulson
parents: 14299
diff changeset
   523
lemma hypreal_of_real_zero [simp]: "hypreal_of_real 0 = 0"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   524
by (simp add: hypreal_of_real_def hypreal_zero_def)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   525
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   526
lemma hypreal_of_real_le_iff [simp]: 
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   527
     "(hypreal_of_real w \<le> hypreal_of_real z) = (w \<le> z)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   528
apply (simp add: hypreal_le_def hypreal_of_real_def, auto)
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   529
apply (rule_tac [2] x = "%n. w" in exI, safe)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   530
apply (rule_tac [3] x = "%n. z" in exI, auto)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   531
apply (rule FreeUltrafilterNat_P, ultra)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   532
done
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   533
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   534
lemma hypreal_of_real_less_iff [simp]: 
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   535
     "(hypreal_of_real w < hypreal_of_real z) = (w < z)"
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   536
by (simp add: linorder_not_le [symmetric]) 
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   537
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   538
lemma hypreal_of_real_eq_iff [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   539
     "(hypreal_of_real w = hypreal_of_real z) = (w = z)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   540
by (force intro: order_antisym hypreal_of_real_le_iff [THEN iffD1])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   541
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   542
text{*As above, for 0*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   543
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   544
declare hypreal_of_real_less_iff [of 0, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   545
declare hypreal_of_real_le_iff   [of 0, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   546
declare hypreal_of_real_eq_iff   [of 0, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   547
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   548
declare hypreal_of_real_less_iff [of _ 0, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   549
declare hypreal_of_real_le_iff   [of _ 0, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   550
declare hypreal_of_real_eq_iff   [of _ 0, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   551
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   552
text{*As above, for 1*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   553
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   554
declare hypreal_of_real_less_iff [of 1, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   555
declare hypreal_of_real_le_iff   [of 1, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   556
declare hypreal_of_real_eq_iff   [of 1, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   557
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   558
declare hypreal_of_real_less_iff [of _ 1, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   559
declare hypreal_of_real_le_iff   [of _ 1, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   560
declare hypreal_of_real_eq_iff   [of _ 1, simplified, simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   561
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   562
lemma hypreal_of_real_inverse [simp]:
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   563
     "hypreal_of_real (inverse r) = inverse (hypreal_of_real r)"
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   564
apply (case_tac "r=0", simp)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   565
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
   566
apply (auto simp add: hypreal_of_real_mult [symmetric])
14299
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
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   569
lemma hypreal_of_real_divide [simp]:
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14365
diff changeset
   570
     "hypreal_of_real (w / z) = hypreal_of_real w / hypreal_of_real z"
14301
paulson
parents: 14299
diff changeset
   571
by (simp add: hypreal_divide_def real_divide_def)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   572
15013
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   573
lemma hypreal_of_real_of_nat [simp]: "hypreal_of_real (of_nat n) = of_nat n"
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   574
by (induct n, simp_all) 
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   575
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   576
lemma hypreal_of_real_of_int [simp]:  "hypreal_of_real (of_int z) = of_int z"
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   577
proof (cases z)
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   578
  case (1 n)
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   579
    thus ?thesis  by simp
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   580
next
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   581
  case (2 n)
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   582
    thus ?thesis
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   583
      by (simp only: of_int_minus hypreal_of_real_minus, simp)
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   584
qed
34264f5e4691 new treatment of binary numerals
paulson
parents: 14738
diff changeset
   585
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   586
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   587
subsection{*Misc Others*}
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   588
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   589
lemma hypreal_less: 
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   590
      "(Abs_hypreal(hyprel``{%n. X n}) < Abs_hypreal(hyprel``{%n. Y n})) =  
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   591
       ({n. X n < Y n} \<in> FreeUltrafilterNat)"
14705
paulson
parents: 14691
diff changeset
   592
by (auto simp add: hypreal_le linorder_not_le [symmetric], ultra+)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   593
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   594
lemma hypreal_zero_num: "0 = Abs_hypreal (hyprel `` {%n. 0})"
14301
paulson
parents: 14299
diff changeset
   595
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
   596
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   597
lemma hypreal_one_num: "1 = Abs_hypreal (hyprel `` {%n. 1})"
14301
paulson
parents: 14299
diff changeset
   598
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
   599
14301
paulson
parents: 14299
diff changeset
   600
lemma hypreal_omega_gt_zero [simp]: "0 < omega"
14705
paulson
parents: 14691
diff changeset
   601
by (auto simp add: omega_def hypreal_less hypreal_zero_num)
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   602
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   603
lemma hypreal_hrabs:
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   604
     "abs (Abs_hypreal (hyprel `` {X})) = 
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   605
      Abs_hypreal(hyprel `` {%n. abs (X n)})"
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   606
apply (auto simp add: hrabs_def hypreal_zero_def hypreal_le hypreal_minus)
15229
1eb23f805c06 new simprules for abs and for things like a/b<1
paulson
parents: 15169
diff changeset
   607
apply ultra
1eb23f805c06 new simprules for abs and for things like a/b<1
paulson
parents: 15169
diff changeset
   608
apply ultra
1eb23f805c06 new simprules for abs and for things like a/b<1
paulson
parents: 15169
diff changeset
   609
apply arith
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   610
done
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   611
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   612
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   613
subsection{*Existence of Infinite Hyperreal Number*}
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   614
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   615
lemma Rep_hypreal_omega: "Rep_hypreal(omega) \<in> hypreal"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   616
by (simp add: omega_def)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   617
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   618
text{*Existence of infinite number not corresponding to any real number.
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   619
Use assumption that member @{term FreeUltrafilterNat} is not finite.*}
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   620
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   621
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   622
text{*A few lemmas first*}
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   623
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   624
lemma lemma_omega_empty_singleton_disj: "{n::nat. x = real n} = {} |  
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   625
      (\<exists>y. {n::nat. x = real n} = {y})"
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   626
by force
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   627
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   628
lemma lemma_finite_omega_set: "finite {n::nat. x = real n}"
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   629
by (cut_tac x = x in lemma_omega_empty_singleton_disj, auto)
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   630
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   631
lemma not_ex_hypreal_of_real_eq_omega: 
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   632
      "~ (\<exists>x. hypreal_of_real x = omega)"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   633
apply (simp add: omega_def hypreal_of_real_def)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   634
apply (auto simp add: real_of_nat_Suc diff_eq_eq [symmetric] 
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   635
            lemma_finite_omega_set [THEN FreeUltrafilterNat_finite])
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   636
done
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   637
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   638
lemma hypreal_of_real_not_eq_omega: "hypreal_of_real x \<noteq> omega"
14705
paulson
parents: 14691
diff changeset
   639
by (insert not_ex_hypreal_of_real_eq_omega, auto)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   640
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   641
text{*Existence of infinitesimal number also not corresponding to any
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   642
 real number*}
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   643
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   644
lemma lemma_epsilon_empty_singleton_disj:
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   645
     "{n::nat. x = inverse(real(Suc n))} = {} |  
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   646
      (\<exists>y. {n::nat. x = inverse(real(Suc n))} = {y})"
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   647
by auto
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   648
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   649
lemma lemma_finite_epsilon_set: "finite {n. x = inverse(real(Suc n))}"
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   650
by (cut_tac x = x in lemma_epsilon_empty_singleton_disj, auto)
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   651
14705
paulson
parents: 14691
diff changeset
   652
lemma not_ex_hypreal_of_real_eq_epsilon: "~ (\<exists>x. hypreal_of_real x = epsilon)"
paulson
parents: 14691
diff changeset
   653
by (auto simp add: epsilon_def hypreal_of_real_def 
paulson
parents: 14691
diff changeset
   654
                   lemma_finite_epsilon_set [THEN FreeUltrafilterNat_finite])
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   655
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   656
lemma hypreal_of_real_not_eq_epsilon: "hypreal_of_real x \<noteq> epsilon"
14705
paulson
parents: 14691
diff changeset
   657
by (insert not_ex_hypreal_of_real_eq_epsilon, auto)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   658
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   659
lemma hypreal_epsilon_not_zero: "epsilon \<noteq> 0"
14468
6be497cacab5 heavy tidying
paulson
parents: 14430
diff changeset
   660
by (simp add: epsilon_def hypreal_zero_def)
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   661
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   662
lemma hypreal_epsilon_inverse_omega: "epsilon = inverse(omega)"
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   663
by (simp add: hypreal_inverse omega_def epsilon_def)
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   664
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   665
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   666
ML
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   667
{*
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   668
val hrabs_def = thm "hrabs_def";
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   669
val hypreal_hrabs = thm "hypreal_hrabs";
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   670
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   671
val hypreal_zero_def = thm "hypreal_zero_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   672
val hypreal_one_def = thm "hypreal_one_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   673
val hypreal_minus_def = thm "hypreal_minus_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   674
val hypreal_diff_def = thm "hypreal_diff_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   675
val hypreal_inverse_def = thm "hypreal_inverse_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   676
val hypreal_divide_def = thm "hypreal_divide_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   677
val hypreal_of_real_def = thm "hypreal_of_real_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   678
val omega_def = thm "omega_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   679
val epsilon_def = thm "epsilon_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   680
val hypreal_add_def = thm "hypreal_add_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   681
val hypreal_mult_def = thm "hypreal_mult_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   682
val hypreal_less_def = thm "hypreal_less_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   683
val hypreal_le_def = thm "hypreal_le_def";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   684
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   685
val finite_exhausts = thm "finite_exhausts";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   686
val finite_not_covers = thm "finite_not_covers";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   687
val not_finite_nat = thm "not_finite_nat";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   688
val FreeUltrafilterNat_Ex = thm "FreeUltrafilterNat_Ex";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   689
val FreeUltrafilterNat_mem = thm "FreeUltrafilterNat_mem";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   690
val FreeUltrafilterNat_finite = thm "FreeUltrafilterNat_finite";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   691
val FreeUltrafilterNat_not_finite = thm "FreeUltrafilterNat_not_finite";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   692
val FreeUltrafilterNat_empty = thm "FreeUltrafilterNat_empty";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   693
val FreeUltrafilterNat_Int = thm "FreeUltrafilterNat_Int";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   694
val FreeUltrafilterNat_subset = thm "FreeUltrafilterNat_subset";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   695
val FreeUltrafilterNat_Compl = thm "FreeUltrafilterNat_Compl";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   696
val FreeUltrafilterNat_Compl_mem = thm "FreeUltrafilterNat_Compl_mem";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   697
val FreeUltrafilterNat_Compl_iff1 = thm "FreeUltrafilterNat_Compl_iff1";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   698
val FreeUltrafilterNat_Compl_iff2 = thm "FreeUltrafilterNat_Compl_iff2";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   699
val FreeUltrafilterNat_UNIV = thm "FreeUltrafilterNat_UNIV";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   700
val FreeUltrafilterNat_Nat_set_refl = thm "FreeUltrafilterNat_Nat_set_refl";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   701
val FreeUltrafilterNat_P = thm "FreeUltrafilterNat_P";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   702
val FreeUltrafilterNat_Ex_P = thm "FreeUltrafilterNat_Ex_P";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   703
val FreeUltrafilterNat_all = thm "FreeUltrafilterNat_all";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   704
val FreeUltrafilterNat_Un = thm "FreeUltrafilterNat_Un";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   705
val hyprel_iff = thm "hyprel_iff";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   706
val hyprel_in_hypreal = thm "hyprel_in_hypreal";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   707
val Abs_hypreal_inverse = thm "Abs_hypreal_inverse";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   708
val lemma_hyprel_refl = thm "lemma_hyprel_refl";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   709
val hypreal_empty_not_mem = thm "hypreal_empty_not_mem";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   710
val Rep_hypreal_nonempty = thm "Rep_hypreal_nonempty";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   711
val inj_hypreal_of_real = thm "inj_hypreal_of_real";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   712
val eq_Abs_hypreal = thm "eq_Abs_hypreal";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   713
val hypreal_minus_congruent = thm "hypreal_minus_congruent";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   714
val hypreal_minus = thm "hypreal_minus";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   715
val hypreal_add = thm "hypreal_add";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   716
val hypreal_diff = thm "hypreal_diff";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   717
val hypreal_add_commute = thm "hypreal_add_commute";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   718
val hypreal_add_assoc = thm "hypreal_add_assoc";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   719
val hypreal_add_zero_left = thm "hypreal_add_zero_left";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   720
val hypreal_add_zero_right = thm "hypreal_add_zero_right";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   721
val hypreal_add_minus = thm "hypreal_add_minus";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   722
val hypreal_add_minus_left = thm "hypreal_add_minus_left";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   723
val hypreal_mult = thm "hypreal_mult";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   724
val hypreal_mult_commute = thm "hypreal_mult_commute";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   725
val hypreal_mult_assoc = thm "hypreal_mult_assoc";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   726
val hypreal_mult_1 = thm "hypreal_mult_1";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   727
val hypreal_zero_not_eq_one = thm "hypreal_zero_not_eq_one";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   728
val hypreal_inverse_congruent = thm "hypreal_inverse_congruent";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   729
val hypreal_inverse = thm "hypreal_inverse";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   730
val hypreal_mult_inverse = thm "hypreal_mult_inverse";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   731
val hypreal_mult_inverse_left = thm "hypreal_mult_inverse_left";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   732
val hypreal_mult_left_cancel = thm "hypreal_mult_left_cancel";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   733
val hypreal_mult_right_cancel = thm "hypreal_mult_right_cancel";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   734
val hypreal_not_refl2 = thm "hypreal_not_refl2";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   735
val hypreal_less = thm "hypreal_less";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   736
val hypreal_eq_minus_iff = thm "hypreal_eq_minus_iff";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   737
val hypreal_le = thm "hypreal_le";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   738
val hypreal_le_refl = thm "hypreal_le_refl";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   739
val hypreal_le_linear = thm "hypreal_le_linear";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   740
val hypreal_le_trans = thm "hypreal_le_trans";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   741
val hypreal_le_anti_sym = thm "hypreal_le_anti_sym";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   742
val hypreal_less_le = thm "hypreal_less_le";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   743
val hypreal_of_real_add = thm "hypreal_of_real_add";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   744
val hypreal_of_real_mult = thm "hypreal_of_real_mult";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   745
val hypreal_of_real_less_iff = thm "hypreal_of_real_less_iff";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   746
val hypreal_of_real_le_iff = thm "hypreal_of_real_le_iff";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   747
val hypreal_of_real_eq_iff = thm "hypreal_of_real_eq_iff";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   748
val hypreal_of_real_minus = thm "hypreal_of_real_minus";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   749
val hypreal_of_real_one = thm "hypreal_of_real_one";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   750
val hypreal_of_real_zero = thm "hypreal_of_real_zero";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   751
val hypreal_of_real_inverse = thm "hypreal_of_real_inverse";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   752
val hypreal_of_real_divide = thm "hypreal_of_real_divide";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   753
val hypreal_zero_num = thm "hypreal_zero_num";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   754
val hypreal_one_num = thm "hypreal_one_num";
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   755
val hypreal_omega_gt_zero = thm "hypreal_omega_gt_zero";
14370
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   756
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   757
val Rep_hypreal_omega = thm"Rep_hypreal_omega";
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   758
val lemma_omega_empty_singleton_disj = thm"lemma_omega_empty_singleton_disj";
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   759
val lemma_finite_omega_set = thm"lemma_finite_omega_set";
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   760
val not_ex_hypreal_of_real_eq_omega = thm"not_ex_hypreal_of_real_eq_omega";
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   761
val hypreal_of_real_not_eq_omega = thm"hypreal_of_real_not_eq_omega";
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   762
val not_ex_hypreal_of_real_eq_epsilon = thm"not_ex_hypreal_of_real_eq_epsilon";
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   763
val hypreal_of_real_not_eq_epsilon = thm"hypreal_of_real_not_eq_epsilon";
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   764
val hypreal_epsilon_not_zero = thm"hypreal_epsilon_not_zero";
b0064703967b simplifications in the hyperreals
paulson
parents: 14369
diff changeset
   765
val hypreal_epsilon_inverse_omega = thm"hypreal_epsilon_inverse_omega";
14299
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   766
*}
0b5c0b0a3eba converted Hyperreal/HyperDef to Isar script
paulson
parents: 13487
diff changeset
   767
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   768
end