presburger arithmetic - sjtuyuxi/teaching/lectures... · it is the arithmetic with only the...
TRANSCRIPT
Presburger Arithmetic
Yuxi Fu
BASICS
Yuxi Fu Presburger Arithmetic 1 / 36
Presburger Arithmetic is seen as a test for the limit of decidability.
It is the arithmetic with only the addition operator; in other wordsit is the Peano Arithmetic without the multiplication operator.
Yuxi Fu Presburger Arithmetic 1 / 36
Mojzesz Presburger (A polish student, 1929).
Uber die Vollstandigkeit eines gewissen Systems der Arithmetikganzer Zahlen, in welchem die Addition als einzige Operationhervortritt. In Comptes Rendus du Premier Congres desMathematicienes des Pays Slaves, 395:92-101, WarsawMathematics Congress.
R. Stansifer (1984).
Presburger’s Article on Integer Arithmetic: Remarks andTranslation. Technical report, Computer Science Department,Cornell University.
Yuxi Fu Presburger Arithmetic 2 / 36
Synopsis
1. Presburger Arithmetic
2. Decidability of PA
3. Complexity of Validity Checking
Yuxi Fu Presburger Arithmetic 3 / 36
Presburger Arithmetic
Yuxi Fu Presburger Arithmetic 4 / 36
First Order Theory
1. First Order Logic: >,⊥,∧,∨,¬,⇒,∃,∀.
2. First Order Theory with Equality:
P{r1(t11 , . . . , t1k1
)/X1, . . . , rn(tn1 , . . . , tnkn
)/Xn} P a tautology
t = ts = t ⇒ t = s
r = s ∧ s = t ⇒ r = t∧1≤i≤k ti = t ′i ⇒ f(t1, . . . , tk) = f(t ′1, . . . , t
′k) f a k-ary function∧
1≤i≤k ti = t ′i ⇒ r(t1, . . . , tk)⇒ r(t ′1, . . . , t′k) r a k-ary relation
∀x .φ⇒ φ{t/x}φ⇒ ∀x .φ x not in φ
(∀x .(ϕ⇒ ψ))⇒ (∀x .ϕ⇒ ∀x .ψ)
Yuxi Fu Presburger Arithmetic 5 / 36
First Order Theory
1. First Order Logic: >,⊥,∧,∨,¬,⇒,∃,∀.
2. First Order Theory with Equality:
P{r1(t11 , . . . , t1k1
)/X1, . . . , rn(tn1 , . . . , tnkn
)/Xn} P a tautology
t = ts = t ⇒ t = s
r = s ∧ s = t ⇒ r = t∧1≤i≤k ti = t ′i ⇒ f(t1, . . . , tk) = f(t ′1, . . . , t
′k) f a k-ary function∧
1≤i≤k ti = t ′i ⇒ r(t1, . . . , tk)⇒ r(t ′1, . . . , t′k) r a k-ary relation
∀x .φ⇒ φ{t/x}φ⇒ ∀x .φ x not in φ
(∀x .(ϕ⇒ ψ))⇒ (∀x .ϕ⇒ ∀x .ψ)
Yuxi Fu Presburger Arithmetic 5 / 36
Presburger Arithmetic, PA
1. Function: nullary 0, unary s.
2. Relation: binary <. Let ≤ be the union of < and =.
3. Axiom:
PA1 ∀x .(s(x) 6= 0)PA2 ∀xy .(s(x) = s(y)⇒ x = y)PA3 ∀x .(x = 0 ∨ ∃y .s(y) = x)PA4 ∀x .(x < s(x))PA5 ∀xy .(x < y ⇒ s(x) ≤ y)PA6 ∀xy .(¬(x < y)⇔ y ≤ x)PA7 ∀xy .((x < y) ∧ (y < z)⇒ x < z)
PA8 ∀x .(x + 0 = x)PA9 ∀xy .(x + s(y)) = s(x + y)
Yuxi Fu Presburger Arithmetic 6 / 36
Presburger Arithmetic
Fact. ∀x , y .x < y ⇔ s(x) < s(y).
Fact. ∀x , y .x < y ∨ x = y ∨ y < x .
Fact. ∀x , y .x 6< y ⇔ (x = y ∨ y < x).
Fact. ∀x , y .x = y ⇔ (x < s(y) ∧ y < s(x)).
Fact. ∀x , y .x 6= y ⇔ (x < y ∨ y < x).
So the relations 6<,=, 6= can be dispensed with in favour of ’<’.
Yuxi Fu Presburger Arithmetic 7 / 36
Presburger Arithmetic
Fact. ∀x , y .x < y ⇔ s(x) < s(y).
Fact. ∀x , y .x < y ∨ x = y ∨ y < x .
Fact. ∀x , y .x 6< y ⇔ (x = y ∨ y < x).
Fact. ∀x , y .x = y ⇔ (x < s(y) ∧ y < s(x)).
Fact. ∀x , y .x 6= y ⇔ (x < y ∨ y < x).
So the relations 6<,=, 6= can be dispensed with in favour of ’<’.
Yuxi Fu Presburger Arithmetic 7 / 36
Numeral
For a natural number i , the closed term
s(s(. . . s︸ ︷︷ ︸i times
(0) . . .))
is called a numeral and is denoted by i (by abusing notation).
Yuxi Fu Presburger Arithmetic 8 / 36
Term
Multiplication by constant
ixdef= x + x + . . .+ x︸ ︷︷ ︸
i times
.
Yuxi Fu Presburger Arithmetic 9 / 36
Term
The terms(s(. . . s︸ ︷︷ ︸i times
(t) . . .))
is equal to t + i .
A term containing variable x1, . . . , xk is equal to a term of the form
n0 + n1x1 + n2x2 + nkxk .
When we write kx + t, we always mean that x does not appear in t.
Yuxi Fu Presburger Arithmetic 10 / 36
Term
The terms(s(. . . s︸ ︷︷ ︸i times
(t) . . .))
is equal to t + i .
A term containing variable x1, . . . , xk is equal to a term of the form
n0 + n1x1 + n2x2 + nkxk .
When we write kx + t, we always mean that x does not appear in t.
Yuxi Fu Presburger Arithmetic 10 / 36
Term
The terms(s(. . . s︸ ︷︷ ︸i times
(t) . . .))
is equal to t + i .
A term containing variable x1, . . . , xk is equal to a term of the form
n0 + n1x1 + n2x2 + nkxk .
When we write kx + t, we always mean that x does not appear in t.
Yuxi Fu Presburger Arithmetic 10 / 36
Formula
In this talk a term in Z is seen as an abbreviation for a term in N.
For example x ← 3 stands for x + 3 < 0 and −y + 3 < x for3 < x + y .
Yuxi Fu Presburger Arithmetic 11 / 36
Expressiveness
Finite quantification
∃x ∈ S .ϕ(x)def=
∨i∈S
ϕ(i).
Unique existence
∃!x .ϕ(x)def= ∃x .ϕ(x) ∧ ∀y .ϕ(y)⇒ y = x .
Yuxi Fu Presburger Arithmetic 12 / 36
Expressiveness
The predicate m = µx .ϕ(x) can be defined by
ϕ(m) ∧ ∀z .ϕ(z)⇒ m ≤ z .
Similarly m = max(S) and m = min(S) are definable.
Yuxi Fu Presburger Arithmetic 13 / 36
Expressiveness
The predicate m = µx .ϕ(x) can be defined by
ϕ(m) ∧ ∀z .ϕ(z)⇒ m ≤ z .
Similarly m = max(S) and m = min(S) are definable.
Yuxi Fu Presburger Arithmetic 13 / 36
Congruence
A useful predicate is the congruence predicate defined by
s ≡k tdef= ∃z .kz+s=t ∨ kz+t=s.
The divide predicate i |x can be defined by x ≡i 0.
Fact. The congruence ≡k is decidable.
Yuxi Fu Presburger Arithmetic 14 / 36
Congruence
A useful predicate is the congruence predicate defined by
s ≡k tdef= ∃z .kz+s=t ∨ kz+t=s.
The divide predicate i |x can be defined by x ≡i 0.
Fact. The congruence ≡k is decidable.
Yuxi Fu Presburger Arithmetic 14 / 36
Let gcd(S) be the greatest common divisor of S .
Let lcm(S) be the least common multiple of S .
Yuxi Fu Presburger Arithmetic 15 / 36
Decidability of PA
Yuxi Fu Presburger Arithmetic 16 / 36
Presburger Arithmetic is Decidable
Theorem. (Presburger, 1929)
The validity of a closed Presburger formula is decidable.
Proof. The basic idea is quantifier elimination.
Yuxi Fu Presburger Arithmetic 17 / 36
Presburger Arithmetic is Decidable
Theorem. (Presburger, 1929)
The validity of a closed Presburger formula is decidable.
Proof. The basic idea is quantifier elimination.
Yuxi Fu Presburger Arithmetic 17 / 36
Presburger Arithmetic is Decidable
All decidability proofs make use of quantifier elimination.
The purpose of quantifier elimination is to replace in a Presburgerformula all the explicit occurrences of the quantifiers by the implicitoccurrences in the form of the congruence relations ≡1,≡2,≡3, . . ..
Fact. The validity of a closed Presburger formula without anyexplicit occurrences of the quantifiers is decidable.
Yuxi Fu Presburger Arithmetic 18 / 36
Presburger Arithmetic is Decidable
All decidability proofs make use of quantifier elimination.
The purpose of quantifier elimination is to replace in a Presburgerformula all the explicit occurrences of the quantifiers by the implicitoccurrences in the form of the congruence relations ≡1,≡2,≡3, . . ..
Fact. The validity of a closed Presburger formula without anyexplicit occurrences of the quantifiers is decidable.
Yuxi Fu Presburger Arithmetic 18 / 36
Presburger Arithmetic is Decidable
All decidability proofs make use of quantifier elimination.
The purpose of quantifier elimination is to replace in a Presburgerformula all the explicit occurrences of the quantifiers by the implicitoccurrences in the form of the congruence relations ≡1,≡2,≡3, . . ..
Fact. The validity of a closed Presburger formula without anyexplicit occurrences of the quantifiers is decidable.
Yuxi Fu Presburger Arithmetic 18 / 36
Quantifier Elimination
H. Enderton (First Edition, 1972; Second Edition, 2001).
A Mathematical Introduction to Logic. Harcourt/Academic Press.
J. Monk (1976).
Mathematical Logic. Springer-Verlag, New York.
Yuxi Fu Presburger Arithmetic 19 / 36
Quantifier Elimination
Suppose (. . . (Qx .ϕ) . . .) is a Presburger formula in which Q is aquantifier and ϕ is quantifier free.
We will turn Qx .ϕ into an equivalent quantifier free formulacomposed of the atomic formulae (of the forms s < t, s ≡i t) andthe logical operators ∧,∨.
Yuxi Fu Presburger Arithmetic 20 / 36
Quantifier Elimination
Suppose (. . . (Qx .ϕ) . . .) is a Presburger formula in which Q is aquantifier and ϕ is quantifier free.
We will turn Qx .ϕ into an equivalent quantifier free formulacomposed of the atomic formulae (of the forms s < t, s ≡i t) andthe logical operators ∧,∨.
Yuxi Fu Presburger Arithmetic 20 / 36
Quantifier Elimination
1. Universal Quantifier Elimination
I If Q = ∀, then apply the De Morgan law
∀x .ϕ(x)⇔ ¬∃.¬ϕ(x)
to get rid of ∀.
2. Negation Elimination
I A negation operator is pushed down all the way to the front ofatomic formulae.
I s 6< t is replaced by t < s ∨ s < t + 1 ∧ t < s + 1.
I s 6≡i t is replaced by (s ≡i t + 1) ∨ . . . ∨ (s ≡i t + i − 1).
Yuxi Fu Presburger Arithmetic 21 / 36
Quantifier Elimination
1. Universal Quantifier Elimination
I If Q = ∀, then apply the De Morgan law
∀x .ϕ(x)⇔ ¬∃.¬ϕ(x)
to get rid of ∀.
2. Negation Elimination
I A negation operator is pushed down all the way to the front ofatomic formulae.
I s 6< t is replaced by t < s ∨ s < t + 1 ∧ t < s + 1.
I s 6≡i t is replaced by (s ≡i t + 1) ∨ . . . ∨ (s ≡i t + i − 1).
Yuxi Fu Presburger Arithmetic 21 / 36
Quantifier Elimination
3. Normalization
I The propositional subformula is converted to a dnf.
I The formula
∃x .((α0 ∧ . . . ∧ αi ) ∨ . . . ∨ (γ0 ∧ . . . ∧ γk))
is then converted to
∃x .(α0 ∧ . . . ∧ αi ) ∨ . . . ∨ ∃x .(γ0 ∧ . . . ∧ γk).
Yuxi Fu Presburger Arithmetic 22 / 36
Quantifier Elimination
4. Coefficient Uniformization
I So we only have to consider formulae of the following form
∃x .
(∧i
nix < ti
)∧
∧j
tj < njx
∧(∧k
nkx ≡ck tk
).
I Let n = lcm({ni , nj , nk}i ,j ,k). We get the equivalent formula
∃x .
(∧i
x < si
)∧
∧j
sj < x
∧(∧k
x ≡dk sk
)∧ x ≡n 0.
Yuxi Fu Presburger Arithmetic 23 / 36
Quantifier Elimination
I The formula∧
i x < si is equivalent to
∨i
x < si ∧∧i ′ 6=i
si ≤ si ′
.
Similarly the formula∧
j sj < x is equivalent to
∨j
sj < x ∧∧j ′ 6=j
sj ′ ≤ sj
.
Yuxi Fu Presburger Arithmetic 24 / 36
Quantifier Elimination
5. Substitution
I So we have reduced the original problem to that of decidingthe validity of formulas of the form
∃x .t ′ < x < t ′′ ∧∧l
x ≡dl tl .
I Let ddef= lcm({dl}l). The above formula is equivalent to
∨0<m≤d
(t ′+m < t ′′ ∧
∧l
t ′+m ≡dl tl
).
Yuxi Fu Presburger Arithmetic 25 / 36
Theorem (Presburger, 1929).
Presburger Arithmetic admits quantifier elimination.
Corollary.
Presburger Arithmetic is consistent, complete and decidable.
Yuxi Fu Presburger Arithmetic 26 / 36
Theorem (Presburger, 1929).
Presburger Arithmetic admits quantifier elimination.
Corollary.
Presburger Arithmetic is consistent, complete and decidable.
Yuxi Fu Presburger Arithmetic 26 / 36
Cooper’s Algorithm
D. Cooper (1972).
Theorem Proving in Arithmetic without Multiplication. In B.Meltzer and D. Michie, eds., Machine Intelligence. EdinburghUniversity Press: 91-100.
Yuxi Fu Presburger Arithmetic 27 / 36
Cooper’s Algorithm
Cooper’s algorithm is a decision procedure for integer PresburgerArithmetic Z.
It works for N by imposing the condition: all variables ≥ 0.
Yuxi Fu Presburger Arithmetic 28 / 36
Cooper’s Algorithm
Cooper’s algorithm is a decision procedure for integer PresburgerArithmetic Z.
It works for N by imposing the condition: all variables ≥ 0.
Yuxi Fu Presburger Arithmetic 28 / 36
Cooper’s Algorithm
The basic idea of Cooper’s algorithm is to do as less formulaconversion as possible.
∀-elimination, ¬-elimination (but keep 6≡i ), coefficientuniformization are all that is necessary.
The trade-off is that it must test a lot of instantiation cases.
Yuxi Fu Presburger Arithmetic 29 / 36
Cooper’s Algorithm
The basic idea of Cooper’s algorithm is to do as less formulaconversion as possible.
∀-elimination, ¬-elimination (but keep 6≡i ), coefficientuniformization are all that is necessary.
The trade-off is that it must test a lot of instantiation cases.
Yuxi Fu Presburger Arithmetic 29 / 36
Cooper’s Algorithm
Let ϕ be a negation-free propositional formula whose atomicformulae are
{x < si}i ∪ {sj < x}j ∪ {x ≡dk 0}k ∪ {x 6≡dl 0}l .
Let ϕ−∞(x) be obtained from ϕ by replacing
I all x < si by >, and
I all sj < x by ⊥.
Lemma. ϕ(x)⇔ ϕ−∞(x) for sufficiently small x .
Yuxi Fu Presburger Arithmetic 30 / 36
Cooper’s Algorithm
Let ϕ be a negation-free propositional formula whose atomicformulae are
{x < si}i ∪ {sj < x}j ∪ {x ≡dk 0}k ∪ {x 6≡dl 0}l .
Let ϕ−∞(x) be obtained from ϕ by replacing
I all x < si by >, and
I all sj < x by ⊥.
Lemma. ϕ(x)⇔ ϕ−∞(x) for sufficiently small x .
Yuxi Fu Presburger Arithmetic 30 / 36
Cooper’s Algorithm
Let ϕ be a negation-free propositional formula whose atomicformulae are
{x < si}i ∪ {sj < x}j ∪ {x ≡dk 0}k ∪ {x 6≡dl 0}l .
Let ϕ−∞(x) be obtained from ϕ by replacing
I all x < si by >, and
I all sj < x by ⊥.
Lemma. ϕ(x)⇔ ϕ−∞(x) for sufficiently small x .
Yuxi Fu Presburger Arithmetic 30 / 36
Cooper’s Algorithm
Theorem. Suppose d = lcm{dk , dl}k,l . Then
∃x .ϕ(x) ⇔d∨
m=1
ϕ−∞(m) ∨d∨
m=1
∨j
ϕ(sj + m).
Proof. Stare at
{x < si}i ∪ {sj < x}j ∪ {x ≡dk 0}k ∪ {x 6≡dl 0}l ;
and think . . .
Yuxi Fu Presburger Arithmetic 31 / 36
Cooper’s Algorithm
Theorem. Suppose d = lcm{dk , dl}k,l . Then
∃x .ϕ(x) ⇔d∨
m=1
ϕ−∞(m) ∨d∨
m=1
∨j
ϕ(sj + m).
Proof. Stare at
{x < si}i ∪ {sj < x}j ∪ {x ≡dk 0}k ∪ {x 6≡dl 0}l ;
and think . . .
Yuxi Fu Presburger Arithmetic 31 / 36
Cooper’s Algorithm
Let ϕ+∞(x) be obtained from ϕ by replacing
I all x < si by ⊥, and
I all sj < x by >.
Lemma. ϕ(x)⇔ ϕ+∞(x) for sufficiently large x .
Theorem. Suppose d = lcm{dk , dl}k,l . Then
∃x .ϕ(x) ⇔d∨
m=1
ϕ+∞(−m) ∨d∨
m=1
∨i
ϕ(si −m).
Yuxi Fu Presburger Arithmetic 32 / 36
FMVE, Fourier-Motzkin Variable Elimination
FMVE decides the validity of a Presburger formula in Q.
After ∀-elimination and ¬-elimination, ∃-elimination is achieved byapplying the following equivalence:
∃x .
(∧h
chah≤ x
)∧
(∧i
ciai< x
)∧
∧j
x ≤djbj
∧(∧k
x <dkbk
)
if and only if∧h,j
chah≤
djbj∧∧h,k
chah
<dkbk∧∧i ,j
ciai<
djbj∧∧i ,k
ciai<
dkbk.
Yuxi Fu Presburger Arithmetic 33 / 36
Complexity of Validity Checking
Yuxi Fu Presburger Arithmetic 34 / 36
M. Fischer and M. Rabin (1974).
Super-Exponential Complexity of Presburger Arithmetic. InComplexity of Computation edited by Richard M. Karp, AmericanMathematical Society, Providence, Rhode Island, 27-41.
D. Oppen (1978).
A 222pn
Upper Bound on the Complexity of Presburger Arithmetic.Journal of Computer and System Sciences, 16:323-332.
Yuxi Fu Presburger Arithmetic 35 / 36
Mojzesz Presburger (1904-1943) was a Polish Jewishmathematician, logician, and philosopher. As a student of AlfredTarski, he invented Presburger Arithmetic in 1929. He died in aconcentration camp in 1943.
In 2010, the European Association for Theoretical ComputerScience began conferring the annual Presburger Award to youngtheoretical computer scientists for outstanding contributions.
Yuxi Fu Presburger Arithmetic 36 / 36