L1
L1
Mircea Marin
L9: Boolean algebras; boolean functions; logic gates; applications and exam-
ples.
Schedule
9 lectures, on Tuesdays, from 10:10 to 11:25, in the following days:
September 7, 14, 21, 28
October 5, 10, 26
November 2, 9.
Exam: November 16.
Lecture material can be downloaded from the webpage
http://www.score.is.tsukuba.ac.jp/~mmarin/MathCS/
Every lecture ends with a set of related exercises.
The participants will receive a grade after a written exam in November 18,
from 10:10 to 11:25.
References
Kenneth H. Rosen. Discrete Mathematics and its Applications. Fifth Edition.
ISBN 0-07-242434-6.
For further questions, you can contact me by email at [email protected]
1
1 L1: Propositional and Predicate Logic
In this lecture you will learn
1. How to specify correct mathematical statements,
2. How to give precise meaning to mathematical statements, and
3. How to prove mathematical statements.
Logic is the study of declarative sentences that state some fact. This means that
only sentences of type (a) are studied by logic. In mathematics, such sentences
are called formulas.
2
We use letters p, q, r, s to denote propositions.
New propositions, called propositional formulas, are formed from existing
propositions using logical operators ¬ (not), ∧ (and), ∨ (or), ⊕ (exclusive or),
→ (implies), ↔ (if and only if):
F ::= propositional formulas:
p proposition
| ¬F negation
| F1 ∧ F2 conjunction
| F1 ∨ F2 disjunction
| F1 ⊕ F2 exclusive disjunction
| F1 → F2 implication
| F1 ↔ F2 equivalence
3
3. Split the sentence into simpler sentences and give distinct names to the
component propositions.
4. Reformulate the English sentence as a propositional formula.
1. Detect the words for logical connectives and identify their logical meaning:
4
“You can not ride the roller coaster if you are under 4 feet tall unless
you are older than 16 years.”
not =¬
A unless B =(¬B → A)
C if D =D → C.
2. We identify the following propositions:
O ≡ “You are older than 16 years.”
T ≡ “You are under 4 feet tall.”
R ≡ “You can ride the roller coaster.”
3. The initial sentence becomes
¬O → (T → ¬R)
F ¬F F1 F2 F1 ∧ F2 F1 F2 F1 ∨ F2 F1 F2 F1 ⊕ F2
T F T T T T T T T T F
F T T F F T F T T F T
F T F F T T F T T
F F F F F F F T F
F1 F2 F1 → F2 F1 F2 F1 ↔ F2
T T T T T T
T F F T F F
F T T F T F
F F T F F T
5
Two propositional formulas F1 and F2 are equivalent if F1 ↔ F2 is a tautology.
The notation F1 ≡ F2 denotes that F1 and F2 are equivalent.
Example 4 (A → ¬B) ∨ A is a tautology because it is always true:
A B ¬B A → ¬B (A → ¬B) ∨ A
T T F F T
T F T T T
F T F T T
F F T T T
A → B and (¬B) → ¬A are equivalent because (A → B) ↔ ((¬B) → ¬A) is a
tautology.
A B ¬A ¬B A→B (¬B) → ¬A (A → B) ↔ ((¬B) → ¬A)
T T F F T T T
T F F T F F T
F T T F T T T
F F T T T T T
Definition 2 (converse, contrapositive, and inverse) There are 3 related
implications that can be formed from a formula p → q.
• The converse of p → q is the formula q → p.
• The contrapositive of p → q is the formula (¬q) → (¬p).
• The inverse of p → q is the formula (¬p) → (¬q).
Example 5 What are the contrapositive, the converse, and the inverse of the
implication
“The
| home{zteam wins} whenever
| {z } it is raining.”?
| {z }
q ← p
6
1.3 Applications of propositional logic
System and software engineers translate requirements in natural language (such
as English or Japanese) into logical formulas. In general, system specifications
must be consistent.
In this example, the system specifications are S = {p ∨ q, ¬p, p → q}. They are
consistent because all components are true when p is F and q is T.
7
Homeworks
1. Let p, q, r be the propositions
8
(a) “The message is scanned for viruses whenever the message was sent
from an unknown system.”
(b) “The message was sent from an unknown system but it was not
scanned for viruses.”
(c) “It is necessary to scan the message for viruses whenever it was sent
from an unknown system.”
(d) “When a message is not sent from an unknown system it is not
scanned for viruses.”
6. Determine whether each of these implications is true or false.
(a) If 1 + 1 = 2, then 2 + 2 = 5.
(b) If 1 + 1 = 3, then 2 + 2 = 4.
(c) If pigs can fly, then 1 + 1 = 3.
(d) If 1 + 1 = 3, then pigs can fly.
(e) If 2 + 2 = 4, then 1 + 2 = 3.
7. Write each of the following statements in the form “if p, then q” in English.
(a) Willy gets caught whenever he cheats.
(b) You can access the website only if you pay a subscription fee.
(c) It snows whenever the wind blows from the north-east.
(d) It is necessary to walk more than 10 miles to get to the top of Mount
Tsukuba.
(e) To be a citizen of this country, it is sufficient that you were born in
Japan.