propositional logic example example example · propositional logic example example example consider...

70
Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will win only if the the aquaphobes and vegetarians vote 3 Either John or Peter will win, but not both 4 If it rains, Peter will win. How would these look in propositional logic? NC State University 1 / 32 First-Order Logic

Upload: doandan

Post on 14-Oct-2018

292 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Propositional Logic Example Example

Example

Consider the following sentences:

1 If it rains, the aquaphobes won’t vote2 John will win only if the the aquaphobes and

vegetarians vote3 Either John or Peter will win, but not both4 If it rains, Peter will win.

How would these look in propositional logic?

NC State University 1 / 32First-Order Logic

Page 2: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Propositional Logic Example Example

Representation

• R (It rains); A (Aquaphobes Vote); J (John Wins); V(Vegetarians Vote); P (Peter Wins)

1 If it rains, the aquaphobes won’t vote:2 John will win only if the aquaphobes and vegetarians

vote:3 Either John or Peter will win, but not both:4 If it rains, Peter will win:

NC State University 2 / 32First-Order Logic

Page 3: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Propositional Logic Example Example

Representation

• R (It rains); A (Aquaphobes Vote); J (John Wins); V(Vegetarians Vote); P (Peter Wins)

1 If it rains, the aquaphobes won’t vote: R→ ¬A2 John will win only if the aquaphobes and vegetarians

vote:3 Either John or Peter will win, but not both:4 If it rains, Peter will win:

NC State University 2 / 32First-Order Logic

Page 4: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Propositional Logic Example Example

Representation

• R (It rains); A (Aquaphobes Vote); J (John Wins); V(Vegetarians Vote); P (Peter Wins)

1 If it rains, the aquaphobes won’t vote: R→ ¬A2 John will win only if the aquaphobes and vegetarians

vote: A ∧ V → J3 Either John or Peter will win, but not both:4 If it rains, Peter will win:

NC State University 2 / 32First-Order Logic

Page 5: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Propositional Logic Example Example

Representation

• R (It rains); A (Aquaphobes Vote); J (John Wins); V(Vegetarians Vote); P (Peter Wins)

1 If it rains, the aquaphobes won’t vote: R→ ¬A2 John will win only if the aquaphobes and vegetarians

vote: A ∧ V → J3 Either John or Peter will win, but not both:(J ∨ P) ∧ ¬(J ∧ P)

4 If it rains, Peter will win:

NC State University 2 / 32First-Order Logic

Page 6: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Propositional Logic Example Example

Representation

• R (It rains); A (Aquaphobes Vote); J (John Wins); V(Vegetarians Vote); P (Peter Wins)

1 If it rains, the aquaphobes won’t vote: R→ ¬A2 John will win only if the aquaphobes and vegetarians

vote: A ∧ V → J3 Either John or Peter will win, but not both:(J ∨ P) ∧ ¬(J ∧ P)

4 If it rains, Peter will win: R→ P

NC State University 2 / 32First-Order Logic

Page 7: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Propositional Logic Example Example

More Examples

Consider the following sentences:

• Tweety has feathers.• Donald has feathers.• John is the son of Jack.• If it rains, aquaphobes won’t vote.• If it is cloudy, some aquaphobes will vote.

Convert them into propositional logic.

NC State University 3 / 32First-Order Logic

Page 8: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL Motivation

Problems with Propositional Logic

• Propositional logic does not allow us to formulategeneral rules or represent relations and is declarative

• Meaning in propositional logic iscontext-independent

• Propositional logic has very limited expressive power• Reasons:

• No “domain” variables• No quantification

• Solution:• Introduce domain variables and quantification• FOL

NC State University 4 / 32First-Order Logic

Page 9: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL Motivation

First Order Logic and PropositionalLogic

Propositional logic assumes the world contains facts.

First-order logic assumes the world contains:

• Objects: people, houses, numbers, colors, baseballgames, wars, . . .

• Relations: red, round, siblingof, biggerthan, partof,comesbetween, . . .

• Functions: onemorethan, plus, . . .

NC State University 5 / 32First-Order Logic

Page 10: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL Motivation

First Order Logic and PropositionalLogic . . .

Ontological commitment

what a representation assumes about existence.Temporal logic assumes that facts hold at specific times.Higher-order logic takes relations and functions of FOL tobe objects themselves.

Epistemological commitment

what can be known about what exists.In PL and FOL, sentences are believed to be true or false(or to have an unknown value).

NC State University 6 / 32First-Order Logic

Page 11: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL Motivation

First Order Logic and PropositionalLogic . . .

Ontological commitment

what a representation assumes about existence.Temporal logic assumes that facts hold at specific times.Higher-order logic takes relations and functions of FOL tobe objects themselves.

Epistemological commitment

what can be known about what exists.In PL and FOL, sentences are believed to be true or false(or to have an unknown value).NC State University 6 / 32

First-Order Logic

Page 12: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Parts of Formulas

Formulas have:

• Variables:• x,y,z• Can be instantiated

• Functions:• f,g,h• mappings

• Constants:• 3, John• Individuals

• Predicates:• P(x,y)• functions whose range

is {True,False}• Quantifiers:

• ∀ for all• ∃ there exists

NC State University 7 / 32First-Order Logic

Page 13: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

FOL: WFFs

A term is

• A constant, or• A variable, or• f (t1, t2, . . . , tn) where f is an n-ary function symbol,

and ti are terms

NC State University 8 / 32First-Order Logic

Page 14: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

FOL: WFFs

Atom

If P is an n-place predicate symbol, and t1, t2, . . . , tn areterms, then

P(t1, . . . , tn)

is an atom. It is sometimes referred to as an atomicformula.

Examples

• Reigns(Pope-Innocent-III, Europe, 1200)• Reigns(You, World, 2013)

NC State University 9 / 32First-Order Logic

Page 15: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

FOL: WFFs. . .

A sentence in FOL is either an atomic sentence orcomplex sentence.

A complex sentence is defined as:Complex sentence:

Sentence, or¬ Sentence, orSentence ∧ Sentence, orSentence ∨ Sentence, orQuantifier Variable Sentence

NC State University 10 / 32First-Order Logic

Page 16: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Quantification

Universal

∀〈Variables〉〈Sentence〉Everyone at NCSU is smart: ∀xAt(x,NCSU)→ Smart(x)∀xP is true in a model m iff P is true where x is eachpossible object in the model.

Existential

∃〈Variables〉〈Sentence〉Someone at NCSU is smart: ∃xAt(x,NCSU) ∧ Smart(x)∃xP is true in a model m iff P is true where x is somepossible object in the model.

NC State University 11 / 32First-Order Logic

Page 17: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Quantification

Universal

∀〈Variables〉〈Sentence〉Everyone at NCSU is smart: ∀xAt(x,NCSU)→ Smart(x)∀xP is true in a model m iff P is true where x is eachpossible object in the model.

Existential

∃〈Variables〉〈Sentence〉Someone at NCSU is smart: ∃xAt(x,NCSU) ∧ Smart(x)∃xP is true in a model m iff P is true where x is somepossible object in the model.NC State University 11 / 32

First-Order Logic

Page 18: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Quantification

Question: What do the following mean?

• ∀xAt(x,NCSU) ∧ Smart(x)• ∃xAt(x,NCSU)→ Smart(x)

NC State University 12 / 32First-Order Logic

Page 19: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Quantification . . .

∃x∃y is the same as ∃y∃x. ∀x∀y is the same as ∀y∀x.

But... ∀x∃y is not the same as ∃x∀y.

Consider:∃x∀yLoves(x, y)∀y∃xLoves(x, y)∀x∃yLoves(x, y)

NC State University 13 / 32First-Order Logic

Page 20: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Quantification . . .

∃x∃y is the same as ∃y∃x. ∀x∀y is the same as ∀y∀x.

But... ∀x∃y is not the same as ∃x∀y.

Consider:∃x∀yLoves(x, y)“There is a person who loves everyone in the world”

∀y∃xLoves(x, y)∀x∃yLoves(x, y)

NC State University 13 / 32First-Order Logic

Page 21: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Quantification . . .

∃x∃y is the same as ∃y∃x. ∀x∀y is the same as ∀y∀x.

But... ∀x∃y is not the same as ∃x∀y.

Consider:∃x∀yLoves(x, y)“There is a person who loves everyone in the world”

∀y∃xLoves(x, y)“Everyone in the world is loved by at least one person”

∀x∃yLoves(x, y)

NC State University 13 / 32First-Order Logic

Page 22: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Quantification . . .

∃x∃y is the same as ∃y∃x. ∀x∀y is the same as ∀y∀x.

But... ∀x∃y is not the same as ∃x∀y.

Consider:∃x∀yLoves(x, y)“There is a person who loves everyone in the world”

∀y∃xLoves(x, y)“Everyone in the world is loved by at least one person”

∀x∃yLoves(x, y)“Everyone in the world loves at least one person”NC State University 13 / 32

First-Order Logic

Page 23: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Quantification . . .

Quantifier duality: each can be expressed using the other.

∀xLikes(x, IceCream)

¬∃x¬Likes(x, IceCream)

And...

∃xLikes(x,Broccoli)¬∀x¬Likes(x,Broccoli)

NC State University 14 / 32First-Order Logic

Page 24: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

Free vs Bound Variables

Definition

An occurrence of a variable in a formula is bound iff theoccurrence is in the scope of a quantifier employing thevariable; otherwise it is free.

Examples

• ∀x.P(x, y)• x is bound• y is free

Predicate calculus requires all variables to be bound.NC State University 15 / 32

First-Order Logic

Page 25: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

FOL WFFS

More Examples

Consider the sample sentences again:

• Tweety has feathers.• Donald has feathers.• John is the son of Jack.• If it rains, aquaphobes won’t vote• If it is cloudy, some aquaphobes will vote

Convert them into Predicate Logic.

NC State University 16 / 32First-Order Logic

Page 26: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

A few conventions for FOL

It is important to standardize a few thing to start with:

• Variables will always be lower case letters• Constants will always be upper case letters• Try not to use the same name for a function and a

predicate• predicateName/n represents a predicate that can

taken n arguments• A predicate may never be nested within another!

NC State University 17 / 32First-Order Logic

Page 27: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Example - Affine Spaces Theorem

Lexicon:Constants: noneVariables: x, yFunctions: nonePredicates:

affine(x) – x is an affine spaceperequiv(x,y) – spaces x and y are perceptuallyequivalenteuclidean(x) – x is a Euclidean spacelive(x) – we live in space xtrans(x,y) – space y is a transformation of space x

NC State University 18 / 32First-Order Logic

Page 28: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Example - Affine Spaces Theorem

Consider the sentences:

1 All affine spaces are perceptually equivalent.2 All Euclidean spaces are affine.3 Not all affine spaces are Euclidean.4 The space we live in is Euclidean.5 Not all transformations produce affine spaces.

Prove that:all affine transformations of the space we live in areperceptually equivalent to it.

NC State University 19 / 32First-Order Logic

Page 29: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Affine Spaces . . .

1 All affine spaces are perceptually equivalent.2 All Euclidean spaces are affine.3 Not all affine spaces are Euclidean.4 The space we live in is Euclidean.5 Not all transformations produce affine spaces.

NC State University 20 / 32First-Order Logic

Page 30: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Affine Spaces . . .

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))

2 All Euclidean spaces are affine.3 Not all affine spaces are Euclidean.4 The space we live in is Euclidean.5 Not all transformations produce affine spaces.

NC State University 20 / 32First-Order Logic

Page 31: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Affine Spaces . . .

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))

2 All Euclidean spaces are affine.∀x(euclidean(x)→ affine(x))

3 Not all affine spaces are Euclidean.4 The space we live in is Euclidean.5 Not all transformations produce affine spaces.

NC State University 20 / 32First-Order Logic

Page 32: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Affine Spaces . . .

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))

2 All Euclidean spaces are affine.∀x(euclidean(x)→ affine(x))

3 Not all affine spaces are Euclidean.∃x(affine(x) ∧ ¬euclidean(x))

4 The space we live in is Euclidean.5 Not all transformations produce affine spaces.

NC State University 20 / 32First-Order Logic

Page 33: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Affine Spaces . . .

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))

2 All Euclidean spaces are affine.∀x(euclidean(x)→ affine(x))

3 Not all affine spaces are Euclidean.∃x(affine(x) ∧ ¬euclidean(x))

4 The space we live in is Euclidean.∀x(live(x)→ euclidean(x))

5 Not all transformations produce affine spaces.

NC State University 20 / 32First-Order Logic

Page 34: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Affine Spaces . . .

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))

2 All Euclidean spaces are affine.∀x(euclidean(x)→ affine(x))

3 Not all affine spaces are Euclidean.∃x(affine(x) ∧ ¬euclidean(x))

4 The space we live in is Euclidean.∀x(live(x)→ euclidean(x))

5 Not all transformations produce affine spaces.∃x(∃y(trans(x, y) ∧ ¬affine(y)))

NC State University 20 / 32First-Order Logic

Page 35: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Affine Spaces . . .

Conclusion:all affine transformations of the space we livein are perceptually equivalent to it.

NC State University 21 / 32First-Order Logic

Page 36: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Predicate Logic

Affine Spaces . . .

Conclusion:all affine transformations of the space we livein are perceptually equivalent to it.∀x(∀y(live(x) ∧ trans(x, y) ∧ affine(y)→ perequiv(x, y)))

NC State University 21 / 32First-Order Logic

Page 37: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL

So, how do we prove a theorem?

In order to prove a theorem, we must:

• represent the given sentences in CNF• negate the conclusion – since we are proving by

contradiction• iteratively find a pair of clauses that can be resolved

till we reach a contradiction

NC State University 22 / 32First-Order Logic

Page 38: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL

So, how do we prove a theorem?

In order to prove a theorem, we must:

• represent the given sentences in CNF• negate the conclusion – since we are proving by

contradiction• iteratively find a pair of clauses that can be resolved

till we reach a contradiction

NC State University 22 / 32First-Order Logic

Page 39: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

CNF in predicate Logic

Consider the following clauses and identify which ofthese are in CNF (textbook, p. 346):

• ∀x p(x)→ q(x)• ¬∀x P(x) ∨ Q(x)• ∀x P(x)∨ ∃x Q(x)• ∀x∃y P(x) ∨ Q(y)

NC State University 23 / 32First-Order Logic

Page 40: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

CNF in predicate Logic

Consider the following clauses and identify which ofthese are in CNF (textbook, p. 346):

• ∀x p(x)→ q(x)Remove ‘→’: ∀x ¬p(x) ∨ q(x)

• ¬∀x P(x) ∨ Q(x)• ∀x P(x)∨ ∃x Q(x)• ∀x∃y P(x) ∨ Q(y)

NC State University 23 / 32First-Order Logic

Page 41: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

CNF in predicate Logic

Consider the following clauses and identify which ofthese are in CNF (textbook, p. 346):

• ∀x p(x)→ q(x)Remove ‘→’: ∀x ¬p(x) ∨ q(x)

• ¬∀x P(x) ∨ Q(x)Move the negation inwards: ∃x ¬P(x) ∧ ¬Q(x)

• ∀x P(x)∨ ∃x Q(x)• ∀x∃y P(x) ∨ Q(y)

NC State University 23 / 32First-Order Logic

Page 42: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

CNF in predicate Logic

Consider the following clauses and identify which ofthese are in CNF (textbook, p. 346):

• ∀x p(x)→ q(x)Remove ‘→’: ∀x ¬p(x) ∨ q(x)

• ¬∀x P(x) ∨ Q(x)Move the negation inwards: ∃x ¬P(x) ∧ ¬Q(x)

• ∀x P(x)∨ ∃x Q(x)Standardize the variables: ∀x1 P(x1)∨ ∃x2 Q(x2)

• ∀x∃y P(x) ∨ Q(y)

NC State University 23 / 32First-Order Logic

Page 43: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

CNF in predicate Logic

Consider the following clauses and identify which ofthese are in CNF (textbook, p. 346):

• ∀x p(x)→ q(x)Remove ‘→’: ∀x ¬p(x) ∨ q(x)

• ¬∀x P(x) ∨ Q(x)Move the negation inwards: ∃x ¬P(x) ∧ ¬Q(x)

• ∀x P(x)∨ ∃x Q(x)Standardize the variables: ∀x1 P(x1)∨ ∃x2 Q(x2)

• ∀x∃y P(x) ∨ Q(y)Interesting...

NC State University 23 / 32First-Order Logic

Page 44: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

CNF in predicate Logic

Consider the following clauses and identify which ofthese are in CNF (textbook, p. 346):

• ∀x p(x)→ q(x)Remove ‘→’: ∀x ¬p(x) ∨ q(x)

• ¬∀x P(x) ∨ Q(x)Move the negation inwards: ∃x ¬P(x) ∧ ¬Q(x)

• ∀x P(x)∨ ∃x Q(x)Standardize the variables: ∀x1 P(x1)∨ ∃x2 Q(x2)

• ∀x∃y P(x) ∨ Q(y)Interesting...

By the way, none of these are in CNF yet!!NC State University 23 / 32

First-Order Logic

Page 45: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Dealing with Quantifiers

We can handle ‘∃’ as follows:

• We eliminate the ‘∃’ by a process calledSkolemization

• We will use special terms called Skolem Constantsand Skolem Functions

• Consider:• ∀x∃y P(x) ∨ Q(y)

• ∃x∀y P(x) ∨ Q(y)

Once this is complete, we can drop the ‘∀’ quantifierwithout any change to the corresponding variables.

NC State University 24 / 32First-Order Logic

Page 46: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Dealing with Quantifiers

We can handle ‘∃’ as follows:

• We eliminate the ‘∃’ by a process calledSkolemization

• We will use special terms called Skolem Constantsand Skolem Functions

• Consider:• ∀x∃y P(x) ∨ Q(y)

Replace y with Skolem function ‘f (x)’: ∀x P(x)∨Q(f (x))

• ∃x∀y P(x) ∨ Q(y)

Once this is complete, we can drop the ‘∀’ quantifierwithout any change to the corresponding variables.NC State University 24 / 32

First-Order Logic

Page 47: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Dealing with Quantifiers

We can handle ‘∃’ as follows:

• We eliminate the ‘∃’ by a process calledSkolemization

• We will use special terms called Skolem Constantsand Skolem Functions

• Consider:• ∀x∃y P(x) ∨ Q(y)

Replace y with Skolem function ‘f (x)’: ∀x P(x)∨Q(f (x))

• ∃x∀y P(x) ∨ Q(y)Replace x with Skolem constant ‘X1’: ∀y P(X1) ∨ Q(y)

Once this is complete, we can drop the ‘∀’ quantifierwithout any change to the corresponding variables.NC State University 24 / 32

First-Order Logic

Page 48: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Example

• ∀x∃y(man(x)→ woman(y) ∧ loves(x, y))• ∃x∀y∀z∃u∀v∃w P(x, y, z, u, v,w)

• ∃x→ A• ∃u→ f (y, z)• ∃w→ g(y, z, v)

NC State University 25 / 32First-Order Logic

Page 49: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Example

• ∀x∃y(man(x)→ woman(y) ∧ loves(x, y))∀x(man(x)→ woman(f (x)) ∧ loves(x, f (x))

• ∃x∀y∀z∃u∀v∃w P(x, y, z, u, v,w)

• ∃x→ A• ∃u→ f (y, z)• ∃w→ g(y, z, v)

NC State University 25 / 32First-Order Logic

Page 50: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Example

• ∀x∃y(man(x)→ woman(y) ∧ loves(x, y))∀x(man(x)→ woman(f (x)) ∧ loves(x, f (x))

• ∃x∀y∀z∃u∀v∃w P(x, y, z, u, v,w)• ∃x→ A

• ∃u→ f (y, z)• ∃w→ g(y, z, v)

NC State University 25 / 32First-Order Logic

Page 51: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Example

• ∀x∃y(man(x)→ woman(y) ∧ loves(x, y))∀x(man(x)→ woman(f (x)) ∧ loves(x, f (x))

• ∃x∀y∀z∃u∀v∃w P(x, y, z, u, v,w)• ∃x→ A• ∃u→ f (y, z)

• ∃w→ g(y, z, v)

NC State University 25 / 32First-Order Logic

Page 52: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Example

• ∀x∃y(man(x)→ woman(y) ∧ loves(x, y))∀x(man(x)→ woman(f (x)) ∧ loves(x, f (x))

• ∃x∀y∀z∃u∀v∃w P(x, y, z, u, v,w)• ∃x→ A• ∃u→ f (y, z)• ∃w→ g(y, z, v)

NC State University 25 / 32First-Order Logic

Page 53: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Example

• ∀x∃y(man(x)→ woman(y) ∧ loves(x, y))∀x(man(x)→ woman(f (x)) ∧ loves(x, f (x))

• ∃x∀y∀z∃u∀v∃w P(x, y, z, u, v,w)• ∃x→ A• ∃u→ f (y, z)• ∃w→ g(y, z, v)

∀y∀z∀v P(A, y, z, f (y, z), v, g(y, z, v))

NC State University 25 / 32First-Order Logic

Page 54: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Back to Affine Spaces . . .

Convert the sentences into CNF:

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))

2 All Euclidean spaces are affine.∀x(euclidean(x)→ affine(x))

3 Not all affine spaces are Euclidean.∃x(affine(x) ∧ ¬euclidean(x))

NC State University 26 / 32First-Order Logic

Page 55: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Back to Affine Spaces . . .

Convert the sentences into CNF:

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))¬affine(x) ∨ ¬affine(y) ∨ perequiv(x, y)

2 All Euclidean spaces are affine.∀x(euclidean(x)→ affine(x))

3 Not all affine spaces are Euclidean.∃x(affine(x) ∧ ¬euclidean(x))

NC State University 26 / 32First-Order Logic

Page 56: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Back to Affine Spaces . . .

Convert the sentences into CNF:

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))¬affine(x) ∨ ¬affine(y) ∨ perequiv(x, y)

2 All Euclidean spaces are affine.∀x(euclidean(x)→ affine(x))¬euclidean(x) ∨ affine(x)

3 Not all affine spaces are Euclidean.∃x(affine(x) ∧ ¬euclidean(x))

NC State University 26 / 32First-Order Logic

Page 57: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Back to Affine Spaces . . .

Convert the sentences into CNF:

1 All affine spaces are perceptually equivalent.∀x(∀y(affine(x) ∧ affine(y)→ perequiv(x, y)))¬affine(x) ∨ ¬affine(y) ∨ perequiv(x, y)

2 All Euclidean spaces are affine.∀x(euclidean(x)→ affine(x))¬euclidean(x) ∨ affine(x)

3 Not all affine spaces are Euclidean.∃x(affine(x) ∧ ¬euclidean(x))affine(A) ∧ ¬euclidean(A)

NC State University 26 / 32First-Order Logic

Page 58: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Back to Affine Spaces . . .

Convert the sentences into CNF:

1 The space we live in is Euclidean.∀x(live(x)→ euclidean(x))

2 Not all transformations produce affine spaces.∃x(∃y(trans(x, y) ∧ ¬affine(y)))

NC State University 27 / 32First-Order Logic

Page 59: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Back to Affine Spaces . . .

Convert the sentences into CNF:

1 The space we live in is Euclidean.∀x(live(x)→ euclidean(x))¬live(x) ∨ euclidean(x)

2 Not all transformations produce affine spaces.∃x(∃y(trans(x, y) ∧ ¬affine(y)))

NC State University 27 / 32First-Order Logic

Page 60: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Back to Affine Spaces . . .

Convert the sentences into CNF:

1 The space we live in is Euclidean.∀x(live(x)→ euclidean(x))¬live(x) ∨ euclidean(x)

2 Not all transformations produce affine spaces.∃x(∃y(trans(x, y) ∧ ¬affine(y)))trans(B,C) ∧ ¬affine(C)

NC State University 27 / 32First-Order Logic

Page 61: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Negated Conclusion for Affine Spaces

Conclusion:

All affine transformations of the space we live in areperceptually equivalent to it.

∀x(∀y(live(x) ∧ trans(x, y) ∧ affine(y)→ perequiv(x, y)))

NC State University 28 / 32First-Order Logic

Page 62: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Negated Conclusion for Affine Spaces

Negated Conclusion:

¬∀x(∀y(live(x) ∧ trans(x, y) ∧ affine(y)→perequiv(x, y)))

⇒ ¬∀x(∀y(¬(live(x) ∧ trans(x, y) ∧ affine(y)) ∨perequiv(x, y)))

⇒ ∃x(∃y(live(x) ∧ trans(x, y) ∧ affine(y) ∧¬perequiv(x, y)))

⇒ live(D) ∧ trans(D,E) ∧ affine(E) ∧ ¬perequiv(D,E)

NC State University 29 / 32First-Order Logic

Page 63: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Negated Conclusion for Affine Spaces

Negated Conclusion:

¬∀x(∀y(live(x) ∧ trans(x, y) ∧ affine(y)→perequiv(x, y)))

⇒ ¬∀x(∀y(¬(live(x) ∧ trans(x, y) ∧ affine(y)) ∨perequiv(x, y)))

⇒ ∃x(∃y(live(x) ∧ trans(x, y) ∧ affine(y) ∧¬perequiv(x, y)))

⇒ live(D) ∧ trans(D,E) ∧ affine(E) ∧ ¬perequiv(D,E)

NC State University 29 / 32First-Order Logic

Page 64: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Negated Conclusion for Affine Spaces

Negated Conclusion:

¬∀x(∀y(live(x) ∧ trans(x, y) ∧ affine(y)→perequiv(x, y)))

⇒ ¬∀x(∀y(¬(live(x) ∧ trans(x, y) ∧ affine(y)) ∨perequiv(x, y)))

⇒ ∃x(∃y(live(x) ∧ trans(x, y) ∧ affine(y) ∧¬perequiv(x, y)))

⇒ live(D) ∧ trans(D,E) ∧ affine(E) ∧ ¬perequiv(D,E)

NC State University 29 / 32First-Order Logic

Page 65: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Negated Conclusion for Affine Spaces

Negated Conclusion:

¬∀x(∀y(live(x) ∧ trans(x, y) ∧ affine(y)→perequiv(x, y)))

⇒ ¬∀x(∀y(¬(live(x) ∧ trans(x, y) ∧ affine(y)) ∨perequiv(x, y)))

⇒ ∃x(∃y(live(x) ∧ trans(x, y) ∧ affine(y) ∧¬perequiv(x, y)))

⇒ live(D) ∧ trans(D,E) ∧ affine(E) ∧ ¬perequiv(D,E)

NC State University 29 / 32First-Order Logic

Page 66: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Conversion to CNF

Negated Conclusion for Affine Spaces

Negated Conclusion:

¬∀x(∀y(live(x) ∧ trans(x, y) ∧ affine(y)→perequiv(x, y)))

⇒ ¬∀x(∀y(¬(live(x) ∧ trans(x, y) ∧ affine(y)) ∨perequiv(x, y)))

⇒ ∃x(∃y(live(x) ∧ trans(x, y) ∧ affine(y) ∧¬perequiv(x, y)))

⇒ live(D) ∧ trans(D,E) ∧ affine(E) ∧ ¬perequiv(D,E)

NC State University 29 / 32First-Order Logic

Page 67: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Resolution

Resolution

Consider:

¬euclidean(x2) ∨ affine(x2)

¬affine(c)

These have a pair of complementary predicates. But, canwe resolve them? If so, how?

Now assume:

¬euclidean(x2) ∨ affine(f (x2))

¬affine(c)

Can we resolve them? If so, how?

The idea is to make the 2 predicates ‘similar’ so that theycan be resolved. So, we try to find a set of substitutionsthat unify the predicates.

NC State University 30 / 32First-Order Logic

Page 68: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Resolution

Substitutions

Definition

A substitution is a set of pairs {t1/v1, t2/v2, . . . , tn/vn},where the ti are terms, the vi are variables, and no two viare the same.

Substitutions always replace variables with terms. Legalsubstitutions are

• constant-for-var• function-for-var• var-for-var

The vars substituted for may occur in either literal.

Example:

p(x,A, f (g(y)), z) and ¬p(C, s, f (t),C) unify under thesubstitution:

{C/x,A/s, g(y)/t,C/z}

NC State University 31 / 32First-Order Logic

Page 69: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Resolution

Substitutions

Definition

A substitution is a set of pairs {t1/v1, t2/v2, . . . , tn/vn},where the ti are terms, the vi are variables, and no two viare the same.

Substitutions always replace variables with terms. Legalsubstitutions are

• constant-for-var• function-for-var• var-for-var

The vars substituted for may occur in either literal.

Example:

p(x,A, f (g(y)), z) and ¬p(C, s, f (t),C) unify under thesubstitution: {C/x,A/s, g(y)/t,C/z}

NC State University 31 / 32First-Order Logic

Page 70: Propositional Logic Example Example Example · Propositional Logic Example Example Example Consider the following sentences: 1 If it rains, the aquaphobes won’t vote 2 John will

Theorem Proving with FOL Resolution

Unification

Definition

The process of finding a substitution that makes twoliterals complementary is called unification.

Two literals for which a unifying substitution exists arecalled unifiable.Importance of Unification

• It is the basis for FOL resolution.• It is the main way rule-based systems determine

which rules apply in a situation.• It is the way variables are treated in logic

programming.NC State University 32 / 32First-Order Logic