User blog:DontDrinkH20/H-Boogol-Boogol Bit by bit: PART 2: Higher Order Logic

This is a series of blog posts I will make to try to generalize the understanding of H-boogol-boogol to the general public of this wiki. It's quite a mind boggling concept, but the kind of person on this website is likely the kind of person who can figure it out if they just read a couple different detailed descriptions. So just believe in yourself, and feel free to get out a notebook and start taking notes.

In the last blog post, Model Theory 101, we looked at systems of mathematics, and formalized the idea of one. We also formalized the idea of "this universe obeys the system of mathematics...." This idea is known as model theory. If you haven't read that yet, go read it now!

First Order Logic Isn't the Only One
In the last blog post, you may remember that I kept putting (first order finitary) in front of everything. This is because nearly all of the things we talked about relied exclusively on first order finitary logic. This is so that I wouldn't confuse you when you got here. Today, right now, I'll talk about higher order logic.

In first order semantics, if you can remember, we defined what (\mathcal{M}\models\varphi[x_0...x_n]\) means for a structure \(\mathcal{M}\) and a first order formula \(\varphi\). The idea behind first order semantics is that you quantify over elements of \(\mathcal{M}\).

For example, \((M; c)\models"\forall x(x = C)"\) if and only if for every \(x\in M\), \(x\) is \(C\). However, we can't express something like this: "for every unary relation \(X\) of \(M\), \(X(C)\)." (Equivalently, for every \(X\subseteq M\), \(X(C)\)). This is why we use 2nd-order logic.

Wait... There are Things First Order Logic Can't Do?
Yep! There are indeed. | Tarski's undefinability theorem shows that in ANY logic which has consistent semantics (no paradoxes, please), there is no way to define a truth predicate for that logic. "But Keith," I hear you say, "what is a truth predicate?" Well shut up, I'm getting to that part.

A truth predicate is basically a relation \(T\) which, when given a formula \(\varphi\) and some objects of the universe \(x_0,x_1...x_n\) such that \(T(\varphi,x_0,x_1...x_n)\). More formally, each formula is encoded in some way (it doesn't actually matter how) but anywho, Tarski's undefinability theorem guarantees that:

If you can encode each formula as a unique object, the truth predicate for that logic based on that encoding is undefinable in that logic. In particular, there is no way to express "\(x\) is undefinable by this logic" in a given structure.

So for example, in the Peano Axioms (natural number axioms), working in the structure \(\mathcal{M}\) you can use Godel numbering to encode every first-order formula as a unique natural number. If you let \(\G(n)\) be the unique formula \(\varphi\) which is encoded as \(n\), there is no first-order formula \(\psi\) such that \(\mathcal{M}\models\psi[n,x_0,x_1,x_2...]\) iff \(\mathcal{M}\models G(n)[x_0,x_1...x_2]\). You simply can't define first-order logic in first-order logic.

HOWEVER, second-order logic can indeed define a first-order truth predicate, and in fact can define a whole bunch of other things first-order logic can't. So what is this mystical second-order logic we speak of? How can we define it?

What IS Higher Order Logic Anyways?
Higher order logic is really just a way to quantify over more things than elements of the universe; you can quantify over all relations of the universe. This allows for the ability to say A LOT more than you could; you can now quantify over "proper classes" in ZFC, for example.

The Intuition of Higher Order Logic
Here's a great example of why higher order logic allows you to do more. Vopěnka's principle is equivalent to the idea that for ANY unary predicate \(P\) such that:


 * 1) \(P(G)\) implies \(G\) is a graph (\(P\) only applies to graphs in other words)
 * 2) There is no set \(X\) such that the elements of \(X\) are precisely the \(x\) such that \(P(x)\) (\(P\) can't be described by a set; \(\{x:P(x)\}\) doesn't exist)

Then, there are some graphs \(G\) and \(H\neq G\) with \(P(G)\) and \(P(H)\) such that \(G\) is a subgraph of \(H\). In other words, if you look at all of the graphs with the property \(P\), there is bound to be one which is part of another.

It turns out that Vopěnka's principle can't be stated at all in first-order logic in ZFC (unless inconsistent, in which case its equivalent to "0=1."). The problem here is that Vopěnka's principle requires being able to talk about ALL predicates, which is something ZFC just can't do. Second order logic, by definition, is able to go "for every predicate..." and "there is some predicate such that..." which means it is easily able to state Vopěnka's principle.

For third order logic, we need to talk about a new thing: the "predicate predicate" (DISCLAIMER: not actual term). Say that \(P\) is a predicate predicate. Then, \(P(Q)\) is a statement which is true or false, depending on the predicate \(Q\). Third order logic allows you to quantify over predicate predicates, i.e. you can go "for every predicate predicate..." and "there is some predicate predicate such that..."

For example, you could say \(P(Q)\) is true if and only if \(Q(\emptyset)\) for a predicate predicate \(P\). (In actuality, they are called \(n\)-th order predicates.)

Higher order logic is just the idea of third order logic generalized to so-called "\(n\)-predicates." IF YOU ARE A SET THEORIST, there is a much simpler explanation. First order logic quantifies over all elements of the universe \(U\). Second-order logic quantifies over all subsets of the universe \(U\). Third-order logic quantifies over all subsets of the powerset of the universe \(U\), and so on.

The More Formal Definition
I'm going to formally define higher order logic statements here. It's OK if you don't understand, just go back and reread until you feel comfortable with it (these definitions are from Jech's "Set Theory").

First of all, for a set \(M\), \(\mathcal{P}^1(M)\) is the set of all subsets of \(M\). \(\mathcal{P}^{n+1}(M)\) is the set of all subsets of subsets of \(M\), and so on. This is important to understand. From within a structure \(\mathcal{M}\) with universe \(M\), the subsets of \(M\) are like the predicates of \(\mathcal{M}\), and the subsets of those are like the "predicate predicates" of \(\mathcal{M}\). More generally, the elements of \(\mathcal{P}^{n-1}(M)\) can be thought of as the \(n\)-predicates of \(\mathcal{M}\).

An \(n\)-th order \(\mathcal{L}\)-term \(t\) is literally just an \(n-1\)-th order \(\mathcal{L}\)-term, but with the addition of "\(n\)-th order variables" \(v_m^{n-1}\) (these will be our "\(n\)-predicates").

Now, I will define an \(n\)-th order \(\mathcal{L}\)-formula. It is defined recursively as a \(\varphi\) which is either:
 * 1) An \(n-1\)-th order \(\mathcal{L}\)-formula
 * 2) "\(v_m^{n-1}(t)\)" where \(t\) is an \(n-1\)-th order \(\mathcal{L}\)-term (for example \(v_0^1(C)\) is asking whether \(v_0^1\), as a predicate, is true on \(C\))
 * 3) "\(\forall_n v_m^{n-1}(t)(\psi)\)" where \(\psi\) is another \(n\)-th order \(\mathcal{L}\)-formula such that \(v_m^{n-1}\) is a free variable in \(\psi\). \(v_m^{n-1}\) is no longer a free variable in \(\forall v_m^{n-1}(t)(\psi)\). (It is no longer one of the inputs of the formula).
 * 4) "\(\exists_n v_m^{n-1}(t)(\psi)\)" where \(\psi\) is another \(n\)-th order \(\mathcal{L}\)-formula such that \(v_m^{n-1}\) is a free variable in \(\psi\). \(v_m^{n-1}\) is no longer a free variable in \(\exists_n v_m^{n-1}(t)(\psi)\). (It is no longer one of the inputs of the formula).

Using the terminology \(\exists_n\) and \(\forall_n\) isn't standard. To be frank, there isn't much standard terminology on writing higher order logic.

Now, I will define standard semantics for higher order logic. Let \(\varphi\) be an \(n\)-th order \(\mathcal{L}\)-formula with \(m\)-many free variables (just assume they are \(v_0^{a_0}\), \(v_1^{b_0}\)...) and let \(\mathcal{M}\) be an \(\mathcal{L}\)-structure:


 * If \(\varphi\) is "\(v_0^{a_0}(t)\)" where \(t\) is an \(\mathcal{L}\)-term, then \(\mathcal{M}\models\varphi[v_0^{a_0},v_1^{a_1}...]\) for a set \(v_0^{a_0}\in\mathcal{P}^{a_0}(M)\) if and only if \(t^{\mathcal{M}}(v_1^{a_1}...)\in v_0^{a_0}\). Here's an example:
 * If \(\mathcal{M}=\mathbb{N}\) and \(\varphi\) is "\(v_0^1(0+1+1)\)", then \(\mathbb{N}\models\varphi[P]\) for a set \(P\) of natural numbers if and only if \(2^{\mathbb{N}}\in P\).
 * If \(\varphi\) is "\(\forall_n v_0^{a_0}(t)(\psi)\)" where \(\psi\) is another \(n\)-th order \(\mathcal{L}\)-formula, then \(\mathcal{M}\models\varphi[x_0,x_1...]\) iff \(\mathcal{M}\models\psi[P,x_1,x_2...]\) for every \(P\in\mathcal{P}^{a_0}\). For example:
 * If \(\mathcal{M}=\mathbb{N}\) and \(\varphi\) is "\(\not\forall v_0^2(v_0^2(v_1^1))\)", then \(\mathbb{N}\models\varphi[P]\) if and only if there is some predicate predicate of \(\mathbb{N}\), \(Q\), such that \(Q(P)\) is false. That is to say, there is some set of sets of natural numbers which does not have \(P\). (This is obviously the case, just using \({H\}\) as \(Q\) where \(H\neq P\)).
 * Similarly, if \(\varphi\) is "\(\exists_n v_0^{a_0}(t)(\psi)\)" where \(\psi\) is another \(n\)-th order \(\mathcal{L}\)-formula, then \(\mathcal{M}\models\varphi[x_0,x_1...]\) iff \(\mathcal{M}\models\psi[P,x_1,x_2...]\) for some \(P\in\mathcal{P}^{a_0}\).

There it is, now you can go about using higher order logic like all of the set theory pros do! Stay tuned for the next blog post, where I'll be explaining what it means for a theory to be an "effectively axiomatized formal system."