Title: 6 : Predicates, Quantifiers
1??????6 Predicates, Quantifiers
Mathematical Induction
- ??????? (Kuang-Chi Chen)
- chichen6_at_mail.tcu.edu.tw
2Predicates Quantifiers
3Predicates
- The statement X is greater than 3 has 2
parts object (variable X) and predicate (is
greater than 3). - Let P(X) denote statement X is greater than 3,
where P denote the predicate is greater than 3.
P(X) is also said to be the value of
propositional function P() at X . - For example, let P(X) denote X gt 3, what are
the truth values of P(4) and P(2)?
4Predicates
- Let Q(x, y) denote the statement x y3, What
are the truth values of the propositions Q(1, 2)
and Q(3, 0)? - Let R(x, y, z) denote the statement xy z,
What are the truth values of the propositions
R(1, 2, 3) and R(0, 0, 1)? - A statement of the form P(x1, x2, , xn) is the
value of the propositional function P at the
n-tuple (x1, x2, , xn), and P is also called a
predicate.
5Predicate Logic
- Predicate logic is an extension of propositional
logic that permits concisely reasoning about
whole classes of entities. - Propositional logic (recall) treats simple
propositions (sentences) as atomic entities. - In contrast, predicate logic distinguishes the
subject of a sentence from its predicate. - - Remember these English grammar terms?
6Applications of Predicate Logic
- It is the formal notation for writing perfectly
clear, concise, and unambiguous mathematical
definitions, axioms, and theorems for any branch
of mathematics. - - Predicate logic with function symbols, the
operator, and a few proof-building rules is
sufficient for defining any conceivable
mathematical system, and for proving anything
that can be proved within that system!
7Other Applications
- Predicate logic is the foundation of thefield of
mathematical logic, which culminated in Gödels
incompleteness theorem, which revealed the
ultimate limits of mathematical thought - Given any finitely describable, consistent
proof procedure, there will always remain - some true statements that will never be
- proven by that procedure.
- i.e., we cant discover all mathematical truths,
unless we sometimes resort to making guesses.
Kurt Gödel1906-1978
8Practical Applications of Predicate Logic
- It is the basis for clearly expressed formal
specifications for any complex system. - It is basis for automatic theorem provers and
many other Artificial Intelligence systems. - E.g. automatic program verification systems.
- Predicate-logic like statements are supported by
some of the more sophisticated database query
engines and container class libraries. - - these are types of programming tools.
9Subjects and Predicates
- In the sentence The dog is sleeping
- - The phrase the dog denotes the subject
the object or entity that the sentence is about. - - The phrase is sleeping denotes the predicate
a property that is true of the subject. - In predicate logic, a predicate is modeled as a
function P() from objects to propositions. - - P(x) x is sleeping (where x is any object).
10More About Predicates
- Convention Lowercase variables x, y, z...
denote objects/entities uppercase variables P,
Q, R denote propositional functions
(predicates). - Keep in mind that the result of applying a
predicate P to an object x is the proposition
P(x). But the predicate P itself (e.g. P is
sleeping) is not a proposition (not a complete
sentence). - E.g. if P(x) x is a prime number, P(3) is
the proposition 3 is a prime number.
11Propositional Functions
- Predicate logic generalizes the grammatical
notion of a predicate to also include
propositional functions of any number of
arguments, each of which may take any grammatical
role that a noun can take. - E.g. let P(x, y, z) x gave y the grade z,
then ifx Mike, y Mary, z A, then - P(x, y, z) Mike gave Mary the grade A.
12Universes of Discourse (U.D.s)
- The power of distinguishing objects from
predicates is that it lets you state things about
many objects at once. - E.g., let P(x)x1 gt x. We can then say,For
any number x, P(x) is true instead of (01gt0) ?
(11gt1) ? (21gt2) ? ... - - The collection of values that a variable x can
take is called xs universe of discourse. (domain)
13Quantifiers
- Quantifiers provide a notation to quantify
(count) how many objects satisfy a given
predicate. - There are two types of quantifiers universal
quantification and existential quantification.
14Two Types of Quantifiers
- ? is the FOR?LL or universal quantifier.?x
P(x) means for all x in the u.d., P holds. - ? is the ?XISTS or existential quantifier.?x
P(x) means there exists an x in the u.d. (that
is, 1 or more) such that P(x) is true.
15The Universal Quantifier ?
- E.g., let the u.d. of x be parking spaces at TCU.
- Let P(x) be the predicate x is full.
- Then the universal quantification of P(x) is
- ?x P(x), is the proposition
-
- All parking spaces at TCU are full., i.e.,
- Every parking space at TCU is full., i.e.,
- For each parking space at TCU, that space is
full.
16The Existential Quantifier ?
- E.g., let the u.d. of x be parking spaces at TCU.
- Let P(x) be the predicate x is full.
- Then the existential quantification of P(x),
- ?x P(x), is the proposition
- Some parking space at TCU is full., i.e.,
- There is a parking space at TCU that is full.
- At least one parking space at TCU is full.
17Free 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 more bound variables.
18Example 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? y is free - P(x), where x3 is another way to bind x.
- An expression with zero free variables is a
bona-fide (actual) proposition. - An expression with one or more free variables is
still only a predicate e.g., Q(y) ?x P(x, y).
19Negations
- Let ?x P(x) be the statement of
- Every student in the class has taken a course
in calculus, where P(x) is x has taken a
course in calculus - What is its negation? ?x ?P(x)
- ? (?x P(x)) ?x ?P(x)
- ? (?x Q(x)) ?x ?Q(x)
20Translating from English into Logical Expressions
- Express Every student in this class has studied
Calculus using predicates and quantifiers. - Sol.1 Let C() be the predicate of has
studied Calculus. Assume universe of disclosure
of x consists of the students in the class. - Its ?x C(x).
21Translating from English into Logical Expressions
(contd)
- Sol.2 If the u.d. is all people. Let S() be the
predicate of is in this class. The solution
is ?x S(x) ? C(x). Not ?x S(x) ? C(x) ? - Sol.3 We concern about other subjects. Let Q(x,
y) be the predicate of student x has studied
subject y. The solution is ?x (S(x) ? Q(x,
Calculus)).
22Review Predicate Logic
- Objects x, y, z,
- Predicates P, Q, R, are functions mapping
objects x to propositions P(x). - Multi-argument predicates P(x, y).
- Quantifiers ?x P(x) For all xs, P(x).
?x P(x) There is an x such that P(x). - Universes of discourse, bound free variables.
23Induction
24Introduction to Induction
- A powerful, rigorous technique for proving that a
predicate P(n) is true for every natural number
n, no matter how large. - Essentially a domino effect principle.
25The First Principle of Mathematical Induction
- Based on a predicate-logic inference rule
- P(0)?n?0 (P(n) ? P(n1))??n?0 P(n)
26The Domino Effect
- Premise 1 Domino 0 falls.
- Premise 2 For every k?N,if domino k falls,
then so - does domino k1.
- Conclusion All ofthe dominoes fall down!
- Note this works even if there are
infinitely many dominoes!
27Validity of Induction
- Proof that ?n?0 P(n) is a valid consequent
- Given any k?0, the 2nd antecedent ?k?0
(P(k)?P(k1)) trivially implies that ?k?0
(kltn)?(P(k)?P(k1)), i.e., that (P(0)?P(1)) ?
(P(1)?P(2)) ? ? (P(n?1)?P(n)). - Repeatedly applying the hypothetical syllogism
rule to adjacent implications in this list n-1
times then gives us P(0)?P(n) which together
with P(0) (antecedent 1) and modus pones gives
us P(n). Thus ?n?0 P(n).
28Outline of An Inductive Proof
- Let us say we want to prove ?n P(n)
- Do the base case (or basis step) Prove P(0).
- Do the inductive step Prove ?n P(n)?P(n1).
- E.g. you could use a direct proof, as follows
- Let n?N, assume P(n). (inductive hypothesis)
- Now, under this assumption, prove P(n1).
- The inductive inference rule then gives us
- ?n P(n).
29Generalizing Induction
- Rule can also be used to prove ?n?c P(n) for a
given constant c?Z, where maybe c?0. - In this circumstance, the base case is to prove
P(c) rather than P(0), and the inductive step is
to prove ?n?c (P(n)?P(n1)). - Induction can also be used to prove?n?c P(an)
for any arbitrary series an. - Can reduce these to the form already shown.
30The Second Principle of Mathematical Induction
- Characterized by another inference rule
- P(0)
Strong Induction - ?n?0 (?0?k?n P(k)) ? P(n1)??n?0 P(n)
- The only difference between this and the 1st
principle is that - - the inductive step here makes use of the
stronger hypothesis that P(k) is true for all
smaller numbers k lt n1, not just for k n.
31 Examples of Induction
321st Principle Example
- Prove that the sum of the first n odd positive
integers is n2. That is, prove - Proof by induction
- Base case Let n1. The sum of the first 1 odd
positive integer is 1 which equals 12.(contd)
331st Principle Example (contd)
- Inductive step Prove ?? n1 P(n)?P(n1).
- Let n1, assume P(n), and prove P(n1)
- By inductive hypothesis P(n).
34Another Induction Example
- Prove that ??n gt 0, n lt 2n.
- Let P(n) (n lt 2n)
- Base case P(1) (1lt21) (1lt2) T.
- Inductive step For ngt0, prove P(n)?P(n1).
- Assuming n lt 2n, prove n 1 lt 2n1.
- Note n 1 lt 2n 1 (by inductive hypothesis)
- lt 2n 2n (1 lt 2 220 22n-1
2n) - 2n1
- So n 1 lt 2n1, and were done.
35More Induction Examples
- n3 n is divisible by 3
- 1 2 22 2n 2n1 1
- Sums of Geometric Progressions
- An Inequality for Harmonic Numbers
- , where
- DeMorgans law
- Number of Subsets of a finite set
- 2n lt n!
36More Induction Examples
- E.g. 9 Any chessboard with 2n2n squares but
with one removed can be tiled using L-shaped
pieces (which cover 3 squares at a time). - E.g. 10 The greedy algorithm (selects talk with
earliest ending time) schedules the most talks in
a single lecture halls.
37The Second Principle of Mathematical Induction
- Characterized by another inference rule
- P(0)
Strong Induction - ?n?0 (?0?k?n P(k)) ? P(n1)??n?0 P(n)
- The only difference between this and the 1st
principle is that - - the inductive step here makes use of the
stronger hypothesis that P(k) is true for all
smaller numbers k lt n1, not just for k n.
38The 2nd Principle of Math Induction
- P(n) ????,??n????
- 1. ? P(1), P(2), P(3), , P(q) ??,
- 2. ???????? 1?i?k ????
- (??q?k),P(i) ??,
- 3. ? 1 2 ???,? P(k1) ???,
- ? ?n?0 P(n) ???
392nd Principle Example
- Show that every ngt1 can be written as a product
? pi p1p2ps of some series of s prime
numbers. - Let P(n) n has that property
- Base case n 2, let s 1, p1 2.
- Inductive step Let n?2. Assume ??2 k n
P(k). - Consider n1. If its prime, let s 1, p1
n1.Else n1 ab, where 2 a n and 2 b
n.Then a p1p2pt and b q1q2qu. - Then we have that n1 p1p2pt q1q2qu, a
product of s tu primes.
40Another 2nd Principle Example
- Prove that every amount of postage of 12 cents or
more can be formed using just 4-cent and 5-cent
stamps. P(n) n can be - Base case 12 3(4), 13 2(4)1(5), 14
1(4)2(5), 15 3(5), so ?12?n?15, P(n). - Inductive step Let n15, assume ?12?k?n P(k).
- Note 12?n?3?n, so P(n?3), so add a 4-cent stamp
to get postage for n1.
41The Well-Ordering Property
- Another way to prove the validity of the
inductive inference rule is by the well-ordering
property, which says that - - Every non-empty set of non-negative integers
has a minimum (smallest) element. - - ? ??S?N ?m?S ?n?S m?n
- This implies that n?P(n) (if non-empty) has a
minimal element m, but then the assumption that
P(m-1)?P((m-1)1) would be contradicted.
42The Well-Ordering Property
- Any non-empty subset of Z contains a smallest
element. (Z is well ordered) - Example 1 If a is an integer and d is a positive
integer. There are unique integers q and r with
0?rltd and a dq r. - Example 2 If there is a cycle of length m (m?3)
among the players in a round-robin tournament,
there must be a cycle of three.
43The Method of Infinite Descent
- A way to prove that P(n) is false for all n?N.
- (Sort of a converse to the principle of
induction) - Prove first that ?P(n) ?kltn P(k).
- - Basically, For every P there is a smaller P.
- But by the well-ordering property of N, we know
that ?P(m) ? ?P(n) ?P(k) nk. - - Basically, If there is a P, there is a
smallest P. - Note that these are contradictory unless ?P(m),
- - that is, ?m?N P(m). There is no P.
44Infinite Descent
- Infinite DescentFor a propositional function
P(n), P(k) is false for all positive integers. - Example is irrational.
45Infinite Descent Example
- Theorem 21/2 is irrational.
- Proof Suppose 21/2 is rational, then ?m, n?Z
21/2m/n. Let M, N be the m, n with the least n.
- So ?kltN, j 21/2 j/k (let j 2N-M, k M-N).
46? ?Propositional Equivalence
47Propositional Equivalence
- Compound propositions p and q that have same
truth values in all possible cases are called
logically equivalent, denoted as p q. - The symbol is not a logical connective, it
means that p q is not a compound prop. - Sometimes, the symbol ? is used instead of .
48Tautologies and Contradictions
- A tautology is a compound proposition that is
true no matter what the truth values of its
atomic propositions are! - Ex. p ? ?p Truth table
- A contradiction is a compound proposition that is
false no matter what! - Ex. p ? ?p Truth table
- Other compound props. are contingencies.
49Logical Equivalence
- Compound proposition p is logically equivalent to
compound proposition q, written p q, IFF the
compound proposition p?q is a tautology. - Compound propositions p and q are logically
equivalent to each other IFF p and q contain the
same truth values as each other in all rows of
their truth tables.
50Prove Equivalence via Truth Tables
- Ex. Prove that p?q ?(?p ? ?q).
51Equivalence Laws
- These are similar to the arithmetic identities
you may have learned in algebra, but for
propositional equivalences instead. - They provide a pattern or template that can be
used to match all or part of a much more
complicated proposition and to find an
equivalence for it.
52Example of Equivalence Laws
- Identity p?T p p?F p
- Domination p?T T p?F F
- Idempotent p?p p p?p p
- Double negation ??p p
- Commutative p?q q?p p?q q?p
- Associative (p?q)?r p?(q?r)
(p?q)?r p?(q?r)
53More Equivalence Laws
- Distributive p?(q?r) (p?q)?(p?r)
p?(q?r) (p?q)?(p?r) - De Morgans ?(p?q) ?p ? ?q ?(p?q) ?p ? ?q
- Trivial tautology/contradiction p ? ?p T
p ? ?p F
54Nested Quantifiers
55Nested Quantifiers
- Example Let the u.d. of x y be people.
- Let L(x, y) x likes y (a predicate with 2
free variables) - Then ?y L(x, y) There is someone whom x
likes. (A predicate with 1 free variable, x) - Then ?x (?y L(x, y)) Everyone has someone
whom they like.(A proposition with 0 free
variables.)
56Quantifier Exercise
- If R(x,y)x relies upon y, express the
following in unambiguous English - ?x(?y R(x,y))
- ?y(?x R(x,y))
- ?x(?y R(x,y))
- ?y(?x R(x,y))
- ?x(?y R(x,y))
Everyone has someone to rely on.
Theres a poor overburdened soul whom everyone
relies upon (including himself)!
Theres some needy person who relies upon
everybody (including himself).
Everyone has someone who relies upon them.
Everyone relies upon everybody, (including
themselves)!
57Natural 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) whom
everyone likes? - ?y ?x Likes(x, y)
- Somebody likes everybody.
- Same problem Depends on context, emphasis.
Probably more likely
58More Conventions
- Sometimes the universe of discourse is restricted
within the quantification, - E.g., ?xgt0 P(x) is shorthand for
- For all x that are greater than zero, P(x).
- ?x (xgt0 ? P(x))
- ?xgt0 P(x) is shorthand for
- There is an x greater than zero such that
P(x). - ?x (xgt0 ? P(x))
59More About Binding
- ?x ?x P(x) - x is not a free variable in ?x
P(x), therefore the ?x binding isnt used. - (?x P(x)) ? Q(x) - The variable x is outside of
the scope of the ?x quantifier, and is therefore
free. Not a proposition! - (?x P(x)) ? (?x Q(x)) This is legal, because
there are 2 different xs!
60Quantifier 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) ? - From those, we can prove the laws?x P(x) ? ??x
?P(x)?x P(x) ? ??x ?P(x) - Which propositional equivalence laws can be used
to prove this?
DeMorgan's
61(Chalkboard)
- (Chalkboard) Another way to see why the order of
quantifiers matters is to expand out the
definitions of FORALL and EXISTS in terms of AND
and OR. E.g., suppose the universe of discourse
just consists of two objects a and b. Now,
consider some predicate P(x, y). Then, - FORALL x EXISTS y P(x, y)
- ? (EXISTS y P(a, y)) /\ (EXISTS y P(b, y))
- ? (P(a, a) \/ P(a, b)) /\ P(b, a) \/ P(b, b)).
- In contrast,
- EXISTS y FORALL x P(x, y)
- ? (FORALL x P(x, a)) \/ (FORALL x P(x, b))
- ? (P(a, a) /\ P(b, a)) \/ (P(a, b) /\ P(b, b)).
62(Chalkboard)
- To see that these two are inequivalent, suppose
only P(a, a) and P(b, b) are true. Then, the
first proposition (with the FORALL first) is
true, but, the second proposition (with the
EXISTS first) is true. Students can come up with
this counterexample in-class as an exercise.
63More Equivalence Laws
- ?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)) - Exercise See if you can prove these yourself.
- What propositional equivalences did you use?
64More Notational Conventions
- Quantifiers bind as loosely as neededparenthesiz
e ?x P(x) ? Q(x) - 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) - All quantified expressions can be reducedto the
canonical alternating form ?x1?x2?x3?x4 P(x1,
x2, x3, x4, )
( )
65Defining New Quantifiers
- As 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.
66Some Number Theory 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 x2y)) - A number is prime, P(x), iff its greater than 1
and it isnt the product of two non-unity
numbers.?x (P(x) ? (xgt1 ? ??yz xyz ? y?1 ?
z?1))
67Goldbachs Conjecture (unproven)
- Using E(x) and P(x) from previous slide,
- ?E(xgt2) ?P(p),P(q) pq x
- or, with more explicit notation
- ?x xgt2 ? E(x) ?
- ?p ?q P(p) ? P(q) ? pq x.
- Every even number greater than 2 is the sum
of two primes.
68Calculus Example
- One way of precisely defining the calculus
concept of a limit, using quantifiers
69Deduction Example
- Definitions s Socrates (ancient Greek
philosopher) H(x) x is human M(x) x
is mortal. - Premises H(s) Socrates
is human. - ?x H(x)?M(x) All humans are mortal.
70Deduction Example Continued
- Some valid conclusions you can draw
- H(s)?M(s) Instantiate universal. If
Socrates is human
then he is mortal. - ?H(s) ? M(s) Socrates is
inhuman or mortal. - H(s) ? (?H(s) ? M(s)) Socrates is human,
and also either inhuman or mortal. - (H(s) ? ?H(s)) ? (H(s) ? M(s)) Apply
distributive law. - F ? (H(s) ? M(s))
Trivial contradiction. - H(s) ? M(s)
Use identity law. - M(s)
Socrates is mortal.
71Another Example
- Definitions H(x) x is human M(x) x
is mortal G(x) x is a god - Premises
- ?x H(x) ? M(x) (Humans are mortal) and
- ?x G(x) ? ?M(x) (Gods are immortal).
- Show that ??x (H(x) ? G(x)) (No human is a
god.)
72The Derivation
- ?x H(x)?M(x) and ?x G(x)??M(x).
- ?x ?M(x)??H(x) Contrapositive.
- ?x G(x)??M(x) ? ?M(x)??H(x)
- ?x G(x)??H(x) Transitivity of ?.
- ?x ?G(x) ? ?H(x) Definition of ?.
- ?x ?(G(x) ? H(x)) DeMorgans law.
- ??x G(x) ? H(x) An equivalence law.
73Summary of Predicate Logic
- From these sections you should have learned
- - Predicate logic notation conventions
- - Conversions predicate logic ? clear English
- - Meaning of quantifiers, equivalences
- - Simple reasoning with quantifiers