(述語論理の応用)

https://www.sw.it.aoyama.ac.jp/2019/Math1/lecture8.html

© 2005-19 Martin J. Dürst Aoyama Gakuin University

- Leftovers, summary and homework from last lecture
- Applications of predicate logic
- Examples for various laws
- Quantifiers and variables
- Quantifiers and sums/products

- Pascal's triangle and number of combinations

- There are many different kinds of symbolic logic: propositional logic, predicate logic,...
- Predicates take arguments (propositions are predicates with zero arguments)
- Predicate logic allows more general statements and inferences than propositional logic
- Predicate logic uses universal quantifiers (∀) and existential quantifiers (∃)

Create formulæ for the statements below about numbers, students, and pets.
Use the quantifiers and operators that we used in the lecture. The set of (all)
Students is denoted with `S`, the set of (all) pets with `P`.
The fact that student `s` likes pet `p` is written
like(`s`, `p`). The age of student `s` is written
age(`s`). You can use any operators generally used in this lecture. Do
not introduce any new functional predicates.

Example: All natural numbers are greater than -5.

∀`n`∈ℕ: `n` > -5

- There is no greatest natural number.

∀`n`∈ℕ: ∃`m`∈ℕ:`m`>`n` - All students are older than 18.

∀`s`∈`S`: age(`s`) > 18 - Every student likes a pet.

∀`s`∈`S`: ∃`p`∈`P`: like(`s`,`p`) - There is a pet liked by all students.

∃`p`∈`P`: ∀`s`∈`S`: like(`s`,`p`) - All students like all pets.

∀`s`∈`S`: ∀`p`∈`P`: like(`s`,`p`) - There is a student who likes all pets.

∃`s`∈`S`: ∀`p`∈`P`: like(`s`,`p`) - Every pet is liked by a student.

∀`p`∈`P`: ∃`s`∈`S`: like(`s`,`p`) - There is a student who likes a pet.

∃`s`∈`S`: ∃`p`∈`P`: like(`s`,`p`) - All students younger than 21 like a pet.

∀`s`∈`S`: age(`s`) < 21 → ∃`p`∈`P`: like(`s`,`p`) - Every pet is disliked (not liked) by a student.

∀`p`∈`P`: ∃`s`∈`S`: ¬like(`s`,`p`) - There is a pet that is disliked by all students who are older than 20.

∃`p`∈`P`: ∀`s`∈`S`: age(`s`) > 20 → ¬like(`s`,`p`)

There is no food that all students like.

Solution given in lecture: ¬∃`f`∈`F`:
∀`s`∈`S`: like(`s`, `f`)

Alternative (question by students): ∀`f`∈`F`:
∃`s`∈`S`: ¬like(`s`, `f`)

Using laws to show that these are the same:

¬∃`f`∈`F`: ∀`s`∈`S`:
like(`s`, `f`) [law 2]

= ∀`f`∈`F`: ¬∀`s`∈`S`:
like(`s`, `f`) [law 1]

= ∀`f`∈`F`: ∃`s`∈`S`:
¬like(`s`, `f`)

There is no greatest natural number.

¬∃`m`∈ℕ: ∀`n`∈ℕ: `n`≦`m`
[law 2]

= ∀`m`∈ℕ: ¬∀`n`∈ℕ:
`n`≦`m` [law 1]

= ∀`n`∈ℕ: ∃`m`∈ℕ:
¬`n`≦`m` [arithmetic]

= ∀`n`∈ℕ: ∃`m`∈ℕ: `n`>`m`

Law 1:

¬∀`x`: P(`x`) = ∃`x`: ¬P(`x`)

Concrete example:

Not all students are from Kanagawa means that there is at least one student who
is not from Kanagawa, and the other way round.

¬∀`s`∈`S`: native(`s`, Kanagawa) =
∃`s`∈`S`: ¬native(`s`, Kanagawa)

The examples all are about the students taking Discrete Mathematics I.

Sets, predicates and functions used:

`S`: Set of students

age(`s`): A student's age (fully completed years)

college(`s`): A student's faculty or college (example: College of
Science and Engineering, CSE)

female(`s`), male(`s`): Predicates for a student's
gender.

native(`s`, `k`): True if student `s` is a native
of prefecture `k` (using "abroad" for students from outside Japan)

Law 5:

(∃`x`: P(`x`)) ∧ Q(`y`) = ∃`x`:
(P(`x`)∧Q(`y`))

Concrete example:

There exists a student from Shizuoka, and a student` is older than
20 ⇔ There is a case where there is a student from Shizuoka and a
student`` is older than 20.`

(∃`s`∈`S`: native(`s`, Shizuoka)) ∧
age(`y`)>20 = ∃`s`∈`S`: (native(`s`,
Shizuoka)∧age(`y`)>20)

Law 8:

(∀`x`: P(`x`)) ∧ (∀`x`: R(`x`)) =
∀`x`: P(`x`)∧R(`x`)

Concrete example:

All students are less that 30 years old, and all students belong to the College
of Science and Engineering. = All students are less than 30 years old and
belong to the College of Science and Engineering.

(∀`s`∈`S`: age(`s`)≤30) ∧
(∀`t`∈`S`: college(`t`)=CSE) =
∀`u`∈`S`: (age(`u`)≤30 ∧
college(`u`)=CSE)

Law 11:

(∃`x`: P(`x`)) ∧ (∃`x`: R(`x`)) ⇐
∃`x`: P(`x`) ∧ R(`x`)

Example of how the left side follows from the right:

There is a student who is a native of Hiroshima and who is male. ⇒ There is a
student who is a native of Hiroshima, and there is a student who is male.

(∃`s`∈`S`: native(`s`, Hiroshima)) ∧
(∃`s`∈`S`: male(`s`)) ⇐
∃`s`∈`S`: (native(`s`, Hiroshima) ∧
male(`s`))

Example of how the right side does not follow from the left side:

There is a student who is a native from Hokkaido, and there is a student who is
female. However, this does not imply that there is a student who is a native
from Hokkaido and is female.

(∃`s`∈`S`: native(`s`, Hokkaido)) ∧
(∃`s`∈`S`: female(`s`)) ⇏
∃`s`∈`S`: (native(`s`, Hokkaido) ∧
female(`s`))

Law 12:

(∃`y`: ∀`x`: P(`x`, `y`)) ⇒
(∀`x`: ∃`y`: P(`x`, `y`))

Example of how the left side follows from the right:

There is an age `y` (e.g. 30) so that for `all` students,
their age is below `y`. From this follows that for `each`
student, there is an age for which the student's age is lower.

(∃`y`: ∀`s`∈`S`:
age(`s``)<``y`) ⇒
(∀`s`∈`S`: ∃`y`:
age(`s``)<``y`)

Example of how the right side doesn't follow from the left side:

All students are native of some prefecture (or abroad). But this does not mean
that there is a single prefecture of which all students are native.

(∀`s`∈`S`: ∃`y`: native(`s`,
`y`)) ⇏ (∃`y`: ∀`s`∈`S`:
native(`s`, `y`))

Quantifiers are similar to sums and products:

Sum: ∑^{∞}_{i}_{=1}
1/`i`^{2} = 1 + 1/4 + 1/9 + 1/16 + 1/25 + ...

Product: ∏^{∞}_{i}_{=1}
1+1/(-2)^{i} = 0.5 · 1.25 · 0.875 · 1.0625 · ...

Universal quantification: (∀`i` ∈ℕ^{+}:
`i`>0) = **⋀**^{∞}_{i}_{=1}
`i`>0 = 1>0 ∧ 2>0 ∧ 3>0 ∧...

Existential quantification: (∃`i` ∈ℕ^{+}:
odd(`i`)) = **⋁**^{∞}_{i}_{=1}
odd(`i`) = odd(1)∨odd(2)∨odd(3)∨...

Quantification is a generalization of conjunction/disjunction to more than
two operands,

in the same way that sum and product are a generalization of
addition/multiplication to more than two operands.

two operands | many operands | ||
---|---|---|---|

name | symbol | name | symbol(s) |

addition | + | sum | ∑ |

multiplication | * | product | ∏ |

conjunction | ∧ | universal quantification | ∀/⋀ |

disjunction | ∨ | existential quantification | ∃/⋁ |

Notation: `n`!

Definition: `n`! = 1 · 2 · ... (`n`-1) · `n` =
∏^{n}_{i=1} `i`

Question:

1! = 1

0! = 1

- Neutral element of addition: 0
- Neutral element of multiplication: 1
- Neutral element of conjunction:
`true`

- Neutral element of disjunction:
`false` - Neutral element of substraction:

does not exist, but 0 is a rigth identity (satisfying only ∀`x`:`x`=`x`△`e`)

∀`i` (`i`<0⋀`i`>5): odd(`i`) =
T (because the neutral element of conjunction is
T)

∃`i` (`i`<0⋀`i`>5): odd(`i`) =
F (because the neutral element of disjunction is
F)

Concrete example (sum):

int sum = 0; for (i=0; i<end; i++) sum += array[i];

In programming language C:

typeresult =neutral element; for (i=0; i<end; i++) result = resultoperatorarray[i];

In programming language Ruby:

array.inject(neutral element) do |memo, next| memooperatornext end

Laws 1 and 2 introduced in the last lecture are generalizations of DeMorgans' laws:

- ¬∀
`x`: P(`x`)

= ¬(P(`x`_{1})∧P(`x`_{2})∧P(`x`_{3})∧P(`x`_{4})∧...)

= (¬P(`x`_{1})∨¬P(`x`_{2})∨¬P(`x`_{3})∨¬P(`x`_{4})∨...)

= ∃`x`: ¬P(`x`) - ¬∃
`x`: P(`x`)

= ¬(P(`x`_{1})∨P(`x`_{2})∨P(`x`_{3})∨P(`x`_{4})∨...)

= (¬P(`x`_{1})∧¬P(`x`_{2})∧¬P(`x`_{3})∧¬P(`x`_{4})∧...)

= ∀`x`: ¬P(`x`)

Simplify ¬(∃`x`: P(`x`) → ∀`y`:
¬Q(`y`))

¬(∃`x`: P(`x`) → ∀`y`: ¬Q(`y`))
[removing implication]

= ¬(¬∃`x`: P(`x`) ∨ ∀`y`:
¬Q(`y`)) [deMorgan's law]

= ¬¬∃`x`: P(`x`) ∧ ¬∀`y`:
¬Q(`y`) [law 1 of last lecture]

= ¬¬∃`x`: P(`x`) ∧ ∃`y`:
¬¬Q(`y`) [double negation]

= ∃`x`: P(`x`) ∧ ∃`y`: Q(`y`)

Actual example:

Let P(`x`) mean "it is raining in `x`", and
Q(`y`) "it is snowing `y`"

Then the original formula says "It's wrong that if it rains somewhere, then it snows nowhere". The final formula says "There is a place where it rains and there is a place where it snows".

(There has to be a place where it rains because otherwise the implication is automatically true.)

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_{n}`C`_{m} _{n}`C`_{n}= 1 (the only subset of size`n`is`A`itself, {`B`|`B`⊂`A`∧|`B`|=|`A`|=`n`} = {{`A`}})_{n}`C`_{0}= 1 (the only subset of size 0 is {}, {`B`|`B`⊂`A`∧|`B`|=1} = {{}})_{n}`C`_{m}=_{n-1}`C`_{m-1}+_{n-1}`C`_{m}(`n`>0, 0<`m`<`n`)

*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* - 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 size`n` - The number of
**c**ombinations is written_{n}`C`_{m} - There are also
`permutations`(considering order),*repeated permutations*(allowing an element to be selected more than once), and*repeated combinations*

_{n}`C`_{m}=`n`!/(`m`! (`n`-`m`)!)

(prove it as a homework, problem 2)

Deadline: November **28**, 2019 (Thursday), 19:00.

Format: **A4 single page** (using both sides is okay; NO cover
page), easily readable **handwriting** (NO printouts), name (kanji
and kana) and student number at the top right

Where to submit: Box in front of room O-529 (building O, 5th floor)

Problem 1: For ternary (three-valued) logic, create defining truth tables
for conjunction, disjunction, and negation. The three values are T, F, and
**?**, where **?** stands for "unknown" (in more
words: "maybe true, maybe false, we don't know").

Hint: What's the result of "**?**∨T"? **?** can
be T or F, but in both cases the result will be T, so
**?**∨T=T.

Problem 2: Prove _{n}`C`_{m}
= `n`!/(`m`! (`n`-`m`)!) for
0≦`n`, 0≦`m`≦`n` using
_{n}`C`_{m} =
_{n-1}`C`_{m-1} +
_{n-1}`C`_{m}

(Hint: Prove first for `m`=0 and `m`=`n`, then for
0<`m`<`n`)

- Pascal's triangle
- パスカルの三角形
- combinatorics
- 組合せ論
- combination
- 組合せ
- permutation
- 順列
- repeated combination
- 重複組合せ
- repeated permutation
- 重複順列
- factorial
- 階乗
- product (∏)
- 総乗、総積
- neutral element
- 単位元