Chapter 6:
Logic
6.1. Introduction
In Chapter 2 we have introduced some basic concepts of logic, but the treatment was quite informal. In this chapter we discuss the foundations of logic in a mathematically rigorous manner. In particular, we clearly distinguish between the syntax and the semantics of a logic and between syntactic derivations of formulas and logical consequences they imply. We also introduce the concept of a logical calculus and define soundness and completeness of a calculus. Moreover, we discuss in detail a concrete calculus for propositional logic, the so-called resolution calculus.
At a very general level, the goal of logic is to provide a framework for expressing mathematical statements and for expressing and verifying proofs for such statements. A more ambitious, secondary goal can be to provide tools for automatically or semi-automatically generating a proof for a given statement.
A treatment of logic usually begins with a chapter on propositional logic[1] (see Section 6.5), followed by a chapter on predicate (or first-order) logic[2] (see Section 6.6), which can be seen as an extension of propositional logic. There are several other logics which are useful in Computer Science and in mathematics, including temporal logic, modal logic, intuitionistic logic, and logics for reasoning about knowledge and about uncertainty. Most if not all relevant logics contain the logical operators from propositional logic, i.e.,
Our goal is to present the general concepts that apply to all types of logics in a unified manner, and then to discuss the specific instantiations of these concepts for each logic individually. Therefore we begin with such a general treatment (see Sections 6.2, 6.3, and 6.4) before discussing propositional and predicate logic. From a didactic viewpoint, however, it will be useful to switch back and forth between the generic concepts of Sections 6.2, 6.3, and 6.4 and the concrete instantiations of Sections 6.5 and 6.6.
We give a general warning: Different treatments of logic often use slightly or sometimes substantially different notation.[3] Even at the conceptual level there are significant differences. One needs to be prepared to adopt a particular notation used in a particular application context. However, the general principles explained here are essentially standard.
We also refer to the book by Kreuzer and Kühling and that by Schönisng mentioned in the preface of these lecture notes.
6.2. Proof Systems
6.2.1. Definition
In a formal treatment of mathematics, all objects of study must be described in a well-defined syntax. Typically, syntactic objects are finite strings over some alphabet
In this section, the two types of mathematical objects we study are:
- mathematical statements of a certain type and
- proofs for this type of statements.
By a statement type we mean for example the class of statements of the form that a given number
Consider a fixed type of statements. Let
Every statement
assigns to each
An element
where
Without strong loss of generality we can in this section consider
with the understanding that any string in
Definition 6.1.
A proof system[6] is a quadruple
We now discuss the two fundamental requirements for proof systems.
Definition 6.2.
A proof system
Definition 6.3.
A proof system
In addition to soundness and completeness, one requires that the function
6.2.2. Examples
Example 6.1.
An undirected graph consists of a set V of nodes and a set E of edges between nodes. Suppose that
We are now interested in proving that a given graph has a so-called Hamiltonian cycle, i.e., that there is a closed path from
To prove that a graph has a Hamiltonian cycle, one can simply provide the sequence of nodes visited by the cycle. A value in
Now we can let
for
This function
Example 6.2.
Let us now consider the opposite problem of proving the inexistence of a Hamiltonian cycle in a given graph. In other words, in the above example we define
of s encode the adjacency matrix of a graph not containing Hamiltonian cycle. In this case, no sound and complete proof system (with reasonably short and efficiently verifiable proofs) is known. It is believed that no such proof system exists.
Example 6.3.
Let again
Example 6.4.
Let us consider the opposite problem, i.e., proving primality of a number
- the list
of distinct prime factors of , - a (recursive) proof of primality for each of
[13] - a generator
of the group .
The exact representation of these three parts of the proof would have to be made precise, but we omit this here as it is obvious how this could be done.
The verification of a proof (i.e., the computation of the function
- If
or , then the verification stops and returns 1. [14] - It is tested whether
all divide and whether can be written as a product of powers of (i.e., whether contains no other prime factor).
It is verified that
and, for all
, that (This means that
has order in ). For every
, an analogous proof of its primality is verified (recursively).
This proof system for primality is sound because if
6.2.3. Discussion
The examples demonstrate the following important points:
- While proof verification must be efficient (in some sense not defined here), proof generation is generally not (or at least not known to be) efficient. For example, finding a proof for the Hamiltonian cycle example requires to find such a cycle, a problem that, as mentioned, is believed to be very hard. Similarly, finding a primality proof as discussed would require the factorization of
, and the factoring problem is believed to be hard. In general, finding a proof (if it exists) is a process requiring insight and ingenuity, and it cannot be efficiently automated. - A proof system is always restricted to a certain type of mathematical statement. For example, the proof system of Example 6.1 is very limited in the sense that it only allows to prove statements of the form "graph
has a Hamiltonian cycle". - Proof verification can in principle proceed in very different ways. The proof verification method of logic, based on checking a sequence of rule applications, is (only) a special case.
- Asymmetry of statements and their negation: Even if a proof system exists for a certain type of statements, it is quite possible that for the negation of the statements, no proof system (with efficient verification) exists.
6.2.4. Proof Systems in Theoretical Computer Science
The concept of a proof system appears in a more concrete form in theoretical computer science (TCS), as follows. Statements and proofs are bit-strings, i.e.,
Conversely, every subset
One then considers the special case where the length of
As mentioned in a footnote, a type of proof system of special interest are so-called probabilistically checkable proofs (PCP).
An important extension of the concept of proof systems are so-called interactive proofs.[16] In such a system, the proof is not a bit-string, but it consists of an interaction (a protocol) between the prover and the verifier, where one tolerates an immensely small (e.g. exponentially small) probability that a verifier accepts a "proof" for a false statement. The reason for considering such interactive proofs are:
- Such interactive proofs can exist for statements for which a classical (noninteractive) proof does not exist. For example, there exists an interactive proof system for the non-Hamiltonicity of graphs.
- Such interactive proofs can have a special property, called zero-knowledge, which means that the verifier learns absolutely nothing (in a well-defined sense) during the protocol, except that the statement is true. In particular, the verifier cannot prove the statement to somebody else.
- Zero-knowledge proofs (especially non-interactive versions, so-called NIZK's) are of crucial importance in a large number of applications, for example in sophisticated blockchain systems.
6.3. Elementary General Concepts in Logic
The purpose of this section is to introduce the most basic concepts in logic in a general manner, not specific to a particular logic. However, this section is best appreciated by considering concrete examples of logics, in particular propositional logic and predicate logic. Without discussing such examples in parallel to introducing the concepts, this section will be hard to appreciate. We will discuss the general concepts and the concrete examples in parallel, going back and forth between Section 6.3 and Sections 6.5 and 6.6.
6.3.1. The General Goal of Logic
A goal of logic is to provide a specific proof system
However, such a proof system
In logic, an element
In standard treatments of logic, the syntax of
6.3.2 Syntax
A logic is defined by the syntax and the semantics. The basic concept in any logic is that of a formula[18] .
Definition 6.4.
The syntax of a logic defines an alphabet
The semantics (see below) defines under which "conditions" a formula is true (denoted as
Some of the symbols in
6.3.3. Semantics
Definition 6.5.
The semantics of a logic defines (among other things, see below) a function
The same symbol
The free symbols of a formula denote kind of variables which need to be assigned fixed values in their respective associated domains before the formula has a truth value. This assignment of values is called an interpretation:
Definition 6.6.
An interpretation consists of a set
Often (but not in propositional logic), the domains are defined in terms of a so-called universe
Definition 6.7.
An interpretation is suitable[22] for a formula
Definition 6.8.
The semantics of a logic also defines a function[24]
Definition 6.9.
A (suitable) interpretation
More generally, for a set M of formulas, a (suitable) interpretation for which all formulas in
If
6.3.4. Connection to Proof Systems
We now explain how the semantics of a logic (the function
First we should remark that one can treat logic in a similarly informal manner as one treats other fields of mathematics. There can be variations on how much is formalized in the sense of proof systems. Concretely, there are the following two options for formalizing a logic:
- In addition to formulas, also interpretations are considered to be formal objects, i.e., there is a syntax for writing (at least certain types of) interpretations. In this case, statements can correspond to pairs
, and the function corresponds to the function (in the sense of proof systems). - Only formulas are formal objects and interpretations are treated informally, e.g. in words or some other informal notation. This is the typical approach in treatments of logic (also in this course). This makes perfect sense if the formal statements one wants to prove only refer to formulas, and not to specific interpretations. Indeed, many statements about formulas are of this form, for example the statement that a formula
is a tautology, the statement that is satisfiable (or unsatisfiable), or the statement that a formula is a logical consequence of a formula , i.e., . Note that to prove such statements it is not necessary to formalize interpretations.
6.3.5. Satisfiability, Tautology, Consequence, Equivalence
Definition 6.10.
A formula
Definition 6.11.
A formula
The symbol
Definition 6.12.
A formula
if every interpretation suitable for both
Definition 6.13.
Definition 6.13. Two formulas
A set
Definition 6.14.
If
That
6.3.6 The Logical Operators , , and
Essentially all logics contain the following recursive definitions as part of the syntax definition.
Definition 6.15.
If
A formula of the form
We introduce some notational conventions for the use of parentheses. The outermost parentheses of a formula can be dropped, i.e., we can write
The implication introduced in Section 2.3 can be understood simply as a notational convention:
The semantics of the logical operators
Definition 6.16.
if and only if
if and only if
if and only if
Some basic equivalences were already discussed in Section 2.3.2 and are now stated for any logic that includes the logical operators
Lemma 6.1.
For any formulas
and (idempotence); and (commutativity); and (associativity); and (absorption); (distributive law); (distributive law); (double negation); and (de Morgan's rules); and (tautology rules); and (unsatisfiability rules). and .
Proof. The proofs follow directly from Definition 6.16. For example, the claim
6.3.7. Logical Consequence vs. Unsatisfiability
We state the following facts without proofs, which are rather obvious. These lemmas are needed for example to make use of the resolution calculus (see Section 6.5.5), which allows to prove the unsatisfiability of a set of formulas, to also be able to prove that a formula
Lemma 6.2.
A formula
Lemma 6.3.
The following three statements are equivalent:
,
is a tautology,
is unsatisfiable.
6.3.8. Theorems and Theories
We can consider at least four types of statements one may want to prove in the context of using a logic:
- Theorems in an axiomatically defined theory (see below),
- Statements about a formula or a set of formulas, for example that
is satisfiable or that a set of formulas is unsatisfiable.
- Statements about a formula or a set of formulas, for example that
- The statement
for a given interpretation and a formula .
- The statement
- Statements about the logic, for example that a certain calculus for the logic is sound.
To describe the first type of statements, consider a fixed logic, for instance predicate logic discussed in Section 6.6, and consider a set
is called a theorem in theory
Consider two theories
Example 6.5.
The formula
6.4. Logical Calculi
6.4.1. Introduction
As mentioned in Section 6.3.1, the goal of logic is to provide a framework for expressing and verifying proofs of mathematical statements. A proof of a theorem should be a purely syntactic derivation consisting of simple and easily verifiable steps. In each step, a new syntactic object (typically a formula, but it can also be a more general object involving formulas) is derived by application of a derivation rule or inference rule, and at the end of the derivation, the desired theorem appears. The syntactic verification of a proof does not require any intelligence or "reasoning between the lines", and it can in particular be performed by a computer.
Checking a proof hence simply means to execute a program. Like in computer programming, where the execution of a program is a dumb process while the design of a program is generally an intelligent, sometimes ingenious process, the verification of a proof should be a dumb process while devising a proof is an intelligent, creative, and sometimes ingenious process.
A well-defined set of rules for manipulating formulas (the syntactic objects) is called a calculus. Many such calculi have been proposed, and they differ in various ways, for example in the syntax, the semantics, the expressiveness, how easy or involved it is to write a proof, and how long a proof will be.
When defining a calculus, there is a trade-off between simplicity (e.g. a small number of rules) and versatility. For a small set of rules, proving even simple logical steps (like the substitution of a sub-formula by an equivalent subformula) can take a very large number of steps in the calculus.
It is beyond the scope of this course to provide an extensive treatment of various logical calculi.
6.4.2. Hilbert-Style Calculi
As mentioned, there are different types of logical calculi. For the perhaps most intuitive type of calculus, the syntactic objects that are manipulated are formulas. This is sometimes called a Hilbert-style calculus. There is also another type of calculi, often called sequent calculi (which we will not discuss in this course), where the syntactic objects are more complex objects than just formulas. The following refers to Hilbert-style calculi.
Definition 6.17.
A derivation rule or inference rule [36] is a rule for deriving a formula from a set of formulas (called the precondition or premises). We write
if
The derivation rule
where spaces separate the formulas above the bar.
Derivation is a purely syntactic concept. Derivation rules apply to syntactically correct (sets of) formulas. Some derivation rules (e.g. resolution, see Section 6.5.5) require the formulas to be in a specific format.
Definition 6.18.
The application of a derivation rule
- Select a subset
of such that for some formula . - Add
to the set (i.e., replace by ).
Definition 6.20.
A derivation[39] of a formula
, for , where for some and for some , and where .
We write
if there is a derivation of
The above treatment of syntactic derivation is not completely general. In some contexts (e.g. in so-called Natural Deduction for predicate logic, which is a so-called sequent calculus), one needs to keep track not only of the derived formulas, but also of the history of the derivation, i.e., the derivation steps that have led to a given formula.
Typically such a derivation rule is defined as a rule that involves place-holders for formulas (such as
Example 6.6.
Two derivation rules for propositional and predicate logic are
The left rule states that if one has already derived a formula of the form
where
6.4.3. Soundness and Completeness of a Calculus
A main goal of logic is to formalize reasoning and proofs. One wants to perform purely syntactic manipulations on given formulas, defined by a calculus, to arrive at a new formula which is a logical consequence. In other words, if we use a calculus, the syntactic concept of derivation (using the calculus) should be related to the semantic concept of logical consequence.
Definition 6.21.
A derivation rule
Example 6.7.
The two rules of Example 6.6 are correct, but the rule
is not correct. To see this, note that if
Definition 6.22.
A calculus
and
A calculus is hence sound and complete if
i.e., if logical consequence and derivability are identical. Clearly, a calculus is sound if and only if every derivation rule is correct. One writes
6.4.4. Some Derivation Rules
In this section we discuss a few derivation rules for propositional logic and any logic which contains propositional logic. We do not provide a complete and compactly defined calculus, just a few rules. For singleton sets of formulas we omit the brackets "
All equivalences, including the basic equivalences of Lemma 6.1, can be used as derivation rules. For example, the following derivation rules are correct:
Other natural and correct rules, which capture logical consequences, not equivalences, are:
Such rules are not necessarily independent. For example, the rule
The last rule discussed above captures case distinction (two cases). It states that if one knows that
To begin a derivation from the empty set of formulas, one can use any rule of the form
called "tertium non datur (TND)" (in English: "there is no third [alternative]"), which captures the fact that a formula
Example 6.8.
The following rule can be understood as capturing the principle of proof by contradiction. (Why?)
The reader can prove the correctness as an exercise.
Which set of rules constitutes an adequate calculus is generally not clear, but some calculi have received special attention. One could argue both for a small set of rules (which are considered the fundamental ones from which everything else is derived) or for a large library of rules (so there is a large degree of freedom in finding a short derivation).
6.4.5. Derivations from Assumptions
If in a sound calculus
One could therefore also extend the calculus by the new rule
which is sound. Here
Example 6.9.
As a toy example, consider the rules
More generally, we can derive a formula
6.4.6. Connection to Proof Systems
Let us briefly explain the connection between logical calculi and the general concept of proof systems (Definition 6.2).
In a proof system allowing to prove statements of the form
6.5. Propositional Logic
We also refer to Section 2.3 where some basics of propositional logic were introduced informally and many examples were already given. This section concentrates on the formal aspects and the connection to Section 6.3.
6.5.1. Syntax
Definition 6.23. (Syntax)
An atomic formula is a symbol of the form
- An atomic formula is a formula.
- If
and are formulas, then also , , and are formulas.
A formula built according to this inductive definition corresponds naturally to a tree where the leaves correspond to atomic formulas and the inner nodes correspond to the logical operators.
6.5.2. Semantics
Recall Definitions 6.5 and 6.6. In propositional logic, the free symbols of a formula are all the atomic formulas. For example, the truth value of the formula
Definition 6.24. (Semantics)
For a set
if and only if
if and only if
if and only if
Example 6.10.
Consider the formula
already discussed in Section 2.3. The truth assignment
6.5.3. Brief Discussion of General Logic Concepts
We briefly discuss the basic concepts from Section 6.3.5 in the context of propositional logic.
Specializing Definition 6.13 to the case of propositional logic, we confirm Definition 2.6: Two formulas
Specializing Definition 6.12 to the case of propositional logic, we see that
Example 6.11.
The basic equivalences of Lemma 6.1 apply in particular to propositional logic.
6.5.4. Normal Forms
Definition 6.25.
A literal is an atomic formula or the negation of an atomic formula.
Definition 6.26.
A formula
for some literals
Example 6.12.
The formula
Definition 6.27.
A formula F is in disjunctive normal form (DNF) if it is a disjunction of conjunctions of literals, i.e., if it is of the form
for some literals
Example 6.13.
The formula
Theorem 6.4.
Every formula is equivalent to a formula in CNF and also to a formula in DNF.
Proof: Consider a formula
Given such a formula
Given such a formula
Example 6.14.
Consider the formula
We therefore obtain the following DNF
as the disjunction of 4 conjunctions. And we obtain the following CNF
as the conjunction of 4 disjunctions.
It is often useful to transform a given formula into an equivalent formula in a certain normal form, but the CNF and the DNF resulting from the truth table as described in the proof of Theorem 6.4 are generally exponentially long. In fact, in the above example
A transformation to CNF or DNF can also be carried out by making use of the basic equivalences of propositional logic.
Example 6.15.
For the formula
In the first step we have used
6.5.5. The Resolution Calculus for Propositional Logic
Resolution is an important logical calculus that is used in certain computer algorithms for automated reasoning. The calculus is very simple in that it consists of a single derivation rule. The purpose of a derivation is to prove that a given set
As mentioned earlier (see Lemma 6.2), this also allows to prove that a formula
The resolution calculus assumes that all formulas of
Recall (Definition 6.25) that a literal is an atomic formula or the negation of an atomic formula. For example
Definition 6.28.
A clause is a set of literals.
Example 6.16.
Definition 6.29.
The set of clauses associated to a formula
in CNF, denoted as
The set of clauses associated with a set
The idea behind this definition is that a clause is satisfied by a truth assignment if and only if it contains some literal that evaluates to true. In other words, a clause stands for the disjunction (OR) of its literals. Likewise, a set
Note that for a given formula (not necessarily in CNF) there are many equivalent formulas in CNF and hence many equivalent sets of clauses. Conversely, to a given set
Definition 6.30.
A clause
Example 6.17.
The clauses
It is important to point out that resolution steps must be carried out one by one; one cannot perform two steps at once. For instance, in the above example,
Given a set
where equation (6.1) must be satisfied. The resolution calculus, denoted
Recall that we write
Lemma 6.5.
The resolution calculus is sound, i.e., if
Proof: We only need to show that the resolution rule is correct, i.e., that if
Let
We refer to Definition 6.30 and distinguish two cases. If
The goal of a derivation in the resolution calculus is to derive the empty clause
Theorem 6.6.
A set
Proof: The "if" part (soundness) follows from Lemma 6.5: If
It remains to prove the "only if" part (completeness with respect to unsatisfiability). We need to show that if a clause set
For the induction step, suppose that for every clause set
- by eliminating all clauses from
containing (which are satisfied since ), and - by eliminating from each remaining clause the literal
if it appears in it (since having in it can not contribute to the clause being satisfied).
Analogously,
If
Analogously, the derivation of
If in any of the two cases we have a derivation of
6.6 Predicate Logic (First-order Logic)
We also refer to Section 2.4 where some basics of predicate logic were introduced informally. Predicate logic is an extension of propositional logic, i.e., propositional logic is embedded in predicate logic as a special case.
6.6.1 Syntax
Definition 6.31. (Syntax of predicate logic)
- A variable symbol is of the form
with . [51] - A function symbol is of the form
with , where denotes the number of arguments of the function. Function symbols for are called constants. - A predicate symbol is of the form
with i , where denotes the number of arguments of the predicate. - A term is defined inductively: A variable is a term, and if
are terms, then is a term. For one writes no parentheses. - A formula is defined inductively:
- For any
and , if are terms, then is a formula, called an atomic formula. - If
and are formulas, then , , and are formulas. - If
is a formula, then, for any , and are formulas.
- For any
A formula constructed according to this inductive definition corresponds naturally to a tree where the leaves correspond to terms and the inner nodes correspond to the logical operators and the quantifiers.
To simplify notation, one usually uses function symbols
6.6.2 Free Variables and Variable Substitution
Definition 6.32.
Every occurrence of a variable in a formula is either bound or free. If a variable
Note that the same variable can occur bound and free in a formula. One can draw the construction tree (see lecture) of a formula showing how a formula is constructed according to the rules of Definition 6.31. Within the subtree corresponding to
Example 6.18.
In the formula
the first two occurrences of
Definition 6.33.
For a formula
6.6.3. Semantics
Recall Definitions 6.5 and 6.6. In predicate logic, the free symbols of a formula are all predicate symbols, all function symbols, and all occurrences of free variables. An interpretation, called structure in the context of predicate logic, must hence define a universe and the meaning of all these free symbols.
Definition 6.34. (Interpretation)
An interpretation or structure is a tuple
is a non-empty universe, is a function assigning to each function symbol (in a certain subset of all function symbols) a function, where for a -ary function symbol , is a function . is a function assigning to each predicate symbol (in a certain subset of all predicate symbols) a function, where for a -ary predicate symbol , is a function , and where is a function assigning to each variable symbol (in a certain subset of all variable symbols) a value in .
For notational convenience, for a structure
We instantiate Definition 6.7 for predicate logic:
Definition 6.35. (Suitable Structure)
A interpretation (structure)
Example 6.20.
For the formula
a suitable structure
For obvious reasons, we will say (see below) that the formula evaluates to true for this structure.
Another suitable structure
For this structure,
The semantics of a formula is now defined in the natural way as already implicitly discussed in Section 2.4.
Definition 6.36. (Semantics)
For an interpretation (structure)
The value
of a term is defined recursively as follows: - If
is a variable, i.e., , then . - If
is of the form for terms and a -ary function symbol , then .
For this definition, we also allow a term to be a (fixed) elementof .
- If
The truth value of a formula
is defined recursively by Definition 6.16 and If
is of the form for terms and a -ary predicate symbol , then . If F is of the form
or , then let for in be the same structure as except that is overwritten by u (i.e., ):
This definition defines the function
The basic concepts discussed in Section 6.3 such as satisfiable, tautology, model, logical consequence, and equivalence, are now immediately instantiated for predicate logic.
Note that the syntax of predicate logic does not require nested quantified variables in a formula to be distinct, but we will avoid such overload of variable names to avoid any confusion. For example, the formula
6.6.4. Predicate Logic with Equality
Reexamining the syntax of predicate logic it may surprise that the equality symbol "
6.6.5 Some Basic Equivalences Involving Quantifiers
In addition to the equivalences stated in Lemma 6.1), we have:
Lemma 6.7.
For any formulas
; ; ; ; ; ; ; ; ; ;
Proof. We only prove statement 7). The other proofs are analogous.
We have to show that every structure
Recall that the definition of the semantics of a formula
To prove the first direction, i.e.,
To prove the other direction, i.e.
The following natural lemma is stated without proof.
Lemma 6.8.
If one replaces a sub-formula
Example 6.21.
because
6.6.6. Substitution of Bound Variables
The following lemma states that the name of a bound variable carries no semantic meaning and can therefore be replaced by any other variable name that does not occur elsewhere. This is called bound substitution.
Lemma 6.9.
For a formula
, .
Proof: For any structure
Therefore
Example 6.22.
The formula
Definition 6.37. (Rectified form)
A formula in which no variable occurs both as a bound and as a free variable and in which all variables appearing after the quantifiers are distinct is said to be in rectified[55] form.
By appropriately renaming quantified variables one can transform any formula into an equivalent formula in rectified form.
6.6.7. Normal Forms
It is often useful to transform a formula into an equivalent formula of a specific form, called a normal form. This is analogous to the conjunctive and disjunctive normal forms for formulas in propositional logic.
Definition 6.38. (Prenex form)
A formula of the form
where the
Theorem 6.10.
For every formula there is an equivalent formula in prenex form.
Proof: One first transforms the formula into an equivalent formula in rectified form and then applies the equivalences of Lemma 6.7 move up all quantifiers in the formula tree, resulting in a prenex form of the formula.
Example 6.23.
In the first step we have renamed the bound variables, in the second step we made use of the equivalence
One can also transform every formula
6.6.8. Derivation Rules
It is beyond the scope of this course to systematically discuss derivation rules for predicate logic, let alone an entire calculus. But, as an example, we discuss one such rule, called universal instantiation (or also universal elimination). It states that for any formula
This rule is justified by the following lemma (proof left as an exercise).
Lemma 6.11.
For any formula
6.6.9. An Example Theorem and its Interpretations
The following apparently innocent theorem is a powerful statement from which several important corollaries follow as special cases. The example illustrates
that one can prove a general theorem in predicate logic and, because it is a tautology, it can then be instantiated for different structures (i.e., interpretations), for each of which it is true.
Theorem 6.12.
Recall that the statement of the theorem means that the formula
Proof: We can transform the formula by equivalence transformations:
where we have made use of
To see that the latter formula (i.e.,
This can be shown as follows: For every
Hence for every
and therefore for every fixed
and therefore we have
as was to be shown.
Let us now interpret Theorem 6.12. We can instantiate it for different universes and predicates. The first interpretation is Russel's paradox:
Corollary 6.13.
There exists no set that contains all sets
Proof: We consider the universe of all sets[58] and, to be consistent with the chapter on set theory, use the variable names
This formula states that there is no set
It is interesting to observe that Russell's paradox is a fact that holds more generally than in the universe of sets and where
Example 6.24.
The reader can investigate as an exercise that Theorem 6.12 also explains the so-called barber paradox (e.g. see Wikipedia) which considers a town with a single barber as well as the set of men that do not shave themselves.
The following corollary was already stated as Theorem 3.23.
Corollary 6.14.
The set
We prove the equivalent statement: Every enumeration of elements of
Proof: We consider the universe
Note that the proof of this corollary contains Cantor's diagonalization argument, which is hence implicite in Theorem 6.12.
We discuss a further use of the theorem. If we understand a program as describable by a finite bit-string, or, equivalently, a natural number (since there is a bijection between finite bit-strings and natural numbers), and if we consider programs that take a natural number as input and output
Corollary 6.15.
There are uncomputable functions
Proof: We consider the universe
The above corollary was already discussed as Corollary 3.24, as a direct consequence of Corollary 6.14 (i.e., of Theorem 3.23). The proof given here is stronger in the sense that it provides a concrete function, namely the function
Corollary 6.16
The function
We point out that the corollary does not exclude the existence of a program that computes the function for an overwhelming fraction of the
6.7 Beyond Predicate Logic
The expressiveness of every logic is limited. For example, one can not express metatheorems about the logic as formulas within the logic. It is therefore no surprise that the expressiveness of predicate logic is also limited.
The formula
In other words, the pair of quantifiers
Predicate logic is actually more limited than one might think. As an example, consider the formula
In this formula,
German: Aussagenlogik ↩︎
German: Prädikatenlogik ↩︎
For example, in some treatments the symbol
is used for , which can be confusing. ↩︎ Membership in
and also in is assumed to be efficiently checkable (for some notion of efficiency). ↩︎ In the context of logic discussed from the next section onwards, the term semantics is used in a specific restricted manner that is compatible with its use here. ↩︎
The term proof system is also used in different ways in the mathematical literature. ↩︎
German: korrekt ↩︎
German: vollständig ↩︎
The usual efficiency notion in Computer Science is so-called polynomial-time computable which we do not discuss further. ↩︎
An interesting notion introduced in 1998 by Arora et al. is that of a probabilistically checkable proof (PCP). The idea is that the proof can be very long (i.e., exponentially long), but that the verification only examines a very small random selection of the bits of the proof and nevertheless can decide correctness, except with very small error probability. ↩︎
The best known algorithm has running time exponential in n. The problem is actually NP-complete, a concept that will be discussed in a later course on theoretical Computer Science. ↩︎
Note that
defines the meaning of the strings in , namely that they are meant to encode graphs and that we are interested in whether a given graph has a Hamiltonian cycle. ↩︎ recursive means that the same principle is applied to prove the primality of every
, and again for every prime factor of , etc. ↩︎ One could also consider a longer list of small primes for which no recursive primality proof is required. ↩︎
Actually, a quite efficient deterministic primality test was recently discovered by Agrawal et al., and this means that primality can be checked without a proof. In other words, there exists a trivial proof system for primality with empty proofs. However, this fact is mathematically considerably more involved than the arguments presented here for the soundness and completeness of the proof system for primality. ↩︎
This topic is discussed in detail in the Master-level course Cryptographic Protocols taught by Martin Hirt and Ueli Maurer. ↩︎
In a fully computerized system, this must of course be (and indeed is) defined. ↩︎
German: Formel ↩︎
There are logics (not considered here) with more than two truth values, for example a logic with confidence or belief values indicating the degree of confidence in the truth of a statement. ↩︎
The term "free" is not standard in the literature which instead uses special terms for each specific logic, but as we see later it coincides for the notion of free variables in predicate logic. ↩︎
There may be restrictions for what is an allowed interpretation. ↩︎
German: passend ↩︎
A suitable interpretation can also assign values to symbols
not occurring free in . ↩︎ We assume that the set of formulas and the set of interpretations are well-defined. ↩︎
Note that different free occurrences of a symbol
in are assigned the same value, namely that determined by the interpretation. ↩︎ This notation in the literature is unfortunately a bit ambiguous since
is used for two different things, namely for an interpretation as well as for the function induced by the interpretation which assigns to every formula the truth value (under that interpretation). We nevertheless use the notation instead of in order to be compatible with most of the literature. ↩︎ German: erfüllbar ↩︎
Note that the statement that
is satisfiable is not equivalent to the statement that every formula in is satisfiable. ↩︎ The symbol
is not a formula itself, i.e., it is not part of the syntax of a logic, but if used in expressions like it is to be understood as standing for an arbitrary unsatisfiable formula. For example, means that is unsatisfiable. ↩︎ German: Tautologie ↩︎
German: gültig, allgemeingültig ↩︎
German: (logische) Folgerung, logische Konsequenz ↩︎
The symbol
is used in two slightly different ways: with a formula (or set of formulas), and also with an interpretation on the left side. This makes sense because one can consider a set of formulas as defining a set of interpretations, namely the set of models for . ↩︎ More formally, let
be any formula (one of the many equivalent ones) that corresponds to the conjunction of all formulas in . Then if and only if . ↩︎ Alternatively, one could also define
to be a symbol of the syntax, in which case one would also need to extend the semantics to provide an interpretation for . This subtle distinction between notational convention or syntax extension is not really relevant for us. We can simply use the symbol . ↩︎ German: Schlussregel ↩︎
German: Kalkül ↩︎
A calculus also corresponds to a relation from the power set of the set of formulas to the set of formulas, namely the union of the relations corresponding the rules of the calculus. ↩︎
German: Herleitung ↩︎
German: widerspruchsfrei ↩︎
German: vollständig ↩︎
However, in so-called constructive or intuitionistic logic, this rule is not considered correct because its application does not require explicit knowledge of whether
or is true. ↩︎ is usually not used. This definition guarantees an unbounded supply of atomic formulas. As a notational convention we can also write , , , … instead of , , , …. ↩︎ German: (Wahrheits-)Belegung ↩︎
If the truth values
and were interpreted as numbers, then means that is greater or equal to for all arguments. This also explains why and together imply . ↩︎ For a literal
, is the negation of , for example if , then . ↩︎ A simpler example illustrating this is that
is satisfiable, but a "double" resolution step would falsely yield ∅, indicating that is unsatisfiable. ↩︎ In the literature, one usually does not use the symbol
in the context of resolution. ↩︎ In the lecture we introduce a natural graphical notation for writing a sequence of resolution steps. ↩︎
For convenience, the clause
is understood to mean the singleton clause set . In other words, the truth value of a clause is understood to be the same as the truth value of . ↩︎ is usually not used. ↩︎ The occurrence of a variable
immediately following a quantifier is also bound. ↩︎ German: geschlossen ↩︎
according to the semantics of
, see Definition 6.36 ↩︎ German: bereinigt ↩︎
German: Pränexform ↩︎
Note that if
does not occur free in , the statement still holds but in this case is trivial. ↩︎ The universe of all sets is not a set itself. Formally, the universe in predicate logic need not be a set (in the sense of set theory), it can be a "collection" of objects. ↩︎
The particular variable names (
and ) are not relevant and are chosen simply to be compatible with the chapter on set theory where sets were denoted by capital letters and Russel's proposed set was called . Here we have deviated from the convention to use only small letters for variables. ↩︎ Explaining the so-called Halting problem, namely to decide whether a given program halts for a given input, would require a more general theorem than Theorem 6.12, but it could be explained in the same spirit. ↩︎
This function of course depends on the concrete programming language which determines the exact meaning of a program and hence determines
. ↩︎