8  Logic II

Wordcount: 3195

Propositional Logic is a useful tool for understanding and changing the truth of true and false statements. However, working in just true / false statements is not how we reason in the real world. When we try to use logic in the real world, it is often on the a true / false question about something. Propositional Logic cannot express these ideas.

As an example:

  1. All people are mortal
  2. Socrates is a person
  3. Therefore, socrates is a mortal.

If we try express these statements in Prop Logic, then we have the following:

  1. All people are mortal is a true statement: \(A\)
  2. Socrates is a person is a true statement: \(B\)
  3. Socrates is a mortal is also a true statement: \(C\)

How do we infer the truth of \(C\) from \(A\) and \(B\)?

We need to use a logic that can reason about objects and their properties. Then, from this logic we want to ask the same four questions we had in propositional logic:

  1. Truth
  2. Satisfiability
  3. Validity
  4. Consequence

8.1 An introduction to First Order Logic

To begin, we need our objects. What are we reasoning over, what do they look like?

More importantly, we reason over a collection of objects, not just single ones. These collections of objects are called domains of discourse \(D\). A domain can be anything:

  • The students taking computer science
  • The computers in the labs
  • The trees around the building
  • The colours in the rainbow

For mathematical reasoning, we might use our number systems:

  • The naturals \(\mathbb{N}\)
  • The reals \(\mathbb{R}\)

The only caveat is that \(D\) must be non-empty. We can’t really reason about nothing.

Now that we have our objects, how do we refer to them? The simplest way is to just give each object a name.

We call these names constants, and we tie them to a specific object in the domain.

Using our earlier examples:

  • An actual name is the unique name for each student
  • A computer may be labelled by its IP address or a name like “PC-0”
  • In the naturals \(\mathbb{N}\), we call the numbers \(0\), \(1\) and so on.

Constants are typically an important element of our domain, for example \(0\) and \(1\) in the reals. So long as we have a finite number of objects, we can theoretically refer to all of them by a constant, but what if the domain is infinite? If we want a finite alphabet to write the logic down in, then we can’t have an infinite number of constants.

To get around this, we use a variable instead of a constant. Constants tie a symbol to a specific object, while variables tie a symbol to an interchangable object. It is a placeholder for the object, and allows us to make more generic statements.

To use these placeholders, we need a way to define what the variable refers to. In prop logic, we used a propositional assignment to give the True / False placeholders (the propositions) a value. We can use a similar function for variables.

A variable assignment is a function that maps a variable to an object in the domain:

\[ \alpha: VARS \mapsto D \]

TipNotation

A propositional assignment uses a roman lowercase letter. \[ v: PROP \mapsto \{ T, F \} \]

A variable assignment uses a greek lowercase letter instead. \[ \alpha: VARS \mapsto D \]

Constants and variables give us a reference to domain elements. What if we wanted to manipulate them? For example:

  • What is the number after this one?
  • What tree is in the north direction of this one?
  • What is the colour after mixing Red and Blue?

We use functions to manipulate our domain elements, and importantly, we can manipulate groups of objects as well. Functions take in any amount of objects, but always the same amount. The result is then just a single object from the domain. The number of objects given as an argument into the function is called its arity.

\[ f: D^n \mapsto D \]

The \(D^n\) here refers to the cartesian product of \(D\) with itself \(n\) times.

If functions are a way to ask what object is from these other objects, then predicates are a way to ask yes and no questions about these objects.

  • Is this number even?
  • Is this tree a South-African native tree?
  • Is this student enjoying FLA?
  • Are these people married?

Predicates also have an arity, and most importantly, they are the mechanism we use to get the ‘truth’ of something for our logic.

\[ P: D^n \mapsto \{ T, F \} \]

NoteEquality

Equality is a kind of yes-no question that asks if two objects are actually the same. Equality is in fact a fixed idea across all our possible domains. If we are talking about trees or students, the concept of equality is the same of ‘Are these two tree’s the same tree?’ and ‘Are these two students the same student?’

As a result, we define equality as a special predicate for every domain \(D\) with:

\[ =: D^2 \mapsto \{ T, F \} \]

This is a surprisingly useful predicate, and if we don’t have it, then it is impossible to translate english sentences about uniqueness into first order logic.

  • If two students have green hair and yellow eyes, then they are the same student: \[ \text{GreenHair}(x) \land \text{YellowEyes}(x) \land \text{GreenHair}(y) \land \text{YellowEyes}(y) \rightarrow x = y \]

Notationally, we write equality as an infix predicate \(x = y\) rather then in prefix notation \(=(x, y)\).

Now, we can try rewrite the Socrates example in our new logic, and see if it works.

  1. All people are mortal: \[Person(x) \rightarrow Mortal(x)\]
  2. Socrates is a person: \[Person(\text{Socrates})\]
  3. Therefore, Socrates is mortal: \[\therefore Mortal(\text{Socrates})\]

By using the structure of the variable \(x\) in our predicate, we can use an assignment from \(x\) to \(\text{Socrates}\) to pull out the truth of Socrates’s mortality.

You may have noticed that the translation from ‘All people are mortal’ to \(Person(x) \rightarrow Mortal(x)\) is missing the ‘All’ part of the sentence. The last component of first order logic is the quantifier, which allows us to generalise a formula.

8.2 Quantifiers of First Order Logic

We are going to use two types of quantifiers:

  • universal: \(\forall\)
  • existential: \(\exists\)

The quantifiers allow us to generalise a logical statement across the entire domain.

To use the assignment object we have defined before, the for all operator \(\forall\) tells us that for any (and every) possible choice of \(x\) by the assignment, the subsequent statement is true.

For example, in our CS students domain the following statement is true:

\[ \forall x\: \text{Student}(x) \]

Every object in our domain is a student.

The existential quantifier \(\exists\) is used in a similar fashion. The word \(\exists x\) tells us that for at least one possible choice of \(x\) by an assignment, the subsequent statement is true.

In our CS Students example there is at least one person who touches grass (I hope)

\[ \exists x\: \text{TouchesGrass}(x) \]

Quantifiers must be defined for some variable. The reason for this is that they act as a sort of abstract specifier for the value of the variable. They don’t give the variable any specific value, rather they provide a generalised statement we can apply to the domain elements.

This distinction gives us two categories of variables:

  • A variable that is connected to some quantifier in the formula.
  • and a variable that is not connected to any quantifier.

A free variable is a variable \(x\) that is found in a logical statement, that does not have a quantifier connected to it. To evaluate the truth of these kinds of variables, we need an assignment of that variable to some domain element.

A bound variable is the opposite of a free variable. When a variable is connected to a quantifier, it’s value is determined (or bound) in some fashion:

  • \(\exists x\) - \(x\) is given some value from the domain.
  • \(\forall x\) - \(x\) is given every possible value from the domain.
TipNotation

A formula \(\varphi\) that has the free variable \(x\) is written as \(\varphi(x)\). This does not mean that \(\varphi\) is a predicate with input \(x\), but the variable \(x\) can be found in the formula.

For example:

\[ \varphi(x) := \text{Person}(x) \rightarrow \text{Mortal}(x) \]

has the free variable \(x\) - no quantifier on \(x\) is provided.

\[ \varphi := \forall x \big( \text{Person}(x) \rightarrow \text{Mortal}(x) \big) \]

has the bound variable \(x\) - the forall quantifier is connected to \(x\)

The ordering of quantifiers can also change how we read a formula.

For example, the two sentences:

  • Every student has a lab computer
  • Every student has the same computer

These are very clearly different sentences. The first means that every person in the class has access to a lab computer, and importantly, it is not necessarily the same computer. The second means that every person has the exact same computer.

Translating these into logic:

\[ \forall x \: \exists y \: \text{UsesComputer}(x, y) \]

Every student \(x\) uses at least one computer \(y\).

\[ \exists y \: \forall x \: \text{UsesComputer}(x, y) \]

The one computer \(y\) is used by every student \(x\).

Now we have everything we need to define First Order Logic formally.

8.3 The Syntax of First Order Logic \(\mathcal{L}_{FO}\)

The formal language \(\mathcal{L}_{FO}\) of First Order Logic (FOL) requires a finite alphabet if we want to be able to write it. Our alphabet consists of:

  • The finite signature \(\Omega\) of our language:
    • What constants \(CONS = \{ 0, 1, ... \}\) are available?
    • What functions \(FUNC = \{ f, g, h, ... \}\)?
    • What predicates \(PRED = \{ P, Q, R, ... \}\)?
    • \(\Omega = ( CONS, FUNC, PRED )\)
  • The variables \(VARS = \{ x, y, z, ... \}\) we can use in a formula
  • Our first order logic specific symbols of \(\{ \exists, \forall, = \}\)
  • and lastly, all the logical connectives we had in propositional logic as well: \(\{ \neg, \vee, \wedge, \rightarrow, \leftrightarrow \}\)
Note

Why are variables not included in the signature of language?

The reason is two fold:

  1. We don’t need variables to write simple formulas in FOL - constants, functions and predicates are all that is technically required: \(P(f(c))\) is an acceptable statement.
  2. We use an assignment to evaluate variables. The assignment function \[ \alpha: VARS \mapsto D \] is the evaluation step, but in the next section we’ll see that the elements of the signature require a more complex object called an interpretation.

In propositional logic, we only cared about the words that formed a formula. Some statement that could be evaluated out to True or False.

First order logic has also given us objects that we can use. Now we need to be able to write these objects down as well. We say a word \(w\) is a well-formed term if:

  1. \(w = c \in CONS\)
  2. \(w = x \in VARS\)
  3. \(w = f(t_1, t_2, ..., t_n)\) if \(f \in FUNC\), \(t_i\) is a term, and \(n\) is the arity of \(f\)
Note

The decision problem for a term is

\[ \text{IS-FO-TERM} := \{ w \mid w \text{ is a well-formed term } \} \]

Now, with our objects neatly defined as terms, we can define the first order formulas. A word \(w\) is a well-formed formula if:

  1. \(w = t_1 = t_2\) if \(t_1\) and \(t_2\) are terms
  2. \(w = P(t_1, t_2, ..., t_n)\) if \(P \in PRED\), \(t_i\) is a term, and \(n\) is the arity of \(P\)
  3. \(w = \neg \varphi\) if \(\varphi\) is a formula
  4. \(w = \varphi_1 \land \varphi_2\) if \(\varphi_1\) and \(\varphi_2\) are formulas
  5. \(w = \varphi_1 \lor \varphi_2\) if \(\varphi_1\) and \(\varphi_2\) are formulas
  6. \(w = \varphi_1 \rightarrow \varphi_2\) if \(\varphi_1\) and \(\varphi_2\) are formulas
  7. \(w = \varphi_1 \leftrightarrow \varphi_2\) if \(\varphi_1\) and \(\varphi_2\) are formulas
  8. \(w = \exists x \: \varphi\) if \(\varphi\) is a formula and \(x \in VARS\)
  9. \(w = \forall x \: \varphi\) if \(\varphi\) is a formula and \(x \in VARS\)
Note

The decision problem for a formula is

\[ \text{IS-FO-FORMULA} := \{ w \mid w \text{ is a well-formed formula} \} \]

The decision problem to determine if a word is well-formed in first order logic is then

\[ \text{IS-FO-WELL-FORMED} := \text{IS-FO-TERM} \cup \text{IS-FO-FORMULA} \]

8.4 The Semantics of \(\mathcal{L}_\text{FO}\)

In propositional logic, a truth assignment to every proposition was the only thing we needed to determine the truth of a formula. In first order logic, with the domain of discourse, constants, functions, and predicates, we now require a significantly more complex object to evaluate it.

This new object is called a model (\(\mathfrak{M}\)) of FOL. This model is composed of two elements:

  1. The domain of discourse \(D\): a non-empty set of objects.
  2. An interpretation function \(I\): a function that maps each element of our signature to some changeable meaning.

\[ \mathfrak{M} := (D, I) \]

Our interpretation function does something different for every component of our signature. It maps each constant \(c \in CONS\) to a specific element in \(D\), each function \(f \in FUNC\) to a some function (of the same arity) over \(D^n\), and each predicate \(P \in PRED\) is mapped to a subset of \(D^n\).

  1. \(I(c) \in D\) for each \(c \in CONS\)
  2. \(I(f): D^n \mapsto D\) for each \(f \in FUNC\)
  3. \(I(P) \subseteq D^n\) for each \(P \in PRED\)
Tip

Why are interpreted predicates subsets instead of a function from \(D^n\) to \(\{ T, F \}\)?

The reason is that the set encodes the properties of the object as part the sets definition. Testing if an element has this property is then just a matter of testing if the element is in the subset.

However, this is functionally equivalent to using a characteristic function \[I(P): D^n \mapsto \{ T, F \}\]

The reason to defer to sets over characteristic functions is then just historical convention. Model theory in First Order Logic developed out of set theory, so membership testing was already well understood, and useful concept.

Using our model definition, we evaluate a term by mapping it to some value in the domain \(D\).

\[ \llbracket t \rrbracket^{\mathfrak{M}, \alpha}: TERM \mapsto D \]

Now, evaluating terms under a model \(\mathfrak{M}\) and assignment \(\alpha\) is then:

  1. \(\llbracket c \rrbracket^{\mathfrak{M}, \alpha} = I(c) \in D\)
  2. \(\llbracket x \rrbracket^{\mathfrak{M}, \alpha} = \alpha(x) \in D\)
  3. \(\llbracket f(t_1, t_2, ..., t_n) \rrbracket^{\mathfrak{M}, \alpha} = I(f)(\llbracket t_1 \rrbracket^{\mathfrak{M}, \alpha}, \llbracket t_2 \rrbracket^{\mathfrak{M}, \alpha}, ..., \llbracket t_n \rrbracket^{\mathfrak{M}, \alpha})\)

Formula evaluation instead relies on the familiar notation from propositional logic:

\[ \mathfrak{M} \vDash \varphi \: [\alpha] \]

The only additional component is that we specify the current variable assignment \(\alpha\) in the evaluation.

A model \(\mathfrak{M}\) satisfies a formula \(\varphi\) under an assignment \(\alpha\) using the following rules:

  1. \(\mathfrak{M} \vDash t_1 = t_2 \: [\alpha] \iff \llbracket t_1 \rrbracket^{\mathfrak{M}, \alpha}\) and \(\llbracket t_2 \rrbracket^{\mathfrak{M}, \alpha}\) are the same element in the domain.
  2. \(\mathfrak{M} \vDash P(t_1, t_2, ..., t_n) \:[\alpha] \iff\) \(P \in PRED\), \(n\) is the arity of \(P\), and \(\llbracket (t_1, t_2, ..., t_n) \rrbracket^{\mathfrak{M}, \alpha} \in I(P)\)
  3. \(\mathfrak{M} \vDash \neg \varphi \:[\alpha] \iff \mathfrak{M} \nvDash \varphi \:[\alpha]\)
  4. \(\mathfrak{M} \vDash \varphi_1 \land \varphi_2 \:[\alpha] \iff \mathfrak{M} \vDash \varphi_1 \:[\alpha] \text{ and } \mathfrak{M} \vDash \varphi_2 \:[\alpha]\)
  5. \(\mathfrak{M} \vDash \varphi_1 \lor \varphi_2 \:[\alpha] \iff \mathfrak{M} \vDash \varphi_1 \:[\alpha] \text{ or } \mathfrak{M} \vDash \varphi_2 \:[\alpha]\)
  6. \(\mathfrak{M} \vDash \varphi_1 \rightarrow \varphi_2 \:[\alpha] \iff \mathfrak{M} \nvDash \varphi_1 \:[\alpha] \text{ or } \mathfrak{M} \vDash \varphi_1 \land \varphi_2 \:[\alpha]\)
  7. \(\mathfrak{M} \vDash \varphi_1 \leftrightarrow \varphi_2 \:[\alpha] \iff \mathfrak{M} \vDash \varphi_1 \rightarrow \varphi_2 \:[\alpha] \text{ and } \mathfrak{M} \vDash \varphi_2 \rightarrow \varphi_1 \:[\alpha]\)
  8. \(\mathfrak{M} \vDash \forall x \; \varphi (x) \: [\alpha] \iff\) for every \(\beta \overset{x}{=} \alpha\), \(\mathfrak{M} \vDash \varphi(x) \:[\beta]\)
  9. \(\mathfrak{M} \vDash \exists x \; \varphi (x) \: [\alpha] \iff\) for at least one \(\beta \overset{x}{=} \alpha\), \(\mathfrak{M} \vDash \varphi(x) \:[\beta]\)
TipNotation

An assignment \(\alpha\) is defined as a mapping from variables to domain elements.

So an assignment might look something like this

\[ \alpha(var) := \begin{cases} d_1 & \text{if } var = x \\ d_2 & \text{if } var = y \end{cases} \]

where \(d_1, d_2 \in D\)

The notation \(\alpha \overset{x}{=} \beta\) means that \(\alpha\) and \(\beta\) are two assignments that are mostly equal. They only differ on the value of the specified variable \(x\).

So in our example where \(\alpha \overset{x}{=} \beta\), then

\[ \beta(var) := \begin{cases} d_3 & \text{if } var = x \\ d_2 & \text{if } var = y \end{cases} \]

where \(d_3 \in D\)

Note

The quantifier evalutations are a fairly opaque definition. It helps to try write the same thing but in english.

\[ \mathfrak{M} \vDash\forall x \; \varphi(x) \:[\alpha] \iff \text{for every } \beta \overset{x}{=} \alpha, \mathfrak{M} \vDash \varphi(x) \:[\beta] \]

becomes:

The model \(\mathfrak{M}\) satisfies \(\forall x \; \varphi(x)\) under assignment \(\alpha\) if for every choice of assignment \(\beta\) for \(x\) from \(\alpha\), \(\mathfrak{M}\) satisfies \(\varphi(x)\).

Similarly, \(\exists x \; \varphi(x)\) is satisfied if there is at least one assignment \(\beta\) for \(x\) from \(\alpha\), such that \(\mathfrak{M}\) satisfies \(\varphi(x)\) under \(\beta\).

An informal framing to help you think about it is that:

The model \(\mathfrak{M}\) satisfies \(\forall x \; \varphi(x)\) under assignment \(\alpha\) if we turn \(x\) into a free variable by dropping the quantifier, and then \(\mathfrak{M}\) satisfies \(\varphi(x)\) for every assignment of that free variable.

To help demonstrate, lets try the following examples:

\[ \mathfrak{M} = ( \{ a, b \}, I ) \text{ where } I(P) = \{ a \} \text{ and } I(Q) = \{ b \} \]


Does \(\mathfrak{M} \vDash \forall x \; P(x) \:[\alpha]\)? \[\begin{align*} \text{Let } \beta(x) = a & \implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} = a \\ & \implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} \in I(P) \\ & \implies \mathfrak{M} \vDash P(x) \:[\beta] \\ &\\ \text{Let } \beta(x) = b &\implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} = b \\ &\implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} \notin I(P) \\ &\implies \mathfrak{M} \nvDash P(x) \:[\beta] \\ &\\ \therefore \mathfrak{M} \nvDash \forall x P(x) \: [\alpha] &\text{ as \textit{not} for every} \beta \overset{x}{=} \alpha, \mathfrak{M} \vDash P(x) \:[\beta] \end{align*}\]


Does \(\mathfrak{M} \vDash \forall x \; (P(x) \lor Q(x)) \:[\alpha]\)? \[\begin{align*} \text{Let } \beta(x) = a & \implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} = a \\ & \implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} \in I(P) \\ & \implies \mathfrak{M} \vDash P(x) \:[\beta] \\ & \implies \mathfrak{M} \vDash P(x) \lor Q(x) \:[\beta] \\ &\\ \text{Let } \beta(x) = b &\implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} = b \\ &\implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} \in I(Q) \\ &\implies \mathfrak{M} \vDash Q(x) \:[\beta] \\ & \implies \mathfrak{M} \vDash P(x) \lor Q(x) \:[\beta] \\ &\\ \therefore \mathfrak{M} \vDash \forall x (P(x) \lor Q(x)) \: [\alpha] &\text{ as for every} \beta \overset{x}{=} \alpha, \mathfrak{M} \vDash P(x) \lor Q(x) \:[\beta] \end{align*}\]


And as the last one: Does \(\mathfrak{M} \vDash \exists x \; P(x) \:[\alpha]\)? \[\begin{align*} \text{Let } \beta(x) = a & \implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} = a \\ & \implies \llbracket x \rrbracket^{\mathfrak{M}, \beta} \in I(P) \\ & \implies \mathfrak{M} \vDash P(x) \:[\beta] \\ &\\ \therefore \mathfrak{M} \vDash \exists x \; P(x) \: [\alpha] &\text{ as for at least one } \beta \overset{x}{=} \alpha, \mathfrak{M} \vDash P(x) \:[\beta] \end{align*}\]


8.5 Properties of \(\mathcal{L}_{FO}\)

In propositional logic, we identified 4 ‘meta’ properties of \(\mathcal{L}_{P}\)

  1. Does \(v \vDash \varphi\)? - Is \(\varphi\) true? - \(\text{PROP-TRUTH}\)
  2. Is \(\varphi\) satisfiable? - Can \(\varphi\) be true? - \(\text{PROP-SAT}\)
  3. Is \(\varphi\) valid? - Is \(\varphi\) always true? - \(\text{PROP-VAL}\)
  4. Is \(\varphi\) a consequence of \(\Lambda\)? - If \(\Lambda\) is true, then is \(\varphi\) true? - \(\text{PROP-CONQ}\)

Now, we want to do the same for first order logic. However, to help simplify our work we are going to restrict our properties to specific types of formulas.

A sentence is a formula that has only bound variables.

While it is possible to generalise the next sections of work to formulas with free variables, it requires a more technical effort to a handle the necessary nuances. For example, the formula \(P(x)\) might be true in \(\mathfrak{M}\) when \(\alpha(x) = a\), but false when \(\alpha(x) = b\). Our properties would need to handle every possible assignment as well.

Working with just sentences means that we can simplify our work by avoiding variable assignments as much as possible. This also simplifies our notation. By using sentences, we can drop the continual references to assignments.

The truth of a sentence \(\varphi\) in a model \(\mathfrak{M}\) is now \[ \mathfrak{M} \vDash \varphi \]

8.5.1 \(\text{FO-TRUTH}\)

In the previous section, we saw a few worked examples of truth of a first order formula.

As a rough set of steps, we broke the formula down until its smallest components, and then built our way back up. This is a very similar algorithm to the one we wrote for \(\text{PROP-TRUTH}\).

So, our language is:

\[ \text{FO-TRUTH} := \{ \langle \mathfrak{M}, \varphi \rangle \mid \mathfrak{M} \vDash \varphi \} \]

and now we can write the Turing Machine.

Except, we first need to understand what \(\langle \mathfrak{M} \rangle\) actually looks like.

\[ \mathfrak{M} = (D, I) \implies \langle \mathfrak{M} \rangle = \langle D \rangle \# \langle I \rangle \]

Next is \(\langle D \rangle\). Here we encounter a problem.

The domain of discourse is just defined as a non-empty set. This definition doesn’t stop us from having an infinite domain like the natural numbers. How do we represent an arbitrary infinite object as a finite string?

The answer there is quite simple: we cannot.

That means that our language \(\text{FO-TRUTH}\) doesn’t exist for an arbritary domain. If we make the assumption that \(D\) is finite however, then we can of course define a similar language.

\[ \text{FINITE-FO-TRUTH} := \{ \langle \mathfrak{M}, \varphi \rangle \mid D \text{ of } \mathfrak{M} \text{ is finite and } \mathfrak{M} \vDash \varphi \} \]

For our purposes, we are interested in the finite and infinite domain case of first order logic, so we’ll leave \(\text{FINITE-FO-TRUTH}\) as an enrichment exercise.

WarningExercise
  1. Provide a string representation of finite models \(\langle \mathfrak{M} \rangle\)
  2. Provide a TM that decides \(\text{FINITE-FO-TRUTH}\)

8.5.2 \(\text{FO-SAT}\)

Propositional satisfiability is defined as follows:

\[ \varphi \in \mathcal{L}_P^* \text{ is satisfiable } \iff \text{there exists an assignment } v, v \vDash \varphi \]

The definition for first order satisfiability is now generalising the propositional assignment, to first order model.

\[ \varphi \in \mathcal{L}_{FO}^* \text{ is satisfiable } \iff \text{there exists a model } \mathfrak{M}, \mathfrak{M} \vDash \varphi \]

Interestingly enough, the definition of ‘exists a model’ means that we can avoid mention of \(\mathfrak{M}\) in the definition of the decision problem for first order satisfiability.

\[ \text{FO-SAT} := \{ \langle \varphi \rangle \mid \varphi \text{ is satisfiable } \} \]

This means that if we could develop some method to avoid using the model directly (or a full definition of it), we could still write an algorithm for this \(\text{FO-SAT}\).

Let’s assume for a moment that we had some magical technique where we could write \(\mathfrak{M}\) without needing to write any infinite string. Then, continuing the magic, we also had some way to enumerate all of these models.

These assumptions mean that we could write the decider \(M_{FT}\) for \(\text{FO-TRUTH}\), and now \(M_{FS}\) for \(\text{FO-SAT}\).

define \(M_{FS}\) on \(\langle \varphi \rangle\):
\(\quad\) for every \(\langle \mathfrak{M} \rangle\):
\(\quad\) \(\quad\) if \(M_{FT}(\langle \mathfrak{M}, \varphi \rangle) = 1\) then
\(\quad\) \(\quad\) \(\quad\) Accept
\(\quad\) Reject

Amazing, we (maybe) have a Turing Machine for \(\text{FO-SAT}\). All we need to is make sure that it is a decider.

The only two components we need to worry about are of course the loops. So, how many different models \(\mathfrak{M}\) are there?

Let’s start with the simplest possible model - a domain of numbers.

Let \(D = \{ 0 \}\), the number \(0 \in \mathbb{N}\), then we have the model \(\mathfrak{M}_0\).
Let \(D = \{ 0,1 \} \implies \mathfrak{M}_1\).
And \(D = \{ 0,1,2 \}\implies \mathfrak{M}_2\).

It seems that we can define a new domain model for every next natural number \(n\) \[ \text{Let } D = { 0, 1, ..., n } \text{ where } n \in \mathbb{N} \implies \mathfrak{M}_n \]

There are an infinite amount of natural numbers…

WarningExcercise

Try write a rigourous proof to show that there are at least a countably infinite number of domains.

Optionally, and solely because you have too much free time
As a foray into the craziness of infinite and the continuum, try find out how many models do actually exist.

As a hint, remember what we said about the size of powersets and the relationship between \(\aleph_0\) and \(\mathfrak{c}\).

So if \(\varphi\) is not satisfiable i.e no model exists to satisfy it, then our for loop is just going to get stuck in an infinite loop.

Even with our magic representation of models, it still is not enough.

8.5.3 An interlude of Logical Notation

In Logic I, I mentioned that we should avoid using the symbol \(\exists\) in the definition of propositional satisfiability.

The reason for this is because \(\exists\) has a very specific meaning in first order logic of

\[ \mathfrak{M} \vDash \exists x \; \varphi(x) \iff \text{for at least one } \beta \overset{x}{=} \alpha, \mathfrak{M} \vDash \varphi(x) \: [\beta] \]

The quantifiers of first order logic are about variables and the assignment of these variables. Using this same notation to refer to different propositional assignments, and now even different first order models, can become confusing.

To use this notation to reference models, we need the new concept of meta notation. Meta notations are mathematical symbols that don’t feature as part of the formal language we are working in, but allow us to condense our descriptions and reasoning about this formal language.

In fact, we have been using meta-notation prolifically throughout the last two sections. Both \(\iff\) and \(\implies\) are the meta-notation equivalents of \(\leftrightarrow\) and \(\rightarrow\) respectively.

Why then do we use \(\iff\) but not \(\exists\) as pieces of meta notation? \(\iff\) is a distinct (but similar) symbol from \(\leftrightarrow\), and visually can be separated from each other. The quantifiers \(\forall\) and \(\exists\) have no ‘similar’ symbols to make the distinction.

Instead a reader is required to identify the meaning from the context of its usage. Avoiding the usage of \(\exists\) and \(\forall\) is then just a choice I made to help clarify its meaning.

For consistency, we’ll define validity and consequence using the text descriptions instead of notation, but you may use it in your own notes if you would prefer.

8.5.4 \(\text{FO-VAL}\)

Propositional validity is defined as \[ \: \vDash \varphi \in \mathcal{L}_P^* \iff \text{ for every assignment } v, v \vDash \varphi \]

Again, to step up into first order logic, we use models instead. \[ \: \vDash \varphi \in \mathcal{L}_{FO}^* \iff \text{ for every model } \mathfrak{M}, \mathfrak{M} \vDash \varphi \]

This gives us the decision problem \[ \text{FO-VAL} := \{ \langle \varphi \rangle \mid \: \vDash \varphi \} \]

To repeat the argument, even if we had our magical representation of \(\mathfrak{M}\), a brute force enumeration of every model will still give us an infinite loop. The main difference is that now it would get stuck when a formula is valid, compared to the looping when the formula wasn’t satisfiable.

The machine for \(\text{FO-VAL}\) is:

define \(M_{FV}\) on \(\langle \varphi \rangle\):
\(\quad\) for every \(\langle \mathfrak{M} \rangle\):
\(\quad\) \(\quad\) if \(M_{FT}(\langle \mathfrak{M}, \varphi \rangle) = 0\) then
\(\quad\) \(\quad\) \(\quad\) Reject
\(\quad\) Accept

8.5.5 \(\text{FO-CONQ}\)

Last, but certainly not least, we have consequence.

Consequence was the tool we used to write ‘proofs’ in prop logic. If these formulas are true, then this formula is true.

\[ \Lambda \vDash \varphi \in \mathcal{L}_P^* \iff \text{ if an assignment } v \vDash \bigwedge \Lambda \text{ then } v \vDash \varphi \]

In first order logic, it serves the same purpose: \[ \Lambda \vDash \varphi \in \mathcal{L}_{FO}^* \iff \text{ for every model, if }\mathfrak{M} \vDash \bigwedge \Lambda \text{ then } \mathfrak{M} \vDash \varphi \]

The decision problem is \[ \text{FO-CONQ} := \{ \langle \Lambda , \varphi \rangle \mid \Lambda \vDash \varphi \} \]

Most unfortunately, nothing has changed with the addition of \(\Lambda\).

define \(M_{FC}\) on \(\langle \Lambda, \varphi \rangle\):
\(\quad\) for every \(\langle \mathfrak{M} \rangle\):
\(\quad\) \(\quad\) if \(M_{FT}(\langle \mathfrak{M}, \bigwedge \Lambda \rangle) = 1\) then
\(\quad\) \(\quad\) \(\quad\) if \(M_{FT}(\langle \mathfrak{M}, \varphi \rangle) = 0\) then
\(\quad\) \(\quad\) \(\quad\) \(\quad\) Reject
\(\quad\) Accept

8.6 The relationship between \(\text{FO-SAT}\), \(\text{FO-VAL}\), and \(\text{FO-CONQ}\)

In Logic I and its tutorial, we established a few relationships between satisfiability, validity and consequence.

The important idea being that we can reduce \(\text{PROP-SAT}\), \(\text{PROP-VAL}\), and \(\text{PROP-CONQ}\) to each other.

The question remains does stepping into first order logic maintain or lose these relationships?

At a glance, this relationship seems to hold. The relationships in prop logic were proved by applying their definitions rather then manipulating the inner structure of the assignment. Therefore, even if first order models are more complex, we don’t really need the internal description of the model.

The last thing to do is to prove the following for use in the actual reductions of the First Order decision problems. We’ll leave them as exercise: the proofs are essentially identical to their propositional equivalents - using the model instead of the prop assignment.

For \(\varphi \in \mathcal{L}_{FO}^*\):

  1. \(\:\vDash \varphi \iff \neg \varphi \text{ is not satisfiable}\)
  2. \(\Lambda \vDash \varphi \iff \:\vDash \bigwedge \Lambda \rightarrow \varphi\)
  3. \(\emptyset \vDash \varphi \iff \:\vDash \varphi\)