Monday: the language of propositional logic, translation between English and formulas, recursive definitions and structural induction. Wednesday: valuations, the truth value of a formula, truth tables, tautologies.
By the end of this week you will be able to:
Today we define the formulas of propositional logic, practice translating between English and formulas, and use the recursive structure of formulas to define functions and to prove facts about all formulas.
In arithmetic, \(2+2=4\) and \(3\cdot5>20\) are well-formed expressions: the first is true, the second is false, but both are allowed. The string \(2+\div3=5\) is not allowed at all; it is not true and not false, it just does not parse. Before we can ask whether a statement of logic is true, we need the same kind of precision: an exact rule that says which strings of symbols count as formulas.
Propositional logic studies the words not, and, or and if ... then used between whole statements. The simplest statements are left unanalyzed: we only give them names.
We fix a countable set \(\mathrm{PROP}\) of primitive propositions (also called atomic propositions). We use the letters \(p,q,r,s\), possibly with subscripts, for them.
The connectives are four symbols:
| symbol | name | read as | kind |
|---|---|---|---|
| \(\neg\) | negation | not | unary |
| \(\wedge\) | conjunction | and | binary |
| \(\vee\) | disjunction | or | binary |
| \(\to\) | implication | if ... then | binary |
A unary connective acts on one formula, a binary connective joins two formulas.
The formulas of propositional logic are defined by the following clauses.
We write \(\mathcal L(\neg,\wedge,\vee,\to)\) for the set of all formulas. The same definition is often written in one line:
\[\varphi\ ::=\ p\ \mid\ \neg\varphi\ \mid\ (\varphi\wedge\varphi)\ \mid\ (\varphi\vee\varphi)\ \mid\ (\varphi\to\varphi)\qquad (p\in\mathrm{PROP}).\]Read it from left to right: a formula is either a primitive proposition, or the negation of a formula, or the conjunction of two formulas, or the disjunction of two formulas, or an implication from one formula to another.
The letters \(\varphi,\psi,\chi\) are not symbols of the language. They are variables that we use to talk about formulas: "\(\neg\varphi\) is a formula" means that for every formula, putting \(\neg\) in front of it gives a formula. The language we study is the object language; the English and mathematics we use to talk about it is the metalanguage. The same distinction appeared in Week 5, where \(\overline\varphi\) was our name for a sentence and not a symbol of \(\mathcal S^{\dagger}\).
We show that \(((p\wedge q)\to r)\vee\neg q\) is a formula by building it with the clauses of Definition 7.2.
The last formula is written with one pair of parentheses fewer at the outside; Convention 7.5 below allows this. Figure 1 shows the same construction as a tree, read from the bottom up.
Every formula has exactly one construction from primitive propositions. (This fact is called unique readability. We use it without proof; the parentheses in clause 3 are what make it true.) The construction drawn as a tree, with the formula at the root, is the parse tree of the formula.
The connective introduced in the last step of the construction is the main connective. The formulas it was applied to are the immediate subformulas.
For instance, the main connective of the formula of Figure 1 is \(\vee\), and its immediate subformulas are \((p\wedge q)\to r\) and \(\neg q\).
Officially every binary connective comes with a pair of parentheses. To make formulas easier to read we allow exactly two simplifications.
No other parentheses may be dropped. In particular \(p\wedge q\to r\) is not a formula: it could mean \((p\wedge q)\to r\) or \(p\wedge(q\to r)\), and these are different formulas (Figure 2). Also \(p\wedge q\wedge r\) is not a formula; write \((p\wedge q)\wedge r\) or \(p\wedge(q\wedge r)\).
We use Definition 7.2 together with Convention 7.5.
A practical test for the main connective: it is the one connective that is not inside any pair of parentheses. If there is none outside all parentheses and the formula starts with \(\neg\), the main connective is that \(\neg\).
Self-check only. Nothing here counts towards your grade.
For each string decide whether it is a formula (with Convention 7.5). If it is, choose its main connective.
Propositional logic does not look inside simple statements. "It is raining" and "I take my umbrella" are treated as units, and only the way they are joined matters. To translate, we first decide which simple statements we need and give them names.
A dictionary assigns to some primitive propositions a simple English statement. A translation of an English sentence is a formula built from these primitive propositions whose structure matches the logical structure of the sentence.
Each entry of a dictionary should be a complete, positive statement without "not", "and", "or" or "if". The negative and compound sentences are then built with the connectives. For instance:
| letter | statement |
|---|---|
| \(r\) | It is raining. |
| \(c\) | It is cold. |
| \(u\) | I take my umbrella. |
| \(w\) | I walk to campus. |
We use this dictionary until the end of Section 2.
English has more ways to say "if" than the four connectives suggest. One more connective is useful for translation. It is not a new symbol of the language; it is a shorthand.
We write \(\varphi\leftrightarrow\psi\) as an abbreviation for \((\varphi\to\psi)\wedge(\psi\to\varphi)\), and read it "\(\varphi\) if and only if \(\psi\)". For instance \(w\leftrightarrow\neg r\) is short for \((w\to\neg r)\wedge(\neg r\to w)\).
The table lists the most common English patterns. Here \(A\) and \(B\) stand for the translations of the parts.
| English | formula |
|---|---|
| not \(A\); it is not the case that \(A\) | \(\neg A\) |
| \(A\) and \(B\); \(A\) but \(B\); \(A\) although \(B\); both \(A\) and \(B\) | \(A\wedge B\) |
| \(A\) or \(B\); either \(A\) or \(B\) | \(A\vee B\) |
| if \(A\) then \(B\); \(B\) if \(A\); \(A\) only if \(B\); \(B\) provided that \(A\) | \(A\to B\) |
| \(A\) is sufficient for \(B\); \(B\) is necessary for \(A\) | \(A\to B\) |
| \(A\) unless \(B\) | \(\neg B\to A\) |
| neither \(A\) nor \(B\) | \(\neg A\wedge\neg B\) |
| not both \(A\) and \(B\) | \(\neg(A\wedge B)\) |
| \(A\) if and only if \(B\) | \(A\leftrightarrow B\) |
| either \(A\) or \(B\), but not both | \((A\vee B)\wedge\neg(A\wedge B)\) |
Dictionary of Definition 7.7.
Words like "but", "although" and "yet" express contrast or surprise. A translation keeps only the "and"; the contrast is lost, and this is intended.
Fix a natural number \(n\) and use the dictionary \(e\): \(n\) is even, \(f\): \(n\) is divisible by \(4\), \(t\): \(n\) is prime.
It is raining and it is cold or I take my umbrella.
The English sentence does not say how to group its parts, and there are two candidates:
Spoken English uses pauses and word order to separate the two readings ("either it is raining and cold, or ..."; "it is raining, and either ..."). A formula has to choose one, and the parentheses record the choice. When a sentence is ambiguous, say which reading you translate.
Same dictionary. For the way back, read the main connective first, then fill in the parts.
Self-check only. Nothing here counts towards your grade.
Dictionary: \(a\): Alice comes to the party. \(b\): Bob comes to the party. \(m\): There is music. \(d\): We dance.
Type a formula for each sentence. You can use the buttons, or type ~ for \(\neg\),
& for \(\wedge\), | for \(\vee\), -> for \(\to\) and
<-> for \(\leftrightarrow\). Follow Convention 7.5: put parentheses around every part
that has a binary connective. Any correct translation is accepted, not only one stored answer.
Formulas are built from primitive propositions by the connectives, in finitely many steps. So to define a function on all formulas it is enough to say what it does on primitive propositions, and how its value on a compound formula is obtained from its values on the immediate subformulas. Below, \(\bullet\) stands for any binary connective \(\wedge\), \(\vee\) or \(\to\).
\(\mathit{length}(\varphi)\) counts the symbols of \(\varphi\), ignoring parentheses. \(\mathit{conn}(\varphi)\) counts the occurrences of connectives. \(\mathit{rank}(\varphi)\) is the depth of the parse tree: the number of levels below the root.
The elements of \(\mathit{sub}(\varphi)\) are the subformulas of \(\varphi\): the formulas at the nodes of its parse tree. \(\mathit{occ}(\varphi)\) is the set of primitive propositions that occur in \(\varphi\). Both are sets, so a formula that appears twice in the tree is counted once.
Let \(\varphi=(p\wedge\neg q)\to(q\vee p)\).
Length. Each line applies one clause of Definition 7.14 to the outermost connective that is still unevaluated:
Check by counting: the symbols are \(p,\wedge,\neg,q,\to,q,\vee,p\).
Connectives. In the same way \(\mathit{conn}(\varphi)=4\): the connectives are \(\wedge\), \(\neg\), \(\to\), \(\vee\).
Rank. \(\mathit{rank}(\neg q)=1\), so \(\mathit{rank}(p\wedge\neg q)=\max\{0,1\}+1=2\). \(\mathit{rank}(q\vee p)=\max\{0,0\}+1=1\). Hence \(\mathit{rank}(\varphi)=\max\{2,1\}+1=3\).
Subformulas. \(\mathit{sub}(\varphi)=\{p,\ q,\ \neg q,\ p\wedge\neg q,\ q\vee p,\ \varphi\}\), six formulas. The parse tree has eight nodes, but \(p\) and \(q\) each occur twice.
Occurring primitive propositions. \(\mathit{occ}(\varphi)=\{p,q\}\).
Let \(P(\varphi)\) be a statement about formulas. Suppose that
Then \(P(\varphi)\) holds for every formula \(\varphi\).
Suppose some formula fails \(P\), and take one with the smallest possible number of construction steps. It is not a primitive proposition, by the base case. So its last construction step applied a connective to one or two formulas with fewer steps, and those satisfy \(P\) by the choice of a smallest counterexample. The matching inductive step then gives \(P\) for our formula, a contradiction. □
This has the same shape as induction on proof trees in Week 3: the primitive propositions play the role of the leaves, and the connectives play the role of the rules. There are four inductive steps, one for each connective. When the steps for \(\wedge,\vee,\to\) are identical, we do them once for \(\bullet\).
For every formula \(\varphi\), \(\mathit{length}(\varphi)>\mathit{conn}(\varphi)\).
Structural induction on \(\varphi\).
Base case: \(\mathit{length}(p)=1>0=\mathit{conn}(p)\).
Step for \(\neg\): assume \(\mathit{length}(\varphi)>\mathit{conn}(\varphi)\). Then \(\mathit{length}(\neg\varphi)=\mathit{length}(\varphi)+1>\mathit{conn}(\varphi)+1=\mathit{conn}(\neg\varphi)\).
Step for \(\bullet\): assume the claim for \(\varphi\) and for \(\psi\). Then \[\begin{aligned}\mathit{length}(\varphi\bullet\psi)&=\mathit{length}(\varphi)+\mathit{length}(\psi)+1\\ &>\mathit{conn}(\varphi)+\mathit{conn}(\psi)+1=\mathit{conn}(\varphi\bullet\psi).\end{aligned}\] □
For every formula \(\varphi\), \(\mathit{rank}(\varphi)\le\mathit{conn}(\varphi)\).
Structural induction on \(\varphi\).
Base case: \(\mathit{rank}(p)=0\le0=\mathit{conn}(p)\).
Step for \(\neg\): if \(\mathit{rank}(\varphi)\le\mathit{conn}(\varphi)\), then \(\mathit{rank}(\neg\varphi)=\mathit{rank}(\varphi)+1\le\mathit{conn}(\varphi)+1=\mathit{conn}(\neg\varphi)\).
Step for \(\bullet\): assume \(\mathit{rank}(\varphi)\le\mathit{conn}(\varphi)\) and \(\mathit{rank}(\psi)\le\mathit{conn}(\psi)\). The maximum of two numbers is at most their sum when both are \(\ge0\), so \[\begin{aligned}\mathit{rank}(\varphi\bullet\psi)&=\max\{\mathit{rank}(\varphi),\mathit{rank}(\psi)\}+1\\ &\le\max\{\mathit{conn}(\varphi),\mathit{conn}(\psi)\}+1\\ &\le\mathit{conn}(\varphi)+\mathit{conn}(\psi)+1=\mathit{conn}(\varphi\bullet\psi).\end{aligned}\] □
Claim: every formula has at least as many connectives as distinct primitive propositions, \(\mathit{conn}(\varphi)\ge|\mathit{occ}(\varphi)|\).
This is false, and one formula is enough to show it: for \(\varphi=p\) we have \(\mathit{conn}(p)=0\) and \(|\mathit{occ}(p)|=1\). An induction proof would fail already at the base case.
Corrected claim: \(\mathit{conn}(\varphi)\ge|\mathit{occ}(\varphi)|-1\) for every \(\varphi\).
Base case: \(0\ge1-1\).
Step for \(\neg\): \(\mathit{conn}(\neg\varphi)=\mathit{conn}(\varphi)+1>\mathit{conn}(\varphi) \ge|\mathit{occ}(\varphi)|-1=|\mathit{occ}(\neg\varphi)|-1\).
Step for \(\bullet\): for two finite sets, \(|X\cup Y|\le|X|+|Y|\). So \[\begin{aligned}\mathit{conn}(\varphi\bullet\psi)&=\mathit{conn}(\varphi)+\mathit{conn}(\psi)+1\\ &\ge\big(|\mathit{occ}(\varphi)|-1\big)+\big(|\mathit{occ}(\psi)|-1\big)+1\\ &\ge|\mathit{occ}(\varphi)\cup\mathit{occ}(\psi)|-1=|\mathit{occ}(\varphi\bullet\psi)|-1.\end{aligned}\] □
To refute a statement about all formulas, give one formula for which it fails. To prove it, give an induction.
Self-check only. Nothing here counts towards your grade.
Fill in the table for \(\varphi_1=\neg(p\to q)\vee(\neg p\wedge(q\to r))\) and \(\varphi_2=\neg\neg(p\wedge q)\to(r\vee\neg r)\).
\(\varphi_1\): length \(11\), conn \(6\), rank \(3\), and \(9\) subformulas: \(p,\ q,\ r,\ p\to q,\ \neg(p\to q),\ \neg p,\ q\to r,\ \neg p\wedge(q\to r),\ \varphi_1\). The rank is \(3\) because both immediate subformulas have rank \(2\).
\(\varphi_2\): length \(10\), conn \(6\), rank \(4\), and \(9\) subformulas: \(p,\ q,\ p\wedge q,\ \neg(p\wedge q),\ \neg\neg(p\wedge q),\ r,\ \neg r,\ r\vee\neg r,\ \varphi_2\). The deepest branch is \(\varphi_2,\ \neg\neg(p\wedge q),\ \neg(p\wedge q),\ p\wedge q,\ p\).
Today we give formulas a meaning: a valuation assigns a truth value to every primitive proposition, and recursion extends it to all formulas. We compute truth values by hand, build truth tables, and sort formulas into tautologies, contradictions and the rest.
So far \(\wedge\) is only a symbol. Nothing connects it with the meaning of "and". We now make the connection through truth: we say when a formula is true. A primitive proposition has no structure that could decide this, so its truth value is simply given. Everything else is computed.
We write \(\mathrm T\) for true and \(\mathrm F\) for false. A valuation is a function \(v:\mathrm{PROP}\to\{\mathrm T,\mathrm F\}\). It gives a truth value to every primitive proposition, in any combination.
For instance, \(v(p)=\mathrm T\), \(v(q)=\mathrm F\), and \(v(s)=\mathrm T\) for all other primitive propositions \(s\), defines a valuation.
Given a valuation \(v\), the truth value \([\![\varphi]\!]_v\in\{\mathrm T,\mathrm F\}\) of a formula \(\varphi\) is defined by recursion on \(\varphi\):
\[\begin{aligned} [\![p]\!]_v&=\mathrm T &&\text{iff}\quad v(p)=\mathrm T\\ [\![\neg\varphi]\!]_v&=\mathrm T &&\text{iff}\quad [\![\varphi]\!]_v=\mathrm F\\ [\![\varphi\wedge\psi]\!]_v&=\mathrm T &&\text{iff}\quad [\![\varphi]\!]_v=\mathrm T\ \text{and}\ [\![\psi]\!]_v=\mathrm T\\ [\![\varphi\vee\psi]\!]_v&=\mathrm T &&\text{iff}\quad [\![\varphi]\!]_v=\mathrm T\ \text{or}\ [\![\psi]\!]_v=\mathrm T\\ [\![\varphi\to\psi]\!]_v&=\mathrm T &&\text{iff}\quad [\![\varphi]\!]_v=\mathrm F\ \text{or}\ [\![\psi]\!]_v=\mathrm T \end{aligned}\]In each line, if the condition on the right fails, the value on the left is \(\mathrm F\). The "or" on the right is inclusive. We read \([\![\varphi]\!]_v\) as "the truth value of \(\varphi\) under \(v\)".
The truth value of a compound formula depends only on the truth values of its immediate subformulas. This is what makes the connectives truth-functional. The dependence is summarized in the truth tables of the connectives. The column for \(\leftrightarrow\) is computed from the abbreviation: both implications are true exactly when \(\varphi\) and \(\psi\) have the same value.
| \(\varphi\) | \(\psi\) | \(\neg\varphi\) | \(\varphi\wedge\psi\) | \(\varphi\vee\psi\) | \(\varphi\to\psi\) | \(\varphi\leftrightarrow\psi\) |
|---|---|---|---|---|---|---|
| T | T | F | T | T | T | T |
| T | F | F | F | T | F | F |
| F | T | T | F | T | T | F |
| F | F | T | F | F | T | T |
\(\varphi\to\psi\) is false only when \(\varphi\) is true and \(\psi\) is false. Think of If a number is prime and greater than 2, then it is odd. The number \(14\) is not a counterexample: it is not prime, so the claim says nothing about it. A counterexample would have to make the antecedent true and the consequent false. So an implication with a false antecedent counts as true.
This is called material implication. It does not capture every use of "if" in English. If today is Saturday, then I am in Buffalo is true on a Tuesday by this definition, which is not how we usually understand the sentence. The material implication is the part of "if" that propositional logic can model with two truth values.
The table also lets us compute with \(\mathrm T\) and \(\mathrm F\) as we compute with numbers: \(\mathrm T\wedge\mathrm F=\mathrm F\), \(\neg\mathrm F=\mathrm T\), \(\mathrm F\to\mathrm F=\mathrm T\). In such a computation the connectives are operations on \(\{\mathrm T,\mathrm F\}\), while inside \([\![\ ]\!]_v\) they are symbols of the language. The recursive definition turns one into the other.
Let \(\varphi=(p\wedge\neg q)\to(q\vee r)\) and let \(v\) be a valuation with \(v(p)=\mathrm T\), \(v(q)=\mathrm F\), \(v(r)=\mathrm F\). Each line applies Definition 7.22 or Table 1 once:
So \([\![\varphi]\!]_v=\mathrm F\). The antecedent is true and the consequent is false: this is the one row in which an implication fails.
If we change only \(v(r)\) to \(\mathrm T\), the consequent becomes \(\mathrm F\vee\mathrm T=\mathrm T\) and the value of \(\varphi\) becomes \(\mathrm T\to\mathrm T=\mathrm T\).
The same computation can be written on the parse tree. Start at the leaves, where \(v\) gives the values, and move up: each node gets its value from its children by Table 1 (Figure 3).
Dictionary: \(r\): It is raining. \(c\): It is cold. \(u\): I take my umbrella. \(w\): I walk to campus. A situation is a valuation. Suppose today it is raining, it is not cold, I take my umbrella and I do not walk: \(v(r)=\mathrm T\), \(v(c)=\mathrm F\), \(v(u)=\mathrm T\), \(v(w)=\mathrm F\).
Sentence 4 shows a useful shortcut: an implication with a false antecedent is true, and a disjunction with one true part is true, so sometimes half of a formula does not need to be computed.
A valuation assigns values to all primitive propositions, infinitely many of them. For one formula only finitely many of these values matter.
Let \(\varphi\) be a formula and let \(v,w\) be valuations with \(v(p)=w(p)\) for every \(p\in\mathit{occ}(\varphi)\). Then \([\![\varphi]\!]_v=[\![\varphi]\!]_w\).
Structural induction on \(\varphi\). The statement \(P(\varphi)\) is: for all valuations \(v,w\) that agree on \(\mathit{occ}(\varphi)\), \([\![\varphi]\!]_v=[\![\varphi]\!]_w\).
Base case. \(\mathit{occ}(p)=\{p\}\), so \(v(p)=w(p)\), and \([\![p]\!]_v=v(p)=w(p)=[\![p]\!]_w\).
Step for \(\neg\). Let \(v,w\) agree on \(\mathit{occ}(\neg\varphi)=\mathit{occ}(\varphi)\). By \(P(\varphi)\), \([\![\varphi]\!]_v=[\![\varphi]\!]_w\). The value of \(\neg\varphi\) is computed from the value of \(\varphi\) alone, so \([\![\neg\varphi]\!]_v=[\![\neg\varphi]\!]_w\).
Step for \(\bullet\). Let \(v,w\) agree on \(\mathit{occ}(\varphi\bullet\psi)=\mathit{occ}(\varphi)\cup\mathit{occ}(\psi)\). Then they agree on \(\mathit{occ}(\varphi)\) and on \(\mathit{occ}(\psi)\), so \(P(\varphi)\) and \(P(\psi)\) give \([\![\varphi]\!]_v=[\![\varphi]\!]_w\) and \([\![\psi]\!]_v=[\![\psi]\!]_w\). The value of \(\varphi\bullet\psi\) is computed from these two values by Table 1, so \([\![\varphi\bullet\psi]\!]_v=[\![\varphi\bullet\psi]\!]_w\). □
So for a formula with \(n\) distinct primitive propositions there are only \(2^n\) cases to consider, one for each combination of their values. This is the idea behind truth tables. For instance, in Example 7.23 the value \(v(s)\) of a primitive proposition \(s\notin\{p,q,r\}\) played no role.
Self-check only. Nothing here counts towards your grade.
Let \(v(p)=\mathrm T\), \(v(q)=\mathrm F\), \(v(r)=\mathrm T\), \(v(s)=\mathrm F\). Find \([\![\varphi]\!]_v\) for each formula.
By Proposition 7.25 every valuation falls under exactly one row, so the table describes the value of \(\varphi\) under all valuations.
The truth table of \(\neg(p\wedge q)\to(\neg p\vee\neg q)\):
| \(p\) | \(q\) | \(p\wedge q\) | \(\neg (p\wedge q)\) | \(\neg p\) | \(\neg q\) | \(\neg p\vee \neg q\) | \(\neg (p\wedge q)\to (\neg p\vee \neg q)\) |
|---|---|---|---|---|---|---|---|
| T | T | T | F | F | F | F | T |
| T | F | F | T | F | T | T | T |
| F | T | F | T | T | F | T | T |
| F | F | F | T | T | T | T | T |
The first column after the bar is computed from \(p\) and \(q\) by the table of \(\wedge\); the second negates it, and so on. The last column is \(\mathrm T\) in every row, so the formula is true under every valuation.
Some books write the same computation more compactly, with each value under the connective that produces it in one long line. The entries are the same; only the layout differs.
The truth table of \((p\to q)\to(q\to p)\):
| \(p\) | \(q\) | \(p\to q\) | \(q\to p\) | \((p\to q)\to (q\to p)\) |
|---|---|---|---|---|
| T | T | T | T | T |
| T | F | F | T | T |
| F | T | T | F | F |
| F | F | T | T | T |
The formula is false in exactly one row: \(p\) false and \(q\) true. In that row \(p\to q\) is true (false antecedent) and \(q\to p\) is false. In words: the converse of a true implication can be false. A true \(p\to q\) does not give \(q\to p\).
The truth table of \(((p\vee q)\wedge\neg r)\to p\) has \(2^3=8\) rows:
| \(p\) | \(q\) | \(r\) | \(p\vee q\) | \(\neg r\) | \((p\vee q)\wedge \neg r\) | \(((p\vee q)\wedge \neg r)\to p\) |
|---|---|---|---|---|---|---|
| T | T | T | T | F | F | T |
| T | T | F | T | T | T | T |
| T | F | T | T | F | F | T |
| T | F | F | T | T | T | T |
| F | T | T | T | F | F | T |
| F | T | F | T | T | T | F |
| F | F | T | F | F | F | T |
| F | F | F | F | T | F | T |
In the first four rows \(p\) is true, so the implication is true whatever the antecedent is. Only the last four rows need work, and among them only the row \(p=\mathrm F\), \(q=\mathrm T\), \(r=\mathrm F\) makes the antecedent true. There the formula is false.
Self-check only. Nothing here counts towards your grade.
Complete the truth table of \((p\wedge\neg q)\vee(q\to r)\). Click a cell to switch between empty, \(\mathrm T\) and \(\mathrm F\). Fill the columns from left to right.
| \(p\) | \(q\) | \(r\) | \(\neg q\) | \(p\wedge \neg q\) | \(q\to r\) | \((p\wedge \neg q)\vee (q\to r)\) |
|---|---|---|---|---|---|---|
| T | T | T | F | F | T | T |
| T | T | F | F | F | F | F |
| T | F | T | T | T | T | T |
| T | F | F | T | T | T | T |
| F | T | T | F | F | T | T |
| F | T | F | F | F | F | F |
| F | F | T | T | F | T | T |
| F | F | F | T | F | T | T |
The formula is false exactly when both disjuncts are false. \(q\to r\) is false only when \(q=\mathrm T\) and \(r=\mathrm F\), and then \(\neg q=\mathrm F\), so \(p\wedge\neg q\) is false too. These are the rows \(\mathrm{TTF}\) and \(\mathrm{FTF}\).
A tautology is true "in virtue of its form": its truth does not depend on the values given to the primitive propositions. For instance \(p\vee\neg p\) is a tautology, \(p\wedge\neg p\) is a contradiction, and \(p\to q\) is contingent and satisfiable.
(1) For every \(v\), \([\![\neg\varphi]\!]_v=\mathrm F\) iff \([\![\varphi]\!]_v=\mathrm T\). So "\(\neg\varphi\) is false under every \(v\)" says the same as "\(\varphi\) is true under every \(v\)". (2) "Not false under every \(v\)" means "true under some \(v\)". (3) \(\varphi\) is true under some \(v\) iff \(\neg\varphi\) is false under some \(v\), iff \(\neg\varphi\) is not a tautology. □
On Monday we translated neither \(A\) nor \(B\) both as \(\neg A\wedge\neg B\) and as \(\neg(A\vee B)\). With \(r\) and \(c\) for the two statements, the claim is that \(\neg(r\vee c)\leftrightarrow(\neg r\wedge\neg c)\) is a tautology:
| \(r\) | \(c\) | \(r\vee c\) | \(\neg (r\vee c)\) | \(\neg r\) | \(\neg c\) | \(\neg r\wedge \neg c\) | \(\neg (r\vee c)\leftrightarrow (\neg r\wedge \neg c)\) |
|---|---|---|---|---|---|---|---|
| T | T | T | F | F | F | F | T |
| T | F | T | F | F | T | F | T |
| F | T | T | F | T | F | F | T |
| F | F | F | T | T | T | T | T |
The column of \(\leftrightarrow\) is \(\mathrm T\) exactly where the two columns it joins agree, and they agree in every row. So the two translations have the same truth value in every situation.
Same dictionary as in Example 7.24.
A full truth table is not always the fastest way. To show that a formula is a tautology, it is enough to show that no valuation makes it false. Often one can search for such a valuation directly, working from the main connective downwards.
(a) \((p\to q)\to(q\to p)\). For the whole implication to be false we need \(p\to q=\mathrm T\) and \(q\to p=\mathrm F\). The second condition forces \(q=\mathrm T\) and \(p=\mathrm F\). Check the first: \(\mathrm F\to\mathrm T=\mathrm T\). So the valuation with \(p=\mathrm F\), \(q=\mathrm T\) makes the formula false, and it is not a tautology. This is the row found in Example 7.28.
(b) \((p\to(q\to r))\to((p\to q)\to(p\to r))\). Suppose some valuation makes it false.
Every choice was forced, and we reached a contradiction. So no valuation makes the formula false, and it is a tautology. This took one line of values instead of eight rows.
The computation in Example 7.27 used only the truth values of \(p\) and \(q\), not what they are. If we replace \(p\) and \(q\) by any formulas \(\varphi\) and \(\psi\), every valuation gives \(\varphi\) and \(\psi\) one of the four combinations of values, and the same row of the table applies. So every formula of the form \(\neg(\varphi\wedge\psi)\to(\neg\varphi\vee\neg\psi)\) is a tautology. Such an expression with Greek letters is a formula scheme; it stands for all of its instances. The same holds for Example 7.34(b), where \(p,q,r\) can be replaced by any formulas.
Self-check only. Nothing here counts towards your grade.
Choose the values of \(p,q,r\). The check computes the formula under your valuation, so every correct valuation is accepted.
(a) Make \((p\to q)\to(\neg q\to r)\) false.
(b) Make \(((p\vee q)\wedge(\neg p\vee\neg q))\wedge(q\to r)\) true.
(a) We need \(p\to q=\mathrm T\) and \(\neg q\to r=\mathrm F\). The second forces \(\neg q=\mathrm T\) and \(r=\mathrm F\), so \(q=\mathrm F\). Then \(p\to q=\mathrm T\) forces \(p=\mathrm F\). The only answer is \(p=q=r=\mathrm F\).
(b) \((p\vee q)\wedge(\neg p\vee\neg q)\) says that exactly one of \(p,q\) is true. If \(p=\mathrm T\), \(q=\mathrm F\), then \(q\to r\) is true for both values of \(r\). If \(p=\mathrm F\), \(q=\mathrm T\), then \(r\) must be \(\mathrm T\). Three valuations work: \(\mathrm{TFT}\), \(\mathrm{TFF}\) and \(\mathrm{FTT}\) (values of \(p,q,r\)).
Self-check only. Nothing here counts towards your grade.
We now have one way to say that a formula is "always true": \(\vDash\varphi\), checked by truth tables. Next week we define a second, completely different notion, \(\vdash\varphi\): \(\varphi\) can be derived from axioms by rules, without any mention of truth. The main results of the coming weeks are that the two notions pick out exactly the same formulas, and that a truth table gives a mechanical test for both.
~, &, |, -> and
<->. Follow Convention 7.5 for parentheses. In the truth tables of Question 5,
type T or F in each cell.Dictionary: \(s\): Sarah studies. \(p\): Sarah passes the exam. \(h\): The exam is hard. \(t\): Sarah has time.
Consider the four strings
For a formula \(\varphi\), let \(f(\varphi)\) be the number of occurrences of primitive propositions in \(\varphi\), counting repetitions (so \(f(p\to p)=2\)), and let \(g(\varphi)\) be the number of occurrences of the symbol \(\wedge\) in \(\varphi\).
Let \(v\) be a valuation with \(v(p)=\mathrm F\), \(v(q)=\mathrm T\), \(v(r)=\mathrm F\), \(v(s)=\mathrm T\).
| \(p\) | \(q\) | \(p\to q\) | \(\neg q\) | \(\neg p\) | \(\neg q\to \neg p\) | \((p\to q)\leftrightarrow (\neg q\to \neg p)\) |
|---|---|---|---|---|---|---|
| T | T | |||||
| T | F | |||||
| F | T | |||||
| F | F |
| \(p\) | \(q\) | \(r\) | \(p\to q\) | \(q\to r\) | \((p\to q)\wedge (q\to r)\) | \(r\to p\) | \(((p\to q)\wedge (q\to r))\to (r\to p)\) |
|---|---|---|---|---|---|---|---|
| T | T | T | |||||
| T | T | F | |||||
| T | F | T | |||||
| T | F | F | |||||
| F | T | T | |||||
| F | T | F | |||||
| F | F | T | |||||
| F | F | F |
On an island every inhabitant is a knight, who always tells the truth, or a knave, who always lies. You meet three inhabitants \(A\), \(B\), \(C\). They say:
Use the dictionary \(a\): \(A\) is a knight, \(b\): \(B\) is a knight, \(c\): \(C\) is a knight.