notes_2_predicatelogic (1)
TRANSCRIPT
-
8/17/2019 NOTES_2_predicateLogic (1)
1/61
Discrete Mathematicsand Applications
COT3100
Prof: A. Ungor
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
2/61
COT31002
Foundations of
Logic: Overview • Propositional logic: (Sections 1.1-1.3)
• Basic definitions.
• Equivalence rules & derivations.
• Predicate logic (Section 1.4, 1.5)
• Predicates.
• Quantified predicate expressions.
• Equivalences & derivations.
• Nested Quantifiers
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
3/61
COT31003
Predicate Logic
• Predicate logic is an extension of propositional logic
that permits concisely reasoning about whole classes
of entities.
E.g., “x>1”, “ x+y=10”
• Such statements are neither true or false whenthe values of the variables are not specified.
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
4/61
COT31004
Applications of
Predicate Logic• It is the formal notation for writing perfectly
clear, concise, and unambiguous
mathematical definitions, axioms, and theoremsfor any branch of mathematics.
• Supported by some of the more sophisticateddatabase query engines.
• Basis for automatic theorem provers and manyother Artificial Intelligence systems.
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
5/61
COT31005
Subjects and
Predicates• The proposition
“The dog is sleeping”has two parts:
• “the dog” denotes the subject - the object or entity
that the sentence is about.
• “is sleeping” denotes the predicate-
.
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
6/61
COT31006
Propositional
Functions• A predicate is modeled as a function P (·) from
objects to propositions.
° P ( x) = “ x is sleeping” (where x is any object).
• The result of applying a predicate P to an object x=a is the proposition P (a).
°e.g. if P (
x) = “ x > 1”, then P (3) is the proposition “3 is greater than 1.”
•
The predicate P itself (e.g. P =“is sleeping”)is not a proposition (not a complete sentence).
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
7/61
COT31007
Propositional
Functions
• Predicate logic includes propositional
functions of any number of arguments.
e.g. let P ( x, y,z ) = “ x gave y the grade z ”,
x=“Mike”, y=“Mary”, z =“A”,
P ( x, y, z ) = “Mike gave Mary the grade A.”
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
8/61
COT31008
Universe of
Discourse
•The collection of values that a variable x can takeis called x"s universe of discourse.
e.g., let P ( x)=“ x+1> x”.
we could define the course of universe as the.
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
9/61
COT31009
Quantifier
Expressions• Quantifiers allow us to quantify (count) how many
objects in the universe of discourse satisfy a given
predicate:
- “!” is the FOR!LL or universal quantifier.
! x P ( x) means ., P holds.
- “"” is the "XISTS or existential quantifier.
" x P ( x) means (that
is, one or more) such that P ( x) is true.
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
10/61
COT310010
Universal Quantifier
!: Example
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
11/61
COT310010
Universal Quantifier
!: Example• Let P ( x) be the predicate “ x is full.”
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
12/61
COT310010
Universal Quantifier
!: Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
13/61
COT310010
Universal Quantifier
!: Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The universal quantification of P ( x),
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
14/61
COT310010
Universal Quantifier
!: Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The universal quantification of P ( x),
! x P ( x), is the proposition:
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
15/61
COT310010
Universal Quantifier
!: Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The universal quantification of P ( x),
! x P ( x), is the proposition:
• “All parking spaces at UF are full.” or
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
16/61
COT310010
Universal Quantifier
!: Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The universal quantification of P ( x),
! x P ( x), is the proposition:
• “All parking spaces at UF are full.” or
• “Every parking space at UF is full.” or
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
17/61
COT310010
Universal Quantifier
!: Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The universal quantification of P ( x),
! x P ( x), is the proposition:
• “All parking spaces at UF are full.” or
• “Every parking space at UF is full.” or
• “For each parking space at UF, that space is full.”
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
18/61
COT310011
The Universal
uantifier !
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
19/61
COT310011
The Universal
uantifier !• To prove that a statement of the form
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
20/61
COT310011
The Universal
uantifier !• To prove that a statement of the form
! x P ( x) is false, it suffices to find acounterexample (i.e., one value of x in the
universe of discourse such that P ( x) is false)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
21/61
COT310011
The Universal
uantifier !• To prove that a statement of the form
! x P ( x) is false, it suffices to find acounterexample (i.e., one value of x in the
universe of discourse such that P ( x) is false)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
22/61
COT310011
The Universal
uantifier !• To prove that a statement of the form
! x P ( x) is false, it suffices to find acounterexample (i.e., one value of x in the
universe of discourse such that P ( x) is false)
• e.g., P ( x) is the predicate “x>0”
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
23/61
COT310012
Existential Quantifier
" Example
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
24/61
COT310012
Existential Quantifier
" Example• Let P ( x) be the predicate “ x is full.”
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
25/61
COT310012
Existential Quantifier
" Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
26/61
COT310012
Existential Quantifier
" Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The existential quantification of P ( x),
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
27/61
COT310012
Existential Quantifier
" Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The existential quantification of P ( x),
" x P ( x), is the proposition:
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
28/61
COT310012
Existential Quantifier
" Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The existential quantification of P ( x),
" x P ( x), is the proposition:
•“Some parking space at UF is full.” or
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
29/61
COT310012
Existential Quantifier
" Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The existential quantification of P ( x),
" x P ( x), is the proposition:
•“Some parking space at UF is full.” or
• “There is a parking space at UF that is full.” or
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
30/61
COT310012
Existential Quantifier
" Example• Let P ( x) be the predicate “ x is full.”
• Let the u.d. of x be .
• The existential quantification of P ( x),
" x P ( x), is the proposition:
•“Some parking space at UF is full.” or
• “There is a parking space at UF that is full.” or
• “At least one parking space at UF is full.”
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
31/61
COT310013
Quantifier
Equivalence Laws• Definitions of quantifiers: If u.d.=a,b,c,…
! x P ( x) # P (a) $ P (b) $ P (c) $ …
" x P ( x) # P (a) % P (b) % P (c) % …
• We can prove the following laws:
! x P ( x) # ¬" x ¬ P ( x)
" x P ( x)
# ¬!
x¬
P ( x)
• Which propositional equivalence laws can be
used to prove this?
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
32/61
COT310013
Quantifier
Equivalence Laws• Definitions of quantifiers: If u.d.=a,b,c,…
! x P ( x) # P (a) $ P (b) $ P (c) $ …
" x P ( x) # P (a) % P (b) % P (c) % …
• We can prove the following laws:
! x P ( x) # ¬" x ¬ P ( x)
" x P ( x)
# ¬!
x¬
P ( x)
• Which propositional equivalence laws can be
used to prove this?
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
33/61
COT310014
More Equivalence
Laws• ¬" x P ( x) # ! x ¬ P ( x)
¬! x P ( x) # " x ¬ P ( x)
• ! x ! y P ( x, y) # ! y ! x P ( x, y)
" x " y P ( x, y) # " y " x P ( x, y)
• ! x ( P ( x) $ Q( x)) # (! x P ( x)) $ (! x Q( x))
" x ( P ( x) % Q( x)) # (" x P ( x)) % (" x Q( x))
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
34/61
COT310015
Scope of Quantifiers
• The part of a logical expression to which a
quantifier is applied is called the scope of thisquantifier.
e.g., (! x P ( x)) $ (" y Q( y))
e.g., (! x P ( x)) $ (" x Q( x))
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
35/61
COT310016
Free and Bound
Variables• An expression like P ( x) is said to have a free
variable x (meaning x is undefined).
• A quantifier (either ! or ") operates on an
expression having one or more free variables,and binds one or more of those variables, to
produce an expression having one or morebound variables.
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
36/61
COT310017
Examples of
Binding • P ( x,y) has 2 free variables, x and y.
• ! x P ( x, y) has 1 free variable, and one bound
variable. [which is which?]
• “ P ( x), where x=3” is another way to bind x.
• An expression with free variables is an
actual proposition.
• An expression with one or more free variables is
still only a predicate: ! x P ( x, y)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
37/61
COT310017
Examples of
Binding • P ( x,y) has 2 free variables, x and y.
• ! x P ( x, y) has 1 free variable, and one bound
variable. [which is which?]
• “ P ( x), where x=3” is another way to bind x.
• An expression with free variables is an
actual proposition.
• An expression with one or more free variables is
still only a predicate: ! x P ( x, y)
y
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
38/61
COT310017
Examples of
Binding • P ( x,y) has 2 free variables, x and y.
• ! x P ( x, y) has 1 free variable, and one bound
variable. [which is which?]
• “ P ( x), where x=3” is another way to bind x.
• An expression with free variables is an
actual proposition.
• An expression with one or more free variables is
still only a predicate: ! x P ( x, y)
y
x
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
39/61
COT3100 18
More to Know
About Binding • ! x " x P ( x) - x is not a free variable in" x P ( x), therefore the ! x binding isn"t used.
• (! x P ( x)) $ Q( x) - The variable x is outside of
the scope of the ! x quantifier, and istherefore free. Not a proposition.
• (! x P ( x)) $ (" x Q( x)) - Legal because there
are 2 x"s!
• Quantifiers bind as loosely as needed:parenthesize ! x P ( x) $ Q( x)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
40/61
COT3100 18
More to Know
About Binding • ! x " x P ( x) - x is not a free variable in" x P ( x), therefore the ! x binding isn"t used.
• (! x P ( x)) $ Q( x) - The variable x is outside of
the scope of the ! x quantifier, and istherefore free. Not a proposition.
• (! x P ( x)) $ (" x Q( x)) - Legal because there
are 2 x"s!
• Quantifiers bind as loosely as needed:parenthesize ! x P ( x) $ Q( x)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
41/61
COT3100 18
More to Know
About Binding • ! x " x P ( x) - x is not a free variable in" x P ( x), therefore the ! x binding isn"t used.
• (! x P ( x)) $ Q( x) - The variable x is outside of
the scope of the ! x quantifier, and istherefore free. Not a proposition.
• (! x P ( x)) $ (" x Q( x)) - Legal because there
are 2 x"s!
• Quantifiers bind as loosely as needed:parenthesize ! x P ( x) $ Q( x)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
42/61
COT3100 18
More to Know
About Binding • ! x " x P ( x) - x is not a free variable in" x P ( x), therefore the ! x binding isn"t used.
• (! x P ( x)) $ Q( x) - The variable x is outside of
the scope of the ! x quantifier, and istherefore free. Not a proposition.
• (! x P ( x)) $ (" x Q( x)) - Legal because there
are 2 x"s!
• Quantifiers bind as loosely as needed:parenthesize ! x P ( x) $ Q( x)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
43/61
COT3100 18
More to Know
About Binding • ! x " x P ( x) - x is not a free variable in" x P ( x), therefore the ! x binding isn"t used.
• (! x P ( x)) $ Q( x) - The variable x is outside of
the scope of the ! x quantifier, and istherefore free. Not a proposition.
• (! x P ( x)) $ (" x Q( x)) - Legal because there
are 2 x"s!
• Quantifiers bind as loosely as needed:parenthesize ! x P ( x) $ Q( x)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
44/61
COT3100 18
More to Know
About Binding • ! x " x P ( x) - x is not a free variable in" x P ( x), therefore the ! x binding isn"t used.
• (! x P ( x)) $ Q( x) - The variable x is outside of
the scope of the ! x quantifier, and istherefore free. Not a proposition.
• (! x P ( x)) $ (" x Q( x)) - Legal because there
are 2 x"s!
• Quantifiers bind as loosely as needed:parenthesize ! x P ( x) $ Q( x)( )
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
45/61
COT3100 19
Nested Quantifiers
Exist within the scope of other quantifiers
• Let the u.d. of x & y be people.
• Let P ( x, y)=“ x likes y” (a predicate with 2 f.v."s)
• Then " y P ( x,y) = “There is someone whom x
likes.” (a predicate with 1 free variable, x)
• Then ! x (" y P ( x,y)) = “Everyone has someone
whom they like.”
(A __________ with ___ free variables.)
(Section 1.5)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
46/61
COT3100 19
Nested Quantifiers
Exist within the scope of other quantifiers
• Let the u.d. of x & y be people.
• Let P ( x, y)=“ x likes y” (a predicate with 2 f.v."s)
• Then " y P ( x,y) = “There is someone whom x
likes.” (a predicate with 1 free variable, x)
• Then ! x (" y P ( x,y)) = “Everyone has someone
whom they like.”
(A __________ with ___ free variables.)
(Section 1.5)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
47/61
COT3100 19
Nested Quantifiers
Exist within the scope of other quantifiers
• Let the u.d. of x & y be people.
• Let P ( x, y)=“ x likes y” (a predicate with 2 f.v."s)
• Then " y P ( x,y) = “There is someone whom x
likes.” (a predicate with 1 free variable, x)
• Then ! x (" y P ( x,y)) = “Everyone has someone
whom they like.”
(A __________ with ___ free variables.)
(Section 1.5)
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
48/61
COT3100 20
Order of Quantifiers Is
Important!!
If P ( x, y)=“ x relies upon y,” express the following in
unambiguous English:
! x(" y P ( x,y))=
" y(! x P ( x,y))=
" x(! y P ( x,y))=
! y(" x P ( x,y))=
! x(! y P ( x,y))=
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
49/61
COT3100 20
Order of Quantifiers Is
Important!!
If P ( x, y)=“ x relies upon y,” express the following in
unambiguous English:
! x(" y P ( x,y))=
" y(! x P ( x,y))=
" x(! y P ( x,y))=
! y(" x P ( x,y))=
! x(! y P ( x,y))=
Everyone has someone to rely on.
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
50/61
COT3100 20
Order of Quantifiers Is
Important!!
If P ( x, y)=“ x relies upon y,” express the following in
unambiguous English:
! x(" y P ( x,y))=
" y(! x P ( x,y))=
" x(! y P ( x,y))=
! y(" x P ( x,y))=
! x(! y P ( x,y))=
Everyone has someone to rely on.
There’s a poor overworked soulwhom everyone relies upon
(including himself)!
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
51/61
COT3100 20
Order of Quantifiers Is
Important!!
If P ( x, y)=“ x relies upon y,” express the following in
unambiguous English:
! x(" y P ( x,y))=
" y(! x P ( x,y))=
" x(! y P ( x,y))=
! y(" x P ( x,y))=
! x(! y P ( x,y))=
Everyone has someone to rely on.
There’s a poor overworked soulwhom everyone relies upon
(including himself)!There’s some needy person who
relies upon everybody (including
himself).
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
52/61
COT3100 20
Order of Quantifiers Is
Important!!
If P ( x, y)=“ x relies upon y,” express the following in
unambiguous English:
! x(" y P ( x,y))=
" y(! x P ( x,y))=
" x(! y P ( x,y))=
! y(" x P ( x,y))=
! x(! y P ( x,y))=
Everyone has someone to rely on.
There’s a poor overworked soulwhom everyone relies upon
(including himself)!There’s some needy person who
relies upon everybody (including
himself).Everyone has someone who reliesupon them.
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
53/61
COT3100 20
Order of Quantifiers Is
Important!!
If P ( x, y)=“ x relies upon y,” express the following in
unambiguous English:
! x(" y P ( x,y))=
" y(! x P ( x,y))=
" x(! y P ( x,y))=
! y(" x P ( x,y))=
! x(! y P ( x,y))=
Everyone has someone to rely on.
There’s a poor overworked soulwhom everyone relies upon
(including himself)!There’s some needy person who
relies upon everybody (including
himself).Everyone has someone who reliesupon them.
Everyone relies upon everybody,
(including themselves)!
Sunday, January 12, 2014
N t l l g g i
-
8/17/2019 NOTES_2_predicateLogic (1)
54/61
COT3100 21
Natural language is
ambiguous!• “Everybody likes somebody.”
• For everybody, there is somebody they like,
• ! x " y Likes( x, y)
• or, there is somebody (a popular person) whomeveryone likes?
• " y ! x Likes( x, y)
Sunday, January 12, 2014
N t l l g g i
-
8/17/2019 NOTES_2_predicateLogic (1)
55/61
COT3100 21
Natural language is
ambiguous!• “Everybody likes somebody.”
• For everybody, there is somebody they like,
• ! x " y Likes( x, y)
• or, there is somebody (a popular person) whomeveryone likes?
• " y ! x Likes( x, y)
Sunday, January 12, 2014
N t l l g g i
-
8/17/2019 NOTES_2_predicateLogic (1)
56/61
COT3100 21
Natural language is
ambiguous!• “Everybody likes somebody.”
• For everybody, there is somebody they like,
• ! x " y Likes( x, y)
• or, there is somebody (a popular person) whomeveryone likes?
• " y ! x Likes( x, y)
[Probably more likely.]
Sunday, January 12, 2014
N t ti l
-
8/17/2019 NOTES_2_predicateLogic (1)
57/61
COT3100 22
Notational
Conventions• Consecutive quantifiers of the same type
can be combined: ! x ! y ! z P ( x, y, z ) #! x,y,z P ( x, y, z ) or even ! xyz P ( x, y, z )
• Sometimes the universe of discourse isrestricted within the quantification, e.g.,
• ! x>0 P ( x) is shorthand for
“For all x that are greater than zero, P ( x).”
• " x>0 P ( x) is shorthand for“There is an x greater than zero such that P ( x).”
Sunday, January 12, 2014
D fi i g N
-
8/17/2019 NOTES_2_predicateLogic (1)
58/61
COT3100 23
Defining New
uantifiersAs per their name, quantifiers can be used to express
that a predicate is true of any given quantity
(number) of objects.
Define "! x P ( x) to mean “ P ( x) is true of exactly one x in
the universe of discourse.”
"! x P ( x) # " x ( P ( x) $ ¬" y ( P ( y) $ y& x))“There is an x such that P ( x), where there is no y
such that P( y) and y is other than x.”
Sunday, January 12, 2014
S N b
-
8/17/2019 NOTES_2_predicateLogic (1)
59/61
COT3100 24
Some Number
Theor Examples• Let u.d. = the natural numbers 0, 1, 2, …
• “A number x is even, E ( x), if and only if it is
equal to 2 times some other number.”
! x ( E ( x) ' (" y x=2 y))
• “A number is prime, P ( x), iff it isn"t the product
of two non-unity numbers.”
! x ( P ( x) ' (¬" y,z x= yz $ y&1 $ z &1))
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
60/61
COT3100 25
Calculus Example
• Precisely defining the concept of a limit using
quantifiers:
(limx→a f (x) = L) ⇔
(∀ > 0 : ∃δ > 0 : (|x− a| < δ ) → (�f (x) − L| < ))
Sunday, January 12, 2014
-
8/17/2019 NOTES_2_predicateLogic (1)
61/61
Reading
• Sections 1.6-1.8