Predicate Logic
Predicate Logic
Predicate Logic
Predicate logic
Attique Ur Rehman
Lecturer BZU Lahore
attiquere@gmail.com
a Upitt student
object
a property
Predicate logic
Remedies the limitations of the propositional logic
Explicitly models objects and their properties
Allows to make statements with variables and
them
quantifylogic:
Predicate
Constant models a specific object
Examples: John, France, 7
Variable represents object of specific type (defined by the
universe of discourse)
Examples: x, y
(universe of discourse can be people, students, numbers)
Predicate - over one, two or many variables or constants.
Represents properties or relations among objects
Examples: Red(car23), student(x), married(John,Ann)
Predicates
Predicates represent properties or relations among
objects
A predicate P(x) assigns a value true or false to each x
depending on whether the property holds or not for x.
The assignment is best viewed as a big table with the
variable substituted for objects from the universe of
discourse
Example:
Assume Student(x) where the universe of discourse are people
Student(John) . T (if John is a student)
Student(Ann) . T (if Ann is a student)
Student(Jane) .. F (if Jane is not a student)
Predicates
Assume a predicate P(x) that represents the statement:
x is a prime number
Truth values for different x:
P(2)
T
P(3)
T
P(4)
F
P(5)
T
P(6)
F
All statements P(2), P(3), P(4), P(5), P(6) are propositions
Quantified statements
Predicate logic lets us to make statements about groups of
objects
To do this we use special quantified expressions
Two types of quantified statements:
universal
Example: all CS Upitt graduates have to pass
cs441
the statement is true for all graduates
existential
Example: Some CS Upitt students graduate with honor.
the statement is true for some people
Universal quantifier
Quantification converts a propositional function
a
intoproposition by binding a variable to a set of values from the
universe of discourse.
Example:
Let P(x) denote x > x - 1.
Is P(x) a proposition? No. Many possible substitutions.
Is x P(x) a proposition? Yes. True if for all x from the
universe of discourse P(x) is true.
x CS-major(x) Student(x)
Translation: (For all people it holds that) if a person is a
CS-major then she is a student.
Proposition: yes.
When true?
When false?
x P(x)
x P(x)
There is an x
where P(x) is false.
Nested quantifiers
More than one quantifier may be necessary to
the
capture meaning of a statement in the predicate logic.
Example:
Every real number has its corresponding negative.
Translation:
Assume:
a real number is denoted as x and its negative as y
A predicate P(x,y) denotes: x + y =0
Then we can write:
x y P(x,y)
Nested quantifiers
More than one quantifier may be necessary
to meaning of a statement in the predicate
logic.
Example:
There is a person who loves everybody.
Translation:
Assume:
Variables x and y denote people
A predicate L(x,y) denotes: x loves y
Then we can write in the predicate logic:
x y L(x,y)
capture the
Order of quantifiers
The order of nested quantifiers matters if quantifiers are of
different type
xy L(x,y) is not the same as yx L(x,y)
Example:
Assume L(x,y) denotes x loves y
Then: xy L(x,y)
Translates to: Everybody loves somebody.
And: y x L(x,y)
Translates to: There is someone who is
loved
The meaning of the two is different.
by everyone.
Order of quantifiers
The order of nested quantifiers does not matter if quantifiers
are of the same type
Example:
For all x and y, if x is a parent of y then y is a child of x
Assume:
Parent(x,y) denotes x is a parent of y
Child(x,y) denotes x is a child of y
Two equivalent ways to represent the statement:
x y Parent(x,y) Child(y,x)
y x Parent(x,y) Child(y,x)
Translation exercise
Suppose:
Variables x,y denote people
L(x,y) denotes x loves y.
Translate:
x L(x,Raymond)
Everybody loves Raymond.
Everybody loves somebody.
xy L(x,y)
There is somebody whom everybody loves. yx L(x,y)
There is somebody who Raymond doesn't love.
yL(Raymond,y)
Negation of quantifiers
English statement:
Nothing is perfect.
Translation: x Perfect(x)
Another way to express the same meaning:
Everything is imperfect.
Translation: x Perfect(x)
Conclusion: x P (x) is equivalent to x P(x)
Negation of quantifiers
English statement:
It is not the case that all dogs are fleabags.
Translation: x Dog(x) Fleabag(x)
Another way to express the same meaning:
There is a dog that is not a fleabag.
Translation: x Dog(x) Fleabag(x)
Logically equivalent to:
x ( Dog(x)
Fleabag(x) )
Conclusion: x P (x) is equivalent to x P(x)
Equivalent
x P(x)
x P(x)
conclusion
Example:
Fermats Little theorem:
If p is a prime and a is an integer not divisible by p,
then: a p 1 1 mod p
conclusion
Example:
Premises (hypotheses)
Fermats Little theorem:
If p is a prime and a is an integer not divisible by p,
then: a p 1 1mod p
conclusion
Formal proofs
Proof:
Provides an argument supporting the validity of the statement
Proof of the theorem:
shows that the conclusion follows from premises
may use:
Premises
Axioms
Results of other theorems
Formal proofs:
steps of the proofs follow logically from the set of premises and
axioms
Formal proofs
Formal proofs:
show that steps of the proofs follow logically from the set of
hypotheses and axioms
hypotheses
conclusion
+
axioms
Rules of inference
Rules of inference: logically valid inference patterns
Example;
Modus Ponens, or the Law of Detachment
Rule of inference
p
p q q
Rules of inference
Rules of inference: logically valid inference patterns
Example;
Modus Ponens, or the Law of Detachment
Rule of inference
p
p q q
implicat
ion
p q is true then q is true.
Given p is true and the
p
False
False
True
True
q
False
True
False
True
pq
True
True
False
True
Rules of inference
Rules of inference: logically valid inference patterns
Example;
Modus Ponens, or the Law of Detachment
Rule of inference
p
p q
q
p q is true then q is true.
Given p is true and the implicat
ion
pq
p
False
False
True
True
q
False
True
False
True
True
True
False
True
Rules of inference
Rules of inference: logically valid inference patterns
Example;
Modus Ponens, or the Law of Detachment
Rules of inference
p
p q q