http://www.sw.it.aoyama.ac.jp/2012/Math1/lecture4.html
© 2005-12 Martin J. Dürst 青山学院大学
論理関数と論理式を操る
1. Create a set with four elements. If you use the same elements as other students, a deduction of points will be applied.
Example:
2. Create the powerset of the set you created in problem 1.
Example:
3. For sets A of size zero to six, create a table of the sizes of the powersets (|P(A)|).
|A| | |P(A)| |
4. Express the relationship between the size of a set A and the size of its powerset P(A) as a formula.
5. Explain the reason behind the formula in problem 5.
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.
(Pascal's triangle)
一行目の (0 ... 0) 1 (0 ... 0)
からスタートし、左上と右上の数を足し合わせると出来る。
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
インドで紀元前から知られ、多くの性質が知られている
ここで次の関係や性質を説明・証明:
(factorial)
書き方: n!
定義: n! = 1 · 2 · ... (n-1) · n = ∏ni=1 i
問題:
1! = 1
0! = 1
(unit element, identity element, neutral element)
具体例 (合計):
int sum = 0; for (i=0; i<end; i++) sum += array[i];
C プログラム言語の場合:
type result = 単位元; for (i=0; i<end; i++) result = result 演算子 array[i];
Ruby の場合:
array.inject(単位元) do |memo, next| memo 演算子 next end
(proposition 又は statement)
正しいか正しくないかが客観的に決められる文
(正しいものでも正しくないものでも良い)
命題ではないのは主観的な記述、質問、一部が決定されてない、代名詞や変数を含む発話など
例:
反例 (命題ではない):
命題は正しいか正しくないかである。
「正しい」は「真」(しん、true) と言い、T、⊤ や 1 と書く
「正しくない」は「偽」(ぎ、false) と言い、F、⊥ や 0 と書く
真と偽はともに真理値 (truth value) という
プログラム言語によって取り扱いが違う
0
は偽に相当0
以外の整数 (特に 1
)
は真に相当false
、真は true
int
) と真理値 (boolean
)
は完全に別の型false
、真は true
false
と nil
(空や無を表現)
は偽、それ以外の値は真Based on two prepositions A and B, we can construct the following proposition:
A and B
We write A ∧ B (also: A·B, or A B)
A ∧ B is defined as follows:
If both A and B are true, then A ∧ B is true.
Else, A ∧ B is false.
We can also write this in functional notation: AND(A, B)
Truth tables are often used for defining logical operations, and for proofs.
A | B | A ∧ B |
F | F | F |
F | T | F |
T | F | F |
T | T | T |
With logical operations, we can create compound predicates from simpler predicates.
The most frequently used logical operations are as follows:
Based on two prepositions A and B, we can construct the following proposition:
A or B
A or B is written A ∨ B (also: 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.
We can also write this in functional notation: OR(A, B)
Truth Table for Logical Or
A | B | A ∨ B |
F | F | F |
F | T | T |
T | F | T |
T | T | T |
Based on one preposition A, we can construct the following proposition:
not A
not A is written ¬A (also A' or A or ~A).
¬A is true if A is false, and is false if A is true.
We can also write this in functional notation: NOT(A)
Truth Table for Logical Not
A | ¬A |
F | T |
T | F |
We can creat a logical formula from propositions, propositional variables, and logical operators.
Example: (A ∨ (¬B)) ∧ C
(operator) precedence and omission of parentheses:
For logical operators, ¬ has higher precedence than ∧, which has higher precedence than ∨.
(WFF)
Goal: Make the structure (grammar) of logical formulæ clear.
All of the following are well-formed formulæ
Formulæ that do not fit the above definition are not well-formed
formulæ.
(Attention: In a later lecture, we will introduce more logical operators.)
Example formula: (A ∨ (¬B)) ∧ B
Simplification (the parentheses around ¬B are unnecessary): (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 |