Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 37 · Getting Started

Statements, Truth Values and Notation

Learn what counts as a logical statement, how truth values work, and the notation (∧ ∨ ¬ → ↔ ∀ ∃) used throughout logic, with runnable Python examples.

Every logical system starts with statements: sentences that are either true or false, never both and never neither. Getting comfortable with what is and is not a statement, and with the symbols used to combine statements, is the first real skill in this course.

What is a statement?

A statement (or proposition) is a declarative sentence with a definite truth value.

Sentence Statement? Why
7 is prime Yes, true Declarative, checkable
2 + 2 = 5 Yes, false False statements are still statements
Close the door No A command has no truth value
Is it Tuesday? No A question has no truth value
x > 3 No (yet) Depends on x; this is a predicate (chapter 3)
This sentence is false No Paradoxical: no consistent truth value

The key point: a statement does not need to be known to be true or false. "There are infinitely many twin primes" is a perfectly good statement even though nobody knows its truth value. What matters is that it has exactly one.

Logic with exactly two truth values is called classical or bivalent logic. Other systems (three-valued, fuzzy, intuitionistic) exist, but this course uses classical logic unless it says otherwise.

Atomic and compound statements

An atomic statement has no logical parts: "the server is up". A compound statement is built from atomic ones using connectives. We name atomic statements with letters called propositional variables: p, q, r, and so on.

Connective Symbol Read as Python
negation ¬p not p not p
conjunction p ∧ q p and q p and q
disjunction p ∨ q p or q (inclusive) p or q
implication p → q if p then q (not p) or q
biconditional p ↔ q p if and only if q p == q
exclusive or p ⊕ q p or q but not both p != q

Python has no built-in implication operator, so we define one. Remember that p → q is false in exactly one situation: p true and q false.

Python Evaluating compound statements

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

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Reading precedence

Just as 2 + 3 * 4 means 2 + (3 * 4), logical formulas have a precedence order. From tightest to loosest binding:

  1. ¬
  2. ∧
  3. ∨
  4. →
  5. ↔

So ¬p ∨ q ∧ r means (¬p) ∨ (q ∧ r). When in doubt, add parentheses; readers and proof checkers both appreciate them. Also note that → associates to the right by convention: p → q → r means p → (q → r).

Formulas as trees

Formulas have a syntax tree. The formula (p ∧ q) → ¬r has → at the root, with the subtree p ∧ q on the left and ¬r on the right. Evaluating a formula means evaluating the tree bottom-up. This is exactly how an interpreter evaluates an expression, and we will build one in the next lessons.

flowchart TD
    A["→"] --> B["∧"]
    A --> C["¬"]
    B --> D["p"]
    B --> E["q"]
    C --> F["r"]

Syntax tree of (p ∧ q) → ¬r.

We can model such trees in Python with nested tuples and evaluate them recursively.

Python A tiny formula evaluator

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

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Quantifier symbols, previewed

Two more symbols will appear from chapter 3 onward. ∀x means "for every x" and ∃x means "there exists an x". They let us talk about many objects at once: ∀x (x is even → x² is even). For now, just recognize them.

Truth values versus truth conditions

The truth value of a compound statement is determined entirely by the truth values of its parts. That property is called truth-functionality. It explains why the table for ∧ has just four rows and why the connectives are such tidy building blocks. It also explains something surprising: p → q says nothing about causation. "If 2 + 2 = 5 then the moon is cheese" is a true implication, because its hypothesis is false. We examine this in connectives and truth tables.

Tautology, contradiction, contingency

Three labels appear constantly:

  • A tautology is true under every assignment (p ∨ ¬p).
  • A contradiction is false under every assignment (p ∧ ¬p).
  • A contingency is neither (p ∧ q).

These names classify formulas by their truth tables; the course returns to them in the tautologies and equivalences lesson.

Common mistakes

  • Treating "or" as exclusive. In logic p ∨ q is true when both are true.
  • Reading p → q as "p causes q". It is a claim about truth values only.
  • Forgetting that a false statement is still a statement.
  • Writing p → q → r without parentheses and assuming left-to-right grouping.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Which of these is a statement in the logical sense?

    It is declarative and has a definite truth value. The last item depends on x, so it is a predicate, not yet a statement.
  2. 2. When is p → q false?

    An implication fails only when its hypothesis holds and its conclusion does not.
  3. 3. How does the inclusive 'or' behave when both parts are true?

    Inclusive disjunction is false only when both disjuncts are false.
  4. 4. How is ¬p ∨ q ∧ r grouped under standard precedence?

    Negation binds tightest, then conjunction, then disjunction.

Summary

  • A statement is a declarative sentence with exactly one truth value, known or not.
  • Connectives ¬, ∧, ∨, →, ↔ build compound statements whose truth depends only on their parts.
  • Implication is false only when the hypothesis is true and the conclusion is false.
  • Formulas form syntax trees that can be evaluated recursively, exactly as a program does.
  • Tautology, contradiction and contingency classify formulas by their truth tables.

Next: A Python Toolkit for Logic