0% found this document useful (0 votes)
488 views

Predicate Logic

Propositional logic has limitations for representing certain types of inferences that involve objects or individuals. First-order logic addresses these limitations by adding terms to represent objects, predicates to make statements about objects, and quantifiers to make generalizations. Resolution theorem proving is an effective method for automated reasoning in first-order logic, but it requires converting statements to conjunctive normal form and using unification to handle variables during the resolution process.

Uploaded by

Mahbubur Rahman
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
488 views

Predicate Logic

Propositional logic has limitations for representing certain types of inferences that involve objects or individuals. First-order logic addresses these limitations by adding terms to represent objects, predicates to make statements about objects, and quantifiers to make generalizations. Resolution theorem proving is an effective method for automated reasoning in first-order logic, but it requires converting statements to conjunctive normal form and using unification to handle variables during the resolution process.

Uploaded by

Mahbubur Rahman
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Limitations of Propositional Logic

• Many kinds of inference cannot be formalized in


propositional logic. For example, most useful inferences
involve applying a general rule to a specific case. But
Artificial Intelligence general-to-specific inferences like the following cannot
be formalized in propositional logic.
– All men are mortal
First-order logic
– Socrates is a man
Conjunctive normal form – Therefore, Socrates is mortal
Resolution theorem-proving • This inference cannot be formalized in propositional
logic because it refers to individual men, such as
Socrates, and make generalizations about all men.

Terms
First-Order Logic (FOL) • First-order logic has terms that represent objects or
individuals. Terms are built using constant, variable,
• Propositional logic has only sentences, which represent and function symbols.
facts. – Constants (designate specific object): A, B, John,
• First-order logic extends propositional logic in two Red, etc.
directions – Variables (designate unspecified object): x, y, z, etc.
– It provides an inner structure for sentences. They are – Functions (designate a specific object related in a
viewed as expressing relations between objects or certain way to another object, or objects):
individuals. FatherOf, ColorOf, etc.
– It provides a means to express, and reason with, • Examples of terms:
generalizations. It makes it possible to say that a
certain property holds of all objects, of some objects, – ColorOf(CarOf(Bill)),
or of no object. CostOf(TextbookOf(CMPSCI383)), etc.
• Ground terms are terms that include no variables.

Predicates
Universal Quantifier
• Predicates have a value of true or false
• A predicate can take arguments, which are terms ∀x P(x) means “for all x, P of x is true”
• A predicate with one argument expresses a property of
Example: ∀x Happy(x)
an object
If the universe of discourse is people, then this
– Student(Bob)
means that everyone is happy.
• A predicate with two or more arguments expresses a
relation between objects Other examples:
– likes(Bob, Mary) ∀x ∀y Knows(x,y) => Knows(y,x)
– likes(Bob, school-of (Bob)) ∀x ∀y Knows(x,y) ^ Knows(y,x)
• A predicate with no arguments is a simple proposition, ∀x ∀y Knows(x,y) => ¬ Likes(y,x)
as in propositional logic

1
Relationship between Universal
Existential Quantifier and Existential Quantifiers
∃x P(x) means “there exists at least one x for ∀x ¬ P(x) <=> ¬∃x P(x)
which P of x is true” ¬∀x P(x) <=> ∃x ¬P(x)
Example: ∃x Happy(x) ∀x P(x) <=> ¬∃x ¬ P(x)
If the universe of discourse is people, then this ∃x P(x) <=> ¬∀x ¬ P(x)
means there is at least one happy person. Examples:
Other examples: ¬∃y Happy(y) <=> ∀y ¬ Happy(y)
∀x ∃y Knows(x,y) ∃y ¬Happy(y) <=> ¬ ∀y Happy(y)
∃x ∃y Knows(x,y) ^ Knows(y,x) ∀x ¬ Likes(x,Jane) <=> ¬∃x Likes(x,Jane)
∀x ∃y Knows(x,y) => ¬ Likes(y,x) ∀x Likes(x,Jane) <=> ¬∃x ¬Likes(x,Jane)

Scope of Quantifiers Order matters: Some examples


• The scope of a quantifier extends ∀x ∃y Likes(x,y)
throughout the expression unless the same
variable is re-quantified. ∃y ∀x Likes(x,y)
• Examples: ∀x ∃y Married(x,y)
∀x ∃y¬ Likes(x,y) ∧ ∃y Married(x,y) ∃y ∀x Married(x,y)
∀x ∃y¬ Likes(x,y)∧ ∃z Married(x,z) ¬∀x ∃y Married(x,y)
∀x ∃y ∃z ¬ Likes(x,y) ∧ Married(x,z)
∀x ∃y¬ Likes(x,y) ∧ Married(x,y)
¬∃y ∀x Married(x,y)

Translate from English to FOL Translate from English to FOL


• All people like dogs.
• Some people like cats. • All CS students are smart.
• Some dogs do not like any cats.
• People who like cats are nice but are not happy. • Some CS students study music.
• Cats and dogs are both types of animals.
• My cat named Fred likes a dog named Dolly but
• Not all CS students study music.
does not like a dog named Max.
• Happy people are not sad.
• Everybody has a mother.

2
Translate from English to FOL The Semantics of FOL
• You can fool some of the people all of the time.
• An interpretation is a set of objects and a
mapping from each constant, functional symbol
• You can’t fool all of the people all of the time. and predicate to an appropriate object, function
and relation in the domain.
• A sentence can be valid, satisfiable, or
• There is one and only one Pope. unsatisfiable, just as in propositional logic.

Inference in First-Order Logic Resolution


• Godel (1930) proved that FOL is complete, • Assumes normal form
which means that a proof can be found for any • Using conjunctive normal form
valid sentence
From (A∨B) ∧(¬A∨C) infer (A∨C)
• However, it was not until 1965 that Robinson
developed the first algorithm for finding proofs • Using implicative normal form
in FOL, called resolution refutation From (¬A B)∧(B C) infer (¬A C)
  

• (Truth tables don’t work in FOL because


sentences with variables can have an infinite
number of possible interpretations.)

Resolution Refutation Resolution in FOL


• To generalize resolution refutation from propositional
To prove that a sentence p can be derived from a set of
logic to FOL, we have to answer two questions:
sentences KB:
– How do we convert a sentence to normal form (for
– Convert ¬p and the sentences in KB to CNF. example, CNF) when it contains quantifiers?
– Repeat until the empty clause results (a contradiction) – How do we detect that two literals contradict each
or no clauses can be resolved other (and so can be resolved) when they contain
• Find two clauses to which the resolution rule variables?
applies, but has not previously been applied. • The answer to the 2nd question involves the concept of
“unification,” discovered by Robinson.
• Apply the resolution rule to create a new clause.
• Conversion to normal form and unificationare the two
– If terminate with empty clause, p is proved. complicated aspects of resolution theorem-proving in
Otherwise, p cannot be proved. FOL, and so we must discuss them in detail

3
Normal Form Converting to CNF
• It is easier for a computer to perform logical inference 1) Eliminate the ⇔ connective using the equivalence
if we convert all sentences into a “normal form.” Any between P⇔Q and (P Q)∧(Q P)
 

sentence of first-order logic can be transformed into an 2) Eliminate the connective using the equivalence
between P Q and ¬P ∨ Q


equivalent sentence in either of these normal forms. 

• In conjunctive normal form (CNF), every sentence is 3) Move negation symbols inward, using the following
expressed as a conjunction of clauses (where a clause is equivalences:
a disjunction of literals) • ¬(P∨Q) becomes ¬P∧¬Q
• ¬(P∧Q) becomes ¬P∨¬Q
(P(x)∨R(x,y)) ∧ (¬S(y)∨R(y,z)) ∧ T(y)
• ¬∀xP becomes ∃x¬P
• In implicative normal form, every sentence is
• ¬∃xP becomes ∀x¬P
expressed as an implication with a conjunction of atoms
• ¬ ¬ P becomes P
on the left and a disjunction of atoms on the right
P(x) ∧ Q(x,y)  S(y) ∨ T(x,y)

Converting to CNF (continued)


4) Standardize variable names so that each
Converting to CNF (continued)
quantifier has its own unique variable name.
∀xP ∨ ∃yQ becomes ∀x∃y P∨Q 8) Use distributive law to convert to CNF
5) Move all quantifiers to the left of the sentence (P∧Q)∨R becomes (P∨R)∧(Q∨R)
(preserving their order). 9) Flatten nested conjunctions and disjunctions
∀xP ∨ ∃yQ becomes ∀x∃y P∨Q (P∨Q) ∨R becomes (P ∨Q ∨R)
6) Use skolemization to remove existential
quantifiers (see next slide)
7) Drop universal quantifier symbols (since we now
assume all variables are universally quantified)

Skolemization
Skolemization: Example
• Method for converting a sentence with existential
quantifiers into a sentence without existential quantifiers
such that the first sentence is satisfiable if and only if the ∀x∃y (Person(x) ∧ Person(y))  Loves(x,y)
second is.
• To eliminate an existential quantifier, replace each is converted to
occurrence of its variable by a Skolem function whose
arguments are the variables of universal quantifiers whose ∀x (Person(x) ∧ Person(f(x))  Loves(x,f(x))
scope includes the scope of the existential quantifier being
eliminated. where f(x) specifies the person that x loves
• If the existential quantifier being eliminated is not within
the scope of any universal quantifiers, the Skolem
function has no arguments, that is, it is a constant.

4
Skolemization: Another Example Skolemization: More examples
• The sentence “Everyone has a brain” is represented as
∀x Person(x)  ∃y Brain(y) ∧ Has(x,y) ∃xP(x) becomes P(A)
• If we simply substitute the constant B for the
existentially quantified variable y, we get a sentence
that says “Everyone has the same brain,” not what we ∀x∀y∃zP(x,y,z) becomes ∀x∀yP(x,y,F(x,y))
want to say!
∀x Person(x) Brain(B) ∧ Has(x,B)
∀x∃yPred(x,y) becomes ∀xPred(x,Succ(x))


• Using the Skolem function B(x) to represent a function


that denotes the object that is x’s brain, the correct
skolemization of our original sentence is
∀x Person(x)  Brain(B(x)) ∧ Has(x,B(x))

Practice Conversion to Implicative Normal Form


Convert the following sentences to CNF
• To convert to implicative normal form, first
∀x P(x) ∀y∃x Q(y,x)


convert to CNF, then perform one


additional step.
• From each conjunct, build an equivalent
implication by putting each negative literal
on the left hand side and each positive
literal on the right
• (¬A∨¬B∨C∨D) becomes (A∧B) (C∨D)


Unification
• In propositional logic, it is easy to see that two literals
Unification cont.
(such as p and ¬p) contradict each other.
• The unification algorithm takes two atomic
• In FOL, this matching process is more complicated
because arguments of predicates must be considered. sentences (literals), such as Knows(John, x)
For example, man(John) and ¬man(John) is a and Knows(John, Paul), and returns a
contradiction, while man(John) and man(Spot) is not. substitution that makes them look the same,
• To detect contradictions in FOL, we need a matching such as {x/Paul}
procedure that compares two literals and discovers
whether there exists a set of substitutions that makes • If there is no such substitition, the
them identical. This procedure is called unification. unification fails.
• Notation: x/car means car is substituted for x

5
Example
Most General Unifier Rule:
Knows(John, x) => Hates(John, x)
• There may be more than one substitution Knowledge Base:
that unifies two clauses. In fact, there may Knows (John, Jane)
be infinitely many Knows(y,Leonid)
Knows(y, Mother-of(y))
• The unification algorithm returns the “most Knows(x, Elizabeth)
general unifier”, that is, the substitution that
makes the least commitment about the Unify(Knows(John,x), Knows(John,Jane)) =
bindings of variables Unify(Knows(John, x), Knows(y, Leonid)) =
Unify(Knows(John,x), Knows(y, Mother(y))) =
Unify(Knows(John,x), Knows(x,Elizabeth)) =

Standardizing Variables Apart Resolution Example


Rule:
Knows(John, x1) => Hates(John, x1)
Anyone passing his history exams and
Knowledge Base: winning the lottery is happy. But anyone
Knows (John, Jane) who studies or is lucky can pass all his
Knows( x2 ,Leonid) exams. John did not study but John is
Knows( x3 , Mother-of( x3)) lucky. Anyone who is lucky wins the
Knows( x4 , Elizabeth) lottery. Is John happy?

Unify(Knows(John, x1), Knows (x2,Elizabeth)) =

1st step: Convert to predicate logic


1. Anyone passing his history exams and winning the 2nd step: Convert to CNF
lottery is happy.
Eliminate implications:
∀x Pass(x, History) ∧ Win(x, Lottery) Happy(x)


2. But anyone who studies or is lucky can pass all his 1. ∀x ¬ (Pass(x, History) ∧ Win(x, Lottery)) ∨ Happy(x)
exams.
∀x ∀y Study(x) ∨ Lucky(x) Pass(x,y)


2. ∀x ∀y ¬ (Study(x) ∨ Lucky(x) ) ∨ Pass(x,y)


3. John did not study, but John is lucky
¬ Study(John) ∧ Lucky(John) 3. ¬ Study(John) ∧ Lucky(John)

4. Anyone who is lucky wins the lottery.


4. ∀x ¬ Lucky(x) ∨ Win(x, Lottery)
∀x Lucky(x)  Win(x, Lottery)

6
Convert to CNF Cont. Convert to CNF Cont.
Move ¬ inward
Distribute ∧ over ∨
1. ∀x ¬ Pass(x, History) ∨ ¬ Win(x, Lottery)) ∨ Happy(x)
2. ∀x ∀y (¬ Study(x) ∧ ¬Lucky(x) )∨ Pass(x,y)
3. ¬ Study(John) ∧ Lucky(John) 1. ¬ Pass(x, History) ∨ ¬ Win(x, Lottery)) ∨ Happy(x)
4. ∀x ¬ Lucky(x) ∨ Win(x, Lottery)
2. (¬ Study(x) ∨ Pass(x,y)) ∧ ( ¬ Lucky(x) ∨ Pass(x,y))
Standardize variables: no action needed
Move quantifiers left: no action needed except drop quantifiers 3. ¬ Study(John) ∧ Lucky(John)
Skolemize: no action needed
4. ¬ Lucky(x) ∨ Win(x, Lottery)

Convert to CNF Cont. Convert to CNF Cont.


Standardize variables apart
Flatten nested conjunctions and disjunctions
1. ¬ Pass(x1, History) ∨ ¬ Win(x1, Lottery) ∨ Happy(x1)
no action necessary
2. a. ¬ Study(x2) ∨ Pass(x2,y1)
State as a set of disjunction of literals
2. b. ¬Lucky(x3) ∨ Pass(x3,y2)
3. a. ¬ Study(John)
1. ¬ Pass(x, History) ∨ ¬ Win(x, Lottery) ∨ Happy(x)
b. Lucky(John)
2. a. ¬ Study(x) ∨ Pass(x,y)
4. ¬ Lucky(x4) ∨ Win(x4, Lottery)
2. b. ¬Lucky(x) ∨ Pass(x,y)
3. a. ¬ Study(John)
NOW IN CONJUNCTIVE NORMAL FORM (CNF)
b. Lucky(John)
4. ¬ Lucky(x) ∨ Win(x, Lottery)

3rd step: Resolution Proof Procedure


Resolution Proof Tree
¬ Happy(John) 1.

• Assert negation of goal {x/John)

¬ Pass(John, History) ∨ ¬ Win(John, Lottery) 4.


– In this case the goal is to prove {x/John}

Happy(John) ¬ Pass(John, History) ∨ ¬Lucky(John) 3b.

– Add the clause ¬ Pass(John, History) 2b.

¬ Happy(John) {x/John, y/History}

¬Lucky(John) 3b.
to the KB
FALSE
• Resolve clauses together until FALSE is
derived

You might also like