src/HOL/Hyperreal/HyperArith.thy
author paulson
Wed, 28 Jan 2004 17:01:01 +0100
changeset 14369 c50188fe6366
parent 14352 a8b1a44d8264
child 14370 b0064703967b
permissions -rw-r--r--
tidying up arithmetic for the hyperreals
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     1
(*  Title:      HOL/HyperBin.thy
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     2
    ID:         $Id$
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     4
    Copyright   1999  University of Cambridge
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     5
*)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     6
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     7
header{*Binary arithmetic and Simplification for the Hyperreals*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     8
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
     9
theory HyperArith = HyperOrd
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    10
files ("hypreal_arith.ML"):
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    11
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    12
subsection{*Binary Arithmetic for the Hyperreals*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    13
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    14
instance hypreal :: number ..
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    15
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    16
defs (overloaded)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    17
  hypreal_number_of_def:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    18
    "number_of v == hypreal_of_real (number_of v)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    19
     (*::bin=>hypreal               ::bin=>real*)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    20
     --{*This case is reduced to that for the reals.*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    21
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    22
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    23
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    24
subsubsection{*Embedding the Reals into the Hyperreals*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    25
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    26
lemma hypreal_number_of [simp]: "hypreal_of_real (number_of w) = number_of w"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    27
by (simp add: hypreal_number_of_def)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    28
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    29
lemma hypreal_numeral_0_eq_0: "Numeral0 = (0::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    30
by (simp add: hypreal_number_of_def)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    31
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    32
lemma hypreal_numeral_1_eq_1: "Numeral1 = (1::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    33
by (simp add: hypreal_number_of_def)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    34
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    35
subsubsection{*Addition*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    36
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    37
lemma add_hypreal_number_of [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    38
     "(number_of v :: hypreal) + number_of v' = number_of (bin_add v v')"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    39
by (simp only: hypreal_number_of_def hypreal_of_real_add [symmetric]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    40
               add_real_number_of)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    41
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    42
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    43
subsubsection{*Subtraction*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    44
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    45
lemma minus_hypreal_number_of [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    46
     "- (number_of w :: hypreal) = number_of (bin_minus w)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    47
by (simp only: hypreal_number_of_def minus_real_number_of
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    48
               hypreal_of_real_minus [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    49
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    50
lemma diff_hypreal_number_of [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    51
     "(number_of v :: hypreal) - number_of w =
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    52
      number_of (bin_add v (bin_minus w))"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    53
by (unfold hypreal_number_of_def hypreal_diff_def, simp)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    54
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    55
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    56
subsubsection{*Multiplication*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    57
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    58
lemma mult_hypreal_number_of [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    59
     "(number_of v :: hypreal) * number_of v' = number_of (bin_mult v v')"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    60
by (simp only: hypreal_number_of_def hypreal_of_real_mult [symmetric] mult_real_number_of)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    61
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    62
text{*Lemmas for specialist use, NOT as default simprules*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    63
lemma hypreal_mult_2: "2 * z = (z+z::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    64
proof -
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    65
  have eq: "(2::hypreal) = 1 + 1"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    66
    by (simp add: hypreal_numeral_1_eq_1 [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    67
  thus ?thesis by (simp add: eq left_distrib)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    68
qed
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    69
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    70
lemma hypreal_mult_2_right: "z * 2 = (z+z::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    71
by (subst hypreal_mult_commute, rule hypreal_mult_2)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    72
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    73
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    74
subsubsection{*Comparisons*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    75
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    76
(** Equals (=) **)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    77
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    78
lemma eq_hypreal_number_of [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    79
     "((number_of v :: hypreal) = number_of v') =
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    80
      iszero (number_of (bin_add v (bin_minus v')))"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    81
apply (simp only: hypreal_number_of_def hypreal_of_real_eq_iff eq_real_number_of)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    82
done
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    83
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    84
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    85
(** Less-than (<) **)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    86
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    87
(*"neg" is used in rewrite rules for binary comparisons*)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    88
lemma less_hypreal_number_of [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    89
     "((number_of v :: hypreal) < number_of v') =
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    90
      neg (number_of (bin_add v (bin_minus v')))"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    91
by (simp only: hypreal_number_of_def hypreal_of_real_less_iff less_real_number_of)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    92
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    93
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    94
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    95
text{*New versions of existing theorems involving 0, 1*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    96
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    97
lemma hypreal_minus_1_eq_m1 [simp]: "- 1 = (-1::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    98
by (simp add: hypreal_numeral_1_eq_1 [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
    99
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   100
lemma hypreal_mult_minus1 [simp]: "-1 * z = -(z::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   101
proof -
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   102
  have  "-1 * z = (- 1) * z" by (simp add: hypreal_minus_1_eq_m1)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   103
  also have "... = - (1 * z)" by (simp only: minus_mult_left)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   104
  also have "... = -z" by simp
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   105
  finally show ?thesis .
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   106
qed
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   107
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   108
lemma hypreal_mult_minus1_right [simp]: "(z::hypreal) * -1 = -z"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   109
by (subst hypreal_mult_commute, rule hypreal_mult_minus1)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   110
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   111
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   112
subsection{*Simplification of Arithmetic when Nested to the Right*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   113
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   114
lemma hypreal_add_number_of_left [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   115
     "number_of v + (number_of w + z) = (number_of(bin_add v w) + z::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   116
by (simp add: add_assoc [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   117
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   118
lemma hypreal_mult_number_of_left [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   119
     "number_of v *(number_of w * z) = (number_of(bin_mult v w) * z::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   120
by (simp add: hypreal_mult_assoc [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   121
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   122
lemma hypreal_add_number_of_diff1:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   123
    "number_of v + (number_of w - c) = number_of(bin_add v w) - (c::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   124
by (simp add: hypreal_diff_def hypreal_add_number_of_left)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   125
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   126
lemma hypreal_add_number_of_diff2 [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   127
     "number_of v + (c - number_of w) =
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   128
      number_of (bin_add v (bin_minus w)) + (c::hypreal)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   129
apply (subst diff_hypreal_number_of [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   130
apply (simp only: hypreal_diff_def add_ac)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   131
done
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   132
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   133
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   134
declare hypreal_numeral_0_eq_0 [simp] hypreal_numeral_1_eq_1 [simp]
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   135
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   136
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   137
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   138
use "hypreal_arith.ML"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   139
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   140
setup hypreal_arith_setup
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   141
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14309
diff changeset
   142
text{*Used once in NSA*}
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14309
diff changeset
   143
lemma hypreal_add_minus_eq_minus: "x + y = (0::hypreal) ==> x = -y"
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   144
by arith
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14309
diff changeset
   145
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14309
diff changeset
   146
14309
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   147
subsubsection{*Division By @{term 1} and @{term "-1"}*}
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   148
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   149
lemma hypreal_divide_minus1 [simp]: "x/-1 = -(x::hypreal)"
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   150
by simp
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   151
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   152
lemma hypreal_minus1_divide [simp]: "-1/(x::hypreal) = - (1/x)"
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   153
by (simp add: hypreal_divide_def hypreal_minus_inverse)
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   154
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   155
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   156
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   157
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   158
(** number_of related to hypreal_of_real.
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   159
Could similar theorems be useful for other injections? **)
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   160
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   161
lemma number_of_less_hypreal_of_real_iff [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   162
     "(number_of w < hypreal_of_real z) = (number_of w < z)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   163
apply (subst hypreal_of_real_less_iff [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   164
apply (simp (no_asm))
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   165
done
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   166
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   167
lemma number_of_le_hypreal_of_real_iff [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   168
     "(number_of w <= hypreal_of_real z) = (number_of w <= z)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   169
apply (subst hypreal_of_real_le_iff [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   170
apply (simp (no_asm))
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   171
done
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   172
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   173
lemma hypreal_of_real_eq_number_of_iff [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   174
     "(hypreal_of_real z = number_of w) = (z = number_of w)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   175
apply (subst hypreal_of_real_eq_iff [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   176
apply (simp (no_asm))
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   177
done
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   178
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   179
lemma hypreal_of_real_less_number_of_iff [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   180
     "(hypreal_of_real z < number_of w) = (z < number_of w)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   181
apply (subst hypreal_of_real_less_iff [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   182
apply (simp (no_asm))
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   183
done
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   184
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   185
lemma hypreal_of_real_le_number_of_iff [simp]:
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   186
     "(hypreal_of_real z <= number_of w) = (z <= number_of w)"
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   187
apply (subst hypreal_of_real_le_iff [symmetric])
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   188
apply (simp (no_asm))
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   189
done
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   190
14309
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   191
(*
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   192
FIXME: we should have this, as for type int, but many proofs would break.
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   193
It replaces x+-y by x-y.
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   194
Addsimps [symmetric hypreal_diff_def]
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   195
*)
f508492af9b4 moving HyperArith0.ML to other theories
paulson
parents: 10751
diff changeset
   196
14369
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   197
ML
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   198
{*
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   199
val hypreal_add_minus_eq_minus = thm "hypreal_add_minus_eq_minus";
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   200
*}
c50188fe6366 tidying up arithmetic for the hyperreals
paulson
parents: 14352
diff changeset
   201
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   202
end