1 Logic

1.9 First order logic

The WFFs we have studied so far only capture logical statements of a very simple form. Very commonly we want to work with more complex statements, especially those that depend on some kind of parameter or variable. Here are some examples.

Example 1.9.1.
  • There exists a rational number x with x2=2.

  • For every natural number22 2 A natural number is a non-negative whole number. n there exists a prime number p with p>n.

  • For all real numbers m there exists a real number n such that for all real numbers x greater than n it holds that ex is greater than m.

These kinds of statement are especially common in analysis, but they arise everywhere in mathematics. Propositional calculus doesn’t have a way of talking about statements that depend on a variable, and might be true for some values, or all values, or no values that variable could take. It also has no way to talk about functions or relations. The logical theory we’re going to learn about that can deal with statements like this is called first order logic or predicate calculus.

In propositional calculus we had WFFs. The corresponding thing in first order logic is called a first order formula. We will treat these very informally — if you want to learn about these in detail, read chapter 4 of the book by Goldrei mentioned in the further reading section at the end of this chapter, or take MATH0037 in year 3.

Here is a simple example of a first order formula:

xXyY:R(x,y)

The meaning of this is “for all x in the set X, there exists a y in the set Y such that the property R(x,y) is true for x and y.” The new things here are the symbol which means “in,” the quantifiers and , and the predicate R(x,y). In the next two subsections we’ll explain what these last two are.

1.9.1 Predicates

A predicate P(x) on a set X is a statement that becomes true or false when an element of X is substituted for the variable x. For example, “x is even” is a predicate on the integers, since for every integer n the statement “n is even” is either true or false.

We need predicates like P(x,y) that require more than one variable. For example, P(x,y) could be the statement “|xy|<1” which is a true or false statement about any two real numbers x and y.

1.9.2 Quantifiers

Lots of statements in mathematics involve the idea of a predicate being true for some, or for all, values of a particular variable. For example:

  • There exists some rational number q such that q2=2.

  • For all real numbers x, we have x20.

  • For all natural numbers n, there exists a prime number p such that p>n.

To write these formally we use quantifiers. There are two types of quantifier: , the universal quantifier, and , the existential quantifier.

The universal quantifier is used to say that something is true for every element of a particular set, called the domain of the quantifier. If P(x) is a predicate,

xX:P(x)

is read as “for all x belonging to X, the statement P(x) is true.” So

x:x2>0

is false, because not every real number x satisfies x2>0, but

x:x20

is true, since every real number x satisfies x20.

The existential quantifier is used to say that something is true for at least one element of a particular set, again called the domain. If P(x) is a predicate

xX:P(x)

says “there exists x in X such that P(x) is true.” Such a statement is true when there is at least one x belonging to the set X making P(x) true. For example,

x:x2>0

is true, because there is at least one real number x whose square is positive (in fact, there’s infinitely many!), but

x:x2<0

is false since there is no real number x whose square is negative.

Let’s write the three examples at the start of this subsection using quantifier notation. We use to represent the set of rational numbers, for the set of real numbers, for the set of natural numbers, and for the set of prime numbers. The statement are then:

  • q:q2=2

  • x:x2>0

  • np:p>n.

1.9.3 Note on how domains for quantifiers are specified

In all the examples above, we specified the domain of the quantifier explicitly. Sometimes, especially in analysis, the domain is specified using a condition. Analysts will write

ϵ>0δ>0:

to mean “for all positive real numbers ϵ, there exists a positive real number δ, …”. You can think of this as meaning

ϵ(0,)δ(0,):

where (0,) means the set of all positive real numbers.

There are even times when the domain of one variable seems to depend on another — you might see an expression like

npn:P(p,n)

If p is intended to be a natural number, for example, we could rewrite this as

np:(pn)P(p,n).

1.9.4 Multiple quantifiers

We need more than one quantifier to express statements whose truth depends on more than one variable. For example, in analysis, the definition of a function f being bounded is that

Mx:|f(x)|M,

that is, there exists a real number M such that for all real numbers x we have |f(x)|M. The definition of a function being continuous at a point is even more complicated, requiring three quantifiers.

When we have more than one quantifier, it’s important to get the quantifiers in the correct order because if you change the order of the quantifiers you may change whether or not the statement is true.

Example 1.9.2.
xy:x+y=0

is true, because no matter what real number x you give me, I can find a real number y (equal to x) such that x+y=0. On the other hand

yx:x+y=0

which is the same statement except that the quantifiers are the other way round, is false because there is no real number y such that for all real numbers x we have x+y=0.

However, quantifiers of the same type can be swapped without changing the truth or falsity of the statement, for example both

xXyY:P(x,y)

and

yYxX:P(x,y)

are true if and only if P(x,y) is true for every x in X and every y in Y.

1.9.5 Negation

It’s often useful to ask what it would mean for a quantified statement not to be true. For example, you might want to prove that a certain sequence (an) does not tend to 0. The definition of a sequence tending to 0 is that

ϵ(0,)Nn:nN|an|<ϵ.

We could negate this just by adding a ¬ to the front: to say that a sequence does not tend to 0 is to say that

¬ϵ(0,)Nn:nN|an|<ϵ

but it would be helpful if we could simplify this in some way, to make it easier to prove. We can do this with the following quantifier rules.

Theorem 1.9.1.

For any predicate P(x) on a set X,

  1. 1.

    ¬(xX:P(x)) is true if and only if xX:¬P(x) is true, and

  2. 2.

    ¬(xX:P(x)) is true if and only if xX:¬P(x) is true.

The first of these holds because to say xX:P(x) is false means that not every P(x) for xX is true, that is, there exists xX such that P(x) is false. The second can be seen similarly.

By using these rules repeatedly, we can find equivalent forms of negated quantified statements even when they contain multiple quantifiers. Returning to our example of a sequence not tending to zero,

¬ϵ(0,)Nn:nN|an|<ϵ
is true if and only if
ϵ(0,)¬Nn:nN|an|<ϵ
is true, if and only if
ϵ(0,)N¬n:nN|an|<ϵ
is true, if and only if
ϵ(0,)Nn:¬(nN|an|<ϵ).

At this point we can use what we know about logical equivalences for WFFs to simplify further: this is equivalent to

ϵ(0,)Nn:(nN)(|an|ϵ).

We now know what we need to do to prove (an) doesn’t tend to 0: we have to find some ϵ>0 such that for every N, there is an nN such that |an|ϵ.

We will now look at some more examples of producing useful equivalent forms for negations of quantified statements. We’re going to use real-life examples from bits of mathematics you may not have met yet, but this won’t be a problem as our negation procedure doesn’t require understanding anything about the meaning of the statement!

Example 1.9.3.

The statement “every value the function f: takes is less than 10” can be written

x:f(x)<10.

What does it mean for this to be false? Let’s negate it, using the negation of quantifiers theorem 1.9.1. That tells us

¬x:P(x)

is equivalent to

x:¬P(x)

which in our case says x:¬(f(x)<10), or x:f(x)10.

Example 1.9.4.

Consider the statement “the function f: is bounded”, which we could write as

Mx|f(x)|M.

Let’s negate it. To keep things short, we’ll write P(x,M) for the predicate |f(x)|M. We know that

¬Mx:P(x,M)
is true if and only if
M¬x:P(x,M)
is true, if and only if
Mx:¬P(x,M).

so “the function f is not bounded” can be written as Mx:¬(|f(x)|M), or equivalently, Mx:|f(x)|>M.