A statement’s truth value is not an opinion. It is a property of the statement under a given interpretation.
“The integer 4 is prime” is False. Not “probably false” or “false for most people.” False. No exceptions.
“This HTTP endpoint is idempotent” — this can be True or False depending on the implementation. But for any specific, fully-specified implementation, one answer is correct.
In classical logic (which is the foundation of programming), truth values are bivalent: exactly two values, True and False, with no middle ground. This is the Law of Excluded Middle: for any statement P, either P is True or P is False. There is no third option.
This sounds obvious until you encounter three-valued logic in
databases. SQL uses NULL as a third truth value.
NULL = NULL does not return True in SQL — it returns
NULL. This is a deliberate deviation from classical logic.
It causes significant confusion. Chapter 5 returns to this.
An atomic statement cannot be broken into smaller statements. “The cache is warm” is atomic. You cannot decompose it further while preserving logical structure.
A compound statement is built from atomic statements using logical operators. “The cache is warm AND the database is reachable” is compound. It is the conjunction of two atomic statements. Logical operators are Chapter 2’s subject.
For now: every compound statement bottoms out at atomic statements. Atomic statements are the leaves of the logical expression tree.
Every boolean value in every programming language is the evaluation
of a statement. When Python evaluates 5 > 3, it
evaluates the statement “5 is greater than 3” and returns
True.
# These are statements — each evaluates to True or False
is_connected = server_status == "running" # statement: server_status equals "running"
has_capacity = queue_depth < MAX_QUEUE # statement: queue_depth is less than MAX_QUEUE
is_valid_request = content_length > 0 # statement: content_length is positive
# This is a conditional — it branches on the truth value of a statement
if is_connected and has_capacity:
process_request()The variable is_connected holds the truth value of a
statement. It is not the statement itself — it is the result of
evaluating the statement at a specific moment. This distinction matters
when the underlying facts change. The statement “the server is running”
might be True at 14:00:00 and False at 14:00:01. The variable
is_connected does not update automatically. It holds a
snapshot.
This is the first hint of a deeper problem: state. A statement evaluated over a mutable system produces a truth value that can become stale. This will reappear as a major theme in Chapter 5 (quantifiers over mutable sets) and throughout Book 3 (distributed systems).
def can_process(request_size: int, queue_depth: int, max_queue: int) -> bool:
# Statement: the queue has room for this request
queue_has_room = queue_depth < max_queue
# Statement: the request is within the size limit
request_is_valid = request_size > 0 and request_size <= MAX_REQUEST_SIZE
# Compound statement: both conditions hold
return queue_has_room and request_is_validEvery boolean expression in this function is evaluated as a statement. The function itself is a statement-valued function: given inputs, it returns a truth value. In mathematics, this is a predicate. In programming, it is a boolean function. Same concept, different notation.