src/HOL/Ring_and_Field.thy
author paulson
Mon Jan 12 16:51:45 2004 +0100 (2004-01-12)
changeset 14353 79f9fbef9106
parent 14348 744c868ee0b7
child 14365 3d4df8c166ae
permissions -rw-r--r--
Added lemmas to Ring_and_Field with slightly modified simplification rules

Deleted some little-used integer theorems, replacing them by the generic ones
in Ring_and_Field

Consolidated integer powers
paulson@14265
     1
(*  Title:   HOL/Ring_and_Field.thy
paulson@14265
     2
    ID:      $Id$
paulson@14265
     3
    Author:  Gertrud Bauer and Markus Wenzel, TU Muenchen
paulson@14269
     4
             Lawrence C Paulson, University of Cambridge
paulson@14265
     5
    License: GPL (GNU GENERAL PUBLIC LICENSE)
paulson@14265
     6
*)
paulson@14265
     7
paulson@14265
     8
header {*
paulson@14265
     9
  \title{Ring and field structures}
paulson@14353
    10
  \author{Gertrud Bauer, L. C. Paulson and Markus Wenzel}
paulson@14265
    11
*}
paulson@14265
    12
paulson@14265
    13
theory Ring_and_Field = Inductive:
paulson@14265
    14
paulson@14265
    15
subsection {* Abstract algebraic structures *}
paulson@14265
    16
paulson@14265
    17
axclass semiring \<subseteq> zero, one, plus, times
paulson@14265
    18
  add_assoc: "(a + b) + c = a + (b + c)"
paulson@14265
    19
  add_commute: "a + b = b + a"
paulson@14288
    20
  add_0 [simp]: "0 + a = a"
paulson@14341
    21
  add_left_imp_eq: "a + b = a + c ==> b=c"
paulson@14341
    22
    --{*This axiom is needed for semirings only: for rings, etc., it is
paulson@14341
    23
        redundant. Including it allows many more of the following results
paulson@14341
    24
        to be proved for semirings too. The drawback is that this redundant
paulson@14341
    25
        axiom must be proved for instances of rings.*}
paulson@14265
    26
paulson@14265
    27
  mult_assoc: "(a * b) * c = a * (b * c)"
paulson@14265
    28
  mult_commute: "a * b = b * a"
paulson@14267
    29
  mult_1 [simp]: "1 * a = a"
paulson@14265
    30
paulson@14265
    31
  left_distrib: "(a + b) * c = a * c + b * c"
paulson@14265
    32
  zero_neq_one [simp]: "0 \<noteq> 1"
paulson@14265
    33
paulson@14265
    34
axclass ring \<subseteq> semiring, minus
paulson@14265
    35
  left_minus [simp]: "- a + a = 0"
paulson@14265
    36
  diff_minus: "a - b = a + (-b)"
paulson@14265
    37
paulson@14265
    38
axclass ordered_semiring \<subseteq> semiring, linorder
paulson@14348
    39
  zero_less_one: "0 < 1" --{*This axiom too is needed for semirings only.*}
paulson@14265
    40
  add_left_mono: "a \<le> b ==> c + a \<le> c + b"
paulson@14265
    41
  mult_strict_left_mono: "a < b ==> 0 < c ==> c * a < c * b"
paulson@14265
    42
paulson@14265
    43
axclass ordered_ring \<subseteq> ordered_semiring, ring
paulson@14265
    44
  abs_if: "\<bar>a\<bar> = (if a < 0 then -a else a)"
paulson@14265
    45
paulson@14265
    46
axclass field \<subseteq> ring, inverse
paulson@14265
    47
  left_inverse [simp]: "a \<noteq> 0 ==> inverse a * a = 1"
paulson@14265
    48
  divide_inverse:      "b \<noteq> 0 ==> a / b = a * inverse b"
paulson@14265
    49
paulson@14265
    50
axclass ordered_field \<subseteq> ordered_ring, field
paulson@14265
    51
paulson@14265
    52
axclass division_by_zero \<subseteq> zero, inverse
paulson@14268
    53
  inverse_zero [simp]: "inverse 0 = 0"
paulson@14268
    54
  divide_zero [simp]: "a / 0 = 0"
paulson@14265
    55
paulson@14265
    56
paulson@14270
    57
subsection {* Derived Rules for Addition *}
paulson@14265
    58
paulson@14288
    59
lemma add_0_right [simp]: "a + 0 = (a::'a::semiring)"
paulson@14265
    60
proof -
paulson@14265
    61
  have "a + 0 = 0 + a" by (simp only: add_commute)
paulson@14265
    62
  also have "... = a" by simp
paulson@14265
    63
  finally show ?thesis .
paulson@14265
    64
qed
paulson@14265
    65
paulson@14265
    66
lemma add_left_commute: "a + (b + c) = b + (a + (c::'a::semiring))"
paulson@14265
    67
  by (rule mk_left_commute [of "op +", OF add_assoc add_commute])
paulson@14265
    68
paulson@14265
    69
theorems add_ac = add_assoc add_commute add_left_commute
paulson@14265
    70
paulson@14265
    71
lemma right_minus [simp]: "a + -(a::'a::ring) = 0"
paulson@14265
    72
proof -
paulson@14265
    73
  have "a + -a = -a + a" by (simp add: add_ac)
paulson@14265
    74
  also have "... = 0" by simp
paulson@14265
    75
  finally show ?thesis .
paulson@14265
    76
qed
paulson@14265
    77
paulson@14265
    78
lemma right_minus_eq: "(a - b = 0) = (a = (b::'a::ring))"
paulson@14265
    79
proof
paulson@14265
    80
  have "a = a - b + b" by (simp add: diff_minus add_ac)
paulson@14265
    81
  also assume "a - b = 0"
paulson@14265
    82
  finally show "a = b" by simp
paulson@14265
    83
next
paulson@14265
    84
  assume "a = b"
paulson@14265
    85
  thus "a - b = 0" by (simp add: diff_minus)
paulson@14265
    86
qed
paulson@14265
    87
paulson@14265
    88
lemma add_left_cancel [simp]:
paulson@14341
    89
     "(a + b = a + c) = (b = (c::'a::semiring))"
paulson@14341
    90
by (blast dest: add_left_imp_eq) 
paulson@14265
    91
paulson@14265
    92
lemma add_right_cancel [simp]:
paulson@14341
    93
     "(b + a = c + a) = (b = (c::'a::semiring))"
paulson@14265
    94
  by (simp add: add_commute)
paulson@14265
    95
paulson@14265
    96
lemma minus_minus [simp]: "- (- (a::'a::ring)) = a"
paulson@14265
    97
  proof (rule add_left_cancel [of "-a", THEN iffD1])
paulson@14265
    98
    show "(-a + -(-a) = -a + a)"
paulson@14265
    99
    by simp
paulson@14265
   100
  qed
paulson@14265
   101
paulson@14265
   102
lemma equals_zero_I: "a+b = 0 ==> -a = (b::'a::ring)"
paulson@14265
   103
apply (rule right_minus_eq [THEN iffD1, symmetric])
paulson@14265
   104
apply (simp add: diff_minus add_commute) 
paulson@14265
   105
done
paulson@14265
   106
paulson@14265
   107
lemma minus_zero [simp]: "- 0 = (0::'a::ring)"
paulson@14265
   108
by (simp add: equals_zero_I)
paulson@14265
   109
paulson@14270
   110
lemma diff_self [simp]: "a - (a::'a::ring) = 0"
paulson@14270
   111
  by (simp add: diff_minus)
paulson@14270
   112
paulson@14270
   113
lemma diff_0 [simp]: "(0::'a::ring) - a = -a"
paulson@14270
   114
by (simp add: diff_minus)
paulson@14270
   115
paulson@14270
   116
lemma diff_0_right [simp]: "a - (0::'a::ring) = a" 
paulson@14270
   117
by (simp add: diff_minus)
paulson@14270
   118
paulson@14288
   119
lemma diff_minus_eq_add [simp]: "a - - b = a + (b::'a::ring)"
paulson@14288
   120
by (simp add: diff_minus)
paulson@14288
   121
paulson@14265
   122
lemma neg_equal_iff_equal [simp]: "(-a = -b) = (a = (b::'a::ring))" 
paulson@14265
   123
  proof 
paulson@14265
   124
    assume "- a = - b"
paulson@14268
   125
    hence "- (- a) = - (- b)"
paulson@14265
   126
      by simp
paulson@14266
   127
    thus "a=b" by simp
paulson@14265
   128
  next
paulson@14265
   129
    assume "a=b"
paulson@14266
   130
    thus "-a = -b" by simp
paulson@14265
   131
  qed
paulson@14265
   132
paulson@14265
   133
lemma neg_equal_0_iff_equal [simp]: "(-a = 0) = (a = (0::'a::ring))"
paulson@14265
   134
by (subst neg_equal_iff_equal [symmetric], simp)
paulson@14265
   135
paulson@14265
   136
lemma neg_0_equal_iff_equal [simp]: "(0 = -a) = (0 = (a::'a::ring))"
paulson@14265
   137
by (subst neg_equal_iff_equal [symmetric], simp)
paulson@14265
   138
paulson@14272
   139
text{*The next two equations can make the simplifier loop!*}
paulson@14272
   140
paulson@14272
   141
lemma equation_minus_iff: "(a = - b) = (b = - (a::'a::ring))"
paulson@14272
   142
  proof -
paulson@14272
   143
  have "(- (-a) = - b) = (- a = b)" by (rule neg_equal_iff_equal)
paulson@14272
   144
  thus ?thesis by (simp add: eq_commute)
paulson@14272
   145
  qed
paulson@14272
   146
paulson@14272
   147
lemma minus_equation_iff: "(- a = b) = (- (b::'a::ring) = a)"
paulson@14272
   148
  proof -
paulson@14272
   149
  have "(- a = - (-b)) = (a = -b)" by (rule neg_equal_iff_equal)
paulson@14272
   150
  thus ?thesis by (simp add: eq_commute)
paulson@14272
   151
  qed
paulson@14272
   152
paulson@14265
   153
paulson@14265
   154
subsection {* Derived rules for multiplication *}
paulson@14265
   155
paulson@14267
   156
lemma mult_1_right [simp]: "a * (1::'a::semiring) = a"
paulson@14265
   157
proof -
paulson@14267
   158
  have "a * 1 = 1 * a" by (simp add: mult_commute)
paulson@14267
   159
  also have "... = a" by simp
paulson@14265
   160
  finally show ?thesis .
paulson@14265
   161
qed
paulson@14265
   162
paulson@14265
   163
lemma mult_left_commute: "a * (b * c) = b * (a * (c::'a::semiring))"
paulson@14265
   164
  by (rule mk_left_commute [of "op *", OF mult_assoc mult_commute])
paulson@14265
   165
paulson@14265
   166
theorems mult_ac = mult_assoc mult_commute mult_left_commute
paulson@14265
   167
paulson@14353
   168
lemma mult_zero_left [simp]: "0 * a = (0::'a::semiring)"
paulson@14265
   169
proof -
paulson@14265
   170
  have "0*a + 0*a = 0*a + 0"
paulson@14265
   171
    by (simp add: left_distrib [symmetric])
paulson@14266
   172
  thus ?thesis by (simp only: add_left_cancel)
paulson@14265
   173
qed
paulson@14265
   174
paulson@14353
   175
lemma mult_zero_right [simp]: "a * 0 = (0::'a::semiring)"
paulson@14265
   176
  by (simp add: mult_commute)
paulson@14265
   177
paulson@14265
   178
paulson@14265
   179
subsection {* Distribution rules *}
paulson@14265
   180
paulson@14265
   181
lemma right_distrib: "a * (b + c) = a * b + a * (c::'a::semiring)"
paulson@14265
   182
proof -
paulson@14265
   183
  have "a * (b + c) = (b + c) * a" by (simp add: mult_ac)
paulson@14265
   184
  also have "... = b * a + c * a" by (simp only: left_distrib)
paulson@14265
   185
  also have "... = a * b + a * c" by (simp add: mult_ac)
paulson@14265
   186
  finally show ?thesis .
paulson@14265
   187
qed
paulson@14265
   188
paulson@14265
   189
theorems ring_distrib = right_distrib left_distrib
paulson@14265
   190
paulson@14272
   191
text{*For the @{text combine_numerals} simproc*}
paulson@14272
   192
lemma combine_common_factor: "a*e + (b*e + c) = (a+b)*e + (c::'a::semiring)"
paulson@14272
   193
by (simp add: left_distrib add_ac)
paulson@14272
   194
paulson@14265
   195
lemma minus_add_distrib [simp]: "- (a + b) = -a + -(b::'a::ring)"
paulson@14265
   196
apply (rule equals_zero_I)
paulson@14265
   197
apply (simp add: add_ac) 
paulson@14265
   198
done
paulson@14265
   199
paulson@14265
   200
lemma minus_mult_left: "- (a * b) = (-a) * (b::'a::ring)"
paulson@14265
   201
apply (rule equals_zero_I)
paulson@14265
   202
apply (simp add: left_distrib [symmetric]) 
paulson@14265
   203
done
paulson@14265
   204
paulson@14265
   205
lemma minus_mult_right: "- (a * b) = a * -(b::'a::ring)"
paulson@14265
   206
apply (rule equals_zero_I)
paulson@14265
   207
apply (simp add: right_distrib [symmetric]) 
paulson@14265
   208
done
paulson@14265
   209
paulson@14268
   210
lemma minus_mult_minus [simp]: "(- a) * (- b) = a * (b::'a::ring)"
paulson@14268
   211
  by (simp add: minus_mult_left [symmetric] minus_mult_right [symmetric])
paulson@14268
   212
paulson@14265
   213
lemma right_diff_distrib: "a * (b - c) = a * b - a * (c::'a::ring)"
paulson@14265
   214
by (simp add: right_distrib diff_minus 
paulson@14265
   215
              minus_mult_left [symmetric] minus_mult_right [symmetric]) 
paulson@14265
   216
paulson@14272
   217
lemma left_diff_distrib: "(a - b) * c = a * c - b * (c::'a::ring)"
paulson@14272
   218
by (simp add: mult_commute [of _ c] right_diff_distrib) 
paulson@14272
   219
paulson@14270
   220
lemma minus_diff_eq [simp]: "- (a - b) = b - (a::'a::ring)"
paulson@14270
   221
by (simp add: diff_minus add_commute) 
paulson@14265
   222
paulson@14270
   223
paulson@14270
   224
subsection {* Ordering Rules for Addition *}
paulson@14265
   225
paulson@14265
   226
lemma add_right_mono: "a \<le> (b::'a::ordered_semiring) ==> a + c \<le> b + c"
paulson@14265
   227
by (simp add: add_commute [of _ c] add_left_mono)
paulson@14265
   228
paulson@14267
   229
text {* non-strict, in both arguments *}
paulson@14267
   230
lemma add_mono: "[|a \<le> b;  c \<le> d|] ==> a + c \<le> b + (d::'a::ordered_semiring)"
paulson@14267
   231
  apply (erule add_right_mono [THEN order_trans])
paulson@14267
   232
  apply (simp add: add_commute add_left_mono)
paulson@14267
   233
  done
paulson@14267
   234
paulson@14268
   235
lemma add_strict_left_mono:
paulson@14341
   236
     "a < b ==> c + a < c + (b::'a::ordered_semiring)"
paulson@14268
   237
 by (simp add: order_less_le add_left_mono) 
paulson@14268
   238
paulson@14268
   239
lemma add_strict_right_mono:
paulson@14341
   240
     "a < b ==> a + c < b + (c::'a::ordered_semiring)"
paulson@14268
   241
 by (simp add: add_commute [of _ c] add_strict_left_mono)
paulson@14268
   242
paulson@14268
   243
text{*Strict monotonicity in both arguments*}
paulson@14341
   244
lemma add_strict_mono: "[|a<b; c<d|] ==> a + c < b + (d::'a::ordered_semiring)"
paulson@14268
   245
apply (erule add_strict_right_mono [THEN order_less_trans])
paulson@14268
   246
apply (erule add_strict_left_mono)
paulson@14268
   247
done
paulson@14268
   248
paulson@14341
   249
lemma add_less_le_mono: "[| a<b; c\<le>d |] ==> a + c < b + (d::'a::ordered_semiring)"
paulson@14341
   250
apply (erule add_strict_right_mono [THEN order_less_le_trans])
paulson@14341
   251
apply (erule add_left_mono) 
paulson@14341
   252
done
paulson@14341
   253
paulson@14341
   254
lemma add_le_less_mono:
paulson@14341
   255
     "[| a\<le>b; c<d |] ==> a + c < b + (d::'a::ordered_semiring)"
paulson@14341
   256
apply (erule add_right_mono [THEN order_le_less_trans])
paulson@14341
   257
apply (erule add_strict_left_mono) 
paulson@14341
   258
done
paulson@14341
   259
paulson@14270
   260
lemma add_less_imp_less_left:
paulson@14341
   261
      assumes less: "c + a < c + b"  shows "a < (b::'a::ordered_semiring)"
paulson@14341
   262
  proof (rule ccontr)
paulson@14341
   263
    assume "~ a < b"
paulson@14341
   264
    hence "b \<le> a" by (simp add: linorder_not_less)
paulson@14341
   265
    hence "c+b \<le> c+a" by (rule add_left_mono)
paulson@14341
   266
    with this and less show False 
paulson@14341
   267
      by (simp add: linorder_not_less [symmetric])
paulson@14270
   268
  qed
paulson@14270
   269
paulson@14270
   270
lemma add_less_imp_less_right:
paulson@14341
   271
      "a + c < b + c ==> a < (b::'a::ordered_semiring)"
paulson@14270
   272
apply (rule add_less_imp_less_left [of c])
paulson@14270
   273
apply (simp add: add_commute)  
paulson@14270
   274
done
paulson@14270
   275
paulson@14270
   276
lemma add_less_cancel_left [simp]:
paulson@14341
   277
    "(c+a < c+b) = (a < (b::'a::ordered_semiring))"
paulson@14270
   278
by (blast intro: add_less_imp_less_left add_strict_left_mono) 
paulson@14270
   279
paulson@14270
   280
lemma add_less_cancel_right [simp]:
paulson@14341
   281
    "(a+c < b+c) = (a < (b::'a::ordered_semiring))"
paulson@14270
   282
by (blast intro: add_less_imp_less_right add_strict_right_mono)
paulson@14270
   283
paulson@14270
   284
lemma add_le_cancel_left [simp]:
paulson@14341
   285
    "(c+a \<le> c+b) = (a \<le> (b::'a::ordered_semiring))"
paulson@14270
   286
by (simp add: linorder_not_less [symmetric]) 
paulson@14270
   287
paulson@14270
   288
lemma add_le_cancel_right [simp]:
paulson@14341
   289
    "(a+c \<le> b+c) = (a \<le> (b::'a::ordered_semiring))"
paulson@14270
   290
by (simp add: linorder_not_less [symmetric]) 
paulson@14270
   291
paulson@14270
   292
lemma add_le_imp_le_left:
paulson@14341
   293
      "c + a \<le> c + b ==> a \<le> (b::'a::ordered_semiring)"
paulson@14270
   294
by simp
paulson@14270
   295
paulson@14270
   296
lemma add_le_imp_le_right:
paulson@14341
   297
      "a + c \<le> b + c ==> a \<le> (b::'a::ordered_semiring)"
paulson@14270
   298
by simp
paulson@14270
   299
paulson@14270
   300
paulson@14270
   301
subsection {* Ordering Rules for Unary Minus *}
paulson@14270
   302
paulson@14265
   303
lemma le_imp_neg_le:
paulson@14269
   304
      assumes "a \<le> (b::'a::ordered_ring)" shows "-b \<le> -a"
paulson@14265
   305
  proof -
paulson@14265
   306
  have "-a+a \<le> -a+b"
paulson@14265
   307
    by (rule add_left_mono) 
paulson@14268
   308
  hence "0 \<le> -a+b"
paulson@14265
   309
    by simp
paulson@14268
   310
  hence "0 + (-b) \<le> (-a + b) + (-b)"
paulson@14265
   311
    by (rule add_right_mono) 
paulson@14266
   312
  thus ?thesis
paulson@14265
   313
    by (simp add: add_assoc)
paulson@14265
   314
  qed
paulson@14265
   315
paulson@14265
   316
lemma neg_le_iff_le [simp]: "(-b \<le> -a) = (a \<le> (b::'a::ordered_ring))"
paulson@14265
   317
  proof 
paulson@14265
   318
    assume "- b \<le> - a"
paulson@14268
   319
    hence "- (- a) \<le> - (- b)"
paulson@14265
   320
      by (rule le_imp_neg_le)
paulson@14266
   321
    thus "a\<le>b" by simp
paulson@14265
   322
  next
paulson@14265
   323
    assume "a\<le>b"
paulson@14266
   324
    thus "-b \<le> -a" by (rule le_imp_neg_le)
paulson@14265
   325
  qed
paulson@14265
   326
paulson@14265
   327
lemma neg_le_0_iff_le [simp]: "(-a \<le> 0) = (0 \<le> (a::'a::ordered_ring))"
paulson@14265
   328
by (subst neg_le_iff_le [symmetric], simp)
paulson@14265
   329
paulson@14265
   330
lemma neg_0_le_iff_le [simp]: "(0 \<le> -a) = (a \<le> (0::'a::ordered_ring))"
paulson@14265
   331
by (subst neg_le_iff_le [symmetric], simp)
paulson@14265
   332
paulson@14265
   333
lemma neg_less_iff_less [simp]: "(-b < -a) = (a < (b::'a::ordered_ring))"
paulson@14265
   334
by (force simp add: order_less_le) 
paulson@14265
   335
paulson@14265
   336
lemma neg_less_0_iff_less [simp]: "(-a < 0) = (0 < (a::'a::ordered_ring))"
paulson@14265
   337
by (subst neg_less_iff_less [symmetric], simp)
paulson@14265
   338
paulson@14265
   339
lemma neg_0_less_iff_less [simp]: "(0 < -a) = (a < (0::'a::ordered_ring))"
paulson@14265
   340
by (subst neg_less_iff_less [symmetric], simp)
paulson@14265
   341
paulson@14272
   342
text{*The next several equations can make the simplifier loop!*}
paulson@14272
   343
paulson@14272
   344
lemma less_minus_iff: "(a < - b) = (b < - (a::'a::ordered_ring))"
paulson@14272
   345
  proof -
paulson@14272
   346
  have "(- (-a) < - b) = (b < - a)" by (rule neg_less_iff_less)
paulson@14272
   347
  thus ?thesis by simp
paulson@14272
   348
  qed
paulson@14272
   349
paulson@14272
   350
lemma minus_less_iff: "(- a < b) = (- b < (a::'a::ordered_ring))"
paulson@14272
   351
  proof -
paulson@14272
   352
  have "(- a < - (-b)) = (- b < a)" by (rule neg_less_iff_less)
paulson@14272
   353
  thus ?thesis by simp
paulson@14272
   354
  qed
paulson@14272
   355
paulson@14272
   356
lemma le_minus_iff: "(a \<le> - b) = (b \<le> - (a::'a::ordered_ring))"
paulson@14272
   357
apply (simp add: linorder_not_less [symmetric])
paulson@14272
   358
apply (rule minus_less_iff) 
paulson@14272
   359
done
paulson@14272
   360
paulson@14272
   361
lemma minus_le_iff: "(- a \<le> b) = (- b \<le> (a::'a::ordered_ring))"
paulson@14272
   362
apply (simp add: linorder_not_less [symmetric])
paulson@14272
   363
apply (rule less_minus_iff) 
paulson@14272
   364
done
paulson@14272
   365
paulson@14270
   366
paulson@14270
   367
subsection{*Subtraction Laws*}
paulson@14270
   368
paulson@14270
   369
lemma add_diff_eq: "a + (b - c) = (a + b) - (c::'a::ring)"
paulson@14270
   370
by (simp add: diff_minus add_ac)
paulson@14270
   371
paulson@14270
   372
lemma diff_add_eq: "(a - b) + c = (a + c) - (b::'a::ring)"
paulson@14270
   373
by (simp add: diff_minus add_ac)
paulson@14270
   374
paulson@14270
   375
lemma diff_eq_eq: "(a-b = c) = (a = c + (b::'a::ring))"
paulson@14270
   376
by (auto simp add: diff_minus add_assoc)
paulson@14270
   377
paulson@14270
   378
lemma eq_diff_eq: "(a = c-b) = (a + (b::'a::ring) = c)"
paulson@14270
   379
by (auto simp add: diff_minus add_assoc)
paulson@14270
   380
paulson@14270
   381
lemma diff_diff_eq: "(a - b) - c = a - (b + (c::'a::ring))"
paulson@14270
   382
by (simp add: diff_minus add_ac)
paulson@14270
   383
paulson@14270
   384
lemma diff_diff_eq2: "a - (b - c) = (a + c) - (b::'a::ring)"
paulson@14270
   385
by (simp add: diff_minus add_ac)
paulson@14270
   386
paulson@14270
   387
text{*Further subtraction laws for ordered rings*}
paulson@14270
   388
paulson@14272
   389
lemma less_iff_diff_less_0: "(a < b) = (a - b < (0::'a::ordered_ring))"
paulson@14270
   390
proof -
paulson@14270
   391
  have  "(a < b) = (a + (- b) < b + (-b))"  
paulson@14270
   392
    by (simp only: add_less_cancel_right)
paulson@14270
   393
  also have "... =  (a - b < 0)" by (simp add: diff_minus)
paulson@14270
   394
  finally show ?thesis .
paulson@14270
   395
qed
paulson@14270
   396
paulson@14270
   397
lemma diff_less_eq: "(a-b < c) = (a < c + (b::'a::ordered_ring))"
paulson@14272
   398
apply (subst less_iff_diff_less_0)
paulson@14272
   399
apply (rule less_iff_diff_less_0 [of _ c, THEN ssubst])
paulson@14270
   400
apply (simp add: diff_minus add_ac)
paulson@14270
   401
done
paulson@14270
   402
paulson@14270
   403
lemma less_diff_eq: "(a < c-b) = (a + (b::'a::ordered_ring) < c)"
paulson@14272
   404
apply (subst less_iff_diff_less_0)
paulson@14272
   405
apply (rule less_iff_diff_less_0 [of _ "c-b", THEN ssubst])
paulson@14270
   406
apply (simp add: diff_minus add_ac)
paulson@14270
   407
done
paulson@14270
   408
paulson@14270
   409
lemma diff_le_eq: "(a-b \<le> c) = (a \<le> c + (b::'a::ordered_ring))"
paulson@14270
   410
by (simp add: linorder_not_less [symmetric] less_diff_eq)
paulson@14270
   411
paulson@14270
   412
lemma le_diff_eq: "(a \<le> c-b) = (a + (b::'a::ordered_ring) \<le> c)"
paulson@14270
   413
by (simp add: linorder_not_less [symmetric] diff_less_eq)
paulson@14270
   414
paulson@14270
   415
text{*This list of rewrites simplifies (in)equalities by bringing subtractions
paulson@14270
   416
  to the top and then moving negative terms to the other side.
paulson@14270
   417
  Use with @{text add_ac}*}
paulson@14270
   418
lemmas compare_rls =
paulson@14270
   419
       diff_minus [symmetric]
paulson@14270
   420
       add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
paulson@14270
   421
       diff_less_eq less_diff_eq diff_le_eq le_diff_eq
paulson@14270
   422
       diff_eq_eq eq_diff_eq
paulson@14270
   423
paulson@14270
   424
paulson@14272
   425
subsection{*Lemmas for the @{text cancel_numerals} simproc*}
paulson@14272
   426
paulson@14272
   427
lemma eq_iff_diff_eq_0: "(a = b) = (a-b = (0::'a::ring))"
paulson@14272
   428
by (simp add: compare_rls)
paulson@14272
   429
paulson@14272
   430
lemma le_iff_diff_le_0: "(a \<le> b) = (a-b \<le> (0::'a::ordered_ring))"
paulson@14272
   431
by (simp add: compare_rls)
paulson@14272
   432
paulson@14272
   433
lemma eq_add_iff1:
paulson@14272
   434
     "(a*e + c = b*e + d) = ((a-b)*e + c = (d::'a::ring))"
paulson@14272
   435
apply (simp add: diff_minus left_distrib add_ac)
paulson@14272
   436
apply (simp add: compare_rls minus_mult_left [symmetric]) 
paulson@14272
   437
done
paulson@14272
   438
paulson@14272
   439
lemma eq_add_iff2:
paulson@14272
   440
     "(a*e + c = b*e + d) = (c = (b-a)*e + (d::'a::ring))"
paulson@14272
   441
apply (simp add: diff_minus left_distrib add_ac)
paulson@14272
   442
apply (simp add: compare_rls minus_mult_left [symmetric]) 
paulson@14272
   443
done
paulson@14272
   444
paulson@14272
   445
lemma less_add_iff1:
paulson@14272
   446
     "(a*e + c < b*e + d) = ((a-b)*e + c < (d::'a::ordered_ring))"
paulson@14272
   447
apply (simp add: diff_minus left_distrib add_ac)
paulson@14272
   448
apply (simp add: compare_rls minus_mult_left [symmetric]) 
paulson@14272
   449
done
paulson@14272
   450
paulson@14272
   451
lemma less_add_iff2:
paulson@14272
   452
     "(a*e + c < b*e + d) = (c < (b-a)*e + (d::'a::ordered_ring))"
paulson@14272
   453
apply (simp add: diff_minus left_distrib add_ac)
paulson@14272
   454
apply (simp add: compare_rls minus_mult_left [symmetric]) 
paulson@14272
   455
done
paulson@14272
   456
paulson@14272
   457
lemma le_add_iff1:
paulson@14272
   458
     "(a*e + c \<le> b*e + d) = ((a-b)*e + c \<le> (d::'a::ordered_ring))"
paulson@14272
   459
apply (simp add: diff_minus left_distrib add_ac)
paulson@14272
   460
apply (simp add: compare_rls minus_mult_left [symmetric]) 
paulson@14272
   461
done
paulson@14272
   462
paulson@14272
   463
lemma le_add_iff2:
paulson@14272
   464
     "(a*e + c \<le> b*e + d) = (c \<le> (b-a)*e + (d::'a::ordered_ring))"
paulson@14272
   465
apply (simp add: diff_minus left_distrib add_ac)
paulson@14272
   466
apply (simp add: compare_rls minus_mult_left [symmetric]) 
paulson@14272
   467
done
paulson@14272
   468
paulson@14272
   469
paulson@14270
   470
subsection {* Ordering Rules for Multiplication *}
paulson@14270
   471
paulson@14265
   472
lemma mult_strict_right_mono:
paulson@14265
   473
     "[|a < b; 0 < c|] ==> a * c < b * (c::'a::ordered_semiring)"
paulson@14265
   474
by (simp add: mult_commute [of _ c] mult_strict_left_mono)
paulson@14265
   475
paulson@14265
   476
lemma mult_left_mono:
paulson@14341
   477
     "[|a \<le> b; 0 \<le> c|] ==> c * a \<le> c * (b::'a::ordered_semiring)"
paulson@14267
   478
  apply (case_tac "c=0", simp)
paulson@14267
   479
  apply (force simp add: mult_strict_left_mono order_le_less) 
paulson@14267
   480
  done
paulson@14265
   481
paulson@14265
   482
lemma mult_right_mono:
paulson@14341
   483
     "[|a \<le> b; 0 \<le> c|] ==> a*c \<le> b * (c::'a::ordered_semiring)"
paulson@14267
   484
  by (simp add: mult_left_mono mult_commute [of _ c]) 
paulson@14265
   485
paulson@14348
   486
lemma mult_left_le_imp_le:
paulson@14348
   487
     "[|c*a \<le> c*b; 0 < c|] ==> a \<le> (b::'a::ordered_semiring)"
paulson@14348
   488
  by (force simp add: mult_strict_left_mono linorder_not_less [symmetric])
paulson@14348
   489
 
paulson@14348
   490
lemma mult_right_le_imp_le:
paulson@14348
   491
     "[|a*c \<le> b*c; 0 < c|] ==> a \<le> (b::'a::ordered_semiring)"
paulson@14348
   492
  by (force simp add: mult_strict_right_mono linorder_not_less [symmetric])
paulson@14348
   493
paulson@14348
   494
lemma mult_left_less_imp_less:
paulson@14348
   495
     "[|c*a < c*b; 0 \<le> c|] ==> a < (b::'a::ordered_semiring)"
paulson@14348
   496
  by (force simp add: mult_left_mono linorder_not_le [symmetric])
paulson@14348
   497
 
paulson@14348
   498
lemma mult_right_less_imp_less:
paulson@14348
   499
     "[|a*c < b*c; 0 \<le> c|] ==> a < (b::'a::ordered_semiring)"
paulson@14348
   500
  by (force simp add: mult_right_mono linorder_not_le [symmetric])
paulson@14348
   501
paulson@14265
   502
lemma mult_strict_left_mono_neg:
paulson@14265
   503
     "[|b < a; c < 0|] ==> c * a < c * (b::'a::ordered_ring)"
paulson@14265
   504
apply (drule mult_strict_left_mono [of _ _ "-c"])
paulson@14265
   505
apply (simp_all add: minus_mult_left [symmetric]) 
paulson@14265
   506
done
paulson@14265
   507
paulson@14265
   508
lemma mult_strict_right_mono_neg:
paulson@14265
   509
     "[|b < a; c < 0|] ==> a * c < b * (c::'a::ordered_ring)"
paulson@14265
   510
apply (drule mult_strict_right_mono [of _ _ "-c"])
paulson@14265
   511
apply (simp_all add: minus_mult_right [symmetric]) 
paulson@14265
   512
done
paulson@14265
   513
paulson@14265
   514
paulson@14265
   515
subsection{* Products of Signs *}
paulson@14265
   516
paulson@14341
   517
lemma mult_pos: "[| (0::'a::ordered_semiring) < a; 0 < b |] ==> 0 < a*b"
paulson@14265
   518
by (drule mult_strict_left_mono [of 0 b], auto)
paulson@14265
   519
paulson@14341
   520
lemma mult_pos_neg: "[| (0::'a::ordered_semiring) < a; b < 0 |] ==> a*b < 0"
paulson@14265
   521
by (drule mult_strict_left_mono [of b 0], auto)
paulson@14265
   522
paulson@14265
   523
lemma mult_neg: "[| a < (0::'a::ordered_ring); b < 0 |] ==> 0 < a*b"
paulson@14265
   524
by (drule mult_strict_right_mono_neg, auto)
paulson@14265
   525
paulson@14341
   526
lemma zero_less_mult_pos:
paulson@14341
   527
     "[| 0 < a*b; 0 < a|] ==> 0 < (b::'a::ordered_semiring)"
paulson@14265
   528
apply (case_tac "b\<le>0") 
paulson@14265
   529
 apply (auto simp add: order_le_less linorder_not_less)
paulson@14265
   530
apply (drule_tac mult_pos_neg [of a b]) 
paulson@14265
   531
 apply (auto dest: order_less_not_sym)
paulson@14265
   532
done
paulson@14265
   533
paulson@14265
   534
lemma zero_less_mult_iff:
paulson@14265
   535
     "((0::'a::ordered_ring) < a*b) = (0 < a & 0 < b | a < 0 & b < 0)"
paulson@14265
   536
apply (auto simp add: order_le_less linorder_not_less mult_pos mult_neg)
paulson@14265
   537
apply (blast dest: zero_less_mult_pos) 
paulson@14265
   538
apply (simp add: mult_commute [of a b]) 
paulson@14265
   539
apply (blast dest: zero_less_mult_pos) 
paulson@14265
   540
done
paulson@14265
   541
paulson@14341
   542
text{*A field has no "zero divisors", and this theorem holds without the
paulson@14277
   543
      assumption of an ordering.  See @{text field_mult_eq_0_iff} below.*}
paulson@14266
   544
lemma mult_eq_0_iff [simp]: "(a*b = (0::'a::ordered_ring)) = (a = 0 | b = 0)"
paulson@14265
   545
apply (case_tac "a < 0")
paulson@14265
   546
apply (auto simp add: linorder_not_less order_le_less linorder_neq_iff)
paulson@14265
   547
apply (force dest: mult_strict_right_mono_neg mult_strict_right_mono)+
paulson@14265
   548
done
paulson@14265
   549
paulson@14265
   550
lemma zero_le_mult_iff:
paulson@14265
   551
     "((0::'a::ordered_ring) \<le> a*b) = (0 \<le> a & 0 \<le> b | a \<le> 0 & b \<le> 0)"
paulson@14265
   552
by (auto simp add: eq_commute [of 0] order_le_less linorder_not_less
paulson@14265
   553
                   zero_less_mult_iff)
paulson@14265
   554
paulson@14265
   555
lemma mult_less_0_iff:
paulson@14265
   556
     "(a*b < (0::'a::ordered_ring)) = (0 < a & b < 0 | a < 0 & 0 < b)"
paulson@14265
   557
apply (insert zero_less_mult_iff [of "-a" b]) 
paulson@14265
   558
apply (force simp add: minus_mult_left[symmetric]) 
paulson@14265
   559
done
paulson@14265
   560
paulson@14265
   561
lemma mult_le_0_iff:
paulson@14265
   562
     "(a*b \<le> (0::'a::ordered_ring)) = (0 \<le> a & b \<le> 0 | a \<le> 0 & 0 \<le> b)"
paulson@14265
   563
apply (insert zero_le_mult_iff [of "-a" b]) 
paulson@14265
   564
apply (force simp add: minus_mult_left[symmetric]) 
paulson@14265
   565
done
paulson@14265
   566
paulson@14265
   567
lemma zero_le_square: "(0::'a::ordered_ring) \<le> a*a"
paulson@14265
   568
by (simp add: zero_le_mult_iff linorder_linear) 
paulson@14265
   569
paulson@14348
   570
lemma zero_le_one: "(0::'a::ordered_semiring) \<le> 1"
paulson@14268
   571
  by (rule zero_less_one [THEN order_less_imp_le]) 
paulson@14268
   572
paulson@14268
   573
paulson@14268
   574
subsection{*More Monotonicity*}
paulson@14268
   575
paulson@14268
   576
lemma mult_left_mono_neg:
paulson@14268
   577
     "[|b \<le> a; c \<le> 0|] ==> c * a \<le> c * (b::'a::ordered_ring)"
paulson@14268
   578
apply (drule mult_left_mono [of _ _ "-c"]) 
paulson@14268
   579
apply (simp_all add: minus_mult_left [symmetric]) 
paulson@14268
   580
done
paulson@14268
   581
paulson@14268
   582
lemma mult_right_mono_neg:
paulson@14268
   583
     "[|b \<le> a; c \<le> 0|] ==> a * c \<le> b * (c::'a::ordered_ring)"
paulson@14268
   584
  by (simp add: mult_left_mono_neg mult_commute [of _ c]) 
paulson@14268
   585
paulson@14268
   586
text{*Strict monotonicity in both arguments*}
paulson@14268
   587
lemma mult_strict_mono:
paulson@14341
   588
     "[|a<b; c<d; 0<b; 0\<le>c|] ==> a * c < b * (d::'a::ordered_semiring)"
paulson@14268
   589
apply (case_tac "c=0")
paulson@14268
   590
 apply (simp add: mult_pos) 
paulson@14268
   591
apply (erule mult_strict_right_mono [THEN order_less_trans])
paulson@14268
   592
 apply (force simp add: order_le_less) 
paulson@14268
   593
apply (erule mult_strict_left_mono, assumption)
paulson@14268
   594
done
paulson@14268
   595
paulson@14268
   596
text{*This weaker variant has more natural premises*}
paulson@14268
   597
lemma mult_strict_mono':
paulson@14341
   598
     "[| a<b; c<d; 0 \<le> a; 0 \<le> c|] ==> a * c < b * (d::'a::ordered_semiring)"
paulson@14268
   599
apply (rule mult_strict_mono)
paulson@14268
   600
apply (blast intro: order_le_less_trans)+
paulson@14268
   601
done
paulson@14268
   602
paulson@14268
   603
lemma mult_mono:
paulson@14268
   604
     "[|a \<le> b; c \<le> d; 0 \<le> b; 0 \<le> c|] 
paulson@14341
   605
      ==> a * c  \<le>  b * (d::'a::ordered_semiring)"
paulson@14268
   606
apply (erule mult_right_mono [THEN order_trans], assumption)
paulson@14268
   607
apply (erule mult_left_mono, assumption)
paulson@14268
   608
done
paulson@14268
   609
paulson@14268
   610
paulson@14268
   611
subsection{*Cancellation Laws for Relationships With a Common Factor*}
paulson@14268
   612
paulson@14268
   613
text{*Cancellation laws for @{term "c*a < c*b"} and @{term "a*c < b*c"},
paulson@14268
   614
   also with the relations @{text "\<le>"} and equality.*}
paulson@14268
   615
paulson@14268
   616
lemma mult_less_cancel_right:
paulson@14268
   617
    "(a*c < b*c) = ((0 < c & a < b) | (c < 0 & b < (a::'a::ordered_ring)))"
paulson@14268
   618
apply (case_tac "c = 0")
paulson@14268
   619
apply (auto simp add: linorder_neq_iff mult_strict_right_mono 
paulson@14268
   620
                      mult_strict_right_mono_neg)
paulson@14268
   621
apply (auto simp add: linorder_not_less 
paulson@14268
   622
                      linorder_not_le [symmetric, of "a*c"]
paulson@14268
   623
                      linorder_not_le [symmetric, of a])
paulson@14268
   624
apply (erule_tac [!] notE)
paulson@14268
   625
apply (auto simp add: order_less_imp_le mult_right_mono 
paulson@14268
   626
                      mult_right_mono_neg)
paulson@14268
   627
done
paulson@14268
   628
paulson@14268
   629
lemma mult_less_cancel_left:
paulson@14268
   630
    "(c*a < c*b) = ((0 < c & a < b) | (c < 0 & b < (a::'a::ordered_ring)))"
paulson@14268
   631
by (simp add: mult_commute [of c] mult_less_cancel_right)
paulson@14268
   632
paulson@14268
   633
lemma mult_le_cancel_right:
paulson@14268
   634
     "(a*c \<le> b*c) = ((0<c --> a\<le>b) & (c<0 --> b \<le> (a::'a::ordered_ring)))"
paulson@14268
   635
by (simp add: linorder_not_less [symmetric] mult_less_cancel_right)
paulson@14268
   636
paulson@14268
   637
lemma mult_le_cancel_left:
paulson@14268
   638
     "(c*a \<le> c*b) = ((0<c --> a\<le>b) & (c<0 --> b \<le> (a::'a::ordered_ring)))"
paulson@14268
   639
by (simp add: mult_commute [of c] mult_le_cancel_right)
paulson@14268
   640
paulson@14268
   641
lemma mult_less_imp_less_left:
paulson@14341
   642
      assumes less: "c*a < c*b" and nonneg: "0 \<le> c"
paulson@14341
   643
      shows "a < (b::'a::ordered_semiring)"
paulson@14341
   644
  proof (rule ccontr)
paulson@14341
   645
    assume "~ a < b"
paulson@14341
   646
    hence "b \<le> a" by (simp add: linorder_not_less)
paulson@14341
   647
    hence "c*b \<le> c*a" by (rule mult_left_mono)
paulson@14341
   648
    with this and less show False 
paulson@14341
   649
      by (simp add: linorder_not_less [symmetric])
paulson@14341
   650
  qed
paulson@14268
   651
paulson@14268
   652
lemma mult_less_imp_less_right:
paulson@14341
   653
    "[|a*c < b*c; 0 \<le> c|] ==> a < (b::'a::ordered_semiring)"
paulson@14341
   654
  by (rule mult_less_imp_less_left, simp add: mult_commute)
paulson@14268
   655
paulson@14268
   656
text{*Cancellation of equalities with a common factor*}
paulson@14268
   657
lemma mult_cancel_right [simp]:
paulson@14268
   658
     "(a*c = b*c) = (c = (0::'a::ordered_ring) | a=b)"
paulson@14268
   659
apply (cut_tac linorder_less_linear [of 0 c])
paulson@14268
   660
apply (force dest: mult_strict_right_mono_neg mult_strict_right_mono
paulson@14268
   661
             simp add: linorder_neq_iff)
paulson@14268
   662
done
paulson@14268
   663
paulson@14268
   664
text{*These cancellation theorems require an ordering. Versions are proved
paulson@14268
   665
      below that work for fields without an ordering.*}
paulson@14268
   666
lemma mult_cancel_left [simp]:
paulson@14268
   667
     "(c*a = c*b) = (c = (0::'a::ordered_ring) | a=b)"
paulson@14268
   668
by (simp add: mult_commute [of c] mult_cancel_right)
paulson@14268
   669
paulson@14265
   670
paulson@14265
   671
subsection {* Fields *}
paulson@14265
   672
paulson@14288
   673
lemma right_inverse [simp]:
paulson@14288
   674
      assumes not0: "a \<noteq> 0" shows "a * inverse (a::'a::field) = 1"
paulson@14288
   675
proof -
paulson@14288
   676
  have "a * inverse a = inverse a * a" by (simp add: mult_ac)
paulson@14288
   677
  also have "... = 1" using not0 by simp
paulson@14288
   678
  finally show ?thesis .
paulson@14288
   679
qed
paulson@14288
   680
paulson@14288
   681
lemma right_inverse_eq: "b \<noteq> 0 ==> (a / b = 1) = (a = (b::'a::field))"
paulson@14288
   682
proof
paulson@14288
   683
  assume neq: "b \<noteq> 0"
paulson@14288
   684
  {
paulson@14288
   685
    hence "a = (a / b) * b" by (simp add: divide_inverse mult_ac)
paulson@14288
   686
    also assume "a / b = 1"
paulson@14288
   687
    finally show "a = b" by simp
paulson@14288
   688
  next
paulson@14288
   689
    assume "a = b"
paulson@14288
   690
    with neq show "a / b = 1" by (simp add: divide_inverse)
paulson@14288
   691
  }
paulson@14288
   692
qed
paulson@14288
   693
paulson@14288
   694
lemma nonzero_inverse_eq_divide: "a \<noteq> 0 ==> inverse (a::'a::field) = 1/a"
paulson@14288
   695
by (simp add: divide_inverse)
paulson@14288
   696
paulson@14288
   697
lemma divide_self [simp]: "a \<noteq> 0 ==> a / (a::'a::field) = 1"
paulson@14288
   698
  by (simp add: divide_inverse)
paulson@14288
   699
paulson@14277
   700
lemma divide_inverse_zero: "a/b = a * inverse(b::'a::{field,division_by_zero})"
paulson@14277
   701
apply (case_tac "b = 0")
paulson@14277
   702
apply (simp_all add: divide_inverse)
paulson@14277
   703
done
paulson@14277
   704
paulson@14277
   705
lemma divide_zero_left [simp]: "0/a = (0::'a::{field,division_by_zero})"
paulson@14277
   706
by (simp add: divide_inverse_zero)
paulson@14277
   707
paulson@14277
   708
lemma inverse_eq_divide: "inverse (a::'a::{field,division_by_zero}) = 1/a"
paulson@14277
   709
by (simp add: divide_inverse_zero)
paulson@14277
   710
paulson@14293
   711
lemma nonzero_add_divide_distrib: "c \<noteq> 0 ==> (a+b)/(c::'a::field) = a/c + b/c"
paulson@14293
   712
by (simp add: divide_inverse left_distrib) 
paulson@14293
   713
paulson@14293
   714
lemma add_divide_distrib: "(a+b)/(c::'a::{field,division_by_zero}) = a/c + b/c"
paulson@14293
   715
apply (case_tac "c=0", simp) 
paulson@14293
   716
apply (simp add: nonzero_add_divide_distrib) 
paulson@14293
   717
done
paulson@14293
   718
paulson@14270
   719
text{*Compared with @{text mult_eq_0_iff}, this version removes the requirement
paulson@14270
   720
      of an ordering.*}
paulson@14348
   721
lemma field_mult_eq_0_iff [simp]: "(a*b = (0::'a::field)) = (a = 0 | b = 0)"
paulson@14270
   722
  proof cases
paulson@14270
   723
    assume "a=0" thus ?thesis by simp
paulson@14270
   724
  next
paulson@14270
   725
    assume anz [simp]: "a\<noteq>0"
paulson@14270
   726
    thus ?thesis
paulson@14270
   727
    proof auto
paulson@14270
   728
      assume "a * b = 0"
paulson@14270
   729
      hence "inverse a * (a * b) = 0" by simp
paulson@14270
   730
      thus "b = 0"  by (simp (no_asm_use) add: mult_assoc [symmetric])
paulson@14270
   731
    qed
paulson@14270
   732
  qed
paulson@14270
   733
paulson@14268
   734
text{*Cancellation of equalities with a common factor*}
paulson@14268
   735
lemma field_mult_cancel_right_lemma:
paulson@14269
   736
      assumes cnz: "c \<noteq> (0::'a::field)"
paulson@14269
   737
	  and eq:  "a*c = b*c"
paulson@14269
   738
	 shows "a=b"
paulson@14268
   739
  proof -
paulson@14268
   740
  have "(a * c) * inverse c = (b * c) * inverse c"
paulson@14268
   741
    by (simp add: eq)
paulson@14268
   742
  thus "a=b"
paulson@14268
   743
    by (simp add: mult_assoc cnz)
paulson@14268
   744
  qed
paulson@14268
   745
paulson@14348
   746
lemma field_mult_cancel_right [simp]:
paulson@14268
   747
     "(a*c = b*c) = (c = (0::'a::field) | a=b)"
paulson@14269
   748
  proof cases
paulson@14268
   749
    assume "c=0" thus ?thesis by simp
paulson@14268
   750
  next
paulson@14268
   751
    assume "c\<noteq>0" 
paulson@14268
   752
    thus ?thesis by (force dest: field_mult_cancel_right_lemma)
paulson@14268
   753
  qed
paulson@14268
   754
paulson@14348
   755
lemma field_mult_cancel_left [simp]:
paulson@14268
   756
     "(c*a = c*b) = (c = (0::'a::field) | a=b)"
paulson@14268
   757
  by (simp add: mult_commute [of c] field_mult_cancel_right) 
paulson@14268
   758
paulson@14268
   759
lemma nonzero_imp_inverse_nonzero: "a \<noteq> 0 ==> inverse a \<noteq> (0::'a::field)"
paulson@14268
   760
  proof
paulson@14268
   761
  assume ianz: "inverse a = 0"
paulson@14268
   762
  assume "a \<noteq> 0"
paulson@14268
   763
  hence "1 = a * inverse a" by simp
paulson@14268
   764
  also have "... = 0" by (simp add: ianz)
paulson@14268
   765
  finally have "1 = (0::'a::field)" .
paulson@14268
   766
  thus False by (simp add: eq_commute)
paulson@14268
   767
  qed
paulson@14268
   768
paulson@14277
   769
paulson@14277
   770
subsection{*Basic Properties of @{term inverse}*}
paulson@14277
   771
paulson@14268
   772
lemma inverse_zero_imp_zero: "inverse a = 0 ==> a = (0::'a::field)"
paulson@14268
   773
apply (rule ccontr) 
paulson@14268
   774
apply (blast dest: nonzero_imp_inverse_nonzero) 
paulson@14268
   775
done
paulson@14268
   776
paulson@14268
   777
lemma inverse_nonzero_imp_nonzero:
paulson@14268
   778
   "inverse a = 0 ==> a = (0::'a::field)"
paulson@14268
   779
apply (rule ccontr) 
paulson@14268
   780
apply (blast dest: nonzero_imp_inverse_nonzero) 
paulson@14268
   781
done
paulson@14268
   782
paulson@14268
   783
lemma inverse_nonzero_iff_nonzero [simp]:
paulson@14268
   784
   "(inverse a = 0) = (a = (0::'a::{field,division_by_zero}))"
paulson@14268
   785
by (force dest: inverse_nonzero_imp_nonzero) 
paulson@14268
   786
paulson@14268
   787
lemma nonzero_inverse_minus_eq:
paulson@14269
   788
      assumes [simp]: "a\<noteq>0"  shows "inverse(-a) = -inverse(a::'a::field)"
paulson@14268
   789
  proof -
paulson@14269
   790
    have "-a * inverse (- a) = -a * - inverse a"
paulson@14268
   791
      by simp
paulson@14268
   792
    thus ?thesis 
paulson@14269
   793
      by (simp only: field_mult_cancel_left, simp)
paulson@14268
   794
  qed
paulson@14268
   795
paulson@14268
   796
lemma inverse_minus_eq [simp]:
paulson@14268
   797
     "inverse(-a) = -inverse(a::'a::{field,division_by_zero})";
paulson@14269
   798
  proof cases
paulson@14268
   799
    assume "a=0" thus ?thesis by (simp add: inverse_zero)
paulson@14268
   800
  next
paulson@14268
   801
    assume "a\<noteq>0" 
paulson@14268
   802
    thus ?thesis by (simp add: nonzero_inverse_minus_eq)
paulson@14268
   803
  qed
paulson@14268
   804
paulson@14268
   805
lemma nonzero_inverse_eq_imp_eq:
paulson@14269
   806
      assumes inveq: "inverse a = inverse b"
paulson@14269
   807
	  and anz:  "a \<noteq> 0"
paulson@14269
   808
	  and bnz:  "b \<noteq> 0"
paulson@14269
   809
	 shows "a = (b::'a::field)"
paulson@14268
   810
  proof -
paulson@14268
   811
  have "a * inverse b = a * inverse a"
paulson@14268
   812
    by (simp add: inveq)
paulson@14268
   813
  hence "(a * inverse b) * b = (a * inverse a) * b"
paulson@14268
   814
    by simp
paulson@14268
   815
  thus "a = b"
paulson@14268
   816
    by (simp add: mult_assoc anz bnz)
paulson@14268
   817
  qed
paulson@14268
   818
paulson@14268
   819
lemma inverse_eq_imp_eq:
paulson@14268
   820
     "inverse a = inverse b ==> a = (b::'a::{field,division_by_zero})"
paulson@14268
   821
apply (case_tac "a=0 | b=0") 
paulson@14268
   822
 apply (force dest!: inverse_zero_imp_zero
paulson@14268
   823
              simp add: eq_commute [of "0::'a"])
paulson@14268
   824
apply (force dest!: nonzero_inverse_eq_imp_eq) 
paulson@14268
   825
done
paulson@14268
   826
paulson@14268
   827
lemma inverse_eq_iff_eq [simp]:
paulson@14268
   828
     "(inverse a = inverse b) = (a = (b::'a::{field,division_by_zero}))"
paulson@14268
   829
by (force dest!: inverse_eq_imp_eq) 
paulson@14268
   830
paulson@14270
   831
lemma nonzero_inverse_inverse_eq:
paulson@14270
   832
      assumes [simp]: "a \<noteq> 0"  shows "inverse(inverse (a::'a::field)) = a"
paulson@14270
   833
  proof -
paulson@14270
   834
  have "(inverse (inverse a) * inverse a) * a = a" 
paulson@14270
   835
    by (simp add: nonzero_imp_inverse_nonzero)
paulson@14270
   836
  thus ?thesis
paulson@14270
   837
    by (simp add: mult_assoc)
paulson@14270
   838
  qed
paulson@14270
   839
paulson@14270
   840
lemma inverse_inverse_eq [simp]:
paulson@14270
   841
     "inverse(inverse (a::'a::{field,division_by_zero})) = a"
paulson@14270
   842
  proof cases
paulson@14270
   843
    assume "a=0" thus ?thesis by simp
paulson@14270
   844
  next
paulson@14270
   845
    assume "a\<noteq>0" 
paulson@14270
   846
    thus ?thesis by (simp add: nonzero_inverse_inverse_eq)
paulson@14270
   847
  qed
paulson@14270
   848
paulson@14270
   849
lemma inverse_1 [simp]: "inverse 1 = (1::'a::field)"
paulson@14270
   850
  proof -
paulson@14270
   851
  have "inverse 1 * 1 = (1::'a::field)" 
paulson@14270
   852
    by (rule left_inverse [OF zero_neq_one [symmetric]])
paulson@14270
   853
  thus ?thesis  by simp
paulson@14270
   854
  qed
paulson@14270
   855
paulson@14270
   856
lemma nonzero_inverse_mult_distrib: 
paulson@14270
   857
      assumes anz: "a \<noteq> 0"
paulson@14270
   858
          and bnz: "b \<noteq> 0"
paulson@14270
   859
      shows "inverse(a*b) = inverse(b) * inverse(a::'a::field)"
paulson@14270
   860
  proof -
paulson@14270
   861
  have "inverse(a*b) * (a * b) * inverse(b) = inverse(b)" 
paulson@14270
   862
    by (simp add: field_mult_eq_0_iff anz bnz)
paulson@14270
   863
  hence "inverse(a*b) * a = inverse(b)" 
paulson@14270
   864
    by (simp add: mult_assoc bnz)
paulson@14270
   865
  hence "inverse(a*b) * a * inverse(a) = inverse(b) * inverse(a)" 
paulson@14270
   866
    by simp
paulson@14270
   867
  thus ?thesis
paulson@14270
   868
    by (simp add: mult_assoc anz)
paulson@14270
   869
  qed
paulson@14270
   870
paulson@14270
   871
text{*This version builds in division by zero while also re-orienting
paulson@14270
   872
      the right-hand side.*}
paulson@14270
   873
lemma inverse_mult_distrib [simp]:
paulson@14270
   874
     "inverse(a*b) = inverse(a) * inverse(b::'a::{field,division_by_zero})"
paulson@14270
   875
  proof cases
paulson@14270
   876
    assume "a \<noteq> 0 & b \<noteq> 0" 
paulson@14270
   877
    thus ?thesis  by (simp add: nonzero_inverse_mult_distrib mult_commute)
paulson@14270
   878
  next
paulson@14270
   879
    assume "~ (a \<noteq> 0 & b \<noteq> 0)" 
paulson@14270
   880
    thus ?thesis  by force
paulson@14270
   881
  qed
paulson@14270
   882
paulson@14270
   883
text{*There is no slick version using division by zero.*}
paulson@14270
   884
lemma inverse_add:
paulson@14270
   885
     "[|a \<noteq> 0;  b \<noteq> 0|]
paulson@14270
   886
      ==> inverse a + inverse b = (a+b) * inverse a * inverse (b::'a::field)"
paulson@14270
   887
apply (simp add: left_distrib mult_assoc)
paulson@14270
   888
apply (simp add: mult_commute [of "inverse a"]) 
paulson@14270
   889
apply (simp add: mult_assoc [symmetric] add_commute)
paulson@14270
   890
done
paulson@14270
   891
paulson@14277
   892
lemma nonzero_mult_divide_cancel_left:
paulson@14277
   893
  assumes [simp]: "b\<noteq>0" and [simp]: "c\<noteq>0" 
paulson@14277
   894
    shows "(c*a)/(c*b) = a/(b::'a::field)"
paulson@14277
   895
proof -
paulson@14277
   896
  have "(c*a)/(c*b) = c * a * (inverse b * inverse c)"
paulson@14277
   897
    by (simp add: field_mult_eq_0_iff divide_inverse 
paulson@14277
   898
                  nonzero_inverse_mult_distrib)
paulson@14277
   899
  also have "... =  a * inverse b * (inverse c * c)"
paulson@14277
   900
    by (simp only: mult_ac)
paulson@14277
   901
  also have "... =  a * inverse b"
paulson@14277
   902
    by simp
paulson@14277
   903
    finally show ?thesis 
paulson@14277
   904
    by (simp add: divide_inverse)
paulson@14277
   905
qed
paulson@14277
   906
paulson@14277
   907
lemma mult_divide_cancel_left:
paulson@14277
   908
     "c\<noteq>0 ==> (c*a) / (c*b) = a / (b::'a::{field,division_by_zero})"
paulson@14277
   909
apply (case_tac "b = 0")
paulson@14277
   910
apply (simp_all add: nonzero_mult_divide_cancel_left)
paulson@14277
   911
done
paulson@14277
   912
paulson@14321
   913
lemma nonzero_mult_divide_cancel_right:
paulson@14321
   914
     "[|b\<noteq>0; c\<noteq>0|] ==> (a*c) / (b*c) = a/(b::'a::field)"
paulson@14321
   915
by (simp add: mult_commute [of _ c] nonzero_mult_divide_cancel_left) 
paulson@14321
   916
paulson@14321
   917
lemma mult_divide_cancel_right:
paulson@14321
   918
     "c\<noteq>0 ==> (a*c) / (b*c) = a / (b::'a::{field,division_by_zero})"
paulson@14321
   919
apply (case_tac "b = 0")
paulson@14321
   920
apply (simp_all add: nonzero_mult_divide_cancel_right)
paulson@14321
   921
done
paulson@14321
   922
paulson@14277
   923
(*For ExtractCommonTerm*)
paulson@14277
   924
lemma mult_divide_cancel_eq_if:
paulson@14277
   925
     "(c*a) / (c*b) = 
paulson@14277
   926
      (if c=0 then 0 else a / (b::'a::{field,division_by_zero}))"
paulson@14277
   927
  by (simp add: mult_divide_cancel_left)
paulson@14277
   928
paulson@14284
   929
lemma divide_1 [simp]: "a/1 = (a::'a::field)"
paulson@14284
   930
  by (simp add: divide_inverse [OF not_sym])
paulson@14284
   931
paulson@14288
   932
lemma times_divide_eq_right [simp]:
paulson@14288
   933
     "a * (b/c) = (a*b) / (c::'a::{field,division_by_zero})"
paulson@14288
   934
by (simp add: divide_inverse_zero mult_assoc)
paulson@14288
   935
paulson@14288
   936
lemma times_divide_eq_left [simp]:
paulson@14288
   937
     "(b/c) * a = (b*a) / (c::'a::{field,division_by_zero})"
paulson@14288
   938
by (simp add: divide_inverse_zero mult_ac)
paulson@14288
   939
paulson@14288
   940
lemma divide_divide_eq_right [simp]:
paulson@14288
   941
     "a / (b/c) = (a*c) / (b::'a::{field,division_by_zero})"
paulson@14288
   942
by (simp add: divide_inverse_zero mult_ac)
paulson@14288
   943
paulson@14288
   944
lemma divide_divide_eq_left [simp]:
paulson@14288
   945
     "(a / b) / (c::'a::{field,division_by_zero}) = a / (b*c)"
paulson@14288
   946
by (simp add: divide_inverse_zero mult_assoc)
paulson@14288
   947
paulson@14268
   948
paulson@14293
   949
subsection {* Division and Unary Minus *}
paulson@14293
   950
paulson@14293
   951
lemma nonzero_minus_divide_left: "b \<noteq> 0 ==> - (a/b) = (-a) / (b::'a::field)"
paulson@14293
   952
by (simp add: divide_inverse minus_mult_left)
paulson@14293
   953
paulson@14293
   954
lemma nonzero_minus_divide_right: "b \<noteq> 0 ==> - (a/b) = a / -(b::'a::field)"
paulson@14293
   955
by (simp add: divide_inverse nonzero_inverse_minus_eq minus_mult_right)
paulson@14293
   956
paulson@14293
   957
lemma nonzero_minus_divide_divide: "b \<noteq> 0 ==> (-a)/(-b) = a / (b::'a::field)"
paulson@14293
   958
by (simp add: divide_inverse nonzero_inverse_minus_eq)
paulson@14293
   959
paulson@14293
   960
lemma minus_divide_left: "- (a/b) = (-a) / (b::'a::{field,division_by_zero})"
paulson@14293
   961
apply (case_tac "b=0", simp) 
paulson@14293
   962
apply (simp add: nonzero_minus_divide_left) 
paulson@14293
   963
done
paulson@14293
   964
paulson@14293
   965
lemma minus_divide_right: "- (a/b) = a / -(b::'a::{field,division_by_zero})"
paulson@14293
   966
apply (case_tac "b=0", simp) 
paulson@14293
   967
by (rule nonzero_minus_divide_right) 
paulson@14293
   968
paulson@14293
   969
text{*The effect is to extract signs from divisions*}
paulson@14293
   970
declare minus_divide_left  [symmetric, simp]
paulson@14293
   971
declare minus_divide_right [symmetric, simp]
paulson@14293
   972
paulson@14293
   973
lemma minus_divide_divide [simp]:
paulson@14293
   974
     "(-a)/(-b) = a / (b::'a::{field,division_by_zero})"
paulson@14293
   975
apply (case_tac "b=0", simp) 
paulson@14293
   976
apply (simp add: nonzero_minus_divide_divide) 
paulson@14293
   977
done
paulson@14293
   978
paulson@14293
   979
paulson@14268
   980
subsection {* Ordered Fields *}
paulson@14268
   981
paulson@14277
   982
lemma positive_imp_inverse_positive: 
paulson@14269
   983
      assumes a_gt_0: "0 < a"  shows "0 < inverse (a::'a::ordered_field)"
paulson@14268
   984
  proof -
paulson@14268
   985
  have "0 < a * inverse a" 
paulson@14268
   986
    by (simp add: a_gt_0 [THEN order_less_imp_not_eq2] zero_less_one)
paulson@14268
   987
  thus "0 < inverse a" 
paulson@14268
   988
    by (simp add: a_gt_0 [THEN order_less_not_sym] zero_less_mult_iff)
paulson@14268
   989
  qed
paulson@14268
   990
paulson@14277
   991
lemma negative_imp_inverse_negative:
paulson@14268
   992
     "a < 0 ==> inverse a < (0::'a::ordered_field)"
paulson@14277
   993
  by (insert positive_imp_inverse_positive [of "-a"], 
paulson@14268
   994
      simp add: nonzero_inverse_minus_eq order_less_imp_not_eq) 
paulson@14268
   995
paulson@14268
   996
lemma inverse_le_imp_le:
paulson@14269
   997
      assumes invle: "inverse a \<le> inverse b"
paulson@14269
   998
	  and apos:  "0 < a"
paulson@14269
   999
	 shows "b \<le> (a::'a::ordered_field)"
paulson@14268
  1000
  proof (rule classical)
paulson@14268
  1001
  assume "~ b \<le> a"
paulson@14268
  1002
  hence "a < b"
paulson@14268
  1003
    by (simp add: linorder_not_le)
paulson@14268
  1004
  hence bpos: "0 < b"
paulson@14268
  1005
    by (blast intro: apos order_less_trans)
paulson@14268
  1006
  hence "a * inverse a \<le> a * inverse b"
paulson@14268
  1007
    by (simp add: apos invle order_less_imp_le mult_left_mono)
paulson@14268
  1008
  hence "(a * inverse a) * b \<le> (a * inverse b) * b"
paulson@14268
  1009
    by (simp add: bpos order_less_imp_le mult_right_mono)
paulson@14268
  1010
  thus "b \<le> a"
paulson@14268
  1011
    by (simp add: mult_assoc apos bpos order_less_imp_not_eq2)
paulson@14268
  1012
  qed
paulson@14268
  1013
paulson@14277
  1014
lemma inverse_positive_imp_positive:
paulson@14277
  1015
      assumes inv_gt_0: "0 < inverse a"
paulson@14277
  1016
          and [simp]:   "a \<noteq> 0"
paulson@14277
  1017
        shows "0 < (a::'a::ordered_field)"
paulson@14277
  1018
  proof -
paulson@14277
  1019
  have "0 < inverse (inverse a)"
paulson@14277
  1020
    by (rule positive_imp_inverse_positive)
paulson@14277
  1021
  thus "0 < a"
paulson@14277
  1022
    by (simp add: nonzero_inverse_inverse_eq)
paulson@14277
  1023
  qed
paulson@14277
  1024
paulson@14277
  1025
lemma inverse_positive_iff_positive [simp]:
paulson@14277
  1026
      "(0 < inverse a) = (0 < (a::'a::{ordered_field,division_by_zero}))"
paulson@14277
  1027
apply (case_tac "a = 0", simp)
paulson@14277
  1028
apply (blast intro: inverse_positive_imp_positive positive_imp_inverse_positive)
paulson@14277
  1029
done
paulson@14277
  1030
paulson@14277
  1031
lemma inverse_negative_imp_negative:
paulson@14277
  1032
      assumes inv_less_0: "inverse a < 0"
paulson@14277
  1033
          and [simp]:   "a \<noteq> 0"
paulson@14277
  1034
        shows "a < (0::'a::ordered_field)"
paulson@14277
  1035
  proof -
paulson@14277
  1036
  have "inverse (inverse a) < 0"
paulson@14277
  1037
    by (rule negative_imp_inverse_negative)
paulson@14277
  1038
  thus "a < 0"
paulson@14277
  1039
    by (simp add: nonzero_inverse_inverse_eq)
paulson@14277
  1040
  qed
paulson@14277
  1041
paulson@14277
  1042
lemma inverse_negative_iff_negative [simp]:
paulson@14277
  1043
      "(inverse a < 0) = (a < (0::'a::{ordered_field,division_by_zero}))"
paulson@14277
  1044
apply (case_tac "a = 0", simp)
paulson@14277
  1045
apply (blast intro: inverse_negative_imp_negative negative_imp_inverse_negative)
paulson@14277
  1046
done
paulson@14277
  1047
paulson@14277
  1048
lemma inverse_nonnegative_iff_nonnegative [simp]:
paulson@14277
  1049
      "(0 \<le> inverse a) = (0 \<le> (a::'a::{ordered_field,division_by_zero}))"
paulson@14277
  1050
by (simp add: linorder_not_less [symmetric])
paulson@14277
  1051
paulson@14277
  1052
lemma inverse_nonpositive_iff_nonpositive [simp]:
paulson@14277
  1053
      "(inverse a \<le> 0) = (a \<le> (0::'a::{ordered_field,division_by_zero}))"
paulson@14277
  1054
by (simp add: linorder_not_less [symmetric])
paulson@14277
  1055
paulson@14277
  1056
paulson@14277
  1057
subsection{*Anti-Monotonicity of @{term inverse}*}
paulson@14277
  1058
paulson@14268
  1059
lemma less_imp_inverse_less:
paulson@14269
  1060
      assumes less: "a < b"
paulson@14269
  1061
	  and apos:  "0 < a"
paulson@14269
  1062
	shows "inverse b < inverse (a::'a::ordered_field)"
paulson@14268
  1063
  proof (rule ccontr)
paulson@14268
  1064
  assume "~ inverse b < inverse a"
paulson@14268
  1065
  hence "inverse a \<le> inverse b"
paulson@14268
  1066
    by (simp add: linorder_not_less)
paulson@14268
  1067
  hence "~ (a < b)"
paulson@14268
  1068
    by (simp add: linorder_not_less inverse_le_imp_le [OF _ apos])
paulson@14268
  1069
  thus False
paulson@14268
  1070
    by (rule notE [OF _ less])
paulson@14268
  1071
  qed
paulson@14268
  1072
paulson@14268
  1073
lemma inverse_less_imp_less:
paulson@14268
  1074
   "[|inverse a < inverse b; 0 < a|] ==> b < (a::'a::ordered_field)"
paulson@14268
  1075
apply (simp add: order_less_le [of "inverse a"] order_less_le [of "b"])
paulson@14268
  1076
apply (force dest!: inverse_le_imp_le nonzero_inverse_eq_imp_eq) 
paulson@14268
  1077
done
paulson@14268
  1078
paulson@14268
  1079
text{*Both premises are essential. Consider -1 and 1.*}
paulson@14268
  1080
lemma inverse_less_iff_less [simp]:
paulson@14268
  1081
     "[|0 < a; 0 < b|] 
paulson@14268
  1082
      ==> (inverse a < inverse b) = (b < (a::'a::ordered_field))"
paulson@14268
  1083
by (blast intro: less_imp_inverse_less dest: inverse_less_imp_less) 
paulson@14268
  1084
paulson@14268
  1085
lemma le_imp_inverse_le:
paulson@14268
  1086
   "[|a \<le> b; 0 < a|] ==> inverse b \<le> inverse (a::'a::ordered_field)"
paulson@14268
  1087
  by (force simp add: order_le_less less_imp_inverse_less)
paulson@14268
  1088
paulson@14268
  1089
lemma inverse_le_iff_le [simp]:
paulson@14268
  1090
     "[|0 < a; 0 < b|] 
paulson@14268
  1091
      ==> (inverse a \<le> inverse b) = (b \<le> (a::'a::ordered_field))"
paulson@14268
  1092
by (blast intro: le_imp_inverse_le dest: inverse_le_imp_le) 
paulson@14268
  1093
paulson@14268
  1094
paulson@14268
  1095
text{*These results refer to both operands being negative.  The opposite-sign
paulson@14268
  1096
case is trivial, since inverse preserves signs.*}
paulson@14268
  1097
lemma inverse_le_imp_le_neg:
paulson@14268
  1098
   "[|inverse a \<le> inverse b; b < 0|] ==> b \<le> (a::'a::ordered_field)"
paulson@14268
  1099
  apply (rule classical) 
paulson@14268
  1100
  apply (subgoal_tac "a < 0") 
paulson@14268
  1101
   prefer 2 apply (force simp add: linorder_not_le intro: order_less_trans) 
paulson@14268
  1102
  apply (insert inverse_le_imp_le [of "-b" "-a"])
paulson@14268
  1103
  apply (simp add: order_less_imp_not_eq nonzero_inverse_minus_eq) 
paulson@14268
  1104
  done
paulson@14268
  1105
paulson@14268
  1106
lemma less_imp_inverse_less_neg:
paulson@14268
  1107
   "[|a < b; b < 0|] ==> inverse b < inverse (a::'a::ordered_field)"
paulson@14268
  1108
  apply (subgoal_tac "a < 0") 
paulson@14268
  1109
   prefer 2 apply (blast intro: order_less_trans) 
paulson@14268
  1110
  apply (insert less_imp_inverse_less [of "-b" "-a"])
paulson@14268
  1111
  apply (simp add: order_less_imp_not_eq nonzero_inverse_minus_eq) 
paulson@14268
  1112
  done
paulson@14268
  1113
paulson@14268
  1114
lemma inverse_less_imp_less_neg:
paulson@14268
  1115
   "[|inverse a < inverse b; b < 0|] ==> b < (a::'a::ordered_field)"
paulson@14268
  1116
  apply (rule classical) 
paulson@14268
  1117
  apply (subgoal_tac "a < 0") 
paulson@14268
  1118
   prefer 2
paulson@14268
  1119
   apply (force simp add: linorder_not_less intro: order_le_less_trans) 
paulson@14268
  1120
  apply (insert inverse_less_imp_less [of "-b" "-a"])
paulson@14268
  1121
  apply (simp add: order_less_imp_not_eq nonzero_inverse_minus_eq) 
paulson@14268
  1122
  done
paulson@14268
  1123
paulson@14268
  1124
lemma inverse_less_iff_less_neg [simp]:
paulson@14268
  1125
     "[|a < 0; b < 0|] 
paulson@14268
  1126
      ==> (inverse a < inverse b) = (b < (a::'a::ordered_field))"
paulson@14268
  1127
  apply (insert inverse_less_iff_less [of "-b" "-a"])
paulson@14268
  1128
  apply (simp del: inverse_less_iff_less 
paulson@14268
  1129
	      add: order_less_imp_not_eq nonzero_inverse_minus_eq) 
paulson@14268
  1130
  done
paulson@14268
  1131
paulson@14268
  1132
lemma le_imp_inverse_le_neg:
paulson@14268
  1133
   "[|a \<le> b; b < 0|] ==> inverse b \<le> inverse (a::'a::ordered_field)"
paulson@14268
  1134
  by (force simp add: order_le_less less_imp_inverse_less_neg)
paulson@14268
  1135
paulson@14268
  1136
lemma inverse_le_iff_le_neg [simp]:
paulson@14268
  1137
     "[|a < 0; b < 0|] 
paulson@14268
  1138
      ==> (inverse a \<le> inverse b) = (b \<le> (a::'a::ordered_field))"
paulson@14268
  1139
by (blast intro: le_imp_inverse_le_neg dest: inverse_le_imp_le_neg) 
paulson@14265
  1140
paulson@14277
  1141
paulson@14277
  1142
subsection{*Division and Signs*}
paulson@14277
  1143
paulson@14277
  1144
lemma zero_less_divide_iff:
paulson@14277
  1145
     "((0::'a::{ordered_field,division_by_zero}) < a/b) = (0 < a & 0 < b | a < 0 & b < 0)"
paulson@14277
  1146
by (simp add: divide_inverse_zero zero_less_mult_iff)
paulson@14277
  1147
paulson@14277
  1148
lemma divide_less_0_iff:
paulson@14277
  1149
     "(a/b < (0::'a::{ordered_field,division_by_zero})) = 
paulson@14277
  1150
      (0 < a & b < 0 | a < 0 & 0 < b)"
paulson@14277
  1151
by (simp add: divide_inverse_zero mult_less_0_iff)
paulson@14277
  1152
paulson@14277
  1153
lemma zero_le_divide_iff:
paulson@14277
  1154
     "((0::'a::{ordered_field,division_by_zero}) \<le> a/b) =
paulson@14277
  1155
      (0 \<le> a & 0 \<le> b | a \<le> 0 & b \<le> 0)"
paulson@14277
  1156
by (simp add: divide_inverse_zero zero_le_mult_iff)
paulson@14277
  1157
paulson@14277
  1158
lemma divide_le_0_iff:
paulson@14288
  1159
     "(a/b \<le> (0::'a::{ordered_field,division_by_zero})) =
paulson@14288
  1160
      (0 \<le> a & b \<le> 0 | a \<le> 0 & 0 \<le> b)"
paulson@14277
  1161
by (simp add: divide_inverse_zero mult_le_0_iff)
paulson@14277
  1162
paulson@14277
  1163
lemma divide_eq_0_iff [simp]:
paulson@14277
  1164
     "(a/b = 0) = (a=0 | b=(0::'a::{field,division_by_zero}))"
paulson@14277
  1165
by (simp add: divide_inverse_zero field_mult_eq_0_iff)
paulson@14277
  1166
paulson@14288
  1167
paulson@14288
  1168
subsection{*Simplification of Inequalities Involving Literal Divisors*}
paulson@14288
  1169
paulson@14288
  1170
lemma pos_le_divide_eq: "0 < (c::'a::ordered_field) ==> (a \<le> b/c) = (a*c \<le> b)"
paulson@14288
  1171
proof -
paulson@14288
  1172
  assume less: "0<c"
paulson@14288
  1173
  hence "(a \<le> b/c) = (a*c \<le> (b/c)*c)"
paulson@14288
  1174
    by (simp add: mult_le_cancel_right order_less_not_sym [OF less])
paulson@14288
  1175
  also have "... = (a*c \<le> b)"
paulson@14288
  1176
    by (simp add: order_less_imp_not_eq2 [OF less] divide_inverse mult_assoc) 
paulson@14288
  1177
  finally show ?thesis .
paulson@14288
  1178
qed
paulson@14288
  1179
paulson@14288
  1180
paulson@14288
  1181
lemma neg_le_divide_eq: "c < (0::'a::ordered_field) ==> (a \<le> b/c) = (b \<le> a*c)"
paulson@14288
  1182
proof -
paulson@14288
  1183
  assume less: "c<0"
paulson@14288
  1184
  hence "(a \<le> b/c) = ((b/c)*c \<le> a*c)"
paulson@14288
  1185
    by (simp add: mult_le_cancel_right order_less_not_sym [OF less])
paulson@14288
  1186
  also have "... = (b \<le> a*c)"
paulson@14288
  1187
    by (simp add: order_less_imp_not_eq [OF less] divide_inverse mult_assoc) 
paulson@14288
  1188
  finally show ?thesis .
paulson@14288
  1189
qed
paulson@14288
  1190
paulson@14288
  1191
lemma le_divide_eq:
paulson@14288
  1192
  "(a \<le> b/c) = 
paulson@14288
  1193
   (if 0 < c then a*c \<le> b
paulson@14288
  1194
             else if c < 0 then b \<le> a*c
paulson@14288
  1195
             else  a \<le> (0::'a::{ordered_field,division_by_zero}))"
paulson@14288
  1196
apply (case_tac "c=0", simp) 
paulson@14288
  1197
apply (force simp add: pos_le_divide_eq neg_le_divide_eq linorder_neq_iff) 
paulson@14288
  1198
done
paulson@14288
  1199
paulson@14288
  1200
lemma pos_divide_le_eq: "0 < (c::'a::ordered_field) ==> (b/c \<le> a) = (b \<le> a*c)"
paulson@14288
  1201
proof -
paulson@14288
  1202
  assume less: "0<c"
paulson@14288
  1203
  hence "(b/c \<le> a) = ((b/c)*c \<le> a*c)"
paulson@14288
  1204
    by (simp add: mult_le_cancel_right order_less_not_sym [OF less])
paulson@14288
  1205
  also have "... = (b \<le> a*c)"
paulson@14288
  1206
    by (simp add: order_less_imp_not_eq2 [OF less] divide_inverse mult_assoc) 
paulson@14288
  1207
  finally show ?thesis .
paulson@14288
  1208
qed
paulson@14288
  1209
paulson@14288
  1210
lemma neg_divide_le_eq: "c < (0::'a::ordered_field) ==> (b/c \<le> a) = (a*c \<le> b)"
paulson@14288
  1211
proof -
paulson@14288
  1212
  assume less: "c<0"
paulson@14288
  1213
  hence "(b/c \<le> a) = (a*c \<le> (b/c)*c)"
paulson@14288
  1214
    by (simp add: mult_le_cancel_right order_less_not_sym [OF less])
paulson@14288
  1215
  also have "... = (a*c \<le> b)"
paulson@14288
  1216
    by (simp add: order_less_imp_not_eq [OF less] divide_inverse mult_assoc) 
paulson@14288
  1217
  finally show ?thesis .
paulson@14288
  1218
qed
paulson@14288
  1219
paulson@14288
  1220
lemma divide_le_eq:
paulson@14288
  1221
  "(b/c \<le> a) = 
paulson@14288
  1222
   (if 0 < c then b \<le> a*c
paulson@14288
  1223
             else if c < 0 then a*c \<le> b
paulson@14288
  1224
             else 0 \<le> (a::'a::{ordered_field,division_by_zero}))"
paulson@14288
  1225
apply (case_tac "c=0", simp) 
paulson@14288
  1226
apply (force simp add: pos_divide_le_eq neg_divide_le_eq linorder_neq_iff) 
paulson@14288
  1227
done
paulson@14288
  1228
paulson@14288
  1229
paulson@14288
  1230
lemma pos_less_divide_eq:
paulson@14288
  1231
     "0 < (c::'a::ordered_field) ==> (a < b/c) = (a*c < b)"
paulson@14288
  1232
proof -
paulson@14288
  1233
  assume less: "0<c"
paulson@14288
  1234
  hence "(a < b/c) = (a*c < (b/c)*c)"
paulson@14288
  1235
    by (simp add: mult_less_cancel_right order_less_not_sym [OF less])
paulson@14288
  1236
  also have "... = (a*c < b)"
paulson@14288
  1237
    by (simp add: order_less_imp_not_eq2 [OF less] divide_inverse mult_assoc) 
paulson@14288
  1238
  finally show ?thesis .
paulson@14288
  1239
qed
paulson@14288
  1240
paulson@14288
  1241
lemma neg_less_divide_eq:
paulson@14288
  1242
 "c < (0::'a::ordered_field) ==> (a < b/c) = (b < a*c)"
paulson@14288
  1243
proof -
paulson@14288
  1244
  assume less: "c<0"
paulson@14288
  1245
  hence "(a < b/c) = ((b/c)*c < a*c)"
paulson@14288
  1246
    by (simp add: mult_less_cancel_right order_less_not_sym [OF less])
paulson@14288
  1247
  also have "... = (b < a*c)"
paulson@14288
  1248
    by (simp add: order_less_imp_not_eq [OF less] divide_inverse mult_assoc) 
paulson@14288
  1249
  finally show ?thesis .
paulson@14288
  1250
qed
paulson@14288
  1251
paulson@14288
  1252
lemma less_divide_eq:
paulson@14288
  1253
  "(a < b/c) = 
paulson@14288
  1254
   (if 0 < c then a*c < b
paulson@14288
  1255
             else if c < 0 then b < a*c
paulson@14288
  1256
             else  a < (0::'a::{ordered_field,division_by_zero}))"
paulson@14288
  1257
apply (case_tac "c=0", simp) 
paulson@14288
  1258
apply (force simp add: pos_less_divide_eq neg_less_divide_eq linorder_neq_iff) 
paulson@14288
  1259
done
paulson@14288
  1260
paulson@14288
  1261
lemma pos_divide_less_eq:
paulson@14288
  1262
     "0 < (c::'a::ordered_field) ==> (b/c < a) = (b < a*c)"
paulson@14288
  1263
proof -
paulson@14288
  1264
  assume less: "0<c"
paulson@14288
  1265
  hence "(b/c < a) = ((b/c)*c < a*c)"
paulson@14288
  1266
    by (simp add: mult_less_cancel_right order_less_not_sym [OF less])
paulson@14288
  1267
  also have "... = (b < a*c)"
paulson@14288
  1268
    by (simp add: order_less_imp_not_eq2 [OF less] divide_inverse mult_assoc) 
paulson@14288
  1269
  finally show ?thesis .
paulson@14288
  1270
qed
paulson@14288
  1271
paulson@14288
  1272
lemma neg_divide_less_eq:
paulson@14288
  1273
 "c < (0::'a::ordered_field) ==> (b/c < a) = (a*c < b)"
paulson@14288
  1274
proof -
paulson@14288
  1275
  assume less: "c<0"
paulson@14288
  1276
  hence "(b/c < a) = (a*c < (b/c)*c)"
paulson@14288
  1277
    by (simp add: mult_less_cancel_right order_less_not_sym [OF less])
paulson@14288
  1278
  also have "... = (a*c < b)"
paulson@14288
  1279
    by (simp add: order_less_imp_not_eq [OF less] divide_inverse mult_assoc) 
paulson@14288
  1280
  finally show ?thesis .
paulson@14288
  1281
qed
paulson@14288
  1282
paulson@14288
  1283
lemma divide_less_eq:
paulson@14288
  1284
  "(b/c < a) = 
paulson@14288
  1285
   (if 0 < c then b < a*c
paulson@14288
  1286
             else if c < 0 then a*c < b
paulson@14288
  1287
             else 0 < (a::'a::{ordered_field,division_by_zero}))"
paulson@14288
  1288
apply (case_tac "c=0", simp) 
paulson@14288
  1289
apply (force simp add: pos_divide_less_eq neg_divide_less_eq linorder_neq_iff) 
paulson@14288
  1290
done
paulson@14288
  1291
paulson@14288
  1292
lemma nonzero_eq_divide_eq: "c\<noteq>0 ==> ((a::'a::field) = b/c) = (a*c = b)"
paulson@14288
  1293
proof -
paulson@14288
  1294
  assume [simp]: "c\<noteq>0"
paulson@14288
  1295
  have "(a = b/c) = (a*c = (b/c)*c)"
paulson@14288
  1296
    by (simp add: field_mult_cancel_right)
paulson@14288
  1297
  also have "... = (a*c = b)"
paulson@14288
  1298
    by (simp add: divide_inverse mult_assoc) 
paulson@14288
  1299
  finally show ?thesis .
paulson@14288
  1300
qed
paulson@14288
  1301
paulson@14288
  1302
lemma eq_divide_eq:
paulson@14288
  1303
  "((a::'a::{field,division_by_zero}) = b/c) = (if c\<noteq>0 then a*c = b else a=0)"
paulson@14288
  1304
by (simp add: nonzero_eq_divide_eq) 
paulson@14288
  1305
paulson@14288
  1306
lemma nonzero_divide_eq_eq: "c\<noteq>0 ==> (b/c = (a::'a::field)) = (b = a*c)"
paulson@14288
  1307
proof -
paulson@14288
  1308
  assume [simp]: "c\<noteq>0"
paulson@14288
  1309
  have "(b/c = a) = ((b/c)*c = a*c)"
paulson@14288
  1310
    by (simp add: field_mult_cancel_right)
paulson@14288
  1311
  also have "... = (b = a*c)"
paulson@14288
  1312
    by (simp add: divide_inverse mult_assoc) 
paulson@14288
  1313
  finally show ?thesis .
paulson@14288
  1314
qed
paulson@14288
  1315
paulson@14288
  1316
lemma divide_eq_eq:
paulson@14288
  1317
  "(b/c = (a::'a::{field,division_by_zero})) = (if c\<noteq>0 then b = a*c else a=0)"
paulson@14288
  1318
by (force simp add: nonzero_divide_eq_eq) 
paulson@14288
  1319
paulson@14288
  1320
subsection{*Cancellation Laws for Division*}
paulson@14288
  1321
paulson@14288
  1322
lemma divide_cancel_right [simp]:
paulson@14288
  1323
     "(a/c = b/c) = (c = 0 | a = (b::'a::{field,division_by_zero}))"
paulson@14288
  1324
apply (case_tac "c=0", simp) 
paulson@14288
  1325
apply (simp add: divide_inverse_zero field_mult_cancel_right) 
paulson@14288
  1326
done
paulson@14288
  1327
paulson@14288
  1328
lemma divide_cancel_left [simp]:
paulson@14288
  1329
     "(c/a = c/b) = (c = 0 | a = (b::'a::{field,division_by_zero}))" 
paulson@14288
  1330
apply (case_tac "c=0", simp) 
paulson@14288
  1331
apply (simp add: divide_inverse_zero field_mult_cancel_left) 
paulson@14288
  1332
done
paulson@14288
  1333
paulson@14353
  1334
subsection {* Division and the Number One *}
paulson@14353
  1335
paulson@14353
  1336
text{*Simplify expressions equated with 1*}
paulson@14353
  1337
lemma divide_eq_1_iff [simp]:
paulson@14353
  1338
     "(a/b = 1) = (b \<noteq> 0 & a = (b::'a::{field,division_by_zero}))"
paulson@14353
  1339
apply (case_tac "b=0", simp) 
paulson@14353
  1340
apply (simp add: right_inverse_eq) 
paulson@14353
  1341
done
paulson@14353
  1342
paulson@14353
  1343
paulson@14353
  1344
lemma one_eq_divide_iff [simp]:
paulson@14353
  1345
     "(1 = a/b) = (b \<noteq> 0 & a = (b::'a::{field,division_by_zero}))"
paulson@14353
  1346
by (simp add: eq_commute [of 1])  
paulson@14353
  1347
paulson@14353
  1348
lemma zero_eq_1_divide_iff [simp]:
paulson@14353
  1349
     "((0::'a::{ordered_field,division_by_zero}) = 1/a) = (a = 0)"
paulson@14353
  1350
apply (case_tac "a=0", simp) 
paulson@14353
  1351
apply (auto simp add: nonzero_eq_divide_eq) 
paulson@14353
  1352
done
paulson@14353
  1353
paulson@14353
  1354
lemma one_divide_eq_0_iff [simp]:
paulson@14353
  1355
     "(1/a = (0::'a::{ordered_field,division_by_zero})) = (a = 0)"
paulson@14353
  1356
apply (case_tac "a=0", simp) 
paulson@14353
  1357
apply (insert zero_neq_one [THEN not_sym]) 
paulson@14353
  1358
apply (auto simp add: nonzero_divide_eq_eq) 
paulson@14353
  1359
done
paulson@14353
  1360
paulson@14353
  1361
text{*Simplify expressions such as @{text "0 < 1/x"} to @{text "0 < x"}*}
paulson@14353
  1362
declare zero_less_divide_iff [of "1", simp]
paulson@14353
  1363
declare divide_less_0_iff [of "1", simp]
paulson@14353
  1364
declare zero_le_divide_iff [of "1", simp]
paulson@14353
  1365
declare divide_le_0_iff [of "1", simp]
paulson@14353
  1366
paulson@14288
  1367
paulson@14293
  1368
subsection {* Ordering Rules for Division *}
paulson@14293
  1369
paulson@14293
  1370
lemma divide_strict_right_mono:
paulson@14293
  1371
     "[|a < b; 0 < c|] ==> a / c < b / (c::'a::ordered_field)"
paulson@14293
  1372
by (simp add: order_less_imp_not_eq2 divide_inverse mult_strict_right_mono 
paulson@14293
  1373
              positive_imp_inverse_positive) 
paulson@14293
  1374
paulson@14293
  1375
lemma divide_right_mono:
paulson@14293
  1376
     "[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/(c::'a::{ordered_field,division_by_zero})"
paulson@14293
  1377
  by (force simp add: divide_strict_right_mono order_le_less) 
paulson@14293
  1378
paulson@14293
  1379
paulson@14293
  1380
text{*The last premise ensures that @{term a} and @{term b} 
paulson@14293
  1381
      have the same sign*}
paulson@14293
  1382
lemma divide_strict_left_mono:
paulson@14293
  1383
       "[|b < a; 0 < c; 0 < a*b|] ==> c / a < c / (b::'a::ordered_field)"
paulson@14293
  1384
by (force simp add: zero_less_mult_iff divide_inverse mult_strict_left_mono 
paulson@14293
  1385
      order_less_imp_not_eq order_less_imp_not_eq2  
paulson@14293
  1386
      less_imp_inverse_less less_imp_inverse_less_neg) 
paulson@14293
  1387
paulson@14293
  1388
lemma divide_left_mono:
paulson@14293
  1389
     "[|b \<le> a; 0 \<le> c; 0 < a*b|] ==> c / a \<le> c / (b::'a::ordered_field)"
paulson@14293
  1390
  apply (subgoal_tac "a \<noteq> 0 & b \<noteq> 0") 
paulson@14293
  1391
   prefer 2 
paulson@14293
  1392
   apply (force simp add: zero_less_mult_iff order_less_imp_not_eq) 
paulson@14293
  1393
  apply (case_tac "c=0", simp add: divide_inverse)
paulson@14293
  1394
  apply (force simp add: divide_strict_left_mono order_le_less) 
paulson@14293
  1395
  done
paulson@14293
  1396
paulson@14293
  1397
lemma divide_strict_left_mono_neg:
paulson@14293
  1398
     "[|a < b; c < 0; 0 < a*b|] ==> c / a < c / (b::'a::ordered_field)"
paulson@14293
  1399
  apply (subgoal_tac "a \<noteq> 0 & b \<noteq> 0") 
paulson@14293
  1400
   prefer 2 
paulson@14293
  1401
   apply (force simp add: zero_less_mult_iff order_less_imp_not_eq) 
paulson@14293
  1402
  apply (drule divide_strict_left_mono [of _ _ "-c"]) 
paulson@14293
  1403
   apply (simp_all add: mult_commute nonzero_minus_divide_left [symmetric]) 
paulson@14293
  1404
  done
paulson@14293
  1405
paulson@14293
  1406
lemma divide_strict_right_mono_neg:
paulson@14293
  1407
     "[|b < a; c < 0|] ==> a / c < b / (c::'a::ordered_field)"
paulson@14293
  1408
apply (drule divide_strict_right_mono [of _ _ "-c"], simp) 
paulson@14293
  1409
apply (simp add: order_less_imp_not_eq nonzero_minus_divide_right [symmetric]) 
paulson@14293
  1410
done
paulson@14293
  1411
paulson@14293
  1412
paulson@14293
  1413
subsection {* Ordered Fields are Dense *}
paulson@14293
  1414
paulson@14293
  1415
lemma zero_less_two: "0 < (1+1::'a::ordered_field)"
paulson@14293
  1416
proof -
paulson@14293
  1417
  have "0 + 0 <  (1+1::'a::ordered_field)"
paulson@14293
  1418
    by (blast intro: zero_less_one add_strict_mono) 
paulson@14293
  1419
  thus ?thesis by simp
paulson@14293
  1420
qed
paulson@14293
  1421
paulson@14293
  1422
lemma less_half_sum: "a < b ==> a < (a+b) / (1+1::'a::ordered_field)"
paulson@14293
  1423
by (simp add: zero_less_two pos_less_divide_eq right_distrib) 
paulson@14293
  1424
paulson@14293
  1425
lemma gt_half_sum: "a < b ==> (a+b)/(1+1::'a::ordered_field) < b"
paulson@14293
  1426
by (simp add: zero_less_two pos_divide_less_eq right_distrib) 
paulson@14293
  1427
paulson@14293
  1428
lemma dense: "a < b ==> \<exists>r::'a::ordered_field. a < r & r < b"
paulson@14293
  1429
by (blast intro!: less_half_sum gt_half_sum)
paulson@14293
  1430
paulson@14293
  1431
paulson@14293
  1432
subsection {* Absolute Value *}
paulson@14293
  1433
paulson@14293
  1434
lemma abs_zero [simp]: "abs 0 = (0::'a::ordered_ring)"
paulson@14293
  1435
by (simp add: abs_if)
paulson@14293
  1436
paulson@14294
  1437
lemma abs_one [simp]: "abs 1 = (1::'a::ordered_ring)"
paulson@14294
  1438
  by (simp add: abs_if zero_less_one [THEN order_less_not_sym]) 
paulson@14294
  1439
paulson@14294
  1440
lemma abs_mult: "abs (a * b) = abs a * abs (b::'a::ordered_ring)" 
paulson@14294
  1441
apply (case_tac "a=0 | b=0", force) 
paulson@14293
  1442
apply (auto elim: order_less_asym
paulson@14293
  1443
            simp add: abs_if mult_less_0_iff linorder_neq_iff
paulson@14293
  1444
                  minus_mult_left [symmetric] minus_mult_right [symmetric])  
paulson@14293
  1445
done
paulson@14293
  1446
paulson@14348
  1447
lemma abs_mult_self: "abs a * abs a = a * (a::'a::ordered_ring)"
paulson@14348
  1448
by (simp add: abs_if) 
paulson@14348
  1449
paulson@14294
  1450
lemma abs_eq_0 [simp]: "(abs a = 0) = (a = (0::'a::ordered_ring))"
paulson@14294
  1451
by (simp add: abs_if)
paulson@14294
  1452
paulson@14294
  1453
lemma zero_less_abs_iff [simp]: "(0 < abs a) = (a \<noteq> (0::'a::ordered_ring))"
paulson@14294
  1454
by (simp add: abs_if linorder_neq_iff)
paulson@14294
  1455
paulson@14294
  1456
lemma abs_not_less_zero [simp]: "~ abs a < (0::'a::ordered_ring)"
paulson@14294
  1457
by (simp add: abs_if  order_less_not_sym [of a 0])
paulson@14294
  1458
paulson@14294
  1459
lemma abs_le_zero_iff [simp]: "(abs a \<le> (0::'a::ordered_ring)) = (a = 0)" 
paulson@14294
  1460
by (simp add: order_le_less) 
paulson@14294
  1461
paulson@14294
  1462
lemma abs_minus_cancel [simp]: "abs (-a) = abs(a::'a::ordered_ring)"
paulson@14294
  1463
apply (auto simp add: abs_if linorder_not_less order_less_not_sym [of 0 a])  
paulson@14294
  1464
apply (drule order_antisym, assumption, simp) 
paulson@14294
  1465
done
paulson@14294
  1466
paulson@14294
  1467
lemma abs_ge_zero [simp]: "(0::'a::ordered_ring) \<le> abs a"
paulson@14294
  1468
apply (simp add: abs_if order_less_imp_le)
paulson@14294
  1469
apply (simp add: linorder_not_less) 
paulson@14294
  1470
done
paulson@14294
  1471
paulson@14294
  1472
lemma abs_idempotent [simp]: "abs (abs a) = abs (a::'a::ordered_ring)"
paulson@14294
  1473
  by (force elim: order_less_asym simp add: abs_if)
paulson@14294
  1474
paulson@14305
  1475
lemma abs_zero_iff [simp]: "(abs a = 0) = (a = (0::'a::ordered_ring))"
paulson@14293
  1476
by (simp add: abs_if)
paulson@14293
  1477
paulson@14294
  1478
lemma abs_ge_self: "a \<le> abs (a::'a::ordered_ring)"
paulson@14294
  1479
apply (simp add: abs_if)
paulson@14294
  1480
apply (simp add: order_less_imp_le order_trans [of _ 0])
paulson@14294
  1481
done
paulson@14294
  1482
paulson@14294
  1483
lemma abs_ge_minus_self: "-a \<le> abs (a::'a::ordered_ring)"
paulson@14294
  1484
by (insert abs_ge_self [of "-a"], simp)
paulson@14294
  1485
paulson@14294
  1486
lemma nonzero_abs_inverse:
paulson@14294
  1487
     "a \<noteq> 0 ==> abs (inverse (a::'a::ordered_field)) = inverse (abs a)"
paulson@14294
  1488
apply (auto simp add: linorder_neq_iff abs_if nonzero_inverse_minus_eq 
paulson@14294
  1489
                      negative_imp_inverse_negative)
paulson@14294
  1490
apply (blast intro: positive_imp_inverse_positive elim: order_less_asym) 
paulson@14294
  1491
done
paulson@14294
  1492
paulson@14294
  1493
lemma abs_inverse [simp]:
paulson@14294
  1494
     "abs (inverse (a::'a::{ordered_field,division_by_zero})) = 
paulson@14294
  1495
      inverse (abs a)"
paulson@14294
  1496
apply (case_tac "a=0", simp) 
paulson@14294
  1497
apply (simp add: nonzero_abs_inverse) 
paulson@14294
  1498
done
paulson@14294
  1499
paulson@14294
  1500
lemma nonzero_abs_divide:
paulson@14294
  1501
     "b \<noteq> 0 ==> abs (a / (b::'a::ordered_field)) = abs a / abs b"
paulson@14294
  1502
by (simp add: divide_inverse abs_mult nonzero_abs_inverse) 
paulson@14294
  1503
paulson@14294
  1504
lemma abs_divide:
paulson@14294
  1505
     "abs (a / (b::'a::{ordered_field,division_by_zero})) = abs a / abs b"
paulson@14294
  1506
apply (case_tac "b=0", simp) 
paulson@14294
  1507
apply (simp add: nonzero_abs_divide) 
paulson@14294
  1508
done
paulson@14294
  1509
paulson@14295
  1510
lemma abs_leI: "[|a \<le> b; -a \<le> b|] ==> abs a \<le> (b::'a::ordered_ring)"
paulson@14295
  1511
by (simp add: abs_if)
paulson@14295
  1512
paulson@14295
  1513
lemma le_minus_self_iff: "(a \<le> -a) = (a \<le> (0::'a::ordered_ring))"
paulson@14295
  1514
proof 
paulson@14295
  1515
  assume ale: "a \<le> -a"
paulson@14295
  1516
  show "a\<le>0"
paulson@14295
  1517
    apply (rule classical) 
paulson@14295
  1518
    apply (simp add: linorder_not_le) 
paulson@14295
  1519
    apply (blast intro: ale order_trans order_less_imp_le
paulson@14295
  1520
                        neg_0_le_iff_le [THEN iffD1]) 
paulson@14295
  1521
    done
paulson@14295
  1522
next
paulson@14295
  1523
  assume "a\<le>0"
paulson@14295
  1524
  hence "0 \<le> -a" by (simp only: neg_0_le_iff_le)
paulson@14295
  1525
  thus "a \<le> -a"  by (blast intro: prems order_trans) 
paulson@14295
  1526
qed
paulson@14295
  1527
paulson@14295
  1528
lemma minus_le_self_iff: "(-a \<le> a) = (0 \<le> (a::'a::ordered_ring))"
paulson@14295
  1529
by (insert le_minus_self_iff [of "-a"], simp)
paulson@14295
  1530
paulson@14295
  1531
lemma eq_minus_self_iff: "(a = -a) = (a = (0::'a::ordered_ring))"
paulson@14295
  1532
by (force simp add: order_eq_iff le_minus_self_iff minus_le_self_iff)
paulson@14295
  1533
paulson@14295
  1534
lemma less_minus_self_iff: "(a < -a) = (a < (0::'a::ordered_ring))"
paulson@14295
  1535
by (simp add: order_less_le le_minus_self_iff eq_minus_self_iff)
paulson@14295
  1536
paulson@14295
  1537
lemma abs_le_D1: "abs a \<le> b ==> a \<le> (b::'a::ordered_ring)"
paulson@14295
  1538
apply (simp add: abs_if split: split_if_asm)
paulson@14295
  1539
apply (rule order_trans [of _ "-a"]) 
paulson@14295
  1540
 apply (simp add: less_minus_self_iff order_less_imp_le, assumption)
paulson@14295
  1541
done
paulson@14295
  1542
paulson@14295
  1543
lemma abs_le_D2: "abs a \<le> b ==> -a \<le> (b::'a::ordered_ring)"
paulson@14295
  1544
by (insert abs_le_D1 [of "-a"], simp)
paulson@14295
  1545
paulson@14295
  1546
lemma abs_le_iff: "(abs a \<le> b) = (a \<le> b & -a \<le> (b::'a::ordered_ring))"
paulson@14295
  1547
by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2)
paulson@14295
  1548
paulson@14295
  1549
lemma abs_less_iff: "(abs a < b) = (a < b & -a < (b::'a::ordered_ring))" 
paulson@14295
  1550
apply (simp add: order_less_le abs_le_iff)  
paulson@14295
  1551
apply (auto simp add: abs_if minus_le_self_iff eq_minus_self_iff) 
paulson@14295
  1552
 apply (simp add:  linorder_not_less [symmetric]) 
paulson@14295
  1553
apply (simp add: le_minus_self_iff linorder_neq_iff) 
paulson@14295
  1554
apply (simp add:  linorder_not_less [symmetric]) 
paulson@14295
  1555
done
paulson@14295
  1556
paulson@14294
  1557
lemma abs_triangle_ineq: "abs (a+b) \<le> abs a + abs (b::'a::ordered_ring)"
paulson@14295
  1558
by (force simp add: abs_le_iff abs_ge_self abs_ge_minus_self add_mono)
paulson@14294
  1559
paulson@14294
  1560
lemma abs_mult_less:
paulson@14294
  1561
     "[| abs a < c; abs b < d |] ==> abs a * abs b < c*(d::'a::ordered_ring)"
paulson@14294
  1562
proof -
paulson@14294
  1563
  assume ac: "abs a < c"
paulson@14294
  1564
  hence cpos: "0<c" by (blast intro: order_le_less_trans abs_ge_zero)
paulson@14294
  1565
  assume "abs b < d"
paulson@14294
  1566
  thus ?thesis by (simp add: ac cpos mult_strict_mono) 
paulson@14294
  1567
qed
paulson@14293
  1568
paulson@14331
  1569
ML
paulson@14331
  1570
{*
paulson@14334
  1571
val add_assoc = thm"add_assoc";
paulson@14334
  1572
val add_commute = thm"add_commute";
paulson@14334
  1573
val mult_assoc = thm"mult_assoc";
paulson@14334
  1574
val mult_commute = thm"mult_commute";
paulson@14334
  1575
val zero_neq_one = thm"zero_neq_one";
paulson@14334
  1576
val diff_minus = thm"diff_minus";
paulson@14334
  1577
val abs_if = thm"abs_if";
paulson@14334
  1578
val divide_inverse = thm"divide_inverse";
paulson@14334
  1579
val inverse_zero = thm"inverse_zero";
paulson@14334
  1580
val divide_zero = thm"divide_zero";
paulson@14334
  1581
val add_0 = thm"add_0";
paulson@14331
  1582
val add_0_right = thm"add_0_right";
paulson@14331
  1583
val add_left_commute = thm"add_left_commute";
paulson@14334
  1584
val left_minus = thm"left_minus";
paulson@14331
  1585
val right_minus = thm"right_minus";
paulson@14331
  1586
val right_minus_eq = thm"right_minus_eq";
paulson@14331
  1587
val add_left_cancel = thm"add_left_cancel";
paulson@14331
  1588
val add_right_cancel = thm"add_right_cancel";
paulson@14331
  1589
val minus_minus = thm"minus_minus";
paulson@14331
  1590
val equals_zero_I = thm"equals_zero_I";
paulson@14331
  1591
val minus_zero = thm"minus_zero";
paulson@14331
  1592
val diff_self = thm"diff_self";
paulson@14331
  1593
val diff_0 = thm"diff_0";
paulson@14331
  1594
val diff_0_right = thm"diff_0_right";
paulson@14331
  1595
val diff_minus_eq_add = thm"diff_minus_eq_add";
paulson@14331
  1596
val neg_equal_iff_equal = thm"neg_equal_iff_equal";
paulson@14331
  1597
val neg_equal_0_iff_equal = thm"neg_equal_0_iff_equal";
paulson@14331
  1598
val neg_0_equal_iff_equal = thm"neg_0_equal_iff_equal";
paulson@14331
  1599
val equation_minus_iff = thm"equation_minus_iff";
paulson@14331
  1600
val minus_equation_iff = thm"minus_equation_iff";
paulson@14334
  1601
val mult_1 = thm"mult_1";
paulson@14331
  1602
val mult_1_right = thm"mult_1_right";
paulson@14331
  1603
val mult_left_commute = thm"mult_left_commute";
paulson@14353
  1604
val mult_zero_left = thm"mult_zero_left";
paulson@14353
  1605
val mult_zero_right = thm"mult_zero_right";
paulson@14334
  1606
val left_distrib = thm "left_distrib";
paulson@14331
  1607
val right_distrib = thm"right_distrib";
paulson@14331
  1608
val combine_common_factor = thm"combine_common_factor";
paulson@14331
  1609
val minus_add_distrib = thm"minus_add_distrib";
paulson@14331
  1610
val minus_mult_left = thm"minus_mult_left";
paulson@14331
  1611
val minus_mult_right = thm"minus_mult_right";
paulson@14331
  1612
val minus_mult_minus = thm"minus_mult_minus";
paulson@14331
  1613
val right_diff_distrib = thm"right_diff_distrib";
paulson@14331
  1614
val left_diff_distrib = thm"left_diff_distrib";
paulson@14331
  1615
val minus_diff_eq = thm"minus_diff_eq";
paulson@14334
  1616
val add_left_mono = thm"add_left_mono";
paulson@14331
  1617
val add_right_mono = thm"add_right_mono";
paulson@14331
  1618
val add_mono = thm"add_mono";
paulson@14331
  1619
val add_strict_left_mono = thm"add_strict_left_mono";
paulson@14331
  1620
val add_strict_right_mono = thm"add_strict_right_mono";
paulson@14331
  1621
val add_strict_mono = thm"add_strict_mono";
paulson@14341
  1622
val add_less_le_mono = thm"add_less_le_mono";
paulson@14341
  1623
val add_le_less_mono = thm"add_le_less_mono";
paulson@14331
  1624
val add_less_imp_less_left = thm"add_less_imp_less_left";
paulson@14331
  1625
val add_less_imp_less_right = thm"add_less_imp_less_right";
paulson@14331
  1626
val add_less_cancel_left = thm"add_less_cancel_left";
paulson@14331
  1627
val add_less_cancel_right = thm"add_less_cancel_right";
paulson@14331
  1628
val add_le_cancel_left = thm"add_le_cancel_left";
paulson@14331
  1629
val add_le_cancel_right = thm"add_le_cancel_right";
paulson@14331
  1630
val add_le_imp_le_left = thm"add_le_imp_le_left";
paulson@14331
  1631
val add_le_imp_le_right = thm"add_le_imp_le_right";
paulson@14331
  1632
val le_imp_neg_le = thm"le_imp_neg_le";
paulson@14331
  1633
val neg_le_iff_le = thm"neg_le_iff_le";
paulson@14331
  1634
val neg_le_0_iff_le = thm"neg_le_0_iff_le";
paulson@14331
  1635
val neg_0_le_iff_le = thm"neg_0_le_iff_le";
paulson@14331
  1636
val neg_less_iff_less = thm"neg_less_iff_less";
paulson@14331
  1637
val neg_less_0_iff_less = thm"neg_less_0_iff_less";
paulson@14331
  1638
val neg_0_less_iff_less = thm"neg_0_less_iff_less";
paulson@14331
  1639
val less_minus_iff = thm"less_minus_iff";
paulson@14331
  1640
val minus_less_iff = thm"minus_less_iff";
paulson@14331
  1641
val le_minus_iff = thm"le_minus_iff";
paulson@14331
  1642
val minus_le_iff = thm"minus_le_iff";
paulson@14331
  1643
val add_diff_eq = thm"add_diff_eq";
paulson@14331
  1644
val diff_add_eq = thm"diff_add_eq";
paulson@14331
  1645
val diff_eq_eq = thm"diff_eq_eq";
paulson@14331
  1646
val eq_diff_eq = thm"eq_diff_eq";
paulson@14331
  1647
val diff_diff_eq = thm"diff_diff_eq";
paulson@14331
  1648
val diff_diff_eq2 = thm"diff_diff_eq2";
paulson@14331
  1649
val less_iff_diff_less_0 = thm"less_iff_diff_less_0";
paulson@14331
  1650
val diff_less_eq = thm"diff_less_eq";
paulson@14331
  1651
val less_diff_eq = thm"less_diff_eq";
paulson@14331
  1652
val diff_le_eq = thm"diff_le_eq";
paulson@14331
  1653
val le_diff_eq = thm"le_diff_eq";
paulson@14331
  1654
val eq_iff_diff_eq_0 = thm"eq_iff_diff_eq_0";
paulson@14331
  1655
val le_iff_diff_le_0 = thm"le_iff_diff_le_0";
paulson@14331
  1656
val eq_add_iff1 = thm"eq_add_iff1";
paulson@14331
  1657
val eq_add_iff2 = thm"eq_add_iff2";
paulson@14331
  1658
val less_add_iff1 = thm"less_add_iff1";
paulson@14331
  1659
val less_add_iff2 = thm"less_add_iff2";
paulson@14331
  1660
val le_add_iff1 = thm"le_add_iff1";
paulson@14331
  1661
val le_add_iff2 = thm"le_add_iff2";
paulson@14334
  1662
val mult_strict_left_mono = thm"mult_strict_left_mono";
paulson@14331
  1663
val mult_strict_right_mono = thm"mult_strict_right_mono";
paulson@14331
  1664
val mult_left_mono = thm"mult_left_mono";
paulson@14331
  1665
val mult_right_mono = thm"mult_right_mono";
paulson@14348
  1666
val mult_left_le_imp_le = thm"mult_left_le_imp_le";
paulson@14348
  1667
val mult_right_le_imp_le = thm"mult_right_le_imp_le";
paulson@14348
  1668
val mult_left_less_imp_less = thm"mult_left_less_imp_less";
paulson@14348
  1669
val mult_right_less_imp_less = thm"mult_right_less_imp_less";
paulson@14331
  1670
val mult_strict_left_mono_neg = thm"mult_strict_left_mono_neg";
paulson@14331
  1671
val mult_strict_right_mono_neg = thm"mult_strict_right_mono_neg";
paulson@14331
  1672
val mult_pos = thm"mult_pos";
paulson@14331
  1673
val mult_pos_neg = thm"mult_pos_neg";
paulson@14331
  1674
val mult_neg = thm"mult_neg";
paulson@14331
  1675
val zero_less_mult_pos = thm"zero_less_mult_pos";
paulson@14331
  1676
val zero_less_mult_iff = thm"zero_less_mult_iff";
paulson@14331
  1677
val mult_eq_0_iff = thm"mult_eq_0_iff";
paulson@14331
  1678
val zero_le_mult_iff = thm"zero_le_mult_iff";
paulson@14331
  1679
val mult_less_0_iff = thm"mult_less_0_iff";
paulson@14331
  1680
val mult_le_0_iff = thm"mult_le_0_iff";
paulson@14331
  1681
val zero_le_square = thm"zero_le_square";
paulson@14331
  1682
val zero_less_one = thm"zero_less_one";
paulson@14331
  1683
val zero_le_one = thm"zero_le_one";
paulson@14331
  1684
val mult_left_mono_neg = thm"mult_left_mono_neg";
paulson@14331
  1685
val mult_right_mono_neg = thm"mult_right_mono_neg";
paulson@14331
  1686
val mult_strict_mono = thm"mult_strict_mono";
paulson@14331
  1687
val mult_strict_mono' = thm"mult_strict_mono'";
paulson@14331
  1688
val mult_mono = thm"mult_mono";
paulson@14331
  1689
val mult_less_cancel_right = thm"mult_less_cancel_right";
paulson@14331
  1690
val mult_less_cancel_left = thm"mult_less_cancel_left";
paulson@14331
  1691
val mult_le_cancel_right = thm"mult_le_cancel_right";
paulson@14331
  1692
val mult_le_cancel_left = thm"mult_le_cancel_left";
paulson@14331
  1693
val mult_less_imp_less_left = thm"mult_less_imp_less_left";
paulson@14331
  1694
val mult_less_imp_less_right = thm"mult_less_imp_less_right";
paulson@14331
  1695
val mult_cancel_right = thm"mult_cancel_right";
paulson@14331
  1696
val mult_cancel_left = thm"mult_cancel_left";
paulson@14331
  1697
val left_inverse = thm "left_inverse";
paulson@14331
  1698
val right_inverse = thm"right_inverse";
paulson@14331
  1699
val right_inverse_eq = thm"right_inverse_eq";
paulson@14331
  1700
val nonzero_inverse_eq_divide = thm"nonzero_inverse_eq_divide";
paulson@14331
  1701
val divide_self = thm"divide_self";
paulson@14331
  1702
val divide_inverse_zero = thm"divide_inverse_zero";
paulson@14331
  1703
val divide_zero_left = thm"divide_zero_left";
paulson@14331
  1704
val inverse_eq_divide = thm"inverse_eq_divide";
paulson@14331
  1705
val nonzero_add_divide_distrib = thm"nonzero_add_divide_distrib";
paulson@14331
  1706
val add_divide_distrib = thm"add_divide_distrib";
paulson@14331
  1707
val field_mult_eq_0_iff = thm"field_mult_eq_0_iff";
paulson@14331
  1708
val field_mult_cancel_right = thm"field_mult_cancel_right";
paulson@14331
  1709
val field_mult_cancel_left = thm"field_mult_cancel_left";
paulson@14331
  1710
val nonzero_imp_inverse_nonzero = thm"nonzero_imp_inverse_nonzero";
paulson@14331
  1711
val inverse_zero_imp_zero = thm"inverse_zero_imp_zero";
paulson@14331
  1712
val inverse_nonzero_imp_nonzero = thm"inverse_nonzero_imp_nonzero";
paulson@14331
  1713
val inverse_nonzero_iff_nonzero = thm"inverse_nonzero_iff_nonzero";
paulson@14331
  1714
val nonzero_inverse_minus_eq = thm"nonzero_inverse_minus_eq";
paulson@14331
  1715
val inverse_minus_eq = thm"inverse_minus_eq";
paulson@14331
  1716
val nonzero_inverse_eq_imp_eq = thm"nonzero_inverse_eq_imp_eq";
paulson@14331
  1717
val inverse_eq_imp_eq = thm"inverse_eq_imp_eq";
paulson@14331
  1718
val inverse_eq_iff_eq = thm"inverse_eq_iff_eq";
paulson@14331
  1719
val nonzero_inverse_inverse_eq = thm"nonzero_inverse_inverse_eq";
paulson@14331
  1720
val inverse_inverse_eq = thm"inverse_inverse_eq";
paulson@14331
  1721
val inverse_1 = thm"inverse_1";
paulson@14331
  1722
val nonzero_inverse_mult_distrib = thm"nonzero_inverse_mult_distrib";
paulson@14331
  1723
val inverse_mult_distrib = thm"inverse_mult_distrib";
paulson@14331
  1724
val inverse_add = thm"inverse_add";
paulson@14331
  1725
val nonzero_mult_divide_cancel_left = thm"nonzero_mult_divide_cancel_left";
paulson@14331
  1726
val mult_divide_cancel_left = thm"mult_divide_cancel_left";
paulson@14331
  1727
val nonzero_mult_divide_cancel_right = thm"nonzero_mult_divide_cancel_right";
paulson@14331
  1728
val mult_divide_cancel_right = thm"mult_divide_cancel_right";
paulson@14331
  1729
val mult_divide_cancel_eq_if = thm"mult_divide_cancel_eq_if";
paulson@14331
  1730
val divide_1 = thm"divide_1";
paulson@14331
  1731
val times_divide_eq_right = thm"times_divide_eq_right";
paulson@14331
  1732
val times_divide_eq_left = thm"times_divide_eq_left";
paulson@14331
  1733
val divide_divide_eq_right = thm"divide_divide_eq_right";
paulson@14331
  1734
val divide_divide_eq_left = thm"divide_divide_eq_left";
paulson@14331
  1735
val nonzero_minus_divide_left = thm"nonzero_minus_divide_left";
paulson@14331
  1736
val nonzero_minus_divide_right = thm"nonzero_minus_divide_right";
paulson@14331
  1737
val nonzero_minus_divide_divide = thm"nonzero_minus_divide_divide";
paulson@14331
  1738
val minus_divide_left = thm"minus_divide_left";
paulson@14331
  1739
val minus_divide_right = thm"minus_divide_right";
paulson@14331
  1740
val minus_divide_divide = thm"minus_divide_divide";
paulson@14331
  1741
val positive_imp_inverse_positive = thm"positive_imp_inverse_positive";
paulson@14331
  1742
val negative_imp_inverse_negative = thm"negative_imp_inverse_negative";
paulson@14331
  1743
val inverse_le_imp_le = thm"inverse_le_imp_le";
paulson@14331
  1744
val inverse_positive_imp_positive = thm"inverse_positive_imp_positive";
paulson@14331
  1745
val inverse_positive_iff_positive = thm"inverse_positive_iff_positive";
paulson@14331
  1746
val inverse_negative_imp_negative = thm"inverse_negative_imp_negative";
paulson@14331
  1747
val inverse_negative_iff_negative = thm"inverse_negative_iff_negative";
paulson@14331
  1748
val inverse_nonnegative_iff_nonnegative = thm"inverse_nonnegative_iff_nonnegative";
paulson@14331
  1749
val inverse_nonpositive_iff_nonpositive = thm"inverse_nonpositive_iff_nonpositive";
paulson@14331
  1750
val less_imp_inverse_less = thm"less_imp_inverse_less";
paulson@14331
  1751
val inverse_less_imp_less = thm"inverse_less_imp_less";
paulson@14331
  1752
val inverse_less_iff_less = thm"inverse_less_iff_less";
paulson@14331
  1753
val le_imp_inverse_le = thm"le_imp_inverse_le";
paulson@14331
  1754
val inverse_le_iff_le = thm"inverse_le_iff_le";
paulson@14331
  1755
val inverse_le_imp_le_neg = thm"inverse_le_imp_le_neg";
paulson@14331
  1756
val less_imp_inverse_less_neg = thm"less_imp_inverse_less_neg";
paulson@14331
  1757
val inverse_less_imp_less_neg = thm"inverse_less_imp_less_neg";
paulson@14331
  1758
val inverse_less_iff_less_neg = thm"inverse_less_iff_less_neg";
paulson@14331
  1759
val le_imp_inverse_le_neg = thm"le_imp_inverse_le_neg";
paulson@14331
  1760
val inverse_le_iff_le_neg = thm"inverse_le_iff_le_neg";
paulson@14331
  1761
val zero_less_divide_iff = thm"zero_less_divide_iff";
paulson@14331
  1762
val divide_less_0_iff = thm"divide_less_0_iff";
paulson@14331
  1763
val zero_le_divide_iff = thm"zero_le_divide_iff";
paulson@14331
  1764
val divide_le_0_iff = thm"divide_le_0_iff";
paulson@14331
  1765
val divide_eq_0_iff = thm"divide_eq_0_iff";
paulson@14331
  1766
val pos_le_divide_eq = thm"pos_le_divide_eq";
paulson@14331
  1767
val neg_le_divide_eq = thm"neg_le_divide_eq";
paulson@14331
  1768
val le_divide_eq = thm"le_divide_eq";
paulson@14331
  1769
val pos_divide_le_eq = thm"pos_divide_le_eq";
paulson@14331
  1770
val neg_divide_le_eq = thm"neg_divide_le_eq";
paulson@14331
  1771
val divide_le_eq = thm"divide_le_eq";
paulson@14331
  1772
val pos_less_divide_eq = thm"pos_less_divide_eq";
paulson@14331
  1773
val neg_less_divide_eq = thm"neg_less_divide_eq";
paulson@14331
  1774
val less_divide_eq = thm"less_divide_eq";
paulson@14331
  1775
val pos_divide_less_eq = thm"pos_divide_less_eq";
paulson@14331
  1776
val neg_divide_less_eq = thm"neg_divide_less_eq";
paulson@14331
  1777
val divide_less_eq = thm"divide_less_eq";
paulson@14331
  1778
val nonzero_eq_divide_eq = thm"nonzero_eq_divide_eq";
paulson@14331
  1779
val eq_divide_eq = thm"eq_divide_eq";
paulson@14331
  1780
val nonzero_divide_eq_eq = thm"nonzero_divide_eq_eq";
paulson@14331
  1781
val divide_eq_eq = thm"divide_eq_eq";
paulson@14331
  1782
val divide_cancel_right = thm"divide_cancel_right";
paulson@14331
  1783
val divide_cancel_left = thm"divide_cancel_left";
paulson@14331
  1784
val divide_strict_right_mono = thm"divide_strict_right_mono";
paulson@14331
  1785
val divide_right_mono = thm"divide_right_mono";
paulson@14331
  1786
val divide_strict_left_mono = thm"divide_strict_left_mono";
paulson@14331
  1787
val divide_left_mono = thm"divide_left_mono";
paulson@14331
  1788
val divide_strict_left_mono_neg = thm"divide_strict_left_mono_neg";
paulson@14331
  1789
val divide_strict_right_mono_neg = thm"divide_strict_right_mono_neg";
paulson@14331
  1790
val zero_less_two = thm"zero_less_two";
paulson@14331
  1791
val less_half_sum = thm"less_half_sum";
paulson@14331
  1792
val gt_half_sum = thm"gt_half_sum";
paulson@14331
  1793
val dense = thm"dense";
paulson@14331
  1794
val abs_zero = thm"abs_zero";
paulson@14331
  1795
val abs_one = thm"abs_one";
paulson@14331
  1796
val abs_mult = thm"abs_mult";
paulson@14348
  1797
val abs_mult_self = thm"abs_mult_self";
paulson@14331
  1798
val abs_eq_0 = thm"abs_eq_0";
paulson@14331
  1799
val zero_less_abs_iff = thm"zero_less_abs_iff";
paulson@14331
  1800
val abs_not_less_zero = thm"abs_not_less_zero";
paulson@14331
  1801
val abs_le_zero_iff = thm"abs_le_zero_iff";
paulson@14331
  1802
val abs_minus_cancel = thm"abs_minus_cancel";
paulson@14331
  1803
val abs_ge_zero = thm"abs_ge_zero";
paulson@14331
  1804
val abs_idempotent = thm"abs_idempotent";
paulson@14331
  1805
val abs_zero_iff = thm"abs_zero_iff";
paulson@14331
  1806
val abs_ge_self = thm"abs_ge_self";
paulson@14331
  1807
val abs_ge_minus_self = thm"abs_ge_minus_self";
paulson@14331
  1808
val nonzero_abs_inverse = thm"nonzero_abs_inverse";
paulson@14331
  1809
val abs_inverse = thm"abs_inverse";
paulson@14331
  1810
val nonzero_abs_divide = thm"nonzero_abs_divide";
paulson@14331
  1811
val abs_divide = thm"abs_divide";
paulson@14331
  1812
val abs_leI = thm"abs_leI";
paulson@14331
  1813
val le_minus_self_iff = thm"le_minus_self_iff";
paulson@14331
  1814
val minus_le_self_iff = thm"minus_le_self_iff";
paulson@14331
  1815
val eq_minus_self_iff = thm"eq_minus_self_iff";
paulson@14331
  1816
val less_minus_self_iff = thm"less_minus_self_iff";
paulson@14331
  1817
val abs_le_D1 = thm"abs_le_D1";
paulson@14331
  1818
val abs_le_D2 = thm"abs_le_D2";
paulson@14331
  1819
val abs_le_iff = thm"abs_le_iff";
paulson@14331
  1820
val abs_less_iff = thm"abs_less_iff";
paulson@14331
  1821
val abs_triangle_ineq = thm"abs_triangle_ineq";
paulson@14331
  1822
val abs_mult_less = thm"abs_mult_less";
paulson@14331
  1823
paulson@14331
  1824
val compare_rls = thms"compare_rls";
paulson@14331
  1825
*}
paulson@14331
  1826
paulson@14293
  1827
paulson@14265
  1828
end