Computer science · 03 / 06

Logic: implication, converse and counterexamples

High school · intermediate · Worked example and 4 exercises with solutions, at your pace.

ONE SMALL STEP AT A TIME

Observe the model. Explain it in your words. Try unaided. Compare your reasoning.

See the visual explanation →

MEMORY SKETCH

The idea to sketch for reasoning

Central ideaLogic: implication, converse and counterexamples

A boolean proposition is true or false.

01Input possibilities
02Operator
03Row results
The idea to sketch for reasoninginput?

See the connection, then redraw it without the screen.

The principle, simply

A boolean proposition is true or false. AND needs both true; inclusive OR needs at least one; XOR exactly one. Implication A ⇒ B is false only when A is true and B false. Truth tables compare expressions systematically.

SEE · CONNECT · EXPLAIN

Make the idea visible

Follow the connections from left to right. Then hide the model and rebuild it in your words.

Connections to rebuild01Inputpossibilities02Operator03Row results04Compareexpressions

AND: both conditions must be true

Toggle A and B. A AND B is true only when both are true.

A = faux, B = faux → faux

Check understanding, not just recognition

Do OR and XOR always agree?

Before calculating or writing, identify which connection you would use and why. Then compare with the guided solution.

WORKED EXAMPLE

From principle to reasoning

For inputs 00, 01, 10, 11, AND is true only for 11; OR is false only for 00.

Solve a problem in this subject

  1. Specify the contract

    Define inputs, types, outputs and forbidden cases. State whether a search algorithm requires sorted data.

  2. Trace a small example

    Tabulate variables, tested conditions and actions using a small hand-checkable example.

  3. Test boundaries

    Consider empty inputs, one item, duplicates, missing values and numeric limits where relevant. Define the output or explain rejection.

  4. Justify

    Explain termination and correctness. Distinguish operation counts, measured time and memory use.

YOUR TURN

01 · Try before checking

Do OR and XOR always agree?

One hint

Inspect two true inputs.

Reveal and understand the solution

No: with A = B = 1, OR is 1 but XOR is 0. One counterexample disproves equivalence.

Compare method, conditions and answer; identify the exact part to revisit.

IMPROVE THROUGH PRACTICE

Three additional challenges with solutions

Start with the first challenge. Write your method before opening a hint; use the solution to find the first step that needs work.

Reflect after practising
02 · Recognise and understandLink to this exercise

For A true and B false, find A AND B and A OR B.

A hint to get started

AND needs both true; inclusive OR needs at least one.

Step-by-step solution
  1. A AND B is false.
  2. A OR B is true.
  3. Inclusive OR also remains true when both are true.

Which step did you miss? Retry without help, then explain why the method works.

03 · Apply the methodLink to this exercise

Compare NOT(A AND B) with NOT A OR NOT B.

A hint to get started

Test four combinations or use De Morgan.

Step-by-step solution
  1. The expressions are equivalent.
  2. When A and B are true, both are false.
  3. In the other three cases both are true.

Which step did you miss? Retry without help, then explain why the method works.

04 · Go furtherLink to this exercise

Is A ⇒ B equivalent to B ⇒ A? Give a counterexample.

A hint to get started

Try A false and B true.

Step-by-step solution
  1. With A false and B true, A ⇒ B is true in propositional logic.
  2. B ⇒ A is false.
  3. An implication is not equivalent to its converse.

Which step did you miss? Retry without help, then explain why the method works.

The trap to avoid

Inclusive OR differs from an exclusive either/or.

Questions to check your understanding

What is the difference between an implication and its converse?

“If P, then Q” does not claim “if Q, then P”. If an integer is divisible by 4, it is even. The converse is false: 6 is even but not divisible by 4. A matching example alone does not establish an equivalence.

How do you find a counterexample?

Identify the assumptions and find an object that satisfies them but contradicts the conclusion. For “every even integer is divisible by 4”, use 6. One counterexample disproves a universal claim; several successful examples do not prove it.

How do you negate “all” and “there exists”?

The negation of “every element has property P” is “there exists at least one element without P”. The negation of “there exists an element with P” is “no element has P”. Always specify the set under discussion.

Without notes, can you…

  • Explain the principle in your own words?
  • Rebuild the diagram and its connections?
  • Solve the exercise and justify the method?

Choosing a state saves it in this browser. This is your assessment, not a grade.