M384 · Logic · Week 12

First-Order Logic: Language, Structures and Consequence

Day 1: the first-order language, and translation between mathematics, physics and formulas. Day 2: free and bound variables, structures, and the truth of a sentence. Day 3: validity, satisfiability, semantic consequence and countermodels.

Goals for this week

By the end of this week you will be able to:

Day 1: The language of first-order logic, and translation

Today we add quantifiers, variables, functions, relations and equality to the language, and we practise translating mathematics and physics into it and back.

1. Why a new language

Goldbach's conjecture says: every even number greater than 2 is the sum of two primes. In propositional logic this statement is a single primitive proposition. The logic sees no numbers, no "every", no "sum" and no "prime" inside it. It cannot explain why the conjecture follows from, or contradicts, any other statement about numbers.

Mathematics talks about objects (numbers, points, functions, group elements), about properties and relations of objects (even, prime, less than, parallel), about operations on objects (sum, product, composition), about named objects (\(0\), \(1\), \(\pi\), the identity element) and about equality. It quantifies: "for all" and "there exists". First-order logic is the language that has exactly these parts. The connectives \(\neg,\wedge,\vee,\to\) stay as they were.

2. Signatures, terms and formulas

The first step is to say which symbols a particular language has. This list is called a signature.

Definition 12.1: signature

A signature \(\mathcal S\) consists of

  • a set of function symbols, each with an arity \(n\ge1\) (the number of arguments it takes);
  • a set of relation symbols (also called predicate symbols), each with an arity \(n\ge1\);
  • a set of constant symbols.

Any of the three sets may be empty. The symbol \(=\) for equality belongs to every language and is not listed in the signature.

Example 12.2: four signatures
(a) \(\mathcal S_{\mathrm{ar}}\): binary function symbols \(+\) and \(\cdot\), a binary relation symbol \(<\), constant symbols \(0\) and \(1\). This is the signature of arithmetic.
(b) \(\mathcal S_{\mathrm{ord}}\): one binary relation symbol \(<\) and nothing else. The signature of orders.
(c) \(\mathcal S_{\mathrm{gr}}\): one binary function symbol \(\cdot\) and one constant symbol \(e\). The signature of groups.
(d) \(\mathcal S_{\mathrm{E}}\): one binary relation symbol \(E\). The signature of graphs: \(E(x,y)\) will mean "there is an edge from \(x\) to \(y\)".

For the moment the symbols have no meaning. The sign \(+\) in \(\mathcal S_{\mathrm{ar}}\) is a binary function symbol and nothing more; what it stands for is decided on Day 2, when we interpret the language in a structure. Until then we only need to know, for each symbol, what kind of symbol it is and how many arguments it takes.

Besides the symbols of the signature, every first-order language has the same logical symbols: the variables \(x, y, z, u, v, w, x_1, x_2,\dots\) (infinitely many), the connectives \(\neg,\wedge,\vee,\to\), the quantifiers \(\forall\) ("for all") and \(\exists\) ("there exists"), equality \(=\), parentheses and the comma.

Definition 12.3: terms

The terms of the language with signature \(\mathcal S\) are defined recursively:

  1. every variable is a term, and every constant symbol of \(\mathcal S\) is a term;
  2. if \(f\) is a function symbol of \(\mathcal S\) of arity \(n\) and \(t_1,\dots,t_n\) are terms, then \(f(t_1,\dots,t_n)\) is a term.

Terms are the names of objects: a term denotes an object once the symbols are interpreted.

Example 12.4: terms of \(\mathcal S_{\mathrm{ar}}\)

\(x\), \(0\), \(1\) are terms by clause 1. By clause 2, \(+(1,1)\) is a term, and so are \(\cdot(+(x,1),y)\) and \(+(+(1,1),\cdot(x,x))\). For binary function symbols such as \(+\) and \(\cdot\) we use the usual infix notation and write \(1+1\), \((x+1)\cdot y\), \((1+1)+x\cdot x\), with the usual convention that \(\cdot\) binds more strongly than \(+\). We also write \(2\) for \(1+1\), \(3\) for \((1+1)+1\), and so on. These are abbreviations, not new symbols.

\(x<y\) is not a term: \(<\) is a relation symbol, and relation symbols build formulas, not terms. \((x<y)+1\) is neither a term nor a formula.

Definition 12.5: formulas

The formulas of the language with signature \(\mathcal S\) are defined recursively:

  1. if \(r\) is a relation symbol of \(\mathcal S\) of arity \(n\) and \(t_1,\dots,t_n\) are terms, then \(r(t_1,\dots,t_n)\) is a formula; if \(t_1,t_2\) are terms, then \(t_1=t_2\) is a formula. These are the atomic formulas;
  2. if \(\varphi\) and \(\psi\) are formulas, then \(\neg\varphi\), \((\varphi\wedge\psi)\), \((\varphi\vee\psi)\) and \((\varphi\to\psi)\) are formulas;
  3. if \(\varphi\) is a formula and \(x\) is a variable, then \(\forall x\,\varphi\) and \(\exists x\,\varphi\) are formulas.

\(\varphi\leftrightarrow\psi\) abbreviates \((\varphi\to\psi)\wedge(\psi\to\varphi)\), and \(t\ne s\) abbreviates \(\neg(t=s)\). For binary relation symbols such as \(<\) we write \(x<y\) instead of \(<(x,y)\).

Notation: the language \(\mathcal L(\mathcal S)\)

The set of all formulas built from the symbols of \(\mathcal S\) by Definitions 12.3 and 12.5 is the first-order language over \(\mathcal S\). We write it

\(\mathcal L(\mathcal S)=\mathcal L(\mathcal S;\ \neg,\wedge,\vee,\to,\forall,\exists,=),\)

listing the logical symbols after the semicolon when we want to display them. The signature changes from one application to the next; the logical symbols are the same in every first-order language. So \(\mathcal L(\mathcal S_{\mathrm{ar}})\) is the language of arithmetic, \(\mathcal L(\mathcal S_{\mathrm{gr}})\) the language of groups, and \(\mathcal L(\mathcal S_{\mathrm E})\) the language of graphs. A formula "of \(\mathcal S\)" means a member of \(\mathcal L(\mathcal S)\).

Conventions for parentheses. The outermost parentheses are dropped, as in propositional logic. A quantifier reaches only as far as the next complete formula: \(\forall x\,\varphi\to\psi\) means \((\forall x\,\varphi)\to\psi\). When the quantifier should cover the whole implication, write \(\forall x(\varphi\to\psi)\). When in doubt, put the parentheses in.

Example 12.6: building a formula

In the language \(\mathcal L(\mathcal S_{\mathrm{ar}}\cup\{P\})\), where \(P\) is a new unary relation symbol (to be read "is prime"), consider

\(\forall x\,(1<x\to\exists y\,(x<y\wedge P(y))).\)

It is built as follows. \(1<x\), \(x<y\) and \(P(y)\) are atomic formulas (clause 1). \(x<y\wedge P(y)\) is a formula by clause 2, and \(\exists y\,(x<y\wedge P(y))\) by clause 3. Then \(1<x\to\exists y\,(x<y\wedge P(y))\) by clause 2, and finally the whole formula by clause 3. Figure 1 shows this construction as a tree.

Read aloud: "for every \(x\), if \(1\) is less than \(x\), then there is a \(y\) greater than \(x\) that is prime". Under the intended reading this says that beyond every number greater than \(1\) there is a prime.

∀x → 1 < x ∃y ∧ x < y P(y) quantifier connective atomic formulas (green)
Figure 1. The construction tree of \(\forall x\,(1<x\to\exists y\,(x<y\wedge P(y)))\). The leaves are atomic formulas; each inner node applies one connective or one quantifier to the formulas below it.
Exercise 1: term, formula or neither?

Self-check only. Nothing here counts towards your grade.

The signature has the binary function symbols \(+\) and \(\cdot\), the binary relation symbol \(<\), the unary relation symbol \(P\) and the constant symbols \(0\), \(1\). Decide for each string whether it is a term, a formula, or neither.

(a) term; (b) formula (atomic); (c) neither, \(P\) is a relation symbol and cannot be an argument of \(+\); (d) formula; (e) neither, a quantifier must be followed by a formula and \(x+1\) is a term; (f) term; (g) formula, the repeated \(\forall x\) is allowed by clause 3 even though it is useless; (h) neither, \(x<y\) is a formula and \(<\) needs terms on both sides.

3. From mathematics to formulas

Translating a mathematical statement into a formula has a fixed routine.

  1. Fix the signature and the objects. Decide what the variables range over (numbers, elements of a group, points) and which symbols are available.
  2. Find the quantifier structure. "Every", "all", "any", "each" give \(\forall\); "some", "there is", "there exists", "has a" give \(\exists\). Write the quantifiers in the order in which the English sentence introduces its objects.
  3. Attach the right connective. A universal statement about the objects with a property is \(\forall x(\text{property}(x)\to\dots)\). An existential statement is \(\exists x(\text{property}(x)\wedge\dots)\).
  4. Translate the inner statement with the atomic formulas of the signature. Properties that are not in the signature, such as "prime", are first written as formulas themselves.
  5. Read the formula back and check that it says what the sentence says, with special attention to the order of the quantifiers.
Warning: \(\forall\) goes with \(\to\), \(\exists\) goes with \(\wedge\)

"Every prime is odd" is \(\forall x(P(x)\to O(x))\). The formula \(\forall x(P(x)\wedge O(x))\) says instead that every object is a prime and odd, which is a different and much stronger claim.

"Some prime is even" is \(\exists x(P(x)\wedge E(x))\). The formula \(\exists x(P(x)\to E(x))\) is true as soon as there is any object that is not prime, since an implication with a false antecedent is true. It says almost nothing.

Example 12.7: arithmetic

Language \(\mathcal L(\mathcal S_{\mathrm{ar}})\); the variables range over the natural numbers \(0,1,2,\dots\).

(a) "\(x\) divides \(y\)". There is a number which, multiplied by \(x\), gives \(y\): \(\exists z\,(x\cdot z=y)\). We write \(D(x,y)\) for this formula.
(b) "\(x\) is prime". A prime is a number greater than \(1\) whose only factorizations are trivial: whenever \(y\cdot z=x\), one of the factors is \(1\). So \[P(x):\quad 1<x\wedge\forall y\,\forall z\,(y\cdot z=x\to(y=1\vee z=1)).\] Check: for \(x=4\), the factorization \(2\cdot2=4\) has no factor equal to \(1\), so the inner implication fails and \(4\) is not prime; for \(x=1\) the first conjunct fails.
(c) "There is no largest prime". Two correct translations: \[\neg\exists x\,(P(x)\wedge\forall y\,(P(y)\to(y<x\vee y=x))) \qquad\text{and}\qquad \forall x\,\exists y\,(x<y\wedge P(y)).\] The first denies the existence of a prime that is at least as large as every prime. The second says that beyond every number there is a prime. In the natural numbers both express the same fact; the second is the form that is usually proved.
(d) "\(x\) is even": \(\exists y\,(x=y+y)\). We write \(E(x)\) for this formula.
(e) Goldbach's conjecture, "every even number greater than \(2\) is the sum of two primes": \[\forall x\,\big((E(x)\wedge 2<x)\to\exists y\,\exists z\,(P(y)\wedge P(z)\wedge x=y+z)\big).\] Step 2: the sentence introduces one object universally ("every even number") and then two objects existentially ("two primes"). Step 3: the universal part gets \(\to\), the existential part gets \(\wedge\). Step 4: \(E\), \(P\) and \(2\) are the abbreviations from (b), (d) and Example 12.4; written out in full, the formula uses only the symbols of \(\mathcal S_{\mathrm{ar}}\).
Example 12.8: orders

Language \(\mathcal L(\mathcal S_{\mathrm{ord}})\); the variables range over the elements of some linearly ordered set, such as \(\mathbb N\), \(\mathbb Z\) or \(\mathbb Q\).

(a) "There is a least element": some \(x\) is below or equal to every \(y\): \(\exists x\,\forall y\,(x<y\vee x=y)\).
(b) "There is no greatest element": every \(x\) has something above it: \(\forall x\,\exists y\,(x<y)\).
(c) "The order is dense": between any two elements there is a third: \(\forall x\,\forall y\,(x<y\to\exists z\,(x<z\wedge z<y))\).
(d) "Every element has an immediate successor": for every \(x\) there is a \(y\) above \(x\) with nothing strictly between them: \(\forall x\,\exists y\,(x<y\wedge\neg\exists z\,(x<z\wedge z<y))\).

Statement (a) is true of \(\mathbb N\) and false of \(\mathbb Z\); (c) is true of \(\mathbb Q\) and false of \(\mathbb Z\). The formulas do not know this. They only say something once the symbol \(<\) is interpreted, which is the subject of Day 2.

Example 12.9: a function

Signature: one unary function symbol \(f\). The variables range over the domain of \(f\), which is also its codomain.

(a) "\(f\) is injective": different inputs give different outputs, or equivalently, equal outputs come from equal inputs: \(\forall x\,\forall y\,(f(x)=f(y)\to x=y)\).
(b) "\(f\) is surjective": every \(y\) is an output: \(\forall y\,\exists x\,(f(x)=y)\).
(c) "\(f\) has a fixed point": \(\exists x\,(f(x)=x)\).
(d) "\(f\) is constant": \(\forall x\,\forall y\,(f(x)=f(y))\).
(e) "\(f\) is not injective". Negate (a): \(\neg\forall x\,\forall y\,(f(x)=f(y)\to x=y)\). It is more informative to push the negation inside: "there are two different inputs with the same output", \(\exists x\,\exists y\,(f(x)=f(y)\wedge x\ne y)\). Day 3 shows that the two formulas are logically equivalent.
Example 12.10: continuity, and the order of quantifiers

Signature: binary function symbols \(+\), \(-\), \(\cdot\), a unary function symbol \(|\ |\) (absolute value), the binary relation symbol \(<\), constant symbols \(0\), \(1\), a unary function symbol \(f\) and a constant symbol \(a\). The variables range over the real numbers. We use \(\varepsilon\) and \(\delta\) as variable names.

(a) "\(f\) is continuous at \(a\)": for every positive \(\varepsilon\) there is a positive \(\delta\) such that every \(x\) within \(\delta\) of \(a\) has \(f(x)\) within \(\varepsilon\) of \(f(a)\): \[\forall\varepsilon\,\big(0<\varepsilon\to\exists\delta\,(0<\delta\wedge\forall x\,(|x-a|<\delta\to|f(x)-f(a)|<\varepsilon))\big).\] Step 3 is visible twice: "for every positive \(\varepsilon\)" became \(\forall\varepsilon(0<\varepsilon\to\dots)\), and "there is a positive \(\delta\)" became \(\exists\delta(0<\delta\wedge\dots)\).
(b) "\(f\) is continuous" (at every point): replace the constant \(a\) by a variable and quantify it first: \[\forall a\,\forall\varepsilon\,\big(0<\varepsilon\to\exists\delta\,(0<\delta\wedge\forall x\,(|x-a|<\delta\to|f(x)-f(a)|<\varepsilon))\big).\]
(c) "\(f\) is uniformly continuous": the same, except that \(\delta\) is chosen before \(a\), so that one \(\delta\) works for all points at once: \[\forall\varepsilon\,\big(0<\varepsilon\to\exists\delta\,(0<\delta\wedge\forall a\,\forall x\,(|x-a|<\delta\to|f(x)-f(a)|<\varepsilon))\big).\]

Formulas (b) and (c) contain the same atomic formulas and the same connectives. They differ only in the position of \(\forall a\): before \(\exists\delta\) in (b), after it in (c). This single change is the difference between continuity and uniform continuity. The function \(f(x)=x^2\) on \(\mathbb R\) satisfies (b) but not (c).

Warning: the order of different quantifiers matters

\(\forall x\,\exists y\,R(x,y)\) says: for each \(x\) there is a \(y\), possibly a different \(y\) for each \(x\). \(\exists y\,\forall x\,R(x,y)\) says: one \(y\) works for all \(x\) at once. With \(R(x,y)\) read as "\(x<y\)" on the natural numbers, the first is true (take \(y=x+1\)) and the second is false (no number is above all numbers). In a formula, a quantified variable may depend on the variables quantified before it, never on those quantified after it.

Example 12.11: groups

Language \(\mathcal L(\mathcal S_{\mathrm{gr}})\). The three group axioms are the sentences

(G1) \(\forall x\,\forall y\,\forall z\,((x\cdot y)\cdot z=x\cdot(y\cdot z))\),
(G2) \(\forall x\,(x\cdot e=x\wedge e\cdot x=x)\),
(G3) \(\forall x\,\exists y\,(x\cdot y=e\wedge y\cdot x=e)\).

We write \(\Gamma_{\mathrm{gr}}=\{\text{(G1)},\text{(G2)},\text{(G3)}\}\).

(a) "The identity element is unique": any \(u\) that behaves like \(e\) is \(e\): \(\forall u\,(\forall x\,(x\cdot u=x\wedge u\cdot x=x)\to u=e)\).
(b) "Inverses are unique": \(\forall x\,\forall y\,\forall z\,((x\cdot y=e\wedge x\cdot z=e)\to y=z)\).
(c) "The group is commutative": \(\forall x\,\forall y\,(x\cdot y=y\cdot x)\).

Statements (a) and (b) are theorems of group theory: they hold in every group. Statement (c) holds in some groups and fails in others. On Day 3 we will see that this difference is a difference between \(\Gamma_{\mathrm{gr}}\models\varphi\) and \(\Gamma_{\mathrm{gr}}\not\models\varphi\).

Example 12.12: counting with equality

Equality lets a formula say how many objects there are. Signature: one unary relation symbol \(P\).

(a) "There are at least two objects": \(\exists x\,\exists y\,(x\ne y)\).
(b) "There are at least three objects": \(\exists x\,\exists y\,\exists z\,(x\ne y\wedge x\ne z\wedge y\ne z)\). Without the inequalities the formula would be satisfied by a single object named three times.
(c) "At most one object has property \(P\)": any two objects with \(P\) are the same object: \(\forall x\,\forall y\,((P(x)\wedge P(y))\to x=y)\).
(d) "Exactly one object has property \(P\)": there is one, and any object with \(P\) is that one: \(\exists x\,(P(x)\wedge\forall y\,(P(y)\to y=x))\).

4. Statements from physics, and reading formulas

Physical laws are statements about all bodies, all times or all systems of a certain kind. They translate by the same routine. The signature is chosen for the statement at hand.

Example 12.13: four laws

Signature: unary relation symbols \(B\) ("is a body"), \(V\) ("moves with constant velocity"), \(C\) ("is charged"), \(I\) ("is an isolated system"); binary relation symbols \(A\) (\(A(f,b)\): "force \(f\) acts on \(b\)"), \(\mathit{In}\) (\(\mathit{In}(p,E)\): "\(p\) is in the electric field \(E\)"), \(G\) (\(G(x,y)\): "\(x\) attracts \(y\)"); a binary function symbol \(\mathit{En}\) (\(\mathit{En}(s,t)\): "the energy of \(s\) at time \(t\)"). The variables range over all physical things under discussion: bodies, forces, fields, times, numbers.

(a) Newton's first law: "a body on which no force acts moves with constant velocity": \[\forall b\,\big((B(b)\wedge\neg\exists f\,A(f,b))\to V(b)\big).\]
(b) Universal gravitation: "any two distinct bodies attract each other": \[\forall x\,\forall y\,\big((B(x)\wedge B(y)\wedge x\ne y)\to(G(x,y)\wedge G(y,x))\big).\]
(c) "Every charged particle in an electric field experiences a force": \[\forall p\,\forall E\,\big((C(p)\wedge\mathit{In}(p,E))\to\exists f\,A(f,p)\big).\]
(d) Conservation of energy: "the energy of an isolated system is the same at all times": \[\forall s\,\big(I(s)\to\forall t\,\forall u\,(\mathit{En}(s,t)=\mathit{En}(s,u))\big).\] Here a function symbol and equality do the work: the law says that two values of the function agree.

All four laws have the shape \(\forall\dots(\dots\to\dots)\): a universal statement about the objects of a certain kind. The order of quantifiers matters here as in mathematics. "Every body has some force acting on it", \(\forall b\,\exists f\,A(f,b)\), is not the statement "some force acts on every body", \(\exists f\,\forall b\,A(f,b)\).

The other direction, reading a formula as an English sentence, follows the tree of the formula from the root: read the outermost quantifier or connective first, then its parts.

Example 12.14: from formulas to English

Language \(\mathcal L(\mathcal S_{\mathrm{ar}})\) with the abbreviation \(P\) of Example 12.7; the variables range over the natural numbers.

(a) \(\forall x\,\exists y\,(x<y)\): "for every number there is a larger one", that is, "there is no largest number".
(b) \(\exists y\,\forall x\,(x<y\vee x=y)\): "there is a number that every number is below or equal to", that is, "there is a largest number". False of the natural numbers, while (a) is true. The two formulas differ only in the order of the quantifiers.
(c) \(\forall x\,\exists y\,(x<y\wedge P(y)\wedge P(y+2))\): "beyond every number there is a prime \(y\) such that \(y+2\) is also prime", that is, "there are infinitely many twin primes". This is the twin prime conjecture, an open problem.
(d) \(\forall x\,(P(x)\to\exists y\,\exists z\,(x=y\cdot z\wedge y\ne1\wedge z\ne1))\): "every prime is a product of two numbers different from \(1\)". This is false: it contradicts the definition of prime. A formula need not be true to be read.
Exercise 2: choose the correct translation

Self-check only. Nothing here counts towards your grade.

For each English statement, exactly one of the three formulas is a correct translation. The signature has a binary relation symbol \(<\), unary relation symbols \(P\) ("is prime") and \(E\) ("is even"), a unary function symbol \(f\) and the binary function symbol \(+\). The variables range over the natural numbers.

(a) (ii). The statement is universal, so "even and greater than \(2\)" is the antecedent of an implication; (i) uses \(\wedge\) and claims that every number is even and greater than \(2\), (iii) says only that some even number greater than \(2\) is not prime.

(b) (iii). "Some prime" is existential and needs \(\wedge\); (i) is a universal statement, (ii) uses \(\to\) inside \(\exists\) and is true as soon as some number is not prime.

(c) (i). "For every \(x\) there is a \(y\)": the universal quantifier comes first; (ii) says that one \(y\) is above all \(x\), (iii) says that there is some \(x\) with a larger number, which is much weaker.

(d) (ii). "Equal outputs come from equal inputs" is \(\forall x\forall y(f(x)=f(y)\to x=y)\); (i) says that \(f\) is constant, (iii) says that \(f\) is surjective.

Exercise 3: read the formula

Self-check only. Nothing here counts towards your grade.

Signature as in Exercise 2, variables over the natural numbers. For each formula choose the English sentence that says the same thing.

(a) (iii): \(\exists y\) comes first, so one \(y\) is claimed to be below or equal to every \(x\); this is "there is a least number".

(b) (i): for every \(x\) a prime \(y\) above \(x\) exists; "there are infinitely many primes".

(c) (ii): the formula is \(\forall x(\dots\to\dots)\) with antecedent \(E(x)\) and consequent "\(x+1\) is not even"; "the successor of an even number is odd".

Day 2: Free and bound variables; structures and truth

Today we define scope, free and bound variables and substitution, and then we give the formulas a meaning: a structure interprets the symbols, and we compute whether a sentence is true in it.

5. Scope, free and bound variables, substitution

In \(\forall x\,\exists y\,(x<y)\) the variables \(x\) and \(y\) are placeholders; the formula is about nothing in particular and is simply true or false once \(<\) is interpreted. In \(\exists y\,(x<y)\) the variable \(y\) is again a placeholder, but \(x\) is not: the formula says something about \(x\), and whether it holds depends on which object \(x\) stands for. This is the difference between bound and free variables.

Definition 12.15: scope, bound and free occurrences, sentences

In a formula \(\forall x\,\varphi\) or \(\exists x\,\varphi\), the formula \(\varphi\) is the scope of that quantifier. An occurrence of a variable \(x\) in a formula is bound if it is inside the scope of a quantifier \(\forall x\) or \(\exists x\) (or is the \(x\) written right after such a quantifier); otherwise the occurrence is free. The set \(FV(\varphi)\) of free variables of \(\varphi\) is defined recursively:

  • \(FV(r(t_1,\dots,t_n))\) and \(FV(t_1=t_2)\) are the sets of variables occurring in the terms;
  • \(FV(\neg\varphi)=FV(\varphi)\); \(FV(\varphi\wedge\psi)=FV(\varphi\vee\psi)=FV(\varphi\to\psi)=FV(\varphi)\cup FV(\psi)\);
  • \(FV(\forall x\,\varphi)=FV(\exists x\,\varphi)=FV(\varphi)\setminus\{x\}\).

A formula with no free variables, \(FV(\varphi)=\varnothing\), is a sentence.

Example 12.16: free variables
(a) \(\forall x\,\exists y\,(x<y)\): \(FV(x<y)=\{x,y\}\), \(FV(\exists y\,(x<y))=\{x\}\), \(FV(\forall x\,\exists y\,(x<y))=\varnothing\). A sentence.
(b) \(\exists y\,(x<y)\): \(FV=\{x\}\). Not a sentence.
(c) \(\forall x\,(P(x)\to\exists y\,R(x,y))\wedge Q(x)\). The scope of \(\forall x\) is \(P(x)\to\exists y\,R(x,y)\) only; the final \(Q(x)\) is outside it. So the first two occurrences of \(x\) (after the quantifier and in \(P(x)\)) and the one in \(R(x,y)\) are bound, and the occurrence in \(Q(x)\) is free: \(FV=\{x\}\). Figure 2 shows the scopes.
(d) \(\forall x\,(x<y)\to\exists y\,(x<y)\). The scope of \(\forall x\) is \(x<y\), so this \(x\) is bound and this \(y\) is free. The scope of \(\exists y\) is the second \(x<y\), so there \(y\) is bound and \(x\) is free. \(FV=\{x,y\}\). The same variable can have free and bound occurrences in one formula.
∀x ( P(x) → ∃y R(x,y) ) ∧ Q(x) scope of ∀x scope of ∃y bound occurrences of x point to ∀x, the occurrence of y in R(x,y) to ∃y free
Figure 2. Scopes in \(\forall x\,(P(x)\to\exists y\,R(x,y))\wedge Q(x)\). The last \(x\) lies outside the scope of \(\forall x\), so it is free; the formula is not a sentence.

Free variables are the places where a formula can be fed an object. Feeding it is substitution: replace the free occurrences of \(x\) by a term \(t\).

Definition 12.17: substitution, and "free for"

For a formula \(\varphi\), a variable \(x\) and a term \(t\), the formula \(\varphi[t/x]\) is the result of replacing every free occurrence of \(x\) in \(\varphi\) by \(t\). Bound occurrences are not touched.

The term \(t\) is free for \(x\) in \(\varphi\) if no variable of \(t\) becomes bound by the substitution, that is, no free occurrence of \(x\) in \(\varphi\) lies in the scope of a quantifier \(\forall y\) or \(\exists y\) for a variable \(y\) that occurs in \(t\).

Example 12.18: substitutions, good and bad
(a) \((\exists y\,(x<y))[0/x]=\exists y\,(0<y)\). The constant \(0\) has no variables, so it is free for \(x\). The result says "something is above \(0\)".
(b) \((\exists y\,(x<y))[z+1/x]=\exists y\,(z+1<y)\). The variable \(z\) does not get bound, so \(z+1\) is free for \(x\).
(c) \((\exists y\,(x<y))[y/x]=\exists y\,(y<y)\). Here \(y\) is not free for \(x\): the substituted \(y\) falls into the scope of \(\exists y\) and is captured. The formula \(\exists y\,(x<y)\) says "something is above \(x\)", which is true of every natural number \(x\); the result \(\exists y\,(y<y)\) says "something is below itself", which is false. Substituting a term that is not free changes the meaning.
(d) \((x<y\to\forall x\,P(x))[0/x]=(0<y\to\forall x\,P(x))\). Only the free occurrence of \(x\) is replaced; the bound occurrences in \(\forall x\,P(x)\) stay.
Warning: check "free for" before you substitute

Whenever a term \(t\) is substituted for \(x\), check that no variable of \(t\) gets captured by a quantifier. If one does, rename the bound variable first: \(\exists y\,(x<y)\) says the same as \(\exists w\,(x<w)\), and now \(y\) is free for \(x\) in it. Next week, a rule of deduction will carry this side condition.

Exercise 4: free or bound?

Self-check only. Nothing here counts towards your grade.

In each formula the variable occurrences are numbered from left to right (the variable written right after a quantifier is not numbered). Mark every numbered occurrence as free or bound.

(a) \(\forall x\,(R(x_1,y_2)\to\exists y\,R(y_3,x_4))\): 1 bound, 2 free, 3 bound, 4 bound. The scope of \(\forall x\) is the whole implication, so both \(x\) are bound; the first \(y\) is outside \(\exists y\).

(b) \(\exists x\,P(x_1)\wedge Q(x_2)\): 1 bound, 2 free. The scope of \(\exists x\) is \(P(x)\) only.

(c) \(\forall x\,\exists y\,(x_1<y_2)\vee x_3=y_4\): 1 bound, 2 bound, 3 free, 4 free. The scope of \(\forall x\,\exists y\) ends at the closing parenthesis.

(d) \(\forall y\,(y_1<x_2\to\exists x\,(y_3<x_4))\): 1 bound, 2 free, 3 bound, 4 bound. The occurrence \(x_2\) is before \(\exists x\) and outside any quantifier on \(x\).

Exercise 5: substitution

Self-check only. Nothing here counts towards your grade.

Write the result of each substitution, and say whether the term is free for the variable. Type \(\forall\) and \(\exists\) with the buttons, \(\neg\) as ~, \(\wedge\) as &, \(\vee\) as \/, \(\to\) as ->. Write the formula exactly as the definition produces it; the check compares the structure of the formula, not the spacing.

(a) \(\exists y\,(f(z)<y)\); \(f(z)\) is free for \(x\), since \(z\) is not captured.

(b) \(\exists y\,(f(y)<y)\); \(f(y)\) is not free for \(x\): \(y\) is captured by \(\exists y\).

(c) \(P(y)\to\forall x\,Q(x)\); only the free \(x\) is replaced; \(y\) is free for \(x\).

(d) \(\forall z\,(z<x+1\to\exists y\,(y<x+1))\); \(x+1\) is free for \(w\), since neither \(z\) nor \(y\) occurs in \(x+1\).

6. Structures

A formula acquires a meaning when we say what the objects are and what the symbols stand for. This is a structure.

Definition 12.19: structure

Let \(\mathcal S\) be a signature. An \(\mathcal S\)-structure \(\mathcal A\) consists of

  • a non-empty set \(A\), the domain (or universe) of \(\mathcal A\);
  • for each function symbol \(f\) of arity \(n\), a function \(f^{\mathcal A}:A^n\to A\);
  • for each relation symbol \(r\) of arity \(n\), a relation \(r^{\mathcal A}\subseteq A^n\), that is, a set of \(n\)-tuples of elements of \(A\);
  • for each constant symbol \(c\), an element \(c^{\mathcal A}\in A\).

\(f^{\mathcal A}\), \(r^{\mathcal A}\), \(c^{\mathcal A}\) are the interpretations of the symbols in \(\mathcal A\). The symbol \(=\) is always interpreted as actual equality of elements of \(A\). An \(\mathcal S\)-structure gives a meaning to every formula of \(\mathcal L(\mathcal S)\) and to no other formulas.

Example 12.20: structures for the signatures of Example 12.2
(a) \(\mathcal N=(\mathbb N;+,\cdot,<,0,1)\): domain the natural numbers, \(+^{\mathcal N}\) and \(\cdot^{\mathcal N}\) the usual addition and multiplication, \(<^{\mathcal N}\) the set of pairs \((m,n)\) with \(m\) less than \(n\), \(0^{\mathcal N}=0\), \(1^{\mathcal N}=1\). This is the standard \(\mathcal S_{\mathrm{ar}}\)-structure. \(\mathcal Z\) and \(\mathcal Q\), with the integers and the rationals as domains and the usual operations, are two other \(\mathcal S_{\mathrm{ar}}\)-structures.
(b) \(\mathcal M\): domain \(\mathbb N\), but \(+^{\mathcal M}\) is multiplication, \(\cdot^{\mathcal M}\) is addition, \(<^{\mathcal M}\) is "greater than", and \(0^{\mathcal M}=1\), \(1^{\mathcal M}=0\). This is a perfectly good \(\mathcal S_{\mathrm{ar}}\)-structure. The symbols do not carry their usual meaning with them; the structure assigns the meaning.
(c) The \(\mathcal S_{\mathrm{E}}\)-structure \(\mathcal G\) of Figure 3: domain \(\{0,1,2,3\}\) and \(E^{\mathcal G}=\{(0,1),(1,2),(2,0),(2,3),(3,3)\}\). A finite structure for a signature with only relation symbols can be given completely by a picture or a table.
(d) The \(\mathcal S_{\mathrm{ord}}\)-structure \(\mathcal T\): domain \(\{0,1,2\}\), and \(<^{\mathcal T}=\{(0,1),(1,2),(2,0)\}\). Nothing forces the interpretation of \(<\) to be an order; here it is a cycle.
0 1 2 3
Figure 3. The structure \(\mathcal G\): domain \(\{0,1,2,3\}\), and \(E^{\mathcal G}\) is the set of arrows \(\{(0,1),(1,2),(2,0),(2,3),(3,3)\}\). An arrow from \(a\) to \(b\) means \((a,b)\in E^{\mathcal G}\).

A structure gives every closed term (a term without variables) a value, and every sentence a truth value. Terms first.

Definition 12.21: value of a closed term

Let \(\mathcal A\) be an \(\mathcal S\)-structure. The value \([\![t]\!]_{\mathcal A}\in A\) of a closed term \(t\) is defined recursively: \([\![c]\!]_{\mathcal A}=c^{\mathcal A}\) for a constant symbol \(c\), and \([\![f(t_1,\dots,t_n)]\!]_{\mathcal A}=f^{\mathcal A}([\![t_1]\!]_{\mathcal A},\dots,[\![t_n]\!]_{\mathcal A})\).

Example 12.22: the same term in two structures

Let \(t\) be the term \((1+1)\cdot(1+1)\).

(a) In \(\mathcal N\): \([\![1+1]\!]_{\mathcal N}=1+1=2\), so \([\![t]\!]_{\mathcal N}=2\cdot2=4\).
(b) In \(\mathcal M\) of Example 12.20(b): \(1^{\mathcal M}=0\), and \(+^{\mathcal M}\) is multiplication, so \([\![1+1]\!]_{\mathcal M}=0\cdot0=0\). Then \(\cdot^{\mathcal M}\) is addition, so \([\![t]\!]_{\mathcal M}=0+0=0\).

For sentences we need to say when \(\forall x\,\varphi\) is true: when \(\varphi\) holds of every element \(a\) of the domain. To state "\(\varphi\) holds of \(a\)" as a sentence, we give \(a\) a name. For every element \(a\in A\) we add a new constant symbol \(\bar a\) to the language, interpreted as \(a\) itself. Then \(\varphi[\bar a/x]\) is a sentence that says of \(a\) what \(\varphi\) says of \(x\).

Definition 12.23: truth of a sentence in a structure

Let \(\mathcal A\) be an \(\mathcal S\)-structure, with a name \(\bar a\) for each \(a\in A\); write \(\mathcal S_A\) for the signature \(\mathcal S\) together with these names. For sentences \(\varphi\) of \(\mathcal L(\mathcal S_A)\) we define \(\varphi\) is true in \(\mathcal A\), written \(\mathcal A\models\varphi\), recursively:

  • \(\mathcal A\models r(t_1,\dots,t_n)\) iff \(([\![t_1]\!]_{\mathcal A},\dots,[\![t_n]\!]_{\mathcal A})\in r^{\mathcal A}\); \(\ \mathcal A\models t_1=t_2\) iff \([\![t_1]\!]_{\mathcal A}=[\![t_2]\!]_{\mathcal A}\);
  • \(\mathcal A\models\neg\varphi\) iff \(\mathcal A\not\models\varphi\); \(\ \mathcal A\models\varphi\wedge\psi\) iff both; \(\ \mathcal A\models\varphi\vee\psi\) iff at least one; \(\ \mathcal A\models\varphi\to\psi\) iff \(\mathcal A\not\models\varphi\) or \(\mathcal A\models\psi\);
  • \(\mathcal A\models\forall x\,\varphi\) iff \(\mathcal A\models\varphi[\bar a/x]\) for every \(a\in A\);
  • \(\mathcal A\models\exists x\,\varphi\) iff \(\mathcal A\models\varphi[\bar a/x]\) for some \(a\in A\).

We say \(\mathcal A\) is a model of \(\varphi\) when \(\mathcal A\models\varphi\). For a formula \(\varphi\) with free variables \(x_1,\dots,x_n\) we set \(\mathcal A\models\varphi\) iff \(\mathcal A\models\forall x_1\cdots\forall x_n\,\varphi\): a formula with free variables is true in \(\mathcal A\) when it holds of all elements.

The clauses for the connectives are the truth tables of propositional logic. The two new clauses say that \(\forall x\) is a conjunction over the whole domain and \(\exists x\) is a disjunction over the whole domain. In a finite structure these are finite conjunctions and disjunctions, and truth can be computed mechanically. In an infinite structure, truth is established by an argument.

Example 12.24: computing truth values
(a) \(\mathcal N\models\forall x\,\exists y\,(x<y)\). Take an arbitrary \(a\in\mathbb N\). We need \(\mathcal N\models\exists y\,(\bar a<y)\), that is, some \(b\) with \(\mathcal N\models\bar a<\bar b\), that is, \(a<b\). The number \(b=a+1\) works. Since \(a\) was arbitrary, the universal sentence is true.
(b) \(\mathcal N\not\models\exists y\,\forall x\,(x<y\vee x=y)\). Take any \(b\in\mathbb N\). Is \(\mathcal N\models\forall x\,(x<\bar b\vee x=\bar b)\)? For \(a=b+1\) the sentence \(\bar a<\bar b\vee\bar a=\bar b\) is false, so no. As no \(b\) works, the existential sentence is false.
(c) The sentence \(\lambda=\exists x\,\forall y\,\neg(y<x)\) ("there is an element with nothing below it") is true in \(\mathcal N\) (take \(x=0\)) and false in \(\mathcal Z\) (below every integer \(b\) lies \(b-1\)). One sentence distinguishes the two structures.
(d) In the structure \(\mathcal G\) of Figure 3:
  • \(\mathcal G\models\forall x\,\exists y\,E(x,y)\): check each of the four elements. \(0\to1\), \(1\to2\), \(2\to0\), \(3\to3\). Every element has an outgoing arrow, so the sentence is true.
  • \(\mathcal G\models\exists x\,E(x,x)\): \((3,3)\in E^{\mathcal G}\). True.
  • \(\mathcal G\not\models\exists y\,\forall x\,E(x,y)\): for \(y=0\) we would need \((0,0)\), which is missing; for \(y=1\) we need \((1,1)\); for \(y=2\), \((2,2)\); for \(y=3\), \((0,3)\). Each candidate fails, so the sentence is false.
  • \(\mathcal G\not\models\forall x\,\forall y\,(E(x,y)\to E(y,x))\): \((0,1)\in E^{\mathcal G}\) but \((1,0)\notin E^{\mathcal G}\). One pair that fails is enough.
(e) In the structure \(\mathcal T\) of Example 12.20(d), \(\mathcal T\models\forall x\,\exists y\,(x<y)\wedge\neg\exists y\,\forall x\,(x<y)\): every element has a successor in the cycle \(0\to1\to2\to0\), and no element is above all three (no element is above itself). So \(\mathcal T\) is a model of Example 12.8(b) although \(<^{\mathcal T}\) is not an order at all.
Exercise 6: build a structure

Self-check only. Nothing here counts towards your grade.

The domain is \(\{0,1,2\}\) and the signature has one binary relation symbol \(E\). Tick the pairs that belong to \(E^{\mathcal A}\) (a tick in row \(a\), column \(b\) means \((a,b)\in E^{\mathcal A}\)). Build a structure \(\mathcal A\) in which

  • \(\forall x\,\exists y\,E(x,y)\) is true,
  • \(\exists y\,\forall x\,E(x,y)\) is false, and
  • \(\forall x\,\neg E(x,x)\) is true.

There are several correct answers; the page computes the three truth values for your structure.

One answer is the cycle \(E^{\mathcal A}=\{(0,1),(1,2),(2,0)\}\). Every element has an arrow out of it, so \(\forall x\exists y\,E(x,y)\) holds. No element receives arrows from all three elements (it would have to receive one from itself), so \(\exists y\forall x\,E(x,y)\) fails. No pair \((a,a)\) is ticked, so \(\forall x\,\neg E(x,x)\) holds. Another answer: \(\{(0,1),(1,0),(2,0)\}\).

Day 3: Validity, satisfiability and semantic consequence

Today we define \(\models\) between sets of sentences and sentences, prove consequences by arguing about an arbitrary structure, and refute them with countermodels.

7. Validity, satisfiability and consequence

In propositional logic a valuation assigns truth values to the primitive propositions, and \(\models\) was defined by looking at all valuations. In first-order logic the role of a valuation is played by a structure. The definitions are the same with "structure" in place of "valuation".

Definition 12.25: satisfiable, valid, \(\Gamma\models\varphi\), equivalent

Let \(\Gamma\) be a set of sentences and \(\varphi,\psi\) sentences, all in \(\mathcal L(\mathcal S)\) for a signature \(\mathcal S\). Structures are \(\mathcal S\)-structures.

  • \(\mathcal A\models\Gamma\) means \(\mathcal A\models\gamma\) for every \(\gamma\in\Gamma\); \(\mathcal A\) is a model of \(\Gamma\).
  • \(\Gamma\) is satisfiable if it has a model.
  • \(\varphi\) is valid, written \(\models\varphi\), if \(\mathcal A\models\varphi\) for every structure \(\mathcal A\).
  • \(\varphi\) is a semantic consequence of \(\Gamma\), written \(\Gamma\models\varphi\), if every model of \(\Gamma\) is a model of \(\varphi\).
  • \(\varphi\) and \(\psi\) are logically equivalent, written \(\varphi\equiv\psi\), if they have the same truth value in every structure, that is, \(\{\varphi\}\models\psi\) and \(\{\psi\}\models\varphi\).

For formulas with free variables these notions are applied to their universal closures, as in Definition 12.23.

Warning: there is no truth table

A propositional formula has finitely many valuations, and a table settles everything. A first-order sentence has infinitely many structures, of every size. To show \(\models\varphi\) or \(\Gamma\models\varphi\), take an arbitrary structure and argue from the definition. To show \(\not\models\varphi\) or \(\Gamma\not\models\varphi\), exhibit one structure, a countermodel, in which \(\Gamma\) holds and \(\varphi\) fails. Small finite structures are often enough.

Example 12.26: valid sentences, consequences, and countermodels

Signature: a unary relation symbol \(P\), a unary relation symbol \(Q\), a binary relation symbol \(E\), a constant symbol \(c\).

(a) \(\models\forall x\,P(x)\to P(c)\). Let \(\mathcal A\) be any structure. If \(\mathcal A\not\models\forall x\,P(x)\), the implication is true. If \(\mathcal A\models\forall x\,P(x)\), then \(\mathcal A\models P(\bar a)\) for every \(a\in A\), in particular for \(a=c^{\mathcal A}\), and \(P(\bar a)\) and \(P(c)\) have the same truth value since both name the same element. So \(\mathcal A\models P(c)\). Either way the implication holds in \(\mathcal A\).
(b) \(\models\forall x\,P(x)\to\exists x\,P(x)\). If \(\mathcal A\models\forall x\,P(x)\), pick any \(a\in A\); the domain is non-empty, so there is one. Then \(\mathcal A\models P(\bar a)\), hence \(\mathcal A\models\exists x\,P(x)\). The non-empty domain is essential: with an empty domain the antecedent would be true and the consequent false.
(c) \(\not\models\exists x\,P(x)\to\forall x\,P(x)\). Countermodel: \(A=\{0,1\}\), \(P^{\mathcal A}=\{0\}\). Then \(P(\bar 0)\) is true, so the antecedent holds; \(P(\bar 1)\) is false, so the consequent fails.
(d) \(\{\forall x\,(P(x)\to Q(x)),\ \forall x\,P(x)\}\models\forall x\,Q(x)\). Let \(\mathcal A\) be a model of both premises and let \(a\in A\) be arbitrary. From the second premise, \(\mathcal A\models P(\bar a)\). From the first, \(\mathcal A\models P(\bar a)\to Q(\bar a)\). So \(\mathcal A\models Q(\bar a)\). As \(a\) was arbitrary, \(\mathcal A\models\forall x\,Q(x)\).
(e) \(\{\forall x\,\exists y\,E(x,y)\}\not\models\exists y\,\forall x\,E(x,y)\). Countermodel: \(A=\{0,1\}\), \(E^{\mathcal A}=\{(0,1),(1,0)\}\) (Figure 4). Every element has an arrow out of it, so the premise holds. For the conclusion, \(y=0\) would need \((0,0)\in E^{\mathcal A}\) and \(y=1\) would need \((1,1)\in E^{\mathcal A}\); neither pair is there. So the conclusion fails.
0 1 (0,1) (1,0)
Figure 4. The countermodel of Example 12.26(e): \(E^{\mathcal A}=\{(0,1),(1,0)\}\). Each element points somewhere, but no element is pointed to by every element.

8. Equivalences between quantified formulas

Proposition 12.27: quantifier laws

For all formulas \(\varphi,\psi\) and variables \(x,y\):

(a) \(\neg\forall x\,\varphi\equiv\exists x\,\neg\varphi\) and \(\neg\exists x\,\varphi\equiv\forall x\,\neg\varphi\).
(b) \(\forall x\,\forall y\,\varphi\equiv\forall y\,\forall x\,\varphi\) and \(\exists x\,\exists y\,\varphi\equiv\exists y\,\exists x\,\varphi\).
(c) \(\forall x\,(\varphi\wedge\psi)\equiv\forall x\,\varphi\wedge\forall x\,\psi\) and \(\exists x\,(\varphi\vee\psi)\equiv\exists x\,\varphi\vee\exists x\,\psi\).
(d) \(\{\exists x\,\forall y\,\varphi\}\models\forall y\,\exists x\,\varphi\).
(e) If \(x\) is not free in \(\psi\): \(\forall x\,(\varphi\to\psi)\equiv\exists x\,\varphi\to\psi\) and \(\forall x\,(\psi\to\varphi)\equiv\psi\to\forall x\,\varphi\).

Proof. We prove the first half of (a), the first half of (c) and (d); the others are similar. Throughout, \(\mathcal A\) is an arbitrary structure, and we may assume the formulas are sentences apart from the variables shown (otherwise take universal closures).

(a) \(\mathcal A\models\neg\forall x\,\varphi\) iff \(\mathcal A\not\models\forall x\,\varphi\) iff it is not the case that \(\mathcal A\models\varphi[\bar a/x]\) for every \(a\in A\) iff for some \(a\in A\), \(\mathcal A\not\models\varphi[\bar a/x]\) iff for some \(a\in A\), \(\mathcal A\models\neg\varphi[\bar a/x]\) iff \(\mathcal A\models\exists x\,\neg\varphi\).

(c) \(\mathcal A\models\forall x\,(\varphi\wedge\psi)\) iff for every \(a\), both \(\mathcal A\models\varphi[\bar a/x]\) and \(\mathcal A\models\psi[\bar a/x]\) iff (for every \(a\), \(\mathcal A\models\varphi[\bar a/x]\)) and (for every \(a\), \(\mathcal A\models\psi[\bar a/x]\)) iff \(\mathcal A\models\forall x\,\varphi\) and \(\mathcal A\models\forall x\,\psi\). The middle step uses that "for all \(a\), (\(S(a)\) and \(T(a)\))" says the same as "(for all \(a\), \(S(a)\)) and (for all \(a\), \(T(a)\))".

(d) Suppose \(\mathcal A\models\exists x\,\forall y\,\varphi\): there is \(a\in A\) with \(\mathcal A\models\varphi[\bar a/x][\bar b/y]\) for every \(b\in A\). Now let \(b\in A\) be arbitrary. The same \(a\) gives \(\mathcal A\models\varphi[\bar b/y][\bar a/x]\), so \(\mathcal A\models\exists x\,\varphi[\bar b/y]\). As \(b\) was arbitrary, \(\mathcal A\models\forall y\,\exists x\,\varphi\). □

Two tempting "laws" are false, and (d) does not reverse.

Example 12.28: equivalences that fail

Signature: unary relation symbols \(P\), \(Q\), binary relation symbol \(E\). In every part the countermodel is \(A=\{0,1\}\) with \(P^{\mathcal A}=\{0\}\), \(Q^{\mathcal A}=\{1\}\), \(E^{\mathcal A}=\{(0,1),(1,0)\}\).

(a) \(\forall x\,(P(x)\vee Q(x))\not\equiv\forall x\,P(x)\vee\forall x\,Q(x)\). Left: \(0\) satisfies \(P\) and \(1\) satisfies \(Q\), so every element satisfies \(P\vee Q\); true. Right: \(\forall x\,P(x)\) fails at \(1\) and \(\forall x\,Q(x)\) fails at \(0\); false. The right side does imply the left side in every structure, so \(\{\forall x\,P(x)\vee\forall x\,Q(x)\}\models\forall x\,(P(x)\vee Q(x))\) holds, and only the other direction fails.
(b) \(\exists x\,(P(x)\wedge Q(x))\not\equiv\exists x\,P(x)\wedge\exists x\,Q(x)\). Right: true, witnessed by \(0\) and by \(1\). Left: no element satisfies both; false. Here the left side implies the right side, not conversely.
(c) \(\{\forall y\,\exists x\,E(x,y)\}\not\models\exists x\,\forall y\,E(x,y)\). Premise: \(0\) is pointed to by \(1\) and \(1\) by \(0\); true. Conclusion: no element points to both; false. So the converse of Proposition 12.27(d) fails.

The laws in Proposition 12.27(a) are used constantly in mathematics to move a negation inside a definition.

Example 12.29: what it means to be discontinuous

From Example 12.10(a), "\(f\) is continuous at \(a\)" is \(\forall\varepsilon\,(0<\varepsilon\to\exists\delta\,(0<\delta\wedge\forall x\,(|x-a|<\delta\to|f(x)-f(a)|<\varepsilon)))\). We negate it and push \(\neg\) inside, one step at a time, using Proposition 12.27(a) for the quantifiers and the propositional equivalences \(\neg(\alpha\to\beta)\equiv\alpha\wedge\neg\beta\) and \(\neg(\alpha\wedge\beta)\equiv\alpha\to\neg\beta\):

\(\neg\forall\varepsilon\,(0<\varepsilon\to\dots)\equiv\exists\varepsilon\,\neg(0<\varepsilon\to\dots)\equiv\exists\varepsilon\,(0<\varepsilon\wedge\neg\exists\delta\,(0<\delta\wedge\dots))\)

\(\equiv\exists\varepsilon\,(0<\varepsilon\wedge\forall\delta\,\neg(0<\delta\wedge\forall x\,(\dots)))\equiv\exists\varepsilon\,(0<\varepsilon\wedge\forall\delta\,(0<\delta\to\neg\forall x\,(|x-a|<\delta\to|f(x)-f(a)|<\varepsilon)))\)

\(\equiv\exists\varepsilon\,\big(0<\varepsilon\wedge\forall\delta\,(0<\delta\to\exists x\,(|x-a|<\delta\wedge\neg(|f(x)-f(a)|<\varepsilon)))\big).\)

Read back: there is a positive \(\varepsilon\) such that for every positive \(\delta\) some \(x\) within \(\delta\) of \(a\) has \(f(x)\) at distance at least \(\varepsilon\) from \(f(a)\). This is exactly the statement one proves to show that a function is discontinuous at a point. Each quantifier flipped, and each \(\to\) under a flipped \(\forall\) became \(\wedge\).

9. Theories and their consequences

A set of sentences \(\Gamma\) used as a list of axioms is called a theory, and its models are the structures that satisfy all the axioms. The models of \(\Gamma_{\mathrm{gr}}\) are exactly the groups. A theorem of group theory is a sentence \(\varphi\) that is true in every group, that is, a sentence with \(\Gamma_{\mathrm{gr}}\models\varphi\). The usual proof of such a theorem, "let \(G\) be a group and let \(a,b\in G\) …", is an argument about an arbitrary model of \(\Gamma_{\mathrm{gr}}\): it is a proof of \(\Gamma_{\mathrm{gr}}\models\varphi\) by the definition.

Example 12.30: left cancellation is a consequence of the group axioms

\(\Gamma_{\mathrm{gr}}\models\forall x\,\forall y\,\forall z\,(x\cdot y=x\cdot z\to y=z)\).

Proof. Let \(\mathcal A\models\Gamma_{\mathrm{gr}}\) and let \(a,b,c\in A\) be arbitrary with \(a\cdot b=a\cdot c\) (we write \(\cdot\) for \(\cdot^{\mathcal A}\) and \(e\) for \(e^{\mathcal A}\)). By (G3) applied to \(a\), there is \(a'\in A\) with \(a'\cdot a=e\). Then

\(b=e\cdot b=(a'\cdot a)\cdot b=a'\cdot(a\cdot b)=a'\cdot(a\cdot c)=(a'\cdot a)\cdot c=e\cdot c=c,\)

where the first and last steps use (G2), the third and fifth use (G1), and the fourth uses the assumption \(a\cdot b=a\cdot c\). So \(\mathcal A\models\bar a\cdot\bar b=\bar a\cdot\bar c\to\bar b=\bar c\) for all \(a,b,c\), which is \(\mathcal A\models\forall x\forall y\forall z(x\cdot y=x\cdot z\to y=z)\). □

Every line of this ordinary algebra proof is a step in checking the definition of \(\models\) in an arbitrary model. Nothing about the particular group was used, which is why the conclusion holds in all groups.

Example 12.31: commutativity is not a consequence of the group axioms

\(\Gamma_{\mathrm{gr}}\not\models\forall x\,\forall y\,(x\cdot y=y\cdot x)\).

A countermodel is any non-commutative group. The six permutations of \(\{1,2,3\}\) under composition form a group \(\mathcal P\) (composition is associative, the identity permutation is the identity element, every permutation has an inverse). Let \(s\) swap \(1\) and \(2\) and fix \(3\), and let \(t\) swap \(2\) and \(3\) and fix \(1\). Then \(s\circ t\) sends \(1\mapsto1\mapsto2\), while \(t\circ s\) sends \(1\mapsto2\mapsto3\). So \(s\circ t\ne t\circ s\): \(\mathcal P\models\Gamma_{\mathrm{gr}}\) but \(\mathcal P\not\models\forall x\forall y(x\cdot y=y\cdot x)\).

So commutativity can be neither proved nor refuted from the group axioms: some models have it, some do not. This is why "abelian group" needs an extra axiom.

Example 12.32: a consequence of the order axioms

The theory of linear orders, in the signature \(\mathcal S_{\mathrm{ord}}\), has the axioms

(O1) \(\forall x\,\neg(x<x)\),   (O2) \(\forall x\,\forall y\,\forall z\,((x<y\wedge y<z)\to x<z)\),   (O3) \(\forall x\,\forall y\,(x<y\vee x=y\vee y<x)\).

Claim: \(\Gamma_{\mathrm{ord}}\models\forall x\,\forall y\,\big((\forall z\,(x<z\vee x=z)\wedge\forall z\,(y<z\vee y=z))\to x=y\big)\), "there is at most one least element".

Proof. Let \(\mathcal A\models\Gamma_{\mathrm{ord}}\), and let \(a,b\in A\) both be least: \(a<c\) or \(a=c\) for every \(c\), and \(b<c\) or \(b=c\) for every \(c\). Taking \(c=b\) in the first, \(a<b\) or \(a=b\); taking \(c=a\) in the second, \(b<a\) or \(b=a\). If \(a\ne b\), then \(a<b\) and \(b<a\), so \(a<a\) by (O2), contradicting (O1). Hence \(a=b\). □

Axiom (O3) was not needed. The claim therefore also holds in every partial order, where (O3) may fail.

10. Saying how large a structure is

With equality, a sentence can fix the size of its models. For each \(n\ge1\) let

\(\lambda_{\ge n}:=\exists x_1\,\exists x_2\cdots\exists x_n\,\bigwedge_{1\le i<j\le n}x_i\ne x_j,\)

the conjunction of all inequalities between the \(n\) variables. Then \(\mathcal A\models\lambda_{\ge n}\) iff the domain of \(\mathcal A\) has at least \(n\) elements, since \(n\) pairwise different witnesses can be chosen exactly when there are at least \(n\) elements. Consequently \(\mathcal A\models\lambda_{\ge n}\wedge\neg\lambda_{\ge n+1}\) iff \(\mathcal A\) has exactly \(n\) elements. For example, \(\lambda_{\ge2}\wedge\neg\lambda_{\ge3}\) is \(\exists x_1\exists x_2(x_1\ne x_2)\wedge\neg\exists x_1\exists x_2\exists x_3(x_1\ne x_2\wedge x_1\ne x_3\wedge x_2\ne x_3)\), and its models are exactly the two-element structures.

The infinite set \(\{\lambda_{\ge n}:n\ge1\}\) is satisfied exactly by the infinite structures. Is there a single sentence \(\sigma\) with \(\mathcal A\models\sigma\) iff \(A\) is infinite? For sentences in the signature with equality alone the answer is no, and the reason will be the Compactness Theorem for first-order logic, in Week 14.

Exercise 7: consequence or countermodel?

Self-check only. Nothing here counts towards your grade.

For each claim decide whether it holds. If it fails, build a countermodel on the domain \(\{0,1,2\}\): tick the elements of \(P^{\mathcal A}\) and \(Q^{\mathcal A}\) and the pairs of \(E^{\mathcal A}\) (row \(a\), column \(b\) for \((a,b)\)). The page evaluates the premises and the conclusion in your structure.

(a) Fails. \(P^{\mathcal A}=\{0\}\), \(Q^{\mathcal A}=\{1,2\}\): every element is in \(P\) or \(Q\), but neither \(\forall x\,P(x)\) nor \(\forall x\,Q(x)\) holds.

(b) Holds. If some \(a\) is in both \(P^{\mathcal A}\) and \(Q^{\mathcal A}\), then \(a\) witnesses \(\exists x\,P(x)\) and also \(\exists x\,Q(x)\).

(c) Fails. \(E^{\mathcal A}=\{(0,1),(1,2),(2,0)\}\): every element points somewhere, no element is pointed to by all three.

(d) Holds. If \(a\) satisfies \(P\) and every element satisfies \(P\to Q\), then \(a\) satisfies \(Q\).

(e) Fails. \(P^{\mathcal A}=\{0\}\), \(Q^{\mathcal A}=\{1\}\): \(\exists x\,P(x)\) and \(\exists x\,Q(x)\) hold, but no element is in both.

Exercise 8: equivalent, or one direction only?

Self-check only. Nothing here counts towards your grade.

For each pair of sentences choose the right relation. "Left \(\models\) right only" means every model of the left sentence is a model of the right one, but not conversely.

(a) Equivalent: Proposition 12.27(a) and \(\neg(\alpha\to\beta)\equiv\alpha\wedge\neg\beta\).

(b) Equivalent: Proposition 12.27(c).

(c) Right \(\models\) left only: Example 12.28(a).

(d) Left \(\models\) right only: Proposition 12.27(d) and Example 12.28(c).

(e) Equivalent: \(\exists x(P(x)\to Q(x))\equiv\exists x(\neg P(x)\vee Q(x))\equiv\exists x\neg P(x)\vee\exists x\,Q(x)\equiv\neg\forall x\,P(x)\vee\exists x\,Q(x)\equiv(\forall x\,P(x)\to\exists x\,Q(x))\).

(f) Left \(\models\) right only: if some \(a\) is in both \(P\) and \(Q\), then \(a\) is in \(P\) and some element is in \(Q\); the countermodel \(P^{\mathcal A}=\{0\}\), \(Q^{\mathcal A}=\{1\}\) refutes the converse.

Homework 12

Instructions

  • Write your full name in the box below before you start.
  • Show your work. For every answer give the reasons, not only the result. A translation should name the signature it uses if the question does not fix one; a truth value needs the argument from the definition; a countermodel needs its domain and the interpretation of every symbol, and a check that it works.
  • Each question has two answer modes, Type and Write by hand. In Write by hand mode the text boxes are replaced by a drawing area where you can write with a pen, a finger or a mouse. For each question, only the answer in the selected mode goes into the PDF. Switching modes does not delete what you entered in the other mode.
  • The symbol buttons under a text box insert symbols at the cursor.
  • To submit, press Save homework as PDF, save the PDF and upload it to Canvas.
  • Your answers are saved automatically in this browser. If you open this page on a different computer or in a different browser, they will not be there.

Question 1: translation30 points

(a) (15 points) Signature \(\mathcal S_{\mathrm{ar}}\) (\(+\), \(\cdot\), \(<\), \(0\), \(1\)); the variables range over the natural numbers. You may use the abbreviations \(P(x)\) ("\(x\) is prime"), \(E(x)\) ("\(x\) is even") and \(D(x,y)\) ("\(x\) divides \(y\)") from Example 12.7, and numerals. Write a formula for each statement.
  1. \(x\) is a perfect square.
  2. Every number greater than \(1\) has a prime divisor.
  3. There are two primes whose difference is \(2\).
  4. The sum of any two odd numbers is even.
  5. \(x\) is the greatest common divisor of \(y\) and \(z\).
(b) (9 points) Choose a signature and write a formula for each statement. State what each symbol of your signature means and what the variables range over.
  1. Every planet moves on an ellipse that has the sun as one of its foci.
  2. For any two bodies, the force that the first exerts on the second is equal and opposite to the force that the second exerts on the first.
  3. The sequence \((a_n)\) converges to \(L\): for every positive \(\varepsilon\) there is an index \(N\) such that every term with index beyond \(N\) is within \(\varepsilon\) of \(L\). (Use a unary function symbol \(a\) for the sequence, so that \(a(n)\) is the \(n\)-th term.)
(c) (6 points) Signature \(\mathcal S_{\mathrm{ar}}\) with the abbreviations of part (a), variables over the natural numbers. Write each formula as an English sentence, as briefly as a mathematician would, and say whether it is true.
  1. \(\forall x\,\exists y\,(x<y\wedge E(y)\wedge P(y))\)
  2. \(\exists y\,\forall x\,(D(y,x))\)
  3. \(\forall x\,\forall y\,(D(x,y)\wedge D(y,x)\to x=y)\)

Question 2: variables, substitution and truth20 points

(a) (6 points) For each formula give \(FV(\varphi)\), and say for each occurrence of a variable whether it is free or bound.
  1. \(\forall x\,(E(x,y)\to\exists y\,E(y,x))\)
  2. \(\exists x\,P(x)\to P(x)\)
(b) (6 points) Let \(\varphi\) be \(\forall y\,(x<y\to\exists z\,(x<z\wedge z<y))\). Write \(\varphi[0/x]\), \(\varphi[z/x]\) and \(\varphi[y+1/x]\). For each of the three terms say whether it is free for \(x\) in \(\varphi\), and explain the problem when it is not.
(c) (8 points) Let \(\mathcal H\) be the \(\mathcal S_{\mathrm{E}}\)-structure with domain \(\{0,1,2,3\}\) and \(E^{\mathcal H}=\{(0,1),(1,0),(1,2),(2,3),(3,2)\}\). Decide, with the argument from Definition 12.23, whether each sentence is true in \(\mathcal H\). Then decide whether it is true in \(\mathcal N\) when \(E(x,y)\) is read as \(x<y\).
  1. \(\forall x\,\exists y\,E(x,y)\)
  2. \(\forall x\,\forall y\,(E(x,y)\to E(y,x))\)
  3. \(\exists x\,\exists y\,(x\ne y\wedge\forall z\,(E(x,z)\leftrightarrow E(y,z)))\)

Question 3: semantic consequence30 points

(a) (8 points) Prove from Definition 12.25, by an argument about an arbitrary model of the premises: \(\{\forall x\,(P(x)\to Q(x)),\ \exists x\,(P(x)\wedge R(x))\}\models\exists x\,(Q(x)\wedge R(x))\).
(b) (8 points) Prove \(\Gamma_{\mathrm{gr}}\models\forall x\,\forall y\,(x\cdot y=x\to y=e)\) in the style of Example 12.30. Say which axiom justifies each step.
(c) (14 points) Each of the following claims is false. Give a countermodel for each: list the domain, the interpretation of every relation symbol, and the checks that the premises are true and the conclusion is false in your structure. Use domains with at most three elements.
  1. \(\{\forall x\,(P(x)\to Q(x)),\ \exists x\,Q(x)\}\models\exists x\,P(x)\)
  2. \(\{\forall x\,\exists y\,E(x,y),\ \forall x\,\neg E(x,x)\}\models\exists x\,\exists y\,(E(x,y)\wedge E(y,x))\)
ClaimDomainInterpretations
(i)
(ii)

Question 4: equivalences and size20 points

(a) (6 points) Prove the second half of Proposition 12.27(a), \(\neg\exists x\,\varphi\equiv\forall x\,\neg\varphi\), from Definition 12.23, in the style of the proof given for the first half.
(b) (6 points) Prove the first half of Proposition 12.27(e): if \(x\) is not free in \(\psi\), then \(\forall x\,(\varphi\to\psi)\equiv\exists x\,\varphi\to\psi\). Explain where the hypothesis on \(x\) is used, and give a structure showing that the equivalence can fail when \(x\) is free in \(\psi\) (take \(\psi\) to be \(P(x)\) and \(\varphi\) to be \(P(x)\)).
(c) (8 points) Signature: one unary relation symbol \(P\). Write a sentence whose models are exactly the structures in which (i) exactly two elements satisfy \(P\); (ii) the domain has exactly three elements and all of them satisfy \(P\); (iii) at least one element satisfies \(P\) and at least one does not. Explain in one sentence each why your sentence has exactly these models.