Professional Documents
Culture Documents
http://www.cse.iitd.ac.in/sak/courses/ilcs/2015-16.index.html
S. Arun-Kumar
Department of Computer Science and Engineering
I. I. T. Delhi, Hauz Khas, New Delhi 110 016.
July 28, 2015
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
1 OF 788
Q UIT
Contents
0
Background Preliminaries
25
0.1
0.2
Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
0.3
0.4
0.5
Ordering Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
0.6
Partial Orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
0.7
Well orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
0.8
0.9
Induction Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
2 OF 788
Q UIT
Lecture 1: Introduction
116
131
2.1
2.2
2.3
2.4
174
187
198
215
255
7.1
7.2
H OME PAGE
JJ
276
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
3 OF 788
Q UIT
287
301
311
327
342
357
380
391
403
426
442
457
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
4 OF 788
Q UIT
477
494
516
530
547
568
590
602
635
648
660
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
5 OF 788
Q UIT
679
688
697
711
729
745
757
775
40 References
787
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
6 OF 788
Q UIT
List of Slides
Lecture 1: Introduction
1.
2.
3.
4.
5.
6.
7.
8.
9.
What is Logic?
Reasoning, Truth and Validity
Examples
Objectivity in Logic
Formal Logic
Formal Logic: Applications
Form and Content
Facets of Mathematical Logic
Logic and Computer Science
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
7 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
8 OF 788
Q UIT
Adequacy
Adequacy: Examples
Functional Completeness
Duality
Principle of Duality
Negation Normal Forms: 1
Negation Normal Forms: 2
Conjunctive Normal Forms
CNF
H OME PAGE
Arguments
Arguments: 2
Validity & Falsification
Translation into propositional Logic
Atoms in Argument
The Representation
Propositional Rendering
The Strategy
Checking Tautology
Computing the CNF
Falsifying CNF
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
9 OF 788
Q UIT
Tautology Checking
CNFs: Set of Sets of Literals
Propositional Resolution
Clean-up
The Resolution Method
The Algorithm
Resolution Examples: Biconditional
Resolution Examples: Exclusive-Or
Resolution Refutation: 1
Resolution Refutation: 2
Resolvent as Logical Consequence
Logical Consequence by Refutation
Against Resolution
The Analytic Tableau Method
Basic Tableaux Facts
Tableaux Rules
Structure of the Rules
Tableaux
Slim Tableaux
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
10 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
11 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
12 OF 788
Q UIT
2. Derived Rules
3. The Sequent Form
4. Proof trees in sequent form
5. Transitivity of Conditional
6. Derived Double Negation Rules
7. Derived Operators
8. Rules for Derived Operators
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
13 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
14 OF 788
Q UIT
7.
8.
9.
10.
11.
H OME PAGE
Satisfiability
Models and Consistency
Examples of Models:1
Examples of Models:2
Examples of Models:3
Logical Consequence
Validity
Validity of Sets of Formulae
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
15 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
16 OF 788
Q UIT
9. Semantics of Equality
10. Axioms for Equality
11. Symmetry and Transitivity
12. Symmetry of Equality
13. Transitivity of Equality
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
17 OF 788
Q UIT
4.
5.
6.
7.
8.
9.
10.
11.
12.
Skolemization
Skolem Normal Forms
SCNF
Ground Instance
Herbrands Theorem
The Herbrand Tree of Interpretations
Compactness of Sets of Ground Formulae
Compactness of Closed Formulae
The Lowenheim-Skolem
Theorem
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
18 OF 788
Q UIT
3. Ground Substitutions
4. Composition of Substitutions
5. Substitutions: A Monoid
Unifiability
Unification Examples:1
Unification Examples:2
Generality of Unifiers
Generality: Facts
Most General Unifiers
More on Positions
Disagreement Set
Example: Disagreement 1
Example: Occurs Check
Example: Disagreement 3
Example: Disagreement 4
Disagreement and Unifiability
The Unification Theorem
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
19 OF 788
Q UIT
4. Representing SCNFs
5. Clauses: Terminology
6. Clauses: Ground Instances
7. Facts about Clauses
8. Clauses: Models
9. Clauses: Herbrands Theorem
10. Resolution in FOL
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
20 OF 788
Q UIT
FOL: Tableaux
FOL: Tableaux Rules
FOL Tableaux: Example 1
First-Order Tableaux
FOL Tableaux: Example 2
Deductive Consistency
Models of Deductively Consistent Sets
Deductive Completeness
The Completeness Theorem
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
21 OF 788
Q UIT
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
22 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
23 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
24 OF 788
Q UIT
0. Background Preliminaries
al-go-rism n. [ME algorsme<OFr.< Med.Lat. algorismus, after Muhammad ibn-Musa AlKharzimi (780-850?).] The Arabic system of numeration: DECIMAL SYSTEM.
al-go-rithm n [Var. of ALGORISM.] Math. A mathematical rule or procedure for solving a
problem.
4word history: Algorithm originated as a varaiant spelling of algorism. The spelling was
probably influenced by the word aruthmetic or its Greek source arithm, number. With the
development of sophisticated mechanical computing devices in the 20th century, however,
algorithm was adopted as a convenient word for a recursive mathematical procedure, the
computers stock in trade. Algorithm has ceased to be used as a variant form of the older
word.
Websters II New Riverside University Dictionary 1984.
0.1. Motivation for the Study of Logic
In the early years of this century symbolic or formal logic became quite popular with philosophers
and mathematicicans because they were interested in the concept of what constitutes a correct proof
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
25 OF 788
Q UIT
in mathematics. Over the centuries mathematicians had pronounced various mathematical proofs
as correct which were later disproved by other mathematicians. The whole concept of logic then
hinged upon what is a correct argument as opposed to a wrong (or faulty) one. This has been amply
illustrated by the number of so-called proofs that have come up for Euclids parallel postulate and for
Fermats last theorem. There have invariably been bugs (a term popularised by computer scientists
for the faults in a program) which were often very hard to detect and it was necessary therefore
to find infallible methods of proof. For centuries (dating back at least to Plato and Aristotle) no
rigorous formulation was attempted to capture the notion of a correct argument which would guide
the development of all mathematics.
The early logicians of the nineteenth and twentieth centuries hoped to establish formal logic as a
foundation for mathematics, though that never really happened. But mathematics does rest on one
firm foundation, namely set theory. But Set theory itself has been expressed in first order logic.
What really needed to be answered were questions relating to the automation or mechanizability
of proofs. These questions are very relevant and important for the development of present-day
computer science and form the basis of many developments in automatic theorem proving. David
Hilbert asked the important question, as to whether all mathematics, if reduced to statements of
symbolic logic, can be derived by a machine. Can the act of constructing a proof be reduced to the
manipulation of statements in symbolic logic? Logic enabled mathematicians to point out why an
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
26 OF 788
Q UIT
alleged proof is wrong, or where in the proof, the reasoning has been faulty. A large part of the credit
for this achievement must go to the fact that by symbolising arguments rather than writing them out
in some natural language (which is fraught with ambiguity), checking the correctness of a proof
becomes a much more viable task. Of course, trying to symbolise the whole of mathematics could
be disastrous as then it would become quite impossible to even read and understand mathematics,
since what is presented usually as a one page proof could run into several pages. But at least in
principle it can be done.
Since the latter half of the twentieth century logic has been used in computer science for various
purposes ranging from program specification and verification to theorem-proving. Initially its use
was restricted to merely specifying programs and reasoning about their implementations. This is
exemplified in the some fairly elegant research on the development of correct programs using firstorder logic in such calculi such as the weakest-precondition calculus of Dijkstra. A method called
Hoare Logic which combines first-order logic sentences and program phrases into a specification
and reasoning mechanism is also quite useful in the development of small programs. Logic in this
form has also been used to specify the meanings of some programming languages, notably Pascal.
The close link between logic as a formal system and computer-based theorem proving is proving
to be very useful especially where there are a large number of cases (following certain patterns)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
27 OF 788
Q UIT
to be analysed and where quite often there are routine proof techniques available which are more
easily and accurately performed by therorem-provers than by humans. The case of the four-colour
theorem which until fairly recently remained a unproved conjecture is an instance of how human
ingenuity and creativity may be used to divide up proof into a few thousand cases and where machines may be used to perform routine checks on the individual cases. Another use of computers
in theorem-proving or model-checking is the verification of the design of large circuits before a
chip is fabricated. Analysing circuits with a billion transistors in them is at best error-prone and at
worst a drudgery that few humans would like to do. Such analysis and results are best performed by
machines using theorem proving techniques or model-checking techniques.
A powerful programming paradigm called declarative programming has evolved since the late seventies and has found several applications in computer science and artificial intelligence. Most programmers using this logical paradigm use a language called Prolog which is an implemented form
of logic1. More recently computer scientists are working on a form of logic called constraint logic
programming.
In the rest of this chapter we will discuss sets, relations, functions. Though most of these topics are
covered in the high school curriculum this section also establishes the notational conventions that
1 actually
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
28 OF 788
Q UIT
will be used throughout. Even a confident reader may wish to browse this section to get familiar
with the notation.
0.2. Sets
A set is a collection of distinct objects. The class of CS253 is a set. So is the group of all first year
students at IITD. We will use the notation {a, b, c} to denote the collection of the objects a, b and
c. The elements in a set are not ordered in any fashion. Thus the set {a, b, c} is the same as the set
{b, a, c}. Further, repetitions of elements in a set do not change it in any way. Two sets are equal if
they contain exactly the same elements. Hence the sets {a, b, c}, {a, b, c, a}, {b, a, c}, {c, b, a, c} are
all equal.
We can describe a set either by enumerating all the elements of the set or by stating the properties that uniquely characterize the elements of the set. Thus, the set of all even positive integers
not larger than 10 can be described either as S = {2, 4, 6, 8, 10} or, equivalently, as S = {x |
x is an even positive integer not larger than 10}
A set can have another set as one of its elements. For example, the set A = {{a, b, c}, d} contains
two elements {a, b, c} and d; and the first element is itself a set. We will use the notation x S to
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
29 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
30 OF 788
Q UIT
3. A B = {x | (x A) and (x 6 B)}
4. A = U A
We also have the following named identities that hold for all sets A, B and C.
Basic properties of set union.
1. (A B) C = A (B C)
Associativity
2. A = A
Identity
3. A U = U
Zero
4. A B = B A
Commutativity
5. A A = A
Idempotence
Associativity
2. A U = A
Identity
3. A =
Zero
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
31 OF 788
Q UIT
4. A B = B A
Commutativity
5. A A = A
Idempotence
Other properties
1. A (B C) = (A B) (A C)
Distributivity of over
2. A (B C) = (A B) (A C)
Distributivity of over
3. (A B) = A B
De Morgans law
4. (A B) = A B
De Morgans law
5. A ( A B) = A B
Absorption
6. A ( A B) = A B
Absorption
The reader is encouraged to come up with properties of set difference and the complementation
operations.
We will use the following notation to denote some standard sets:
The empty set:
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
32 OF 788
Q UIT
The Universe: U
The set of Natural Numbers: N = {0, 1, 2, . . .}. We will include 0 in the set of Natural numbers.
After all, it is quite natural to score a 0 in an examination!
The set of positive integers: P = {1, 2, 3, . . .}
The two-element set: 2 = {0, 1}. More generally for any natural number n we let n = {0, 1, . . . , n
1} the set of all naturals less than n. By convention is the set of all naturals less than 0.
The set of integers: Z = {. . . , 2, 1, 0, 1, 2, . . .}
The set of rational numbers: Q
The set of real numbers: R
The Boolean set: B = {f alse, true}
The Powerset of a set A: 2A is the set of all subsets of the set A.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
33 OF 788
Q UIT
The Cartesian product of two sets A and B, denoted by A B, is the set of all ordered pairs (a, b)
such that a A and b B. Thus,
A B = {(a, b) | a A and b B}
Given another set C we may form the following different kinds of cartesian products (which are not
at all the same!).
(A B) C = {((a, b), c) | a A, b B and c C}
A (B C) = {(a, (b, c)) | a A, b B and c C}
A B C = {(a, b, c) | a A, b B and c C}
The last cartesian product gives the construction of tuples. Elements of the set A1 A2 An
for given sets A1, A2, . . . , An are called ordered n-tuples.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
34 OF 788
Q UIT
An is the set of all ordered n-tuples (a1, a2, . . . , an) such that ai A for all i. i.e.,
An = |A A
{z A}
n times
A binary relation R from A to B is a subset of A B. It is a characterization of the intuitive
notion that some of the elements of A are related to some of the elements of B. We also use the infix
notation aRb to mean (a, b) R. When A and B are the same set, we say R is a binary relation
on A. Familiar binary relations from N to N are =, 6=, <, , >, . Thus the elements of the
set {(0, 0), (0, 1), (0, 2), . . . , (1, 1), (1, 2), . . .} are all members of the relation which is a subset of
N N.
In general, an n-ary relation among the sets A1, A2, . . . , An is a subset of the set A1 A2 An.
Definition 0.1 Let R A B be a binary relation from A to B. Then
1. For any set A0 A the image of A0 under R is the set defined by
R(A0) = {b B | aRb f or some a A0}
2. For every subset B 0 B the pre-image of B 0 under R is the set defined by
R1(B 0) = {a A | aRb f or some b B 0}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
35 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
36 OF 788
Q UIT
parts 1 and 2 of definition 0.1 where relation symbol has been overloaded).
3. Similarly every partial function f : A * B may be overloaded to mean the total function
f : 2A 2B , which yields the image of A0 for each A0 A. Likewise even though the
converse (see part 2 of definition 0.6) of graph(f ) may not be a function, the total inverse
function f 1 : 2B 2A is well defined and for each B 0 B, yields the pre-image of B 0.
Notation. Let f be a total function from set A to set B. Then
1-1
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
37 OF 788
Q UIT
2. The binary relation which associates key sequences from a computer keyboard with their respective 8-bit ASCII codes is an example of a relation which is total and injective.
3. The binary relation which associates 7-bit ASCII codes with their corresponding ASCII characters is a bijection.
The figures 1, 2, 3, 4 and 5 respectively illustrate the concepts of partial, injective, surjective, bijective and inverse of a bijective function on finite sets. The directed arrows go from elements in the
domain to their images in the codomain.
We may equivalently define partial and total functions as follows.
Definition 0.3 A function (or a total function) f from A to B is a binary relation f A B such
that for every element a A there is a unique element b B so that (a, b) f (usually denoted
f (a) = b and sometimes f : a 7 b). We will use the notation R : A B to denote a function R from
A to B. The set A is called the domain of the function R and the set B is called the co-domain of
the function R. The range of a function R : A B is the set {b B | for some a A, R(a) = b}.
A partial function f from A to B, denoted f : A * B is a total function from some subset of A to
the set B. Clearly every total function is also a partial function.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
38 OF 788
Q UIT
x
y
b
z
d
e
f
v
The word function unless otherwise specified is taken to mean a total function. Some familiar
examples of partial and total functions are
1. + and (addition and multiplication) on the natural numbers are total functions of the type
f :NNN
2. (subtraction) on the natural numbers is a partial function of the type f : N N * N.
3. div and mod are total functions of the type f : N P N. If a = q b + r such that 0 r < b
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
39 OF 788
Q UIT
B
f
y
w
u
v
and a, b, q, r N then the functions div and mod are defined as div(a, b) = q and mod(a, b) = r.
We will often write these binary functions as a b, a div b, a mod b etc. Note that div and mod
are also partial functions of the type f : N N * N.
4. The binary relations =, 6=, <, , >, may also be thought of as functions of the type
f : N N B where B = {f alse, true}.
Definition 0.4 Given a set A, a finite sequence of length n 0 of elements from A, denoted ~a, is
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
40 OF 788
Q UIT
x
y
b
z
d
e
u
v
a (total) function of the type ~a : {1, 2, . . . , n} A. We normally denote such a sequence of length
n by [a1, a2, . . . , an]. Alternatively, ~a may be regarded as a total function from {0, . . . , n 1} to A
and may be denoted by [a0, a2, . . . , an1]. The empty sequence, denoted [], is also such a function
[] : A and denotes a sequence of length 0.
It is very common in computer science to distinguish between the notion of a sequence and that of a
string or a word.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
41 OF 788
Q UIT
y
w
c
e
u
v
Definition 0.5 An alphabet is a finite set of symbols also called letters. Any finite sequence of
letters from an alphabet is called a string or a word. A string of length n N is usually written
a1a2 . . . an or a1a2 . . . an, where each ai A, 1 i n. The unique empty string (of length 0) is
usually denoted and the operation of juxtaposing two strings s and t to form a new string is called
(con)catenation.
It is quite clear that there exists a simple bijection from the set An (which is the set of all n-tuples of
elements from the set A) and the set of all sequences of length n of elements from A. We will often
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
42 OF 788
Q UIT
h1
y
w
c
e
u
v
identify the two as being the same set even though they are actually different by definition2. The set
of all finite sequences of elements from A is denoted A, where
[
An
A =
n0
2 In
H OME PAGE
a programming language like ML, the difference is evident from the notation and the constructor operations for tuples and lists
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
43 OF 788
Q UIT
The set of all non-empty sequences of elements from A is denoted A+ and is defined as
[
+
A =
An
n>0
An infinite sequence of elements from A is a total function from P to A. The set of all such infinite
sequences is denoted A .
0.4. Operations on Binary Relations
Definition 0.6
1. Given a set A, the identity relation over A, denoted IA, is the set {(a, a) | a A}.
2. Given a binary relation R from A to B, the converse of R, denoted R1 is the relation from B
to A defined as R1 = {(b, a) | (a, b) R}.
3. Given binary relations R A B and S B C, the composition of R with S is denoted
R; S and defined as R; S = {(a, c) | aRb and bSc, f or some b B}.
Note that unlike in the case of functions (where for any function f : A B its inverse f 1 :
B A may not always be defined), the converse of a relation is always defined. Given functions
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
44 OF 788
Q UIT
Theorem 0.7 (Schroeder-Bernstein Theorem) Let A and B be sets and let f : A B and
g : B A be injective functions. Then there exists a bijection between A and B.
1-1
Proof: Since f and g are both injective (1-1), they are both total functions, but their inverses may
not be total. By injectivity, for any a A, f (a) = b implies that b cannot be the image under f of
any other member of A. Likewise for any b B, g(b) A and for every other b0 B we have
g(b0) 6= g(b). Hence f 1 : B * A and g 1 : A * B are both partial functions.
For any a0 A we define the origin of a0 as a0 itself if g 1(a0) is undefined i.e. if a0 is not the image
of any b B under g. (Likewise for any b0 B, the origin of b0 is b0 itself if f 1(b0) is undefined).
Otherwise g 1(a0) = b1 for a unique b1 B. Now consider the maximal (possibly infinite) sequence
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
45 OF 788
Q UIT
of elements
a0
g 1(a0)
= b1
f 1(b1)
= a2
g 1(a2)
= b3
...
...
f 1(b2k1) = a2k
g 1(a2k ) = b2k+1
...
...
...
...
A,
B,
A,
B,
,
A,
B,
such that for each k > 0, a2k = f 1(b2k1) and b2k+1 = g 1(b2k ). We then have the following cases
for each a0 A.
Case AA. a2m is the origin of a0 for some m 0. That is, the sequence a0, b1, a2, b3, . . . , a2m is
finite and g 1(a2m) is undefined. In this case a2m is the origin of a0 and a0 AA.
Case AB . b2m+1 is the origin of a0 for some m 0. That is, the sequence a0, b1, a2, b3, . . . , a2m, b2m+1
is finite and f 1(b2m+1) is undefined. Then b2m+1 is the origin of a0 and a0 AB .
Case AU . The origin of a0 is undefined. That is, the sequence a0, b1, a2, b3, . . . , a2m, b2m+1, . . . is
infinite. Then a0 AU .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
46 OF 788
Q UIT
Hence A may be partitioned into three (mutually disjoint) sets AA, AB , AU depending upon the
origins of the elements of A. (Analogously, B may be partitioned into BA, BB and BU ).
Now we may define the total function h : A B such that
f (a) if a AA AU
h(a) =
g 1(a) if a AB
1-1
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
47 OF 788
Q UIT
R =
Rn
n0
Sometimes it is also useful to consider merely the transitive closure R+ of R which is defined as
[
+
R =
Rn
n>0
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
48 OF 788
Q UIT
H OME PAGE
equivalent definition used in most books is: R is antisymmetric if and only if (a, b), (b, a) R implies a = b.
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
49 OF 788
Q UIT
4. The reachability relation on directed graphs is also an example of a relation that need not be
either symmetric or asymmetric. The relation need not be antisymmetric either.
0.6. Partial Orders
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
50 OF 788
Q UIT
Definition 0.11 A partially ordered set, or poset hA, i consists of a set A together with a partial
order relation on A.
Fact 0.12 If hA, i is a poset, then so is hA, i where =1.
Notation. Given a poset hA, i and a, b A, we sometimes write
b a to mean a b,
a < b to mean a b and a 6= b and
b > a to mean a < b.
Fact 0.13 If hA, i is a poset, then < and > are strict partial orders.
For any set A (empty or non-empty) we have that h2A, i is also a poset and in fact, the partial
ordering relation on A can be characterised (upto isomorphism) by the subset relation.
Definition 0.14 Given two posets hA, Ai and hB, B i, a function f : A B is said to be orderpreserving if and only if for all a, a0 A, a A a0 implies f (a) B f (a0). The two posets are said
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
51 OF 788
Q UIT
to be (order-) isomorphic if there exists an order-preserving bijection between them. We denote this
fact by hA, Ai
= hB, B i.
Notice that if f : A B is a bijection then so is f 1 : B A.
Lemma 0.15 For each poset hA, i there exists a set A 2A such that hA, i
= hA , i.
Proof: For each x A let Ax = {a A | a x}. Define the set A = {Ax | x A} 2A and
the function f : A A such that f (x) = Ax for each x A. It is easy to see that f is bijective
and order-preserving i.e. for all x, y A, x y if and only if Ax Ay .
QED
0.7. Well orders
We discuss well-orders since an mportat induction principle depends upon the notion of a wellordering and generalises the principle of mathematical induction.
Definition 0.16 Let hA, i be a poset and B A. An element b B is said to be minimal if there
exists no a B such that a < b. A poset hA, i is called well-founded if every nonempty subset of
A has a minimal element. Equivalently we say that on A is a well-founded.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
52 OF 788
Q UIT
Lemma 0.17 A poset hA, i is well-founded if and only if there is no subset {ai A | i 0} such
that ai > ai+1 for all i 0.
Proof:
(). Assume hA, i is well-founded and there is a subset A0 = {ai A | i 0, ai > ai+1} A.
Clearly A0 contains no minimal element, which is a contradiction.
(). Assume there is no subset A0 = {ai A | i 0, ai > ai+1} A. If hA, i is not
well-founded, there exists a nonempty subset B A which has no minimal element. Consider
any b0 B. Since b0 is not minimal there exists b1 B such that b0 > b1. Again b1 is not
minimal, so there must be a b2 B with b1 > b2. Proceeding in this fashion we find that for each
bi < < b1 < b0, there exists a bi+1 B such that bi+1 < bi < < b1 < b0. We may thus
construct a set B 0 = {bi B | i 0, bi > bi+1} B A which contradicts the assumption
that there is no such subset.
QED
The set B 0 = {bi B | i 0, bi > bi+1} is an example of an infinite descending chain
< bi+1 < bi < < b1 < b0
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
53 OF 788
Q UIT
Definition 0.18 A set A is finite if it can be placed in bijection with a set n = {0, . . . , n 1} for
some n N.
The above definition embodies the usual notion of counting. In particular note that the empty set
is finite since it can be placed in bijection with itself.
Definition 0.19 A set A is called infinite if there exists a bijection between A and some proper
subset of itself.
This definition begs the question, If a set is not infinite, then is it necessarily finite?. It turns out
that indeed it is. Further it is also true that if a set is not finite then it can be placed in bijection with
a proper subset of itself. But rigorous proofs of these statements are beyond the scope of this course
and hence we shall not pursue them.
Example 0.20 We give appropriate bijections to show that various sets are infinite. In each case,
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
54 OF 788
Q UIT
note that the codomain of the bijection is a proper subset of the domain.
1. The set N of natural numbers is infinite because we can define the 1-1 correspondence p :
1-1
df
N
P,
with
p(m)
=
m + 1.
onto
1-1
F where
2. The set E of even natural numbers is infinite because we have the bijection e : E
onto
F is the set of all multiples of 4.
3. The set of odd natural numbers is infinite. (Why?)
1-1
N by which
4. The set Z of integers is infinite because we have the following bijection z : Z
onto
the negative integers have unique images among the odd numbers and the non-negative integers
have unique images among the even numbers. More specifically,
2m
if m N
z(m) =
2m 1 otherwise
Example 0.21 The set R of reals is infinite. We outline the proof by considering the nonempty open
interval (a, b) = {p | a < p < b} and use figure 6 as a guide to understand the mapping.
_
0 0
Take any line-segment AB of length b a 6= 0 and bend it into the semi-circle A B and place
it tangent to the x-axis at the point (0, 0) (as shown in the figure). The bijection between the points
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
55 OF 788
Q UIT
y
A
(0,r) C
B
P
P
p"
on the semi-circle and the real numbers p, a < p < b is obvious. This semicircle has a radius
ba
. The centre C of this semi-circle is then located at the point (0, r) on the 2-dimensional
r=
plane.
Consider an arbitrary point P 0 on the semi-circle, which corresponds to a real number p, a < p < b.
The ray CP 0 intersects the x-axis at some point P 00 which has the coordinates (p00, 0). Since A0 6=
P 0 6= B 0, the ray cannot be parallel to the x-axis). Similarly from every point P 00 on the x-axis
there exists a unique point P 0 on the semi-circle such that C, P 0 and P 00 are collinear. Each point
P 0 such that A0 6= P 0 6= B 0 on this semi-circle corresponds exactly to a unique real number p in
the open interval (a, b) and vice-versa. Hence there exists a 1-1 correspondence between the points
on the semicircle (excluding the end-points of the semi-circle) and those on the x-axis. Let p00 be
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
56 OF 788
Q UIT
the x-coordinate of the point P 00. Since the composition of bijections is a bijection (see exercises),
we may compose all these bijections to obtain a 1-1 correspondence between each p in the interval
(a, b) and the real numbers.
Definition 0.22 An infinite set is said to be countable (or countably infinite) if it can be placed in
bijection with the set P Otherwise, it is said to be uncountable.
The above definition essentially says that a countably infinite set may be enumerated by selecting a
unique first element, a unique second element and so on. Countability of an infinite set therefore
implies that for any positive integer n, it should be possible to obtain the unique designated n-th
element fromt he set and also for any element in the set, it should be possible to obtain its position
in the enumeration.
Fact 0.23 The following are easy to prove.
1. An infinite set A is countable if and only if there is a bijection between A and N.
2. Every infinite subset of N is countable.
3. If A is a finite set and B is a countable set, then A B is countable.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
57 OF 788
Q UIT
...
(0, 0)
(1, 0)
(2, 0)
(0, 1)
(1, 1)
(2, 1)
(0, 2)
(1, 2)
(2, 2)
...
(0, 3)
(1, 3)
(2, 3)
...
...
...
...
is not a 1-1 correspondence because we cannot answer the following questions with (unique) answers.
1. What is the n-th element in the ordering?
2. What is the position in the ordering of the pair (a, b) for arbitrary naturals a and b?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
58 OF 788
Q UIT
y
Di
D4
(a1, b+1)
(a, b+1)
D3
(a,b)
D2
5
D1
7
D0
x
0
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
59 OF 788
Q UIT
consider the ordering implicitly defined in figure 7. By traversing the blue rays D0, D1, D2, . . . in
order, we get an obvious ordering on the elements of N2. However it should be possible to give
unique answers to the above questions.
(a + b)(a + b + 1) + 2b
is the required bijection.
2
Proof outline: The function f defines essentially the traversal of the rays D0, D1, D2, . . . in order
as we shall prove. It is easy to verify that D0 contains only the pair (0, 0) and f (0, 0) = 0. Now
consider any pair (a, b) 6= (0, 0). If (a, b) lies on the ray Di, then it is clear that i = a + b. Now
consider all the pairs that lie on the rays D0, D1, . . . , Di15
Claim f : N2 N defined by f (a, b) =
5 Under the usual (x, y) coordinate system, these are all the lattice points on and inside the right triangle defined by the three points (i 1, 0), (0, 0) and (0, i 1). A lattice point in the (x, y)-plane is point
whose x and y coordinates are both integers.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
60 OF 788
Q UIT
Theorem 0.25 The countable union of countable sets is countable, i.e. given a family A = {Ai |
S
Ai is countable, i N} of countable sets, their union A = iN Ai is also countable.
Proof: For simplicity we assume that the sets are all pairwise disjoint i.e. Ai Aj = for each
i 6= j. Hence for each element a A, there exists a unique i N such that a Ai. This implies
1-1
there exists a bijection h : A {(i, a) | a Ai, i N}. Since each Ai is countable, there
onto
1-1
1-1
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
61 OF 788
Q UIT
a countably infinite set of atoms A, such that A does not contain any of the symbols , ,
( and ).
1. A M0,
2. If and are any two elements of M0 then () and ( ) also belong to M0, and
3. No string other than those obtained by a finite number of applications of the above rules belongs
to M0.
We prove that the M0 is countably infinite.
Solution There are at least two possible proofs. The first one simply encodes of formulas into unique
natural numbers. The second uses induction on the structure of formulas and the fact that a countable union of countable sets yields a countable set. We postpone the second proof to the chapter on
induction. So here goes!
Proof:
Since A is countably infinite, there exists a 1 1 correspondence ord : A P
which uniquely enumerates the atoms in some order. This function may be extended to a function ord0 which includes the symbols ,(,),, such that ord0(00) = 1, ord0(() = 2,
ord0()00) = 3, ord0( 00) = 4, and ord0(A00) = ord(A00) + 4, for every A A. Let Syms =
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
62 OF 788
Q UIT
A {00, (, )00, 00}. Clearly ord0 : Syms P is also a 1 1 correspondence. Hence there
also exist inverse functions ord1 and ord01 which for any positive integer identify a unique symbol
from the domains of the two functions respectively.
Now consider any string6 belonging to Syms. It is possible to assign a unique positive integer to
this string by using powers of primes. Let p1 = 2, p2 = 3, . . . , pi, . . . be the infinite list of primes in
increasing order. Let the function encode : Syms P be defined by induction on the lengths of
the strings in Syms, as follows. Assume s Syms, a Syms and 00 denotes the empty string.
encode(00) = 1
0
encode(sa) = encode(s) pmord (a)
where s is a string of length m 1 for m 1.
It is now obvious from the unique prime-factorization of positive integers that every string in Syms
has a unique positive integer as its encoding and from any positive integer it is possible to get
the unique string that it represents. Hence Syms is a countably infinite set. Since the language
of minimal logic is a subset of the Syms it cannot be an uncountable. Hence there are only two
possibilities: either it is finite or it is countably infinite.
Claim. The language of minimal logic is not finite.
6 This
H OME PAGE
includes even arbitrary strings which are not part of the language. For example, you may have strings such as )(.
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
63 OF 788
Q UIT
Proof of claim. Suppose the language were finite. Then there exists a formula in the language
such that encode() is the maximum possible positive integer. This Syms and hence is a string
of the form a1 . . . am where each ai Syms. Clearly
encode() =
m
Y
piord (ai)
i=1
encode() = 2
ord0 (00 )
m
Y
00 )
i=1
QED
Not all infinite sets that can be constructed are countable. In other words even among infinite sets
there are some sets that are more infinite than others. The following theorem and the form of its
proof was first given by Georg Cantor and has been used to prove several results in logic, mathematics and computer science.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
64 OF 788
Q UIT
Theorem 0.27 (Cantors diagonalization). The powerset of N (i.e. 2N, the set of all subsets of N)
is an uncountable set.
Proof: Firstly, it should be clear that 2N is not a finite set, since it can be placed in bijection with
2P which is a proper subset of 2N.
Consider any subset A N. We may represent this set as an infinite sequence A composed of 0s
and 1s such that A(i) = 1 if i A, otherwise A(i) = 0. Let = { | for eachi N, (i) {0, 1}}
1-1
such
be the set of all such sequences. It is easy to show that there exists a bijection g : 2N
onto
that g(A) = A, for each A N. Clearly, therefore 2N is countable if and only if is countable.
1-1
.
We prove the claim as follows. Suppose is countable then there exists a bijection h : N
onto
In fact let h(i) = i , for each i N. Now consider the sequence constructed in such a manner
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
65 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
66 OF 788
Q UIT
For any a A, a is called an interior member if a g(a) and otherwise a is an exterior member.
Consider the set
X = {x A | x 6 g(x)}
which consists of exactly the exterior members of A. Since g is a 1-1 correspondence, there exists a
unique x A such that X = g(x). Note that X could be the empty set.
x is either an interior member or an exterior member. If x is an interior member then x g(x) = X
which contradicts the assumption that X contains only exterior members. If x is an exterior member
then x 6 g(x) = X. But then since x is an exterior member x X, which is a contradiction. Hence
the assumption that there exists a 1-1 correspondence g between A and 2A must be false. QED
Example 0.29 We show using the Schroeder-Bernstein theorem 0.7 that there exists a bijection between the sets 2P and the real closed-open interval [0, 1). We construct two injective mappings
f : 2P [0, 1) and g : [0, 1) 2P as follows: For any A P let f (A) = 0.d1d2d3 . . . such that
di = 1 if i A and di = 2 otherwise. Clearly for every A there exists a unique image in [0, 1) and
no two distinct subsets of P would have identical images. Hence f is injective.
1-1
1-1
To define g we consider only normal binary representations of real numbers. That is, we consider
only binary representations which do not have an infinite sequence of trailing 1s, since any num-
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
67 OF 788
Q UIT
ber of the form 0.b1b2 . . . bi101 equals the real number 0.b1b2 . . . bi110 which is normal. Every
real number in [1, 0) has a unique normal representation. Now consider the function defined by
g(0.b1b2b3 . . .) = {i P | bi = 1}. g is clearly a well-defined function and it is injective as well.
Hence they are both uncountable sets.
Exercise 0.1
1. Find the fallacy in the proof of the following purported theorem.
Theorem: If x = y then 2 = 1.
Proof:
1. x = y
2. x2 = xy
3. x2 y 2 = xy y 2
4. (x + y)(x y) = y(x y)
5. x + y = y
6. 2y = y
7. 2 = 1
Given
Multiply both sides by x
Subtract Y 2 from both sides
Factorize
Cancel out (x y)
Substitute x for y, by equation 1.
Divide both sides by y
QED
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
68 OF 788
Q UIT
C.
functions f : A
B
and
g
:
B
C,
their
composition
is
the
function
g
f
:
A
onto
onto
onto
6. Is the composition of injective functions also injective? Is the composition of surjective functions
also surjective? Prove or disprove the two statements.
7. Prove that the inverse of a bijective function is also a bijective function.
8. Prove that for any binary relations R, R0 from A to B and S, S 0 from B to C, if R R0 and
S S 0 then R; S R0; S 0
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
69 OF 788
Q UIT
9. Prove or disprove7that relational composition satisfies the following distributive laws for relations, where R A B and S, T B C.
(a) R; (S T ) = (R; S) (R; T )
(b) R; (S T ) = (R; S) (R; T )
(c) R; (S T ) = (R; S) (R; T )
10. Prove that for R A B and S B C, (R; S)1 = (S 1); (R1).
11. Show that a relation R on a set A is
(a) antisymmetric if and only if R R1 IA
(b) transitive if and only if R; R R
(c) connected if and only if (A A) IA R R1
12. Consider any reflexive relation R on a set A. Does it necessarily follow that A is not asymmetric? If R is asymmetric does it necessarily follow that it is irreflexive?
13. Prove that
(a) Nn, for any n > 0 is a countably infinite set,
7 that
H OME PAGE
is, find an example of appropriate relations which actually violate the equality
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
70 OF 788
Q UIT
(b) If {Ai|i 0} is a countable collection of pair-wise disjoint sets (i.e. Ai Aj = for all
S
i 6= j) then A = i0 Ai is also a countable set.
(c) N the set of all finite sequences of natural numbers is countable.
14. Prove that
(a) N the set of all infinite sequences of natural numbers is uncountable,
(b) the set of all binary relations on a countably infinite set is an uncountable set,
(c) the set of all total functions from N to N is uncountable.
15. Prove that there exists a bijection between the set 2N and the open interval (0, 1) of real numbers.
What can you conclude about the cardinality of the set 2N in relation to the set R?
16. Prove that the composition operation on relations is associative. Give an example of the composition of relations to show that relational composition is not commutative in general.
17. Consider any reflexive relation R on a set A. Does it necessarily follow that R is not asymmetric? If R is asymmetric does it necessarily follow that it is irreflexive?
18. Prove that for any relation R on a set A,
(a) S = R (R)1 and T = (R R1) are both equivalence relations.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
71 OF 788
Q UIT
21. For any two sets A and B, A B if there exists an injective function f : A B.
(a) Prove that is a preorder on any collection of sets.
(b) Prove that any bijection between sets defines an equivalence relation on the collection of sets.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
72 OF 788
Q UIT
Anyone who has had a good background in school mathematics must be familiar with two uses of
induction.
1. definition of functions and relations by mathematical induction, and
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
73 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
74 OF 788
Q UIT
The underlined portion, called the induction hypothesis, is an assumption that is necessary for
the conclusion to be proved. Intuitively, the principle captures the fact that in order to prove any
statement involving natural numbers, it is suffices to do it in two steps. The first step is the basis and
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
75 OF 788
Q UIT
needs to be proved. The proof of the induction step essentially tells us that the reasoning involved in
proving the statement for all other natural numbers is the same. Hence instead of an infinitary proof
(one for each natural number) we have a compact finitary proof which exploits the similarity of the
proofs for all the naturals except the basis.
Example 0.31 We prove that all natural numbers of the form n3 + 2n are divisible by 3.
Proof:
Basis. For n = 0, we have n3 + 2n = 0 which is divisible by 3.
Induction step. Assume for an arbitrarily chosen n 0, n3 + 2n is divisible by 3. Now consider
(n + 1)3 + 2(n + 1). We have
(n + 1)3 + 2(n + 1) = (n3 + 3n2 + 3n + 1) + (2n + 2)
= (n3 + 2n) + 3(n2 + n + 1)
which clearly is divisible by 3.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
76 OF 788
Q UIT
Several versions of this principle exist. We state some of the most important ones. In such cases,
the underlined portion is the induction hypothesis. For example it is not necessary to consider 0 (or
even 1) as the basis step. Any integer k could be considered the basis, as long as the property is to
be proved for all n k.
Such a version seems very useful when the property to be proved is either not true or is undefined
for all naturals less than k. The following example illustrates this.
Example 0.32 Every positive integer n 8 is expressible as n = 3i + 5j where i, j 0.
Proof: .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
77 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
78 OF 788
Q UIT
QED
In general any property P that holds for all naturals greater than or equal to some given k may be
transformed equivalently into a property Q, which reads exactly like P except that all occurrences
of n in P are systematically replaced by n + k. We may then prove the property Q using the
first version of the principle.
What we have stated above informally is, in fact a proof outline of the following theorem.
Theorem 0.34 The two principles of mathematical induction are equivalent. In other words, every
application of PMI - version 1 may be transformed into an application of PMI version 2 and
vice-versa.
In the sequel we will assume that the principle of mathematical induction always refers to the first
version.
0.11. Complete Induction
Often in inductive definitions and proofs it seems necessary to work with an inductive hypothesis
that includes not just the predecessor of a natural number, but some or all of their predecessors as
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
79 OF 788
Q UIT
well.
Example 0.35 The definition of the following sequence is a case of precisely such a definition where
the function F (n) is defined for all naturals as follows.
Basis. F (0) = 0
Induction step
F (n + 1) =
1
if n = 0
F (n) + F (n 1) otherwise
H OME PAGE
JJ
II
LCS
G O BACK
F ULL S CREEN
C LOSE
80 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
81 OF 788
Q UIT
=
=
F (n) + F (n 1)
n1 + n2
by the induction hypothesis
n2( + 1)
n
since 2 = + 1
QED
Note that the feature distinguishing the principle of mathematical induction from that of complete
induction is the induction hypothesis. It appears to be much stronger in the latter case. However,
in the following example we again prove the property in example 0.36 but this time we use the
principle of mathematical induction instead.
Example 0.37 Let P(n) denote the property
F (n + 1) n.
Rather than prove the original statement For all n, P(n) we instead consider the property Q(n)
which we define as
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
82 OF 788
Q UIT
=
=
F (n) + F (n 1)
n1 + n2
by the induction hypothesis
n2( + 1)
n
since 2 = + 1
QED
The above example shows quite clearly that the induction hypothesis used in any application of
complete induction though seemingly stronger, can also lead to the proof of seemingly stronger
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
83 OF 788
Q UIT
properties. But in fact, in the end the proofs are almost identical. These proofs lead us then naturally
into the next theorem.
Theorem 0.38 The two principles of mathematical induction are equivalent. In other words, every
application of PMI may be transformed into an application of PCI and vice-versa.
Proof: We need to prove the following two claims.
1. Any proof of a property using the principle of mathematical induction, is also a proof of the
same property using the principle of complete induction. This is so because the only possible
change in the nature of two proofs could be because they use different induction hypotheses.
Since the proof by mathematical induction uses a fairly weak assumption which is sufficient to
prove the property, strengthening it in any way does not need to change the rest of the proof of
the induction step.
2. For every proof of a property using the principle of complete induction, there exists a corresponding proof of the same property using the principle of mathematical induction. To prove
this claim we resort to the same trick employed in example 0.36. We merely replace each occurrence of the original property in the form P(n) by Q(n), where the property Q is defined
as
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
84 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
85 OF 788
Q UIT
P may also be considered as defining a set S = {x | x satisfies property P}. Therefore if a property
P is true for all natural numbers the set defined by the property must be the set of natural numbers.
This gives us the last version of the principle of mathematical induction.
We end this section with an example of the use of induction to prove that for any n N, the set of
all n-tuples of natural numbers is only countably infinite.
Example 0.39 Assume there exists a 1-1 correspondence f2 : N2 N. Use this fact to prove by
induction on n, that there exists a 1-1 correspondence fn : Nn N, for all n 2.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
86 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
87 OF 788
Q UIT
is a bijection.
Note.
1. Many people assume automatically that Nn+1 = Nn N or Nn+1 = N Nn. But while it is true
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
88 OF 788
Q UIT
that there exists a bijection between Nn+1 and Nn N, they are not equal as sets. Hence we have
defined the function g though it is not really necessary for the proof.
2. Very often countability is assumed by people and they try to argue that since the sets are countable there should be a bijection. But it should be clear that estabilishing a bijection is necessary
first to prove that the required sets are countable. In fact the aim of this problem is to construct
a bijection to prove that the sets N n are all countable.
0.12. Structural Induction
In many cases such as the syntactic definitions of programming languages, their semantics and the
construction of recursive data types in languages such as ML and Java, it is helpful to consider
a form of induction called structural induction. This form of induction enables us to prove fairly
general properties about the datatypes so constructed and is a convenient tool for defining functions
and proving properties about data types and programs.
Definition 0.40 Let U be a set called the Universe, B a nonempty subset of U called the basis, and
let K called the constructor set be a nonempty set of functions, such that each function f K has
associated with it a unique natural number n 0 called its arity and denoted by (f ). If a function
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
89 OF 788
Q UIT
f has an arity of n 0, then f : Un U. Let X be the family of subsets of U such that each
X X satisfies the following conditions.
Basis. B X
Induction step. if f K is of arity n 0, a1, . . . , an X then f (a1, . . . , an) X
A set A is said to be inductively defined from B, K, U if it is the smallest set (under the subset
ordering ) satisfying the above conditions i.e.
\
A=
X
(1)
XX
The set A is also said to have been generated from the basis B and the rules of generation f K.
As in the other induction principles the underlined portion is the induction hypothesis. It may not
be absolutely clear whether A defined as in (1) satisfies the two conditions of definition 0.40.
Lemma 0.41 A X where A and X are as in definition 0.40.
Proof: We need to show that A satisfies the two conditions that each X X satisfies. It is easy
to see that since since B X for each X X , we have B A and hence A does satisfy the
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
90 OF 788
Q UIT
basis condition. As for the induction step, consider any f K and elements a1, . . . , a(f ) A.
By equation (1) we have a1, . . . , a(f ) X for every X X . Therefore f (a1, . . . , a(f )) X for
every X X which implies f (a1, . . . , a(f )) A. Hence A X .
QED
We may also think of A as the smallest set (under the subset ordering) which satsfies the set equation
[
X = B {f (X n) | f K, (f ) = n 0, X U}
(2)
in the unknown X, where f (X n) = {a | a = f (a1, . . . , an), for some (a1, . . . , an) X n}. We
show in lemma 0.44 that such equations may be solved for their unique smallest solution.
Definition 0.42 Let U, B, K be as in definition 0.40. Then a sequence [a1, . . . , am] of elements of
U is called a construction sequence for am if for all i = 1, . . . , m either ai B or there exists a
constructor f K, of arity n > 0, and 0 < i1, . . . , in < i such that f (ai1 , . . . , ain ) = ai.
ai is said to directly depend on each of the elements ai1 , . . . , ain (denoted aij 1 ai for each
j {1, . . . , n}). ai depends on aj , denoted aj ai if either aj 1 ai or there exists some i0 such
that aj ai0 and ai0 1 ai.
A contains exactly all those elements of U which have a construction sequence. The basis along
with the constructor functions are said to define the terms generated by the rules of construction of
definition 0.40.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
91 OF 788
Q UIT
Example 0.43 Consider the following definition of a subclass of arithmetic expressions, called amexpressions generated only from natural numbers and the addition and multiplication operations.
The rules may be expressed in English as follows.
Basis Every natural number is an am-expression.
Induction step
addition If e and e0 are am-expressions then add(e, e0) is an am-expression.
multiplication If e and e0 are am-expressions then mult(e, e0) is an am-expression.
Initiality Only strings that are obtained by a finite number of applications of the above rules are
am-expressions (nothing else is an am- expression).
In the above definition of am-expressions N is the basis, K = {add, mult} is the set of constructors
each of arity 2 and the universe U consists of all possible finite sequences of symbols drawn from
the natural numbers and applications of the constructors. The smallest set generated from finite
sequences of applications of the basis and induction steps is the set of am-expressions involving only
the naturals and the 2-ary constructors add and mult such that every application of a constructor
has exactly two operands each of which in turn is either a natural number or constructed in a
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
92 OF 788
Q UIT
similar fashion. 0, add(0, 1), mult(add(1, 0), mult(1, 1)) are all am-expressions. On the
other hand,
1. add(0) is not an am-expression since the arity of add is 2,
2. 0, 1 is not an am-expression since it is not a natural number (it is actually a sequence of two
natural numbers) ,
3. mult(, 0) is not an am-expression since is not a natural.
The am-expression mult(add(1, 0), mult(1, 1)) has the following possible construction sequences.
1. [1, 0, add(1, 0), 1, 1, mult(1, 1), mult(add(1, 0), mult(1, 1))]
2. [1, 0, add(1, 0), mult(1, 1), mult(add(1, 0), mult(1, 1))] where replications of am-expressions have
been omitted.
3. [1, 0, mult(1, 1), add(1, 0), mult(add(1, 0), mult(1, 1))] since it does not matter in which order
the two operands of the last element in the sequence occur in the construction sequence as long
as they precede the final am-expression.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
93 OF 788
Q UIT
A convenient shorthand notation called the Backus-Naur Form (BNF) is usually employed to express
the rules of generation . For the set of am-expressions defined above the BNF is as follows.
e, e0 ::= n N | add(e, e0) | mult(e, e0)
It is possible to relate the notions of dependence in a construction sequence to the construction
process by partially ordering the process of construction of elements in an inductively generated set
as follows. Let B, K and U be as in definition 0.40. Consider the infinite sequence of sets
[A0 A1 A2 A3 ]
(3)
The following lemma shows that A = A and is indeed the smallest solution to the equation (2).
Moreover (3) gives a construction of the smallest solution by mathematical induction.
Lemma 0.44 Let B, K and U be as in definition 0.40 and A be as in equation (4). Then A = A.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
94 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
95 OF 788
Q UIT
the form a = f (a1, . . . , a(f )) where a1, . . . , a(f ) Ak . Again by the induction hypothesis we have
a1, . . . , a(f ) A and since A X , a = f (a1, . . . , a(f )) A. Hence Ak+1 A. a QED
Lemma 0.44 and its proof, in addition to showing us how to obtain least solutions to equations of the
form (2) also show the relationship to the principle of mathematical induction. Further the lemma
gives us a way to quantify dependence of elements in a construction sequence by assigning each
element an order number.
Definition 0.45 The height of any element a (denoted 4(a)) in an inductively generated set A is the
least index i in the monotonic sequence (3) such that a Ai.
In any construction sequence [a1, . . . , am], ai aj only if the height of ai is less than the height of
aj .
Example 0.46 Let S N be the smallest set of numbers defined by
n ::= 0 | n + 1
Clearly this defines the smallest set containing 0 and closed under the successor operation on the
naturals. It follows that S = N. Notice that the above BNF is merely a rewording of the principle of
mathematical induction version 0.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
96 OF 788
Q UIT
Example 0.46 shows that mathematical induction is merely a particular case of structural induction.
Example 0.47 The language of minimal logic was defined in example 0.26. We may redefine the
language by the following BNF
, ::= a A | () | ( )
We prove that the language is countable.
Proof: We first begin by classifying the formulas of the language according to their depth. Let Mk
be the set of formulas of the language such that each formula has a depth at most k for k 0. We
all formulas of depth k + 1 of the form (k ) and let Mk be the set of all formulas of the form
(k k ), where k , k Mk . We then have
Mk+1 = Mk Mk
Mk
= Mk (Mk Mk ) (Mk Mk )
= Mk
H OME PAGE
JJ
II
Nk+1
LCS
Nk+1
G O B ACK
F ULL S CREEN
C LOSE
97 OF 788
Q UIT
Here
Nk+1 =Nk+1
Nk+1
Nk+1
consists
Nk+1
Nk+1
= , Mk
Nk+1
Nk+1
S
S
S
The entire language may then be defined as the set M0 = k0 Mk = A k>0 Nk k>0 Nk
Mk , Nk+1
= ,
Nk+1
Nk+1
and
is countably infinite for all k 0.
Claim. Each of the sets
Proof of claim. We prove this claim by induction on k. The basis is M0 = A and it is given that it is
countably infinite. The induction step proceeds as follows. We have by the induction hypothesis that
1-1
N. We use numk to construct
Mk is countably infinite. Hence there is a bijection numk : Mk
onto
the 1 1 correspondence numk+1 as follows: We may use numk to define a bijection between
Nk
and N. Similarly there exists a 1-1 correspondence between Nk+1 and N N given by the ordered
pair of numbers (numk (k ), numk (k )) for each (k k ) Nk+1. But we know that there is a 1-1
1-1
N.
correspondence diag : N N
onto
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
98 OF 788
Q UIT
Mk , Nk+1
Nk+1
if k+1 Mk
3 numk (k+1)
numk+1(k+1) = 3 numk (k ) + 1
if k+1 k Nk+1
3 diag(num ( ), num ( )) + 2 if
N
k
k+1
H OME PAGE
JJ
II
LCS
G O BACK
F ULL S CREEN
C LOSE
99 OF 788
Q UIT
Proof: Let P be a property of the elements of U that satisfies the conditions above. Let C be the
set of all elements of A that satisfy the property P, i.e. C = {a A | P holds for a}. It is clear
that B C A. To show that C = A[
it suffices to prove that A C = . Consider the sequence
of sets defined in (3) and the set A =
Ai as given in equation (4). We prove that for all i 0,
i0
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
100 OF 788
Q UIT
that a does not satisfy P. Hence there is no smallest i such that Ai 6 C. Therefore for all i 0,
Ai C and hence A C from which it follows that P holds for every element of A. QED
Example 0.48 Consider the following BNF of arithmetic expressions
e, e0 ::= n N | (e + e) | (e e0) | (e e0)
Given a string w of symbols, a string u is called a prefix of w if there is a string v such that w = u.
v , where . denotes the (con)catenation) operation on strings. Clearly the empty string is a prefix
of every string and every string is a prefix of itself. u is called a proper prefix of w if v is a nonempty
string.
Let e be any expression generated by the above BNF and let e0 be a prefix10 of e. Further, let L(e0)
and R(e0) denote respectively the numbers of left and right parentheses in e0. Let P be the property
of strings e in the language of arithmetic expressions given by
For every prefix e0 of e, L(e0) R(e0).
We use the principle of structural induction (theorem 0.12) to prove that property P holds for all
10 e0
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
101 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
102 OF 788
Q UIT
Case e0 = (f 0 . By the induction hypothesis we have L(f 0) R(f 0) and hence L(e0) =
1 + L(f 0) > R(f 0) = R(e0).
Case e0 = (f g 0. By the induction hypothesis we have L(f ) R(f ) and L(g 0) R(g 0).
Hence L(e0) = 1 + L(f ) + L(g 0) > R(f ) + R(g 0) = R(e0).
Case e0 = (f g. By the induction hypothesis we have L(f ) R(f ) and L(g) R(g).
Hence L(e0) = 1 + L(f ) + L(g) > R(f ) + R(g) = R(e0).
Case e0 = e = (f g)00. By the induction hypothesis we have L(f ) R(f ) and L(g)
R(g). Hence L(e0) = L(e) = 1 + L(f ) + L(g) R(f ) + R(g) + 1 = R(e0) = R(e).
We leave it as an exercise for the reader to prove that every proof by the principle of mathematical
induction may also be translated into a proof by the principle of structural induction (see example
0.46 and the equivalences between the various versions of the principle of mathematical induction
and complete induction). We are now ready to show that even though structural induction seems to
be more general than mathematical induction they are in fact equivalent in power. In other words,
every proof by the principle of structural induction may also rewritten as a proof by (some version)
of the principle of mathematical induction or complete induction. To do this we need the height (see
definition 0.45) of each element in an inductively defined set.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
103 OF 788
Q UIT
Theorem 0.49 Every proof using the principle of structural induction (PSI) may be replaced by a
proof using the principle of complete induction (PCI).
Proof: Let A be inductively defined by B, K, U and let P be a property of elements of A that has
been proved by the principle of structural induction. Let the property Q(n) for each natural number
n be defined as
The property P holds for all elements of height n
Basis. The basis step n = 0 of the proof of property Q proceeds exactly as the basis step of the proof
by PSI with as many cases are required in the proof of by PSI.
The induction hypothesis. The induction hypothesis is the assumption that Q(m) holds for all 0
m < n.
The induction step The induction step is simply that if the induction hypothesis holds for all m < n
then Q holds for n. The proof by PSI for each constructor in the induction step is a case in the
induction step of the proof Q(n).
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
104 OF 788
Q UIT
Definition 0.50 Let A be inductively defined by B, K, and U and let V be any arbitrary set. Then
h : A V is said to be an inductively defined function if h(b) = h0(b) and h(f (a1, . . . , a(f ))) =
hf (h(a1), . . . , h(a(f ))) where h0 : B V is a function and for every n-ary constructor f K,
there is an n-ary function hf : V n V . A relation R A V is said to be inductively defined
if
R = {(b, h0(b)) | b B} {(f (a1, . . . , a(f )), hf (v1, . . . , v(f ))) | a1Rv1, . . . , a(f )Rv(f )}
Example 0.51 Consider the language P0 of propositional logic, where the basis is a countable set
A of atoms, and the language is defined by the BNF
, ::= p A | () | ( ) | ( )
Further let B = h{0, 1},, +, .i be the algebraic system whose operations are defined as follows.
0 = 1
and 1 = 0
1 + 1 = 0 + 1 = 1 + 0 = 1 and 0 + 0 = 0
0 0 = 0 1 = 1 0 = 0 and 1 1 = 1
Let 0 : A {0, 1} be a truth value assignment for the propositional atoms. Then the truth values
of propositional formulas in P0 under , is the inductively defined function T : P0 {0, 1}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
105 OF 788
Q UIT
=
=
=
=
0(p)
pA
T []
T [] + T []
T [] T []
One question that naturally arises is that if induction is merely equation solving, then are there
problems or properties which require us to solve a system of simultaneous equations? We answer
this question with the following example.
Example 0.52 Consider the following BNF which consists of the generation of three different sets
of bit strings (i.e. sequences of 0s and 1s) which are all mutually dependent.
z ::= 0 | z0 | i1
i ::= 1 | t0 | z1
t ::= i0 | t1
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
106 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
107 OF 788
Q UIT
The same intuition also guides the proof of property PZ . However, the proof is dependent upon
properties PI for the set I and PT for T where
PI : I = {i 2+ | [i] = 3m + 1, m N}
and
PT : T = {t 2+ | [t] = 3n + 2, n N}
Hence an inductive proof of property PZ requires a simultaneous proof of properties PI and PT .
Lemma 0.53 The elements of the sets Z, I and T satisfy properties PZ , PI and PT respectively.
Proof: We proceed by simultaneous induction on the lengths of strings of 2+.
Basis. There are exactly two bit strings of length 1 viz, 0 and 1 and it follows easily that 0 Z
and 1 I.
Induction Hypothesis (IH).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
108 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
109 OF 788
Q UIT
We have already seen in definition 0.10 that a linear or total order is a connected partial order. We
now use this and definition 0.16 in defining a well-ordered set.
Definition 0.54 A well-ordering of a set is a well-founded total ordering of the set. A well-ordered
set is sometimes called a woset.
Fact 0.55 Let hA, i be a (nonempty) well-ordered set.
1. Every nonempty subset of A has a unique least element.
2. A has a unique least element.
Well-ordered induction generalises the principle of mathematical induction to any set A which may
be enumerated as a sequence [ai | i N] indexed by the non-negative integers. There is an implicit
total ordering in the elements such that ai aj if and only if i j in the integers.Hence any
property P (ai) of elements of the set may be regarded as a property Q(i) of the index of the element
in the set. What makes induction applicable here is the fact that the set N is well-ordered (see
defnition 0.54) by the relation . Hence were a property P to fail for some element aj in the set A,
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
110 OF 788
Q UIT
there would be a least element ai aj for which it would fail and which in turn translates to the
property Q(j) and Q(i) failing in such a fashion that for all (if any) i0 < i, Q(i0) would hold.
Theorem 0.56 The Principle of Well-ordered Induction. Let hA, i be a well-ordered set. Let
X A such that
Basis . The (unique) least element of A is in X and
Induction Step . For each a A, for every a0 A, a0 < a implies a0 X,
Then X = A
Proof: Suppose X 6= A. Then B = A X 6= . Since B A, and A is totally ordered, B has a
unique smallest element b B. But b 6 X, even though for every element a < b, a X. But by
the induction step b X, which is a contradiction.
QED
Note that in the statement of the above theorem, the basis is included (vacuously) in the induction
step. Hence the basis statement in this principle is actually superfluous.
Exercise 0.2
1. Prove that version 1, 2 and 3 of PMI are mutually equivalent.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
111 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
112 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
113 OF 788
Q UIT
(c) Prove using the principle of structural induction that for any proposition p, and a state ,
T (p) = 1 if and only if tau belongs to the -meaning of p.
8. Let A be a language ,inductively defined by B, K, U. Define the set of syntax tree, TA of the
elements of A as follows:
(a) For each b B, there is a single node labelled b,
(b) For each n-ary operator and a1, . . . , an, a A, if (a1, . . . , an) = a, the syntax tree t of a
is a tree with root labelled by and t1, . . . , tn as the immediate subtree of t, where t1, . . . , tn
are the syntax trees corresponding to a1, . . . , an respectively.
(a) Prove that every element of A has a unique syntax tree if A is free.
(b) Give an example to show that every syntax tree need not define a unique element of A.
9. Let L0 be the language of propositional logic as defined in the last example. Then intuitively
speaking, a propositional formula p is a subformula of a propositional formula q if the syntax
tree of p is a subtree of the syntax tree of q.
(a) Define the notion of subformula inductively.
(b) Let of every formula q, SF(q) denote the set of all subformulas of q. Define SF(q) inductively.
(c) Let p q if and only if p is a subformula of q. Prove that is a partial order on L0.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
114 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
115 OF 788
Q UIT
1. Lecture 1: Introduction
Lecture 1: Introduction
Tuesday 26 July 2011
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
116 OF 788
Q UIT
1. What is Logic?
2. Reasoning, Truth and Validity
3. Examples
4. Objectivity in Logic
5. Formal Logic
6. Formal Logic: Applications
7. Form and Content
8. Facets of Mathematical Logic
9. Logic and Computer Science
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
117 OF 788
Q UIT
What is Logic?
Logic is about reasoning:
validity of arguments
consistency among sets of statements
matters of truth and falsehood
Logic is concerned only about the form of reasoning and not
about the content
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
118 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
119 OF 788
Q UIT
Examples
Example 1.1
All humans live forever.
Socrates is human.
Hence Socrates lives forever.
Example 1.2
All humans are born with opposable toes
By adulthood opposable toes become non-opposable
John is an adult human
Hence John has no opposable toes.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
120 OF 788
Q UIT
Objectivity in Logic
The traditional logic of Aristotle and Leibniz are essentially
philosophical in nature with its main purpose being to investigate the objective laws of thought.
Objectivity implies essentially that arguments must be communicable to and verifiable by other people.
Objectivity has always implied formalizability.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
121 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
122 OF 788
Q UIT
of phrases, expressions and sentences in the formal language. Since we will be expressing these
meanings through objects in mathematical structures, these objects will be coloured brown.
The study of logic promises to be pretty colourful, what?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
123 OF 788
Q UIT
Formal Logic
Logic as a formal language with a syntax to which a semantics
had to be attached.
In turn using mathematical methods within logic, led to its
formalization as mathematical logic
The strict separation of syntax from semantics made logic
a clean and elegant mathematical discipline which could be
then applied to the foundational questions of mathematics.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
124 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
125 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
126 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
127 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
128 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
129 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
130 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
131 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
132 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
133 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
134 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
135 OF 788
Q UIT
a a
0 1
1 0
H OME PAGE
JJ
b
0
1
0
1
II
a.b a + b a . b a = b
0
0
1
1
0
1
1
0
0
1
0
0
1
1
1
1
LCS
G O B ACK
F ULL S CREEN
C LOSE
136 OF 788
Q UIT
Boolean identities
Negation
a
= a
Comparison a . b = a + b
.
Equality
a = b = (a . b).(b . a)
a+0
a+1
a+a
a+b
(a + b) + c
a + (b.c)
a+b
a+a
0
a + (a.b)
H OME PAGE
JJ
=
=
=
=
=
=
=
=
=
=
a
Identity
a.1 = a
1
Zero
a.0 = 0
a
Idempotence
a.a = a
b+a
Commutativity
a.b = b.a
a + (b + c)
Associativity
(a.b).c = a.(b.c)
(a + b).(a + c) Distributivity a.(b + c) = (a.b) + (a.c)
a.b
De Morgan
a.b = a + b
1
Simplification
a.a = 0
1
Inversion
1 = 0
a
Absorption a.(a + b) = a
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
137 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
138 OF 788
Q UIT
We now begin our study of formal logic by studying statements in natural lanaguage. We will
frequently appeal to reasoning methods employed in sentences (actually statements) in natural languages. We initially restrict our study to statements expressed in natural languages. This logic is
often called propositional or sentential logic.
In general sentences in any natural language may be classified into the following forms (usually
indicated by the mood of the sentence. A standard text book on English grammar defines a mood
as the mode or manner in which the action denoted by the verb is represented. It further illustrates
three moods in the English language. English Grammar 101 classifies the verbs in the English
language into four moods (including the infnitive as a mood. But to get really confounded and
confused, the reader needs to refer to Wikipedia where several moods are defined (e.g. optative,
jussive, potential, inferential).
The following example sentences are taken from the references above.
Indicative Mood: expresses an assertion, denial, or question.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
139 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
140 OF 788
Q UIT
(such as assertions and denials) may be considered to be propositions in our setting. Hence of the
examples given above the only ones which are of interest to us would be
Little Rock is the capital of Arakansas.
which is a denial (it denies the statement Ostriches can fly). The last indicative statement
Have you finished your homework?
is a question for which no truth value can be assigned. It is therefore not a proposition in the sense
that we understand propositions. Notice that a denial is an assertion too it is simply the negation of
an assertion and hence is a statement to which a truth value may be assigned. We will treat denials
also as assertions and declare that assertions in natural language are all propositions in our sense of
the term.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
141 OF 788
Q UIT
The examples that we have considered above are rather simple. We could consider more examples
of assertions, denials and complex assertions which are made up of assertions and denials. Here are
a few.
God is in his Heaven and all is right with the world.
Time and tide wait for no man.
You can fool some people some of the time, some people all of the time and all the people
some of the time, but you cannot fool all the people all the time.
Anybody who becomes the Prime Minister has a clear national and international agenda.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
142 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
143 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
144 OF 788
Q UIT
bottom
false
>
top
true
negation
not
conjunction
and
disjunction
or
conditional
if...then
biconditional
if and only if
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
145 OF 788
Q UIT
We may translate natural language sentences into propositions by identifying the simplest sentences
as atoms and connecting up the simple sentences using the connectives at our disposal. Naturally,
many of the subtleties of the use of the connectives in natural lanaguages would be lost in translation.
For the purposes of logical reasoning, the table given in Natural Language equivalents is sufficient
for propositional reasoning, if we ignore the subtleties in natural language such as tonal variations,
implied tense and judgmental implications that often come loaded with the sentences. We will have
more to say on this with respect to particular connectives in the following descriptions.
Negation (). This connective is used to mean not, it is not the case that and abbreviated negation
prefixes such as non- and un-. If the atom A denotes the simple statement I am at work, then
(A) denotes I am not at work. In certain cases opposites could be translated using negation.
For example, if the sentence
This dish is good.
is denoted by the atom B, the sentence
This dish is bad.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
146 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
147 OF 788
Q UIT
The operator is commutative as we shall see later. Therefore for any formulae and ,
would be logically equivalent to . Hence the implied difference between the two sentences
(from [7])
Jane got married and had a baby.
and
Jane had a baby and got married.
is usually lost in translation.
Disjunction (). The usual meaning is an or in the inclusive sense although or is often used in
English in the exclusive sense. Hence would have to be translated to mean either or
or both and .
In our natural language arguments we will use or in the inclusive sense. either or would
refer to an or that is used in the exclusive sense. That is either or would mean that exactly
one of the two propositions holds and both cannot hold at the same time. Therefore the sentence
Ram or Shyam topped the class.
which could be equivalently rendered in English as a compound sentence
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
148 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
149 OF 788
Q UIT
Biconditional () The translation If then , not otherwise is reserved for the biconditional.
Alternative translations for are if and only if , iff , exactly when and
just in case .
The following tables adapted from [7] summarise the various English renderings of each operator
given arbitrary operands and .
Operation English rendering
not
does not hold
It is not the case that holds
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
150 OF 788
Q UIT
and
Both and
but
Not only but
although
despite
yet
while
Operation English rendering
or
or or both
and/or
unless
except when
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
151 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
152 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
153 OF 788
Q UIT
Some Remarks
It is convenient to have a syntactic symbol for absolute truth
and absolute falsehood though it is strictly not necessary.
and > are constants and hence have no precedence associated with them.
In a formula of the form , is called the antecedent and
the consequent.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
154 OF 788
Q UIT
Notice that we have defined the language to be fully parenthesized i.e. every compound formula
is enclosed in a pair of parentheses (( )). However it may actually be very distracting and confusing to read formulae with too many parentheses. We will define precedence and associativity
conventions to reduce the number of parentheses while reading and writing formulae.
Associativity conventions. This convention refers to the consecutive occurrences of the same binary
operator. Simple examples from school arithmetic are used to illustrate the conventions used in
disambiguating expressions which are not fully parenthesized.
Left Associativity is the convention that an expression on numbers like 6 3 2 should be
read as ((6 3) 2) (which would yield the value 1). It should not be read as (6 (3 2))
(which would yield the value 5). Here we say that the subtraction operation associates to
the left or that subtraction is a left associative operation. Other binary operations such as
addition, multiplication and division on numbers are also left associative.
Right Associativity is the convention used to group consecutive occurrences of powers of num2
2
bers. For example 43 is to be read as (4(3 )) which would yield the result 49 = 262144. It
should not be read as ((43)2) which would yield the result 642 = 4096. We say that exponen-
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
155 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
156 OF 788
Q UIT
on the right i.e. they should be grouped from left to right. Thus 5 + 4 3 is to be read as
((5 + 4) 3) yielding 6 (even though reading it as (5 + (4 3)) yields the same result). Similarly 5 4 + 3 should be read as ((5 4) + 3) (yielding the result 4) rather than as (5 (4 + 3))
(which yields 2). For example 24/4 3 would yield 18 by our convention. While this convention is well-established for left associative operators, it is not clear what the convention is when
there are consecutive occurrences of distinct right associative operators having equal precedence.
However in case of any confusion we may always put in enough parentheses to disambiguate the
expression.
Our interest in precedence, however is restricted to being able to translate an expression written
in linear form unambiguously into its abstract syntax tree. The use of parentheses aids in unambiguously defining an unique abstract syntax tree. Even though we write formulae in linear
form we will always implicitly assume that they represent the corresponding abstract syntax tree.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
157 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
158 OF 788
Q UIT
Syntactic Identity
The precedence rules make a lot of parentheses redundant.
Instead of propositions written linearly we will rather think of
propositions as abstract syntax trees (AST).
Any two propositions and which have the same AST will
be considered syntactically identical and denoted .
If then and differ only in the presence of redundant
parentheses.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
159 OF 788
Q UIT
q
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
160 OF 788
Q UIT
Subformulae
Definition 2.6 The set of subformulae of any formula is the
set SF () defined by induction on the structure of formulae as
follows:
SF ()
= {}
SF (>)
= {>}
SF (p)
= {p},
for each atom p
SF ()
= SF () {}
SF ( ) = SF () SF () { }, {, , , }
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
161 OF 788
Q UIT
Atoms in a Formula
Definition 2.7 The atoms of a formula is defined by induction
on the structure of formulae.
atoms()
= {}
atoms(>)
= {>}
atoms(p)
= {p},
for each atom p
atoms()
= atoms()
atoms( ) = atoms() atoms(), {, , , }
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
162 OF 788
Q UIT
Degree of a Formula
Definition 2.8 The degree of a formula is defined by induction
on the structure of formulae.
degree()
= 0
degree(>)
= 0
degree(p)
= 0,
for each atom p
degree()
= degree()
degree( ) = 1 + degree() + degree(), {, , , }
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
163 OF 788
Q UIT
Size of a Formula
Definition 2.9 The size of a formula is defined by induction on
the structure of formulae.
size()
= 1
size(>)
= 1
size(p)
= 1,
for each atom p
size()
= 1 + size()
size( ) = 1 + size() + size(), {, , , }
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
164 OF 788
Q UIT
Height of a Formula
Definition 2.10 The height of a formula is defined by induction
on the structure of formulae.
height()
= 0
height(>)
= 0
height(p)
= 0,
for each atom p
height()
= 1 + height()
height( ) = 1 + max(height(), height()), {, , , }
where max is the maximum of two numbers.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
165 OF 788
Q UIT
Exercise 2.1
1. Prove that the set P0 is countably infinite. Hint: Use the solution given in example 0.47.
2. Let T (P0) be the set of all abstract syntax trees of the language P0. Define a function AST :
P0 T (P0) which for any well-formed formula yields the corresponding unique abstract
syntax tree of the formula.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
166 OF 788
Q UIT
Definition 2.11
A directed graph is a pair hN, i consisting of a finite or a countably infinite set N of nodes
and a set N N of (directed) edges such that for any edge (s, t) (usually denoted
s t in infix notation), s is called the source and t the target of the edge. s is called a
predecessor of t and t is called a successor of s.
A (directed) path of length k 1 in a directed graph is a finite sequence of nodes n0, n1, . . . ,
nk1, nk such that ni ni+1 for each i {0, . . . , k 1}. In addition if nk = n0 the path is
called a cycle of length k, A cycle of length 1 is called a self-loop
A directed graph is called a directed acyclic graph (DAG) if it has no cycles.
An unordered (directed) tree is a directed acyclic graph such that there is at most one path
between any pair of nodes.
A (rooted directed) tree is a triple hN, , ri such that hN, i is an unordered (directed)
tree and r N is a distinguished node called the root of the tree and satisfying the following
the properties.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
167 OF 788
Q UIT
There exists a function ` : N N called the level such that `(r) = 0 and for any s t,
`(t) = `(s) + 1.
Every node in N {r} has a unique predecessor.
We will be primarily interested in rooted trees and we will simply refer to them as trees.
Notation. We will often represent a tree T specified only by a name and a root node r either as
r
-T %
or upside-down as
according to convenience.
.T &
r
Facts 2.12
Every node in N is source or a target of one or more edges,
The relation is irreflexive (i.e. there is no edge whose source and target are the same node).
The root node has no predecessor.
A leaf (node) is a node with no successor.
Definition 2.13 Let T = hN, , ri be a rooted tree.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
168 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
169 OF 788
Q UIT
r
or
.
r
.T &
r0
Two trees T0 = hN0, 0, r0i and T1 = hN1, 1, r1i may be joined together at a new node r
to form a new tree T = hN, , ri where N = N0 N1 {r}, =0 1 {r
r0, r r1}. T may be denoted
r
- T0 % - T1 %
. &
r0
r1
.
or
r0
r1
- %
r
. T0 & . T1 &
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
170 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
171 OF 788
Q UIT
Proof: Assume T = hN, , ri is a finitely branching infinite rooted tree which has no infinite
path. Clearly since N = Desc(r) is infinite, r is infinitary. r has an infinitary successor by lemma
2.16. Hence there exists a maximal path in T all of whose nodes are infinitary. This path has to be
infinite, otherwise there would be a last node in the path which is infinitary but has no successors,
which is impossible.
QED
Corollary 2.18 Every infinite tree is infinitely branching or finitely branching with at least one infinite path.
Corollary 2.19 (Contrapositive of Konigs Lemma) A finitely branching tree is finite if and only
if it has no infinite path.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
172 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
173 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
174 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
175 OF 788
Q UIT
df
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
176 OF 788
Q UIT
T JK = 0
df
T J>K = 1
df
T JK = T JK
df
T J K = T JK . T JK
df
T J K = T JK + T JK
df
T J K = T JK . T JK
df
T J K = T JK = T JK )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
177 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
178 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
179 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
180 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
181 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
182 OF 788
Q UIT
(p)
H OME PAGE
(r)
JJ
(q)
(p)
(r)
(q)
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
183 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
184 OF 788
Q UIT
Exercise 3.1
1. Prove that for each truth assignment , the function T J.K is a homomorphism between the
.
algebras P0 = hP0, i and B = h{0, 1}, {, ., +, . , =}i.
2. Prove that if two truth assignments and 0 are exactly the same for elements in atoms() for
any formula , then
if and only if 0
.
3. Any homomorphism h : A B from an algebra A to another algebra B (thus establishing a
1-1 correspondence between the signatures of the two algebras) induces an equivalence relation
on A . What is the nature of the equivalence relation = induced by T J.K for a truth assignment
?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
185 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
186 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
187 OF 788
Q UIT
1. Logical Consequence: 1
2. Logical Consequence: 2
3. Other Theorems
4. Logical Implication
5. Implication & Equivalence
6. Logical Equivalence as a Congruence
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
188 OF 788
Q UIT
Logical Consequence: 1
Definition 4.1 A proposition P0 is called a logical consequence of a set P0 of formulas (denoted |= ) if any truth
assignment that satisfies all formulas of also satisfies .
When = then logical consequence reduces to logical validity.
|= denotes that is logically valid.
6|= denotes that is not a logical consequence of .
6|= denotes that is logically invalid.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
189 OF 788
Q UIT
Logical Consequence: 2
Theorem 4.2 Let = {i | 1 i n} be a finite set of propositions, and let be any proposition. Then |= if and only if
((. . . ((1 2) 3) . . . n) ) is a tautology.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
190 OF 788
Q UIT
=
=
=
=
0
0
1 and T JK = 0
1 and T JK ) = 0
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
191 OF 788
Q UIT
Other Theorems
Theorem 4.3 Let = {i | 1 i n} be a finite set of propositions, and let be any proposition. Then
1. |= if and only if |= 1 (2 (n ) )
2. |= if and only if ((. . . ((1 2) 3) . . . n) ) is a
contradiction.
Corollary 4.4 A formula is a tautology iff is a contradiction
(unsatisfiable).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
192 OF 788
Q UIT
Logical Implication
Definition 4.5 A formula logically implies another formula
(denoted ) iff |= . is called (logical) implication.
Definition 4.6 A formula is logically equivalent to another formula (denoted ) iff |= . is called (logical)
equivalence.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
193 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
194 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
195 OF 788
Q UIT
Exercise 4.1
1. Use the semantics of propositional logic to prove theorem 4.3 and corollary 4.4.
2. Prove the facts 4.7.
3. Prove that logical equivalence is indeed a congruence relation on P0.
4. For each truth assignment let = denote the equivalence defined in exercise 3.1. What is the
relationship between and = ?
5. We may define the notion of a precongruence for preorders analogously to the notion of congruence for equivalences, i.e. a preorder is a precongruence if it is preserved under each operator.
Is a precongruence on P0? If so prove it, otherwise identify the operators which preserve the
relation and for operators which do not preserve the relation give examples to show that
they are not preserved.
6. Prove that 1, , n |= if and only if for each i, 1 i n, 1, , i1, i+1, , n, |=
i.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
196 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
197 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
198 OF 788
Q UIT
1. Adequacy
2. Adequacy: Examples
3. Functional Completeness
4. Duality
5. Principle of Duality
6. Negation Normal Forms: 1
7. Negation Normal Forms: 2
8. Conjunctive Normal Forms
9. CNF
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
199 OF 788
Q UIT
Some identities
Negation
>
( )
( )
( )
( )
H OME PAGE
JJ
Identity
>
>
Zero
Idempotence
Commutativity
( )
Associativity ( )
( ) ( ) Distributivity ( )
De Morgan ( )
>
Simplification
>
Inversion
>
Absorption ( )
II
LCS
G O B ACK
F ULL S CREEN
( )
( ) ( )
C LOSE
200 OF 788
Q UIT
Adequacy
Some Other Important identities are:
( ) ( )
(5)
(6)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
201 OF 788
Q UIT
Adequacy: Examples
Example 5.2
1. From the identities (5) and (6) and the two Simplification identities it is clear that O = {, , } is an adequate set of operators for P0.
2. Further given that O = {, , } is adequate and using the
De Morgan identity and Negation, we have that
( ) ( )
and hence {, } is an adequate set.
3. We may use the other De Morgan identity
( ) ( )
to conclude that {, } is adequate.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
202 OF 788
Q UIT
Functional Completeness
It is quite possible that one could extend P0 with new operators
(perhaps 3-ary or 4-ary or indeed of any arity) and thus make
the language more expressive.
Definition 5.3 A set O of operators for propositional logic is
functionally complete (also called expressively adequate) if any
formula built up using the operators of O is logically equivalent
to a formula using operators only from .
Lemma 5.4 {, , } is a functionally complete set.
Proof
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
203 OF 788
Q UIT
where for each row r, and each j, 1 j n, arj = 1 if arj = 1 and arj = 0 otherwise. Similarly
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
204 OF 788
Q UIT
the product (
a
)
is
inverted
if
b
=
0
otherwise
(
r
1jn j
1jn aj ) = 1. Alternatively we have
X
Y
on(a1, , an) =
(
arj )
br =1,0r<2n arj =1,1jn
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
205 OF 788
Q UIT
Duality
Definition 5.5
Two formulas and are called duals of each other if each
can be obtained from the other by simultaneously replacing
all occurrences of
by ,
by ,
by > and
> by
and are duals of each other and
> and are duals of each other
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
206 OF 788
Q UIT
Principle of Duality
Theorem 5.6 If atoms() = {p1, . . . , pn} and o(p1, . . . , pn)
then
o(p1, . . . , pn)
where o is the dual of o.
Proof: By structural induction and the use of the De Morgan
and Simplication laws.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
207 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
208 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
209 OF 788
Q UIT
where m 0.
A conjunctive normal form is a formula of the form
1 2 n where j for each 1 j n is a disjunction of
literals.
We may analogously define a conjunction of literals and a disjunctive normal form (DNF).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
210 OF 788
Q UIT
CNF
Theorem 5.10 Every formula in P0 is logically equivalent to a
conjunctive normal form.
Proof:
It suffices to consider only negation normal forms.
In each case use the distributive laws to distribute over
and use the negation law to remove multiple contiguous occurrences of negations.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
211 OF 788
Q UIT
Exercise 5.1
1. Prove that the following sets are adequate for P0.
(a) {, }
(b) {, }
2. Prove that {, } is not an adequate set.
3. Prove that if O then O or O.
4. Define BNFs to generate exactly
(a) the set N0 of negation normal forms
(b) the set C0 of conjunctive normal forms
(c) the set D0 of disjunctive normal forms.
5. Using principles of induction prove that
(a) C0 N0 P0,
(b) D0 N0 P0,
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
212 OF 788
Q UIT
6. Let o1(p1, . . . , pn) and o2(p1, . . . , pn) be formulas such that . Then prove that
o1(p1, . . . , pn) o2(p1, . . . , pn)
o1 (p1, . . . , pn) o2 (p1, . . . , pn)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
213 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
214 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
215 OF 788
Q UIT
1. Arguments
2. Arguments: 2
3. Validity & Falsification
4. Translation into propositional Logic
5. Atoms in Argument
6. The Representation
7. Propositional Rendering
8. The Strategy
9. Checking Tautology
10. Computing the CNF
11. Falsifying CNF
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
216 OF 788
Q UIT
Arguments
A typical informally stated argument might go as follows:
If prices rise, then the poor and the salaried class will be unhappy.
If taxes are increased then the businessmen will be unhappy.
If the poor and the salaried class or the businessmen are unhappy, the Government will not be
re-elected.
Inflation will rise if Government expenditure exceeds its revenue.
Government expenditure will exceed its revenue unless taxes are increased or the Government
resorts to deficit financing or takes a loan from the IMF to cover the deficit.
If the Government resorts to deficit financing then inflation will rise.
If inflation rises, the prices will also rise.
The Government will get reelected.
Therefore the Government will take a loan from the IMF.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
217 OF 788
Q UIT
Arguments: 2
A typical informally stated argument might go as follows:
If prices rise, then the poor and the salaried class will be unhappy.
If taxes are increased then the businessmen will be unhappy.
If
or
unless
or
the Government resorts to deficit financing or takes a loan from the IMF to cover the deficit.
If the Government resorts to deficit financing then inflation will rise.
If inflation rises, the prices will also rise.
The Government will get reelected.
Therefore the Government will take a loan from the IMF.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
218 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
219 OF 788
Q UIT
If Mary has a little lamb, then Little Bo-Peep loses her sheep.
If Jack and Jill go up the hill, then Humpty-Dumpty sits on a wall.
If Little Bo-Peep loses her sheep or Humpty-Dumpty sits on a wall, then Little Miss Muffet sits on
a tuffet.
Little Jack Horner sits in a corner if the boy stands on the burning deck.
The boy stands on the burning deck unless Jack and Jill go up the hill or Wee Willie Winkie runs
through the town or Eensy Weensy spider climbs up the water spout
If Wee Willie Winkie runs through the town then Little Jack Horner sits in a corner
If Little Jack Horner sits in a corner then Mary has a little lamb.
Little Miss Muffet sits on a tuffet.
Therefore Eensy Weensy spider climbs up the water spout.
But if the original argument is logically valid then so is the new one, since logical validity depends
entirely on the so called connectives that make up the propositions and their effect on truth values.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
220 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
221 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
222 OF 788
Q UIT
Atoms in Argument
The Argument
val
val
val
val
val
val
val
val
val
In this case the the truth table would have 29 = 512 rows. Further, the truth table will use all the atoms, even the irrelevant
ones.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
223 OF 788
Q UIT
The Representation
d a t a t y p e Prop =
|
|
|
|
|
H OME PAGE
JJ
ATOM o f s t r i n g
NOT o f Prop
AND o f Prop Prop
OR o f Prop Prop
IMP o f Prop Prop
EQL o f Prop Prop
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
224 OF 788
Q UIT
Propositional Rendering
The Argument
val
val
val
val
val
val
val
val
val
val
val
H OME PAGE
Atoms in Argument
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
225 OF 788
Q UIT
The Strategy
We need to either show that
Arg1 = IM P (bigAN D H, conc1)
is a tautology or can be falsified. Using theorem 4.2 for validity
v a l bigAND = l e f t R e d u c e (AND ) ;
f u n V a l i d ( ( H, P ) : Argument ) =
i f n u l l (H) then t a u t o l o g y ( P )
e l s e t a u t o l o g y ( IMP ( bigAND (H) , P ) )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
226 OF 788
Q UIT
Checking Tautology
Checking for tautology crucially involves finding falsifying truth
assignments for at last one of the conjuncts in the CNF of the
argument.
fun tautology2 (P) =
l e t va l Q = cnf (P ) ;
v a l LL = f a l s i f y (Q)
in
i f n u l l ( LL ) then ( t r u e , [ ] )
e l s e ( f a l s e , LL )
end
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
227 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
228 OF 788
Q UIT
cnflistlist.sml
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
229 OF 788
Q UIT
ATOM o f s t r i n g
NOT o f P r o p
AND o f P r o p P r o p
OR o f P r o p P r o p
IMP o f P r o p P r o p
EQL o f P r o p P r o p
|
|
|
|
|
;
( P r o p o s i t i o n s t o CNFs )
exception Atom exception ;
f u n newatom ( s ) = i f s = "" t h e n r a i s e A t o m e x c e p t i o n
e l s e (ATOM s ) ;
f u n drawChar ( c , n ) =
i f n>0 t h e n ( p r i n t ( s t r ( c ) ) ; drawChar ( c , ( n 1 ) ) )
else ();
f u n show ( P ) =
let
f u n drawTabs ( n ) = drawChar ( # "\t" , n ) ;
f u n s h o w T r e e T a b s (ATOM a , n ) = ( drawTabs ( n ) ;
print (a );
p r i n t ( "\n" )
)
|
s h o w T r e e T a b s (NOT ( P ) , n ) = ( drawTabs ( n ) ; p r i n t ( "NOT" ) ;
s h o w T r e e T a b s ( P , n + 1)
)
|
s h o w T r e e T a b s (AND ( P , Q) , n ) =
( showTreeTabs ( P , n + 1 ) ;
drawTabs ( n ) ; p r i n t ( "AND\n" ) ;
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
230 OF 788
Q UIT
in
s h o w T r e e T a b s (Q, n + 1)
)
s h o w T r e e T a b s (OR ( P , Q) , n ) =
( showTreeTabs ( P , n + 1 ) ;
drawTabs ( n ) ; p r i n t ( "OR\n" ) ;
s h o w T r e e T a b s (Q, n + 1)
)
s h o w T r e e T a b s ( IMP ( P , Q) , n ) =
( showTreeTabs ( P , n + 1 ) ;
drawTabs ( n ) ; p r i n t ( "IMPLIES\n" ) ;
s h o w T r e e T a b s (Q, n + 1)
)
s h o w T r e e T a b s (EQL ( P , Q) , n ) =
( showTreeTabs ( P , n + 1 ) ;
drawTabs ( n ) ; p r i n t ( "IFF\n" ) ;
s h o w T r e e T a b s (Q, n + 1)
)
;
( p r i n t ( "\n" ) ; s h o w T r e e T a b s ( P , 0 ) ; p r i n t ( "\n" ) )
end
;
( The f u n c t i o n below e v a l u a t e s a f o r m u l a g i v e n a t r u t h a s s i g n m e n t .
The t r u t h a s s i g n m e n t i s g i v e n a s a l i s t o f a t o m s t h a t a r e t r u e
( a l l o t h e r atoms a r e f a l s e ) .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
231 OF 788
Q UIT
f u n l o o k u p ( x : Prop , [ ] ) = f a l s e
|
lookup ( x , h : : L)
= ( x = h ) o r e l s e lookup ( x , L)
;
fun
|
|
|
|
|
;
eval
eval
eval
eval
eval
eval
(ATOM a , L )
(NOT ( P ) , L )
(AND ( P , Q) , L )
(OR ( P , Q) , L )
( IMP ( P , Q) , L )
(EQL ( P , Q) , L )
=
=
=
=
=
=
l o o k u p (ATOM a , L )
i f eval (P , L) then f a l s e e l s e t r u e
e v a l ( P , L ) a n d a l s o e v a l (Q, L )
e v a l ( P , L ) o r e l s e e v a l (Q, L )
e v a l (OR (NOT ( P ) , Q) , L )
( e v a l ( P , L ) = e v a l (Q, L ) )
( We c o u l d a l s o w r i t e a t a u t o l o g y c h e c k e r w i t h o u t u s i n g t r u t h
a s s i g n m e n t s by f i r s t c o n v e r t i n g e v e r y t h i n g i n t o a n o r m a l form .
)
( F i r s t r e w r i t e i m p l i c a t i o n s and e q u i v a l e n c e s )
fun
|
|
|
|
|
;
H OME PAGE
rewrite
rewrite
rewrite
rewrite
rewrite
rewrite
JJ
(ATOM a )
(NOT ( P ) )
(AND ( P , Q ) )
(OR ( P , Q ) )
( IMP ( P , Q ) )
(EQL ( P , Q ) )
=
=
=
=
=
=
ATOM a
NOT ( r e w r i t e ( P ) )
AND ( r e w r i t e ( P ) , r e w r i t e (Q ) )
OR ( r e w r i t e ( P ) , r e w r i t e (Q ) )
OR (NOT ( r e w r i t e ( P ) ) , r e w r i t e (Q ) )
r e w r i t e (AND ( IMP ( P , Q) , IMP (Q, P ) ) )
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
232 OF 788
Q UIT
nnf
nnf
nnf
nnf
nnf
nnf
nnf
(ATOM a )
(NOT (ATOM a ) )
(NOT (NOT ( P ) ) )
(AND ( P , Q ) )
(NOT (AND ( P , Q ) ) )
(OR ( P , Q ) )
(NOT (OR ( P , Q ) ) )
=
=
=
=
=
=
=
ATOM a
NOT (ATOM a )
nnf ( P )
AND ( n n f ( P ) , n n f (Q ) )
n n f (OR (NOT ( P ) , NOT (Q ) ) )
OR ( n n f ( P ) , n n f (Q ) )
n n f (AND (NOT ( P ) , NOT (Q ) ) )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
233 OF 788
Q UIT
( P r o p o s i t i o n s t o CNFs e n d s )
( CNFs t o l i s t s o f l i s t s o f l i t e r a l s )
( Convert a clause i n t o a l i s t of l i t e r a l s )
f u n f l a t t e n O R (OR (A, B ) ) = ( f l a t t e n O R A) @ ( f l a t t e n O R B)
| flattenOR C
= [C] ( a s s u m i n g C i s a l i t e r a l )
( C o n v e r t a CNF i n t o a l i s t o f l i s t s o f c l a u s e s )
f u n f l a t t e n A N D (AND (Q, R ) ) = ( f l a t t e n A N D Q) @ ( f l a t t e n A N D R)
| flattenAND ( P )
= [ flattenOR P ] ( assuming P i s a c l a u s e )
( S o r t t h e l i t L i s t L i s t u s i n g some o r d e r i n g and remove d u p l i c a t e s w h i l e s o r t i n g )
( D e f i n e an o r d e r i n g l i t L e s s on l i t e r a l s : )
f u n l i t L e s s (ATOM ( a ) , ATOM ( b ) )
=
| l i t L e s s (NOT(ATOM a ) , NOT(ATOM b ) ) =
( every negative l i t e r a l i s smaller
| l i t L e s s (NOT(ATOM a ) , ATOM ( b ) )
=
| l i t L e s s (ATOM ( a ) , NOT(ATOM b ) )
=
a < b ( l e x i c o g r a p h i c )
a < b
than every p o s i t i v e l i t e r a l )
true
false
( Extend t h e o r d e r i n g to l i s t s of l i t e r a l s )
fun c l a u s e L e s s ( [ ] , [ ] )
| clauseLess ([] ,
)
| clauseLess ( ,
[])
H OME PAGE
JJ
= false
= true
= false
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
234 OF 788
Q UIT
| c l a u s e L e s s ( h1 : : T1 , h2 : : T2 ) =
( l i t L e s s ( h1 , h2 ) ) o r e l s e
( ( h1=h2 ) a n d a l s o c l a u s e L e s s ( T1 , T2 ) )
( D e f i n e mergeSortRD t o remove d u p l i c a t e s a s s o r t i n g p r o c e e d s )
f u n mergeSortRD R [ ] = [ ]
| mergeSortRD R [ h ] = [ h ]
| mergeSortRD R L = ( can t s p l i t a l i s t u n l e s s i t h a s > 1 e l e m e n t )
l e t fun s p l i t [ ] = ( [ ] , [ ] )
| split [h] = ([h] , [])
| s p l i t ( h1 : : h2 : : t ) =
l e t val ( left , right ) = s p l i t t ;
i n ( h1 : : l e f t , h2 : : r i g h t )
end ;
val ( left , right ) = s p l i t L;
f u n mergeRD ( R , [ ] , [ ] ) = [ ]
| mergeRD ( R , [ ] , L2 ) = L2
| mergeRD ( R , L1 , [ ] ) = L1
| mergeRD ( R , ( L1 a s h1 : : t 1 ) , ( L2 a s h2 : : t 2 ) ) =
i f h1=h2 t h e n mergeRD ( R , t 1 , L2 ) ( remove a copy )
e l s e i f R( h1 , h2 ) t h e n h1 : : ( mergeRD ( R , t 1 , L2 ) )
e l s e h2 : : ( mergeRD ( R , L1 , t 2 ) ) ;
v a l s o r t e d L e f t = mergeSortRD R l e f t ;
v a l s o r t e d R i g h t = mergeSortRD R r i g h t ;
i n mergeRD ( R , s o r t e d L e f t , s o r t e d R i g h t )
end ;
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
235 OF 788
Q UIT
( Now s o r t t h e l i s t o f l i s t s o f l i t e r a l s r e m o v i n g d u p l i c a t e s )
f u n s o r t R D LL = ( F i r s t s o r t e a c h c l a u s e and t h e n t h e l i s t o f c l a u s e s )
l e t v a l s o r t e d C l a u s e s = map ( mergeSortRD l i t L e s s ) LL
i n mergeSortRD c l a u s e L e s s s o r t e d C l a u s e s
end ;
( P u t t i n g everything t o g e t h e r )
fun p r o p 2 l i s t l i s t P =
end ( s t r u c t ) ;
open PL ;
( T e s t i n g p r o p 2 l i s t l i s t ====================================
val
god = ATOM T h e r e i s a God ;
v a l god = ATOM T h e r e i s a God : P r o p
val
o s c i e n t = ATOM God i s o m n i s c i e n t ;
val
o p o t e n t = ATOM God i s o m n i p o t e n t ;
val
e v i l = ATOM T h e r e i s E v i l ;
val
know = ATOM God knows t h e r e i s E v i l ;
val
p r e v e n t = ATOM God p r e v e n t s E v i l ;
val
val
val
val
val
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
236 OF 788
Q UIT
v a l o s c i e n t = ATOM God i s o m n i s c i e n t : P r o p
GC # 0 . 0 . 0 . 1 . 7 . 1 8 7 :
( 1 ms )
v a l o p o t e n t = ATOM God i s o m n i p o t e n t : P r o p
v a l e v i l = ATOM T h e r e i s E v i l : P r o p
v a l know = ATOM God knows t h e r e i s E v i l : P r o p
v a l p r e v e n t = ATOM God p r e v e n t s E v i l : P r o p
v a l hy1 = IMP (ATOM T h e r e i s a God ,AND (ATOM # ,ATOM # ) ) : P r o p
v a l hy2 = IMP (ATOM God i s o m n i s c i e n t ,ATOM God knows t h e r e i s E v i l ) : P r o p
v a l hy3 = IMP (ATOM God i s o m n i p o t e n t ,ATOM God p r e v e n t s E v i l ) : P r o p
v a l hy4 = ATOM T h e r e i s E v i l : P r o p
v a l c o n c = NOT (ATOM T h e r e i s a God ) : P r o p
p r o p 2 l i s t l i s t hy1 ;
val i t =
[ [ NOT (ATOM T h e r e i s a God ) ,ATOM God i s o m n i p o t e n t ] ,
[NOT (ATOM T h e r e i s a God ) ,ATOM God i s o m n i s c i e n t ] ] : P r o p l i s t l i s t
p r o p 2 l i s t l i s t hy2 ;
v a l i t = [ [ NOT (ATOM God i s o m n i s c i e n t ) ,ATOM God knows t h e r e i s E v i l ] ]
: Prop l i s t l i s t
v a l andhyp = AND ( hy1 , AND ( hy2 , AND( hy3 , hy4 ) ) ) ;
v a l andhyp = AND ( IMP (ATOM # ,AND # ) ,AND ( IMP # ,AND # ) ) : P r o p
p r o p 2 l i s t l i s t andhyp ;
val i t =
[ [ NOT (ATOM God i s o m n i p o t e n t ) ,ATOM God p r e v e n t s E v i l ] ,
[NOT (ATOM God i s o m n i s c i e n t ) ,ATOM God knows t h e r e i s E v i l ] ,
[NOT (ATOM T h e r e i s a God ) ,ATOM God i s o m n i p o t e n t ] ,
[NOT (ATOM T h e r e i s a God ) ,ATOM God i s o m n i s c i e n t ] ,
[ATOM T h e r e i s E v i l ] ] : P r o p l i s t l i s t
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
237 OF 788
Q UIT
v a l a = ATOM a ;
v a l a = ATOM a : P r o p
v a l b = ATOM b ;
v a l b = ATOM b : P r o p
v a l c = ATOM c ;
v a l c = ATOM c : P r o p
v a l one = IMP ( a , OR ( a , a ) ) ;
v a l one = IMP (ATOM a ,OR (ATOM # ,ATOM # ) ) : P r o p
v a l two = EQL( b , OR( b , NOT( b ) ) ) ;
v a l two = EQL (ATOM b ,OR (ATOM # ,NOT # ) ) : P r o p
v a l t h r e e = EQL(AND( a , a ) , OR(NOT( a ) , OR( a , NOT( a ) ) ) ) ;
GC # 0 . 0 . 0 . 1 . 8 . 2 2 1 :
( 1 ms )
v a l t h r e e = EQL (AND (ATOM # ,ATOM # ) ,OR (NOT # ,OR # ) ) : P r o p
val p2ll = p r o p 2 l i s t l i s t ;
v a l p 2 l l = f n : P r o p > P r o p l i s t l i s t
p 2 l l one ;
v a l i t = [ [ NOT (ATOM a ) ,ATOM a ] ] : P r o p l i s t l i s t
p 2 l l two ;
v a l i t = [ [ NOT (ATOM b ) ,ATOM b ] , [ATOM b ] ] : P r o p l i s t l i s t
p2ll three ;
v a l i t = [ [ NOT (ATOM a ) ,ATOM a ] , [ATOM a ] ] : P r o p l i s t l i s t
p 2 l l (OR( one , OR( two , t h r e e ) ) ) ;
val i t =
[ [ NOT (ATOM a ) ,NOT (ATOM b ) ,ATOM a ,ATOM b ] ,
[NOT (ATOM a ) ,ATOM a ,ATOM b ] ] : P r o p l i s t l i s t
=============================================================== )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
238 OF 788
Q UIT
Falsifying CNF
1. Suffices to find a falsification of at least one conjunct
2. A conjunct in the CNF can be false iff all the disjuncts in it are
false.
3. A disjunct is false iff it does not contain a complementary
pair.
Wni
Vm
Assume the CNF is Q i=1 Di where each Di j=1 Lij
where the literals of Di = Pi Ni where Pi is the set of positive literals (atoms) and Ni consists of the atoms appearing as
negative literals.
Then Di is false iff Pi Ni = .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
239 OF 788
Q UIT
tautology1.sml
s i g n a t u r e PropLogic =
sig
exception Atom exception
d a t a t y p e Prop =
ATOM o f s t r i n g
|
NOT o f P r o p
|
AND o f P r o p P r o p |
OR o f P r o p P r o p |
IMP o f P r o p P r o p |
EQL o f P r o p P r o p
t y p e Argument = P r o p l i s t P r o p
v a l show
: P r o p > u n i t
v a l showArg : Argument > u n i t
v a l f a l s i f y A r g : Argument > P r o p l i s t l i s t
val Valid
: Argument > b o o l P r o p l i s t l i s t
end ;
( P r o p o s i t i o n a l formulas )
s t r u c t u r e PL : P r o p L o g i c =
( s t r u c t u r e PL = ) ( T h i s i s f o r d e b u g g i n g p u r p o s e s o n l y )
struct
d a t a t y p e Prop =
ATOM o f s t r i n g
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
240 OF 788
Q UIT
NOT o f P r o p
AND o f P r o p P r o p
OR o f P r o p P r o p
IMP o f P r o p P r o p
EQL o f P r o p P r o p
|
|
|
|
;
exception Atom exception ;
f u n newatom ( s ) = i f s = "" t h e n r a i s e A t o m e x c e p t i o n
e l s e (ATOM s ) ;
f u n drawChar ( c , n ) =
i f n>0 t h e n ( p r i n t ( s t r ( c ) ) ; drawChar ( c , ( n 1 ) ) )
else ();
f u n show ( P ) =
let
f u n drawTabs ( n ) = drawChar ( # "\t" , n ) ;
f u n s h o w T r e e T a b s (ATOM a , n ) = ( drawTabs ( n ) ;
print (a );
p r i n t ( "\n" )
)
|
s h o w T r e e T a b s (NOT ( P ) , n ) = ( drawTabs ( n ) ; p r i n t ( "NOT" ) ;
s h o w T r e e T a b s ( P , n + 1)
)
|
s h o w T r e e T a b s (AND ( P , Q) , n ) =
( showTreeTabs ( P , n + 1 ) ;
drawTabs ( n ) ; p r i n t ( "AND\n" ) ;
s h o w T r e e T a b s (Q, n + 1)
)
|
s h o w T r e e T a b s (OR ( P , Q) , n ) =
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
241 OF 788
Q UIT
( showTreeTabs ( P , n + 1 ) ;
drawTabs ( n ) ; p r i n t ( "OR\n" ) ;
s h o w T r e e T a b s (Q, n + 1)
)
|
in
s h o w T r e e T a b s ( IMP ( P , Q) , n ) =
( showTreeTabs ( P , n + 1 ) ;
drawTabs ( n ) ; p r i n t ( "IMPLIES\n" ) ;
s h o w T r e e T a b s (Q, n + 1)
)
s h o w T r e e T a b s (EQL ( P , Q) , n ) =
( showTreeTabs ( P , n + 1 ) ;
drawTabs ( n ) ; p r i n t ( "IFF\n" ) ;
s h o w T r e e T a b s (Q, n + 1)
)
;
( p r i n t ( "\n" ) ; s h o w T r e e T a b s ( P , 0 ) ; p r i n t ( "\n" ) )
end
;
( The f u n c t i o n below e v a l u a t e s a f o r m u l a g i v e n a t r u t h a s s i g n m e n t .
The t r u t h a s s i g n m e n t i s g i v e n a s a l i s t o f a t o m s t h a t a r e a s s i g n e d
t r u e ( i m p l i c i t l y a l l o t h e r a t o m s a r e assume d t o h a v e b e e n
assigned false ).
)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
242 OF 788
Q UIT
f u n l o o k u p ( x : Prop , [ ] ) = f a l s e
|
lookup ( x , h : : L) =
i f ( x = h ) then true
e l s e lookup ( x , L)
;
fun
|
|
|
|
|
;
eval
eval
eval
eval
eval
eval
( We
)
(ATOM a , L ) = l o o k u p (ATOM a , L )
(NOT ( P ) , L ) = i f e v a l ( P , L ) t h e n f a l s e e l s e t r u e
(AND ( P , Q) , L ) = e v a l ( P , L ) a n d a l s o e v a l (Q, L )
(OR ( P , Q) , L ) = e v a l ( P , L ) o r e l s e e v a l (Q, L )
( IMP ( P , Q) , L ) = e v a l (OR (NOT ( P ) , Q) , L )
(EQL ( P , Q) , L ) = ( e v a l ( P , L ) = e v a l (Q, L ) )
f i r s t c o n v e r t e v e r y p r o p o s i t i o n i n t o a n o r m a l form .
( F i r s t r e w r i t e i m p l i c a t i o n s and e q u i v a l e n c e s )
fun
|
|
|
|
|
;
H OME PAGE
rewrite
rewrite
rewrite
rewrite
rewrite
rewrite
JJ
(ATOM a )
(NOT ( P ) )
(AND ( P , Q ) )
(OR ( P , Q ) )
( IMP ( P , Q ) )
(EQL ( P , Q ) )
=
=
=
=
= ATOM a
= NOT ( r e w r i t e ( P ) )
AND ( r e w r i t e ( P ) , r e w r i t e (Q ) )
OR ( r e w r i t e ( P ) , r e w r i t e (Q ) )
OR (NOT ( r e w r i t e ( P ) ) , r e w r i t e (Q ) )
r e w r i t e (AND ( IMP ( P , Q) , IMP (Q, P ) ) )
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
243 OF 788
Q UIT
nnf
nnf
nnf
nnf
nnf
nnf
nnf
(ATOM a )
= ATOM a
(NOT (ATOM a ) )
= NOT (ATOM a )
(NOT (NOT ( P ) ) )
= nnf ( P )
(AND ( P , Q ) )
= AND ( n n f ( P ) , n n f (Q ) )
(NOT (AND ( P , Q ) ) ) = n n f (OR (NOT ( P ) , NOT (Q ) ) )
(OR ( P , Q ) )
= OR ( n n f ( P ) , n n f (Q ) )
(NOT (OR ( P , Q ) ) ) = n n f (AND (NOT ( P ) , NOT (Q ) ) )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
244 OF 788
Q UIT
( A p r o p o s i t i o n i n CNF i s a t a u t o l o g y
iff
Every c o n j u n c t i s a t a u t o l o g y
iff
E v e r y d i s j u n c t i n e v e r y c o n j u n c t c o n t a i n s b o t h p o s i t i v e and n e g a t i v e
l i t e r a l s o f a t l e a s t one atom
So we c o n s t r u c t t h e l i s t o f a l l t h e p o s i t i v e and n e g a t i v e a t o m s i n e v e r y
d i s j u n c t t o c h e c k w h e t h e r t h e l i s t s a r e a l l e q u a l . We n e e d a b i n a r y
f u n c t i o n on l i s t s t o d e t e r m i n e w h e t h e r two l i s t s a r e d i s j o i n t
)
fun i s P r e s e n t ( a , [ ] ) = f a l s e
|
i s P r e s e n t ( a , b : : L) = ( a = b ) o r e l s e i s P r e s e n t ( a , L)
;
f u n d i s j o i n t ( [ ] , M) = t r u e
|
d i s j o i n t (L, [ ] ) = true
|
d i s j o i n t ( L a s a : : LL , M a s b : :MM) =
n o t ( i s P r e s e n t ( a , M) ) a n d a l s o
not ( i s P r e s e n t (b , L ) )
andalso
d i s j o i n t ( LL , MM)
;
( ABHISHEK : D e f i n i n g a t o t a l o r d e r i n g on a t o m s ( l e x i c o g r a p h i c
o r d e r i n g on u n d e r l y i n g s t r i n g s ) , and e x t e n d i n g i t t o a l i s t o f a t o m s .
)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
245 OF 788
Q UIT
e x c e p t i o n notAtom ;
fun atomLess ( a , b ) = case ( a , b ) of
(ATOM( x ) , ATOM( y ) ) => x<y
| ( , )
=> r a i s e notAtom ;
fun l i s t L e s s ( a , b ) = case
( , [])
| ([] ,
)
| ( x : : lx , y : : l y )
(a ,
=>
=>
=>
b ) of
false
true
i f atomLess ( x , y ) then t r u e
e l s e i f atomLess ( y , x ) then f a l s e
e l s e l i s t L e s s ( lx , l y ) ;
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
246 OF 788
Q UIT
e l s e i f l e s s ( y , x ) t h e n y : : merge l e s s ( x : : l 1 , l 2 )
e l s e merge l e s s ( x : : l 1 , l 2 ) ;
( ABHISHEK : Claim i s t h a t i f a l l l i s t s a r e b u i l t t h r o u g h t h e a b o v e
f u n c t i o n , t h e n t h e r e i s no n e e d t o s o r t o r remove d u p l i c a t e s .
Hence a l l @ o p e r a t i o n s h a v e b e e n r e p l a c e d by merge .
)
e x c e p t i o n not CNF ;
fun
|
|
|
;
positives
positives
positives
positives
(ATOM a )
= [ATOM a ]
(NOT (ATOM ) ) = [ ]
(OR ( P , Q ) )
= merge a t o m L e s s ( p o s i t i v e s ( P ) , p o s i t i v e s (Q ) )
(P)
= r a i s e not CNF
fun
|
|
|
;
negatives
negatives
negatives
negatives
=
(ATOM )
(NOT (ATOM a ) ) =
(OR ( P , Q ) )
=
(P)
=
[]
[ATOM a ]
merge a t o m L e s s ( n e g a t i v e s ( P ) , n e g a t i v e s (Q ) )
r a i s e not CNF
( Check w h e t h e r a f o r m u l a i n CNF i s a t a u t o l o g y )
f u n t a u t (AND ( P , Q ) ) = t a u t ( P ) a n d a l s o t a u t (Q)
|
t a u t ( P ) = ( i f i t i s n o t a c o n j u n c t i o n t h e n i t must be a d i s j u n c t )
not ( d i s j o i n t ( p o s i t i v e s (P ) , negatives (P ) ) )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
247 OF 788
Q UIT
;
fun t a u t o l o g y 1 ( P ) =
l e t val Q = cnf (P)
in
t a u t (Q)
end
;
( The main p r o b l e m w i t h t h e a b o v e i s t h a t i t c h e c k s w h e t h e r a g i v e n
p r o p o s i t i o n i s a t a u t o l o g y , but whenever i t i s not , i t does not y i e l d
a f a l s i f y i n g t r u t h a s s i g n m e n t . We r e c t i f y t h i s p r o b l e m below .
)
(
F i r s t l y , a s i n t h e c a s e o f t h e f u n c t i o n l o o k u p , we w i l l assume a t r u t h
a s s i g n m e n t i s a l i s t o f a t o m s which a r e a s s i g n e d t h e t r u t h v a l u e t r u e
and t h a t any atom t h a t i s n o t p r e s e n t i n t h e l i s t h a s b e e n a s s i g n e d
false .
Assume Q i s a p r o p o s i t i o n i n CNF . Then i t i s o n l y n e c e s s a r y t o l i s t o u t
a l l t h e l i s t s of t r u t h a s s i g n m e n t s t h a t can f a l s i f y Q.
S u p p o s e Q i s i n CNF , b u t n o t n e c e s s a r i l y a t a u t o l o g y . F u r t h e r l e t
Q = AND ( D1 ,
. . . , Dn )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
248 OF 788
Q UIT
P i and Ni a r e t h e l i s t s o f a t o m s d e n o t i n g t h e p o s i t i v e and n e g a t i v e
literals respectively .
Q would be f a l s i f i e d i f a t l e a s t one o f t h e Di c a n be made f a l s e . Di
c a n be made f a l s e o n l y i f i t d o e s n o t c o n t a i n a c o m p l e m e n t a r y p a i r ,
i . e . t h e r e e x i s t s no atom a s u c h t h a t b o t h a and a o c c u r i n Di . Hence
f o r Di t o be f a l s i f i e d i t i s n e c e s s a r y t h a t t h e l i s t s P i and Ni a r e
d i s j o i n t ( i f t h e r e i s no atom common t o P i and Ni , t h e r e i s no
c o m p l e m e n t a r y p a i r i n Di .
S i n c e Di i s a d i s j u n c t i o n o f l i t e r a l s , i t c a n be f a l s i f i e d o n l y by
a s s i g n i n g e v e r y l i t e r a l i n Di t h e v a l u e f a l s e . T h i s c a n be done o n l y
by a s s i g n i n g a l l t h e a t o m s i n P i t h e v a l u e f a l s e and a l l t h e a t o m s
i n Ni t h e v a l u e t r u e .
I n o t h e r words , i f P i and Ni a r e d i s j o i n t , t h e n Ni i s a t r u t h
a s s i g n m e n t which f a l s i f i e s t h e p r o p o s i t i o n Q . We r e f e r t o Ni a s a
FALSIFIER o f Q .
T h e r e f o r e t h e FALSIFIERS o f Q a r e e x a c t l y t h e l i s t o f n e g a t i v e a t o m s
o f e a c h d i s j u n c t which d o e s n o t c o n t a i n a c o m p l e m e n t a r y p a i r . By
c h e c k i n g e a c h d i s j u n c t i n Q we may l i s t o u t ALL t h e p o s s i b l e
FALSIFIERS o f Q .
I f Q h a s no FALSIFIER t h e n no d i s j u n c t Di c a n be made f a l s e i . e . e v e r y
d i s j u n c t d o e s i n d e e d h a v e a compementary p a i r . We may t h e n c o n c l u d e
that Q is a tautology .
)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
249 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
250 OF 788
Q UIT
(
We may u s e t h e t a u t o l o g y c h e c k e r t o p r o v e v a r i o u s a r g u m e n t s
l o g i c a l l y v a l i d o r l o g i c a l l y i n v a l i d . An a r g u m e n t c o n s i s t s
o f a s e t o f p r o p o s i t i o n s c a l l e d t h e h y p o t h e s e s and a ( s i n g l e )
p r o p o s i t i o n c a l l e d t h e c o n c l u s i o n . L o o s e l y s p e a k i n g , an a r g u m e n t
i s s i m i l a r t o a t h e o r e m o f m a t h e m a t i c s . The a r g u m e n t
i s l o g i c a l l y v a l i d i f the conclusion i s a l o g i c a l consequence of
o f t h e h y p o t h e s e s . More a c c u r a t e l y , i f i n e v e r y t r u t h a s s i g n m e n t
which makes a l l t h e h y p o t h e s e s t r u e , t h e c o n c l u s i o n i s a l s o i n v a r i a b l y
t r u e then the argument i s l o g i c a l l y v a l i d .
S y m b o l i c a l l y i f H1 , . . . , Hm a r e p r o p o s i t i o n s and C i s a n o t h e r
p r o p o s i t i o n t h e n t h e a r g u m e n t ( { H1 , . . . , Hm} , C) i s l o g i c a l l y
v a l i d ( e q u i v a l e n t l y , C i s a l o g i c a l c o n s e q u e n c e o f {H1 , . . . , Hm} )
i f and o n l y i f t h e ( compound ) p r o p o s i t i o n
( H1 / \
...
/ \ Hm) => C
is a tautology .
An a r g u m e n t which i s n o t l o g i c a l l y v a l i d i s l o g i c a l l y
i n v a l i d . I n p a r t i c u l a r i f t h e r e e x i s t s a t r u t h a s s i g n m e n t u n d e r which
a l l the hypotheses are t r u e but the conclusion i s false , then the
argument i s i n v a l i d .
Any a r g u m e n t i s t r i v i a l l y l o g i c a l l y v a l i d i f t h e r e i s no t r u t h
a s s i g n m e n t u n d e r which e v e r y h y p o t h e s i s i s t r u e . I n o t h e r words ,
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
251 OF 788
Q UIT
i f t h e s e t o f h y p o t h e s e s i s an i n c o n s i s t e n t s e t t h e n r e g a r d l e s s
o f what t h e c o n c l u s i o n i s , t h e a r g u m e n t i s a l w a y s l o g i c a l l y v a l i d .
The s e t o f h y p o t h e s e s {H1 , . . . , Hm} i s i n c o n s i s t e n t i f and o n l y i f
( H1 / \ . . . / \ Hm) i s a c o n t r a d i c t i o n ( i t i s f a l s e f o r e v e r y t r u t h
assignment ) .
)
t y p e Argument = P r o p l i s t P r o p ;
f u n showArg (A: Argument ) =
l e t f u n p r i n t A r g (A: Argument a s ( [ ] , c ) ) =
( drawChar ( # "-" , 8 0 ) ; p r i n t ( "\n" ) ;
show ( c ) ; p r i n t ( "\n\n" )
)
|
p r i n t A r g (A: Argument a s ( p : : p l i s t , c ) ) =
( show ( p ) ; p r i n t ( "\n" ) ;
printArg ( plist , c )
)
i n ( p r i n t ( "\n\n" ) ; p r i n t A r g (A ) )
end
;
fun l e f t R e d u c e ( F ) =
l e t exception emptylist ;
fun l r ( [ ] ) = r a i s e e m p t y l i s t
|
lr ([ a ]) = a
|
l r ( a : : L) = F ( a , l r (L ) )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
252 OF 788
Q UIT
in
lr
end
;
v a l bigAND = l e f t R e d u c e (AND ) ;
f u n V a l i d ( ( L , P ) : Argument ) =
i f n u l l (L) then tautology (P)
e l s e t a u t o l o g y ( IMP ( bigAND ( L ) , P ) )
;
f u n f a l s i f y A r g ( ( L , P ) : Argument ) =
i f n u l l (L) then f a l s i f y ( cnf (P ) )
e l s e f a l s i f y ( c n f ( IMP ( bigAND ( L ) , P ) ) )
;
end ( s t r u c t ) ;
( open PL ; )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
253 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
254 OF 788
Q UIT
Lecture 7: Propositional
Unsatisfiability
Wednesday 10 August 2011
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
255 OF 788
Q UIT
1. Tautology Checking
2. CNFs: Set of Sets of Literals
3. Propositional Resolution
4. Clean-up
5. The Resolution Method
6. The Algorithm
7. Resolution Examples: Biconditional
8. Resolution Examples: Exclusive-Or
9. Resolution Refutation: 1
10. Resolution Refutation: 2
11. Resolvent as Logical Consequence
12. Logical Consequence by Refutation
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
256 OF 788
Q UIT
Tautology Checking
1. Involves conversion of IMP (bigAND H, conc1) into CNF
which increases the size of the formula.
2. Involves checking falsifiability of the argument.
3. CNF can be obtained more easily for the formula (. . . ((1
2) 3) . . . n)
Convert each individual i and to CNF
and then append all the lists to obtain the required list.
4. More efficient to use theorem 4.3.2 if the technique involves
CNF.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
257 OF 788
Q UIT
i
1im
i,j
1jni
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
258 OF 788
Q UIT
Note: For the sake of brevity we will abuse notation by identifying a clause (set of literals) with the
formula denoting their disjunction and a set of clauses with the formula denoting their conjunction.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
259 OF 788
Q UIT
Propositional Resolution
V
To show
V |= we show that is false by first transforming to a formula in CNF.
This CNF is represented as a set of sets of literals. Let be the
set of sets of literals.
1. Each set C is called a clause.
2. Each clause in represents a disjunction of literals.
3. The empty clause {} represents a contradiction.
4. The unsatisfiability of the set is shown by deriving the
empty clause.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
260 OF 788
Q UIT
Clean-up
Let be a finite set of clauses.
1. For all clauses C, C 0, if C C 0, then C 0 may be deleted from
without affecting logical equivalence.
2. Any clause containing complementary pairs of literals, may
be deleted from without affecting logical equivalence.
3. From any clause, duplicate occurrences of a literal may be
deleted without affecting logical equivalence.
The resulting clause set 0 is said to be clean.
^
H OME PAGE
JJ
LC L
II
LCS
C 00
G O B ACK
L0C 0 L
F ULL S CREEN
C LOSE
261 OF 788
Q UIT
resolve(, p) = ( ( ))
{D | D = (C {p}) (C {p}), C , C }
is called the resolvent.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
262 OF 788
Q UIT
T JDK = (
1jn,j6=j0
1im,i6=i0
H OME PAGE
JJ
T J1,iK )+(
I
X
1jn
LCS
G O B ACK
F ULL S CREEN
C LOSE
QED
263 OF 788
Q UIT
The Algorithm
Require: a clean set of clauses
1: while ({} 6 ) (p, p) do
2:
0 := resolve(, p)
3:
:= Clean-up(0)
4: end while
Note:
1. {} is the empty clause which represents the proposition (it
represents the disjunction of an empty set of literals).
2. The presence of the empty clause in a set of clauses also
indicates the unsatisfiability of the set of clauses.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
264 OF 788
Q UIT
Theorem 7.4 Given a clean non-empty set 0 of non-empty clauses, the propositional resolution
algorithm terminates in at most |atoms(0)| iterations, deriving either an empty clause or a set of
non-empty clauses which are satisfied by every model of the original set 0.
Proof: Since in each iteration one atom and its negation are completely eliminated, |atoms(0)| is
the number of iterations possible. Further by applying lemma 7.2 to the result of each iteration we
get that satisfiability and logical implication are preserved.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
265 OF 788
Q UIT
Assume n is the number of atoms of which is made up. After some iterations of resolution and
cleanup, assume there are k distinct atoms in the set of clauses on which resolution is applied. After
performing the cleanup procedure there could be at most 2k clauses with each clause containing at
most k literals. Assuming each literal occupies a unit of memory, the space requirement is given by
size() = 2k k literals.
For any complementary pair (p, p), it is possible that at most half of the 2k (i.e. 2k1) clauses
contain p and the other half contain p. This would be the worst-case scenario, as it yields the
maximum number of new clauses. Therefore in performing a single step of resolution over all
possible pairs of clauses to yield a new set 0 of clauses, a maximum of 2k1 2k1 unions of distinct
pairs of clauses needs to be performed. Before applying the clean-up procedure the space required
could be as high as 2k1 2k1 = 22(k1) > 2k k for k > 4. But since 0 is made up of at most (k 1)
atoms, size(0) 2k1(k 1), after clean-up the space requirement reduces to 2k1(k 1). Since
k n the maximum space required after the first application of resolution and before cleaning up
exceeds the space required for all other iterations and is bounded by 22(n1) = O(22n).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
266 OF 788
Q UIT
Given a space of 2k k to represent the clauses containing at most k atoms, we require a time proportional to this amount of space in order to identify which clauses have to be resolved against a
particular complementary pair. After resolution we create a space of 22(k1) which has to be scanned
for the cleanup operations. Hence the amount of time required to perform a step of resolution and
the amount of time required to perform the cleanup are both proportional to 22(k1). Hence the total
time required for performing resolution followed by cleanup in n iterations (which is the maximum
possible) is given by
Pn 2k2
T (n)
k=1 2
which is clearly exponential.
Hence both the worst case time and space complexities are exponential in the number of atoms.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
267 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
268 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
269 OF 788
Q UIT
Resolution Refutation: 1
Example 7.7 Consider the simple logical consequence
p q |= p
which we prove by resolution refutation. The set of clauses representing the hypothesis and the negation of the conclusion is
{{p}, {q}, {p}}. Resolving on the pair (p, p) yields
{{}, {q}}
Notice that {} {{}, {q}}.
Since for any clause C 6= , C {}, the clean-up always reduces every set of clauses to {{}} whenever {} .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
270 OF 788
Q UIT
Resolution Refutation: 2
Example 7.8 Consider the simple logical consequence
p q |= p q
which we prove by resolution refutation. Negating the conclusion yields p q {{p, q}, {p, q}}. The set of clauses representing the hypothesis and the negation of the conclusion is
{{p}, {q}, {p, q}, {p, q}} which after clean-up yields
{{p}, {q}, {p, q}}
Resolving on the pair (p, p) produces
{{q}, {q}}
and then on the pair (q, q) produces the empty clause {{}}.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
271 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
272 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
273 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
274 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
275 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
276 OF 788
Q UIT
1. Against Resolution
2. The Analytic Tableau Method
3. Basic Tableaux Facts
4. Tableaux Rules
5. Structure of the Rules
6. Tableaux
7. Slim Tableaux
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
277 OF 788
Q UIT
Against Resolution
1. For any argument, it was still necessary to transform the argument into a mammoth formula in CNF in order to be able
to perform resolution.
2. The numbers of clauses and sizes of clauses could temporarily increase as a result of resolution.
3. Termination relied on the reduction of the number of atoms
at each step of resolution.
4. Resolution also requires a clean-up of the initial set of
clauses to work correctly.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
278 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
279 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
T JK = 0 = T JK
T JK = 1 = T JK
F ULL S CREEN
C LOSE
280 OF 788
Q UIT
Tableaux Rules
( )
.
( )
.
( )
.
.
( )
.
.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
281 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
282 OF 788
Q UIT
Tableaux
1. A tableau is a tree where each path of the tableau represents
a conjunction of unbroken formulae.
2. Each application of the tableaux rules preserves satisfiability
of the conjunction of unbroken formulae in each path.
3. A path of the tableau is closed if it contains a complementary
pair (the conjunction of the formulae in the path is clearly
unsatisfiable).
4. The result of applying a tableau rule to an ancestor node has
to be distributed in all branches of its descendants.
5. A tableau is closed if every path in the tableau is closed signifying that the original set of formulae is unsatisfiable.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
283 OF 788
Q UIT
Slim Tableaux
1. Any formula which has been broken up by a tableau rule may
be discarded.
2. Any branch which has been closed may be discarded.
3. Any formula which dominates several branches of the
tableau creates multiple copies (one in each branch of its
descendants) when it is broken up.
By applying the elongation rules first the number of branches
over which elongation rules have to be replicated can be reduced
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
284 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
285 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
286 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
287 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
288 OF 788
Q UIT
Elongation.
Branching.
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
289 OF 788
Q UIT
Tableaux Rules: 2
{, }
{}
.
.
{}
{}
{ }
{( )}
.
.
{, }
{} {}
{ }
{( )}
.
.
{, }
{} {}
{ }
{( )}
.
.
{, }
{} {}
{ }
.
{ } { }
{( )}
.
{ } { }
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
290 OF 788
Q UIT
Tableau Proofs
1. A tableau is a tree rooted at a node containing a set of
formulas
2. Each application of
0
path to ,
a branching rule
to a leaf of the tableau extends the
0 00
tableau to two leaves 0 and 00.
3. A path of the tableau is closed if its leaf is {}.
4. The tableau is closed if every path is closed, otherwise the
the tableau is open.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
291 OF 788
Q UIT
Consistency
Definition 9.1 A set of formulas is consistent if it is satisfiable
i.e. there is a truth assignment under which every formula of
is true. Otherwise, it is inconsistent.
Fact 9.2 Every non-empty subset of a consistent set is also
consistent
Lemma 9.3 Each tableau rule preserves satisfiability in the following sense.
the denominator 0.
Branching Rules (
) If the numerator is satisfiable then
0
00
at least one of the denominators 0 or 00 is satisfiable.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
292 OF 788
Q UIT
Branching Rules 0 00 . if every formula in is true under then every formula in 0 or every formula in 00 is true
|
under .
Elongation Rules
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
293 OF 788
Q UIT
Unsatisfiability
Definition 9.4 A tableau is completed if no leaf in any path may
be extended.
Corollary 9.5 If is satisfiable then there exists a completed
tableau rooted at which has a satisfiable leaf.
Corollary 9.6 A set is unsatisfiable if there exists a closed
tableau rooted at .
Question. If a completed tableau rooted at is closed could there be
other completed tableaux rooted at which might be open?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
294 OF 788
Q UIT
Hintikka Sets
Definition 9.7 A finite or infinite set is a Hintikka set if
1. 6 and for any p A, {p, p} 6 ,
2. If for {, , } then { 0, 0} ,
3. If for {, , , , } then { 0, 0}
6=
where 0 and 0 are defined by the following table
0 0
0
0
( )
( )
( )
( )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
295 OF 788
Q UIT
Hintikkas Lemma
Lemma 9.8 Every Hintikka set is satisfiable.
Proof: Let be a Hintikka set. For any atom p, since {p, p} 6
, consider the following truth assignment .
1. (p) = 1 if p ,
2. (p) = 0 if p and
3. if {p, p} = then choose any value (say 1 for definiteness).
We may then show by induction on the degree of formulae in
that each formula in is satisfiable.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
296 OF 788
Q UIT
Proof:
We may prove that each rule in Tableaux Rules: 2
creates a path for the construction of Hintikka sets.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
297 OF 788
Q UIT
Completeness
Theorem 9.10 Completeness of the Tableau Method
1. If is a tautology then every completed tableau rooted at
{} is closed.
2. Every tautology is provable by the tableau method.
Proof:
1. Suppose T is a completed tableau rooted at {} which is
open. Then by corollary 9.5 must be satisfiable and hence
cannot be a tautology. Hence T must be closed.
2. If is a tautology that cannot be proved by the tableau
method, there must exist a completed tableau rooted at {}
which has an open path. But that implies {} is satisfiable
which implies that is not a tautology.
H OME PAGE
JJ
QED
I
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
298 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
299 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
300 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
301 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
302 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
303 OF 788
Q UIT
Corollary 10.4 Any (finite or infinite) set of formulae is satisfiable iff all its non-empty finite subsets are satisfiable.
Note:
If is a countably infinite set then it can be placed in 1-1
correspondence with the set N of naturals and hence there
is some enumeration of its formulae and each formula carries
an unique index from N.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
304 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
305 OF 788
Q UIT
be the set of all formulae in this path. Since this path contains each of the formulae i , we
have and further is a Hintikka set. By Hintikkas lemma 9.8 this set must be satisfiable.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
306 OF 788
Q UIT
Inconsistency
Corollary 10.5 A set is inconsistent if some nonempty finite
subset of is unsatisfiable.
Proof: Follows from the compactness theorem 10.3 and its
corollary 10.4.
QED
Facts 10.6
1. Any superset of an inconsistent set is also inconsistent.
2. Any set containing a complementary pair is inconsistent.
3. (see table) If { 0, 0} is inconsistent then so is {}
where
4. (see table) If both { 0} and {0} are inconsistent then
so is {} where .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
307 OF 788
Q UIT
Consequences of Compactness
Corollary 10.7 Given a finite or infinite set , and a formula
1. {} is inconsistent iff there exists = {i | 1 i
n} f , n 0, such that {} is inconsistent.
V
2. |= iff |= iff ( ) is a tautology, for some =
{i | 1 i n} f .
Hence
1. to show that an argument is valid it suffices to prove that the
conclusion follows from a finite subset of the hypotheses.
2. to show invalidity of an argument it suffices to find a finite
subset of the hypotheses which are inconsistent with the conclusion.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
308 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
309 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
310 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
311 OF 788
Q UIT
1. Consistent Sets
2. Properties of Finite Character: 1
3. Properties of Finite Character: 2
4. Properties of Finite Character: 3
5. Maximally Consistent Sets
6. Lindenbaums Theorem
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
312 OF 788
Q UIT
Consistent Sets
Lemma 11.1 If is a consistent set then for any formula at
least one of the two sets 1 = {} or 0 = {} is
consistent.
2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
313 OF 788
Q UIT
H OME PAGE
JJ
QED
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
314 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
315 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
316 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
317 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
318 OF 788
Q UIT
claim above that S
p and from the construction of each Si, that Si
p for each i 0.
Clearly a = aj+1 for some j 0 in the enumeration (8). Hence Sj {aj+1}
p. But
Sj {aj+1} = Sj+1 S. Hence S = S {a} and S is maximal.
a
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
319 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
320 OF 788
Q UIT
Lindenbaums Theorem
Theorem 11.7 (Lindenbaums Theorem) Every consistent set
can be extended to a maximally consistent set. More precisely
for every consistent there exists a maximally consistent set
.
Proof:
By definition 11.2 and corollary 10.4 consistency of
sets of formulae is a property of finite character in the universe
P0. From theorem 11.4 it follows that any set P0 may be
extended to a maximally consistent set .
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
321 OF 788
Q UIT
(9)
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
322 OF 788
Q UIT
Claim. is maximal.
` Suppose there exists a formula such that {} is consistent. Clearly i+1 for
some i 0 in the enumeration (9). Since {i+1} is consistent, by fact 9.2 i {i+1}
{i+1} is also consistent. But then i+1 = i {i+1} and hence = {}.
Hence is maximal.
a
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
323 OF 788
Q UIT
Exercise 11.1
1. Let hP, i be a finite partial order. Prove using Konigs lemma that every element of P lies
between a maximal element and a minimal element i.e. for each a P there exist a minimal
element l P and a maximal element u P such that l a u.
2. Prove that every maximally consistent set is a Hintikka set.
3. For any given consistent set of formulae, there may exist more than one maximally consistent
extension. Give examples of and such that there are two maximally consistent extensions,
and 0 with and 0.
4. (Tarskis theorem) For any set , of formulae, the set |= called the closure under logical consequence is defined as
|= = { P0 | |= , for some f }
Let M C () = { | is a maximally consistent extension of } be the set of all maximally
consistent extensions of . Prove that
\
|=
=
M C ()
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
324 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
325 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
326 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
327 OF 788
Q UIT
1. Introduction to Reasoning
2. Proof Systems: 1
3. Requirements of Proof Systems
4. Proof Systems: Desiderata
5. Formal Theories
6. Formal Language
7. Axioms and Inference Rules
8. Axiomatic Theories
9. Syntax and Decidability
10. A Hilbert-style Proof System
11. Rule Patterns
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
328 OF 788
Q UIT
Introduction to Reasoning
1. The methods discussed truth-table, tautology checking,
resolution and tableau are useful for automated deduction,
but
2. they do not reflect the process of reasoning employed by humans and used most often in mathematical proofs called deduction.
3. Deduction enables the proof of validity of arguments but seldom their invalidity.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
329 OF 788
Q UIT
Proof Systems: 1
A proof system for deduction
1. prohibits the use of meaning in drawing conclusions.
2. has a number of axioms (or axiom schemas) and a small
number of (finitary) inference rules.
3. Each proof is a finite tree where each node of the tree is either an assumption or an axiom or is obtained by patternmatching and substitution from the axioms and inference
rules.
4. Each proof can be checked manually or verified by machine
implementable algorithms.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
330 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
331 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
332 OF 788
Q UIT
Formal Theories
Definition 12.1 A formal theory T = hL, A , Ri consists of
Formal Language a formal language L.
Axioms a subset A of the language L.
Inference Rules a set R of inference rules.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
333 OF 788
Q UIT
Formal Language
1. An alphabet = X {(, )} consisting of a set X of variables a set of connectives each with a pre-defined arity and
grouping symbols.
2. L is defined inductively on .
3. The well-formed formulas or wffs of L are defined inductively
on the alphabet.
4. Membership of strings (from the alphabet) in L is decidable
i.e. there exists an algorithm to decide whether a given string
is a well-formed formula
Formal Theories
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
334 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
335 OF 788
Q UIT
Axiomatic Theories
Definition 12.2
The axioms and rules of inference of a formal theory together
constitute a proof system for the set of wffs in the theory.
A formal theory is said to be axiomatic if there exists an algorithm to decide whether a given wff is an axiom.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
336 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
337 OF 788
Q UIT
K.
N.
X (Y X)
(Y X) ((Y X) Y )
A single rule of inference modus ponens
X Y ,X
MP.
Y
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
338 OF 788
Q UIT
Rule Patterns
1. The axiom schema K states that for all (simultaneous) substitutions {/X, /Y } the formulae ( ) are all axioms
of the system.
2. The rules specify patterns and shapes of formulae. Thus
modus ponens specifies the relation
MP = {(( , ), ) | , L0}
and thus asserts that is a direct consequence of
and for all formulae and .
3. An application of the rule consists of identifying appropriate
substitutions of the variables X and Y by formulae in L0 to
yield a direct consequence by the same substitution.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
339 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
340 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
341 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
342 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
343 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
344 OF 788
Q UIT
An Example Proof
We formally deduce for any formula using the proof
system H0. As is normal practice in mathematics the proof is
presented as a sequence of steps.
1. (( ) )
H OME PAGE
JJ
{/X, /Y }K
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
345 OF 788
Q UIT
An Example Proof
We formally deduce for any formula using the proof
system H0. As is normal practice in mathematics the proof is
presented as a sequence of steps.
1. (( ) )
{/X, /Y }K
2. ( (( ) )) (( ( )) ( ))
{/X, /Y , /Z}S
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
345 OF 788
Q UIT
An Example Proof
We formally deduce for any formula using the proof
system H0. As is normal practice in mathematics the proof is
presented as a sequence of steps.
1. (( ) )
{/X, /Y }K
2. ( (( ) )) (( ( )) ( ))
{/X, /Y , /Z}S
3. (( ( )) ( ))
H OME PAGE
JJ
II
{2, 1}MP
LCS
G O B ACK
F ULL S CREEN
C LOSE
345 OF 788
Q UIT
An Example Proof
We formally deduce for any formula using the proof
system H0. As is normal practice in mathematics the proof is
presented as a sequence of steps.
1. (( ) )
{/X, /Y }K
2. ( (( ) )) (( ( )) ( ))
{/X, /Y , /Z}S
3. (( ( )) ( ))
{2, 1}MP
4. ( ( ))
H OME PAGE
JJ
{/X, /Y }K
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
345 OF 788
Q UIT
An Example Proof
We formally deduce for any formula using the proof
system H0. As is normal practice in mathematics the proof is
presented as a sequence of steps.
1. (( ) )
{/X, /Y }K
2. ( (( ) )) (( ( )) ( ))
{/X, /Y , /Z}S
3. (( ( )) ( ))
{2, 1}MP
4. ( ( ))
{/X, /Y }K
5.
{3, 4}MP
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
345 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
346 OF 788
Q UIT
1
(( ) )
3
( (( ) )) (( ( )) ( ))
(( ( )) ( ))
5
( ( ))
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
347 OF 788
Q UIT
Formal Proofs
Definition 13.2
A formal proof of a formula from a finite set of formulae
is a finite tree of formulae
rooted at the formula ,
the leaves are axioms or instances of axiom schemas or
members from .
each non-leaf node is a direct consequence of one or more
nodes at the succeeding level by virtue of application of
a rule of inference of the appropriate arity.
is said to be (formally) provable from in the proof system
H0 and denoted `H0 if there exists a formal proof of in
the system H0.
is a (formal) theorem if = and is denoted `H0
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
348 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
349 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
350 OF 788
Q UIT
i0 + 1
i ( i)
i
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
351 OF 788
Q UIT
- Tj0 %
j0 + 1
j
(i l )
( (i l )) (( i) ( l ))
- Ti 0 %
0
0
0
j +2
j +i +2
(
)
i
i
l
j 0 + i0 + 3
l
where j 0 + 1 is an instance of S, and j 0 + 2 and j 0 + i0 + 3 are both applications of MP to
their respective immediate successors in the tree.
0
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
352 OF 788
Q UIT
a
(). Assume ` . Let T be a formal proof tree rooted at with m nodes for some
m > 0. By monotonicity (theorem 13.1) , ` is proven by the same tree. We may extend
T to the tree T 0 by adding a new (m + 1)-st leaf node and creating the (m + 2)-nd root node .
-T %
m
m+2
T 0 is a proof of , ` .
H OME PAGE
JJ
m+1
QED
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
353 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
354 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
355 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
356 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
357 OF 788
Q UIT
1. Simplifying Proofs
2. Derived Rules
3. The Sequent Form
4. Proof trees in sequent form
5. Transitivity of Conditional
6. Derived Double Negation Rules
7. Derived Operators
8. Rules for Derived Operators
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
358 OF 788
Q UIT
Simplifying Proofs
The deduction theorem allows movement of sub-formulae
between the set (sequence) of assumptions and the formula
to be proven.
Hence the set (sequence) of formulae which form the assumptions is an important part of the proof.
We use the notion of a sequent to formalize this movement
which may take place a any stage.
Definition 14.1 A sequent is a meta-formula of the form ` .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
359 OF 788
Q UIT
Derived Rules
By substitutivity (theorem 13.1) we may simplify our proofs by
incorporating theorems and meta-theorems as derived rules
of our proof system.
These rules may be presented in sequent form.
The proof of the reflexivity may be rendered in sequent form
by simply pre-pending each node in the tree with `.
The Deduction Theorem and its converse may be rendered
in sequent form as a derived rule.
Reflexivity may be expressed in sequent form as a derived
rule.
These derived rules may be directly invoked in later proofs.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
360 OF 788
Q UIT
S.
N.
` X (Y X)
` (Y X) ((Y X) Y )
`XY
`X
MP.
`Y
R.
H OME PAGE
JJ
`XY
DT .
, X ` Y
` XX
J
II
LCS
G O B ACK
, X ` Y
DT .
`XY
F ULL S CREEN
C LOSE
361 OF 788
Q UIT
JJ
II
3 `
`
`
` ( ) ( )
` ( ) (( ) ( ))
LCS
G O B ACK
F ULL S CREEN
C LOSE
362 OF 788
Q UIT
Transitivity of Conditional
From theorem 14.2 we get a derived axiom schema
T.
` (X Y ) ((Y Z) (X Z))
But equivalently by applying the derived rule DT to T above
we also get a derived rule of inference which is often more convenient to use.
`XY
`Y Z
T.
`XZ
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
363 OF 788
Q UIT
Exercise 14.1
1. Prove that each of the axiom schemas in H0 represents a collection of tautologies.
2. Prove that Modus Ponens in sequent form preserves logical consequence i.e. if |= and
|= then |= .
3. Using the above prove that the proof system H0 is sound i.e. If `H0 then |= .
4. Find the fallacy in the following proof of theorem 14.2. Assume 1, 2 and 3 are as in the proof
of theorem 14.2.
3 `
DT
2 ` ( )
MP
H OME PAGE
JJ
S
2 ` ( ( )) (( ) ( )) 2 `
MP
2 ` ( ( )) ( )
2 `
DT
1 ` ( ) ( )
DT
` ( ) (( ) ( ))
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
364 OF 788
Q UIT
5. Prove the following derived rule of inference (You may use any of the derived rules of inference
in addition to the usual proof rules).
R2 .
` X (Y Z)
`Y
`XZ
6. Could we have consequently reordered our theorems by first proving R2 and then proving
T? Discuss whether there is anything fallacious in this approach.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
365 OF 788
Q UIT
`X
DNI.
` X
H OME PAGE
JJ
DNI .
` X X
II
LCS
G O B ACK
F ULL S CREEN
` X X
C LOSE
366 OF 788
Q UIT
QED
Proof of derived rule DNI and axiom schema DNI
Proof:
K
( )
T
N
( ) (( ) ) DNE
MP
( )
DT `
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
367 OF 788
Q UIT
Exercise 14.2
1. Prove the axiom schema
N0.
(Y X) (X Y )
A deduction theorem variant of this schema is also called the modus tollens rule or the contrapositive rule.
2. A variant of the system H0 is the system H00 obtained by replacing the schema N by N.
(a) Prove the axiom schema N in the system H00.
(b) Prove the double negation rules DNE and DNI in H00.
3. Prove the following axiom schemas in H0. In each case you are allowed to use any version of
the theorems previously proven.
(a) .
(b) N00.
H OME PAGE
JJ
X (X Y )
What can you conclude about the system H0 from your proof?
(X Y ) (Y X)
J
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
368 OF 788
Q UIT
(c) N2.
X (Y (X Y ))
(d) C.
, X ` Y
, X ` Y
(X Y ) ((X Y ) Y )
`Y
(e) Derive the proof by contradiction also called the indirect proof method rule I in the system
H0 .
, X ` Y
, X ` Y
I.
` X
H OME PAGE
JJ
` (XX)X
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
369 OF 788
Q UIT
Derived Operators
df
>
for all
df
= ( )
for all
df
=
df
= ( )
df
= (( ) ( ))
Several other binary and other operators of varying arities may
be defined.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
370 OF 788
Q UIT
to
each
derived
operator
defined
as
df
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
371 OF 788
Q UIT
Gentzens System
Natural Deduction
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
372 OF 788
Q UIT
Natural Deduction: 1
Introduction
Elimination
` X X
`
I.
E.
`
`X
`>
> >I.
>E.
`>
` X X
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
373 OF 788
Q UIT
Natural Deduction: 2
Introduction
Elimination
, X `
, X `
I.
E.
` X
`X
`X
` X
I.
E.
` X
`X
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
374 OF 788
Q UIT
Natural Deduction: 3
Introduction
Elimination
` X Y
` XZ
` Y Z
`X
`Y
I1.
I2.
E.
`X Y
`X Y
`Z
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
375 OF 788
Q UIT
Natural Deduction: 4
Introduction
Elimination
` X
` Y
`X Y
`X Y
I.
E1.
E2.
`X Y
`X
`Y
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
376 OF 788
Q UIT
Natural Deduction: 5
Introduction
Elimination
` XY
` X
E.
`Y
, X ` Y
I.
`XY
` XY
` Y X
`XY
`XY
I.
E1.
E2.
`XY
`XY
`Y X
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
377 OF 788
Q UIT
Exercise 14.3
1. Prove the logical equivalences of P0 using the system H0.
2. Prove the non-obvious logical equivalences of P0 in the system G0.
3. Derive each of the rules of G0 from the system H0. You may use the rules OE and OI as and
when needed for each operator.
4. Derive the axiom schemas K, S and N in G0.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
378 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
379 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
380 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
381 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
382 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
383 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
384 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
385 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
386 OF 788
Q UIT
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
387 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
388 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
389 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
390 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
391 OF 788
Q UIT
1. Towards Completeness
2. Towards Truth-tables
3. The Truth-table Lemma
4. The Completeness Theorem
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
392 OF 788
Q UIT
Towards Completeness
1. By theorem 15.3 the only theorems of the system H0 are
tautologies.
2. By theorems 4.2 and 4.3 the question of completeness of H0
reduces to that of whether every tautology of P0 is provable in
H0.
3. If H0 is complete then by exercise 14.3.4, G0 is also complete.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
393 OF 788
Q UIT
Towards Truth-tables
1. Restricting ourselves to showing that every tautology is provable in H0 is sufficient.
2. But we proceed to show that every truth table can be simulated as a proof in H0, thereby capturing all of the semantic
features of the language P0 in its proof theory.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
394 OF 788
Q UIT
pi
pi otherwise
and
if T JK = 1
otherwise
2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
395 OF 788
Q UIT
DNI `
MP
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
396 OF 788
Q UIT
- T1 %
, T JK = 1 and
`
- T1 %
`
`
` ( )
MP
which proves the claim.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
397 OF 788
Q UIT
- T2 %
`
`
` ( )
MP
` ( ( ))
MP
- T1 %
`
` ( )
MP
- T2 %
`
` ( )
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
398 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
399 OF 788
Q UIT
- Tsk %
.
sk `
- Ts0 %
from
s0 `
Now consider any two proof trees whose indexes differ only in the rightmost bit. That is, for any
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
400 OF 788
Q UIT
- Tsj1 %
as follows.
sj1 `
- Tsj10 %
sj10 `
DT
sj1 ` pj
MP
- Tsj11 %
- Tsj10 %
and
. We construct the proof
sj11 `
sj10 `
- Tsj11 %
sj11 `
DT
sj1 ` pj
MP
sj1 `
We can thus eliminate the atom pj from the assumptions by applying the above proof procedure to
all pairs of proof trees whose assumptions differ only in the value of pj .
Thus the 2k proof trees are combined pairwise to produce 2k1 proof trees that are independent of
the atom pk . Proceeding in a like manner we may eliminate all the atoms one by one by using similar
- T %
proof constructions so that finally we obtain a single monolithic proof tree
where = ,
`
thus concluding the proof that the tautology is a formal theorem of H0.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
401 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
402 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
403 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
404 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
405 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
406 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
407 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
408 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
409 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
410 OF 788
Q UIT
JJ
LCS
G O B ACK
|
|
|
|
|
>
()
( )
( )
x[]
F ULL S CREEN
C LOSE
411 OF 788
Q UIT
Precedence Conventions
The operator precedence conventions are as before.
The two new operators are called the universal quantifier ()
and existential quantifier () respectively and are parameterised by variables.
The scope of the (variable in a) quantified formula is delimited
by the the matching pair of brackets ([ and ]).
If a formula is preceded by several quantifiers (e.g.
x[y[z[]]]) we collapse the scoping brackets where there
is no ambiguity (e.g xyz[]).
We will think of both -terms and -formulae as abstract syntax trees. The brackets delimiting the scope of a quantifed
variable then become redundant.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
412 OF 788
Q UIT
x
x
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
413 OF 788
Q UIT
Subterms
Definition 17.6 For each term t, ST (t) denotes the set of subterms of t (including t itself). The set of proper subterms of t is
the set ST (t) {t}.
t
c()
x
f (t1, . . . , tn)
H OME PAGE
JJ
depth
1
1
1+
M axni=1depth(ti)
II
LCS
size
1
1
1+
P
n
i=1 size(ti)
G O B ACK
F ULL S CREEN
ST
{t}
{t}
{t}
S
n
i=1 ST (ti)
C LOSE
414 OF 788
Q UIT
Variables in a Term
For any term t, V ar(t) denotes the set of all variables that occur in t. These functions may be defined by induction on the
structure of terms as follows.
Definition 17.7
t
c()
x
f (t1, . . . , tn)
H OME PAGE
JJ
II
V ar(t)
{x}
S
1in V ar(ti)
LCS
G O B ACK
F ULL S CREEN
C LOSE
415 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
416 OF 788
Q UIT
x
x
x
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
417 OF 788
Q UIT
Scope Trees
The abstract syntax tree also determines the scope of the individual bound variables.
x
x
x
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
418 OF 788
Q UIT
Free Variables
Definition 17.10 For any predicate the set of free variables
occurring in it (denoted F V ()) and the set of sub-formulae
(denoted SF () are defined by induction on the structure of
predicates.
F[
V ()
SF ()
Condition
p(t1, . . . , tn)
V ar(ti)
{p(t1, . . . , tn)}
1in
F V ()
{} SF ()
F V () F V () {o(, )} SF () o 0 {}
SF ()
F V () {x}
{ x[]} SF ()
{, }
x[]
JJ
H OME PAGE
II
LCS
o(, )
G O B ACK
F ULL S CREEN
C LOSE
419 OF 788
Q UIT
Bound Variables
Definition 17.11 If x[] is a sub-formula of some formula
then is said to be the scope of the quantifier x and every
free occurrence of the variable x in the formula is said to be
bound in the scope of the quantifier x in which it occurs.
Q
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
420 OF 788
Q UIT
Closure
Definition 17.12
1. A formula is called closed if F V () = .
2. The universal closure of (x1, . . . , xm) denoted ~[] is defined
as the formula x1, . . . , xm[].
3. The existential closure of (x1, . . . , xm) denoted ~[] is defined
as the formula x1, . . . , xm[].
4. A literal is an atomic formula or its negation. For any literal
will denote its negation.
,
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
421 OF 788
Q UIT
Exercise 17.1
1. Translate the following statements into first-order logic statements. (You may use the function
symbols that are normally used in mathematics, e.g. 0 for zero, = for equality, + for
addition etc.). The names x, y etc. stand for variables.
Every number has a unique successor.
Not every number has a predecessor.
The sum of any two odd numbers is even.
x is a prime.
There is no largest prime.
x is a divisor of y.
x and y are relatively prime.
Define the notion of greatest common divisor of two numbers as as a ternary predicate
gcd(x, y, z) in terms of the previous parts. In other words, gcd(x, y, z) stands for the statement
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
422 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
423 OF 788
Q UIT
have been heard. Nobody was heard. If the criminal who robbed the mansion managed to
fool the guard, he must have been a convincing actor. Nobody could rob the mansion unless
he fooled the guard. No criminal could be both an expert locksmith and a convincing actor.
Therefore some criminal had an accomplice among the servants.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
424 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
425 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
426 OF 788
Q UIT
1. Structures
2. Notes on Structures
3. Infix Convention
4. Expansions and Reducts
5. Valuations and Interpretations
6. Evaluating Terms
7. Coincidence Lemma for Terms
8. Variants
9. Variant Notation
10. Semantics of Formulae
11. Notes on the Semantics
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
427 OF 788
Q UIT
Structures
Given a signature , a -structure or -algebra A consists of
a non-empty set A = |A| called the domain (or carrier or
universe) of A,
a function f A : Am A for each m-ary function symbol
f (including symbols for each constant)
a relation pA An for each n-ary atomic predicate symbol
p and
(for completeness) a truth value pA 2 = {0, 1} for each
(0-ary) atomic proposition p .
When the -algebra is understood or is the only structure under
consideration, we omit the subscript A from the functions and
relations.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
428 OF 788
Q UIT
Notes on Structures
1. The domain has to be non-empty.
2. All functions are total.
3. One way to deal with partial functions (e.g. division on natural numbers) of arity m > 1 is to treat them as (m + 1)-ary
relations and define predicate symbols to represent them.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
429 OF 788
Q UIT
Infix Convention
If in particular structures, functions or relations are normally
written in infix form, then we use the infix form in the logical
language too.
Example 18.1 If N = hN; +; <i the set of natural numbers under
the binary operation of addition (+) and the binary relation lessthan (<) is the structure, then we write predicate formulae using
the corresponding symbols in the language in infix form. For
example, the formula
x[y[x < x + y]]
with the operation in infix form is more easily understood in
place of the more pedantic
x[y[< (x, +(x, y))]]
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
430 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
431 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
432 OF 788
Q UIT
Evaluating Terms
Definition 18.5 Given -interpretation (A, v) the value of a term
t in the interpretation is defined by induction on the structure of
the term.
df
VAJxKv
xV
= v(x),
df
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
433 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
434 OF 788
Q UIT
Variants
Definition 18.7 Two valuations v, v 0 : V |A| are said to be
X-variants of each other (denoted v =\X v 0 for any X V if for
all y V X, v(y) = v 0(y), i.e. they differ from each other at most
in the values for variables from X.
Fact 18.8
1. For any X V and valuation v, v is an X-variant of itself i.e.
v =\X v.
2. =\X is an equivalence relation on valuations.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
435 OF 788
Q UIT
Variant Notation
Notation.
1. When X = {x} is a singleton we refer to v and v 0 as x-variants
and denote it by v =\x v 0.
2. If vx =\x v and vx(x) = a |A| we write vx = v[x := a].
3. If X = {x1, . . . , xn}, vX =\X v and vX (xi) = ai |A|, for each
i, 1 i n, then we write vX = v[x1 := a1, . . . , xn := an].
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
436 OF 788
Q UIT
Semantics of Formulae
Let (A, vA) be a -interpretation. Then T JKv is defined by
induction on the structure of . We omit the propositional connectives as being obvious and concentrate only on the other
constructs.
df
1 if (VAJt1KvA , . . . , VAJtnKvA ) pA
TAJp(t1, . . . , tn)KvA =
0 otherwise
df Q
0 = v }
TAJx[]KvA
= {TAJKv0 | vA
\x A
A
df P
0 = v }
TAJx[]KvA
= {TAJKv0 | vA
\x A
A
Definitions of
P Q
,
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
437 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
438 OF 788
Q UIT
Exercise 18.1
1. Define interpretations on universes of discourse containing at least 3 elements and give a valuation in which the following hold. Assume p and q are atomic predicate symbols of any positive
arity of your choice.
(a) (p x[q] x[p q])
(b) (x[p q] (x[p] q))
2. Prove that the following predicates have no models at all where p and q are atomic predicates
(of any positive arity).
(a) (p x[q] x[p q])
(b) ((x[p] q) x[p q])
3. Consider the universe of discourse to be the set of all nodes of graphs and let the atomic binary
predicate symbol e stand for the edge relation on nodes, i.e. e(x, y) stands for there is an edge
from x to y. Further let = stand for the usual identity relation on nodes. What properties on
graphs do the following first-order predicates define?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
439 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
440 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
441 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
442 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
443 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
444 OF 788
Q UIT
Semantics of Formulae
Proof: By induction on the structure of . However the interesting cases are those of atomic
predicates and quantified formulae.
Case p(t1, . . . , tn) where p is an n-ary predicate symbol. For each x F V (p(t1, . . . , tn)) =
[
V ar(ti) we have v(x) = v 0(x). Hence for each ti we have VJtiKv = VJtiKv0 from which we get
1in
Case
Sub-case x 6 F V (). Then x 6 {x1, . . . , xn} and hence for every vx and vx0 which are x-variants of
v and v 0 respectively we have T J(x1, . . . , xn)Kvx = T J(x1, . . . , xn)Kvx0 from which we obtain
Q
Q
{T JKvx | vx =\x v} =
{T JKvx0 | vx0 =\x v 0}
and
P
P
{T JKvx | vx =\x v} =
{T JKvx0 | vx0 =\x v 0}
which implies T JKvx = T JKvx0 .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
445 OF 788
Q UIT
Sub-case x F V (). Then F V () = {x, x1, . . . , xn}. Let T (x) = {T JKvx | vx =\x v} and
T 0(x) = {T JKvx0 | vx0 =\x v 0}. Note that T (x), T 0(x) {{0}, {1}, {0, 1}}. Assume for some
J
Q P
{ , }, T JKvx 6= T JKvx0 . Then T (x) 6= T 0(x) which implies there exists a A = |A|
such that for vx = v[x := a] and vx0 = v 0[x := a], T JKvx 6= T JKvx0 . But this is impossible
since F V () = {x, x1, . . . , xn}, vx(x) = a = vx0 (x) and for each xi {x1, . . . , xn}, we have
vx(xi) = vx0 (xi). Hence T JKvx = T JKvx0 .
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
446 OF 788
Q UIT
Substitutions
Definition 19.2
A substitution is a (total) function : V T() which is
almost everywhere the identity.
S1 (V) is the set of all substitutions.
is called a ground substitution if F V ((x)) = .
The domain of a substitution is the finite set dom() =
{x | x 6 (x)}. acts on the variables in dom().
Notes and notation.
Equivalently a substitution may be represented as a finite
(possibly empty) set = {s/x | (x) = s 6 x} containing
only the non-identical elements and their images under .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
447 OF 788
Q UIT
Instantiation of Terms
Definition 19.3 Let be a substitution.
The application of to a term t T() is denoted t and
defined inductively as follows.
y
= y,
y 6 dom()
x
= (x),
x dom()
f (t1, . . . , tm) = f (t1, . . . , tm), f : sm s
t is called a (substitution) instance of t.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
448 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
449 OF 788
Q UIT
VJ{s/x}tKv
VJ{s/x}f (t1, . . . , tm)Kv
VJf ({s/x}t1, . . . , {s/x}tm)Kv
fA(VJ{s/x}t1Kv , . . . , VJ{s/x}tmKv )
fA(VJt1Kv[x:=a], . . . , VJtmKv[x:=a])
By the induction hypothesis
VJf (t1, . . . , tm)Kv[x:=a]
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
450 OF 788
Q UIT
Admissibility
The occurrence of bound variables in formulae requires careful
handling when substitutions are applied to formulae. Intuitively,
an element s/x is admissible in a formula if the variables
of s remain free after instantiating the formula.
Definition 19.5 Let be a substitution
An element s/x is admissible in
p(t1, . . . , tn),
if it is admissible in ,
( ) if it is admissible in both and
x[],
y[] if x 6 y, y 6 F V (s) and s/x is admissible in .
Q
Q
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
451 OF 788
Q UIT
Instantiations of Formulae
Definition 19.6 Let be a substitution.
The application of to a formula P1() is denoted and
defined inductively as follows.
JJ
H OME PAGE
= p(t1 . . . , tn),
= (),
= ( ),
= x[0],
II
LCS
p : sn
{, , , }
0 = {(x)/x},
G O B ACK
F ULL S CREEN
C LOSE
p(t1, . . . , tn)
( )
x[]
{, }
452 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
453 OF 788
Q UIT
The sub-cases involving the propositional connectives are trivial and the only interesting cases left
are those of quantified formulae.
Sub-case y[]. Since x F V () clearly x 6 y and hence x F V (). Further since {s/x}
is admissible in , y 6 V ar(s). This implies that
Q
1. {s/x} is admissible in ,
H OME PAGE
JJ
y[{s/x}] and
2. {s/x}
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
454 OF 788
Q UIT
which implies for any quantifier T J{s/x}Kv = T JKv[x:=a] regardless of the quantifier involved.
QED
Exercise 19.1
1. Let (A1, v1) be a 1-interpretation and (A2, v2) a 2-interpretation such that |A1| = |A2|. Let
= 1 2.
(a) Let t be a -term. Prove that if (A1, v1) and (A2, v2) agree on the symbols occurring in t,
then VA1 JtKv1 = VA2 JtKv2 .
(b) Let be a -formula. Prove that (A1, v1) and (A2, v2) agree on the symbols occurring in ,
then TA1 JKv1 = TA2 JKv2 .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
455 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
456 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
457 OF 788
Q UIT
1. Satisfiability
2. Models and Consistency
3. Examples of Models:1
4. Examples of Models:2
5. Examples of Models:3
6. Logical Consequence
7. Validity
8. Validity of Sets of Formulae
9. Negations of Semantical Concepts
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
458 OF 788
Q UIT
Satisfiability
Definition 20.1 (Satisfaction).
A -interpretation (A, v) satisfies a -formula denoted
(A, v)
if and only if T JKv = 1.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
459 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
460 OF 788
Q UIT
Examples of Models:1
Example 20.3 Let = {0 : s, +1 : s s, = : s2, < : s2}, let
N = hN; 0, +1; =, <i
be the -structure where N is the set of naturals, +1 is the unary
successor function, = is the atomic binary equality predicate
and < is the binary less-than predicate. Let
df
df
1 = (+1(x) = 0)
2 = (+1(x) = +1(y)) (x = y)
df
df
3 = xy[y = +1(x)]
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
461 OF 788
Q UIT
Examples of Models:2
Example 20.4 Let = {0 : s, + : s2 s, = : s2} and let Z
be the -structure
Z = hZ; 0, +; =i
where Z is the set of integers, 0 and + represent the integer
zero and the binary addition operation respectively, and = is the
atomic binary equality predicate. Z is a model of the following
set of formulae
df
identity = x[x + 0 = x]
(11)
df
rightinverse = xy[x + y = 0]
H OME PAGE
JJ
II
LCS
G O B ACK
(10)
(12)
F ULL S CREEN
C LOSE
462 OF 788
Q UIT
Examples of Models:3
Example 20.5 The set defined in the previous example is the
set of axioms which defines the notion of a group in algebra.
The addition of an extra axiom
df
commutative = x, y[x + y = y + x]
(13)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
463 OF 788
Q UIT
Logical Consequence
Definition 20.6 A -formula is a logical consequence of a set
of -formulae, denoted |= , if and only if every model A
of is also a model of . If is empty then is said to be
logically valid (denoted |= ).
Example 20.7 Let be the signature in example 20.4 and let
df
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
464 OF 788
Q UIT
Proof: Let x be any element. Then by axiom rightinverse there exists y such that
x+y =0
(14)
y+z =0
(15)
(y + x) + 0
(identity )
(y + x) + (y + z)
(15)
y + (x + (y + z)) (associative)
y + ((x + y) + z) (associative)
y + (0 + z)
(14)
(y + 0) + z
(associative)
y+z
(identity )
0
(15)
Effectively from the group axioms we have extracted fresh knowledge about groups in general
namely that, the existence of a right inverse for each element of the group implies the existence
of a left-inverse. In fact, by replacing the opening line of the proof by
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
465 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
466 OF 788
Q UIT
Validity
Definition 20.8 (Validity). Let A be a -structure, and be
-formulae.
(A
). is valid in A if and only if A is a model of .
(A
). is valid in a class A of -structures if it is valid in
each structure A A.
(
). is (logically) valid if and only if every -structure is a
model of .
( ). is (logically) equivalent to if
.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
467 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
468 OF 788
Q UIT
We have deviated in our meta-logical notation from standard textbooks. Notice from the definitions
of logical consequence, logical validity and validity of sets of formulae that |= if and only if for
every structure -structure A, A
implies A
. Most textbooks on first-order logic actually
use only one overloaded symbol |= for both concepts. However we have decided to keep them
separate since the concept of logical consequence involves sets of formulae of a formal language
whereas the other refers specifically to models.
Notice also that for any formula , both
and |= denote that is (logically) valid. By extension,
therefore logical equivalence defined as
may equally well be defined as |= .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
469 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
470 OF 788
Q UIT
Exercise 20.1
1. Prove that A is a model of iff A is a model of ~[].
2. Prove that |= iff ~[] |= ~[], where ~[] denotes the universal closure of each formula in
.
3. Prove that
if and only if |= (i.e. |= ). Hence in most books on logic, the same symbol
|= is used for both logical consequence and for validity in models).
4. Prove that
if and only if
~[].
5. Prove that is satisfiable in A if and only if ~[] is satisfiable in A.
6. Show that is valid for any formula .
7. In general every first-order logic formula which has a tautological shape in propositional
logic is a valid formula. Formalize this notion and prove it.
8. Prove that and are duals i.e. show that
(a)
x[] x[]
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
471 OF 788
Q UIT
x[] is equvalent to .
10. If x 6 F V () then
11. Give examples of interpretations (A, v) to show that the following formulae are not valid.
(a) x[] x[]
(b) xy[(x, y)] yx[(x, y)]
12. Prove that for any binary predicate ,
x, y[(x, y) (y, x)] x, y[(x, y) (y, x)]
13. Prove that the following formulae are valid.
(a) x[(x) x[(x)]].
(b) xy[(x, y)] yx[(x, y)]
14. Prove that iff |= and |= .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
472 OF 788
Q UIT
15. A student claimed that the following definition is a stronger definition of logical consequence
than definition 20.6. Justify or refute his claim.
Definition 20.10 A -formula is a logical consequence of a set of -formulae, denoted
|=0 , if and only if for every interpretation (A, v), (A, v)
for each implies
(A, v)
.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
473 OF 788
Q UIT
When we consider the notion of a model, we come across various notions which express properties
of the models. For example, if < denotes an irreflexive ordering relation, then a sentence such as
xy[x < y] specifies that there is no greatest element in the ordering. Such a sentence therefore has
no finite models. Its negation however has only finite models. Another sentence such as xy[x = y]
in the language of first-order logic with equality has only singleton models.
If all models of a set of sentences are finite then there must be a finite bound on the size of the
models (i.e. the carrier set of the structure must be of a fixed finite cardinality). Otherwise, as the
following theorem shows there would also be infinite models. For instance as Enderton [3] states:
It is a priori conceivable that there might be some very subtle equation of group theory that
was true in every finite group but false in every infinite group.
But theorem 20.11 assures us that such a possibility does not exist.
Theorem 20.11 If a set of -formulae has arbitrarily large finite models, then it has an infinite
model.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
474 OF 788
Q UIT
Proof: Assume has arbirarily large finite models. Now consider the following formulae k for
each k 2,
df
2 = x1, x2[(x1 = x2)]
df
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
475 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
476 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
477 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
478 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
479 OF 788
Q UIT
Distinguishability
Example 21.2 For = {= : s2, < : s2} consider the structures Z = hZ; ; =, <i and Q = hQ; ; =, <i where Z is the
set of integers, Q is the set of rational numbers, < are respectively the less-than relations on the two sets respectively. Now
consider the formula
df
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
480 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
481 OF 788
Q UIT
Isomorphic Structures
Example 21.3 Let = {0 : s, +1 : s s, = : s2, < : s2}.
Now consider the structures
N = hN; 0, +1; =, <i
2N = h2N; 0, +2; =, <i
where 2N is the set of even natural numbers, +1, +2 denote
the respective successor functions, < is the usual less-than
relation on both structures. The two structures are clearly isomorphic and there is an isomorphism which : N 2N such
that (n) = 2n which along with the inverse map 1(2n) = n
maps one structure exactly onto the other.
Isomorphic -structures cannot be distinguished by P1().
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
482 OF 788
Q UIT
Corollary 21.5 If : A
= B then for any formula (x1, . . . , xn)
and any valuation vA, vB and values a1, . . . , an |A|,
(A, vA[x1 := a1 . . . , xn := an])
iff
(B, vB[x1 := (a1) . . . , xn := (an)])
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
483 OF 788
Q UIT
1-1
B
Assume there is an isomorphism : A
= B. Since is an isomorphism, : A
onto
1-1
A also
is a bijection that preserves structure, where A = |A| and B = |B|. Hence 1 : B
onto
exists and preserves strucure. Further we have
1. (fA(a1, . . . , am)) = fB((a1), . . . , (am)) for every m-ary function fA,
2. 1(fB(b1, . . . , bm)) = fA( 1(b1), . . . , 1(bm)) for every m-ary function fB,
3. (a1, . . . , an) pA iff ((a1), . . . , (an)) pB for each n-ary relation pA.
4. (b1, . . . , bn) pB iff ( 1(b1), . . . , 1(bn)) pA for each n-ary relation pB.
Further for each vA : V A, vA : V B and for each vB : V B, 1 vB : V A.
For every formula , we may prove the stronger claims,
TAJKvA = TBJKvA
TBJKvB = TAJK1vB
The proof is by induction on the structure of and is left as an exercise to the interested reader.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
484 OF 788
Q UIT
The Isomorphism Lemma then raises the following interesting question which we will answer later.
Question. Are -structures which satisfy the same -formulae isomorphic?
But regardless of the answer to the above question the isomorphism lemma also brings the realization that for a any given set of -formulae there could be more than one model, in fact a class of
models, for a given nonempty set of -formulae. Our notions of validity may therefore include
the following besides those given in definition 20.8.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
485 OF 788
Q UIT
Substructures
Definition 21.6 A -structure A is a substructure of another structure B (denoted A B) if
=
6 |A| |B|,
for each f : sm s , fA = fB |A|m,
for each p : sn , pA = pB |A|n.
where fB |A|m denotes the restriction of fB to elements of
|A|m.
Facts 21.7 If A B, then
1. |A| is -closed, i.e. for each f : sm s and each
(a1, . . . , am) |A|m, fB(a1, . . . , am) |A|.
2. Conversely for each X |B|, such that X is -closed there
exists a unique -substructure X B.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
486 OF 788
Q UIT
Substructure Examples
Example 21.8
1. N = hN; 0, +; =i is a substructure of Z = hZ; 0, +; =i which in
turn is a substructure of Q = hQ; 0, +; =i which in turn is a
substructure of R = hR; 0, +; =i.
2. 2N = h2N; 0, +; =i is a substructure of N = hN; 0, +; =i.
3. However the odd numbers are not closed under addition and
hence they do not form a substructure of N under addition.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
487 OF 788
Q UIT
Quantifier-free Formulae
Definition 21.9 For any signature , the set QF 1() of
quantifier-free formulae is given by the following grammar
, ::=
|
|
|
H OME PAGE
JJ
II
LCS
G O B ACK
|
|
|
|
>
()
( )
( )
F ULL S CREEN
C LOSE
488 OF 788
Q UIT
Proof:
Use the Isomorphism lemma 21.4 on the common
subset of the two carrier sets using the identity isomorphism.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
489 OF 788
Q UIT
, ::= QF 1()
| ( )
| ( )
|
x[]
Q
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
490 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
491 OF 788
Q UIT
Exercise 21.1
1. Theorem 21.13 (The Homomorphism Theorem). Let $ : A B be a homomorphism from
a structure A into a structure B and let vA be a valuation.
(a) For any term t, VBJtK$vA = $(VAJtKvA )
2. Prove that if $ is not surjective, the two structures may be distinguished by a formula.
3. In part 1b of theorem 21.13 why is the condition of injectivity necessary? (Hint. Let = be the
atomic binary equality predicate whose semantics is defined in an obvious fashion. Now show
that if $ is not injective then the two structures can be distinguished using equality.)
4. Prove that if $ is surjective but not necessarily injective, then in the absence of any predicate
from which equality or inequality of terms may be expressed or derived, part 1b of theorem 21.13
may be extended to quantified formulae.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
492 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
493 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
494 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
495 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
496 OF 788
Q UIT
x[X] {t/x}X
, t x or {t/x} admissible in X
D.
x[X Y ] (X x[Y ])
The modus ponens (MP) rule and
{y/x}X
I.
, y x or y 6 F V (X)
x[X]
H OME PAGE
JJ
II
LCS
, x 6 F V (X)
G O B ACK
F ULL S CREEN
C LOSE
497 OF 788
Q UIT
Admissibility of Substitutions
Some explanations are perhaps in order regarding the side conditions attached to the axioms above.
E. The side condition t x allows the subsituted term to be the variable x, which is not surprising. But this is explicitly mentioned only because the side condition {t/x} admissible in X
does not include the possibility of replacing x by itself.
But more important is the side condition {t/x} admissible in X. If this condition were not
present then we could have the following situation which would be clearly unsound.
df
(16)
Now consider any model consisting of at least two distinct elements and let p(x, y) denote the
identity relation on the carrier set. Clearly in such a model while the antecedent x[y[p(x, y)]]
is clearly valid (true for each valuation), the consequent y[p(y, y)] would be invalid (false for
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
498 OF 788
Q UIT
certain valuations).
D. In this axiom schema if we were to relax the side-condition and allow the quantifier to be moved
in even if x F V (X) it would result in the following situation when X = (x) = Y .
x[(x) (x)] ((x) x[(x)])
(17)
Whereas the antecedent of the formula in (17) is logically valid, the truth of the consequent is
not guaranteed in any interpretation in which (x) is true only for some elements of the domain
and false for others.
I. The hypothesis of the rule asserts that a formula ( , x, ) holds when the free variable x is
replaced uniformly throughout the formula by any variable that does not occur free in . Then
clearly the formula holds for any arbitrary value that x may take, and hence the variable x may
be universally quantified.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
499 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
500 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
501 OF 788
Q UIT
Faulty Proof:2
x[h(x) m(x)]
x[g(x) h(x)]
E h(z) m(z)
E g(y) h(y)
??
g(y) m(y)
I x[g(x) m(x)]
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
502 OF 788
Q UIT
A Correct Proof
x[g(x) h(x)]
x[h(x) m(x)]
E g(y) h(y)
E h(y) m(y)
T
g(y) m(y)
I x[g(x) m(x)]
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
503 OF 788
Q UIT
` x[X] {t/x}X
, t x or {t/x} admissible in X
` x[X Y ] (X x[Y ])
, x 6 F V (X)
` {y/x}X
I.
, y 6 F V (X) F V ()
` x[X]
Note that the variable y being quantified should not occur free
in any of the assumptions .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
504 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
505 OF 788
Q UIT
Generally in mathematics, if there are two named entities x and y and nothing is stated about the
relationship between them, we can neither assume they stand for distinct entities nor can we exclude
the possibility that they both stand for the same entity.
For instance, it becomes essential when speaking of models which contain at least two elements, to
make a first-order statement like xy[(x = y)] which states that there exist at least two distinct
objects.
Example 22.2 Consider any first-order theory of boolean algebra. If we allow for the possibility
that 1 = 0 every equation of boolean algebra would still be satsified and the boolean identities
would still continue to hold. But in addition we would also have 0 . 1 . 0. If we were to adopt
this as a model for truth, then every formula would be implied by every other formula and the whole
edifice of mathmatical logic as we know it would collapse to a triviality without the assumption that
the value 1 is distinct from the value 0.
On the other hand, it may so happen that one may define properties of objects and prove a theorem
stating in effect that if the two objects x and y both satisfy a certain property , then they are both
the same object. This is usually expressed as ((x) (y)) (x = y).
Example 22.3 The definition of injective functions in any standard mathematics text uses equality
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
506 OF 788
Q UIT
or inequality in its definition. A function f : A B is injective if for any two distinct elements
a, a0 such that a 6= a0, f (a) 6= f (a0). Alternatively, f is injective if f (a) = f (a0) implies a = a0.
The use of equality or inequality in all such situations is inescapable. Hence equality has a special
place in mathematics and logic and is usually required as a basic relation between named entities,
even when it is not primarily a relation of interest in the models that are being studied.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
507 OF 788
Q UIT
Semantics of Equality
The semantics of the binary infix atomic predicate = is defined
as follows:
df
1 if VAJsKvA =VAJtKvA
TAJs = tKvA =
0 otherwise
In the sequel we do not explicitly include equality in the signature, but assume that it is present as part of the language of
First-order Predicate Logic with Equality.
(First-order Predicate Calculus with Equality) The first-order
theory with no non-logical axioms except the axioms for equality.
H OME PAGE
JJ
II
LCS
G O BACK
F ULL S CREEN
C LOSE
508 OF 788
Q UIT
= R.
= S.
H OME PAGE
= C.
t=t
(s = t) ({s/x}u = {t/x}u)
(s = t) ({s/x}X {t/x}X)
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
509 OF 788
Q UIT
Explanations.
=R This is the reflexivity axiom schema, which asserts that any term equals itself.
=C This is the congruence axiom schema and it asserts that equals may be substituted for equals in
any term context.
=S This is the substitutivity axiom schema which again asserts that the replacement of equals by
equals does not alter the truth value of formulae. However due to the presence of quantifiers and
bound variables one must ensure that the substitution of equals by equals does not result in the
capture of free variables of either s or t.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
510 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
511 OF 788
Q UIT
Symmetry of Equality
Proof of derived rule =Sym
df
`
s
=
s
t
=
s
MP
` t=s
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
512 OF 788
Q UIT
Transitivity of Equality
Proof of derived rule =T
Let = {s = t, t = u} and s = x. Then
=S ` t = u (s = t s = u) ` t = u
MP
u
` s=t
MP ` s = t s =
` s=u
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
513 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
514 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
515 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
516 OF 788
Q UIT
1. Alpha Conversion
2. The Deduction Theorem for Predicate Calculus
3. Useful Corollaries
4. Soundness of Predicate Calculus
5. Soundness of The Hilbert System
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
517 OF 788
Q UIT
Alpha Conversion
Notation We use a` as an abbreviation for the two statements ` and ` .
Lemma 23.1 For every formula for which {y/x} is admissible
x[] a` y[{y/x}]
Proof: If {y/x} is admissible in then we may readily see that
{x/y} is also admissible in {y/x} since x 6 F V ({y/x}) and
{x/y}{y/x}
Further since x 6 F V (x[]) we have by axiom schema E
x[] i.e.
x[] {x/y}{y/x}
We then have the following proofs.
H OME PAGE
JJ
II
LCS
G O B ACK
QED
F ULL S CREEN
C LOSE
518 OF 788
Q UIT
x[] ` x[]
E
y[{y/x}] ` y[{y/x}]
y[{y/x}] ` y[{y/x}] {y/x}
MP
y[{y/x}] ` {y/x}
I
y[{y/x}] ` x[]
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
519 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
520 OF 788
Q UIT
j0 + 1
j ( j )
j
Suppose j was obtained by the application of the axiom schema I on some i such that `(i) >
`(j ). Then j x[i]. By the induction hypothesis there exists a proof tree Ti 0 rooted at
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
521 OF 788
Q UIT
i and such that no free free variable of has been generalized in the application. Further
x 6 F V (). We may now extend Ti 0 to a proof tree Tj0 as follows.
- Ti 0 %
i
i
0
i +1
x[ i]
i0 + 3
0
i0 + 2
x[ i] ( x[i])
x[i] j
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
522 OF 788
Q UIT
Useful Corollaries
Corollary 23.3 If the proof of , ` involves no generalization
of any free variable of then ` .
Corollary 23.4 If is a closed formula and , ` then `
.
Corollary 23.5 If no free variable of = {1, . . . , m} is generalized in a proof of ` , then ` 1 m .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
523 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
524 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
525 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
526 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
527 OF 788
Q UIT
(a) ~[ 0] ` 0
(b) 0 ` 0
(c) We also have the derived rule of inference .
` 0
`
4. If and are formulae such that x 6 F V (), then the following are theorems of H1 (x[] is
an abbreviation of x[]).
(a) ` x[] and hence ` x[]
(b) ` x[] and hence by rule I ` x[]
(c) ` x[ ] ( x[])
(d) ` x[ ] (x[] )
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
528 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
529 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
530 OF 788
Q UIT
1. Existential Generalisation
2. Existential Elimination
3. Remarks on Existential Elimination
4. Restrictions on Existential Elimination
5. Equivalence of Proofs
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
531 OF 788
Q UIT
Existential Generalisation
Existential quantification is the derived operator defined by
df
x[] = x[]
We then have the rules
` {t/x}
I.
, {t/x} admissible in
` x[]
` x[]
E.
, a 6 F V () F V (x[]) is fresh
` {a/x}
I is a derived rule
However E is not a derived rule in the Hilbert-System.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
532 OF 788
Q UIT
E
` x[] {t/x}
MP
DNI
` {t/x} {t/x}
T
` {t/x} x[]
MP
H OME PAGE
JJ
` {t/x} x[]
` {t/x}
` x[] x[]
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
533 OF 788
Q UIT
Existential Elimination
Existential generalisation from a constant introduced somehow
into the proof is very common in mathematics.
Example 24.1 Consider a purported proof of
x[ ], x[] ` x[]
where x may be a free variable of both and . The standard
practice is to assume the existence of some constant symbol
a and proceed with it to eventually generalize.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
534 OF 788
Q UIT
` x[]
` {a/x}
Unless the same constant symbol is used both in the application of E and E the proof will
not go through. Here is a proof not involving the use of the constant (which is reminiscent of a
proof by contradiction) which assumes there is no value for x which will make true. Let =
{x[], x[]}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
535 OF 788
Q UIT
` x[]
` x[]
E `
E `
(( ) )
I
` ( )
I
` x[( )]
DT
x[] ` x[] x[( )]
Note that the application of DT is correct since no free variable of has been generalised in the
proof so far. We may now proceed as follows. First from rule N we get
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
536 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
537 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
538 OF 788
Q UIT
Equivalence of Proofs
Theorem 24.3 (Existential-Elimination Elimination Theorem).
If `E is a correct proof then ` provided no constants
introduced in the proof `E occur in . i.e. if is provable
from by use of the E rule then is provable from without
making use of the E rule.
2
However this theorem is not applicable if does contain any of
the constants introduced by the proof `E .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
539 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
540 OF 788
Q UIT
- T1 %
does not involve any application of rule E. For i = 1, this is also
` y1[1]
- T10 %
the required tree
.
` y1[1]
such that the proof
By adding the formula {a1/y1}1 to the set of assumptions and removing the subtree
- T1 %
` y1[1]
-T1%
from T we get a proof tree
in which there are only k 1 applications of rule
, {a1/y1}1 `E
E and , {a1/y1}1 `E {a1/y1}1 is a leaf node of T 1.
Starting with T 1 we again remove the next application of rule E viz.
- T2 %
, {a1/y1}1 ` y2[2]
E
, {a1/y1}1 `E {a2/y2}2
to obtain
H OME PAGE
JJ
-T2%
, {a1/y1}1, {a2/y2}2 `E
J
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
541 OF 788
Q UIT
- T2 %
, {a1/y1}1 ` y2[2]
does not involve any application of rule E and is the required tree
- T20 %
, {a1/y1}1 ` y2[2]
Proceeding in this fashion we get proof trees
-Ti%
, {a1/y1}1, {ai/yi}i `E
in which there are exactly k i applications of rule E and for i = k we get
-Tk%
, {a1/y1}1, {ak /yk }k `
which is completely free from all applications of rule E.
Further it is also clear that for each i, 1 i k there exist proof trees
- Ti 0 %
, {a1/y1}1, {ai1/yi1}i1 ` yi[i]
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
542 OF 788
Q UIT
(18)
Since the original proof is correct by definition 24.2, there is no occurrence of any of the constants
ai, 1 i k, in . Further the proof (18) does not utilise the constant ak as anything more than
a symbol. It also does not generalise on ak anywhere within the proof. Clearly then replacing this
constant ak by a fresh variable symbol zk (which occurs nowhere in any of the proofs including
proof (18)) does not affect the correctness of the proof.
Take a fresh variable zk which does not occur anywhere in the proof (18) and replace all occurrences
of ak by zk to obtain proof (19).
, {a1/y1}1, . . . , {ak1/yk1}k1 ` {zk /yk }k
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
(19)
543 OF 788
Q UIT
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
544 OF 788
Q UIT
Exercise 24.1
1. Use the method outlined in the proof of theorem 24.3 to transform the proof `E x[] of
example 24.1 to one without the use of rule E.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
545 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
546 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
547 OF 788
Q UIT
1. Natural Deduction: 6
2. Moving Quantifiers
3. Quantifier Movement
4. More on Quantifier Movement
5. Prenex Normal Forms
6. The Prenex Normal Form Theorem
7. Prenex Conjunctive Normal Form
8. The Herbrand Algebra
9. Terms in a Herbrand Algebra
10. Herbrand Interpretations
11. Herbrand Models
12. Ground Quantifier-free Formulae
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
548 OF 788
Q UIT
Natural Deduction: 6
The introduction and elimination rules for the propositional operators along with the rules I, E, I and E comprise the system G1.
Introduction
Elimination
` {t/x}X
` x[X]
I.
E.
` x[X]
` {t/x}X
{t/x} admissible in X
` {t/x}X
` x[]
I.
E.
` x[X]
` {a/x}
a 6 F V () F V (x[]) is fresh
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
549 OF 788
Q UIT
Exercise 25.1
1. Prove the arguments in Problem 2 of exercise 17.1 using Natural Deduction.
2. There have been frequent complaints that Logic (of any order) is cold-blooded of the first order.
Lets dispel this notion. Consider the following premises.
All the world loves a lover. Romeo loves Juliet.
Now prove the following conclusions using Natural Deduction.
(a) Therefore I love you.
(b) Therefore Love loves Love.11
(c) Therefore if I love you, then you love me.
(d) Therefore you love yourself.
(e) Therefore everyone loves everyone.
11 This
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
550 OF 788
Q UIT
3. Refer to the premises in Problem 2 above. Which of the conclusions becomes invalid if the
premise Romeo loves Juliet is removed? Further, does it follow that love is an equivalence
relation?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
551 OF 788
Q UIT
Moving Quantifiers
Notation.
i {, }, for 1 i m.
m xm
1 x1 2 x2 . . .
JJ
II
H OME PAGE
LCS
G O B ACK
F ULL S CREEN
C LOSE
552 OF 788
Q UIT
Quantifier Movement
Lemma 25.1 Let z 6 F V () F V () {x1, . . . , xn}. Then the
following logical equivalences hold for 0 {, }.
0
0
1. x y[]
x y[]
0
0
2. x[ y[] ] x z[{z/y} ]
0
0
3. x[ y[]] x z[ {z/y}]
Q
Q Q
Q Q
Q Q
Q
Q
Q Q
Q Q
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
553 OF 788
Q UIT
0z[{z/y} ]
Q
Q
Q
Q
Corollary 25.2
0
4. x[ y[] ]
5. x[ 0y[]]
6. x[ 0y[]]
0
7. x[ y[] ]
0z[ {z/y}}]
0z[ {z/y}}]
0z[{z/y} ]
Q Q
Q
Q
Q
Q
Q Q
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
554 OF 788
Q UIT
Exercise 25.2
1. Prove lemma 25.1.
2. Prove corollary 25.2.
Having obtained the above results we are now ready to prove the Prenex normal form theorem. But first lets define the
form precisely.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
555 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
556 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
557 OF 788
Q UIT
QED
12 That
H OME PAGE
is, ensure that no two quantifiers use the same bound variable and no variable occurs both free and bound in the formula.
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
558 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
559 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
560 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
561 OF 788
Q UIT
Herbrand Interpretations
Lemma 25.8 Given a Herbrand interpretation (H, vH) where for
each variable x, v(x) = sx T0(). For any term t with V ar(t) =
{x1, . . . , xk }
VHJtKvH = {sx1 /x1, . . . , sxk /xk }t
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
562 OF 788
Q UIT
Herbrand Models
Definition 25.9 A Herbrand model of a set of -formulae is
merely a valuation vH such that every formula in is true under
the substitution defined by vH F V ().
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
563 OF 788
Q UIT
2.
pair.
^
1ik
3.
1ik
4.
1ik
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
564 OF 788
Q UIT
2.
i cannot be valid since from the previous part we know that i has a model, where i is
1ik
the complement of i.
_
3.
i has a model because i has a model.
1ik
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
565 OF 788
Q UIT
4.
i is valid iff
1ik
1ik
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
566 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
567 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
568 OF 788
Q UIT
1. Skolemization
2. Skolem Normal Forms
3. SCNF
4. Ground Instance
5. Herbrands Theorem
6. The Herbrand Tree of Interpretations
7. Compactness of Sets of Ground Formulae
8. Compactness of Closed Formulae
9. The Lowenheim-Skolem Theorem
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
569 OF 788
Q UIT
Skolemization
Theorem 26.1 (Skolem Normal Form Theorem.) Let
0
1. every model of x[{g(x1, . . . , xn)/y}] is a model of .
Q
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
570 OF 788
Q UIT
Define a function g which for each n-tuple (a1, . . . , an) |An| provides a single element a |A|
such that
T JKv[x1:=a1,...,xn:=an][y:=a] = 1
Then clearly for every (a1, . . . , an) |An| we have
T JKv[x1:=a1,...,xn:=an][y:=gA(a1,...,an)] = 1
Now let A B where B is a g -algebra with g B = g. It is then clear that for every valuation vB,
T J{g(x1, . . . , xn)/y}KvB = 1
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
571 OF 788
Q UIT
and hence B
0.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
572 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
573 OF 788
Q UIT
SCNF
Theorem 26.4 For every sentence (closed formula) P1()
there is an algorithm sko to construct a closed universal formula
SCN F 1() such that has a model iff has a model.
2
Definition 26.5
1. The function g in theorem 26.1 is called a Skolem function
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
574 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
575 OF 788
Q UIT
example of a formula which has two (or even more) different SNFS, 0, 00 such that
6 0 6 00 6
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
576 OF 788
Q UIT
Ground Instance
Definition 26.6 Let be a signature containing at least
one constant and let be a nonempty set of closed
universal -formulae.
For any ~[] where
QF 1(), the ground-instances of denoted g() is the set
{{t1/x1, ,[
tn/xn} | F V () = {x1, . . . , xn}, t1, . . . , tn T0()}
and g() =
g().
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
577 OF 788
Q UIT
Herbrands Theorem
Theorem 26.7 (Herbrands Theorem). Let and be as in
definition 26.6. Then the following statements are equivalent.
1. has a model.
2. has a Herbrand model.
3. g() has a model.
4. g() has a Herbrand model.
2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
578 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
579 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
580 OF 788
Q UIT
P0
P0
P1
P1
P2
P2
P2
P1
P1
P2
P2
P2
P2
P2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
581 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
582 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
583 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
584 OF 788
Q UIT
Corollary 26.10 (Finite Unsatisfiability). A set of closed formulae is unsatisfiable iff there is a non-empty finite unsatisfiable subset of .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
585 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
586 OF 788
Q UIT
The Lowenheim-Skolem
Theorem
Theorem 26.11 (The Lowenheim-Skolem Theorem). If a set
of closed formulae has a model, then it has a model with a
domain which is at most countable.
Proof:
Assume has a model. Then sko() has a model
too. By theorem 26.7 sko() has a Herbrand model. Since a
Herbrand model has a domain which is at most countable and
since every model of sko() is also a model of , it follows that
has a model with at most a countable domain. QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
587 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
588 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
589 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
590 OF 788
Q UIT
1. Substitutions Revisited
2. Some Simple Facts
3. Ground Substitutions
4. Composition of Substitutions
5. Substitutions: A Monoid
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
591 OF 788
Q UIT
Substitutions Revisited
We have defined substitutions and instantiations earlier. In light
of the Lowenheim-Skolem
theorem 26.11, we
1. require more powerful operations on syntactic substitutions
to exploit the construction of Herbrand models,
2. need to extend the theory of substitutions to include a composition operator for substitutions.
3. need to give a programing interpretation to First-order logic.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
592 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
593 OF 788
Q UIT
Ground Substitutions
Definition 27.3
= {ti/xi | ti 6 xi, 1 i n} is a ground substitution if each
ti, 1 i n, is a ground term.
A term u is called an instance of a term t if there exists a
substitution such that u t.
u is a ground instance of t if u is an instance of t and is ground.
u is a common instance of two or more terms t1, . . . , tn if there
exist substitutions 1, . . . , n such that
u 1t1 ntn
Terms t and u are called variants of each other if there exist
substitutions and such that t u and u = t.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
594 OF 788
Q UIT
Composing Substitutions
We will often require to perform substitutions in sequence i.e. it may be necessary to first apply a substitution on a
term t yielding a term t to which another substitution may be applied to yield a term (t). We would like to answer
the question of how to define a single substitution such that for every term u,
(u) u
(20)
Then is the composition of with . Before presenting the formal definition of composition we try to understand
how such a composition must be defined to ensure that equation (20) holds. Let = {s1 /x1 , , sk /xk } and =
{t1 /y1 , , tm /ym }. We have dom() = X = {x1 , , xk } and dom( ) = Y = {y1 , , ym }. The effect of on
any term u is to replace each free occurrence of each variable xi by the term si simultaneously for 1 i k. The
terms si could contain (free) variables drawn from X and Y . It could also happen that some of the terms si may simply
be variables themselves. Consider a single variable xi . If si z for some variable z, then u would simply have z
occurring free in all those positions of u where xi occurs free. Of course, free occurrences of xi could be present in u
because of some other variable substitution (say si0 /xi0 for some i0 6= i). Hence it is clear that all free occurrences of any
x X in t are due to the application of the substitution . Further, for any yj Y , we have the following possibilities.
1. Case yj Y X and yj F V (u). All such free occurrences of yj in u will be present in the same positions in u
as well. The effect of would be to replace them all with tj .
2. Case yj Y X and yj 6 F V (u). New free occurrences may arise due to the substitution . The effect of the
application of will replace all of them by tj .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
595 OF 788
Q UIT
3. Case yj xi for some xi X. In this case the only free occurrences of yj possible are those which occur after
applying .
To summarise
1. Case 1 requires to be applied separately.
2. The effect of on cases 2 and 3 may be captured by applying to the range of . Once that is done one may even
remove the element tj /yj from the substitution, since it would have no effect.
3. Further all elements such that si xi are removed from , since we are interested in specifying the substitution as
a finite set of non-identical replacements.
With this understanding we are ready to tackle our definition of composition.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
596 OF 788
Q UIT
Composition of Substitutions
Definition 27.4 Given substitutions = {s1/x1, , sk /xk } and
= {t1/y1, , tm/ym}, their composition is a new substitution such that
= { si/xi | 1 i k, si 6 xi}{tj /yj | 1 j m, yj 6 dom()}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
597 OF 788
Q UIT
Substitutions: A Monoid
Lemma 27.5 Given substitutions , , and a term t, we have
1. 1 = 1 =
2. ( )t (t)
3. ( ) = ( )
2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
598 OF 788
Q UIT
QED
Exercise 27.1
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
599 OF 788
Q UIT
1. Let u t. Give examples of t, u and such that F V (t) 6= , u is ground but is not a ground
substitution.
2. Prove that for any substitutions and , = iff dom() dom( ) = and dom( )
S
tran() F V (t) =
3. A substitution is called idempotent if = . Now complete the statement of the following
lemma and prove it.
Lemma 27.6 A substitution = {ti/xi | 1 i m} for some m 0 is idempotent iff
dom() .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
600 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
601 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
602 OF 788
Q UIT
1. Unifiability
2. Unification Examples:1
3. Unification Examples:2
4. Generality of Unifiers
5. Generality: Facts
6. Most General Unifiers
7. More on Positions
8. Disagreement Set
9. Example: Disagreement 1
10. Example: Occurs Check
11. Example: Disagreement 3
12. Example: Disagreement 4
13. Disagreement and Unifiability
14. The Unification Theorem
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
603 OF 788
Q UIT
Syntactic unification is the problem of finding substitutions so as to make two or more terms
syntactically identical. It may be thought of as a special form of equation solving where one attempts
to find solutions to the problem s t by finding suitable instances of the variables in the two terms
in order to make the two terms look identical. The solution of such an equation on essentially
uninterpreted terms is a substitution and the process of finding this solution is called unification. As
in normal equation solving the substitution is to be applied to all the terms that have to be unified.
Moreover as in equation solving, it is possible that no solution exists. A set consisting of two or
more terms is said to be unifiable if such a substitution exists.
We will use words like occurrence, sub-term, depth, size quite liberally. In the light of
the presence of several occurrences of operators, free variables and bound variables (including different bound variable occurrences signifying different variables but possessing the same name e.g.
(x[(xx)] x[(xx)])) in a term, it is useful to define a unique position for each symbol in a term t.
For any term t we have a set of strings P os(t) N which is the set of positions occurring in t.
Further for each p P os(t), there is a unique symbol occurring at that position denoted by pos(p, t).
Definition 28.1
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
604 OF 788
Q UIT
t
c
x
o(t1, . . . , tn)
depth
1
1
1 + M axni=1depth(ti)
size
1
1
Pn
1 + i=1 size(ti)
ST
{t}
{t}
Sn
{t} i=1 ST (ti)
pos
{}
{}
Sn
{} i=1 i.pos(ti)
The functions given in the table above are defined by induction on the structure of term t. is the
empty word on strings, . is the catenation operator on strings and i.pos(ti) = {i.p | p pos(ti)}.
s v t iff s ST (t) is the subterm relation on terms. s is a proper subterm of t (denoted s @ t)
iff s v t and s 6 t.
For any t, the subterm at position p pos(t) is denoted t|p and defined by induction on p as
follows: t| t, and for t o(t1, . . . , tn), t|i.p0 ti|p if p = i.p0 pos(t)
For any term t and any position p pos(t), sym(p, t) yields the symbol at position p in the term
t.
The position is called the root position and the symbol at the root position is called the
root symbol. Hence rootsym(t) = sym(, t) and for any position p pos(t), sym(p, t) =
rootsym(t|p).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
605 OF 788
Q UIT
The set of occurrences of a symbol V in a term is defined as the set Occ(, t) of positions
in which that symbol occurs i.e. Occ(, t) = {p pos(t) | sym(p, t) = }.
Facts 28.2 For any term t and positions p, q pos(t), t|q @ t|p iff p q.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
606 OF 788
Q UIT
Unifiability
Definition 28.3 A nonempty finite set of terms {ti | 1 i n},
n > 1 is said to be unifiable if there exists a substitution such
that
t1 t2 tn
is called a unifier of {ti | 1 i n}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
607 OF 788
Q UIT
Unification Examples:1
Example 28.4 Let f and g be distinct binary operators and
x, y, v, w V .
1. The terms f (x, y) and f (v, w) may be unified by the substitution = {x/v, y/w} since f (v, w) f (x, y) f (x, y). They
may also be unified by 1 = {v/x, w/y}.
2. Let r, s, t be any three terms.
Then f (x, y)
and f (v, w) may be unified by the substitution
= {g(s, t)/v, f (r, r)/w, g(s, t)/x, f (r, r)/y}.
3. The terms f (x, y) and f (y, x) may be unified by = {x/y}
since f (x, y) f (x, x) f (y, x).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
608 OF 788
Q UIT
Unification Examples:2
Example 28.5 Let f and g be distinct binary operators.
1. The terms f (x, y) and g(x, y) cannot be unified by any substitution.
2. The terms f (x, y) and f (y, x) cannot be unified by =
{x/y, y/x} since f (x, y) f (y, x) and f (y, x) f (x, y).
Hence f (x, y) 6 f (y, x).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
609 OF 788
Q UIT
The following facts are easy to prove and may be used without any mention of them in the sequel.
Fact 28.6 Let s and t be any two terms and let p pos = pos(s) pos(t). Then
1. If s|p t|p for any position p pos then for all positions p, q pos, p q implies s|q t|q .
2. If rootsym(s|p) = o1 6 o2 = rootsym(t|p) then s and t are not unifiable under any substitution.
3. If s and t are unifiable then for every position p pos, rootsym(s|p) 6 rootsym(t|p) implies at
least one of the symbols is a variable i.e. {rootsym(s|p), rootsym(t|p)} V 6=
Exercise 28.1
1. Generalize the fact 28.6 to nonempty finite sets of terms.
2. Construct an example to show that the converse of fact 28.6.3 does not hold.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
610 OF 788
Q UIT
Generality of Unifiers
There is a certain sense in which may be regarded as being
more general than in example 28.4.
Definition 28.7
A substitution is at least as general as another substitution
(denoted & ) if there exists a substitution such that
= .
if & & .
is strictly more general than (denoted ) if & and
6& .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
611 OF 788
Q UIT
Generality: Facts
Fact 28.8
1. & is a preordering relation on S(V ) i.e. it is a reflexive and
transitive relation.
2. is an irreflexive and transitive relation on S(V ).
3. is an equivalence relation on S(V ).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
612 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
613 OF 788
Q UIT
More on Positions
For any nonempty set of terms T , we have
\
P os(T ) =
{pos(t)} =
6
tT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
614 OF 788
Q UIT
Disagreement Set
Definition 28.11 Given a set T (|T | > 1) of terms (also viewed
as a set of abstract syntax trees), the disagreement set of T is
defined as the set T |q of subterms rooted at some position q
such that
1. not all the terms in T |q have the same root symbol and
2. for every p q, |rootsym(T |p)| = 1, where is the properprefix relation on strings.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
615 OF 788
Q UIT
We have seen that pos(t) for any term t is partially ordered by the relation which inverts the proper
sub-term ordering on ST (t) (Fact 28.2). For the purpose of specifying the unification algorithm, it
is useful to define a total order < on the positions of terms which is consistent with . Intuitively if
u = o(t1, t2 . . . , tn) we would like to specify recursively that
the root position u precedes the root positions of all the subterms t1, . . . , tn. (which is taken care
of by the prefix ordering on positions) i.e. < i for all 1 i n
for each i, j such that 1 i < j n, the position of the root of ti precedes that of tj in the total
ordering.
If i < j, then the position of the root of any proper subterm of ti precedes the position of any
subterm of tj (including the root).
Definition 28.12 For any positions p, q pos(t), p < q iff one of the following conditions holds.
p = 6= q or
(p = i.p0, q = i.q 0 and p0 < q 0) or
(p = i.p0, q = j.q 0 and i < j).
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
616 OF 788
Q UIT
If all operators in are always used in prefix form then each term may also be regarded as a string
in ( {(, )}). The ordering < on pos(t) simply becomes the left-to-right ordering of symbols in
the well-formed terms of T(V ) represented as strings.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
617 OF 788
Q UIT
1:
2:
D ISAGREEMENT
(T ) = D ISAGREE(T, , P os(T ) {}) where
T
P os(T ) = tT P os(t) {At least P os(T )} and
df
3:
4:
5:
6:
7:
8:
9:
10:
H OME PAGE
D ISAGREE(T, p, P ) =
if |rootsym(T |p)| = 1 then
if P 6= then
let p0 = M in(P ); P 0 = P {p0} in
D ISAGREE(T, p0, P 0)
end let
else {There is no disagreement}
return fail
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
618 OF 788
Q UIT
11:
12:
13:
14:
end if
else {A disagreement has been found at position p}
return T |p
end if
The function M in used in the algorithm above is the minimum position with respect to the total
ordering < on positions (definition 28.12) in a term.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
619 OF 788
Q UIT
Example: Disagreement 1
Example 28.13 Consider the set of terms
S1 = {f (a, x, h(g(z))), f (z, h(y), h(y))}
where a is a constant, f is a ternary operator and g and h are
unary operators. In this case, reading the terms from left to
right we get a disagreement set D1 = {a, z}. On the other
hand, reading from right to left we obtain the disagreement set
D10 = {g(z), y} which requires going down one level deeper.
The algorithm however will compute the leftmost disagreement
D1 always.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
620 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
621 OF 788
Q UIT
Example: Disagreement 3
Example 28.15 Consider the set
S3 = {f (a, x, h(g(z))), f (b, h(y), h(y))}
where a and b are both constant symbols. Here a disagreement
set is D3 = {a, b}. Again it is clear that S3 is not unifiable.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
622 OF 788
Q UIT
Example: Disagreement 4
Example 28.16 Consider the set
S4 = {f (h(z), x, h(g(z))), f (g(x), h(y), h(y))}
Here we have a disagreement set D4 = {h(z), g(x)}. Since
h(z) cannot be unified with g(x) under any substitution of free
variables, S4 is not unifiable.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
623 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
624 OF 788
Q UIT
The above facts reduce the problem of finding a unifier if it exists, to that of systematically finding
disagreement sets and unifying them.
Finding a unifier for a disagreement set is a pre-requisite for finding a unifier for the original set of
terms. A disagreement set consists of subterms of the original set of terms at a particular position
such that at least two distinct (sub-)terms exist in the set. Further a disagreement set is unifiable
only if there is at most one non-variable term in it. By choosing a substitution {t/x} where both t
and x are terms in the disagreement set satisfying the condition x 6 F V (t), there is a possibility of
unifying the disagreement set. The algorithm constructs a sequence of singleton substitutions whose
composition yields a most general unifier if it exists.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
625 OF 788
Q UIT
Algorithm: Unification
Require: S f T(V ) and |S| > 1
Ensure: If S is not unifiable then fail else S(V ) : |S| = 1
and is a mgu of S
df
1:
2:
3:
4:
5:
6:
7:
H OME PAGE
PARTIAL U NIFY(, S) =
let T = S in
if |T | = 1 then
return { is a mgu of S}
else {There is a position at which at least two terms are different}
let D = D ISAGREEMENT(T ) in
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
626 OF 788
Q UIT
8:
9:
10:
11:
12:
13:
14:
15:
16:
H OME PAGE
if x D V : t T [x 6 F V (t)] then
Choose t T : x 6 F V (t)
PARTIAL U NIFY({t/x} , S)
{T = S |{t/x}T | < |T |}
{|({t/x} )S| < |S| |S|}
else {Occurs check fails so S is not unifiable}
return fail
end if
end let
end if
end let
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
627 OF 788
Q UIT
Example 28.18 Consider the set S = S1 in example 28.13. Starting with 0 = 1 we go through the
following steps to obtain a unifier of S.
i
0
1
2
3
i
0
1
2
3
i S
0 S
1 S
2 S
3 S
=1
= {a/z} 0
= {h(y)/x} 1
= {g(z)/y} 2
Di
= {f (a, x, h(g(z))), f (z, h(y), h(y)}
D0
= {f (a, x, h(g(z))), f (a, h(y), h(y)}
D1
= {f (a, h(y), h(g(z))), f (a, h(y), h(y)} D2
= {f (a, h(g(z)), h(g(z))}
D3
= {a, z}
= {x, h(y)}
= {g(z), y}
=
Hence the required unifier is 3 = {g(z)/y} {h(y)/x} {a/z} 1 = {a/z, h(g(z))/x, g(z)/y}.
Example 28.19 Let S = {f (y, z, w), f (g(x, x), g(y, y), g(z, z))} where f is a ternary operator and
g is a binary operator. An attempt to apply the algorithm yields the following sequence of substitutions: 1 = {g(x, x)/y} from which we get 1S = {f (g(x, x), z, w), f (g(x, x), g(g(x, x), g(x, x)), g(z, z))}
and then 2 = {g(g(x, x), g(x, x))/z} which yields
2S = {f (g(x, x), g(g(x, x), g(x, x)), w),
f (g(x, x), g(g(x, x), g(x, x)), g(g(g(x, x), g(x, x)), g(g(x, x), g(x, x))))} and finally
3 = {g(g(g(x, x), g(x, x)), g(g(x, x), g(x, x)))/w} 2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
628 OF 788
Q UIT
Hence in general there are pathological cases which make the algorithm very expensive to run,
having a complexity that is exponential in the length of the input i.e. to unify the set
{f (x1, . . . , xn), f (g(x0, x0), , g(xn1, xn1))}
would require a substitution that has 2k 1 occurrences of the symbol g in the substitution of the
variable xk .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
629 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
630 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
631 OF 788
Q UIT
a
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
632 OF 788
Q UIT
Exercise 28.2
1. Generalize the facts 28.6 to a set S of terms where |S| 2.
2. Identify the relationships among the different substitutions , 1, , , and 1 in examples
28.4 and 28.5
3. Let D be the disagreement set of S.
(a) Can |D| be different from |S|? Justify your answer.
(b) If S = D then under what conditions is S unifiable?
(c) If S 6= D then what can you say about the depths of terms in D as compared to the depths of
terms in S?
4. Construct an example of a set S of terms with disagreement set D in which there exist a variable
x and a term t such that x F V (t) and yet the set S is unifiable.
5. Prove that if S is unifiable then the mgu computed by the unification algorithm is idempotent.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
633 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
634 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
635 OF 788
Q UIT
1. Recapitulation
2. SCNFs and Models
3. SCNFs and Unsatisfiability
4. Representing SCNFs
5. Clauses: Terminology
6. Clauses: Ground Instances
7. Facts about Clauses
8. Clauses: Models
9. Clauses: Herbrands Theorem
10. Resolution in FOL
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
636 OF 788
Q UIT
Recapitulation
1. For any set {} (where may or may not be empty) of
closed -formulae |= iff {} is unsatisfiable.
2. A non-empty set of closed -formulae is unsatisfiable iff it
contains a non-empty finite unsatisfiable subset.
3. A set of closed -formulae has a model iff it has a Herbrand
model
4. A non-empty finite set
V of closed -formulae is unsatisfiable
iff the formula is unsatisfiable.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
637 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
638 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
639 OF 788
Q UIT
Representing SCNFs
Definition 29.1 Let the SCNF sko() be represented by a set
sko() = {Ci | 1 i m}
such that
sko() ~[
Ci ]
1im
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
640 OF 788
Q UIT
Clauses: Terminology
Definition 29.2
1. A clause is a finite set of literals.
2. The empty clause is the empty set of literals ({}).
3. A ground clause is a clause with no occurrences of variables.
4. For any substitution , and clause C = {j | 1 j n},
C = {j | 1 j n}.
Compare with clauses in propositional logic
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
641 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
642 OF 788
Q UIT
1im
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
643 OF 788
Q UIT
Clauses: Models
Definition 29.5
1. A structure A is a model of a
clause C = {j | 1 j n} (denoted A
C) iff n > 0
W
~
and A
[ 1jn j ].
a set S of clauses (denoted A
S) if it is a model of every
clause in S.
2. S |= C iff every model of S is also a model of C.
Note: An empty clause has no models.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
644 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
645 OF 788
Q UIT
Resolution in FOL
Compare with resolution in propositional logic
S
Res1
0 }
(S {Ci, Cj }) {Cij
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
646 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
647 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
648 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
649 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
650 OF 788
Q UIT
Factoring
2. Unlike in the case of propositional resolution it should be possible to eliminate several literals at once
Example 30.2 Consider the set S = {C1, C2} where
C1 = {p(x), p(y)}
C2 = {p(u), p(v)}
S is clearly unsatisfiable but by removing only one literal at a
time with the substitution {x/u} yields the new clause
0 = {p(y), p(v)}
C12
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
651 OF 788
Q UIT
Example: 1
Example 30.3 Consider the set S = {C1, C2} where
C1 = {q(x, y), q(y, z), q(x, z)}
x, y, z[(q(x, y) q(y, z)) q(x, z)]
which represents transitivity and
C2 = {q(u, v), q(v, u)}
u, v[q(u, v) q(v, u)]
which represents symmetry.
A logical consequence of these two properties is the property
derived below.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
652 OF 788
Q UIT
C1 = {q(x, y), q(y, z), q(x, z)}, {q(u, v), q(v, u)} = C2
= {z/u, y/v
0
{q(x, y), q(x, z), q(z, y)} = C12
0 = {q(x, y), q(z, y), q(x, z)}
C12
x, y, z[(q(x, y) q(z, y)) q(x, z)]
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
653 OF 788
Q UIT
Example: 2
Example 30.4 Suppose we need to prove that if a binary relation p is reflexive
df
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
654 OF 788
Q UIT
After renaming bound variables and converting into SCNF to get the
clauses
C1 = {p(x, x)}
C2 = {p(u, v), p(u, w), p(v, w)}
The mgu = {x/u, x/w} yields the required clause
0 = {p(x, v), p(v, x)}
C12
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
655 OF 788
Q UIT
Refutation
Refutation in propositional logic
=
{C3, C4}
where a and b are skolem constants.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
656 OF 788
Q UIT
{C1 = {p(x, x)}, C2 = {p(u, v), p(u, w), p(v, w)}, C3 = {p(a, b)}, C4 = {p(b, a)}}
= {x/u, x/w}
0
{C12
= {p(x, v), p(v, x)}, C3 = {p(a, b)}, C4 = {p(b, a)}} 0
= {a/x, b/v}
0
{C124
= {p(a, b), }, C3 = {p(a, b)}, } 00
=1
{{}}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
657 OF 788
Q UIT
3. Try a refutation proof using = {x/u, x/w, x/v} as the first unifier in example 30.5. Why
doesnt it work?
4. Try a refutation proof using = {x/u, x/w, y/v} as the first unifier in example 30.5. Why does
it work?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
658 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
659 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
660 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
661 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
662 OF 788
Q UIT
i]
(21)
j ]
(22)
i Ci
A ~[
_
i Cj
JJ
II
LCS
G O B ACK
(23)
(24)
F ULL S CREEN
C LOSE
663 OF 788
Q UIT
({} Ci0)
(25)
_
A
({} Cj0 )
(26)
Let Ci0 = {i0 | 1 i0 k} and Cj0 = {j 0 | 1 j 0 l}. Then we have the following table
which shows a case analysis for the various values of k and l.
{} Ci0
k=0=l
k = 0, l > 0
k > 0, l = 0 (1 k )
k, l > 0
(1 k )
{} Cj0
(1 l )
(1 l )
Ci0 Cj0
{}
1 l
1 k
(1 k ) (1 l )
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
664 OF 788
Q UIT
Ground Clauses
Theorem 31.4 (Completeness of Resolution Refutation for
ground clauses). Let G be a set of ground clauses. If G does
not possess a model, the empty clause ({}) may be derived by
Res0.
Here Res0 is the propositional resolution rule given by
S
Res0
0 }
(S {Ci, Cj }) {Cij
0 = C 0 C 0 . Note that there is no substitution involved
where Cij
i
j
anywhere since all clauses are ground.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
665 OF 788
Q UIT
Clearly, #G = 0 iff every clause is made up of a single literal. We proceed to prove the theorem by
induction on #G.
^
Basis. #G = 0. Then each Ci = {i} and G
i and by theorem 25.10, G is unsatisfiable iff
1ik
it contains a complementary pair. Clearly by rule Res0 the resolvent of this complementary pair
is the empty clause.
Induction Hypothesis (IH).
For all k, 0 #G = k < m for some m > 0, if G does not possess a model, then the empty
clause is derivable from G.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
666 OF 788
Q UIT
Induction Step. Assume #G = m > 0. There must be at least one clause Ci which contains more
than one literal. So let Ci = {i} Di with i 6 Di 6= . Let Gi1 = (G {Ci}) {Di} and
Gi2 = (G {Ci}) {i}. Clearly #Gi1 < #G and #Gi2 < #G. Further if G does not have a
model then neither Gi1 nor Gi2 has a model (if either of them had a model then so would G since
W
Ci i Di). By the induction hypothesis,
1. there exists a resolution proof R1 from Gi1 which derives the empty clause and
2. there is another resolution proof R2 from Gi2 which also derives the empty clause.
Notice that since we are dealing only with ground literals, all resolvents are obtained by applying
the rule Res0.
Consider the proof R10 obtained from R1 by adding the literal i to Gi1 and performing exactly
the same sequence of resolutions.
Case 1. If the proof R1 did not involve the use of any of the literals from Di and the empty
clause was derived, then clearly the same sequence with i included would also derive the
empty clause and that completes the proof.
Case 2 On the other hand if one or more steps in proof R1 involved literals from Di then
the resulting proof R10 may derive the clause {i} in place of the empty clause. However
we do know that the empty clause is derived from Gi2 in proof R2. This implies there exist
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
667 OF 788
Q UIT
resolution steps in R2 involving the literal i which derive the empty clause. Therefore there
exists at least one clause containing the literal i in the set of final clauses obtained in R10 . By
applying the resolution steps of R2 which do not appear anywhere in R10 , the empty clause
would again be derived.
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
668 OF 788
Q UIT
Then there exists a resolvent C12 of C1 and C2 by a single application of resolution via a substitution and a substitution
0 C .
such that C12
12
2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
669 OF 788
Q UIT
C1
C2
C2
lifted to
1C1
C12
2C2
0
C12
0
C12
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
670 OF 788
Q UIT
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
671 OF 788
Q UIT
C1
C2
12
1 C1
C12
12
2 C2
12
0
C12
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
672 OF 788
Q UIT
Completeness of Resolution
Refutation: 1
1. The lifting lemma helps us to use the completeness of resolution refutation for ground clauses and lift it to clauses with
variables.
2. By standardizing variables apart we may guarantee that the
conditions of disjointness of free variables between different
clauses (lemma 31.5) may be enforced.
3. Any set of clauses S = {Ci | 1 i m} represents the
conjunction of the universal closure of each clause.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
673 OF 788
Q UIT
Completeness of Resolution
Refutation: 2
1. The lifting lemma 31.5 guarantees that if the substitutions 1
and 2 are ground, then there exists a corresponding ground
substitution which produces the same effect after resolution.
2. By Herbrands theorem 26.7 a set is unsatisfiable iff a finite
subset of ground instances of is unsatisfiable.
3. To prove the completeness of resolution refutation it is sufficient to consider only the finite set of ground clauses from which
the empty clause {} may be derived.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
674 OF 788
Q UIT
Completeness of Resolution
Refutation: 3
Theorem 31.6 (Completeness of Resolution Refutation). If a set
of clauses is unsatisfiable then the empty clause is derivable
from .
2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
675 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
676 OF 788
Q UIT
C1
C3
C2
12
1C1
C4
34
C12
12
12
3 C3
2C2
C1234
1234
4 C4
34
1234
0
C12
C34
34
0
C34
1234
0
C1234
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
677 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
678 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
679 OF 788
Q UIT
1. FOL: Tableaux
2. FOL: Tableaux Rules
3. FOL Tableaux: Example 1
4. First-Order Tableaux
5. FOL Tableaux: Example 2
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
680 OF 788
Q UIT
FOL: Tableaux
1. The tableau method in principle is similar to
natural deduction in its use of syntactical decomposition,
resolution in using unsatisfiability to prove validity.
2. The tableau method for both propositional and predicate
logic has some advantages over resolution.
3. FOL resolution requires formulae to be converted into PCNF
and then SCNF before resolution may be applied.
4. As in the case of Natural Deduction the tableau method uses
the rules E and E to decompose quantified formulae along
with the same restrictions.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
681 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
682 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
683 OF 788
Q UIT
First-Order Tableaux
1. Unlike propositional tableaux, any satisfiable set of quantified formulae can potentially yield an infinite tableau, since a
formula of the form x[] can have an infinite number of
instances.
2. For unsatisfiable sets, closed finite tableaux may be constructed by applying the following heuristics
Whenever possible apply propositional rules before applying quantifier rules
Apply rules . and . before applying . and . in order
to direct the proof towards a propositional contradiction.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
684 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
685 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
686 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
687 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
688 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
689 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
690 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
691 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
692 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
693 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
694 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
695 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
696 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
697 OF 788
Q UIT
1. Deductive Consistency
2. Models of Deductively Consistent Sets
3. Deductive Completeness
4. The Completeness Theorem
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
698 OF 788
Q UIT
Deductive Consistency
Definition 34.1 A set L1() is deductively consistent iff
there does not exist a formula such that `H1 and
`H1 .
This definition is equivalent to other possible definitions such
as those given below which may all be derived from rule .
Lemma 34.2 The following statements are equivalent.
1. L1() is deductively consistent.
2. There does not exist a formula such that `H1 ( )
3. There exists a formula which is not provable.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
699 OF 788
Q UIT
We have earlier defined the notion of consistency of a set of formulae in propositional logic (see
also lemma 11.1) leading to the notions of maximal consistency and Lindenbaums theorem which
enabled us to extend a consistent set of propositions to a maximally consistent one. Later we have
also defined the notion of consistency of sets of predicate logic formulae in definition 20.2. Notice
that definition 9.1 though worded differently, also states that a set of propositions is consistent only
if it has a model. The notion of a model in sentential logic however, refers to the existence of a
truth assignment under which all the sentences are true (simultaneously). Hence both in sentential
and predicate logic the notion of consistency refers to the existence of a model. These notions of
consistency are model-theoretic since they are intimately associated with the existence of a model.
We have reserved the term deductive consistency (definition 34.1) to a proof-theoretic notion obtained from deductions rather than models. A priori there is no reason to believe that the two notions
are equivalent unless we can prove that our deductive system is sound and complete. While soundness has been proven we need to prove completeness before claiming that the model-theoretic notion
of consistency and the proof-theoretic one are equivalent.
We need to carry our analogies between model-theory and proof theory a little further to the domain
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
700 OF 788
Q UIT
maximal consistent sets (indeed some of the proof ideas would be analogous too!) in order to be able
to prove the completeness of the system H1. We refer to such maximally consistent sets obtained
through deductions as being deductively complete. The main difference however, is that we restrict
ourselves to only closed formulae as will be evident soon.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
701 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
702 OF 788
Q UIT
Deductive Completeness
Lemma 34.4 For any L1(), `H1 iff `H1 [] iff
{[]} is not deductively consistent.
2
We restrict our attention to only deductively consistent and
complete sets.
Definition 34.5 A (deductively consistent) set L1() is deductively complete iff for every closed formula , `H1 or
`H1 .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
703 OF 788
Q UIT
QED
Notes on proof of lemma 34.4.
1. The univeral closure is required in the lemma, because in general the inconsistency of {}
does not imply `H1 .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
704 OF 788
Q UIT
Example 34.6 Let = {x[p(x)]} and p(x). Then {p(x)} is inconsistent. However, it is not possible to prove `H1 p(x).
2. Hence the maximally consistent sets of propositional logic translate into deductively complete
sets in FOL. And this maximal completeness can only be shown for closed formulae and not for
arbitrary formulae with free variables.
3. Clearly deductive completeness therefore is restricted to closed formulae.
The following is the proof-theoretic analogue of Lindenbaums theorem. Even the proof of the
theorem mirrors the alternative proof of Lindenbaums theorem.
Theorem 34.7 (The Extension Theorem) Every deductively consistent set may be extended to a
deductively complete set.
Proof: Let be a nonempty deductively consistent set of -formulae. For any enumeration of
closed -formulae
1, 2, 3, . . .
(28)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
705 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
706 OF 788
Q UIT
` For any arbitrary closed formula , occurs in the enumeration 28 at some position, say
m for some m 0. If m `H1 m then `H1 m. Otherwise m+1 = m {m}
and `H1 m. By definition 34.5 is deductively complete.
a
QED
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
707 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
708 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
709 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
710 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
711 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
712 OF 788
Q UIT
df
= {eirref lexivity }
DG
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
713 OF 788
Q UIT
df
df
df
U G
df
0
Equivalently esymmetry = x, y[e(x, y) e(y, x)] (see exercise 20.1.12) may be used in place of esymmetry .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
714 OF 788
Q UIT
df
IP O
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
715 OF 788
Q UIT
df
<trichotomy
df
ILO
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
716 OF 788
Q UIT
(Reflexive) Preorders
= {; : s2}
df
P re
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
717 OF 788
Q UIT
df
= x[x x]
ref lexivity
df
transitivity
df
P O
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
718 OF 788
Q UIT
df
LO
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
719 OF 788
Q UIT
Equivalence Relations
= {; : s2}
df
df
= x, y[(x y) (y x)]
df
Equiv
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
720 OF 788
Q UIT
Peanos Postulates
P1. 0 is a natural number.
P2. If x is a natural number then x+1 (called the successor of x)
is a natural number.
P3. 0 6= x+1 for any natural number x.
P4. x+1 = y +1 implies x = y
P5. Let P be a property that may or may not hold of every natural number. If
Basis. 0 has the property P and
Induction Step. whenever a natural number x has the property P , x+1 also has the property P
then all natural numbers have the property P .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
721 OF 788
Q UIT
df
df
= xy[x+1 = y +1 x = y]
df
n
(+1)
(+1)ndistinct = x[(x
= x)]
df
(+1)distinct = {(+1)ndistinct | n > 0}
df
S
= {0notsuccessor , +1injective, 6=0successor }
(+1)distinct
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
722 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
723 OF 788
Q UIT
m
(+1)
modulo m = x[x
= x]
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
724 OF 788
Q UIT
one for each n > 0. For simplicity let us call these elements
10, 20, 30, . . .. Each of these new elements is different from every element in N.
Since 00 6= 0, it must have a predecessor say 10
which again leads to the addition of all the elements
20, 30, 30, . . . each of which is distinct and different from
all other elements. Let us call this set of elements Z0.
N0S = hN Z0, S i is a model of S and is said to be nonstandard.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
725 OF 788
Q UIT
Z-Chains
Z0 is called a Z-Chain.
N0S = hN Z0, S i is also a countable model of the axioms
S .
Further NS and N0S are not isomorphic
We could add a countable number of distinct Z-chains, Z00,
Z000, Z0000, etc. to obtain other distinct and mutually nonisomorphic models.
Each of the models obtained above is a also a countable
model of S .
Each of these models is also non-standard.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
726 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
727 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
728 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
729 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
730 OF 788
Q UIT
df
=
Consider any clause C = {1, . . . , p} {1, . . . , n} where
i, 1 i p are positive literals and j , 1 j n are the
negative literals. Then we have
W
W
~
C [( 1ip i) ( 1jn j )]
W
V
~
[( 1ip i) ( 1jn j )]
V
W
~
[( 1jn j ) ( 1ip i)]
W
V
~
[( 1ip i) ( 1jn j )]
df
= 1 , . . . , p 1 , . . . , n
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
731 OF 788
Q UIT
Horn Clauses
Definition 36.1 Given a clause
df
C = 1, . . . , p 1, . . . , n
Then C is a Horn clause if 0 p 1.
C is called a
program clause or rule clause if p = 1,
fact or unit clause if p = 1 and n = 0,
goal clause or query if p = 0,
Each j is called a sub-goal of the goal clause.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
732 OF 788
Q UIT
Goal clauses
Given a goal clause
df
G =
1 , . . . , n
~[1 . . . n]
~[1 . . . n]
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
733 OF 788
Q UIT
Logic Programs
Definition 36.2 A logic program is a finite set of Horn clauses,
i.e. it is a set of rules P = {h1, . . . , hk }, k 0 with
hl l 1l , . . . , nl l , for 0 l k. l is called the head of
the rule and 1l , . . . , nl l is the body of the rule.
Given a logic program P and a goal clause G = {1, . . . , n} the
basic idea is to show that
P {G} is unsatisfiable
~[1 n] is a logical consequence of P
~[1 n] is a logical consequence of P
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
734 OF 788
Q UIT
Sorting in Logic
sort(x, y)
sorted(nil)
sorted(x.nil)
sorted(x.y.z)
lesseq(x, x)
lesseq(x, y)
perm(nil, nil)
perm(x.y, u.v)
delete(x, x.y, y)
delete(x, y.z, y.w)
H OME PAGE
JJ
II
G O B ACK
F ULL S CREEN
C LOSE
735 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
736 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
737 OF 788
Q UIT
p a r t i t i o n (M, [ ] , [ ] , [ ] ) .
p a r t i t i o n (M, H . T , H . Lesser , G r e a t e r ) : H=<M,
p a r t i t i o n (M, T , Lesser , G r e a t e r )
p a r t i t i o n (M, H . T , Lesser , H . G r e a t e r ) : M<H,
p a r t i t i o n (M, T , Lesser , G r e a t e r )
append ( [ ] , L , L ) .
append (H . T , L , H . A ) : append ( T , L , A ) .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
738 OF 788
Q UIT
Prolog: SEND+MORE=MONEY
smm :
L = [ S , E , N, D,M, O, R, Y ] ,
Digits = [0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9] ,
assign digits (L, Digits ) ,
M > 0, S > 0,
1000S + 100E + 10N + D +
1000M + 100O + 10R + E =:=
10000M + 1000O + 100N + 10E + Y ,
write (
) , w r i t e ( S ) , w r i t e ( E ) , w r i t e (N) , w r i t e (D) , n l ,
w r i t e ( + ) , w r i t e (M) , w r i t e (O) , w r i t e (R) , w r i t e ( E ) , n l ,
w r i t e ( ----- ) , n l ,
w r i t e ( = ) , w r i t e (M) , w r i t e (O) , w r i t e (N) , w r i t e ( E ) , w r i t e ( Y ) , n
s e l e c t (Z , [ Z |R] , R ) .
s e l e c t ( Z , [ Y | Zs ] , [ Y | Ys ] ) : s e l e c t ( Z , Zs , Ys ) .
List ).
assign digits ( [] ,
a s s i g n d i g i t s ( [ D| Ds ] , L i s t ): s e l e c t (D, L i s t , NewList ) ,
a s s i g n d i g i t s ( Ds , NewList ) .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
739 OF 788
Q UIT
Prolog: Naturals
isnf (z ).
i s n f ( s ( X ) ) : i s n f ( X ) .
r e w r i t e ( X , X ) : i s n f ( X ) .
r e w r i t e ( s ( X ) , s ( Y ) ) : r e w r i t e ( X , Y ) , i s n f ( Y ) .
r e w r i t e ( a ( z , Y ) , Y ) : i s n f ( Y ) .
r e w r i t e ( a ( Y , z ) , Y ) : i s n f ( Y ) .
r e w r i t e ( a ( s ( X ) , Y ) , s ( Z ) ) : r e w r i t e ( a ( X , Y ) , Z ) .
r e w r i t e ( a ( X , s ( Y ) ) , s ( Z ) ) : r e w r i t e ( a ( X , Y ) , Z ) .
r e w r i t e ( a ( X , Y ) , Z ) : r e w r i t e ( X , U) , r e w r i t e ( Y , V ) , r e w r i t e ( a (U, V ) , Z ) .
even ( z ) .
even ( s ( s ( X ) ) ) : r e w r i t e ( X , Y ) , even ( Y ) .
odd ( X ) : n o t even ( X ) . % n e g a t i o n as f a i l u r e
/ rewrite (a(a( s ( z ) , s ( s ( z ) ) ) , a( s ( z ) , s ( s ( z ) ) ) ) , X) .
X = s ( s ( s ( s ( s ( s ( z ) ) ) ) ) ) /
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
740 OF 788
Q UIT
/ I m p l e m e n t i n g d o u b l e e n d e d q u e u e s t h r o u g h c o n s t r u c t o r s /
deq ( n u l l q ) .
deq ( f n q (A, D ) ) : i n t e g e r (A) , deq (D ) .
deq ( r n q ( B , D ) ) : i n t e g e r (B ) , deq (D ) .
n o n n u l l ( f n q (A, D ) ) : i n t e g e r (A) , deq (D ) .
n o n n u l l ( r n q ( B , D ) ) : i n t e g e r (B ) , deq (D ) .
deq ( f d q (D ) ) : n o n n u l l (D ) .
deq ( r d q (D ) ) : n o n n u l l (D ) .
nf ( nullq ) .
n f ( f n q (A, D ) ) : i n t e g e r (A) , n f (D ) .
r e w r i t e (D, D) : n f (D ) .
%i n d u c t i o n s t e p f o r n o r m a l f o r m s
r e w r i t e ( f n q (A, D) , f n q (A, E ) ) : i n t e g e r (A) , r e w r i t e (D, E ) .
% f o r a l l forms o t h e r than normal forms
r e w r i t e ( r n q ( B , n u l l q ) , f n q ( B , n u l l q ) ) : i n t e g e r (B ) . % b a s i s o f i n d u c t i o n
r e w r i t e ( r d q ( f n q (A, n u l l q ) ) , n u l l q ) . % b a s i s o f i n d u c t i o n
% r e w r i t e ( f d q ( f n q (A, n u l l q ) ) , n u l l q ) f o l l o w s from t h e more g e n e r a l r e w r i t e
r e w r i t e ( f d q ( f n q (A, D ) ) , E): i n t e g e r (A) , r e w r i t e (D, E ) . % f d q f o r a l l n o n n u l l
r e w r i t e ( r n q ( B , f n q (A, D ) ) , f n q (A, E ) ) : % f o r r n q on n o r m a l f o r m s
i n t e g e r (A) , i n t e g e r (B ) ,
r e w r i t e (D, F ) ,
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
741 OF 788
Q UIT
r e w r i t e ( rnq (B, F ) , E ) , nf (E ) .
r e w r i t e ( r n q ( B , D) , E ) : % f o r r n q on o t h e r f o r m s
i n t e g e r (B ) ,
r e w r i t e (D, F ) ,
r e w r i t e ( rnq (B, F ) , E ) .
r e w r i t e ( r d q ( f n q (A, D ) ) , f n q (A, E ) ) :
i n t e g e r (A) ,
r e w r i t e (D, F ) , n o n n u l l ( F ) ,
r e w r i t e ( rdq ( F ) , E ) .
% f o r r d q on n o r m a l f o r m s
r e w r i t e ( r d q (D) , E ) : % f o r r d q on o t h e r f o r m s
r e w r i t e (D, F ) , r e w r i t e ( r d q ( F ) , E ) .
% r e w r i t e ( r d q ( r n q ( B , D ) ) , D) f o l l o w s by i n d u c t i o n from t h e v a r i o u s r e w r i t e s a b o v e
f v ( f n q (A, D) , D): i n t e g e r (A) , deq (D ) . % v a l u e a t t h e f r o n t o f t h e d e q u e u e
r v ( f n q (A, n u l l q ) , B) : i n t e g e r (A) , A=B .
r v ( f n q (A, D) , B) : i n t e g e r (A) , r e w r i t e (D, E ) , r v ( E , B ) .
r v (D, B ) : r e w r i t e (D, E ) , r v ( E , B ) .
/ Testing
% R e s t o r i n g f i l e / u s r / l o c a l / l i b / Yap / s t a r t u p
YAP v e r s i o n Yap 5 . 1 . 1
? % r e c o n s u l t i n g / home / s a k / p r o l o g / d e q u e s . P . . .
% r e c o n s u l t e d / home / s a k / p r o l o g / d e q u e s . P i n module u s e r , 0 msec 4096 b y t e s
yes
? r e w r i t e ( f n q ( 2 , f n q ( 1 , n u l l q ) ) , X ) .
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
742 OF 788
Q UIT
X = fnq (2 , fnq (1 , n u l l q ) ) ?
yes
? r v ( f n q ( 1 , f n q ( 2 , n u l l q ) ) , B ) .
B = 2 ?
yes
? r v ( r n q ( 3 , f n q ( 1 , f n q ( 2 , n u l l q ) ) ) , B ) .
B = 3 ?
yes
? r e w r i t e ( r n q ( 4 , f d q ( f n q ( 1 , f n q ( 2 , r n q ( 3 , n u l l q ) ) ) ) ) , X ) .
X = fnq (2 , fnq (3 , fnq (4 , n u l l q ) ) ) ?
yes
? r v ( r n q ( 4 , f d q ( f n q ( 1 , f n q ( 2 , r n q ( 3 , n u l l q ) ) ) ) ) , B ) .
B = 4 ?
yes
? r v ( r d q ( r n q ( 4 , f d q ( f n q ( 1 , f n q ( 2 , r n q ( 3 , n u l l q ) ) ) ) ) ) , B ) .
B = 3 ?
yes
/
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
743 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
744 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
745 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
746 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
747 OF 788
Q UIT
vA
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
748 OF 788
Q UIT
MAJKvA
= vA
df
MAJx := tKvA
= vA[x := VAJtKvA ]
df
MAJ[P ]KvA
MAJP ; QKvA
MAJ?P : QKvA
MAJ{?P }KvA
H OME PAGE
JJ
= MAJP KvA
df
=
(MAJQK MAJP K)vA
df
MAJP KvA if TAJKvA = 1
=
MAJQKvA if TAJKvA = 0
df
MAJP ; {?P }KvA if TAJKvA = 1
=
vA
if TAJKvA = 0
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
749 OF 788
Q UIT
v0
v
P
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
750 OF 788
Q UIT
Correctness Assertions
Definition 37.1 A partial correctness assertion (also called a
Hoare-triple) is a triple of the form {} P {} where is a
formula called the precondition, P is a program and is the
postcondition.
Definition 37.2
{} P {} holds in a state vA (denoted (A, vA)
{} P {}),
0 implies (A, v 0 )
if (A, vA)
and MAJP KvA = vA
A
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
751 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
752 OF 788
Q UIT
Examples: Factorial 1
Let Z {! : s, +, , : s2 s; =, > : s2}.
df
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
753 OF 788
Q UIT
Examples: Factorial 2
df
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
754 OF 788
is
Q UIT
Exercise 37.1
1. For any program P defined on a signature what do the following correctness formulae mean?
(a) {>} P {>}
(b) {>} P {}
(c) {} P {>}
(d) {} P {}
(e) [>] P [>]
(f) [>] P []
(g) [] P [>]
(h) [] P []
2. Which of the correctness formulae given in problem 1 are
(a) always valid?
(b) always unsatisfiable?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
755 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
756 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
757 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
758 OF 788
Q UIT
.
H OME PAGE
JJ
II
{} {}
LCS
G O B ACK
F ULL S CREEN
C LOSE
759 OF 788
Q UIT
v0
v
x := t
:= .
H OME PAGE
JJ
{} x := t {}
I
II
LCS
( {t/x})
G O B ACK
F ULL S CREEN
C LOSE
760 OF 788
Q UIT
P
v0
v 00
{} P {}
; . {} Q {}
{} P ; Q {}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
761 OF 788
Q UIT
Q
{ } P {}
? : . { } Q {}
{} ?P : Q {}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
762 OF 788
Q UIT
{ } P {}
{}.
{} {?P } { }
in the while rule is called the loop invariant.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
763 OF 788
Q UIT
0
{0} P { 0}
.
0
{} P {}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
764 OF 788
Q UIT
{} P {}
:= .
[].
{{t/x}} x := t {}
{} [P ] {}
{} {}
{ } P {}
{}.
{} {?P } { }
{} P {}
; . {} Q {}
{} P ; Q {}
{ } P {}
? : . { } Q {}
{} ?P : Q {}
0
{0} P { 0}
.
0
{} P {}
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
765 OF 788
Q UIT
Example: Factorial 1
{x = x0}
p := 1;
{x = x0 p = 1}
{(x0 = x) (x 0 p x! = x0!)}
{0 (x 0 p x! = x0!)} {}
{(x = 0)?
{0 (x 0) (p x! = x0!) (x = 0)}
{0 (x > 0) (p x! = x0!)}
[p := p x;
{0 (x > 0) (p (x 1)! = x0!)}
x := x 1]
{0 (x 0) (p x! = x0!)}
{}
}
{ (x = 0)}
{0 (x = 0) (p x! = x0!)}
{(x0 0 p = x0!)}
where 0 (x0 0)
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
766 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
767 OF 788
Q UIT
[] P []
:=!
[]!
[{t/x}] x := t []
[] [P ] []
[] []
[] P []
; ! [] Q []
[] P ; Q []
[ ] P []
? :! [ ] Q []
[] ?P : Q []
0
[0] P [ 0]
!
0
[] P []
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
768 OF 788
Q UIT
Example: Factorial 2
[x = x0]
p := 1;
[x = x0 p = 1]
[(x0 = x) (x 0 p x! = x0!) (x0 < 0 p = 1)]
[0 (x 0 p x! = x0!)] []
{x > 0?
[0 (x > 0) (p x! = x0!) (x, p) = x = 0 > 0]
[p := p x;
[0 (x > 0) (p (x 1)! = x0!)
(x, p) = x = 0 > 0]
x := x 1]
[0 (x 0) (p x! = x0!) (x, p) = x < 0 > 0] ]
[]
}
[0 (x = 0) (p x! = x0!) (x, p) = x = 0]
[(x0 0 p = x0!) (x0 < 0 p = 1)] []
where 0 (x0 0) (x0 < 0 p = 1)
c.f. Partial correctness proof
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
769 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
770 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
771 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
772 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
773 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
774 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
775 OF 788
Q UIT
1. Summary
2. The Limitations of Predicate Logic
3. Sortedness
4. Many-Sorted Logic: Symbols
5. Many-Sorted Signatures
6. Many-Sorted Signature: Terms
7. Many-Sorted Predicate Logic
8. Reductions
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
776 OF 788
Q UIT
Summary
1. A mathematical treatment of the essentials of reasoning
2. A rigorous treatment of First-order logic
3. Applications in logic and computer science
(a) some elementary theorem proving
(b) logic programming
(c) program verification
4. Some illustrations of the power of first-order logic
5. Some illustrations of the lack of distinguishability.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
777 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
778 OF 788
Q UIT
Sortedness
A treatment that works mainly with a 1-sorted term algebra
often does not address the interesting problems of a mathematical theory e.g. the first-order theory of directed or undirected graphs.
To begin to address even the simplest problems of graph theory requires counting and the power of the first order theory
of numbers.
The problems of second-order logic (quantification over first
order properties) may be expressed in many-sorted first order logic by allowing the power set of a set to be included in
the universe of discourse of a many-sorted first order logic.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
779 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
780 OF 788
Q UIT
Many-Sorted Signatures
Definition 39.2 Given a finite nonempty set S of sorts with S =
{si | 1 i k}, a S-sorted signature consists of a set of
strings of the form
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
781 OF 788
Q UIT
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
782 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
783 OF 788
Q UIT
Reductions
Second-Order logic may simply be considered a 2-sorted
logic with predicates parameterised over both individuals and
sets of individuals.
An S-sorted Predicate Logic may be reduced to a 1-sorted
Predicate logic by introducing a fresh set of unary-predicates
is si (one for each sort si) to denote membership in a sort
and
replace every quantified formula of the form ixi[] by the
1-sorted formula x[is si(x) ] and recursively for each
quantifier,
replace every quantified formula of the form ixi[] by the 1sorted formula x[is si(x) ] and recursively for each quantifier,
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
784 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
785 OF 788
Q UIT
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
786 OF 788
Q UIT
40. References
References
[1] I. M. Copi. Symbolic Logic. Macmillan, London, UK, 1979.
[2] H. D. Ebbinghaus, J. Flum, and W. Thomas. Mathematical Logic. Springer-Verlag, New York, USA, 1994.
[3] H. B. Enderton. A Mathematical Introduction to Logic. Elsevier India, New Delhi, India, 2001.
[4] M. Fitting. First-Order Logic and Automated Theorem Proving. Springer-Verlag, New York, USA, 1990.
[5] M. Huth and M. Ryan. Logic in Computer Science: Modelling and Reasoning about Systems. Cambridge University Press,
Cambridge, UK, 2000.
[6] John Kelly. The Essence of Logic. Prentice-Hall India, New Delhi, India, 1997.
[7] S. C. Kleene. Mathematical Logic. Dover Publications Inc., New York, USA, 1967.
[8] E. Mendelson. Introduction to Mathematical Logic. D. Van Nostrand Co. Inc., Princeton, New Jersey, USA, 1963.
[9] Anil Nerode and R. Shore. Logic for Applications. Springer-Verlag, New York, USA, 1993.
[10] R. M. Smullyan. First-Order Logic. Springer-Verlag, Berlin, Germany, 1968.
[11] V. Sperschneider and G. Antoniou. Logic: A Foundation for Computer Science. Addison-Wesley Publishing Company, Reading,
UK, 1991.
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
787 OF 788
Q UIT
Thank You!
Any Questions?
H OME PAGE
JJ
II
LCS
G O B ACK
F ULL S CREEN
C LOSE
788 OF 788
Q UIT