text‹
The ‹arith› method is used frequently throughout the Isabelle
distribution. This file merely contains some additional tests and special
corner cases. Some rather technical remarks:
🚫‹Lin_Arith.simple_tac›is a very basic version of the tactic. It performs no
meta-to-object-logic conversion, and only some splitting of operators. 🚫‹Lin_Arith.tac› performs meta-to-object-logic conversion, full
splitting of operators, and NNF normalization of the goal. The ‹arith›
method combines them both, and tries other methods (e.g.~‹presburger›)
as well. This is the one that you should usein your proofs!
An ‹arith›-based simproc is available as well (see 🚫‹Lin_Arith.simproc›), which---for performance
reasons---however does even less splitting than 🚫‹Lin_Arith.simple_tac›
at the moment (namely inequalities only). (On the other hand, it
does take apart conjunctions, which 🚫‹Lin_Arith.simple_tac› currently
does not do.) ›
subsection‹Splitting of Operators: 🍋‹max›, 🍋‹min›, 🍋‹abs›, 🍋‹minus›, 🍋‹nat›, 🍋‹modulo›, 🍋‹divide››
lemma"(i::nat) <= max i j" by linarith
lemma"(i::int) <= max i j" by linarith
lemma"min i j <= (i::nat)" by linarith
lemma"min i j <= (i::int)" by linarith
lemma"min (i::nat) j <= max i j" by linarith
lemma"min (i::int) j <= max i j" by linarith
lemma"min (i::nat) j + max i j = i + j" by linarith
lemma"min (i::int) j + max i j = i + j" by linarith
lemma"(i::nat) < j ==> min i j < max i j" by linarith
lemma"(i::int) < j ==> min i j < max i j" by linarith
lemma"(0::int) <= \i\" by linarith
lemma"(i::int) <= \i\" by linarith
lemma"\\i::int\\ = \i\" by linarith
text‹Also testing subgoals with bound variables.›
lemma"!!x. (x::nat) <= y ==> x - y = 0" by linarith
lemma"!!x. (x::nat) - y = 0 ==> x <= y" by linarith
lemma"!!x. ((x::nat) <= y) = (x - y = 0)" by linarith
lemma"[| (x::nat) < y; d < 1 |] ==> x - y = d" by linarith
lemma"[| (x::nat) < y; d < 1 |] ==> x - y - x = d - x" by linarith
lemma"(x::int) < y ==> x - y < 0" by linarith
lemma"nat (i + j) <= nat i + nat j" by linarith
lemma"i < j ==> nat (i - j) = 0" by linarith
lemma"(i::nat) mod 0 = i" using split_mod [of _ _ 0, linarith_split] 🍋‹rule 🚫‹split_mod›is only declared by default for numerals› by linarith
lemma"(i::nat) mod 1 = 0" (* rule split_mod is only declared by default for numerals *) using split_mod [of _ _ 1, linarith_split] 🍋‹rule 🚫‹split_mod›is only declared by default for numerals› by linarith
lemma"(i::nat) mod 42 <= 41" by linarith
lemma"(i::int) mod 0 = i" using split_zmod [of _ _ 0, linarith_split] 🍋‹rule 🚫‹split_zmod›is only declared by default for numerals› by linarith
lemma"(i::int) mod 1 = 0" using split_zmod [of _ _ "1", linarith_split] 🍋‹rule 🚫‹split_zmod›is only declared by default for numerals› by linarith
lemma"(n < m & m < n') | (n < m & m = n') | (n < n' & n' < m) |
(n = n' & n' < m) | (n = m & m < n') |
(n' < m & m < n) | (n' < m & m = n) |
(n' < n & n < m) | (n' = n & n < m) | (n' = m & m < n) |
(m < n & n < n') | (m < n & n' = n) | (m < n' & n' < n) |
(m = n & n < n') | (m = n' & n' < n) |
(n' = m & m = (n::nat))" (* FIXME: this should work in principle, but is extremely slow because *) (* preprocessing negates the goal and tries to compute its negation *) (* normal form, which creates lots of separate cases for this *) (* disjunction of conjunctions *) (* by (tactic {* Lin_Arith.tac 1 *}) *) oops
lemma"2 * (x::nat) ~= 1" (* FIXME: this is beyond the scope of the decision procedure at the moment, *) (* because its negation is satisfiable in the rationals? *) (* by (tactic {* Lin_Arith.simple_tac 1 *}) *) oops
text‹Constants.›
lemma"(0::nat) < 1" by linarith
lemma"(0::int) < 1" by linarith
lemma"(47::nat) + 11 < 8 * 15" by linarith
lemma"(47::int) + 11 < 8 * 15" by linarith
text‹Splitting of inequalities of different type.›
lemma"[| (a::nat) ~= b; (i::int) ~= j; a < 2; b < 2 |] ==>
a + b <= nat (max ∣i∣∣j∣)" by linarith
text‹Again, but different order.›
lemma"[| (i::int) ~= j; (a::nat) ~= b; a < 2; b < 2 |] ==>
a + b <= nat (max ∣i∣∣j∣)" by linarith
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.