(命題と論理式)

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

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

- Summary of last lecture
- Last week's homework
- Propositions
- Construction and use of logical (Boolean) formulæ
- This week's homework

- The history of numbers starts with the integers 1, 2, 3,...
- Across different cultures, the numerals for 1, 2, 3,... and 10, 20,... look similar
- Peano created a set of 5 axioms using "1" and "successor" only
- These axioms form a base for arithmetic on natural numbers
- The numeral 0 was discovered very late.

It is important in positional number representation. - Positional number representation can use various bases
- In Information Technology, the bases 2, (8,) 10, and 16 are used

Question: Why do computer scientist always think Christmas and Halloween are the same?

Halloween | October 31 | oct 31 | 31_{8} = 25 |

Christmas | December 25 | dec 25 | 25_{10} = 25 |

Question: At what age do Information Technologists celebrate "Kanreki" (還暦)

64 = 2^{6} ("Kanreki" is a round number in the
East Asian calendar. For Information Technology, powers of 2 are round
numbers.)

Those who have not yet registered for "Discrete Mathematics I" at http://moo.sw.it.aoyama.ac.jp, and those who have their name in Romaji instead of Kanji, must come to the front immediately after this lecture

[まだ http://moo.sw.it.aoyama.ac.jp で授業登録できてない人 、又は漢字ではなくローマ字で名前を登録している人は必ず授業直後申し出ること!]

The video of the first two lectures are available via a link from Moodle.

Userid and password are the same as for other Aoyama websites.

Please use the video soon to review the lecture.

Please be careful when watching the video on a mobile device (may be
expensive!).

The video can be watched at different speeds, and you can jump easily to the next slide.

- A
*proposition*is a sentence that is objectively either*correct*or*wrong*. - Propositions may also be called
*statement*s. - Even if a sentence is not correct, it is a proposition.
- Even if we do not know the answer (but there is a single answer), it is a proposition.
- Examples:
- 2 times 2 is 4.
- 10 is smaller than 5.
- Four is an odd number.
- On January 1, 2020, it will rain in Fuchinobe.

The following are NOT propositions:

- Subjective sentences (opinions,...)
- Questions
- Sentences that include undefined variables or pronouns

Counterexamples (NOT propositions):

- Her birthday is tomorrow (October 4, 2019).

Reason: 'Her' is undefined. `x`is even.

Reason: Undefined variable.- Did I eat breakfast this morning?

Reason: Question - Natto (納豆) is delicious.

Reason: Subjective opinion.

- Each proposition is either correct or wrong.
- "Correct" is called
*true*(真), and is written T, ⊤, or 1. - "Wrong" (not correct) is called
`false`(偽), and is written F, ⊥, or 0. - True and false together are called
*truth values*. - Other representations for truth values: ○/×, on/off, ...
- Truth values are also called
*Boolean values*or just*Booleans*(after Georges Boole)

Different programming languages handle truth values differently.

Some examples:

- C programming language:
`0`

represents*false*.- All integers ≠
`0`

can represent*true*. - The type
`int`

is used for booleans. - The C99 standard introduced
`bool`

,`true`

, and`false`

.

- Unix shell:
`0`

represents*true*.- All integers ≠
`0`

can represent*false*. - This is exactly the opposite of C.

- Java programming language:
*false*and*true*are represented as`false`

and`true`

.- Integers (
`int`

) and boolean values (`boolean`

) are different types.

- Ruby programming language:
*false*and*true*are represented as`false`

and`true`

.`false`

and`nil`

(empty/nothing) are interpreted as*false*. All other objects are interpreted as*true*.

With logical operations, we can create compound propositions from simpler propositions.

The most frequently used, and most basic, logical operations are:

- and:
`A`∧`B`(conjunction) - or:
`A`∨`B`(disjunction) - not: ¬
`A`(negation)

Based on two propositions `A` and `B`, we can construct
the following proposition:

`A` and `B`

We write `A` ∧ `B` (also: `A`·`B`,
`A B`, AND(`A`, `B`))

Because ∧ has two operands, it is a *binary* operation.

`A` ∧ `B` is defined as follows:

If both `A` and `B` are true, then `A` ∧ `B` is true.

Else, `A` ∧ `B` is false.

A |
B |
A ∧ B |
---|---|---|

F | F | F |

F | T | F |

T | F | F |

T | T | T |

Because there are only two truth values, we can define logical operations using a table. This is similar to the 9×9 multiplication table,

but would not work for operations on integers (e.g. multiplication) in general.

7 is smaller than 5 ∧ 7 is even (read: 7 is smaller than 5 and is even): F

8 is smaller than 5 ∧ 8 is even (read: 8 is smaller than 5 and is even): F

4 is smaller than 5 ∧ 4 is even (read: 4 is smaller than 5 and is even): T

3 is smaller than 5 ∧ 3 is even (read: 3 is smaller than 5 and is even): F

Based on two propositions `A` and `B`, we can construct
the following proposition:

`A` or `B`

`A` or `B` is written `A` ∨ `B` (also:
`A`+`B`, OR(`A`, `B`))

`A` ∨ `B` is defined as follows:

If both `A` and `B` are false, then `A` ∨ `B` is false.

Else, `A` ∨ `B` is true.

This means that logical or is inclusive. Logical or is a binary operation.

A |
B |
A ∨ B |
---|---|---|

F | F | F |

F | T | T |

T | F | T |

T | T | T |

4 is smaller than 5 ∨ 4 is even: T

8 is smaller than 5 ∨ 8 is even: T

7 is smaller than 5 ∨ 7 is even: F

3 is smaller than 5 ∨ 3 is even: T

Based on one proposition `A`, we can construct the following
proposition:

not `A`

not `A` is written ¬`A` (also `A`', `A`, ~`A`,
NOT(`A`)).

¬`A` is true if `A` is false

¬`A` is false if `A` is true.

Negation has only one operand and is therefore a *unary*
operation.

A |
¬A |
---|---|

F | T |

T | F |

¬ (4 is even) (read: 4 is not even): F

¬ (4 is odd) (read: 4 is not odd): T

In Information Technology:

- Create models of the real world
- Model logical operations in programming languages
- Model electronic circuits

In Mathematics:

- Model mathematical statements and their relationships
- Verify proofs
- Automate mathematical reasoning

- Express facts of the real world as propositions
- Express relationships between facts as relationships between propositions
- Set up and work out logical formulæ using the propositions
- Apply the results to the real world

Examples: Conditions for getting a discount; conditions for a passing grade in a course; conditions for completing (winning) a game,...

Condition for getting a discount: You get a discount if you are a student of Aoyama Gakuin University and today is a Friday or a Saturday.

Propositions:

`Ao`: You are a student of Aoyama Gakuin University.

`Fr`: Today (October 4, 2019) is a Friday.

`Sa`: Today (October 4, 2019) is a Saturday.

The truth values for these propositions are: `Ao`=T,
`Fr`=T, `Sa`=F

The condition for a discount can be expressed as:

`Ao` ∧ (`Fr`∨`Sa`)

The condition evaluates to T, so you get a discount!

We can creat a logical formula from propositions, propositional variables, and logical operators.

Example: (`A` ∨ (¬`B`)) ∧ `C`

Operator precedence and omission of parentheses:

- Each operator has a given
*precedence*. - Operations with higher precedence get evaluated first.
- If the order of evaluation is not correct, we use parentheses to fix it.

Precedence for logical operators:

- High: ¬
- Middle: ∧
- Low: ∨

Examples:

`A`∨`B`∧`C` = `A` ∨
(`B`∧`C`) ≠ (`A`∨`B`) ∧
`C`

(`A` ∨ (¬`B`)) ∧ `C` = (`A` ∨
¬`B`) ∧ `C` ≠ `A` ∨ ¬`B` ∧
`C`

(WFF)

Goal: Make the structure (grammar) of logical formulæ clear.

All of the following are well-formed formulæ

- Propositions
- Propositional variables
- If
`W`and`V`are well-formed formulæ, then the following are also well-formed formulæ:- (
`W`) - ¬
`W` `W`∧`V``W`∨`V`

- (

Formulæ that do not fit the above definition are not well-formed
formulæ.

(Attention: In a later lecture, we will introduce more logical operators. This
will extend the definition.)

Examples:

(`A` ∨ `¬B`) ∧ `C` (well-formed)

(`A` ∨(`B` ¬∧) `C` (not
well-formed)

- Formulæ can be drawn as trees
- Trees have a root (at the
**top**), internal nodes, and leaf nodes - The internal nodes are operators
- The leaves are operands
- The tree shows a formula's structure
- Evaluation order is expressed in the tree's structure (bottom to top)

→ parentheses are unnecessary

Example formula: `A` ∨ `¬B` ∧ `C`

Truth tables are often used to:

**Define**logical operations**Evaluate**logical formulæ**Prove**properties of logical operations and formulæ [see lecture 5]

Example formula: (`A` ∨ ¬`B`) ∧ `B`

Evaluation using a truth table

A |
B |
¬B |
A ∨ ¬B |
(A ∨ ¬B) ∧ B |
---|---|---|---|---|

F | F | T | T | F |

F | T | F | F | F |

T | F | T | T | F |

T | T | F | T | T |

From this truth table, we can deduce that (`A` ∨ ¬`B`)
∧ `B` = `A` ∧ `B`

- Columns:
- A column for each variable that appears in the formula
- A column for each subexpression in the formula

(starting with the the simplest subexpression) - A column for the overall formula

- Rows:
- One row for the headers

- 2
^{n}rows for entries, where`n`is the number of variables

- One row for the headers
- Variable columns:
- Start with FF... in the first row
- End with TT... in the last row
- When converting F to 0 and T to 1, the variable columns should show
the binary numbers from 0 to 2
^{n}-1.

- Subexpression columns and final column: Calculating each value from earlier columns.
- Example: Write a truth table for
`D`∧ ¬`F`∨ ¬`E`

- A boolean function calculates a truth value from zero or more Boolean arguments.
- The
*domain*of a boolean function are zero or more truth values. - The
*range*of a boolean function is a single truth value. - Because Boolean arguments only take the values
`true`and`false`, the number of Boolean functions is quite limited.

- Number of rows of a truth table with
`n`variables: 2^{n} - Each row can have either T or F as a result
- Number of Boolean functions with
`n`variables: 2^{(2n)} - Examples:
Number of variables ( `n`)0 1 2 3 4 5 Number of rows 1 2 4 8 16 32 Number of Boolean functions 2 4 16 256 65536 4294967296

Question: Can we find a logic formula for any such function? (Answer: see next lecture)

(for integers or reals,...)

- Commutative laws:

Addition and multiplication are commutative:

`a`+`b`=`b`+`a`,`a``b`=`b``a` - Associative laws:

Addition and multiplication are associative:

(`a`+`b`) +`c`=`a`+ (`b`+`c`), (`a``b`) ·`c`=`a`· (`b`·`C`) - Distributive law:

Multiplication distributes over addition:

`a`· (`b`+`c`) =`a``b`+`a``c`

Addition does not distribute over multiplication:

`a`+`b``c`≠ (`a`+`b`) · (`a`+`c`)

- Commutative laws:

Both conjunction and disjunction are commutative:

`A`∧`B`=`B`∧`A`,`A`∨`B`=`B`∨`A` - Associative laws:

Both conjunction and disjunction are associative:

(`A`∧`B`) ∧`C`=`A`∧ (`B`∧`C`), (`A`∨`B`) ∨`C`=`A`∨ (`B`∨`C`) - Distributive laws:

Conjunction distributes over disjunction:

`A`∧ (`B`∨`C`) =`A`∧`B`∨`A`∧`C`

Disjunction distributes over conjunction:

`A`∨`B`∧`C`= (`A`∨`B`) ∧ (`A`∨`C`)

Repeat each quiz until you get 100% correct answers; deadline:
**October 10 (Thursday) 22:00**:

- Solve the quiz Propositions: True or False
- Solve the quiz Truth Table 1
- Solve the quiz Truth Table 2
- Use highschool texts or the Web to research about other laws for logical operations.

下記のクイズは満点まで繰り返す; **締切: 10月10日
(木) 22:00**:

- Moodle で Propositions: True or False のクイズを解く
- Moodle で Truth Table 1 のクイズを解く
- Moodle で Truth Table 2 のクイズを解く
- 論理演算の (交換律、結合律、分配率以外の) 法則について高校の資料やウェブで調べること。

- round number
- 切りのいい数
- proposition
- 命題
- objective (adj.)
- 客観的
- subjective (adj.)
- 主観的
- opinion
- 意見
- variable
- 変数
- pronoun
- 代名詞
- odd number
- 奇数
- even number
- 偶数
- truth value (of a proposition)
- (命題の) 真偽
- true
- 真 (しん)
- false
- 偽 (ぎ)
- type (in programming languages)
- (プログラム言語の) 型
- logical operation
- 論理演算
- electronic circuits
- 電子回路
- reasoning
- 推理、推論
- modeling
- モデル化 (する)
- (logical) and
- かつ
- binary operation
- 二項演算
- unary operation
- 単項演算
- conjunction
- 論理積
- truth table
- 真理表 (又は真理値表)
- logical operation
- 論理演算
- compound proposition
- 複合命題
- (logical) or
- 又は
- disjunction
- 論理和
- (logical) not
- ではない
- negation
- 論理否定
- logical formula
- 論理式 (複数: formulæ or formulas)
- well-formed (logical) formula
- 整論理式
- grammar
- 文法
- tree
- 木 (生物学のものではなく、数学や情報テクノロジーで使うもの)
- root
- (木の) 根
- internal node
- 内部節
- leaf
- 葉
- propositional variable
- 命題変数
- (operator) precedence
- (演算子の) 優先順位
- evaluation
- (式の) 評価
- parentheses
- 括弧
- subexpression
- 部分式
- Boolean function
- 論理関数、ブール関数
- Boolean argument
- 論理引数 (ひきすう; ブール引数とも言う)
- domain (of a function)
- (関数の) 定義域
- range (of a function)
- (関数の) 値域
- commutative law
- 交換律
- distributive law
- 分配律
- distribute
- 分配する