Lecture 3

advertisement
Lecture 3
TextBook: Artificial Intelligence:Structures and Strategies for
complex problem solving
Pub: Addison Wesley
George F Luger & William A stubblefield
ISBN: 0-805-31196-3
Chapter 2 - Predicate Calculus (p: 47)
Symbols and Sentences
Propositional calculus Symbols
Symbols : P, Q, R, S, T
Truth symbols: True, false
And connectives: ,, , , 
(and, or, not, imply, equivalence)
Definition Propositional Calculus sentences
True, P, Q and R are sentences
P  Q , P  Q , P  P is sentences.
In expressions of the form P  Q , P and Q are called conjuncts.
P  Q , P and Q are called disjuncts
In an implications P  Q , P is the premise or antecedent and Q,
the conclusion or consequence.
1. Every propositional symbols and truth symbol is a sentences.
example true, P, Q, and R
2. The negation of a sentence is a sentence. Example P, false
3. The conjuection (disjunction) , or and (or), of two sentences is a
sentence P  P
4. The implication of one sentence for another is a sentence
PQ
5. The equilvalence of two sentences is a sentences.
Example P  Q  R
Definition
Propositional calculus semantics (p: 50)
1. Negation  P is true if P is false
2. Conjunction  , is T only when both conjuncts have T values.
3. Disjunction  , is F only when both disjuntcs have F values.
4. Implication  , is F only when the premise is T and the
consequent is F, otherswise is T. e.g. P  Q
5. The equivalence = , is T only when both expressions have the
same truth assignment for all possible interpretation, otherwise F.
e.g. P = Q
Example 1 : Proof P  Q  P  Q
Prove by trurth table
P
Q
T
T
F
F
T
F
T
F
 P P  Q P  Q P  Q  P  Q
F
F
T
T
T
F
T
T
T
F
T
T
T
T
T
T
Therefore P  Q  P  Q .
Some LAW for propositional calculus
The contrapostive law: ( P  Q)  (Q  P)
De Morgan’s Law:
( P  Q)  (P  Q)and( P  Q)  (P  Q) Commut
ative laws: ( P  Q)  (Q  P)and ( P  Q)  (Q  P)
Associative Law: (( P  Q)  R)  ( P  (Q  R))
Distributive Law: ( P  (Q  R)  ( P  Q)  ( P  R)
The predicate calculus (p. 52)
Definition
Predicate calculus symbols
1. Letter, both upper and lower case
2. digit 0, 1, ..9.
3. The underscore “_”
Symbols in predictae calculus begin with a “letter” and are followed
by any sequence of these legal characters
Legitimate predicate calculus :
George fire3 tom_and_jerry
Not legal symbols
3jack
“no blank allowed”
ab%cd
A function expression is a function symbol followed by its
arguments.
Example:
f(X,Y)
father(david)
price(bananas)
are well- formed function expressions
Each function denotes the mapping of arguments onto a single
object in the range.
father(david)
david -----(mapping)------ tom
The act of replacing function with its value is called evaluation.
plus(2,3)
function expression value 5
Symbols and Terms
Predicate symbols include:
Truth symbols: true and false
Constant symbols are symbols expression having the first character
lowercase.
Variable symbols are symbols expression having the first character
uppercase.
Function symbols are symbols having first character lowercase.
Function have an arity indicating the number of elements of the
domain mapped onto each element of the range.
Term is either a constant, variable, or function expression. Examples
of terms
cat
times(2,3)
X
Blue
Mother(jane)
Atomic sentence is a predicate of artiy n followed by n terms
enclosed in parenthese and separated by commas. Predicate calculus
sentences are delimited by a preiod.
likes(george, kate).
friends(bill, george).
The arguments to a predicate are terms and may also include
variables or function expressions.
friends(father(david), father(andrew)).
Universal quantifier,  , indicates that the sentence is true for all
values of the quntified variable.
Existential quantifier,  , indicates that the sentences is true for
some value(s) in the domains.
Y friend (Y , peter) .
X likes ( X , ice _ cream) .
Every atomic sentence is a sentences,
If s is a sentences, then so is its negation,
If s1 and s2 are sentences, then so their
Conjunction s1  s2
Disjunction s1  s2
Implication s1  s 2
equilvalence s1  s2
If X is a variable and s is a sentence, then
If X is a variable and s is a sentence, then
s
Xs is a sentence.
Xs is a sentence.
Procedure verify_sentence(expression);
Begin
Case
expression is an atomic sentence: return(success);
expresssion is of the form Q X s, where Q is either or ,
X is a variable, and s is a sentence.
If verify_sentence(s) return success
then return(success)
expression is of the form s :
If verify_sentence(s) return success
then return(success);
expression is of the form s1 op s2, where op is a binary logical
operator: If verify_sentence(s1) return success and
verify_sentence(s2) return success
then return(success);
otherwise: return(fail)
end;
End.
Download