src/HOL/Real/RealDef.thy
author paulson
Thu Jan 01 10:06:32 2004 +0100 (2004-01-01)
changeset 14334 6137d24eef79
parent 14329 ff3210fe968f
child 14335 9c0b5e081037
permissions -rw-r--r--
tweaking of lemmas in RealDef, RealOrd
paulson@5588
     1
(*  Title       : Real/RealDef.thy
paulson@7219
     2
    ID          : $Id$
paulson@5588
     3
    Author      : Jacques D. Fleuriot
paulson@5588
     4
    Copyright   : 1998  University of Cambridge
paulson@5588
     5
    Description : The reals
paulson@14269
     6
*)
paulson@14269
     7
paulson@14269
     8
theory RealDef = PReal:
paulson@5588
     9
paulson@14270
    10
(*MOVE TO THEORY PREAL*)
paulson@14269
    11
instance preal :: order
paulson@14269
    12
proof qed
paulson@14269
    13
 (assumption |
paulson@14269
    14
  rule preal_le_refl preal_le_trans preal_le_anti_sym preal_less_le)+
paulson@10752
    15
paulson@14270
    16
instance preal :: order
paulson@14270
    17
  by (intro_classes,
paulson@14270
    18
      (assumption | 
paulson@14270
    19
       rule preal_le_refl preal_le_trans preal_le_anti_sym preal_less_le)+)
paulson@14270
    20
paulson@14270
    21
lemma preal_le_linear: "x <= y | y <= (x::preal)"
paulson@14270
    22
apply (insert preal_linear [of x y]) 
paulson@14270
    23
apply (auto simp add: order_less_le) 
paulson@14270
    24
done
paulson@14270
    25
paulson@14270
    26
instance preal :: linorder
paulson@14270
    27
  by (intro_classes, rule preal_le_linear)
paulson@14270
    28
paulson@14270
    29
paulson@5588
    30
constdefs
paulson@5588
    31
  realrel   ::  "((preal * preal) * (preal * preal)) set"
paulson@14269
    32
  "realrel == {p. \<exists>x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}"
paulson@14269
    33
paulson@14269
    34
typedef (REAL)  real = "UNIV//realrel"
paulson@14269
    35
  by (auto simp add: quotient_def)
paulson@5588
    36
paulson@14269
    37
instance real :: ord ..
paulson@14269
    38
instance real :: zero ..
paulson@14269
    39
instance real :: one ..
paulson@14269
    40
instance real :: plus ..
paulson@14269
    41
instance real :: times ..
paulson@14269
    42
instance real :: minus ..
paulson@14269
    43
instance real :: inverse ..
paulson@14269
    44
paulson@14269
    45
consts
paulson@14269
    46
   (*Overloaded constants denoting the Nat and Real subsets of enclosing
paulson@14269
    47
     types such as hypreal and complex*)
paulson@14269
    48
   Nats  :: "'a set"
paulson@14269
    49
   Reals :: "'a set"
paulson@14269
    50
paulson@14269
    51
   (*overloaded constant for injecting other types into "real"*)
paulson@14269
    52
   real :: "'a => real"
paulson@5588
    53
paulson@5588
    54
paulson@14269
    55
defs (overloaded)
paulson@5588
    56
paulson@14269
    57
  real_zero_def:
paulson@12018
    58
  "0 == Abs_REAL(realrel``{(preal_of_prat(prat_of_pnat 1),
paulson@12018
    59
			    preal_of_prat(prat_of_pnat 1))})"
paulson@12018
    60
paulson@14269
    61
  real_one_def:
paulson@12018
    62
  "1 == Abs_REAL(realrel``
paulson@12018
    63
               {(preal_of_prat(prat_of_pnat 1) + preal_of_prat(prat_of_pnat 1),
paulson@12018
    64
		 preal_of_prat(prat_of_pnat 1))})"
paulson@5588
    65
paulson@14269
    66
  real_minus_def:
paulson@10919
    67
  "- R ==  Abs_REAL(UN (x,y):Rep_REAL(R). realrel``{(y,x)})"
bauerg@10606
    68
paulson@14269
    69
  real_diff_def:
bauerg@10606
    70
  "R - (S::real) == R + - S"
paulson@5588
    71
paulson@14269
    72
  real_inverse_def:
wenzelm@11713
    73
  "inverse (R::real) == (SOME S. (R = 0 & S = 0) | S * R = 1)"
paulson@5588
    74
paulson@14269
    75
  real_divide_def:
bauerg@10606
    76
  "R / (S::real) == R * inverse S"
paulson@14269
    77
paulson@5588
    78
constdefs
paulson@5588
    79
paulson@12018
    80
  (** these don't use the overloaded "real" function: users don't see them **)
paulson@14269
    81
paulson@14269
    82
  real_of_preal :: "preal => real"
paulson@7077
    83
  "real_of_preal m     ==
paulson@12018
    84
           Abs_REAL(realrel``{(m + preal_of_prat(prat_of_pnat 1),
paulson@12018
    85
                               preal_of_prat(prat_of_pnat 1))})"
paulson@5588
    86
paulson@14269
    87
  real_of_posnat :: "nat => real"
paulson@7077
    88
  "real_of_posnat n == real_of_preal(preal_of_prat(prat_of_pnat(pnat_of_nat n)))"
paulson@7077
    89
paulson@5588
    90
paulson@14269
    91
defs (overloaded)
paulson@5588
    92
paulson@14269
    93
  real_of_nat_def:   "real n == real_of_posnat n + (- 1)"
paulson@10919
    94
paulson@14269
    95
  real_add_def:
paulson@14329
    96
  "P+Q == Abs_REAL(\<Union>p1\<in>Rep_REAL(P). \<Union>p2\<in>Rep_REAL(Q).
nipkow@10834
    97
                   (%(x1,y1). (%(x2,y2). realrel``{(x1+x2, y1+y2)}) p2) p1)"
paulson@14269
    98
paulson@14269
    99
  real_mult_def:
paulson@14329
   100
  "P*Q == Abs_REAL(\<Union>p1\<in>Rep_REAL(P). \<Union>p2\<in>Rep_REAL(Q).
nipkow@10834
   101
                   (%(x1,y1). (%(x2,y2). realrel``{(x1*x2+y1*y2,x1*y2+x2*y1)})
paulson@10752
   102
		   p2) p1)"
paulson@5588
   103
paulson@14269
   104
  real_less_def:
paulson@14269
   105
  "P<Q == \<exists>x1 y1 x2 y2. x1 + y2 < x2 + y1 &
paulson@14329
   106
                            (x1,y1)\<in>Rep_REAL(P) & (x2,y2)\<in>Rep_REAL(Q)"
paulson@14269
   107
  real_le_def:
paulson@14269
   108
  "P \<le> (Q::real) == ~(Q < P)"
paulson@5588
   109
paulson@14334
   110
  real_abs_def:  "abs (r::real) == (if 0 \<le> r then r else -r)"
paulson@14334
   111
paulson@14334
   112
wenzelm@12114
   113
syntax (xsymbols)
paulson@14269
   114
  Reals     :: "'a set"                   ("\<real>")
paulson@14269
   115
  Nats      :: "'a set"                   ("\<nat>")
paulson@14269
   116
paulson@14269
   117
paulson@14329
   118
subsection{*Proving that realrel is an equivalence relation*}
paulson@14269
   119
paulson@14270
   120
lemma preal_trans_lemma:
paulson@14270
   121
     "[| (x1::preal) + y2 = x2 + y1; x2 + y3 = x3 + y2 |]
paulson@14269
   122
      ==> x1 + y3 = x3 + y1"
paulson@14269
   123
apply (rule_tac C = y2 in preal_add_right_cancel)
paulson@14269
   124
apply (rotate_tac 1, drule sym)
paulson@14269
   125
apply (simp add: preal_add_ac)
paulson@14269
   126
apply (rule preal_add_left_commute [THEN subst])
paulson@14269
   127
apply (rule_tac x1 = x1 in preal_add_assoc [THEN subst])
paulson@14269
   128
apply (simp add: preal_add_ac)
paulson@14269
   129
done
paulson@14269
   130
paulson@14269
   131
lemma realrel_iff [simp]: "(((x1,y1),(x2,y2)): realrel) = (x1 + y2 = x2 + y1)"
paulson@14269
   132
by (unfold realrel_def, blast)
paulson@14269
   133
paulson@14269
   134
lemma realrel_refl: "(x,x): realrel"
paulson@14269
   135
apply (case_tac "x")
paulson@14269
   136
apply (simp add: realrel_def)
paulson@14269
   137
done
paulson@14269
   138
paulson@14269
   139
lemma equiv_realrel: "equiv UNIV realrel"
paulson@14269
   140
apply (unfold equiv_def refl_def sym_def trans_def realrel_def)
paulson@14269
   141
apply (fast elim!: sym preal_trans_lemma)
paulson@14269
   142
done
paulson@14269
   143
paulson@14269
   144
(* (realrel `` {x} = realrel `` {y}) = ((x,y) : realrel) *)
paulson@14269
   145
lemmas equiv_realrel_iff = 
paulson@14269
   146
       eq_equiv_class_iff [OF equiv_realrel UNIV_I UNIV_I]
paulson@14269
   147
paulson@14269
   148
declare equiv_realrel_iff [simp]
paulson@14269
   149
paulson@14269
   150
lemma realrel_in_real [simp]: "realrel``{(x,y)}: REAL"
paulson@14269
   151
by (unfold REAL_def realrel_def quotient_def, blast)
paulson@14269
   152
paulson@14269
   153
lemma inj_on_Abs_REAL: "inj_on Abs_REAL REAL"
paulson@14269
   154
apply (rule inj_on_inverseI)
paulson@14269
   155
apply (erule Abs_REAL_inverse)
paulson@14269
   156
done
paulson@14269
   157
paulson@14269
   158
declare inj_on_Abs_REAL [THEN inj_on_iff, simp]
paulson@14269
   159
declare Abs_REAL_inverse [simp]
paulson@14269
   160
paulson@14269
   161
paulson@14269
   162
lemmas eq_realrelD = equiv_realrel [THEN [2] eq_equiv_class]
paulson@14269
   163
paulson@14269
   164
lemma inj_Rep_REAL: "inj Rep_REAL"
paulson@14269
   165
apply (rule inj_on_inverseI)
paulson@14269
   166
apply (rule Rep_REAL_inverse)
paulson@14269
   167
done
paulson@14269
   168
paulson@14269
   169
(** real_of_preal: the injection from preal to real **)
paulson@14269
   170
lemma inj_real_of_preal: "inj(real_of_preal)"
paulson@14269
   171
apply (rule inj_onI)
paulson@14269
   172
apply (unfold real_of_preal_def)
paulson@14269
   173
apply (drule inj_on_Abs_REAL [THEN inj_onD])
paulson@14269
   174
apply (rule realrel_in_real)+
paulson@14269
   175
apply (drule eq_equiv_class)
paulson@14269
   176
apply (rule equiv_realrel, blast)
paulson@14269
   177
apply (simp add: realrel_def)
paulson@14269
   178
done
paulson@14269
   179
paulson@14269
   180
lemma eq_Abs_REAL: 
paulson@14269
   181
    "(!!x y. z = Abs_REAL(realrel``{(x,y)}) ==> P) ==> P"
paulson@14269
   182
apply (rule_tac x1 = z in Rep_REAL [unfolded REAL_def, THEN quotientE])
paulson@14269
   183
apply (drule_tac f = Abs_REAL in arg_cong)
paulson@14269
   184
apply (case_tac "x")
paulson@14269
   185
apply (simp add: Rep_REAL_inverse)
paulson@14269
   186
done
paulson@14269
   187
paulson@14269
   188
paulson@14329
   189
subsection{*Congruence property for addition*}
paulson@14269
   190
paulson@14269
   191
lemma real_add_congruent2_lemma:
paulson@14269
   192
     "[|a + ba = aa + b; ab + bc = ac + bb|]
paulson@14269
   193
      ==> a + ab + (ba + bc) = aa + ac + (b + (bb::preal))"
paulson@14269
   194
apply (simp add: preal_add_assoc) 
paulson@14269
   195
apply (rule preal_add_left_commute [of ab, THEN ssubst])
paulson@14269
   196
apply (simp add: preal_add_assoc [symmetric])
paulson@14269
   197
apply (simp add: preal_add_ac)
paulson@14269
   198
done
paulson@14269
   199
paulson@14269
   200
lemma real_add:
paulson@14269
   201
  "Abs_REAL(realrel``{(x1,y1)}) + Abs_REAL(realrel``{(x2,y2)}) =
paulson@14269
   202
   Abs_REAL(realrel``{(x1+x2, y1+y2)})"
paulson@14269
   203
apply (simp add: real_add_def UN_UN_split_split_eq)
paulson@14269
   204
apply (subst equiv_realrel [THEN UN_equiv_class2])
paulson@14269
   205
apply (auto simp add: congruent2_def)
paulson@14269
   206
apply (blast intro: real_add_congruent2_lemma) 
paulson@14269
   207
done
paulson@14269
   208
paulson@14269
   209
lemma real_add_commute: "(z::real) + w = w + z"
paulson@14269
   210
apply (rule_tac z = z in eq_Abs_REAL)
paulson@14269
   211
apply (rule_tac z = w in eq_Abs_REAL)
paulson@14269
   212
apply (simp add: preal_add_ac real_add)
paulson@14269
   213
done
paulson@14269
   214
paulson@14269
   215
lemma real_add_assoc: "((z1::real) + z2) + z3 = z1 + (z2 + z3)"
paulson@14269
   216
apply (rule_tac z = z1 in eq_Abs_REAL)
paulson@14269
   217
apply (rule_tac z = z2 in eq_Abs_REAL)
paulson@14269
   218
apply (rule_tac z = z3 in eq_Abs_REAL)
paulson@14269
   219
apply (simp add: real_add preal_add_assoc)
paulson@14269
   220
done
paulson@14269
   221
paulson@14269
   222
lemma real_add_zero_left: "(0::real) + z = z"
paulson@14269
   223
apply (unfold real_of_preal_def real_zero_def)
paulson@14269
   224
apply (rule_tac z = z in eq_Abs_REAL)
paulson@14269
   225
apply (simp add: real_add preal_add_ac)
paulson@14269
   226
done
paulson@14269
   227
paulson@14269
   228
lemma real_add_zero_right: "z + (0::real) = z"
paulson@14334
   229
by (simp add: real_add_zero_left real_add_commute)
paulson@14269
   230
paulson@14269
   231
instance real :: plus_ac0
paulson@14269
   232
  by (intro_classes,
paulson@14269
   233
      (assumption | 
paulson@14269
   234
       rule real_add_commute real_add_assoc real_add_zero_left)+)
paulson@14269
   235
paulson@14269
   236
paulson@14334
   237
subsection{*Additive Inverse on real*}
paulson@14334
   238
paulson@14334
   239
lemma real_minus_congruent:
paulson@14334
   240
  "congruent realrel (%p. (%(x,y). realrel``{(y,x)}) p)"
paulson@14334
   241
apply (unfold congruent_def, clarify)
paulson@14334
   242
apply (simp add: preal_add_commute)
paulson@14334
   243
done
paulson@14334
   244
paulson@14334
   245
lemma real_minus:
paulson@14334
   246
      "- (Abs_REAL(realrel``{(x,y)})) = Abs_REAL(realrel `` {(y,x)})"
paulson@14334
   247
apply (unfold real_minus_def)
paulson@14334
   248
apply (rule_tac f = Abs_REAL in arg_cong)
paulson@14334
   249
apply (simp add: realrel_in_real [THEN Abs_REAL_inverse] 
paulson@14334
   250
            UN_equiv_class [OF equiv_realrel real_minus_congruent])
paulson@14334
   251
done
paulson@14334
   252
paulson@14334
   253
lemma real_add_minus_left: "(-z) + z = (0::real)"
paulson@14269
   254
apply (unfold real_zero_def)
paulson@14269
   255
apply (rule_tac z = z in eq_Abs_REAL)
paulson@14269
   256
apply (simp add: real_minus real_add preal_add_commute)
paulson@14269
   257
done
paulson@14269
   258
paulson@14269
   259
paulson@14329
   260
subsection{*Congruence property for multiplication*}
paulson@14269
   261
paulson@14329
   262
lemma real_mult_congruent2_lemma:
paulson@14329
   263
     "!!(x1::preal). [| x1 + y2 = x2 + y1 |] ==>
paulson@14269
   264
          x * x1 + y * y1 + (x * y2 + x2 * y) =
paulson@14269
   265
          x * x2 + y * y2 + (x * y1 + x1 * y)"
paulson@14269
   266
apply (simp add: preal_add_left_commute preal_add_assoc [symmetric] preal_add_mult_distrib2 [symmetric])
paulson@14269
   267
apply (rule preal_mult_commute [THEN subst])
paulson@14269
   268
apply (rule_tac y1 = x2 in preal_mult_commute [THEN subst])
paulson@14269
   269
apply (simp add: preal_add_assoc preal_add_mult_distrib2 [symmetric])
paulson@14269
   270
apply (simp add: preal_add_commute)
paulson@14269
   271
done
paulson@14269
   272
paulson@14269
   273
lemma real_mult_congruent2:
paulson@14269
   274
    "congruent2 realrel (%p1 p2.
paulson@14269
   275
          (%(x1,y1). (%(x2,y2). realrel``{(x1*x2 + y1*y2, x1*y2+x2*y1)}) p2) p1)"
paulson@14269
   276
apply (rule equiv_realrel [THEN congruent2_commuteI], clarify)
paulson@14269
   277
apply (unfold split_def)
paulson@14269
   278
apply (simp add: preal_mult_commute preal_add_commute)
paulson@14269
   279
apply (auto simp add: real_mult_congruent2_lemma)
paulson@14269
   280
done
paulson@14269
   281
paulson@14269
   282
lemma real_mult:
paulson@14269
   283
   "Abs_REAL((realrel``{(x1,y1)})) * Abs_REAL((realrel``{(x2,y2)})) =
paulson@14269
   284
    Abs_REAL(realrel `` {(x1*x2+y1*y2,x1*y2+x2*y1)})"
paulson@14269
   285
apply (unfold real_mult_def)
paulson@14269
   286
apply (simp add: equiv_realrel [THEN UN_equiv_class2] real_mult_congruent2)
paulson@14269
   287
done
paulson@14269
   288
paulson@14269
   289
lemma real_mult_commute: "(z::real) * w = w * z"
paulson@14269
   290
apply (rule_tac z = z in eq_Abs_REAL)
paulson@14269
   291
apply (rule_tac z = w in eq_Abs_REAL)
paulson@14269
   292
apply (simp add: real_mult preal_add_ac preal_mult_ac)
paulson@14269
   293
done
paulson@14269
   294
paulson@14269
   295
lemma real_mult_assoc: "((z1::real) * z2) * z3 = z1 * (z2 * z3)"
paulson@14269
   296
apply (rule_tac z = z1 in eq_Abs_REAL)
paulson@14269
   297
apply (rule_tac z = z2 in eq_Abs_REAL)
paulson@14269
   298
apply (rule_tac z = z3 in eq_Abs_REAL)
paulson@14269
   299
apply (simp add: preal_add_mult_distrib2 real_mult preal_add_ac preal_mult_ac)
paulson@14269
   300
done
paulson@14269
   301
paulson@14269
   302
lemma real_mult_1: "(1::real) * z = z"
paulson@14269
   303
apply (unfold real_one_def pnat_one_def)
paulson@14269
   304
apply (rule_tac z = z in eq_Abs_REAL)
paulson@14334
   305
apply (simp add: real_mult preal_add_mult_distrib2 preal_mult_1_right
paulson@14334
   306
                 preal_mult_ac preal_add_ac)
paulson@14269
   307
done
paulson@14269
   308
paulson@14269
   309
lemma real_add_mult_distrib: "((z1::real) + z2) * w = (z1 * w) + (z2 * w)"
paulson@14269
   310
apply (rule_tac z = z1 in eq_Abs_REAL)
paulson@14269
   311
apply (rule_tac z = z2 in eq_Abs_REAL)
paulson@14269
   312
apply (rule_tac z = w in eq_Abs_REAL)
paulson@14269
   313
apply (simp add: preal_add_mult_distrib2 real_add real_mult preal_add_ac preal_mult_ac)
paulson@14269
   314
done
paulson@14269
   315
paulson@14329
   316
text{*one and zero are distinct*}
paulson@14269
   317
lemma real_zero_not_eq_one: "0 ~= (1::real)"
paulson@14269
   318
apply (unfold real_zero_def real_one_def)
paulson@14269
   319
apply (auto simp add: preal_self_less_add_left [THEN preal_not_refl2])
paulson@14269
   320
done
paulson@14269
   321
paulson@14329
   322
subsection{*existence of inverse*}
paulson@14269
   323
(** lemma -- alternative definition of 0 **)
paulson@14269
   324
lemma real_zero_iff: "0 = Abs_REAL (realrel `` {(x, x)})"
paulson@14269
   325
apply (unfold real_zero_def)
paulson@14269
   326
apply (auto simp add: preal_add_commute)
paulson@14269
   327
done
paulson@14269
   328
paulson@14334
   329
lemma real_mult_inv_left_ex: "x ~= 0 ==> \<exists>y. y*x = (1::real)"
paulson@14269
   330
apply (unfold real_zero_def real_one_def)
paulson@14269
   331
apply (rule_tac z = x in eq_Abs_REAL)
paulson@14269
   332
apply (cut_tac x = xa and y = y in linorder_less_linear)
paulson@14269
   333
apply (auto dest!: preal_less_add_left_Ex simp add: real_zero_iff [symmetric])
paulson@14334
   334
apply (rule_tac
paulson@14334
   335
        x = "Abs_REAL (realrel `` { (preal_of_prat (prat_of_pnat 1), 
paulson@14334
   336
                            pinv (D) + preal_of_prat (prat_of_pnat 1))}) " 
paulson@14334
   337
       in exI)
paulson@14334
   338
apply (rule_tac [2]
paulson@14334
   339
        x = "Abs_REAL (realrel `` { (pinv (D) + preal_of_prat (prat_of_pnat 1),
paulson@14334
   340
                   preal_of_prat (prat_of_pnat 1))})" 
paulson@14334
   341
       in exI)
paulson@14329
   342
apply (auto simp add: real_mult pnat_one_def preal_mult_1_right
paulson@14329
   343
              preal_add_mult_distrib2 preal_add_mult_distrib preal_mult_1
paulson@14329
   344
              preal_mult_inv_right preal_add_ac preal_mult_ac)
paulson@14269
   345
done
paulson@14269
   346
paulson@14269
   347
lemma real_mult_inv_left: "x ~= 0 ==> inverse(x)*x = (1::real)"
paulson@14269
   348
apply (unfold real_inverse_def)
paulson@14269
   349
apply (frule real_mult_inv_left_ex, safe)
paulson@14269
   350
apply (rule someI2, auto)
paulson@14269
   351
done
paulson@14334
   352
paulson@14334
   353
instance real :: field
paulson@14334
   354
proof
paulson@14334
   355
  fix x y z :: real
paulson@14334
   356
  show "(x + y) + z = x + (y + z)" by (rule real_add_assoc)
paulson@14334
   357
  show "x + y = y + x" by (rule real_add_commute)
paulson@14334
   358
  show "0 + x = x" by simp
paulson@14334
   359
  show "- x + x = 0" by (rule real_add_minus_left)
paulson@14334
   360
  show "x - y = x + (-y)" by (simp add: real_diff_def)
paulson@14334
   361
  show "(x * y) * z = x * (y * z)" by (rule real_mult_assoc)
paulson@14334
   362
  show "x * y = y * x" by (rule real_mult_commute)
paulson@14334
   363
  show "1 * x = x" by (rule real_mult_1)
paulson@14334
   364
  show "(x + y) * z = x * z + y * z" by (simp add: real_add_mult_distrib)
paulson@14334
   365
  show "0 \<noteq> (1::real)" by (rule real_zero_not_eq_one)
paulson@14334
   366
  show "x \<noteq> 0 ==> inverse x * x = 1" by (rule real_mult_inv_left)
paulson@14334
   367
  show "y \<noteq> 0 ==> x / y = x * inverse y" by (simp add: real_divide_def)
paulson@14334
   368
qed
paulson@14334
   369
paulson@14334
   370
paulson@14334
   371
(** Inverse of zero!  Useful to simplify certain equations **)
paulson@14269
   372
paulson@14334
   373
lemma INVERSE_ZERO: "inverse 0 = (0::real)"
paulson@14334
   374
apply (unfold real_inverse_def)
paulson@14334
   375
apply (rule someI2)
paulson@14334
   376
apply (auto simp add: zero_neq_one)
paulson@14269
   377
done
paulson@14334
   378
paulson@14334
   379
lemma DIVISION_BY_ZERO: "a / (0::real) = 0"
paulson@14334
   380
  by (simp add: real_divide_def INVERSE_ZERO)
paulson@14334
   381
paulson@14334
   382
instance real :: division_by_zero
paulson@14334
   383
proof
paulson@14334
   384
  fix x :: real
paulson@14334
   385
  show "inverse 0 = (0::real)" by (rule INVERSE_ZERO)
paulson@14334
   386
  show "x/0 = 0" by (rule DIVISION_BY_ZERO) 
paulson@14334
   387
qed
paulson@14334
   388
paulson@14334
   389
paulson@14334
   390
(*Pull negations out*)
paulson@14334
   391
declare minus_mult_right [symmetric, simp] 
paulson@14334
   392
        minus_mult_left [symmetric, simp]
paulson@14334
   393
paulson@14334
   394
text{*Used in RealBin*}
paulson@14334
   395
lemma real_minus_mult_commute: "(-x) * y = x * (- y :: real)"
paulson@14334
   396
by simp
paulson@14334
   397
paulson@14334
   398
lemma real_mult_1_right: "z * (1::real) = z"
paulson@14334
   399
  by (rule Ring_and_Field.mult_1_right)
paulson@14269
   400
paulson@14269
   401
paulson@14329
   402
subsection{*Theorems for Ordering*}
paulson@14329
   403
paulson@14329
   404
(* real_less is a strict order: irreflexive *)
paulson@14269
   405
paulson@14329
   406
text{*lemmas*}
paulson@14329
   407
lemma preal_lemma_eq_rev_sum:
paulson@14329
   408
     "!!(x::preal). [| x = y; x1 = y1 |] ==> x + y1 = x1 + y"
paulson@14269
   409
by (simp add: preal_add_commute)
paulson@14269
   410
paulson@14329
   411
lemma preal_add_left_commute_cancel:
paulson@14329
   412
     "!!(b::preal). x + (b + y) = x1 + (b + y1) ==> x + y = x1 + y1"
paulson@14269
   413
by (simp add: preal_add_ac)
paulson@14269
   414
paulson@14329
   415
lemma preal_lemma_for_not_refl:
paulson@14329
   416
     "!!(x::preal). [| x + y2a = x2a + y;
paulson@14269
   417
                       x + y2b = x2b + y |]
paulson@14269
   418
                    ==> x2a + y2b = x2b + y2a"
paulson@14269
   419
apply (drule preal_lemma_eq_rev_sum, assumption)
paulson@14269
   420
apply (erule_tac V = "x + y2b = x2b + y" in thin_rl)
paulson@14269
   421
apply (simp add: preal_add_ac)
paulson@14269
   422
apply (drule preal_add_left_commute_cancel)
paulson@14269
   423
apply (simp add: preal_add_ac)
paulson@14269
   424
done
paulson@14269
   425
paulson@14269
   426
lemma real_less_not_refl: "~ (R::real) < R"
paulson@14269
   427
apply (rule_tac z = R in eq_Abs_REAL)
paulson@14269
   428
apply (auto simp add: real_less_def)
paulson@14269
   429
apply (drule preal_lemma_for_not_refl, assumption, auto)
paulson@14269
   430
done
paulson@14269
   431
paulson@14269
   432
(*** y < y ==> P ***)
paulson@14269
   433
lemmas real_less_irrefl = real_less_not_refl [THEN notE, standard]
paulson@14269
   434
declare real_less_irrefl [elim!]
paulson@14269
   435
paulson@14269
   436
lemma real_not_refl2: "!!(x::real). x < y ==> x ~= y"
paulson@14269
   437
by (auto simp add: real_less_not_refl)
paulson@14269
   438
paulson@14269
   439
(* lemma re-arranging and eliminating terms *)
paulson@14269
   440
lemma preal_lemma_trans: "!! (a::preal). [| a + b = c + d;
paulson@14269
   441
             x2b + d + (c + y2e) < a + y2b + (x2e + b) |]
paulson@14269
   442
          ==> x2b + y2e < x2e + y2b"
paulson@14269
   443
apply (simp add: preal_add_ac)
paulson@14269
   444
apply (rule_tac C = "c+d" in preal_add_left_less_cancel)
paulson@14269
   445
apply (simp add: preal_add_assoc [symmetric])
paulson@14269
   446
done
paulson@14269
   447
paulson@14269
   448
(** A MESS!  heavy re-writing involved*)
paulson@14269
   449
lemma real_less_trans: "!!(R1::real). [| R1 < R2; R2 < R3 |] ==> R1 < R3"
paulson@14269
   450
apply (rule_tac z = R1 in eq_Abs_REAL)
paulson@14269
   451
apply (rule_tac z = R2 in eq_Abs_REAL)
paulson@14269
   452
apply (rule_tac z = R3 in eq_Abs_REAL)
paulson@14269
   453
apply (auto simp add: real_less_def)
paulson@14269
   454
apply (rule exI)+
paulson@14269
   455
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   456
 prefer 2 apply blast 
paulson@14269
   457
 prefer 2 apply blast 
paulson@14269
   458
apply (drule preal_lemma_for_not_refl, assumption)
paulson@14269
   459
apply (blast dest: preal_add_less_mono intro: preal_lemma_trans)
paulson@14269
   460
done
paulson@14269
   461
paulson@14269
   462
lemma real_less_not_sym: "!! (R1::real). R1 < R2 ==> ~ (R2 < R1)"
paulson@14269
   463
apply (rule notI)
paulson@14269
   464
apply (drule real_less_trans, assumption)
paulson@14269
   465
apply (simp add: real_less_not_refl)
paulson@14269
   466
done
paulson@14269
   467
paulson@14269
   468
(* [| x < y;  ~P ==> y < x |] ==> P *)
paulson@14269
   469
lemmas real_less_asym = real_less_not_sym [THEN contrapos_np, standard]
paulson@14269
   470
paulson@14269
   471
lemma real_of_preal_add:
paulson@14269
   472
     "real_of_preal ((z1::preal) + z2) =
paulson@14269
   473
      real_of_preal z1 + real_of_preal z2"
paulson@14269
   474
apply (unfold real_of_preal_def)
paulson@14269
   475
apply (simp add: real_add preal_add_mult_distrib preal_mult_1 add: preal_add_ac)
paulson@14269
   476
done
paulson@14269
   477
paulson@14269
   478
lemma real_of_preal_mult:
paulson@14269
   479
     "real_of_preal ((z1::preal) * z2) =
paulson@14269
   480
      real_of_preal z1* real_of_preal z2"
paulson@14269
   481
apply (unfold real_of_preal_def)
paulson@14269
   482
apply (simp (no_asm_use) add: real_mult preal_add_mult_distrib2 preal_mult_1 preal_mult_1_right pnat_one_def preal_add_ac preal_mult_ac)
paulson@14269
   483
done
paulson@14269
   484
paulson@14269
   485
lemma real_of_preal_ExI:
paulson@14269
   486
      "!!(x::preal). y < x ==>
paulson@14269
   487
       \<exists>m. Abs_REAL (realrel `` {(x,y)}) = real_of_preal m"
paulson@14269
   488
apply (unfold real_of_preal_def)
paulson@14269
   489
apply (auto dest!: preal_less_add_left_Ex simp add: preal_add_ac)
paulson@14269
   490
done
paulson@14269
   491
paulson@14269
   492
lemma real_of_preal_ExD:
paulson@14269
   493
      "!!(x::preal). \<exists>m. Abs_REAL (realrel `` {(x,y)}) =
paulson@14269
   494
                     real_of_preal m ==> y < x"
paulson@14269
   495
apply (unfold real_of_preal_def)
paulson@14269
   496
apply (auto simp add: preal_add_commute preal_add_assoc)
paulson@14269
   497
apply (simp add: preal_add_assoc [symmetric] preal_self_less_add_left)
paulson@14269
   498
done
paulson@14269
   499
paulson@14329
   500
lemma real_of_preal_iff:
paulson@14329
   501
     "(\<exists>m. Abs_REAL (realrel `` {(x,y)}) = real_of_preal m) = (y < x)"
paulson@14269
   502
by (blast intro!: real_of_preal_ExI real_of_preal_ExD)
paulson@14269
   503
paulson@14329
   504
text{*Gleason prop 9-4.4 p 127*}
paulson@14269
   505
lemma real_of_preal_trichotomy:
paulson@14269
   506
      "\<exists>m. (x::real) = real_of_preal m | x = 0 | x = -(real_of_preal m)"
paulson@14269
   507
apply (unfold real_of_preal_def real_zero_def)
paulson@14269
   508
apply (rule_tac z = x in eq_Abs_REAL)
paulson@14269
   509
apply (auto simp add: real_minus preal_add_ac)
paulson@14269
   510
apply (cut_tac x = x and y = y in linorder_less_linear)
paulson@14269
   511
apply (auto dest!: preal_less_add_left_Ex simp add: preal_add_assoc [symmetric])
paulson@14269
   512
apply (auto simp add: preal_add_commute)
paulson@14269
   513
done
paulson@14269
   514
paulson@14329
   515
lemma real_of_preal_trichotomyE:
paulson@14329
   516
     "!!P. [| !!m. x = real_of_preal m ==> P;
paulson@14269
   517
              x = 0 ==> P;
paulson@14269
   518
              !!m. x = -(real_of_preal m) ==> P |] ==> P"
paulson@14269
   519
apply (cut_tac x = x in real_of_preal_trichotomy, auto)
paulson@14269
   520
done
paulson@14269
   521
paulson@14269
   522
lemma real_of_preal_lessD:
paulson@14269
   523
      "real_of_preal m1 < real_of_preal m2 ==> m1 < m2"
paulson@14269
   524
apply (unfold real_of_preal_def)
paulson@14269
   525
apply (auto simp add: real_less_def preal_add_ac)
paulson@14269
   526
apply (auto simp add: preal_add_assoc [symmetric])
paulson@14269
   527
apply (auto simp add: preal_add_ac)
paulson@14269
   528
done
paulson@14269
   529
paulson@14269
   530
lemma real_of_preal_lessI: "m1 < m2 ==> real_of_preal m1 < real_of_preal m2"
paulson@14269
   531
apply (drule preal_less_add_left_Ex)
paulson@14269
   532
apply (auto simp add: real_of_preal_add real_of_preal_def real_less_def)
paulson@14269
   533
apply (rule exI)+
paulson@14269
   534
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   535
 apply (rule_tac [2] refl)+
paulson@14269
   536
apply (simp add: preal_self_less_add_left del: preal_add_less_iff2)
paulson@14269
   537
done
paulson@14269
   538
paulson@14329
   539
lemma real_of_preal_less_iff1:
paulson@14329
   540
     "(real_of_preal m1 < real_of_preal m2) = (m1 < m2)"
paulson@14269
   541
by (blast intro: real_of_preal_lessI real_of_preal_lessD)
paulson@14269
   542
paulson@14269
   543
declare real_of_preal_less_iff1 [simp]
paulson@14269
   544
paulson@14269
   545
lemma real_of_preal_minus_less_self: "- real_of_preal m < real_of_preal m"
paulson@14269
   546
apply (auto simp add: real_of_preal_def real_less_def real_minus)
paulson@14269
   547
apply (rule exI)+
paulson@14269
   548
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   549
 apply (rule_tac [2] refl)+
paulson@14269
   550
apply (simp (no_asm_use) add: preal_add_ac)
paulson@14269
   551
apply (simp (no_asm_use) add: preal_self_less_add_right preal_add_assoc [symmetric])
paulson@14269
   552
done
paulson@14269
   553
paulson@14269
   554
lemma real_of_preal_minus_less_zero: "- real_of_preal m < 0"
paulson@14269
   555
apply (unfold real_zero_def)
paulson@14269
   556
apply (auto simp add: real_of_preal_def real_less_def real_minus)
paulson@14269
   557
apply (rule exI)+
paulson@14269
   558
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   559
 apply (rule_tac [2] refl)+
paulson@14269
   560
apply (simp (no_asm_use) add: preal_self_less_add_right preal_add_ac)
paulson@14269
   561
done
paulson@14269
   562
paulson@14269
   563
lemma real_of_preal_not_minus_gt_zero: "~ 0 < - real_of_preal m"
paulson@14269
   564
apply (cut_tac real_of_preal_minus_less_zero)
paulson@14269
   565
apply (fast dest: real_less_trans elim: real_less_irrefl)
paulson@14269
   566
done
paulson@14269
   567
paulson@14269
   568
lemma real_of_preal_zero_less: "0 < real_of_preal m"
paulson@14269
   569
apply (unfold real_zero_def)
paulson@14269
   570
apply (auto simp add: real_of_preal_def real_less_def real_minus)
paulson@14269
   571
apply (rule exI)+
paulson@14269
   572
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   573
 apply (rule_tac [2] refl)+
paulson@14269
   574
apply (simp (no_asm_use) add: preal_self_less_add_right preal_add_ac)
paulson@14269
   575
done
paulson@14269
   576
paulson@14269
   577
lemma real_of_preal_not_less_zero: "~ real_of_preal m < 0"
paulson@14269
   578
apply (cut_tac real_of_preal_zero_less)
paulson@14269
   579
apply (blast dest: real_less_trans elim: real_less_irrefl)
paulson@14269
   580
done
paulson@14269
   581
paulson@14269
   582
lemma real_minus_minus_zero_less: "0 < - (- real_of_preal m)"
paulson@14269
   583
by (simp add: real_of_preal_zero_less)
paulson@14269
   584
paulson@14269
   585
(* another lemma *)
paulson@14269
   586
lemma real_of_preal_sum_zero_less:
paulson@14269
   587
      "0 < real_of_preal m + real_of_preal m1"
paulson@14269
   588
apply (unfold real_zero_def)
paulson@14269
   589
apply (auto simp add: real_of_preal_def real_less_def real_add)
paulson@14269
   590
apply (rule exI)+
paulson@14269
   591
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   592
 apply (rule_tac [2] refl)+
paulson@14269
   593
apply (simp (no_asm_use) add: preal_add_ac)
paulson@14269
   594
apply (simp (no_asm_use) add: preal_self_less_add_right preal_add_assoc [symmetric])
paulson@14269
   595
done
paulson@14269
   596
paulson@14269
   597
lemma real_of_preal_minus_less_all: "- real_of_preal m < real_of_preal m1"
paulson@14269
   598
apply (auto simp add: real_of_preal_def real_less_def real_minus)
paulson@14269
   599
apply (rule exI)+
paulson@14269
   600
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   601
 apply (rule_tac [2] refl)+
paulson@14269
   602
apply (simp (no_asm_use) add: preal_add_ac)
paulson@14269
   603
apply (simp (no_asm_use) add: preal_self_less_add_right preal_add_assoc [symmetric])
paulson@14269
   604
done
paulson@14269
   605
paulson@14269
   606
lemma real_of_preal_not_minus_gt_all: "~ real_of_preal m < - real_of_preal m1"
paulson@14269
   607
apply (cut_tac real_of_preal_minus_less_all)
paulson@14269
   608
apply (blast dest: real_less_trans elim: real_less_irrefl)
paulson@14269
   609
done
paulson@14269
   610
paulson@14329
   611
lemma real_of_preal_minus_less_rev1:
paulson@14329
   612
     "- real_of_preal m1 < - real_of_preal m2
paulson@14269
   613
      ==> real_of_preal m2 < real_of_preal m1"
paulson@14269
   614
apply (auto simp add: real_of_preal_def real_less_def real_minus)
paulson@14269
   615
apply (rule exI)+
paulson@14269
   616
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   617
 apply (rule_tac [2] refl)+
paulson@14269
   618
apply (auto simp add: preal_add_ac)
paulson@14269
   619
apply (simp add: preal_add_assoc [symmetric])
paulson@14269
   620
apply (auto simp add: preal_add_ac)
paulson@14269
   621
done
paulson@14269
   622
paulson@14329
   623
lemma real_of_preal_minus_less_rev2:
paulson@14329
   624
     "real_of_preal m1 < real_of_preal m2
paulson@14269
   625
      ==> - real_of_preal m2 < - real_of_preal m1"
paulson@14269
   626
apply (auto simp add: real_of_preal_def real_less_def real_minus)
paulson@14269
   627
apply (rule exI)+
paulson@14269
   628
apply (rule conjI, rule_tac [2] conjI)
paulson@14269
   629
 apply (rule_tac [2] refl)+
paulson@14269
   630
apply (auto simp add: preal_add_ac)
paulson@14269
   631
apply (simp add: preal_add_assoc [symmetric])
paulson@14269
   632
apply (auto simp add: preal_add_ac)
paulson@14269
   633
done
paulson@14269
   634
paulson@14329
   635
lemma real_of_preal_minus_less_rev_iff:
paulson@14329
   636
     "(- real_of_preal m1 < - real_of_preal m2) =
paulson@14269
   637
      (real_of_preal m2 < real_of_preal m1)"
paulson@14269
   638
apply (blast intro!: real_of_preal_minus_less_rev1 real_of_preal_minus_less_rev2)
paulson@14269
   639
done
paulson@14269
   640
paulson@14270
   641
paulson@14270
   642
subsection{*Linearity of the Ordering*}
paulson@14270
   643
paulson@14269
   644
lemma real_linear: "(x::real) < y | x = y | y < x"
paulson@14269
   645
apply (rule_tac x = x in real_of_preal_trichotomyE)
paulson@14269
   646
apply (rule_tac [!] x = y in real_of_preal_trichotomyE)
paulson@14270
   647
apply (auto dest!: preal_le_anti_sym 
paulson@14270
   648
            simp add: preal_less_le_iff real_of_preal_minus_less_zero 
paulson@14334
   649
                      real_of_preal_zero_less real_of_preal_minus_less_all
paulson@14334
   650
                      real_of_preal_minus_less_rev_iff)
paulson@14269
   651
done
paulson@14269
   652
paulson@14269
   653
lemma real_neq_iff: "!!w::real. (w ~= z) = (w<z | z<w)"
paulson@14269
   654
by (cut_tac real_linear, blast)
paulson@14269
   655
paulson@14269
   656
paulson@14329
   657
lemma real_linear_less2:
paulson@14329
   658
     "!!(R1::real). [| R1 < R2 ==> P;  R1 = R2 ==> P;
paulson@14269
   659
                       R2 < R1 ==> P |] ==> P"
paulson@14269
   660
apply (cut_tac x = R1 and y = R2 in real_linear, auto)
paulson@14269
   661
done
paulson@14269
   662
paulson@14269
   663
lemma real_minus_zero_less_iff: "(0 < -R) = (R < (0::real))"
paulson@14269
   664
apply (rule_tac x = R in real_of_preal_trichotomyE)
paulson@14269
   665
apply (auto simp add: real_of_preal_not_minus_gt_zero real_of_preal_not_less_zero real_of_preal_zero_less real_of_preal_minus_less_zero)
paulson@14269
   666
done
paulson@14269
   667
declare real_minus_zero_less_iff [simp]
paulson@14269
   668
paulson@14269
   669
lemma real_minus_zero_less_iff2: "(-R < 0) = ((0::real) < R)"
paulson@14269
   670
apply (rule_tac x = R in real_of_preal_trichotomyE)
paulson@14269
   671
apply (auto simp add: real_of_preal_not_minus_gt_zero real_of_preal_not_less_zero real_of_preal_zero_less real_of_preal_minus_less_zero)
paulson@14269
   672
done
paulson@14269
   673
declare real_minus_zero_less_iff2 [simp]
paulson@14269
   674
paulson@14269
   675
ML
paulson@14269
   676
{*
paulson@14269
   677
val real_le_def = thm "real_le_def";
paulson@14269
   678
val real_diff_def = thm "real_diff_def";
paulson@14269
   679
val real_divide_def = thm "real_divide_def";
paulson@14269
   680
val real_of_nat_def = thm "real_of_nat_def";
paulson@14269
   681
paulson@14269
   682
val preal_trans_lemma = thm"preal_trans_lemma";
paulson@14269
   683
val realrel_iff = thm"realrel_iff";
paulson@14269
   684
val realrel_refl = thm"realrel_refl";
paulson@14269
   685
val equiv_realrel = thm"equiv_realrel";
paulson@14269
   686
val equiv_realrel_iff = thm"equiv_realrel_iff";
paulson@14269
   687
val realrel_in_real = thm"realrel_in_real";
paulson@14269
   688
val inj_on_Abs_REAL = thm"inj_on_Abs_REAL";
paulson@14269
   689
val eq_realrelD = thm"eq_realrelD";
paulson@14269
   690
val inj_Rep_REAL = thm"inj_Rep_REAL";
paulson@14269
   691
val inj_real_of_preal = thm"inj_real_of_preal";
paulson@14269
   692
val eq_Abs_REAL = thm"eq_Abs_REAL";
paulson@14269
   693
val real_minus_congruent = thm"real_minus_congruent";
paulson@14269
   694
val real_minus = thm"real_minus";
paulson@14269
   695
val real_add = thm"real_add";
paulson@14269
   696
val real_add_commute = thm"real_add_commute";
paulson@14269
   697
val real_add_assoc = thm"real_add_assoc";
paulson@14269
   698
val real_add_zero_left = thm"real_add_zero_left";
paulson@14269
   699
val real_add_zero_right = thm"real_add_zero_right";
paulson@14269
   700
paulson@14269
   701
*}
paulson@14269
   702
paulson@14334
   703
subsection{*Properties of Less-Than Or Equals*}
paulson@14334
   704
paulson@14334
   705
lemma real_le_imp_less_or_eq: "!!(x::real). x \<le> y ==> x < y | x = y"
paulson@14334
   706
apply (unfold real_le_def)
paulson@14334
   707
apply (cut_tac real_linear)
paulson@14334
   708
apply (blast elim: real_less_irrefl real_less_asym)
paulson@14334
   709
done
paulson@14334
   710
paulson@14334
   711
lemma real_less_or_eq_imp_le: "z<w | z=w ==> z \<le>(w::real)"
paulson@14334
   712
apply (unfold real_le_def)
paulson@14334
   713
apply (cut_tac real_linear)
paulson@14334
   714
apply (fast elim: real_less_irrefl real_less_asym)
paulson@14334
   715
done
paulson@14334
   716
paulson@14334
   717
lemma real_le_less: "(x \<le> (y::real)) = (x < y | x=y)"
paulson@14334
   718
by (blast intro!: real_less_or_eq_imp_le dest!: real_le_imp_less_or_eq)
paulson@14334
   719
paulson@14334
   720
lemma real_le_refl: "w \<le> (w::real)"
paulson@14334
   721
by (simp add: real_le_less)
paulson@14334
   722
paulson@14334
   723
lemma real_le_trans: "[| i \<le> j; j \<le> k |] ==> i \<le> (k::real)"
paulson@14334
   724
apply (drule real_le_imp_less_or_eq) 
paulson@14334
   725
apply (drule real_le_imp_less_or_eq) 
paulson@14334
   726
apply (rule real_less_or_eq_imp_le) 
paulson@14334
   727
apply (blast intro: real_less_trans) 
paulson@14334
   728
done
paulson@14334
   729
paulson@14334
   730
lemma real_le_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::real)"
paulson@14334
   731
apply (drule real_le_imp_less_or_eq) 
paulson@14334
   732
apply (drule real_le_imp_less_or_eq) 
paulson@14334
   733
apply (fast elim: real_less_irrefl real_less_asym)
paulson@14334
   734
done
paulson@14334
   735
paulson@14334
   736
(* Axiom 'order_less_le' of class 'order': *)
paulson@14334
   737
lemma real_less_le: "((w::real) < z) = (w \<le> z & w \<noteq> z)"
paulson@14334
   738
apply (simp add: real_le_def real_neq_iff)
paulson@14334
   739
apply (blast elim!: real_less_asym)
paulson@14334
   740
done
paulson@14334
   741
paulson@14334
   742
instance real :: order
paulson@14334
   743
  by (intro_classes,
paulson@14334
   744
      (assumption | 
paulson@14334
   745
       rule real_le_refl real_le_trans real_le_anti_sym real_less_le)+)
paulson@14334
   746
paulson@14334
   747
(* Axiom 'linorder_linear' of class 'linorder': *)
paulson@14334
   748
lemma real_le_linear: "(z::real) \<le> w | w \<le> z"
paulson@14334
   749
apply (simp add: real_le_less)
paulson@14334
   750
apply (cut_tac real_linear, blast)
paulson@14334
   751
done
paulson@14334
   752
paulson@14334
   753
instance real :: linorder
paulson@14334
   754
  by (intro_classes, rule real_le_linear)
paulson@14334
   755
paulson@14334
   756
paulson@14334
   757
subsection{*Theorems About the Ordering*}
paulson@14334
   758
paulson@14334
   759
lemma real_gt_zero_preal_Ex: "(0 < x) = (\<exists>y. x = real_of_preal y)"
paulson@14334
   760
apply (auto simp add: real_of_preal_zero_less)
paulson@14334
   761
apply (cut_tac x = x in real_of_preal_trichotomy)
paulson@14334
   762
apply (blast elim!: real_less_irrefl real_of_preal_not_minus_gt_zero [THEN notE])
paulson@14334
   763
done
paulson@14334
   764
paulson@14334
   765
lemma real_gt_preal_preal_Ex:
paulson@14334
   766
     "real_of_preal z < x ==> \<exists>y. x = real_of_preal y"
paulson@14334
   767
by (blast dest!: real_of_preal_zero_less [THEN real_less_trans]
paulson@14334
   768
             intro: real_gt_zero_preal_Ex [THEN iffD1])
paulson@14334
   769
paulson@14334
   770
lemma real_ge_preal_preal_Ex:
paulson@14334
   771
     "real_of_preal z \<le> x ==> \<exists>y. x = real_of_preal y"
paulson@14334
   772
by (blast dest: order_le_imp_less_or_eq real_gt_preal_preal_Ex)
paulson@14334
   773
paulson@14334
   774
lemma real_less_all_preal: "y \<le> 0 ==> \<forall>x. y < real_of_preal x"
paulson@14334
   775
by (auto elim: order_le_imp_less_or_eq [THEN disjE] 
paulson@14334
   776
            intro: real_of_preal_zero_less [THEN [2] real_less_trans] 
paulson@14334
   777
            simp add: real_of_preal_zero_less)
paulson@14334
   778
paulson@14334
   779
lemma real_less_all_real2: "~ 0 < y ==> \<forall>x. y < real_of_preal x"
paulson@14334
   780
by (blast intro!: real_less_all_preal linorder_not_less [THEN iffD1])
paulson@14334
   781
paulson@14334
   782
lemma real_of_preal_le_iff:
paulson@14334
   783
     "(real_of_preal m1 \<le> real_of_preal m2) = (m1 \<le> m2)"
paulson@14334
   784
apply (auto intro!: preal_leI simp add: linorder_not_less [symmetric])
paulson@14334
   785
done
paulson@14334
   786
paulson@14334
   787
paulson@14334
   788
subsection{*Monotonicity of Addition*}
paulson@14334
   789
paulson@14334
   790
lemma real_mult_order: "[| 0 < x; 0 < y |] ==> (0::real) < x * y"
paulson@14334
   791
apply (auto simp add: real_gt_zero_preal_Ex)
paulson@14334
   792
apply (rule_tac x = "y*ya" in exI)
paulson@14334
   793
apply (simp (no_asm_use) add: real_of_preal_mult)
paulson@14334
   794
done
paulson@14334
   795
paulson@14334
   796
(*Alternative definition for real_less*)
paulson@14334
   797
lemma real_less_add_positive_left_Ex: "R < S ==> \<exists>T::real. 0 < T & R + T = S"
paulson@14334
   798
apply (rule_tac x = R in real_of_preal_trichotomyE)
paulson@14334
   799
apply (rule_tac [!] x = S in real_of_preal_trichotomyE)
paulson@14334
   800
apply (auto dest!: preal_less_add_left_Ex simp add: real_of_preal_not_minus_gt_all real_of_preal_add real_of_preal_not_less_zero real_less_not_refl real_of_preal_not_minus_gt_zero real_of_preal_minus_less_rev_iff)
paulson@14334
   801
apply (rule real_of_preal_zero_less) 
paulson@14334
   802
apply (rule_tac [1] x = "real_of_preal m+real_of_preal ma" in exI)
paulson@14334
   803
apply (rule_tac [2] x = "real_of_preal D" in exI)
paulson@14334
   804
apply (auto simp add: real_of_preal_minus_less_rev_iff real_of_preal_zero_less real_of_preal_sum_zero_less real_add_assoc)
paulson@14334
   805
apply (simp add: real_add_assoc [symmetric])
paulson@14334
   806
done
paulson@14334
   807
paulson@14334
   808
lemma real_less_sum_gt_zero: "(W < S) ==> (0 < S + (-W::real))"
paulson@14334
   809
apply (drule real_less_add_positive_left_Ex)
paulson@14334
   810
apply (auto simp add: add_ac)
paulson@14334
   811
done
paulson@14334
   812
paulson@14334
   813
lemma real_lemma_change_eq_subj: "!!S::real. T = S + W ==> S = T + (-W)"
paulson@14334
   814
by (simp add: add_ac)
paulson@14334
   815
paulson@14334
   816
(* FIXME: long! *)
paulson@14334
   817
lemma real_sum_gt_zero_less: "(0 < S + (-W::real)) ==> (W < S)"
paulson@14334
   818
apply (rule ccontr)
paulson@14334
   819
apply (drule linorder_not_less [THEN iffD1, THEN real_le_imp_less_or_eq])
paulson@14334
   820
apply (auto simp add: real_less_not_refl)
paulson@14334
   821
apply (drule real_less_add_positive_left_Ex, clarify, simp)
paulson@14334
   822
apply (drule real_lemma_change_eq_subj, auto)
paulson@14334
   823
apply (drule real_less_sum_gt_zero)
paulson@14334
   824
apply (auto elim: real_less_asym simp add: add_left_commute [of W] add_ac)
paulson@14334
   825
done
paulson@14334
   826
paulson@14334
   827
lemma real_mult_less_mono2: "[| (0::real) < z; x < y |] ==> z * x < z * y"
paulson@14334
   828
apply (rule real_sum_gt_zero_less)
paulson@14334
   829
apply (drule real_less_sum_gt_zero [of x y])
paulson@14334
   830
apply (drule real_mult_order, assumption)
paulson@14334
   831
apply (simp add: right_distrib)
paulson@14334
   832
done
paulson@14334
   833
paulson@14334
   834
lemma real_less_sum_gt_0_iff: "(0 < S + (-W::real)) = (W < S)"
paulson@14334
   835
by (blast intro: real_less_sum_gt_zero real_sum_gt_zero_less)
paulson@14334
   836
paulson@14334
   837
lemma real_less_eq_diff: "(x<y) = (x-y < (0::real))"
paulson@14334
   838
apply (unfold real_diff_def)
paulson@14334
   839
apply (subst real_minus_zero_less_iff [symmetric])
paulson@14334
   840
apply (simp add: real_add_commute real_less_sum_gt_0_iff)
paulson@14334
   841
done
paulson@14334
   842
paulson@14334
   843
lemma real_less_eqI: "(x::real) - y = x' - y' ==> (x<y) = (x'<y')"
paulson@14334
   844
apply (subst real_less_eq_diff)
paulson@14334
   845
apply (rule_tac y1 = y in real_less_eq_diff [THEN ssubst], simp)
paulson@14334
   846
done
paulson@14334
   847
paulson@14334
   848
lemma real_le_eqI: "(x::real) - y = x' - y' ==> (y\<le>x) = (y'\<le>x')"
paulson@14334
   849
apply (drule real_less_eqI)
paulson@14334
   850
apply (simp add: real_le_def)
paulson@14334
   851
done
paulson@14334
   852
paulson@14334
   853
lemma real_add_left_mono: "x \<le> y ==> z + x \<le> z + (y::real)"
paulson@14334
   854
apply (rule real_le_eqI [THEN iffD1]) 
paulson@14334
   855
 prefer 2 apply assumption
paulson@14334
   856
apply (simp add: real_diff_def add_ac)
paulson@14334
   857
done
paulson@14334
   858
paulson@14334
   859
paulson@14334
   860
subsection{*The Reals Form an Ordered Field*}
paulson@14334
   861
paulson@14334
   862
instance real :: ordered_field
paulson@14334
   863
proof
paulson@14334
   864
  fix x y z :: real
paulson@14334
   865
  show "x \<le> y ==> z + x \<le> z + y" by (rule real_add_left_mono)
paulson@14334
   866
  show "x < y ==> 0 < z ==> z * x < z * y" by (simp add: real_mult_less_mono2)
paulson@14334
   867
  show "\<bar>x\<bar> = (if x < 0 then -x else x)"
paulson@14334
   868
    by (auto dest: order_le_less_trans simp add: real_abs_def linorder_not_le)
paulson@14334
   869
qed
paulson@14334
   870
paulson@14334
   871
text{*These two need to be proved in @{text Ring_and_Field}*}
paulson@14334
   872
lemma real_add_less_le_mono: "[| w'<w; z'\<le>z |] ==> w' + z' < w + (z::real)"
paulson@14334
   873
apply (erule add_strict_right_mono [THEN order_less_le_trans])
paulson@14334
   874
apply (erule add_left_mono) 
paulson@14334
   875
done
paulson@14334
   876
paulson@14334
   877
lemma real_add_le_less_mono:
paulson@14334
   878
     "!!z z'::real. [| w'\<le>w; z'<z |] ==> w' + z' < w + z"
paulson@14334
   879
apply (erule add_right_mono [THEN order_le_less_trans])
paulson@14334
   880
apply (erule add_strict_left_mono) 
paulson@14334
   881
done
paulson@14334
   882
paulson@14334
   883
lemma real_zero_less_one: "0 < (1::real)"
paulson@14334
   884
  by (rule Ring_and_Field.zero_less_one)
paulson@14334
   885
paulson@14334
   886
lemma real_le_square [simp]: "(0::real) \<le> x*x"
paulson@14334
   887
 by (rule Ring_and_Field.zero_le_square)
paulson@14334
   888
paulson@14334
   889
paulson@14334
   890
subsection{*More Lemmas*}
paulson@14334
   891
paulson@14334
   892
lemma real_mult_left_cancel: "(c::real) \<noteq> 0 ==> (c*a=c*b) = (a=b)"
paulson@14334
   893
by auto
paulson@14334
   894
paulson@14334
   895
lemma real_mult_right_cancel: "(c::real) \<noteq> 0 ==> (a*c=b*c) = (a=b)"
paulson@14334
   896
by auto
paulson@14334
   897
paulson@14334
   898
text{*The precondition could be weakened to @{term "0\<le>x"}*}
paulson@14334
   899
lemma real_mult_less_mono:
paulson@14334
   900
     "[| u<v;  x<y;  (0::real) < v;  0 < x |] ==> u*x < v* y"
paulson@14334
   901
 by (simp add: Ring_and_Field.mult_strict_mono order_less_imp_le)
paulson@14334
   902
paulson@14334
   903
lemma real_mult_less_iff1 [simp]: "(0::real) < z ==> (x*z < y*z) = (x < y)"
paulson@14334
   904
  by (force elim: order_less_asym
paulson@14334
   905
            simp add: Ring_and_Field.mult_less_cancel_right)
paulson@14334
   906
paulson@14334
   907
lemma real_mult_le_cancel_iff1 [simp]: "(0::real) < z ==> (x*z \<le> y*z) = (x\<le>y)"
paulson@14334
   908
by (auto simp add: real_le_def)
paulson@14334
   909
paulson@14334
   910
lemma real_mult_le_cancel_iff2 [simp]: "(0::real) < z ==> (z*x \<le> z*y) = (x\<le>y)"
paulson@14334
   911
  by (force elim: order_less_asym
paulson@14334
   912
            simp add: Ring_and_Field.mult_le_cancel_left)
paulson@14334
   913
paulson@14334
   914
text{*Only two uses?*}
paulson@14334
   915
lemma real_mult_less_mono':
paulson@14334
   916
     "[| x < y;  r1 < r2;  (0::real) \<le> r1;  0 \<le> x|] ==> r1 * x < r2 * y"
paulson@14334
   917
 by (rule Ring_and_Field.mult_strict_mono')
paulson@14334
   918
paulson@14334
   919
text{*FIXME: delete or at least combine the next two lemmas*}
paulson@14334
   920
lemma real_sum_squares_cancel: "x * x + y * y = 0 ==> x = (0::real)"
paulson@14334
   921
apply (drule Ring_and_Field.equals_zero_I [THEN sym])
paulson@14334
   922
apply (cut_tac x = y in real_le_square) 
paulson@14334
   923
apply (auto, drule real_le_anti_sym, auto)
paulson@14334
   924
done
paulson@14334
   925
paulson@14334
   926
lemma real_sum_squares_cancel2: "x * x + y * y = 0 ==> y = (0::real)"
paulson@14334
   927
apply (rule_tac y = x in real_sum_squares_cancel)
paulson@14334
   928
apply (simp add: real_add_commute)
paulson@14334
   929
done
paulson@14334
   930
paulson@14334
   931
paulson@14334
   932
lemma real_add_order: "[| 0 < x; 0 < y |] ==> (0::real) < x + y"
paulson@14334
   933
apply (drule add_strict_mono [of concl: 0 0], assumption)
paulson@14334
   934
apply simp 
paulson@14334
   935
done
paulson@14334
   936
paulson@14334
   937
lemma real_le_add_order: "[| 0 \<le> x; 0 \<le> y |] ==> (0::real) \<le> x + y"
paulson@14334
   938
apply (drule order_le_imp_less_or_eq)+
paulson@14334
   939
apply (auto intro: real_add_order order_less_imp_le)
paulson@14334
   940
done
paulson@14334
   941
paulson@14334
   942
paulson@14334
   943
subsection{*An Embedding of the Naturals in the Reals*}
paulson@14334
   944
paulson@14334
   945
lemma real_of_posnat_one: "real_of_posnat 0 = (1::real)"
paulson@14334
   946
by (simp add: real_of_posnat_def pnat_one_iff [symmetric]
paulson@14334
   947
              real_of_preal_def symmetric real_one_def)
paulson@14334
   948
paulson@14334
   949
lemma real_of_posnat_two: "real_of_posnat (Suc 0) = (1::real) + (1::real)"
paulson@14334
   950
by (simp add: real_of_posnat_def real_of_preal_def real_one_def pnat_two_eq
paulson@14334
   951
                 real_add
paulson@14334
   952
            prat_of_pnat_add [symmetric] preal_of_prat_add [symmetric]
paulson@14334
   953
            pnat_add_ac)
paulson@14334
   954
paulson@14334
   955
lemma real_of_posnat_add: 
paulson@14334
   956
     "real_of_posnat n1 + real_of_posnat n2 = real_of_posnat (n1 + n2) + (1::real)"
paulson@14334
   957
apply (unfold real_of_posnat_def)
paulson@14334
   958
apply (simp (no_asm_use) add: real_of_posnat_one [symmetric] real_of_posnat_def real_of_preal_add [symmetric] preal_of_prat_add [symmetric] prat_of_pnat_add [symmetric] pnat_of_nat_add)
paulson@14334
   959
done
paulson@14334
   960
paulson@14334
   961
lemma real_of_posnat_add_one:
paulson@14334
   962
     "real_of_posnat (n + 1) = real_of_posnat n + (1::real)"
paulson@14334
   963
apply (rule_tac a1 = " (1::real) " in add_right_cancel [THEN iffD1])
paulson@14334
   964
apply (rule real_of_posnat_add [THEN subst])
paulson@14334
   965
apply (simp (no_asm_use) add: real_of_posnat_two real_add_assoc)
paulson@14334
   966
done
paulson@14334
   967
paulson@14334
   968
lemma real_of_posnat_Suc:
paulson@14334
   969
     "real_of_posnat (Suc n) = real_of_posnat n + (1::real)"
paulson@14334
   970
by (subst real_of_posnat_add_one [symmetric], simp)
paulson@14334
   971
paulson@14334
   972
lemma inj_real_of_posnat: "inj(real_of_posnat)"
paulson@14334
   973
apply (rule inj_onI)
paulson@14334
   974
apply (unfold real_of_posnat_def)
paulson@14334
   975
apply (drule inj_real_of_preal [THEN injD])
paulson@14334
   976
apply (drule inj_preal_of_prat [THEN injD])
paulson@14334
   977
apply (drule inj_prat_of_pnat [THEN injD])
paulson@14334
   978
apply (erule inj_pnat_of_nat [THEN injD])
paulson@14334
   979
done
paulson@14334
   980
paulson@14334
   981
lemma real_of_nat_zero [simp]: "real (0::nat) = 0"
paulson@14334
   982
by (simp add: real_of_nat_def real_of_posnat_one)
paulson@14334
   983
paulson@14334
   984
lemma real_of_nat_one [simp]: "real (Suc 0) = (1::real)"
paulson@14334
   985
by (simp add: real_of_nat_def real_of_posnat_two real_add_assoc)
paulson@14334
   986
paulson@14334
   987
lemma real_of_nat_add [simp]: 
paulson@14334
   988
     "real (m + n) = real (m::nat) + real n"
paulson@14334
   989
apply (simp add: real_of_nat_def add_ac)
paulson@14334
   990
apply (simp add: real_of_posnat_add add_assoc [symmetric])
paulson@14334
   991
apply (simp add: add_commute) 
paulson@14334
   992
apply (simp add: add_assoc [symmetric])
paulson@14334
   993
done
paulson@14334
   994
paulson@14334
   995
(*Not for addsimps: often the LHS is used to represent a positive natural*)
paulson@14334
   996
lemma real_of_nat_Suc: "real (Suc n) = real n + (1::real)"
paulson@14334
   997
by (simp add: real_of_nat_def real_of_posnat_Suc add_ac)
paulson@14334
   998
paulson@14334
   999
lemma real_of_nat_less_iff [iff]: 
paulson@14334
  1000
     "(real (n::nat) < real m) = (n < m)"
paulson@14334
  1001
by (auto simp add: real_of_nat_def real_of_posnat_def)
paulson@14334
  1002
paulson@14334
  1003
lemma real_of_nat_le_iff [iff]: "(real (n::nat) \<le> real m) = (n \<le> m)"
paulson@14334
  1004
by (simp add: linorder_not_less [symmetric])
paulson@14334
  1005
paulson@14334
  1006
lemma inj_real_of_nat: "inj (real :: nat => real)"
paulson@14334
  1007
apply (rule inj_onI)
paulson@14334
  1008
apply (auto intro!: inj_real_of_posnat [THEN injD]
paulson@14334
  1009
            simp add: real_of_nat_def add_right_cancel)
paulson@14334
  1010
done
paulson@14334
  1011
paulson@14334
  1012
lemma real_of_nat_ge_zero [iff]: "0 \<le> real (n::nat)"
paulson@14334
  1013
apply (induct_tac "n")
paulson@14334
  1014
apply (auto simp add: real_of_nat_Suc)
paulson@14334
  1015
apply (drule real_add_le_less_mono)
paulson@14334
  1016
apply (rule zero_less_one)
paulson@14334
  1017
apply (simp add: order_less_imp_le)
paulson@14334
  1018
done
paulson@14334
  1019
paulson@14334
  1020
lemma real_of_nat_mult [simp]: "real (m * n) = real (m::nat) * real n"
paulson@14334
  1021
apply (induct_tac "m")
paulson@14334
  1022
apply (auto simp add: real_of_nat_Suc left_distrib add_commute)
paulson@14334
  1023
done
paulson@14334
  1024
paulson@14334
  1025
lemma real_of_nat_inject [iff]: "(real (n::nat) = real m) = (n = m)"
paulson@14334
  1026
by (auto dest: inj_real_of_nat [THEN injD])
paulson@14334
  1027
paulson@14334
  1028
lemma real_of_nat_diff [rule_format]:
paulson@14334
  1029
     "n \<le> m --> real (m - n) = real (m::nat) - real n"
paulson@14334
  1030
apply (induct_tac "m", simp)
paulson@14334
  1031
apply (simp add: real_diff_def Suc_diff_le le_Suc_eq real_of_nat_Suc add_ac)
paulson@14334
  1032
apply (simp add: add_left_commute [of _ "- 1"]) 
paulson@14334
  1033
done
paulson@14334
  1034
paulson@14334
  1035
lemma real_of_nat_zero_iff: "(real (n::nat) = 0) = (n = 0)"
paulson@14334
  1036
  proof 
paulson@14334
  1037
    assume "real n = 0"
paulson@14334
  1038
    have "real n = real (0::nat)" by simp
paulson@14334
  1039
    then show "n = 0" by (simp only: real_of_nat_inject)
paulson@14334
  1040
  next
paulson@14334
  1041
    show "n = 0 \<Longrightarrow> real n = 0" by simp
paulson@14334
  1042
  qed
paulson@14334
  1043
paulson@14334
  1044
lemma real_of_nat_neg_int [simp]: "neg z ==> real (nat z) = 0"
paulson@14334
  1045
by (simp add: neg_nat real_of_nat_zero)
paulson@14334
  1046
paulson@14334
  1047
paulson@14334
  1048
lemma real_inverse_unique: "x*y = (1::real) ==> y = inverse x"
paulson@14334
  1049
apply (case_tac "x \<noteq> 0")
paulson@14334
  1050
apply (rule_tac c1 = x in real_mult_left_cancel [THEN iffD1], auto)
paulson@14334
  1051
done
paulson@14334
  1052
paulson@14334
  1053
lemma real_inverse_gt_one: "[| (0::real) < x; x < 1 |] ==> 1 < inverse x"
paulson@14334
  1054
by (auto dest: less_imp_inverse_less)
paulson@14334
  1055
paulson@14334
  1056
lemma real_of_nat_gt_zero_cancel_iff: "(0 < real (n::nat)) = (0 < n)"
paulson@14334
  1057
by (rule real_of_nat_less_iff [THEN subst], auto)
paulson@14334
  1058
declare real_of_nat_gt_zero_cancel_iff [simp]
paulson@14334
  1059
paulson@14334
  1060
lemma real_of_nat_le_zero_cancel_iff: "(real (n::nat) <= 0) = (n = 0)"
paulson@14334
  1061
apply (rule real_of_nat_zero [THEN subst])
paulson@14334
  1062
apply (subst real_of_nat_le_iff, auto)
paulson@14334
  1063
done
paulson@14334
  1064
declare real_of_nat_le_zero_cancel_iff [simp]
paulson@14334
  1065
paulson@14334
  1066
lemma not_real_of_nat_less_zero: "~ real (n::nat) < 0"
paulson@14334
  1067
apply (simp (no_asm) add: real_le_def [symmetric] real_of_nat_ge_zero)
paulson@14334
  1068
done
paulson@14334
  1069
declare not_real_of_nat_less_zero [simp]
paulson@14334
  1070
paulson@14334
  1071
lemma real_of_nat_ge_zero_cancel_iff [simp]: 
paulson@14334
  1072
      "(0 <= real (n::nat)) = (0 <= n)"
paulson@14334
  1073
apply (simp add: real_le_def le_def)
paulson@14334
  1074
done
paulson@14334
  1075
paulson@14334
  1076
lemma real_mult_self_sum_ge_zero: "(0::real) \<le> x*x + y*y"
paulson@14334
  1077
proof -
paulson@14334
  1078
  have "0 + 0 \<le> x*x + y*y" by (blast intro: add_mono zero_le_square)
paulson@14334
  1079
  thus ?thesis by simp
paulson@14334
  1080
qed
paulson@14334
  1081
paulson@14334
  1082
paulson@14334
  1083
ML
paulson@14334
  1084
{*
paulson@14334
  1085
val real_abs_def = thm "real_abs_def";
paulson@14334
  1086
paulson@14334
  1087
val real_less_eq_diff = thm "real_less_eq_diff";
paulson@14334
  1088
paulson@14334
  1089
val real_mult = thm"real_mult";
paulson@14334
  1090
val real_mult_commute = thm"real_mult_commute";
paulson@14334
  1091
val real_mult_assoc = thm"real_mult_assoc";
paulson@14334
  1092
val real_mult_1 = thm"real_mult_1";
paulson@14334
  1093
val real_mult_1_right = thm"real_mult_1_right";
paulson@14334
  1094
val real_minus_mult_commute = thm"real_minus_mult_commute";
paulson@14334
  1095
val preal_le_linear = thm"preal_le_linear";
paulson@14334
  1096
val real_mult_inv_left = thm"real_mult_inv_left";
paulson@14334
  1097
val real_less_not_refl = thm"real_less_not_refl";
paulson@14334
  1098
val real_less_irrefl = thm"real_less_irrefl";
paulson@14334
  1099
val real_not_refl2 = thm"real_not_refl2";
paulson@14334
  1100
val preal_lemma_trans = thm"preal_lemma_trans";
paulson@14334
  1101
val real_less_trans = thm"real_less_trans";
paulson@14334
  1102
val real_less_not_sym = thm"real_less_not_sym";
paulson@14334
  1103
val real_less_asym = thm"real_less_asym";
paulson@14334
  1104
val real_of_preal_add = thm"real_of_preal_add";
paulson@14334
  1105
val real_of_preal_mult = thm"real_of_preal_mult";
paulson@14334
  1106
val real_of_preal_ExI = thm"real_of_preal_ExI";
paulson@14334
  1107
val real_of_preal_ExD = thm"real_of_preal_ExD";
paulson@14334
  1108
val real_of_preal_iff = thm"real_of_preal_iff";
paulson@14334
  1109
val real_of_preal_trichotomy = thm"real_of_preal_trichotomy";
paulson@14334
  1110
val real_of_preal_trichotomyE = thm"real_of_preal_trichotomyE";
paulson@14334
  1111
val real_of_preal_lessD = thm"real_of_preal_lessD";
paulson@14334
  1112
val real_of_preal_lessI = thm"real_of_preal_lessI";
paulson@14334
  1113
val real_of_preal_less_iff1 = thm"real_of_preal_less_iff1";
paulson@14334
  1114
val real_of_preal_minus_less_self = thm"real_of_preal_minus_less_self";
paulson@14334
  1115
val real_of_preal_minus_less_zero = thm"real_of_preal_minus_less_zero";
paulson@14334
  1116
val real_of_preal_not_minus_gt_zero = thm"real_of_preal_not_minus_gt_zero";
paulson@14334
  1117
val real_of_preal_zero_less = thm"real_of_preal_zero_less";
paulson@14334
  1118
val real_of_preal_not_less_zero = thm"real_of_preal_not_less_zero";
paulson@14334
  1119
val real_minus_minus_zero_less = thm"real_minus_minus_zero_less";
paulson@14334
  1120
val real_of_preal_sum_zero_less = thm"real_of_preal_sum_zero_less";
paulson@14334
  1121
val real_of_preal_minus_less_all = thm"real_of_preal_minus_less_all";
paulson@14334
  1122
val real_of_preal_not_minus_gt_all = thm"real_of_preal_not_minus_gt_all";
paulson@14334
  1123
val real_of_preal_minus_less_rev1 = thm"real_of_preal_minus_less_rev1";
paulson@14334
  1124
val real_of_preal_minus_less_rev2 = thm"real_of_preal_minus_less_rev2";
paulson@14334
  1125
val real_linear = thm"real_linear";
paulson@14334
  1126
val real_neq_iff = thm"real_neq_iff";
paulson@14334
  1127
val real_linear_less2 = thm"real_linear_less2";
paulson@14334
  1128
val real_le_imp_less_or_eq = thm"real_le_imp_less_or_eq";
paulson@14334
  1129
val real_less_or_eq_imp_le = thm"real_less_or_eq_imp_le";
paulson@14334
  1130
val real_le_less = thm"real_le_less";
paulson@14334
  1131
val real_le_refl = thm"real_le_refl";
paulson@14334
  1132
val real_le_linear = thm"real_le_linear";
paulson@14334
  1133
val real_le_trans = thm"real_le_trans";
paulson@14334
  1134
val real_le_anti_sym = thm"real_le_anti_sym";
paulson@14334
  1135
val real_less_le = thm"real_less_le";
paulson@14334
  1136
val real_less_sum_gt_zero = thm"real_less_sum_gt_zero";
paulson@14334
  1137
val real_sum_gt_zero_less = thm"real_sum_gt_zero_less";
paulson@14334
  1138
paulson@14334
  1139
val real_gt_zero_preal_Ex = thm "real_gt_zero_preal_Ex";
paulson@14334
  1140
val real_gt_preal_preal_Ex = thm "real_gt_preal_preal_Ex";
paulson@14334
  1141
val real_ge_preal_preal_Ex = thm "real_ge_preal_preal_Ex";
paulson@14334
  1142
val real_less_all_preal = thm "real_less_all_preal";
paulson@14334
  1143
val real_less_all_real2 = thm "real_less_all_real2";
paulson@14334
  1144
val real_of_preal_le_iff = thm "real_of_preal_le_iff";
paulson@14334
  1145
val real_mult_order = thm "real_mult_order";
paulson@14334
  1146
val real_zero_less_one = thm "real_zero_less_one";
paulson@14334
  1147
val real_add_less_le_mono = thm "real_add_less_le_mono";
paulson@14334
  1148
val real_add_le_less_mono = thm "real_add_le_less_mono";
paulson@14334
  1149
val real_add_order = thm "real_add_order";
paulson@14334
  1150
val real_le_add_order = thm "real_le_add_order";
paulson@14334
  1151
val real_le_square = thm "real_le_square";
paulson@14334
  1152
val real_mult_less_mono2 = thm "real_mult_less_mono2";
paulson@14334
  1153
paulson@14334
  1154
val real_mult_less_iff1 = thm "real_mult_less_iff1";
paulson@14334
  1155
val real_mult_le_cancel_iff1 = thm "real_mult_le_cancel_iff1";
paulson@14334
  1156
val real_mult_le_cancel_iff2 = thm "real_mult_le_cancel_iff2";
paulson@14334
  1157
val real_mult_less_mono = thm "real_mult_less_mono";
paulson@14334
  1158
val real_mult_less_mono' = thm "real_mult_less_mono'";
paulson@14334
  1159
val real_sum_squares_cancel = thm "real_sum_squares_cancel";
paulson@14334
  1160
val real_sum_squares_cancel2 = thm "real_sum_squares_cancel2";
paulson@14334
  1161
paulson@14334
  1162
val real_mult_left_cancel = thm"real_mult_left_cancel";
paulson@14334
  1163
val real_mult_right_cancel = thm"real_mult_right_cancel";
paulson@14334
  1164
val real_of_posnat_one = thm "real_of_posnat_one";
paulson@14334
  1165
val real_of_posnat_two = thm "real_of_posnat_two";
paulson@14334
  1166
val real_of_posnat_add = thm "real_of_posnat_add";
paulson@14334
  1167
val real_of_posnat_add_one = thm "real_of_posnat_add_one";
paulson@14334
  1168
val real_of_nat_zero = thm "real_of_nat_zero";
paulson@14334
  1169
val real_of_nat_one = thm "real_of_nat_one";
paulson@14334
  1170
val real_of_nat_add = thm "real_of_nat_add";
paulson@14334
  1171
val real_of_nat_Suc = thm "real_of_nat_Suc";
paulson@14334
  1172
val real_of_nat_less_iff = thm "real_of_nat_less_iff";
paulson@14334
  1173
val real_of_nat_le_iff = thm "real_of_nat_le_iff";
paulson@14334
  1174
val inj_real_of_nat = thm "inj_real_of_nat";
paulson@14334
  1175
val real_of_nat_ge_zero = thm "real_of_nat_ge_zero";
paulson@14334
  1176
val real_of_nat_mult = thm "real_of_nat_mult";
paulson@14334
  1177
val real_of_nat_inject = thm "real_of_nat_inject";
paulson@14334
  1178
val real_of_nat_diff = thm "real_of_nat_diff";
paulson@14334
  1179
val real_of_nat_zero_iff = thm "real_of_nat_zero_iff";
paulson@14334
  1180
val real_of_nat_neg_int = thm "real_of_nat_neg_int";
paulson@14334
  1181
val real_inverse_unique = thm "real_inverse_unique";
paulson@14334
  1182
val real_inverse_gt_one = thm "real_inverse_gt_one";
paulson@14334
  1183
val real_of_nat_gt_zero_cancel_iff = thm "real_of_nat_gt_zero_cancel_iff";
paulson@14334
  1184
val real_of_nat_le_zero_cancel_iff = thm "real_of_nat_le_zero_cancel_iff";
paulson@14334
  1185
val not_real_of_nat_less_zero = thm "not_real_of_nat_less_zero";
paulson@14334
  1186
val real_of_nat_ge_zero_cancel_iff = thm "real_of_nat_ge_zero_cancel_iff";
paulson@14334
  1187
*}
paulson@10752
  1188
paulson@5588
  1189
end