satisfiability checking - first order logic

110
Satisfiability Checking First Order Logic Prof. Dr. Erika Ábrahám Theory of Hybrid Systems Informatik 2 WS 11/12 Prof. Dr. Erika Ábrahám - Satisfiability Checking 1 / 36

Upload: others

Post on 09-Feb-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Satisfiability Checking - First Order Logic

Satisfiability CheckingFirst Order Logic

Prof. Dr. Erika Ábrahám

Theory of Hybrid SystemsInformatik 2

WS 11/12

Prof. Dr. Erika Ábrahám - Satisfiability Checking 1 / 36

Page 2: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.

Assume the argumentation:1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by definingconstants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume1 ∀x . isWoman(x)→ lovesShopping(x)2 isWoman(Eve)

Then3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 3: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.Assume the argumentation:

1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by definingconstants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume1 ∀x . isWoman(x)→ lovesShopping(x)2 isWoman(Eve)

Then3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 4: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.Assume the argumentation:

1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by defining

constants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume1 ∀x . isWoman(x)→ lovesShopping(x)2 isWoman(Eve)

Then3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 5: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.Assume the argumentation:

1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by definingconstants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume1 ∀x . isWoman(x)→ lovesShopping(x)2 isWoman(Eve)

Then3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 6: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.Assume the argumentation:

1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by definingconstants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume

1 ∀x . isWoman(x)→ lovesShopping(x)2 isWoman(Eve)

Then3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 7: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.Assume the argumentation:

1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by definingconstants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume1 ∀x . isWoman(x)→ lovesShopping(x)

2 isWoman(Eve)Then

3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 8: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.Assume the argumentation:

1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by definingconstants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume1 ∀x . isWoman(x)→ lovesShopping(x)2 isWoman(Eve)

Then3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 9: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.Assume the argumentation:

1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by definingconstants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume1 ∀x . isWoman(x)→ lovesShopping(x)2 isWoman(Eve)

Then

3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 10: Satisfiability Checking - First Order Logic

From informal to formal logics

We have seen that natural languages are not well-suited for correctreasoning.Assume the argumentation:

1 All women love shopping.2 Eve is a woman.3 Thus Eve loves shopping.

We can formalize it by definingconstants: Evevariables: xpredicate symbols: isWoman(·), lovesShopping(·)

Assume1 ∀x . isWoman(x)→ lovesShopping(x)2 isWoman(Eve)

Then3 lovesShopping(Eve)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 2 / 36

Page 11: Satisfiability Checking - First Order Logic

First-Order Logic

First-order (FO) logic is a framework.It gives us a generic syntax by recursively defining strings on analphabet.Non-logical elements are logically combined using:

constants (Eve, 0, true, . . . )variables (x,y,. . . )function symbols (+(·, ·), vaterOf(·),. . . )predicate symbols (>(·, ·), isPrime(·), isBrotherOf(·, ·),. . . )logical symbols ((, ),∧,¬, . . . ,∃,∀).

Note:Constants can also be seen as function symbols of arity 0.Sometimes equality (=) is included as a logical symbol.E.g., the Boolean connectives negation (¬) and conjunction (∧) andthe existential quantifier ∃ would be sufficient, the remaining syntax(∨,→,↔, . . . ,∀) are syntactic sugar.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 3 / 36

Page 12: Satisfiability Checking - First Order Logic

First-Order Logic

First-order (FO) logic is a framework.It gives us a generic syntax by recursively defining strings on analphabet.Non-logical elements are logically combined using:

constants (Eve, 0, true, . . . )variables (x,y,. . . )function symbols (+(·, ·), vaterOf(·),. . . )predicate symbols (>(·, ·), isPrime(·), isBrotherOf(·, ·),. . . )logical symbols ((, ),∧,¬, . . . ,∃,∀).

Note:Constants can also be seen as function symbols of arity 0.Sometimes equality (=) is included as a logical symbol.E.g., the Boolean connectives negation (¬) and conjunction (∧) andthe existential quantifier ∃ would be sufficient, the remaining syntax(∨,→,↔, . . . ,∀) are syntactic sugar.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 3 / 36

Page 13: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 14: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:

1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 15: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.

2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol thenf (t1, ..., tn) is a term.

Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 16: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.

Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 17: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 18: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:

1 If P is an n-ary predicate symbol and t1, . . . , tn are terms thenP(t1, . . . , tn) is a formula.

2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 19: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.

2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 20: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.

3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 21: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.

4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 22: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.

5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) areformulae.

Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 23: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.

Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 24: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.

The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 25: Satisfiability Checking - First Order Logic

Formation rules

Terms are inductively defined by the following rules:1 All constants and variables are terms.2 If t1, . . . , tn (n > 0) are terms and f an n-ary function symbol then

f (t1, ..., tn) is a term.Only strings obtained by finitely many applications of these rules are terms.

(Well-formed) formulae are inductively defined by the following rules:1 If P is an n-ary predicate symbol and t1, . . . , tn are terms then

P(t1, . . . , tn) is a formula.2 If ϕ is a formula, then (¬ϕ) is a formula.3 If ϕ and ψ are formulae, then (ϕ ∧ ψ) is a formula.4 Similar rules apply to other binary logical connectives.5 If ϕ is a formula and x is a variable, then (∀x .ϕ) and (∃x . ϕ) are

formulae.Only expressions which can be obtained by finitely many applications ofrules 1–5 are formulae.The formulae obtained by the first rule are said to be atomic.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 4 / 36

Page 26: Satisfiability Checking - First Order Logic

Notational conventions

We omit parenthesis whenever we may restore them through operatorprecedence:

binds stronger

¬ ∧ ∨ → ↔ ∃ ∀

Thus, we write:¬¬a for (¬(¬a)),∃a. ∃b. (a ∧ b → F (a, b)) for ∃a. ∃b. ((a ∧ b)→ F (a, b))

Prof. Dr. Erika Ábrahám - Satisfiability Checking 5 / 36

Page 27: Satisfiability Checking - First Order Logic

Notational conventions

We omit parenthesis whenever we may restore them through operatorprecedence:

binds stronger

¬ ∧ ∨ → ↔ ∃ ∀

Thus, we write:¬¬a for (¬(¬a)),∃a. ∃b. (a ∧ b → F (a, b)) for ∃a. ∃b. ((a ∧ b)→ F (a, b))

Prof. Dr. Erika Ábrahám - Satisfiability Checking 5 / 36

Page 28: Satisfiability Checking - First Order Logic

Free and bound variables

The free and bound variables of a formula are defined inductively:

If ϕ is an atomic formula then a variable x is free in ϕ iff x occurs in ϕ.Moreover, there are no bound variables in any atomic formula.A variable x is free in (¬ϕ) iff x is free in ϕ.Moreover, x is bound in (¬ϕ) iff x is bound in ϕ.x is free in (ϕ ∧ ψ) iff x is free in either ϕ or ψ.Moreover, x is bound in (ϕ ∧ ψ) iff x is bound in either ϕ or ψ.The same rule applies to any other binary connective in place of ∧.x is free in (∃y . ϕ) iff x is free in ϕ and x is a symbol different from y .Moreover, x is bound in (∃y . ϕ) iff x is y or x is bound in ϕ.The same rule holds with ∀ in place of ∃.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 6 / 36

Page 29: Satisfiability Checking - First Order Logic

Free and bound variables

The free and bound variables of a formula are defined inductively:

If ϕ is an atomic formula then a variable x is free in ϕ iff x occurs in ϕ.Moreover, there are no bound variables in any atomic formula.A variable x is free in (¬ϕ) iff x is free in ϕ.Moreover, x is bound in (¬ϕ) iff x is bound in ϕ.x is free in (ϕ ∧ ψ) iff x is free in either ϕ or ψ.Moreover, x is bound in (ϕ ∧ ψ) iff x is bound in either ϕ or ψ.The same rule applies to any other binary connective in place of ∧.x is free in (∃y . ϕ) iff x is free in ϕ and x is a symbol different from y .Moreover, x is bound in (∃y . ϕ) iff x is y or x is bound in ϕ.The same rule holds with ∀ in place of ∃.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 6 / 36

Page 30: Satisfiability Checking - First Order Logic

Free and bound variables

The free and bound variables of a formula are defined inductively:If ϕ is an atomic formula then a variable x is free in ϕ iff x occurs in ϕ.Moreover, there are no bound variables in any atomic formula.

A variable x is free in (¬ϕ) iff x is free in ϕ.Moreover, x is bound in (¬ϕ) iff x is bound in ϕ.x is free in (ϕ ∧ ψ) iff x is free in either ϕ or ψ.Moreover, x is bound in (ϕ ∧ ψ) iff x is bound in either ϕ or ψ.The same rule applies to any other binary connective in place of ∧.x is free in (∃y . ϕ) iff x is free in ϕ and x is a symbol different from y .Moreover, x is bound in (∃y . ϕ) iff x is y or x is bound in ϕ.The same rule holds with ∀ in place of ∃.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 6 / 36

Page 31: Satisfiability Checking - First Order Logic

Free and bound variables

The free and bound variables of a formula are defined inductively:If ϕ is an atomic formula then a variable x is free in ϕ iff x occurs in ϕ.Moreover, there are no bound variables in any atomic formula.A variable x is free in (¬ϕ) iff x is free in ϕ.Moreover, x is bound in (¬ϕ) iff x is bound in ϕ.

x is free in (ϕ ∧ ψ) iff x is free in either ϕ or ψ.Moreover, x is bound in (ϕ ∧ ψ) iff x is bound in either ϕ or ψ.The same rule applies to any other binary connective in place of ∧.x is free in (∃y . ϕ) iff x is free in ϕ and x is a symbol different from y .Moreover, x is bound in (∃y . ϕ) iff x is y or x is bound in ϕ.The same rule holds with ∀ in place of ∃.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 6 / 36

Page 32: Satisfiability Checking - First Order Logic

Free and bound variables

The free and bound variables of a formula are defined inductively:If ϕ is an atomic formula then a variable x is free in ϕ iff x occurs in ϕ.Moreover, there are no bound variables in any atomic formula.A variable x is free in (¬ϕ) iff x is free in ϕ.Moreover, x is bound in (¬ϕ) iff x is bound in ϕ.x is free in (ϕ ∧ ψ) iff x is free in either ϕ or ψ.Moreover, x is bound in (ϕ ∧ ψ) iff x is bound in either ϕ or ψ.

The same rule applies to any other binary connective in place of ∧.x is free in (∃y . ϕ) iff x is free in ϕ and x is a symbol different from y .Moreover, x is bound in (∃y . ϕ) iff x is y or x is bound in ϕ.The same rule holds with ∀ in place of ∃.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 6 / 36

Page 33: Satisfiability Checking - First Order Logic

Free and bound variables

The free and bound variables of a formula are defined inductively:If ϕ is an atomic formula then a variable x is free in ϕ iff x occurs in ϕ.Moreover, there are no bound variables in any atomic formula.A variable x is free in (¬ϕ) iff x is free in ϕ.Moreover, x is bound in (¬ϕ) iff x is bound in ϕ.x is free in (ϕ ∧ ψ) iff x is free in either ϕ or ψ.Moreover, x is bound in (ϕ ∧ ψ) iff x is bound in either ϕ or ψ.The same rule applies to any other binary connective in place of ∧.

x is free in (∃y . ϕ) iff x is free in ϕ and x is a symbol different from y .Moreover, x is bound in (∃y . ϕ) iff x is y or x is bound in ϕ.The same rule holds with ∀ in place of ∃.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 6 / 36

Page 34: Satisfiability Checking - First Order Logic

Free and bound variables

The free and bound variables of a formula are defined inductively:If ϕ is an atomic formula then a variable x is free in ϕ iff x occurs in ϕ.Moreover, there are no bound variables in any atomic formula.A variable x is free in (¬ϕ) iff x is free in ϕ.Moreover, x is bound in (¬ϕ) iff x is bound in ϕ.x is free in (ϕ ∧ ψ) iff x is free in either ϕ or ψ.Moreover, x is bound in (ϕ ∧ ψ) iff x is bound in either ϕ or ψ.The same rule applies to any other binary connective in place of ∧.x is free in (∃y . ϕ) iff x is free in ϕ and x is a symbol different from y .Moreover, x is bound in (∃y . ϕ) iff x is y or x is bound in ϕ.

The same rule holds with ∀ in place of ∃.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 6 / 36

Page 35: Satisfiability Checking - First Order Logic

Free and bound variables

The free and bound variables of a formula are defined inductively:If ϕ is an atomic formula then a variable x is free in ϕ iff x occurs in ϕ.Moreover, there are no bound variables in any atomic formula.A variable x is free in (¬ϕ) iff x is free in ϕ.Moreover, x is bound in (¬ϕ) iff x is bound in ϕ.x is free in (ϕ ∧ ψ) iff x is free in either ϕ or ψ.Moreover, x is bound in (ϕ ∧ ψ) iff x is bound in either ϕ or ψ.The same rule applies to any other binary connective in place of ∧.x is free in (∃y . ϕ) iff x is free in ϕ and x is a symbol different from y .Moreover, x is bound in (∃y . ϕ) iff x is y or x is bound in ϕ.The same rule holds with ∀ in place of ∃.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 6 / 36

Page 36: Satisfiability Checking - First Order Logic

Free and bound variables

Examples:

In z ∨ ∀x . ∀y . (P(x)→ Q(z)), x and y are bound variables, z is afree variable, and w is neither bound nor free.In z ∨ ∀z .P(z), z is both bound and free.

Freeness and boundness can be also specialized to specific occurrences ofvariables in a formula. In z ∨ ∀z .P(z), the first occurrence of z is free whilethe second is bound.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 7 / 36

Page 37: Satisfiability Checking - First Order Logic

Free and bound variables

Examples:In z ∨ ∀x . ∀y . (P(x)→ Q(z)), x and y are bound variables, z is afree variable, and w is neither bound nor free.In z ∨ ∀z .P(z), z is both bound and free.

Freeness and boundness can be also specialized to specific occurrences ofvariables in a formula. In z ∨ ∀z .P(z), the first occurrence of z is free whilethe second is bound.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 7 / 36

Page 38: Satisfiability Checking - First Order Logic

Some definitions

A signature Σ fixes a set of non-logical symbols.A Σ-formula is a formula with non-logical symbols from Σ.A variable is free if it is not bound by a quantifier.A sentence is a formula without free variables.

In the previous example:Σ = (Eve, isWoman(·), lovesShopping(·)) with

Eve a constant andisWoman and lovesShopping unary predicate symbols.

The formulae1 ∀x . isWoman(x)→ lovesShopping(x)

2 isWoman(Eve)3 lovesShopping(Eve)

are Σ-sentences (the only variable x is bound).

Prof. Dr. Erika Ábrahám - Satisfiability Checking 8 / 36

Page 39: Satisfiability Checking - First Order Logic

Some definitions

A signature Σ fixes a set of non-logical symbols.A Σ-formula is a formula with non-logical symbols from Σ.A variable is free if it is not bound by a quantifier.A sentence is a formula without free variables.

In the previous example:

Σ = (Eve, isWoman(·), lovesShopping(·)) withEve a constant andisWoman and lovesShopping unary predicate symbols.

The formulae1 ∀x . isWoman(x)→ lovesShopping(x)

2 isWoman(Eve)3 lovesShopping(Eve)

are Σ-sentences (the only variable x is bound).

Prof. Dr. Erika Ábrahám - Satisfiability Checking 8 / 36

Page 40: Satisfiability Checking - First Order Logic

Some definitions

A signature Σ fixes a set of non-logical symbols.A Σ-formula is a formula with non-logical symbols from Σ.A variable is free if it is not bound by a quantifier.A sentence is a formula without free variables.

In the previous example:Σ = (Eve, isWoman(·), lovesShopping(·)) with

Eve a constant andisWoman and lovesShopping unary predicate symbols.

The formulae1 ∀x . isWoman(x)→ lovesShopping(x)

2 isWoman(Eve)3 lovesShopping(Eve)

are Σ-sentences (the only variable x is bound).

Prof. Dr. Erika Ábrahám - Satisfiability Checking 8 / 36

Page 41: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+, >}0, 1 are constant symbols+ is a binary function symbol> is a binary predicate symbol

Examples of Σ-formulae:∃x . ∀y . x > y∀x . ∃y . x > y∀x . x + 1 > x∀x . ¬(x + 0 > x ∨ x > x + 0)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 9 / 36

Page 42: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+, >}0, 1 are constant symbols+ is a binary function symbol> is a binary predicate symbol

Examples of Σ-formulae:

∃x . ∀y . x > y∀x . ∃y . x > y∀x . x + 1 > x∀x . ¬(x + 0 > x ∨ x > x + 0)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 9 / 36

Page 43: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+, >}0, 1 are constant symbols+ is a binary function symbol> is a binary predicate symbol

Examples of Σ-formulae:∃x . ∀y . x > y∀x . ∃y . x > y∀x . x + 1 > x∀x . ¬(x + 0 > x ∨ x > x + 0)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 9 / 36

Page 44: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+, ∗, <, isPrime}0, 1 constant symbols+, ∗ binary function symbols< binary predicate symbolisPrime unary predicate symbol

An example Σ-formula:∀n. ∃p. 1 < n→ isPrime(p) ∧ n < p < 2 ∗ n

Prof. Dr. Erika Ábrahám - Satisfiability Checking 10 / 36

Page 45: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+, ∗, <, isPrime}0, 1 constant symbols+, ∗ binary function symbols< binary predicate symbolisPrime unary predicate symbol

An example Σ-formula:∀n. ∃p. 1 < n→ isPrime(p) ∧ n < p < 2 ∗ n

Prof. Dr. Erika Ábrahám - Satisfiability Checking 10 / 36

Page 46: Satisfiability Checking - First Order Logic

Example

Let Σ = {0, 1,+,=} where 0, 1 are constants, + is a binary functionsymbol and = a binary predicate symbol.Let ϕ = ∃x . x + 0 = 1 a Σ-formula.

Q: Is ϕ true?A: So far these are only symbols, strings. No meaning yet.Q: What do we need to fix for the semantics?A: We need a domain for the variables. Let’s say N0.Q: Is ϕ true in N0?A: Depends on the interpretation of ’+’ and ’=’ !

Prof. Dr. Erika Ábrahám - Satisfiability Checking 11 / 36

Page 47: Satisfiability Checking - First Order Logic

Example

Let Σ = {0, 1,+,=} where 0, 1 are constants, + is a binary functionsymbol and = a binary predicate symbol.Let ϕ = ∃x . x + 0 = 1 a Σ-formula.Q: Is ϕ true?

A: So far these are only symbols, strings. No meaning yet.Q: What do we need to fix for the semantics?A: We need a domain for the variables. Let’s say N0.Q: Is ϕ true in N0?A: Depends on the interpretation of ’+’ and ’=’ !

Prof. Dr. Erika Ábrahám - Satisfiability Checking 11 / 36

Page 48: Satisfiability Checking - First Order Logic

Example

Let Σ = {0, 1,+,=} where 0, 1 are constants, + is a binary functionsymbol and = a binary predicate symbol.Let ϕ = ∃x . x + 0 = 1 a Σ-formula.Q: Is ϕ true?A: So far these are only symbols, strings. No meaning yet.

Q: What do we need to fix for the semantics?A: We need a domain for the variables. Let’s say N0.Q: Is ϕ true in N0?A: Depends on the interpretation of ’+’ and ’=’ !

Prof. Dr. Erika Ábrahám - Satisfiability Checking 11 / 36

Page 49: Satisfiability Checking - First Order Logic

Example

Let Σ = {0, 1,+,=} where 0, 1 are constants, + is a binary functionsymbol and = a binary predicate symbol.Let ϕ = ∃x . x + 0 = 1 a Σ-formula.Q: Is ϕ true?A: So far these are only symbols, strings. No meaning yet.Q: What do we need to fix for the semantics?

A: We need a domain for the variables. Let’s say N0.Q: Is ϕ true in N0?A: Depends on the interpretation of ’+’ and ’=’ !

Prof. Dr. Erika Ábrahám - Satisfiability Checking 11 / 36

Page 50: Satisfiability Checking - First Order Logic

Example

Let Σ = {0, 1,+,=} where 0, 1 are constants, + is a binary functionsymbol and = a binary predicate symbol.Let ϕ = ∃x . x + 0 = 1 a Σ-formula.Q: Is ϕ true?A: So far these are only symbols, strings. No meaning yet.Q: What do we need to fix for the semantics?A: We need a domain for the variables. Let’s say N0.

Q: Is ϕ true in N0?A: Depends on the interpretation of ’+’ and ’=’ !

Prof. Dr. Erika Ábrahám - Satisfiability Checking 11 / 36

Page 51: Satisfiability Checking - First Order Logic

Example

Let Σ = {0, 1,+,=} where 0, 1 are constants, + is a binary functionsymbol and = a binary predicate symbol.Let ϕ = ∃x . x + 0 = 1 a Σ-formula.Q: Is ϕ true?A: So far these are only symbols, strings. No meaning yet.Q: What do we need to fix for the semantics?A: We need a domain for the variables. Let’s say N0.Q: Is ϕ true in N0?

A: Depends on the interpretation of ’+’ and ’=’ !

Prof. Dr. Erika Ábrahám - Satisfiability Checking 11 / 36

Page 52: Satisfiability Checking - First Order Logic

Example

Let Σ = {0, 1,+,=} where 0, 1 are constants, + is a binary functionsymbol and = a binary predicate symbol.Let ϕ = ∃x . x + 0 = 1 a Σ-formula.Q: Is ϕ true?A: So far these are only symbols, strings. No meaning yet.Q: What do we need to fix for the semantics?A: We need a domain for the variables. Let’s say N0.Q: Is ϕ true in N0?A: Depends on the interpretation of ’+’ and ’=’ !

Prof. Dr. Erika Ábrahám - Satisfiability Checking 11 / 36

Page 53: Satisfiability Checking - First Order Logic

Structures, satisfiability, validity

A structure is given by:a domain D,an interpretation I of the non-logical symbols that

maps each constant symbol to a domain element,maps each function symbol to a function of the same arity, andmaps each predicate symbol to a predicate of the same arity,

an assignment of a domain element to each free (unquantified) variable.

A formula is satisfiable if there exists a structure that satisfies it.A formula is valid if it is satisfied by all structures.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 12 / 36

Page 54: Satisfiability Checking - First Order Logic

Structures, satisfiability, validity

A structure is given by:a domain D,an interpretation I of the non-logical symbols that

maps each constant symbol to a domain element,maps each function symbol to a function of the same arity, andmaps each predicate symbol to a predicate of the same arity,

an assignment of a domain element to each free (unquantified) variable.

A formula is satisfiable if there exists a structure that satisfies it.

A formula is valid if it is satisfied by all structures.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 12 / 36

Page 55: Satisfiability Checking - First Order Logic

Structures, satisfiability, validity

A structure is given by:a domain D,an interpretation I of the non-logical symbols that

maps each constant symbol to a domain element,maps each function symbol to a function of the same arity, andmaps each predicate symbol to a predicate of the same arity,

an assignment of a domain element to each free (unquantified) variable.

A formula is satisfiable if there exists a structure that satisfies it.A formula is valid if it is satisfied by all structures.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 12 / 36

Page 56: Satisfiability Checking - First Order Logic

Semantics

Semantics of terms and formulae under a structure (D, I ):

constants: [[c]](D,I ) = I (c)variables: [[x ]](D,I ) = I (x)functions: [[f (t1, . . . , tn)]](D,I ) = I (f )([[t1]](D,I ), . . . , [[tn]](D,I ))predicates: [[p(t1, . . . , tn)]](D,I ) = I (p)([[t1]](D,I ), . . . , [[tn]](D,I ))logical structure:

[[¬ϕ]](D,I ) =

{true if [[ϕ]](D,I )=falsefalse if [[ϕ]](D,I )=true

[[ϕ ∧ ψ]](D,I ) =

{true if [[ϕ]](D,I ) = true and [[ψ]](D,I )=truefalse if [[ϕ]](D,I ) = false or [[ψ]](D,I )=false

[[∃x . ϕ]](D,I ) =

{true if there exists v∈D such that [[ϕ]](D,I [x 7→v ])=truefalse if for all v∈D we have [[ϕ]](D,I [x 7→v ])=false

Prof. Dr. Erika Ábrahám - Satisfiability Checking 13 / 36

Page 57: Satisfiability Checking - First Order Logic

Semantics

Semantics of terms and formulae under a structure (D, I ):constants: [[c]](D,I ) = I (c)variables: [[x ]](D,I ) = I (x)functions: [[f (t1, . . . , tn)]](D,I ) = I (f )([[t1]](D,I ), . . . , [[tn]](D,I ))predicates: [[p(t1, . . . , tn)]](D,I ) = I (p)([[t1]](D,I ), . . . , [[tn]](D,I ))logical structure:

[[¬ϕ]](D,I ) =

{true if [[ϕ]](D,I )=falsefalse if [[ϕ]](D,I )=true

[[ϕ ∧ ψ]](D,I ) =

{true if [[ϕ]](D,I ) = true and [[ψ]](D,I )=truefalse if [[ϕ]](D,I ) = false or [[ψ]](D,I )=false

[[∃x . ϕ]](D,I ) =

{true if there exists v∈D such that [[ϕ]](D,I [x 7→v ])=truefalse if for all v∈D we have [[ϕ]](D,I [x 7→v ])=false

Prof. Dr. Erika Ábrahám - Satisfiability Checking 13 / 36

Page 58: Satisfiability Checking - First Order Logic

Example

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula

Q: Is ϕ satisfiable?A: Yes. Consider the structure S :

Domain: N0Interpretation:

0 and 1 are mapped to 0 and 1 in N0

= means equality+ means addition

S satisfies ϕ. S is said to be a model of ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 14 / 36

Page 59: Satisfiability Checking - First Order Logic

Example

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formulaQ: Is ϕ satisfiable?

A: Yes. Consider the structure S :Domain: N0Interpretation:

0 and 1 are mapped to 0 and 1 in N0

= means equality+ means addition

S satisfies ϕ. S is said to be a model of ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 14 / 36

Page 60: Satisfiability Checking - First Order Logic

Example

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formulaQ: Is ϕ satisfiable?A: Yes. Consider the structure S :

Domain: N0Interpretation:

0 and 1 are mapped to 0 and 1 in N0

= means equality+ means addition

S satisfies ϕ. S is said to be a model of ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 14 / 36

Page 61: Satisfiability Checking - First Order Logic

Example (cont.)

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula

Q: Is ϕ valid?A: No. Consider the structure S ′:

Domain: N0Interpretation:

0 and 1 are mapped to 0 and 1 in N0

= means equality+ means multiplication

S ′ does not satisfy ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 15 / 36

Page 62: Satisfiability Checking - First Order Logic

Example (cont.)

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formulaQ: Is ϕ valid?

A: No. Consider the structure S ′:Domain: N0Interpretation:

0 and 1 are mapped to 0 and 1 in N0

= means equality+ means multiplication

S ′ does not satisfy ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 15 / 36

Page 63: Satisfiability Checking - First Order Logic

Example (cont.)

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formulaQ: Is ϕ valid?A: No. Consider the structure S ′:

Domain: N0Interpretation:

0 and 1 are mapped to 0 and 1 in N0

= means equality+ means multiplication

S ′ does not satisfy ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 15 / 36

Page 64: Satisfiability Checking - First Order Logic

Theories, T -safisfiability and T -validity

A Σ-theory T is defined by a set of Σ-sentences.

The number of sentences that are necessary for defining a theory maybe large or infinite.Instead, it is common to define a theory through a set of axioms.The theory is defined by these axioms and everything that can beinferred from them by a sound inference system.

A Σ-formula ϕ is T -satisfiable if there exists a structure that satisfiesboth the sentences of T and ϕ.A Σ-formula ϕ is T -valid if all structures that satisfy the sentencesdefining T also satisfy ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 16 / 36

Page 65: Satisfiability Checking - First Order Logic

Theories, T -safisfiability and T -validity

A Σ-theory T is defined by a set of Σ-sentences.

The number of sentences that are necessary for defining a theory maybe large or infinite.Instead, it is common to define a theory through a set of axioms.The theory is defined by these axioms and everything that can beinferred from them by a sound inference system.

A Σ-formula ϕ is T -satisfiable if there exists a structure that satisfiesboth the sentences of T and ϕ.A Σ-formula ϕ is T -valid if all structures that satisfy the sentencesdefining T also satisfy ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 16 / 36

Page 66: Satisfiability Checking - First Order Logic

Theories, T -safisfiability and T -validity

A Σ-theory T is defined by a set of Σ-sentences.

The number of sentences that are necessary for defining a theory maybe large or infinite.Instead, it is common to define a theory through a set of axioms.The theory is defined by these axioms and everything that can beinferred from them by a sound inference system.

A Σ-formula ϕ is T -satisfiable if there exists a structure that satisfiesboth the sentences of T and ϕ.A Σ-formula ϕ is T -valid if all structures that satisfy the sentencesdefining T also satisfy ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 16 / 36

Page 67: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative

Q: Is ϕ T -satisfiable?A: Yes, S is a model.Q: Is ϕ T -valid?A: No. S ′ satisfies the sentences in T but not ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 17 / 36

Page 68: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative

Q: Is ϕ T -satisfiable?

A: Yes, S is a model.Q: Is ϕ T -valid?A: No. S ′ satisfies the sentences in T but not ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 17 / 36

Page 69: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative

Q: Is ϕ T -satisfiable?A: Yes, S is a model.

Q: Is ϕ T -valid?A: No. S ′ satisfies the sentences in T but not ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 17 / 36

Page 70: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative

Q: Is ϕ T -satisfiable?A: Yes, S is a model.Q: Is ϕ T -valid?

A: No. S ′ satisfies the sentences in T but not ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 17 / 36

Page 71: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative

Q: Is ϕ T -satisfiable?A: Yes, S is a model.Q: Is ϕ T -valid?A: No. S ′ satisfies the sentences in T but not ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 17 / 36

Page 72: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative3 ∀x . 0 + x = x

Q: Is ϕ T -satisfiable?A: Yes, S is a model.Q: Is ϕ T -valid?A: Yes. (S ′ does not satisfy the third axiom.)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 18 / 36

Page 73: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative3 ∀x . 0 + x = x

Q: Is ϕ T -satisfiable?

A: Yes, S is a model.Q: Is ϕ T -valid?A: Yes. (S ′ does not satisfy the third axiom.)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 18 / 36

Page 74: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative3 ∀x . 0 + x = x

Q: Is ϕ T -satisfiable?A: Yes, S is a model.

Q: Is ϕ T -valid?A: Yes. (S ′ does not satisfy the third axiom.)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 18 / 36

Page 75: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative3 ∀x . 0 + x = x

Q: Is ϕ T -satisfiable?A: Yes, S is a model.Q: Is ϕ T -valid?

A: Yes. (S ′ does not satisfy the third axiom.)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 18 / 36

Page 76: Satisfiability Checking - First Order Logic

Examples

Σ = {0, 1,+,=}ϕ = ∃x . x + 0 = 1 a Σ-formula.We now define the Σ-theory T by the following axioms:

1 ∀x . x = x // = must be reflexive2 ∀x . ∀y . x + y = y + x //+ must be commutative3 ∀x . 0 + x = x

Q: Is ϕ T -satisfiable?A: Yes, S is a model.Q: Is ϕ T -valid?A: Yes. (S ′ does not satisfy the third axiom.)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 18 / 36

Page 77: Satisfiability Checking - First Order Logic

Example

Σ = {=}ϕ = (x = y ∧ y 6= z)→ x 6= z a Σ-formulaWe now define the Σ-theory T by the following axioms:

1 ∀x . x = x (reflexivity)2 ∀x . ∀y . x = y → y = x (symmetry)3 ∀x . ∀y . ∀z . x = y ∧ y = z → x = z (transitivity)

Q: Is ϕ T -satisfiable?A: Yes.Q: Is ϕ T -valid?A: Yes. Every structure that satisfies T also satisfies ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 19 / 36

Page 78: Satisfiability Checking - First Order Logic

Example

Σ = {=}ϕ = (x = y ∧ y 6= z)→ x 6= z a Σ-formulaWe now define the Σ-theory T by the following axioms:

1 ∀x . x = x (reflexivity)2 ∀x . ∀y . x = y → y = x (symmetry)3 ∀x . ∀y . ∀z . x = y ∧ y = z → x = z (transitivity)

Q: Is ϕ T -satisfiable?

A: Yes.Q: Is ϕ T -valid?A: Yes. Every structure that satisfies T also satisfies ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 19 / 36

Page 79: Satisfiability Checking - First Order Logic

Example

Σ = {=}ϕ = (x = y ∧ y 6= z)→ x 6= z a Σ-formulaWe now define the Σ-theory T by the following axioms:

1 ∀x . x = x (reflexivity)2 ∀x . ∀y . x = y → y = x (symmetry)3 ∀x . ∀y . ∀z . x = y ∧ y = z → x = z (transitivity)

Q: Is ϕ T -satisfiable?A: Yes.

Q: Is ϕ T -valid?A: Yes. Every structure that satisfies T also satisfies ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 19 / 36

Page 80: Satisfiability Checking - First Order Logic

Example

Σ = {=}ϕ = (x = y ∧ y 6= z)→ x 6= z a Σ-formulaWe now define the Σ-theory T by the following axioms:

1 ∀x . x = x (reflexivity)2 ∀x . ∀y . x = y → y = x (symmetry)3 ∀x . ∀y . ∀z . x = y ∧ y = z → x = z (transitivity)

Q: Is ϕ T -satisfiable?A: Yes.Q: Is ϕ T -valid?

A: Yes. Every structure that satisfies T also satisfies ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 19 / 36

Page 81: Satisfiability Checking - First Order Logic

Example

Σ = {=}ϕ = (x = y ∧ y 6= z)→ x 6= z a Σ-formulaWe now define the Σ-theory T by the following axioms:

1 ∀x . x = x (reflexivity)2 ∀x . ∀y . x = y → y = x (symmetry)3 ∀x . ∀y . ∀z . x = y ∧ y = z → x = z (transitivity)

Q: Is ϕ T -satisfiable?A: Yes.Q: Is ϕ T -valid?A: Yes. Every structure that satisfies T also satisfies ϕ.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 19 / 36

Page 82: Satisfiability Checking - First Order Logic

Example

Σ = {<}ϕ : ∀x . ∃y . y < x a Σ-formulaConsider the Σ-theory T defined by the axioms:

1 ∀x . ∀y . ∀z . x < y ∧ y < z → x < z (transitivity)2 ∀x . ∀y . x < y → ¬(y < x) (anti-symmetry)

Q: Is ϕ T -satisfiable?A: Yes. We construct a model for it:

Domain: Z< means “less than”

Q: Is ϕ T -valid?A: No. We construct a structure to the contrary:

Domain: N0< means “less than”

Prof. Dr. Erika Ábrahám - Satisfiability Checking 20 / 36

Page 83: Satisfiability Checking - First Order Logic

Example

Σ = {<}ϕ : ∀x . ∃y . y < x a Σ-formulaConsider the Σ-theory T defined by the axioms:

1 ∀x . ∀y . ∀z . x < y ∧ y < z → x < z (transitivity)2 ∀x . ∀y . x < y → ¬(y < x) (anti-symmetry)

Q: Is ϕ T -satisfiable?

A: Yes. We construct a model for it:Domain: Z< means “less than”

Q: Is ϕ T -valid?A: No. We construct a structure to the contrary:

Domain: N0< means “less than”

Prof. Dr. Erika Ábrahám - Satisfiability Checking 20 / 36

Page 84: Satisfiability Checking - First Order Logic

Example

Σ = {<}ϕ : ∀x . ∃y . y < x a Σ-formulaConsider the Σ-theory T defined by the axioms:

1 ∀x . ∀y . ∀z . x < y ∧ y < z → x < z (transitivity)2 ∀x . ∀y . x < y → ¬(y < x) (anti-symmetry)

Q: Is ϕ T -satisfiable?A: Yes. We construct a model for it:

Domain: Z< means “less than”

Q: Is ϕ T -valid?A: No. We construct a structure to the contrary:

Domain: N0< means “less than”

Prof. Dr. Erika Ábrahám - Satisfiability Checking 20 / 36

Page 85: Satisfiability Checking - First Order Logic

Example

Σ = {<}ϕ : ∀x . ∃y . y < x a Σ-formulaConsider the Σ-theory T defined by the axioms:

1 ∀x . ∀y . ∀z . x < y ∧ y < z → x < z (transitivity)2 ∀x . ∀y . x < y → ¬(y < x) (anti-symmetry)

Q: Is ϕ T -satisfiable?A: Yes. We construct a model for it:

Domain: Z< means “less than”

Q: Is ϕ T -valid?

A: No. We construct a structure to the contrary:Domain: N0< means “less than”

Prof. Dr. Erika Ábrahám - Satisfiability Checking 20 / 36

Page 86: Satisfiability Checking - First Order Logic

Example

Σ = {<}ϕ : ∀x . ∃y . y < x a Σ-formulaConsider the Σ-theory T defined by the axioms:

1 ∀x . ∀y . ∀z . x < y ∧ y < z → x < z (transitivity)2 ∀x . ∀y . x < y → ¬(y < x) (anti-symmetry)

Q: Is ϕ T -satisfiable?A: Yes. We construct a model for it:

Domain: Z< means “less than”

Q: Is ϕ T -valid?A: No. We construct a structure to the contrary:

Domain: N0< means “less than”

Prof. Dr. Erika Ábrahám - Satisfiability Checking 20 / 36

Page 87: Satisfiability Checking - First Order Logic

Logic fragments

So far we only restricted the non-logical symbols by signatures andtheir interpretation by theories.Sometimes we want to restrict the grammar and the logical symbolsthat we can use as well.These are called logic fragments.Examples:

The quantifier-free fragment over Σ = {0, 1,=,+}The conjunctive fragment over Σ = {0, 1,=,+}

Prof. Dr. Erika Ábrahám - Satisfiability Checking 21 / 36

Page 88: Satisfiability Checking - First Order Logic

Fragments

Let T be a theory with Σ = {} without axioms.

Q: What is the quantifier-free frament of T?A: Propositional logicExample: x1 → (x2 ∨ x3)

Thus, propositional logic is also a first-order theory.(A very degenerate one.)

Q: What is T?A: Quantified Boolean formulae (QBF)Example:

∀x1. ∃x2. ∀x3. x1 → (x2 ∨ x3)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 22 / 36

Page 89: Satisfiability Checking - First Order Logic

Fragments

Let T be a theory with Σ = {} without axioms.Q: What is the quantifier-free frament of T?

A: Propositional logicExample: x1 → (x2 ∨ x3)

Thus, propositional logic is also a first-order theory.(A very degenerate one.)

Q: What is T?A: Quantified Boolean formulae (QBF)Example:

∀x1. ∃x2. ∀x3. x1 → (x2 ∨ x3)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 22 / 36

Page 90: Satisfiability Checking - First Order Logic

Fragments

Let T be a theory with Σ = {} without axioms.Q: What is the quantifier-free frament of T?A: Propositional logicExample: x1 → (x2 ∨ x3)

Thus, propositional logic is also a first-order theory.(A very degenerate one.)

Q: What is T?A: Quantified Boolean formulae (QBF)Example:

∀x1. ∃x2. ∀x3. x1 → (x2 ∨ x3)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 22 / 36

Page 91: Satisfiability Checking - First Order Logic

Fragments

Let T be a theory with Σ = {} without axioms.Q: What is the quantifier-free frament of T?A: Propositional logicExample: x1 → (x2 ∨ x3)

Thus, propositional logic is also a first-order theory.(A very degenerate one.)

Q: What is T?

A: Quantified Boolean formulae (QBF)Example:

∀x1. ∃x2. ∀x3. x1 → (x2 ∨ x3)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 22 / 36

Page 92: Satisfiability Checking - First Order Logic

Fragments

Let T be a theory with Σ = {} without axioms.Q: What is the quantifier-free frament of T?A: Propositional logicExample: x1 → (x2 ∨ x3)

Thus, propositional logic is also a first-order theory.(A very degenerate one.)

Q: What is T?A: Quantified Boolean formulae (QBF)Example:

∀x1. ∃x2. ∀x3. x1 → (x2 ∨ x3)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 22 / 36

Page 93: Satisfiability Checking - First Order Logic

Some famous theories

Presburger arithmetic: Σ = {0, 1,+,=} over integersPeano arithmetic: Σ = {0, 1,+, ∗,=} over integersLinear real argebra: Σ = {0, 1,+,=} over realsReal algebra: Σ = {0, 1,+, ∗,=} over realsTheory of arraysTheory of pointers. . .

Prof. Dr. Erika Ábrahám - Satisfiability Checking 23 / 36

Page 94: Satisfiability Checking - First Order Logic

The algorithmic point of view...

It is also common to present theories NOT through the axioms thatdefine them.The interpretation of symbols is fixed to their common use.

Thus + is plus, . . .

The fragment is defined via grammar rules rather than restrictions onthe generic first-order grammar.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 24 / 36

Page 95: Satisfiability Checking - First Order Logic

The algorithmic point of view...

Example: Equality logicGrammar:formula ::= atom | formula ∧ formula | ¬formula

atom ::= Boolean-variable |variable = variable |variable = constant |constant = constant

Interpretation: = is equality.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 25 / 36

Page 96: Satisfiability Checking - First Order Logic

Expressiveness of a theory

Each formula defines a language:The set of satisfying assignments (models) are the words accepted bythis language.

Consider the fragment ’2-CNF’:

formula ::= (literal ∨ literal) | formula ∧ formulaliteral ::= Boolean-variable | ¬Boolean-variable

Example formula:(x1 ∨ ¬x2) ∧ (¬x3 ∨ x2)

Prof. Dr. Erika Ábrahám - Satisfiability Checking 26 / 36

Page 97: Satisfiability Checking - First Order Logic

Expressiveness of a theory

Now consider the propositional logic formula ϕ : (x1 ∨ x2 ∨ x3)

Q: Can we express this language with 2-CNF?

A: No.Proof:

The language accepted by ϕ has 7 words: all assignments other thanx1 = x2 = x3 = 0 (false).A 2-CNF clause removes 2 assignments, which leaves us with 6accepted words.E.g., (x1 ∨ x2) removes the assignments x1 = x2 = x3 = 0 andx1 = x2 = 0, x3 = 1.Additional clauses only remove more assignments.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 27 / 36

Page 98: Satisfiability Checking - First Order Logic

Expressiveness of a theory

Now consider the propositional logic formula ϕ : (x1 ∨ x2 ∨ x3)

Q: Can we express this language with 2-CNF?A: No.Proof:

The language accepted by ϕ has 7 words: all assignments other thanx1 = x2 = x3 = 0 (false).A 2-CNF clause removes 2 assignments, which leaves us with 6accepted words.E.g., (x1 ∨ x2) removes the assignments x1 = x2 = x3 = 0 andx1 = x2 = 0, x3 = 1.Additional clauses only remove more assignments.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 27 / 36

Page 99: Satisfiability Checking - First Order Logic

Expressiveness of a theory

Now consider the propositional logic formula ϕ : (x1 ∨ x2 ∨ x3)

Q: Can we express this language with 2-CNF?A: No.Proof:

The language accepted by ϕ has 7 words: all assignments other thanx1 = x2 = x3 = 0 (false).A 2-CNF clause removes 2 assignments, which leaves us with 6accepted words.E.g., (x1 ∨ x2) removes the assignments x1 = x2 = x3 = 0 andx1 = x2 = 0, x3 = 1.Additional clauses only remove more assignments.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 27 / 36

Page 100: Satisfiability Checking - First Order Logic

Examples

Languages defined by L1

Languages defined by L2

L2 is more expressive than L1. Notation: L1 ≺ L2.Claim: 2-CNF ≺ propositional logic.Generally there is only a partial order between theories.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 28 / 36

Page 101: Satisfiability Checking - First Order Logic

The Tradeoff

So we see that theories can have different expressive power.Q: Why would we want to restrict ourselves to a theory or a fragment?Why not take some ’maximal theory’?

A: Adding axioms to the theory may make it harder to decide or evenundecidable.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 29 / 36

Page 102: Satisfiability Checking - First Order Logic

The Tradeoff

So we see that theories can have different expressive power.Q: Why would we want to restrict ourselves to a theory or a fragment?Why not take some ’maximal theory’?A: Adding axioms to the theory may make it harder to decide or evenundecidable.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 29 / 36

Page 103: Satisfiability Checking - First Order Logic

Example: Hilbert axiom system (H)

Let H be (M.P) + the following axiom schemas:

A→(B→A) (H1)

((A→(B→C))→((A→B)→(A→C)) (H2)

(¬B→¬A)→(A→B) (H3)

H is sound and complete for propositional logic.This means that with H we can prove any valid propositional formula,and only such formulae. The proof is finite.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 30 / 36

Page 104: Satisfiability Checking - First Order Logic

Example

But there exist first order theories defined by axioms which are notsufficient for proving all T -valid formulae.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 31 / 36

Page 105: Satisfiability Checking - First Order Logic

Example: First Order Peano Arithmetic

Σ = {0, 1,+, ∗,=}Domain: Natural numbersAxioms (“semantics”):

1 ∀x . (x 6= x + 1)2 ∀x . ∀y . (x 6= y)→ (x + 1 6= y + 1)3 Induction4 ∀x . x + 0 = x5 ∀x . ∀y : (x + y) + 1 = x + (y + 1)6 ∀x . x ∗ 0 = 07 ∀x . ∀y . x ∗ (y + 1) = x ∗ y + x

UNDECIDABLE!

Prof. Dr. Erika Ábrahám - Satisfiability Checking 32 / 36

Page 106: Satisfiability Checking - First Order Logic

Reduction: Peano Arithmetic to Presburger Arithmetic

Σ = {0, 1,+,��∗, =}Domain: Natural numbersAxioms (“semantics”):

1 ∀x . (6= x + 1)2 ∀x . ∀y . (x 6= y)→ (x + 1 6= y + 1)3 Induction4 ∀x . x + 0 = x5 ∀x . ∀y . (x + y) + 1 = x + (y + 1)6 (((

(((∀x . x ∗ 0 = 0

7((((

(((((((

(((∀x . ∀y . x ∗ (y + 1) = x ∗ y + x

DECIDABLE!

Prof. Dr. Erika Ábrahám - Satisfiability Checking 33 / 36

Page 107: Satisfiability Checking - First Order Logic

Tradeoff: expressiveness/computational hardness

Prof. Dr. Erika Ábrahám - Satisfiability Checking 34 / 36

Page 108: Satisfiability Checking - First Order Logic

When is a specific theory useful?

Expressible enough to state something interesting.Decidable (or semi-decidable) and more efficiently solvable than richertheories.More expressible, or more natural for expressing some models incomparison to ’leaner’ theories.

Prof. Dr. Erika Ábrahám - Satisfiability Checking 35 / 36

Page 109: Satisfiability Checking - First Order Logic

Expressiveness and complexity

Q1: Let L1 and L2 be two theories whose satisfiability problem isdecidable and in the same complexity class. Is the satisfiability problemof an L1 formula reducible to a satisfiability problem of an L2 formula?

Q2: Let L1 and L2 be two theories whose satisfiability problems arereducible to each other. Are L1 and L2 in the same complexity class?

Prof. Dr. Erika Ábrahám - Satisfiability Checking 36 / 36

Page 110: Satisfiability Checking - First Order Logic

Expressiveness and complexity

Q1: Let L1 and L2 be two theories whose satisfiability problem isdecidable and in the same complexity class. Is the satisfiability problemof an L1 formula reducible to a satisfiability problem of an L2 formula?Q2: Let L1 and L2 be two theories whose satisfiability problems arereducible to each other. Are L1 and L2 in the same complexity class?

Prof. Dr. Erika Ábrahám - Satisfiability Checking 36 / 36