Introduction To Logic: by Magda V Arter Esz
Introduction To Logic: by Magda V Arter Esz
by Magda Várterész
1
Lesson 1
• Everyday meanings
• A branch of science
Logic is the study of careful reasoning by formal methods; it is specifically
concerned with whether reasoning is correct.
Reasoning
thinking process
↓ we can follow it ↓
with the help of a language
statement(s) a new statement
premise(s) conclusion
2
Propositions
A sentence that is either true or false, but not both is called a proposition.
A proposition is expressed as a declarative sentence (as opposed to a question,
command, etc.)
Example 1.1
6. He plays football.
Which of the above are declarative sentences and which are propositions?
3
What is the correct reasoning?
Example 1.1 Consider the following argument about Peter, who is a stu-
dent in a logic course.
Premise: If Peter has the ability and works hard, then Peter will be suc-
cessful in the course.
Conclusion: Therefore, if Peter is not successful in the course, then Peter
does not have the ability or Peter does not work hard.
Premise 1: If the car runs out of petrol, then the car stops.
Premise 2: The car does not run out of petrol.
Conclusion: Therefore, the car does not stop.
Do you think, the reasoning is correct? (This and the previous reasonings
are faulty, because although the premises are true, the conclusion is not sure
true.)
4
The abstracted form of an argument
We can put the same proposition in place of the same sign. We shall
use capital Roman letters to denote the simple propositions, these are called
propositional letters.
→ Let us use capital Roman letters instead of signs!
Premise 1: If A, then B.
Premise 2: Not A.
Conclusion: Not B.
Example 1.4 Our first argument can be written in abstracted form by the
help of letters P, Q, and R represent the following statements:
To conclude in this way is true, because if the premise is true, the conclu-
sion is also true.
5
Exercises
(written home-work)
1. Indicate which of the following are declarative sentences and which are
propositions?
(a) Paul reads The New York Times and watches the BBC News.
(b) Paul watches the BBC News or jogs 3 miles.
(c) If Paul reads The New York Times, then he does not watch the
BBC News.
(d) Paul does not read The New York Times and does not watch the
BBC News.
(e) Paul reads The New York Times or watches the BBC News, but he
does not jog 3 miles.
6
Lesson 2
DEFINITION 2.1
Let P and Q be propositional letters.
Not P.
P and Q.
P or Q.
If P, then Q.
7
Example 2.1
8
The truth table
P Q (P ∧ Q) P Q (P ∨ Q) P Q (P ⊃ Q)
T T T T T T T T T
T F F T F T T F F
F T F F T T F T T
F F F F F F F F T
P ¬P
T F
F T
Example 2.1
P Q (P ∨ Q) ¬P ((P ∨ Q) ∧ ¬P )
T T T F F
T F T F F
F T T T T
F F F T F
9
Exercises
(written home-work)
Write each of the following compound propositions with the help of log-
ical connectives.
(a) Paul reads The New York Times and watches the BBC News.
(b) Paul watches the BBC News or jogs 3 miles.
(c) If Paul reads The New York Times, then he does not watch the
BBC News.
(d) Paul does not read The New York Times and does not watch the
BBC News.
(e) Paul reads The New York Times or watches the BBC News, but he
does not jog 3 miles.
(a) ¬(P ∧ Q)
(b) ¬(¬P ∨ ¬Q)
(c) (¬P ∨ (Q ⊃ P ))
(d) (¬Q ⊃ (Q ⊃ P ))
(e) (P ∧ (Q ⊃ ¬P ))
(f) ((P ∨ ¬Q) ⊃ Q)
(g) (P ∧ (Q ⊃ ¬R))
(h) (¬(P ∧ Q) ∨ (R ∧ ¬P ))
10
Lesson 3
The description of the syntax of any language begins with its alphabet.
The language of propositional logic consists of the following symbols:
1. logical connectives: ¬, ∧, ∨, ⊃
2. parentheses: ( , )
The next definition gives the grammar according to which logic expressions
are constructed. It is an inductive definition that describes the ”shortest” ex-
pressions first and then describes how to build longer expressions from shorter
ones.
DEFINITION 3.1 (propositional formulas)
11
Example 3.1 Let P, Q, R be propositional letters.
The meaning of a formula in logic is simply its truth value. Thus, the
notion of semantics is based on assigning truth values to formulas.
DEFINITION 3.2
An interpretation of a propositional logic language is a function
I : P r → {T, F }
12
Some more syntactic notions of propositional logic
2. d(¬A) = d(A) + 1.
Example 3.2
The immediate subformulas of the formula ((¬P ∧ ¬Q) ⊃ R) are
(¬P ∧ ¬Q) and R.
d((¬P ∧ ¬Q) ⊃ R) = 4
The set of its subformulas is
13
Exercises
(written home-work)
(a) X ⊃ Y ⊃ Z ⊃ ¬X
(b) X ∨ Y ∧ Z ⊃ Y
14
Lesson 4
Logical equivalence
P ¬P ¬¬P
T F T
F T F
Since the columns headed by ¬¬P and P agree in every row, these
formulas are logically equivalent.
P Q P ∨Q ¬(P ∨ Q) ¬P ¬Q ¬P ∧ ¬Q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
15
Important logical equivalences
16
contraposition
A ⊃ B ∼ ¬B ⊃ ¬A
double negation
¬¬A ∼ A
transposition of the first members in an implication
A ⊃ (B ⊃ C) ∼ B ⊃ (A ⊃ C)
A ∧ B ⊃ C ∼ A ⊃ (B ⊃ C)
A ⊃ (B ⊃ C) ∼ (A ⊃ B) ⊃ (A ⊃ C)
partition of events
A ∨ B ⊃ C ∼ (A ⊃ C) ∧ (B ⊃ C)
17
Propositional tautology and contradiction
Some formulas have the seemingly dull property of always being true or
always being false.
DEFINITION 4.2
A formula that is true for all possible interpretations is called a (propositional)
tautology. We denote with |= A if A is a tautology. A formula that is false for
all possible interpretations is called a (propositional) contradiction. We denote
with =| A if A is a contradiction.
Example 4.3
P ¬P P ∨ ¬P
T F T
F T T
P ¬P P ∧ ¬P
T F F
F T F
18
Some important tautologies
excluded third
|= A ∨ ¬A
law about contradiction
|= ¬(A ∧ ¬A)
identity law
|= A ⊃ A
insertion a first member to an implication
|= A ⊃ (B ⊃ A)
transitivity
|= (A ⊃ B) ∧ (B ⊃ C) ⊃ (A ⊃ C)
reductio ad absurdum
|= (A ⊃ B) ∧ (A ⊃ ¬B) ⊃ ¬A
|= A ⊃ (¬A ⊃ B)
Pierce’s law
|= ((A ⊃ B) ⊃ A) ⊃ A
modus ponens
|= A ∧ (A ⊃ B) ⊃ B
modus tollens
|= (A ⊃ B) ∧ ¬B ⊃ ¬A
Exercises
(written home-work)
1. Show that the formulas facing pages 14-15 are really logically equivalent.
19
Lesson 5
Propositional consequence
DEFINITION 5.1
Let A1 , A2 , . . . , An (n ≥ 1) and B formulas. We say that B is a proposi-
tional consequence of A1 , A2 , . . . , An , or B follows from A1 , A2 , . . . , An , denoted
A1 , A2 , . . . , An |= B, if B is true in every interpretation, where every formula
of A1 , A2 , . . . , An is true.
THEOREM 5.1
A1 , A2 , . . . , An |= B if and only if |= A1 ∧ A2 ∧ . . . ∧ An ⊃ B.
Proof.
20
THEOREM 5.2
A1 , A2 , . . . , An |= B if and only if =| A1 ∧ A2 ∧ . . . ∧ An ∧ ¬B.
Proof.
From Theorem 5.1 A1 , A2 , . . . , An |= B if and only if |= A1 ∧ A2 ∧ . . . ∧ An ⊃
B. But from the last lesson we know that a formula is a tautology if and
only if its negation is a contradiction, so A1 , A2 , . . . , An |= B if and only
if =| ¬(A1 ∧ A2 ∧ . . . ∧ An ⊃ B). From the last lesson we know also that
¬(A1 ∧ A2 ∧ . . . ∧ An ⊃ B) ∼ (A1 ∧ A2 ∧ . . . ∧ An ) ∧ ¬B, so they have the same
truth value in every interpretation.
Example 5.1
1. Show that P, P ⊃ Q |= Q.
We do this by constructing a truth table for P ∧ (P ⊃ Q) ⊃ Q.
P Q P ⊃Q P ∧ (P ⊃ Q) P ∧ (P ⊃ Q) ⊃ Q
T T T T T
T F F F T
F T T F T
F F T F T
21
3. Is the the following reasoning correct? (Example 1.1)
Premise: If Peter has the ability and works hard, then Peter will be
successful in the course.
Conclusion: Therefore, if Peter is not successful in the course, then Peter
does not have the ability or Peter does not work hard.
This argument can be written in abstracted form by the help of letters
P, Q, and R represent the following propositions:
Premise 1: P ∧ Q ⊃ R
Conclusion: ¬R ⊃ ¬P ∨ ¬Q
22
Exercises
(written home-work)
1. Show that
(a) ¬Q, P ∨ Q, P ⊃ R |= R
(b) P ⊃ Q, ¬P ⊃ ¬Q |= ¬Q ⊃ ¬P
23
Lesson 6
A sequent
> ∧ A1 ∧ A2 ∧ . . . ∧ An ⊃ B1 ∨ B2 ∨ . . . ∨ Bm ∨ ⊥
AΓ → ∆A
⊥Γ → ∆
ABΓ → ∆ Γ → ∆A; Γ → ∆B
(∧ →) (→ ∧)
(A ∧ B)Γ → ∆ Γ → ∆(A ∧ B)
AΓ → ∆; BΓ → ∆ Γ → ∆AB
(∨ →) (→ ∨)
(A ∨ B)Γ → ∆ Γ → ∆(A ∨ B)
Γ → ∆A; BΓ → ∆ AΓ → ∆B
(⊃→) (→⊃)
(A ⊃ B)Γ → ∆ Γ → ∆(A ⊃ B)
Γ → ∆A AΓ → ∆
(¬ →) (→ ¬)
¬AΓ → ∆ Γ → ∆¬A
24
Let A be a formula. A proof tree for A in the Gentzen calculus is a finite
labelled tree whose nodes are labelled with sequents, whose root is labelled
with → A, and all of whose leaves are labelled with axioms. If a node is
labelled with Γ → ∆, then its children must be labelled with the sequents
from which Γ → ∆ is derived by one of the deduction rules. A formula A is
said to be provable in the Gentzen calculus if there is a proof tree for A.
Example 6.1 → (A ∧ B ⊃ C) ⊃ (A ⊃ (B ⊃ C)) is provable:
A, B → A, C A, B → B, C
A, B → A ∧ B, C C, A, B → C [ (→ ∧) ]
A ∧ B ⊃ C, A, B → C [ (⊃ →) ]
A ∧ B ⊃ C, A → B ⊃ C [ (→ ⊃) ]
A ∧ B ⊃ C → A ⊃ (B ⊃ C) [ (→ ⊃) ]
→ (A ∧ B ⊃ C) ⊃ (A ⊃ (B ⊃ C)) [ (→ ⊃) ]
(a) Soundness of the Gentzen calculus: Every formula provable in the Gentzen
calculus is a tautology.
25
Exercises
(written home-work)
Show that the next sequents are provable in the Gentzen calculus.
(a) → (A ∨ B ⊃ C) ⊃ (A ⊃ C) ∧ (B ⊃ C)
(c) → (A ⊃ (B ⊃ C)) ⊃ (A ∧ B ⊃ C)
(d) → (A ∧ B ⊃ C) ⊃ (A ⊃ (B ⊃ C))
(e) → (A ⊃ B ∨ C) ⊃ (A ⊃ B) ∨ (A ⊃ C)
(f) → (A ⊃ B) ∨ (A ⊃ C) ⊃ (A ⊃ (B ∨ C))
(g) → ¬(A ⊃ B) ⊃ ¬A ∨ ¬B
(h) → (A ⊃ B) ⊃ ¬A ∨ B
26
Lesson 7
Predicates
x is an odd integer.
27
2. x is a student of Debrecen University.
Let S(x) denote this sentence, the domain of S is a set of persons.
3. x is a right-angled triangle.
Let R(x) denote this sentence, the domain of R is a set of triangles.
4. If x is odd, then x is not a multiple of 2.
Let P (x) denote that x is odd and Q(x) denote that x is a multiple of
2. The domain of P and Q is the set of positive integers. This sentence
has the logical form
P (x) ⊃ ¬Q(x)
and its truth value can be determined for a specified value of x. (It is
true for all x.)
Quantifiers
Sentences such as
or
cannot be symbolized using the logical connectives presented thus far. The
reason for this is the presence of the phrases ”there exists an x” and ”for all
x”. They are use so frequently that they warrant symbolic representation.
1. The proposition
is symbolized by
∃xP (x)
28
2. The proposition
is symbolized by
∀xP (x)
The sign ∀ is called the universal quantifier and translates as ”for all”.
Other phrases for ∀ are ”for each” or ”for every” or ”given any”. The
proposition ∀xP (x) is true if P (x) is true for every value of domain of
P.
The quantifiers ∃ and ∀, together with the logical connectives, are collec-
tively referred to as the logical symbols.
Example 7.2
∀x(I(x) ⊃ R(x))
2. There exists an even prime number. Let E(x) denote that x is an even
number, and P (x) that x is a prime number. The logical form of the
sentence:
∃x(E(x) ∧ P (x))
29
Exercises
(written home-work) by next Friday)
(a) ∃xC(x)
(b) ∃xH(x)
(c) ∀x(C(x) ⊃ ¬H(x))
(d) ∃x(C(x) ∧ H(x))
(e) ∃x(H(x) ⊃ C(x))
(a) For every two points, there is a line passing through both points.
(b) For every two points, there is one and only one line passing through
both points.
30
Lesson 8
2. quantifiers: ∀, ∃
31
Example 8.1 Let P 1 , Q2 , R3 be one-, two- and tree-place predicate sym-
bols of L.
Formulas: ¬P (x), (Q(c, y) ∨ R(z, z, z)), ¬(¬P (x) ⊃ (Q(c, y) ∨ R(z, z, z))),
∀xP (x), ∃y∃z(Q(c, y) ∨ R(z, z, z)) . . .
2. d(¬A) = d(A) + 1.
32
DEFINITION 8.6 The free-variable occurrences in a formula are defined as
follows:
4. The free-variable occurrences in ∀xA and ∃xA are are free-variable oc-
currences in A, except for occurrences of x.
4. ∀xA ≈ ∀yA0 and ∃xA ≈ ∃yA0 if and only if when we replace the free-
occurrence x in A and y in A0 with the same new variable z, we get, that
Axz ≈ Ayz .
33
Exercises
(written home-work)
(a) Q(x, y, y)
(b) (P (x) ⊃ ∀y(R(x, y, z) ∧ P (x, y)))
(c) R(P (x), y, z)
34
Lesson 9
First-order semantics
35
DEFINITION 9.4 Let hD, Ii be an interpretation for the language L, and
let θ be an valuation in this interpretation. To each formula of L, we associate
a truth value as follows:
• ||P (t1 , t2 , . . . , tn )||I,θ = T if and only if (|t1 |I,θ , |t2 |I,θ , . . . , |tn |I,θ ) ∈
PI , where |x|I,θ = θ(x), and for a constant symbol c, |c|I,θ = cI .
• ||>||I = T ||⊥||I = F
36
DEFINITION 9.5 Let A and B formulas. A and B are logically equivalent,
denoted A ∼ B, if ||A||I,θ = ||B||I,θ in every interpretation I for every valuation
θ.
DEFINITION 9.6 A formula A of L is first-order tautology if ||A||I,θ = T
in every interpretation I for every valuation θ. (|= A) A formula A of L is first-
order contradiction if ||A||I,θ = F in every interpretation I for every valuation
θ. (=| A)
fictive quantifiers
if x 6∈ F v(A), then
∀xA ∼ A ∃xA ∼ A
change of place of the same quantifiers
∀x∀yA(x, y) ∼ ∀y∀xA(x, y)
∃x∃yA(x, y) ∼ ∃y∃xA(x, y)
quantifiers in an implication
|= ∀xA(x) ⊃ ∃xA(x)
|= ∃y∀xA(x, y) ⊃ ∀x∃yA(x, y)
De Morgan’s laws
¬∃xA(x) ∼ ∀x¬A(x)
¬∀xA(x) ∼ ∃x¬A(x)
change of place of quantifier and negation
∃xA(x) ∼ ¬∀x¬A(x)
∀xA(x) ∼ ¬∃x¬A(x)
lifting out the one side
if x 6∈ F v(A), then
A ∧ ∀xB(x) ∼ ∀x(A ∧ B(x))
A ∧ ∃xB(x) ∼ ∃x(A ∧ B(x))
A ∨ ∀xB(x) ∼ ∀x(A ∨ B(x))
A ∨ ∃xB(x) ∼ ∃x(A ∨ B(x))
37
A ⊃ ∀xB(x) ∼ ∀x(A ⊃ B(x))
A ⊃ ∃xB(x) ∼ ∃x(A ⊃ B(x))
∀xB(x) ⊃ A ∼ ∃x(B(x) ⊃ A)
∃xB(x) ⊃ A ∼ ∀x(B(x) ⊃ A)
lifting out the both sides
Exercises
(written home-work)
1. Show that the formulas facing pages 36-37 are really logically equivalent.
38
Lesson 10
First-order consequence
DEFINITION 10.1
Let A1 , A2 , . . . , An (n ≥ 1) and B formulas. We say that B is a first-order con-
sequence of A1 , A2 , . . . , An , or B follows from A1 , A2 , . . . , An , denoted A1 , A2 , . . . , An |=
B, if B is true in every interpretation for every valuation, where every formula
of A1 , A2 , . . . , An is true.
THEOREM 10.1
A1 , A2 , . . . , An |= B if and only if |= A1 ∧ A2 ∧ . . . ∧ An ⊃ B.
THEOREM 10.2
A1 , A2 , . . . , An |= B if and only if =| A1 ∧ A2 ∧ . . . ∧ An ∧ ¬B.
THEOREM 10.3
If A1 , A2 , . . . , An |= B and x is not free in formulas A1 , A2 , . . . , An , then
A1 , A2 , . . . , An |= ∀xB.
Example 10.1
39
2. Show, that the conclusion is a first-order consequence of the premises.
Exercises
(written home-work)
40
Lesson 11
Gentzen calculus
AΓ → ∆A
⊥Γ → ∆
Deduction rules of Gentzen calculus
ABΓ → ∆ Γ → ∆A; Γ → ∆B
(∧ →) (→ ∧)
(A ∧ B)Γ → ∆ Γ → ∆(A ∧ B)
AΓ → ∆; BΓ → ∆ Γ → ∆AB
(∨ →) (→ ∨)
(A ∨ B)Γ → ∆ Γ → ∆(A ∨ B)
Γ → ∆A; BΓ → ∆ AΓ → ∆B
(⊃→) (→⊃)
(A ⊃ B)Γ → ∆ Γ → ∆(A ⊃ B)
Γ → ∆A AΓ → ∆
(¬ →) (→ ¬)
¬AΓ → ∆ Γ → ∆¬A
A(x||t)∀xAΓ → ∆ Γ → ∆A(x||y)
(∀ →) (→ ∀)
∀xAΓ → ∆ Γ → ∆∀xA
A(x||y)Γ → ∆ Γ → ∆A(x||t)∃xA
(∃ →) (→ ∃)
∃xAΓ → ∆ Γ → ∆∃xA
41
Let A be a formula. A proof tree for A in the Gentzen calculus is a finite
labelled tree whose nodes are labelled with sequents, whose root is labelled
with → A, and all of whose leaves are labelled with axioms. If a node is
labelled with Γ → ∆, then its children must be labelled with the sequents
from which Γ → ∆ is derived by one of the deduction rules. A formula A is
said to be provable in the Gentzen calculus if there is a proof tree for A.
Example 11.1
→ ∀xP (x) ⊃ ¬∃x¬P (x) is provable:
42
Example 11.2
→ ∀xP (x) ⊃ ¬∃x¬P (x) is provable:
Exercises
(written home-work)
Show that the next sequents are provable in the Gentzen calculus.
43
Lesson 12
Normal forms
DEFINITION 12.1
• A literal is an atom or the negation of an atom.
• Let L1 , L2 , . . . , Ln (n ≥ 1) be literals.
L1 ∧ L2 ∧ . . . ∧ Ln is an elementary conjunction,
L1 ∨ L2 ∨ . . . ∨ Ln is an elementary disjunction.
Example 12.1
• P , ¬P , Q(x) and ¬R(c, y) are literals
THEOREM 12.1
There exists an algorithm transforming any given quantifier-free formula A
into an equivalent conjunctive (or disjunctive) normal form B.
Steps of transformation procedure:
1. Use the equivalence
• A ⊃ B ∼ ¬A ∨ B
• ¬¬A ∼ A
44
• ¬(A ∧ B) ∼ ¬A ∨ ¬B
• ¬(A ∨ B) ∼ ¬A ∧ ¬B
• A ∧ (B ∨ C) ∼ (A ∧ B) ∨ (A ∧ C)
• A ∨ (B ∧ C) ∼ (A ∨ B) ∧ (A ∨ C)
(A ⊃ B) ∨ ¬(¬B ⊃ A ∨ ¬C)
5. (¬A ∨ B) ∨ (¬B ∧ ¬A ∧ C)
45
DEFINITION 12.2
A formula is in a prenex normal form, if it is in the form of Q1 x1 Q2 x2 . . . Qn xn C (n ≥
0), where Qi is either ∀ or ∃, and C is a formula containing no quantifier.
Example 12.3 The formula ∀x∃y∃z(P (x) ⊃ ¬Q(y, z)) is in prenex normal
form.
THEOREM 12.2
There exists an algorithm transforming any given formula A into an equivalent
prenex normal form B.
Steps of transformation procedure:
1. If there is a variable having both free and bound occurrences, then re-
name its bound occurrences.
• ¬∃xA(x) ∼ ∀x¬A(x)
• ¬∀xA(x) ∼ ∃x¬A(x)
• A ∧ ∀xB(x) ∼ ∀x(A ∧ B(x))
• A ∧ ∃xB(x) ∼ ∃x(A ∧ B(x))
• A ∨ ∀xB(x) ∼ ∀x(A ∨ B(x))
• A ∨ ∃xB(x) ∼ ∃x(A ∨ B(x))
• A ⊃ ∀xB(x) ∼ ∀x(A ⊃ B(x))
• A ⊃ ∃xB(x) ∼ ∃x(A ⊃ B(x))
• ∀xB(x) ⊃ A ∼ ∃x(B(x) ⊃ A)
• ∃xB(x) ⊃ A ∼ ∀x(B(x) ⊃ A)
46
Example 12.4 Transform the formula
Exercises
(written home-work)
(c) (C ⊃ A) ⊃ (¬(B ∨ C) ⊃ A)
47
1. Show that the formulas A ⊃ B and ¬(A ∧ ¬B) are logically equivalent.
4. Show that the next formula is not tautology: ∃xP (x) ⊃ ∀xP (x).
(x is not free in R)