Skip to content
The Lumenary

Each worksheet prints cleanly on A4 or Letter. Answer keys are on a separate page.

The Lumenary · Early undergraduate

First-order logic

Name: ______________________

Date: ______________________

You will learn to

  • Write first-order formulas in a given signature, such as the axioms for groups, linear orders and fields, and recognise statements that are not first-order
  • Decide whether a sentence is true in a given structure by unwinding the definition of satisfaction
  • Use natural deduction to derive simple consequences, and prove the soundness theorem Γ⊢φ⇒Γ⊨φ\Gamma \vdash \varphi \Rightarrow \Gamma \models \varphi
  • Prove that isomorphic structures satisfy the same sentences, and use sentences and countermodels to show non-isomorphism and non-derivability
  • State Gödel's completeness theorem and distinguish ⊨\models from ⊢\vdash
  1. 1.

    In the signature of fields {+,⋅,−,0,1}\{+, \cdot, -, 0, 1\}, which sentence says "every non-zero element has a multiplicative inverse"?

    • A.∀x (¬(x=0)→∃y (x⋅y=1))\forall x\, \big(\neg(x = 0) \to \exists y\ (x \cdot y = 1)\big)
    • B.∃y ∀x (¬(x=0)→x⋅y=1)\exists y\, \forall x\, \big(\neg(x = 0) \to x \cdot y = 1\big)
    • C.∀x ∃y (¬(x=0)∧x⋅y=1)\forall x\, \exists y\, \big(\neg(x = 0) \wedge x \cdot y = 1\big)
    • D.∀x (x⋅x−1=1)\forall x\ (x \cdot x^{-1} = 1)
  2. 2.

    Let C=({1,2,3},E)\mathcal{C} = (\{1, 2, 3\}, E) with E={(1,2),(2,3),(3,1)}E = \{(1,2), (2,3), (3,1)\} (a directed triangle). Which sentences are true in C\mathcal{C}? Choose all that apply.

    • A.∀x ∃y E(x,y)\forall x\, \exists y\ E(x, y)
    • B.∃y ∀x E(x,y)\exists y\, \forall x\ E(x, y)
    • C.∀x ∀y (E(x,y)→¬E(y,x))\forall x\, \forall y\, \big(E(x, y) \to \neg E(y, x)\big)
    • D.∀x ∀y ∀z (E(x,y)∧E(y,z)→E(x,z))\forall x\, \forall y\, \forall z\, \big(E(x, y) \wedge E(y, z) \to E(x, z)\big)
    • E.∀x ∃y ∃z (E(x,y)∧E(y,z)∧E(z,x))\forall x\, \exists y\, \exists z\, \big(E(x, y) \wedge E(y, z) \wedge E(z, x)\big)
  3. 3.

    Which of these properties of a structure (M,<)(M, <) can be expressed by a single first-order sentence in the signature {<}\{<\}? Choose all that apply.

    • A.There is a least element.
    • B.Between any two elements there is a third.
    • C.Every non-empty subset has a least element.
    • D.There are exactly three elements.
    • E.There are only finitely many elements.
  4. 4.

    Which statement is the soundness theorem?

    • A.If Γ⊢φ\Gamma \vdash \varphi then Γ⊨φ\Gamma \models \varphi.
    • B.If Γ⊨φ\Gamma \models \varphi then Γ⊢φ\Gamma \vdash \varphi.
    • C.Every consistent theory has a model.
    • D.There is an algorithm deciding whether Γ⊢φ\Gamma \vdash \varphi.
  5. 5.

    Someone "derives" P(y)⊢∀x P(x)P(y) \vdash \forall x\, P(x) as follows: (1) P(y)⊢P(y)P(y) \vdash P(y) by assumption; (2) P(y)⊢∀x P(x)P(y) \vdash \forall x\, P(x) by ∀\forallI. Which statement is right?

    • A.Step 2 is illegal: ∀\forallI requires that yy is not free in the assumptions, but yy is free in P(y)P(y).
    • B.The derivation is correct.
    • C.Step 1 is illegal: one cannot assume a formula with a free variable.
    • D.It needs ∀\forallE instead of ∀\forallI.
  6. 6.

    Which sentence proves that (Z,<)(\mathbb{Z}, <) and (Q,<)(\mathbb{Q}, <) are not isomorphic?

    • A.∀x ∀y (x<y→∃z (x<z∧z<y))\forall x\, \forall y\, \big(x < y \to \exists z\, (x < z \wedge z < y)\big)
    • B.∀x ∃y (y<x)\forall x\, \exists y\ (y < x)
    • C.∀x ∃y (x<y)\forall x\, \exists y\ (x < y)
    • D."There are countably many elements."
  7. 7.

    In the Lean formalisation, the rule allI : Derivable (Γ.map Formula.shift) φ → Derivable Γ (.all φ) shifts every assumption (variable ii becomes i+1i + 1) before deriving the body φ. What does the shift achieve?

    • A.It makes the de Bruijn variable 00 fresh — it occurs free in no assumption — which is the eigenvariable condition of ∀\forallI.
    • B.It renames bound variables to avoid capture during substitution.
    • C.It weakens the assumptions, so that fewer formulas are derivable.
    • D.Nothing: it is needed only to make the types match.
  8. 8.

    On a finite domain, quantifiers are loops. Write forall(domain, pred) and exists(domain, pred), and use them to write serial(domain, rel), which decides ∀x ∃y R(x,y)\forall x\, \exists y\ R(x, y) for a relation rel given as a set of pairs, and has_hub(domain, rel), which decides ∃y ∀x R(x,y)\exists y\, \forall x\ R(x, y).

    Computational — Practice

Code: Apache-2.0 · Content: CC BY-SA 4.0