问题
Every goal that I have encountered in Isabelle so far that could be solved using arith could also be solved by presburger and vice versa, for example
lemma "odd (n::nat) ⟹ Suc (2 * (n div 2)) = n"
by presburger (* or arith *)
What's the difference between the two solvers? Examples of goals that one can solve but the other can't would be nice.
Edit: I managed to come up with a lemma proved by arith that presburger can't handle. It seems like this has something to do with real numbers:
lemma "max i (i + 1) > (i::nat)" by arith -- ✔
lemma "max i (i + 1) > (i::nat)" by presburger -- ✔
lemma "max i (i + 1) > (i::real)" by arith -- ✔
lemma "max i (i + 1) > (i::real)" by presburger -- ✘
回答1:
I just asked Tobias Nipkow and this is what he told me:
presburgeris a decision procedure for Presburger arithmetic, i.e. linear arithmetic on natural numbers and integers, plus some pre-processing, which is why your statement withrealcould be proven as well (as it boils down to a problem on integers). It can handle quantifiers. The algorithm underlying it is known as Cooper's algorithm.linarithperforms Fourier-Motzkin elimination to decide problems of linear arithmetic on real numbers. It can also prove these properties on natural numbers and integers, but only if they also hold on all reals. It cannot handle quantifiers.arithcan be summarised as a combination ofpresburgerandlinarith.
For the sake of completeness, I would like to add that there are more specialised proof methods for interesting classes of statements:
algebraapplies, to my knowledge, certain rules for algebraic manipulations (such as commutativity, associativity, inverse elements, etc.) to solve goals that can be proven by rearranging terms in algebraic structures like groups and ringsapproximatecomputes enclosures for concrete terms using interval arithmeticsoscan prove multivariate polynomial inequalities like(x :: real) ≥ 2 ⟹ y ≥ 2 ⟹ x + y ≤ x * yusing sum-of-squares certificatessturm, which was written by me, can count the number of real roots in a given interval and prove certain univariate real polynomial inequalities.regexpcan prove statements on relations like(r ∪ s⁺)* = (r ∪ s)*using regular expressions.
来源:https://stackoverflow.com/questions/28644151/whats-the-difference-between-arith-and-presburger-in-isabelle