All articles
Discrete MathematicsOpen to everyone

Introduction to Quantifiers and First Order Predicate Logic

Here we will learn about the introduction to quanitifiers and predicate logic

Gulshan Kumar

Propositional logic treats complete statements such as

p: The number 5 is primep:\text{ The number 5 is prime}

as single units.

However, many mathematical statements contain variables and describe properties that may hold for some or all objects.

For example:

Every natural number is greater than or equal to zero.

or

There exists a prime number greater than 100.

To represent such statements formally, we use predicate logic, also called first-order logic.

The two most important ideas in predicate logic are:

  • Predicates
  • Quantifiers

Predicates

A predicate is a statement containing one or more variables whose truth value depends on the values assigned to those variables.

For example,

P(x):x>5P(x): x>5

is a predicate.

It is not automatically true or false until a value is assigned to xx.

If

x=8,x=8,

then

P(8):8>5P(8): 8>5

is true.

If

x=3,x=3,

then

P(3):3>5P(3): 3>5

is false.

Thus, a predicate becomes a proposition after its variables are given specific values or are bound by quantifiers.


Domain of Discourse

The domain of discourse, or simply the domain, is the collection of values that a variable is allowed to take.

Consider

P(x):x2=4.P(x):x^2=4.

If the domain is the set of natural numbers,

N,\mathbb{N},

then only

x=2x=2

satisfies the predicate.

If the domain is the set of integers,

Z,\mathbb{Z},

then both

x=2x=2

and

x=−2x=-2

satisfy it.

Therefore, the truth of a quantified statement may depend on the chosen domain.


Quantifiers

A quantifier specifies how many elements of a domain satisfy a predicate.

The two fundamental quantifiers are:

  1. Universal Quantifier
  2. Existential Quantifier

Universal Quantifier

The symbol

∀\forall

is called the universal quantifier.

It is read as:

for all

or

for every

If P(x)P(x) is a predicate, then

∀x P(x)\forall x\,P(x)

means:

P(x)P(x) is true for every value of xx in the domain.

For example,

∀x∈R,x2≥0\forall x\in\mathbb{R},\quad x^2\ge0

means:

For every real number xx, x2x^2 is greater than or equal to zero.

This statement is true.


Example

Let

P(x):x+0=x.P(x):x+0=x.

Over the set of real numbers,

∀x P(x)\forall x\,P(x)

means

∀x∈R,x+0=x.\forall x\in\mathbb{R},\quad x+0=x.

Since the statement is true for every real number,

∀x P(x)\forall x\,P(x)

is true.


Existential Quantifier

The symbol

∃\exists

is called the existential quantifier.

It is read as:

there exists

or

there is at least one

The expression

∃x P(x)\exists x\,P(x)

means:

There exists at least one value of xx in the domain for which P(x)P(x) is true.

For example,

∃x∈Z,x2=9\exists x\in\mathbb{Z},\quad x^2=9

means:

There exists an integer whose square is 9.

Since

32=93^2=9

and

(−3)2=9,(-3)^2=9,

the statement is true.


Universal vs Existential Quantifier

Suppose

P(x):x>0P(x):x>0

and the domain is

Z.\mathbb{Z}.

Then

∀x P(x)\forall x\,P(x)

means:

Every integer is greater than zero.

This is false.

But

∃x P(x)\exists x\,P(x)

means:

There exists an integer greater than zero.

This is true.

Thus,

∀\forall

requires the predicate to hold for every element, whereas

∃\exists

requires it to hold for at least one element.


Truth of Quantified Statements

Universal Statement

A statement of the form

∀x P(x)\forall x\,P(x)

is true only if P(x)P(x) is true for every element of the domain.

To show that it is false, we only need to find one value for which P(x)P(x) is false.

Such a value is called a counterexample.


Example

Consider

∀x∈Z,x2>x.\forall x\in\mathbb{Z},\quad x^2>x.

Take

x=0.x=0.

Then

02>00^2>0

becomes

0>0,0>0,

which is false.

Therefore,

∀x∈Z,x2>x\forall x\in\mathbb{Z},\quad x^2>x

is false.

Here, x=0x=0 is a counterexample.


Existential Statement

A statement of the form

∃x P(x)\exists x\,P(x)

is true if we can find at least one value for which P(x)P(x) is true.

For example,

∃x∈Z,x2=16\exists x\in\mathbb{Z},\quad x^2=16

is true because

x=4x=4

satisfies the predicate.


Negation of Quantified Statements

The negation of quantified statements is extremely important.

The universal and existential quantifiers change into each other under negation.


Negation of Universal Quantifier

The negation of

∀x P(x)\forall x\,P(x)

is

¬(∀x P(x))≡∃x ¬P(x)\boxed{ \neg(\forall x\,P(x)) \equiv \exists x\,\neg P(x) }

In words:

It is not true that P(x)P(x) holds for every xx

means

There exists at least one xx for which P(x)P(x) does not hold.


Example

Consider:

Every student passed the examination.

Let

P(x):x passed the examination.P(x):x\text{ passed the examination}.

The statement is

∀x P(x).\forall x\,P(x).

Its negation is

∃x ¬P(x).\exists x\,\neg P(x).

Therefore:

There exists at least one student who did not pass the examination.

Notice that the negation is not:

No student passed.

That would be a much stronger statement.


Negation of Existential Quantifier

The negation of

∃x P(x)\exists x\,P(x)

is

¬(∃x P(x))≡∀x ¬P(x)\boxed{ \neg(\exists x\,P(x)) \equiv \forall x\,\neg P(x) }

In words:

There does not exist an xx satisfying P(x)P(x)

means

Every xx fails to satisfy P(x)P(x).


Example

Consider:

There exists a student who scored 100 marks.

Let

P(x):x scored 100 marks.P(x):x\text{ scored 100 marks}.

The statement is

∃x P(x).\exists x\,P(x).

Its negation is

∀x ¬P(x).\forall x\,\neg P(x).

Therefore:

Every student did not score 100 marks.

More naturally:

No student scored 100 marks.


Quantifier Negation Laws

The two important laws are

¬(∀x P(x))≡∃x ¬P(x)\boxed{ \neg(\forall x\,P(x)) \equiv \exists x\,\neg P(x) }

and

¬(∃x P(x))≡∀x ¬P(x)\boxed{ \neg(\exists x\,P(x)) \equiv \forall x\,\neg P(x) }

These are similar in spirit to De Morgan's Laws.


Translating Statements Using Quantifiers

Quantifiers allow ordinary mathematical or English statements to be written formally.

Suppose the domain is the set of all people.

Let

S(x):x is a studentS(x):x\text{ is a student}

and

H(x):x is hardworking.H(x):x\text{ is hardworking}.

Every Student Is Hardworking

The statement

Every student is hardworking.

can be written as

∀x (S(x)→H(x))\boxed{ \forall x\,(S(x)\rightarrow H(x)) }

The implication is important.

We do not write

∀x (S(x)∧H(x))\forall x\,(S(x)\land H(x))

because that would mean that every person in the entire domain is both a student and hardworking.


Some Student Is Hardworking

The statement

Some student is hardworking.

means that at least one person is both a student and hardworking.

Therefore,

∃x (S(x)∧H(x))\boxed{ \exists x\,(S(x)\land H(x)) }

No Student Is Hardworking

The statement

No student is hardworking.

can be written as

∀x (S(x)→¬H(x))\boxed{ \forall x\,(S(x)\rightarrow\neg H(x)) }

or equivalently,

¬∃x (S(x)∧H(x))\boxed{ \neg\exists x\,(S(x)\land H(x)) }

Some Student Is Not Hardworking

This statement is represented by

∃x (S(x)∧¬H(x))\boxed{ \exists x\,(S(x)\land\neg H(x)) }

Free and Bound Variables

Variables in predicate logic can be either free or bound.


Bound Variable

A variable is bound if it lies within the scope of a quantifier.

For example,

∀x (x+1>x)\forall x\,(x+1>x)

Here, xx is bound by the universal quantifier.

Similarly, in

∃y (y2=4),\exists y\,(y^2=4),

the variable yy is bound by the existential quantifier.

A formula in which every variable is bound represents a complete proposition with a definite truth value.


Free Variable

A variable is free if it is not controlled by any quantifier.

For example,

P(x):x>5P(x):x>5

contains the free variable xx.

Its truth value cannot be determined until a value of xx is specified.

Consider

∀x (x+y>0).\forall x\,(x+y>0).

Here,

  • xx is bound,
  • yy is free.

Therefore, the expression still depends on the value of yy.


Scope of a Quantifier

The scope of a quantifier is the part of the formula to which the quantifier applies.

For example,

∀x (P(x)→Q(x))\forall x\,(P(x)\rightarrow Q(x))

has the entire expression

P(x)→Q(x)P(x)\rightarrow Q(x)

inside the scope of ∀x\forall x.

Parentheses are useful for making the scope clear.

For example,

∀x (P(x)∨Q(x))\forall x\,(P(x)\lor Q(x))

is different in structure from an expression where only one component is quantified.


Quantifiers with Logical Connectives

Quantifiers often appear together with implication, conjunction, and disjunction.

Understanding their placement is important.


Universal Statements Commonly Use Implication

Suppose

P(x):x is a dogP(x):x\text{ is a dog}

and

Q(x):x is an animal.Q(x):x\text{ is an animal}.

The statement

Every dog is an animal

is represented as

∀x (P(x)→Q(x))\boxed{ \forall x\,(P(x)\rightarrow Q(x)) }

Existential Statements Commonly Use Conjunction

The statement

There exists a dog that is black

can be represented as

∃x (D(x)∧B(x))\boxed{ \exists x\,(D(x)\land B(x)) }

where

D(x):x is a dogD(x):x\text{ is a dog}

and

B(x):x is black.B(x):x\text{ is black}.

This requires one object to satisfy both properties.


Useful Equivalences Involving Quantifiers

Some useful logical equivalences are:

∀x (P(x)∧Q(x))≡(∀x P(x))∧(∀x Q(x))\forall x\,(P(x)\land Q(x)) \equiv (\forall x\,P(x)) \land (\forall x\,Q(x))

This says that every object satisfies both properties exactly when every object satisfies the first property and every object satisfies the second.

Similarly,

∃x (P(x)∨Q(x))≡(∃x P(x))∨(∃x Q(x)).\exists x\,(P(x)\lor Q(x)) \equiv (\exists x\,P(x)) \lor (\exists x\,Q(x)).

However, similar-looking expressions do not always distribute in the same way.

For example,

∃x (P(x)∧Q(x))\exists x\,(P(x)\land Q(x))

does not generally mean the same thing as

(∃x P(x))∧(∃x Q(x)).(\exists x\,P(x)) \land (\exists x\,Q(x)).

The reason is that the two existential statements may be satisfied by different objects.


Example

Suppose the domain contains two people:

  • Aman is a student but not a teacher.
  • Ravi is a teacher but not a student.

Then

∃x S(x)\exists x\,S(x)

is true, and

∃x T(x)\exists x\,T(x)

is also true.

Therefore,

(∃x S(x))∧(∃x T(x))(\exists x\,S(x)) \land (\exists x\,T(x))

is true.

But

∃x (S(x)∧T(x))\exists x\,(S(x)\land T(x))

is false because no single person is both a student and a teacher.


Important Quantifier Formulae

The most important identities to remember are

¬(∀x P(x))≡∃x ¬P(x)\boxed{ \neg(\forall x\,P(x)) \equiv \exists x\,\neg P(x) } ¬(∃x P(x))≡∀x ¬P(x)\boxed{ \neg(\exists x\,P(x)) \equiv \forall x\,\neg P(x) }

Also,

∀x (P(x)∧Q(x))≡(∀x P(x))∧(∀x Q(x))\boxed{ \forall x\,(P(x)\land Q(x)) \equiv (\forall x\,P(x)) \land (\forall x\,Q(x)) }

and

∃x (P(x)∨Q(x))≡(∃x P(x))∨(∃x Q(x))\boxed{ \exists x\,(P(x)\lor Q(x)) \equiv (\exists x\,P(x)) \lor (\exists x\,Q(x)) }

What did you think?

First Order Predicate Logicpredicate logicquantifiers

Continue the conversation

Share a question, an insight, or a different perspective.

Discussion loads when you reach this section.

Follow the idea

Keep reading