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