Chapter-2 Foundation Logic
Chapter-2 Foundation Logic
Logic
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGIC
❖Proposition – basic building blocks of logic
– a declarative sentence that is either TRUE or FALSE, but not both.
❖Example:
1. Manila is the capital of the Philippines.
2. Toronto is the capital of Canada.
3. 1 + 1 = 2.
4. 2 + 2 = 3.
❖ Sentences 1 and 2 are not propositions because they are not declarative sentences.
❖ Sentences 3 and 4 are not propositions because they are neither true nor false.
❖ Note that each of sentences 3 and 4 can be turned into a proposition if we assign values to the
variables.
Which of these sentences are propositions? What are the truth values of those that are propositions?
c) 2 + 3 = 5. T
d) 5 + 7 = 10. F
1. Negation (denote or !)
2. “And” or logical conjunction (denoted )
3. “Or” or logical disjunction (denoted )
4. “XOR” or exclusive or (denoted )
5. Conditional/Implication (denoted or →)
6. Biconditional (denoted or )
Example: Find the negation of the proposition and express this in simple English.
1. 𝑥 ∧ 𝑦 1. 𝑥 ∧ 𝑦
𝒙 𝒚 𝒙 ∧𝒚 𝒙 𝒚 𝒙 ∧𝒚
T T T T T
T F T F F
F T F T F
F F F F F
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGICAL OPERATORS: Conjunction
2. ~𝑥 ∧ 𝑦 2. ~𝑥 ∧ 𝑦
𝒙 𝒚 ~𝒙 ~𝒙 ∧ 𝒚 𝒙 𝒚 ~𝒙 ~𝒙 ∧ 𝒚
T T T T F F
T F T F F F
F T F T T T
F F F F T F
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGICAL OPERATORS: Conjunction
3. ~𝑦 ∧ 𝑥 3. ~𝑦 ∧ 𝑥
𝒙 𝒚 ~𝒚 ~𝒚 ∧ 𝒙 𝒙 𝒚 ~𝒚 ~𝒚 ∧ 𝒙
T T T T F F
T F T F T T
F T F T F F
F F F F T F
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGICAL OPERATORS
DISJUNCTION TRUTH TABLE FOR
THE DISJUNCTION OF
Definition. Let 𝑝and 𝑞 be propositions. TWO PROPOSITIONS
The 𝑑𝑖𝑠𝑗𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑜𝑓 𝑝 and 𝑞,
denoted by 𝑝 ∨ 𝑞, is the proposition
𝒑 𝒒 𝒑∨𝒒
"𝑝 𝑜𝑟 𝑞". The T T T
𝑑𝑖𝑠𝑗𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑝 ∨ 𝑞 is false when
both 𝑝 and 𝑞 are false and is true T F T
otherwise. F T T
F F F
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGICAL OPERATORS: Disjunction
1. 𝑎 ∨ 𝑏 2. 𝑎 ∨ ~𝑏
𝒂 𝒃 𝒂∨𝒃 𝒂 𝒃 ~𝒃 𝒂 ∨ ~𝒃
T T T T
T F T F
F T F T
F F F F
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGICAL OPERATORS: Disjunction
3. ~𝑎 ∨ 𝑏
𝒂 𝒃 ~𝒂 ~𝒂 ∨ 𝒃
T T
T F
F T
F F
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGICAL OPERATORS
EXCLUSIVE OR TRUTH TABLE FOR
THE EXCLUSIVE OR
Definition. Let 𝑝and 𝑞 be propositions. OF TWO
PROPOSITIONS
The 𝑒𝑥𝑐𝑙𝑢𝑠𝑖𝑣𝑒 𝑜𝑟 of 𝑝 and 𝑞,
denoted by "𝑝 ⊕ 𝑞", is the 𝒑 𝒒 𝒑⊕𝒒
proposition that is true when exactly
T T F
one of 𝑝 and 𝑞 is true and is false
otherwise. T F T
F T T
F F F
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGICAL OPERATORS: XOR
Example
1. The circuit is either ON or OFF but not both
2. Let ab < 0, then either a < 0 or b < 0 but not both
3. You may have cake or ice cream, but not both
PRACTICE:
Let 𝑝 be the statement “Maria learns discrete mathematics” and 𝑞 the statement “Maria
will find a good job”. Express the statement 𝑝 → 𝑞 as a statement in English.
Answers:
“If Maria learns discrete mathematics, then she will find a good job.”
“Maria will find a good job when she learns discrete mathematics.”
“For Maria to get a good job, it is sufficient for her to learn discrete mathematics.
“Maria will find a good job unless she does not learn discrete mathematics.”
3. If sin x = 0, then x = 0.
False. x can be a multiple of . If we let x=2, then sin x=0 but x 0. The implication “if
sin x = 0, then x = k, for some k” is true.
EXAMPLE:
LET 𝑝 BE THE STATEMENT “YOU CAN TAKE
THE FLIGHT,” AND LET 𝑞 BE THE STATEMENT
“YOU BUY A TICKET.” THEN 𝑝 𝑞
Answer:
“You can take the flight if and only if you buy a
ticket.”
2. X 2 0 IF AND ONLY IF X 0.
False. The implication “if x2 0 then x 0” is false. Consider x=-1.
The hypothesis (-1)2=1 0 but the conclusion fails.
Example:
𝑝 → 𝑞: If you have a Sprite, then you have a root beer.
Example:
𝑝 → 𝑞: If it rains, then the ground gets wet.
𝑞 → 𝑝: If the ground gets wet, then it rained.
Example:
𝑝 → 𝑞: If 15 is an odd number, then15 is a prime number.
¬𝑞 → ¬𝑝: If 15 is not a prime number, then 15 is not an odd
number.
Note: Of these three conditional statements formed from 𝑝 → 𝑞, only the contrapositive always
has the same truth value as 𝑝 → 𝑞.
When two compound propositions always have the same truth value we call them equivalent,
so that a conditional statement and its contrapositive are equivalent.
Converse:
“If I have a test today, then today is Friday.”
Inverse:
“If today isn’t Friday, then I don’t have a test today.”
Contrapositive:
“If I don’t have a test today, then today isn’t Friday.”
SAMPLE PROBLEMS.
Converse:
“If the home team wins, then it is raining.”
Inverse:
“If it is not raining, then the home team does not win.”
Contrapositive:
“If the home team does not win, then it is not raining.”
❖ A bit is a symbol with two possible values, namely, 0 (zero) and 1 (one).
❖ The well-known statistician John Tukey introduced this terminology in 1946.
❖ 1 represents T (true), 0 represents F (false).
❖ A variable is called a Boolean variable if its value is either true or false.
❖ Consequently, a Boolean variable can be represented using a bit.
a) (p∨q)→(p⊕q)
b) (p⊕q)→(p∧q)
c) (p∨q)⊕(p∧q)
d) (p q)⊕(¬p q)
e) (p q)⊕(¬p ¬r)
f) (p⊕q)→(p⊕¬q)
ANSWER TO EXERCISE:
For questions a, b, c, d and f
ANSWER TO EXERCISE:
For question e,
❖ Information is often represented using bit strings, which are lists of zeros
and ones.
❖ When this is done, operations on the bit strings can be used to manipulate
this information.
Definition: A bit string is a sequence of zero or more bits. The length of this string is the number of
bits in the string.
❖ We use the symbols ∨, ∧, and ⊕ to represent the bitwise OR, bitwise AND, and bitwise XOR
operations, respectively.
Find the bitwise OR, bitwise AND, and bitwise XOR of each of these pairs of bit strings.
Propositional logic and its rules can be used to design computer circuits, to
construct computer programs, to verify the correctness of programs, and to build
expert systems.
❖ System specifications should be consistent, that is, they should not contain
conflicting requirements that could be used to derive a contradiction.
LOGIC PUZZLES
❖ Puzzles that can be solved using logical reasoning.
❖ Solving logic puzzles is an excellent way to practice working with the rules of
logic. Also, computer programs designed to carry out logical reasoning often use
well- known logic puzzles to illustrate their capabilities.
LOGIC CIRCUITS
❖ Propositional logic can be applied to the design of computer hardware.
❖ A logic circuit (or digital circuit) receives input signals p1,p2,...,pn, each a bit
[either 0 (off) or 1 (on)], and produces output signals s1,s2,...,sn, each a bit.
❖ The inverter, or NOT gate, takes an input bit p, and produces as output ¬𝑝.
❖ The OR gate takes two input signals p and q, each a bit, and produces as output
the signal 𝑝 ∨ 𝑞.
❖ The AND gate takes two input signals p and q , each a bit, and produces as
output the signal 𝑝 ∧ 𝑞.
❖ Complicated digital circuits can be constructed from three basic circuits, called
gates.
Example:
A digital circuit that produces the output (𝑝 ∨ ¬𝑟) ∧ (¬𝑝 ∨ (𝑞 ∨ ¬𝑟)) when
given input bits p, q, and r.
➢ Because of this, methods that produce propositions with the same truth
value as a given compound proposition are used extensively in the
construction of mathematical arguments.
Logical Equivalences:
➢ Compound propositions that have the same truth values in all possible cases are
called logically equivalent.
➢ One way to determine whether two compound propositions are equivalent is to use a
truth table.
Prepared by: Engr. Alimo-ot & Engr. Sacramento, ECE Department
LOGICAL EQUIVALENCES
➢ The compound propositions 𝑝 and 𝑞 are called logically equivalent if 𝑝 𝑞 is a
tautology.
*Remark: The symbol ≡ is not a logical connective, and 𝑝 ≡ 𝑞 is not a compound proposition
but rather is the statement that 𝑝 𝑞 is a tautology. The symbol ⟺ is sometimes used
instead ≡ to denote logical equivalence.
Logical Equivalences:
➢ In these equivalences,
and
Solution:
Let p: “Von has a cellphone”
q: “Von has a laptop computer.”
➢ Consequently, we can express the negation of our original statement as “Von does not have a
cellphone or he does not have a laptop computer.”
Solution:
Let r: “James will go to the concert.”
s: “Wilfred will go to the concert.”
➢ We could use a truth table to show that these compound propositions are
equivalent. Indeed, it would not be hard to do so.
➢ When no such assignments exists, that is, when the compound proposition is false for
all assignments of truth values to its variables, the compound proposition is
unsatisfiable.
➢ Note that a compound proposition is unsatisfiable if and only if its negation is true
for all assignments of truth values to the variables, that is, if and only if its
negation is a tautology.