open atlas
↑ Back to track
Logic, from zero LOGIC · 01 · 01

Statements and truth: what a proposition really is

A proposition is a statement that is definitely true or definitely false — never both, never neither. 'x > 3' isn't one until x gets a value, and every if-condition in your code becomes one the moment it runs. Truthiness bugs begin exactly where strict truth values end.

LOGIC Foundations ◷ 16 min
Level
FoundationsJuniorMiddleSenior

Think about everyday sentences. “It is raining” is the kind of thing you can simply call true or false by looking outside. “Shut the window!” is not — it is an order, not a claim, so calling it “false” makes no sense. “Is the bus late?” is a question, which asks for a true-or-false answer rather than giving one. Logic is built entirely on the first kind of sentence — the ones that must be either true or false — and so is every decision your code makes. A payments startup once shipped a one-line change: read the admin flag from a config file instead of the database. The file said isAdmin: "false" — a string. The check if (user.isAdmin) then passed for every single user, because a non-empty string is truthy in JavaScript. For six hours, anyone who opened the right URL saw the refunds dashboard. The bug was not a typo — it was a swap of propositions.

Goal

After this lesson you can say what a proposition is, explain why commands and questions are not propositions, describe what a free variable does to a sentence, substitute a value to close an open sentence, and identify the proposition an if-condition actually evaluates.

1

A proposition is a sentence with exactly one truth value. A proposition (also called a statement) is a declarative sentence that is either true or false — exactly one of the two, never both, never neither. “7 is an even number” is a proposition: it is false, and that is fine — a false statement is still a perfectly good proposition. “Close the door!” is not a proposition; a command can only be obeyed or ignored, not called true or false.

2

Questions and expressions of taste are also excluded. “Is the server up?” asks for a truth value rather than asserting one. “This pizza is delicious” is a matter of personal taste — classical logic refuses it. The two truth values are written T and F, or in code true and false. Logic does not care what a proposition is about — it only cares about that one bit attached to it.

3

A sentence with a free variable is not a proposition — it is an open sentence. Look at “x > 3”. True or false? You cannot say — it depends on what x is. A sentence containing a free variable (a placeholder with no value attached) is called an open sentence or predicate. Feed it a value and it closes: bind x = 7 and you get “7 > 3”, a true proposition; bind x = 1 and you get “1 > 3”, a false proposition.

4

Your if-condition is an open sentence that the runtime closes. Every if, while, and ternary you write is the runtime building and evaluating a proposition. You author the open sentence; execution binds the variables; the result must collapse to one bit: take the branch or do not. In coercing languages like JavaScript any value is squeezed into true or false by truthiness rules — which is why the string "false" passes an if as confidently as true does.

Worked example

Classify each sentence: proposition, open sentence, or neither?

  1. “The HTTP request returned status 200.”
  2. “Close the connection!”
  3. “count > limit” (where count and limit are unbound variables)
  4. “count > limit” (where count = 50000 and limit = 100)

Sentence 1 is a proposition — it asserts a fact that is either true or false in the world.

Sentence 2 is neither — it is a command; it can be obeyed or ignored but has no truth value.

Sentence 3 is an open sentence — both variables are free, so no truth value exists yet.

Sentence 4 is a proposition — binding count = 50000 and limit = 100 closes the sentence: “50000 > 100” is true.

The practical lesson: every if (count > limit) you write is sentence 3 at coding time. The runtime turns it into sentence 4 — and if limit was never assigned, JavaScript silently evaluates 50000 > undefined, which is false via NaN. A real proposition, just not the one you meant.

Why this works

Why does logic insist on exactly one truth value? Because everything downstream — truth tables, proofs, the equivalences in the next lessons — works by tracking how truth flows from small statements into big ones. If a sentence could be both true and false, you could “prove” anything. A boolean column that can be true, false, or NULL is a famous source of bugs for the same reason: the third state breaks every assumption written for two.

Practice 0 / 5

Is '7 is a prime number' a proposition? Type yes or no.

Is 'Turn off the lights!' a proposition? Type yes or no.

Is 'x + 1 > 5' (x unbound) a proposition? Type yes or no.

Bind x = 10 in 'x + 1 > 5'. Is it true or false?

In JavaScript, does if('false') execute its branch? Type yes or no.

Check yourself
Quiz

Which of the following is a proposition?

Recap

A proposition is a declarative sentence with exactly one truth value — true or false, never both, never neither. Commands, questions, and matters of taste fail the test; false statements pass it, because carrying a truth value, not being true, is the entry condition. A sentence with a free variable is an open sentence: not a proposition itself but a template that becomes one when every variable is bound — bind x = 7 to “x > 3” and you get the true proposition “7 > 3”. Every if-condition is an open sentence you write at coding time that the runtime closes at execution time. The danger zone is the gap between the proposition you meant and the one the machine builds: an unassigned variable still binds (to undefined, making 50000 > undefined come out false through NaN), and coercing languages evaluate truthiness rather than meaning, so the non-empty string “false” drives an if as confidently as true does. The discipline: convert untrusted string input into real booleans at the boundary, compare strictly, and always be able to say which proposition your condition actually evaluates.

Practice

Start at the top. Tasks go easiest → hardest: recall a fact, apply it to a case, then a senior-level stretch. Open one, attempt it, then reveal.

recallapplystretch0 of 5 done

Something unclear?

Ask a question about this lesson. Questions are anonymous and go straight to the author to make the lesson better.

Apply this

Put this lesson to work on a real build.

shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.