Week 4 Notes - (Logics)
Week 4 Notes - (Logics)
c Oketch
1 Logic
Definition 1.1 (Logic). It is the systematic study of valid reasoning, sound argumentation, and
inference.
It involves evaluating the validity of mathematical arguments, distinguishing between true and false
statements, and identifying errors in reasoning. It aims to understand how conclusions are drawn from
premises. Logic is critical in mathematics, computer science, philosophy, and other fields, helping to
ensure rational and consistent thinking.
1.1 Propositions
Definition 1.2 (Proposition). It is a statement which is either true or false.
The truth values of propositions are T (if it is a true statement) or F (if it is a false statement). For
instance,
• It is raining today.
• x2 = 36. [Not a proposition because the variable x has not been assigned any value. It is an
open sentence]
The above propositions are called simple propositions. Compound propositions can be formed by
connectives with simple propositions. For example,
We usually use lower case letters p, q, r, s to denote propositions. In propositions, we avoid dealing
with ambiguous case, i.e., statements that are both true and false at the same time.
Definition 1.3 (Truth table). It displays all possible truth values of a logical expression or a set of
propositions.
In a truth table if the number of propositions are n, then the number of rows is 2n . Truth tables
are essential tools for evaluating the validity and behavior of logical expressions, especially in more
complex logical reasoning and analysis. They help in understanding how different combinations of
truth values affect the overall truth value of a logical statement.
1.2 Connectives
Let p and q be two propositions. Then,
Definition 1.4 (Negation). The negation of p, denoted by ∼ p or ¬p, is the proposition “NOT p”. It
is true (T) whenever p is false. Otherwise, it is false.
For example:
1
1.2 Connectives ⃝Francis
c Oketch
p ∼p
T F
F T
For example:
The truth table for the conjunction of two propositions p and q is as follows
p q p∧q
T T T
T F F
F T F
F F F
Definition 1.6 (Disjunction). The disjunction of p and q, denoted by p∨q, is the compound proposition
“p OR q”. It is true (T) when at least one of p or q is true. Otherwise, it is false.
For example:
The truth table for the disjunction of two propositions p and q is as follows
p q p∨q
T T T
T F T
F T T
F F F
Definition 1.7 (Exclusive Or). The exclusive Or of p and q, denoted by p ⊕ q or p XOR q, is the
compound proposition “p or q, and not both p and q”. It is true (T) when exactly one of p and q is
true. Otherwise, it is false.
For example:
• p ⊕ q is the statement “it is cold or it is raining, and not both cold and raining”
The truth table for the exclusive Or of two propositions p and q is as follows
p q p⊕q
T T F
T F T
F T T
F F F
2
1.2 Connectives ⃝Francis
c Oketch
Two compound propositions A and B are called logically equivalent if, and only if, their truth
tables are identical. In this case, we write A ≡ B.
• tautology if it is true for all possible truth values of its components. In other words, the
last column in the truth table has every entry “T”. For example, (∼ p) ∨ p.
• contradiction if it is the negation of a tautology. In other words, the last column in the
truth table has every entry “F”. For example, p ∧ (∼ p).
• contingency if it is neither a tautology nor a contradiction.
Example(s):
1. Let p be “Kuwait is an island”, q be “Sea water contains salt”, and r be “it is raining today”.
Discuss the truth value of (∼ (p ∨ q)) ∧ (r ∧ (∼ p)).
Solution
The truth table is:
Hence, the propositional form (∼ (p ∨ q)) ∧ (r ∧ (∼ p)) is true only if p is false and q false and r
is true. Otherwise, it is false.
2. Let p be “π is an irrational number”. Find the negation of p, and give any three examples of
denials of p.
Solution
Solution
The truth table is:
3
1.3 Conditionals and Biconditionals ⃝Francis
c Oketch
Since (p ∨ q) ∨ ((∼ p) ∧ (∼ q)) is true for all possible truth values of p and q, it is a tautology.
Moreover, it can be seen that the negation of (p ∨ q) ∨ ((∼ p) ∧ (∼ q)) is a contradiction.
Exercise:
1. Let p, q, and r be three propositions. Construct the truth table of the propositional form
(a) (p ∨ q) ∧ (∼ r)
(b) (p ∧ q) ∨ (p ∨ (∼ r))
2. Show that:
In other words, p ⇒ q is false when p is true and q is false; otherwise it is true. In this case, p is called
the hypothesis or premise or antecedent and q is called the conclusion or consequent. For example,
let
p q p⇒q ∼p (∼ p) ∨ q
T T T F T
T F F F F
F T T T T
F F T T T
→ Note:
4
1.3 Conditionals and Biconditionals ⃝Francis
c Oketch
Example(s):
1. Find the inverse, converse and contrapositive of if today is Friday, then I have a test today.
Solution
Let p be “today is Friday” and let q be “I have a test today”. Given the conditional sentence
p ⇒ q, we have
• Inverse: ∼ p ⇒∼ q, i.e., if today is not Friday, then I don’t have a test today.
• Converse: q ⇒ p, i.e., if I have a test today, then today is Friday.
• Contrapositive: ∼ q ⇒∼ p, i.e., if I didn’t have a test today, then today is not Friday.
Note that “if, and only if,” is abbreviated as “iff”. For example, let
Exercise:
1. Show that:
(a) “You can access internet from campus only if you are a computer science major or you are
not a freshman”.
(a) (p ⇒ q) ∨ ((∼ p) ⇒ q)
(b) (p ⇔ q) ∨ ((∼ p) ⇔ r)
(c) p ⇒ (q ∧ [(q ∧ (∼ r)) ⇒ (p ∨ r)])
5
1.4 Logic Gates and Circuits ⃝Francis
c Oketch
(a) p ⇒ (∼ q) ∨ r
(b) ∼ p ⇒ (q ⇒ r
(c) (p ∨ q) ∨ r
(d) (p ∧ q) ∨ r
(e) (p ∧ q) ∧ (∼ r)
(a) (∼ p) ∧ (p ∨ q) ⇒ q
(b) [(p ⇒ q) ∧ (q ⇒ r)] ⇒ (p ⇒ r)
x y x∧y
1 1 1
1 0 0
0 1 0
0 0 0
1.4.2 OR Gate
An OR gate receives inputs x and y and produces output denoted by x ∨ y, as shown in logic table
x y x∨y
1 1 1
1 0 1
0 1 1
0 0 0
x y =∼ x
1 0
0 1
6
1.4 Logic Gates and Circuits ⃝Francis
c Oketch
• If the switch is closed, current will pass through it. If the switch is open, current will not pass
through it.
The electrical circuits containing switches by Boolean expressions, if ON is denoted by true or 1 and
OFF is denoted by False or 0.
1
1
Mathematics is fun!