Predicate Logic and Quantifiers
(述語論理、全称限量子、存在限量子)
Discrete Mathematics I
7th lecture, November 11, 2022
https://www.sw.it.aoyama.ac.jp/2022/Math1/lecture7.html
Martin J. Dürst
© 2005-22 Martin
J. Dürst Aoyama Gakuin
University
Today's Schedule
- Leftovers/summary for last lecture
- Last week's homework
- Pascal's triangle, combinations, and combinatorics
- Predicates and predicate logic
- Operators on Predicates: Quantifiers
- This week's homework
Summary of Last Lecture
- Sets are one of the most basic kinds of objects in
Mathematics
- Sets are unordered, and do not contain any repetitions
- There are two notations for sets: Connotation (e.g. {1, 2, 3,
4}) and denotation (e.g. {n|n ∈ ℕ,
n>0, n<5})
- Operations on sets include union, intersection,
difference, and complement
- The empty set is a subset of any set
- The powerset of a set is the set of all subsets
- The laws for sets are very similar to the laws for predicate logic
Leftovers of Last Lecture
Operations on sets, neutral elements, Venn diagrams, laws for sets, limits
of sets,...
Homework, Problems 1/2
1. Create a set with four elements. If you use the same elements as other
students, a deduction of points will be applied.
Example: {cat, cow, crow, camel}
2. Create the powerset of the set you created in problem 1.
Example: {{}, {cat}, {cow}, {crow}, {camel}, {cat,
cow}, {cat, crow}, {cat, camel}, {cow, crow}, {cow, camel}, {crow, camel},
{cat, cow, crow}, {cat, cow, camel}, {cat, crow, camel}, {cow, crow, camel},
{cat, cow, crow, camel}}
Homework, Problems 3/4
3. For sets A of size zero to six, create a table of the sizes of
the powersets (|P(A)|).
|A| |
|P(A)| |
0 |
1 |
1 |
2 |
2 |
4 |
3 |
8 |
4 |
16 |
5 |
32 |
6 |
64 |
4. Express the relationship between the size of a set A and the
size of its powerset P(A) as a formula.
|P(A)| = 2|A| (the
size of the powerset of A is 2 to the power of the size of
A)
Homework, Problem 5
5. Explain the reason behind the formula in problem 4.
The formula is correct for |A|=0: A={},
P(A)={{}},
|P(A)|=20=1
If the formula is correct for |A|=k (i.e.
|P(A)|=2k),
we can show that it is correct for B with
|B|=k+1
Example
A={cat, cow}, |A|=2, P(A) = {{},
{cat}, {cow}, {cat, cow}}, |P(A)|=4
B = A∪{carp}={cat, cow, carp}, |B|=3
P(B) =
P(A)∪{a∪{carp}|a∈P(A)}
= P(A)∪{{carp}, {cat, carp}, {cow,
carp}, {cat, cow, carp}}
|P(B)| = 2·|P(A)| = 8
General case
B =
{c|c∈A∨c=d∧d∉A}
(= A∪{d} where d∉A),
|B| = k+1 = |A|+1,
P(B)=P(A)∪{e∪{d}|e∈P(A)},
|P(B)|=2·|P(A)| =
2·2k=2k+1
(Let B be the set consisting of the elements of A and
one additional element d which is not contained in A.
The size of B is one greater than the size of A.
Then the powerset of B is the union of two distinct sets: the
powerset of A, and the set of sets from the powerset of A
with d added.
The size of the powerset of B is therefore double the size of the
powerset of A.)
(This explanation is using Mathematical induction over k.)
Homework, Problem 6
6. Create a table that shows, for sets A of size zero to five,
and for each n (size of sets in P(A)), the
number of such sets.
|A| |
n |
|{B|B⊂A∧|B|=n}| |
|A| |
n |
|{B|B⊂A∧|B|=n}| |
0 |
0 |
1 |
4 |
0 |
1 |
1 |
0 |
1 |
4 |
1 |
4 |
1 |
1 |
1 |
4 |
2 |
6 |
2 |
0 |
1 |
4 |
3 |
4 |
2 |
1 |
2 |
4 |
4 |
1 |
2 |
2 |
1 |
5 |
0 |
1 |
3 |
0 |
1 |
5 |
1 |
5 |
3 |
1 |
3 |
5 |
2 |
10 |
3 |
2 |
3 |
5 |
3 |
10 |
3 |
3 |
1 |
5 |
4 |
5 |
|
|
|
5 |
5 |
1 |
(These numbers are the numbers appearing in Pascal's triangle.)
Pascal's Triangle
Start with a single 1
in the first row, surrounded by zeroes
((0 ... 0) 1 (0 ... 0)
).
Create row by row by adding the number above and to the left and the number
above and to the right.
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
- For a set A with |A| = n, we can
write
|{B|B⊂A∧|B|=m}|
as
nCm
(the mth number in the nth row of Pascal's
triangle)
- nC0 = 1 (the
only subset of size 0 is {},
{B|B⊂A∧|B|=1} = {{}})
- nCn =
1 (the only subset of size n is A itself,
{B|B⊂A∧|B|=|A|=n}
= {{A}})
- nCm =
n-1Cm-1
+ n-1Cm
(n>0, 0<m<n)
Subsets and Combinations
- Combinatorics is very important for Information Technology
- Combinatorics deals with counting the number of different things under
various conditions or restrictions
- The word combinations refers to the choices of a given size from
a set without repetitions and without considering order
- The number of combinations of a certain size m selected from a
set of size n are the same as the subsets of a given size
m in a powerset of a set of size n
- The number of combinations is written
nCm
- The number of combinations can be calculated directly:
nCm =
n!/(m! (n-m)!)
- There are also permutations (considering order), repeated
permutations (allowing an element to be selected more than once), and
repeated combinations
Types of Symbolic Logic
- Binary (Boolean) logic (using only true and false)
- Multi-valued logic (using e.g. true, false, and unknown)
- Fuzzy logic (including calculation of ambiguity)
- Propositional logic (using only propositions)
- Predicate logic (first order predicate logic,...)
- Temporal logic (integrating temporal relationships)
Limitations of Propositions
With propositions, related statements have to be made separately
Examples:
2 is even. 5 is even.
Today it is sunny. Tomorrow it is sunny. The day after tomorrow, it is
sunny.
We can express "If today is sunny, then tomorrow will also be sunny." or "If
2 is even, then 3 is not even".
But we cannot express "If it's sunny on a given day, it's also sunny on the
next day." or "If x is even, then x+2 is also even.".
⇒ This problem can be solved using predicates
Examples of Predicates
- even(4): 4 is even
- even(27): 27 is even
- odd(4): 4 is odd
- sunny(November 12, 2021): It is sunny on November 12, 2021
- parent(Ieyasu, Hidetada): Ieyasu is the parent of Hidetada
- smaller(3, 7) (or: 3 < 7)
Predicate Overview
- The problem with propositions can be solved by introducing
predicates.
- In the same way as propositions, predicates are objectively true or
false.
- A predicate is a function (with 0 or more arguments) that returns true or
false.
- If the value of an argument is undefined, the result (value) of the
predicate is unknown.
- A predicate with 0 arguments is a proposition.
How to Write Predicates
There are two ways to write predicates:
- Functional notation:
- The name of the predicate is the name of the function
- Arguments are enclosed in parentheses after the function name
- Each predicate has a fixed number of arguments
- Arguments in different positions have different meanings
- Reading of predicates depends on their meaning
- Operator notation:
- Operators that return true or false are predicates
- Examples: 3 < 7, 5 ≧ 2, a ∈ B,
even(x) ∨ odd(y)
Formulas Containing Predicates
Using predicates, we can express new things:
- sunny(x) → sunny(day after x)
- even(y) → even(y+2)
- even(z) → odd(z+1)
Similar to propositions, predicates can be true or false.
But predicates can also be unknown/undefined, for example if they contain
variables.
Even if a predicate is undefined (e.g. even(x)),
a formula containing this predicate can have a defined value (true or false)
(e.g. even(y) → even(y+2), or odd(z) →
even(z+24))
First Order Predicate Logic
- The arguments of predicates can be constants, functions (e.g. sin),
formulæ,...
Examples:
- even(2), say(Romeo, 'I love you'), parent(Ieyasu, Hidetada)
- even(sin(0)), even(2+3×7)
- However, it is not possible to use predicates within predicates
Counterexample: say(z, parent(y,
x))
(z says "y is the parent of x")
- Higher-order logic allows predicates within predicates
Example: ∀n∈ℕ: even(n) →
even(n+2)
Readings:
- For all n, elements of ℕ, if n is even, then
n+2 is even.
- For all natural numbers n, if n is even, then
n+2 is even.
General form: ∀x: P (x)
∀ is the A of "for All", inverted.
Readings in Japanese:
- 全ての自然数 n において、n
が偶数ならば n+2 も偶数である
- 任意の x において、P(x)
Examples of Universal Quantifiers
∀n∈ℕ: n > -1
∀n∈ℕ: ∀m∈ℕ: n+m =
m+n
∀a∈ℚ: ∀b∈ℕ: a+b =
b+a
∀a∈{T, F}: ∀b∈{T, F}:
a∨b = b∨a
Let S be the set of all students, B the set of all
books, and let read(s, b) denote the fact that student
s reads book b.
Then ∀s∈S: ∀b∈B:
read(s, b) means that all students read all books.
Remark 1: ∀n∈ℕ: ∀m∈ℕ:
n+m = m+n can be written as
∀n, m∈ℕ: n+m =
m+n
Remark 2: ∀s∈S: ∀b∈B:
read(s, b) is interpreted as
∀s∈S: (∀b∈B:
read(s, b))
Knowledge about Field of Application
Existential Quantifier
Example: ∃n∈ℕ: odd (n)
Readings:
- There exists a n, element of ℕ, for which n is
odd.
- There is a natural number n so that n is odd.
- There exists a natural number n which is odd.
- There exists an odd natural number.
General form: ∃y: P (y)
∃ is the mirrored form of the E in "there
Exists".
Readings in Japanese:
- P(y) が成立する y が存在する
- ある y について、P(y)
Structure of Quantifier Expressions
Example: ∀m, n∈ℕ: m > n →
m2 ≧ n2
- ∀: Quantifier
- m, n:
Variable(s), separated by commas
- ∈ℕ: Set membership
(applies to all previous variables connected by commas; unnecessary if
there is a single obvious universal set)
- ":": Colon
- m > n →
m2 ≧ n2: Quantified
predicate
More Quantifier Examples
∀n∈ℕ: n + n + n =
3n
∃n∈ℕ: n2 =
n3
∃n∈ℝ: q2 < 50q <
q3
∀m, n∈ℕ: 7m + 2n =
2n + 7m
Applied Quantifier Examples
S: Set of students
F: Set of foods
like(s, f): Student s likes food
f
- All students like all foods:
- Some students like all foods:
- There is a food that all students like:
- There is no food that all students like:
- Each student dislikes a food:
Summary
- Predicates are limited because they cannot express complex facts
- Propositions are functions or operators that return truth values
(true/false)
- First order propositional logic allows formal reasoning for some
application domain (e.g. arithmetic, set theory,...)
- The universal quantifier (∀) expresses that a predicate is
true for all members of some set(s)
- The existential quantifier (∃) expresses that a predicate is
true for some member(s) of some set(s)
This Week's Homework
Deadline: November 17, 2022 (Thursday), 18:40.
Format: Handout, easily readable handwriting
Where to submit: Box in front of room O-529 (building O, 5th floor)
Problems: See handout
About Returns of Tests and Homeworks
- Today, the graded intermediate tests will be returned
- This is not part of the lecture itself (i.e. after 12:30)
- If you have some other commitment after 12:30, you can come to my office
in the afternoon (after 14:00) to pick up your homework
- Homeworks including names in kana/Latin letters will be distributed
first, then those without
- Homeworks with higher points will be distributed before those with lower
points
- When your name is called, immediately and very clearly raise your
hand, and come to the front quickly
- When taking your homework, make sure it is really yours
- NEVER take the homework of somebody else (a friend,...)
- Carefully analyze your mistakes and work on fixing them and avoiding them
in the future
- Feel free to ask questions
Glossary
- Mathematical induction
- 数学的帰納法
- Pascal's triangle
- パスカルの三角形
- combinatorics
- 組合せ論
- combination
- 組合せ
- permutation
- 順列
- repeated combination
- 重複組合せ
- repeated permutation
- 重複順列
- factorial
- 階乗
- predicate logic
- 述語論理
- quantifier
- 限量子
- evaluate
- 評価する
- evaluation
- 評価
- array
- 配列
- symbolic logic
- 記号論理
- multi-valued logic
- 多値論理
- fuzzy logic
- ファジィ論理
- ambiguity
- 曖昧さ
- first-order predicate logic
- 一階述語論理
- temporal logic
- 時相論理
- binary logic
- 二値論理
- generalization
- 一般化
- argument
- 引数
- undefined
- 未定
- higher-order logic
- 高階述語論理
- universal quantifier
- 全称限量子 (全称記号)
- existential quantifier
- 存在限量子 (存在記号)