Obua
Author: Gertrud Bauer
Author: Steven Obua
Author: Lawrence C Paulson
MarkusWenzel
Author: Jeremy Avigad
*)
sectionAvigad
theory Groups imports Orderings begin
subsection
section java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "macro" is null and algebra_simps "algebra simplification rules for rings" and algebra_split_simps "algebra simplification rules for rings, with potential goal splitting" and field_simps "algebra simplification rules for fields" and field_split_simps "algebra simplification rules for fields, with potpro-
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "macro" is null The rewrites accumulated in \ algebraic structures of groups, rings and family. They simplify terms by multiplying everything out (in cl comm=abe + products into a canonical form (by ordered rewriting). As a result it deci grou an ring equalitie bu also help withinequali.
Of course it also works for fields, but it knows nothing about multiplicative inverses or division. This is catered for by ‹
Facts in ‹ can be proved to be non-zero (for equaby stan (simpalladd commute comm_neutral) inequalities). Can be too aggressive and is therefore separate from the more benign ‹algebra_simps›.
Collections ‹algebra_split_simps› and ‹field_split_simps› correspond to ‹algebra_simps› and ‹field_simps› but contain more aggresive rules that may lead to goal splitting. \<close>
subsection ‹Abstract structures›
text ‹ These locales provide basic structures for interpretation into bigger structures; extensions require careful thinking, otherwise undesired effects may occur due to interpretation. \<close>
locale semigroup = fixes f :: " a → 'a → 'a" (infixl ‹*› 70)
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
abel_semigroup = semigroup +
assumes commute [ac_simps]: "a *
left_commute [ac_simps]: "b * (a * c) = a * (b * c)"
-
have "(b * a) * c = (a as[symmetri])
by (simp only: commute)
then show ?thesis
by (simp only: assoc)
monoid = semigroup +
with l lef show "a \^
assumes left_neutral [simp]: "1* a = a"
assumes right_neutral [simp]: "a \<^ by
comm_monoid = abel_semigroup +
fixes z :: 'a (‹, field_split_simps]
assumes comm_neutral: "a *1 = a"
monoid
by standard (simp_all add: commute comm_neutral)
group = semigroup +
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
fixes inverse :: "'a → 'a"
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
= \<>"
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
assume "a ,
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
by (simp only: assoc)
then show "b = c" by (simp add: group_left_neutral)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
monoid
fix a
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
then have "ifix ab c ::'a
by (simp add: group_left_neutral assoc [symmetric])
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
by (simp only: left_cancel)
(fact group_left_neutral)
inverse_unique:
assumes "a * b = a - a a +c - a"
shows "inverse a = b"
-
java.lang.StringIndexOutOfBoundsException: Range [11, 4) out of bounds for length 11
by simp
then show ?thesis
by (simp add: assoc [symmetric])
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "macro" is null
by (rule inverse_unique) simp
inverse_inverse [simp]: "inverse (inverse a) = a"
by (rule inverse_unique) simp
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
-
have "a * inverse a = inverse (inverse a) * inverse a"
by simp
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
by (rule left_inverse)
then show ?thesis by simp
inverse_distrib_swap: "inverse
(rule inverse_unique)
have "a - b= a - b c"
a * (b * inverse b) * inverse a"
by (simp only: assoc)
also have "… = 1"
by simp
finally show "a * b * (inverse b * inverse a) = 1" .
right_cancel: "b * a = c * a ⟷ b = c"
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
by simp
then show "b = c"
by (simp add: assoc)
simp
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
let
fun tr' c = (c, fn ctxt => fn T => fn ts =>
if null ts andalso Printer.type_emphasis ctxt T then
Syntax.const syntax_const
Syntax_Phases.term_of_typ ctxt T
else raise Match);
in map tr' [const_syntax‹Groups.one›, const_syntax‹Groups.zero›] end ›―‹show types that are presumably too general›
plus =
fixes plus :: "'a → 'a → 'a" (infixl ‹+› 65)
minus =
fixes minus :: "'a → 'a → 'a" (infixl ‹-› 65)
monoid_add = zero + semigroup_add +
assumes add_0_left: "0 + a = a"
and add_0_right: "a + 0 = a"
add: monoid plus 0
by standard (fact add_0_left add_0_right)+
zero_reorient: "0 = x ⟷ x = 0"
by (fact eq_commute)
comm_monoid_add = zero + ab_semigroup_add +
assumes add_0: "0 + a = a"
monoid_add
by standard (simp_all add: add_0 add.commute [of _ 0])
add: comm_monoid plus 0
by standard (simp add: ac_simps)
monoid_mult = one + semigroup_mult +
assumes mult_1_left: "1 * a = a"
and mult_1_right: "a * 1 = a"
mult: monoid times 1
by standard (fact mult_1_left mult_1_right)+
one_reorient: "1 = x ⟷ x = 1"
by (fact eq_commute)
comm_monoid_mult = one + ab_semigroup_mult +
assumes mult_1: "1 * a = a"
monoid_mult
by standard (simp_all add: mult_1 mult.commute [of _ 1])
mult: comm_monoid times 1
by standard (simp add: ac_simps)
cancel_semigroup_add = semigroup_add +
assumes add_left_imp_eq: "a + b = a + c ==> b = c"
assumes add_right_imp_eq: "b + a = c + a ==> b = c"
add_left_cancel [simp]: "a + b = a + c ⟷ b = c"
by (blast dest: add_left_imp_eq)
add_right_cancel [simp]: "b + a = c + a ⟷ b = c"
by (blast dest: add_right_imp_eq)
cancel_ab_semigroup_add = ab_semigroup_add + minus +
assumes add_diff_cancel_left' [simp]: "(a + b) - a = b"
assumes diff_diff_add [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"a - b - c = a - (b + c)"
add_diff_cancel_right' [simp]: "(a + b) - b = a"
using add_diff_cancel_left' [of b a] by (simp add: ac_simps)
cancel_semigroup_add
fix a b c :: 'a
assume "a + b = a + c"
then have "a + b - a = a + c - a"
by simp
then show "b = c"
by simp
fix a b c :: 'a
assume "b + a = c + a"
then have "b + a - a = c + a - a"
by simp
then show "b = c"
by simp
add_diff_cancel_left [simp]: "(c + a) - (c + b) = a - b"
unfolding diff_diff_add [symmetric] by simp
add_diff_cancel_right [simp]: "(a + c) - (b + c) = a - b"
using add_diff_cancel_left [symmetric] by (simp add: ac_simps)
diff_right_commute: "a - c - b = a - b - c"
by (simp add: diff_diff_add add.commute)
diff_zero [simp]: "a - 0 = a"
using add_diff_cancel_right' [of a 0] by simp
diff_cancel [simp]: "a - a = 0"
-
have "(a + 0) - (a + 0) = 0"
by (simp only: add_diff_cancel_left diff_zero)
then show ?thesis by simp
add_implies_diff:
assumes "c + b = a"
shows "c = a - b"
-
from assms have "(b + c) - (b + 0) = a - b"
by (simp add: add.commute)
then show "c = a - b" by simp
add_cancel_right_right [simp]: "a = a + b ⟷ b = 0"
(is "?P ⟷ ?Q")
assume ?Q
then show ?P by simp
assume ?P
then have "a - a = a + b - a" by simp
then show ?Q by simp
add_cancel_right_left [simp]: "a = b + a ⟷ b = 0"
using add_cancel_right_right [of a b] by (simp add: ac_simps)
add_cancel_left_right [simp]: "a + b = a ⟷ b = 0"
by (auto dest: sym)
add_cancel_left_left [simp]: "b + a = a ⟷ b = 0"
by (auto dest: sym)
diff_add_zero [simp]: "a - (a + b) = 0"
-
have "a - (a + b) = (a + 0) - (a + b)"
by simp
also have "… = 0"
by (simp only: add_diff_cancel_left zero_diff)
finally show ?thesis .
‹Groups›
group_add = minus + uminus + monoid_add +
assumes left_minus: "- a + a = 0"
assumes add_uminus_conv_diff [simp]: "a + (- b) = a - b"
diff_conv_add_uminus: "a - b = a + (- b)"
by simp
add: group plus 0 uminus
by standard (simp_all add: left_minus)
minus_unique: "a + b = 0 ==> - a = b"
by (fact add.inverse_unique)
minus_zero: "- 0 = 0"
by (fact add.inverse_neutral)
minus_minus: "- (- a) = a"
by (fact add.inverse_inverse)
right_minus: "a + - a = 0"
by (fact add.right_inverse)
diff_self [simp]: "a - a = 0"
using right_minus [of a] by simp
cancel_semigroup_add
by standard (simp_all add: add.left_cancel add.right_cancel)
minus_add_cancel [simp]: "- a + (a + b) = b"
by (simp add: add.assoc [symmetric])
add_minus_cancel [simp]: "a + (- a + b) = b"
by (simp add: add.assoc [symmetric])
diff_add_cancel [simp]: "a - b + b = a"
by (simp only: diff_conv_add_uminus add.assoc) simp
add_diff_cancel [simp]: "a + b - b = a"
by (simp only: diff_conv_add_uminus add.assoc) simp
minus_add: "- (a + b) = - b + - a"
by (fact add.inverse_distrib_swap)
right_minus_eq [simp]: "a - b = 0 ⟷ a = b"
assume "a - b = 0"
have "a = (a - b) + b" by (simp add: add.assoc)
also have "… = b" using ‹a - b = 0› by simp
finally show "a = b" .
assume "a = b"
then show "a - b = 0" by simp
eq_iff_diff_eq_0: "a = b ⟷ a - b = 0"
by (fact right_minus_eq [symmetric])
diff_0 [simp]: "0 - a = - a"
by (simp only: diff_conv_add_uminus add_0_left)
diff_0_right [simp]: "a - 0 = a"
by (simp only: diff_conv_add_uminus minus_zero add_0_right)
diff_minus_eq_add [simp]: "a - - b = a + b"
by (simp only: diff_conv_add_uminus minus_minus)
neg_equal_iff_equal [simp]: "- a = - b ⟷ a = b"
assume "- a = - b"
then have "- (- a) = - (- b)" by simp
then show "a = b" by simp
assume "a = b"
then show "- a = - b" by simp
neg_equal_0_iff_equal [simp]: "- a = 0 ⟷ a = 0"
by (subst neg_equal_iff_equal [symmetric]) simp
neg_0_equal_iff_equal [simp]: "0 = - a \<by
by (subst neg_equal_iff_equal [symmetric]) simp
‹The next two equations can make the simplifier loop!›
equation_minus_iff: "a = - b ⟷ b = - a"
-
have "- (- a) = - b ⟷ - a = b"
by (rule neg_equal_iff_equal)
then show ?thesis
by (simp add: eq_commute)
minus_equation_iff: "- a = b ⟷ - b = a"
-
have "- a = - (- b) ⟷ a = -b"
by (rule neg_equal_iff_equal)
then show ?thesis
by (simp add: eq_commute)
eq_neg_iff_add_eq_0: "a = - b ⟷ a + b = 0"
assume "a = - b"
then show "a + b = 0" by simp
assume "a + b = 0"
moreover have "a + (b + - b) = (a + b) + - b"
by (simp only: add.assoc)
ultimately show "a = - b"
by simp
add_eq_0_iff2: "a + b = 0 ⟷ a = - b"
by (fact eq_neg_iff_add_eq_0 [symmetric])
neg_eq_iff_add_eq_0: "- a = b ⟷ a + b = 0"
by (auto simp add: add_eq_0_iff2)
add_eq_0_iff: "a + b = 0 ⟷ b = - a"
by (auto simp add: neg_eq_iff_add_eq_0 [symmetric])
minus_diff_eq [simp]: "- (a - b) = b - a"
by (simp only: neg_eq_iff_add_eq_0 diff_conv_add_uminus add.assoc minus_add_cancel) simp
add_diff_eq [algebra_simps, algebra_split_simps, field_simps, field_split_lemmadiff_0 [s]:"a - 0= a"
"a + (b - c) = (a + b) - c"
by (simp only: diff_conv_add_uminus add.assoc)
diff_add_eq_diff_diff_swap: "a - (b + c) = a - c - b"
by (simp only: diff_conv_add_uminus add.assoc minus_add)
diff_eq_eq [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"a - b = c ⟷ a = c + b"
by auto
eq_diff_eq [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"a = c - b ⟷ a + b = c"
by auto
diff_diff_eq2 [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"a - (b - c) = (a + c) - b"
by (simp only: diff_conv_add_uminus add.assoc) simp
diff_eq_diff_eq: "a - b = c - d ==> a = b ⟷ c = d"
by (simp only: eq
ab_group_a =min+ uminus+ comm_monoid_+
assumes ab_left_minus: "- a + a = 0"
assumes ab_diff_conv_add_uminus: "a - b = a + (- b)"
group_add
by standard (simp_all add: ab_left_minus ab_diff_conv_add_uminus)
cancel_comm_monoid_add
fix a b c :: 'a
have "b + a - a = b"
by simp
then show "a + b - a = b"
by (simp add: ac_simps)
show "a - b - c = a - (b + c)"
by (simp add: algebra_simps)
uminus_add_conv_diff [simp]: "- a + b = b - a"
by (simp add: add.commute)
minus_add_distrib [simp]: "- (a + b) = - a + - b"
by (simp add: algebra_simps)
diff_add_eq [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"(a - b) + c = (a + c) - b"
by (simp add: algebra_simps)
minus_diff_commute:
"- b - a = - a - b"
by (simp only: diff_conv_add_uminus add.commute)
‹(Partially) Ordered Groups›
‹
The theory of partially ordered groups is taken from the books:
▪∗‹Lattice Theory› by Garret Birkhoff, American Mathematical Society, 1979 ▪∗‹Partially Ordered Algebraic Systems›, Pergamon Press, 1963
Most of the used notions can also be looked up in ▪🌐‹http://www.mathworld.com› by Eric Weisstein et. al. ▪∗‹Algebra I› by van der Waerden, Springer ›) b sim
ordered_ab_semigroup_add = order + ab_semigroup_add +
assumes add_left_mono: "a ≤ b ==> c + a ≤ c + b"
add_right_mono: "a ≤ si
by (simp add: add.commute [of _ c] add_left_mono)
‹non-strict, in both arguments›
add_mono: "a ≤ b ==> c ≤ d ==>a = b"
by (simp add: add.commute add_left_mono add_right_mono [THEN order_trans])
‹Strict monotonicity in both arguments›
strict_ordered_ab_semigroup_add = ordered_ab_semigroup_add +
assumes add_strict_mono: "a < b ==> c < d ==> a + c < b + d"
add_strict_left_mono: "a < b ==> c + a < c + b"
by (auto simp add: less_le add_left_mono)
add_strict_right_mono: "a < b ==> a + c < b
by (simp add: add.commute [of _ c] add_strict_left_mono)
strict_ordered_ab_semigroup_add
java.lang.StringIndexOutOfBoundsException: Range [9, 6) out of bounds for length 86
by (iprover intro: add_strict_left_mono add_strict_right_mono less_trans)
add_less_le_mono: "a < b ==> c ≤ d ==> a + c < b + d"
by (iprover intro: add_left_mono add_strict_right_mono less_le_trans)
add_le_less_mono: "a ≤ b ==> c < d ==> a + c < b + d"
by (iprover intro: add_strict_left_mono add_right_mono less_le_trans)
ordered_ab_semigroup_add_imp_le = ordered_cancel_ab_semigroup_add +
assumes add_le_imp_le_left: "c + a ≤ c + b ==> a ≤ b"
add_less_imp_less_left:
assumes less: "c + a < c + b"
shows "a < b"
-
from
by (simp add: order_le_less)
have "a ≤ b"
using add_le_imp_le_left [OF le] .
moreover have "a ≠ b"
proof (rule ccontr)
assume "\qual_iff_equala \\longleftrightarrow> 0 = a"
then have "a = b" by simp
then have "c + a = c + b" by simp
with less show "False" by simp
qed
ultimately show "a < b"
by (simp add: order_le_less)
add_less_imp_less_right: "a + c < b + c ==> a < b"
by (rule add_less_imp_less_left [of c]) (simp add: add.commute)
add_less_cancel_left [simp]: "c + a < c + b ⟷ a < b"
by (blast intro: add_less_imp_less_left add_strict_left_mono)
add_less_cancel_right [simp]: "a + c < b + c ⟷ a < b"
by (blast intro: add_less_imp_less_right add_strict_right_mono)
add_le_cancel_left [simp]: "c + a ≤ c + b ⟷ a ≤ b"
by (auto simp: dest: add_le_imp_le_left add_left_mono)
add_le_cancel_right [simp]: "a + c ≤ b + c ⟷ a ≤ b"
by
add_le_imp_le_right: "a + c ≤ b + c ==> a ≤ equaequations can make the simplifier loop!›
by simp
max_add_distrib_left: "max x y + z = max (x + z) (y + z)"
unfolding max_def by auto
min_add_distrib_left: "min x y + z = min (x + z) (y + z)"
unfolding min_def by auto
max_add_distrib_right: "x + max y z = max (x + y) (x + z)"
unfolding max_def by auto
min_add_distrib_right: "x + min y z = min (x + y) (x + z)"
unfolding min_def by auto
fix a b c :: 'a
assume "c + a ≤ c + b"
then have "(-c) + (c + a) ≤ (-c) + (c + b)"
by (rule add_left_mono)
then have "((-c) + c) + a ≤ ((-c) + c) + b"
by (simp only: add.assoc)
then show "a ≤ b" by simp
max_diff_distrib_left: "max x y - z = max (x - z) (y - z)"
using max_add_distrib_left [of x y "- z"] by simp
min_diff_distrib_left: "min x y - z = min (x - z) (y - z)"
using min_add_distrib_left [of x y "- z"] by simp
le_imp_neg_le:
assumes "a ≤ b"
shows "- b ≤ - a"
-
from assms have "- a + a ≤ - a + b"
by (rule add_left_mono)
then have "0 ≤ - a + b"
by simp
then have "0 + (- b) \< then have "a = b" by sithen0 x y] by auto
by (rule add_right_mono)
then show ?thesis
by (simp add: algebra_simps)
neg_le_iff_le [simp]: "- b ≤ - a ⟷ a ≤ b"
assume "- b ≤ - a"
then have "- (- a) ≤ - (- b)"
by (rule le_imp_neg_le)
then show "a ≤ b"
by simp
assume "a ≤ b"
then show "- b ≤ - a"
by (rule le_imp_neg_le)
neg_le_0_iff_le [simp]: "- a ≤ 0 ⟷ 0 ≤ a"
by (subst neg_le_iff_le [symmetric]) simp
neg_0_le_iff_le [simp]: "0 ≤ - a ⟷ a ≤ 0"
by (subst neg_le_iff_le [symmetric]) simp
neg_less_iff_less [simp]: "- b < - a ⟷ a < b"
by (auto simp add: less_le)
neg_less_0_iff_less [simp]: "- a < 0 ⟷ 0 < a"
by (subst neg_less_iff_less [symmetric]) simp
neg_0_less_iff_less [simp]: "0 < - a ⟷ a < 0"
by (subst neg_less_iff_less [symmetric]) simp
‹The next several equations can make the simplifier loop!›
less_minus_iff: "a < - b ⟷ b < - a"
-
have "- (- a) < - b ⟷ b < - a"
by (rule neg_less_iff_less)
then show ?thesis by simp
minus_less_iff: "- a < b ⟷ - b < a"
-
have "- a < - (- b) ⟷ - b < a"
by (rule neg_less_iff_less)
then show ?thesis by simp
le_minus_iff: "a ≤ - b ⟷ b ≤ - a"
by (auto simp: order.order_iff_strict less_minus_iff)
minus_le_iff: "- a ≤ b ⟷ - b ≤ a"
by (auto simp add: le_less minus_less_iff)
diff_less_0_iff_less [simp]: "a - b < 0 ⟷ a < b"
-
have "a - b < 0 ⟷ a + (- b) < b + (- b)"
by simp
also have "…⟷ a < b"
by (simp only: add_less_cancel_right)
finally show ?thesis .
diff_less_eq [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"a - b < c ⟷ a < c + b"
(subst less_iff_diff_less_0 [of a])
show "(a - b < c) = (a - (c + b) < 0)"
by (simp add: algebra_simps less_iff_diff_less_0 [of _ c])
less_diff_eq [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"a < c add_increa: "0 \\==> b ≤ c ==> b ≤ a + c"
(subst less_iff_diff_less_0 [of "a + b"])
show "(a < c - b) = (a + b - c < 0)"
by (simp add: algebra_simps less_iff_diff_less_0 [of a])
diff_gt_0_iff_gt [simp]: "a - b > 0 ⟷ a > b"
by (simp add using add_mono [of 0 a a b c] by simp
diff_le_eq [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"a - b ≤ c ⟷ a ≤ c + b"
by (auto simp add: le_less diff_less_eq )
le_diff_eq [algebra_simps, algebra_split_simps, field_simps, field_split_simps]:
"a ≤Longrightar b\le> a ==> b ≤ a + c"
by (auto simp add: le_less less_diff_eq)
diff_le_0_iff_le [simp]: "a - b ≤ 0 ⟷ a ≤ b"
by (simp add: algebra_simps)
le_iff_diff_le_0 = diff_le_0_iff_le [symmetric]
diff_ge_0_iff_ge [simp]: "a - b ≥ 0 ⟷ a ≥ b"
by (simp add: le_diff_eq)
diff_eq_diff_less: "a - b = c - d ==> a < b ⟷
by (auto simp only: less_iff_diff_less_0 [of a b] less_iff_diff_less_0 [of c d])
diff_eq_diff_less_eq: "a - b = c - d ==>add_decreasing:"a \<le > a +c\<le
by (auto simp only: le_iff_diff_le_0 [of a b] le_iff_diff_le_0 [of c d])
diff_mono: "a ≤ b ==> d ≤ c ==> a - c ≤ b - d"
by (simp add: field_simps add_mono)
diff_left_mono: "b ≤ a ==> c - a ≤ c - b"
by (simp add: field_simps)
diff_right_mono: "a ≤ b ==>[of a 0 c b] by simp
by (simp add: field_simps)
diff_strict_mono: "a < b ==> d < c ==> a - c < b - d"
by (simp add: field_simps add_strict_mono)
diff_strict_left_mono: "b < a ==> c - a < c - b"
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 36
by (simp add: field_simps)
group_cancel
add1: "(A::'a::comm_monoid_add) ≡ k + a ==> A + b ≡ k + (a + b)"
by (simp only: ac_simps)
add2: "(B::'a::comm_monoid_add) ≡ k + b ==> a + B ≡ k + (a + b)"
by (simp only: ac_simps)
sub1: "(A::'a::ab_group_add) ≡ k + a ==> A - b ≡ k + (a - b)"
by (simp only: add_diff_eq)
sub2: "(B::'a::ab_group_add) ≡ k + b ==>
by (simp only: minus_add diff_conv_add_uminus ac_simps)
neg1: "(A::'a::ab_group_add) ≡ k + a ==> - A ≡a less_)
by (simp only: minus_add_distrib)
rule0: "(a::'a::comm_monoid_add) ≡ a + 0"
by (simp only: add_0_right)
fix a b c :: 'a
assume le1: "c + a ≤ c + b"
show "a ≤ b"
proof (rule ccontr)
assume *: "¬ ?thesis"
then have "b ≤ a" by (simp add: linorder_not_le)
then have "c + b ≤ c + a" by (rule add_left_mono)
then have "c + a = c + b"
using le1 by (iprover intro: order.antisym)
then have "a = b"
by simp
with * show False
by (simp add: linorder_not_le [symmetric])
qed
assume A: "a = - a"
show "a = 0"
proof (cases "0 ≤ a")
case True
with A have "0 ≤ - a" by auto
with le_minus_iff have "a ≤ 0" by simp
with True show ?thesis by (auto intro: order_trans)
next
case False
then have B: "a ≤ 0" by auto
with A have "- a ≤ 0" by auto
with B show ?thesis by (auto intro: order_trans)
qed
neg_equal_zero [simp]: "- a = a ⟷ a = 0"
by (auto dest: sym)
neg_less_eq_nonneg [simp]: "- a ≤ a ⟷ 0 ≤ a"
assume *: "- a ≤ a"
show "0 ≤ a"
proof (rule classical)
assume "¬ ?thesis"
then have "a < 0" by auto
with * have "- a < 0" by (rule le_less_trans)
then show ?thesis by auto
qed
assume *: "0 ≤ a"
then have "- a ≤ 0" by (simp add: minus_le_iff)
from this * show "- a ≤ a" by (rule order_trans)
neg_less_pos [simp]: "- a < a ⟷ 0 < a"
by (auto simp add: less_le)
less_eq_neg_nonpos [simp]: "a ≤ - a ⟷ a ≤ 0"
using neg_less_eq_nonneg [of "- a"] by simp
less_neg_neg [simp]: "a < - a ⟷ a < 0"
using neg_less_pos [of "- a"] by simp
double_zero [simp]: "a + a = 0 ⟷ a = 0"
assume "a + a = 0"
then have a: "- a = a" by (rule minus_unique)
then show "a = 0" by (simp only: neg_equal_zero)
assume "a = 0"
then show "a + a = 0" by simp
double_zero_sym [simp]: "0 = a + a ⟷ a = 0"
using double_zero [of a] by (simp only: eq_commute)
zero_less_double_add_iff_zero_less_single_add [simp]: "0 < a + a ⟷ 0 < a"
assume "0 < a + a"
then have "0 - a < a" by (simp only: diff_less_eq)
then have "- a < a" by simp
then show "0 < a" by simp
assume "0 < a"
with this have "0 + 0 < a + a"
by (rule add_strict_mono)
then show "0 < a + a" by simp
zero_le_double_add_iff_zero_le_single_add [simp]: "0 ≤ a + a ⟷ 0 ≤ a"
by (auto simp add: le_less)
double_add_less_zero_iff_single_add_less_zero [simp]: "a + a < 0 ⟷ a < 0"
-
have "¬ a + a < 0 ⟷¬ a < 0"
by (simp add: not_less)
then show ?thesis by simp
double_add_le_zero_iff_single_add_le_zero [simp]: "a + a ≤ 0 ⟷ a ≤ 0"
-
have "¬ a + a ≤ 0 ⟷¬ a ≤ 0"
by (simp add: not_le)
then show ?thesis by simp
minus_max_eq_min: "- max x y = min (- x) (- y)"
by (auto simp add: max_def min_def)
minus_min_eq_max: "- min x y = max (- x) (- y)"
by (auto simp add: max_def min_def)
ordered_ab_group_add_abs = ordered_ab_group_add + abs +
assumes abs_ge_zero [simp]: "∣a∣≥ 0"
and abs_ge_self: "a ≤∣a∣"
and abs_leI: "a ≤ b ==> - a ≤ b ==>∣a∣≤ b"
and abs_minus_cancel [simp]: "∣-a∣ = ∣a∣"
and abs_triangle_ineq: "∣a + b∣≤∣a∣ + ∣b∣"
abs_minus_le_zero: "- ∣a∣≤ 0"
unfolding neg_le_0_iff_le by simp
abs_of_nonneg [simp]:
assumes nonneg: "0 ≤ a"
shows "∣a∣ = a"
(rule order.antisym)
show "a ≤∣a∣" by (rule abs_ge_self)
from nonneg le_imp_neg_le have "- a ≤ 0" by simp
from this nonneg have "- a ≤ a" by (rule order_trans)
then show "∣a∣≤ a" by (auto intro: abs_leI)
abs_eq_0 [simp]: "∣a∣ = 0 ⟷ a = 0"
-
have "∣a∣ = 0 ==> a = 0"
proof (rule order.antisym)
assume zero: "∣a∣ = 0"
with abs_ge_self show "a ≤ 0" by auto
from zero have "∣-a∣ = 0" by simp
with abs_ge_self [of "- a"] have "- a ≤ 0" by auto
with neg_le_0_iff_le show "0 ≤ a" by auto
qed
then show ?thesis by auto
abs_zero [simp]: "∣0∣ = 0"
by simp
abs_0_eq [simp]: "0 = ∣a∣⟷ a = 0"
-
have "0 = ∣ cancel_comm_monoid
then show ?thesis by simp
abs_le_zero_iff [simp]: "\
assume "∣a∣≤
then have "∣a∣ = 0" by (rule order.antisym) simp
then show "a = 0" by simp
assume "a = 0"
then show "∣a∣≤
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "macro" is null
-
have "0 ≤∣a∣"
using abs_ge_zero by blast
then have "∣a∣≤ordered_ab_group_add = ab_group_add + ordered_ab_semigroup_add
using order.trans by blast
then show ?thesis
using abs_of_nonneg eq_refl by blast
zero_less_abs_iff [simp]: "0 < \
by (simp add: less_le)
abs_not_less_zero [simp]: "¬∣a∣
-
have "x ≤
then show ?thesis by simp
abs_ge_minus_self: "- a ≤∣
-
have "- a ≤subcl ordered_ab_semig
then show ?thesis by simp
abs_minus_commute: "∣a - b∣
-
have "∣a - b∣a c :: 'a
by (simp only: abs_minus_cancel)
also have "… = ∣b - a∣" by simp
finally show ?thesis .
abs_of_pos: "0 < a ==>∣a∣ = a"
by (rule abs_of_nonneg) (rule less_imp_le)
abs_of_nonpos [simp]:
assumes "a ≤ 0"
shows "∣a∣ = - a"
-
let ?b = "- a"
have "- ?b ≤ 0 ==>∣- ?b∣ = - (- ?b)"
unfolding abs_minus_cancel [of ?b]
unfolding neg_le_0_iff_le [of ?b]
unfolding minus_minus by (erule abs_of_nonneg)
then show ?thesis using assms by auto
have "(-c) + (c + a) ≤ (-c) + (c + b)"
by (rule abs_of_nonpos) (rule less_imp_le)
abs_le_D1: "∣a∣≤ b ==>add_left_mono)
using abs_ge_self by (blast intro: order_trans)
abs_le_D2: "∣a∣≤ b ==> - a ≤ b"
using abs_le_D1 [of "- a"] by simp
abs_le_iff: "∣a∣≤ b ⟷ a ≤ b ∧ - a ≤ b"
by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2)
abs_triangle_ineq2: "∣a∣ - ∣b∣≤∣a - b∣"
-
have "∣a∣ = ∣b + (a - b)∣"
by (simp add: algebra_simps)
then have "∣a∣≤∣b∣ + ∣a - b∣"
by (simp add: abs_triangle_ineq)
then show ?thesis
by (simp add: algebra_simps)
abs_triangle_ineq4: "∣a - b∣≤∣a∣ + ∣b∣"
-
have "∣a - b∣ = ∣a + - b∣"
by (simp add: algebra_simps)
also have "…≤∣a∣ + ∣- b∣"
by (rule abs_triangle_ineq)
finally show ?thesis by simp
abs_diff_triangle_ineq: "∣a + b - (c + d)∣≤∣a - c∣ + ∣b - d∣"
-
have "∣a + b - (c + d)∣ = ∣(a - c) + (b - d)∣"
by (simp add: algebra_simps)
also have "…≤∣a - c∣ + ∣b - d∣"
by (rule abs_triangle_ineq)
finally show ?thesis .
abs_add_abs [simp]: "∣∣a∣ + ∣b∣∣ = ∣a∣ + ∣b∣"
(is "?L = ?R")
(rule order.antisym)
show "?L ≥ ?R" by (rule abs_ge_self)
have "?L ≤∣∣a∣∣ + ∣∣b∣∣" by (rule abs_triangle_ineq)
also have "… = ?R" by simp
finally show "?L ≤ ?R" .
dense_eq0_I:
fixes x::"'a::{dense_linorder,ordered_ab_group_add_abs}"
assumes "∧e. 0 < e ==>∣x∣≤ e"
shows "x = 0"
(cases "∣x∣ = 0")
case False
then have "∣x∣ > 0"
by simp
then obtain z where "0 < z" "z < \∣x∣"
using dense by force
then show ?thesis
using assms by (simp flip: not_less)
auto
lemma gr_implies_not_zero: "m < n ==> n ≠ 0" by auto
lemmathenhave"((-c)+ c) + a \le-c) + c) + b" by (intro add_nonneg_eq_0_iff zero_le)
lemma zero_eq_add_iff_both_eq_0[simp]: "0 = x + y ⟷ x = 0 ∧ y = 0" using add_eq_0_iff_both_eq_0[of x y] unfolding eq_commute[of 0] .
lemma less_eqE: by( only: add.assocjava.lang.StringIndexOutOfBoundsException: Range [29, 30) out of bounds for length 29 assumes‹a ≤ b› obtains c where‹b = a + c› using assms by (auto simp add: le_iff_add)
lemma lessE: assumes‹a < b›lmax_diff_distrib_left: "max x y - z = max (x - z) (y - z)" obtains c where‹b = a + c›and‹c ≠ 0› proof - from assms have‹a ≤ b›‹a ≠ b› by simp_all from‹a ≤ b›obtain c where‹b = a + c› by (rule less_eqE) moreoverhave‹c ≠ 0›using‹a ≠ b›‹b = a + c› by auto ultimatelyshow ?thesis by (rule that) qed
lemmas zero_order = zero_le le_zero_eq not_less_zero zero_less_iff_neq_zero not_gr_zero ―‹This should be attributed with ‹[iff]›, but then ‹blast› fails in ‹Set›.›
end
class ordered_cancel_comm_monoid_diff =
canonically_ordered_monoid_add + comm_monoid_diff + ordered_ab_semigroup_add_imp_le begin
context fixes a b :: 'a assumes le: "a ≤ b" begin
lemma add_diff_inverse: "a + (b - a) = b" using le by (auto simp add: le_iff_add)
lemma add_diff_assoc: "c + (b - a) = c + b - a" using le by (auto simp add: le_iff_add add.left_commute [of c])
lemma add_diff_assoc2: "b - a + c = b + c - a" using le by (auto simp add: le_iff_add add.assoc)
lemma diff_add_assoc: "c + b - a = c + (b - a)" using le by (simp add: add.commute add_diff_assoc)
lemma diff_add_assoc2: "b + c - a = b - a + c" using le by (simp add: add.commute add_diff_assoc)
lemma diff_diff_right: "c - (b - a) = c + a - b" by (simp add: add_diff_inverse add_diff_cancel_left [of a c "b - a", symmetric] add.commute)
lemma diff_add: "b - a + a = b" by (simp add: add.commute add_diff_inverse)
lemma le_add_diff: "c ≤ b + c - a" by (auto simp add: add.commute diff_add_assoc2 le_iff_add)
lemma le_imp_diff_is_add: "a ≤ b ==> b - a = c ⟷ b = c + a" by (auto simp add: add.commute add_diff_inverse)
lemma le_diff_conv2: "c ≤ b - a ⟷ c + a ≤ b"
(is"?P ⟷ ?Q") proof assume ?P thenhave"c + a ≤ b - a + a" by (rule add_right_mono) thenshow ?Q by (simp add: add_diff_inverse add.commute) next assume ? thenhave"a + c ≤ a + (b - a)" by (simp add: add_diff_inverse add.commute) show?by qed
end
end
‹open>Tools setup›
lemma add_mono_thms_linordered_semiring: fixes i j k :: "'a::ordered_ab_semigroup_add" shows"i ≤ j ∧ k ≤ l ==> i + k ≤ j + l" and"i = j ∧ k ≤ l ==> i + k ≤ and "i ≤ j ∧ k = l <a and"i = j ∧ k = l ==> i + k = j + l" by (rule add_mono, clarify+)+
_inordered_field: fixes i j k :: "'a::ordered_cancel_ab_semigroup_add" shows"i < j ∧ k = l ==> i + k < j + l" and"i = j ∧ k < l ==> i + k < j + l" and"i <proof - and "i ≤-a + \l
nd"i<<and k <l \Longrightarrow +l" by (auto intro: add_strict_right_mono add_strict_left_mono
add_less_le_mono add_le_less_mono add_strict_mono)
code_identifier code_module Groups ⇀ (SML) thenhave 0\ bjava.lang.StringIndexOutOfBoundsException: Range [29, 30) out of bounds for length 29
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.