(命題と論理式)
http://www.sw.it.aoyama.ac.jp/2017/Math1/lecture3.html
© 2005-17 Martin J. Dürst Aoyama Gakuin University
Those who have not yet registered for "Discrete Mathematics I" at http://moo.sw.it.aoyama.ac.jp, or have their name in Romaji instead of Kanji, must come to the front immediately after this lecture
[まだ http://moo.sw.it.aoyama.ac.jp で授業登録できてない人 、又は漢字ではなくローマ字で名前を登録している人は必ず授業直後申し出ること!]
A proposition is a sentence that is objectively either correct or wrong.
Propositions may also be called statements.
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:
The following are NOT propositions:
Counterexamples (NOT propositions):
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, ...
The handling of truth values (also called Boolean values or simply Booleans) differs among programming languages.
"Boolean" is named after Georges Boole.
Some examples:
0
represents false.0
can represent true.int
is used for booleans.bool
, true
, and
false
.0
represents true.0
can represent false.false
and true
.int
) and boolean values (boolean
)
are different types.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:
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.
Examples:
4 is smaller than 5 ∧ 4 is even. T (read: 4 is
smaller than 5 and is even)
7 is smaller than 5 ∧ 7 is even. F (read: 7 is
smaller than 5 and is even)
8 is smaller than 5 ∧ 8 is even. F (read: 8 is
smaller than 5 and is even)
3 is smaller than 5 ∧ 3 is even. F (read: 3 is
smaller than 5 and is even)
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.
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.
Examples:
4 is smaller than 5 ∨ 4 is even. T
8 is smaller than 5 ∨ 8 is even. T
3 is smaller than 5 ∨ 3 is even. T
7 is smaller than 5 ∨ 7 is even. F
A | B | A ∨ B |
---|---|---|
F | F | F |
F | T | T |
T | F | T |
T | T | 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, and is false if A is true.
Negation has only one operand and is therefore a unary operation.
Examples:
¬ (4 is even). F (read: 4 is not even.)
¬ (4 is odd). T (read: 4 is not odd.)
Truth Table for logical not
A | ¬A |
---|---|
F | T |
T | F |
In Information Technology:
In Mathematics:
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 (2017/9/29) is a Friday.
Sa: Today (2017/9/29) 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:
For logical operators, ¬ has higher precedence than ∧, which has higher precedence than ∨.
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æ
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)
Example formula: A ∨ ¬B ∧ C
Truth tables are often used to:
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 |
Repeat each quiz until you get 100% correct answers; deadline: October 5 (Thursday) 22:00:
下記のクイズは満点まで繰り返す; 締切: 10月 5日 (木) 22:00: