Chapter 6: First-order Syntax and Semantics
We now take the scaffolding of propositional logic, and develop it into a more powerful system called “first-order logic”.
Throughout this chapter it will help to keep in mind how you would develop a language to talk about the real numbers. Recall that the real numbers can be thought of as “every possible decimal expansion”. The decimal expansion, for example, of 3/2 is 1.5. And the decimal expansion of 1/3 is the infinite expansion 0.333…
Later we’ll have more to say about decimal expansions and the formal construction of real numbers. But at least for now, this is a simple start to thinking about the real numbers.
Some examples: Every integer and rational number is a real number. But then there are some real numbers, like and , which are real numbers but not rational. Later in this course we will actually prove that is real but not rational, whereas proving this for is a bit beyond the scope of this course.
Note that doesn’t look like a “decimal expansion”. But there is a sequence of decimal numerals which is equivalent to .
Now what does this have to do with logic?
First of all notice that the “number of real numbers” is enormous. It is clearly infinite, and bigger than the rational numbers in the sense that the rational numbers are a subset of the real numbers. In fact, this doesn’t even fully capture the way in which the real numbers are bigger than the rational numbers — we’ll have more to say about that later.
But one thing is clear: Our language cannot, in any practical sense, name every single real number. Of course each real number is an infinite decimal sequence — you might therefore argue that one can regard the decimal sequence as the “name” of the number.
However, that’s not practical. We can only practically write down finitely many digits of any decimal expansion. We will never fully name any number, if we were to use that system.
Alternately, we can name a real number by symbols like and . These names fully identify the decimal sequence. When we write , this refers to the exact number — in a sense, referring to its entire completed decimal expansion.
But for all practical purposes, our collection of names can only be finite. We might grow the set of names, but at any given moment in our use of language, we will only have specifically named finitely many real numbers. And yet there is an infinity of real numbers, and we will often want to reason about all of them, or certain infinite subsets of them.
In this chapter we will introduce the notion of predicates and objects. These ideas help us to analyze language. They help to make our logical system a bit more expressive. But they have relatively little to do with the issue of trying to talk about an infinite set of objects.
After that we introduce “quantifiers”. We use quantifiers to represent our how our logical system will express statements regarding “all” or “some” elements of the domain. Especially in the case of the real numbers, quantifiers are our solution to the question “how do we productively talk and reason about an infinite set, when we can only name finitely many of its elements?”
“All” and “Some”
Consider a sentence like “every dog deserves pets”.

If we were to express this in predicate syntax, first we would need a name for every dog. That would be a lot of names, like
for each of about a billion doggies.
Already this is uncomfortably large, to be listing every individual. But then we would need to say that each dog deserves pets. Ok, so we make a predicate “deserves pets”, let’s say it’s D.
Then we need to form the very long conjunction
But in English, the sentence is much simpler and shorter—we just use a phrase like “all”.
Of course there is a parallel idea for disjunction: Consider the sentence “Some chimpanzee deserves pets.”

Yep, this chimp deserves pets!
But maybe not the next one.

To express “some chimps deserve pets” we’ll need to name every chimp,
and then assert
The point being that “all” indicates a long conjunction of a predicate, over every individual in the domain. “Some” indicates a long disjunction of a predicate, over every individual in the domain.
The above only considers a finite domain, like the set of all doggies or the set of all chimps.
But in math we’ll often need to discuss an infinite domain, like in the sentence “Every number divisible by 4 is divisible by 2.” The natural domain for this statement is the set of integers, and so we are claiming “If 0 is divisible by 4 then 0 is divisible by 2, and if 1 is divisible by 4 then 1 is divisible by 2, and if -1 …”
This is like an “infinitely long conjunction”. But an infinitely long sentence is not actually possible.
Therefore we need a system of finite expressions, which is able to make claims about an infinite domain.
And of course there is a parallel for disjunction. In the sentence “there is an integer larger than ” we are essentially saying “either 0 is larger than , or 1 is larger than , or -1 is larger than , or …”
Whenever we want to make a claim about all objects within the domain, we call this “universal quantification”. This is indicated by words like “all”, “every”, “each”, and so on.
Whenever we want to make a claim that there is some object within the domain, we call this “existential quantification”. This is indicated by words like “there is”, “there exists”, “some”, and so on.
Quantifiers over Properties
We are now going to add quantifiers to our predicate logic. The result is called first-order logic, which we officially define later.
To express “every dog deserves pets” in first-order logic, we will write
The upside-down ‘A’ is read as “for all”. So the literal reading of this expression is
For all x, x deserves pets.
We assume that the “domain of discourse” here is the set of all dogs.
To express “some chimp deserves pets” we write
Note that here we are switching the domain of discourse, and now we assume that “” means “exists a chimp”.
How do we know what the domain of discourse is, at any moment? It is usually understood from context. If we are ever worried about a misunderstanding, we can always state the domain of discourse explicitly.
Definition
Syntax
We assume that we have sets of symbols for
- Objects
- Functions
- Variables
- Properties
None of these sets overlap, and none of them contain parentheses, logical connectives, or commas.
Terms are defined as before, except that now both objects and variables are terms.
Let P be a property symbol, and x a variable symbol.
The expression is called the universal quantification of P over x.
The expression is called the existential quantification of P over x.
Any proposition that is formed as a predicate formula, or a predicate formula with universal or existential quantification over all of its variables, is called a first-order formula (or just formula for short). #TODO
-
Note, this only defines a narrowly restricted case.
The above definition does not define quantification over general predicates. It only defines quantification over properties.
All of these are examples of first-order propositions.
The following are not first-order propositions.
The first is not because it is simply malformed: the existential quantifier requires a variable.
The second is not because the variable y is not bounded by a quantifier. All variables must be bounded.
The third is not for the same reason, although this time x is the unbounded quantifier.
The fourth is not because it uses a constant symbol a in quantification. Quantification requires the use of a variable.
Exercise
Classify each of the following as first-order formulas or not.
Definition
Semantics
Let be the domain of discourse and a model.
We assign if for every choice of we have . Otherwise .
We assign if there is some choice of such that . Otherwise .
To give an example, suppose the domain is the set of these objects:

Let the predicate R denote a red object, B blue, W white, K black, C cone, S sphere, U cube, Y cylinder, T tetrahedron, and P a rectangular prism.
Then because not all of the objects in the domain are red.
However because some object in the domain is red.
Exercise
Let . Let be the predicate “x is positive”, and is the predicate “x is negative”, and the predicate “x is equal to 1”.
Decide which of the following is true.
Exercise
Let be the predicate “x is even”.
For each choice of universe, decide whether and are true.
- .
- .
- .
- .
Of course we don’t have to live with only simple predicates—we can join them into more complex expressions, using the propositional logic from before.
If we refer back to the colorful shapes in the image above, here are some true quantified statements about them:
Respectively, these say
- Every blue object is not a cone.
- There is a white sphere.
- Every black object is white.
- There does not exist a black object.
- There exists an object which is not red.
Notice that (3) above is kind of funny—but technically true!
Don’t believe me? Test it out using the official semantics!
Pick any object, like say, the red cube. Let’s call it u. Now let’s evaluate . By the semantics of the conditional, this is . Because u is not black, . Because u is not white, . Therefore
So it’s true for the red cube!
Exercise
Now let u be the white cylinder. Evaluate .
Next, explain why .
Exercise
Let’s consider a property, P, and a model, , such that for every choice of u in the domain.
Certain it follows that .
Now prove that .
Also prove that .
Exercise
Consider a property, P, and model, , such that for every u in the domain.
It follows immediately by definition that .
Is it necessarily true that ?
Hint: What if the model has domain elements a and b, such that
Set Properties, Operations, and Relations
There is a direct connection between the familiar set operations, on the one hand, and the logical constructs that we’ve developed so far.
Consider for example the set of all even natural numbers, , which in set-builder notation is
Notice that this set is defined by the “is even” property. If we use the symbol E for the “is even” property, then the following proposition is true (in a model with universe ).
The above expression says that “x is an element of X if and only if x is even”. This is more than just true, it is in fact the definition of the set X!
We have previously said that any set, Y, can be defined some property, call it . Specifically, if the universe is U, then Y can be defined as
Well, this is just the same thing as saying
What this demonstrates is that anything which we can express by set-builder notation can also be expressed by quantified logic.
Exercise
Write the quantifier logic expression of the set
Let U be a universal set and .
Then the union, , is the set of all elements in A or B. Put into a logical expression,
Notice the use of the logical operator, .
In fact, we could even state the definition of the union with quantifier logic instead of set-builder notation:
This expression “says” that x is an element of , if and only if x is either in A or B.
So we have seen that the idea of the union of sets is something which has equivalent definitions in set-builder notation, and in quantifier logic.
Exercise
In the same style as above, use set-builder notation and a logical operation to define the intersection, .
That is to say, fill in the blank in the expression below.
Exercise
Now define the intersection using quantifier logic instead of set-builder notation.
Exercise
Define using set-builder notation and logical operations, and then also define it using quantifier logic.
Do likewise for the complement, .
We have now seen that all of the set operations, union, intersection, set minus, and complement, can be expressed in quantifier logic.
What about the
Exercise
What is the relationship between sets A and B, if the following proposition is true?
Exercise
Choose appropriate symbols to express the sentence “All squares are rectangles, but not all rectangles are squares.”
Exercise
Explain why “all that glisters is not gold” implies “gold does not glister”.
Exercise
Explain why “every integer is even or odd” does not rule out the possibility that some integer is both even and odd.
Write a symbolic expression for “every integer is even or odd but not both”.
Nested Quantifiers
Things get more interesting still when we consider multiple quantifiers.
Consider the domain of all humans on the planet, and the relation which represents “x loves y”.
Now consider the different meanings of each of the following propositions.
The first one says “everyone loves everyone”. This would perhaps be true in some futuristic utopia.

The second says that “everyone loves someone”. That’s the content of a pop song.
https://youtu.be/1ja32uS-bD0?si=KR5ZGXTEr2EbJC_M
The third one says that “someone loves everyone”, which seems to describe a kind of Jesus figure.

And finally the last one says that “someone loves someone”, which seems almost like a truism.

Let’s see an example. Suppose that we have the following road network between cities.

Let’s use to mean “x is linked to y by a road”. So for example is true while is not.
Let’s also use to mean “x is lexically next after y”. Note that is true because b is lexically next after a. However, is not true.
Here is a sentence that should be true: For any two cities, x and y, if x is lexically next after y then x is linked to y. In a formula, this is
Intuitively this is true because we see four pairs where one city is lexically next: A and B, B and C, C and D, and D and E. In every case, the pair of cities are linked, as you can see in the graph.
To evaluate formally, we need to consider five total possible assignments to x.
Let’s consider these each in turn.
With this assignment we now have to evaluate . To do this we again need to consider five possible assignments to y.
-
With this assignment we now have to evaluate . Noting that and , then
-
With this assignment
-
-
-
As we see, when , then for every possible mapping of y, we get a true proposition.
Therefore .
-
Exercise
Perform this assignment and evaluate .
Exercise
Perform this assignment and evaluate the relevant proposition.
-
-
-
With this assignment
-
-
-
As we see, when , then for every possible mapping of y, we get a true proposition.
Therefore .
-
-
We should check this case too, but I promise . However, you are invited to check for yourself if you would like more exercise.
The above now confirms that, for every possible assignment to x, the resulting proposition is true.
Therefore it demonstrates .
Exercise
Using the same city and road diagram, solve the following exercises.
You don’t always have to make every single assignment. For example, to show is true, you do need to show that it is true for every possible assignment to x. So this means that you need to check at least five assignments to x.
Now if you were very flat-footed, you would then check five assignments to y. If at least one of those assignments is true, then the existential proposition is true.
But this is more effort than you really need to do. When it comes to an existential quantifier, you really just need to exhibit one instance of , not every instance of . So, for each assignment of x, if you find one satisfying assignment of , you can stop early!
-
Show that
is true. (Hint: With an appropriate choice of assignments, this only requires evaluating five propositions. Further hint: For any choice of x, it is not linked to itself!)
-
Show that
is true. (With an appropriate choice of assignments, this only requires evaluating five propositions.)
-
Show that
is false. (With an appropriate choice of assignments, this only requires evaluating one proposition!)
-
Show that
is false. (With an appropriate choice of assignments, this only requires evaluating one proposition.)
-
Show that
is true. (With an appropriate choice of assignments, this requires only evaluating one proposition.)
-
Show that is false. This requires evaluating five propositions.
First-order Logic
Up to this point I’ve been pretty dogged in presenting the formal syntax and semantics of each logical system that we consider: First with propositional logic and then with predicate logic.
But now consider a formula like the following.
This has many-place relations, and nested quantifiers. This is a more general instance of a first-order formula.
As you can see below, the rigorous definition of the syntax and semantics for first-order logic is long and complex. I don’t recommend that you actually read the following definition in detail—we will not use it through the rest of the course.
Definition
Syntax
Note that we will use a bold comma: . This is a distinct symbol from our simple comma. We do so in order to tell the difference between a comma used in our regular language, and a comma used inside our first-order syntax.
Let , , and . These, respectively, are the sets of unary connectives, binary connectives, and quantifier symbols.
Let , and be three nonempty sets such that each of the following sets are disjoint: , and . The first four of these are, respectively, the set of object symbols, variable symbols, function symbols, predicate symbols.
The set
is the alphabet of a first-order language.
Let be a function, called the arity function.
Every element of is a term.
Let and , and let be terms. Then is a term.
We define to be the set of terms,
Let and , and let be terms. Then is called an atomic formula. Every atomic formula is a first-order formula.
If are any two first-order formulas, and , and , and , then the following are also first-order formulas.
We define to be the set of first-order formulas,
We define a function recursively. Let and and . Let .
-
If then .
-
If then .
-
If and and if , then
-
If and , and if , then
-
-
-
We call the set of free variables of .
If and , then we say that is a closed formula.
We denote the set of closed formulas,
Definition
Semantics
We use the same sets as above for the syntax.
Let be any nonempty set, called the universe.
Let be a function such that, for each , the expression is the interpretation of a, which denotes the element of to which a is mapped.
Moreover let and . The expression is the interpretation of f, which denotes the function to which f is mapped.
Moreover, let and . The expression is the interpretation of P, which denotes the subset of to which P is mapped.
Let .
Let be a function, which we call a variable assignment.
We define the notation to be the function
We call the function v remapping x to y.
We now define the extended variable mapping, .
- If then .
- If then .
- If and , and , then
For a formula , model , and variable assignment v, we will define what it means for the model and assignment to satisfy the formula, denoted
We use to express that does not hold.
-
If and and , and if we have
then .
-
If then
- If then .
- If and then .
- If or then .
- If or then .
- If and then .
- Suppose that , and for every we have . Then .
- Suppose that and for some we have . Then .
Finally we can define truth in the model .
Let be a closed formula. Then we say that is true in the model , and write , if for every variable assignment v we have .
Another reason why we will avoid actually using this rigorous definition: In my opinion, these ideas don’t significantly help your understanding of other mathematical topics like algebra and topology. Remember, we’re studying logic because it’s inherently interesting, yes—but also, so that we may apply it to understanding other mathematical subjects.
However, we will need a few ideas, even if we do not emphasize their rigorous definition. We will need to understand the idea of a formula, and free and bound variables. Rather than follow the formal definition, we just gesture at the idea with a few examples.
In the following expression, the variables x and y are free while w and z are not.