0% found this document useful (0 votes)
10 views70 pages

Lecture Ten - Predicate Logic

The document discusses various concepts in logic, including universal and existential quantification, satisfaction and validity, and the negation of quantifiers. It explains the syntax of first-order logic, predicates, free and bound variables, and substitution. Additionally, it covers the use of restrictions in quantifiers and provides examples and laws related to these topics.

Uploaded by

abduljawadmunir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views70 pages

Lecture Ten - Predicate Logic

The document discusses various concepts in logic, including universal and existential quantification, satisfaction and validity, and the negation of quantifiers. It explains the syntax of first-order logic, predicates, free and bound variables, and substitution. Additionally, it covers the use of restrictions in quantifiers and provides examples and laws related to these topics.

Uploaded by

abduljawadmunir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

Topics

• Universal quantification
• Existential quantification
• Satisfaction and validity
• The negation of quantifiers
• Free and bound variables
• Substitution
• Restriction
• Uniqueness
• Equational reasoning
• Natural deduction
• One point rule
Page 2
Pros and cons of propositional
logic
• Propositional logic is declarative

• Propositional logic allows conjunction, disjunction,


negated information

• Propositional logic is compositional:


• meaning of B1,1  P1,2 is derived from meaning of B1,1 and of
P1,2

• Meaning in propositional logic is context-independent


(unlike natural language, where meaning depends on context)

• Propositional logic has very limited expressive power


(unlike natural language)
First-order logic
• Whereas propositional logic assumes the world
contains facts,
• first-order logic (like natural language) assumes the
world contains
– Objects: people, houses, numbers, colors, baseball
games, wars, …
– Relations & functions: red, round, prime, brother
of, bigger than, part of, comes between, father of,
best friend, one more than, plus, …
Syntax of FOL: Basic elements
• Constants KingJohn, 2, NUS,...
• Functions Sqrt, LeftLegOf,...
• Variables x, y, a, b,...
• Connectives , , , , 
• Equality =
• Quantifiers , 
Predicates
• A predicate is a proposition whose truth
depends on the value of one or more
variables.
• For example, “n is a perfect square” is a
predicate whose truth depends on the value
of n.
• A function like notation is used to denote a
predicate supplied with specific variable
values. P(n)=“n is a perfect square”
• P(4) is true and P(5) is false.

Page 6
Universal Quantification
• Universal Quantification denoted as 
• Universal Quantification allows us to capture
statements of the form “for all” or “for every”.
• For example, “every natural number is
greater than or equal to zero” can be written
formally as
n : N  n  0

Page 7
Universal Quantification
• A quantified statement consists of three
parts: the quantifier, the quantification,
which describes the variables and the type of
variable with which the statement is
concerned and the predicate which is
normally some statement about the
quantified variables.
• Every predicate logic statement can be
considered as follows
quantifier quantifica tion  predicate
Page 8
Universal Quantification

m, n : N  m  n  m  n  m  n
m : N ; n : N  m  n  m  n  m  n
m : N  n : N  m  n  m  n  m  n

p : People; d : Dog  p is small  p owns d  d is small

Page 9
Exercise
• Everybody likes Jaffa cakes
• All vegetarians don’t like Jaffa cakes
• Everybody either likes Jaffa cakes or is
a vegetarian
• Either every body likes Jaffa cakes or
everybody is a vegetarian

Page 10
Solution

x : People  x likes Jaffa cakes


x : People  (x is vegetarian  (x likes Jaffa cakes))
x : People  (x likes Jaffa cakes  x is vegetarian)
(x : People  x likes Jaffa cakes)  (x : People  x is vegetarian)

Page 11
Universal Quantification
• Law 1
((x : X  p )  (x : X  q ))  (x : X  p  q )

• Example
((p : Person  p is tall)  (p : Person  p is strong)) 
(p : Person  p is tall  p is strong)

Page 12
Universal Quantification
• Law 2
(x : X  p  q )  ((x : X  p )  (x : X  q ))

• Example
((p : Person  p is tall)  (p : Person  p is strong)) 
(p : Person  p is tall  p is strong)

Page 13
Existential quantification
• Existential quantifier denoted by 
• As universal quantification is used to
assert that a certain property holds of
every element of a set, existential
quantification is used to assert that such a
property holds of some (or at least)
elements of a set
• “Some natural numbers are divisible by 3”
may be written as n : N  n mod 3  0
Page 14
Exercise
• Some people like Jaffa cakes
• Some vegetarians don’t like Jaffa cakes
• Some people either like Jaffa cakes or
are vegetarian
• Either some people like Jaffa cakes or
some people are vegetarian

Page 15
Solution
x : People  x likes Jaffa cakes
x : People  x is vegetarian  (x likes Jaffa cakes)
x : People  (x likes Jaffa cakes  x is vegetaria n)
(x : People  x likes Jaffa cakes)  (x : People  x is vegetarian)

Page 16
Existential quantification
• Law 3
(x : X  p  q )  ((x : X  p )  (x : X  q ))

• Example
(c : Car  fast (c )  small (c )) 
((c : Car  fast (c ))  (c : Car  small (c )))

Page 17
Existential quantification
• Law 4
(x : X  p  q)  ((x : X  p )  (x : X  q ))

• Example
c : Car  fast (c)  small (c)) 
((c : Car  fast (c))  (c : Car  small (c)))

Page 18
Satisfaction and validity
• The predicate n>3 can be considered neither true
nor false unless we know the value associated with
n

• A predicate p is valid if and only if it is true for all


possible values of the appropriate type. That is, if a
predicate p is associated with a variable x of type X,
then p is valid if, and only if,
x : X  p is true
• Example
The predicate n  0 is valid as n : N  n  0 is equivalent to true
Page 19
Satisfaction and validity
• A predicate p is satisfiable if and only if it is
true for some values of the appropriate type.
That is, if a predicate p is associated with a
variable x of type X, then p is satisfiable if,
and only if , x : X  p is true

• Example
The predicate n  0 is satisfiabl e as n : N  n  0
is equivalent to true

Page 20
Satisfaction and validity
• A predicate p is unsatisfiable if, and only if, it
is false for all possible values of the
appropriate type.

• If a predicate p is associated with a variable x


of type X, then p is unsatisfiable if, and only
if,
x : X  p is false

Page 21
Satisfaction and validity
• The analogies between valid, satisfiable and
unsatisfiable predicates, and tautologies,
contingencies and contradictions:
• valid predicates and tautologies are always
true
• satisfiable predicates and contingencies are
sometimes true and sometimes false
• unsatisfiable predicates and contradictions
are never true

Page 22
The negation of quantifiers
• The statement “some body like Brian” may
be expressed via predicate logic as
p : Person  p likes Brian

• To negate this expression, we may write as,


p : Person  p likes Brian

• which in natural language may be expressed


as “nobody likes Brian”

Page 23
The negation of quantifiers
• Logically saying “nobody likes Brian” is equivalent to
saying “everybody does not like Brian”.
• The negation of quantifiers behaves exactly in this
fashion, just as in natural language, “nobody likes
Brian” and “everybody does not like Brian” are
equivalent so in predicate logic
(p : Person  p likes Brian)
• And
p : Person  ( p likes Brian)

• are equivalent.

Page 24
The negation of quantifiers
• Law 5

(x : X  p )  x : X  p
(x : X  p )  x : X  p

• When negation is applied to a quantified


expression it flips quantifiers as it moves
inwards(i.e negation turns all universal
quantifiers to existential quantifiers and vice
versa, and negates all predicates)

Page 25
The negation of quantifiers
• Consider the statement,
x : X  y : Y  z : Z  p ( x, y , z )

• The effect of negation of this expression can


be determined as,
x : X  y : Y  z : Z  p ( x, y, z )
 x : X  y : Y  z : Z  p( x, y, z )
 x : X  y : Y  z : Z  p ( x, y, z )
 x : X  y : Y  z : Z  p ( x, y, z )
Page 26
Exercise
• Everyone likes everyone
• Everyone likes someone
• Someone likes everyone
• Someone likes someone

Page 27
Free and bound variables
• Consider two predicates
• n>5…..Eq. 1
n : N  n  5.....Eq.2

• In equation 2, the variable n is bound, it


is existentially quantified variable.
• In equation 1, n is free as its value may
not be determined or restricted

Page 28
Free and bound variables
• Example
(y : People  y likes robin)  x likes richard
• In this statement, y and x are two variables. y is
universally quantified and it is bound, while x is free
variable.
• In statement, x : X  p
• The occurrence of x in the declaration is binding, any
occurrences of x in p are bound, and any occurrences
of any variables other than x are free

Page 29
Free and bound variables
• Example

(x : N  x  0  y  x )  x  3
• Exercise, Determine the scope of the universal and
existential quantifiers of the following predicate,

(x : X  p  (y : Y  q )  r )
• The distinction between predicates and propositions can
be stated as predicates are logical statements which can
contain free variables while propositions are logical
statements which contain no such holes
Page 30
Substitution
• Consider statement,
n : N  n  5
• we may replace the name n with any term t,
provided that t is of the same type as n. This process
is called substitution: the expression p[t/n] denotes
the fact that the term t is being substituted for the
variable name n in the predicate p.

• Example, we may denote the substitution of 3 for n


in the predicate n>5 by
n  5[3 / n]
Page 31
Substitution
• Also, we may denote the substitution of 3+4
for n in n>5 by
n>5[3+4/n]
• Substitution is only for free variables

Page 32
Substitution
• More than one substitution in case of more than one free
variable
x is happy  y is sad
• Consider predicate,
• Here x and y are both free variables. We may substitute
nigel for x as follows,
(x is happy  y is sad)[nigel /x] 
nigel is happy  y is sad

• Now substituting ken for y,


(nigel is happy  y is sad)[ken/y]
nigel is happy  ken is sad

Page 33
Substitution
• Similarly, in one step, overall substitution may be
denoted as,
(x is happy  y is sad)[nigel/x][ken/y]
• These two substitutions take place sequentially,
first nigel is substituted for x, then ken is
substituted for y. However, for simultaneous
substitutions,
(x is happy  y is sad)[nigel /x, ken/y]

Page 34
Substitution
• To illustrate the difference between sequential and
simultaneous substitution, consider the example,

( x  3  y  7)[ y / x,8 / y ]
 y  38  7
( x  3  y  7)[ y / x][8 / y ]
 y  3  y  7[8 / y ]
 8  38  7
 true

• In former there is only one occurrence of y and in latter


there are two occurrences of y
Page 35
Restriction
• Filters role in predicate logic
• Considering an example, all natural numbers
which are prime numbers and are greater
than 2 are odd, may be written as,
n : N  (n is prime  n  2)  n is odd

• Using a filter, statement may be written as,


n : N | n is prime  n  2  n is odd

• Form of restricted predicates as,


quantifier quantifica tion | restrictio n  predicate
Page 36
Restriction
• Restriction can also be used in existential
quantification, “there has been a female
British Prime Minister”, may be written as
p : People | p is female  p was a British Prime Minister

universal quantifica tion | restrictio n  predicate


universal quantifica tion  restrictio n  predicate

n : N | n is prime  n  2  n is odd
n : N  (n is prime  n  2)  n is odd

Page 37
Restriction
• Law 6
(x : X | p  t)  (x : X  p  t)

• Law 7
(x : X | p  t )  (x : X  p  t )

Page 38
Exercise
• Represent the following statement in the
form,
quantifier quantifica tion | restrictio n  predicate

• Everyone who likes cheese likes spam


• There is a person who likes cheese that
likes spam
• Everyone who likes cheese also likes spam
and likes bananas

Page 39
Solution
p : People | p likes cheese  p likes spam
p : People | p likes cheese  p likes spam
p : People | p likes cheese  p likes spam  p likes bananas

Page 40
Uniqueness
• Existential quantifier, allows us to represent
statements such as “there is at least one x,
such that…”.
• In order to be more specific, consider, “there
is exactly one x, such that…”
• Consider an example statement,
x : N  x  1  1
it is the case that the predicate x+1=1 is true
for exactly one natural number:0
Page 41
Uniqueness
• The operator which allow us to state that “
there is exactly one natural number, x, is
denoted as 1
1 x : N  x  1  1
• As an example,
1c : Country  c is a richest

Page 42
Uniqueness
• Assuming the statement
1 x : X  p
• It is sometimes useful to pinpoint exactly which
element of X for which predicate p holds. Also, it
is convenient to perform some operation on this
value.
• The µ operator allows us to do exactly this, the
statement (µx:X | p) is read as “ the unique x
from set X such that p holds of x”
• Example, (µx:N | x+1=1) where µ is associated
with value 0
Page 43
Uniqueness
• When a unique element of the relevant type does possess
the relevant property, then we are free to construct
statements as given previously
• On the other hand, µ expressions that are not associated
with a unique element generate an undefined value.
• As an example, the µ expressions
(µn:N | n is even)
and
(µc:Country | population (c) > 10,000,000)
are both undefined

Page 44
Uniqueness
• We can incorporate terms into set
comprehensions, so we can apply terms in µ
expressions. Expressions of the form,
( x : X | p  t )
• return the result of applying the term t to the
unique element of the set X which satisfies the
predicate p
( c : Country | c is richest  capital(c))

• gives the value Washington

Page 45
Uniqueness
• If there is no unique element which possesses
the relevant property, then the result is
undefined
(  n : N | n is even  n 2 )
• and
(  c : Country | population (c)  10,000,000  capital(c))
• are both undefined.

Page 46
Exercise
• Write the following in terms of µ
expressions
– The tallest mountain in the world
– The height of the tallest mountain
– The oldest person in the world
– The nationality of the oldest person in the
world
– The smallest natural number

Page 47
Solution

( m : Mountain | m is tallest in world)


( m : Mountain, , m is tallest in world  height(m))
( p : People | p is oldest in world
( p : People | p is oldest in world  nationalit y(p))
( n : N | (m : N  n  m))

Page 48
Equational Reasoning
• Two methods of reasoning
– Equational reasoning
– Natural deduction
• Also,
x : X | p  t
x : X  p  t
x : X | p  t
x : X  p  t

Page 49
Equational Reasoning
• Law 8
If a predicate holds for all elements of a set,
then it holds for some of them
x : X  p  x : X  p
• Law 9
If a predicate holds for exactly one element
of a set, then it holds for at least one of them
1 x : X  p  x : X  p

Page 50
Equational Reasoning
• Law 10
If p holds for all elements of X and t is a term of type
X, then p holds for t
(x : X  p(x)  tX)  p(t)
Example, prime(x)  x  2  x is odd
The predicate
holds for all natural numbers. The term 3+4 is of type N
and as such,
prime(3  4)  3  4  2  3  4 is odd
holds.
Page 51
Equational Reasoning
• Law 11
This law states that if t is a term of type X
and p holds of t, then we can conclude that
p holds for some elements of X
(tX  p (t ))  (x : X  p ( x))

• Example
The proposition 7εN is true and furthermore
7 is prime. As such, n : N  n is prime

Page 52
Equational Reasoning
• The quantification of any variables with regards to propositions
which are always true or always has absolutely no effect. This
notion is captured by following laws,

• Law 12
(x : X  true)  true

• Law 13
(x : X  true)  true
• Law 14
(x : X  false)  false
• Law 15
(x : X  false)  false
Page 53
Equational Reasoning
• The predicate x : X  p(x)  y  z is concerned
with three variables: x, y and z.
• x is bound and y and z are free. As x does not
appear in the predicate y=z, we are free to
assume that the existential quantification of x
has no effect on the truth or falsity of that
predicate.
• We conclude that following equivalence holds.
x : X  ( p( x)  y  z ) 
(x : X  p( x))  y  z

Page 54
Equational Reasoning
• Law 16
It states that as x does not appear free in q,
the following holds
(x : X  p  q )  ((x : X  p )  q )
• Example,
(n : N  n  3  l  10)  ((n : N  n  3)  l  10)

Page 55
Equational Reasoning
• Law 17
It states that as x does not appear free in q,
the following holds,
(x : X  p  q)  ((x : X  p)  q )

• Example
(n : N  n  3  l  10)  ((n : N  n  3)  l  10)

Page 56
Equational Reasoning
• Law 18
It states as x does not appear free in q, the
following holds
(x : X  p  q)  ((x : X  p )  q)

• Example
(p : Person  p likes spam  l  10) 
((p : Person  p likes spam)  l  10)

Page 57
Equational Reasoning
• Law 19
It states as x does not appear free in q, the
following holds
(x : X  p  q )  ((x : X  p )  q )

• Example
(p : Person  p likes spam  l  10) 
((p : Person  p likes spam)  l  10)

Page 58
Equational Reasoning
• Example: A theorem in predicate logic
(x : X  p  q )  (x : X  p  q )

• Proof:
x : X  p  q
 x : X  ( p  q) (law 5)
 x : X  (p  q ) (propositi onal law)
 x : X  p  q (propositi onal law)

Page 59
Equational Reasoning
• Example Theorem
((x : X  p)  (x : X  q))  (x : X  p  q)
((x : X  p)  (x : X  q))
 (x : X  p)  (x : X  q) (propositi onal law)
 (x : X  p)  (x : X  q) (law 5)
 (x : X  p)  (x : X  q) (law 8)
 x : Xp  q (law 3)
 x : X  p  q (law 18)

Page 60
Exercise

(x : X  p  q )  ((x : X  p )  (x : X  q ))

Page 61
Solution
x : X  p  q
 x : X  p  q (propositi onal law)
 (x : X  p )  (x : X  q ) (law 3)
 (x : X  p )  (x : X  q ) (law 5)
(x : X  p)  (x : X  q) (law 18)

Page 62
Natural deduction
• Natural deduction can also be extended to
predicate logic
• Natural deduction rules for universal
quantification
x : X  p tx
( elim)
p (t / x )
• Rule1 states that if p holds for all values of X,
then provided that t is of type X- p holds for t

Page 63
Natural deduction
• Example:
All natural numbers which are prime and greater than
2 are odd. 7 is prime and greater than 2 and we may
conclude that it is odd.
n : N | prime(n)  n  2  odd(n) prime(7)  7  2 7N
( elim)
odd (7)

Page 64
Natural deduction
• Rules for existential quantification
If xεX such that p holds for x, then if we
are able to define further predicate, q in
which x does not appear free, then we
may conclude q
x : X | p  q
q

Page 65
Natural deduction
• Intro rule
• If p is true for any term t of set X, then we
conclude that, x : X  p holds
tX p[t/x]
( intro)
x : X  p

7N prime(7)
( intro)
n : N  prime(n)

Page 66
Natural deduction
• Example

tX p[t/x] q[t/x]


( intro)
x : X | p  q

Page 67
The one-point rule
p : Person  p likes emily  p  rick
• It states that p is a person that likes Emily, but also
that the name of person is Rick
• We can conclude that rick ε Person and rick likes
emily are both true

• Law 20
(x : X  p  x  t)  (t  x  p(t/x))
x : X  p  x  t
p[t/x]  t  X
Page 68
The one-point rule
• Example
p : Person  p owns a red car  p  becky
becky  Person  becky owns a red car
p[t/x]  t  X
x : X  p  x  t

becky owns a red car  becky  Person


p : Person  p owns a red car  p  becky

Page 69
References
• Discrete Mathematics with Examples
by Simpson

Page 70
Thank you!

Page 71

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy