Mathematical Logic
Mathematical Logic
2 Deductions 9
2.1 Introduction 9
2.2 Deduction 9
2.2.1 Deduction Rules for the Connectives ∧, ⌉ 9
2.2.2 Deduction Rules for the Connectives →, ↔ and ∨ 11
2.3 Consistency Theorem 11
2.4 Completeness Theorem 11
2.5 Independence of formulas 12
3 Turing Machine 13
3.1 Introduction 13
3.1.1 Components of the machine 13
3.1.2 Formal Definition 13
3.1.3 How the Turing Machine operates 14
3.1.4 Representation of Natural Integers 15
3.1.5 Graphical Representation of the Turing Machine 15
i
ii CONTENTS
4 Predicate Logic 17
4.1 Introduction 17
4.2 The Alphabet of Predicate Logic 17
4.3 Terms 18
4.4 Predicates 18
4.5 Formulas 18
4.5.1 Atomic Formula 18
4.5.2 Well-formed Formula 19
4.5.3 Scope of Quantifiers, Free Variables, Bound Variables 19
4.5.4 Closed Formula 20
4.5.5 Open Formula 20
4.5.6 The Closure 20
Chapter 1
1.1 Introduction
One of the popular definitions of logic is that it is the analysis of methods of reasoning.
In studying these methods, logic is interested in the form rather than the content of the
argument. For example, consider these two arguments:
2. All cats like fish. Silvy is a cat. Hence, Silvy likes fish.
Both have the same form: All A are B. S is an A. Hence, S is a B. The truth or
falsity of the particular premises and conclusions is of no concern to logicians. They want
to know only whether the premises imply the conclusion. The systematic formalization
and cataloguing of valid methods of reasoning are a main task of logicians. If the work
uses mathematical techniques or if it is primarily devoted to the study of mathematical
reasoning, then it may be called mathematical logic. We can narrow the domain of math-
ematical logic if we define its principal aim to be a precise and adequate understanding
of the notion of mathematical proof.
Negation
Negation is one of the simplest operations on sentences. Although a sentence in a natural
language may be negated in many ways, we shall adopt a uniform procedure: placing a
sign for negation, the symbol ⌉, in front of the entire sentence. Thus, if A is a sentence,
1
2 CHAPTER 1. THE PROPOSITIONAL CALCULUS
A ⌉A
T F
F T
When A is true, ⌉A is false; when A is false, ⌉A is true. We use T and F to denote the
truth values true and false.
Conjunction
Another common truth-unctional operation is the conjunction: “and”. The conjunction
of sentences A and B will be designated by A ∧ B and has the following truth table:
A ⌉A A ∧ B
T T T
T F F
F T F
F F F
A ∧ B is true when and only when both A and B are true. A and B are called the
conjuncts of A ∧ B. Note that there are four rows in the table, corresponding to the
number of possible assignments of truth values to A and B.
Disjunction
In natural languages, there are two distinct uses of “or”: the inclusive and the exclusive.
According to the inclusive usage, “A or B” means “A or B or both,” whereas according to
the exclusive usage, the meaning is “A or B, but not both,”. We shall introduce a special
sign, ∨, for the inclusive connective. Its truth table is as follows:
A ⌉A A ∨ B
T T T
T F T
F T T
F F F
Thus, A ∨ B is false when and only when both A and B are false. “A ∨ B” is called a
disjunction, with the disjuncts A and B.
1.2. PROPOSITIONAL CONNECTIVES: TRUTH TABLES 3
Conditional
Another important truth-functional operation is the conditional: “if A, then B.” Ordinary
usage is unclear here. Surely, “if A, then B” is false when the antecedent A is true and
the consequent B is false. However, in other cases, there is no well-defined truth value.
For example, the following sentences would be considered neither true nor false:
Their meaning is unclear, since we are accustomed to the assertion of some sort of
relationship (usually causal) between the antecedent and the consequent. We shall make
the convention that “if A, then B” is false when and only when A is true and B is false.
Thus, sentences 1–3 are assumed to be true. Let us denote “if A, then B” by “A → B”.
An expression “A → B” is called a conditional. Then → has the following truth table:
A ⌉A A→B
T T T
T F F
F T T
F F T
bi-Conditional
Let us denote “A if and only if B” by “A ↔ B.” Such an expression is called a bicondi-
tional. Clearly, A ↔ B is true when and only when A and B have the same truth value.
Its truth table, therefore is:
A ⌉A A↔B
T T T
T F F
F T F
F F T
Remark
1. If A and B are statement forms, then so are (⌉A), (⌉B), (A ∧ B), (A ∨ B), (A → B),
and (A ↔ B).
2. ⌉(A ∧ B) ≡ (⌉A∨⌉B)
3. ⌉(A ∨ B) ≡ (⌉A∧⌉B)
1.3 Tautologies
A statement form that is always true, no matter what the truth values of its statement
letters may be, is called a tautology. A statement form is a tautology if and only if
its corresponding truth function takes only the value T, or equivalently, if, in its truth
table, the column under the statement form contains only Ts. An example of a tautology
is (A ∨ (⌉A)), the so-called law of the excluded middle. Other simple examples are
(⌉(A ∧ (⌉A))), (A ↔ (⌉(⌉A))), ((A ∧ B) → A), and (A → (A ∨ B)).
1. (A ∧ B) logically implies A, (A ∧ B) ⇒ A, (A ∧ B) |= A.
Proposition
1. B logically implies C if and only if (B → C) is a tautology. (B ⇒ C) iff |= (B → C).
Proposition
Every truth function is generated by a statement form involving the connectives ⌉, ∧, and
∨.
Example 1.6.1.
x1 x2 f (x1 , x2 )
T T F
T F T (x1 ∧⌉x2 )
F T T (⌉x1 ∧ x2 )
F F T (⌉x1 ∧⌉x2 )
x1 x2 x3 f (x1 , x2 , x3 )
T T T T (x1 ∧ x2 ∧ x3 )
T T F F
T F T T (x1 ∧⌉x2 ∧ x3 )
T F F T (x1 ∧⌉x2 ∧⌉x3 )
F T T F
F T F F
F F T F
F F F T (⌉x1 ∧⌉x2 ∧⌉x3 )
f (x1 , x2 , x3 ) is: (x1 ∧ x2 ∧ x3 ) ∨ (x1 ∧⌉x2 ∧ x3 ) ∨ (x1 ∧⌉x2 ∧⌉x3 ) ∨ (⌉x1 ∧⌉x2 ∧⌉x3 )
Corollary
Every truth function can be generated by a statement form containing as connectives only
∧ and ⌉, or only ∨ and ⌉, or only → and ⌉.
Proof
1. Negation: ⌉A ≡⌉A
2. Conjunction: A ∧ B ≡ A ∧ B
6 CHAPTER 1. THE PROPOSITIONAL CALCULUS
3. Disjunction: A ∨ B ≡⌉(⌉A∧⌉B)
4. Conditional: A → B ≡⌉(A∧⌉B)
5. bi-Conditional: A ↔ B ≡⌉(A∧⌉B)∧⌉(B∧⌉A)
Proposition
1. A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C)
2. A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C)
Example 1.7.1.
x1 x2 f (x1 , x2 )
T T F
T F T (x1 ∧⌉x2 )
F T T (⌉x1 ∧ x2 )
F F T (⌉x1 ∧⌉x2 )
Proposition
CN F (f ) =⌉(DN F (⌉f ))
Example 1.8.1.
x1 x2 x3 f (x1 , x2 , x3 ) ⌉f (x1 , x2 , x3 )
T T T T F
T T F F T (x1 ∧ x2 ∧⌉x3 )
T F T T F
T F F T F
F T T F T (⌉x1 ∧ x2 ∧ x3 )
F T F F T (⌉x1 ∧ x2 ∧⌉x3 )
F F T F T (⌉x1 ∧⌉x2 ∧ x3 )
F F F T F
DNF(⌉f (x1 , x2 , x3 )) is: (x1 ∧ x2 ∧⌉x3 ) ∨ (⌉x1 ∧ x2 ∧ x3 ) ∨ (⌉x1 ∧ x2 ∧⌉x3 ) ∨ (⌉x1 ∧⌉x2 ∧ x3 )
so:
CNF(f (x1 , x2 , x3 )) is: (⌉x1 ∨⌉x2 ∨ x3 ) ∧ (x1 ∨⌉x2 ∨⌉x3 ) ∧ (x1 ∨⌉x2 ∨ x3 ) ∧ (x1 ∨ x2 ∨⌉x3 )
8 CHAPTER 1. THE PROPOSITIONAL CALCULUS
Chapter 2
Deductions
2.1 Introduction
In Chapter 1, we learned that determining the validity of formulas in propositional calculus
relies primarily on truth tables. However, constructing the truth table for a formula is
a tedious task, especially when the formula contains multiple propositions. Proof theory
offers methods to study the validity of formulas without using truth tables.
2.2 Deduction
A deduction of a formula α from a set of formulas Γ is a sequence of formulas α1 , α2 , . . . , αn
such that αi is either an axiom, a formula from Γ, or a formula derived from the preceding
formulas using inference rules. It is denoted as Γ ⊢ α, and the formulas in Γ are called
hypotheses.
9
10 CHAPTER 2. DEDUCTIONS
A Gentzen natural deduction refers to any truth tree in which a conclusion is derived
from the premises by applying the following rules : (I∧), (E∧), (I⌉), (E⌉)
Remark
Let Γ = {α1 , α2 , . . . , αn } be a set of formulas where the αi are arbitrary propositions.
• Γ ⊢ α: means that there exists a deduction that concludes α, where the only
uneliminated premises are in Γ.
• ⊢ α: means that there exists a deduction that concludes α, such that all the premises
are eliminated.
Example
In the formal system S = {∧, ⌉} prove ⊢ α∨⌉α
It is important to note that the ∨ connective is not present in our system of deduction
rules. We need to define its meaning in terms of the connectives ⌉ and ∧.
α∨⌉α ≡⌉(⌉α ∧ α)
Using proof-by-contradiction, we assume that ⌉(⌉α ∧ α) is false, which means that we
assume that (⌉α ∧ α) is true, and we look for a contradiction.
assumption assumption
Contraduction
Example
In the formal system S = {∧, ⌉} prove α ⊢ α ∨ β
Using proof-by-contradiction, we assume that α ∨ β is false, which means that we
assume that ⌉(α ∨ β) is true, and we look for a contradiction.
⌉(α ∨ β) is true means that (⌉α∧⌉β) is also true.
2.3. CONSISTENCY THEOREM 11
assumption hypothesis
Contraduction
Example
In the formal system S = {∧, ⌉} prove α → β, α ⊢ β
Using proof-by-contradiction, we assume that β is false, which means that we assume
that ⌉β is true, and we look for a contradiction.
Since the only system considered in this example is S = {∧, ⌉}, we need to define the
meaning of α → β in terms of the connectives ⌉ and ∧.
α → β ≡⌉(α∧⌉β).
hypothesis assumption hypothesis
Contraduction
2. if |= A, then ⊢ A
12 CHAPTER 2. DEDUCTIONS
• A set of formulas Γ is independent if none of its formulas can be derived from the
others.
Chapter 3
Turing Machine
3.1 Introduction
The Turing machine is an abstract model of how mechanical computing devices oper-
ate, such as a computer and its memory. It was created by Alan Turing to provide a
precise definition of the concept of an algorithm. This model is still widely used in theo-
retical computer science, particularly to address problems of algorithmic complexity and
computability.
1. A tape (memory) of infinite length divided into cells. Each cell contains at most
one symbol.
2. A read/write head that allows you to read or modify the content of a cell.
Conventions
• S0 represents the blank symbol; denoted 0 or b.
13
14 CHAPTER 3. TURING MACHINE
Example
Consider the following Turing machine:
S = {0, |}, E = {q0 , q1 , q2 }
q0 1Rq0
q0 01q1
q1 1Lq1
q1 0Rq2
3.1. INTRODUCTION 15
Remark
Let f be a function N p → N q , and let T be a Turing machine. We say that f is computable
by T if, starting from the initial configuration q0 x1 ∗ x2 ∗ · · · ∗ xp we get qf y1 ∗ y2 ∗ · · · ∗ yq
such that: f (x1 , x2 , . . . , xp ) = (y1 , y2 , . . . , yq ) where:
• xi is the representation of xi on T .
Remark
Each state appears only once in the graph.
Example
Consider the Turing machine T.M = (S, E, I) such that:
q0 1Rq0
q0 01q1
q1 1Lq1
q1 0Rqf
Example
Design the Turing machine that computes the predecessor of a binary-represented integer
n with its mirrored version.
f (n) = n − 1 ⇒ T M (n) = n − 1
f (1) = 0 ⇒ T M (1) = 0
f (4) = 3 ⇒ T M (001) = 11
f (5) = 3 ⇒ T M (101) = 001
Example
Design the Turing machine that computes the function f (n) = 0 for a binary-represented
integer n.
f (n) = 0 ⇒ T M (n) = 0
f (1) = 0 ⇒ T M (1) = 0
f (2) = 0 ⇒ T M (10) = 0
f (3) = 0 ⇒ T M (11) = 0
Predicate Logic
4.1 Introduction
In propositional logic, we are restricted to propositional connectives (which combine
propositions, rather than variables and propositions). This limitation prevents us from
representing reasoning like the following:
ALL humans are mortal. Socrates is a human. THEREFORE, Socrates is mortal.
This reasoning involves the concepts of object and object properties.
The properties of objects are expressed in the form Human-being(Socrate). Here,
Human-being is the property, and Socrate is the object. Generic statements require
the use of the universal quantifier ∀. Thus, “EVERY human being is mortal” can be
translated as ∀x (human-being(x) → mortal(x)). A more general concept than that of
a property is the predicate, which makes it possible to express a relationship between
multiple objects, such as Father(Jean, Pierre) or smaller than(3, 7). A predicate can
have zero, one, or more arguments. Propositional variables are considered predicates with
zero arguments.
Predicate logic is also called first-order logic, in contrast to second-order pred-
icate logic, which allows quantification not only over objects but also over predicates,
enabling it to represent set theory (propositional logic can be viewed as zero-order predi-
cate logic). The aim of this chapter is to define first-order logic. We will first discuss its
syntax, i.e., how to write formulas, and then their semantics.
17
18 CHAPTER 4. PREDICATE LOGIC
• The quantifiers ∀, ∃.
• The connectors ⌉, ∧, ∨, →
Remark
Functions with zero arguments are called constants and are written without parentheses
(a, b, . . . , Socrate, . . . ). Similarly, predicates with zero arguments are simply propositional
variables.
4.3 Terms
The set of terms is the smallest set of expressions formed from the alphabet of predicate
logic such that:
• Any variable (or constant) is a term.
4.4 Predicates
In mathematical logic, a predicate of a language represents a property of the objects in
the domain under consideration, expressed within that language.
Example
• Socrates is a man.
• Socrates is mortal.
4.5 Formulas
4.5.1 Atomic Formula
If p is a predicate with n arguments and t1 , t2 , . . . , tn are terms, then p(t1 , t2 , . . . , tn ) is an
atomic formula.
4.5. FORMULAS 19
Atomic formulas are those that contain only predicates (no logical symbols). In con-
trast, non-atomic formulas are sentences that include logical symbols.
Example
In ∀y((p(x) ∨ ∃x p(x)) ∧ q(y)), the first occurrence of x (in p(x)) is free, while the second
occurrence is bound. The occurrence of y is bound.
In (∀x R(x)) ∧ P (x), the first occurrence of x (in R(x)) is bound by the quantifier ∀,
while the second occurrence of x (in P (x)) remains free.
20 CHAPTER 4. PREDICATE LOGIC
Example
The formula ∀x ∃y x < y is closed.
Example
The formula ∀x x < y is open. (here y is free)
21