Artificial Intelligence - Introduction to knowledge representation, logic and resolution theorem-proving

parnelresonantAI and Robotics

Jul 17, 2012 (4 years and 11 months ago)


CS 4633/6633 Artificial Intelligence
Artificial Intelligence
Introduction to knowledge representation,
logic and resolution theorem-proving
CS 4633/6633 Artificial Intelligence
Knowledge Representation Hypothesis
A widely-held (although controversial) view among
AI researchers is that for a system to be
“artificially intelligent,” it must contain a
component that can be understood as linguistic
(i.e., that can be expressed in some language)
such that:
– this component contains the knowledge of the
system, and
– this component drives the intelligent behavior
of the system
CS 4633/6633 Artificial Intelligence
Knowledge-Based System
Consists of:

Knowledge Base (KB):
– a set of sentences representing facts about the
world expressed in some knowledge
representation language

Inference Engine
– infers new sentences from the sentences in the
knowledge base
CS 4633/6633 Artificial Intelligence
Knowledge Representation Language

Virtually all knowledge representation
languages are based, in some way, on formal
logic (propositional logic, predicate logic,
temporal logic, etc.)

Formal logic shares with English the
advantage that it can express facts about the
world. It shares with computer programming
languages the advantage of being clear and
CS 4633/6633 Artificial Intelligence
A logic is a formal language that
– Syntax = rules for describing legal
– Semantics = how sentences represent
facts in the world
– Proof theory = rules for infering sentences
from other sentences
CS 4633/6633 Artificial Intelligence
Syntax of Propositional Logic

TRUE and FALSE are sentences

The propositional variables P, Q, R, … are sentences

Parentheses around a sentence forms a sentence

Combining sentences with the following logical
connectives forms a sentence
symbol example name sentence name
∧ P ∧ Q and conjunction
∨ P ∨ Q or disjunction
¬ ¬P not negation


Q implies implication
⇔ P ⇔ Q is equivalent equivalence (biconditional)
CS 4633/6633 Artificial Intelligence
Semantics of propositional logic

An interpretation associates each propositional
variable with a proposition about the world. Because
propositions are either true or false, we can also
specify an interpretation by assigning the truth values
TRUE and FALSE directly to propositional variables,
regardless of which proposition each denotes.

Each logical connective is defined by a truth table

Given an interpretation of propositional variables, we
can use a truth table to compute the truth value of
any sentence under that interpretation
CS 4633/6633 Artificial Intelligence
Satisfiability, Validity, and Entailment

A sentence is satisfiable (or consistent) if it is
true under some intepretation

A sentence is valid (or a tautology) if it is true
under every possible interpretation

A sentence is inconsistent (or unsatisfiable or a
contradiction) if it is false under every possible

Sentence P entails sentence Q, written P |= Q, if Q
is true whenever P is true

In propositional logic, truth tables can be used to
test for entailment: P |= Q if and only if the
sentence P=>Q is valid.
CS 4633/6633 Artificial Intelligence
Use a truth table to show that P

Q, P |= Q
CS 4633/6633 Artificial Intelligence
Formal System

Formal language

Set of axioms

Set of inference rules

Proof (or derivation)
– a sequence of sentences such that every
sentence in the sequence is an axiom or can
be derived from sentences earlier in the
sequence by applying rules of inference
– the notation KB |- p indicates that sentence p
can be inferred from the set of sentences KB
CS 4633/6633 Artificial Intelligence
Rules of inference in
propositional logic

Modus ponens

Q, P |- Q

Unit resolution
P∨Q, ¬ Q |- P

P∨Q, ¬ Q∨R |- P∨R
CS 4633/6633 Artificial Intelligence
Proof and Entailment

Proof is a syntactic notion. In constructing proofs,
we don’t consider the meaning of sentences.
KB |- p means we can prove/derive p from KB

Entailment is a semantic notion. It depends on the
meaning we give to logical connectives by
associating them with truth tables.
KB |= p means that p is entailed by KB, that is,
whenever KB is true the sentence p is true

Although we can show entailment by truth tables,
we can usually construct proofs more efficiently.
CS 4633/6633 Artificial Intelligence
Properties of a Formal System

– if KB |- p, then KB |= p

– if KB |= p, then KB |- p

– there is an algorithm that can decide in finite
time whether any proposition is a theorem or
CS 4633/6633 Artificial Intelligence
Resolution Refutation

By itself, resolution is a sound rule of inference
but not complete.

However, a technique called resolution refutation
is sound and complete.

Resolution refutation is a form of proof by
contradiction. It shows that KB |= p by showing
that the set of clauses KB ∪ {¬p} is unsatisfiable.

To use resolution refutation, we first convert
sentences to conjunctive normal form
CS 4633/6633 Artificial Intelligence
Conjunctive Normal Form

A literal is a propositional variable or its negation

A clause is a disjunction of literals

A sentence written as a conjunction of clauses is
said to be in conjunctive normal form

Example:(¬ P ∨ Q ∨ R) ∧ (P ∨ ¬ R ∨ ¬ S) ∧ (P ∨ ¬ Q)

Any sentence in propositional logic can be written
in conjunctive normal form (CNF)

Resolution refutation requires sentences to be in
conjunction normal form
CS 4633/6633 Artificial Intelligence
Conversion to CNF
Remove biconditional using following equivalence
P⇔ Q becomes (P

Q)∧ (Q


Remove implication using following equivalence

Q becomes ¬ P∨Q

DeMorgan’s laws
¬(P∨Q) becomes ¬P∧ ¬Q
¬(P∧ Q) becomes ¬P ∨¬Q

Distributive laws
P∧ (Q∨R) becomes (P∧ Q)∨(P∧ R)
P∨(Q∧ R) becomes (P∨Q)∧ (P∨R)

Also, associative laws and eliminate double
CS 4633/6633 Artificial Intelligence
Convert the following sentences to CNF

¬ Q

(P ∧ R)

(P ∨ ¬Q)

CS 4633/6633 Artificial Intelligence
Resolution Refutation
To prove KB |- p,
– Convert ¬p and the clauses in KB to CNF and
combine into a single set of clauses, Γ
– Loop
»Find two clauses in Γ to which the resolution rule
applies, but has not previously been used. If can’t
be found, return “p cannot be proven.”
»Apply the resolution rule to create a new clause. If
the new clause is the empty clause (that is, a
contradiction), return “p has been proven.”
»Add the new clause to Γ.
CS 4633/6633 Artificial Intelligence

Express the following statements in
propositional logic
– If it is hot and humid, then it is raining.
– If it is humid, then it is hot.
– It is humid.

Use resolution refutation to prove the
following statement
– It is raining.
CS 4633/6633 Artificial Intelligence
Proof Tree
R ¬R
¬M ∨ R
¬H ∨ ¬M ∨ R ¬M ∨ H
CS 4633/6633 Artificial Intelligence
Comments about Resolution Refutation

Resolution refutation will terminate with the empty
clause if KB |= p. It will terminate without producing
the empty clause if KB |≠ p.

Resolution is a state-space search algorithm! A state
is a set of clauses. The operator is resolution on two
clauses. A proof has a tree structure with p as the
root and clauses in the original KB as leaves.
Intelligent search strategies can find proofs efficiently.

Although inference in propositional logic is NP-
complete, resolution refutation is usually more
efficient than using truth tables.