And/Or Graph:
Connecting Logic and
State Space
Motivations
• You have learned about FOL
– AND, OR, IF, etc.
• You have learned about state space
– tic-tac-toe game tree, Königsberg bridges,
etc.
• This lecture combines these two technologies
for logical inference using state space
representation
– And/Or Graph
Objectives
• State space representation of predicate
calculus
• What is And/Or graph representation?
• And/Or graph for car problem diagnostic
• And/Or graph for financial advisor
• And/Or graph for a simple English grammar
State space representation of predicate calculus
• Letters as nodes T
• Implications as links
•qp T T
•rp
•vq
•sr
•tr T T
•su Given: tr
•t t
By modus ponens
•s r
Propositions that are reachable from boxed
states are true propositions.
Summary: state space representation of
predicate calculus
T
T T
• Representation
– Logical expressions as states, p, q, r, …
– Inference rules as links, .
– Prolog facts and rules T T
• Correctness
– Soundness and completeness of predicate calculus
– Inference rules guarantee the correctness of conclusions
• Theorem proof
– State space search
– A Prolog query becomes a goal to be satisfied in a bottom up fashion.
Simple And/Or graph
• Or graph
•qrp
• And graph
•qr→p
And/or graph
a
b
c
aΛ bd
aΛ ce
bΛ df
f g
aΛ eh
• Is h true?
• Is h true if b is no longer true?
• What is the fastest way (CPU time) to show that X is true?
• Is q true? Closed world assumption.
Car diagnosis
Where is Fred?
7d location(fred,Z)
7a 7b 7c
7a 7b 7c 7d
Financial adviser knowledge base
1. savings_account (inadequate)
investment(savings)
2. savings_account (adequate)
income(adequate) investment (stocks)
3. savings_account (adequate)
income(inadequate) investment(combination)
4. X amount_saved(X) Y (dependents (Y)
greater(X, minsavings(Y)))
savings_account(adequate)
X is the dollar amount.
Y is the number of dependents.
minsavings is the number of dependents multiplied
by 5000.
Knowledge base cont’d
5. X amount_saved(X) Y (dependents (Y)
greater (X, minsavings(Y)))
savings_account(inadequate)
6. X earnings(X, steady) Y (dependents (Y)
greater (X, minincome(Y)))
income(adequate)
7. X earnings(X, steady) Y (dependents (Y)
greater (X, minincome(Y)))
income(inadequate)
Minimum income is
15,000 + (4000 * number of dependents)
8. X earnings(X, unsteady) income(inadequate)
Applying it to an individual
A person whose
9. amount_saved(20000)
10. earnings(30000, steady)
11. dependents (2)
What should he do about investment?
And/or graph searched by the financial advisor
A person whose
9. amount_saved(20000)
10. earnings(30000, steady)
11. dependents (2)
What should he do about
investment?
F T
T
A small English grammar
Summary
• And/Or graph combines first-order logic with
state space representation.
• Nodes are logical expressions.
• Arcs are logical inferences.
• Logical deduction is search in this space.
• Use this technology to engineer AI systems
for many applications such as diagnostics.