Recall…
Key observations about the table:
The diagram is called a Truth Table
p and q are variables , each of which take on one of two Boolean values, True or False (T/F, 1/0)
∨ is a binary operator that implements a function (creates output) from the 2 input variables to another Boolean value. It is characterized by its output values.
The operator ∨ corresponds to the English word or .
The expression p ∨ q is called a proposition .
Foreshadowing
How many rows for a proposition on 3 variables? \(k\) variables?
Give a good name for an operator that takes 1 variable: __________
Give a good name for an operator that takes 3 variables: __________
How many different binary operators could there be?
challenge: Of all binary operators, how many are commutative? (Half: 8.)
Truth Tables
All graded learning activities in the course use a tool called PrairieLearn .
Open Activity 1: Propositional Logic and work through it.
us.prairielearn.com/pl/course_instance/209866
First time any of them has opened PrairieLearn. Expect enrolment friction – walk the room. Full credit runs to Sunday, so nobody is penalised for a slow start.
Swimming
I swim Tuesday and Thursday and Saturday or Sunday.
How many times did I swim? (circle all possible values)
\[0 \qquad 1 \qquad 2 \qquad 3 \qquad 4 \qquad 5\]
Collect before advancing.
5 is the one worth an argument: it turns on whether days I never mentioned count. The sentence is silent about Monday.
Swimming Continued
Add parentheses so that I swam exactly this many times:
5: \(\text{Tue} \wedge \text{Thu} \wedge \text{Sat} \vee \text{Sun}\)
4: \(\text{Tue} \wedge \text{Thu} \wedge \text{Sat} \vee \text{Sun}\)
3: \(\text{Tue} \wedge \text{Thu} \wedge \text{Sat} \vee \text{Sun}\)
2: \(\text{Tue} \wedge \text{Thu} \wedge \text{Sat} \vee \text{Sun}\)
1: \(\text{Tue} \wedge \text{Thu} \wedge \text{Sat} \vee \text{Sun}\)
0: \(\text{Tue} \wedge \text{Thu} \wedge \text{Sat} \vee \text{Sun}\)
Same string six times. Annotate each line live.
Close on the pivot: in English the parentheses are optional, which is why the sentence had three readings. We are about to build a notation where they are compulsory – every AND and OR rule in the grammar emits its own pair, so there is nothing to leave out and nothing to guess.
WFFs
A well-formed formula is a Boolean statement generated by the following rules:
<wff> ::= <atom>
| ~ <wff>
| ( <wff> ∧ <wff> )
| ( <wff> ∨ <wff> )
<atom> ::= p | q | r | s | ...
This definition is in the form of a Grammar .
_____________: <wff> and <atom>
_____________: p, q, r, s …
It is our first self-referential or recursive definition.
WFFs
Rand rule apply rule on line —
Rand atom atom becomes —
<wff> ::= <atom>
| ~ <wff>
| ( <wff> ∧ <wff> )
| ( <wff> ∨ <wff> )
<atom> ::= p | q
Generate a WFF:
<wff>
WFFs (Notes)
<wff> ::= <atom>
| ~ <wff>
| ( <wff> ∧ <wff> )
| ( <wff> ∨ <wff> )
<atom> ::= p | q
Grammars can be used to construct many different kinds of sequences.
We could have included additional operators \(\rightarrow\) , \(\leftrightarrow\) , \(\oplus\) , \(\uparrow\)
Computational evaluation of <wff>is covered in DSCI221. For now, we trust Python and focus on logic.
The <wff> are propositions .
WFF Puzzle
Which of these are WFFs?
<wff> ::= <atom>
| ~ <wff>
| ( <wff> ∧ <wff> )
| ( <wff> ∨ <wff> )
<atom> ::= p | q
\((\neg p ∧ (q ∨ r))\)
\(((p ∧ q) ∨ (r ∧ \neg s))\)
\(((\neg p) ∨ (q ∨ r))\)
\((p ∨ (qr))\)
\(\neg (p ∨ (q ∧ \neg r))\)
\(\neg (p ∨ q))\)
Parse Trees
Apply the outermost relevant rule…
\(((\text{Tu} \wedge \text{Th}) \wedge (\text{Sa} \vee \text{Su}))\) \((\text{Tu} \wedge (\text{Th} \wedge (\text{Sa} \vee \text{Su})))\)
Work outward-in: the outermost parentheses are the last rule applied, so they are the root. Each internal node is a rule application, each leaf an atom.
The trees are different – and every row of the truth table agrees. That gap is the point. The parentheses fix the structure, the structure fixes how you evaluate, but two structures can evaluate the same everywhere. What the parentheses buy you is a definite answer, not a unique expression.
That is the opening for Monday: logical equivalence is exactly this relation – different formulas, same truth table. Do not name it yet; just let them notice that two different trees came out the same.
WFFs
<wff> ::= <atom>
| ~ <wff>
| ( <wff> ∧ <wff> )
| ( <wff> ∨ <wff> )
<atom> ::= p | q
Theorem: \(\neg (p ∨ q))\) is not a WFF.
Proof:
Words and Ideas
Truth Table
Proposition
Grammar
Well-formed formula
Recursive definition