Predicate Calculus AI
Predicate Calculus AI
1
Chapter Objectives
2
Example
3
Propositional logic
4
Propositional Calculus Sentences
5
Propositional Calculus Sentences
(cont’d)
The disjunction, or or, of two sentences is a
sentence.
Example: P P
The implication of one sentence from another is
a sentence.
Example: P → Q
The equivalence of two sentences is a
sentence.
Example: P Q R
Legal sentences are also called well-formed
formulas or WFFs.
6
Propositional calculus semantics
8
For propositional expressions P, Q, R
9
Fig. 2.1: Truth table for the operator
10
Fig. 2.2 Truth table demonstrating the
equivalence of PQ and P→Q
11
Proofs in propositional calculus
12
Prove using a truth table
Variables Premises Trial
Conclusions
P Q R P→Q Q→R R P P
T T T T T F T F
T T F T F T T F
T F T F T F T F
T F F F T T T F
F T T T T F F T
F T F T F T F T
F F T T T F F T
F F F T T T F T
13
Propositional calculus is cumbersome
14
Represent in predicate calculus
15
Can also use functions
16
The role of the knowledge engineer
fisher-hall-is-a-building
ee-is-a-building
building (fisher)
building (ee)
white-house-on-the-corner-is-a-building
green (fisher)
color (fisher, green)
holds (color, fisher, green)
holds (color, fisher, green, jan-2003)
holds (color, fisher, blue, jul-2003) 17
18
Symbols and terms
1. Truth symbols true and false (these are
reserved symbols)
2. Constant symbols are symbol expressions
having the first character lowercase.
E.g., thunk, fisher
3. Variable symbols are symbol expressions
beginning with an uppercase character.
E.g., X, Y, Z, Building
4. Function symbols are symbol expressions
having the first character lowercase.
Arity: number of elements in the domain
E.g., mother-of (bill); maximum-of (7,8) 19
Symbols and terms (cont’d)
A function expression consists of a function
constant of arity n, followed by n terms, t1 ,t2 ,…,
tn, enclosed in parentheses and separated by
commas.
E.g., mother-of(mother-of(joe))
maximum(maximum(7, 18), add-one(18))
A term is either a constant, variable, or function
expression.
E.g. color-of(house-of(neighbor(joe)))
house-of(X)
20
Predicates and atomic sentences
21
Predicate calculus sentences
22
Predicate calculus sentences (cont’d)
23
verify_sentence algorithm
24
How to compute the truth value of
predicate calculus expressions
Assume an expression E and an interpretation I
over E over a nonempty domain D. The truth
value for E is determined by:
1. The value of a constant is the element of D it
is assigned to by I.
2. The value of a variable is the set of elements
of D it is assigned to by I.
3. The value of a function expression is that
element of D obtained by evaluating the
function for the parameter values assigned by
the interpretation.
25
How to compute the truth value of
predicate calculus expressions (cont’d)
4. The value of the truth symbol “true” is T, and
“false” is F.
5. The value of an atomic sentence is either T or
F, as determined by the interpretation I.
6. The value of the negation of a sentence is T if
the value of the sentence is F, and F if the value
of the sentence is T.
7. The value of the conjunction of two
sentences is T, if the value of both sentences is
T and F otherwise.
8-10. The truth value of expressions using ,→,
and is determined as defined in Section 2.1.2.
26
How to compute the truth value of
predicate calculus expressions (cont’d)
Finally, for a variable X and a sentence S
containing X:
11. The value of X S is T if S is T for all
assignments to X under I, and it is F otherwise.
12. The value of X S is T if there is an
assignment to X under I such that S is T, and it
is F otherwise
27
Revisit and
30
Order of quantifiers matters
31
Order of quantifiers matters
32
Examples
33
Examples
34
Examples (cont’d)
35
Blocks world
on (c,a)
on(b,d)
ontable(a)
ontable(d)
clear(b)
clear(c)
hand_empty
c b
a d
36
Blocks world example
37
Interpretation
39
Satisfy, model, valid, inconsistent (cont’d)
40
Proof procedure
41
Logically follows, sound, and complete
42
43