Propositions and Boolean Formulæ
(命題と論理式)
Discrete Mathematics I
3rd lecture, October 3, 2014
http://www.sw.it.aoyama.ac.jp/2014/Math1/lecture3.html
Martin J. Dürst

© 2005-14 Martin
J. Dürst Aoyama Gakuin
University
Today's Schedule
  - Summary of last lecture
 
  - Last week's homework
 
  - Propositions
 
  - Construction and use of logical (Boolean) formulæ
 
  - This week's homework
 
Summary of Last Lecture
  - The history of numbers starts with the integers 1, 2, 3,...
 
  - Across different cultures, the numerals for 1, 2, 3, 10 are similar
 
  - Peano created a set of 5 axioms using "1" and "successor" only that form
    a base for integer arithmetic
 
  - The numeral 0 was discovered very late, but 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
 
Last Week's Homework: Jokes
Question: Why do computer scientist always think Christmas and Halloween are
the same?
[都合により削除]
Question: At what age do Information Technologists celebrate "Kanreki"
(還暦)
[都合により削除]
 
Last Week's Homework: Arithmetic and Base Conversion
  - Total number of attempts: 452
 
  - Completely solved: 121 students
 
  - Less than 100%: 10 students
 
  - Not solved: 6 students
 
  - Average: 9.84 (out of 10)
 
About Moodle
Those who have not yet registered for "Discrete Mathematics I" at http://moo.sw.it.aoyama.ac.jp must
come to the front immediately after this lecture
[まだ http://moo.sw.it.aoyama.ac.jp
で授業登録できてない人は授業直後申し出ること!]
Proposition
A proposition is a sentence that is objectively either correct or
not.
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:
  - 2 times 2 is 4.
 
  - 10 is smaller than 5.
 
  - Four is an odd number.
 
  - On January 1, 2015, it will rain in Fuchinobe.
 
 
Counterexamples of Propositions
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, 2014).
    Reason: 'Her' is undefined. 
  - x is even.
    Reason: Undefined variable. 
  - When did you get up this morning?
    Reason: Question 
  - Natto (納豆) is delicious.
    Reason: Subjective opinion. 
 
Truth Values of a Proposition
Each proposition is either correct or not.
"Correct" is called true (真), and is written T, ⊤, or 1.
"Not correct" is called false (偽), and is written F, ⊥, or 0.
True and false together are called truth values.
Other representations for truth values: ○/×,...
 
Truth Values in Program Languages
The handling of truth values (also called booleans) differs for different
programming languages:
  - C programming Language: 
    
      0 represents false. 
      - All integers ≠
0 can represent true. 
      - The type 
int is used for booleans. 
    
   
  - Unix shell: 
    
      0 represents true. 
      - All integers ≠
0 can represent false. 
      - This is exactly the oppositie of C.
 
    
   
  - Java programming language: 
    
      - false is represented as 
false、true
        as true. 
      - Integers (
int) and boolean values (boolean)
        are different types. 
    
   
  - Ruby programming language: 
    
      - false is represented as 
false、true
        as true. 
      false and nil (empty/nothing) are
        interpreted as false. All other objects are interpreted as
        true. 
    
   
 
The Importance of Logical Operations
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
 
Modeling
  - 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
 
Logical Operations
With logical operations, we can create compound propositions from simpler
propositions.
The most frequently used logical operations are as follows:
  - and: A ∧ B (conjunction)
 
  - or: A ∨ B (disjunction)
 
  - not: ¬A (negation)
 
Conjunction (and)
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 and is even. T
7 is smaller than 5 and is even. F
8 is smaller than 5 and is even. F
3 is smaller than 5 and is even. F
 
Truth Table for Logical And
  
    
      | A | 
      B | 
      A ∧ B | 
    
    
      | F | 
      F | 
      F | 
    
    
      | F | 
      T | 
      F | 
    
    
      | T | 
      F | 
      F | 
    
    
      | T | 
      T | 
      T | 
    
  
Disjunction (or)
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.
Examples:
4 is smaller than 5 or is even. T
8 is smaller than 5 or is even. T
3 is smaller than 5 or is even. T
7 is smaller than 5 or is even. F
Truth Table for Logical Or
  
    
      | A | 
      B | 
      A ∨ B | 
    
    
      | F | 
      F | 
      F | 
    
    
      | F | 
      T | 
      T | 
    
    
      | T | 
      F | 
      T | 
    
    
      | T | 
      T | 
      T | 
    
  
 
Negation
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 an unary
operation.
Examples:
4 is not even. F
4 is not odd. T
Truth Table for Logical Not
 
Structure of Logical Formulæ
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.
 
  - Operators with higher precedence get evaluated first.
 
  - If the order of evaluation is not correct, we use parentheses to fix
  it.
 
For logical operators, ¬ has higher precedence than ∧, which has higher
precedence than ∨.
Example: A ∨ B ∧ C = A ∨
(B∧C) ≠ (A∨B) ∧
C 
 
Well-Formed Formula
(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æ: 
    
  
 
Formulæ that do not fit the above definition are not well-formed
formulæ.
(Attention: In a later lecture, we will introduce more logical operators.)
 
Logical Formula Evaluation with a Truth Table
Truth tables are often used for:
  - Defining logical operations
 
  - Evaluating logical formulæ
 
  - Proofs of properties of logical operations and formulæ
 
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 | 
    
  
 
How to Write a Truth Table
  - Create a column for each variable that appears in the formula.
 
  - Starting the the simplest subexpression, add a column for each
    subexpression in the formula.
 
  - Add a column for the overall formula.
 
  - Create one row for the headers, and 2n rows for
    entries, where n is the number of variables
 
  - Fill in the 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
  2n-1.
 
  - Fill in the subexpression columns and the final column by calculating
    each value from earlier columns.
 
  - Example: Write a truth table for (D ∧ ¬F) ∨
    ¬E
 
How to Use a Truth Table for a Proof
  - Goal: Prove one of the absorbtion laws for ∨ and ∧: A∨A∧B
    = A.
 
  - Method: 
    
      - Create a truth table for both sides of the law.
 
      - Compare the columns for both sides.
 
      - If the columns are equal, the law is proved.
 
    
   
  
    
      | A | 
      B | 
      A ∧ B | 
      A ∨
        A∧B | 
    
    
      | F | 
      F | 
      F | 
      F | 
    
    
      | F | 
      T | 
      F | 
      F | 
    
    
      | T | 
      F | 
      F | 
      T | 
    
    
      | T | 
      T | 
      T | 
      T | 
    
  
Boolean Functions
  - 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.
 
This Week's Homework
  - Solve the quiz Propositions:
    True or False until October 9, 22:00
 
  - Solve the quiz Truth Table
    1 until October 9, 22:00
 
  - Solve the quiz Truth Table
    2 until October 9, 22:00
 
Deadline: October 9, 22:00
Repeat each quiz until you get 100% correct answers.
今回の宿題
  - Moodle で Propositions:
    True or False のクイズを解く
    (全正解でない場合、繰り返す、締切: 10月 9日 (木)
    22:00) 
 
  - Moodle で Truth Table
    1 のクイズを解く
    (全正解でない場合、繰り返す、締切: 10月 9日 (木)
    22:00)
 
  - Moodle で Truth Table
    2 のクイズを解く
    (全正解でない場合、繰り返す、締切: 10月 9日 (木)
    22:00)
 
Glossary
  - 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
 
    - 文法
 
  - propositional variable
 
    - 命題変数
 
  - (operator) precedence
 
    - (演算子の) 優先順位
 
  - evaluation
 
    - (式の) 評価
 
  - parentheses
 
    - 括弧
 
  - subexpression
 
    - 部分式
 
  - Boolean function
 
    - 論理関数、ブール関数
 
  - Boolean argument
 
    - 論理引数 (ひきすう; ブール引数とも言う)
 
  - domain (of a function)
 
    - (関数の) 定義域
 
  - range (of a function)
 
    - (関数の) 値域