1.7. Predicate Logic

Propositional logic deals with indivisible propositions: P, Q, R are either true or false, and the connectives combine these values. It cannot, however, talk about the elements of a set and their properties. Statements such as "every element of a set satisfies \varphi" or "some element satisfies \varphi" — ubiquitous in mathematics and in program specifications — are beyond its reach. For example, "every natural number is even or odd" cannot be represented in a way that exposes its structure: the best propositional translation would be a single atomic proposition P, which says nothing about numbers.

Predicate logic (or first-order logic) extends propositional logic with terms, which denote elements of a domain, predicates, which express properties of and relations between these elements, and the quantifiers \forall and \exists. In this chapter we review the syntax and semantics of predicate logic and present the quantifier rules of natural deduction and of the sequent calculus. This material paves the way for the next chapter, in which we will see how quantifiers can be represented by means of dependent types.

1.7.1. Syntax

1.7.1.1. Signatures and terms

The syntax of the logic is parameterized by a signature. A signature \Sigma is a set of function symbols together with a function a : \Sigma \to \mathbb{N} that assigns to each symbol its arity, that is, the number of arguments it expects. Symbols f \in \Sigma with a(f) = 0 are called constants.

The syntax of predicate logic describes two different kinds of entities:

  • terms, which represent elements of the domain of discourse and are built from variables and the symbols of the signature;

  • formulas, which are the logical components, to which we assign truth values.

Let \mathcal{V} be a countable set of variables. The set \mathcal{T}_{\Sigma} of terms over \Sigma is the smallest set such that:

  • \mathcal{V} \subseteq \mathcal{T}_{\Sigma}, that is, every variable is a term;

  • if f \in \Sigma, a(f) = n and t_1, \ldots, t_n \in \mathcal{T}_{\Sigma}, then f(t_1, \ldots, t_n) \in \mathcal{T}_{\Sigma}.

Equivalently, as a grammar: t \;::=\; x \;\mid\; f(t_1, \ldots, t_n) \qquad (x \in \mathcal{V},\; f \in \Sigma,\; a(f) = n)

For example, consider the signature \Sigma = \{f : 2,\; a : 0\}, consisting of a binary symbol f and a constant a. The following are terms over \Sigma: a, f(a, a) and f(x, f(x, a)). On the other hand, f(a) is not a term, since f expects two arguments. If we interpret f as addition and a as zero, the last term represents x + (x + 0); indeed, it is common to write binary symbols in infix notation.

1.7.1.2. Predicates and formulas

To define formulas we also consider a set \mathcal{P} of predicates (or relation symbols), each with its arity a : \mathcal{P} \to \mathbb{N}. A predicate of arity 0 is simply a propositional variable: thus propositional logic is a special case of predicate logic.

Formulas are generated by the grammar \begin{array}{lcl} \varphi & ::= & P(t_1,\ldots,t_n) \;\mid\; \varphi \circ \varphi \;\mid\; \neg\varphi \;\mid\; \bot \;\mid\; \top \\ & \mid & \exists x.\, \varphi \;\mid\; \forall x.\, \varphi \end{array} where P \in \mathcal{P}, a(P) = n, t_1, \ldots, t_n \in \mathcal{T}_{\Sigma} and \circ \in \{\supset, \leftrightarrow, \land, \lor\}. Formulas of the form P(t_1, \ldots, t_n) are called atomic. We use \supset for implication, as is traditional in logic texts. For example, with a binary predicate = (written infix) and the symbol +, the formula \forall x.\, \exists y.\, x + x = y states that every element has a "double".

1.7.1.3. Free and bound variables

In a formula \forall x.\, \varphi, we say that x is bound in \varphi: the quantifier is its binder, and \varphi is its scope. The same holds for \exists x.\, \varphi. A variable occurrence is free if it is not within the scope of a quantifier that binds it. Formally, the set \text{fv} of free variables is defined by \begin{array}{lcl} \text{fv}(x) & = & \{x\} \\ \text{fv}(f(t_1, \ldots, t_n)) & = & \text{fv}(t_1) \cup \cdots \cup \text{fv}(t_n) \\ \text{fv}(P(t_1, \ldots, t_n)) & = & \text{fv}(t_1) \cup \cdots \cup \text{fv}(t_n) \\ \text{fv}(\bot) = \text{fv}(\top) & = & \emptyset \\ \text{fv}(\neg\varphi) & = & \text{fv}(\varphi) \\ \text{fv}(\varphi_1 \circ \varphi_2) & = & \text{fv}(\varphi_1) \cup \text{fv}(\varphi_2) \\ \text{fv}(\forall x.\,\varphi) = \text{fv}(\exists x.\,\varphi) & = & \text{fv}(\varphi) \setminus \{x\} \end{array} A formula is called closed (or a sentence) if \text{fv}(\varphi) = \emptyset. Just as in the lambda calculus, the name of a bound variable is irrelevant: \forall x.\,P(x) and \forall y.\,P(y) are regarded as the same formula (alpha-equivalence).

1.7.1.4. Substitution

We write [x \mapsto t]\varphi for the substitution of the term t for the free occurrences of the variable x in the formula \varphi. As in the lambda calculus, we must avoid variable capture: if some variable of t would be bound by a quantifier of \varphi, we first rename the bound variable. We always assume that this renaming is done implicitly.

For example, consider the formula \varphi = (\exists y.\, x + x = y) \lor (\exists x.\, x = y) and the substitution [x \mapsto z + z]. In the first disjunct, x is free and gets replaced; in the second, x is bound by \exists x and remains unchanged: [x \mapsto z + z]\varphi = (\exists y.\, (z + z) + (z + z) = y) \lor (\exists x.\, x = y) If instead we naively applied [x \mapsto y] to the first disjunct, we would obtain \exists y.\, y + y = y, in which the substituted y has been captured. The correct substitution first renames the bound variable: [x \mapsto y](\exists y.\,x + x = y) = \exists w.\, y + y = w.

Substitution will be used both in the definition of the semantics and in the deduction rules for the quantifiers.

1.7.2. Semantics

To give meaning to formulas we need to say what they talk about. Given a signature \Sigma and a set of predicates \mathcal{P}, the meaning of a formula is defined in terms of a structure.

1.7.2.1. Structures

A structure is a triple (M, F, R) where:

  • M is a nonempty set, called the domain or universe;

  • F is a set of functions [\![f]\!] : M^n \to M, one for each f \in \Sigma of arity n;

  • R is a set of relations [\![P]\!] \subseteq M^n, one for each predicate P \in \mathcal{P} of arity n.

For example, for the signature \{f : 2, a : 0\} and a binary predicate E, one possible structure is M = \mathbb{N}, [\![f]\!](m, n) = m + n, [\![a]\!] = 0 and [\![E]\!] = \{(m, m) \mid m \in \mathbb{N}\}. Another structure for the same signature could use the set of lists, concatenation and the empty list. A formula may be true in one structure and false in another.

1.7.2.2. Semantics of terms

Once a structure is fixed, the semantics of a term depends on the values assigned to its free variables. Let t be a term whose free variables are among \{x_1, \ldots, x_k\}. Its interpretation is a function [\![t]\!]^k : M^k \to M that takes a k-tuple (m_1, \ldots, m_k) — the value of each variable — and returns an element of the domain. The semantics of a variable x_i is the projection onto the i-th position: [\![x_i]\!]^k(m_1, \ldots, m_k) = m_i and that of an application of a function symbol is obtained by interpreting the arguments and applying the corresponding function: [\![f(t_1,\ldots,t_n)]\!]^k(m_1,\ldots,m_k) = [\![f]\!]\big([\![t_1]\!]^k(m_1,\ldots,m_k),\ldots,[\![t_n]\!]^k(m_1,\ldots,m_k)\big)

1.7.2.3. Semantics of formulas

Using the semantics of terms, the semantics of a formula \varphi whose free variables are among x_1, \ldots, x_k is defined as a subset [\![\varphi]\!]^k \subseteq M^k: the set of assignments of values to the variables that make \varphi true. For atomic formulas: [\![P(t_1, \ldots, t_n)]\!]^k = \{ \vec{m} \in M^k \mid ([\![t_1]\!]^k(\vec{m}), \ldots, [\![t_n]\!]^k(\vec{m})) \in [\![P]\!] \} where \vec{m} abbreviates (m_1, \ldots, m_k). The connectives correspond to set operations: \begin{array}{lcl} [\![\bot]\!]^k & = & \emptyset \\ [\![\top]\!]^k & = & M^k \\ [\![\neg \varphi]\!]^k & = & M^k - [\![\varphi]\!]^k\\ [\![\varphi_1 \land \varphi_2]\!]^k & = & [\![\varphi_1]\!]^k \cap [\![\varphi_2]\!]^k\\ [\![\varphi_1 \lor \varphi_2]\!]^k & = & [\![\varphi_1]\!]^k\cup [\![\varphi_2]\!]^k\\ [\![\varphi_1 \supset \varphi_2]\!]^k & = & [\![\neg \varphi_1 \lor \varphi_2]\!]^k \end{array} (and \varphi_1 \leftrightarrow \varphi_2 is treated as (\varphi_1 \supset \varphi_2) \land (\varphi_2 \supset \varphi_1)). The quantifiers introduce a new variable x_{k+1}, interpreted in M^{k+1}. The universal quantifier corresponds to an intersection over all possible values of the new variable; the existential to a union: \begin{array}{lcl} [\![\forall x_{k + 1}.\,\varphi]\!]^k & = & \displaystyle\bigcap_{m\in M}\{(m_1,\ldots,m_k)\mid(m_1,\ldots,m_k,m)\in[\![\varphi]\!]^{k+1}\} \\[1.5em] [\![\exists x_{k + 1}.\,\varphi]\!]^k & = & \displaystyle\bigcup_{m\in M}\{(m_1,\ldots,m_k)\mid(m_1,\ldots,m_k,m)\in[\![\varphi]\!]^{k+1}\} \end{array} That is, an assignment satisfies \forall x_{k+1}.\,\varphi if, extended with any value m for x_{k+1}, it satisfies \varphi; and it satisfies \exists x_{k+1}.\,\varphi if some value m makes \varphi true.

For closed formulas (k = 0) we have M^0 = \{()\}, the set containing only the empty tuple. Hence [\![\varphi]\!]^0 \subseteq \{()\} and there are only two possibilities:

  • [\![\varphi]\!]^0 = \emptyset, and we say that \varphi is false in the structure;

  • [\![\varphi]\!]^0 = \{()\}, and we say that \varphi is true in the structure.

We thus recover the two truth values of propositional logic. A sentence that is true in every structure is called valid.

1.7.2.4. A semantics in Lean

The definition above can be transcribed into Lean. For simplicity we use De Bruijn indices for variables (as in the chapter on the lambda calculus) and represent the k-tuple of values by a function ρ : Nat → M, the environment. Instead of subsets of M^k, we interpret formulas directly as Lean propositions, parameterized by the environment. To keep the example small, we fix a signature with one constant, one binary symbol and one binary predicate.

namespace Ch06 inductive Tm where | var : Nat → Tm -- variable (De Bruijn) | a : Tm -- constant | f : Tm → Tm → Tm -- binary symbol inductive Fm where | E : Tm → Tm → Fm -- binary predicate | bot : Fm | imp : Fm → Fm → Fm | and : Fm → Fm → Fm | or : Fm → Fm → Fm | all : Fm → Fm | ex : Fm → Fm structure Struct where M : Type a : M f : M → M → M E : M → M → Prop -- extends the environment with a new value at position 0 def cons {M : Type} (m : M) (ρ : Nat → M) : Nat → M | 0 => m | n + 1 => ρ n def Tm.eval (S : Struct) (ρ : Nat → S.M) : Tm → S.M | .var i => ρ i | .a => S.a | .f t u => S.f (t.eval S ρ) (u.eval S ρ) def Fm.eval (S : Struct) (ρ : Nat → S.M) : Fm → Prop | .E t u => S.E (t.eval S ρ) (u.eval S ρ) | .bot => False | .imp φ ψ => φ.eval S ρ → ψ.eval S ρ | .and φ ψ => φ.eval S ρ ∧ ψ.eval S ρ | .or φ ψ => φ.eval S ρ ∨ ψ.eval S ρ | .all φ => ∀ m : S.M, φ.eval S (cons m ρ) | .ex φ => ∃ m : S.M, φ.eval S (cons m ρ)

The quantifier cases are the exact analogue of the intersection and union over m \in M: the environment is extended with the new value. As an example, consider the structure of the natural numbers with a = 0, f = + and E equality, and the sentence \forall x.\, \exists y.\, E(f(x, x), y) ("every number has a double"). Under the existential quantifier, y has index 0 and x has index 1:

abbrev natS : Struct := ⟨Nat, 0, (· + ·), (· = ·)⟩ def double : Fm := .all (.ex (.E (.f (.var 1) (.var 1)) (.var 0))) example : double.eval natS (fun _ => 0) := ⊢ Fm.eval natS (fun x => 0) double m:natS.M⊢ Fm.eval natS (cons m fun x => 0) (Fm.E ((Tm.var 1).f (Tm.var 1)) (Tm.var 0)).ex All goals completed! 🐙

Note that, when proving that the sentence is true in this structure, we supply an explicit witness (m + m) for the existential. This constructive reading of the quantifiers is exactly what the deduction rules below capture.

1.7.3. Natural deduction

Natural deduction for predicate logic keeps all the rules of propositional logic (introduction and elimination of \supset, \land, \lor, \bot, \top) and adds rules for handling the quantifiers. As before, judgements have the form \Gamma \vdash \varphi, where \Gamma is a set of formulas (hypotheses). For reference, we recall the rules for implication, which will be used in the example below (with \neg\varphi abbreviating \varphi \supset \bot): \frac{}{\Gamma, \varphi \vdash \varphi}\;(\text{Hyp}) \qquad \frac{\Gamma, \varphi \vdash \psi}{\Gamma \vdash \varphi \supset \psi}\;(\supset\text{I}) \qquad \frac{\Gamma \vdash \varphi \supset \psi \qquad \Gamma \vdash \varphi}{\Gamma \vdash \psi}\;(\supset\text{E})

1.7.3.1. The universal quantifier

The rules for the universal quantifier are: \frac{\Gamma \vdash \varphi \qquad x \not\in\textrm{fv}(\Gamma)}{\Gamma\vdash \forall x.\, \varphi}\;(\forall\text{I}) \qquad \frac{\Gamma \vdash \forall x.\, \varphi}{\Gamma \vdash [x\mapsto t]\varphi}\;(\forall\text{E})

The introduction rule formalizes the reasoning "let x be an arbitrary element": if we can prove \varphi without assuming anything about x — which is guaranteed by the condition x \notin \text{fv}(\Gamma), i.e., no hypothesis mentions x — then \varphi holds for every x. Without this condition we could derive, from the hypothesis P(x), the conclusion \forall x.\,P(x), which is clearly wrong. The elimination rule says that, from a universal statement, we may obtain the instance for any term t.

1.7.3.2. The existential quantifier

The rules for the existential quantifier are: \frac{\Gamma \vdash [x\mapsto t]\varphi}{\Gamma \vdash \exists x.\,\varphi}\;(\exists\text{I}) \qquad \frac{\Gamma\vdash \exists x.\,\varphi_1 \qquad \Gamma, [x\mapsto y]\varphi_1\vdash\varphi \qquad y\not\in\textrm{fv}(\Gamma)\cup\textrm{fv}(\varphi)}{\Gamma\vdash \varphi}\;(\exists\text{E})

To introduce an existential it suffices to exhibit a witness t that satisfies the property. The elimination rule formalizes the reasoning "let y be an element such that \varphi_1(y)": if we know that some x satisfies \varphi_1, and we can prove \varphi assuming \varphi_1 for a fresh y (about which we know nothing else), then \varphi holds. The condition that y does not occur free in \Gamma nor in the conclusion \varphi guarantees that we made no assumptions about the unknown witness and that it does not "escape" into the conclusion. The variable y is called the eigenvariable (or parameter) of the rule.

Observe the symmetry between the rules: \forall\text{I} and \exists\text{E} carry freshness conditions on variables, while \forall\text{E} and \exists\text{I} allow any term t to be chosen.

1.7.3.3. Example

Let us derive \vdash \forall x.\, \neg A(x) \supset \neg \exists x.\, A(x): if no element satisfies A, then there is no element satisfying A. Building a derivation is most natural bottom-up, following the structure of the conclusion.

  1. The conclusion is an implication; by (\supset\text{I}), it suffices to prove \neg\exists x.\,A(x) under the hypothesis \forall x.\,\neg A(x).

  2. \neg\exists x.\,A(x) abbreviates \exists x.\,A(x) \supset \bot; by (\supset\text{I}) again, it suffices to prove \bot under the hypotheses \Gamma = \forall x.\,\neg A(x),\; \exists x.\,A(x).

  3. To use the existential hypothesis, we apply (\exists\text{E}) with a fresh variable y: it suffices to prove \bot under \Gamma, A(y).

  4. From \forall x.\,\neg A(x), by (\forall\text{E}) with t = y, we obtain \neg A(y); together with the hypothesis A(y), rule (\supset\text{E}) yields \bot.

The complete derivation is shown below, where \Gamma = \forall x.\,\neg A(x),\; \exists x.\,A(x): \frac{\dfrac{\dfrac{\Gamma \vdash \exists x.\,A(x) \qquad \dfrac{\dfrac{\Gamma, A(y) \vdash \forall x.\,\neg A(x)}{\Gamma, A(y) \vdash \neg A(y)}\;(\forall\text{E}) \qquad \Gamma, A(y) \vdash A(y)}{\Gamma, A(y) \vdash \bot}\;(\supset\text{E})}{\Gamma \vdash \bot}\;(\exists\text{E})}{\forall x.\,\neg A(x) \vdash \neg\exists x.\,A(x)}\;(\supset\text{I})}{\vdash \forall x.\, \neg A(x) \supset \neg \exists x.\, A(x)}\;(\supset\text{I}) The leaves are instances of (Hyp). The side condition of (\exists\text{E}) is satisfied, since y occurs neither in \Gamma nor in \bot.

In Lean, the same proof can be written as a term or with tactics. In the term version, fun h ⟨y, hy⟩ => h y hy reads exactly like the derivation: the first abstraction is the outer (\supset\text{I}); the pattern ⟨y, hy⟩ is the elimination of the existential, introducing the eigenvariable y and the hypothesis hy : A y; h y is the elimination of the universal; and the application to hy is the (\supset\text{E}):

variable {α : Type} (A : α → Prop) example : (∀ x, ¬ A x) → ¬ ∃ x, A x := fun h ⟨y, hy⟩ => h y hy example : (∀ x, ¬ A x) → ¬ ∃ x, A x := α:TypeA:α → Prop⊢ (∀ (x : α), ¬A x) → ¬∃ x, A x intro h α:TypeA:α → Proph:∀ (x : α), ¬A xhex:∃ x, A x⊢ False α:TypeA:α → Proph:∀ (x : α), ¬A xy:αhy:A y⊢ False All goals completed! 🐙

The natural deduction rules for predicate logic are sound (everything derivable is valid) and, in the classical version, complete (every valid formula is derivable): this is Gödel's completeness theorem. In other words, with these four quantifier rules, added to those of propositional logic, we can deduce every provable fact of predicate logic.

1.7.4. Sequent calculus

In the sequent calculus, instead of introduction and elimination rules, each connective has rules that introduce it on the right and on the left of the sequent \Gamma \Rightarrow \varphi. As with natural deduction, the sequent calculus for predicate logic simply adds the quantifier rules to the propositional ones. For reference, the propositional rules used in the example below are: \frac{}{\Gamma, \varphi \Rightarrow \varphi}\;(\text{Id}) \qquad \frac{\Gamma, \varphi \Rightarrow \psi}{\Gamma \Rightarrow \varphi \supset \psi}\;(\supset\text{R}) \qquad \frac{\Gamma, \varphi \supset \psi \Rightarrow \varphi \qquad \Gamma, \varphi \supset \psi, \psi \Rightarrow \chi}{\Gamma, \varphi \supset \psi \Rightarrow \chi}\;(\supset\text{L}) \qquad \frac{}{\Gamma, \bot \Rightarrow \varphi}\;(\bot\text{L})

1.7.4.1. The universal quantifier

\frac{\Gamma \Rightarrow \varphi \qquad x \not\in \textrm{fv}(\Gamma)}{\Gamma\Rightarrow \forall x.\, \varphi}\;(\forall\text{R}) \qquad \frac{\Gamma, \forall x.\,\varphi_1, [x\mapsto t]\varphi_1\Rightarrow \varphi}{\Gamma,\forall x.\,\varphi_1 \Rightarrow \varphi}\;(\forall\text{L})

Rule (\forall\text{R}) is identical to the natural deduction introduction rule. Rule (\forall\text{L}) says that, if we have the hypothesis \forall x.\,\varphi_1, we may add any instance [x \mapsto t]\varphi_1 to the context. Note that the universal hypothesis is kept in the premise: it may need to be instantiated more than once, with different terms.

1.7.4.2. The existential quantifier

\frac{\Gamma \Rightarrow [x\mapsto t]\varphi}{\Gamma\Rightarrow \exists x.\,\varphi}\;(\exists\text{R}) \qquad \frac{\Gamma, [x\mapsto y]\varphi\Rightarrow \varphi_1 \qquad y\not\in\textrm{fv}(\Gamma) \cup \textrm{fv}(\varphi_1)}{\Gamma,\exists x.\,\varphi \Rightarrow \varphi_1}\;(\exists\text{L})

(\exists\text{R}) requires a witness, like (\exists\text{I}). (\exists\text{L}), on the other hand, replaces the existential hypothesis with an instance for a fresh variable y, which does not occur in the rest of the sequent.

1.7.4.3. Example

The formula of the previous example can also be derived in the sequent calculus. Building the derivation bottom-up, we apply (\supset\text{R}) twice, then (\exists\text{L}) with the fresh variable y, (\forall\text{L}) with t = y and, finally, (\supset\text{L}) on \neg A(y) = A(y) \supset \bot. Let \Delta = \forall x.\,\neg A(x),\; A(y),\; \neg A(y): \frac{\dfrac{\dfrac{\dfrac{\dfrac{\Delta \Rightarrow A(y)\;(\text{Id}) \qquad \Delta, \bot \Rightarrow \bot\;(\bot\text{L})}{\Delta \Rightarrow \bot}\;(\supset\text{L})}{\forall x.\,\neg A(x),\; A(y) \Rightarrow \bot}\;(\forall\text{L})}{\forall x.\,\neg A(x),\; \exists x.\,A(x) \Rightarrow \bot}\;(\exists\text{L})}{\forall x.\,\neg A(x) \Rightarrow \neg\exists x.\,A(x)}\;(\supset\text{R})}{\Rightarrow \forall x.\,\neg A(x) \supset \neg\exists x.\,A(x)}\;(\supset\text{R})

Notice how, in the sequent calculus, every rule manipulates the structure of the principal formula and the derivation grows only "upwards", decomposing formulas. This property (the subformula property, a consequence of cut elimination) makes the sequent calculus a suitable tool for automated proof search.

end Ch06

This concludes our review of predicate logic. In the next chapter we will see how the Calculus of Constructions allows quantifiers to be represented as types — the universal quantifier as a type of dependent functions and the existential quantifier through an impredicative encoding — thereby extending the Curry-Howard isomorphism to predicate logic.

1.7.5. Exercises

  1. Consider the signature \Sigma = \{s : 1,\; z : 0,\; p : 2\}. Which of the expressions below are terms over \Sigma? s(s(z)); p(z); p(s(x), p(z, y)); s(z, z).

  2. Compute \text{fv}(\varphi) for \varphi = \forall x.\,(P(x, y) \supset \exists y.\,Q(y, z)) and determine the result of [y \mapsto f(x)]\varphi, renaming bound variables where necessary.

  3. Give a structure in which the sentence \forall x.\,\exists y.\,R(x, y) is true and \exists y.\,\forall x.\,R(x, y) is false.

  4. Using the definition of the semantics, show that [\![\neg\forall x.\,\varphi]\!]^k = [\![\exists x.\,\neg\varphi]\!]^k. Is this equivalence derivable in intuitionistic natural deduction? In which direction?

  5. Derive in natural deduction: (a) \forall x.\,(P(x) \land Q(x)) \supset (\forall x.\,P(x)) \land (\forall x.\,Q(x)); (b) (\exists x.\,P(x) \lor Q(x)) \supset (\exists x.\,P(x)) \lor (\exists x.\,Q(x)); (c) \exists x.\,\forall y.\,R(x, y) \supset \forall y.\,\exists x.\,R(x, y).

  6. Show that the "proof" below is incorrect, identifying the violated condition: from P(x) \vdash P(x), one concludes P(x) \vdash \forall x.\,P(x) by (\forall\text{I}), and then \vdash P(x) \supset \forall x.\,P(x).

  7. Derive the formulas of exercise 5 in the sequent calculus.

  8. Prove the formulas of exercise 5 in Lean, first as terms and then with tactics.

  9. Using the definitions Fm and Fm.eval from this chapter, define the formula \forall x.\,E(f(x, a), x) and prove that it is true in the structure natS.