Logic and Computer Addition
Logic and Computer Addition
Logic and Computer Addition
CODES
A. Logic and Computer Addition
The term “logic” is often used, but not always in its technical sense. Logic is
technically defined as “the science or study of how to evaluate arguments and reasoning.”
Logic helps us to differentiate correct reasoning from poor reasoning. It is important in the
sense that it helps us to reason correctly. Others defined logic as discipline that deals with
the methods of reasoning. And logical reasoning is used on mathematics to prove theorems,
in computer science to verify correctness of programs and to prove theorems.
The existence of mathematical logic has contributed to, and has been aggravated by,
the study of foundations of mathematics. The study started in the late 19th century with the
development of axiomatic frameworks for analysis, geometry and arithmetic. In our time
the work in the foundations of mathematics often centered on establishing which parts of
mathematics can be formalized, rather than trying to find theories in which all of
mathematics can be developed.
• Propositions
Answer:
1. Mathematics is fun.
2. Calculus is more interesting than Trigonometry.
3. It was hot in Manila.
4. Street vendors are poor.
A propositional variable is a variable which is used to represent a proposition. A
formal propositional variable written using propositional logic notation, p, q, and r are
used to represent propositions. Logical connectives are used to combine simple propositions
which are referred as compound propositions. A compound proposition is a proposition
composed of two or more simple propositions connected by logical connectives “and,” ”or,”
”if then,” ”not,” ”if and only if,” and “exclusive-or.” A proposition which is not compound is
said to be simple (also called atomic).
• Logical Operators
There are six main logical connectives such as conjunction, disjunction, negation,
conditional, biconditional, and exclusive-or. The following are briefly discussed in this
section. Note that T refers to true proposition and F refers to false proposition.
Answer:
1. Since “2 + 6 = 9” is a false proposition (note that 2 + 6 = 9) and the proposition
"man is a mammal” is true, the conjunction of the compound proposition is
false.
P q 𝒑∧𝒒
F T F
Answer:
1. Note that the proposition “2 + 6 = 9” is false while the proposition “Manny
Pacquiao is a boxing champion” is true; hence the disjunction of the compound
proposition is true.
p q 𝒑∨𝒒
F T T
3. Given that both propositions ”Ferdinand Marcos is the only three-term Philippine
President” and “man is a mammal” are both true, thus the disjunction of the
compound proposition is true.
p q 𝒑∨𝒒
F T T
c. Negation. The negation of the proposition p is denoted by ~𝑝, where ~ is the symbol for
“not.”
Example: The following are propositions for p, find the corresponding ~𝑝.
1. 3 + 5 = 8.
2. Sofia is a girl.
3. Achaiah is not here.
Answer:
1. 3 + 5 ≠ 8.
2. Sofia is not a girl. or Sofia is a boy.
3. Achaiah is here.6
Property 4: The conditional proposition 𝑝 → 𝑞 is false only when p is true and q is false;
otherwise 𝑝 → 𝑞 is true. Meaning 𝑝 → 𝑞 states that a true proposition cannot imply a false
proposition.
p q 𝒑→𝒒
T T T
T F F
F T T
F F T
Example: In the proposition “If vinegar is sweet, then sugar is sour.” The antecedent is
“vinegar is sweet,” and the consequent is “sugar is sour.”
Example: Obtain the truth value of each of the following conditional propositions.
1. If vinegar is sweet, then sugar is sour.
2. 2 + 5 = 7 is a sufficient condition for 5 + 6 = 1.
3. 14 – 8 = 4 is a necessary condition that 6 ÷ 3 = 2.
Answer:
1. Since the propositions “vinegar is sweet” and the “sugar is sour” are both false,
therefore the conditional of the compound proposition is true.
p q 𝒑→𝒒
F F T
Property 5: If p and q are true or both false, then 𝑝 ⟷ 𝑞 is true; if p and q have
opposite truth values, then 𝑝 ⟷ 𝑞 is false.
p q 𝒑⟷𝒒
T T T
T F F
F T F
F F T
Example: Determine the truth values of each of the following biconditional propositions.
1. 2 + 8 = 10 if and only if 6 – 3 = 3.
2. Manila is the capital of the Philippines is equivalent to fish live in the moon.
3. 8 – 2 = 5 is a necessary and sufficient for 4 + 2 = 7.
Answer:
1. Since the statements “2 + 8 = 10” and the “6 – 3 = 3” are both true, therefore
the conditional of the compound proposition is true.
P q 𝒑⟷𝒒
T T T
2. Note that “Manila is the capital of the Philippines” is true proposition while “fish
live in the moon” is false, thus the conditional of the compound proposition is
false.
P q 𝒑⟷𝒒
T F F
It can be noted that the true values of 𝑝⨁𝑞 is the negation of the truth values of p ↔
q.
Given the proposition “Sofia will take her lunch in Batangas or she will have it in
Singapore,” it can be noted from the statement that “Sofia cannot have her lunch in
Batangas and at the same time do it in Singapore,” thus it is considered false.
If Sofia will have her lunch in Batangas or in Singapore, meaning she can only have
it in one location given a single schedule (the truth value is true).
Lastly, if she ought to decide to have her lunch elsewhere (neither in Batangas nor in
Singapore), therefore the truth value is false.
Disjunction 𝑝∨𝑞 p or q
Negation ∼𝑝 not p
¬𝑝 It is false that p…
𝑝′ It is not the case that p…
Conditional 𝑝⟶𝑞 If p, then q. p
implies q. p only if
q. p therefore q. p
is stronger than q.
p is sufficient
condition for q.
q if p. q follows p.
q whenever p. q is
weaker than p.
q is a necessary condition
for p.
1. ∼ 𝑝 ∨∼ 𝑞
2. 𝑝 → (𝑝 ↔ ~𝑞)
3. ~𝑝 ∧ 𝑞) ∨ (𝑝 ∧∼ 𝑞)
4. (𝑝 → 𝑞) ∨ (𝑞 ∧∼ 𝑟)
5. [(𝑝⨁𝑞) ∧ (𝑝 → 𝑞)] ∨ (𝑝 ↔ 𝑟)
Solution:
1. ∼ 𝑝 ∨∼ 𝑞
p q ∼𝒑 ∼𝒒 ∼ 𝒑 ∨∼ 𝒒
T T F F F
T F F T T
F T T F T
F F T T T
2. 𝑝 → (𝑝 ↔ ~𝑞)
p q ∼𝒒 𝒑 ↔∼ 𝒒 𝒑 → (𝒑 ↔ ~𝒒)
T T F F F
T F T T T
F T F T T
F F T F T
3. (~𝑝 ∧ 𝑞) ∨ (𝑝 ∧∼ 𝑞)
p Q ∼𝒑 ~𝒑 ∧ 𝒒 ~𝒒 (𝒑 ∧∼ 𝒒) ~𝒑 ∧ 𝒒) ∨ (𝒑 ∧∼ 𝒒)
T T F F F F F
T F F F T T T
F T T T F F T
F F T F T F F
4. (
p Q r 𝒑→𝒒 ∼𝒓 𝒒 ∧∼ 𝒓 (𝒑 → 𝒒) ∨ (𝒒 ∧∼ 𝒓)
T T T T F F T
T T F T T T T
T F T F F F F
T F F F T F F
F T T T F F T
F T F T T T T
F F T T F F T
F F F T T F T
5. [(𝑝⨁𝑞) ∧ (𝑝 → 𝑞)] ∨ (𝑝 ↔ 𝑟)
p Q r 𝑝⨁𝑞 𝑝→𝑞 (𝑝⨁𝑞) ∧ (𝑝 → 𝑞) 𝑝↔𝑟 [(𝑝⨁𝑞) ∧ (𝑝 → 𝑞)] ∨ (𝑝 ↔ 𝑟)
T T T F T F T T
T T F F T F F F
T F T T F F T T
T F F T F F F F
F T T T T T F T
F T F T T T T T
F F T F T F F F
F F F F T F T T
1. Tautology is a compound statement that is true for all possible combinations of the
truth values of the propositional variables also called logically true.
2. Contradiction is a compound statement that is false for all possible combinations of the
truth values of the propositional variables also called logically false or absurdity.
3. Contingency is a compound statement that can be either true or false, depending on
the truth values of the propositional variables are neither a tautology nor a
contradiction.
Example: Write the truth table for each of the following compound statements and
determine whether the compound statement is tautology, contradiction or contingency.
1. (~𝑝 ∧ 𝑞) → 𝑞
2. (𝑝 → 𝑞) ∧ (𝑝 → ~𝑞)
3. (~𝑝 ∨ 𝑞) ⊕ (𝑝 → 𝑞)
Solution:
1. (~𝑝 ∧ 𝑞) → 𝑞
p q ∼𝒑 ~𝒑 ∧ 𝒒 (~𝑝 ∧ 𝑞) → 𝑞
T T F F T
T F F F T
F T T T T
F T T F T
Since all the truth values of the compound statement (~𝑝 ∧ 𝑞) → 𝑞 are true, thus it is
a tautology.
2. (𝑝 → 𝑞) ∧ (𝑝 → ~𝑞)
P q 𝑝→𝑞 ~𝑞 𝑝 → ~𝑞 (𝑝 → 𝑞) ∧ (𝑝 → ~𝑞)
T T T F F F
T F F T T F
F T T F T T
F T T T T T
Note that the truth values of the statement (𝑝 → 𝑞) ∧ (𝑝 → ~𝑞) are combinations of
true and false, therefore the compound statement is contingency.
3. (~𝑝 ∨ 𝑞) ⊕ (𝑝 → 𝑞)
P q ~𝑝 ~𝑝 ∨ 𝑞 𝑝→𝑞 (~𝑝 ∨ 𝑞) ⊕ (𝑝 → 𝑞)
T T F T T F
T F F F F F
F T T T T F
F T T T T F
Observe that all the truth values of the compound statement are false, thus it
is a contradiction.
Two propositions are said to be logically equivalent if they have the same
truth value for every row of the truth table, that is if 𝑥 ↔ 𝑦 is a tautology.
Symbolically, 𝑥 ≡ 𝑦.
1. 𝑝 ∧ (𝑞 ∨ 𝑟) and (𝑝 ∧ 𝑞) ∨ (𝑝 ∧ 𝑟)
2. 𝑝 → 𝑞 and ~𝑞 → ~𝑝
3. 𝑝 ↔ 𝑞 and (𝑝 → 𝑞) ∧ (𝑞 → 𝑝)
Solution:
1. 𝑝 ∧ (𝑞 ∨ 𝑟) and (𝑝 ∧ 𝑞) ∨ (𝑝 ∧ 𝑞)
P q r 𝒒∨𝒓 𝒑 ∧ (𝒒 ∨ 𝒓) 𝒑∧𝒒 𝒑∧𝒓 (𝒑 ∧ 𝒒) ∨ (𝒑 ∧ 𝒓)
T T T T T T T T
T T F T T T F T
T F T T T F T T
T F F F F F F F
F T T T F F F F
F T F T F F F F
F F T T F F F F
F F F F F F F F
2. 𝑝 → 𝑞 and ~𝑞 → ~𝑝
p q 𝒑→𝒒 ~𝒒 ~𝒑 ~𝒒 → ~𝒑
T T T F T T
T F F T F F
F T T F T T
F F T T F T
The truth values of 𝑝 ↔ 𝑞 and (𝑝 → 𝑞) ∧ (𝑞 → 𝑝) are equal, thus we can say that
they are logically equivalent.
REFERENCES:
1. Nocon, R. C., & Nocon, E. G. (2018). Essential Mathematics for the Modern World.
Quezon City: C & E Publishing, Inc.