Study Material Unit-01 - Set Theory & Logic - Part-02-Logic - SY B.Tech Comp
Study Material Unit-01 - Set Theory & Logic - Part-02-Logic - SY B.Tech Comp
Propositional Logic:
The rules of logic give precise meaning to mathematical statements. These rules
are used to distinguish between valid and invalid mathematical arguments. Because a
major goal of this topic is to teach, how to understand and how to construct correct
mathematical arguments, the importance of logic in understanding mathematical
reasoning, logic has numerous applications to computer science. These rules are used in
the design of computer circuits, the construction of computer programs, the verification
of the correctness of programs, and in many other ways. Furthermore, software systems
have been developed for constructing some, but not all, types of proofs automatically.
Remark relate to Logic:
• Crucial for mathematical reasoning
• Used for designing electronic circuitry
• Logic is a system based on propositions.
Propositions:
A proposition is a declarative sentence (that is, a sentence that declares a fact)
that is either true or false, but not both.
• A proposition is a statement that is either true or false (not both).
• We say that the truth value of a proposition is either true (T) or false (F),
Corresponds to 1 and 0 in digital circuits.
e.g. i) “Elephants are bigger than dogs.” Truth value-T
ii)“520 < 111” , Truth value-F
iii) “y > 5” Truth value- Its truth value depends on the value of y, but this value is not
specified.
Statement no. iii) called as a propositional function or open sentence. Denoted by P(x), P(y)
Consider the following sentences.
1. What time is it?
2. Read this carefully
Sentences 1 and 2 are not propositions because they are not declarative sentences.
Logical Operators/Connectives:
• Negation (NOT, ∼ 𝑜𝑟)
• Conjunction (AND, ⋀)
• Disjunction (OR, ⋁)
• Implication (if – then, ⟶ 𝑜𝑟 ⟹)
• Biconditional (if and only if, ↔ 𝑜𝑟 ⇔)
Truth tables can be used to show how these operators can combine propositions to
compound propositions.
Truth tables:
1) Negation (NOT):Unary Operator, Symbol- or ~
P P
P Q P Q
T T T
T F F
F T F
F F F
P Q PQ
T T T
T F T
F T T
F F F
P Q P→Q
T T T
T F F
F T T
F F T
P Q PQ
T T T
T F F
F T F
F F T
P Q P Q (P)(Q)
T T F F F
T F F T T
F T T F T
F F T T T
2)
T T T F F
T F F T T
F T F T T
F F F T T
Q) What are the contrapositive, the converse, and the inverse of the conditional
statement“The home team wins whenever it is raining?”
e.g: How can this English sentence be translated into a logical expression?
“If it is not raining, then the home team does not win.”
Therefore the logic expression of “If it is not raining, then the home team does not win.”
is ~𝑝 → ~𝑞.
Equivalent Statements:
An important type of step used in a mathematical argument is the replacement of a
statement with another statement with the same truth value. 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. Note that we will
use the term “compound proposition” to refer to an expression formed from
propositional variables using logical operators, such as𝑝 ∧ 𝑞.
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. In particular, the compound propositions p and q are equivalent if and only
if the columns giving their truth values agree.
T T T F F T
T F F T T T
F T F T T T
F F F T T T
The statements (PQ) and (P) (Q) are logically equivalent,
since (PQ) (P) (Q) is always true.
T T T T T T T T
T T F F T T T T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F F F T F F
F F T F F F T F
F F F F F F F F
In above truth table, from 5th and 8th column we have proved that p ∨ (q ∧ r) and (p ∨ q)
∧ (p ∨ r) are logically equivalent. This is the distributive law of disjunction over
conjunction.
Remark:
1) The symbol ≡ is not a logical connective, and p ≡ q is not a compound
proposition but rather is the statement that p ↔ q is a tautology. The symbol ⇔
is sometimes used instead of ≡ to denote logical equivalence.
2) The compound propositions p and q are called logically equivalent if p ↔ q is a
tautology. The notation 𝑝 ≡ 𝑞denotes that p and q are logically equivalent.
3) A compound proposition that is always true, no matter what the truth values of
the propositional variables that occur in it, is called a tautology. A compound
proposition that is always false is called a contradiction. A compound proposition
that is neither a tautology nor a contradiction is called a contingency.
Logical Equivalences:
Equivalence Name of Law/ Identity
• ¬(p ∨ q) ≡ ¬p ∧¬q
• p ∨ (p ∧ q) ≡ p Absorption laws
Discrete Mathematics, Unit-01_Sets & Logics Vishwakarma University, Pune-48
Prepared by Jameel A. Ansari
• p ∧ (p ∨ q) ≡ p
• p ∨¬p ≡ T Negation laws
• p ∧¬p ≡ F
Note: equivalent expressions can always be substituted for each other in a more
complex expression - useful for simplification.
Example:
Let Propositional function P(x), where P is the predicate and x is the variable.
P(x) = x-3 > 5
What is the truth value of P(2) ? F
What is the truth value of P(8) ? F
What is the truth value of P(9) ? T
Q)Let P(x) denote the statement “x >3.” What are the truth values of P(4) and P(2)?
Solution:
We obtain the statement P(4) by setting x = 4 in the statement “x >3.” Hence,
P(4), which is the statement “4 >3,” is true. However, P(2), which is the statement
“2 >3,”is false.
Q) Let Q(x, y) denote the statement “x = y + 3.” What are the truth values of the
propositions Q(1, 2) and Q(3, 0)?
Solution: To obtain Q(1, 2), set x = 1 and y = 2 in the statement Q(x, y). Hence, Q(1, 2) is
the statement “1 = 2 + 3,” which is false. The statement Q(3, 0) is the proposition
“3 = 0 + 3,”which is true.
Universal Quantification:
Let P(x) be a propositional function.
Universally quantified sentence:
P(x) is true for every x in the universe of discourse (Domain).
Notation: universal quantifier
x P(x), ‘For all x, P(x)’, ‘For every x, P(x)’
Example:
Let S(x): x is a MBA student.
G(x): x is a genius.
What does x (S(x) → G(x)) mean ?
“If x is a MBA student, then x is a genius.” or
“All MBA students are geniuses.”
Existential Quantification:
Let P(x) be a propositional function.
Existentially quantified sentence:
There exists an x in the universe of discourse (domain) for which P(x) is true.
Notation: existential quantifierx P(x)
‘There is an x such that P(x),’ ‘For some x, P(x)’, ‘For at least one x, P(x)’, ‘I can find an x
such that P(x).’
Note:
Existence: We show that an element x with the desired property exists.
Uniqueness: We show that if 𝑦 ≠ 𝑥, then y does not have the desired property.
Equivalently, we can show that if x and y both have the desired property, then x = y.
Negation of Quantification:
(x P(x)) is logically equivalent to x (P(x)).
(x P(x)) is logically equivalent to x (P(x)).
Q) Let 𝑃(𝑚, 𝑛)be the statement “m divides n,” where the domain for both variables
consists of all positive integers. (By “m divides n” we mean that n = km for some integer
k.) Determine the truth values of each of these statements.
a) 𝑃(4, 5) b) 𝑃(2, 4)
c) ∀𝑚∀𝑛 𝑃(𝑚, 𝑛) d) ∃𝑚∀𝑛 𝑃(𝑚, 𝑛)
e) ∃𝑛 ∀𝑚𝑃(𝑚, 𝑛) f )∀𝑛𝑃(1, 𝑛)
T T T T T T T
T T F T T F F
T F T T F T F
T F F T T F F
F T T F T T F
F T F F T T F
F F T T F T F
F F F T T T T
T T T T F F T F
T T F T T T T F
T F T T T T T F
T F F T T T T F
F T T T T T T F
F T F T T T T F
F F T T T T T F
F F F F T F T F
Instead of using truth table to solve this problem, we will reason about truth values.
Note that (p ∨¬q) ∧ (q ∨¬r) ∧ (r ∨¬p) is true when the three variable p, q, and r have
the same truth value (see Truth table). Hence, it is satisfiable as there is at
least one assignment of truth values for p, q, and r that makes it true.
Similarly, note that (p ∨ q ∨ r) ∧ (¬p ∨¬q ∨¬r) is true when at least one of p, q, and r is
true and at least one is false (Make truth table). Hence, (p ∨ q ∨ r) ∧ (¬p ∨¬q ∨¬r) is
satisfiable, as there is at least one assignment of truth values for p, q, and r that makes it
true.
Finally, note that for (p ∨¬q) ∧ (q ∨¬r) ∧ (r ∨¬p) ∧ (p ∨ q ∨ r) ∧ (¬p ∨¬q ∨¬r)
to be true, (p ∨¬q) ∧ (q ∨¬r) ∧ (r ∨¬p) and (p ∨ q ∨ r) ∧ (¬p ∨¬q ∨¬r) must both
be true. For the first to be true, the three variables must have the same truth values, and
for the second to be true, at least one of three variables must be true and at least one
must be false. However, these conditions are contradictory. From these observations we
conclude that no assignment of truth values to p, q, and r makes
(p ∨¬q) ∧ (q ∨¬r) ∧ (r ∨¬p) ∧(p ∨ q ∨ r) ∧ (¬p ∨¬q ∨¬r) true. Hence, it is
unsatisfiable.
We can use a proof to demonstrate that a particular statement is true. A proof consists
of a sequence of statements that form an argument.
Rules of Inference:
Inference is the act or process of deriving a conclusion based solely on what one
already knows. It uses hypotheses, axioms, definitions etc. to reach a conclusion.
We say that an argument is valid, if whenever all its hypotheses are true,
its conclusion is also true.
“If it rains today, then we will not have a barbeque today. If we do not have a barbeque
today, then we will have a barbeque tomorrow.
Therefore, if it rains today, then we will have a barbeque tomorrow.”
Solution:
p: “It is raining today.”
q: “We will not have a barbeque today.”
r: “We will have a barbeque tomorrow.”
So the argument is of the following form:
𝑝 →𝑞
𝑞 →𝑟
∴ 𝑝 →𝑟
Solution:Yes
A: “David is intelligent.”
B: “David is a good actor.”
C: “David can count from 1 to 10.”
Step 1: C
Step 2: A → C
Step 3: A
Step 4: B A
Step 5: B Conclusion: a (“David is a good actor.”)
Q) State which rule of inference is the basis of the following argument: “It is below
freezing now.
Therefore, it is either below freezing or raining now.”
Solution: Let p be the proposition “It is below freezing now” and q the proposition
“It is rainingnow.” Then this argument is of the form
𝑝
∴ 𝑝∨𝑞
This is an argument that uses the addition rule.
Q) State which rule of inference is the basis of the following argument: “It is below
freezing andraining now. Therefore, it is below freezing now.”
Solution: Let p be the proposition “It is below freezing now,” and let q be the proposition
“It israining now.” This argument is of the form
Discrete Mathematics, Unit-01_Sets & Logics Vishwakarma University, Pune-48
Prepared by Jameel A. Ansari
𝑝∧𝑞
∴ 𝑃
This argument uses the simplification rule.
Q) Show that the premises “If you send me an e-mail message, then I will finish writing
theprogram,” “If you do not send me an e-mail message, then I will go to sleep early,”
and “If I goto sleep early, then I will wake up feeling refreshed” lead to the conclusion “If
I do not finishwriting the program, then I will wake up feeling refreshed.”
3.A conjunctive clause is a proposition that contains only literals and the connective .
Eg: (p q r).
4. A disjunctive clause is a proposition that contains only literals and the connective .
Eg: (p q r)
F F F T
F F T T
F T F T
F T T F
T F F T
T F T F
T T F T
T T T F
There are 5 cases where the proposition is true, hence 5 minterms. Rows 1,2,3, 5 and 7
produce the following disjunction of minterms:
(P V Q)→R
(P Q R) V (P Q R) V (P Q R)V (P Q R) V (P Q R)
PROOFS:
Proofs in mathematics are valid arguments that establish the truth of mathematical
statements.
Premise: A statement, in an argument, or argument form, other than the final one
Note: Less important theorems sometimes are called propositions. (Theorems can
also be referred to as facts or results.)
Lemma: A less important theorem that is helpful in the proof of other results is called
a lemma. Complicated proofs are usually easier to understand when they are proved
using a series of lemmas, where each lemma is proved individually.
axiom: A statement that is assumed to be true and that can be used as a basis for
proving theorems.
Trivial proof: A proof that p → q is true based on the fact that q is true.
Direct proof: A proof that p → q is true that proceeds by showing that q must be true
when p is true.
Proof by contradiction: a proof that q is true based on the truth of the conditional
statement p → ¬q, where p is a contradiction.
Q) Give a direct proof of the theorem “If n is an odd integer, then 𝑛2 is odd.”
Proof:
Note that this theorem states ∀n(P (n) → Q(n)), where P(n) is “n is an odd integer”
and Q(n) is “𝑛2 is odd.” As we have said, we will follow the usual convention in
mathematical proofs by showing that P(n) implies Q(n), and not explicitly using
universal instantiation.
To begin a direct proof of this theorem, we assume that the hypothesis of this
conditional statement is true, namely, we assume that n is odd. By the definition of an
odd integer, it follows that n = 2k + 1, where k is some integer. We want to show that 𝑛2
is also odd. We can square both sides of the equation n= 2k + 1 to obtain a new equation
that expresses 𝑛2 . When we do this, we find that 𝑛2 = (2𝑘 + 1)2 = 4𝑘 2 + 4𝑘 + 1 =
2(2𝑘 2 + 2𝑘) + 1 = 2𝑘1 + 1 .
Discrete Mathematics, Unit-01_Sets & Logics Vishwakarma University, Pune-48
Prepared by Jameel A. Ansari
By the definition of an odd integer, we can conclude that 𝑛2 is an odd integer (it is one
more than twice an integer).Consequently, we have proved that if n is an odd integer,
then 𝑛2 is an odd integer.
Q.) Use a proof by contradiction to prove that the sum of an irrational number and a
rational number is irrational.
Proof:
The proposition to be proved here is as follows: If 𝑟is a rational number and i is an
irrational number, then 𝑠 = 𝑟 + 𝑖 is an irrational number.
So suppose that 𝑟is rational, i is irrational, and s is rational.
We know that the sum of the rational numbers 𝑠and −𝑟must be rational. (Indeed, if 𝑠 =
𝑎/𝑏 𝑎𝑛𝑑 𝑟 = 𝑐/𝑑,
where a, b, c, and d are integers, with 𝑏 ≠ 0 and 𝑑 ≠ 0, then by algebra we see that
𝑠 + ( −𝑟) = (𝑎𝑑 − 𝑏𝑐)/ (𝑏𝑑) ,
so that patently 𝑠 + ( −𝑟) is a rational number. But 𝑠 + ( −𝑟) = 𝑟 + 𝑖 − 𝑟 = 𝑖,
forcing us to the conclusion that i is rational. This contradicts our hypothesis that i is
irrational. Therefore the assumption that s was rational was incorrect, and we conclude,
as desired, that s is irrational.
b) Suppose that 𝑛3 + 5 is odd and that n is odd. Since n is odd, and the product of odd
numbers is odd, in two steps we see that 𝑛3 is odd. But then subtracting we conclude
that 5, being the difference of the two odd numbers 𝑛3 + 5 and 𝑛3 , is even. This is not
true. Therefore our supposition was wrong, and the proof by contradiction is complete.
𝑛(𝑛+1)
i) 1 + 2 + 3 + ⋯……..+ 𝑛 = 2
𝑛(3𝑛+1)
ii) 2 + 5 + 8+. . . . . . . . . . +(3𝑛 − 1) = 2
Proof:i) Let
𝑛(𝑛+1)
𝑝(𝑛) ≡ 1 + 2 + 3 + ⋯ … … . . + 𝑛 = 2 ...........(1)
L.H.S = 1 + 2 + 3 + ⋯ … … . . +𝑘 + (𝑘 + 1)
Therefore 𝑝(𝑘 + 1) is true. Hence P(n) is true for all natural/Positive integers numbers.
𝐼𝑛𝑑𝑢𝑐𝑡𝑖𝑜𝑛 𝑆𝑡𝑒𝑝:
Therefore 𝑝(𝑘 + 1) is true. Hence P(n) is true for all natural/Positive integers numbers.