M384 Logic
Week 2: Truth, Consequence, and Inference
Topics: models and semantic consequence; formal and informal proofs; preorders and monotone functions; the logic of identity, soundness and completeness.
Source: L. S. Moss, Logic from Language, Chapter 0.
By the end of this week you will be able to:
- decide whether a sentence is true in a given model, and explain why truth always needs a model;
- state the definition of semantic consequence \(\Gamma \models \varphi\) and give a countermodel when \(\Gamma \not\models \varphi\);
- check whether a relation is a preorder or an equivalence relation, and read and draw Hasse diagrams;
- decide whether a function between preorders is monotone, antitone, both, or neither;
- write formal proofs in the identity system \(\mathsf{E}\) and explain what soundness and completeness say about it.
Day 1: Truth in a model and semantic consequence
Today we see that a sentence is true or false only inside a model, and we define what it means for a sentence to follow from a set of sentences.
Syntax and semantics
Logic is the study of inference in language. If someone says a sentence, they are committed to more than that one sentence: a hearer will infer other sentences that follow from it. For example, from All of my friends can ride a bicycle and Sandy is my friend, the hearer infers Sandy can ride a bicycle. We want a precise, mathematical account of this kind of inference.
The first step is a distinction that runs through the whole course:
- Syntax is about the raw symbols: which strings count as sentences.
- Semantics is about meaning. For us, meaning is given by abstract mathematical objects called models.
Here is a model. Let \(M = \{1,2,3,4,5,6,7,8\}\) and interpret three nouns as subsets of \(M\):
\([\![\mathit{runners}]\!] = \{1,2,3,4,5,6\},\qquad [\![\mathit{skiers}]\!] = \{1,4\},\qquad [\![\mathit{skaters}]\!] = \{2,4\}.\)
Figure 1 shows this model as a picture.
Let \(\mathcal M\) be a model that interprets each noun \(p\) as a subset \([\![p]\!]\) of a set \(M\). The sentence All \(p\) are \(q\) is true in \(\mathcal M\), written \(\mathcal M \models \textit{All } p \textit{ are } q\), iff \([\![p]\!] \subseteq [\![q]\!]\), that is, iff every element of \([\![p]\!]\) is also an element of \([\![q]\!]\).
Otherwise the sentence is false in \(\mathcal M\), written \(\mathcal M \not\models \textit{All } p \textit{ are } q\). This happens exactly when some element of \([\![p]\!]\) is not in \([\![q]\!]\).
Decide whether each sentence is true or false in the model of Figure 1.
(a) All skaters are runners.
(b) All runners are skiers.
(c) All skaters are skiers.
(d) All runners are runners.
(a) True. \([\![\mathit{skaters}]\!] = \{2,4\}\) and both 2 and 4 belong to \([\![\mathit{runners}]\!] = \{1,\dots,6\}\). So \(\{2,4\} \subseteq \{1,\dots,6\}\).
(b) False. The element 3 is in \([\![\mathit{runners}]\!]\) but not in \([\![\mathit{skiers}]\!] = \{1,4\}\). One such element is enough to make the sentence false. (Elements 2, 5, 6 also work.)
(c) False. The element 2 is a skater but not a skier.
(d) True. Every set is a subset of itself, so \([\![\mathit{runners}]\!] \subseteq [\![\mathit{runners}]\!]\). In fact All \(x\) are \(x\) is true in every model, for every noun \(x\), for the same reason.
The sentence All skaters are runners is not true or false on its own. The question "Is it true?" only makes sense after a model is given. Once the model is specified precisely, the truth value can be computed, even mechanically. Sentences are true or false in models.
Inference based on models
Logical reasoning is reasoning that works for all models. It cannot tell you what is true. It can tell you that, if certain assumptions are true, then certain conclusions are also true. Consider:
This inference does not depend on what sparrows, birds, and animals actually are. Replace the three nouns by any other nouns, or by nouns you have never heard of, and the argument still works: in every model where the two sentences above the line are true, the sentence below the line is also true. We now make this idea precise. First, some notation.
We use \(\varphi\) (phi), \(\psi\) (psi), \(\chi\) (chi) for sentences, and \(\Gamma\) (gamma), \(\Delta\) (delta) for sets of sentences. The word "sentence" changes meaning from one logical system to another; the definitions below are the same for all of them.
Each logical system has its own definition of when a model \(\mathcal M\) satisfies a sentence \(\varphi\), written \(\mathcal M \models \varphi\). Let \(\Gamma\) be a set of sentences and \(\mathcal M\) a model.
- \(\mathcal M \models \Gamma\) iff \(\mathcal M \models \varphi\) for every \(\varphi \in \Gamma\).
- \(\Gamma \models \varphi\) iff for all models \(\mathcal M\): if \(\mathcal M \models \Gamma\), then \(\mathcal M \models \varphi\).
We read \(\Gamma \models \varphi\) as: every model of \(\Gamma\) is a model of \(\varphi\); or \(\Gamma\) logically (semantically) implies \(\varphi\); or \(\varphi\) is a semantic consequence of \(\Gamma\).
We write \(\Gamma \not\models \varphi\) when this fails. In plain terms: there is some model \(\mathcal M\) with \(\mathcal M \models \Gamma\) but \(\mathcal M \not\models \varphi\). Such a model is called a countermodel.
Show that \(\{\textit{All } p \textit{ are } q,\ \textit{All } q \textit{ are } r\} \models \textit{All } p \textit{ are } r\).
By Definition 0.3 we must consider an arbitrary model \(\mathcal M\) in which both assumptions are true and show that the conclusion is true there too.
Suppose \(\mathcal M \models \textit{All } p \textit{ are } q\) and \(\mathcal M \models \textit{All } q \textit{ are } r\). By the definition of truth, \([\![p]\!] \subseteq [\![q]\!]\) and \([\![q]\!] \subseteq [\![r]\!]\).
Take any \(x \in [\![p]\!]\). Then \(x \in [\![q]\!]\) by the first inclusion, and then \(x \in [\![r]\!]\) by the second. So \([\![p]\!] \subseteq [\![r]\!]\), which means \(\mathcal M \models \textit{All } p \textit{ are } r\).
Since \(\mathcal M\) was arbitrary, the consequence holds in every model. This is the sparrows argument above, with the nouns replaced by letters.
Show that \(\textit{All } p \textit{ are } q \not\models \textit{All } q \textit{ are } p\).
We need one countermodel: a model where the assumption is true and the conclusion is false.
Let \(M = \{1, 2\}\), \([\![p]\!] = \{1\}\), \([\![q]\!] = \{1, 2\}\).
The assumption holds: \(\{1\} \subseteq \{1,2\}\). The conclusion fails: \(2 \in [\![q]\!]\) but \(2 \notin [\![p]\!]\), so \([\![q]\!] \not\subseteq [\![p]\!]\).
One countermodel is enough, because \(\Gamma \models \varphi\) requires the conclusion to hold in every model of \(\Gamma\). Note that the model of Figure 1 would also work, with \(p = \mathit{skiers}\) and \(q = \mathit{runners}\).
Formal proofs and informal proofs
A proof in mathematics is a piece of reasoning that convinces us that some assumptions imply a conclusion. It is written in a natural language, may use diagrams and citations, and often skips steps. It is informal.
A formal proof is a caricature of an informal proof. Its sentences come from a precise grammar, and its steps are applications of precisely stated rules. Two properties matter:
- One can check whether a string is a sentence of the grammar without knowing what it means.
- One can check whether a formal proof is correct without knowing what the sentences or the rules are about.
This looks paradoxical: we study meaning, yet the basic objects are checked without meaning. It is not a mistake. Syntax and formal proofs are mathematical objects that can be built and taken apart mechanically. Their connection to meaning is a separate result, and proving that connection is the main work of this course (you will see the first such result on Day 3).
Start with atomic sentences \(p_0, p_1, p_2, \dots\). The set \(\mathsf T\) of terms of boolean algebra is the smallest set such that:
- every atomic sentence \(p_i\) is in \(\mathsf T\), and \(\mathrm T\) and \(\mathrm F\) are in \(\mathsf T\);
- if \(\varphi \in \mathsf T\), then \((\neg\varphi) \in \mathsf T\);
- if \(\varphi, \psi \in \mathsf T\), then \((\varphi \wedge \psi)\), \((\varphi \vee \psi)\), and \((\varphi \leftrightarrow \psi)\) are in \(\mathsf T\).
At this point these expressions do not mean anything. No semantics has been given. \(\mathsf T\) is only a precisely specified collection of strings.
(a) Show that \((\neg(p_0 \wedge \mathrm F))\) belongs to \(\mathsf T\).
(b) Explain why the string \(p_0 \wedge\) does not belong to \(\mathsf T\).
(a) We build the string using the clauses. \(p_0 \in \mathsf T\) and \(\mathrm F \in \mathsf T\) by clause 1. Then \((p_0 \wedge \mathrm F) \in \mathsf T\) by clause 3. Then \((\neg(p_0 \wedge \mathrm F)) \in \mathsf T\) by clause 2. Each step is a mechanical check of the form of the string; we never asked what \(\wedge\) or \(\neg\) means.
(b) \(\mathsf T\) is the smallest set closed under the three clauses. Every string produced by clause 2 or 3 begins with an opening parenthesis, and the strings from clause 1 are single symbols. The string \(p_0 \wedge\) is neither, so it is not produced by any clause and is not in \(\mathsf T\).
Day 2: Preorders and monotone functions
Today we study preorders, a kind of mathematical structure that will appear throughout the course, and functions between preorders that respect the order.
Preorders
A preorder is a pair \(\mathbb P = (P, \le)\), where \(P\) is a set and \(\le\) is a relation on \(P\) which is both reflexive and transitive.
- Reflexivity: \(p \le p\) for all \(p \in P\).
- Transitivity: for all \(p, q, r \in P\), if \(p \le q\) and \(q \le r\), then \(p \le r\).
A preorder is technically a pair, not a set. Following standard usage, we refer to it by the set when the order is clear.
(a) The natural numbers \(\mathbb N = \{0, 1, 2, \dots\}\) with the usual ordering \(\le\).
(b) For any set \(X\), the set \(\mathcal P(X)\) of all subsets of \(X\), ordered by inclusion: \(A \le B\) iff \(A \subseteq B\).
(a) Reflexive: \(n \le n\) for every natural number. Transitive: if \(n \le m\) and \(m \le k\) then \(n \le k\). The real numbers with the usual ordering form a preorder in the same way.
(b) Reflexive: every element of \(A\) is an element of \(A\), so \(A \subseteq A\). Transitive: if every element of \(A\) is in \(B\), and every element of \(B\) is in \(C\), then every element of \(A\) is in \(C\); so \(A \subseteq C\).
(a) \(A = \{a,b,c\}\) and \(R = \{(a,b), (b,c)\}\).
(b) \(\mathbb N\) with \(E = \{(n,m) : n - m \le 1\}\).
(c) \(\mathbb N\) with \(R = \{(n,m) : n < m\}\).
(a) Not reflexive: \((a,a) \notin R\). Not transitive either: \((a,b) \in R\) and \((b,c) \in R\), but \((a,c) \notin R\). One failure is enough, so \((A,R)\) is not a preorder.
(b) Reflexive: \(n - n = 0 \le 1\). Not transitive: \((2,1) \in E\) since \(2-1 = 1\), and \((1,0) \in E\) since \(1-0=1\), but \((2,0) \notin E\) since \(2 - 0 = 2 > 1\). So \((\mathbb N, E)\) is not a preorder.
(c) Transitive: if \(n < m\) and \(m < k\) then \(n < k\). Not reflexive: \(0 < 0\) is false. So \((\mathbb N, R)\) is not a preorder.
Note the convention: we write \(\le\) only when we are working with a preorder. For an arbitrary relation we use a letter such as \(R\).
Hasse diagrams and equivalence in a preorder
Let \(P = \{a, b, c, d, e, f, g\}\) with the preorder \(\le\) whose full list of pairs is
\(a \le a,\ a \le b,\ a \le c,\ a \le d,\ a \le e,\ a \le f,\ a \le g,\ b \le b,\ b \le c,\ b \le e,\ b \le f,\ b \le g,\ c \le b,\ c \le c,\ c \le e,\ c \le f,\ c \le g,\)
\(d \le d,\ d \le e,\ d \le f,\ d \le g,\ e \le e,\ e \le f,\ e \le g,\ f \le e,\ f \le f,\ f \le g,\ g \le e,\ g \le f,\ g \le g.\)
Figure 2 shows the same preorder as a picture, called its Hasse diagram.
How to read the diagram:
- \(a\) is at the bottom because \(a \le x\) for every \(x \in P\).
- \(b\) and \(c\) share a node because \(b \le c\) and \(c \le b\). We write \(b \equiv c\) and say \(b\) and \(c\) are equivalent in the preorder. Equivalent does not mean identical: \(b\) and \(c\) are different elements.
- Reflexivity is implicit: we never draw a loop from a node to itself.
- Transitivity is implicit: we never draw a line from \(a\) to \(e\), because it follows from \(a \le b\) and \(b \le e\).
- The left-right placement of \(b, c\) and \(d\) has no meaning.
Using Figure 2, decide: (a) is \(d \le c\)? (b) is \(c \le g\)? (c) is \(g \le e\)? (d) is \(e \le a\)?
(a) No. There is no upward path from \(d\) to the node of \(b,c\); the two middle nodes are not connected. In the list of pairs, \(d \le c\) does not appear.
(b) Yes. There is a line from the node \(b,c\) up to the node \(e,f,g\), and \(c\) and \(g\) are in those nodes. In the list, \(c \le g\) appears.
(c) Yes. \(g\) and \(e\) are in the same node, so \(g \le e\) and \(e \le g\); thus \(g \equiv e\).
(d) No. The path from \(a\) to \(e\) goes upward, not downward. \(e \le a\) is not in the list.
For any preorder \(\mathbb P = (P, \le)\):
- The opposite preorder \(\mathbb P^{\mathrm{op}}\) has the same set \(P\), with \(p \le q\) in \(\mathbb P^{\mathrm{op}}\) iff \(q \le p\) in \(\mathbb P\).
- The flattened preorder \(\mathbb P^{\flat}\) has the same set \(P\), with \(p \le q\) in \(\mathbb P^{\flat}\) iff \(p = q\).
An important preorder for logic is \(\mathbf 2\), also called Bool. Its set is \(\{\mathrm T, \mathrm F\}\) and its order is \(\mathrm F \le \mathrm T\) (together with \(\mathrm F \le \mathrm F\) and \(\mathrm T \le \mathrm T\)). Figure 3 shows \(\mathbf 2\), its opposite, and its flattening.
In \(\mathbf 2^{\mathrm{op}}\) the order is reversed: \(\mathrm T \le \mathrm F\). So \(\mathrm T\) is now at the bottom.
In \(\mathbf 2^{\flat}\) no element is below another different element. The two nodes stand side by side without a line. Both \(\mathbf 2^{\mathrm{op}}\) and \(\mathbf 2^{\flat}\) are preorders: reversing an order or keeping only the reflexive pairs preserves reflexivity and transitivity.
For preorders \(\mathbb P\) and \(\mathbb Q\), the product \(\mathbb P \times \mathbb Q\) has as its set the cartesian product \(P \times Q\), ordered by
\((p, q) \le (p', q')\) in \(\mathbb P \times \mathbb Q\) iff \(p \le p'\) in \(\mathbb P\) and \(q \le q'\) in \(\mathbb Q\).
Monotone and antitone functions
Let \(\mathbb P\) and \(\mathbb Q\) be preorders. A function \(f : P \to Q\) is
- monotone if for all \(p, q \in P\): if \(p \le q\) in \(\mathbb P\), then \(f(p) \le f(q)\) in \(\mathbb Q\);
- antitone if for all \(p, q \in P\): if \(p \le q\) in \(\mathbb P\), then \(f(q) \le f(p)\) in \(\mathbb Q\).
To show that a function is not monotone, one pair \(p \le q\) with \(f(p) \le f(q)\) false is enough. To show that it is monotone, you must argue for all pairs. The same holds for antitone.
For each function, decide whether it is monotone, antitone, both, or neither.
(a) \(f(x) = x + 1\)
(b) \(g(x) = x^2 - 3x + 2\)
(c) \(h(x) = 577\)
(d) \(i(x) = x\)
(e) \(j(0) = 1\) and \(j(x) = 0\) for \(x > 0\)
(a) Monotone: if \(n \le m\) then \(n + 1 \le m + 1\). Not antitone: \(0 \le 1\) but \(f(1) = 2 \le 1 = f(0)\) is false.
(b) Compute \(g(0) = 2\), \(g(1) = 0\), \(g(2) = 0\), \(g(3) = 2\). Not monotone: \(0 \le 1\) but \(g(0) = 2 \le 0 = g(1)\) is false. Not antitone: \(1 \le 3\) but \(g(3) = 2 \le 0 = g(1)\) is false. So \(g\) is neither.
(c) A constant function is both monotone and antitone: for any \(n \le m\), \(h(n) = 577 \le 577 = h(m)\) and also \(h(m) \le h(n)\). Every constant function has this property.
(d) The identity is monotone: \(n \le m\) gives \(i(n) = n \le m = i(m)\). It is not antitone: \(0 \le 1\) but \(1 \le 0\) fails.
(e) Antitone: take \(n \le m\). If \(n = 0\), then \(j(m) \le 1 = j(0)\) holds because \(j(m)\) is 0 or 1. If \(n > 0\), then \(m > 0\) too, and \(j(m) = 0 \le 0 = j(n)\). Not monotone: \(0 \le 1\) but \(j(0) = 1 \le 0 = j(1)\) fails.
| \(f(\mathrm T)\) | \(f(\mathrm F)\) | |
|---|---|---|
| \(f_1\) | T | T |
| \(f_2\) | T | F |
| \(f_3\) | F | T |
| \(f_4\) | F | F |
Which of these are monotone, and which are antitone?
In \(\mathbf 2\) the only pair \(p \le q\) with \(p \ne q\) is \(\mathrm F \le \mathrm T\). Monotone means \(f(\mathrm F) \le f(\mathrm T)\); antitone means \(f(\mathrm T) \le f(\mathrm F)\). The reflexive pairs never cause a problem.
\(f_1\) (constant T) and \(f_4\) (constant F): both conditions hold, so both monotone and antitone.
\(f_2\) is the identity: \(f_2(\mathrm F) = \mathrm F \le \mathrm T = f_2(\mathrm T)\), so monotone. Antitone would need \(\mathrm T \le \mathrm F\), which is false.
\(f_3\) is negation, it flips the truth values: \(f_3(\mathrm T) = \mathrm F \le \mathrm T = f_3(\mathrm F)\), so antitone; not monotone.
Summary: \(f_1, f_2, f_4\) are monotone; \(f_1, f_3, f_4\) are antitone.
The material conditional is the function \(\to : \{\mathrm T,\mathrm F\} \times \{\mathrm T,\mathrm F\} \to \{\mathrm T,\mathrm F\}\) defined by
\(\mathrm T \to \mathrm T = \mathrm T,\quad \mathrm T \to \mathrm F = \mathrm F,\quad \mathrm F \to \mathrm T = \mathrm T,\quad \mathrm F \to \mathrm F = \mathrm T.\)
Show that \(\to\) is monotone when taken as a function from \(\mathbf 2^{\mathrm{op}} \times \mathbf 2\) to \(\mathbf 2\).
First we work out the order on \(\mathbf 2^{\mathrm{op}} \times \mathbf 2\). By Definition 0.10, \((p,q) \le (p',q')\) iff \(p \le p'\) in \(\mathbf 2^{\mathrm{op}}\) (that is, \(p' \le p\) in \(\mathbf 2\)) and \(q \le q'\) in \(\mathbf 2\). The first coordinate may go from T to F, and the second from F to T.
So \((\mathrm T,\mathrm F)\) is the bottom element, \((\mathrm F, \mathrm T)\) is the top, and \((\mathrm F,\mathrm F)\), \((\mathrm T,\mathrm T)\) are in the middle and not comparable with each other. This is the diamond in Figure 4.
Now apply \(\to\): the bottom \((\mathrm T,\mathrm F)\) goes to F, and the other three pairs go to T. Going up in the diamond, the value never goes from T down to F. Concretely, take any \(x \le y\) in the product. If \(x = (\mathrm T,\mathrm F)\), the value at \(x\) is F, and F is below every element of \(\mathbf 2\). Otherwise the value at \(x\) is T; then \(y \ne (\mathrm T, \mathrm F)\) because \((\mathrm T,\mathrm F)\) is the bottom, so the value at \(y\) is also T. In both cases the value at \(x\) is \(\le\) the value at \(y\). So \(\to\) is monotone.
Note that \(\to\) is not monotone from \(\mathbf 2 \times \mathbf 2\) to \(\mathbf 2\): there \((\mathrm F,\mathrm F) \le (\mathrm T, \mathrm F)\), but \(\mathrm T \le \mathrm F\) fails. Taking the opposite order in the first coordinate is exactly what makes the function monotone. This is the reason for the "op".
Composition
Let \(g : P \to Q\) and \(f : Q \to R\) be functions on preorders. The composition \(f \circ g : P \to R\) is defined by \((f \circ g)(p) = f(g(p))\): first apply \(g\), then apply \(f\) to the result.
If \(f\) and \(g\) are both monotone, then so is \(f \circ g\).
Proof. Suppose \(p_1 \le p_2\) in \(P\). Since \(g\) is monotone, \(g(p_1) \le g(p_2)\) in \(Q\). Since \(f\) is monotone, \(f(g(p_1)) \le f(g(p_2))\) in \(R\). (This is the important step: monotonicity of \(f\) is applied to the pair \(g(p_1) \le g(p_2)\).) But \((f \circ g)(p_1) = f(g(p_1))\) and \((f \circ g)(p_2) = f(g(p_2))\), so \((f \circ g)(p_1) \le (f \circ g)(p_2)\). As \(p_1, p_2\) were arbitrary, \(f \circ g\) is monotone.
Let \(g : \mathbb N \to \mathbb N\), \(g(x) = x + 1\), and \(f : \mathbb N \to \mathcal P(\mathbb N)\), \(f(n) = \{0, 1, \dots, n\}\), where \(\mathcal P(\mathbb N)\) is ordered by inclusion. Is \(f \circ g\) monotone?
\(g\) is monotone (Example 9(a)). \(f\) is monotone: if \(n \le m\) then \(\{0,\dots,n\} \subseteq \{0,\dots,m\}\), because every number up to \(n\) is also a number up to \(m\).
By Proposition 0.15, \(f \circ g\) is monotone. Directly: \((f \circ g)(x) = \{0, 1, \dots, x+1\}\), and if \(x \le y\) then \(\{0,\dots,x+1\} \subseteq \{0,\dots,y+1\}\).
Day 3: The logic of identity, soundness and completeness
Today we go through a complete small logical system from start to finish: syntax, semantics, a proof system, and the two theorems that connect them.
For any logical system: \(\mathcal M \models \Gamma\) means every sentence in \(\Gamma\) is true in \(\mathcal M\); \(\Gamma \models \varphi\) means every model of \(\Gamma\) is a model of \(\varphi\). A relation on a set is reflexive if every element is related to itself, and transitive if \(x\,R\,y\) and \(y\,R\,z\) imply \(x\,R\,z\).
Syntax and semantics
Syntax. We start with a collection of names, \(\mathrm{Names} = \{\mathit{Amina}, \mathit{Bao}, \mathit{Clarisse}, \mathit{Damir}, \dots\}\). We use letters \(a, b, c, \dots\) as variables over names. The sentences are the expressions \(a = b\), read "\(a\) is \(b\)", where \(a\) and \(b\) are names. There are no other sentences.
A model \(\mathcal M\) is a set \(M\) together with an interpretation function \([\![\ ]\!] : \mathrm{Names} \to M\). We define
\(\mathcal M \models a = b\) iff \([\![a]\!] = [\![b]\!]\).
The notions \(\mathcal M \models \Gamma\) and \(\Gamma \models a = b\) are then given by Definition 0.3.
Let \(M = \{1,2,3,4\}\), with \([\![a]\!] = 1\), \([\![b]\!] = 1\), \([\![c]\!] = 2\). Which of \(a = b\), \(a = c\), \(c = c\) are true in \(\mathcal M\)?
\(\mathcal M \models a = b\), because \([\![a]\!] = 1 = [\![b]\!]\).
\(\mathcal M \not\models a = c\), because \([\![a]\!] = 1 \ne 2 = [\![c]\!]\).
\(\mathcal M \models c = c\), because \([\![c]\!] = [\![c]\!]\). This holds for every name in every model.
Two observations from Figure 5: two different names can refer to the same element, as in real life (\([\![\mathit{Superman}]\!] = [\![\mathit{Clark\ Kent}]\!]\)), and an element of the model need not have any name (here 3 and 4).
Some semantic facts that follow directly from properties of equality between elements of a set:
- \(\models a = a\) (true in every model; here \(\Gamma\) is empty).
- \(a = b \models b = a\).
- \(a = b,\ b = c \models a = c\).
- \(b = c,\ d = a,\ a = c \models d = b\).
The goal is to characterize, for every set \(\Gamma\) of equations, exactly which single equations are semantic consequences of \(\Gamma\). We do this with a proof system.
The proof system \(\mathsf E\)
The rules are named for reflexivity (r), symmetry (s), and transitivity (t). Rule r has no premises: \(a = a\) may be written at any time.
A formal proof from \(\Gamma\) is a tree built with these rules, whose leaves are either sentences from \(\Gamma\) or instances of rule r. We write \(\Gamma \vdash a = b\) if there is such a tree with conclusion \(a = b\).
Show that \(b = c,\ d = a,\ a = c \vdash d = b\).
Reading from the top: the leaves \(d = a\), \(a = c\), \(b = c\) are all in \(\Gamma\). Rule t combines \(d = a\) and \(a = c\) into \(d = c\). Rule s turns \(b = c\) into \(c = b\). Rule t combines \(d = c\) and \(c = b\) into \(d = b\).
Checking this proof requires no knowledge of what the names refer to. Each step only matches the shape of a rule.
Show that \(a = c,\ b = c \vdash a = b\), and show that \(\vdash b = b\) (with no assumptions).
Rule t needs the middle name to match: \(a = c\) and \(c = b\). The assumption is \(b = c\), so we first apply rule s to it. Then t gives \(a = b\).
For \(\vdash b = b\), the proof is a single application of rule r, with no premises. Its tree has only the conclusion \(b = b\).
Equivalence relations
To prove completeness we need a general notion from mathematics.
A relation \(E\) on a set \(X\) is an equivalence relation if:
- for all \(x \in X\), \(x\,E\,x\) (reflexive);
- for all \(x, y \in X\), if \(x\,E\,y\) then \(y\,E\,x\) (symmetric);
- for all \(x, y, z \in X\), if \(x\,E\,y\) and \(y\,E\,z\) then \(x\,E\,z\) (transitive).
For \(x \in X\), the equivalence class of \(x\) is \([x] = \{y \in X : x\,E\,y\}\). The quotient set \(X/E\) is the set of all equivalence classes.
Every equivalence relation is a preorder (it is reflexive and transitive). A preorder in which \(p \le q\) always implies \(q \le p\) is an equivalence relation.
Let \(X = \{1,2,3,4\}\) and
\(R_1 = \{(1,1),(1,2),(1,3),(2,1),(3,3),(3,4)\}\)
\(R_2 = \{(1,1),(2,2),(1,2),(2,1),(3,3),(4,4)\}\)
\(R_3 = \{(1,1),(2,2),(3,3),(1,2),(2,1),(1,3),(3,1),(2,3),(3,2),(4,4)\}\)
Which are equivalence relations? For those that are, find the equivalence classes and the quotient set.
\(R_1\) is not reflexive: \((2,2) \notin R_1\). So it is not an equivalence relation. (It is not symmetric either: \((3,4) \in R_1\) but \((4,3) \notin R_1\).)
\(R_2\) is reflexive (all four pairs \((x,x)\) are present), symmetric (the only non-reflexive pairs are \((1,2)\) and \((2,1)\), each other's reverse), and transitive (the only chains are like \(1\,R_2\,2\), \(2\,R_2\,1\), giving \(1\,R_2\,1\), which is present). So \(R_2\) is an equivalence relation. Classes: \([1] = \{1,2\} = [2]\), \([3] = \{3\}\), \([4] = \{4\}\). Quotient: \(X/R_2 = \{\{1,2\}, \{3\}, \{4\}\}\), often written \(\{[1],[3],[4]\}\).
\(R_3\) relates every pair among \(1,2,3\) in both directions, and \(4\) only to itself. Reflexivity, symmetry, and transitivity all hold. Classes: \([1] = [2] = [3] = \{1,2,3\}\) and \([4] = \{4\}\). Quotient: \(X/R_3 = \{\{1,2,3\}, \{4\}\}\).
Let \(X = \{0, 1, \dots, 23\}\) (the hours of a day) and let \(x\,R\,y\) iff \(x \bmod 12 = y \bmod 12\). Define \([x] + [y] = [\,(x + y) \bmod 12\,]\). Is this a proper definition?
\(R\) is an equivalence relation: it compares the values \(x \bmod 12\), and equality of values is reflexive, symmetric, and transitive. The classes are \([0] = \{0, 12\}\), \([1] = \{1, 13\}\), and so on; the quotient is \(\{[0], [1], \dots, [11]\}\), the 12-hour clock.
The concern: \([3] + [11]\) is defined through the numbers 3 and 11, but \([3] = [15]\) and \([11] = [23]\). If we had chosen 15 and 23 as representatives, we would compute \(15 + 23 = 38\).
Check: \(3 + 11 = 14\) and \(14 \bmod 12 = 2\); \(38 \bmod 12 = 2\). Both choices give \([2]\). In general, if \(x \bmod 12 = x' \bmod 12\) and \(y \bmod 12 = y' \bmod 12\), then \((x+y) \bmod 12 = (x'+y') \bmod 12\). So the result does not depend on which representatives we pick, and the definition is proper.
Whenever a function or relation is defined on a quotient set through representatives, this independence check must be done.
Soundness and completeness
Let \(\Gamma\) be a set of sentences. Define a relation \(\equiv_\Gamma\) on \(\mathrm{Names}\) by: \(x \equiv_\Gamma y\) iff \(\Gamma \vdash x = y\).
For every set \(\Gamma\), the relation \(\equiv_\Gamma\) is an equivalence relation.
Proof. Reflexive: \(\Gamma \vdash x = x\) by rule r. Symmetric: if there is a proof of \(x = y\) from \(\Gamma\), apply rule s at the bottom to get a proof of \(y = x\). Transitive: if there are proofs of \(x = y\) and \(y = z\) from \(\Gamma\), put them side by side and apply rule t to get a proof of \(x = z\).
If \(\Gamma \vdash x = y\), then \(\Gamma \models x = y\). In other words: if \(\Gamma \vdash x = y\) and a model \(\mathcal M\) satisfies all sentences in \(\Gamma\), then \(\mathcal M \models x = y\).
Proof. Fix a model \(\mathcal M\) with \(\mathcal M \models \Gamma\). We show by induction on proof trees that the conclusion of every proof from \(\Gamma\) is true in \(\mathcal M\).
- A leaf is either a sentence of \(\Gamma\), true in \(\mathcal M\) by assumption, or an instance \(a = a\) of rule r, true because \([\![a]\!] = [\![a]\!]\).
- Rule s: if \([\![a]\!] = [\![b]\!]\), then \([\![b]\!] = [\![a]\!]\).
- Rule t: if \([\![a]\!] = [\![b]\!]\) and \([\![b]\!] = [\![c]\!]\), then \([\![a]\!] = [\![c]\!]\).
So each rule takes true premises to a true conclusion, and the conclusion of the whole tree is true in \(\mathcal M\).
If \(\Gamma \models x = y\), then \(\Gamma \vdash x = y\).
Proof. Suppose \(\Gamma \models x = y\). Consider the equivalence relation \(\equiv_\Gamma\) on \(\mathrm{Names}\). Define a model \(\mathcal M\) by taking \(M = \mathrm{Names}/{\equiv_\Gamma}\), the quotient set, and \([\![v]\!] = [v]\) for each name \(v\). Each name is sent to its own equivalence class.
Claim: \(\mathcal M \models \Gamma\). Take an equation \(v = w\) in \(\Gamma\). Then \(\Gamma \vdash v = w\) (a one-leaf proof), so \(v \equiv_\Gamma w\), so \([v] = [w]\), so \([\![v]\!] = [\![w]\!]\). The equation is satisfied.
Since \(\Gamma \models x = y\) and \(\mathcal M \models \Gamma\), we get \(\mathcal M \models x = y\). That is, \([x] = [\![x]\!] = [\![y]\!] = [y]\). Two equivalence classes are equal only if their elements are related, so \(x \equiv_\Gamma y\). By Definition 0.22, \(\Gamma \vdash x = y\).
Together, soundness and completeness say that for this system the two notions of consequence agree: \(\Gamma \vdash x = y\) if and only if \(\Gamma \models x = y\). The proof-theoretic side is mechanical and checkable; the semantic side talks about all models. The theorems guarantee that they pick out exactly the same equations. This is the pattern we will repeat for every logical system in the course.
Let \(\Gamma = \{a = b,\ c = d\}\). Show that \(\Gamma \nvdash a = c\).
By soundness, if \(\Gamma \vdash a = c\) then every model of \(\Gamma\) satisfies \(a = c\). So it is enough to find one model of \(\Gamma\) where \(a = c\) is false.
Take \(M = \{1, 2\}\), \([\![a]\!] = [\![b]\!] = 1\), \([\![c]\!] = [\![d]\!] = 2\). Then \(\mathcal M \models a = b\) and \(\mathcal M \models c = d\), so \(\mathcal M \models \Gamma\). But \([\![a]\!] = 1 \ne 2 = [\![c]\!]\), so \(\mathcal M \not\models a = c\).
Hence \(\Gamma \not\models a = c\), and by soundness \(\Gamma \nvdash a = c\). Trying to search through all possible proof trees is not needed.
Homework, Week 2
- Fill in your name in the field below before you start.
- Show your work. A bare answer without reasoning receives no credit. Write full sentences where a proof or an explanation is asked.
- When you are done, click "Save homework as PDF" and upload the PDF to Canvas.
- Your answers are saved automatically in this browser. If you open this file on a different computer or in a different browser, they will not be there.
- Total: 100 points. Questions 2 and 3 are taken from Section 0.5 of the textbook; the others are based on the material of Days 1 and 3.
Question 1: semantic consequence20 points
The sentences in this question are of the form All \(p\) are \(q\), with the semantics of Day 1.
Question 2 (Exercise 0.6)20 points
Let \(\mathbb P\) be the preorder with three points \(P = \{x, y, z\}\) and order
\(x \le x,\quad y \le y,\quad z \le z,\quad x \le y,\quad x \le z,\)
and no other relations. So \(x\) is below both \(y\) and \(z\), and \(y\), \(z\) are not comparable. Let \(\mathbb Q = \mathbb P^{\mathrm{op}}\), which has the same set and the reversed order. The Hasse diagrams of both are shown below.
In each part, give the count and explain how you found it (for example, by listing the functions, or by an argument that covers all cases).
Question 3 (Exercise 0.9)20 points
This question builds on Proposition 0.15. Let \(g : P \to Q\) and \(f : Q \to R\) be functions between preorders, and let \(f \circ g : P \to R\) be their composition, \((f \circ g)(p) = f(g(p))\). Prove each statement in full, following the style of the proof of Proposition 0.15.
Question 4: formal proofs in \(\mathsf E\)15 points
Build a formal proof tree for each statement, using only the rules r, s, t of Definition 0.17. The conclusion is given at the bottom of each tree. For every sentence in the tree, choose how it is obtained: as an assumption from \(\Gamma\), by rule r (no premises), by rule s (one premise), or by rule t (two premises). When you choose s or t, empty boxes for the premises appear above; type the premise sentences into them, then continue upward until every leaf is an assumption from \(\Gamma\) or an instance of rule r. Write sentences in the form a = b.