Skip to content
Tutorials Center
My learning

Topics

Lesson 63 of 86 ยท Deductive and Analytical Reasoning

Logical Connectives and Truth Statements

Understand if-then statements, converse and contrapositive, and/or/not, De Morgan's laws and truth-teller and liar puzzles, with a truth table script.

Logic problems are built from small words: if, then, and, or, not, only if, unless. People use them loosely in conversation, but reasoning tests use them with exact meanings. A question might say "If the train is late, Meera walks" and then ask what follows when Meera did not walk. A puzzle might tell you that one of three people always lies and ask who. Both depend on knowing precisely what each word does to a statement's truth.

In this lesson you will learn the connectives, the four relatives of an if-then statement (and which are equivalent), how to negate a statement correctly, and how to solve truth-teller and liar puzzles by checking every case. Two scripts do the checking for you: a truth table generator and a puzzle solver.

Statements and the three basic connectives

A statement is a sentence that is either true or false. "7 is prime" is a statement; "Close the door" is not. We write p and q for statements.

Connective Reads as True when
not p It is not the case that p p is false
p and q Both p and q both are true
p or q p, or q, or both at least one is true

Two warnings. In logic, "or" is inclusive: p or q is true even when both are true. Everyday speech and many exam questions sometimes use "either...or" to mean exactly one (exclusive or); when the wording says "either ... or but not both", use that meaning. Second, the word "but" means "and": "It is cheap but fragile" asserts both.

If-then statements

An if-then statement (also called an implication or conditional) has the form "if p, then q". Here p is the hypothesis and q is the conclusion. The statement makes a promise: whenever p happens, q happens too.

An if-then statement is false in exactly one case: p is true and q is false. In every other case, the promise was not broken, so the statement is true. That includes the surprising case where p is false: if the hypothesis never happens, the promise cannot be broken.

p q if p then q
True True True
True False False
False True True
False False True

This means "if p then q" has the same truth value as "not p, or q". Both fail only when p is true and q is false.

Several phrasings mean the same thing as "if p then q":

  • p implies q.
  • p only if q. (The condition q is required for p.)
  • q if p. (Note the swap: "q if p" is "if p then q".)
  • p is sufficient for q, and q is necessary for p.
  • Unless: "p unless q" means "if not q, then p".

The pairs that confuse most learners are if and only if. "You get a prize if you win" means winning is enough. "You get a prize only if you win" means winning is required but may not be enough. When both hold, the statement is if and only if, a two-way link.

The four relatives of if-then

From the statement "if p then q", you can form three others by swapping and negating.

flowchart TD
    O["Original<br/>if p then q"] --- C["Converse<br/>if q then p"]
    O --- I["Inverse<br/>if not p then not q"]
    O --- K["Contrapositive<br/>if not q then not p"]
    C --- I

The original and contrapositive always agree; the converse and inverse always agree with each other, but not necessarily with the original.

Take the example "If a number is divisible by 6, it is divisible by 3". This is true.

  • Converse: "If a number is divisible by 3, it is divisible by 6." False: 9 is a counterexample.
  • Inverse: "If a number is not divisible by 6, it is not divisible by 3." False: 9 again.
  • Contrapositive: "If a number is not divisible by 3, it is not divisible by 6." True, and this is always true when the original is true.

The central fact is that a statement and its contrapositive are logically equivalent. The converse is a different statement, and believing that it follows from the original is the most common logical error.

The script below prints the whole truth table for the four forms and then tests which pairs are equivalent. Read the columns before you read the verdicts at the bottom.

JS Truth table for if-then and its relatives

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The last two lines are De Morgan's laws, covered next.

Negating statements correctly

Exams love to ask "which statement is the negation of this one?" The rules below always work.

Statement Its negation
All X are Y Some X are not Y
Some X are Y No X is Y
No X is Y Some X are Y
p and q not p, or not q
p or q not p, and not q
If p then q p and not q

The "p and q" and "p or q" lines are De Morgan's laws: to negate a combination, negate each part and swap and with or. The last line says the way to deny a promise is to produce a case where p happened and q did not.

Example 1. What is the negation of "All the students passed the test"?

The negation is "At least one student did not pass". It is not "No student passed", which is much stronger than needed.

Example 2. What is the negation of "The shop is open and the card machine works"?

By De Morgan: "The shop is closed, or the card machine does not work" (or both).

Valid and invalid arguments

Using an if-then statement, you can draw two valid conclusions and two tempting but invalid ones. Suppose the rule is "If it rains, the match is cancelled".

flowchart TD
    R["Rule: if p then q"] --> A["It rained (p true)"]
    R --> B["Match not cancelled (q false)"]
    R --> C["Match cancelled (q true)"]
    R --> D["It did not rain (p false)"]
    A --> A1["Valid: q is true"]
    B --> B1["Valid: p is false"]
    C --> C1["Invalid: p may be true or false"]
    D --> D1["Invalid: q may be true or false"]

Affirming the hypothesis or denying the conclusion is valid; the other two moves are fallacies.

  • Valid: affirm p, conclude q. It rained, so the match was cancelled.
  • Valid: deny q, conclude not p. The match was not cancelled, so it did not rain. This is the contrapositive at work.
  • Invalid: affirm q, conclude p. The match was cancelled, but perhaps for another reason. The converse does not follow.
  • Invalid: deny p, conclude not q. It did not rain, but the match may still have been cancelled for other reasons.

Example 3. "If Anil studies, he passes. Anil did not pass." What can you conclude?

Using the contrapositive (if he did not pass, he did not study), Anil did not study.

Truth-teller and liar puzzles

In these puzzles each person is either a truth-teller (every statement is true) or a liar (every statement is false). Each person makes a claim, and you determine who is who.

The most reliable method is to try every assignment and keep the ones where each person's claim has the right truth value: a truth-teller's claim must be true, a liar's claim must be false. With two people there are four assignments, with three people there are eight.

Example 4. A says: "B is a liar." B says: "A and I are both truthful." Who is who?

Suppose B tells the truth. Then A and B are both truthful, so A's claim "B is a liar" would be true, a contradiction since B is truthful. So B lies. Then B's claim is false, which is fine. A's claim "B is a liar" is true, so A tells the truth.

Example 5. A says: "I am a liar." Is this possible?

If A tells the truth, then A is a liar, a contradiction. If A lies, the claim "I am a liar" would be true, also a contradiction. No assignment works: such a puzzle is a paradox and normally does not appear in a test with an answer.

Counting claims ("exactly one of us is lying") are the standard test of care. The solver below tries all assignments for each puzzle and prints every one that is consistent. If it prints nothing or two answers, the puzzle is broken or has more than one solution.

JS Truth-teller and liar solver

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Look at the third puzzle by hand. The three claims (exactly one liar, exactly two, all three) cannot be true together, so at most one of them is true and at least two people are liars. All three cannot be liars, because then C's claim would be true. So there are exactly two liars: B's claim is the true one, and A and C lie. That matches the solver.

Habits for logic questions

  1. Translate each sentence into p and q form, and write the if-then rule once.
  2. Use the contrapositive for "not" questions: to go from not q to not p.
  3. Do not trust the converse. If a conclusion needs "q so p", look for a counterexample.
  4. Negate carefully, using the table: all becomes some-not, and becomes or.
  5. For liar puzzles, test the cases and keep the consistent ones. Start with the claim that is easiest to test.

Words like "unless" and "only if" are the most frequent source of lost marks. When in doubt, rewrite the sentence as "if ..., then ..." and check the table on this page.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Rule: 'If it rains, the match is cancelled.' The match was not cancelled. Which conclusion is valid?

    The contrapositive of 'if rain then cancelled' is 'if not cancelled then no rain'. The match was not cancelled, so it did not rain.
  2. 2. Which is the contrapositive of 'If a number is divisible by 6, it is divisible by 3'?

    The contrapositive swaps the parts and negates both: if not q then not p. Here q is 'divisible by 3', so it becomes 'if not divisible by 3, then not divisible by 6'.
  3. 3. What is the negation of 'All the students passed the test'?

    To deny 'all', you need only one exception: at least one student did not pass. 'No student passed' is a much stronger statement than the negation.
  4. 4. A says: 'We are both liars.' (A and B are each truth-tellers or liars.) What can you conclude?

    If A told the truth, A would be a liar, a contradiction. So A lies, which means 'we are both liars' is false. Since A is a liar, B must be truthful.
  5. 5. The statement 'if p then q' is false in exactly which case?

    An if-then promise is broken only when the hypothesis happens and the conclusion does not.

Summary

  • "p or q" is true when at least one part is true; "if p then q" is false only when p is true and q is false.
  • "If p then q" is equivalent to its contrapositive "if not q then not p", and to "not p or q".
  • The converse and inverse are equivalent to each other, but not to the original statement.
  • To negate: "all" becomes "some are not", "and" becomes "or" and vice versa (De Morgan), and "if p then q" becomes "p and not q".
  • From "if p then q", valid moves are: p is true so q is true, and q is false so p is false. The other two moves are fallacies.
  • For truth-teller and liar puzzles, test every assignment and keep those where a truth-teller's claim is true and a liar's claim is false.

Next: Linear Seating Arrangements, where several clues must fit together in one row.