src/HOL/OrderedGroup.thy
author haftmann
Fri Mar 02 15:43:21 2007 +0100 (2007-03-02)
changeset 22390 378f34b1e380
parent 21382 d71aed9286d3
child 22422 ee19cdb07528
permissions -rw-r--r--
now using "class"
wenzelm@14770
     1
(*  Title:   HOL/OrderedGroup.thy
obua@14738
     2
    ID:      $Id$
avigad@16775
     3
    Author:  Gertrud Bauer, Steven Obua, Lawrence C Paulson, and Markus Wenzel,
avigad@16775
     4
             with contributions by Jeremy Avigad
obua@14738
     5
*)
obua@14738
     6
obua@14738
     7
header {* Ordered Groups *}
obua@14738
     8
nipkow@15131
     9
theory OrderedGroup
haftmann@21382
    10
imports LOrder
wenzelm@19798
    11
uses "~~/src/Provers/Arith/abel_cancel.ML"
nipkow@15131
    12
begin
obua@14738
    13
obua@14738
    14
text {*
obua@14738
    15
  The theory of partially ordered groups is taken from the books:
obua@14738
    16
  \begin{itemize}
obua@14738
    17
  \item \emph{Lattice Theory} by Garret Birkhoff, American Mathematical Society 1979 
obua@14738
    18
  \item \emph{Partially Ordered Algebraic Systems}, Pergamon Press 1963
obua@14738
    19
  \end{itemize}
obua@14738
    20
  Most of the used notions can also be looked up in 
obua@14738
    21
  \begin{itemize}
wenzelm@14770
    22
  \item \url{http://www.mathworld.com} by Eric Weisstein et. al.
obua@14738
    23
  \item \emph{Algebra I} by van der Waerden, Springer.
obua@14738
    24
  \end{itemize}
obua@14738
    25
*}
obua@14738
    26
obua@14738
    27
subsection {* Semigroups, Groups *}
obua@14738
    28
haftmann@22390
    29
class semigroup_add = plus +
haftmann@22390
    30
  assumes add_assoc: "(a \<^loc>+ b) \<^loc>+ c = a \<^loc>+ (b \<^loc>+ c)"
haftmann@22390
    31
haftmann@22390
    32
class ab_semigroup_add = semigroup_add +
haftmann@22390
    33
  assumes add_commute: "a \<^loc>+ b = b \<^loc>+ a"
obua@14738
    34
obua@14738
    35
lemma add_left_commute: "a + (b + c) = b + (a + (c::'a::ab_semigroup_add))"
obua@14738
    36
  by (rule mk_left_commute [of "op +", OF add_assoc add_commute])
obua@14738
    37
obua@14738
    38
theorems add_ac = add_assoc add_commute add_left_commute
obua@14738
    39
haftmann@22390
    40
class semigroup_mult = times +
haftmann@22390
    41
  assumes mult_assoc: "(a \<^loc>* b) \<^loc>* c = a \<^loc>* (b \<^loc>* c)"
obua@14738
    42
haftmann@22390
    43
class ab_semigroup_mult = semigroup_mult +
haftmann@22390
    44
  assumes mult_commute: "a \<^loc>* b = b \<^loc>* a"
obua@14738
    45
obua@14738
    46
lemma mult_left_commute: "a * (b * c) = b * (a * (c::'a::ab_semigroup_mult))"
obua@14738
    47
  by (rule mk_left_commute [of "op *", OF mult_assoc mult_commute])
obua@14738
    48
obua@14738
    49
theorems mult_ac = mult_assoc mult_commute mult_left_commute
obua@14738
    50
haftmann@22390
    51
class comm_monoid_add = zero + ab_semigroup_add +
haftmann@22390
    52
  assumes add_0 [simp]: "\<^loc>0 \<^loc>+ a = a"
obua@14738
    53
haftmann@22390
    54
class monoid_mult = one + semigroup_mult +
haftmann@22390
    55
  assumes mult_1_left [simp]: "\<^loc>1 \<^loc>* a  = a"
haftmann@22390
    56
  assumes mult_1_right [simp]: "a \<^loc>* \<^loc>1 = a"
obua@14738
    57
haftmann@22390
    58
class comm_monoid_mult = one + ab_semigroup_mult +
haftmann@22390
    59
  assumes mult_1: "\<^loc>1 \<^loc>* a = a"
obua@14738
    60
obua@14738
    61
instance comm_monoid_mult \<subseteq> monoid_mult
haftmann@22390
    62
  by intro_classes (insert mult_1, simp_all add: mult_commute, auto)
obua@14738
    63
haftmann@22390
    64
class cancel_semigroup_add = semigroup_add +
haftmann@22390
    65
  assumes add_left_imp_eq: "a \<^loc>+ b = a \<^loc>+ c \<Longrightarrow> b = c"
haftmann@22390
    66
  assumes add_right_imp_eq: "b \<^loc>+ a = c \<^loc>+ a \<Longrightarrow> b = c"
obua@14738
    67
haftmann@22390
    68
class cancel_ab_semigroup_add = ab_semigroup_add +
haftmann@22390
    69
  assumes add_imp_eq: "a \<^loc>+ b = a \<^loc>+ c \<Longrightarrow> b = c"
obua@14738
    70
obua@14738
    71
instance cancel_ab_semigroup_add \<subseteq> cancel_semigroup_add
haftmann@22390
    72
proof intro_classes
haftmann@22390
    73
  fix a b c :: 'a
haftmann@22390
    74
  assume "a + b = a + c" 
haftmann@22390
    75
  then show "b = c" by (rule add_imp_eq)
haftmann@22390
    76
next
obua@14738
    77
  fix a b c :: 'a
obua@14738
    78
  assume "b + a = c + a"
haftmann@22390
    79
  then have "a + b = a + c" by (simp only: add_commute)
haftmann@22390
    80
  then show "b = c" by (rule add_imp_eq)
obua@14738
    81
qed
obua@14738
    82
haftmann@22390
    83
class ab_group_add = minus + comm_monoid_add +
haftmann@22390
    84
  assumes left_minus [simp]: "uminus a \<^loc>+ a = \<^loc>0"
haftmann@22390
    85
  assumes diff_minus: "a \<^loc>- b = a \<^loc>+ (uminus b)"
obua@14738
    86
obua@14738
    87
instance ab_group_add \<subseteq> cancel_ab_semigroup_add
haftmann@22390
    88
proof intro_classes
obua@14738
    89
  fix a b c :: 'a
obua@14738
    90
  assume "a + b = a + c"
haftmann@22390
    91
  then have "uminus a + a + b = uminus a + a + c" unfolding add_assoc by simp
haftmann@22390
    92
  then show "b = c" by simp 
obua@14738
    93
qed
obua@14738
    94
obua@14738
    95
lemma add_0_right [simp]: "a + 0 = (a::'a::comm_monoid_add)"
obua@14738
    96
proof -
obua@14738
    97
  have "a + 0 = 0 + a" by (simp only: add_commute)
obua@14738
    98
  also have "... = a" by simp
obua@14738
    99
  finally show ?thesis .
obua@14738
   100
qed
obua@14738
   101
wenzelm@21245
   102
lemmas add_zero_left = add_0
wenzelm@21245
   103
  and add_zero_right = add_0_right
wenzelm@21245
   104
obua@14738
   105
lemma add_left_cancel [simp]:
haftmann@22390
   106
  "a + b = a + c \<longleftrightarrow> b = (c \<Colon> 'a\<Colon>cancel_semigroup_add)"
haftmann@22390
   107
  by (blast dest: add_left_imp_eq) 
obua@14738
   108
obua@14738
   109
lemma add_right_cancel [simp]:
haftmann@22390
   110
  "b + a = c + a \<longleftrightarrow> b = (c \<Colon> 'a\<Colon>cancel_semigroup_add)"
obua@14738
   111
  by (blast dest: add_right_imp_eq)
obua@14738
   112
obua@14738
   113
lemma right_minus [simp]: "a + -(a::'a::ab_group_add) = 0"
obua@14738
   114
proof -
obua@14738
   115
  have "a + -a = -a + a" by (simp add: add_ac)
obua@14738
   116
  also have "... = 0" by simp
obua@14738
   117
  finally show ?thesis .
obua@14738
   118
qed
obua@14738
   119
obua@14738
   120
lemma right_minus_eq: "(a - b = 0) = (a = (b::'a::ab_group_add))"
obua@14738
   121
proof
obua@14738
   122
  have "a = a - b + b" by (simp add: diff_minus add_ac)
obua@14738
   123
  also assume "a - b = 0"
obua@14738
   124
  finally show "a = b" by simp
obua@14738
   125
next
obua@14738
   126
  assume "a = b"
obua@14738
   127
  thus "a - b = 0" by (simp add: diff_minus)
obua@14738
   128
qed
obua@14738
   129
obua@14738
   130
lemma minus_minus [simp]: "- (- (a::'a::ab_group_add)) = a"
obua@14738
   131
proof (rule add_left_cancel [of "-a", THEN iffD1])
obua@14738
   132
  show "(-a + -(-a) = -a + a)"
obua@14738
   133
  by simp
obua@14738
   134
qed
obua@14738
   135
obua@14738
   136
lemma equals_zero_I: "a+b = 0 ==> -a = (b::'a::ab_group_add)"
obua@14738
   137
apply (rule right_minus_eq [THEN iffD1, symmetric])
obua@14738
   138
apply (simp add: diff_minus add_commute) 
obua@14738
   139
done
obua@14738
   140
obua@14738
   141
lemma minus_zero [simp]: "- 0 = (0::'a::ab_group_add)"
obua@14738
   142
by (simp add: equals_zero_I)
obua@14738
   143
obua@14738
   144
lemma diff_self [simp]: "a - (a::'a::ab_group_add) = 0"
obua@14738
   145
  by (simp add: diff_minus)
obua@14738
   146
obua@14738
   147
lemma diff_0 [simp]: "(0::'a::ab_group_add) - a = -a"
obua@14738
   148
by (simp add: diff_minus)
obua@14738
   149
obua@14738
   150
lemma diff_0_right [simp]: "a - (0::'a::ab_group_add) = a" 
obua@14738
   151
by (simp add: diff_minus)
obua@14738
   152
obua@14738
   153
lemma diff_minus_eq_add [simp]: "a - - b = a + (b::'a::ab_group_add)"
obua@14738
   154
by (simp add: diff_minus)
obua@14738
   155
obua@14738
   156
lemma neg_equal_iff_equal [simp]: "(-a = -b) = (a = (b::'a::ab_group_add))" 
obua@14738
   157
proof 
obua@14738
   158
  assume "- a = - b"
obua@14738
   159
  hence "- (- a) = - (- b)"
obua@14738
   160
    by simp
obua@14738
   161
  thus "a=b" by simp
obua@14738
   162
next
obua@14738
   163
  assume "a=b"
obua@14738
   164
  thus "-a = -b" by simp
obua@14738
   165
qed
obua@14738
   166
obua@14738
   167
lemma neg_equal_0_iff_equal [simp]: "(-a = 0) = (a = (0::'a::ab_group_add))"
obua@14738
   168
by (subst neg_equal_iff_equal [symmetric], simp)
obua@14738
   169
obua@14738
   170
lemma neg_0_equal_iff_equal [simp]: "(0 = -a) = (0 = (a::'a::ab_group_add))"
obua@14738
   171
by (subst neg_equal_iff_equal [symmetric], simp)
obua@14738
   172
obua@14738
   173
text{*The next two equations can make the simplifier loop!*}
obua@14738
   174
obua@14738
   175
lemma equation_minus_iff: "(a = - b) = (b = - (a::'a::ab_group_add))"
obua@14738
   176
proof -
obua@14738
   177
  have "(- (-a) = - b) = (- a = b)" by (rule neg_equal_iff_equal)
obua@14738
   178
  thus ?thesis by (simp add: eq_commute)
obua@14738
   179
qed
obua@14738
   180
obua@14738
   181
lemma minus_equation_iff: "(- a = b) = (- (b::'a::ab_group_add) = a)"
obua@14738
   182
proof -
obua@14738
   183
  have "(- a = - (-b)) = (a = -b)" by (rule neg_equal_iff_equal)
obua@14738
   184
  thus ?thesis by (simp add: eq_commute)
obua@14738
   185
qed
obua@14738
   186
obua@14738
   187
lemma minus_add_distrib [simp]: "- (a + b) = -a + -(b::'a::ab_group_add)"
obua@14738
   188
apply (rule equals_zero_I)
obua@14738
   189
apply (simp add: add_ac) 
obua@14738
   190
done
obua@14738
   191
obua@14738
   192
lemma minus_diff_eq [simp]: "- (a - b) = b - (a::'a::ab_group_add)"
obua@14738
   193
by (simp add: diff_minus add_commute)
obua@14738
   194
obua@14738
   195
subsection {* (Partially) Ordered Groups *} 
obua@14738
   196
haftmann@22390
   197
class pordered_ab_semigroup_add = order + ab_semigroup_add +
haftmann@22390
   198
  assumes add_left_mono: "a \<sqsubseteq> b \<Longrightarrow> c \<^loc>+ a \<sqsubseteq> c \<^loc>+ b"
obua@14738
   199
haftmann@22390
   200
class pordered_cancel_ab_semigroup_add =
haftmann@22390
   201
  pordered_ab_semigroup_add + cancel_ab_semigroup_add
obua@14738
   202
obua@14738
   203
instance pordered_cancel_ab_semigroup_add \<subseteq> pordered_ab_semigroup_add ..
obua@14738
   204
haftmann@22390
   205
class pordered_ab_semigroup_add_imp_le = pordered_cancel_ab_semigroup_add +
haftmann@22390
   206
  assumes add_le_imp_le_left: "c \<^loc>+ a \<sqsubseteq> c + b \<Longrightarrow> a \<sqsubseteq> b"
obua@14738
   207
haftmann@22390
   208
class pordered_ab_group_add = ab_group_add + pordered_ab_semigroup_add
obua@14738
   209
obua@14738
   210
instance pordered_ab_group_add \<subseteq> pordered_ab_semigroup_add_imp_le
obua@14738
   211
proof
obua@14738
   212
  fix a b c :: 'a
obua@14738
   213
  assume "c + a \<le> c + b"
obua@14738
   214
  hence "(-c) + (c + a) \<le> (-c) + (c + b)" by (rule add_left_mono)
obua@14738
   215
  hence "((-c) + c) + a \<le> ((-c) + c) + b" by (simp only: add_assoc)
obua@14738
   216
  thus "a \<le> b" by simp
obua@14738
   217
qed
obua@14738
   218
haftmann@22390
   219
class ordered_cancel_ab_semigroup_add = pordered_cancel_ab_semigroup_add + linorder
obua@14738
   220
obua@14738
   221
instance ordered_cancel_ab_semigroup_add \<subseteq> pordered_ab_semigroup_add_imp_le
obua@14738
   222
proof
obua@14738
   223
  fix a b c :: 'a
obua@14738
   224
  assume le: "c + a <= c + b"  
obua@14738
   225
  show "a <= b"
obua@14738
   226
  proof (rule ccontr)
obua@14738
   227
    assume w: "~ a \<le> b"
obua@14738
   228
    hence "b <= a" by (simp add: linorder_not_le)
obua@14738
   229
    hence le2: "c+b <= c+a" by (rule add_left_mono)
obua@14738
   230
    have "a = b" 
obua@14738
   231
      apply (insert le)
obua@14738
   232
      apply (insert le2)
obua@14738
   233
      apply (drule order_antisym, simp_all)
obua@14738
   234
      done
obua@14738
   235
    with w  show False 
obua@14738
   236
      by (simp add: linorder_not_le [symmetric])
obua@14738
   237
  qed
obua@14738
   238
qed
obua@14738
   239
obua@14738
   240
lemma add_right_mono: "a \<le> (b::'a::pordered_ab_semigroup_add) ==> a + c \<le> b + c"
haftmann@22390
   241
  by (simp add: add_commute [of _ c] add_left_mono)
obua@14738
   242
obua@14738
   243
text {* non-strict, in both arguments *}
obua@14738
   244
lemma add_mono:
obua@14738
   245
     "[|a \<le> b;  c \<le> d|] ==> a + c \<le> b + (d::'a::pordered_ab_semigroup_add)"
obua@14738
   246
  apply (erule add_right_mono [THEN order_trans])
obua@14738
   247
  apply (simp add: add_commute add_left_mono)
obua@14738
   248
  done
obua@14738
   249
obua@14738
   250
lemma add_strict_left_mono:
obua@14738
   251
     "a < b ==> c + a < c + (b::'a::pordered_cancel_ab_semigroup_add)"
obua@14738
   252
 by (simp add: order_less_le add_left_mono) 
obua@14738
   253
obua@14738
   254
lemma add_strict_right_mono:
obua@14738
   255
     "a < b ==> a + c < b + (c::'a::pordered_cancel_ab_semigroup_add)"
obua@14738
   256
 by (simp add: add_commute [of _ c] add_strict_left_mono)
obua@14738
   257
obua@14738
   258
text{*Strict monotonicity in both arguments*}
obua@14738
   259
lemma add_strict_mono: "[|a<b; c<d|] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"
obua@14738
   260
apply (erule add_strict_right_mono [THEN order_less_trans])
obua@14738
   261
apply (erule add_strict_left_mono)
obua@14738
   262
done
obua@14738
   263
obua@14738
   264
lemma add_less_le_mono:
obua@14738
   265
     "[| a<b; c\<le>d |] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"
obua@14738
   266
apply (erule add_strict_right_mono [THEN order_less_le_trans])
obua@14738
   267
apply (erule add_left_mono) 
obua@14738
   268
done
obua@14738
   269
obua@14738
   270
lemma add_le_less_mono:
obua@14738
   271
     "[| a\<le>b; c<d |] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"
obua@14738
   272
apply (erule add_right_mono [THEN order_le_less_trans])
obua@14738
   273
apply (erule add_strict_left_mono) 
obua@14738
   274
done
obua@14738
   275
obua@14738
   276
lemma add_less_imp_less_left:
obua@14738
   277
      assumes less: "c + a < c + b"  shows "a < (b::'a::pordered_ab_semigroup_add_imp_le)"
obua@14738
   278
proof -
obua@14738
   279
  from less have le: "c + a <= c + b" by (simp add: order_le_less)
obua@14738
   280
  have "a <= b" 
obua@14738
   281
    apply (insert le)
obua@14738
   282
    apply (drule add_le_imp_le_left)
obua@14738
   283
    by (insert le, drule add_le_imp_le_left, assumption)
obua@14738
   284
  moreover have "a \<noteq> b"
obua@14738
   285
  proof (rule ccontr)
obua@14738
   286
    assume "~(a \<noteq> b)"
obua@14738
   287
    then have "a = b" by simp
obua@14738
   288
    then have "c + a = c + b" by simp
obua@14738
   289
    with less show "False"by simp
obua@14738
   290
  qed
obua@14738
   291
  ultimately show "a < b" by (simp add: order_le_less)
obua@14738
   292
qed
obua@14738
   293
obua@14738
   294
lemma add_less_imp_less_right:
obua@14738
   295
      "a + c < b + c ==> a < (b::'a::pordered_ab_semigroup_add_imp_le)"
obua@14738
   296
apply (rule add_less_imp_less_left [of c])
obua@14738
   297
apply (simp add: add_commute)  
obua@14738
   298
done
obua@14738
   299
obua@14738
   300
lemma add_less_cancel_left [simp]:
obua@14738
   301
    "(c+a < c+b) = (a < (b::'a::pordered_ab_semigroup_add_imp_le))"
obua@14738
   302
by (blast intro: add_less_imp_less_left add_strict_left_mono) 
obua@14738
   303
obua@14738
   304
lemma add_less_cancel_right [simp]:
obua@14738
   305
    "(a+c < b+c) = (a < (b::'a::pordered_ab_semigroup_add_imp_le))"
obua@14738
   306
by (blast intro: add_less_imp_less_right add_strict_right_mono)
obua@14738
   307
obua@14738
   308
lemma add_le_cancel_left [simp]:
obua@14738
   309
    "(c+a \<le> c+b) = (a \<le> (b::'a::pordered_ab_semigroup_add_imp_le))"
obua@14738
   310
by (auto, drule add_le_imp_le_left, simp_all add: add_left_mono) 
obua@14738
   311
obua@14738
   312
lemma add_le_cancel_right [simp]:
obua@14738
   313
    "(a+c \<le> b+c) = (a \<le> (b::'a::pordered_ab_semigroup_add_imp_le))"
obua@14738
   314
by (simp add: add_commute[of a c] add_commute[of b c])
obua@14738
   315
obua@14738
   316
lemma add_le_imp_le_right:
obua@14738
   317
      "a + c \<le> b + c ==> a \<le> (b::'a::pordered_ab_semigroup_add_imp_le)"
obua@14738
   318
by simp
obua@14738
   319
paulson@15234
   320
lemma add_increasing:
paulson@15234
   321
  fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"
paulson@15234
   322
  shows  "[|0\<le>a; b\<le>c|] ==> b \<le> a + c"
obua@14738
   323
by (insert add_mono [of 0 a b c], simp)
obua@14738
   324
nipkow@15539
   325
lemma add_increasing2:
nipkow@15539
   326
  fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"
nipkow@15539
   327
  shows  "[|0\<le>c; b\<le>a|] ==> b \<le> a + c"
nipkow@15539
   328
by (simp add:add_increasing add_commute[of a])
nipkow@15539
   329
paulson@15234
   330
lemma add_strict_increasing:
paulson@15234
   331
  fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"
paulson@15234
   332
  shows "[|0<a; b\<le>c|] ==> b < a + c"
paulson@15234
   333
by (insert add_less_le_mono [of 0 a b c], simp)
paulson@15234
   334
paulson@15234
   335
lemma add_strict_increasing2:
paulson@15234
   336
  fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"
paulson@15234
   337
  shows "[|0\<le>a; b<c|] ==> b < a + c"
paulson@15234
   338
by (insert add_le_less_mono [of 0 a b c], simp)
paulson@15234
   339
paulson@19527
   340
lemma max_add_distrib_left:
paulson@19527
   341
  fixes z :: "'a::pordered_ab_semigroup_add_imp_le"
paulson@19527
   342
  shows  "(max x y) + z = max (x+z) (y+z)"
paulson@19527
   343
by (rule max_of_mono [THEN sym], rule add_le_cancel_right)
paulson@19527
   344
paulson@19527
   345
lemma min_add_distrib_left:
paulson@19527
   346
  fixes z :: "'a::pordered_ab_semigroup_add_imp_le"
paulson@19527
   347
  shows  "(min x y) + z = min (x+z) (y+z)"
paulson@19527
   348
by (rule min_of_mono [THEN sym], rule add_le_cancel_right)
paulson@19527
   349
paulson@19527
   350
lemma max_diff_distrib_left:
paulson@19527
   351
  fixes z :: "'a::pordered_ab_group_add"
paulson@19527
   352
  shows  "(max x y) - z = max (x-z) (y-z)"
paulson@19527
   353
by (simp add: diff_minus, rule max_add_distrib_left) 
paulson@19527
   354
paulson@19527
   355
lemma min_diff_distrib_left:
paulson@19527
   356
  fixes z :: "'a::pordered_ab_group_add"
paulson@19527
   357
  shows  "(min x y) - z = min (x-z) (y-z)"
paulson@19527
   358
by (simp add: diff_minus, rule min_add_distrib_left) 
paulson@19527
   359
paulson@15234
   360
obua@14738
   361
subsection {* Ordering Rules for Unary Minus *}
obua@14738
   362
obua@14738
   363
lemma le_imp_neg_le:
obua@14738
   364
      assumes "a \<le> (b::'a::{pordered_ab_semigroup_add_imp_le, ab_group_add})" shows "-b \<le> -a"
obua@14738
   365
proof -
obua@14738
   366
  have "-a+a \<le> -a+b"
obua@14738
   367
    by (rule add_left_mono) 
obua@14738
   368
  hence "0 \<le> -a+b"
obua@14738
   369
    by simp
obua@14738
   370
  hence "0 + (-b) \<le> (-a + b) + (-b)"
obua@14738
   371
    by (rule add_right_mono) 
obua@14738
   372
  thus ?thesis
obua@14738
   373
    by (simp add: add_assoc)
obua@14738
   374
qed
obua@14738
   375
obua@14738
   376
lemma neg_le_iff_le [simp]: "(-b \<le> -a) = (a \<le> (b::'a::pordered_ab_group_add))"
obua@14738
   377
proof 
obua@14738
   378
  assume "- b \<le> - a"
obua@14738
   379
  hence "- (- a) \<le> - (- b)"
obua@14738
   380
    by (rule le_imp_neg_le)
obua@14738
   381
  thus "a\<le>b" by simp
obua@14738
   382
next
obua@14738
   383
  assume "a\<le>b"
obua@14738
   384
  thus "-b \<le> -a" by (rule le_imp_neg_le)
obua@14738
   385
qed
obua@14738
   386
obua@14738
   387
lemma neg_le_0_iff_le [simp]: "(-a \<le> 0) = (0 \<le> (a::'a::pordered_ab_group_add))"
obua@14738
   388
by (subst neg_le_iff_le [symmetric], simp)
obua@14738
   389
obua@14738
   390
lemma neg_0_le_iff_le [simp]: "(0 \<le> -a) = (a \<le> (0::'a::pordered_ab_group_add))"
obua@14738
   391
by (subst neg_le_iff_le [symmetric], simp)
obua@14738
   392
obua@14738
   393
lemma neg_less_iff_less [simp]: "(-b < -a) = (a < (b::'a::pordered_ab_group_add))"
obua@14738
   394
by (force simp add: order_less_le) 
obua@14738
   395
obua@14738
   396
lemma neg_less_0_iff_less [simp]: "(-a < 0) = (0 < (a::'a::pordered_ab_group_add))"
obua@14738
   397
by (subst neg_less_iff_less [symmetric], simp)
obua@14738
   398
obua@14738
   399
lemma neg_0_less_iff_less [simp]: "(0 < -a) = (a < (0::'a::pordered_ab_group_add))"
obua@14738
   400
by (subst neg_less_iff_less [symmetric], simp)
obua@14738
   401
obua@14738
   402
text{*The next several equations can make the simplifier loop!*}
obua@14738
   403
obua@14738
   404
lemma less_minus_iff: "(a < - b) = (b < - (a::'a::pordered_ab_group_add))"
obua@14738
   405
proof -
obua@14738
   406
  have "(- (-a) < - b) = (b < - a)" by (rule neg_less_iff_less)
obua@14738
   407
  thus ?thesis by simp
obua@14738
   408
qed
obua@14738
   409
obua@14738
   410
lemma minus_less_iff: "(- a < b) = (- b < (a::'a::pordered_ab_group_add))"
obua@14738
   411
proof -
obua@14738
   412
  have "(- a < - (-b)) = (- b < a)" by (rule neg_less_iff_less)
obua@14738
   413
  thus ?thesis by simp
obua@14738
   414
qed
obua@14738
   415
obua@14738
   416
lemma le_minus_iff: "(a \<le> - b) = (b \<le> - (a::'a::pordered_ab_group_add))"
obua@14738
   417
proof -
obua@14738
   418
  have mm: "!! a (b::'a). (-(-a)) < -b \<Longrightarrow> -(-b) < -a" by (simp only: minus_less_iff)
obua@14738
   419
  have "(- (- a) <= -b) = (b <= - a)" 
obua@14738
   420
    apply (auto simp only: order_le_less)
obua@14738
   421
    apply (drule mm)
obua@14738
   422
    apply (simp_all)
obua@14738
   423
    apply (drule mm[simplified], assumption)
obua@14738
   424
    done
obua@14738
   425
  then show ?thesis by simp
obua@14738
   426
qed
obua@14738
   427
obua@14738
   428
lemma minus_le_iff: "(- a \<le> b) = (- b \<le> (a::'a::pordered_ab_group_add))"
obua@14738
   429
by (auto simp add: order_le_less minus_less_iff)
obua@14738
   430
obua@14738
   431
lemma add_diff_eq: "a + (b - c) = (a + b) - (c::'a::ab_group_add)"
obua@14738
   432
by (simp add: diff_minus add_ac)
obua@14738
   433
obua@14738
   434
lemma diff_add_eq: "(a - b) + c = (a + c) - (b::'a::ab_group_add)"
obua@14738
   435
by (simp add: diff_minus add_ac)
obua@14738
   436
obua@14738
   437
lemma diff_eq_eq: "(a-b = c) = (a = c + (b::'a::ab_group_add))"
obua@14738
   438
by (auto simp add: diff_minus add_assoc)
obua@14738
   439
obua@14738
   440
lemma eq_diff_eq: "(a = c-b) = (a + (b::'a::ab_group_add) = c)"
obua@14738
   441
by (auto simp add: diff_minus add_assoc)
obua@14738
   442
obua@14738
   443
lemma diff_diff_eq: "(a - b) - c = a - (b + (c::'a::ab_group_add))"
obua@14738
   444
by (simp add: diff_minus add_ac)
obua@14738
   445
obua@14738
   446
lemma diff_diff_eq2: "a - (b - c) = (a + c) - (b::'a::ab_group_add)"
obua@14738
   447
by (simp add: diff_minus add_ac)
obua@14738
   448
obua@14738
   449
lemma diff_add_cancel: "a - b + b = (a::'a::ab_group_add)"
obua@14738
   450
by (simp add: diff_minus add_ac)
obua@14738
   451
obua@14738
   452
lemma add_diff_cancel: "a + b - b = (a::'a::ab_group_add)"
obua@14738
   453
by (simp add: diff_minus add_ac)
obua@14738
   454
obua@14754
   455
text{*Further subtraction laws*}
obua@14738
   456
obua@14738
   457
lemma less_iff_diff_less_0: "(a < b) = (a - b < (0::'a::pordered_ab_group_add))"
obua@14738
   458
proof -
obua@14738
   459
  have  "(a < b) = (a + (- b) < b + (-b))"  
obua@14738
   460
    by (simp only: add_less_cancel_right)
obua@14738
   461
  also have "... =  (a - b < 0)" by (simp add: diff_minus)
obua@14738
   462
  finally show ?thesis .
obua@14738
   463
qed
obua@14738
   464
obua@14738
   465
lemma diff_less_eq: "(a-b < c) = (a < c + (b::'a::pordered_ab_group_add))"
paulson@15481
   466
apply (subst less_iff_diff_less_0 [of a])
obua@14738
   467
apply (rule less_iff_diff_less_0 [of _ c, THEN ssubst])
obua@14738
   468
apply (simp add: diff_minus add_ac)
obua@14738
   469
done
obua@14738
   470
obua@14738
   471
lemma less_diff_eq: "(a < c-b) = (a + (b::'a::pordered_ab_group_add) < c)"
paulson@15481
   472
apply (subst less_iff_diff_less_0 [of "a+b"])
paulson@15481
   473
apply (subst less_iff_diff_less_0 [of a])
obua@14738
   474
apply (simp add: diff_minus add_ac)
obua@14738
   475
done
obua@14738
   476
obua@14738
   477
lemma diff_le_eq: "(a-b \<le> c) = (a \<le> c + (b::'a::pordered_ab_group_add))"
obua@14738
   478
by (auto simp add: order_le_less diff_less_eq diff_add_cancel add_diff_cancel)
obua@14738
   479
obua@14738
   480
lemma le_diff_eq: "(a \<le> c-b) = (a + (b::'a::pordered_ab_group_add) \<le> c)"
obua@14738
   481
by (auto simp add: order_le_less less_diff_eq diff_add_cancel add_diff_cancel)
obua@14738
   482
obua@14738
   483
text{*This list of rewrites simplifies (in)equalities by bringing subtractions
obua@14738
   484
  to the top and then moving negative terms to the other side.
obua@14738
   485
  Use with @{text add_ac}*}
obua@14738
   486
lemmas compare_rls =
obua@14738
   487
       diff_minus [symmetric]
obua@14738
   488
       add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
obua@14738
   489
       diff_less_eq less_diff_eq diff_le_eq le_diff_eq
obua@14738
   490
       diff_eq_eq eq_diff_eq
obua@14738
   491
avigad@16775
   492
subsection {* Support for reasoning about signs *}
avigad@16775
   493
avigad@16775
   494
lemma add_pos_pos: "0 < 
avigad@16775
   495
    (x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) 
avigad@16775
   496
      ==> 0 < y ==> 0 < x + y"
avigad@16775
   497
apply (subgoal_tac "0 + 0 < x + y")
avigad@16775
   498
apply simp
avigad@16775
   499
apply (erule add_less_le_mono)
avigad@16775
   500
apply (erule order_less_imp_le)
avigad@16775
   501
done
avigad@16775
   502
avigad@16775
   503
lemma add_pos_nonneg: "0 < 
avigad@16775
   504
    (x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) 
avigad@16775
   505
      ==> 0 <= y ==> 0 < x + y"
avigad@16775
   506
apply (subgoal_tac "0 + 0 < x + y")
avigad@16775
   507
apply simp
avigad@16775
   508
apply (erule add_less_le_mono, assumption)
avigad@16775
   509
done
avigad@16775
   510
avigad@16775
   511
lemma add_nonneg_pos: "0 <= 
avigad@16775
   512
    (x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) 
avigad@16775
   513
      ==> 0 < y ==> 0 < x + y"
avigad@16775
   514
apply (subgoal_tac "0 + 0 < x + y")
avigad@16775
   515
apply simp
avigad@16775
   516
apply (erule add_le_less_mono, assumption)
avigad@16775
   517
done
avigad@16775
   518
avigad@16775
   519
lemma add_nonneg_nonneg: "0 <= 
avigad@16775
   520
    (x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) 
avigad@16775
   521
      ==> 0 <= y ==> 0 <= x + y"
avigad@16775
   522
apply (subgoal_tac "0 + 0 <= x + y")
avigad@16775
   523
apply simp
avigad@16775
   524
apply (erule add_mono, assumption)
avigad@16775
   525
done
avigad@16775
   526
avigad@16775
   527
lemma add_neg_neg: "(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add})
avigad@16775
   528
    < 0 ==> y < 0 ==> x + y < 0"
avigad@16775
   529
apply (subgoal_tac "x + y < 0 + 0")
avigad@16775
   530
apply simp
avigad@16775
   531
apply (erule add_less_le_mono)
avigad@16775
   532
apply (erule order_less_imp_le)
avigad@16775
   533
done
avigad@16775
   534
avigad@16775
   535
lemma add_neg_nonpos: 
avigad@16775
   536
    "(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) < 0 
avigad@16775
   537
      ==> y <= 0 ==> x + y < 0"
avigad@16775
   538
apply (subgoal_tac "x + y < 0 + 0")
avigad@16775
   539
apply simp
avigad@16775
   540
apply (erule add_less_le_mono, assumption)
avigad@16775
   541
done
avigad@16775
   542
avigad@16775
   543
lemma add_nonpos_neg: 
avigad@16775
   544
    "(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) <= 0 
avigad@16775
   545
      ==> y < 0 ==> x + y < 0"
avigad@16775
   546
apply (subgoal_tac "x + y < 0 + 0")
avigad@16775
   547
apply simp
avigad@16775
   548
apply (erule add_le_less_mono, assumption)
avigad@16775
   549
done
avigad@16775
   550
avigad@16775
   551
lemma add_nonpos_nonpos: 
avigad@16775
   552
    "(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) <= 0 
avigad@16775
   553
      ==> y <= 0 ==> x + y <= 0"
avigad@16775
   554
apply (subgoal_tac "x + y <= 0 + 0")
avigad@16775
   555
apply simp
avigad@16775
   556
apply (erule add_mono, assumption)
avigad@16775
   557
done
obua@14738
   558
obua@14738
   559
subsection{*Lemmas for the @{text cancel_numerals} simproc*}
obua@14738
   560
obua@14738
   561
lemma eq_iff_diff_eq_0: "(a = b) = (a-b = (0::'a::ab_group_add))"
obua@14738
   562
by (simp add: compare_rls)
obua@14738
   563
obua@14738
   564
lemma le_iff_diff_le_0: "(a \<le> b) = (a-b \<le> (0::'a::pordered_ab_group_add))"
obua@14738
   565
by (simp add: compare_rls)
obua@14738
   566
obua@14738
   567
subsection {* Lattice Ordered (Abelian) Groups *}
obua@14738
   568
obua@14738
   569
axclass lordered_ab_group_meet < pordered_ab_group_add, meet_semilorder
obua@14738
   570
obua@14738
   571
axclass lordered_ab_group_join < pordered_ab_group_add, join_semilorder
obua@14738
   572
obua@14738
   573
lemma add_meet_distrib_left: "a + (meet b c) = meet (a + b) (a + (c::'a::{pordered_ab_group_add, meet_semilorder}))"
obua@14738
   574
apply (rule order_antisym)
nipkow@21312
   575
apply (simp_all add: le_meetI)
obua@14738
   576
apply (rule add_le_imp_le_left [of "-a"])
obua@14738
   577
apply (simp only: add_assoc[symmetric], simp)
nipkow@21312
   578
apply rule
nipkow@21312
   579
apply (rule add_le_imp_le_left[of "a"], simp only: add_assoc[symmetric], simp)+
obua@14738
   580
done
obua@14738
   581
obua@14738
   582
lemma add_join_distrib_left: "a + (join b c) = join (a + b) (a+ (c::'a::{pordered_ab_group_add, join_semilorder}))" 
obua@14738
   583
apply (rule order_antisym)
obua@14738
   584
apply (rule add_le_imp_le_left [of "-a"])
obua@14738
   585
apply (simp only: add_assoc[symmetric], simp)
nipkow@21312
   586
apply rule
nipkow@21312
   587
apply (rule add_le_imp_le_left [of "a"], simp only: add_assoc[symmetric], simp)+
nipkow@21312
   588
apply (rule join_leI)
nipkow@21312
   589
apply (simp_all)
obua@14738
   590
done
obua@14738
   591
obua@14738
   592
lemma is_join_neg_meet: "is_join (% (a::'a::{pordered_ab_group_add, meet_semilorder}) b. - (meet (-a) (-b)))"
obua@14738
   593
apply (auto simp add: is_join_def)
nipkow@21312
   594
apply (rule_tac c="meet (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_meet_distrib_left)
nipkow@21312
   595
apply (rule_tac c="meet (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_meet_distrib_left)
obua@14738
   596
apply (subst neg_le_iff_le[symmetric]) 
nipkow@21312
   597
apply (simp add: le_meetI)
obua@14738
   598
done
obua@14738
   599
obua@14738
   600
lemma is_meet_neg_join: "is_meet (% (a::'a::{pordered_ab_group_add, join_semilorder}) b. - (join (-a) (-b)))"
obua@14738
   601
apply (auto simp add: is_meet_def)
nipkow@21312
   602
apply (rule_tac c="join (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_join_distrib_left)
nipkow@21312
   603
apply (rule_tac c="join (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_join_distrib_left)
obua@14738
   604
apply (subst neg_le_iff_le[symmetric]) 
nipkow@21312
   605
apply (simp add: join_leI)
obua@14738
   606
done
obua@14738
   607
obua@14738
   608
axclass lordered_ab_group \<subseteq> pordered_ab_group_add, lorder
obua@14738
   609
obua@14738
   610
instance lordered_ab_group_meet \<subseteq> lordered_ab_group
obua@14738
   611
proof 
obua@14738
   612
  show "? j. is_join (j::'a\<Rightarrow>'a\<Rightarrow>('a::lordered_ab_group_meet))" by (blast intro: is_join_neg_meet)
obua@14738
   613
qed
obua@14738
   614
obua@14738
   615
instance lordered_ab_group_join \<subseteq> lordered_ab_group
obua@14738
   616
proof
obua@14738
   617
  show "? m. is_meet (m::'a\<Rightarrow>'a\<Rightarrow>('a::lordered_ab_group_join))" by (blast intro: is_meet_neg_join)
obua@14738
   618
qed
obua@14738
   619
obua@14738
   620
lemma add_join_distrib_right: "(join a b) + (c::'a::lordered_ab_group) = join (a+c) (b+c)"
obua@14738
   621
proof -
obua@14738
   622
  have "c + (join a b) = join (c+a) (c+b)" by (simp add: add_join_distrib_left)
obua@14738
   623
  thus ?thesis by (simp add: add_commute)
obua@14738
   624
qed
obua@14738
   625
obua@14738
   626
lemma add_meet_distrib_right: "(meet a b) + (c::'a::lordered_ab_group) = meet (a+c) (b+c)"
obua@14738
   627
proof -
obua@14738
   628
  have "c + (meet a b) = meet (c+a) (c+b)" by (simp add: add_meet_distrib_left)
obua@14738
   629
  thus ?thesis by (simp add: add_commute)
obua@14738
   630
qed
obua@14738
   631
obua@14738
   632
lemmas add_meet_join_distribs = add_meet_distrib_right add_meet_distrib_left add_join_distrib_right add_join_distrib_left
obua@14738
   633
obua@14738
   634
lemma join_eq_neg_meet: "join a (b::'a::lordered_ab_group) = - meet (-a) (-b)"
obua@14738
   635
by (simp add: is_join_unique[OF is_join_join is_join_neg_meet])
obua@14738
   636
obua@14738
   637
lemma meet_eq_neg_join: "meet a (b::'a::lordered_ab_group) = - join (-a) (-b)"
obua@14738
   638
by (simp add: is_meet_unique[OF is_meet_meet is_meet_neg_join])
obua@14738
   639
obua@14738
   640
lemma add_eq_meet_join: "a + b = (join a b) + (meet a (b::'a::lordered_ab_group))"
obua@14738
   641
proof -
obua@14738
   642
  have "0 = - meet 0 (a-b) + meet (a-b) 0" by (simp add: meet_comm)
obua@14738
   643
  hence "0 = join 0 (b-a) + meet (a-b) 0" by (simp add: meet_eq_neg_join)
obua@14738
   644
  hence "0 = (-a + join a b) + (meet a b + (-b))"
obua@14738
   645
    apply (simp add: add_join_distrib_left add_meet_distrib_right)
obua@14738
   646
    by (simp add: diff_minus add_commute)
obua@14738
   647
  thus ?thesis
obua@14738
   648
    apply (simp add: compare_rls)
obua@14738
   649
    apply (subst add_left_cancel[symmetric, of "a+b" "join a b + meet a b" "-a"])
obua@14738
   650
    apply (simp only: add_assoc, simp add: add_assoc[symmetric])
obua@14738
   651
    done
obua@14738
   652
qed
obua@14738
   653
obua@14738
   654
subsection {* Positive Part, Negative Part, Absolute Value *}
obua@14738
   655
obua@14738
   656
constdefs
obua@14738
   657
  pprt :: "'a \<Rightarrow> ('a::lordered_ab_group)"
obua@14738
   658
  "pprt x == join x 0"
obua@14738
   659
  nprt :: "'a \<Rightarrow> ('a::lordered_ab_group)"
obua@14738
   660
  "nprt x == meet x 0"
obua@14738
   661
obua@14738
   662
lemma prts: "a = pprt a + nprt a"
obua@14738
   663
by (simp add: pprt_def nprt_def add_eq_meet_join[symmetric])
obua@14738
   664
obua@14738
   665
lemma zero_le_pprt[simp]: "0 \<le> pprt a"
nipkow@21312
   666
by (simp add: pprt_def)
obua@14738
   667
obua@14738
   668
lemma nprt_le_zero[simp]: "nprt a \<le> 0"
nipkow@21312
   669
by (simp add: nprt_def)
obua@14738
   670
obua@14738
   671
lemma le_eq_neg: "(a \<le> -b) = (a + b \<le> (0::_::lordered_ab_group))" (is "?l = ?r")
obua@14738
   672
proof -
obua@14738
   673
  have a: "?l \<longrightarrow> ?r"
obua@14738
   674
    apply (auto)
obua@14738
   675
    apply (rule add_le_imp_le_right[of _ "-b" _])
obua@14738
   676
    apply (simp add: add_assoc)
obua@14738
   677
    done
obua@14738
   678
  have b: "?r \<longrightarrow> ?l"
obua@14738
   679
    apply (auto)
obua@14738
   680
    apply (rule add_le_imp_le_right[of _ "b" _])
obua@14738
   681
    apply (simp)
obua@14738
   682
    done
obua@14738
   683
  from a b show ?thesis by blast
obua@14738
   684
qed
obua@14738
   685
obua@15580
   686
lemma pprt_0[simp]: "pprt 0 = 0" by (simp add: pprt_def)
obua@15580
   687
lemma nprt_0[simp]: "nprt 0 = 0" by (simp add: nprt_def)
obua@15580
   688
obua@15580
   689
lemma pprt_eq_id[simp]: "0 <= x \<Longrightarrow> pprt x = x"
obua@15580
   690
  by (simp add: pprt_def le_def_join join_aci)
obua@15580
   691
obua@15580
   692
lemma nprt_eq_id[simp]: "x <= 0 \<Longrightarrow> nprt x = x"
obua@15580
   693
  by (simp add: nprt_def le_def_meet meet_aci)
obua@15580
   694
obua@15580
   695
lemma pprt_eq_0[simp]: "x <= 0 \<Longrightarrow> pprt x = 0"
obua@15580
   696
  by (simp add: pprt_def le_def_join join_aci)
obua@15580
   697
obua@15580
   698
lemma nprt_eq_0[simp]: "0 <= x \<Longrightarrow> nprt x = 0"
obua@15580
   699
  by (simp add: nprt_def le_def_meet meet_aci)
obua@15580
   700
obua@14738
   701
lemma join_0_imp_0: "join a (-a) = 0 \<Longrightarrow> a = (0::'a::lordered_ab_group)"
obua@14738
   702
proof -
obua@14738
   703
  {
obua@14738
   704
    fix a::'a
obua@14738
   705
    assume hyp: "join a (-a) = 0"
obua@14738
   706
    hence "join a (-a) + a = a" by (simp)
obua@14738
   707
    hence "join (a+a) 0 = a" by (simp add: add_join_distrib_right) 
obua@14738
   708
    hence "join (a+a) 0 <= a" by (simp)
obua@14738
   709
    hence "0 <= a" by (blast intro: order_trans meet_join_le)
obua@14738
   710
  }
obua@14738
   711
  note p = this
obua@14738
   712
  assume hyp:"join a (-a) = 0"
obua@14738
   713
  hence hyp2:"join (-a) (-(-a)) = 0" by (simp add: join_comm)
obua@14738
   714
  from p[OF hyp] p[OF hyp2] show "a = 0" by simp
obua@14738
   715
qed
obua@14738
   716
obua@14738
   717
lemma meet_0_imp_0: "meet a (-a) = 0 \<Longrightarrow> a = (0::'a::lordered_ab_group)"
obua@14738
   718
apply (simp add: meet_eq_neg_join)
obua@14738
   719
apply (simp add: join_comm)
paulson@15481
   720
apply (erule join_0_imp_0)
paulson@15481
   721
done
obua@14738
   722
obua@14738
   723
lemma join_0_eq_0[simp]: "(join a (-a) = 0) = (a = (0::'a::lordered_ab_group))"
obua@14738
   724
by (auto, erule join_0_imp_0)
obua@14738
   725
obua@14738
   726
lemma meet_0_eq_0[simp]: "(meet a (-a) = 0) = (a = (0::'a::lordered_ab_group))"
obua@14738
   727
by (auto, erule meet_0_imp_0)
obua@14738
   728
obua@14738
   729
lemma zero_le_double_add_iff_zero_le_single_add[simp]: "(0 \<le> a + a) = (0 \<le> (a::'a::lordered_ab_group))"
obua@14738
   730
proof
obua@14738
   731
  assume "0 <= a + a"
obua@14738
   732
  hence a:"meet (a+a) 0 = 0" by (simp add: le_def_meet meet_comm)
obua@14738
   733
  have "(meet a 0)+(meet a 0) = meet (meet (a+a) 0) a" (is "?l=_") by (simp add: add_meet_join_distribs meet_aci)
obua@14738
   734
  hence "?l = 0 + meet a 0" by (simp add: a, simp add: meet_comm)
obua@14738
   735
  hence "meet a 0 = 0" by (simp only: add_right_cancel)
obua@14738
   736
  then show "0 <= a" by (simp add: le_def_meet meet_comm)    
obua@14738
   737
next  
obua@14738
   738
  assume a: "0 <= a"
obua@14738
   739
  show "0 <= a + a" by (simp add: add_mono[OF a a, simplified])
obua@14738
   740
qed
obua@14738
   741
obua@14738
   742
lemma double_add_le_zero_iff_single_add_le_zero[simp]: "(a + a <= 0) = ((a::'a::lordered_ab_group) <= 0)" 
obua@14738
   743
proof -
obua@14738
   744
  have "(a + a <= 0) = (0 <= -(a+a))" by (subst le_minus_iff, simp)
obua@14738
   745
  moreover have "\<dots> = (a <= 0)" by (simp add: zero_le_double_add_iff_zero_le_single_add)
obua@14738
   746
  ultimately show ?thesis by blast
obua@14738
   747
qed
obua@14738
   748
obua@14738
   749
lemma double_add_less_zero_iff_single_less_zero[simp]: "(a+a<0) = ((a::'a::{pordered_ab_group_add,linorder}) < 0)" (is ?s)
obua@14738
   750
proof cases
obua@14738
   751
  assume a: "a < 0"
obua@14738
   752
  thus ?s by (simp add:  add_strict_mono[OF a a, simplified])
obua@14738
   753
next
obua@14738
   754
  assume "~(a < 0)" 
obua@14738
   755
  hence a:"0 <= a" by (simp)
obua@14738
   756
  hence "0 <= a+a" by (simp add: add_mono[OF a a, simplified])
obua@14738
   757
  hence "~(a+a < 0)" by simp
obua@14738
   758
  with a show ?thesis by simp 
obua@14738
   759
qed
obua@14738
   760
obua@14738
   761
axclass lordered_ab_group_abs \<subseteq> lordered_ab_group
obua@14738
   762
  abs_lattice: "abs x = join x (-x)"
obua@14738
   763
obua@14738
   764
lemma abs_zero[simp]: "abs 0 = (0::'a::lordered_ab_group_abs)"
obua@14738
   765
by (simp add: abs_lattice)
obua@14738
   766
obua@14738
   767
lemma abs_eq_0[simp]: "(abs a = 0) = (a = (0::'a::lordered_ab_group_abs))"
obua@14738
   768
by (simp add: abs_lattice)
obua@14738
   769
obua@14738
   770
lemma abs_0_eq[simp]: "(0 = abs a) = (a = (0::'a::lordered_ab_group_abs))"
obua@14738
   771
proof -
obua@14738
   772
  have "(0 = abs a) = (abs a = 0)" by (simp only: eq_ac)
obua@14738
   773
  thus ?thesis by simp
obua@14738
   774
qed
obua@14738
   775
obua@14738
   776
lemma neg_meet_eq_join[simp]: "- meet a (b::_::lordered_ab_group) = join (-a) (-b)"
obua@14738
   777
by (simp add: meet_eq_neg_join)
obua@14738
   778
obua@14738
   779
lemma neg_join_eq_meet[simp]: "- join a (b::_::lordered_ab_group) = meet (-a) (-b)"
obua@14738
   780
by (simp del: neg_meet_eq_join add: join_eq_neg_meet)
obua@14738
   781
obua@14738
   782
lemma join_eq_if: "join a (-a) = (if a < 0 then -a else (a::'a::{lordered_ab_group, linorder}))"
obua@14738
   783
proof -
obua@14738
   784
  note b = add_le_cancel_right[of a a "-a",symmetric,simplified]
obua@14738
   785
  have c: "a + a = 0 \<Longrightarrow> -a = a" by (rule add_right_imp_eq[of _ a], simp)
nipkow@15197
   786
  show ?thesis by (auto simp add: join_max max_def b linorder_not_less)
obua@14738
   787
qed
obua@14738
   788
obua@14738
   789
lemma abs_if_lattice: "\<bar>a\<bar> = (if a < 0 then -a else (a::'a::{lordered_ab_group_abs, linorder}))"
obua@14738
   790
proof -
obua@14738
   791
  show ?thesis by (simp add: abs_lattice join_eq_if)
obua@14738
   792
qed
obua@14738
   793
obua@14738
   794
lemma abs_ge_zero[simp]: "0 \<le> abs (a::'a::lordered_ab_group_abs)"
obua@14738
   795
proof -
nipkow@21312
   796
  have a:"a <= abs a" and b:"-a <= abs a" by (auto simp add: abs_lattice)
obua@14738
   797
  show ?thesis by (rule add_mono[OF a b, simplified])
obua@14738
   798
qed
obua@14738
   799
  
obua@14738
   800
lemma abs_le_zero_iff [simp]: "(abs a \<le> (0::'a::lordered_ab_group_abs)) = (a = 0)" 
obua@14738
   801
proof
obua@14738
   802
  assume "abs a <= 0"
obua@14738
   803
  hence "abs a = 0" by (auto dest: order_antisym)
obua@14738
   804
  thus "a = 0" by simp
obua@14738
   805
next
obua@14738
   806
  assume "a = 0"
obua@14738
   807
  thus "abs a <= 0" by simp
obua@14738
   808
qed
obua@14738
   809
obua@14738
   810
lemma zero_less_abs_iff [simp]: "(0 < abs a) = (a \<noteq> (0::'a::lordered_ab_group_abs))"
obua@14738
   811
by (simp add: order_less_le)
obua@14738
   812
obua@14738
   813
lemma abs_not_less_zero [simp]: "~ abs a < (0::'a::lordered_ab_group_abs)"
obua@14738
   814
proof -
obua@14738
   815
  have a:"!! x (y::_::order). x <= y \<Longrightarrow> ~(y < x)" by auto
obua@14738
   816
  show ?thesis by (simp add: a)
obua@14738
   817
qed
obua@14738
   818
obua@14738
   819
lemma abs_ge_self: "a \<le> abs (a::'a::lordered_ab_group_abs)"
nipkow@21312
   820
by (simp add: abs_lattice)
obua@14738
   821
obua@14738
   822
lemma abs_ge_minus_self: "-a \<le> abs (a::'a::lordered_ab_group_abs)"
nipkow@21312
   823
by (simp add: abs_lattice)
obua@14738
   824
obua@14738
   825
lemma abs_prts: "abs (a::_::lordered_ab_group_abs) = pprt a - nprt a"
obua@14738
   826
apply (simp add: pprt_def nprt_def diff_minus)
obua@14738
   827
apply (simp add: add_meet_join_distribs join_aci abs_lattice[symmetric])
nipkow@21312
   828
apply (subst join_absorp2, auto)
obua@14738
   829
done
obua@14738
   830
obua@14738
   831
lemma abs_minus_cancel [simp]: "abs (-a) = abs(a::'a::lordered_ab_group_abs)"
obua@14738
   832
by (simp add: abs_lattice join_comm)
obua@14738
   833
obua@14738
   834
lemma abs_idempotent [simp]: "abs (abs a) = abs (a::'a::lordered_ab_group_abs)"
obua@14738
   835
apply (simp add: abs_lattice[of "abs a"])
nipkow@21312
   836
apply (subst join_absorp1)
obua@14738
   837
apply (rule order_trans[of _ 0])
obua@14738
   838
by auto
obua@14738
   839
paulson@15093
   840
lemma abs_minus_commute: 
paulson@15093
   841
  fixes a :: "'a::lordered_ab_group_abs"
paulson@15093
   842
  shows "abs (a-b) = abs(b-a)"
paulson@15093
   843
proof -
paulson@15093
   844
  have "abs (a-b) = abs (- (a-b))" by (simp only: abs_minus_cancel)
paulson@15093
   845
  also have "... = abs(b-a)" by simp
paulson@15093
   846
  finally show ?thesis .
paulson@15093
   847
qed
paulson@15093
   848
obua@14738
   849
lemma zero_le_iff_zero_nprt: "(0 \<le> a) = (nprt a = 0)"
obua@14738
   850
by (simp add: le_def_meet nprt_def meet_comm)
obua@14738
   851
obua@14738
   852
lemma le_zero_iff_zero_pprt: "(a \<le> 0) = (pprt a = 0)"
obua@14738
   853
by (simp add: le_def_join pprt_def join_comm)
obua@14738
   854
obua@14738
   855
lemma le_zero_iff_pprt_id: "(0 \<le> a) = (pprt a = a)"
obua@14738
   856
by (simp add: le_def_join pprt_def join_comm)
obua@14738
   857
obua@14738
   858
lemma zero_le_iff_nprt_id: "(a \<le> 0) = (nprt a = a)"
obua@14738
   859
by (simp add: le_def_meet nprt_def meet_comm)
obua@14738
   860
obua@15580
   861
lemma pprt_mono[simp]: "(a::_::lordered_ab_group) <= b \<Longrightarrow> pprt a <= pprt b"
obua@15580
   862
  by (simp add: le_def_join pprt_def join_aci)
obua@15580
   863
obua@15580
   864
lemma nprt_mono[simp]: "(a::_::lordered_ab_group) <= b \<Longrightarrow> nprt a <= nprt b"
obua@15580
   865
  by (simp add: le_def_meet nprt_def meet_aci)
obua@15580
   866
obua@19404
   867
lemma pprt_neg: "pprt (-x) = - nprt x"
obua@19404
   868
  by (simp add: pprt_def nprt_def)
obua@19404
   869
obua@19404
   870
lemma nprt_neg: "nprt (-x) = - pprt x"
obua@19404
   871
  by (simp add: pprt_def nprt_def)
obua@19404
   872
obua@14738
   873
lemma iff2imp: "(A=B) \<Longrightarrow> (A \<Longrightarrow> B)"
obua@14738
   874
by (simp)
obua@14738
   875
avigad@16775
   876
lemma abs_of_nonneg [simp]: "0 \<le> a \<Longrightarrow> abs a = (a::'a::lordered_ab_group_abs)"
obua@14738
   877
by (simp add: iff2imp[OF zero_le_iff_zero_nprt] iff2imp[OF le_zero_iff_pprt_id] abs_prts)
obua@14738
   878
avigad@16775
   879
lemma abs_of_pos: "0 < (x::'a::lordered_ab_group_abs) ==> abs x = x";
avigad@16775
   880
by (rule abs_of_nonneg, rule order_less_imp_le);
avigad@16775
   881
avigad@16775
   882
lemma abs_of_nonpos [simp]: "a \<le> 0 \<Longrightarrow> abs a = -(a::'a::lordered_ab_group_abs)"
obua@14738
   883
by (simp add: iff2imp[OF le_zero_iff_zero_pprt] iff2imp[OF zero_le_iff_nprt_id] abs_prts)
obua@14738
   884
avigad@16775
   885
lemma abs_of_neg: "(x::'a::lordered_ab_group_abs) <  0 ==> 
avigad@16775
   886
  abs x = - x"
avigad@16775
   887
by (rule abs_of_nonpos, rule order_less_imp_le)
avigad@16775
   888
obua@14738
   889
lemma abs_leI: "[|a \<le> b; -a \<le> b|] ==> abs a \<le> (b::'a::lordered_ab_group_abs)"
nipkow@21312
   890
by (simp add: abs_lattice join_leI)
obua@14738
   891
obua@14738
   892
lemma le_minus_self_iff: "(a \<le> -a) = (a \<le> (0::'a::lordered_ab_group))"
obua@14738
   893
proof -
obua@14738
   894
  from add_le_cancel_left[of "-a" "a+a" "0"] have "(a <= -a) = (a+a <= 0)" 
obua@14738
   895
    by (simp add: add_assoc[symmetric])
obua@14738
   896
  thus ?thesis by simp
obua@14738
   897
qed
obua@14738
   898
obua@14738
   899
lemma minus_le_self_iff: "(-a \<le> a) = (0 \<le> (a::'a::lordered_ab_group))"
obua@14738
   900
proof -
obua@14738
   901
  from add_le_cancel_left[of "-a" "0" "a+a"] have "(-a <= a) = (0 <= a+a)" 
obua@14738
   902
    by (simp add: add_assoc[symmetric])
obua@14738
   903
  thus ?thesis by simp
obua@14738
   904
qed
obua@14738
   905
obua@14738
   906
lemma abs_le_D1: "abs a \<le> b ==> a \<le> (b::'a::lordered_ab_group_abs)"
obua@14738
   907
by (insert abs_ge_self, blast intro: order_trans)
obua@14738
   908
obua@14738
   909
lemma abs_le_D2: "abs a \<le> b ==> -a \<le> (b::'a::lordered_ab_group_abs)"
obua@14738
   910
by (insert abs_le_D1 [of "-a"], simp)
obua@14738
   911
obua@14738
   912
lemma abs_le_iff: "(abs a \<le> b) = (a \<le> b & -a \<le> (b::'a::lordered_ab_group_abs))"
obua@14738
   913
by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2)
obua@14738
   914
nipkow@15539
   915
lemma abs_triangle_ineq: "abs(a+b) \<le> abs a + abs(b::'a::lordered_ab_group_abs)"
obua@14738
   916
proof -
obua@14738
   917
  have g:"abs a + abs b = join (a+b) (join (-a-b) (join (-a+b) (a + (-b))))" (is "_=join ?m ?n")
haftmann@19233
   918
    by (simp add: abs_lattice add_meet_join_distribs join_aci diff_minus)
nipkow@21312
   919
  have a:"a+b <= join ?m ?n" by (simp)
nipkow@21312
   920
  have b:"-a-b <= ?n" by (simp) 
nipkow@21312
   921
  have c:"?n <= join ?m ?n" by (simp)
nipkow@21312
   922
  from b c have d: "-a-b <= join ?m ?n" by(rule order_trans)
obua@14738
   923
  have e:"-a-b = -(a+b)" by (simp add: diff_minus)
obua@14738
   924
  from a d e have "abs(a+b) <= join ?m ?n" 
obua@14738
   925
    by (drule_tac abs_leI, auto)
obua@14738
   926
  with g[symmetric] show ?thesis by simp
obua@14738
   927
qed
obua@14738
   928
avigad@16775
   929
lemma abs_triangle_ineq2: "abs (a::'a::lordered_ab_group_abs) - 
avigad@16775
   930
    abs b <= abs (a - b)"
avigad@16775
   931
  apply (simp add: compare_rls)
avigad@16775
   932
  apply (subgoal_tac "abs a = abs (a - b + b)")
avigad@16775
   933
  apply (erule ssubst)
avigad@16775
   934
  apply (rule abs_triangle_ineq)
avigad@16775
   935
  apply (rule arg_cong);back;
avigad@16775
   936
  apply (simp add: compare_rls)
avigad@16775
   937
done
avigad@16775
   938
avigad@16775
   939
lemma abs_triangle_ineq3: 
avigad@16775
   940
    "abs(abs (a::'a::lordered_ab_group_abs) - abs b) <= abs (a - b)"
avigad@16775
   941
  apply (subst abs_le_iff)
avigad@16775
   942
  apply auto
avigad@16775
   943
  apply (rule abs_triangle_ineq2)
avigad@16775
   944
  apply (subst abs_minus_commute)
avigad@16775
   945
  apply (rule abs_triangle_ineq2)
avigad@16775
   946
done
avigad@16775
   947
avigad@16775
   948
lemma abs_triangle_ineq4: "abs ((a::'a::lordered_ab_group_abs) - b) <= 
avigad@16775
   949
    abs a + abs b"
avigad@16775
   950
proof -;
avigad@16775
   951
  have "abs(a - b) = abs(a + - b)"
avigad@16775
   952
    by (subst diff_minus, rule refl)
avigad@16775
   953
  also have "... <= abs a + abs (- b)"
avigad@16775
   954
    by (rule abs_triangle_ineq)
avigad@16775
   955
  finally show ?thesis
avigad@16775
   956
    by simp
avigad@16775
   957
qed
avigad@16775
   958
obua@14738
   959
lemma abs_diff_triangle_ineq:
obua@14738
   960
     "\<bar>(a::'a::lordered_ab_group_abs) + b - (c+d)\<bar> \<le> \<bar>a-c\<bar> + \<bar>b-d\<bar>"
obua@14738
   961
proof -
obua@14738
   962
  have "\<bar>a + b - (c+d)\<bar> = \<bar>(a-c) + (b-d)\<bar>" by (simp add: diff_minus add_ac)
obua@14738
   963
  also have "... \<le> \<bar>a-c\<bar> + \<bar>b-d\<bar>" by (rule abs_triangle_ineq)
obua@14738
   964
  finally show ?thesis .
obua@14738
   965
qed
obua@14738
   966
nipkow@15539
   967
lemma abs_add_abs[simp]:
nipkow@15539
   968
fixes a:: "'a::{lordered_ab_group_abs}"
nipkow@15539
   969
shows "abs(abs a + abs b) = abs a + abs b" (is "?L = ?R")
nipkow@15539
   970
proof (rule order_antisym)
nipkow@15539
   971
  show "?L \<ge> ?R" by(rule abs_ge_self)
nipkow@15539
   972
next
nipkow@15539
   973
  have "?L \<le> \<bar>\<bar>a\<bar>\<bar> + \<bar>\<bar>b\<bar>\<bar>" by(rule abs_triangle_ineq)
nipkow@15539
   974
  also have "\<dots> = ?R" by simp
nipkow@15539
   975
  finally show "?L \<le> ?R" .
nipkow@15539
   976
qed
nipkow@15539
   977
obua@14754
   978
text {* Needed for abelian cancellation simprocs: *}
obua@14754
   979
obua@14754
   980
lemma add_cancel_21: "((x::'a::ab_group_add) + (y + z) = y + u) = (x + z = u)"
obua@14754
   981
apply (subst add_left_commute)
obua@14754
   982
apply (subst add_left_cancel)
obua@14754
   983
apply simp
obua@14754
   984
done
obua@14754
   985
obua@14754
   986
lemma add_cancel_end: "(x + (y + z) = y) = (x = - (z::'a::ab_group_add))"
obua@14754
   987
apply (subst add_cancel_21[of _ _ _ 0, simplified])
obua@14754
   988
apply (simp add: add_right_cancel[symmetric, of "x" "-z" "z", simplified])
obua@14754
   989
done
obua@14754
   990
obua@14754
   991
lemma less_eqI: "(x::'a::pordered_ab_group_add) - y = x' - y' \<Longrightarrow> (x < y) = (x' < y')"
obua@14754
   992
by (simp add: less_iff_diff_less_0[of x y] less_iff_diff_less_0[of x' y'])
obua@14754
   993
obua@14754
   994
lemma le_eqI: "(x::'a::pordered_ab_group_add) - y = x' - y' \<Longrightarrow> (y <= x) = (y' <= x')"
obua@14754
   995
apply (simp add: le_iff_diff_le_0[of y x] le_iff_diff_le_0[of  y' x'])
obua@14754
   996
apply (simp add: neg_le_iff_le[symmetric, of "y-x" 0] neg_le_iff_le[symmetric, of "y'-x'" 0])
obua@14754
   997
done
obua@14754
   998
obua@14754
   999
lemma eq_eqI: "(x::'a::ab_group_add) - y = x' - y' \<Longrightarrow> (x = y) = (x' = y')"
obua@14754
  1000
by (simp add: eq_iff_diff_eq_0[of x y] eq_iff_diff_eq_0[of x' y'])
obua@14754
  1001
obua@14754
  1002
lemma diff_def: "(x::'a::ab_group_add) - y == x + (-y)"
obua@14754
  1003
by (simp add: diff_minus)
obua@14754
  1004
obua@14754
  1005
lemma add_minus_cancel: "(a::'a::ab_group_add) + (-a + b) = b"
obua@14754
  1006
by (simp add: add_assoc[symmetric])
obua@14754
  1007
obua@14754
  1008
lemma minus_add_cancel: "-(a::'a::ab_group_add) + (a + b) = b"
obua@14754
  1009
by (simp add: add_assoc[symmetric])
obua@14754
  1010
obua@15178
  1011
lemma  le_add_right_mono: 
obua@15178
  1012
  assumes 
obua@15178
  1013
  "a <= b + (c::'a::pordered_ab_group_add)"
obua@15178
  1014
  "c <= d"    
obua@15178
  1015
  shows "a <= b + d"
obua@15178
  1016
  apply (rule_tac order_trans[where y = "b+c"])
obua@15178
  1017
  apply (simp_all add: prems)
obua@15178
  1018
  done
obua@15178
  1019
obua@15178
  1020
lemmas group_eq_simps =
obua@15178
  1021
  mult_ac
obua@15178
  1022
  add_ac
obua@15178
  1023
  add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
obua@15178
  1024
  diff_eq_eq eq_diff_eq
obua@15178
  1025
obua@15178
  1026
lemma estimate_by_abs:
obua@15178
  1027
"a + b <= (c::'a::lordered_ab_group_abs) \<Longrightarrow> a <= c + abs b" 
obua@15178
  1028
proof -
obua@15178
  1029
  assume 1: "a+b <= c"
obua@15178
  1030
  have 2: "a <= c+(-b)"
obua@15178
  1031
    apply (insert 1)
obua@15178
  1032
    apply (drule_tac add_right_mono[where c="-b"])
obua@15178
  1033
    apply (simp add: group_eq_simps)
obua@15178
  1034
    done
obua@15178
  1035
  have 3: "(-b) <= abs b" by (rule abs_ge_minus_self)
obua@15178
  1036
  show ?thesis by (rule le_add_right_mono[OF 2 3])
obua@15178
  1037
qed
obua@15178
  1038
paulson@17085
  1039
text{*Simplification of @{term "x-y < 0"}, etc.*}
paulson@17085
  1040
lemmas diff_less_0_iff_less = less_iff_diff_less_0 [symmetric]
paulson@17085
  1041
lemmas diff_eq_0_iff_eq = eq_iff_diff_eq_0 [symmetric]
paulson@17085
  1042
lemmas diff_le_0_iff_le = le_iff_diff_le_0 [symmetric]
paulson@17085
  1043
declare diff_less_0_iff_less [simp]
paulson@17085
  1044
declare diff_eq_0_iff_eq [simp]
paulson@17085
  1045
declare diff_le_0_iff_le [simp]
paulson@17085
  1046
paulson@17085
  1047
obua@14738
  1048
ML {*
obua@14738
  1049
val add_assoc = thm "add_assoc";
obua@14738
  1050
val add_commute = thm "add_commute";
obua@14738
  1051
val add_left_commute = thm "add_left_commute";
obua@14738
  1052
val add_ac = thms "add_ac";
obua@14738
  1053
val mult_assoc = thm "mult_assoc";
obua@14738
  1054
val mult_commute = thm "mult_commute";
obua@14738
  1055
val mult_left_commute = thm "mult_left_commute";
obua@14738
  1056
val mult_ac = thms "mult_ac";
obua@14738
  1057
val add_0 = thm "add_0";
obua@14738
  1058
val mult_1_left = thm "mult_1_left";
obua@14738
  1059
val mult_1_right = thm "mult_1_right";
obua@14738
  1060
val mult_1 = thm "mult_1";
obua@14738
  1061
val add_left_imp_eq = thm "add_left_imp_eq";
obua@14738
  1062
val add_right_imp_eq = thm "add_right_imp_eq";
obua@14738
  1063
val add_imp_eq = thm "add_imp_eq";
obua@14738
  1064
val left_minus = thm "left_minus";
obua@14738
  1065
val diff_minus = thm "diff_minus";
obua@14738
  1066
val add_0_right = thm "add_0_right";
obua@14738
  1067
val add_left_cancel = thm "add_left_cancel";
obua@14738
  1068
val add_right_cancel = thm "add_right_cancel";
obua@14738
  1069
val right_minus = thm "right_minus";
obua@14738
  1070
val right_minus_eq = thm "right_minus_eq";
obua@14738
  1071
val minus_minus = thm "minus_minus";
obua@14738
  1072
val equals_zero_I = thm "equals_zero_I";
obua@14738
  1073
val minus_zero = thm "minus_zero";
obua@14738
  1074
val diff_self = thm "diff_self";
obua@14738
  1075
val diff_0 = thm "diff_0";
obua@14738
  1076
val diff_0_right = thm "diff_0_right";
obua@14738
  1077
val diff_minus_eq_add = thm "diff_minus_eq_add";
obua@14738
  1078
val neg_equal_iff_equal = thm "neg_equal_iff_equal";
obua@14738
  1079
val neg_equal_0_iff_equal = thm "neg_equal_0_iff_equal";
obua@14738
  1080
val neg_0_equal_iff_equal = thm "neg_0_equal_iff_equal";
obua@14738
  1081
val equation_minus_iff = thm "equation_minus_iff";
obua@14738
  1082
val minus_equation_iff = thm "minus_equation_iff";
obua@14738
  1083
val minus_add_distrib = thm "minus_add_distrib";
obua@14738
  1084
val minus_diff_eq = thm "minus_diff_eq";
obua@14738
  1085
val add_left_mono = thm "add_left_mono";
obua@14738
  1086
val add_le_imp_le_left = thm "add_le_imp_le_left";
obua@14738
  1087
val add_right_mono = thm "add_right_mono";
obua@14738
  1088
val add_mono = thm "add_mono";
obua@14738
  1089
val add_strict_left_mono = thm "add_strict_left_mono";
obua@14738
  1090
val add_strict_right_mono = thm "add_strict_right_mono";
obua@14738
  1091
val add_strict_mono = thm "add_strict_mono";
obua@14738
  1092
val add_less_le_mono = thm "add_less_le_mono";
obua@14738
  1093
val add_le_less_mono = thm "add_le_less_mono";
obua@14738
  1094
val add_less_imp_less_left = thm "add_less_imp_less_left";
obua@14738
  1095
val add_less_imp_less_right = thm "add_less_imp_less_right";
obua@14738
  1096
val add_less_cancel_left = thm "add_less_cancel_left";
obua@14738
  1097
val add_less_cancel_right = thm "add_less_cancel_right";
obua@14738
  1098
val add_le_cancel_left = thm "add_le_cancel_left";
obua@14738
  1099
val add_le_cancel_right = thm "add_le_cancel_right";
obua@14738
  1100
val add_le_imp_le_right = thm "add_le_imp_le_right";
obua@14738
  1101
val add_increasing = thm "add_increasing";
obua@14738
  1102
val le_imp_neg_le = thm "le_imp_neg_le";
obua@14738
  1103
val neg_le_iff_le = thm "neg_le_iff_le";
obua@14738
  1104
val neg_le_0_iff_le = thm "neg_le_0_iff_le";
obua@14738
  1105
val neg_0_le_iff_le = thm "neg_0_le_iff_le";
obua@14738
  1106
val neg_less_iff_less = thm "neg_less_iff_less";
obua@14738
  1107
val neg_less_0_iff_less = thm "neg_less_0_iff_less";
obua@14738
  1108
val neg_0_less_iff_less = thm "neg_0_less_iff_less";
obua@14738
  1109
val less_minus_iff = thm "less_minus_iff";
obua@14738
  1110
val minus_less_iff = thm "minus_less_iff";
obua@14738
  1111
val le_minus_iff = thm "le_minus_iff";
obua@14738
  1112
val minus_le_iff = thm "minus_le_iff";
obua@14738
  1113
val add_diff_eq = thm "add_diff_eq";
obua@14738
  1114
val diff_add_eq = thm "diff_add_eq";
obua@14738
  1115
val diff_eq_eq = thm "diff_eq_eq";
obua@14738
  1116
val eq_diff_eq = thm "eq_diff_eq";
obua@14738
  1117
val diff_diff_eq = thm "diff_diff_eq";
obua@14738
  1118
val diff_diff_eq2 = thm "diff_diff_eq2";
obua@14738
  1119
val diff_add_cancel = thm "diff_add_cancel";
obua@14738
  1120
val add_diff_cancel = thm "add_diff_cancel";
obua@14738
  1121
val less_iff_diff_less_0 = thm "less_iff_diff_less_0";
obua@14738
  1122
val diff_less_eq = thm "diff_less_eq";
obua@14738
  1123
val less_diff_eq = thm "less_diff_eq";
obua@14738
  1124
val diff_le_eq = thm "diff_le_eq";
obua@14738
  1125
val le_diff_eq = thm "le_diff_eq";
obua@14738
  1126
val compare_rls = thms "compare_rls";
obua@14738
  1127
val eq_iff_diff_eq_0 = thm "eq_iff_diff_eq_0";
obua@14738
  1128
val le_iff_diff_le_0 = thm "le_iff_diff_le_0";
obua@14738
  1129
val add_meet_distrib_left = thm "add_meet_distrib_left";
obua@14738
  1130
val add_join_distrib_left = thm "add_join_distrib_left";
obua@14738
  1131
val is_join_neg_meet = thm "is_join_neg_meet";
obua@14738
  1132
val is_meet_neg_join = thm "is_meet_neg_join";
obua@14738
  1133
val add_join_distrib_right = thm "add_join_distrib_right";
obua@14738
  1134
val add_meet_distrib_right = thm "add_meet_distrib_right";
obua@14738
  1135
val add_meet_join_distribs = thms "add_meet_join_distribs";
obua@14738
  1136
val join_eq_neg_meet = thm "join_eq_neg_meet";
obua@14738
  1137
val meet_eq_neg_join = thm "meet_eq_neg_join";
obua@14738
  1138
val add_eq_meet_join = thm "add_eq_meet_join";
obua@14738
  1139
val prts = thm "prts";
obua@14738
  1140
val zero_le_pprt = thm "zero_le_pprt";
obua@14738
  1141
val nprt_le_zero = thm "nprt_le_zero";
obua@14738
  1142
val le_eq_neg = thm "le_eq_neg";
obua@14738
  1143
val join_0_imp_0 = thm "join_0_imp_0";
obua@14738
  1144
val meet_0_imp_0 = thm "meet_0_imp_0";
obua@14738
  1145
val join_0_eq_0 = thm "join_0_eq_0";
obua@14738
  1146
val meet_0_eq_0 = thm "meet_0_eq_0";
obua@14738
  1147
val zero_le_double_add_iff_zero_le_single_add = thm "zero_le_double_add_iff_zero_le_single_add";
obua@14738
  1148
val double_add_le_zero_iff_single_add_le_zero = thm "double_add_le_zero_iff_single_add_le_zero";
obua@14738
  1149
val double_add_less_zero_iff_single_less_zero = thm "double_add_less_zero_iff_single_less_zero";
obua@14738
  1150
val abs_lattice = thm "abs_lattice";
obua@14738
  1151
val abs_zero = thm "abs_zero";
obua@14738
  1152
val abs_eq_0 = thm "abs_eq_0";
obua@14738
  1153
val abs_0_eq = thm "abs_0_eq";
obua@14738
  1154
val neg_meet_eq_join = thm "neg_meet_eq_join";
obua@14738
  1155
val neg_join_eq_meet = thm "neg_join_eq_meet";
obua@14738
  1156
val join_eq_if = thm "join_eq_if";
obua@14738
  1157
val abs_if_lattice = thm "abs_if_lattice";
obua@14738
  1158
val abs_ge_zero = thm "abs_ge_zero";
obua@14738
  1159
val abs_le_zero_iff = thm "abs_le_zero_iff";
obua@14738
  1160
val zero_less_abs_iff = thm "zero_less_abs_iff";
obua@14738
  1161
val abs_not_less_zero = thm "abs_not_less_zero";
obua@14738
  1162
val abs_ge_self = thm "abs_ge_self";
obua@14738
  1163
val abs_ge_minus_self = thm "abs_ge_minus_self";
nipkow@21312
  1164
val le_imp_join_eq = thm "join_absorp2";
nipkow@21312
  1165
val ge_imp_join_eq = thm "join_absorp1";
nipkow@21312
  1166
val le_imp_meet_eq = thm "meet_absorp1";
nipkow@21312
  1167
val ge_imp_meet_eq = thm "meet_absorp2";
obua@14738
  1168
val abs_prts = thm "abs_prts";
obua@14738
  1169
val abs_minus_cancel = thm "abs_minus_cancel";
obua@14738
  1170
val abs_idempotent = thm "abs_idempotent";
obua@14738
  1171
val zero_le_iff_zero_nprt = thm "zero_le_iff_zero_nprt";
obua@14738
  1172
val le_zero_iff_zero_pprt = thm "le_zero_iff_zero_pprt";
obua@14738
  1173
val le_zero_iff_pprt_id = thm "le_zero_iff_pprt_id";
obua@14738
  1174
val zero_le_iff_nprt_id = thm "zero_le_iff_nprt_id";
obua@14738
  1175
val iff2imp = thm "iff2imp";
avigad@16775
  1176
(* val imp_abs_id = thm "imp_abs_id";
avigad@16775
  1177
val imp_abs_neg_id = thm "imp_abs_neg_id"; *)
obua@14738
  1178
val abs_leI = thm "abs_leI";
obua@14738
  1179
val le_minus_self_iff = thm "le_minus_self_iff";
obua@14738
  1180
val minus_le_self_iff = thm "minus_le_self_iff";
obua@14738
  1181
val abs_le_D1 = thm "abs_le_D1";
obua@14738
  1182
val abs_le_D2 = thm "abs_le_D2";
obua@14738
  1183
val abs_le_iff = thm "abs_le_iff";
obua@14738
  1184
val abs_triangle_ineq = thm "abs_triangle_ineq";
obua@14738
  1185
val abs_diff_triangle_ineq = thm "abs_diff_triangle_ineq";
obua@14738
  1186
*}
obua@14738
  1187
obua@14738
  1188
end