Statements and Connectives
A proposition is a statement that's definitely true or definitely false. Words like "and," "or" and "not" glue simple statements into bigger ones, and since each piece can only be T or F, you can check every possibility in a truth table.
What the symbols mean
- Not p
True exactly when p is false.
- p and q
True only when both p and q are true.
- p or q
Inclusive or: true when at least one of them is true.
- Exclusive or
True when exactly one of them is true.
Explanation
A proposition is simply a sentence that's either true or false, and a connective is a word like "and," "or" or "not" that glues propositions into bigger ones. The name "connective" is literal: it connects statements, the way "and" connects two clauses in a sentence. All of this is the bedrock of every proof you'll write and every if-statement in code. Symbols like (not p), (p and q), (p or q) and (one or the other, but not both) look like a new alphabet, but they're just shorthand for those words. The only new idea is being completely precise about when the combined sentence is true. Bear with the notation for a page and it'll feel natural.
Logic starts with sentences you can grade. "7 is prime" and "Paris is in Spain" are propositions: the first is true, the second is false, and there's no in-between. "Close the door" isn't one, because you can't call an order true or false. "x > 3" isn't one either, at least until somebody tells you what x is.
We'll use letters such as and for propositions, and connectives to combine them, the same way and combine numbers. Here's the nice part: each letter has only two possible values, so you can list every case. That list is a truth table. Each new letter doubles the number of cases, so two letters need rows and letters need :
| T | T | T | T | F |
| T | F | F | T | T |
| F | T | F | T | T |
| F | F | F | F | F |
A common mistake. It's tempting to read the way you'd read "soup or salad" on a menu, where you get one but not both. In math it doesn't work that way: always means at least one, and it's true when both are true. That's the inclusive or. When you really do mean exactly one, you use the exclusive or, . Compare the last two columns of the table: they differ only in the top row.
Compound statements nest, too. To evaluate you work from the inside out, just like you would with in arithmetic.
See it
Worked examples
Let be "it is raining" and be "I have an umbrella." Write "it is raining and I don't have an umbrella" in symbols.
- 1
"I don't have an umbrella" is the negation of , so it's .
Build the truth table of .
- 1
List the four rows of and , then flip the column to get : F, T, F, T.
Practice
Type your answer and check it. Solve them all to complete the lesson.
How many rows does a truth table with 3 propositional variables have?
If is true and is false, what is the value of ?
If is false and is true, what is the value of ?
In how many of the four rows is true?
A smart-home rule turns the porch light on when motion is detected and it's dark, or when the alarm is armed: . For how many of the 8 combinations of , and is the light on?
A truth table with variables has rows. How many variables does a truth table with 1024 rows have?
The hardest one here. Get it, and you've got this lesson.
A two-input connective is any rule giving T or F for each of the four rows of . How many different two-input connectives are there? How many three-input ones? Enter both.
Where it's used
Search engines, database queries and the chips in every computer combine true/false conditions with exactly these connectives.