Read a two-state predicate
Leans on
Quick review (2 minutes)
A librarian looks at the four slots on a returns cart.
This paper model uses one or more labeled slots, each with a known state. For each slot, record the Boolean answer to “Is this slot free?” Use true for free and false for occupied.
Use the states from one moment and keep them fixed while you work. The rule here covers a fixed set of slots with no missing states. For the whole set, give true if one or more slots are free. Give false if zero slots are free.
Write the total number of slots and the number occupied.
Subtract the occupied count from the total. Give true if the free count is one or more. Give false if it is zero.
To check, draw one box per slot and start with every box unmarked. Visit the slots once in label order. Mark each occupied box and leave each free box unmarked. Stop after the last label. Count the unmarked boxes and use that count to answer the question again.
On the returns cart, the count 1 answers “How many slots are free?” That one free slot makes the answer to “Is at least one slot free?” true. Keep the free count and the predicate result on separate lines.
1 In plain words
A librarian looks at the four slots on a returns cart. Each slot is a place for a book. Three slots hold books, so they are occupied. The fourth is empty, so it is free.
The slot information is the input. In this lesson, a predicate is a question that gives true or false for the stated input. For this cart, ask “Is at least one slot free?” At least one means one or more. There is one free slot, so the answer is true.
Python’s two Boolean values are True and False. On paper, write them as true and false. Remember to read the question before choosing the answer.
2 Picture it
The four cart slots are labeled A through D. A, B and C hold books. D is empty and labeled Free. An arrow points to the question Is any slot free? and the result true.
3 Why
Every slot in the drawing is either occupied or free. Subtracting the number of occupied slots from the total gives the number of free slots. A single free slot is enough to answer true.
A program gives a computer instructions to follow. The steps below give you instructions to follow on paper.
4 The rule
This paper model uses one or more labeled slots, each with a known state.
For each slot, record the Boolean answer to “Is this slot free?” Use true for free and false for occupied.
Use the states from one moment and keep them fixed while you work. The rule here covers a fixed set of slots with no missing states. For the whole set, give true if one or more slots are free. Give false if zero slots are free.
5 How
- Write the total number of slots and the number occupied.
- Subtract the occupied count from the total. Give true if the free count is one or more. Give false if it is zero.
- To check, draw one box per slot and start with every box unmarked. Visit the slots once in label order. Mark each occupied box and leave each free box unmarked. Stop after the last label. Count the unmarked boxes and use that count to answer the question again.
6 Trace
| Slot or question | Free? | Explanation |
|---|---|---|
| A | false | A holds books. |
| B | false | B holds books. |
| C | false | C holds books. |
| D | true | D is empty. |
| At least one free? | true | Subtract 3 from 4 to get one free slot. Marking the occupied boxes independently leaves only D unmarked. |
7 The trap
On the returns cart, the count 1 answers “How many slots are free?” That one free slot makes the answer to “Is at least one slot free?” true. Keep the free count and the predicate result on separate lines.
Quick checks
Quick check 1 of 2
On another returns cart, A and C are occupied and B and D are free. Write the free count. Then answer ‘Is at least one slot free?’
Show the steps and the answer
2 free slots. The predicate result is true.
Why: Four slots minus two occupied slots leaves two free slots. You can point to B and D. Two is at least one, so the result is true.
Source: Python Software Foundation, Built-in Types (Python 3.13 documentation)
Quick check 2 of 2
A parcel rack holds packages. It has six known slots, and all six are occupied. Is at least one slot free?
Show the steps and the answer
false
Why: Six slots minus six occupied slots leaves zero free slots. Every box gets a mark, so there is no free slot to point to.
Source: Python Software Foundation, Built-in Types (Python 3.13 documentation)
Sources
- Built-in Types (Python 3.13 documentation). Python Software Foundation. Python Software Foundation License Version 2. Read 26 Nov 2026.
- Programming Languages (Computer Science Field Guide). University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0 International. Read 26 Nov 2026.