Learn Predicate Logic in about a week!

Learning should be fun and quick; no need to spend ages in just one single course.

Start learning  

#35 Mathematics
11 mins   /

What exactly is prenex normal form (PNF)?

Get to explore what is meant by the prenex normal form, how to convert to one, and what is the motivation behind doing so.

In the study of formal logic, the idea of normalization is a pretty useful one. It simply means to reduce a given logical expression into an equivalent or refined form which is based on a given structure and/or set of symbols.

Basically, normalization brings consistency in the specification of logical expressions. Normalization ensures that different expressions are represented in the same manner.

In predicate logic, a well-known normalization is called the prenex normal form (PNF). In this article, I'll show you exactly what it is, how to convert a predicate logic expression into PNF, and its larger application to computational logic and automated theorem provers.

What is prenex normal form?

Prenex normal form (PNF) is a normalization employed in predicate logic (or first-order logic). The main idea is to take all quantifiers to the left end of the expression. For example, consider the following:

::\forall x P(x) \land \forall y Q(y)::

This is NOT in prenex normal form. Why? you ask. Because all the quantifiers are not at the beginning. Here's the equivalent expression in PNF:

::\forall x \forall y (P(x) \land Q(y))::

Both the ::\forall x:: and ::\forall y:: quantifiers are now at the left side and therefore the expression is in prenex normal form. In general, PNF can be expressed as:

::Q_1 x_1 Q_2 x_2 ... Q_n x_n P(x_1, x_2, ..., x_n)::

where each one of ::Q_1::, ::Q_2::, ..., ::Q_n:: represents a universal quantifier or an existential quantifier, and ::P(x_1, x_2, ..., x_n):: denotes a predicate without any quantifiers (sometimes referred to as being a quantifier-free predicate).

There is an interesting theorem that states that any logical expression can be written equivalently in PNF.

The proof of this theorem is not really hard to understand but I won't be discussing it here.

How to convert to PNF?

Converting to PNF isn't a difficult thing to do if you are well-versed with equivalences in propostional logic, De Morgan laws for quantifiers, and some equivalences related to quantifiers. Once you know these basics, converting any expression in PNF involves a couple of simple steps.

  • Remove any negation (::\neg::) by taking it inwards.
  • Take quantifiers to the left side based on simple equivalences in quantifiers.

Let me show you some examples.

First, the same example as the one shown above:

::\forall x P(x) \land \forall y Q(y)::

It's easy to reason that this expression would be exactly the same if the quantifiers are all brought to the left side. Here's its PNF:

::\forall x \forall y (P(x) \land Q(y))::

Now, consider the following:

::\exists x (P(x) \to \exists y Q(y))::

Converting this to PNF is easy because the ::\exists y:: quantifier can be take:

::\exists x \exists y (P(x) \to Q(y))::

As another example, consider the following, where ::A:: denotes a proposition containing no quantifiers:

::\neg \exists y (A \lor \forall x P(x))::

To convert this to PNF, first let's take the negation inwards:

::\neg \exists y (A \lor \forall x P(x))\\ \forall y \neg (A \lor \forall x P(x))\\ \forall y (\neg A \land \neg \forall x P(x))\\ \forall y (\neg A \land \exists x \neg P(x))::

And now, it's just a matter of bringing the existential quantifier outside:

::\forall y \exists x (\neg A \land \neg P(x))::

The application of PNF

It's all good to know what is PNF and how to convert to it but what exactly is the purpose of this normalization? Is it just an interesting, abstract theory or some practical prerequisite for something much bigger and practical.

Well, it's indeed the latter — PNF is highly practical. PNF is a prerequisite for the more computationally useful Skolem normal form.

Without delving too much into its details, Skolemization — the process of converting an expression into Skolem normal form — takes a PNF expression and removes all existential quantifiers from it and replaces the existentially-quantified variables with a function, called the Skolem function.

For example, the PNF expression

::\forall x \exists y (P(x) \lor Q(y))::

would become the following after Skolemization:

::\forall x (P(x) \lor Q(f(x)))::

Here, ::f(x):: is the Skolem function, which depends on the value of ::x:: (which comes from the fact that the original statement states that For every ::x::, there is some ::y::; in other words, every ::x:: has a corresponding ::y::).

This Skolem normal form is in turn used in automatic theorem provers — like Vampire or Prover9 — because removing the existential quantifier makes working with the expression easier algorithmically.

PNF doesn't make expressions more readable

While we're at it, I want to raise the point that PNF is certainly NOT meant to make a logical expression easier for us to read. For example, if I say something like All humans are mortal and all plants are living creatures then a more natural expression would be:

::\forall h M(h) \land \forall p L(p)::

where ::h:: in the first quantifier ranges over all humans and ::p:: in the second one ranges over all plants (as is evident by the choice of their names as well); ::M(h):: means that Human ::h:: is mortal and ::L(p):: means that Plant ::p:: is a living creature.

But in PNF, this would become:

::\forall h \forall p (M(h) \land L(p))::

which groups two seemingly unrelated ideas together. Of course, the reduction in clarity might not be as evident in this example since it's contrived but hopefully you get the idea.

Bilal Adnan

Hi there! 👋 I'm the founder of Codeguage — basically the guy who's trying to make life easy for absolute beginners entering into computer science. You can follow me on LinkedIn or Medium to stay up-to-date with my conversations.