You are on page 1of 28

COIT, UNITEN

CCSB354
CCSB354
ARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCE
Chapter 2
Logic
Chapter 2
Logic
lnsfucfo: A11c1a 1ang Y. C.
COIT, UNITEN
2
LOGIC
LOGIC
A formalization of some aspect of language.

A representation of knowledge.
A structure at the symbol level.
First Order Predicate Logic

COIT, UNITEN
3
1kADl1lONAL LOGlC
1kADl1lONAL LOGlC
Identity
is
Contradiction
is not
Excluded Middle
is not both and

COIT, UNITEN
4
Four Statement Forms
Four Statement Forms
A11 5 1s P
No 5 1s P
5ome 5 1s P
5ome 5 1s nof P
1he 5y11og1sm:
1s a sef of u1es goven1ng Whaf
conc1us1on can be eached fom a sef
of sfafemenfs W1ffen 1n fhe fou-
sfafemenf fom
COIT, UNITEN
5
Reasoning by Pattern
Reasoning by Pattern
A11 x ae y . A11 x ae y . A11 x ae y . A11 x ae y .
A11 y ae z . A11 y ae z . A11 y ae z . A11 y ae z .
1heefoe,a11 x ae z . 1heefoe,a11 x ae z . 1heefoe,a11 x ae z . 1heefoe,a11 x ae z .
COIT, UNITEN
6
Unsound Patterns
Unsound Patterns

COIT, UNITEN
7
Cont..
Cont..
Nof so good: Nof so good: Nof so good: Nof so good:
A11 1oyofas ae cas.
5ome cas ae Iea1.
1heefoe,some 1oyofas ae
Iea1. --- buf fh1s 1s a
Wong conc1us1on!
COIT, UNITEN
8
The Syllogism (I)

All Malaysians are car-drivers (1)


All people in KL are Malaysians (2)
COIT, UNITEN
9
The Syllogism (II)
Then the following conclusion is valid:
- All people in KL are car drivers(3)

COIT, UNITEN
10
Syllogism (III)
ALL or NO are known as universal
quantifiers that refers to every
element of the subject class.
"SOME is known as an existential
quantifier.

COIT, UNITEN
11
Example of
Fragments of Information
(Symbolic description)
The red block is ON the green block.
The green block is somewhere ABOVE
the blue block.
The green block is NOT on the blue block.
The yellow block is on the green OR the
blue.
The blue block is on SOME other block.
COIT, UNITEN
12
We will obtain these
We will obtain these

Premises
Premises

(from previous slide):


The red block is on the green block.
The green block is somewhere ABOVE the
blue block.
The green block is NOT on the blue block.
The yellow block is on the green OR the blue.
The blue block is on SOME other block.
COIT, UNITEN
13
Conc1us1ons
Conc1us1ons
The red block is on the green block.
The green block is on the yellow block.
The yellow block is on the blue block.
The blue block is on the black block.
Main conclusion
The black block is on the table.
COIT, UNITEN
14
Rules of Inference
Rules of Inference
A rule of inference is a pattern of reasoning
consisting of one set of sentence schemas,
called premises, and a second set of
sentence schemas, called conclusions.
P Q
P
-----------
Q
COIT, UNITEN
15
Rule Instances
Rule Instances
An instance of a rule of inference is
a rule in which all meta variables
have been consistently replaced by
expressions in such a way that all
premises and conclusions are
syntactically legal sentences.
COIT, UNITEN
16
Sound Rules of Inference
Sound Rules of Inference
A rule of inference is sound if and only if the
premises in any instance of the rule logically
entail the conclusions.
Modus Ponens
P Q
P
--------
Q
Modus Tollens
P Q
Q
--------
P
COIT, UNITEN
17
Sound Rules of Inference
Sound Rules of Inference
Equivalence Elimination (EE)
P Q
P Q
--------
Q P
Double Negation (DN)
P
-------
P
COIT, UNITEN
18
Proof
Proof
A poof of a conc1us1on fom a sef of
pem1ses 1s a sequence of senfences
fem1naf1ng 1n fhe conc1us1on 1n
Wh1ch each 1fem 1s e1fhe:
1. A pem1se
2. An 1nsfance of an ax1om schema
3. 1he esu1f of app1y1ng a u1e of
1nfeence fo ea11e 1fems 1n
sequence.
COIT, UNITEN
19
Example
Example
When it is raining, the ground is wet.
When the ground is wet, it is slippery.
It is raining. Prove that it is slippery.
1. raining wet Premise
2. wet slippery Premise
3. raining Premise
4. wet MP: 1,3
5. slippery MP: 2,4
reasoning
COIT, UNITEN
20
Sample Proof
Sample Proof
Whenever p is true, q is true. Whenever q is
true, r is true. Prove that, whenever p is
true, r is true.
1. p q Premise
2. q r Premise
3. (q r) ( p (q r)) ..given
4. p (q r) MP: 3,2
5. ( p (q r)) (( p q) (p r)) ..given
6. ( p q) ( p r) MP: 5, 4
7. p r MP: 6,1
Refer next slide
COIT, UNITEN
21
Implication Introduction: s => (t => s)
Implication Distribution: (r => (s => t))
=> ((r => s) => (r => t))
COIT, UNITEN
22
Inference Rules
Inference Rules
(I)
(I)
Modus Ponendo Ponens
- If P implies Q, and P is true, then Q is
true.
Modus Tollendo Tollens
- If P implies Q, and Q is false, then P is
false.
COIT, UNITEN
23
Inference Rules
Inference Rules
(II)
(II)
Modus Ponendo Tollens
- If P and Q are not both true, and P is
true, then Q is false.
Modus Tollendo Ponens
- If either P or Q is true, and P is not true,
then Q is true.
COIT, UNITEN
24
Well
Well
-
-
Formed
Formed Formula (wff)
TAUTOLOGY

CONTRADICTION

A complex formula that includes logical
connectives. The truth value of a wff is known
as its semantics or meaning.
COIT, UNITEN
25
1heo1es and Ax1oms
A set of well-formed formulas (wffs)
constructed for any field of knowledge
is said to be the theory of that field.
Wh11e each 1nd1v1dua1 Wff 1s
an ax1om.
COIT, UNITEN
26
Some other terms
Proposition
any statement that can be assigned a value of
true or false.
Clausal form
using only connectives such as: and , or and not.
Horn clause
contains only one positive literal.
Literal
is an atomic formula or the negation of an atomic
formula.
COIT, UNITEN
27
http://metalab.uniten.edu.my/~alicia/AI/ExtraSlides/Supplementary/Part1/
COIT, UNITEN
28
Class Exercise #1
Class Exercise #1
Head I win. Tails you lose. Suppose the coin comes up tails. Show that I win.
(Use h = head, t = tail, m = I win, y = you win)
Start with: h m (1)
t y (2)
h t (3)
m y (4)
t (5)
y M.P: 2, 5 (6)
m y EE: 4 (7)
y m EE: 4 (8)
m M.P: 8, 6 -- proven!

You might also like