src/HOL/OrderedGroup.thy
 author paulson Tue Jun 28 15:27:45 2005 +0200 (2005-06-28) changeset 16587 b34c8aa657a5 parent 16417 9bc16273c2d4 child 16775 c1b87ef4a1c3 permissions -rw-r--r--
Constant "If" is now local
     1 (*  Title:   HOL/OrderedGroup.thy

     2     ID:      $Id$

     3     Author:  Gertrud Bauer, Steven Obua, Lawrence C Paulson, and Markus Wenzel

     4 *)

     5

     6 header {* Ordered Groups *}

     7

     8 theory OrderedGroup

     9 imports Inductive LOrder

    10 uses "../Provers/Arith/abel_cancel.ML"

    11 begin

    12

    13 text {*

    14   The theory of partially ordered groups is taken from the books:

    15   \begin{itemize}

    16   \item \emph{Lattice Theory} by Garret Birkhoff, American Mathematical Society 1979

    17   \item \emph{Partially Ordered Algebraic Systems}, Pergamon Press 1963

    18   \end{itemize}

    19   Most of the used notions can also be looked up in

    20   \begin{itemize}

    21   \item \url{http://www.mathworld.com} by Eric Weisstein et. al.

    22   \item \emph{Algebra I} by van der Waerden, Springer.

    23   \end{itemize}

    24 *}

    25

    26 subsection {* Semigroups, Groups *}

    27

    28 axclass semigroup_add \<subseteq> plus

    29   add_assoc: "(a + b) + c = a + (b + c)"

    30

    31 axclass ab_semigroup_add \<subseteq> semigroup_add

    32   add_commute: "a + b = b + a"

    33

    34 lemma add_left_commute: "a + (b + c) = b + (a + (c::'a::ab_semigroup_add))"

    35   by (rule mk_left_commute [of "op +", OF add_assoc add_commute])

    36

    37 theorems add_ac = add_assoc add_commute add_left_commute

    38

    39 axclass semigroup_mult \<subseteq> times

    40   mult_assoc: "(a * b) * c = a * (b * c)"

    41

    42 axclass ab_semigroup_mult \<subseteq> semigroup_mult

    43   mult_commute: "a * b = b * a"

    44

    45 lemma mult_left_commute: "a * (b * c) = b * (a * (c::'a::ab_semigroup_mult))"

    46   by (rule mk_left_commute [of "op *", OF mult_assoc mult_commute])

    47

    48 theorems mult_ac = mult_assoc mult_commute mult_left_commute

    49

    50 axclass comm_monoid_add \<subseteq> zero, ab_semigroup_add

    51   add_0[simp]: "0 + a = a"

    52

    53 axclass monoid_mult \<subseteq> one, semigroup_mult

    54   mult_1_left[simp]: "1 * a  = a"

    55   mult_1_right[simp]: "a * 1 = a"

    56

    57 axclass comm_monoid_mult \<subseteq> one, ab_semigroup_mult

    58   mult_1: "1 * a = a"

    59

    60 instance comm_monoid_mult \<subseteq> monoid_mult

    61 by (intro_classes, insert mult_1, simp_all add: mult_commute, auto)

    62

    63 axclass cancel_semigroup_add \<subseteq> semigroup_add

    64   add_left_imp_eq: "a + b = a + c \<Longrightarrow> b = c"

    65   add_right_imp_eq: "b + a = c + a \<Longrightarrow> b = c"

    66

    67 axclass cancel_ab_semigroup_add \<subseteq> ab_semigroup_add

    68   add_imp_eq: "a + b = a + c \<Longrightarrow> b = c"

    69

    70 instance cancel_ab_semigroup_add \<subseteq> cancel_semigroup_add

    71 proof

    72   {

    73     fix a b c :: 'a

    74     assume "a + b = a + c"

    75     thus "b = c" by (rule add_imp_eq)

    76   }

    77   note f = this

    78   fix a b c :: 'a

    79   assume "b + a = c + a"

    80   hence "a + b = a + c" by (simp only: add_commute)

    81   thus "b = c" by (rule f)

    82 qed

    83

    84 axclass ab_group_add \<subseteq> minus, comm_monoid_add

    85   left_minus[simp]: " - a + a = 0"

    86   diff_minus: "a - b = a + (-b)"

    87

    88 instance ab_group_add \<subseteq> cancel_ab_semigroup_add

    89 proof

    90   fix a b c :: 'a

    91   assume "a + b = a + c"

    92   hence "-a + a + b = -a + a + c" by (simp only: add_assoc)

    93   thus "b = c" by simp

    94 qed

    95

    96 lemma add_0_right [simp]: "a + 0 = (a::'a::comm_monoid_add)"

    97 proof -

    98   have "a + 0 = 0 + a" by (simp only: add_commute)

    99   also have "... = a" by simp

   100   finally show ?thesis .

   101 qed

   102

   103 lemma add_left_cancel [simp]:

   104      "(a + b = a + c) = (b = (c::'a::cancel_semigroup_add))"

   105 by (blast dest: add_left_imp_eq)

   106

   107 lemma add_right_cancel [simp]:

   108      "(b + a = c + a) = (b = (c::'a::cancel_semigroup_add))"

   109   by (blast dest: add_right_imp_eq)

   110

   111 lemma right_minus [simp]: "a + -(a::'a::ab_group_add) = 0"

   112 proof -

   113   have "a + -a = -a + a" by (simp add: add_ac)

   114   also have "... = 0" by simp

   115   finally show ?thesis .

   116 qed

   117

   118 lemma right_minus_eq: "(a - b = 0) = (a = (b::'a::ab_group_add))"

   119 proof

   120   have "a = a - b + b" by (simp add: diff_minus add_ac)

   121   also assume "a - b = 0"

   122   finally show "a = b" by simp

   123 next

   124   assume "a = b"

   125   thus "a - b = 0" by (simp add: diff_minus)

   126 qed

   127

   128 lemma minus_minus [simp]: "- (- (a::'a::ab_group_add)) = a"

   129 proof (rule add_left_cancel [of "-a", THEN iffD1])

   130   show "(-a + -(-a) = -a + a)"

   131   by simp

   132 qed

   133

   134 lemma equals_zero_I: "a+b = 0 ==> -a = (b::'a::ab_group_add)"

   135 apply (rule right_minus_eq [THEN iffD1, symmetric])

   136 apply (simp add: diff_minus add_commute)

   137 done

   138

   139 lemma minus_zero [simp]: "- 0 = (0::'a::ab_group_add)"

   140 by (simp add: equals_zero_I)

   141

   142 lemma diff_self [simp]: "a - (a::'a::ab_group_add) = 0"

   143   by (simp add: diff_minus)

   144

   145 lemma diff_0 [simp]: "(0::'a::ab_group_add) - a = -a"

   146 by (simp add: diff_minus)

   147

   148 lemma diff_0_right [simp]: "a - (0::'a::ab_group_add) = a"

   149 by (simp add: diff_minus)

   150

   151 lemma diff_minus_eq_add [simp]: "a - - b = a + (b::'a::ab_group_add)"

   152 by (simp add: diff_minus)

   153

   154 lemma neg_equal_iff_equal [simp]: "(-a = -b) = (a = (b::'a::ab_group_add))"

   155 proof

   156   assume "- a = - b"

   157   hence "- (- a) = - (- b)"

   158     by simp

   159   thus "a=b" by simp

   160 next

   161   assume "a=b"

   162   thus "-a = -b" by simp

   163 qed

   164

   165 lemma neg_equal_0_iff_equal [simp]: "(-a = 0) = (a = (0::'a::ab_group_add))"

   166 by (subst neg_equal_iff_equal [symmetric], simp)

   167

   168 lemma neg_0_equal_iff_equal [simp]: "(0 = -a) = (0 = (a::'a::ab_group_add))"

   169 by (subst neg_equal_iff_equal [symmetric], simp)

   170

   171 text{*The next two equations can make the simplifier loop!*}

   172

   173 lemma equation_minus_iff: "(a = - b) = (b = - (a::'a::ab_group_add))"

   174 proof -

   175   have "(- (-a) = - b) = (- a = b)" by (rule neg_equal_iff_equal)

   176   thus ?thesis by (simp add: eq_commute)

   177 qed

   178

   179 lemma minus_equation_iff: "(- a = b) = (- (b::'a::ab_group_add) = a)"

   180 proof -

   181   have "(- a = - (-b)) = (a = -b)" by (rule neg_equal_iff_equal)

   182   thus ?thesis by (simp add: eq_commute)

   183 qed

   184

   185 lemma minus_add_distrib [simp]: "- (a + b) = -a + -(b::'a::ab_group_add)"

   186 apply (rule equals_zero_I)

   187 apply (simp add: add_ac)

   188 done

   189

   190 lemma minus_diff_eq [simp]: "- (a - b) = b - (a::'a::ab_group_add)"

   191 by (simp add: diff_minus add_commute)

   192

   193 subsection {* (Partially) Ordered Groups *}

   194

   195 axclass pordered_ab_semigroup_add \<subseteq> order, ab_semigroup_add

   196   add_left_mono: "a \<le> b \<Longrightarrow> c + a \<le> c + b"

   197

   198 axclass pordered_cancel_ab_semigroup_add \<subseteq> pordered_ab_semigroup_add, cancel_ab_semigroup_add

   199

   200 instance pordered_cancel_ab_semigroup_add \<subseteq> pordered_ab_semigroup_add ..

   201

   202 axclass pordered_ab_semigroup_add_imp_le \<subseteq> pordered_cancel_ab_semigroup_add

   203   add_le_imp_le_left: "c + a \<le> c + b \<Longrightarrow> a \<le> b"

   204

   205 axclass pordered_ab_group_add \<subseteq> ab_group_add, pordered_ab_semigroup_add

   206

   207 instance pordered_ab_group_add \<subseteq> pordered_ab_semigroup_add_imp_le

   208 proof

   209   fix a b c :: 'a

   210   assume "c + a \<le> c + b"

   211   hence "(-c) + (c + a) \<le> (-c) + (c + b)" by (rule add_left_mono)

   212   hence "((-c) + c) + a \<le> ((-c) + c) + b" by (simp only: add_assoc)

   213   thus "a \<le> b" by simp

   214 qed

   215

   216 axclass ordered_cancel_ab_semigroup_add \<subseteq> pordered_cancel_ab_semigroup_add, linorder

   217

   218 instance ordered_cancel_ab_semigroup_add \<subseteq> pordered_ab_semigroup_add_imp_le

   219 proof

   220   fix a b c :: 'a

   221   assume le: "c + a <= c + b"

   222   show "a <= b"

   223   proof (rule ccontr)

   224     assume w: "~ a \<le> b"

   225     hence "b <= a" by (simp add: linorder_not_le)

   226     hence le2: "c+b <= c+a" by (rule add_left_mono)

   227     have "a = b"

   228       apply (insert le)

   229       apply (insert le2)

   230       apply (drule order_antisym, simp_all)

   231       done

   232     with w  show False

   233       by (simp add: linorder_not_le [symmetric])

   234   qed

   235 qed

   236

   237 lemma add_right_mono: "a \<le> (b::'a::pordered_ab_semigroup_add) ==> a + c \<le> b + c"

   238 by (simp add: add_commute[of _ c] add_left_mono)

   239

   240 text {* non-strict, in both arguments *}

   241 lemma add_mono:

   242      "[|a \<le> b;  c \<le> d|] ==> a + c \<le> b + (d::'a::pordered_ab_semigroup_add)"

   243   apply (erule add_right_mono [THEN order_trans])

   244   apply (simp add: add_commute add_left_mono)

   245   done

   246

   247 lemma add_strict_left_mono:

   248      "a < b ==> c + a < c + (b::'a::pordered_cancel_ab_semigroup_add)"

   249  by (simp add: order_less_le add_left_mono)

   250

   251 lemma add_strict_right_mono:

   252      "a < b ==> a + c < b + (c::'a::pordered_cancel_ab_semigroup_add)"

   253  by (simp add: add_commute [of _ c] add_strict_left_mono)

   254

   255 text{*Strict monotonicity in both arguments*}

   256 lemma add_strict_mono: "[|a<b; c<d|] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"

   257 apply (erule add_strict_right_mono [THEN order_less_trans])

   258 apply (erule add_strict_left_mono)

   259 done

   260

   261 lemma add_less_le_mono:

   262      "[| a<b; c\<le>d |] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"

   263 apply (erule add_strict_right_mono [THEN order_less_le_trans])

   264 apply (erule add_left_mono)

   265 done

   266

   267 lemma add_le_less_mono:

   268      "[| a\<le>b; c<d |] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"

   269 apply (erule add_right_mono [THEN order_le_less_trans])

   270 apply (erule add_strict_left_mono)

   271 done

   272

   273 lemma add_less_imp_less_left:

   274       assumes less: "c + a < c + b"  shows "a < (b::'a::pordered_ab_semigroup_add_imp_le)"

   275 proof -

   276   from less have le: "c + a <= c + b" by (simp add: order_le_less)

   277   have "a <= b"

   278     apply (insert le)

   279     apply (drule add_le_imp_le_left)

   280     by (insert le, drule add_le_imp_le_left, assumption)

   281   moreover have "a \<noteq> b"

   282   proof (rule ccontr)

   283     assume "~(a \<noteq> b)"

   284     then have "a = b" by simp

   285     then have "c + a = c + b" by simp

   286     with less show "False"by simp

   287   qed

   288   ultimately show "a < b" by (simp add: order_le_less)

   289 qed

   290

   291 lemma add_less_imp_less_right:

   292       "a + c < b + c ==> a < (b::'a::pordered_ab_semigroup_add_imp_le)"

   293 apply (rule add_less_imp_less_left [of c])

   294 apply (simp add: add_commute)

   295 done

   296

   297 lemma add_less_cancel_left [simp]:

   298     "(c+a < c+b) = (a < (b::'a::pordered_ab_semigroup_add_imp_le))"

   299 by (blast intro: add_less_imp_less_left add_strict_left_mono)

   300

   301 lemma add_less_cancel_right [simp]:

   302     "(a+c < b+c) = (a < (b::'a::pordered_ab_semigroup_add_imp_le))"

   303 by (blast intro: add_less_imp_less_right add_strict_right_mono)

   304

   305 lemma add_le_cancel_left [simp]:

   306     "(c+a \<le> c+b) = (a \<le> (b::'a::pordered_ab_semigroup_add_imp_le))"

   307 by (auto, drule add_le_imp_le_left, simp_all add: add_left_mono)

   308

   309 lemma add_le_cancel_right [simp]:

   310     "(a+c \<le> b+c) = (a \<le> (b::'a::pordered_ab_semigroup_add_imp_le))"

   311 by (simp add: add_commute[of a c] add_commute[of b c])

   312

   313 lemma add_le_imp_le_right:

   314       "a + c \<le> b + c ==> a \<le> (b::'a::pordered_ab_semigroup_add_imp_le)"

   315 by simp

   316

   317 lemma add_increasing:

   318   fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"

   319   shows  "[|0\<le>a; b\<le>c|] ==> b \<le> a + c"

   320 by (insert add_mono [of 0 a b c], simp)

   321

   322 lemma add_increasing2:

   323   fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"

   324   shows  "[|0\<le>c; b\<le>a|] ==> b \<le> a + c"

   325 by (simp add:add_increasing add_commute[of a])

   326

   327 lemma add_strict_increasing:

   328   fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"

   329   shows "[|0<a; b\<le>c|] ==> b < a + c"

   330 by (insert add_less_le_mono [of 0 a b c], simp)

   331

   332 lemma add_strict_increasing2:

   333   fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"

   334   shows "[|0\<le>a; b<c|] ==> b < a + c"

   335 by (insert add_le_less_mono [of 0 a b c], simp)

   336

   337

   338 subsection {* Ordering Rules for Unary Minus *}

   339

   340 lemma le_imp_neg_le:

   341       assumes "a \<le> (b::'a::{pordered_ab_semigroup_add_imp_le, ab_group_add})" shows "-b \<le> -a"

   342 proof -

   343   have "-a+a \<le> -a+b"

   344     by (rule add_left_mono)

   345   hence "0 \<le> -a+b"

   346     by simp

   347   hence "0 + (-b) \<le> (-a + b) + (-b)"

   348     by (rule add_right_mono)

   349   thus ?thesis

   350     by (simp add: add_assoc)

   351 qed

   352

   353 lemma neg_le_iff_le [simp]: "(-b \<le> -a) = (a \<le> (b::'a::pordered_ab_group_add))"

   354 proof

   355   assume "- b \<le> - a"

   356   hence "- (- a) \<le> - (- b)"

   357     by (rule le_imp_neg_le)

   358   thus "a\<le>b" by simp

   359 next

   360   assume "a\<le>b"

   361   thus "-b \<le> -a" by (rule le_imp_neg_le)

   362 qed

   363

   364 lemma neg_le_0_iff_le [simp]: "(-a \<le> 0) = (0 \<le> (a::'a::pordered_ab_group_add))"

   365 by (subst neg_le_iff_le [symmetric], simp)

   366

   367 lemma neg_0_le_iff_le [simp]: "(0 \<le> -a) = (a \<le> (0::'a::pordered_ab_group_add))"

   368 by (subst neg_le_iff_le [symmetric], simp)

   369

   370 lemma neg_less_iff_less [simp]: "(-b < -a) = (a < (b::'a::pordered_ab_group_add))"

   371 by (force simp add: order_less_le)

   372

   373 lemma neg_less_0_iff_less [simp]: "(-a < 0) = (0 < (a::'a::pordered_ab_group_add))"

   374 by (subst neg_less_iff_less [symmetric], simp)

   375

   376 lemma neg_0_less_iff_less [simp]: "(0 < -a) = (a < (0::'a::pordered_ab_group_add))"

   377 by (subst neg_less_iff_less [symmetric], simp)

   378

   379 text{*The next several equations can make the simplifier loop!*}

   380

   381 lemma less_minus_iff: "(a < - b) = (b < - (a::'a::pordered_ab_group_add))"

   382 proof -

   383   have "(- (-a) < - b) = (b < - a)" by (rule neg_less_iff_less)

   384   thus ?thesis by simp

   385 qed

   386

   387 lemma minus_less_iff: "(- a < b) = (- b < (a::'a::pordered_ab_group_add))"

   388 proof -

   389   have "(- a < - (-b)) = (- b < a)" by (rule neg_less_iff_less)

   390   thus ?thesis by simp

   391 qed

   392

   393 lemma le_minus_iff: "(a \<le> - b) = (b \<le> - (a::'a::pordered_ab_group_add))"

   394 proof -

   395   have mm: "!! a (b::'a). (-(-a)) < -b \<Longrightarrow> -(-b) < -a" by (simp only: minus_less_iff)

   396   have "(- (- a) <= -b) = (b <= - a)"

   397     apply (auto simp only: order_le_less)

   398     apply (drule mm)

   399     apply (simp_all)

   400     apply (drule mm[simplified], assumption)

   401     done

   402   then show ?thesis by simp

   403 qed

   404

   405 lemma minus_le_iff: "(- a \<le> b) = (- b \<le> (a::'a::pordered_ab_group_add))"

   406 by (auto simp add: order_le_less minus_less_iff)

   407

   408 lemma add_diff_eq: "a + (b - c) = (a + b) - (c::'a::ab_group_add)"

   409 by (simp add: diff_minus add_ac)

   410

   411 lemma diff_add_eq: "(a - b) + c = (a + c) - (b::'a::ab_group_add)"

   412 by (simp add: diff_minus add_ac)

   413

   414 lemma diff_eq_eq: "(a-b = c) = (a = c + (b::'a::ab_group_add))"

   415 by (auto simp add: diff_minus add_assoc)

   416

   417 lemma eq_diff_eq: "(a = c-b) = (a + (b::'a::ab_group_add) = c)"

   418 by (auto simp add: diff_minus add_assoc)

   419

   420 lemma diff_diff_eq: "(a - b) - c = a - (b + (c::'a::ab_group_add))"

   421 by (simp add: diff_minus add_ac)

   422

   423 lemma diff_diff_eq2: "a - (b - c) = (a + c) - (b::'a::ab_group_add)"

   424 by (simp add: diff_minus add_ac)

   425

   426 lemma diff_add_cancel: "a - b + b = (a::'a::ab_group_add)"

   427 by (simp add: diff_minus add_ac)

   428

   429 lemma add_diff_cancel: "a + b - b = (a::'a::ab_group_add)"

   430 by (simp add: diff_minus add_ac)

   431

   432 text{*Further subtraction laws*}

   433

   434 lemma less_iff_diff_less_0: "(a < b) = (a - b < (0::'a::pordered_ab_group_add))"

   435 proof -

   436   have  "(a < b) = (a + (- b) < b + (-b))"

   437     by (simp only: add_less_cancel_right)

   438   also have "... =  (a - b < 0)" by (simp add: diff_minus)

   439   finally show ?thesis .

   440 qed

   441

   442 lemma diff_less_eq: "(a-b < c) = (a < c + (b::'a::pordered_ab_group_add))"

   443 apply (subst less_iff_diff_less_0 [of a])

   444 apply (rule less_iff_diff_less_0 [of _ c, THEN ssubst])

   445 apply (simp add: diff_minus add_ac)

   446 done

   447

   448 lemma less_diff_eq: "(a < c-b) = (a + (b::'a::pordered_ab_group_add) < c)"

   449 apply (subst less_iff_diff_less_0 [of "a+b"])

   450 apply (subst less_iff_diff_less_0 [of a])

   451 apply (simp add: diff_minus add_ac)

   452 done

   453

   454 lemma diff_le_eq: "(a-b \<le> c) = (a \<le> c + (b::'a::pordered_ab_group_add))"

   455 by (auto simp add: order_le_less diff_less_eq diff_add_cancel add_diff_cancel)

   456

   457 lemma le_diff_eq: "(a \<le> c-b) = (a + (b::'a::pordered_ab_group_add) \<le> c)"

   458 by (auto simp add: order_le_less less_diff_eq diff_add_cancel add_diff_cancel)

   459

   460 text{*This list of rewrites simplifies (in)equalities by bringing subtractions

   461   to the top and then moving negative terms to the other side.

   462   Use with @{text add_ac}*}

   463 lemmas compare_rls =

   464        diff_minus [symmetric]

   465        add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2

   466        diff_less_eq less_diff_eq diff_le_eq le_diff_eq

   467        diff_eq_eq eq_diff_eq

   468

   469

   470 subsection{*Lemmas for the @{text cancel_numerals} simproc*}

   471

   472 lemma eq_iff_diff_eq_0: "(a = b) = (a-b = (0::'a::ab_group_add))"

   473 by (simp add: compare_rls)

   474

   475 lemma le_iff_diff_le_0: "(a \<le> b) = (a-b \<le> (0::'a::pordered_ab_group_add))"

   476 by (simp add: compare_rls)

   477

   478 subsection {* Lattice Ordered (Abelian) Groups *}

   479

   480 axclass lordered_ab_group_meet < pordered_ab_group_add, meet_semilorder

   481

   482 axclass lordered_ab_group_join < pordered_ab_group_add, join_semilorder

   483

   484 lemma add_meet_distrib_left: "a + (meet b c) = meet (a + b) (a + (c::'a::{pordered_ab_group_add, meet_semilorder}))"

   485 apply (rule order_antisym)

   486 apply (rule meet_imp_le, simp_all add: meet_join_le)

   487 apply (rule add_le_imp_le_left [of "-a"])

   488 apply (simp only: add_assoc[symmetric], simp)

   489 apply (rule meet_imp_le)

   490 apply (rule add_le_imp_le_left[of "a"], simp only: add_assoc[symmetric], simp add: meet_join_le)+

   491 done

   492

   493 lemma add_join_distrib_left: "a + (join b c) = join (a + b) (a+ (c::'a::{pordered_ab_group_add, join_semilorder}))"

   494 apply (rule order_antisym)

   495 apply (rule add_le_imp_le_left [of "-a"])

   496 apply (simp only: add_assoc[symmetric], simp)

   497 apply (rule join_imp_le)

   498 apply (rule add_le_imp_le_left [of "a"], simp only: add_assoc[symmetric], simp add: meet_join_le)+

   499 apply (rule join_imp_le)

   500 apply (simp_all add: meet_join_le)

   501 done

   502

   503 lemma is_join_neg_meet: "is_join (% (a::'a::{pordered_ab_group_add, meet_semilorder}) b. - (meet (-a) (-b)))"

   504 apply (auto simp add: is_join_def)

   505 apply (rule_tac c="meet (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_meet_distrib_left meet_join_le)

   506 apply (rule_tac c="meet (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_meet_distrib_left meet_join_le)

   507 apply (subst neg_le_iff_le[symmetric])

   508 apply (simp add: meet_imp_le)

   509 done

   510

   511 lemma is_meet_neg_join: "is_meet (% (a::'a::{pordered_ab_group_add, join_semilorder}) b. - (join (-a) (-b)))"

   512 apply (auto simp add: is_meet_def)

   513 apply (rule_tac c="join (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_join_distrib_left meet_join_le)

   514 apply (rule_tac c="join (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_join_distrib_left meet_join_le)

   515 apply (subst neg_le_iff_le[symmetric])

   516 apply (simp add: join_imp_le)

   517 done

   518

   519 axclass lordered_ab_group \<subseteq> pordered_ab_group_add, lorder

   520

   521 instance lordered_ab_group_meet \<subseteq> lordered_ab_group

   522 proof

   523   show "? j. is_join (j::'a\<Rightarrow>'a\<Rightarrow>('a::lordered_ab_group_meet))" by (blast intro: is_join_neg_meet)

   524 qed

   525

   526 instance lordered_ab_group_join \<subseteq> lordered_ab_group

   527 proof

   528   show "? m. is_meet (m::'a\<Rightarrow>'a\<Rightarrow>('a::lordered_ab_group_join))" by (blast intro: is_meet_neg_join)

   529 qed

   530

   531 lemma add_join_distrib_right: "(join a b) + (c::'a::lordered_ab_group) = join (a+c) (b+c)"

   532 proof -

   533   have "c + (join a b) = join (c+a) (c+b)" by (simp add: add_join_distrib_left)

   534   thus ?thesis by (simp add: add_commute)

   535 qed

   536

   537 lemma add_meet_distrib_right: "(meet a b) + (c::'a::lordered_ab_group) = meet (a+c) (b+c)"

   538 proof -

   539   have "c + (meet a b) = meet (c+a) (c+b)" by (simp add: add_meet_distrib_left)

   540   thus ?thesis by (simp add: add_commute)

   541 qed

   542

   543 lemmas add_meet_join_distribs = add_meet_distrib_right add_meet_distrib_left add_join_distrib_right add_join_distrib_left

   544

   545 lemma join_eq_neg_meet: "join a (b::'a::lordered_ab_group) = - meet (-a) (-b)"

   546 by (simp add: is_join_unique[OF is_join_join is_join_neg_meet])

   547

   548 lemma meet_eq_neg_join: "meet a (b::'a::lordered_ab_group) = - join (-a) (-b)"

   549 by (simp add: is_meet_unique[OF is_meet_meet is_meet_neg_join])

   550

   551 lemma add_eq_meet_join: "a + b = (join a b) + (meet a (b::'a::lordered_ab_group))"

   552 proof -

   553   have "0 = - meet 0 (a-b) + meet (a-b) 0" by (simp add: meet_comm)

   554   hence "0 = join 0 (b-a) + meet (a-b) 0" by (simp add: meet_eq_neg_join)

   555   hence "0 = (-a + join a b) + (meet a b + (-b))"

   556     apply (simp add: add_join_distrib_left add_meet_distrib_right)

   557     by (simp add: diff_minus add_commute)

   558   thus ?thesis

   559     apply (simp add: compare_rls)

   560     apply (subst add_left_cancel[symmetric, of "a+b" "join a b + meet a b" "-a"])

   561     apply (simp only: add_assoc, simp add: add_assoc[symmetric])

   562     done

   563 qed

   564

   565 subsection {* Positive Part, Negative Part, Absolute Value *}

   566

   567 constdefs

   568   pprt :: "'a \<Rightarrow> ('a::lordered_ab_group)"

   569   "pprt x == join x 0"

   570   nprt :: "'a \<Rightarrow> ('a::lordered_ab_group)"

   571   "nprt x == meet x 0"

   572

   573 lemma prts: "a = pprt a + nprt a"

   574 by (simp add: pprt_def nprt_def add_eq_meet_join[symmetric])

   575

   576 lemma zero_le_pprt[simp]: "0 \<le> pprt a"

   577 by (simp add: pprt_def meet_join_le)

   578

   579 lemma nprt_le_zero[simp]: "nprt a \<le> 0"

   580 by (simp add: nprt_def meet_join_le)

   581

   582 lemma le_eq_neg: "(a \<le> -b) = (a + b \<le> (0::_::lordered_ab_group))" (is "?l = ?r")

   583 proof -

   584   have a: "?l \<longrightarrow> ?r"

   585     apply (auto)

   586     apply (rule add_le_imp_le_right[of _ "-b" _])

   587     apply (simp add: add_assoc)

   588     done

   589   have b: "?r \<longrightarrow> ?l"

   590     apply (auto)

   591     apply (rule add_le_imp_le_right[of _ "b" _])

   592     apply (simp)

   593     done

   594   from a b show ?thesis by blast

   595 qed

   596

   597 lemma pprt_0[simp]: "pprt 0 = 0" by (simp add: pprt_def)

   598 lemma nprt_0[simp]: "nprt 0 = 0" by (simp add: nprt_def)

   599

   600 lemma pprt_eq_id[simp]: "0 <= x \<Longrightarrow> pprt x = x"

   601   by (simp add: pprt_def le_def_join join_aci)

   602

   603 lemma nprt_eq_id[simp]: "x <= 0 \<Longrightarrow> nprt x = x"

   604   by (simp add: nprt_def le_def_meet meet_aci)

   605

   606 lemma pprt_eq_0[simp]: "x <= 0 \<Longrightarrow> pprt x = 0"

   607   by (simp add: pprt_def le_def_join join_aci)

   608

   609 lemma nprt_eq_0[simp]: "0 <= x \<Longrightarrow> nprt x = 0"

   610   by (simp add: nprt_def le_def_meet meet_aci)

   611

   612 lemma join_0_imp_0: "join a (-a) = 0 \<Longrightarrow> a = (0::'a::lordered_ab_group)"

   613 proof -

   614   {

   615     fix a::'a

   616     assume hyp: "join a (-a) = 0"

   617     hence "join a (-a) + a = a" by (simp)

   618     hence "join (a+a) 0 = a" by (simp add: add_join_distrib_right)

   619     hence "join (a+a) 0 <= a" by (simp)

   620     hence "0 <= a" by (blast intro: order_trans meet_join_le)

   621   }

   622   note p = this

   623   assume hyp:"join a (-a) = 0"

   624   hence hyp2:"join (-a) (-(-a)) = 0" by (simp add: join_comm)

   625   from p[OF hyp] p[OF hyp2] show "a = 0" by simp

   626 qed

   627

   628 lemma meet_0_imp_0: "meet a (-a) = 0 \<Longrightarrow> a = (0::'a::lordered_ab_group)"

   629 apply (simp add: meet_eq_neg_join)

   630 apply (simp add: join_comm)

   631 apply (erule join_0_imp_0)

   632 done

   633

   634 lemma join_0_eq_0[simp]: "(join a (-a) = 0) = (a = (0::'a::lordered_ab_group))"

   635 by (auto, erule join_0_imp_0)

   636

   637 lemma meet_0_eq_0[simp]: "(meet a (-a) = 0) = (a = (0::'a::lordered_ab_group))"

   638 by (auto, erule meet_0_imp_0)

   639

   640 lemma zero_le_double_add_iff_zero_le_single_add[simp]: "(0 \<le> a + a) = (0 \<le> (a::'a::lordered_ab_group))"

   641 proof

   642   assume "0 <= a + a"

   643   hence a:"meet (a+a) 0 = 0" by (simp add: le_def_meet meet_comm)

   644   have "(meet a 0)+(meet a 0) = meet (meet (a+a) 0) a" (is "?l=_") by (simp add: add_meet_join_distribs meet_aci)

   645   hence "?l = 0 + meet a 0" by (simp add: a, simp add: meet_comm)

   646   hence "meet a 0 = 0" by (simp only: add_right_cancel)

   647   then show "0 <= a" by (simp add: le_def_meet meet_comm)

   648 next

   649   assume a: "0 <= a"

   650   show "0 <= a + a" by (simp add: add_mono[OF a a, simplified])

   651 qed

   652

   653 lemma double_add_le_zero_iff_single_add_le_zero[simp]: "(a + a <= 0) = ((a::'a::lordered_ab_group) <= 0)"

   654 proof -

   655   have "(a + a <= 0) = (0 <= -(a+a))" by (subst le_minus_iff, simp)

   656   moreover have "\<dots> = (a <= 0)" by (simp add: zero_le_double_add_iff_zero_le_single_add)

   657   ultimately show ?thesis by blast

   658 qed

   659

   660 lemma double_add_less_zero_iff_single_less_zero[simp]: "(a+a<0) = ((a::'a::{pordered_ab_group_add,linorder}) < 0)" (is ?s)

   661 proof cases

   662   assume a: "a < 0"

   663   thus ?s by (simp add:  add_strict_mono[OF a a, simplified])

   664 next

   665   assume "~(a < 0)"

   666   hence a:"0 <= a" by (simp)

   667   hence "0 <= a+a" by (simp add: add_mono[OF a a, simplified])

   668   hence "~(a+a < 0)" by simp

   669   with a show ?thesis by simp

   670 qed

   671

   672 axclass lordered_ab_group_abs \<subseteq> lordered_ab_group

   673   abs_lattice: "abs x = join x (-x)"

   674

   675 lemma abs_zero[simp]: "abs 0 = (0::'a::lordered_ab_group_abs)"

   676 by (simp add: abs_lattice)

   677

   678 lemma abs_eq_0[simp]: "(abs a = 0) = (a = (0::'a::lordered_ab_group_abs))"

   679 by (simp add: abs_lattice)

   680

   681 lemma abs_0_eq[simp]: "(0 = abs a) = (a = (0::'a::lordered_ab_group_abs))"

   682 proof -

   683   have "(0 = abs a) = (abs a = 0)" by (simp only: eq_ac)

   684   thus ?thesis by simp

   685 qed

   686

   687 lemma neg_meet_eq_join[simp]: "- meet a (b::_::lordered_ab_group) = join (-a) (-b)"

   688 by (simp add: meet_eq_neg_join)

   689

   690 lemma neg_join_eq_meet[simp]: "- join a (b::_::lordered_ab_group) = meet (-a) (-b)"

   691 by (simp del: neg_meet_eq_join add: join_eq_neg_meet)

   692

   693 lemma join_eq_if: "join a (-a) = (if a < 0 then -a else (a::'a::{lordered_ab_group, linorder}))"

   694 proof -

   695   note b = add_le_cancel_right[of a a "-a",symmetric,simplified]

   696   have c: "a + a = 0 \<Longrightarrow> -a = a" by (rule add_right_imp_eq[of _ a], simp)

   697   show ?thesis by (auto simp add: join_max max_def b linorder_not_less)

   698 qed

   699

   700 lemma abs_if_lattice: "\<bar>a\<bar> = (if a < 0 then -a else (a::'a::{lordered_ab_group_abs, linorder}))"

   701 proof -

   702   show ?thesis by (simp add: abs_lattice join_eq_if)

   703 qed

   704

   705 lemma abs_eq [simp]:

   706   fixes a :: "'a::{lordered_ab_group_abs, linorder}"

   707   shows  "0 \<le> a ==> abs a = a"

   708 by (simp add: abs_if_lattice linorder_not_less [symmetric])

   709

   710 lemma abs_minus_eq [simp]:

   711   fixes a :: "'a::{lordered_ab_group_abs, linorder}"

   712   shows "a < 0 ==> abs a = -a"

   713 by (simp add: abs_if_lattice linorder_not_less [symmetric])

   714

   715 lemma abs_ge_zero[simp]: "0 \<le> abs (a::'a::lordered_ab_group_abs)"

   716 proof -

   717   have a:"a <= abs a" and b:"-a <= abs a" by (auto simp add: abs_lattice meet_join_le)

   718   show ?thesis by (rule add_mono[OF a b, simplified])

   719 qed

   720

   721 lemma abs_le_zero_iff [simp]: "(abs a \<le> (0::'a::lordered_ab_group_abs)) = (a = 0)"

   722 proof

   723   assume "abs a <= 0"

   724   hence "abs a = 0" by (auto dest: order_antisym)

   725   thus "a = 0" by simp

   726 next

   727   assume "a = 0"

   728   thus "abs a <= 0" by simp

   729 qed

   730

   731 lemma zero_less_abs_iff [simp]: "(0 < abs a) = (a \<noteq> (0::'a::lordered_ab_group_abs))"

   732 by (simp add: order_less_le)

   733

   734 lemma abs_not_less_zero [simp]: "~ abs a < (0::'a::lordered_ab_group_abs)"

   735 proof -

   736   have a:"!! x (y::_::order). x <= y \<Longrightarrow> ~(y < x)" by auto

   737   show ?thesis by (simp add: a)

   738 qed

   739

   740 lemma abs_ge_self: "a \<le> abs (a::'a::lordered_ab_group_abs)"

   741 by (simp add: abs_lattice meet_join_le)

   742

   743 lemma abs_ge_minus_self: "-a \<le> abs (a::'a::lordered_ab_group_abs)"

   744 by (simp add: abs_lattice meet_join_le)

   745

   746 lemma le_imp_join_eq: "a \<le> b \<Longrightarrow> join a b = b"

   747 by (simp add: le_def_join)

   748

   749 lemma ge_imp_join_eq: "b \<le> a \<Longrightarrow> join a b = a"

   750 by (simp add: le_def_join join_aci)

   751

   752 lemma le_imp_meet_eq: "a \<le> b \<Longrightarrow> meet a b = a"

   753 by (simp add: le_def_meet)

   754

   755 lemma ge_imp_meet_eq: "b \<le> a \<Longrightarrow> meet a b = b"

   756 by (simp add: le_def_meet meet_aci)

   757

   758 lemma abs_prts: "abs (a::_::lordered_ab_group_abs) = pprt a - nprt a"

   759 apply (simp add: pprt_def nprt_def diff_minus)

   760 apply (simp add: add_meet_join_distribs join_aci abs_lattice[symmetric])

   761 apply (subst le_imp_join_eq, auto)

   762 done

   763

   764 lemma abs_minus_cancel [simp]: "abs (-a) = abs(a::'a::lordered_ab_group_abs)"

   765 by (simp add: abs_lattice join_comm)

   766

   767 lemma abs_idempotent [simp]: "abs (abs a) = abs (a::'a::lordered_ab_group_abs)"

   768 apply (simp add: abs_lattice[of "abs a"])

   769 apply (subst ge_imp_join_eq)

   770 apply (rule order_trans[of _ 0])

   771 by auto

   772

   773 lemma abs_minus_commute:

   774   fixes a :: "'a::lordered_ab_group_abs"

   775   shows "abs (a-b) = abs(b-a)"

   776 proof -

   777   have "abs (a-b) = abs (- (a-b))" by (simp only: abs_minus_cancel)

   778   also have "... = abs(b-a)" by simp

   779   finally show ?thesis .

   780 qed

   781

   782 lemma zero_le_iff_zero_nprt: "(0 \<le> a) = (nprt a = 0)"

   783 by (simp add: le_def_meet nprt_def meet_comm)

   784

   785 lemma le_zero_iff_zero_pprt: "(a \<le> 0) = (pprt a = 0)"

   786 by (simp add: le_def_join pprt_def join_comm)

   787

   788 lemma le_zero_iff_pprt_id: "(0 \<le> a) = (pprt a = a)"

   789 by (simp add: le_def_join pprt_def join_comm)

   790

   791 lemma zero_le_iff_nprt_id: "(a \<le> 0) = (nprt a = a)"

   792 by (simp add: le_def_meet nprt_def meet_comm)

   793

   794 lemma pprt_mono[simp]: "(a::_::lordered_ab_group) <= b \<Longrightarrow> pprt a <= pprt b"

   795   by (simp add: le_def_join pprt_def join_aci)

   796

   797 lemma nprt_mono[simp]: "(a::_::lordered_ab_group) <= b \<Longrightarrow> nprt a <= nprt b"

   798   by (simp add: le_def_meet nprt_def meet_aci)

   799

   800 lemma iff2imp: "(A=B) \<Longrightarrow> (A \<Longrightarrow> B)"

   801 by (simp)

   802

   803 lemma imp_abs_id: "0 \<le> a \<Longrightarrow> abs a = (a::'a::lordered_ab_group_abs)"

   804 by (simp add: iff2imp[OF zero_le_iff_zero_nprt] iff2imp[OF le_zero_iff_pprt_id] abs_prts)

   805

   806 lemma imp_abs_neg_id: "a \<le> 0 \<Longrightarrow> abs a = -(a::'a::lordered_ab_group_abs)"

   807 by (simp add: iff2imp[OF le_zero_iff_zero_pprt] iff2imp[OF zero_le_iff_nprt_id] abs_prts)

   808

   809 lemma abs_leI: "[|a \<le> b; -a \<le> b|] ==> abs a \<le> (b::'a::lordered_ab_group_abs)"

   810 by (simp add: abs_lattice join_imp_le)

   811

   812 lemma le_minus_self_iff: "(a \<le> -a) = (a \<le> (0::'a::lordered_ab_group))"

   813 proof -

   814   from add_le_cancel_left[of "-a" "a+a" "0"] have "(a <= -a) = (a+a <= 0)"

   815     by (simp add: add_assoc[symmetric])

   816   thus ?thesis by simp

   817 qed

   818

   819 lemma minus_le_self_iff: "(-a \<le> a) = (0 \<le> (a::'a::lordered_ab_group))"

   820 proof -

   821   from add_le_cancel_left[of "-a" "0" "a+a"] have "(-a <= a) = (0 <= a+a)"

   822     by (simp add: add_assoc[symmetric])

   823   thus ?thesis by simp

   824 qed

   825

   826 lemma abs_le_D1: "abs a \<le> b ==> a \<le> (b::'a::lordered_ab_group_abs)"

   827 by (insert abs_ge_self, blast intro: order_trans)

   828

   829 lemma abs_le_D2: "abs a \<le> b ==> -a \<le> (b::'a::lordered_ab_group_abs)"

   830 by (insert abs_le_D1 [of "-a"], simp)

   831

   832 lemma abs_le_iff: "(abs a \<le> b) = (a \<le> b & -a \<le> (b::'a::lordered_ab_group_abs))"

   833 by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2)

   834

   835 lemma abs_triangle_ineq: "abs(a+b) \<le> abs a + abs(b::'a::lordered_ab_group_abs)"

   836 proof -

   837   have g:"abs a + abs b = join (a+b) (join (-a-b) (join (-a+b) (a + (-b))))" (is "_=join ?m ?n")

   838     apply (simp add: abs_lattice add_meet_join_distribs join_aci)

   839     by (simp only: diff_minus)

   840   have a:"a+b <= join ?m ?n" by (simp add: meet_join_le)

   841   have b:"-a-b <= ?n" by (simp add: meet_join_le)

   842   have c:"?n <= join ?m ?n" by (simp add: meet_join_le)

   843   from b c have d: "-a-b <= join ?m ?n" by simp

   844   have e:"-a-b = -(a+b)" by (simp add: diff_minus)

   845   from a d e have "abs(a+b) <= join ?m ?n"

   846     by (drule_tac abs_leI, auto)

   847   with g[symmetric] show ?thesis by simp

   848 qed

   849

   850 lemma abs_diff_triangle_ineq:

   851      "\<bar>(a::'a::lordered_ab_group_abs) + b - (c+d)\<bar> \<le> \<bar>a-c\<bar> + \<bar>b-d\<bar>"

   852 proof -

   853   have "\<bar>a + b - (c+d)\<bar> = \<bar>(a-c) + (b-d)\<bar>" by (simp add: diff_minus add_ac)

   854   also have "... \<le> \<bar>a-c\<bar> + \<bar>b-d\<bar>" by (rule abs_triangle_ineq)

   855   finally show ?thesis .

   856 qed

   857

   858 lemma abs_add_abs[simp]:

   859 fixes a:: "'a::{lordered_ab_group_abs}"

   860 shows "abs(abs a + abs b) = abs a + abs b" (is "?L = ?R")

   861 proof (rule order_antisym)

   862   show "?L \<ge> ?R" by(rule abs_ge_self)

   863 next

   864   have "?L \<le> \<bar>\<bar>a\<bar>\<bar> + \<bar>\<bar>b\<bar>\<bar>" by(rule abs_triangle_ineq)

   865   also have "\<dots> = ?R" by simp

   866   finally show "?L \<le> ?R" .

   867 qed

   868

   869 text {* Needed for abelian cancellation simprocs: *}

   870

   871 lemma add_cancel_21: "((x::'a::ab_group_add) + (y + z) = y + u) = (x + z = u)"

   872 apply (subst add_left_commute)

   873 apply (subst add_left_cancel)

   874 apply simp

   875 done

   876

   877 lemma add_cancel_end: "(x + (y + z) = y) = (x = - (z::'a::ab_group_add))"

   878 apply (subst add_cancel_21[of _ _ _ 0, simplified])

   879 apply (simp add: add_right_cancel[symmetric, of "x" "-z" "z", simplified])

   880 done

   881

   882 lemma less_eqI: "(x::'a::pordered_ab_group_add) - y = x' - y' \<Longrightarrow> (x < y) = (x' < y')"

   883 by (simp add: less_iff_diff_less_0[of x y] less_iff_diff_less_0[of x' y'])

   884

   885 lemma le_eqI: "(x::'a::pordered_ab_group_add) - y = x' - y' \<Longrightarrow> (y <= x) = (y' <= x')"

   886 apply (simp add: le_iff_diff_le_0[of y x] le_iff_diff_le_0[of  y' x'])

   887 apply (simp add: neg_le_iff_le[symmetric, of "y-x" 0] neg_le_iff_le[symmetric, of "y'-x'" 0])

   888 done

   889

   890 lemma eq_eqI: "(x::'a::ab_group_add) - y = x' - y' \<Longrightarrow> (x = y) = (x' = y')"

   891 by (simp add: eq_iff_diff_eq_0[of x y] eq_iff_diff_eq_0[of x' y'])

   892

   893 lemma diff_def: "(x::'a::ab_group_add) - y == x + (-y)"

   894 by (simp add: diff_minus)

   895

   896 lemma add_minus_cancel: "(a::'a::ab_group_add) + (-a + b) = b"

   897 by (simp add: add_assoc[symmetric])

   898

   899 lemma minus_add_cancel: "-(a::'a::ab_group_add) + (a + b) = b"

   900 by (simp add: add_assoc[symmetric])

   901

   902 lemma  le_add_right_mono:

   903   assumes

   904   "a <= b + (c::'a::pordered_ab_group_add)"

   905   "c <= d"

   906   shows "a <= b + d"

   907   apply (rule_tac order_trans[where y = "b+c"])

   908   apply (simp_all add: prems)

   909   done

   910

   911 lemmas group_eq_simps =

   912   mult_ac

   913   add_ac

   914   add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2

   915   diff_eq_eq eq_diff_eq

   916

   917 lemma estimate_by_abs:

   918 "a + b <= (c::'a::lordered_ab_group_abs) \<Longrightarrow> a <= c + abs b"

   919 proof -

   920   assume 1: "a+b <= c"

   921   have 2: "a <= c+(-b)"

   922     apply (insert 1)

   923     apply (drule_tac add_right_mono[where c="-b"])

   924     apply (simp add: group_eq_simps)

   925     done

   926   have 3: "(-b) <= abs b" by (rule abs_ge_minus_self)

   927   show ?thesis by (rule le_add_right_mono[OF 2 3])

   928 qed

   929

   930 lemma abs_of_ge_0: "0 <= (y::'a::lordered_ab_group_abs) \<Longrightarrow> abs y = y"

   931 proof -

   932   assume 1:"0 <= y"

   933   have 2:"-y <= 0" by (simp add: 1)

   934   from 1 2 have 3:"-y <= y" by (simp only:)

   935   show ?thesis by (simp add: abs_lattice ge_imp_join_eq[OF 3])

   936 qed

   937

   938 ML {*

   939 val add_zero_left = thm"add_0";

   940 val add_zero_right = thm"add_0_right";

   941 *}

   942

   943 ML {*

   944 val add_assoc = thm "add_assoc";

   945 val add_commute = thm "add_commute";

   946 val add_left_commute = thm "add_left_commute";

   947 val add_ac = thms "add_ac";

   948 val mult_assoc = thm "mult_assoc";

   949 val mult_commute = thm "mult_commute";

   950 val mult_left_commute = thm "mult_left_commute";

   951 val mult_ac = thms "mult_ac";

   952 val add_0 = thm "add_0";

   953 val mult_1_left = thm "mult_1_left";

   954 val mult_1_right = thm "mult_1_right";

   955 val mult_1 = thm "mult_1";

   956 val add_left_imp_eq = thm "add_left_imp_eq";

   957 val add_right_imp_eq = thm "add_right_imp_eq";

   958 val add_imp_eq = thm "add_imp_eq";

   959 val left_minus = thm "left_minus";

   960 val diff_minus = thm "diff_minus";

   961 val add_0_right = thm "add_0_right";

   962 val add_left_cancel = thm "add_left_cancel";

   963 val add_right_cancel = thm "add_right_cancel";

   964 val right_minus = thm "right_minus";

   965 val right_minus_eq = thm "right_minus_eq";

   966 val minus_minus = thm "minus_minus";

   967 val equals_zero_I = thm "equals_zero_I";

   968 val minus_zero = thm "minus_zero";

   969 val diff_self = thm "diff_self";

   970 val diff_0 = thm "diff_0";

   971 val diff_0_right = thm "diff_0_right";

   972 val diff_minus_eq_add = thm "diff_minus_eq_add";

   973 val neg_equal_iff_equal = thm "neg_equal_iff_equal";

   974 val neg_equal_0_iff_equal = thm "neg_equal_0_iff_equal";

   975 val neg_0_equal_iff_equal = thm "neg_0_equal_iff_equal";

   976 val equation_minus_iff = thm "equation_minus_iff";

   977 val minus_equation_iff = thm "minus_equation_iff";

   978 val minus_add_distrib = thm "minus_add_distrib";

   979 val minus_diff_eq = thm "minus_diff_eq";

   980 val add_left_mono = thm "add_left_mono";

   981 val add_le_imp_le_left = thm "add_le_imp_le_left";

   982 val add_right_mono = thm "add_right_mono";

   983 val add_mono = thm "add_mono";

   984 val add_strict_left_mono = thm "add_strict_left_mono";

   985 val add_strict_right_mono = thm "add_strict_right_mono";

   986 val add_strict_mono = thm "add_strict_mono";

   987 val add_less_le_mono = thm "add_less_le_mono";

   988 val add_le_less_mono = thm "add_le_less_mono";

   989 val add_less_imp_less_left = thm "add_less_imp_less_left";

   990 val add_less_imp_less_right = thm "add_less_imp_less_right";

   991 val add_less_cancel_left = thm "add_less_cancel_left";

   992 val add_less_cancel_right = thm "add_less_cancel_right";

   993 val add_le_cancel_left = thm "add_le_cancel_left";

   994 val add_le_cancel_right = thm "add_le_cancel_right";

   995 val add_le_imp_le_right = thm "add_le_imp_le_right";

   996 val add_increasing = thm "add_increasing";

   997 val le_imp_neg_le = thm "le_imp_neg_le";

   998 val neg_le_iff_le = thm "neg_le_iff_le";

   999 val neg_le_0_iff_le = thm "neg_le_0_iff_le";

  1000 val neg_0_le_iff_le = thm "neg_0_le_iff_le";

  1001 val neg_less_iff_less = thm "neg_less_iff_less";

  1002 val neg_less_0_iff_less = thm "neg_less_0_iff_less";

  1003 val neg_0_less_iff_less = thm "neg_0_less_iff_less";

  1004 val less_minus_iff = thm "less_minus_iff";

  1005 val minus_less_iff = thm "minus_less_iff";

  1006 val le_minus_iff = thm "le_minus_iff";

  1007 val minus_le_iff = thm "minus_le_iff";

  1008 val add_diff_eq = thm "add_diff_eq";

  1009 val diff_add_eq = thm "diff_add_eq";

  1010 val diff_eq_eq = thm "diff_eq_eq";

  1011 val eq_diff_eq = thm "eq_diff_eq";

  1012 val diff_diff_eq = thm "diff_diff_eq";

  1013 val diff_diff_eq2 = thm "diff_diff_eq2";

  1014 val diff_add_cancel = thm "diff_add_cancel";

  1015 val add_diff_cancel = thm "add_diff_cancel";

  1016 val less_iff_diff_less_0 = thm "less_iff_diff_less_0";

  1017 val diff_less_eq = thm "diff_less_eq";

  1018 val less_diff_eq = thm "less_diff_eq";

  1019 val diff_le_eq = thm "diff_le_eq";

  1020 val le_diff_eq = thm "le_diff_eq";

  1021 val compare_rls = thms "compare_rls";

  1022 val eq_iff_diff_eq_0 = thm "eq_iff_diff_eq_0";

  1023 val le_iff_diff_le_0 = thm "le_iff_diff_le_0";

  1024 val add_meet_distrib_left = thm "add_meet_distrib_left";

  1025 val add_join_distrib_left = thm "add_join_distrib_left";

  1026 val is_join_neg_meet = thm "is_join_neg_meet";

  1027 val is_meet_neg_join = thm "is_meet_neg_join";

  1028 val add_join_distrib_right = thm "add_join_distrib_right";

  1029 val add_meet_distrib_right = thm "add_meet_distrib_right";

  1030 val add_meet_join_distribs = thms "add_meet_join_distribs";

  1031 val join_eq_neg_meet = thm "join_eq_neg_meet";

  1032 val meet_eq_neg_join = thm "meet_eq_neg_join";

  1033 val add_eq_meet_join = thm "add_eq_meet_join";

  1034 val prts = thm "prts";

  1035 val zero_le_pprt = thm "zero_le_pprt";

  1036 val nprt_le_zero = thm "nprt_le_zero";

  1037 val le_eq_neg = thm "le_eq_neg";

  1038 val join_0_imp_0 = thm "join_0_imp_0";

  1039 val meet_0_imp_0 = thm "meet_0_imp_0";

  1040 val join_0_eq_0 = thm "join_0_eq_0";

  1041 val meet_0_eq_0 = thm "meet_0_eq_0";

  1042 val zero_le_double_add_iff_zero_le_single_add = thm "zero_le_double_add_iff_zero_le_single_add";

  1043 val double_add_le_zero_iff_single_add_le_zero = thm "double_add_le_zero_iff_single_add_le_zero";

  1044 val double_add_less_zero_iff_single_less_zero = thm "double_add_less_zero_iff_single_less_zero";

  1045 val abs_lattice = thm "abs_lattice";

  1046 val abs_zero = thm "abs_zero";

  1047 val abs_eq_0 = thm "abs_eq_0";

  1048 val abs_0_eq = thm "abs_0_eq";

  1049 val neg_meet_eq_join = thm "neg_meet_eq_join";

  1050 val neg_join_eq_meet = thm "neg_join_eq_meet";

  1051 val join_eq_if = thm "join_eq_if";

  1052 val abs_if_lattice = thm "abs_if_lattice";

  1053 val abs_ge_zero = thm "abs_ge_zero";

  1054 val abs_le_zero_iff = thm "abs_le_zero_iff";

  1055 val zero_less_abs_iff = thm "zero_less_abs_iff";

  1056 val abs_not_less_zero = thm "abs_not_less_zero";

  1057 val abs_ge_self = thm "abs_ge_self";

  1058 val abs_ge_minus_self = thm "abs_ge_minus_self";

  1059 val le_imp_join_eq = thm "le_imp_join_eq";

  1060 val ge_imp_join_eq = thm "ge_imp_join_eq";

  1061 val le_imp_meet_eq = thm "le_imp_meet_eq";

  1062 val ge_imp_meet_eq = thm "ge_imp_meet_eq";

  1063 val abs_prts = thm "abs_prts";

  1064 val abs_minus_cancel = thm "abs_minus_cancel";

  1065 val abs_idempotent = thm "abs_idempotent";

  1066 val zero_le_iff_zero_nprt = thm "zero_le_iff_zero_nprt";

  1067 val le_zero_iff_zero_pprt = thm "le_zero_iff_zero_pprt";

  1068 val le_zero_iff_pprt_id = thm "le_zero_iff_pprt_id";

  1069 val zero_le_iff_nprt_id = thm "zero_le_iff_nprt_id";

  1070 val iff2imp = thm "iff2imp";

  1071 val imp_abs_id = thm "imp_abs_id";

  1072 val imp_abs_neg_id = thm "imp_abs_neg_id";

  1073 val abs_leI = thm "abs_leI";

  1074 val le_minus_self_iff = thm "le_minus_self_iff";

  1075 val minus_le_self_iff = thm "minus_le_self_iff";

  1076 val abs_le_D1 = thm "abs_le_D1";

  1077 val abs_le_D2 = thm "abs_le_D2";

  1078 val abs_le_iff = thm "abs_le_iff";

  1079 val abs_triangle_ineq = thm "abs_triangle_ineq";

  1080 val abs_diff_triangle_ineq = thm "abs_diff_triangle_ineq";

  1081 *}

  1082

  1083 end