src/HOL/OrderedGroup.thy
author nipkow
Mon Aug 16 14:22:27 2004 +0200 (2004-08-16)
changeset 15131 c69542757a4d
parent 15093 49ede01e9ee6
child 15140 322485b816ac
permissions -rw-r--r--
New theory header syntax.
     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 import Inductive LOrder
    10 files "../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: "[|0\<le>a; b\<le>c|] ==> b \<le> a + (c::'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add})"
   318 by (insert add_mono [of 0 a b c], simp)
   319 
   320 subsection {* Ordering Rules for Unary Minus *}
   321 
   322 lemma le_imp_neg_le:
   323       assumes "a \<le> (b::'a::{pordered_ab_semigroup_add_imp_le, ab_group_add})" shows "-b \<le> -a"
   324 proof -
   325   have "-a+a \<le> -a+b"
   326     by (rule add_left_mono) 
   327   hence "0 \<le> -a+b"
   328     by simp
   329   hence "0 + (-b) \<le> (-a + b) + (-b)"
   330     by (rule add_right_mono) 
   331   thus ?thesis
   332     by (simp add: add_assoc)
   333 qed
   334 
   335 lemma neg_le_iff_le [simp]: "(-b \<le> -a) = (a \<le> (b::'a::pordered_ab_group_add))"
   336 proof 
   337   assume "- b \<le> - a"
   338   hence "- (- a) \<le> - (- b)"
   339     by (rule le_imp_neg_le)
   340   thus "a\<le>b" by simp
   341 next
   342   assume "a\<le>b"
   343   thus "-b \<le> -a" by (rule le_imp_neg_le)
   344 qed
   345 
   346 lemma neg_le_0_iff_le [simp]: "(-a \<le> 0) = (0 \<le> (a::'a::pordered_ab_group_add))"
   347 by (subst neg_le_iff_le [symmetric], simp)
   348 
   349 lemma neg_0_le_iff_le [simp]: "(0 \<le> -a) = (a \<le> (0::'a::pordered_ab_group_add))"
   350 by (subst neg_le_iff_le [symmetric], simp)
   351 
   352 lemma neg_less_iff_less [simp]: "(-b < -a) = (a < (b::'a::pordered_ab_group_add))"
   353 by (force simp add: order_less_le) 
   354 
   355 lemma neg_less_0_iff_less [simp]: "(-a < 0) = (0 < (a::'a::pordered_ab_group_add))"
   356 by (subst neg_less_iff_less [symmetric], simp)
   357 
   358 lemma neg_0_less_iff_less [simp]: "(0 < -a) = (a < (0::'a::pordered_ab_group_add))"
   359 by (subst neg_less_iff_less [symmetric], simp)
   360 
   361 text{*The next several equations can make the simplifier loop!*}
   362 
   363 lemma less_minus_iff: "(a < - b) = (b < - (a::'a::pordered_ab_group_add))"
   364 proof -
   365   have "(- (-a) < - b) = (b < - a)" by (rule neg_less_iff_less)
   366   thus ?thesis by simp
   367 qed
   368 
   369 lemma minus_less_iff: "(- a < b) = (- b < (a::'a::pordered_ab_group_add))"
   370 proof -
   371   have "(- a < - (-b)) = (- b < a)" by (rule neg_less_iff_less)
   372   thus ?thesis by simp
   373 qed
   374 
   375 lemma le_minus_iff: "(a \<le> - b) = (b \<le> - (a::'a::pordered_ab_group_add))"
   376 proof -
   377   have mm: "!! a (b::'a). (-(-a)) < -b \<Longrightarrow> -(-b) < -a" by (simp only: minus_less_iff)
   378   have "(- (- a) <= -b) = (b <= - a)" 
   379     apply (auto simp only: order_le_less)
   380     apply (drule mm)
   381     apply (simp_all)
   382     apply (drule mm[simplified], assumption)
   383     done
   384   then show ?thesis by simp
   385 qed
   386 
   387 lemma minus_le_iff: "(- a \<le> b) = (- b \<le> (a::'a::pordered_ab_group_add))"
   388 by (auto simp add: order_le_less minus_less_iff)
   389 
   390 lemma add_diff_eq: "a + (b - c) = (a + b) - (c::'a::ab_group_add)"
   391 by (simp add: diff_minus add_ac)
   392 
   393 lemma diff_add_eq: "(a - b) + c = (a + c) - (b::'a::ab_group_add)"
   394 by (simp add: diff_minus add_ac)
   395 
   396 lemma diff_eq_eq: "(a-b = c) = (a = c + (b::'a::ab_group_add))"
   397 by (auto simp add: diff_minus add_assoc)
   398 
   399 lemma eq_diff_eq: "(a = c-b) = (a + (b::'a::ab_group_add) = c)"
   400 by (auto simp add: diff_minus add_assoc)
   401 
   402 lemma diff_diff_eq: "(a - b) - c = a - (b + (c::'a::ab_group_add))"
   403 by (simp add: diff_minus add_ac)
   404 
   405 lemma diff_diff_eq2: "a - (b - c) = (a + c) - (b::'a::ab_group_add)"
   406 by (simp add: diff_minus add_ac)
   407 
   408 lemma diff_add_cancel: "a - b + b = (a::'a::ab_group_add)"
   409 by (simp add: diff_minus add_ac)
   410 
   411 lemma add_diff_cancel: "a + b - b = (a::'a::ab_group_add)"
   412 by (simp add: diff_minus add_ac)
   413 
   414 text{*Further subtraction laws*}
   415 
   416 lemma less_iff_diff_less_0: "(a < b) = (a - b < (0::'a::pordered_ab_group_add))"
   417 proof -
   418   have  "(a < b) = (a + (- b) < b + (-b))"  
   419     by (simp only: add_less_cancel_right)
   420   also have "... =  (a - b < 0)" by (simp add: diff_minus)
   421   finally show ?thesis .
   422 qed
   423 
   424 lemma diff_less_eq: "(a-b < c) = (a < c + (b::'a::pordered_ab_group_add))"
   425 apply (subst less_iff_diff_less_0)
   426 apply (rule less_iff_diff_less_0 [of _ c, THEN ssubst])
   427 apply (simp add: diff_minus add_ac)
   428 done
   429 
   430 lemma less_diff_eq: "(a < c-b) = (a + (b::'a::pordered_ab_group_add) < c)"
   431 apply (subst less_iff_diff_less_0)
   432 apply (rule less_iff_diff_less_0 [of _ "c-b", THEN ssubst])
   433 apply (simp add: diff_minus add_ac)
   434 done
   435 
   436 lemma diff_le_eq: "(a-b \<le> c) = (a \<le> c + (b::'a::pordered_ab_group_add))"
   437 by (auto simp add: order_le_less diff_less_eq diff_add_cancel add_diff_cancel)
   438 
   439 lemma le_diff_eq: "(a \<le> c-b) = (a + (b::'a::pordered_ab_group_add) \<le> c)"
   440 by (auto simp add: order_le_less less_diff_eq diff_add_cancel add_diff_cancel)
   441 
   442 text{*This list of rewrites simplifies (in)equalities by bringing subtractions
   443   to the top and then moving negative terms to the other side.
   444   Use with @{text add_ac}*}
   445 lemmas compare_rls =
   446        diff_minus [symmetric]
   447        add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
   448        diff_less_eq less_diff_eq diff_le_eq le_diff_eq
   449        diff_eq_eq eq_diff_eq
   450 
   451 
   452 subsection{*Lemmas for the @{text cancel_numerals} simproc*}
   453 
   454 lemma eq_iff_diff_eq_0: "(a = b) = (a-b = (0::'a::ab_group_add))"
   455 by (simp add: compare_rls)
   456 
   457 lemma le_iff_diff_le_0: "(a \<le> b) = (a-b \<le> (0::'a::pordered_ab_group_add))"
   458 by (simp add: compare_rls)
   459 
   460 subsection {* Lattice Ordered (Abelian) Groups *}
   461 
   462 axclass lordered_ab_group_meet < pordered_ab_group_add, meet_semilorder
   463 
   464 axclass lordered_ab_group_join < pordered_ab_group_add, join_semilorder
   465 
   466 lemma add_meet_distrib_left: "a + (meet b c) = meet (a + b) (a + (c::'a::{pordered_ab_group_add, meet_semilorder}))"
   467 apply (rule order_antisym)
   468 apply (rule meet_imp_le, simp_all add: meet_join_le)
   469 apply (rule add_le_imp_le_left [of "-a"])
   470 apply (simp only: add_assoc[symmetric], simp)
   471 apply (rule meet_imp_le)
   472 apply (rule add_le_imp_le_left[of "a"], simp only: add_assoc[symmetric], simp add: meet_join_le)+
   473 done
   474 
   475 lemma add_join_distrib_left: "a + (join b c) = join (a + b) (a+ (c::'a::{pordered_ab_group_add, join_semilorder}))" 
   476 apply (rule order_antisym)
   477 apply (rule add_le_imp_le_left [of "-a"])
   478 apply (simp only: add_assoc[symmetric], simp)
   479 apply (rule join_imp_le)
   480 apply (rule add_le_imp_le_left [of "a"], simp only: add_assoc[symmetric], simp add: meet_join_le)+
   481 apply (rule join_imp_le)
   482 apply (simp_all add: meet_join_le)
   483 done
   484 
   485 lemma is_join_neg_meet: "is_join (% (a::'a::{pordered_ab_group_add, meet_semilorder}) b. - (meet (-a) (-b)))"
   486 apply (auto simp add: is_join_def)
   487 apply (rule_tac c="meet (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_meet_distrib_left meet_join_le)
   488 apply (rule_tac c="meet (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_meet_distrib_left meet_join_le)
   489 apply (subst neg_le_iff_le[symmetric]) 
   490 apply (simp add: meet_imp_le)
   491 done
   492 
   493 lemma is_meet_neg_join: "is_meet (% (a::'a::{pordered_ab_group_add, join_semilorder}) b. - (join (-a) (-b)))"
   494 apply (auto simp add: is_meet_def)
   495 apply (rule_tac c="join (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_join_distrib_left meet_join_le)
   496 apply (rule_tac c="join (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_join_distrib_left meet_join_le)
   497 apply (subst neg_le_iff_le[symmetric]) 
   498 apply (simp add: join_imp_le)
   499 done
   500 
   501 axclass lordered_ab_group \<subseteq> pordered_ab_group_add, lorder
   502 
   503 instance lordered_ab_group_meet \<subseteq> lordered_ab_group
   504 proof 
   505   show "? j. is_join (j::'a\<Rightarrow>'a\<Rightarrow>('a::lordered_ab_group_meet))" by (blast intro: is_join_neg_meet)
   506 qed
   507 
   508 instance lordered_ab_group_join \<subseteq> lordered_ab_group
   509 proof
   510   show "? m. is_meet (m::'a\<Rightarrow>'a\<Rightarrow>('a::lordered_ab_group_join))" by (blast intro: is_meet_neg_join)
   511 qed
   512 
   513 lemma add_join_distrib_right: "(join a b) + (c::'a::lordered_ab_group) = join (a+c) (b+c)"
   514 proof -
   515   have "c + (join a b) = join (c+a) (c+b)" by (simp add: add_join_distrib_left)
   516   thus ?thesis by (simp add: add_commute)
   517 qed
   518 
   519 lemma add_meet_distrib_right: "(meet a b) + (c::'a::lordered_ab_group) = meet (a+c) (b+c)"
   520 proof -
   521   have "c + (meet a b) = meet (c+a) (c+b)" by (simp add: add_meet_distrib_left)
   522   thus ?thesis by (simp add: add_commute)
   523 qed
   524 
   525 lemmas add_meet_join_distribs = add_meet_distrib_right add_meet_distrib_left add_join_distrib_right add_join_distrib_left
   526 
   527 lemma join_eq_neg_meet: "join a (b::'a::lordered_ab_group) = - meet (-a) (-b)"
   528 by (simp add: is_join_unique[OF is_join_join is_join_neg_meet])
   529 
   530 lemma meet_eq_neg_join: "meet a (b::'a::lordered_ab_group) = - join (-a) (-b)"
   531 by (simp add: is_meet_unique[OF is_meet_meet is_meet_neg_join])
   532 
   533 lemma add_eq_meet_join: "a + b = (join a b) + (meet a (b::'a::lordered_ab_group))"
   534 proof -
   535   have "0 = - meet 0 (a-b) + meet (a-b) 0" by (simp add: meet_comm)
   536   hence "0 = join 0 (b-a) + meet (a-b) 0" by (simp add: meet_eq_neg_join)
   537   hence "0 = (-a + join a b) + (meet a b + (-b))"
   538     apply (simp add: add_join_distrib_left add_meet_distrib_right)
   539     by (simp add: diff_minus add_commute)
   540   thus ?thesis
   541     apply (simp add: compare_rls)
   542     apply (subst add_left_cancel[symmetric, of "a+b" "join a b + meet a b" "-a"])
   543     apply (simp only: add_assoc, simp add: add_assoc[symmetric])
   544     done
   545 qed
   546 
   547 subsection {* Positive Part, Negative Part, Absolute Value *}
   548 
   549 constdefs
   550   pprt :: "'a \<Rightarrow> ('a::lordered_ab_group)"
   551   "pprt x == join x 0"
   552   nprt :: "'a \<Rightarrow> ('a::lordered_ab_group)"
   553   "nprt x == meet x 0"
   554 
   555 lemma prts: "a = pprt a + nprt a"
   556 by (simp add: pprt_def nprt_def add_eq_meet_join[symmetric])
   557 
   558 lemma zero_le_pprt[simp]: "0 \<le> pprt a"
   559 by (simp add: pprt_def meet_join_le)
   560 
   561 lemma nprt_le_zero[simp]: "nprt a \<le> 0"
   562 by (simp add: nprt_def meet_join_le)
   563 
   564 lemma le_eq_neg: "(a \<le> -b) = (a + b \<le> (0::_::lordered_ab_group))" (is "?l = ?r")
   565 proof -
   566   have a: "?l \<longrightarrow> ?r"
   567     apply (auto)
   568     apply (rule add_le_imp_le_right[of _ "-b" _])
   569     apply (simp add: add_assoc)
   570     done
   571   have b: "?r \<longrightarrow> ?l"
   572     apply (auto)
   573     apply (rule add_le_imp_le_right[of _ "b" _])
   574     apply (simp)
   575     done
   576   from a b show ?thesis by blast
   577 qed
   578 
   579 lemma join_0_imp_0: "join a (-a) = 0 \<Longrightarrow> a = (0::'a::lordered_ab_group)"
   580 proof -
   581   {
   582     fix a::'a
   583     assume hyp: "join a (-a) = 0"
   584     hence "join a (-a) + a = a" by (simp)
   585     hence "join (a+a) 0 = a" by (simp add: add_join_distrib_right) 
   586     hence "join (a+a) 0 <= a" by (simp)
   587     hence "0 <= a" by (blast intro: order_trans meet_join_le)
   588   }
   589   note p = this
   590   assume hyp:"join a (-a) = 0"
   591   hence hyp2:"join (-a) (-(-a)) = 0" by (simp add: join_comm)
   592   from p[OF hyp] p[OF hyp2] show "a = 0" by simp
   593 qed
   594 
   595 lemma meet_0_imp_0: "meet a (-a) = 0 \<Longrightarrow> a = (0::'a::lordered_ab_group)"
   596 apply (simp add: meet_eq_neg_join)
   597 apply (simp add: join_comm)
   598 apply (subst join_0_imp_0)
   599 by auto
   600 
   601 lemma join_0_eq_0[simp]: "(join a (-a) = 0) = (a = (0::'a::lordered_ab_group))"
   602 by (auto, erule join_0_imp_0)
   603 
   604 lemma meet_0_eq_0[simp]: "(meet a (-a) = 0) = (a = (0::'a::lordered_ab_group))"
   605 by (auto, erule meet_0_imp_0)
   606 
   607 lemma zero_le_double_add_iff_zero_le_single_add[simp]: "(0 \<le> a + a) = (0 \<le> (a::'a::lordered_ab_group))"
   608 proof
   609   assume "0 <= a + a"
   610   hence a:"meet (a+a) 0 = 0" by (simp add: le_def_meet meet_comm)
   611   have "(meet a 0)+(meet a 0) = meet (meet (a+a) 0) a" (is "?l=_") by (simp add: add_meet_join_distribs meet_aci)
   612   hence "?l = 0 + meet a 0" by (simp add: a, simp add: meet_comm)
   613   hence "meet a 0 = 0" by (simp only: add_right_cancel)
   614   then show "0 <= a" by (simp add: le_def_meet meet_comm)    
   615 next  
   616   assume a: "0 <= a"
   617   show "0 <= a + a" by (simp add: add_mono[OF a a, simplified])
   618 qed
   619 
   620 lemma double_add_le_zero_iff_single_add_le_zero[simp]: "(a + a <= 0) = ((a::'a::lordered_ab_group) <= 0)" 
   621 proof -
   622   have "(a + a <= 0) = (0 <= -(a+a))" by (subst le_minus_iff, simp)
   623   moreover have "\<dots> = (a <= 0)" by (simp add: zero_le_double_add_iff_zero_le_single_add)
   624   ultimately show ?thesis by blast
   625 qed
   626 
   627 lemma double_add_less_zero_iff_single_less_zero[simp]: "(a+a<0) = ((a::'a::{pordered_ab_group_add,linorder}) < 0)" (is ?s)
   628 proof cases
   629   assume a: "a < 0"
   630   thus ?s by (simp add:  add_strict_mono[OF a a, simplified])
   631 next
   632   assume "~(a < 0)" 
   633   hence a:"0 <= a" by (simp)
   634   hence "0 <= a+a" by (simp add: add_mono[OF a a, simplified])
   635   hence "~(a+a < 0)" by simp
   636   with a show ?thesis by simp 
   637 qed
   638 
   639 axclass lordered_ab_group_abs \<subseteq> lordered_ab_group
   640   abs_lattice: "abs x = join x (-x)"
   641 
   642 lemma abs_zero[simp]: "abs 0 = (0::'a::lordered_ab_group_abs)"
   643 by (simp add: abs_lattice)
   644 
   645 lemma abs_eq_0[simp]: "(abs a = 0) = (a = (0::'a::lordered_ab_group_abs))"
   646 by (simp add: abs_lattice)
   647 
   648 lemma abs_0_eq[simp]: "(0 = abs a) = (a = (0::'a::lordered_ab_group_abs))"
   649 proof -
   650   have "(0 = abs a) = (abs a = 0)" by (simp only: eq_ac)
   651   thus ?thesis by simp
   652 qed
   653 
   654 lemma neg_meet_eq_join[simp]: "- meet a (b::_::lordered_ab_group) = join (-a) (-b)"
   655 by (simp add: meet_eq_neg_join)
   656 
   657 lemma neg_join_eq_meet[simp]: "- join a (b::_::lordered_ab_group) = meet (-a) (-b)"
   658 by (simp del: neg_meet_eq_join add: join_eq_neg_meet)
   659 
   660 lemma join_eq_if: "join a (-a) = (if a < 0 then -a else (a::'a::{lordered_ab_group, linorder}))"
   661 proof -
   662   note b = add_le_cancel_right[of a a "-a",symmetric,simplified]
   663   have c: "a + a = 0 \<Longrightarrow> -a = a" by (rule add_right_imp_eq[of _ a], simp)
   664   show ?thesis
   665     apply (auto simp add: join_max max_def b linorder_not_less)
   666     apply (drule order_antisym, auto)
   667     done
   668 qed
   669 
   670 lemma abs_if_lattice: "\<bar>a\<bar> = (if a < 0 then -a else (a::'a::{lordered_ab_group_abs, linorder}))"
   671 proof -
   672   show ?thesis by (simp add: abs_lattice join_eq_if)
   673 qed
   674 
   675 lemma abs_ge_zero[simp]: "0 \<le> abs (a::'a::lordered_ab_group_abs)"
   676 proof -
   677   have a:"a <= abs a" and b:"-a <= abs a" by (auto simp add: abs_lattice meet_join_le)
   678   show ?thesis by (rule add_mono[OF a b, simplified])
   679 qed
   680   
   681 lemma abs_le_zero_iff [simp]: "(abs a \<le> (0::'a::lordered_ab_group_abs)) = (a = 0)" 
   682 proof
   683   assume "abs a <= 0"
   684   hence "abs a = 0" by (auto dest: order_antisym)
   685   thus "a = 0" by simp
   686 next
   687   assume "a = 0"
   688   thus "abs a <= 0" by simp
   689 qed
   690 
   691 lemma zero_less_abs_iff [simp]: "(0 < abs a) = (a \<noteq> (0::'a::lordered_ab_group_abs))"
   692 by (simp add: order_less_le)
   693 
   694 lemma abs_not_less_zero [simp]: "~ abs a < (0::'a::lordered_ab_group_abs)"
   695 proof -
   696   have a:"!! x (y::_::order). x <= y \<Longrightarrow> ~(y < x)" by auto
   697   show ?thesis by (simp add: a)
   698 qed
   699 
   700 lemma abs_ge_self: "a \<le> abs (a::'a::lordered_ab_group_abs)"
   701 by (simp add: abs_lattice meet_join_le)
   702 
   703 lemma abs_ge_minus_self: "-a \<le> abs (a::'a::lordered_ab_group_abs)"
   704 by (simp add: abs_lattice meet_join_le)
   705 
   706 lemma le_imp_join_eq: "a \<le> b \<Longrightarrow> join a b = b" 
   707 by (simp add: le_def_join)
   708 
   709 lemma ge_imp_join_eq: "b \<le> a \<Longrightarrow> join a b = a"
   710 by (simp add: le_def_join join_aci)
   711 
   712 lemma le_imp_meet_eq: "a \<le> b \<Longrightarrow> meet a b = a"
   713 by (simp add: le_def_meet)
   714 
   715 lemma ge_imp_meet_eq: "b \<le> a \<Longrightarrow> meet a b = b"
   716 by (simp add: le_def_meet meet_aci)
   717 
   718 lemma abs_prts: "abs (a::_::lordered_ab_group_abs) = pprt a - nprt a"
   719 apply (simp add: pprt_def nprt_def diff_minus)
   720 apply (simp add: add_meet_join_distribs join_aci abs_lattice[symmetric])
   721 apply (subst le_imp_join_eq, auto)
   722 done
   723 
   724 lemma abs_minus_cancel [simp]: "abs (-a) = abs(a::'a::lordered_ab_group_abs)"
   725 by (simp add: abs_lattice join_comm)
   726 
   727 lemma abs_idempotent [simp]: "abs (abs a) = abs (a::'a::lordered_ab_group_abs)"
   728 apply (simp add: abs_lattice[of "abs a"])
   729 apply (subst ge_imp_join_eq)
   730 apply (rule order_trans[of _ 0])
   731 by auto
   732 
   733 lemma abs_minus_commute: 
   734   fixes a :: "'a::lordered_ab_group_abs"
   735   shows "abs (a-b) = abs(b-a)"
   736 proof -
   737   have "abs (a-b) = abs (- (a-b))" by (simp only: abs_minus_cancel)
   738   also have "... = abs(b-a)" by simp
   739   finally show ?thesis .
   740 qed
   741 
   742 lemma zero_le_iff_zero_nprt: "(0 \<le> a) = (nprt a = 0)"
   743 by (simp add: le_def_meet nprt_def meet_comm)
   744 
   745 lemma le_zero_iff_zero_pprt: "(a \<le> 0) = (pprt a = 0)"
   746 by (simp add: le_def_join pprt_def join_comm)
   747 
   748 lemma le_zero_iff_pprt_id: "(0 \<le> a) = (pprt a = a)"
   749 by (simp add: le_def_join pprt_def join_comm)
   750 
   751 lemma zero_le_iff_nprt_id: "(a \<le> 0) = (nprt a = a)"
   752 by (simp add: le_def_meet nprt_def meet_comm)
   753 
   754 lemma iff2imp: "(A=B) \<Longrightarrow> (A \<Longrightarrow> B)"
   755 by (simp)
   756 
   757 lemma imp_abs_id: "0 \<le> a \<Longrightarrow> abs a = (a::'a::lordered_ab_group_abs)"
   758 by (simp add: iff2imp[OF zero_le_iff_zero_nprt] iff2imp[OF le_zero_iff_pprt_id] abs_prts)
   759 
   760 lemma imp_abs_neg_id: "a \<le> 0 \<Longrightarrow> abs a = -(a::'a::lordered_ab_group_abs)"
   761 by (simp add: iff2imp[OF le_zero_iff_zero_pprt] iff2imp[OF zero_le_iff_nprt_id] abs_prts)
   762 
   763 lemma abs_leI: "[|a \<le> b; -a \<le> b|] ==> abs a \<le> (b::'a::lordered_ab_group_abs)"
   764 by (simp add: abs_lattice join_imp_le)
   765 
   766 lemma le_minus_self_iff: "(a \<le> -a) = (a \<le> (0::'a::lordered_ab_group))"
   767 proof -
   768   from add_le_cancel_left[of "-a" "a+a" "0"] have "(a <= -a) = (a+a <= 0)" 
   769     by (simp add: add_assoc[symmetric])
   770   thus ?thesis by simp
   771 qed
   772 
   773 lemma minus_le_self_iff: "(-a \<le> a) = (0 \<le> (a::'a::lordered_ab_group))"
   774 proof -
   775   from add_le_cancel_left[of "-a" "0" "a+a"] have "(-a <= a) = (0 <= a+a)" 
   776     by (simp add: add_assoc[symmetric])
   777   thus ?thesis by simp
   778 qed
   779 
   780 lemma abs_le_D1: "abs a \<le> b ==> a \<le> (b::'a::lordered_ab_group_abs)"
   781 by (insert abs_ge_self, blast intro: order_trans)
   782 
   783 lemma abs_le_D2: "abs a \<le> b ==> -a \<le> (b::'a::lordered_ab_group_abs)"
   784 by (insert abs_le_D1 [of "-a"], simp)
   785 
   786 lemma abs_le_iff: "(abs a \<le> b) = (a \<le> b & -a \<le> (b::'a::lordered_ab_group_abs))"
   787 by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2)
   788 
   789 lemma abs_triangle_ineq: "abs (a+b) \<le> abs a + abs (b::'a::lordered_ab_group_abs)"
   790 proof -
   791   have g:"abs a + abs b = join (a+b) (join (-a-b) (join (-a+b) (a + (-b))))" (is "_=join ?m ?n")
   792     apply (simp add: abs_lattice add_meet_join_distribs join_aci)
   793     by (simp only: diff_minus)
   794   have a:"a+b <= join ?m ?n" by (simp add: meet_join_le)
   795   have b:"-a-b <= ?n" by (simp add: meet_join_le) 
   796   have c:"?n <= join ?m ?n" by (simp add: meet_join_le)
   797   from b c have d: "-a-b <= join ?m ?n" by simp
   798   have e:"-a-b = -(a+b)" by (simp add: diff_minus)
   799   from a d e have "abs(a+b) <= join ?m ?n" 
   800     by (drule_tac abs_leI, auto)
   801   with g[symmetric] show ?thesis by simp
   802 qed
   803 
   804 lemma abs_diff_triangle_ineq:
   805      "\<bar>(a::'a::lordered_ab_group_abs) + b - (c+d)\<bar> \<le> \<bar>a-c\<bar> + \<bar>b-d\<bar>"
   806 proof -
   807   have "\<bar>a + b - (c+d)\<bar> = \<bar>(a-c) + (b-d)\<bar>" by (simp add: diff_minus add_ac)
   808   also have "... \<le> \<bar>a-c\<bar> + \<bar>b-d\<bar>" by (rule abs_triangle_ineq)
   809   finally show ?thesis .
   810 qed
   811 
   812 text {* Needed for abelian cancellation simprocs: *}
   813 
   814 lemma add_cancel_21: "((x::'a::ab_group_add) + (y + z) = y + u) = (x + z = u)"
   815 apply (subst add_left_commute)
   816 apply (subst add_left_cancel)
   817 apply simp
   818 done
   819 
   820 lemma add_cancel_end: "(x + (y + z) = y) = (x = - (z::'a::ab_group_add))"
   821 apply (subst add_cancel_21[of _ _ _ 0, simplified])
   822 apply (simp add: add_right_cancel[symmetric, of "x" "-z" "z", simplified])
   823 done
   824 
   825 lemma less_eqI: "(x::'a::pordered_ab_group_add) - y = x' - y' \<Longrightarrow> (x < y) = (x' < y')"
   826 by (simp add: less_iff_diff_less_0[of x y] less_iff_diff_less_0[of x' y'])
   827 
   828 lemma le_eqI: "(x::'a::pordered_ab_group_add) - y = x' - y' \<Longrightarrow> (y <= x) = (y' <= x')"
   829 apply (simp add: le_iff_diff_le_0[of y x] le_iff_diff_le_0[of  y' x'])
   830 apply (simp add: neg_le_iff_le[symmetric, of "y-x" 0] neg_le_iff_le[symmetric, of "y'-x'" 0])
   831 done
   832 
   833 lemma eq_eqI: "(x::'a::ab_group_add) - y = x' - y' \<Longrightarrow> (x = y) = (x' = y')"
   834 by (simp add: eq_iff_diff_eq_0[of x y] eq_iff_diff_eq_0[of x' y'])
   835 
   836 lemma diff_def: "(x::'a::ab_group_add) - y == x + (-y)"
   837 by (simp add: diff_minus)
   838 
   839 lemma add_minus_cancel: "(a::'a::ab_group_add) + (-a + b) = b"
   840 by (simp add: add_assoc[symmetric])
   841 
   842 lemma minus_add_cancel: "-(a::'a::ab_group_add) + (a + b) = b"
   843 by (simp add: add_assoc[symmetric])
   844 
   845 ML {*
   846 val add_zero_left = thm"add_0";
   847 val add_zero_right = thm"add_0_right";
   848 *}
   849 
   850 ML {*
   851 val add_assoc = thm "add_assoc";
   852 val add_commute = thm "add_commute";
   853 val add_left_commute = thm "add_left_commute";
   854 val add_ac = thms "add_ac";
   855 val mult_assoc = thm "mult_assoc";
   856 val mult_commute = thm "mult_commute";
   857 val mult_left_commute = thm "mult_left_commute";
   858 val mult_ac = thms "mult_ac";
   859 val add_0 = thm "add_0";
   860 val mult_1_left = thm "mult_1_left";
   861 val mult_1_right = thm "mult_1_right";
   862 val mult_1 = thm "mult_1";
   863 val add_left_imp_eq = thm "add_left_imp_eq";
   864 val add_right_imp_eq = thm "add_right_imp_eq";
   865 val add_imp_eq = thm "add_imp_eq";
   866 val left_minus = thm "left_minus";
   867 val diff_minus = thm "diff_minus";
   868 val add_0_right = thm "add_0_right";
   869 val add_left_cancel = thm "add_left_cancel";
   870 val add_right_cancel = thm "add_right_cancel";
   871 val right_minus = thm "right_minus";
   872 val right_minus_eq = thm "right_minus_eq";
   873 val minus_minus = thm "minus_minus";
   874 val equals_zero_I = thm "equals_zero_I";
   875 val minus_zero = thm "minus_zero";
   876 val diff_self = thm "diff_self";
   877 val diff_0 = thm "diff_0";
   878 val diff_0_right = thm "diff_0_right";
   879 val diff_minus_eq_add = thm "diff_minus_eq_add";
   880 val neg_equal_iff_equal = thm "neg_equal_iff_equal";
   881 val neg_equal_0_iff_equal = thm "neg_equal_0_iff_equal";
   882 val neg_0_equal_iff_equal = thm "neg_0_equal_iff_equal";
   883 val equation_minus_iff = thm "equation_minus_iff";
   884 val minus_equation_iff = thm "minus_equation_iff";
   885 val minus_add_distrib = thm "minus_add_distrib";
   886 val minus_diff_eq = thm "minus_diff_eq";
   887 val add_left_mono = thm "add_left_mono";
   888 val add_le_imp_le_left = thm "add_le_imp_le_left";
   889 val add_right_mono = thm "add_right_mono";
   890 val add_mono = thm "add_mono";
   891 val add_strict_left_mono = thm "add_strict_left_mono";
   892 val add_strict_right_mono = thm "add_strict_right_mono";
   893 val add_strict_mono = thm "add_strict_mono";
   894 val add_less_le_mono = thm "add_less_le_mono";
   895 val add_le_less_mono = thm "add_le_less_mono";
   896 val add_less_imp_less_left = thm "add_less_imp_less_left";
   897 val add_less_imp_less_right = thm "add_less_imp_less_right";
   898 val add_less_cancel_left = thm "add_less_cancel_left";
   899 val add_less_cancel_right = thm "add_less_cancel_right";
   900 val add_le_cancel_left = thm "add_le_cancel_left";
   901 val add_le_cancel_right = thm "add_le_cancel_right";
   902 val add_le_imp_le_right = thm "add_le_imp_le_right";
   903 val add_increasing = thm "add_increasing";
   904 val le_imp_neg_le = thm "le_imp_neg_le";
   905 val neg_le_iff_le = thm "neg_le_iff_le";
   906 val neg_le_0_iff_le = thm "neg_le_0_iff_le";
   907 val neg_0_le_iff_le = thm "neg_0_le_iff_le";
   908 val neg_less_iff_less = thm "neg_less_iff_less";
   909 val neg_less_0_iff_less = thm "neg_less_0_iff_less";
   910 val neg_0_less_iff_less = thm "neg_0_less_iff_less";
   911 val less_minus_iff = thm "less_minus_iff";
   912 val minus_less_iff = thm "minus_less_iff";
   913 val le_minus_iff = thm "le_minus_iff";
   914 val minus_le_iff = thm "minus_le_iff";
   915 val add_diff_eq = thm "add_diff_eq";
   916 val diff_add_eq = thm "diff_add_eq";
   917 val diff_eq_eq = thm "diff_eq_eq";
   918 val eq_diff_eq = thm "eq_diff_eq";
   919 val diff_diff_eq = thm "diff_diff_eq";
   920 val diff_diff_eq2 = thm "diff_diff_eq2";
   921 val diff_add_cancel = thm "diff_add_cancel";
   922 val add_diff_cancel = thm "add_diff_cancel";
   923 val less_iff_diff_less_0 = thm "less_iff_diff_less_0";
   924 val diff_less_eq = thm "diff_less_eq";
   925 val less_diff_eq = thm "less_diff_eq";
   926 val diff_le_eq = thm "diff_le_eq";
   927 val le_diff_eq = thm "le_diff_eq";
   928 val compare_rls = thms "compare_rls";
   929 val eq_iff_diff_eq_0 = thm "eq_iff_diff_eq_0";
   930 val le_iff_diff_le_0 = thm "le_iff_diff_le_0";
   931 val add_meet_distrib_left = thm "add_meet_distrib_left";
   932 val add_join_distrib_left = thm "add_join_distrib_left";
   933 val is_join_neg_meet = thm "is_join_neg_meet";
   934 val is_meet_neg_join = thm "is_meet_neg_join";
   935 val add_join_distrib_right = thm "add_join_distrib_right";
   936 val add_meet_distrib_right = thm "add_meet_distrib_right";
   937 val add_meet_join_distribs = thms "add_meet_join_distribs";
   938 val join_eq_neg_meet = thm "join_eq_neg_meet";
   939 val meet_eq_neg_join = thm "meet_eq_neg_join";
   940 val add_eq_meet_join = thm "add_eq_meet_join";
   941 val prts = thm "prts";
   942 val zero_le_pprt = thm "zero_le_pprt";
   943 val nprt_le_zero = thm "nprt_le_zero";
   944 val le_eq_neg = thm "le_eq_neg";
   945 val join_0_imp_0 = thm "join_0_imp_0";
   946 val meet_0_imp_0 = thm "meet_0_imp_0";
   947 val join_0_eq_0 = thm "join_0_eq_0";
   948 val meet_0_eq_0 = thm "meet_0_eq_0";
   949 val zero_le_double_add_iff_zero_le_single_add = thm "zero_le_double_add_iff_zero_le_single_add";
   950 val double_add_le_zero_iff_single_add_le_zero = thm "double_add_le_zero_iff_single_add_le_zero";
   951 val double_add_less_zero_iff_single_less_zero = thm "double_add_less_zero_iff_single_less_zero";
   952 val abs_lattice = thm "abs_lattice";
   953 val abs_zero = thm "abs_zero";
   954 val abs_eq_0 = thm "abs_eq_0";
   955 val abs_0_eq = thm "abs_0_eq";
   956 val neg_meet_eq_join = thm "neg_meet_eq_join";
   957 val neg_join_eq_meet = thm "neg_join_eq_meet";
   958 val join_eq_if = thm "join_eq_if";
   959 val abs_if_lattice = thm "abs_if_lattice";
   960 val abs_ge_zero = thm "abs_ge_zero";
   961 val abs_le_zero_iff = thm "abs_le_zero_iff";
   962 val zero_less_abs_iff = thm "zero_less_abs_iff";
   963 val abs_not_less_zero = thm "abs_not_less_zero";
   964 val abs_ge_self = thm "abs_ge_self";
   965 val abs_ge_minus_self = thm "abs_ge_minus_self";
   966 val le_imp_join_eq = thm "le_imp_join_eq";
   967 val ge_imp_join_eq = thm "ge_imp_join_eq";
   968 val le_imp_meet_eq = thm "le_imp_meet_eq";
   969 val ge_imp_meet_eq = thm "ge_imp_meet_eq";
   970 val abs_prts = thm "abs_prts";
   971 val abs_minus_cancel = thm "abs_minus_cancel";
   972 val abs_idempotent = thm "abs_idempotent";
   973 val zero_le_iff_zero_nprt = thm "zero_le_iff_zero_nprt";
   974 val le_zero_iff_zero_pprt = thm "le_zero_iff_zero_pprt";
   975 val le_zero_iff_pprt_id = thm "le_zero_iff_pprt_id";
   976 val zero_le_iff_nprt_id = thm "zero_le_iff_nprt_id";
   977 val iff2imp = thm "iff2imp";
   978 val imp_abs_id = thm "imp_abs_id";
   979 val imp_abs_neg_id = thm "imp_abs_neg_id";
   980 val abs_leI = thm "abs_leI";
   981 val le_minus_self_iff = thm "le_minus_self_iff";
   982 val minus_le_self_iff = thm "minus_le_self_iff";
   983 val abs_le_D1 = thm "abs_le_D1";
   984 val abs_le_D2 = thm "abs_le_D2";
   985 val abs_le_iff = thm "abs_le_iff";
   986 val abs_triangle_ineq = thm "abs_triangle_ineq";
   987 val abs_diff_triangle_ineq = thm "abs_diff_triangle_ineq";
   988 *}
   989 
   990 end