Mathematical Reasoning and Discrete Math

First-order Logic

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.

∀x∃y(R(x,y)→S(y,y,a)){\tt \forall} {\tt x}{\tt \exists} {\tt y}({\tt R}({\tt x},{\tt y}) {\tt \to} {\tt S}({\tt y},{\tt y},{\tt a}))

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: ,{\tt \boldsymbol ,}. 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 Un={¬}\text{Un}=\{{\tt \neg}\}, Bins={∧,∨,→,↔}\text{Bins} = \{{\tt \land},{\tt \lor},{\tt \to},{\tt \leftrightarrow}\}, and Quants={∀,∃}\text{Quants} = \{{\tt \forall}, {\tt \exists}\}. These, respectively, are the sets of unary connectives, binary connectives, and quantifier symbols.

Let Objs,Vars,Funcs\text{Objs}, \text{Vars}, \text{Funcs}, and Preds\text{Preds} be three nonempty sets such that each of the following sets are disjoint: Objs,Vars,Funcs,Preds,Un,Bins,Quants\text{Objs},\text{Vars},\text{Funcs},\text{Preds},\text{Un},\text{Bins},\text{Quants}, and {(,),,}\{{\tt (},{\tt )},{\tt \boldsymbol ,}\}. The first four of these are, respectively, the set of object symbols, variable symbols, function symbols, predicate symbols.

The set

Σ=Objs∪Vars∪Funcs∪Preds∪Un∪Bins∪Quants∪{(,),,}\begin{aligned} \Sigma=&\text{Objs}\cup\text{Vars}\\ &\cup\text{Funcs}\cup\text{Preds}\\&\cup\text{Un}\cup\text{Bins}\\ &\cup\text{Quants}\cup\{{\tt (},{\tt )},{\tt \boldsymbol,}\} \end{aligned}

is an alphabet of a first-order language.

Let Arity:Funcs∪Preds→{0,1,2,...}\text{Arity}: \text{Funcs}\cup \text{Preds}\to \{0,1,2,...\} be a function, called the arity function.

Every element of Objs∪Vars\text{Objs}\cup \text{Vars} is a term.

Let f∈Funcs{\tt f}\in \text{Funcs} and n=Arity(f)n = \text{Arity}({\tt f}), and let t1,…,tn{\tt t_1},…,{\tt t_n} be terms. Then f(t1,…,tn){\tt f}({\tt t_1},…,{\tt t_n}) is a term.

We define Term\text{Term} to be the set of terms,

Term={t∈Σ∗:t is a term}\text{Term} = \{{\tt t} \in \Sigma^*:{\tt t}\text{ is a term}\}

Let P∈Preds{\tt P}\in \text{Preds} and n=Arity(P)n = \text{Arity}({\tt P}), and let t1,...,tn{\tt t_1},...,{\tt t_n} be terms. Then P(t1,t2,…,tn){\tt P}({\tt t_1}\boldsymbol ,{\tt t_2}\boldsymbol ,…\boldsymbol,{\tt t_n}) is called an atomic formula. Every atomic formula is a first-order formula.

If ϕ,ψ{\tt \phi},{\tt \psi} are any two first-order formulas, and □∈Bins{\tt \Box}\in\text{Bins}, and ◊∈Quants{\tt \Diamond}\in\text{Quants}, and x∈Vars{\tt x}\in \text{Vars}, then the following are also first-order formulas.

  • (¬ϕ)({\tt \neg} {\tt \phi})
  • (ϕ□ψ)({\tt \phi}{\tt \Box}{\tt \psi})
  • (◊xϕ)({\tt \Diamond} {\tt x} {\tt \phi})

We define Forms\text{Forms} to be the set of first-order formulas,

Forms={ϕ∈Σ∗:ϕ is a first-order formula}\text{Forms} = \{{\tt \phi}\in\Sigma^*:{\tt \phi} \text{ is a first-order formula}\}

We define a function Free:Term∪Forms→P(Vars)\text{Free}:\text{Term}\cup\text{Forms}\to \mathcal P(\text{Vars}) recursively. Let □∈Bins{\tt \Box}\in\text{Bins} and ◊∈Quants{\tt \Diamond}\in\text{Quants} and x∈Vars{\tt x}\in \text{Vars}. Let ϕ,ψ∈Forms{\tt \phi},{\tt \psi}\in\text{Forms}.

  • If x∈Objs{\tt x}\in \text{Objs} then Free(x)=∅\text{Free}({\tt x}) = \emptyset.

  • If x∈Vars{\tt x}\in \text{Vars} then Free(x)={x}\text{Free}({\tt x}) = \{{\tt x}\}.

  • If f∈Funcs{\tt f}\in \text{Funcs} and n=Arity(f)n=\text{Arity}({\tt f}) and if t1,…,tn∈Terms{\tt t_1},…,{\tt t_n}\in\text{Terms}, then

    Free(f(t1,...,tn))=Free(t1)∪⋯∪Free(tn)\text{Free}({\tt f}({\tt t_1},...,{\tt t_n})) = \text{Free}({\tt t_1})\cup \dots \cup \text{Free}({\tt t_n})

  • If P∈Preds{\tt P}\in \text{Preds} and n=Arity(P)n=\text{Arity}({\tt P}), and if t1,…,tn∈Terms{\tt t_1},…,{\tt t_n}\in\text{Terms}, then

    Free(P(t1,...,tn))=Free(t1)∪⋯∪Free(tn)\text{Free}({\tt P}({\tt t_1},...,{\tt t_n})) = \text{Free}({\tt t_1})\cup\cdots \cup \text{Free}({\tt t_n})

  • Free((¬ϕ))=Free(ϕ)\text{Free}(({\tt \neg} {\tt \phi})) = \text{Free}({\tt \phi})

  • Free((ϕ□ψ))=Free(ϕ)∪Free(ψ)\text{Free}(({\tt \phi}{\tt \Box}{\tt \psi})) = \text{Free}({\tt \phi})\cup \text{Free}({\tt \psi})

  • Free((◊xϕ))=Free(ϕ)∖{x}\text{Free}(({\tt \Diamond} {\tt x}{\tt \phi})) = \text{Free}({\tt \phi})\smallsetminus \{{\tt x}\}

We call Free(ϕ)\text{Free}({\tt \phi}) the set of free variables of ϕ{\tt \phi}.

If ϕ∈Forms{\tt \phi} \in \text{Forms} and Free(ϕ)=∅\text{Free}({\tt \phi})=\emptyset, then we say that ϕ{\tt \phi} is a closed formula.

We denote the set of closed formulas,

Closeds={ϕ∈Forms:Free(ϕ)=∅}\text{Closeds} = \{{\tt \phi}\in\text{Forms}: \text{Free}({\tt \phi}) = \emptyset\}

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 a∈Obj{\tt a}\in \text{Obj}, the expression aइ{\tt a}^{इ} is the interpretation of a{\tt a}, which denotes the element of उउ to which a{\tt a} is mapped.

aइ∈उ{\tt a}^{इ} \in उ

Moreover let f∈Funcs{\tt f}\in \text{Funcs} and n=Arity(f)n=\text{Arity}({\tt f}). The expression fइ{\tt f}^{इ} is the interpretation of f{\tt f}, which denotes the function to which f{\tt f} is mapped.

fइ:उn→उ{\tt f}^{इ}:उ^n\toउ

Moreover, let P∈Preds{\tt P}\in \text{Preds} and n=Arity(P)n=\text{Arity}({\tt P}). The expression Pइ{\tt P}^{इ} is the interpretation of P{\tt P}, which denotes the subset of उnउ^n to which P{\tt P} is mapped.

Pइ⊆उn{\tt P}^{इ} \subseteq उ^n

Let म=(उ,इ)म = (उ,इ).

Let v:Vars→उv: \text{Vars}\to उ be a function, which we call a variable assignment.

We define the notation v[x↦y]v[{\tt x}\mapsto {\tt y}] to be the function

v[x↦y](z)={v(z) if z≠xy if z=xv[{\tt x}\mapsto {\tt y}]({\tt z}) = \begin{cases} v({\tt z}) & \text{ if } {\tt z}\ne {\tt x}\\ {\tt y} & \text{ if } {\tt z} = {\tt x} \end{cases}

We call v[x↦y]v[{\tt x}\mapsto {\tt y}] the function v remapping x{\tt x} to y{\tt y}.

We now define the extended variable mapping, v‾\overline v.

  • If x∈Objs{\tt x}\in \text{Objs} then v‾(x)=x\overline v({\tt x}) = {\tt x}.
  • If x∈Vars{\tt x}\in \text{Vars} then v‾(x)=v(x)\overline v({\tt x}) = v({\tt x}).
  • If f∈Funcs{\tt f}\in\text{Funcs} and n=Arity(f)n=\text{Arity}({\tt f}), and t1,…,tn∈Terms{\tt t_1},…,{\tt t_n}\in\text{Terms}, then

v‾(f(t1,...,tn))=fइ(v‾(t1),...,v‾(tn))\overline v({\tt f}({\tt t_1},...,{\tt t_n})) = {\tt f}^{इ}(\overline v({\tt t_1}),...,\overline v({\tt t_n}))

For a formula ϕ∈Forms{\tt \phi}\in\text{Forms}, model मम, and variable assignment v, we will define what it means for the model and assignment to satisfy the formula, denoted

म,v⊨ϕम,v\vDash {\tt \phi}

We use म,v⊭ϕम,v\not\vDash{\tt \phi} to express that म,v⊨ϕम, v\vDash {\tt \phi} does not hold.

  • If P∈Preds{\tt P}\in\text{Preds} and n=Arity(P)n=\text{Arity}({\tt P}) and t1,…,tn∈Terms{\tt t_1},…,{\tt t_n}\in\text{Terms}, and if we have

    (v‾(t1),...,v‾(tn))∈Pइ(\overline v({\tt t_1}),...,\overline v({\tt t_n}))\in {\tt P}^{इ}

    then म,v⊨P(t1,…,tn)म,v\vDash {\tt P}({\tt t_1},…,{\tt t_n}).

  • If ϕ,ψ∈Form{\tt \phi},{\tt \psi}\in\text{Form} then

    • If म,v⊭ϕम,v\not\vDash {\tt \phi} then म,v⊨(¬ϕ)म,v\vDash ({\tt \neg} {\tt \phi}).
    • If म,v⊨ϕम,v\vDash {\tt \phi} and म,v⊨ψम,v\vDash {\tt \psi} then म,v⊨(ϕ∧ψ)म,v\vDash ({\tt \phi}{\tt \land}{\tt \psi}).
    • If म,v⊨ϕम,v\vDash {\tt \phi} or म,v⊨ψम,v\vDash {\tt \psi} then म,v⊨(ϕ∨ψ)म,v\vDash ({\tt \phi}{\tt \lor}{\tt \psi}).
    • If म,v⊭ϕम,v\not\vDash {\tt \phi} or म,v⊨ψम,v\vDash {\tt \psi} then म,v⊨(ϕ→ψ)म,v\vDash ({\tt \phi}{\tt \to}{\tt \psi}).
    • If म,v⊨ϕ→ψम,v\vDash {\tt \phi} {\tt \to} {\tt \psi} and म,v⊨ψ→ϕम,v\vDash {\tt \psi}{\tt \to}{\tt \phi} then म,v⊨(ϕ↔ψ)म,v\vDash ({\tt \phi}{\tt \leftrightarrow}{\tt \psi}).
    • Suppose that x∈Vars{\tt x}\in \text{Vars}, and for every u∈उu\inउ we have म,v[x↦u]⊨ϕम,v[{\tt x}\mapsto u]\vDash {\tt \phi}. Then म,v⊨(∀xϕ)म,v\vDash ({\tt \forall} {\tt x}{\tt \phi}).
    • Suppose that x∈Vars{\tt x}\in \text{Vars} and for some u∈उu\inउ we have म,v[x↦u]⊨ϕम,v[{\tt x}\mapsto u]\vDash {\tt \phi}. Then म,v⊨(∃xϕ)म,v\vDash ({\tt \exists} {\tt x}{\tt \phi}).

Finally we can define truth in the model मम.

Let ϕ{\tt \phi} be a closed formula. Then we say that ϕ{\tt \phi} is true in the model मम, and write म⊨ϕम\vDash {\tt \phi}, if for every variable assignment v we have म,v⊨ϕम,v\vDash {\tt \phi}.

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{\tt x} and y{\tt y} are free while w{\tt w} and z{\tt z} are not.

∀x(P(x)→∃y((¬R(x,y)∧Q(f(y,z)))){\tt \forall} {\tt x}({\tt P}({\tt x}){\tt \to} {\tt \exists} {\tt y}(({\tt \neg} {\tt R}({\tt x},{\tt y}){\tt \land} {\tt Q}({\tt f}({\tt y},{\tt z}))))

Functions

We are studying logic, to study math. One of the most central things that we understand in mathematics, is how to solve an equation, like

2x+1=13\tt 2x+1=13

How are we going to represent such a thing in logic?

We're not entirely ready to address this question in its entirety. But certainly any answer is going to have to say something about functions.

In particular, the part of the expression 2x+1\tt 2x+1 is a function.

Let's say that we use the symbols o{\tt o} for 1 and t{\tt t} for 2. Let's now further agree that we use the symbol f{\tt f} for the "times two" function. That is to say, we will use f{\tt f} to denote the function g(x)=2xg(x)=2x.

Note

f{\tt f} is in the object language, not gg. Note that we are using the symbol f{\tt f} for a symbol in the logical language. gg is not in the logical language (called the "object language"). gg is in the function itself, which we say is in the "metalanguage". The metalanguage is the language that I am writing to you in: English, or a mathy version of English.

If this is confusing, note that it is exactly the same distinction as having a symbol like 'a{\tt a}' in the logical language, but the symbol refers to the person, Adam. It is the distinction between syntax and semantics: a{\tt a} is in the syntax, the person to whom it refers, Adam, is in the semantics.

In the current context, f{\tt f} is the symbol in the syntax, gg is the actal function that it refers to, in the semantics.

Then suppose that we want to interpret the object referred to by f(o){\tt f}({\tt o}). Intuitively this should be the function, gg, applied to the number 1. That is

g(1)=2(1)=2g(1) = 2(1) = 2

This is what we will eventually ensure when we define the semantics of functions.

But now notice that we will also need to have a certain collection of symbols that are reserved for functions. It is tradition to use f,g,h{\tt f}, {\tt g}, {\tt h} and perhaps more after that. But here, the tradition is not especially clear: Is i{\tt i} a constant or function?

Well, luckly, we do not rely on tradition. If there is ever ambiguity, we can always just resolve it by declaring explicitly our symbol sets for constants (recall, Consts\text{Consts}), variables (from now on, Vars\text{Vars}), functions (Funcs\text{Funcs}), and predicates (Preds\text{Preds}).

These sets of symbols are allowed to be literally any nonempty sets, with the caveat that they cannot overlap. If any object were both a constant and a function symbol, it would introduce unnecessary and unpleasant ambiguity when trying to read a formula.

Similarly none of these sets are allowed to contain parentheses, since that would create readability issues. For example if the left paren, ), were a constant symbol then we would have annoying difficulty reading "P()){\tt P}{\tt (}{\tt )}{\tt )}". For similar reasons, none of the sets may contain logical connectives, like ¬{\tt \neg} or ∀{\tt \forall}, nor may they contain commas.

Finally let's notice that not all functions have just one input. Consider the function h(x,y)=2x+πyh(x,y)=2x + \pi y.

We have already discused the concept of "arity" with regard to predicates, and the same idea applies to functions. The function above has arity 2. If it is represented by the symbol h\tt h, then we also say that h\tt h has arity 2.

Function Composition

Just as propositions can be "put together" using the connectives, also functions can be "put together". The fundamental way that we put functions together is by "composition".

Consider for example the functions f(x)=2xf(x)=2\sqrt{x} and g(x)=x+3g(x)=x+3. You may be familiar with composition from earlier math courses. For example, you may already know that that the composition of ff with gg is written f∘gf\circ g, and its definition is given by

(f∘g)(x)=f(g(x))(f\circ g)(x) = f(g(x))

In this particular example, this means

(f∘g)(x)=f(g(x))=f(x+3)=2x+3\begin{aligned} (f\circ g)(x) &= f(g(x)) \\ & = f(x+3) \\ & = 2\sqrt{x+3} \end{aligned}

This means that if we wanted to evaluate the function f∘gf\circ g at input x=2x=2 then we may calculate

(f∘g)(2)=22+3=25 \begin{aligned} (f\circ g)(2) &= 2\sqrt{2+3}\\ &= 2\sqrt 5 \end{aligned}

It may be gratifying to know that function composition is, in fact, substitution! You already learned about substitution for the purposes of an inference rule in an earlier chapter. Well, happily, your understanding of substitution will now start paying dividends.

Using notation like we previously have for substitution, f(g(x))f(g(x)) means the same thing as [f(x)]x:=g(x)[f(x)]_{x:=g(x)}. That is to say, the composition f(g(x))f(g(x)) means

Take f(x)f(x) and replace every instance of x with g(x)g(x).

Therefore

f(g(x))=[f(x)]x:=g(x)=[2x]x:=x+3=2x+3\begin{aligned} f(g(x)) &= [f(x)]_{x:= g(x)} \\ &= [2\sqrt x]_{x:=x+3} \\ &= 2\sqrt{\colorbox{yellow}{$x+3$}} \end{aligned}

I have highlighted where x has been substituted for x+3x+3 above.

Let's see another and more complex example. For instance, let h(x)=x2+2x−1h(x)=x^2+2x-1 and i(x)=2x−1xi(x)=2^x-\frac 1 x. We will find an equivalent expression for h∘ih\circ i. Again, the idea is that every instance of x in h is replaced by i.

(h∘i)(x)=[h(x)]x:=i(x)=[x2+2x−1]x:=2x−1x=(2x−1x)2+2(2x−1x)−1\begin{aligned} (h\circ i)(x) &= [h(x)]_{x:= i(x)} \\ &= [x^2+2x-1]_{x:= 2^x - \frac 1 x} \\ &= \colorbox{yellow}{$\left(2^x-\frac 1 x \right)$} ^2 + 2 \colorbox{yellow}{$\left(2^x-\frac 1 x\right)$} - 1 \end{aligned}

We will not bother with so-called "simplifcation", and leave this as our representation of (h∘i)(x)(h\circ i)(x).

Exercise

Using h and i as above, find the formula for the composition i∘hi\circ h.

Using f and g above, find g∘fg\circ f.

Terms

"Terms" are a generalization of objects. We have already established that constants are objects. Also variables are objects. Although variables do not name a particular element in the domain, they do refer to various elements in the domain.

Anything that refers to an object, we call a term. So constants and variables are all instances of terms.

But also, functions refer to elements in the domain. For example, suppose we use the domain of natural numbers, and the function f(x,y)=x+yf(x,y) = x+y. Then f(2,1)=2+1f(2,1) = 2+1 refers to the element 3.

If f\tt f is a function symbol of arity n, and x1,x2,...,xn\tt x_1,x_2,...,x_n are n object symbols, then

f(x1,x2,...,xn)\tt f(x_1,x_2,...,x_n)

is a term.

Moreover, if g\tt g and h\tt h are function symbols with arity 1, and x\tt x an object symbol (either constant or variable), then f(g(x))\tt f(g(x)) is also a term.

Definition

Syntax

Suppose that we have sets of symbols, Consts,Vars, Funcs\text{Consts}, \text{Vars, Funcs}, which respectively denote the sets of constant symbols, variable symbols, and function symbols. We assume that none of these overlap, and none of them contains parentheses, logical connectives, or commas. Let Arity\text{Arity} be an arity function.

Any a∈Consts∪Vars{\tt a}\in \text{Consts}\cup\text{Vars} is called an object symbol and is a term.

Let f∈Funcs{\tt f}\in\text{Funcs} and assume Arity(f)=n\text{Arity}(\mathtt f) = n. Let t1,t2,...,tn{\tt t_1,t_2,...,t_n} be a collection of terms.

Then f(t1,t2,...,tn)\tt f(t_1,t_2,...,t_n) is a term.

Suppose that we have

  • Consts={a,b,c}\text{Consts} = \{{\tt a,b,c}\},
  • Vars={x,y,z}\text{Vars}=\{{\tt x,y,z}\},
  • Funcs={f,g,h}\text{Funcs} = \{{\tt f,g,h}\}.
  • Arity(f)=1,Arity(g)=2,Arity(h)=3\text{Arity}(\mathtt f)=1, \text{Arity}(\mathtt g) = 2,\text{Arity}(\mathtt h) = 3

Then a\tt a is a term, because it is an object symbol.

Likewise x\tt x is a term.

f\tt f is not a term. However, since its arity is 1, and since a\tt a is a term, then

f(a)\tt f(a)

is a term.

g(a)\tt g(a) is not a term, because the arity of g\tt g is 2. But

g(b,f(x))\tt g(b,f(x))

is a term.

Exercise

Decide which of the following are terms and which are not.

  1. ax\tt ax
  2. fa\tt fa
  3. g(f(x),g(a,b))\tt g(f(x), g(a,b))
  4. h(h,h,h)\tt h(h,h,h)

First-order Syntax

Definition

Syntax

We assume that we have sets of symbols for

  • Constants, Consts\text{Consts},
  • Variables, Vars\text{Vars},
  • Functions, Funcs\text{Funcs},
  • Predicates, Preds\text{Preds}

None of these sets overlap, and none of them contain parentheses, logical connectives, or commas.

Let P∈Preds{\tt P}\in\text{Preds} be a property symbol, and x{\tt x} a variable symbol.

The expression ∀xP(x){\tt \forall} {\tt x} {\tt P}({\tt x}) is called the universal quantification of P{\tt P} over x{\tt x}.

The expression ∃xP(x){\tt \exists} {\tt x} {\tt P}({\tt x}) is called the existential quantification of P{\tt P} over x{\tt 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

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.

∃xD(x)∀xP(a,x)↔¬∃z(Q(z)∨Z(z,b))R(a,b,c)\begin{aligned} {\tt \exists} {\tt x} {\tt D}({\tt x})\\ {\tt \forall} {\tt x} {\tt P}({\tt a},{\tt x}){\tt \leftrightarrow} {\tt \neg}{\tt \exists} {\tt z}({\tt Q}({\tt z}){\tt \lor} {\tt Z}({\tt z},{\tt b}))\\ {\tt R}({\tt a},{\tt b},{\tt c}) \end{aligned}

The following are not first-order propositions.

∃D(x)∀xP(y,x)↔¬∃z(Q(z)∨Z(z,b))R(x,b,c)∀aS(a)\begin{aligned} {\tt \exists} {\tt D}({\tt x})\\ {\tt \forall} xP({\tt y},{\tt x}) {\tt \leftrightarrow} {\tt \neg} {\tt \exists} {\tt z} ({\tt Q}({\tt z}){\tt \lor} {\tt Z}({\tt z},{\tt b})) \\ {\tt R}({\tt x},{\tt b},{\tt c})\\ {\tt \forall} {\tt a} {\tt S}({\tt a}) \end{aligned}

The first is not because it is simply malformed: the existential quantifier requires a variable.

The second is not because the variable y{\tt y} is not bounded by a quantifier. All variables must be bounded.

The third is not for the same reason, although this time x{\tt x} is the unbounded quantifier.

The fourth is not because it uses a constant symbol a{\tt a} in quantification. Quantification requires the use of a variable.

Exercise

Classify each of the following as first-order formulas or not.

  1. ∀x∀yT(x,y,y,x){\tt \forall} {\tt x}{\tt \forall} {\tt y}{\tt T}({\tt x},{\tt y},{\tt y},{\tt x})
  2. ∃aA(a,a){\tt \exists} {\tt a}{\tt A}({\tt a},{\tt a})
  3. ¬∃vQ(v){\tt \neg} {\tt \exists} {\tt v} {\tt Q}({\tt v})
  4. ∃v¬Q(v){\tt \exists} {\tt v} {\tt \neg} {\tt Q}({\tt v})
  5. ∀xP{\tt \forall} {\tt x} {\tt P}

Definition

Semantics

Let उउ be the domain of discourse and मम a model.

We assign (∀xP(x))म=ट({\tt \forall} {\tt x} {\tt P}({\tt x}))^{म}=ट if for every choice of u∈उu\in उ we have u∈Pमu\in {\tt P}^{म}. Otherwise (∀xP(x))म=फ({\tt \forall} {\tt x}{\tt P}({\tt x}))^{म}=फ.

We assign (∃xP(x))म=ट({\tt \exists} {\tt x}{\tt P}({\tt x}))^{म} = ट if there is some choice of u∈उu\in उ such that u∈Pमu\in {\tt P}^{म}. Otherwise (∃xP(x))म=फ({\tt \exists} xP({\tt x}))^{म} = फ.

To give an example, suppose the domain is the set of these objects:

image.png

Let the predicate R{\tt R} denote a red object, B{\tt B} blue, W{\tt W} white, K{\tt K} black, C{\tt C} cone, S{\tt S} sphere, U{\tt U} cube, Y{\tt Y} cylinder, T{\tt T} tetrahedron, and P{\tt P} a rectangular prism.

Then (∀xR(x))म=फ({\tt \forall} {\tt x} {\tt R}({\tt x}))^{म}=फ because not all of the objects in the domain are red.

However (∃xR(x))म=ट({\tt \exists} {\tt x}{\tt R}({\tt x}))^{म}=ट because some object in the domain is red.

Exercise

Let उ=Nउ = \Bbb N. Let P(x){\tt P}({\tt x}) be the predicate “x{\tt x} is positive”, and Q(x){\tt Q}({\tt x}) is the predicate “x{\tt x} is negative”, and R(x){\tt R}({\tt x}) the predicate “x{\tt x} is equal to 1”.

Decide which of the following is true.

  1. ∀xP(x){\tt \forall} {\tt x}{\tt P}({\tt x})
  2. ∃xP(x){\tt \exists} {\tt x} {\tt P}({\tt x})
  3. ∀xQ(x){\tt \forall} {\tt x} {\tt Q}({\tt x})
  4. ∃xQ(x){\tt \exists} {\tt x} {\tt Q}({\tt x})
  5. ∀xR(x){\tt \forall} {\tt x} {\tt R}({\tt x})
  6. ∃xR(x){\tt \exists} {\tt x} {\tt R}({\tt x})

Exercise

Let P(x){\tt P}({\tt x}) be the predicate “x{\tt x} is even”.

For each choice of universe, decide whether ∀xP(x){\tt \forall} {\tt x}{\tt P}({\tt x}) and ∃xP(x){\tt \exists} {\tt x} {\tt P}({\tt x}) are true.

  1. उ=Zउ = \Bbb Z.
  2. उ=Nउ = \Bbb N.
  3. उ={x∈N:x is prime}उ = \{{\tt x}\in\Bbb N: {\tt x} \text{ is prime}\}.
  4. उ={2}उ = \{2\}.

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:

∀x(B(x)→¬C(x)){\tt \forall} {\tt x}({\tt B}({\tt x}){\tt \to} {\tt \neg} {\tt C}({\tt x}))

∃x(W(x)∧S(x)){\tt \exists} {\tt x}({\tt W}({\tt x}){\tt \land} {\tt S}({\tt x}))

∀x(K(x)→W(x)){\tt \forall} {\tt x}({\tt K}({\tt x}){\tt \to} {\tt W}({\tt x}))

¬∃xK(x){\tt \neg} {\tt \exists} {\tt x} {\tt K}({\tt x})

∃x¬R(x){\tt \exists} {\tt x} {\tt \neg} {\tt R}({\tt x})

Respectively, these say

  1. Every blue object is not a cone.
  2. There is a white sphere.
  3. Every black object is white.
  4. There does not exist a black object.
  5. 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 (K(u)→W(u))म({\tt K}(u){\tt \to} {\tt W}(u))^{म}. By the semantics of the conditional, this is (K(u))म⇝(W(u))म({\tt K}(u))^{म} \leadsto ({\tt W}(u))^{म}. Because u is not black, K(u)म=फ{\tt K}(u)^{म}=फ. Because u is not white, W(u)म=फ{\tt W}(u)^{म}=फ. Therefore

(K(u)→W(u))म=K(u)म⇝W(u)म=फ⇝फ=ट\begin{aligned} ({\tt K}(u){\tt \to} {\tt W}(u))^{म} &= {\tt K}(u)^{म}\leadsto {\tt W}(u)^{म} \\ &= फ\leadsto फ \\ &= ट \end{aligned}

So it’s true for the red cube!

Exercise

Now let u be the white cylinder. Evaluate (K(u)→W(u))म({\tt K}(u){\tt \to} {\tt W}(u))^{म}.

Next, explain why (∀x(K(x)→W(x)))म=ट({\tt \forall} {\tt x} ({\tt K}({\tt x}){\tt \to} {\tt W}({\tt x})))^{म} = ट.

Exercise

Let’s consider a property, P, and a model, मम, such that P(u)म=ट{\tt P}(u)^{म} = ट for every choice of u in the domain.

Certain it follows that ∀xP(x)म=ट{\tt \forall} {\tt x} {\tt P}({\tt x})^{म}=ट.

Now prove that ∀x(P(x)∨Q(x))म=ट{\tt \forall} {\tt x}({\tt P}({\tt x}){\tt \lor} {\tt Q}({\tt x}))^{म}=ट.

Also prove that (∀xP(x)∨∀xQ(x))म=ट({\tt \forall} {\tt x} {\tt P}({\tt x}){\tt \lor} {\tt \forall} {\tt x} {\tt Q}({\tt x}))^{म}=ट.

Exercise

Consider a property, P{\tt P}, and model, मम, such that (P(u)∨Q(u))म=ट({\tt P}(u){\tt \lor} {\tt Q}(u))^{म} = ट for every u in the domain.

It follows immediately by definition that ∀x(P(x)∨Q(x))म=ट{\tt \forall} {\tt x}({\tt P}({\tt x}){\tt \lor} {\tt Q}({\tt x}))^{म}=ट.

Is it necessarily true that ∀xP(x)∨∀xQ(x){\tt \forall} xP({\tt x}){\tt \lor}{\tt \forall} {\tt x} {\tt Q}({\tt x})?

Hint: What if the model has domain elements a{\tt a} and b{\tt b}, such that

P(a)म=टP(b)म=फQ(a)म=फQ(b)म=ट\begin{aligned} {\tt P}({\tt a})^{म}=ट\\ {\tt P}({\tt b})^{म}=फ\\ {\tt Q}({\tt a})^{म}=फ\\ {\tt Q}({\tt b})^{म}=ट \end{aligned}

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, X={2,4,…}X = \{2,4,…\}, which in set-builder notation is

X={x∈N:x is even}X=\{x\in \Bbb N:x \text{ is even}\}

Notice that this set is defined by the “is even” property. If we use the symbol E{\tt E} for the “is even” property, then the following proposition is true (in a model with universe N\Bbb N).

∀x(x∈X↔E(x)){\tt \forall} {\tt x}({\tt x}\in {\tt X}{\tt \leftrightarrow} {\tt E}({\tt x}))

The above expression says that “x{\tt x} is an element of X{\tt X} if and only if x{\tt x} is even”. This is more than just true, it is in fact the definition of the set XX!

We have previously said that any set, Y, can be defined some property, call it φ(x)\varphi(x). Specifically, if the universe is U, then Y can be defined as

Y={x∈U:φ(x)}Y = \{x\in U: {\tt \varphi}(x)\}

Well, this is just the same thing as saying

∀x(x∈Y↔φ(x)){\tt \forall} {\tt x}({\tt x}\in {\tt Y}{\tt \leftrightarrow} {\tt \varphi}({\tt x}))

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

{x∈Q:x>1}\{x\in\Bbb Q: x>1\}

Let U be a universal set and A,B⊆UA,B\subseteq U.

Then the union, A∪BA\cup B, is the set of all elements in A{\tt A} or B{\tt B}. Put into a logical expression,

A∪B={x∈U:x∈A∨x∈B}{\tt A}\cup {\tt B} = \{{\tt x}\in {\tt U}: {\tt x}\in {\tt A}{\tt \lor} {\tt x}\in {\tt B}\}

Notice the use of the logical operator, ∨{\tt \lor}.

In fact, we could even state the definition of the union with quantifier logic instead of set-builder notation:

∀x(x∈A∪B↔(x∈A∨x∈B)){\tt \forall} {\tt x}({\tt x}\in {\tt A}\cup {\tt B}{\tt \leftrightarrow} ({\tt x}\in {\tt A}{\tt \lor} {\tt x}\in {\tt B}))

This expression “says” that x{\tt x} is an element of A∪BA\cup B, if and only if x{\tt x} is either in AA or BB.

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, A∩BA\cap B.

That is to say, fill in the blank in the expression below.

A∩B={x∈U:‾}A\cap B = \{x\in U: \underline{\hspace{3cm}}\}

Exercise

Now define the intersection using quantifier logic instead of set-builder notation.

Exercise

Define A∖BA\smallsetminus B using set-builder notation and logical operations, and then also define it using quantifier logic.

Do likewise for the complement, AcA^c.

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 AA and BB, if the following proposition is true?

∀x(x∈A↔x∈B){\tt \forall} {\tt x}({\tt x}\in {\tt A}{\tt \leftrightarrow} {\tt x}\in {\tt B})

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”.