CPSC 533 AI - Knowledge-bases Propositional Logic

Introduction to Knowledge-bases

Knowledge-base Agent

Representation, Reasoning and Logic

Propositional Logic
* Syntax & Semantics
* Inferencing
* Example:
•
•
Wumpus World
A Propositional logic Knowledge-based Agent for the
Wupus World
CPSC 533 AI - Knowledge-bases
Knowledge-base Agent
* Sentences
* Knowledge Representation Language
* Background Knowledge
KB
tell
ask/result
agent
percept
Describing a KB...
What it knows
Knowledge level
How it knows
Logical level
Knowledge implementation
Implementation level
CPSC 533 AI - Knowledge-bases
Knowledge-base Agent
* Sentences
* Knowledge Representation Language
* Background Knowledge
KB
sentences
tell
agent
inference
engine
percept
Describing a KB...
What it knows
Knowledge level
How it knows
Logical level
Knowledge implementation
ask/result
Implementation level
CPSC 533 AI - Knowledge-bases
Representation, Reasoning & Logic
 Knowledge Representation Languages
* Express knowledge in a computer-tractable manner.
* Are described in terms of:
• Syntax: Configurations to represent sentences.
• Semantics: Determines sentences meaning.
* Logic: Language with well-defined syntax and semantics.
 Inferencing
inferencing a
agent
x sentences
x+a sentences
world
y facts
y+d facts
CPSC 533 AI - Knowledge-bases
Representation, Reasoning & Logic
 Inferencing
(cont)
* Process where true sentences are generated, based on existing ones.
* Characteristics:
• Process: Truth-preserving / Sound.
• Sentences: Entailed.
Proof
entailed
sentence
sentences
Completeness
For an Inference Process to be “sound”, it has to comply with the
inferencing semantical rules of a language (a.k.a. proof theory)
CPSC 533 AI - Knowledge-bases
Representation, Reasoning & Logic
 Semantics
* Sentences do not have a meaning: they need to be interpreted.
“The sky is blue” vs. “The bird is in the cage”.
* Characteristics of sentences:
• Valid: True under all interpretations.
• Satisfiable: True under some interpretations.
• Un-satisfiable: False in all worlds.
 Logics
Language
Ontological Commitment
(what exists in the world)
Epistemological Commitment
(what is believed about the world)
Propositional logic
facts
First-order logic
facts, objects, relations
Temporal logic
facts, objects, relations, times
Probability theory
facts
Fuzzy logic
degrees of truth
true / false / unknown
true / false / unknown
true / false / unknown
degree of belief 0..1
degree of belief 0..1
CPSC 533 AI - Knowledge-bases
Propositional Logic
 Syntax
* Constants: True, False
* Symbols: P, Q, ...
* ()
* Connectives:


and
or


implies
equivalence

negation
* BNF
• sentence atomic_sentence | complex_sentence
• atomic_sentence TRUE | FALSE | P | Q | ...
• complex_sentence ( sentence ) | sentence connective sentence | sentence
• connective  |  | | 
CPSC 533 AI - Knowledge-bases
Propositional Logic
 Semantics
* Constants: True = True, False = False
* Symbols: Not valid, but satisfiable.
“A sentence has a meaning derived from its parts.”
Truth tables
P
H
P H
False
False
True
True
False
True
False
True
False
True
True
True
(P  H)
 
False
False
True
False
H ((P H)

H)

P
True
True
True
True
CPSC 533 AI - Knowledge-bases
Propositional Logic
 Inference Rules
a a entails b
b
* Modus-Ponens
aba
b
* And-Elimination
a1 a2 an
ai
* And-Introduction
a1 a2 an
a1 a2 an
* Or-Introduction
ai
a1 a2 an
* Double-Negation Elimination
* Unit Resolution
* Resolution
a
a
abb
a
abb
a
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 Wumpus World
4
Wumpus

3
Pit
 Breeze
2
Gold
1
D
start
1
2
3
Stench
Gold Hunter
4
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 Wumpus World
4





3
2

1
D
1
4


2
2

3
3
4
OK
1
OK
1
2
3
4
p - Pit
w - Wumpus
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 Wumpus World
4




1
1
4


3
2


2
2

3
3
4
OK
p?
p?
1
1
2
3
4
p - Pit
w - Wumpus
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 Wumpus World
4




1
1
4


3
2


2
2

3
3
4
OK
p?
p?
1
1
2
3
4
p - Pit
w - Wumpus
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 Wumpus World
4





3
2

1
D
1
4


2
w!
2

3
3
4
OK
p!
1
1
2
3
4
p - Pit
w - Wumpus
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 Wumpus World
4





3
2

1
D
1
4


2

3
4
3
w!
OK
2
OK
1
p!
1
2
3
4
p - Pit
w - Wumpus
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 Wumpus World
4





3
2

1
D
1
4


2

3
4
3
p?
w!
p?
2
OK
1
p!
1
2
3
4
p - Pit
w - Wumpus
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 A Propositional logic KB Agent for the Wumpus World
4
3
2


1,3

1

2,1
2
3,1
3
S2,1
S1,2
B1,1
B2,1
B1,2
R1 : S1,1 W1,1  W1,2  W2,1
R2 : S2,1 W1,1  W2,1  W2,2  W3,1


1,1


1,2
1
S1,1
R3 : S1,2 W1,1  W1,2  W2,2  W1,3

R4 : S1,2 W1,1  W1,2  W2,2  W1,3
4
CPSC 533 AI - Knowledge-bases
Propositional Logic (example)
 A Propositional logic KB Agent for the Wumpus World
1) Modus Ponens on S1,1 and R1
W1,1  W1,2  W2,1
2) And-Elimination
W1,1
W1,2
W2,1
3) Modus Ponens on S2,1 and R2
W1,1  W2,1  W2,2  W3,1
S1,1
S2,1
S1,2
B1,1
B2,1
B1,2
R1 : S1,1 W1,1  W1,2  W2,1
R2 : S2,1 W1,1  W2,1  W2,2  W3,1
R3 : S1,2 W1,1  W1,2  W2,2  W1,3
R4 : S1,2 W1,1  W1,2  W2,2  W1,3
4) And-Elimination
W1,1
W2,1
W2,2
W3,1
5) Modus Ponens on S1,2 and R4
W1,1  W1,2  W2,2  W1,3
6) Unit Resolution
W1,2  W2,2  W1,3
Goal: W1,3
7) Unit Resolution
W2,2  W1,3
8) Unit Resolution
W1,3
CPSC 533 AI - Knowledge-bases