Vous êtes sur la page 1sur 14

Engineering Systems Design and Analysis

(ENG 504)
504)
Lecture 5
/


Email: amhm@zu.edu.eg / amhm162@gmail.com
Webpage: http://www.staff.zu.edu.eg/amhm/

In the previous lecture

Branch and bound algorithm


Examples:
Travelling Salesman Problem
Scheduling Problems
Expert systems
Propositional logic

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Agenda

Expert systems
Predicate logic

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

Predicate Logic

2013/2014

Limitations of Propositional Logic

Statements about similar objects and relations need to be enumerated:


Doesnt deal with relations.
Cant combine evidences.
Statements referring to groups of objects require exhaustive enumeration
of objects:
Cant express quantification.
Cant deal with uncertain information.

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

It is called also First-Order Logic (FOL).


In English, the predicate is the part of the sentence that tells you something
about the subject.
A predicate is a verb phrase template that describes a property of objects,
or a relationship among objects represented by the variables.
Example 1: "The car Tom is driving is blue",
The sky is blue,
"The cover of this book is blue"
Predicate: x is blue which describes the property of being blue.
We can give this predicate a name, i.e., B(x)
Thus, x is an arbitrary object and B(x) reads as x is blue.

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

Example 2: "John gives the book to Mary",


"Jim gives a toy to Tom",
"Jane gives a lecture to Mary",
Predicate: x gives y to z which describes a relationship bet. 3 objects.
Name: G(x,y,z)
x,y,z are variables, while John, Mary, Jane, Jim and Tom are
objects.

Notice that a predicate becomes a proposition when specific


values (objects) are assigned to its variables.

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

As we did when studying propositional logic, we have to look on:


Syntax.
Semantics.
Inference rules.
Syntax:
Symbols:
Constants: objects.
Functions: to check a property of its variables.
Predicate: a true/false relationships bet. objects.
Connectives : AND, OR, NOT,.. (as in propositional logic).
Quantifiers: i.e.,
which means there exists and
which means
for all.
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

Each predicate variable has a Domain or Universe which is the set of values that
can be assigned to the variable.
Thus, If P(x) is a predicate and x has domain U, the truth set of P(x) is the set
of all elements in U such that P(t) is true.
Example:
U={1,2,3,4,5,6,7,8,9,10}
P(x): x is prime
The truth set is {1,2,3,5,7}

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

Quantifiers:

x which means for all x in its domain is called the universal quantifier.
Example: All Human are Mortals, here is its FOL translation:
predicate: All x are y
H(x): x is a human
M(y): y is mortal
x, H(x) M(x)

x which means at least, there exists one value of x from its domain is
called the existential quantifier.
Example: Some numbers are prime
P(x): x is prime
x, P(x)
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

Example 1: Translate the following quantified statements into English:


1. U(x) = ,
P(x): x2 > 0
x, P(x)
Answer: For every rational number, the quadratic function gives positive value.
2. U(x) = ,
M(x): x > 3
B(x): x3 > 27

x, M(x) B(x)
Answer: There exists one rational number such that it is greater than 3 and its
cubic is greater than 27.

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

Predicate Logic

2013/2014

10

Example 2: Write the FOL representation:


1. No School bus is black
Answer: Predicate: No x is y
S(x): x is a school bus
B(y): y is black
x, S(x) B(x) or x, S(x) B(x)
2. Some uncles are younger than their nephews
Answer: Predicate:x is younger than y
S(x,y): x is younger than y
P(x): x is an uncle
N(y): y is a nephew
x,y, S(P(x),N(y))
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic
Notice that:

11

If U={1,2,3}, then

x, P(x) is equivalent to P(1) P(2) P(3)


x,P(x) is equivalent to P(1) P(2) P(3)

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

Predicate Logic

2013/2014

12

DeMorgans low for quantifiers:

x, P(x)

x ,P(x)

x,P(x) x, P(x)

Exercise 1: Write the FOL representation for:


Some drivers do not obey the speed limit
Not all dogs are dangerous

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

13

Quantifiers plus and :

distributes over :
x, (P(x) Q(x)) x,P(x) x,Q(x)
distributes over :
x,(P(x) Q(x)) x,P(x) x,Q(x)
But notice that: x,(P(x) Q(x)) x,P(x) x,Q(x)

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

is True.

Zagazig Univ-Eng. Faculty

Predicate Logic

2013/2014

14

Rules of inference:
1.

Universal Modus ponens:

x, (P(x) Q(x))

Given

P(c)

Q(c)

Conclusion

where c is some element in Ps domain.

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

15

Rules of inference:
2. Universal Modus Tollens :

Example:
All dogs bark

x, (P(x) Q(x))
Q(c)

P(c)

Roy does not bark


Roy is not a dog
U = all living creatures,
P(x): x is a dog,
Q(x): x barks.

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

Predicate Logic

2013/2014

16

Rules of inference:
3. Universal Hypothetical Syllogism:

x, (P(x) Q(x))
x, (Q(x) R(x))

x, (P(x) R(x))

like the chain rule!

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

17

Problem formulation in general:


Given: a story that describes properties and relations between objects.
Questions:
A query which requires an answer
(i.e., is there an object that has such and such?)
Check if a proposition is true or false.
Proof a proposition.

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

18

Example 3:
A horse that is registered for todays race is not a thoroughbred.
Every horse registered for todays race has won a race this year.
Therefore a horse that has won a race this year is not a thoroughbred. Proof?
Solution:
Predicates: P(x): x is registered for todays race
Q(x): x is a thoroughbred
R(x): x won a race this year
Domain: all horses.
FOL representation: x, (P(x) Q(x))
x, (P(x) R(x))

x, (R(x) Q(x))
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

19

Example 3: Solution:
To proof that x, (R(x) Q(x)) we use the inference rules:
Step

Reason

x, (P(x) Q(x))

Given

P(a) Q(a), for some a

From 1

P(a)

From 1

Q(a)

From 1

x, (P(x) R(x))

Given

P(a) R(a)

From 5

R(a)

From 3,6

R(a) Q(a)

From 4,7

x, (R(x) Q(x))

From 8

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

20

Example 4:
Tony, Shi-Kuo and Ellen belong to the Hoofers Club. Every member of the
Hoofers Club is either a skier or a mountain climber or both. No mountain
climber likes rain, and all skiers like snow. Ellen dislikes whatever Tony likes and
likes whatever Tony dislikes. Tony likes rain and snow.

Query: Is there a member of the Hoofers Club who is a mountain climber but
not a skier?

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

21

Example 4: Solution:
Predicates: S(x) : x is a skier , Domain: Hoffers club
M(x) : x is a mountain climber, Domain: Hoffers club
L(x,y) : x likes y, Domain of y: snow and rain.
x,S(x) v M(x)

FOL representation:

M(x) L(x, Rain)


x,S(x) L(x, Snow)
L(Tony, x) L(Ellen, x)
L(Tony, x) L(Ellen, x)
L(Tony, Rain)
L(Tony, Snow)
M(x) S(x) ? If true, who is x?
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Predicate Logic

22

Example 4: Solution:
Step

Reason

x,S(x) v M(x)

given

M(x) v S(x)

From 1

M(x) L(x, Rain)

given

x,S(x) L(x, Snow)

given

L(Tony, x) L(Ellen, x)

given

L(Tony, Snow)

given

L(Ellen, Snow)

From 5,6

S(Ellen)

From 7,4

M(Ellen)

From 9,2

10

M(Ellen) S(Ellen)

From 10

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Answer is Ellen

Zagazig Univ-Eng. Faculty

2013/2014

Applications

23

There are programming languages that are built upon the concepts of predicate
logic, i.e., PROLOG (programming in logic).
There are numerous examples of Expert Systems that are based on rule-based
reasoning:
DENDRAL : Infers molecular structure from the information provided by
a mass spectrometer
MYCIN: Diagnosis of blood infections, 450 rules; performs as well as
experts
PROSPECTOR: Correctly recommended exploratory drilling at geological
site

Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

Assignment #2
#2

2013/2014

24

Given the following paragraph:


Jack owns a dog. Every dog owner is an animal lover.
No animal lover kills an animal. Either Jack or Curiosity killed the
cat, who is named Tuna. Did Curiosity kill Tuna?
Answer the query using predicate logic rules, your answer should
include:
1.

Predicate statements.

2. FOL representation.
3. Inference steps.
4. Answer to the query.
Dr. A. Helmi Eng. Sys. Design and Analysis (ENG 504)

Zagazig Univ-Eng. Faculty

2013/2014

Thanks

Vous aimerez peut-être aussi