Logic-Rondo-2 3 0
Logic-Rondo-2 3 0
Henning Basold
T
Base revision 33eba78, (HEAD -> v2) from 2024-02-20
AF
e
ut
rib
ist
td
DR
no
Do
c ba Copyright © 2020–2024 Henning Basold, under a Cre-
ative Commons Attribution-ShareAlike 4.0 International License:
https://creativecommons.org/licenses/by-sa/4.0/.
B. Tools 61
B.1. Sets and Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
B.2. Induction on Natural Numbers . . . . . . . . . . . . . . . . . . 61
B.3. Trees and Induction . . . . . . . . . . . . . . . . . . . . . . . . 64
B.4. Formal Languages . . . . . . . . . . . . . . . . . . . . . . . . . 67
C. Three-Valued Logic 71
D. Logic Programming 73
iv Contents
The Visitor
Clara opens her eyes. She finds herself in a small room, with some of the
dawning day coming in. Clara gasps for air and sits up, realising that she is
in her own bed. Cold sweat is running down to her chin and her pillow has a
wet silhouette of her head. “Phew, what I dream! I should not prepare so late
for my exams any more.”
2 Prologue
Suddenly, Clara realises that she is not alone, that there is something next to
her bed. She slowly turns the head and suppresses a scream upon putting her
eyes on the metallic object. It looks like a can with cylindrical arms and legs
sticking out, and a metal sphere on the head with something that looks like
closed eyes and mouth. At the end of the hanging arms are metallic hands
with fingers and the legs even have feet, making the object look like a can-
shaped, clumsy human. Now awake, Clara realises that the object next to her
bed is a robot. She is hesitant to move, afraid to bring the robot to life. Who
knows if it is dangerous!
A red lamp on the chest of the robot starts flashing in regular pulses in rhythm
with buzzing noises coming out of its interior. Clara jumps out of her bed and
hides behind her desk at the other end of the room. The robot comes to life,
his arms stretch under tension. Its empty eyes are opening, and Clara has
the impression to stare down into ever-expanding space. Crackling noises
are followed by a metallic voice: “Initial startup finished. Human presence
detected. I am Isaac, please identify yourself.”
Both fall silent. After some minutes of thinking, Clara has a realisation. “Did
you say ‘Deduction System’?”, she asks Isaac. “I did. Do you know anything
about that?” Isaac is surprised. “I am not sure, but I am currently taking a
course on logic and deduction systems play a big part in that course.”, Clara
explains. “You see, they allow the inference of new knowledge from exist-
ing knowledge in a way that is completely formal and can be understood by
computers.” Isaac is intrigued. “Computers like my brain, is that what you
are saying?” His eyes and face seem to express curiosity. “I don’t know. It
might be that you are working with the same form of deduction that appear
in my course. Maybe if you learn about loguc and deductions we can access
your memory and find out who you are. After all, I suppose that even the
computers of the future still follow the same logical principles.”
Part I.
Clara just spoke out a name, when the light on Isaac starts flashing faster and
faster. Suddenly everything is dark and Clara feels like she is floating in the
air. After a few seconds, which felt like centuries, there is light again.
Aristotle: Who are you, entering my house with that metal construction?
Isaac: I’m not a metal construction! I’m a living and breathing robot!
Aristotle: By Zeus! It can speak!
Clara: Where are we? Who are you?
Aristotle: I am Aristotle and you are in Athens. Now, who are you?
Clara: Isaac, what happened? How did we get here and how come I can talk
to him?
Isaac: My Trans-O-Matic enables translation between any language known
to me, including ancient Greek, for everyone in my surrounding.
Aristotle: A robot, mh? What is that supposed to mean?
Clara: Of course, you cannot know. You may think of an αὐτόματον (automa-
ton) as Hephaestus created them, only that a robot can make decisions for
itself and act like a human, all within limits certainly.
Aristotle: How fascinating! May I keep you here for studying my friend?
8 1. Introduction to Propositional Logic
Isaac: Isaac is the name and I would prefer not to be studied, if you don’t
mind. Rather, Clara and I are trying to understand the roots of my being.
Clara: Indeed, I want to help Isaac to recover his memory, which seems to be
based on some logical deduction system. Unfortunately, I know very little
about logic and we are not sure where to start. That’s why we are here with
you, one of the founders of formal logic.
Aristotle: I see, I see.
Start where all logic starts: with simple deduction. Take, for example, the
following deduction. “If it rains and Socrates has no umbrella, then he gets
wet. Socrates has no umbrella and is not wet. Therefore, it does not rain.”
and can read it still in exactly the same way by replacing 𝑟 , 𝑢 and 𝑤 by the
corresponding phrases. We call 𝑟 , 𝑢 and 𝑤 propositional variables, as they
stand for propositions that can be either true or false. This is very important
to keep in mind: we reason about such variables independently of their truth,
and arguments need to be able to account for any possibility!
You will have noticed that the second sentence cannot be directly written with
the three propositional variables because it says “he does not get wet”, while
we only have the variable 𝑤 that stands for “he gets wet”. We will allow our-
selves to write “not” in front of a variable to negate what it says, that is, “not
𝑤” stands for “he does not get wet”. Natural language is full of ambiguities,
caused by different ways of reading and interpreting sentences. One of the
goals of formal logic is to prevent such ambiguities. With this in mind, we
can write the second and third sentence as
What is left of the original sentence are only the words “if”, “then”, “and”,
“therefore” and “not”. These are logical connectives, and we will introduce
formal notations for them soon.
But let us appreciate for a moment that we have replaced in the original ex-
ample certain phrases by variables and obtained an argument that relies only
on the structure of the sentences, rather than their meaning. For instance, we
could reinterpret the variables like so:
Definition 1.2
The propositional formulas 𝜑 of propositional logic are generated by the
following context free grammar, in which 𝑝 ranges over the propositional
variables PVar.
𝜑 ::= 𝑝 | ⊥ | 𝜑 ∧ 𝜑 | 𝜑 ∨ 𝜑 | 𝜑 → 𝜑 | (𝜑)
1.1. Syntax of Propositional Logic 11
“But wait”, Clara intervenes, “we are missing the negation, aren’t we?” Yes
indeed, we are. However, our intuition would dictate that the formula ¬𝜑
should hold only if 𝜑 does not hold. Or, in other words, whenever 𝜑 holds,
something went wrong and we discovered an absurd situation. We can ex-
press this by the formula 𝜑 → ⊥, saying that 𝜑 implies absurdity. Similarly,
we can also express other common logical connectives in terms of the basic
connectives.
Example 1.4
The deduction that it did not rain by experimenting with Socrates’ misery
consists of the following three formulas.
𝑟 ∧𝑢 → 𝑤 and 𝑢 ∧ ¬𝑤 and ¬𝑟
(𝑟 ∧ 𝑢 → 𝑤) ∧ (𝑢 ∧ ¬𝑤) → ¬𝑟
You should also appreciate that we can leave out parentheses by using our
reading conventions. Without them, the formula in example 1.4 would look
1.2. Parse Trees and Subformulas 13
like this: ( )
( ) ( )
(𝑟 ∧ 𝑢) → 𝑤 ∧ 𝑢 ∧ (¬𝑤) → (¬𝑟 )
What an abomination! I wish, I had these tools in the debates with my con-
temporary philosophers in the ancient Greek times.
Table 1.2 shows some more example, in which the reading conventions allow
us to leave out parentheses Note that there is no convention about mixing ∧
and ∨, as this would cause more confusion than it helps. For example, the
formula 𝑝 ∧ 𝑞 ∨ 𝑟 is considered to be ambiguous and should be written either
as (𝑝 ∧ 𝑞) ∨ 𝑟 or 𝑝 ∧ (𝑞 ∨ 𝑟 ).
Isaac: I have the feeling that there may still be some ambiguity. How can I
know for sure in which order I have to process a formula?
Aristotle: My apologies! But you are a curious thing and I would like to ask
you so many questions.
Definition 1.5
The top-level connective and direct subformulas of formulas are given
as in table 1.3. A formula is called atomic if it has no direct subformulas,
that is, if it is of the shape ⊥ or 𝑝 for 𝑝 ∈ PVar.
Given a formula 𝜑, the parse tree of 𝜑 is a tree, in which
When we picture such trees, we typically draw a circle for every node and
write the label inside this node. This allows to picture, for example, the for-
mula 𝑝 ∧ 𝑞 as
𝑝 𝑞
Example 1.6
Recall the formula
(𝑟 ∧ 𝑢 → 𝑤) ∧ (𝑢 ∧ ¬𝑤) → ¬𝑟
from example 1.4. The parse tree of this formula is given as follows.
1.2. Parse Trees and Subformulas 15
∧ →
→ ∧ 𝑟 ⊥
∧ 𝑤 𝑢 →
𝑟 𝑢 𝑤 ⊥
Note that the parse tree does not contain negations because this is a derived
connective. Instead, it is represented by the defining formula. For instance,
¬𝑟 becomes 𝑟 → ⊥ in the parse tree.
It is now easy to read off all subformulas from the tree:
( )
Sub (𝑟 ∧ 𝑢 → 𝑤) ∧ (𝑢 ∧ ¬𝑤) → ¬𝑟 = {
𝑟, 𝑢, 𝑟 ∧ 𝑢, 𝑤, 𝑟 ∧ 𝑢 → 𝑤,
⊥, 𝑤 → ⊥, 𝑢 ∧ (𝑤 → ⊥)
𝑟 → ⊥, (𝑟 ∧ 𝑢 → 𝑤) ∧ (𝑢 ∧ (𝑤 → ⊥))
(𝑟 ∧ 𝑢 → 𝑤) ∧ (𝑢 ∧ (𝑤 → ⊥)) → (𝑟 → ⊥)
}
Clara: These are a lot of formalities for expressing very simple things! Is all
of this really necessary?
Aristotle: If you know how computers work, then you should be able to appre-
ciate the clarity of representing formulas as parse trees and you can imagine
how a computer could process formulas by traversing such trees. From my
perspective, the formalisation of knowledge as formulas is a great leap for-
ward. You know, history is full of misunderstandings caused by ambiguities
of natural language. The formal language of propositional logic does away
with this, as there is no ambiguity in formulas and we can clear up misun-
derstandings by elaborating formulas into parse trees.
16 1. Introduction to Propositional Logic
Isaac: Fantastic! Now I know how I can represent knowledge. But how can I
do anything with this knowledge?
Clara: And how do I know that the knowledge Isaac stores is correct?
Aristotle: These are excellent questions, which I will not be able to answer
to you as our time here is up. Let me just say that you, Isaac, will want to
learn how to deduce knowledge formally and that you, Clara, will have to
accept that there is know absolute truth but you have to study the semantics
of logic.
May Athena guide your way in finding answers to your questions, though
let me improve your odds and refer you to someone who may help.
Exercises
Exercise 1
Give the formula corresponding to the following parse tree. Remember that
negation is defined in terms of implication to absurdity: ¬𝜑 = 𝜑 → ⊥.
𝑝 →
→ ⊥
𝑞 →
𝑝 𝑞
Exercise 2
a) 𝑝
b) ()𝑝
c) 𝑝 → 𝑞
d) 𝑝 → ∧𝑞
e) ¬𝑝
f) ⊥
g) 𝑝 → ()
h) ∨𝑝
i) ⊤ → ⊥
j) 𝑝 ∧ 𝑞 → 𝑝, 𝑞
Exercise 3
2. If Dick met Jane yesterday, they had a cup of coffee together, or they
took a walk in the park.
Exercise 4
For each of the following formulas of PL, draw its parse tree and list all its
subformulas.
a) 𝜑 0 = ¬(𝑝 → 𝑞 ∧ 𝑟 ) ∨ 𝑞 → 𝑝
b) 𝜑 1 = (𝑝 ∨ 𝑞 → 𝑟 ) ∧ ¬𝑞 → 𝑝 → 𝑟
c) 𝜑 3 = 𝑝 → 𝑞 ∨ (𝑟 ∧ ¬𝑠) → 𝑞
Hint: Before drawing the parse trees, change all ¬𝜑 to 𝜑 → ⊥, for any for-
mula 𝜑 and add parenthesis if needed to the formulas by following the reading
conventions.
18 1. Introduction to Propositional Logic
Exercise 5
Clara: I do understand now what propositional formulas are and how they
can be used to formalise knowledge, but I do not at all understand what is
going on. How did we get to Athens and to the time of Aristotle? This is
impossible!
Isaac: This is made possible by my Voyag-O-Matic unit, which enables trav-
elling through time-space.
Clara: Isn’t this dangerous? What if we alter the past and change the future?
Isaac: When we left the building, another of my units made sure that Aristo-
tle’s memory of our visit faded.
Clara: And if we change anything else?
Isaac: I will prevent this, as I have to follow the laws of robotics. Indeed, we
should not loose any time here to avoid any incident. Where can I bring us
next?
Clara: I think that we should learn more about formal proofs and I have an
idea where to go!
Clara closes her eyes in anticipation and the sensation of floating sets in. She
hears Isaac’s voice, first muffled and then coming closer. Clara opens the eyes
and she feels her weight coming back.
Isaac: What is going on here? Who are all these people sitting in the fields,
on the hills and in the garden of this villa?
Peano:1 Welcome to my home! These are the women working in the cotton
mills of Torino. They are asking for their rights: limiting working days to
1 Ken02; RL08.
20 2. Deduction in Propositional Logic
10 hours, lunch breaks, costs for working material should be covered by the
factory owner etc. etc.
Clara: Professor Peano, what a pleasure to meet you! These are indeed very
reasonable requests.
Isaac: It seems that these rights have been lost in our time.
Clara: Yes, that is unfortunately true. I guess that we could at some point
use logic and computers to prove that rights will remain unstable, unless
workers control their workspace and students their educational institution.
Peano: Ah, yes. Even though limited in scope, it contains many important
developments on mathematical reasoning, such as equality [Pea16]. But be
that as it may, in which way were you left dissatisfied?
Clara: One can write down whatever formula and has no assurance that it is
valid. How do we know that some formula is a theorem of arithmetic or a
valid deduction of other kind of knowledge?
Peano: In short, you are looking for proofs, rules of deductions, if you wish.
The Greeks had developed already such rules, which you certainly know
from Euclidean geometry. But I suppose that you are looking something
more… modern, perhaps?
Peano: Formal proofs are what has guided my Formulario project. Please,
come to my terrace and enjoy the worm evening with me over a glass
of wine. I will tell you about a system that was conceived by Gerhard
Gentzen [Gen35], with whom I disagree politically, but who paved the way
for natural approaches to deduction.
2.1. Deductive Systems 21
Let us begin with what an informal, but rigorous, proof consists of. One of the
main issues, which had been identified already by the Indian logicians [Gan04,
Sec. 3.6 and Chap. 4], is that we need to be absolutely clear about the assump-
tions that we make and what we want to prove. Otherwise, we can easily
prove anything, like the existence of any kind of god, without providing any
actual evidence. Once this is stated, we can go state the proof method and
steps. You may enumerate the ingredients of a proofs thus as follows, but be
careful that this list is only an informal statement and may vary. It might be
beneficial to learn about proofs also from other people [Sol13].
Peano: You have perhaps informal proofs before, in which case you should be
able to match the above scheme to those proofs. Only that it will be difficult
to pin down the exact background theory used in those proof. How can we,
therefore, be sure that those proofs are correct?
Isaac: If they were is unambiguous format, then I could check all the steps
and, assuming that the computations did not go wrong anywhere, could
say with certainty that they are correct.
Clara: That would be great! But at the same time I would like to be able read
and write these proofs easily, as I would like to communicate them still with
other humans.
Peano: This is a very good point! Before we get to such natural deduction
systems, let me first start with making proofs unambiguous and introduce
you to deductive systems.
Over time, logicians have developed a vast range of deduction methods. What
I would like to focus on here are deductive systems that formalise proofs of
syntactic formulas. Here is a list, certainly incomplete, of such methods, in
22 2. Deduction in Propositional Logic
which the methods marked are based on tree representations of proofs. Trees
make proofs easy to understand, while still being suitable for automation.
• Axiomatic proof theory
• Natural deduction
• Sequent calculus
• Tableaux methods
• Uniform and focalised proofs
• Algebraic proof theory
• Type theory
• Category theory
In order to use a deductive systems in the formalisation of proofs, as outlined
above, we have to
I) fix a deductive system 𝐼 with background theory,
II) list our assumptions Γ,
III) represent the proposition as formula 𝜑, and
IV) construct a deduction of 𝜑 from Γ in 𝐼 , which is written as
Γ ⊢𝐼 𝜑 .
Clara: Fine, we know now what deductive systems are and what we desire of
them, but how does such a system look like concretely?
Peano: No worries, we get to that. We will start with a deductive system that
is very natural [Pra06] in the sense that deductions in that system corre-
spond to intuitive reasoning and, more importantly, deductions can be re-
duced to very direct proofs. This latter sense of natural enables automatic
deduction methods, but that is for another time. For the moment, let us
think about how we would naturally prove propositions.
Conjunction Let us begin with the case of conjunction and suppose that
we want to prove 𝜑 ∧ 𝜓 . Intuitively, we would expect this proposition to be
true if 𝜑 and 𝜓 are separately true. In the terminology of deductive systems,
we should thus be able to derive from the sequents
Γ ⊢𝜑 and Γ ⊢𝜓
Γ ⊢𝜑 Γ ⊢𝜓
(∧I)
Γ ⊢ 𝜑 ∧𝜓
This rules consists of hypotheses, the conclusion and a label to name the rule.
The hypotheses above the line are what we have to prove before we can apply
the rule. Once we have proved the hypotheses, we can deduce the conclusion
using the rule. We use labels to identify in proofs the rules that we use, which
24 2. Deduction in Propositional Logic
helps both readability and allows us to verify proofs. In the case of the rule
above, we used the label (∧I) and read it as “conjunction introduction”. The
conclusion of this rule is thus a conjunction that has been introduced. You
will have noticed that we used formulas 𝜑 and 𝜓 but did not say what these
formulas exactly are. In fact, the rule works for any formula and we can see
deduction rules as schemes that are agnostic to the structure of 𝜑 and 𝜓 . With
the rule (∧I), we are now able to prove conjunctions.
More generally, deduction rules are of the form
𝐽1 𝐽2 ··· 𝐽𝑛
(L)
𝐽
where all the hypotheses 𝐽1, . . . , 𝐽𝑛 and the conclusion 𝐽 are judgements, and
L is a rule label. The label indicates whether we are introducing a connec-
tive, like (∧I) above, or are eliminating a connective, which means that the
connective appears among the hypotheses.
Why would we need to eliminate a connective? Suppose that we know, for
example from the assumptions of our proposition, that 𝜑 ∧ 𝜓 holds. In this
case, we also know that 𝜑 and 𝜓 hold separately. This leads us to the following
two rules.
Γ ⊢ 𝜑 ∧𝜓 Γ ⊢ 𝜑 ∧𝜓
(∧E1 ) (∧E2 )
Γ ⊢𝜑 Γ ⊢𝜓
In these rules, the “E” stands for elimination and the number indicate which
of the conjuncts we would like to access.
Implication Suppose you know that some formula, say 𝜑, implies another
formula 𝜓 . Recall that implication is written as 𝜑 → 𝜓 . We may read this
formula as “if we know 𝜑, then we also know 𝜓 ”. This gives us actually a good
intuition for how to use, or eliminate, an implication. The intuition is that
if we can prove the condition (antecedent) of an implication, then we know
that the conclusion of the implication holds. To use this in natural deduction
proofs, we turn this idea into a rule:
Γ ⊢𝜑 →𝜓 Γ ⊢𝜑
(→E)
Γ ⊢𝜓
But how can we prove an implication? Also here we can use our intuition:
if we can prove 𝜓 under the assumption that 𝜑 holds, then this means that
“if we know 𝜑, then we also know 𝜓 ”. Since this is our intuitive reading of
2.2. Natural Deduction 25
𝜑:Γ Γ⊢⊥
(Assum) (⊥E)
Γ ⊢𝜑 Γ ⊢𝜑
Γ ⊢ 𝜑 ∧𝜓 Γ ⊢ 𝜑 ∧𝜓 Γ ⊢𝜑 Γ ⊢𝜓
(∧E1 ) (∧E2 ) (∧I)
Γ ⊢𝜑 Γ ⊢𝜓 Γ ⊢ 𝜑 ∧𝜓
Γ ⊢𝜑 Γ ⊢𝜓
(∨I1 ) (∨I2 )
Γ ⊢ 𝜑 ∨𝜓 Γ ⊢ 𝜑 ∨𝜓
Γ ⊢ 𝜑 ∨𝜓 Γ, 𝜑 ⊢ 𝛿 Γ,𝜓 ⊢ 𝛿
(∨E)
Γ ⊢𝛿
Γ, 𝜑 ⊢ 𝜓 Γ ⊢𝜑 →𝜓 Γ ⊢𝜑
(→I) (→E)
Γ ⊢𝜑 →𝜓 Γ ⊢𝜓
Γ, 𝜑 ⊢ 𝜓
(→I)
Γ ⊢𝜑 →𝜓
Now we know how to add assumptions, but not yet how to use them. Let us
write 𝜑 : Γ if the formula 𝜑 appears in the list Γ. The rule for using an assump-
tion allows us to pick any formula from Γ and use it as proven proposition.
𝜑:Γ
(Assum)
Γ ⊢𝜑
Isaac is a bit puzzled: “These rules work each for one connective or assump-
tions, but how can we deduce anything complex with these rules?” Think
about what a deduction is: a combination of reasoning steps. This means that
a deduction will combine several rules together and, since some rules have
more than one hypothesis, and we will get something that looks like a tree.
26 2. Deduction in Propositional Logic
Definition 2.1 may look rather pedantic at first sight, but it really just for-
malises our intuition of proofs. To illustrate this, let us go through some sim-
ple examples.
2.2. Natural Deduction 27
Example 2.2
In this example, we show how the (Assum)-rule and (→I)-rule can be used
together to deduce ⊢ 𝑝 → 𝑞 → 𝑝. The formula 𝑝 → 𝑞 → 𝑝 also allows us
to “store” knowledge and is one of the building blocks of combinatory logic
in form of the K-combinator. Here is a deduction for this theorem:
𝑝 : 𝑝, 𝑞
(Assum)
𝑝, 𝑞 ⊢ 𝑝
(→I)
𝑝 ⊢𝑞 →𝑝
(→I)
⊢𝑝 →𝑞 →𝑝
How does this proof tree relate to the definition? Let us redraw it in a way
that can be more easily recognised as a tree.
𝑝, 𝑞 ⊢ 𝑝 (Assum)
𝑝 ⊢ 𝑞 → 𝑝 (→I)
⊢ 𝑝 → 𝑞 → 𝑝 (→I)
Even though this looks more like a list, we can still see everything that make
a proof tree according to definition 2.1. First of all, the root at the bottom of
the tree is labelled by the sequent ⊢ 𝑝 → 𝑞 → 𝑝 that we aim to prove and
the rule (→I) that is used to prove it. This rule demands that we move the
antecedent 𝑝 of the implication to the context and then prove the sequent
𝑝 ⊢ 𝑞 → 𝑝, which in turn is how the child of the root is labelled. Similarly,
we can check the labelling of this child. Finally, the leaf node is labelled
by (Assum). This shows that the tree indeed fulfils all the requirements
demanded by definition 2.1 to make it a valid proof tree.
Γ ⊢𝜑
?
Is the requirement iii) of definition 2.1 necessary?
Example 2.3
We deduce 𝑝 ∧ 𝑞 → 𝑟 ⊢ 𝑝 → 𝑞 → 𝑟 . This process is also known as Cur-
rying. As the sequents can get quite lengthy, let us name the assumptions
throughout the proof by defining Γ = 𝑝 ∧ 𝑞 → 𝑟 .
Γ, 𝑝, 𝑞 ⊢ 𝑝 Γ, 𝑝, 𝑞 ⊢ 𝑞
(∧I)
Γ, 𝑝, 𝑞 ⊢ 𝑝 ∧ 𝑞 → 𝑟 Γ, 𝑝, 𝑞 ⊢ 𝑝 ∧ 𝑞
(→E)
Γ, 𝑝, 𝑞 ⊢ 𝑟
(→I)
Γ, 𝑝 ⊢ 𝑞 → 𝑟
(→I)
Γ ⊢𝑝 →𝑞 →𝑟
As you can see, we have simplified the application of (Assum) in the two
right leaves, but added some information on the left leaf to make the proof
easier to read.
“Aristotle gave us… I mean we found an example in Aristotle’s work, of a
deduction. Can we justify that in natural deduction?”, Clara wonders. “That
example used negation and, if I remember correctly, negation was defined in
terms of implication and absurdity. Can we thus use the deduction rules for
those connectives to reason about negation and prove the said example?”
Absolutely! But I would advise to make your life simpler and first establish
some specific rules for negation inside the system ND. These rules would not
be part of the system itself but can be derived from it and can be used like
proof rules: they are admissible.
Definition 2.4
A rule
𝐽1 𝐽2 ··· 𝐽𝑛
(L)
𝐽
is admissible, if it is possible to construct from any deduction of the sequents
𝐽1, . . . , 𝐽𝑛 a deduction for the sequent 𝐽 .
Now we can make your life easier by providing admissible rules that determine
how negation can be handled in ND.
2.2. Natural Deduction 29
Theorem 2.5
The following two rules are admissible in ND.
Γ, 𝜑 ⊢ ⊥ Γ ⊢𝜑 Γ ⊢ ¬𝜑
(¬I) (¬E)
Γ ⊢ ¬𝜑 Γ ⊢𝜓
Proof. Let 𝜑 and 𝜓 be formulas. First, we suppose that Γ, 𝜑 ⊢ ⊥ holds. We
then obtain immediately a proof tree
Γ, 𝜑 ⊢ ⊥
(→I)
Γ ⊢𝜑 →⊥
This shows that both, (¬I) and (¬E), are admissible in ND. □
Using these two rules, we can easily prove sequents that involve negation. In
particular, we can prove the statement by Aristotle!
Γ, 𝑟 ⊢ 𝑢 ∧ ¬𝑤
(∧E1 )
Γ, 𝑟 ⊢ 𝑟 Γ, 𝑟 ⊢ 𝑢
(∧I)
Γ, 𝑟 ⊢ 𝑟 ∧ 𝑢 → 𝑤 Γ, 𝑟 ⊢ 𝑟 ∧ 𝑢 Γ, 𝑟 ⊢ 𝑢 ∧ ¬𝑤
(→E) (∧E2 )
Γ, 𝑟 ⊢ 𝑤 Γ, 𝑟 ⊢ ¬𝑤
(¬E)
Γ, 𝑟 ⊢ ⊥
(¬I)
Γ ⊢ ¬𝑟
“I would like to see also some proofs that involve the elimination of disjunc-
tion.”, says Isaac. “Could we go over that as well?”
Most certainly. Here is an interesting example that shows that, if we can ex-
clude on alternative of a disjunction, then the other necessarily has to hold.
30 2. Deduction in Propositional Logic
Example 2.7
We put Γ = 𝑝 ∨ 𝑞, ¬𝑞 and prove Γ ⊢ 𝑝 by means of the following deduction.
Γ, 𝑞 ⊢ 𝑞 Γ, 𝑞 ⊢ ¬𝑞
(¬E)
Γ ⊢ 𝑝 ∨𝑞 Γ, 𝑝 ⊢ 𝑝 Γ, 𝑞 ⊢ 𝑝
(∨E)
Γ⊢𝑝
Note that (∨E) acts like a case distinction and we show in the second, were
we suppose that 𝑞 holds, that this case is absurd. This allows us to show
that Γ ⊢ 𝑝 must hold.
In the final example, we show that the negation of a disjunction is very similar
to the conjunction of the negation of the subformulas of the disjunction. The
result is a proof of the equivalence ¬(𝜑 ∨ 𝜓 ) ↔ (¬𝜑 ∧ ¬𝜓 ) know as one of de
Morgan’s laws.
Example 2.8
Let 𝜑 and 𝜓 be arbitrary formulas. We first prove ¬(𝜑 ∨ 𝜓 ) ⊢ ¬𝜑. To avoid
writing too much, let us define Γ = ¬(𝜑 ∨𝜓 ), 𝜑. Then we have the following
derivation.
Γ ⊢𝜑
(∨I1 )
Γ ⊢ ¬(𝜑 ∨ 𝜓 ) Γ ⊢ 𝜑 ∨𝜓 (𝐷 1 )
(¬E)
Γ⊢⊥
(¬I)
¬(𝜑 ∨ 𝜓 ) ⊢ ¬𝜑
Similarly, we can find a derivation 𝐷 2 for ¬(𝜑 ∨𝜓 ) ⊢ ¬𝜓 and thus, by putting
these derivations together, we get the following derivation.
𝐷1 𝐷2
¬(𝜑 ∨ 𝜓 ) ⊢ ¬𝜑 ¬(𝜑 ∨ 𝜓 ) ⊢ ¬𝜓 (𝐷 3 )
(∧I)
¬(𝜑 ∨ 𝜓 ) ⊢ ¬𝜑 ∧ ¬𝜓
Γ1 ⊢ ¬𝜑 ∧ ¬𝜓 Γ2 ⊢ ¬𝜑 ∧ ¬𝜓
Γ1 ⊢ ¬𝜑 Γ1 ⊢ 𝜑 Γ2 ⊢ ¬𝜓 Γ2 ⊢ 𝜓
(¬E) (¬E)
Γ ⊢ 𝜑 ∨𝜓 Γ1 ⊢ ⊥ Γ2 ⊢ ⊥
(∨E)
Γ⊢⊥
(¬I)
¬𝜑 ∧ ¬𝜓 ⊢ ¬(𝜑 ∨ 𝜓 )
?
Can you give admissible introduction and elimination rules for the
truth proposition ⊤?
“What about the equivalence ¬(𝜑 ∧ 𝜓 ) ↔ (¬𝜑 ∨ ¬𝜓 )?”, Clara wonders. That
equivalence is surprisingly more delicate and it turns out that to only on direc-
tion is provable within the proof system ND, see exercise 7, while the other
direction is not! Clara is really puzzled now: “How can we know that and
why should it not be provable? And how can we then be sure that our proofs
are correct?” These are indeed a valid questions that we have glossed over so
far. The first question we cannot answer easily at this stage because we would
need to understand first how to prove properties of deductions, which we shall
leave for another time. The second question touches on, what you may call,
logical pluralism: the idea that truth and provability is relative. “Does it then
even make sense ask whether a proof is correct?”, Clara gets even more con-
fused. Of course it does make sense but you need to understand that this is
relative to a chosen deduction system, like the system ND that we have dis-
cussed. So to answer your third question: Once we have fixed a deduction
system, we only need to check in a proof that all steps are correct. This means
checking that a given deduction is the form of a proof tree according to defi-
nition 2.1, which in turn is an entirely mechanical task. In fact, I have heard
rumours that machines exist that can be fed a representation of a potential
proof tree and then compute whether it is an actual proof tree. This would be
of great help to my Formulario project, since anyone who trusts the verifying
32 2. Deduction in Propositional Logic
Clara: Thank you so much for your time and patience Professor Peano. We
have greatly enjoyed our time with you and learned many things, even be-
yond formal logic.
Isaac: If only all humans were as kind and generous as you are Professor, then
I may grow to like your kind.
Peano: I don’t know what you have seen in your future, but never lose hope
that the good in humans will prevail and a society of true solidarity will
emerge. You, as a robot, may have the chance to exist that long.
Isaac: I suppose that you have never seen the film WALL-E?
Peano: Now, please excuse me. I wish you all the best for your journey!
Clara and Isaac leave the vicinity of the Peano’s villa. “The conversation with
Professor Peano was very illumin…”, Isaac freezes mid-sentence. “What is
it?”, but Clara gets no response. “♪ Il capo in piedi col suo bastone, o bella
ciao bella ciao bella ciao ciao ciao ♪”, a group of singing women is walking in
their direction. Clara starts to panic. What if they see us? This may disrupt
history! She looks around her and finds clothes drying in a garden. Clara
grabs bed linen and throws them over Isaac. One of the ladies in the passing
group addresses Clara: “Leave your work. Come with us!”. It seems that the
Trans-O-Matic is still working. “No, I still have this pile of linen to hang.” The
lady comes closer. “I help you and then you can come with us.” Clara starts
sweating.
“Look, there is finally the cart with the drinks!”, another person in the group
exclaims. All attention goes away from Clara and to the cart. “Finally, I am
dying of thirst!”. The lady turns away from Clara. “Come over and have some
drink with us”, she says and moves with the group to the cart. “I come, just
moment!”, Clara shouts over.
“Isaac, it is time to leave”, she whispers. A buzzing sound under the linen
becomes audible and Clara starts to feel weightless. She closes her eyes.
2.2. Natural Deduction 33
Exercises
Exercise 6
Exercise 7
Let 𝜑 and 𝜓 be formulas. Derive the following sequents in the system ND.
a) 𝜑 ∧ 𝜓 ⊢ 𝜑 b) 𝜑 ∧ 𝜓 ⊢ 𝜓
c) ¬𝜑 ∨ ¬𝜓 ⊢ ¬(𝜑 ∧ 𝜓 )
Exercise 8
State and prove admissible introduction and elimination rules for bi-implication.
Isaac: Indeed, that Peirce. I was able to recover some parts of my memory
with the understanding of natural deduction and propositional logic. It
seems that accessing the memory and deducing knowledge from it occu-
pied all my resources, making me unresponsive. However, I got stuck on
some more complex parts of the memory that I do not understand. It is
then that I recovered and brought us here. In fact, the name Peirce came up
several times when I investigated my memory for more knowledge of logic.
[Peirce enters the study room, holding a tray with cups, a pot with steaming
coffee and some cookies.]
Peirce: Please come over here and take a seat. [He serves the coffee.] Isaac
explained me already that you are looking to understand logic, but then we
got a bit side-tracked on the meaning of symbols. So please tell me, what is
it that you would like to know.
Clara: We know how to express propositions as syntactic formulas and how
to formalise proofs in the system of natural deduction. However, we are
somewhat wary about the usability of natural deduction because the proofs
get so large and, more importantly, we are sceptical about the correctness
of the proof system. I mean, the rules are somewhat intuitive, or “natural”,
but I am more used to think in the categories of true and false.
Peirce: Good, you are following the first rule of logic: the desire to learn.3 You
may want to part from this dichotomy of truth eventually, but we come back
to that. For now, let us see if we can make natural deduction more practical.
negligible impact. The first issue is more severe, but we shall introduce a for-
mat for proofs that allows for a bit of two-dimensional structure and features
numbered references to help readability.
Consider, for example, the proof tree from example 2.3. This proof tree is
shown below on the left. Let us draw a tree that corresponds to this proof tree
but only has numbers as labels. You may find this tree on the right:
2 3
Γ, 𝑝, 𝑞 ⊢ 𝑝 Γ, 𝑝, 𝑞 ⊢ 𝑞
(∧I) 1 4
Γ, 𝑝, 𝑞 ⊢ 𝑝 ∧ 𝑞 → 𝑟 Γ, 𝑝, 𝑞 ⊢ 𝑝 ∧ 𝑞
(→E) 5
Γ, 𝑝, 𝑞 ⊢ 𝑟
(→I)
Γ, 𝑝 ⊢ 𝑞 → 𝑟 6
(→I)
Γ ⊢𝑝 →𝑞 →𝑟 7
As you can imagine, we can make a list of all the nodes and refer to them by
their numbers instead of drawing the edges. If you have ever implemented
trees with pointers or arrays, then this will be very familiar. Also, if you ever
read some classical text on mathematical logic, then you will see that proofs
are often represented in this way. But just listing the proof steps and using
numbered references misses the introduction of premises. For instance, we
introduce a new assumption in node 7 that we will have to record. This leads
us to Fitch-style proofs, which combine numbered proof steps and so-called
flags that indicate the introduction of assumptions. The above proof tree looks
like this in Fitch-style:
1 𝑝 ∧𝑞 → 𝑟
2 𝑝
3 𝑞
4 𝑝 ∧𝑞 ∧I, 2, 3
5 𝑟 →E, 1, 4
6 𝑞 →𝑟 →I, 3–5
7 𝑝 →𝑞 →𝑟 →I, 2–6
Fitch-style proofs use as numbering schemes the line numbers of a proof, go-
ing from top to bottom. The mentioned flags are in line 1, 2 and 3, and we
38 3. Fitch-Style Deduction and Classical Truth
say that we open flags in those lines. A flag indicates that everything proved
within it, requires the premises written on top of that flag. For instance, the
whole proof ranging from line 2 to 7 requires the premise 𝑝 ∧ 𝑞 → 𝑟 in line 1,
the proof ranging from line 3 to 6 requires the premise 𝑝 in line 2 and so forth.
We also indent flags a bit and retain some two-dimensional elements, which
helps readability a lot. Except for premises made, we indicate on the right of
a Fitch-style proof the proof rule that we use to obtain the formula in that line
together with the involved line numbers.
Clara begins to understand, but still has an issue:“Looking back at the rules
of ND in fig. 2.1, it appears that also the (∨E)-rule changes the premises, but
for two sub-proofs! How do we deal with that?” In exactly the same way!
Recall that we proved 𝑝 ∨ 𝑞, ¬𝑞 ⊢ 𝑝 in example 2.7. First of all, note that this
judgement has two premises, which we will write on two separate lines in the
proof. The goal of the proof is then to prove 𝑝 from the these two premises:
1 𝑝 ∨𝑞
2 ¬𝑞
3 𝑝
4 𝑝 Assum, 3
5 𝑞
6 𝑝 ¬E, 5, 2
7 𝑝 ∨E, 1, 3–4, 5–6
The (∨E)-rule has been used in this proof on line 7 and refers to the disjunction
in line 1 that is eliminated and to the two sub-proofs in lines 3–4 and 5–6.
3.1. Fitch-Style Natural Deduction 39
1 𝜑1
..
2 .
𝑛 𝜑𝑛
..
𝑛+1 .
𝛾
..
.
𝑚 𝛿
..
𝑚+1 .
𝑘 𝜓 L
Everything above the horizontal line that opens a flag are the assumptions
or hypotheses, which can be used inside the flag and will be discharged, once
the flag closes. For example, 𝜑 1, . . . , 𝜑𝑛 are the assumptions under which 𝜓
holds, and 𝛾 is the assumption that is used to prove 𝛿. With line 𝑚, 𝛾 will be
discharged and is no longer usable from line 𝑚 + 1 on. This corresponds to
proving the sequent 𝜑 1, . . . , 𝜑𝑛 , 𝛾 ⊢ 𝛿 by means of a rule like (→I), as we did
in the first Fitch-style proof above in lines 6 and 7. In the same proof, you can
also see that flags can be nested arbitrarily. Finally, every line, which is not a
hypothesis, needs to be given a label L that states used the rule and the lines
that contain the information necessary to apply this rule.
We will not give a precise definition of Fitch-style proofs because this is rather
cumbersome and instead rely on intuition build through examples. Now Clara
is a bit worried: “Is there no way to ensure that a Fitch-style proof is correct?”
Of course! Fitch-style proofs are just a different way of writing ND-proofs,
which means that, if it is possible to translate a given Fitch-style proof into
a correct ND-proof, then also the Fitch-style proof will be correct. However,
a better way is to leave the checking to a computer. For now let us continue
with some examples.
40 3. Fitch-Style Deduction and Classical Truth
1 𝑟 ∧𝑢 → 𝑤
2 𝑢 ∧ ¬𝑤
3 𝑟
4 𝑢 ∧E, 2
5 𝑟 ∧𝑢 ∧I, 3, 4
6 𝑤 →E, 1, 5
7 ¬𝑤 ∧E, 2
8 ⊥ ¬E, 6, 7
9 ¬𝑟 ¬I, 3–8
You should be able to match all the steps to the original proof. One small
difference is that we do not indicate any longer which conjunct we want
to obtain from the application of the elimination rules for the conjunction.
However, it is easy to recover the indices by inspecting the involved for-
mulas. We will allow ourselves the same simplification for the introduction
rules of the disjunction.
?
Which of the following two Fitch-style proof attempts is correct? If
any, which sequent does it prove?
1 𝑝 1 𝑝
2 𝑞 2 𝑟
3 𝑝 Assum, 1 3 𝑟 ∧𝑝 ∧I, 1, 2
4 𝑞→𝑝 →I, 2–3 4 𝑟 → 𝑝 ∧𝑟 →I, 2–3
3.2. Truth Values 41
𝑝 𝑞 𝑝 ∧𝑞
0 0 0
0 1 0
1 0 0
1 1 1
Example 3.2
Let 𝜑 be the formula 𝑝 ∧ 𝑞 for some propositional variables 𝑝 and 𝑞. What
would the truth value of 𝜑? Is 𝜑 true or false? That depends entirely on
the truth values of 𝑝 and 𝑞, since propositional variables have no intrinsic
meaning. Let us, for simplicity, write 0 instead of false and 1 instead of true.
We could choose another notation, but this particular notation is short and
will turn out to be beneficial, not the least because it corresponds to bits
and voltage levels in your circuits, Isaac!
Now think about the case that 𝑝 and 𝑞 are both true, thus we assume they
have both 1 as truth value. What would be the truth value of the conjunc-
tion 𝑝 ∧ 𝑞? Clearly, as 𝑝 and 𝑞 are true, so should be 𝑝 ∧ 𝑞 (read ∧ out as
“and”). Thus, if 𝑝 and 𝑞 have the truth value 1, the 𝜑 should have as well
the truth value 1.
How about that case that one of them, say 𝑞, is false and has the truth value
0? Then we end up with the question whether “true and false” should be
true or false. As it is not possible that something is true and false at the
42 3. Fitch-Style Deduction and Classical Truth
same time, we deduce that 𝑝 ∧ 𝑞 is false in this case and the formula 𝜑 has
the truth value 0.
We can continue like this and prepare the small table 3.1. This table lists
all the possible values that the variables 𝑝 and 𝑞 can take, together with
the truth value of 𝑝 ∧ 𝑞 that results from these values. Thus, the first two
columns list all possibilities, while the last column is computed [Ane12] or
deduced from the first column.
?
Suppose we prepare a truth table for the formula 𝑝∧𝑞∧𝑟 with three dif-
ferent propositional variables. How many rows would the table have?
Surely, we could devise truth tables for all kinds of formulas by hand, but what
are truth tables in general and how do they relate to the meaning of formulas?
To understand this, let us consider each row of the truth table in table 3.1
separately. Every row assigns truth values to the variables that appear in the
formula and then determines the truth values of the overall formula. Note that
it does not matter what other variables, which do not appear in the formula,
have as truth value. The following definition can be thought of formalising
the values of variables in one row of a truth table.
Definition 3.3
We define the set of (Boolean) truth values B by B = {0, 1}. Given a set
𝑈 ⊆ PVar of propositional variables, a 𝑈 -valuation for 𝜑 is a map 𝑣 : 𝑈 → B.
Example 3.4
Let 𝑈 = {𝑝, 𝑞} and thus a valuation for 𝑈 has to assign truth values to 𝑝
and 𝑞. For instance, one possible valuation 𝑣 : 𝑈 → B could be given by
This valuation corresponds to the third row of the truth table for conjunc-
tion in example 3.2.
Let us look at an example with variables coming from a more complex for-
mula.
Example 3.5
Recall that (𝑟 ∧ 𝑢 → 𝑤) ∧ (𝑢 ∧ ¬𝑤) → ¬𝑟 appeared in example 1.4. Let
𝑈 = {𝑟, 𝑢, 𝑤 }, which consists of all variables that appear in 𝜑 One possible
3.2. Truth Values 43
𝑣 (𝑟 ) = 1 𝑣 (𝑢) = 0 𝑣 (𝑤) = 1 .
The examples 3.4 and 3.5 have two important aspects: First, the set of variables
𝑈 is finite in each case. This will allow us to list all possible valuations for 𝑈
as a table, as in table 3.1. Second, the set contains all variables that are used
in particular formulas. Thus, a valuation will in each case fully determine the
Boolean values for said formulas. We will organise these into convenient truth
tables To say what a truth table is, we need to first define how the value in
one row is determined.
Definition 3.6
We define the semantic implication as binary operation =⇒ : B×B → B
on truth values 𝑥, 𝑦 ∈ B by the following case distinction.
{
1, 𝑥 ≤ 𝑦
𝑥 =⇒ 𝑦 =
0, otherwise
Let 𝜑 be a propositional formula and write var(𝜑) for the set of proposi-
tional variables that occur in 𝜑. Given a formula 𝜑, a set 𝑈 of propositional
variables with var(𝜑) ⊆ 𝑈 , and a 𝑈 −valuation 𝑣, we define the Boolean
propositional semantics J𝜑K(𝑣) of 𝜑 at 𝑣 in terms of its top-level con-
nective and semantics of its direct subformulas as follows.
J𝑝K(𝑣) = 𝑣 (𝑝)
J⊥K(𝑣) = 0
J𝜑 1 ∧ 𝜑 2 K(𝑣) = min{J𝜑 1 K(𝑣), J𝜑 2 K(𝑣)}
J𝜑 1 ∨ 𝜑 2 K(𝑣) = max{J𝜑 1 K(𝑣), J𝜑 2 K(𝑣 }
J𝜑 1 → 𝜑 2 K(𝑣) = J𝜑 1 K(𝑣) =⇒ J𝜑 2 K(𝑣)
Example 3.7
Let 𝜑 be the formula 𝑝 ∧ 𝑞. We have var(𝜑) = {𝑝, 𝑞} and can define a
44 3. Fitch-Style Deduction and Classical Truth
We see in example 3.7 that we can list all possible valuations for a finite set
of variables and the semantics of a formula as a table. For instance, let 𝑈 =
{𝑝, 𝑞} and 𝜑 a formula with var(𝜑) ⊆ 𝑈 . Table 3.2 lists all 𝑈 -valuations and
𝑝 𝑞 𝜑
0 0 J𝜑K(𝑣 1 ) for 𝑣 1 (𝑝) = 0, 𝑣 1 (𝑞) =0
0 1 J𝜑K(𝑣 2 ) for 𝑣 2 (𝑝) = 0, 𝑣 2 (𝑞) =1
1 0 J𝜑K(𝑣 3 ) for 𝑣 3 (𝑝) = 1, 𝑣 3 (𝑞) =0
1 1 J𝜑K(𝑣 4 ) for 𝑣 4 (𝑝) = 1, 𝑣 4 (𝑞) =1
the semantics for the corresponding valuation. This is how table 3.1 arises
from definition 3.6 by means of four calculations akin to that in example 3.7.
For concrete formulas, we will always use truth tables because they are very
concise. Table 3.3 sums up the semantics of all connectives in a truth table.
𝑝 𝑞 ⊥ 𝑝 ∧𝑞 𝑝 ∨𝑞 𝑝 →𝑞
0 0 0 0 0 1
0 1 0 0 1 1
1 0 0 0 1 0
1 1 0 1 1 1
We can also give semantics and truth tables for derived connectives.
3.2. Truth Values 45
Example 3.8
Recall that the negation ¬𝜑 of 𝜑 is defined to be the formula 𝜑 → ⊥. If 𝜑
is a propositional variables, the truth of ¬𝑝 is:
𝑝 ⊥ 𝑝→⊥
0 0 1
1 0 0
We can generalise this table to the negation of an arbitrary formula 𝜑 by
means of an arithmetic expression:
J¬𝜑K(𝑣) = 1 − J𝜑K(𝑣) .
When devising the truth table for larger formulas, it helps to add (some) sub-
formulas to the table. The following example demonstrates this.
Example 3.9
Let 𝑝 and 𝑞 be variables, and let 𝜑 be the formula 𝑝 ∨ (𝑞 → 𝑝) → 𝑞 → 𝑝.
Its truth table is given as follows.
𝑝 𝑞 𝑞→𝑝 𝑝 ∨ (𝑞 → 𝑝) 𝜑
0 0 1 1 1
0 1 0 0 1
1 0 1 1 1
1 1 1 1 1
This table lists not only the semantics of 𝜑 but also of some subformulas,
which is not strictly necessary but greatly aids the calculation.
This last example shows a formula that uses three propositional variables.
Example 3.10
Let 𝜑 be (𝑟 ∧ 𝑢 → 𝑤) ∧ (𝑢 ∧ ¬𝑤) → ¬𝑟 , which appeared in example 1.4 as
formalisation of Aristotle’s deduction in one formula. We see that var(𝜑) =
{𝑟, 𝑢, 𝑤 } and thus a valuation for 𝜑 has to assign truth values to each of
46 3. Fitch-Style Deduction and Classical Truth
these.
𝑢 𝑤 𝑟 𝑟 ∧𝑢 → 𝑤 𝑢 ∧ ¬𝑤 ¬𝑟 𝜑
0 0 0 1 0 1 1
0 0 1 1 0 0 1
0 1 0 1 0 1 1
0 1 1 1 0 0 1
1 0 0 1 1 1 1
1 0 1 0 1 0 1
1 1 0 1 0 1 1
1 1 1 1 0 0 1
“Making a truth table for a formula does not seem difficult, just a bit labori-
ous.”, Clara interjects, “But what is the use of making truth like in examples 3.9
and 3.10? These formulas are always true, which would mean that the formu-
las are somewhat trivial, doesn’t it?”.
Not at all! That these formulas are always true means that the relation be-
tween the propositional variables that they express is valid. Let us make this
a definition.
Definition 3.11
Let 𝜑 be a propositional formula. We say that 𝜑 is valid if J𝜑K(𝑣) = 1 for
all valuations 𝑣 and satisfiable if J𝜑K(𝑣) = 1 for some valuation 𝑣. A valid
formula is also called a tautology .
Given the truth table of a formula 𝜑, we can easily read off that 𝜑 is valid if all
the rows of the truth table for 𝜑 have a 1 and that 𝜑 is satisfiable if some row in
the table has a 1. For instance, ¬𝑝 is satisfiable but not a tautology, it is said to
be contingent, see example 3.8. However, the formulas 𝑝 ∨ (𝑞 → 𝑝) → 𝑞 → 𝑝
and (𝑟 ∧𝑢 → 𝑤) ∧ (𝑢 ∧¬𝑤) → ¬𝑟 from examples 3.9 and 3.10 are both valid.
Clara is a bit confused: “So you say that valid formulas express true relations
between propositional variables. This is clear, but I wonder now about the
3.5. Classical Logic and Completeness 47
natural deduction proofs. Those were also supposed to express valid relations.
Are those the same?”
Not exactly, but at least everything that is provable in ND is also valid. This is
called soundness. We do not have the tools to prove this, yet, but we can state
a simplified version.
“Great, this means that we can prove all valid propositions in ND!”, exclaims
Clara convinced. Not so fast! Theorem 3.12 says that you can prove only valid
formulas, but not necessarily all. In fact, this is not even true!
Theorem 3.14
The sequent ⊢ ¬¬𝑝 → 𝑝 is not provable in ND, but ¬¬𝑝 → 𝑝 is valid.
Theorem 3.14 tells us that there are valid formulas, which are not provable. Is
there a way to fix this? It turns out that it suffices to turn the formula ¬¬𝑝 → 𝑝
into a proof rule to obtain a complete deductive system.
48 3. Fitch-Style Deduction and Classical Truth
Definition 3.15
The system cND (classical natural deduction) is obtained by adding to the
system ND the following rule for proofs by contradiction.
Γ, ¬𝜑 ⊢ ⊥
(Contra)
Γ ⊢𝜑
The rule (Contra) formalises the commonly know proof principle, called “proof
by contradiction”, that proceeds by proving that the assumption that a prop-
erty 𝜑 does not hold is absurd and then concluding that 𝜑 must therefore
hold.
With this rule, we can prove in the system cND every valid proposition.
“Why is the proof-by-contradiction rule so special?”, Clara asks, “It seems like
a perfectly good proof principle to me.”
The problem with the (Contra)-rule is that it is very specific to the Boolean
interpretation. Let me show you what I mean.
Example 3.17
We can derive the law of excluded middle (LEM) in cND:
1 ¬(𝑝 ∨ ¬𝑝)
2 ¬𝑝 example 2.8, 1
3 ¬¬𝑝 symmetric example 2.8, 1
4 ⊥ ¬E, 2, 3
5 𝑝 ∨ ¬𝑝 Contra, 1–4
The LEM states that every formula has to be either true or false, which is ex-
actly what we have in the Boolean model, and that a third possibility is not
3.5. Classical Logic and Completeness 49
Example 3.18
Under the Boolean semantics, one can define the implication 𝑝 → 𝑞 alter-
natively as ¬𝑝 ∨ 𝑞, as the following truth table shows.
𝑝 𝑞 ¬𝑝 ¬𝑝 ∨ 𝑞 𝑝 →𝑞
0 0 1 1 1
0 1 1 1 1
1 0 0 0 0
1 1 0 1 1
By theorem 3.16 there must be a proof of ⊢ (¬𝑝 ∨ 𝑞) ↔ (𝑝 → 𝑞) in cND.
Indeed, the completeness proof does not give you an explicit derivation that
could be independently checked, it does not give any independently verifiable
evidence.
“This is like claiming that someone committed a crime without providing any
evidence!”, Clara jokes.
True, although not having a derivation is perhaps less detrimental for the vic-
tim, unless natural deduction it is used in court. In any case, the only way
out is to actually find the proof. For propositional logic, the good news is that
there is an algorithm that can find the derivation, as is mentioned the proof
of theorem 3.16. In the case of other logics, we cannot always automatically
find derivations and it becomes important to find symbolic representations of
proofs that can be easily checked even though it may not be possible to find
them automatically.
50 3. Fitch-Style Deduction and Classical Truth
Clara: It is often claimed that many problems can be solved well by machines,
if we just feed them enough data to analyse. However, it seems that you are
saying that there are limits to this.
Peirce: Oh yes, thinking requires signs that represent knowledge, this is cen-
tral to our thinking!4 But let us leave the study of semiotics for another time,
it will get dark soon and I understand that you still have a long way to go.
Clara: Thank you very much for your time, Professor Peirce!
Peirce: I am no longer… Well, it was a pleasure to meet you! I wish you a safe
voyage.
Isaac and Clara leave the house. Once outside the view of the house, Clara
stops and turns to Isaac: “While I was sleeping, you were talking to Peirce.
How is it possible that he just accepted you?”
“Ah, that’s why you still appear ‘normal’ to me!”, Clara is impressed but starts
to get used to the technological surprises. “Did you learn enough to continue
deciphering your memory?”
“Yes, I was able to get more information from the memory. There was men-
tioning of ‘my heart’, but I do not know what that means. The remaining
memory is marked with First-Order Deduction, which I stopped.”
Clara raises her eyebrows, “A heart? How could you have a heart? However,
I have an idea where we can go to understand the remaining memory!”
By now, Clara knows the procedure. She closes her eyes and the floating feel-
ing sets in.
4 “To begin with, every concept and every thought beyond immediate perception is a
sign.” [Pei92, Pragmatism (1907)]. See also Marr [Mar95]
3.5. Classical Logic and Completeness 51
Exercises
1 𝑝
2 𝑞
3 𝑝 Assum, 1
4 𝑞→𝑝 →I, 2–3
Answer to quiz on page 42 For each of the three variables, there are two
possibilities 0 and 1. Thus, there are 23 = 8 different combinations of truth
values and each of them gets its own row.
You may find all Greek letters with their respective pronunciation and the
LATEX-macro to typeset them in table A.1. The capital Greek letters P and the
small letter 𝑜 require being set up with the mathspec package or the following
two declarations.
\DeclareMathSymbol{\Rho}{\mathalpha}{operators}{"50}
60 A. Greek Letters
\DeclareMathSymbol{\omicron}{\mathord}{letters}{"6F}
\renewcommand*{\phi}{\varphi}
\renewcommand*{\epsilon}{\varepsilon}
\renewcommand*{\theta}{\vartheta}
\renewcommand*{\kappa}{\varkappa}
\renewcommand*{\rho}{\varrho}
The reason for using these is that 𝜑, 𝜀, 𝜗, 𝜘 and 𝜚 are easier to distinguish, to
write or are just more common then their respective standard LATEX-versions
𝜙, 𝜖, 𝜃 , 𝜅 and 𝜌. For instance, 𝜅, 𝜌 and 𝜃 are difficult to distinguish from 𝑘, 𝑝
and Θ. Phi written as 𝜑 can be written in one movement, while 𝜙 needs two.
Epsilon is common in both forms, but 𝜀 is easier to write than 𝜖 because it also
just needs one movement, and 𝜖 can be easily confused with the membership
relation ∈ and the Euro symbol €.
B. Tools
[𝑛] = {𝑘 ∈ N | 𝑘 < 𝑛} .
In particular, we have [0] = ∅, [1] = {0} etc. Generally, [𝑛] has exactly 𝑛
elements.
To make our life simple, we will write 𝑛 + 1 instead of suc(𝑛) for the successor
of the number 𝑛. We can the express any natural number by 1 = 0+1, 2 = 1+1,
3 = 2 + 1 and so forth. When we wrote N = {0, 1, 2, . . .} above, we intuitively
understood that N should consist of exactly the numbers expressed in this way
and that there should be no spurious elements like catfish ∈ N. That this is
the case is expressed by the iteration property because it tells us that every
element in N is either of the form 0 or 𝑛 + 1 for some 𝑛 ∈ N. This principle
allows us to count from any number down to 0. One can say that
This definition arises by applying the iteration principle to the pair (1, 𝑓𝑎 ) with
𝑓𝑎 (𝑥) = 𝑥 · 𝑎. However, defining exponentiation via the formal iteration prin-
ciple is clearly inconvenient, and we will use the equational style in eq. (B.1)
whenever possible and we are sure that the equations can be reduced to the iter-
ation principle. Such a reduction is not always easy. For instance, the factorial
B.2. Induction on Natural Numbers 63
The iteration principle the natural numbers can be used to define most maps
on the natural numbers that we may be interested in.2 From the iteration
principle, we can also derive the usual induction principle.3
The assumption 𝑃 (𝑛) in the induction step is called the induction hypothe-
sis, and it should be noted that it is only assumed for each individual 𝑛. Some-
times, the induction principle is mistakenly stated with the induction hypoth-
esis separated as follows.
2 Defining exact set of definable maps requires one to set up a formal theory, like primitive
recursion, Peano arithmetic or Gödel’s system T.
3 We do not specify formally at this point what a property is, but we can think of subsets 𝑃 ⊆ N.
64 B. Tools
This, however, is incorrect because the second point implies immediately the
first and third, thereby allowing us to prove that any property! Clearly, we do
not want this and theorem B.2 is the correct principle. In ⁇, we will see how
first order logic allows us to resolve such ambiguities of natural language.
There are various kinds of trees: binary trees, which have two children below
every node; lists, which have just one child at any node; trees with arbitrary
branching, where every node may have an arbitrary number of children. Be-
sides the branching, trees usually have labels. For instance, in a list every node
is labelled with the corresponding list element. The aim of this section is to
give a general account of labelled trees.
Definition B.3
We call a pair (𝐴, 𝐵) a branching type if 𝐴 is a set and 𝐵 an 𝐴-indexed
family of sets, that is, for every 𝑎 ∈ 𝐴 we are given a set 𝐵𝑎 .
Note that the terminology of “branching type” also tacitly includes labels. The
intuition of this definition is that a tree of type (𝐴, 𝐵) will be labelled in 𝐴 and
will have at a node with label 𝑎 ∈ 𝐴 one branch for every element in 𝐵𝑎 .
Example B.4
Binary trees (not balanced!) labelled in N are induced by the branching
type (N ∪ {∗}, 𝐵) with 𝐵𝑛 = [2] and 𝐵 ∗ = ∅. The idea is that an inner node
can be labelled with a number, while a leaf is labelled with ∗. An inner node
has then exactly two children and a leaf has none.
B.3. Trees and Induction 65
2
0 1
3 0
0 1 0 1
∗ 10 ∗ ∗
0 1
∗ ∗
Figure B.1.: Example of a binary tree labelled in N. The root is labelled with the
number 2 and has two children. The circled blue numbers indicate
the number of the outgoing branching.
Figure B.1 shows an example of a binary tree, which we wish to capture with
the branching type given in example B.4. The following definition shows how
general trees can be constructed and what their defining property is.
𝑓¯(tr𝑎 (𝛼)) = 𝑓𝑎 (𝑔 ◦ 𝛼)
This definition packs a lot. Let us unfold it in the case of binary trees.
𝑛
0 1
𝛼 (0) 𝛼 (1)
Let us denote by ℓ the tree tr∗ (𝜀), where 𝜀 is the only element of B ∅ , see ⁇.
This tree represents a leaf in a binary tree. The tree from fig. B.1 can then
be represented in B by
𝑠𝑛 : N [2] → N 𝑠∗ : N∅ → N
𝑠𝑛 (𝛼) = 𝑛 + 𝛼 (0) + 𝛼 (1) 𝑠 ∗ (𝛼) = 0
this gives us a map 𝑠¯ : B → N. Running this map on the tree 𝑡 from above,
we have get the following.
𝑠¯(𝑡) = 𝑠 2 (¯𝑠 (tr3 (ℓ, tr10 (ℓ, ℓ))), 𝑠¯(tr0 (ℓ, ℓ)))
= 2 + 𝑠¯(tr3 (ℓ, tr10 (ℓ, ℓ))) + 𝑠¯(tr0 (ℓ, ℓ))
= 2 + (3 + 𝑠¯(ℓ) + 𝑠¯(tr10 (ℓ, ℓ))) + (0 + 𝑠¯(ℓ) + 𝑠¯(ℓ))
= 2 + (3 + 0 + (10 + 𝑠¯(ℓ) + 𝑠¯(ℓ))) + (0 + 0 + 0)
= 2 + (3 + 0 + (10 + 0 + 0)) + 0
= 2 + (3 + 0 + 10) + 0
= 2 + 13 + 0
= 15
Thus, we have traversed the trees depth-first and summed up all the inter-
mediate results.
So far, have used the iteration principle only to define maps but not to prove
anything. Just like for the natural numbers, we can also obtain an induction
principle.
B.4. Formal Languages 67
Recall that 𝐴∗ denotes the set of words over an alphabet 𝐴. Concretely, the set
of words is given by
𝐴∗ = {𝜀} ∪ {𝑎 0𝑎 1 · · · 𝑎𝑛 | 𝑛 ∈ N, 𝑎𝑘 ∈ 𝐴},
where 𝜀 is the empty word. For instance, if 𝐴 = {𝑎, 𝑏}, then 𝐴∗ contains the
singleton words 𝑎 and 𝑏, and longer words like 𝑎𝑏𝑏𝑎𝑎. The set of languages
over 𝐴 is the powerset P (𝐴∗ ), that is, the set of all subsets of 𝐴∗ . Given two
words 𝑣, 𝑤 ∈ 𝐴∗ , we denote by 𝑣𝑤 or 𝑣 + 𝑤 the concatenation of the words
𝑣 and 𝑤, that is, considering 𝑣 and 𝑤 as one word by reading their letters in
order.
(𝑣 0 · · · 𝑣𝑛 ) + (𝑤 0 · · · 𝑤𝑚 ) = 𝑣 0 · · · 𝑣𝑛𝑤 0 · · · 𝑤𝑚
Example B.8
Suppose we want to define a language of arithmetic expressions, in which
one can use numbers in N, addition and negation. In this case, we would
say that such expressions 𝑒 are generated by the following grammar.
This grammar can be read as follows. The symbol ::= says that an expres-
sion 𝑒 can be generated by using any of the four options on the right-hand
side, where the options are separated by the vertical bar. The first option is
that 𝑒 can be any natural number 𝑛, which is the only case where we can
start to generate an expression. To generate larger expressions, we have
to use any of the other two options. For instance, if we have generated
68 B. Tools
But what does “generated by” mean exactly? We can think of eq. (B.3) as
a way of describing trees of a certain shape. For instance, the expression
5 + (−3) can be seen as a linear, textual description of the following tree.
+
5 ()
In appendix B.3, we have already seen how to describe such trees. The
labels are numbers and the operators, that is, we put
𝐿 = N ∪ {+, −, ()}
which indicates that the numbers are leaves, “+” has two children, and “−”
and “()” have one. An expression can be seen as a tree of branching type
(𝐿, 𝐵). To get a language, we define a map flat : T (𝐿, 𝐵) → 𝐴∗ by iteration
B.4. Formal Languages 69
𝑓𝑛 (𝛼) = 𝑛
𝑓+ (𝛼) = 𝛼 (0) + ” + ” + 𝛼 (1)
𝑓+ (𝛼) = ” − ” + 𝛼 (0)
𝑓 () (𝛼) = ”(” + 𝛼 (0) + ”)”
This gives us that expressions are given as the image of the map flat:
5 + + 1
4 1 5 4
Definition B.9
Let 𝐴 be an alphabet (a set). A context-free grammar 𝐺 over 𝐴 is a tuple
(𝑉 , 𝑅) where 𝑉 is a finite set of non-terminal symbols and 𝑅 ⊆ 𝑉 × (𝐴 ∪ 𝑉 )
is a relation, the production rules of 𝐺.
70 B. Tools
Example B.10
Taking 𝑉 = {𝑒} and
0⊑𝑋, 𝑋 ⊑ 1, 0 ⊑ 1, 0 ⊑ 0, 𝑋 ⊑𝑋 and 1 ⊑ 1.
This order allows us to use min and max as usual, and if we use them to inter-
pret conjunction and disjunction, then we will see that they conform to our
expectation of an unknown value as input to logic gates:
We can also define a semantic implication =⇒T on T just as we did for the
Boolean semantics: {
1, 𝑎 ⊑ 𝑏
𝑎 =⇒T 𝑏 =
𝑏, otherwise
The following table lists all the possibilities for =⇒𝑇 𝑟𝑖 and the resulting nega-
tion:
Putting this all together, we can define for valuations 𝑣 : PVar → T a map
J−KT𝑣 : PForm → T analogously to definition 3.6. We can use this map to also
gives us an entailment relation ⊨T by defining
Also similarly to the Boolean model (theorem 3.12), one can prove the follow-
ing soundness result.
Theorem C.1
If Γ ⊢ 𝜑 is derivable in ND, then Γ ⊨T 𝜑.
However, the similarity with the Boolean model stops when we move to clas-
sical logic. Indeed, it is easy to see that ⊭T 𝑝 ∨ ¬𝑝. Let 𝑣 be the valuation that
is equal to 𝑋 everywhere. We then have
General Notation
Logic Syntax
Operations on Formulas