Discrete Mathematics · Unit 1 · Topic 01

Propositional logic: true, false, and what follows.

Short answer

Propositional logic studies sentences that are true or false, joined by the connectives \(\neg\) (not), \(\wedge\) (and), \(\vee\) (or), \(\to\) (if-then) and \(\leftrightarrow\) (if and only if). A truth table lists every case.

\(p \to q\) is false only when \(p\) is true and \(q\) is false, so \(p \to q \equiv \neg p \vee q \equiv \neg q \to \neg p\).

EngineeringComputer Science / ITBSc
01

Propositions and connectives

A proposition is a sentence that is either true or false, but not both. "7 is a prime number" is a proposition (true). "2 + 2 = 5" is a proposition (false). "\(x + 1 = 3\)" is not, because its truth depends on \(x\). A question or an order ("Shut the door") is not a proposition either.

We name simple propositions with letters \(p, q, r\) and join them with connectives to build compound ones. The truth value of the compound depends only on the truth values of its parts, so a small table settles everything.

The five connectives

\(\neg p\) (not \(p\)), \(p \wedge q\) (\(p\) and \(q\)), \(p \vee q\) (\(p\) or \(q\), or both), \(p \to q\) (if \(p\) then \(q\)), \(p \leftrightarrow q\) (\(p\) if and only if \(q\)).

\(p\)\(q\)\(\neg p\)\(p \wedge q\)\(p \vee q\)\(p \to q\)\(p \leftrightarrow q\)
TTFTTTT
TFFFTFF
FTTFTTF
FFTFFTT

Two columns surprise people. \(p \vee q\) is the inclusive or: it is true when both parts are true. And \(p \to q\) is false in only one row, when \(p\) is true and \(q\) is false. Think of it as a promise: "If you score 90, I will buy you a bike." The promise is broken only if you score 90 and get no bike. If you score less, the promise has not been broken, whatever happens, so \(p \to q\) counts as true.

02

Truth tables, tautologies and equivalence

A compound proposition with \(n\) variables has a truth table with \(2^n\) rows: 4 rows for two variables, 8 for three. Evaluate it column by column, from the inside out.

  • A tautology is true in every row, like \(p \vee \neg p\).
  • A contradiction is false in every row, like \(p \wedge \neg p\).
  • Anything else is a contingency.

Two propositions are logically equivalent, written \(A \equiv B\), when they have the same truth value in every row. Equivalently, \(A \leftrightarrow B\) is a tautology. These are the laws you will use most:

LawEquivalence
Double negation\(\neg(\neg p) \equiv p\)
De Morgan\(\neg(p \wedge q) \equiv \neg p \vee \neg q\)
De Morgan\(\neg(p \vee q) \equiv \neg p \wedge \neg q\)
Distributive\(p \wedge (q \vee r) \equiv (p \wedge q) \vee (p \wedge r)\)
Distributive\(p \vee (q \wedge r) \equiv (p \vee q) \wedge (p \vee r)\)
Absorption\(p \vee (p \wedge q) \equiv p\)
Implication\(p \to q \equiv \neg p \vee q\)
Contrapositive\(p \to q \equiv \neg q \to \neg p\)
Negating an implication\(\neg(p \to q) \equiv p \wedge \neg q\)
Biconditional\(p \leftrightarrow q \equiv (p \to q) \wedge (q \to p)\)
Converse, inverse, contrapositive

For the conditional \(p \to q\):

Converse: \(q \to p\). Inverse: \(\neg p \to \neg q\). Contrapositive: \(\neg q \to \neg p\).

The contrapositive is equivalent to the original. The converse and the inverse are equivalent to each other, but not to the original.

Normal forms

Every proposition can be rewritten in a standard shape. A disjunctive normal form (DNF) is an OR of AND-terms. A conjunctive normal form (CNF) is an AND of OR-clauses. You can read both straight off the truth table:

  1. DNF: for each row where the proposition is true, write an AND-term that is true only in that row (use \(p\) if \(p\) is T there, \(\neg p\) if it is F). Join the terms with \(\vee\).
  2. CNF: for each row where it is false, write an OR-clause that is false only in that row (use \(\neg p\) if \(p\) is T there, \(p\) if it is F). Join the clauses with \(\wedge\).

For \(p \to q\), the only false row is \(p = \)T, \(q = \)F, so the CNF is the single clause \(\neg p \vee q\), which is the implication law again.

03

Rules of inference and quantifiers

An argument is a list of premises and a conclusion. It is valid if the conclusion is true in every row where all the premises are true. In other words, (premise 1 \(\wedge\) premise 2 \(\wedge \cdots\)) \(\to\) conclusion is a tautology. The rules below are small valid arguments you can chain together instead of drawing a big table.

RuleFromConclude
Modus ponens\(p \to q,\ p\)\(q\)
Modus tollens\(p \to q,\ \neg q\)\(\neg p\)
Hypothetical syllogism\(p \to q,\ q \to r\)\(p \to r\)
Disjunctive syllogism\(p \vee q,\ \neg p\)\(q\)
Simplification\(p \wedge q\)\(p\)
Addition\(p\)\(p \vee q\)
Resolution\(p \vee q,\ \neg p \vee r\)\(q \vee r\)

Two look-alikes are not valid: from \(p \to q\) and \(q\) you cannot conclude \(p\) (affirming the consequent), and from \(p \to q\) and \(\neg p\) you cannot conclude \(\neg q\) (denying the antecedent). The row \(p = \)F, \(q = \)T breaks both.

Quantifiers

A sentence like "\(x\) is even" becomes a proposition once you say how many \(x\) it is about. \(\forall x\, P(x)\) means "\(P(x)\) is true for every \(x\) in the domain", and \(\exists x\, P(x)\) means "there is at least one \(x\) for which \(P(x)\) is true". Negation swaps the quantifier and pushes the \(\neg\) inside:

\[\neg\,\forall x\, P(x) \equiv \exists x\, \neg P(x), \qquad \neg\,\exists x\, P(x) \equiv \forall x\, \neg P(x)\]

So the negation of "every student passed" is "some student did not pass", not "every student failed".

04

Solved examples

Example 1: Spotting propositions

Easy

Which of these are propositions? (a) Mumbai is in Maharashtra. (b) \(x + 5 = 9\). (c) What time is it? (d) 15 is divisible by 4.

  1. (a) has a definite truth value: true. It is a proposition.
  2. (b) depends on \(x\), so it has no truth value yet. Not a proposition.
  3. (c) is a question. Not a proposition.
  4. (d) is false, since \(15 = 4 \times 3 + 3\). A false sentence is still a proposition.

Answer(a) and (d) are propositions; (a) is true and (d) is false.

Example 2: Building a truth table

Easy

Draw up the truth table of \((p \to q) \wedge (q \to p)\) and compare it with \(p \leftrightarrow q\).

  1. Take the rows in the order TT, TF, FT, FF for \((p, q)\).
  2. Column \(p \to q\): T, F, T, T. Column \(q \to p\): T, T, F, T.
  3. AND them row by row: T, F, F, T.
  4. The column for \(p \leftrightarrow q\) is also T, F, F, T.

AnswerThe columns match, so \((p \to q) \wedge (q \to p) \equiv p \leftrightarrow q\).

Example 3: Converse, inverse, contrapositive

Easy

Write the converse, inverse and contrapositive of "If it rains, then the match is cancelled."

  1. Here \(p\): it rains, \(q\): the match is cancelled.
  2. Converse \(q \to p\): If the match is cancelled, then it rains.
  3. Inverse \(\neg p \to \neg q\): If it does not rain, then the match is not cancelled.
  4. Contrapositive \(\neg q \to \neg p\): If the match is not cancelled, then it does not rain.

AnswerOnly the contrapositive says the same thing as the original statement.

Example 4: A tautology

Medium

Show that \(\big(p \wedge (p \to q)\big) \to q\) is a tautology.

  1. Rows TT, TF, FT, FF. Column \(p \to q\): T, F, T, T.
  2. Column \(p \wedge (p \to q)\): T, F, F, F.
  3. Final column, (that column) \(\to q\): \(\text{T} \to \text{T}\), \(\text{F} \to \text{F}\), \(\text{F} \to \text{T}\), \(\text{F} \to \text{F}\), which gives T, T, T, T.

AnswerEvery row is T, so it is a tautology. This is modus ponens written as one formula.

Example 5: Simplifying with the laws

Medium

Without a truth table, show that \(\neg\big(p \vee (\neg p \wedge q)\big) \equiv \neg p \wedge \neg q\).

  1. De Morgan on the outer bracket: \(\neg p \wedge \neg(\neg p \wedge q)\).
  2. De Morgan again, then double negation: \(\neg(\neg p \wedge q) \equiv p \vee \neg q\). So we have \(\neg p \wedge (p \vee \neg q)\).
  3. Distribute: \((\neg p \wedge p) \vee (\neg p \wedge \neg q)\).
  4. \(\neg p \wedge p\) is a contradiction F, and \(\text{F} \vee A \equiv A\).

Answer\(\neg\big(p \vee (\neg p \wedge q)\big) \equiv \neg p \wedge \neg q\)

Example 6: Brackets matter

Medium

Is \((p \to q) \to r\) equivalent to \(p \to (q \to r)\)?

  1. To show two formulas are not equivalent, one row where they differ is enough.
  2. Try \(p = \)F, \(q = \)T, \(r = \)F. Left: \(p \to q\) is T, and \(\text{T} \to \text{F}\) is F.
  3. Right: \(p\) is F, so \(p \to (\text{anything})\) is T.

AnswerNot equivalent: they differ at \(p = \)F, \(q = \)T, \(r = \)F (and also at \(p = \)F, \(q = \)F, \(r = \)F).

Example 7: DNF and CNF

Exam level

Find the DNF and CNF of \((p \vee q) \to r\), and simplify both.

  1. The formula is false only when \(p \vee q\) is T and \(r\) is F: rows \((p,q,r) = \)(T,T,F), (T,F,F), (F,T,F). The other 5 rows are true.
  2. DNF, one AND-term per true row: \[(p \wedge q \wedge r) \vee (p \wedge \neg q \wedge r) \vee (\neg p \wedge q \wedge r) \vee (\neg p \wedge \neg q \wedge r) \vee (\neg p \wedge \neg q \wedge \neg r)\]
  3. CNF, one OR-clause per false row: \[(\neg p \vee \neg q \vee r) \wedge (\neg p \vee q \vee r) \wedge (p \vee \neg q \vee r)\]
  4. Simplify using the implication law: \((p \vee q) \to r \equiv \neg(p \vee q) \vee r \equiv (\neg p \wedge \neg q) \vee r\). Distributing \(\vee r\) gives \((\neg p \vee r) \wedge (\neg q \vee r)\).

AnswerSimplified DNF: \((\neg p \wedge \neg q) \vee r\). Simplified CNF: \((\neg p \vee r) \wedge (\neg q \vee r)\).

Example 8: Checking an argument

Exam level

Test the argument: "If I study, I pass. If I pass, I get a job. I did not get a job. Therefore I did not study."

  1. Let \(p\): I study, \(q\): I pass, \(r\): I get a job. Premises: \(p \to q\), \(q \to r\), \(\neg r\). Conclusion: \(\neg p\).
  2. Hypothetical syllogism on the first two premises gives \(p \to r\).
  3. Modus tollens on \(p \to r\) and \(\neg r\) gives \(\neg p\).
  4. Check by table: the premises are all true only in the row \(p = q = r = \)F, and there \(\neg p\) is T.

AnswerThe argument is valid.

Vipul Sir's tip

To test an argument quickly, hunt for one bad row: all premises true and the conclusion false. If such a row exists, the argument is invalid and that row is your proof. If you can show no such row exists, it is valid. This is much faster than filling in all \(2^n\) rows.

05

Common mistakes

1. Thinking \(p \to q\) is false when \(p\) is false

Wrong: "If 2 + 2 = 5, then the Moon is cheese" is false. Right: its hypothesis is false, so the conditional is true. \(p \to q\) is false only when \(p\) is T and \(q\) is F.

2. Treating the converse as equivalent

"If \(n\) is divisible by 4, then \(n\) is even" is true. Its converse, "if \(n\) is even, then \(n\) is divisible by 4", is false: take \(n = 6\). Only the contrapositive can replace the original.

3. Negating without flipping the connective

Wrong: \(\neg(p \wedge q) \equiv \neg p \wedge \neg q\). At \(p = \)T, \(q = \)F the left side is T and the right side is F. Right: \(\neg(p \wedge q) \equiv \neg p \vee \neg q\). The \(\wedge\) becomes \(\vee\), and the other way round.

06

Practice questions

Try each one on paper before you open the answer.

Q1If \(p\) is true and \(q\) is false, find the truth values of \(p \to q\), \(\neg p \leftrightarrow q\) and \(\neg p \vee q\).

\(p \to q\) is F. \(\neg p\) is F, so \(\neg p \leftrightarrow q\) is \(\text{F} \leftrightarrow \text{F}\), which is T. \(\neg p \vee q\) is F (it matches \(p \to q\), as it should).

Q2Write the contrapositive of "If \(n\) is even, then \(n^2\) is even."

If \(n^2\) is not even, then \(n\) is not even. For integers: if \(n^2\) is odd, then \(n\) is odd.

Q3Is \((p \to q) \vee (q \to p)\) a tautology?

Yes. If \(q\) is T, then \(p \to q\) is T. If \(q\) is F, then \(q \to p\) is T. Either way the OR is T, so all four rows are T.

Q4Use the laws to show \(\neg(p \to q) \equiv p \wedge \neg q\).

\(\neg(p \to q) \equiv \neg(\neg p \vee q)\) by the implication law, \(\equiv \neg\neg p \wedge \neg q\) by De Morgan, \(\equiv p \wedge \neg q\) by double negation.

Q5Is this argument valid? "\(p \to q\). \(q\). Therefore \(p\)."

No. In the row \(p = \)F, \(q = \)T both premises are true and the conclusion is false. This mistake is called affirming the consequent.

Q6Negate: (a) \(\forall x \in \mathbb{Z},\ x^2 \ge 0\). (b) "Some prime number is even."

(a) \(\exists x \in \mathbb{Z}\) with \(x^2 < 0\). (b) "Every prime number is odd", that is, no prime is even. (The original (b) is true because of 2, so the negation is false.)

Stuck on a question?

Bring it to a free demo class and work through it with Vipul Sir. Book on WhatsApp.

07

Frequently asked questions

What is a tautology in propositional logic?

A compound proposition that is true for every assignment of truth values to its variables, such as \(p \vee \neg p\) or \(\big(p \wedge (p \to q)\big) \to q\). Its truth table column is all T.

What is the difference between converse, inverse and contrapositive?

For \(p \to q\): the converse is \(q \to p\), the inverse is \(\neg p \to \neg q\), and the contrapositive is \(\neg q \to \neg p\). Only the contrapositive is equivalent to the original statement.

Why is p implies q true when p is false?

Because a conditional only makes a claim about the cases where \(p\) is true. When \(p\) is false the claim has not been broken, and logic assigns it the value T. This also makes \(p \to q \equiv \neg p \vee q\) hold in every row.

What is the difference between DNF and CNF?

DNF is an OR of AND-terms, built from the rows where the formula is true. CNF is an AND of OR-clauses, built from the rows where it is false. Both describe the same truth table.

Related lessons

← All 10 Discrete Mathematics topics
Vipul Sir
Written by Vipul Sir

Vipul Sir has taught mathematics for over 15 years to HSC, CBSE, ICSE, IGCSE/IB, Diploma, Engineering and BSc students at VVS Classes in Goregaon and Vile Parle, Mumbai. He teaches every class himself, concepts first and exam technique second.

Discrete Mathematics

Get Discrete Mathematics right, with Vipul Sir beside you.

Concept-first classes in small batches in Goregaon and Vile Parle, or online. Your first class is free.

WhatsApp↗