126
VILNIUS UNIVERSITY Julius Andrikonis Mathematical Logic Lecture Notes Vilnius, 2012

Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

VILNIUS UNIVERSITY

Julius Andrikonis

Mathematical LogicLecture Notes

Vilnius, 2012

Page 2: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are
Page 3: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Contents

Table of Contents 2

1 Introduction 31.1 A short history of logic . . . . . . . . . . . . . . . . . . . . . 31.2 Important notation . . . . . . . . . . . . . . . . . . . . . . . 101.3 Propositional logic . . . . . . . . . . . . . . . . . . . . . . . 10

1.3.1 Syntax and semantics . . . . . . . . . . . . . . . . . . 101.3.2 Hilbert-type calculus . . . . . . . . . . . . . . . . . . 131.3.3 Sequent calculus . . . . . . . . . . . . . . . . . . . . 151.3.4 Resolution method . . . . . . . . . . . . . . . . . . . 201.3.5 Important concepts of logic . . . . . . . . . . . . . . 22

1.4 Other important concepts . . . . . . . . . . . . . . . . . . . 231.4.1 Relations . . . . . . . . . . . . . . . . . . . . . . . . 231.4.2 Functions and sets . . . . . . . . . . . . . . . . . . . 24

2 Predicate logic 252.1 The definitions . . . . . . . . . . . . . . . . . . . . . . . . . 252.2 Normal prenex forms . . . . . . . . . . . . . . . . . . . . . . 332.3 Predicate logic with function symbols . . . . . . . . . . . . . 382.4 Hilbert-type calculus . . . . . . . . . . . . . . . . . . . . . . 422.5 Sequent calculus . . . . . . . . . . . . . . . . . . . . . . . . . 442.6 Semantic tableaux method . . . . . . . . . . . . . . . . . . . 472.7 Compactness . . . . . . . . . . . . . . . . . . . . . . . . . . 512.8 Semantic trees . . . . . . . . . . . . . . . . . . . . . . . . . . 532.9 Resolution method . . . . . . . . . . . . . . . . . . . . . . . 56

2.9.1 The description of resolution calculus . . . . . . . . . 562.9.2 Linear tactics . . . . . . . . . . . . . . . . . . . . . . 592.9.3 Tactics of semantic resolution . . . . . . . . . . . . . 602.9.4 Absorption tactics . . . . . . . . . . . . . . . . . . . 61

2.10 Intuitionistic logic . . . . . . . . . . . . . . . . . . . . . . . . 622.11 Relational algebra . . . . . . . . . . . . . . . . . . . . . . . . 66

3 Deductive databases 713.1 Datalog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713.2 Programs with negation operator . . . . . . . . . . . . . . . 753.3 Datalog and relational algebra . . . . . . . . . . . . . . . . . 76

1

Page 4: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

3.4 Disjunctive Datalog . . . . . . . . . . . . . . . . . . . . . . . 773.5 U-Datalog . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

4 Modal logics 824.1 Syntax and semantics . . . . . . . . . . . . . . . . . . . . . . 824.2 Hilbert-type calculi . . . . . . . . . . . . . . . . . . . . . . . 884.3 Sequent calculi . . . . . . . . . . . . . . . . . . . . . . . . . 904.4 Tableaux calculus . . . . . . . . . . . . . . . . . . . . . . . . 924.5 Relation to predicate logic . . . . . . . . . . . . . . . . . . . 944.6 Mints transformation . . . . . . . . . . . . . . . . . . . . . . 964.7 Knowledge logics . . . . . . . . . . . . . . . . . . . . . . . . 984.8 Multimodal logic . . . . . . . . . . . . . . . . . . . . . . . . 99

5 Temporal logics 1015.1 Branching time logics . . . . . . . . . . . . . . . . . . . . . . 1015.2 Linear Temporal logic . . . . . . . . . . . . . . . . . . . . . 104

5.2.1 Syntax and semantics . . . . . . . . . . . . . . . . . . 1045.2.2 Hilbert-type calculus . . . . . . . . . . . . . . . . . . 1075.2.3 Sequent calculus . . . . . . . . . . . . . . . . . . . . 108

5.3 Finite linear temporal logic . . . . . . . . . . . . . . . . . . . 1105.3.1 Syntax and semantics . . . . . . . . . . . . . . . . . . 1105.3.2 Tableaux calculus . . . . . . . . . . . . . . . . . . . . 1115.3.3 Planning problem . . . . . . . . . . . . . . . . . . . . 114

6 Hybrid logic 1166.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 1166.2 Hybrid logic H(@, ↓) . . . . . . . . . . . . . . . . . . . . . . 1176.3 Relation to predicate logic . . . . . . . . . . . . . . . . . . . 119

Bibliography 123

Page 5: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Chapter 1

Introduction

1.1 A short history of logic

The term logic is derived from Ancient Greek language (gr. λογος, logos— reason, idea, word). A science of logic studies human thinking. Moreprecisely it analyses different methods of thinking.Example 1.1.1. Let’s analyse two reasonings:

• If I have money, I will visit my parents. I haven’t visited my parents.Therefore, I have no money.

• If I find my lecture notes, I will pass the exam. I haven’t passed theexam. Therefore, I haven’t found my lecture notes.

Both reasonings are different, but the way of thinking is the same: if pthen q, not q, therefore not p.

Is such form of reasoning always correct? If so, then it is a law of logic.How to find other laws of logic? These (and many more) are the problemsof logic.

However, natural language is usually too ambiguous to analyse. Thusthinking in logic is formalised. Words, reasonings, statements of naturallanguage are presented using logical symbols. In other words, an artificiallanguage is created. In high level of theoretical thinking it is nearly im-possible to do without an artificial language. Different artificial languagesare used to present mathematical formulas, equations of chemical reactions,etc…. An artificial language removes all the ambiguities of natural language,it provides optimal and the most precise way of presenting the results ofresearch. However the definition of artificial language is similar to thatof a natural language. Artificial language also has its alphabet and rules,which describe a way to make words. In logic words of language are usu-ally called formulas. The variety of problems forces a variety of languages:propositional logic, predicate logic, modal logic, hybrid logic, etc….

Logic was developed as a branch of philosophy. In IV-VI centuries BCit already existed in Greece, China and India. The most renowned logicianof those days is Greek philosopher Aristotle (BC 384–322), who created alogic theory, called syllogistic, which was a base for formal logic.

3

Page 6: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

In syllogistic only reasonings of the form if F1 and F2, then F are anal-ysed. Here F1 and F2 are called hypothesis and F is a conclusion. Theremust be exactly two hypothesis and one conclusion. Each statement (F1,F2 and F ) can only be of such form:

(a) Every S is P ,

(i) Neither of S is P ,

(e) Some of S are P ,

(o) Some of S are not P .

Moreover, the three statements must contain three predicates, which aredenoted P , M and S. Hypothesis F1 must contain P and M , hypothesis F2—M and S and conclusion F must contain P and S. The order of predicatesin both hypothesis can vary, however in the conclusion it is fixed: P is thefirst predicate and S is the second one. To better demonstrate the possibleorder of predicates in hypothesis, figures are used:

S M

M PFigure 1

S M

P MFigure 2

M S

M PFigure 3

M S

P MFigure 4

The reasoning consist of three statements, each can be either (a), (e),(i) or (o). Thus there are 43 = 64 possible combinations: aaa, aai, aae,aao,…. These combinations are called moduses (lot. modus — method,rule, measure). Moreover, each of 64 moduses can represent any of the fourfigures, thus in total there are 64× 4 = 256 possible combinations. All thecombinations were analysed and as a result 19 sound reasonings (laws oflogic) were found.

Another famous Greek logician is Zeno of Citium (BC 334–262), wholived in Athens and taught in a school called Stoa Poikile (gr. Ποικιληστοα, Painted Porch). Because of the name of the school, his disciples werecalled stoics. They developed the basics of propositional logics. Stoics usedlogical operations of negation, conjunction, disjunction and implication todistinguish simple statements from composite ones. The notation of con-nectives wasn’t used then. Reasonings were presented as natural languagesentences with ordinal numbers in place of variables.

Example 1.1.2. A reasoning((

(p∧ q)⊃ r)∧(p∧¬r

))⊃¬q was denoted

as follows:

If the 1st and the 2nd, then the 3rd.Now the 1st holds but the 3rd does not.

Therefore, the 2nd does not hold.

4

Page 7: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Stoics founded the term logic. They created a deductive system, whichcontained five unquestionable or axiomatic reasonings and four inferencerules, called themata. A reasoning was considered valid if it is either ax-iomatic or can be reduced to the axiomatic one by the rules.

The five axiomatic reasonings were:

1. If the 1st, then the 2nd. The 1st holds. Therefore the 2nd holds.

2. If the 1st, then the 2nd. The 2nd does not hold. Therefore the 1st doesnot hold.

3. It is not true that the 1st and the 2nd. The 1st holds. Therefore the 2nd

does not hold.

4. Either 1st or the 2nd. The 1st holds. Therefore the 2nd does not hold.

5. Either 1st or the 2nd. The 1st does not hold. Therefore the 2nd holds.

Only two of the four themata are extant:

1. If from two statements a third one follows, then from the first one andthe negation of the third one, the negation of the second one follows.

2. If from two statements a third one follows and from the third one andfourth one a fifth one follows, then from the first two statements andthe fourth one the fifth one follows.

These ideas are still used in logic. E.g. axiomatic reasoning 1 is calledmodus ponens, axiomatic reasoning 2 is called modus tolens. Rules similarto themata 2 are called the cut rules.

After Aristotle and stoics there was a long period of stagnation, whichlasted more than two thousand years.

It is still widely discussed who is the pioneer of modern mathematicallogic. Different authors mention different names among which there is Ger-man mathematician G.W. Leibniz (1646–1716), English-born mathemati-cian G. Boole (1815-1864), German mathematician F.L.G. Frege (1848–1925). But all of them were highly influenced by Aristotle.

British mathematician A. De Morgan (1806–1871) enriched logical lawsby some properties of objects, analysed in algebra. G. Boole tried to es-tablish logic as an exact science. His book An Investigation of the Lawsof Thought was the first work, which analysed logical laws using mathe-matics. They were the first new ideas in logic after Aristotle and stoics.German mathematician E. Schröder (1841–1902) and Russian mathemati-cian P.S. Poretsky (1846–1907) grounded propositional and predicate logic,by associating them with algebra.

During the centuries a lot of laws of logic were discovered. How? Usuallya hypothesis was established and efforts were directed to deny it. I.e. anexample was searched, which demonstrated that the hypothesis does nothold. If the efforts failed, a hypothesis was declared a law of logic. Therewere no proof in a mathematical sense. A set of laws of logic was first

5

Page 8: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

systemised by German mathematician F.L.G. Frege. In 1879 he was thefirst one to develop a formal propositional calculus. He also showed that allthe known and a lot of new statements are derivable in the calculus. Forsimplicity, the axioms will be presented using modern formal language.

1. F ⊃ (G⊃ F )

2.((F ⊃ (G⊃H)

)⊃((F ⊃G)⊃ (F ⊃H)

)3.(F ⊃ (G⊃H)

)⊃(G⊃ (F ⊃H)

)4. (F ⊃G)⊃ (¬G⊃ ¬F )5. ¬¬F ⊃ F6. F ⊃ ¬¬F

A calculus contains Modus ponens rule (if F and F ⊃ G, then G) andthe rule of formula substitution. Later it was proved that axiom 3 is notnecessary. It is derivable from other axioms.

It is worth mentioning that F.L.G. Frege defined the calculus before it wasnoticed that the validity of laws of logic can be checked using truth tables.Only six years later (in 1885) American mathematician and philosopherCh.S. Peirce (1839–1914) developed the truth table method. The axiomati-sation of F.L.G. Frege set an example for calculi that followed. After that,F.C.H.H. Brentano (1838–1917) defined calculus, which used only conjunc-tion and negation, B.A.W. Russell (1872–1970) — a calculus with negationand disjunction. Another achievement of F.L.G. Frege in mathematisinglogic is introduction of predicates, individual constants and quantifiers. Thisprovided a possibility to formalise mathematical expressions. G. Frege alsostarted using symbol `. A statement that F is valid was presented as ` F

The main results presented here are based on G. Frege calculus and theworks of later logicians.

The main stimulus for mathematicians to take a closer look into formallogics was a discovery of antinomies (paradoxes). The biggest worry wascaused by antinomy presented in the press by B.A.W. Russell in 1903.Definition 1.1.3 (Russell’s Antinomy). SupposeM is a set, which is com-posed of sets A1,A2, . . . , that satisfy the condition: any set Ai is not anelement of itself, i.e. set Ai is not an element of Ai. It is not hard to reasonthat setM is an element ofM iff it is not an element ofM.

Logic as an independent branch of mathematics with its own problemsand methods was formed in the fourth decade of the XIX century. A seri-ous impact to this was made by the works of Austrian logician K.F. Gödel(1906–1978). In 1930 he proved the completeness of predicate calculus.Therefore a predicate calculus became a system which was able to formalisemathematics. In contrast to other sciences, the main method to obtain newknowledge in mathematics is the proof and not the experiment. For exam-ple, by measuring the angles of many triangles it is possible to conclude that

6

Page 9: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

the sum of inner angles of the triangle is 180◦. However for mathematicianthis statement can be accepted as true only when it is proved by logicalreasoning.

Now the proof of any theorem is actually only a sequence of formulas withsome reasoning, which explains how a following formula can be obtainedfrom the previous one(s). Formulas are understood uniformly, however thereasoning is often a cause of various ambiguities. Is it possible to findsuch rules of reasoning (logic), that can be expressed using mathematicalformulas and used for proving theorems? If this would be possible, the proofof the theorem could be formulated as a sequence of formulas with names ofthe rules in between, that show which rule and already obtained formulasare used to derive the new formula. Having such sequence of reasoning itwould be easy to check, if it is a proof of the theorem. The idea to createa universal language for all the mathematics and use it to formalise all theproofs was formulated by G.W. Leibniz. Such language would provide atool to say which hypothesis is valid and which is not.

For a long time it was believed that there is only one logic, which is thesame in everyday language as well as in mathematics, physics and otherbranches of science. The main aim of logicians were to define (discover) allthe laws of logic. It was well known that by changing the system of axioms,the theory changes. For example, by changing the axiom of parallel linesto Lobachevsky axiom Lobachevsky non-Euclidian geometry is obtained.It seemed that the logic itself is absolute and stable. It was thought thatmathematical theory could be presented as a diagonal of parallelogram. Oneside of the parallelogram would be an axiom system of the theory and theother one — logics (derivation rules):

axioms

logics

theories

However in 1921 Polish logician J. Łukasiewicz (1878–1956) describedthree-valued logic and a little bit later American logician E.L. Post (1897–1954) described m-valued (m ≥ 3) logic. The illusion of the existence ofa single logic collapsed. In 1930 Dutch mathematician A. Heyting (1898–1980) created intuitionistic logic, which can not be expressed using terms ofclassical logic. According to it, a new mathematical theory was described —constructive mathematics, in which Law of Excluded Middle1 is not valid.

Modern computers provided many possibilities to apply logic. First of all,the logic for computer scientists is a formal language, which describes knowl-edge (information) about relational structures or models, queries, specifi-

1Tertium non datur — a statement is true or it is not true: p ∨ ¬p.

7

Page 10: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

cations. One of the task in informatics is to create new logic, which couldbe applied to solve new problems. The following logics were created for theneeds of computer science:

• dynamic logic (in 1969 by C.A.R. Hoare (born 1934)),

• temporal logic (in 1977 by A. Pnueli (1941–2009)),

• descriptive logic (in 1984 by M. Schmidt-Schauss and G. Smolka),

• hybrid logic (in 1985 m. by S. Passy (born 1956) and T. Tinchev).

The creation of these new non-classical logics were inspired by modallogic. For a long time it was part of philosophy and known as necessityand possibility logic. After discovering that it is convenient for definingrelations and analysing computer programs, its role changed. Soon theworks about applying modal logics in informatics, artificial intelligence andlinguistics appeared. Using modal logics, new formalisms are introduced,which enable analysis of time, knowledge, belief, etc…. First systems ofmodal logic were created by American logician C.I. Lewis (1882–1964) in1918 and 1932 and called S1, S2, S3, S4 and S5. Two of them — S4 andS5 — became famous in modal logic theory. They are still analysed andwidely applied.

Different systems, which are analogous to S4 was defined by Russian logi-cian I. Orlov (1886–1936) and Austrian logician K.F. Gödel, approximatelyat the same time. They interpreted the necessity operator in a differentway — as the operator of provability. A system, similar to S5, was alreadydefined in 1906 by Scottish mathematician H. MacColl (1837–1909).

The first textbook Principia Mathematica, dedicated to mathematicallogic and its applications, was published in 1910. The authors wereB.A.W. Russell and A.N. Whitehead (1861–1947). The book contains suchsentence:

The fact that all Mathematics is Symbolic Logic is one of thegreatest discoveries of our age.

Later during several years two more volumes were published. With the ap-pearance of the book, new stage of logic development started. The nexttextbook appeared only in 1928. It was Grundzüge der theoretischen Logikby D. Hilbert (1862–1943) and W.F. Ackermann (1896-1962). Later Grund-lagen der Mathematik by D. Hilbert and P.I. Bernays (1888–1977) was pub-lished (first volume in 1934 and the second volume in 1939). The later bookcompleted the formation of logic as a independent branch of mathematics.A lot of symbols presented in these books are still used today.

8

Page 11: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Logical B.A.W. Russell D. Hilbertoperation A.N. Whitehead P.I. Bernaysnegation ∼ p p̄

conjunction p . q p & qdisjunction p ∨ q p ∨ qimplication p ⊃ q p → qequivalence p ≡ q p ∼ q

Symbols ∼, ∨, ≡, ⊃ were created in 1908 by B.A.W. Russell, . (to denoteconjunction) — G. Boole. The author of ¬, ∧ is A. Heyting (1929). Thesymbol & was created in 1924 by M.I. Schönfinkel (1889–1942), → — in1917 by D. Hilbert, and ↔ in 1940 by A. Tarski (1901–1983).

Now, when the computers are widely used, logic is becoming the branchof computer science. Between 1955 and 1956 (i.e. 10 years after the firstcomputer was produced) Americans A. Newell (1927–1992), H.A. Simon(1916–2001) and J.C. Shaw (1922–1991) created a program Logic Theo-rist, which proved 38 out of 52 theorems of propositional logic, which wereprovided in three-volume textbook Principia Mathematica (1910-1913). Apublic demonstration of the program occurred on 9th August, 1956. It wasthe first program with artificial intelligence. The concept of artificial intelli-gence, meaning an artificial ability to think logically, was established in 1955by American computer scientist J. McCarthy (1927-2011), who foundedthe first artificial intelligence laboratory together with M.L. Minsky (born1927). He is the author of LISP programming language. Although similarprogram was created earlier by M. Davis (born 1928), however publishedresults with the description of the program appeared later than about LogicTheorist. Both programs used some specific methods, which were suitableonly to solve the analysed problems and because of that they didn’t havemore influence on later works about automatic theorem proving. The ini-tiator of automatic theorem proving is Chinese-American logician H. Wang(1921–1995). Using IBM computer in 1959 he proved approximately 400laws of propositional logic and first-order logic with equality, which werepresented in three-volume textbook Principia Mathematica.

In 1965 American logician J.A. Robinson (born 1928) described a newderivation search method for predicate logic formulas, called the resolutioncalculus. Soon a new branch of informatics were formed, called logic pro-gramming (program — a finite sequence of logic formulas), which was basedon the tactics of derivation search using resolution calculus. The initiatorsof logic programming are J.M. Foster and E.W. Elcock with their systemABSYS. In logic programming the input data and the query (aim) are de-fined using logic formulas. The result of the query is obtained by deductionusing the input data. The most popular logic programming language isPROLOG (PROgramming in LOGic). It was created in 1971 by Frenchmathematician A. Colmerauer (born 1941). A program in PROLOG is asequence of first-order logic formulas, that satisfy certain conditions. Thesearch of the result of the query is carried out using resolution method andlinear tactics. In 1985 and 1986 French logician L. Farinas presented a

9

Page 12: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

method to extend PROLOG by incorporating formulas of modal logic andcalled the new programming language MOLOG.

1.2 Important notation

In general, notation is introduced together with the concept it describes.Only some basic notation is provided here.

First of all, sets of numbers are denoted as follows:• Natural numbers — N; it is assumed that 0 ∈ N;• Integer numbers — Z;• Rational numbers — Q;• Real numbers — R;Functions are defined in a following way: f : A → B meaning that

function f is defined in set A and returns values in set B. E.g. functionf : N × N → Q has two natural arguments and the result is a rationalnumber. Sign × here denotes Cartesian product.

Intervals of numbers are denoted as follows [a, b]. This notation meansthe interval between a and b, a, b ∈ [a, b]. I.e. [a, b] = {c : a 6 c 6 b}. Ifsome edge does not belong to some interval, then respective square bracketis replaced by a parenthesis: b ∈ (a, b], but a 6∈ (a, b].

Expression of the form {y1/x1, y2/x2, . . . , yn/xn} is called a substitution. Theyare denoted by small Greek letters: α, β, γ. If α = {y1/x1, y2/x2, . . . , yn/xn},then notation Fα represents an expression, which is obtained from F byreplacing all the occurrences of xi by yi for every i ∈ [1, n]. The type ofexpression F as well as of expressions yi is not important, xi are usuallyvariables. Let α and β be two substitutions:

α = {y′1/x′1, y′2/x′2, . . . , y′n/x′n}

β = {y′′1/x′i1, y′′2/x′i2, . . . ,

y′′k/x′ik ,z′′1/x′′1 , z

′′2/x′′2 , . . . , z

′′m/x′′m}

Here x′′i 6= x′j for any i ∈ [1,m] and j ∈ [1, n]. A composition of α and β isa substitution:

α ◦ β = {y′1β/x′1, y′2β/x′2, . . . , y′nβ/x′n, z′′1/x′′1 , z′′2/x′′2 , . . . , z′′m/x′′m}

In fact if γ = α ◦ β, then Fγ = (Fα)β.The word iff is used to denote the phrase if and only if.

1.3 Propositional logic

1.3.1 Syntax and semantics

As it can be implied from the name, propositional logic analyses proposi-tions. Here propositional logic is denoted as PC.

10

Page 13: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Definition 1.3.1. A proposition is a sentence, which is either true or false.

Example 1.3.2. The following sentences are propositions:

• The sun is shining.

• I have never been to Australia.

• If I study hard, I will pass algebra and logic exams.

The following sentences are not propositions:

• Is it raining?

• Oh, what a beautiful day!

• Could you please pass me some salt?

As it can be seen from the example above, some propositions can bebroken down into simpler ones. E.g. statement If I study hard, I will passalgebra and logic exams can be split into three simpler propositions: I studyhard, I will pass algebra exam and I will pas logic exam. Such propositionis composite. However it is usually defined that composite statements areformed from the simpler ones using logical operators. Here these operatorsare presented:

• Negation. Denoted ¬. It is read as Not something. Here instead ofsomething any proposition can be inserted.

• Conjunction. Denoted ∧. It is read as something and something.

• Disjunction. Denoted ∨. It is read as something or something.

• Implication. Denoted ⊃. It is read as if something, then something.

• Equivalence. Denoted ↔. It is read as something is equivalent tosomething.

To formalise the statements, propositions are replaced by propositionalvariables. Here propositional variables are denoted by small Latin letterswith or without indexes: p, q, r, p1, p2, q1,…. Using propositional vari-ables and (or) logical operators composite propositions, called formulas, areproduced.

Definition 1.3.3. Propositional formula is defined recursively as follows:

• Propositional variable is a propositional formula. It is also called atomicpropositional formula.

• If F is a propositional formula, then (¬F ) is a propositional formulatoo.

• If F and G are propositional formulas, then (F ∧G), (F ∨G), (F ⊃G),(F ↔G) are propositional formulas too.

11

Page 14: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Here formulas are denoted by capital Latin letters (F,G,H, F1, . . . ). Out-ermost parentheses of formulas are always omitted, as well as some innerparentheses if the order of application of logical operators is clear. Thepriorities of logical operators are ¬, ∧, ∨, ⊃, ↔, where ¬ has the highestpriority and ↔ — the lowest.

Example 1.3.4. Formula((p ∧ q) ∨ (¬p)

)can be presented as p ∧ q ∨ ¬q.

The priority of ¬ is highest and the priority or ∧ is higher than that of ∨,thus parentheses do not add any additional information.

However, formula((p ∨ q) ∧ p

)can not be written as p ∨ q ∧ p, because

∧ has higher priority than ∨ and the latter formula is in fact(p ∨ (q ∧ p)

).

Every proposition can be true (denoted >) or false (denoted ⊥). Thisis true for composite propositions as well. Moreover, to find if a compositeproposition is true, it must be checked if the simpler ones, are true. Thetruth of the formula is defined by interpretation:Definition 1.3.5. An interpretation of propositional formula F is functionν : P → {>,⊥}, where P is a set of all the propositional variables of F .

An interpretation only defines the value of every propositional variable.A value of the formula, which consists of propositional variables, is definedrecursively according to logical operators of the formula. The fact thatformula F is true with interpretation ν is denoted ν � F . The fact thatformula F is false with interpretation ν is denoted ν 2F .Definition 1.3.6. Let’s say that ν is an interpretation of propositionalformula F , then:

• if F is a propositional variable, then ν �F iff ν(F ) = >.• if F = ¬G, then ν �F iff ν 2G.• if F = G ∧H, then ν �F iff ν �G and ν �H.• if F = G ∨H, then ν 2F iff ν 2G and ν 2H.• if F = G⊃H, then ν 2F iff ν �G and ν 2H.• if F = G↔H, then ν �F iff ν �G and ν �H or ν 2G and ν 2H.If there is an interpretation with which F is true, then it is said that F is

satisfiable. If F is true with every possible interpretation of F , then it is saidthat F is valid and denoted �F . Later more logics will be defined thus toclarify the logic, for which the formula is valid (or true with interpretationν), notation �PC F (or ν �PC F respectively) can be used.

If there is an algorithm to check if any formula is valid, then there isalso an algorithm to check if any formula is satisfiable. Actually, in orderto check if formula F is not satisfiable, it must be checked if ¬F is valid. Inorder to check if F is satisfiable, first a check if F is valid must be carriedout. If F is valid, then it is satisfiable. Otherwise a check if ¬F is valid

12

Page 15: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

is performed. If ¬F is valid, then F is not satisfiable. Otherwise it issatisfiable. This is demonstrated in the following diagram:

Is F valid?

Yes. F is satisfiable No. Is ¬F valid?

Yes. F is not satisfiable No. F is satisfiableTo test for formula validity several methods are used. The most basic one

is called truth table method. The aim of it is to go through all the possibleinterpretations of the formula. If formula contains n propositional variables,each of which can be true or false, then there are exactly 2n interpretationswhich must be checked. They can be listed in a table, and this is the reasonfor such name of the method.

Next several more complex methods are presented.

1.3.2 Hilbert-type calculus

Hilbert-type calculus is composed of many axioms and some rules. Theaim of the method is to show how a formula can be constructed from theaxioms, using the rules of the calculus. Here Hilbert-type calculus definedin [10] is used. There are alternative definitions, e.g. [8].Definition 1.3.7. Hilbert-type calculus for propositional logic (denotedHPC) consists of axioms:

1.1 . F ⊃ (G⊃ F );

1.2 .(F ⊃ (G⊃H)

)⊃((F ⊃G)⊃ (F ⊃H)

);

2.1 . (F ∧G)⊃ F ;2.2 . (F ∧G)⊃G;

2.3 . (F ⊃G)⊃(

(F ⊃H)⊃(F ⊃ (G ∧H)

));

3.1 . F ⊃ (F ∨G);3.2 . G⊃ (F ∨G);

3.3 . (F ⊃H)⊃(

(G⊃H)⊃((F ∨G)⊃H

));

4.1 . (F ⊃G)⊃ (¬G⊃ ¬F );4.2 . F ⊃ ¬¬F ;4.3 . ¬¬F ⊃ F ;

13

Page 16: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

and Modus Ponens (MP) rule:

F F ⊃GG

Here F , G and H stand for any propositional formula.

Note that there are no axioms (or rules) with equivalence operator. Infact, formula F ↔G can be replaced by (F ⊃G) ∧ (G⊃ F ).

This type of calculus was formulated for the first time in [7], thereforesuch calculi are called Hilbert-type.

In order to check if some formula is valid, a derivation is constructed. Aderivation of formula F in Hilbert-type calculus is a sequence of formulasF1, . . . , Fn, where Fn ≡ F and for every i ∈ [1, n], Fi is either an axiom,or obtained by applying the rules of the calculus to formulas from the set{Fj : j < i}. Thus the derivation search starts with axioms and from themnew formulas are constructed by applying the rules. The process terminatessuccessfully if formula F is finally obtained.

Here Hilbert-type derivations are presented as lists together with infor-mation on how the formula was obtained. For this purpose a substitutionis used.

Definition 1.3.8. It is said that formula F is derivable in some Hilbert-type calculus C (denoted `C F ), if a derivation of F in C exists. Otherwiseit is said that F is not derivable in C (0CF ).

One of the core properties of the calculus are soundness and completeness.It is said that Hilbert-type calculus C for logic L is sound if for any formulaF , if `C F then �L F . It is said that Hilbert-type calculus C for logic L iscomplete if for any formula F , if �LF , then `CF . Only sound and completecalculi can be used to check both validity and satisfiability of any formula.

Calculus C is called contradictory if for some formula F it is true that both`C F and `C ¬F . It can be proved that if a calculus is contradictory, thenany formula can be derived in it. Calculus, that is sound and complete, isnot contradictory. However, from the fact that calculus is not contradictory,doesn’t follow that it is sound or complete.

The soundness and completeness of HPC is shown in [10].Now an example of derivation in HPC is presented.

Example 1.3.9. A derivation of p⊃ p in HPC is as follows:1.(p⊃

((p⊃ p)⊃ p

))⊃((p⊃ (p⊃ p)

)⊃ (p⊃ p)

)Axiom 1.2, {p/F , p⊃p/G, p/H}.

2. p⊃((p⊃ p)⊃ p

)Axiom 1.1, {p/F , p⊃p/G}.

3.(p⊃ (p⊃ p)

)⊃ (p⊃ p) MP rule from 2 and 1.

4. p⊃ (p⊃ p) Axiom 1.1, {p/F , p/G}.5. p⊃ p MP rule from 4 and 3.

Although Hilbert-type calculi are used in discussing semantics of thelogic, however proof search in such calculi is not an easy task. It is hard todescribe an algorithm of choosing the axioms, as can be seen in Example

14

Page 17: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

1.3.9. There are several techniques suggested to tackle this problem, oneof witch was first introduced in [5], and therefore is called Gentzen-typecalculus. In Gentzen-type calculi an expression, called a sequent is used,thus Gentzen-type calculi are also called sequent calculi.

1.3.3 Sequent calculus

Definition 1.3.10. A sequent is an expression of the form Γ → ∆, whereΓ and ∆ are multisets of formulas and can possibly be empty. Γ is calledantecedent and ∆ is called succedent.

Here sequents are denoted by letter S with or without indices and capitalGreek letters (Γ, ∆, Σ, Γ1) denote multisets of formulas, which can beempty, if not mentioned otherwise. Sequents, which consist of propositionalformulas only, are called propositional sequents.

The semantics of the sequent can be seen from the following definition.Definition 1.3.11. Let’s say that S is a sequent, then corresponding for-mula of S (denoted Cor(S)) is defined as follows:

• if S = F1, . . . , Fn → G1, . . . , Gm, where n,m > 1, then correspondingformula Cor(S) = (F1 ∧ . . . ∧ Fn)⊃ (G1 ∨ . . . ∨Gm).

• if S = → G1, . . . , Gm, where m > 1, then Cor(S) = G1 ∨ . . . ∨Gm.• if S = F1, . . . , Fn → , where n > 1, then Cor(S) = ¬(F1 ∧ . . . ∧ Fn).• if S = → , then Cor(S) = p ∧ ¬p for some propositional variable p.It is clear that if S is a propositional sequent, then Cor(S) is a proposi-

tional formula. This definition is similar to that given in [12].Now it is possible to define the semantic meaning of sequent.

Definition 1.3.12. Let’s say that S is a propositional sequent and ν is aninterpretation of propositional formula Cor(S), then S is true with inter-pretation ν (denoted ν �S) iff ν �Cor(S). If �Cor(S), then it is said thatS is valid and denoted �S.

Thus a sequent is true with some interpretation ν, iff when all the formu-las of antecedent are true with ν, at least one formula of succedent is alsotrue with ν.

In [5] the following calculus was defined:Definition 1.3.13. The original Gentzen-type calculus for propositionallogic (GPCo) consists of an axiom F → F , structural rules:

Weakening:Γ → ∆ (w →)

F,Γ → ∆Γ → ∆ (→ w)Γ → ∆, F

Contraction:F, F,Γ → ∆

(c→)F,Γ → ∆

Γ → ∆, F, F(→ c)Γ → ∆, F

15

Page 18: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Exchange:

Γ1, G, F,Γ2 → ∆(e→)Γ1, F,G,Γ2 → ∆

Γ → ∆1, G, F,∆2 (→ e)Γ → ∆1, F,G,∆2

logical rules:Negation:

Γ → ∆, F(¬ →)

¬F,Γ → ∆F,Γ → ∆

(→ ¬)Γ → ∆,¬F

Conjunction:

F,Γ → ∆(∧ →)1

F ∧G,Γ → ∆G,Γ → ∆

(∧ →)2F ∧G,Γ → ∆

Γ → ∆, F Γ → ∆, G(→ ∧)Γ → ∆, F ∧G

Disjunction:

F,Γ → ∆ G,Γ → ∆(∨ →)

F ∨G,Γ → ∆

Γ → ∆, F(→ ∨)1Γ → ∆, F ∨G

Γ → ∆, G(→ ∨)2Γ → ∆, F ∨G

Implication:

Γ → ∆, F G,Γ → ∆(⊃ →)

F ⊃G,Γ → ∆F,Γ → ∆, G

(→ ⊃)Γ → ∆, F ⊃G

and the cut rule:Γ1 → ∆1, F F,Γ2 → ∆2 (cut F )Γ1,Γ2 → ∆1,∆2

The sequent(s) above the horizontal line of the rule is (are) called thepremise(s). The sequent bellow the line is called the conclusion.

Once again, to check the validity of some sequent, derivation is con-structed. Now a derivation search tree of the sequent S in Gentzen-typecalculus is a tree of sequents, which has S at the bottom as a root and eachnode is either a leaf, or a conclusion of an application of some rule of thecalculus in which case all the premises of the application are child nodes ofthat node. S is called the initial sequent. To denote some derivation searchtree, letter D with or without indices is used.

A branch of derivation search tree D is a subtree of D in which each nodeexcept the last one has exactly one child, the last node has no children andwhich is not a subtree of any other branch of D (similar definition can be

16

Page 19: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

found in [13]). The branch can be infinite. In that case there is no last nodeand each node has exactly one child. It can be noticed that every sequent ofthe derivation search tree belongs to at least one branch. If every branch ofa derivation search tree D is finite, then D is finite, otherwise it is infinite.

If all the branches of a derivation search tree D of S end with axiom, itis said that D is a derivation tree (or simply a derivation) of S. If thereexists a derivation tree of S in Gentzen-type calculus C, it is said that S isderivable in C (denoted `C S) and otherwise it is said that S is not derivable(denoted 0C S). Formula F is derivable in sequent calculus C (denoted `CF )iff `C → F .

Similarly to the Hilbert-type calculus, if the derivation tree of sequentS in sequent calculus is present, the reasoning about the validity of S isobvious. It starts from the axiom(s) and is continued through the appli-cations of the rules. Due to the form of the rules, if all the premises ofsome application are valid, the conclusion of the application is valid too.However, the process of derivation search starts with sequent S. If S is notan axiom and it is suitable as a conclusion of some rule, then the premise(s)of the rule are inspected and the process of finding the appropriate rule isrepeated to them. Thus here it is said that the rule of sequent calculus isapplied to the conclusion and the premise(s) are obtained. The applicationof some rule is called an inference.

It is obvious, that usually several rules can be applied to the same se-quent. To separate them, main formula of the inference is defined. Themain formula of inferences

Γ → ∆, F(¬ →)

¬F,Γ → ∆F,Γ → ∆

(→ ¬)Γ → ∆,¬F

is ¬F . F is called a side formula. Formulas from Γ and ∆ are calledparametric formulas. This definition can be extended to cover other typesof inferences.

It is said that sequent calculus C for logic L is sound if for any sequent S,if `C S then �LS. It is said that sequent calculus C for logic L is completeif for any sequent S, if �L S, then `C S. The soundness and completenessof GPCo is proved in [5].

Now let’s provide an example of derivation in GPCo.

17

Page 20: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 1.3.14. A derivation in GPC of the formula used in Example1.3.9 is obvious, so a derivation tree of axiom 2.3 of HPC is provided instead.

F → F (→ w)F → F, G ∧H

(→ e)F → G ∧H, F

(w →)F ⊃G, F → G ∧H, F

(e→)F, F ⊃G → G ∧H, F

F → F (→ w)F → F, G ∧H

(→ e)F → G ∧H, F

(w →)H, F → G ∧H, F

G → G (w →)F, G → G

(e→)G, F → G

(w →)H, G, F → G

(e→)G, H, F → G

H → H (w →)F, H → H

(e→)H, F → H

(w →)G, H, F → H

(→ ∧)G, H, F → G ∧H

(⊃ →)F ⊃G, H, F → G ∧H

(e→)H, F ⊃G, F → G ∧H

(e→)H, F, F ⊃G → G ∧H

(⊃ →)F ⊃H, F, F ⊃G → G ∧H

(e→)F, F ⊃H, F ⊃G → G ∧H

(→ ⊃)F ⊃H, F ⊃G → F ⊃ (G ∧H)

(→ ⊃)F ⊃G → (F ⊃H)⊃

(F ⊃ (G ∧H)

)(→ ⊃)

→ (F ⊃G)⊃(

(F ⊃H)⊃(

F ⊃ (G ∧H)))

However such calculus has some drawbacks too. First of all, it is notobvious how to chose the main formula in the cut rule.

Example 1.3.15. The choice of main formula in the cut rule is not obvious:p → p

(→ w)p → p, q(→ e)p → q, p

q → q(w →)p, q → q(e→)q, p → q(⊃ →)

p⊃ q, p → q(e→)

p, p⊃ q → q

q → q(→ w)q → q, r(→ e)q → r, q

r → r (w →)q, r → r(e→)r, q → r(⊃ →)

q ⊃ r, q → r(e→)

q, q ⊃ r → r(cut q)

p, p⊃ q, q ⊃ r → r

Next, there are a lot of applications of different structural rules:

Example 1.3.16. Consider the following derivation:

p → p(w →)q, p → p

q → q(w →)p, q → q(e→)q, p → q(→ ∧)

q, p → p ∧ q(→ ∨)1

q, p → (p ∧ q) ∨ (p ∧ r)

p → p(w →)r, p → p

r → r (w →)p, r → r(e→)r, p → r(→ ∧)

r, p → p ∧ r(→ ∨)2

r, p → (p ∧ q) ∨ (p ∧ r)(∨ →)

q ∨ r, p → (p ∧ q) ∨ (p ∧ r)(∧ →)2

p ∧ (q ∨ r), p → (p ∧ q) ∨ (p ∧ r)(e→)

p, p ∧ (q ∨ r) → (p ∧ q) ∨ (p ∧ r)(∧ →)1

p ∧ (q ∨ r), p ∧ (q ∨ r) → (p ∧ q) ∨ (p ∧ r)(c→)

p ∧ (q ∨ r) → (p ∧ q) ∨ (p ∧ r)

Here application of (c→) is only needed to make sure that both p andq ∨ r do not disappear from the sequent, because both are needed in thederivation. Rule (w →) is applied simply to remove formulas, that are notpart of the axiom. Exchange rule (e→) is applied to place the sequent in theleft of the antecedent.

18

Page 21: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

In fact it is possible to prove that the cut rule is not needed in thecalculus. This was proved in [5] for predicate logic, which is mentionedlater in Theorem 2.5.2. However, it is not hard to transform the proof tocover only propositional logic.Theorem 1.3.17 (Gentzen Hauptsatz for propositional logic). Every der-ivation in GPCo can be transformed into derivation without the cut rule.

Later, in [9] another sequent calculus was provided, which eliminated allthe structural rules.Definition 1.3.18. Gentzen-type calculus without structural rules for propo-sitional logic (GPC) consists of an axiom Γ, F → F,∆ and the logical rules:

Negation:

Γ → ∆, F(¬ →)

¬F,Γ → ∆F,Γ → ∆

(→ ¬)Γ → ∆,¬F

Conjunction:

F,G,Γ → ∆(∧ →)

F ∧G,Γ → ∆Γ → ∆, F Γ → ∆, G

(→ ∧)Γ → ∆, F ∧G

Disjunction:

F,Γ → ∆ G,Γ → ∆(∨ →)

F ∨G,Γ → ∆Γ → ∆, F,G

(→ ∨)Γ → ∆, F ∨G

Implication:

Γ → ∆, F G,Γ → ∆(⊃ →)

F ⊃G,Γ → ∆F,Γ → ∆, G

(→ ⊃)Γ → ∆, F ⊃G

In this calculus the order of the formulas in antecedent and succedentis not important. This eliminates the need to apply exchange rules. Thesoundness and completeness of GPC is proved in [9].

Let’s demonstrates how calculus GPC simplifies the derivations of se-quents derived in Examples 1.3.14, 1.3.15 and 1.3.16Example 1.3.19. A derivation in GPC of the sequent, used in Example1.3.14.

F, F ⊃G → G ∧H,FF,H → G ∧H,F

F,H,G → G F,H,G → H(→ ∧)

F,H,G → G ∧H(⊃ →)

F,H, F ⊃G → G ∧H(⊃ →)

F, F ⊃H,F ⊃G → G ∧H(→ ⊃)

F ⊃H,F ⊃G → F ⊃ (G ∧H)(→ ⊃)

F ⊃G → (F ⊃H)⊃(F ⊃ (G ∧H)

)(→ ⊃)

→ (F ⊃G)⊃(

(F ⊃H)⊃(F ⊃ (G ∧H)

))Example 1.3.20. A derivation in GPC of the sequent, used in Example1.3.15.

19

Page 22: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

p, q, r → r p, q → r, q(⊃ →)

p, q, q ⊃ r → r p, q ⊃ r → r, p(⊃ →)

p, p⊃ q, q ⊃ r → r

Example 1.3.21. A derivation in GPC of the sequent, used in Example1.3.16.

p, q → p, p ∧ r p, q → q, p ∧ r(→ ∧)

p, q → p ∧ q, p ∧ rp, r → p ∧ q, p p, r → p ∧ q, r

(→ ∧)p, r → p ∧ q, p ∧ r

(∨ →)p, q ∨ r → p ∧ q, p ∧ r

(→ ∨)p, q ∨ r → (p ∧ q) ∨ (p ∧ r)

(∧ →)p ∧ (q ∨ r) → (p ∧ q) ∨ (p ∧ r)

There are also other sequent calculi for propositional logic such as [2, 6].

1.3.4 Resolution method

Both of the previous methods are used to check the validity of some for-mula. Of course, as described in page 13, they can be used for satisfiabilitychecking too. A method presented in this section aims to demonstrate thatformula is not satisfiable. This method is called resolution calculus. It isclear that it can analogously be adapted for validity checking.

Let’s start with several definitions.A literal is an atomic formula or negation of atomic formula. In propo-

sitional logic only propositional variable is an atomic formula, so literal isa propositional variable (e.g. p) or its negation (e.g. ¬p). A disjunctionof literals (l1 ∨ l2 ∨ . . . ∨ ln) is called a disjunct. A conjunction of literals(l1 ∧ l2 ∧ . . . ∧ ln) is called a conjunct.Definition 1.3.22. Normal disjunctive form (or NDF) is a disjunction ofconjuncts (i.e. F1 ∨ F2 ∨ . . . ∨ Fn, where Fi, i ∈ [1, n] is a conjunct).Definition 1.3.23. Normal conjunctive form (or NCF) is a conjunction ofdisjuncts (i.e. F1 ∧ F2 ∧ . . . ∧ Fn, where Fi, i ∈ [1, n] is a disjunct).

It is said that two propositional formulas F and G are equivalent, if forany interpretation ν it is true that ν � F iff ν � G. Such fact is denotedF ≡ G. It is not hard to prove that for any propositional formula F it ispossible to find NDF (as well as NCF) G such that F ≡ G.

Before applying the resolution calculus a formula must be transformedinto set of disjuncts. In order to do that, first a formula is transformed intoNCF and then the set is composed of every disjunct of NCF. The resolutioncalculus contains only one rule:

F ∨ p ¬p ∨GF ∨G

Here F ∨p and ¬p∨G are premises and F ∨G is a conclusion. Because ofcommutativity of disjunction, p and ¬p can be in any part of the respectivepremise, not necessarily at the end or at the beginning of the formula.

20

Page 23: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

The application of the resolution rule produces a new disjunct, whichlater can be used in the derivation search. Usually the repeating literals inF ∨G are omitted and only one occurrence is left. In the application of therule F and G can be empty formulas. If both of them are empty, then it issaid that empty disjunct (denoted �) is obtained.

Definition 1.3.24. A derivation of disjunct F from set of disjuncts S inresolution calculus is a sequence F1, F2, . . . , Fn, where Fn = F and for ev-ery formula Fi, i ∈ [1, n] are either Fi ∈ S or Fi is obtained by applyingresolution rule to formulas Fk and Fl, k, l ∈ [1, i).

It is said that disjunct F is derivable from set of disjuncts S if there is aderivation of F from S. It is said that set of disjuncts S is derivable if � isderivable from S.

Although a derivation is defined as a list of formulas, for convenience itwill be presented as a tree.

Now to sum up, in order to derive formula F in resolution calculus,first it must be transformed into NCF. Now if the set of disjuncts of NCFis derivable, then formula F is derivable. If F is derivable in resolutioncalculus, then it is not satisfiable.

Example 1.3.25. An axiom 2.3 of HPC is valid. It is derived in sequentcalculus GPC in Example 1.3.19. However the negation of the axiom is notsatisfiable. Let’s derive it in resolution calculus. First a formula must betransformed into NCF:

¬(

(F ⊃G)⊃(

(F ⊃H)⊃(F ⊃ (G ∧H)

)))=

= ¬(

(¬F ∨G)⊃(

(¬F ∨H)⊃(¬F ∨ (G ∧H)

)))=

= ¬(¬(¬F ∨G) ∨

(¬(¬F ∨H) ∨

(¬F ∨ (G ∧H)

)))=

= (¬F ∨G) ∧ ¬(¬(¬F ∨H) ∨

(¬F ∨ (G ∧H)

))=

= (¬F ∨G) ∧(

(¬F ∨H) ∧ ¬(¬F ∨ (G ∧H)

))=

= (¬F ∨G) ∧(

(¬F ∨H) ∧(F ∧ ¬(G ∧H)

))=

= (¬F ∨G) ∧(

(¬F ∨H) ∧(F ∧ (¬G ∨ ¬H)

))=

= (¬F ∨G) ∧ (¬F ∨H) ∧ F ∧ (¬G ∨ ¬H)

21

Page 24: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Thus the set of disjuncts S = {¬F ∨G,¬F ∨H,F,¬G ∨ ¬H}. Now thederivation of S in resolution calculus is as follows:

F ¬F ∨HH

F ¬F ∨GG ¬G ∨ ¬H

¬H�

1.3.5 Important concepts of logic

Definition 1.3.26. Suppose F and G are two propositional formulas. G isa subformula of F (F is a superformula of G), iff:

• F = G,• F = ¬F1 and G is a subformula of F1, or• F = F1 ∧ F2, F = F1 ∨ F2, F = F1 ⊃ F2 or F = F1↔ F2 and G is a

subformula of F1 or F2.Example 1.3.27. Subformulas of formula (p ∧ ¬q) ∨

((p ∧ (r ⊃ q)

)are:

(p ∧ ¬q) ∨((p ∧ (r ⊃ q)

), (p ∧ ¬q), p, ¬q, q, p ∧ (r ⊃ q), r ⊃ q and r.

If G is a subformula of F it can be denoted as F (G). In that case formulaF (H) is obtained by replacing all the occurrences of subformulas G in F byH.Example 1.3.28. Suppose F = p ∧ (q ⊃ p), G = q ⊃ p and H = ¬q ∨ p.The fact that G is a subformula of F can be denoted as F (G). ThenF (H) = p ∧ (¬q ∨ p).Lemma 1.3.29. These formulas are equivalent in propositional logic:

• ¬¬p ≡ p,• ¬(p ∧ q) ≡ ¬p ∨ ¬q,• ¬(p ∨ q) ≡ ¬p ∧ ¬q,• p⊃ q ≡ ¬p ∨ q,• p↔ q ≡ (p⊃ q) ∧ (q ⊃ p).Another important measure is the length of the formula. It is defined in

recursive way and shows the number of logical operators in the formula.Definition 1.3.30. The length of propositional formula F (denoted l(F ))is:

• 0, if F is a propositional variable.• l + 1, if F is of the form ¬G and l = l(G).• l1 + l2 +1, if F is of the form G∧H, G∨H, G⊃H or G↔H, l1 = l(G)

and l2 = l(H).

22

Page 25: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

It is said that rule is admissible in some calculus if formula is derivablein the calculus using the rule iff it is derivable in the calculus without usingthe rule.

Most definitions presented in this subsection or in Section 1.3 can beeasily extended to cover other logics, which are defined later. Thus theseconcepts are used later in different contexts without further notice.

1.4 Other important concepts

1.4.1 Relations

Here only binary relations (with exception of Section 2.11) are used.Definition 1.4.1. A binary relation (or simply, relation) R in set A is anysubset of A×A.

According to the definition, a relation is some set of pairs of elementsof set A. E.g. {(1, 2), (1, 1), (3, 2)} is a relation in N. However, to simplifythe notation and to demonstrate that relation R is between two elements,instead of (a, b) ∈ R expression aRb is used.

The relation can have some properties, that are general for every element.Definition 1.4.2. Suppose R is a binary relation in set A, then R is:

• reflexive, iff for any a ∈ A it is true that aRa;• irreflexive, iff for any a ∈ A it is not true that aRa;• complete, iff for any a ∈ A there is b such that aRb;• symmetric, iff for any a, b ∈ A if aRb, then bRa;• asymmetric, iff for any a, b ∈ A if aRb, then it is not true that bRa;• antisymmetric, iff for any a, b ∈ A if aRb and bRa, then a = b;• transitive, iff for any a, b, c ∈ A if aRb and bRc, then aRc;• euclidean, iff for any a, b, c ∈ A if aRb and aRc, then bRc;

Lemma 1.4.3. It is not hard to demonstrate some properties of relations:• if relation is symmetric and transitive, then it is euclidean;• the relation is symmetric, transitive and complete iff it is reflexive and

euclidean;• if relation is reflexive, then it is complete;• if relation is irreflexive and transitive, then it is asymmetric.If a relation is reflexive, antisymmetric and transitive, then it is a weak

partial order relation. If a relation is irreflexive, antisymmetric and transi-tive, then it is a strict partial order relation. If relation R in set A is partialorder relation and for any a, b ∈ R it is true that aRb or bRa, then R istotal order relation.

23

Page 26: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

1.4.2 Functions and sets

Suppose f : A → B is a function. Point b = f(a) is called an image of pointa. An image of set A1 ⊂ A is a set {f(a) : a ∈ A1}.Definition 1.4.4. Function f : A → B is:

• injection, iff the image of different points is different. I.e. for anya1, a2 ∈ A if a1 6= a2, then f(a1) 6= f(a2);

• surjection, iff the image of set A is set B. I.e. f(A) = B;• bijection, iff it is injection and surjection.A bijection is actually a pairing of elements of two sets. It ensures that

every element is paired with exactly one element of the other set and thatevery element has a pair. If it is possible to find a bijection between twofinite sets, then both sets contain the same number of elements. Similarunderstanding can be extended to infinite sets. If it is possible to find abijection between set A and N, then set A is countable. There are manycountable sets: N, Z, Q,…. If a set is countable, then it is possible tonumber all its elements in some order. However, not every set is countable.The most famous set, which is not countable is R. If it is possible to finda bijection between set A and R, then the cardinality of set A is calledcontinuum.Definition 1.4.5. Suppose f : A → B is some function. Then a functionf−1 : B → A is called an inverse function of f if for every x ∈ A it is truethat f−1(f(x)) = x and for every y ∈ B it is true that f(f−1(y)) = y.

Function f is invertible, if there exists an inverse function of f . Thefollowing lemma can be proved:Lemma 1.4.6. A function is bijection iff it is invertible.

24

Page 27: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Chapter 2

Predicate logic

2.1 The definitions

It is not always convenient to denote propositions with a single propositionalvariable, because the truth of the proposition could depend on the value ofother parameters. Consider the proposition x is a prime number. It is trueif x = 3 and false, if x = 4. Such propositions are called predicates.Definition 2.1.1. The n-place predicate in set A is a single-valued n-argu-ment function f : An → {>,⊥}.Example 2.1.2. Some examples of predicates:

• x and y are neighbours, if x and y are from the set of Vilnius population.• height of x is larger than 2 meters, if x is from the set of Lithuania

citizens.• x and y are perpendicular, if x and y are from the set of lines of the

plane.• Predicate x is dividable by 5, if x is from set Z.• Predicate x+ y = z, if x, y and z are from set R.Therefore predicate logic (denoted PR) contains three types of variables:

1. propositional variables, denoted by small Latin letters: p, q, r, p1, p2,….2. individual variables, denoted by small Latin letters: x, y, z, x1, x2,….

Individual variables are used in predicates and sometimes are calledsimply variables.

3. predicate variables, denoted by capital Latin letters: P (x), Q(x, y),R(x, y, z), P1(x1, x2), P2(z),…. To denote the number of argumentsin predicate, an index in top right corner of the letter is used. E.g.two-place predicate P (x, y) can be denoted as P 2.

The individual variables (or arguments) of the predicate denotes someelement of the set in which the predicate is defined. The concrete elementsof the set are called individual constants. They are usually denoted usingsmall Latin letters a, b, c, a1, a2,….

25

Page 28: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 2.1.3. Let’s consider predicate P (x) defined in set Z, which istrue if x is an odd number. Then individual variable x represents anyinteger, and integers 2, 3, 4 are individual constants.

The interpretation of predicates can be defined in several ways. Some-times it is convenient to list all the arguments for which the predicate istrue (or false), e.g. by providing such table.Example 2.1.4. Let’s define predicate P (x, y, z) in set {a, b, c} such thatP (x, y, z) = > iff (x, y, z) ∈ {(a, b, c), (a, a, a), (b, a, c), (c, a, b)}. Therefore,P (c, a, b) = > and P (c, c, b) = ⊥. The table defining the predicate P is:

x y za b ca a ab a cc a b

As it was mentioned earlier, predicates are propositions with variables.Of course, it is possible that predicate is true (or false) with every value ofthe variable. To denote that there exists such value of variable x with whichpredicate P (x) is true, notation ∃xP (x) is used. To denote that predicateP (x) is true with every possible value of variable x notation ∀xP (x) isused. The signs ∃ and ∀ are called quantifiers and can be used in frontof composite formulas too. This is detailed in the definition of predicateformula.Definition 2.1.5. Predicate formula is defined recursively as follows:

1. If P is n-place predicate variable and x1, x2, . . . , xn are individual vari-ables, then P (x1, x2, . . . , xn) is a predicate formula. It is also called anatomic formula.

2. If p is a propositional variable, then p is a predicate formula. It is alsocalled an atomic formula.

3. If F is a predicate formula, then ¬F is also a predicate formula.4. If F and G are predicate formulas, then (F ∧G), (F ∨G), (F ⊃G) and

(F ↔G) are predicate formulas.5. if F is a predicate formula and x is individual variable, then ∃xF and∀xF are also predicate formulas.

As well as in propositional formulas, some brackets in predicate formulascan also be omitted. Quantifiers together with ¬ operator have the highestpriority among the operators. Atomic predicate formula is either predicateP (x1, x2, . . . , xn) or propositional variable p.Example 2.1.6. Some examples of predicate formulas:

• ∀x∃y((P (x, y) ∧Q(y, x, z)

)⊃ ∃zR(z, x, y)

),

26

Page 29: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• P (x, y, z) ∨ ∀x∀z(Q(y, z, x) ∨ ¬Q(x, y, z)

).

Definition 2.1.7. Say that predicate formula QxG, where Q ∈ {∀,∃} isa quantifier and G is some predicate formula, is a subformula of predicateformula F . Then the occurrence of formula G is called a scope of quantifierQ and quantifier complex Qx.

Definition 2.1.8. An occurrence of individual variable x in formula F iscalled bound if it is in the scope of quantifier complex ∀x or ∃x. Otherwisethe considered occurrence is called free. If formula F has at least one freeoccurrence of variable x, then variable x is free in formula F .

Definition 2.1.9. A predicate formula is closed, if it does not have any freeoccurrence of any variable.

If for two predicate formulas QxF and WxG, where Q,W ∈ {∀,∃},WxG is a subformula of F , then formula QxF is irregular. E.g. formula∀x∃xP (x) is irregular. Irregular formulas are not analysed here.

Example 2.1.10. Let’s define the following propositions using predicateformulas:

1. Every user has a permission to connect to some database.

2. For every database there is a user, who can connect to it.

For formalisation let’s use the following predicates:

• U(x) = > iff x is a user,

• D(x) = > iff x is a database,

• P (x, y, z) = > if x has a permission to do operation y in database z,

and individual constants:

• a — a permission to edit data,

• b — a permission to connect to the database.

The solutions are:

1. ∀x(U(x)⊃ ∃y

(D(y) ∧ P (x, b, y)

)),

2. ∀x(D(x)⊃ ∃y

(U(y) ∧ P (y, b, x)

)),

Example 2.1.11. Let’s define the given propositions using predicate for-mulas and predicates U , R, H and E defined in setM, where

• M is a set of users and reports,

• U(x) = > iff x is a user,

• R(x) = > iff x is a report,

27

Page 30: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• H(x, y) = > iff user x has report y,• E(x, y) = > iff x is the same object as y.

The propositions are:1. There is a user, who has no reports,2. There are some users, who have more than one report.The solutions are:

1. ∃x(U(x) ∧ ∀y

(R(y)⊃ ¬H(x, y)

)),

2. ∃x∃y∃z(U(x) ∧R(y) ∧R(z) ∧H(x, y) ∧H(x, z) ∧ ¬E(y, z)).As well as propositional formula, predicate formula can be true or false.

However the value of the formula depends not only on the value of proposi-tional variables, but also on the definition of predicates. Moreover, formulascan contain some free variables and the value can also depend on them. Thusto interpret a predicate formula, a structure is defined.Definition 2.1.12. Let F be a predicate formula. Let P k1

1 , P k22 , . . . , P kn

n beall the predicate variables occurring in F . Let x1, x2, . . . , xm be all the freevariables occurring in F . Then an F -corresponding structure is a multiple⟨ν,M, Rk1

1 , Rk22 , . . . , R

knn , a1, a2, . . . , am

⟩, where ν : P → {>,⊥} is an inter-

pretation of propositional variables (P is a set of propositional variables ofF ),M is some non-empty set, Rki

i , i ∈ [1, n] are some predicates, which aredefined in M, ai ∈ M, i ∈ [1,m]. Predicate Rki

i is corresponding predicateof P ki

i and individual constant ai is a corresponding constant of free variablexi.

To define which predicate of the structure corresponds to which predicateof the formula and which constant of the structure corresponds to which freevariable, predicates and free variables of the formula are listed in alphabeticorder. Usually predicate formulas does not contain propositional variables.If a formula F doesn’t contain propositional variables, then F -correspondingstructure can be presented without function ν. Similarly, if any other partof the structure is not necessary, it is omitted.

Once again the fact that formula F is true in some F -correspondingstructure S is denoted S �F and is defined in a recursive way:Definition 2.1.13. Let F be some predicate formula, P k1

1 , P k22 , . . . , P kn

n— all the predicate variables occurring in F , x1, x2, . . . , xm — all the freevariables occurring in F and S =

⟨ν,M, Rk1

1 , Rk22 , . . . , R

knn , a1, a2, . . . , am

⟩— some F -corresponding structure. Then:

• if F is a propositional variable, then S �F iff ν(F ) = >.

• if F = P kii (x1, x2, . . . , xki), then let xj1, xj2, . . . , xjm be the full list of

free variables in F . Let ali be a corresponding constant of xji, i ∈ [1,m].Now S �F iff Rki

i (x1, x2, . . . , xki){al1/xj1, al2/xj2, . . . , alm/xjm} = >.

28

Page 31: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• if F = ¬G, then S �F iff S 2G.

• if F = G ∧H, then S �F iff S �G and S �H.

• if F = G ∨H, then S 2F iff S 2G and S 2H.

• if F = G⊃H, then S 2F iff S �G and S 2H.

• if F = G↔H, then S 2F iff S �G and S �H or ν 2G and ν 2H.

• if F = ∀xG, then S �F iff for any a ∈M it is true that S �G{a/x}.

• if F = ∃xG, then S �F iff there is a ∈M such that S �G{a/x}.

Definition 2.1.14. A predicate formula F is satisfiable if there exists anF -corresponding structure in which F is true.

Definition 2.1.15. A predicate formula F is valid (tautology), if it is truein every F -corresponding structure.

Example 2.1.16. Read the propositions and determine if they are correct(if formulas are valid). Variables x and y are integers.

1. ∀x∃y(x+ y = 1),

2. ∃x∃y((x > y) ∧ (x+ y = 0)

),

3. ∃x∀y((x+ y = y) ∧ (x < 3)

),

4. ∀x∀y((x+ 3 = y)⊃ (y < x)

).

The solutions are:

1. For every x there is y such that x+ y = 1. Correct. In fact, y = 1− x.

2. There is x and y such that x > y and x+ y = 0. Correct. It is enoughto present one such example: let x = 4 and y = −4. It is obvious that4 > −4 and 4 + (−4) = 0.

3. There is x such that for any y it is true that x + y = y and x < 3.Correct. Once again, one such x must be found. Let x = 0. Then nomatter what the value of y is 0 + y = y and 0 < 3.

4. For any x and y if x+ 3 = y, then y < x. Incorrect. To show that, oneexample must be found such that x+ 3 = y but y ≮ x. Let x = 1 andy = 4. 1 + 3 = 4, but 4 ≮ 1.

Example 2.1.17. Now let’s analyse several formulas without any knowl-edge about the domain of the variables.

1. Formula ∀x∀y∀z((P (x, y)∧P (y, z)

)⊃P (x, z)

)is satisfiable, because it

is true in structure 〈R,=〉. It is obvious, that for real numbers formula∀x∀y∀z

(((x = y) ∧ (y = z)

)⊃ (x = z)

)is true.

29

Page 32: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

2. Formula P (x, y) ∧ ¬P (x, x) ∧ ∀x∃yP (x, y) is satisfiable, because it istrue in structure 〈N, <, 3, 5〉: 3 < 5, 3 ≮ 3 and ∀x∃y(x < y).

3. Formula ∀xP (x)⊃∃xP (x) is valid. For any structure 〈M, R〉 if formula∀xR(x) is true, then also formula ∃xR(x) is true. Recall that accordingto Definition 2.1.12 M 6= ∅. Therefore, if R(x) = > for every x ∈ M,then for some a ∈ M, R(a) = > and thus ∃xR(x) is true. If, however∀xR(x) is false, then the base formula is also true in the structure.

4. Formula ∃x∀y(P (x, x) ∧ ¬P (x, y)

)is not satisfiable. Suppose that the

formula is satisfiable in structure 〈M, R〉. Then there is a constanta ∈ M such that R(a, a) = >. Moreover, for every y ∈ M it is nottrue that R(a, y) and therefore R(a, a) = ⊥. So the contradiction wasobtained and therefore there is no such structure in which the baseformula is true.

It is worth noting that different statements in everyday language can bedenoted using the same formula. E.g. statements:

• every mushroom, which is not poisonous, is edible,

• every mushroom, which is not edible, is poisonous and

• everything, which is neither edible nor poisonous, is not mushroom atall.

are all equivalent and can be denoted using formula

∀x(

mushroom(x)⊃(¬ poisonous(x)⊃ edible(x)

))Consider syllogistic created by Aristotle, which was briefly introduced

in Page 3. All the statements analysed there can be represented usingpredicate formulas according to this table:

(a) Every S is P ∀x(S(x)⊃ P (x)

)(i) Neither of S is P ∀x

(S(x)⊃ ¬P (x)

)(e) Some of S are P ∃x

(S(x) ∧ P (x)

)(o) Some of S are not P ∃x

(S(x) ∧ ¬P (x)

)Example 2.1.18. These statements can be formalised as follows:

• Statement all the students (S) of informatics passed the algebra (A)exam is denoted as ∀x

(S(x)⊃ A(x)

).

• Statement some students (S) of informatics failed the logic (L) examis denoted as ∃x

(S(x) ∧ ¬L(x)

).

Thus it is possible to formally prove using predicate logic that 19 soundreasonings are really laws of logic.

30

Page 33: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

The order of quantifiers in a predicate formula in some cases is essential.Formulas ∀x∃yP (x, y) and ∃y∀xP (x, y) are not equivalent. It is not hardto find a structure in which one formula is true and another one is not. E.g.structure 〈N;<〉. Formula ∀x∃y(x < y) is true, but formula ∃y∀x(x < y) isfalse.Lemma 2.1.19. These formulas are equivalent in predicate logic:

1. ∀x∀yF ≡ ∀y∀xF ,2. ∃x∃yF ≡ ∃y∃xF ,3. ∀xF (x) ≡ ∀yF (y), here y is not part of F (x) and x is not part of F (y),4. ∃xF (x) ≡ ∃yF (y), here y is not part of F (x) and x is not part of F (y),5. ¬∀xF ≡ ∃x¬F ,6. ¬∃xF ≡ ∀x¬H.Here (and also later) F (x) denotes a predicate formula with free variable

x and in that case F (y) denotes the same formula with every free occurrenceof x replaced by y.Definition 2.1.20. A predicate formula is in negation normal form if (1) itconsists only of the operations ¬, ∧ and ∨ and (2) the negation, if it is partof the formula, occurs only next to atomic formulas.

Example 2.1.21. Formulas ∀xP (x)⊃ ∃y¬Q(y), ¬∀x∃y(P (x) ∨ ¬Q(x, y)

)and ∃x¬∃y

(¬P (x) ∨ P (y)

)are not in negation normal form. But formula

∀x∃y∀z((¬P (x, y) ∧Q(y, z)

)∨ ¬R(x, y)

)is.

Example 2.1.22. Let’s transform formula ¬∀x∃y(P (x, y) ⊃ ∃z¬Q(x, z)

)into negation normal form.

¬∀x∃y(P (x, y)⊃ ∃z¬Q(x, z)

)≡ ¬∀x∃y

(¬P (x, y) ∨ ∃z¬Q(x, z)

)≡

≡ ∃x¬∃y(¬P (x, y) ∨ ∃z¬Q(x, z)

)≡ ∃x∀y¬

(¬P (x, y) ∨ ∃z¬Q(x, z)

)≡

≡ ∃x∀y(P (x, y) ∧ ¬∃z¬Q(x, z)

)≡ ∃x∀y

(P (x, y) ∧ ∀zQ(x, z)

)Example 2.1.23. In differential calculus a function f(x) is continuous inpoint a if for every positive ε there is positive δ such that |f(x)− f(a)| < ε,if |x− a| < δ.

Therefore the definition can be represented using formula

∀ε∃δ∀x((|x− a| < δ)⊃ (|f(x)− f(a)| < ε)

)Thus a function is not continuous if

¬∀ε∃δ∀x((|x− a| < δ)⊃ (|f(x)− f(a)| < ε)

)≡

31

Page 34: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

≡ ∃ε∀δ∃x¬((|x− a| < δ)⊃ (|f(x)− f(a)| < ε)

)≡

≡ ∃ε∀δ∃x¬(¬(|x− a| < δ) ∨ (|f(x)− f(a)| < ε)

)≡

≡ ∃ε∀δ∃x((|x− a| < δ) ∧ ¬(|f(x)− f(a)| < ε)

)≡

≡ ∃ε∀δ∃x((|x− a| < δ) ∧ (|f(x)− f(a)| > ε)

)If set M of F -corresponding structure is finite, then it is possible to

eliminate the quantifiers from the formula. Suppose predicate P (x) is partof F and M = {a1, a2, . . . , an}, then quantifier ∀ can be eliminated fromformula ∀xP (x) using equivalence

∀xP (x) ≡ P (a1) ∧ P (a2) ∧ . . . ∧ P (an)

Similarly the quantifier ∃ can be eliminated from formula ∃xP (x) usingequivalence

∃xP (x) ≡ P (a1) ∨ P (a2) ∨ . . . ∨ P (an)Therefore, if only structures with finite setM (or simply finite structures)are analysed, then formula of predicate logic can be transformed to propo-sitional formula.Example 2.1.24. Let’s eliminate quantifiers from formula ∃x∀yQ(y, y, x)if the set of individual constants isM = {a, b, c}.

∃x∀yQ(y, y, x) = ∀yQ(y, y, a) ∨ ∀yQ(y, y, b) ∨ ∀yQ(y, y, c) ==(Q(a, a, a) ∧Q(b, b, a) ∧Q(c, c, a)

)∨(Q(a, a, b) ∧Q(b, b, b) ∧Q(c, c, b)

)∨(

Q(a, a, c) ∧Q(b, b, c) ∧Q(c, c, c))

However it is not enough to analyse finite structures only. This is demon-strated by the following theorem.Theorem 2.1.25. Formula

∀x∃yP (x, y) ∧ ∀x¬P (x, x) ∧ ∀x∀y∀z((P (x, y) ∧ P (y, z)

)⊃ P (x, z)

)is satisfiable in infinite structure but is not satisfiable in any finite structure.Proof. Notice, that the formula is a conjunction of three different subformu-las: ∀x∃yP (x, y), ∀x¬P (x, x) and ∀x∀y∀z

((P (x, y) ∧ P (y, z)

)⊃ P (x, z)

).

The formula is true in structure 〈N, <〉. In fact, for natural numbers, formu-las ∀x∃y(x < y), ∀x¬(x < x) and ∀x∀y∀z

(((x < y) ∧ (y < z)

)⊃ (x < z)

)are true.

However, in every structure with finite set the formula is false. Theproof is by contradiction. Suppose that the formula is true in structureS = 〈M;Q(x, y)〉 and M = {a1, a2, . . . , an}. Let’s choose some ai1 ∈ M.The formula is true in the structure, therefore ∀x∃yQ(x, y) is true and there

32

Page 35: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

is ai2 ∈ M such that Q(ai1, ai2) = >. By continuing this reasoning, it ispossible to construct an infinite sequence ai1, ai2, . . . of elements of the setM, where Q(aij , aij+1) = > for every j. Now the sequence is infinite, butthe setM has n elements. Therefore, among the first n+ 1 elements of thesequence (ai1, ai2, . . . , ain+1) there are at least two, that are equal. Let’s saythat aim = aim+k .

Now, because ∀x∀y∀z((Q(x, y) ∧Q(y, z)

)⊃Q(x, z)

), Q(aim, aim+1) = >

and Q(aim+1, aim+2) = >, then also Q(aim, aim+2) = >. By following thisreasoning, it is possible to obtain that Q(aim, aim+3) = >, Q(aim, aim+4) =>,… and Q(aim, aim+k) = >. However, formula ∀x¬Q(x, x) is also true, andbecause aim = aim+k a contradiction is obtained. Therefore the base formulais not satisfiable in any finite structure.

According to the definition, a set of a structure can be of any cardinality.From Theorem 2.1.25 it is obvious that it is not enough to analyse onlyfinite sets. However, another theorem ensures that it is enough to checkonly countable sets.Theorem 2.1.26 (Löwenheim-Skolem). If formula of predicate logic is sat-isfiable, then it is satisfiable in some countable set.

2.2 Normal prenex forms

As mentioned in page 20 all the formulas of propositional logic can betransformed into equivalent NDFs and NCFs. Similarly predicate formulascan be transformed into normal prenex form.Definition 2.2.1. Formula is in normal prenex form if it is of the formQ1x1Q2x2 . . .QnxnG, where Qi ∈ {∀,∃}, i ∈ [1, n] and G is a formula with-out any quantifier. G is called a matrix and Q1x1Q2x2 . . .Qnxn is called aprefix.Example 2.2.2. According to the definition:

• formula ∃x∀y(P (x, x) ∨Q(y, x)

)is in normal prenex form,

• formula ∃xP (x)⊃ ∀yQ(y) is not in normal prenex form.If F ≡ G and G is in normal prenex form, then it is said that G is a

normal prenex form of F . Every formula has a normal prenex form. Totransform the formula into normal prenex form the following equivalencesare used:

1. ¬∀xF (x) ≡ ∃x¬F (x),2. ¬∃xF (x) ≡ ∀x¬F (x),3. ∃xF (x) ≡ ∃yF (y), where y is a new variable, not part of F (x),4. ∀xF (x) ≡ ∀yF (y), where y is a new variable, not part of F (x),

33

Page 36: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

5. ∀xF (x) ∧G ≡ ∀x(F (x) ∧G

), where x is not part of G,

6. ∃xF (x) ∧G ≡ ∃x(F (x) ∧G

), where x is not part of G,

7. ∀xF (x) ∨G ≡ ∀x(F (x) ∨G

), where x is not part of G,

8. ∃xF (x) ∨G ≡ ∃x(F (x) ∨G

), where x is not part of G,

First, all the occurrences of logical operations other than ¬, ∨ or ∧ mustbe eliminated. This is done using equivalences mentioned in Lemma 1.3.29.Next, using equivalences 1 and 2 formula without negations in front ofquantifiers must be obtained. Another step is to rename variables usingequivalences 3 and 4 to ensure that every quantifier has a different variable.Finally quantifiers must be taken out using equivalences 5, 6, 7 and 8.

This procedure definitely produces a normal prenex form of any givenformula of predicate logic. However to simplify the result, other equivalencescan be used:

1. ∀xF (x) ∧ ∀xG(x) ≡ ∀x(F (x) ∧G(x)

),

2. ∃xF (x) ∨ ∃xG(x) ≡ ∃x(F (x) ∨G(x)

),

It must be noted that conjunction and disjunction are not interchangeablein the last two equivalences. That is, ∀xF (x)∨ ∀xG(x) 6≡ ∀x

(F (x)∨G(x))

and ∃xF (x) ∧ ∃xG(x) 6≡ ∃x(F (x) ∧G(x)).

To prove the first one, let F (x) = P (x) and G(x) = Q(x). Let’s analysethe structure 〈N, x < 5, x > 5〉. In fact formula ∀x(x < 5) ∨ ∀x(x > 5) isfalse, but ∀x

((x < 5) ∨ (x > 5)

)is true.

To prove the second one, once again let F (x) = P (x) and G(x) = Q(x)and let’s analyse the structure 〈N, x < 3, x > 10〉. In fact it is true that∃x(x < 3) ∧ ∃x(x > 10), it is false that ∃x

((x < 3) ∧ (x > 10)

).

Example 2.2.3. Let F = ∀x∃yP (x, y) ⊃ ∀y(Q(y, y) ∧ ∃xP (y, x)

). Let’s

transform F into normal prenex form.

F = ∀x∃yP (x, y)⊃ ∀y(Q(y, y) ∧ ∃xP (y, x)

)≡

≡ ¬∀x∃yP (x, y) ∨ ∀y(Q(y, y) ∧ ∃xP (y, x)

)≡

≡ ∃x∀y¬P (x, y) ∨ ∀y(Q(y, y) ∧ ∃xP (y, x)

)≡

≡ ∃x∀y¬P (x, y) ∨ ∀y∃x(Q(y, y) ∧ P (y, x)

)≡

≡ ∃u∀v¬P (u, v) ∨ ∀y∃x(Q(y, y) ∧ P (y, x)

)≡

≡ ∃u∀v∀y∃x(¬P (u, v) ∨

(Q(y, y) ∧ P (y, x)

))

34

Page 37: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Notice, that it is possible to obtain the simpler normal prenex form:

∃x∀y¬P (x, y) ∨ ∀y∃x(Q(y, y) ∧ P (y, x)

)≡

≡ ∃x∀v¬P (x, v) ∨ ∀y∃x(Q(y, y) ∧ P (y, x)

)≡

≡ ∀y(∃x∀v¬P (x, v) ∨ ∃x

(Q(y, y) ∧ P (y, x)

))≡

≡ ∀y∃x(∀v¬P (x, v) ∨

(Q(y, y) ∧ P (y, x)

))≡

≡ ∀y∃x∀v(¬P (x, v) ∨

(Q(y, y) ∧ P (y, x)

))Example 2.2.4. Let’s transform formula ∀x∃yP (x, y) ∨ ∀x∃yQ(x, y) intonormal prenex form and let’s try to minimise the prefix.

∀x∃yP (x, y) ∨ ∀x∃yQ(x, y) ≡ ∀x∃yP (x, y) ∨ ∀z∃yQ(z, y) ≡

≡ ∀x∀z(∃yP (x, y) ∨ ∃yQ(z, y)

)≡ ∀x∀z∃y

(P (x, y) ∨Q(z, y)

)There is no algorithm to check if predicate formula is satisfiable (or valid).

However for some subsets of the set of predicate formulas such algorithmexists. One of such subsets is set of formulas with one-place predicatevariables only. To prove that it is always possible to check if formula withone-place predicate variables only is satisfiable, first it must be shown thatany such formula can be transformed to normal prenex form with prefix∀∀ . . . ∀∃∃ . . . ∃. Here the complete proof is omitted and only an algorithmfor such transformation is provided.

Example 2.2.5. Transform formula ∃y∀x((P (x)∨Q(y)

)∧(R(x)∨R(y)

))into normal prenex form with prefix ∀∀ . . . ∀∃∃ . . . ∃.

Let’s put ∀x into brackets:

∃y∀x((P (x) ∨Q(y)

)∧(R(x) ∨R(y)

))≡

≡ ∃y((∀xP (x) ∨Q(y)

)∧(∀xR(x) ∨R(y)

))Let’s transform the matrix into NDF:

∃y((∀xP (x) ∨Q(y)

)∧(∀xR(x) ∨R(y)

))≡

≡ ∃y((∀xP (x)∧∀xR(x)

)∨(∀xP (x)∧R(y)

)∨(Q(y)∧∀xR(x)

)∨(Q(y)∧R(y)

))Let’s put ∃y into brackets:

∃y((∀xP (x)∧∀xR(x)

)∨(∀xP (x)∧R(y)

)∨(Q(y)∧∀xR(x)

)∨(Q(y)∧R(y)

))≡

35

Page 38: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

≡(∀xP (x)∧∀xR(x)

)∨(∀xP (x)∧∃yR(y)

)∨(∃yQ(y)∧∀xR(x)

)∨∃y

(Q(y)∧R(y)

)Let’s take the quantifiers out of conjunctions. Let’s start with ∀ and after

that let’s take out ∃:(∀xP (x)∧∀xR(x)

)∨(∀xP (x)∧∃yR(y)

)∨(∃yQ(y)∧∀xR(x)

)∨∃y

(Q(y)∧R(y)

)≡

≡ ∀x(P (x)∧R(x)

)∨∀x

(P (x)∧∃yR(y)

)∨∀x

(∃yQ(y)∧R(x)

)∨∃y

(Q(y)∧R(y)

)≡

≡ ∀x(P (x)∧R(x)

)∨∀x∃y

(P (x)∧R(y)

)∨∀x∃y

(Q(y)∧R(x)

)∨∃y

(Q(y)∧R(y)

)Let’s rename the variables:

∀x(P (x)∧R(x)

)∨∀x∃y

(P (x)∧R(y)

)∨∀x∃y

(Q(y)∧R(x)

)∨∃y

(Q(y)∧R(y)

)≡

≡ ∀x(P (x)∧R(x)

)∨∀z∃y

(P (z)∧R(y)

)∨∀u∃y

(Q(y)∧R(u)

)∨∃y

(Q(y)∧R(y)

)Let’s take the quantifiers out of the brackets:

∀x(P (x)∧R(x)

)∨∀z∃y

(P (z)∧R(y)

)∨∀u∃y

(Q(y)∧R(u)

)∨∃y

(Q(y)∧R(y)

)≡

≡ ∀x∀z∀u∃y((P (x)∧R(x)

)∨(P (z)∧R(y)

)∨(Q(y)∧R(u)

)∨(Q(y)∧R(y)

))The obtained formula is in normal prenex form.In order to put quantifiers into brackets, the subformulas can be trans-

formed into NDF or NCF. By doing this repeatedly, it is always possible toachieve that there are no quantifiers inside the scope of other quantifiers.This is due to the fact that formula contains one-place predicates only.

The normal prenex forms of formulas are classified into decidable andundecidable according to the form of the prefix and the type of predicatevariables. Decidable means that there is an algorithm to check if a formulais satisfiable (or valid). Usually only formulas with no free variables areanalysed.

A set of formulas in normal prenex form is called a class. Classesare defined by the pair 〈π, σ〉. Here π is any combination of elements of{∀,∃,∀n,∃n,∀∞,∃∞}, n ∈ [2,∞) and σ is a set of predicate variables. Vari-able σ also provides information about number of places in every predicatevariable. It is obvious that π represents the type of prefix that any formulaof the class has. Notation ∀n means prefix of the form ∀x1∀x2 . . . ∀xn andnotation ∃n is understood similarly. Notation ∀∞ (∃∞) means any number(even 0) of quantifier complexes of the form ∀x (respectively ∃x). Set σdefines the type of predicate variables, that formula may contain. It showshow many one-place, two-place, etc… predicates every formula of the classhas. More formally, the class is defined as follows:Definition 2.2.6. A pair 〈π, σ〉 denotes a class of formulas of the normalprenex form Q1x1Q2x2 . . .QnxnG such that:

1. Qi ∈ {∀, ∃}, i ∈ [1, n],

36

Page 39: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

2. G does not contain quantifiers,

3. π = Q1Q2 . . .Qn,

4. there is a bijection between the set of predicate variables of G (takinginto account the number of places in the predicates) and σ.

Example 2.2.7. Formula ∀x∃y((P (x)∨P (y)

)∧(Q(x, y)∨R(y)

))is part

of the class⟨∀∃, {P 1

1 , P12 , P

23 }⟩, because it has two one-placed and one two-

placed predicate variables and the prefix ∀∃.

Suppose π1 and π2 are the two representations of the prefix in definitionof the class. It is said that π1 is part of π2, if it is possible to obtain π1 fromπ2 using finite number of operations:

1. removing symbol ∀ or ∃,

2. replacing symbol ∀∞ by ∀n or symbol ∃∞ by ∃n,

3. replacing symbol ∀n by ∀m or symbol ∃n by ∃m, if m < n.

Definition 2.2.8. It is said that 〈π1, σ1〉 6 〈π2, σ2〉 (the later class is largerthan the former one) if:

1. π1 = π2 or π1 is part of π2,

2. there is a bijection between σ1 and subset of σ2.

It is easy to see that if some class is undecidable, then any larger class isundecidable too. Now let’s list several minimal undecidable classes:

•⟨∃∀∃, {P 2, Q1

1, Q12, . . . }

⟩;

•⟨∃3∀, {P 2, Q1

1, Q12, . . . }

⟩;

•⟨∀∞∃3∀, {P 2}

⟩;

•⟨∃∞∀, {P 2}

⟩;

•⟨∃∀∃∞, {P 2}

⟩;

•⟨∃3∀∞, {P 2}

⟩;

•⟨∀∞∃∀∃, {P 2}

⟩;

•⟨∃∀∞∃, {P 2}

⟩;

•⟨∃∀∃∀∞, {P 2}

⟩.

It should be noted that from the fact that class⟨∃∀∃, {P 2, Q1

1, Q12, . . . }

⟩is undecidable follows that any larger class is also undecidable. Thus the

37

Page 40: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

statement that such class is undecidable means that any formula with fol-lowing properties is undecidable:

• prefix of the formula is ∃∀∃ or ∃∀∃ is part of the prefix of the formulaand

• formula contains at least one two-place predicate and any number ofone-place predicates.

A class 〈π, σ〉 is decidable if:• σ composes of one-place predicate variables only;• π = ∀∞∃∞;• π = ∀∞∃2∀∞;• 〈π, σ〉 6 〈π′, σ′〉, where 〈π′, σ′〉 is decidable.

2.3 Predicate logic with function symbols

Any expression that can occur as the parameter of the predicate, is called,a term. Individual constants and individual variables are terms. However,let’s extend the notion of term by including functions. Suppose predicatesare defined in set M. Then only functions of the form f : Mn → M areanalysed for any n ∈ N\{0}. Functions are denoted by small Latin letters f ,g, h, f1,… and as well as for predicate variables, the number of arguments ofthe function can be presented as the top-right index: fn. Terms are denotedusing small t with or without index.

Suppose, a set of individual constants consists of days of the year. Thereare some examples of functions defined in this set: y = tomorrow(x) (ifx = 14th of March, then tomorrow(x) = 15th of March), y = yesterday(x),y = one_week_later(x), y = one_month_later(x).Definition 2.3.1. A term is defined as follows:

• Individual constant is a term.• Individual variable is a term.• If fn is function symbol and t1, t2, . . . , tn are terms, then f(t1, t2, . . . , tn)

is also a term.Example 2.3.2. Let M = {a, b, c}, f(x) is one-place function symbol.Then the following expressions are terms: a, b, c, x, y, z, f(x), f(a), f(c),f(f(x)

), f(f(a)

), f(f(f(y)

)),….

Now let’s define predicate formula with function symbols.Definition 2.3.3. Formula is defined recursively as follows:

1. If P is n-place predicate variable and t1, t2, . . . , tn are terms, thenP (t1, t2, . . . , tn) is a formula.

38

Page 41: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

2. If p is a propositional variable, then p is a formula.3. If F is a formula, then ¬F is also a formula.4. If F and G are formulas, then (F ∧G), (F ∨G), (F ⊃G) and (F ↔G)

are formulas.5. if F is a formula and x is individual variable, then ∃xF and ∀xF are

also formulas.Suppose, a set of individual constants consists of all the lines in the plain.

Function f(x) returns a line y which is perpendicular to line x and crossesthe centre of coordinate system. Say, predicate L(x, y) = > iff lines x andy are parallel. Then formula L(x, f(y)) = >, iff line x is parallel to a line,which is perpendicular to y and crosses the centre of coordinate system.

The definition of expression F (x) can be extended to cover terms. Sup-pose x is a free variable in formula F (x) and t is a term. Formula F (t) isobtained from F (x) by replacing all the free occurrences of x by term t.Example 2.3.4. If F (x) = ∀x

(P (x) ∨Q(x)

)∧ R(x, x) and t = f

(a, g(y)

),

then F (t) = ∀x(P(x)∨Q

(x))∧R

(f(a, g(y)

), f(a, g(y)

)).

It is possible to do without function symbols in predicate logic. Thisis just a more convenient (natural) way to formalise expressions, formulaswith function symbols are shorter. E.g. instead of y = f(x) a predicateP (x, y) could be defined such that P (x, y) = > iff y = f(x).

Of course, to interpret predicate formulas with function symbols a dif-ferent structure is needed. Such structure must cover interpretation of thefunctions.Definition 2.3.5. Let F be a predicate formula with function symbols.Let P k1

1 , P k22 , . . . , P kn

n be all the predicate variables occurring in F . Letx1, x2, . . . , xm be all the free variables occurring in F . Let f l11 , f

l22 , . . . , f

luu

be all the function symbols occurring in F . Then multiple⟨ν,M, Rk1

1 , Rk22 , . . . , R

knn , a1, a2, . . . , am, g

l11 , g

l22 , . . . , g

luu

⟩is called an F -corresponding structure if ν : P → {>,⊥} is an interpretationof propositional variables (P is a set of propositional variables of F ),M issome non-empty set, Rki

i , i ∈ [1, n] are some predicates, which are definedin M, ai ∈ M, i ∈ [1,m], glii : Mli → M, i ∈ [1, u] are some functions.Predicate Rki

i is corresponding predicate of P kii , individual constant ai is a

corresponding constant of free variable xi and function glii is correspondingfunction of f lii .

Once again, a concept of S �F must be redefined, however it should beobvious how to change Definition 2.1.13 to incorporate function symbols.The definitions of satisfiable and valid formulas are analogous to Definitions2.1.14 and 2.1.15.

Now to better understand the definitions let’s analyse several examples.

39

Page 42: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 2.3.6. Formula ∀x∃y(P(x, y, f(x)

)∧ Q

(y, y, y

))is satisfiable.

It is true in structure 〈N, x+ y = z, xy = z, x+ 1〉. That is, a formula∀x∃y

((x + y = x + 1) ∧ (yy = y)

)is true. For any x if y = 1, then

both parts of the conjunction are true.Example 2.3.7. Formula

∀x¬P(x, x

)∧ ∀xP

(y, f(x)

)∧ ∀x∃y

(P(f(x), y

)∧ P

(y, f(f(x))

))is satisfiable, because it is true in structure 〈N, x < y, 1, x+ 2〉. That is,∀x¬(x < x) ∧ ∀x(1 < x + 2) ∧ ∀x∃y

((x + 2 < y) ∧ (y < x + 4)

)is true for

natural numbers.

Example 2.3.8. Is formula ∀x(P(f(x), x

)∧P

(x, g(x)

))⊃∀xP

(f(x), g(x)

)valid?

To answer this question positively, it must be proved that formula is truein every structure. To answer this question negatively, it is enough to findone structure, in which this formula is false. Actually, this formula is falsein structure 〈M, P ′, f ′, g′〉, where:

• M = {1, 2, 3},• P ′(x, y) = > iff (x, y) ∈ {(1, 1), (1, 2), (2, 3), (3, 3)},• f ′(1) = 1, f ′(2) = 1, f ′(3) = 3,• g′(1) = 2, g′(2) = 3, g′(3) = 3.

Formula ∀x(P ′(f ′(x), x

)∧ P ′

(x, g′(x)

))is true, but ∀xP ′

(f ′(x), g′(x)

)is

false, because P ′(f ′(2), g′(2)

)= P ′(1, 3) = ⊥.

Example 2.3.9. Is formula ∀xP(x, f(x)

)⊃ P

(f(a), f(f(a))

)valid?

Actually it is, and in order to prove that let’s assume contrary, that thereis a structure 〈M, P ′, f ′〉 such that ∀xP ′

(x, f ′(x)

)⊃ P ′

(f ′(a), f ′(f ′(a))

)is

false. That is, ∀xP ′(x, f ′(x)

)is true and P ′

(f ′(a), f ′(f ′(a))

)is false. The

former formula, is true for every x, therefore x can be changed to f ′(a).After the change, formula P ′

(f ′(a), f ′(f ′(a))

)is obtained, which is true

according to the former formula, but false according to the latter one. Thisis the contradiction, therefore the base formula is valid.

By using function symbols it is possible to remove ∃ quantifier. The pro-cess of finding equivalent formula without ∃ quantifier is called skolemizationand was described in 1920 by Norwegian logician Th. Skolem (1887–1963).

Before skolemization, a formula must be transformed into normal prenexform. Suppose F = Q1x1Q2x2 . . .QnxnG(x1, x2, . . . , xn) is such formula(i.e. Qi ∈ {∀,∃}, i ∈ [1, n], formula G(x1, x2, . . . , xn) has no quantifiers andx1, x2, . . . , xn is the full list of free variables in G). Skolemization can be

40

Page 43: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

described as follows. Suppose Qr = ∃ is the first such quantifier in F . Thatis, Q1 = Q2 = · · · = Qr−1 = ∀. Let

F ′ = πG(x1, x2, . . . , xr−1, f(x1, x2, . . . , xr−1), xr+1, xr+2, . . . , xn

)where prefix π = ∀x1∀x2 . . . ∀xr−1Qr+1xr+1Qr+2xr+2 . . .Qnxn and f is anew function variable, which is not part of G. If r = 1, i.e. ∃ is the firstquantifier of F , then let F ′ = Q2x2Q3x3 . . .QnxnG(a, x2, x3 . . . , xn), wherea is some new individual constant, which is not part of G. Such process iscontinued until there is no ∃ quantifier in F ′.Example 2.3.10. Let’s skolemize formula

∃x1∃x2∀y1∀y2∃x3∀y3∃x4G(x1, x2, y1, y2, x3, y3, x4)Let a and b be new constants, that are not part of G. Let f(y1, y2) andg(y1, y2, y3) be new function symbols. Then the skolemized formula is:

∀y1∀y2∀y3G(a, b, y1, y2, f(y1, y2), y3, g(y1, y2, y3)

)Suppose, F is some closed formula. Let’s do the following:

1. transform it into normal prenex form,2. skolemize it,3. remove all the quantifiers ∀,4. transform it into NCF.

The resulting formula is called a standard form of formula F . Althoughthere are no quantifiers in the standard form, it is assumed that all the freevariables are bounded by quantifier ∀.Example 2.3.11. Let’s transform formula

∀x((P (x) ∧Q(x)

)⊃ ∃y

(R(x, y) ∧ S(y)

))into standard form.

∀x((P (x) ∧Q(x)

)⊃ ∃y

(R(x, y) ∧ S(y)

))≡

≡ ∀x∃y((P (x) ∧Q(x)

)⊃(R(x, y) ∧ S(y)

))≡

≡ ∀x((P(x)∧Q

(x))⊃(R(x, f(x)

)∧ S

(f(x)

)))≡

≡(P(x)∧Q

(x))⊃(R(x, f(x)

)∧ S

(f(x)

))≡

≡ ¬(P(x)∧Q

(x))∨(R(x, f(x)

)∧ S

(f(x)

))≡

≡(¬P

(x)∨ ¬Q

(x))∨(R(x, f(x)

)∧ S

(f(x)

))≡

≡(¬P

(x)∨ ¬Q

(x)∨R

(x, f(x)

))∧(¬P

(x)∨ ¬Q

(x)∨ S

(f(x)

))

41

Page 44: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Formulas with function symbols can also be classified into decidable andundecidable classes. Recall that formulas must be in normal prenex form.

For formulas with function symbols different notation is used. A classis presented as π(pred:i1, i2, . . . , in; funkc:j1, j2, . . . , jm). Here π is a prefixof a formula, ik, k ∈ [1, n] means that formula must contain ik k-placepredicate variables. The values of jl, l ∈ [1,m] means that formula mustcontain jl l-place function variables. If ik =∞, it means that formula maycontain any number of k-place predicate variables. Notation jl is interpretedanalogously. If instead of all the ik (jl) a word any is written, then anynumber of any type of predicate (respectively function) variables may bepresent in a formula. If instead of concrete prefix, letter π is written, formulamay contain any prefix.Example 2.3.12. π(pred:∞; funkc:1) denotes a class of normal prenex formformulas with any prefix, any number of one-place predicate variables anda single one-place function symbol.

American scientist Y. Gurevichius proved that class π(pred:∞; funkc:∞)is maximal decidable and ∃∃(pred:0, 1; funkc:1) and ∃∃(pred:1; funkc:0, 1)are minimal undecidable classes.

In some cases equality predicate is incorporated in syntax of predicatelogic. Therefore formulas with equality predicate are also classified accord-ing to decidability:

Maximal decidable classes:• π(=; pred:∞; funkc:1),• ∀∗(=; pred:any; funkc:any),• ∀∗∃∀∗(=; pred:any; funkc:1),• ∀∗∃∗(=; pred:any; constants:∞).Minimal undecidable classes:

• ∃∃∀(=; pred:∞, 1),• ∃∃∀(=; pred:0, 1; constants:∞),• ∃∃∀∗(=; pred:0, 1),• ∀∗∃∃∀(=; pred:0, 1),• ∃(=; funkc:2),• ∃(=; funkc:0, 1).

2.4 Hilbert-type calculus

Definition 2.4.1. It is said that term t is free with respect to variable xin formula F (x), if for any individual variable y in t, x doesn’t occur in thescope of ∀y, nor of ∃y in formula F (x).

42

Page 45: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 2.4.2. Let F = ∀y∃z∀u(P (y, z)∨Q(x, v)

). Terms f

(b, f(v, w)

),

g(f(x), w

), x, v are free with respect to x in F . Terms f(x, y), g

(u, f(a, b)

),

z are not free with respect to x in F .Hilbert-type predicate calculus is similar to propositional Hilbert-type

calculus HPC.Definition 2.4.3. Hilbert-type calculus for predicate logic (denoted HPR)consists of axioms of HPC and:

5.1 ∀xF (x)⊃ F (t),5.2 F (t)⊃ ∃xF (x).

Here, t is a term, which is free with respect to variable x in formula F (x).The rules of HPR are:

F F ⊃G MPG

G⊃ F (y)∀

G⊃ ∀xF (x)F (y)⊃G

∃∃xF (x)⊃GHere y is a free variable in F (y), but it does not occur in G ⊃ ∀xF (x)

freely. Moreover, y must be free with respect to x in formula F (x). Notice,that y can possibly be equal to x.

The additional requirement for term t in axioms 5.1 and 5.2 is necessary.Without it, it would be possible to derive false statements from the correctones. E.g. ∀x∃y(x 6= y) is a satisfiable formula (e.g. in set N), however∃y(y 6= y) is not and therefore, formula ∀x∃y(x 6= y) ⊃ ∃y(y 6= y) is notvalid and should not be an axiom of this calculus. Actually, in this case yis not free with respect to x in formula ∀x∃y(x 6= y).

The additional requirements for variable y in rules ∀ and ∃ are alsonecessary. This could also be demonstrated with an example, which doesnot respect the requirement:

(x > 7)⊃ (x > 3)(x > 7)⊃ ∀x(x > 3)

Although the premise is valid, the conclusion is not. This is because xoccurs freely in the conclusion.

In a separate case, when G is not present, rule ∀ can be transformed into:F (y)

∀′∀xF (x)Let’s analyse an example of derivation in HPR.

Example 2.4.4. Let’s show, that from formula ∀x∀yP (x, y) another for-mula ∀y∀xP (x, y) is derivable. Let’s construct a derivation:1. ∀x∀yP (x, y) An assumption.2. ∀x∀yP (x, y)⊃ ∀yP (a, y) Axiom 5.1.3. ∀yP (a, y) MP rule from 1 and 2.4. ∀yP (a, y)⊃ P (a, b) Axiom 5.1.5. P (a, b) MP rule from 3 and 4.6. ∀xP (x, b) ∀ rule from 5.7. ∀y∀xP (x, y) ∀ rule from 6.

43

Page 46: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

It is known that HPR is sound and complete. However, let’s demonstratea weaker statement.Theorem 2.4.5. Hilbert-type predicate calculus HPR is not contradictory.Proof. Let’s define a transformation operator Tr(F ), which transforms pred-icate formula F into propositional formula:

• Tr(P (t1, t2, . . . , tn)

)= p, that is to an atomic formula a new proposi-

tional variable is assigned,• Tr(¬F ) = ¬Tr(F ),• Tr(F ∧G) = Tr(F ) ∧ Tr(G),• Tr(F ∨G) = Tr(F ) ∨ Tr(G),• Tr(F ⊃G) = Tr(F )⊃ Tr(G),

• Tr(∀xF (x)

)= Tr

(F (x)

),

• Tr(∃xF (x)

)= Tr

(F (x)

).

This operator has the following properties:• If predicate formula F is an axiom of HPR, then Tr(F ) is a valid

formula.• If Tr(F ) is a valid formula and G is obtained from F using rules ∀, ∀′

or ∃, then Tr(G) is also a valid formula, because Tr(F ) = Tr(G).• If Tr(F ) and Tr(F ⊃G) are both valid, then Tr(G) is also valid.Therefore, if some formula F is derivable in Hilbert-type predicate cal-

culus, then Tr(F ) is a valid formula. Therefore, it is impossible to deriveformula ¬F , because Tr(¬F ) = ¬Tr(F ) is not satisfiable formula.

2.5 Sequent calculus

A definition of sequent is the same as in propositional logic, except that theformulas now are from predicate logic.Definition 2.5.1. A sequent calculus for predicate logic (denoted GPRo)is obtained by adding rules for quantifiers into calculus GPCo:

F (z),Γ → ∆(∃ →)

∃xF (x),Γ → ∆Γ → ∆,∃xF (x), F (t)

(→ ∃)Γ → ∆,∃xF (x)

F (t),∀xF (x),Γ → ∆(∀ →)

∀xF (x),Γ → ∆Γ → ∆, F (z)

(→ ∀)Γ → ∆,∀xF (x)

Here z is a new variable, which doesn’t belong to Γ, ∆, ∃xF (x) nor∀xF (x) and t is a term, which is free with respect to x in formula F (x).

44

Page 47: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

It have already been mentioned that the main result of Gentzen was theproof of cut-elimination theorem for predicate logic.Theorem 2.5.2 (Gentzen Hauptsatz). If all the free and bound variables insome sequent are denoted using different letters, then the sequent is derivablein predicate sequent calculus GPRo iff it is derivable without using the cutrule.

However, later more convenient calculi without structural rules were de-veloped. To obtain such calculus let’s add the same quantifier rules intocalculus for propositional logic GPC.Definition 2.5.3. Gentzen-type calculus without structural rules for pred-icate logic (GPR) is obtained by adding rules for quantifiers into calculusGPC:

F (z),Γ → ∆(∃ →)

∃xF (x),Γ → ∆Γ → ∆,∃xF (x), F (t)

(→ ∃)Γ → ∆,∃xF (x)

F (t),∀xF (x),Γ → ∆(∀ →)

∀xF (x),Γ → ∆Γ → ∆, F (z)

(→ ∀)Γ → ∆,∀xF (x)

Here z is a new variable, which doesn’t belong to Γ, ∆, ∃xF (x) nor∀xF (x) and t is a term, which is free with respect to x in formula F (x).

Order of formulas in multisets is not important.Example 2.5.4. Let’s show that sequent → ∀x∀yP (x, y)⊃∀y∀xP (x, y) isderivable in calculus GPR. Recall, that this sequent is similar to the caseanalysed in Example 2.4.4.

P (x1, y1),∀yP (x1, y),∀x∀yP (x, y) → P (x1, y1)(∀ →)

∀yP (x1, y),∀x∀yP (x, y) → P (x1, y1)(∀ →)

∀x∀yP (x, y) → P (x1, y1)(→ ∀)

∀x∀yP (x, y) → ∀xP (x, y1)(→ ∀)

∀x∀yP (x, y) → ∀y∀xP (x, y)(→ ⊃)

→ ∀x∀yP (x, y)⊃ ∀y∀xP (x, y)Example 2.5.5. Let’s derive sequent: → ∃x∀yP (x, y) ⊃ ∀y∃xP (x, y) incalculus GPR.

P (x1, y1),∀yP (x1, y) → ∃xP (x, y1), P (x1, y1)(→ ∃)

P (x1, y1),∀yP (x1, y) → ∃xP (x, y1)(∀ →)

∀yP (x1, y) → ∃xP (x, y1)(→ ∀)

∀yP (x1, y) → ∀y∃xP (x, y)(∃ →)

∃x∀yP (x, y) → ∀y∃xP (x, y)(→ ⊃)

→ ∃x∀yP (x, y)⊃ ∀y∃xP (x, y)

45

Page 48: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 2.5.6. Now a derivation of a well known tautology of predicatelogic is presented: →

(¬∀xP (x)⊃ ∃x¬P (x)

)∧(∃x¬P (x)⊃ ¬∀xP (x)

).

P (z) → ∃x¬P (x), P (z)(→ ¬)

→ ∃x¬P (x),¬P (z), P (z)(→ ∃)

→ ∃x¬P (x), P (z)(→ ∀)

→ ∃x¬P (x),∀xP (x)(¬ →)

¬∀xP (x) → ∃x¬P (x)(→ ⊃)

→ ¬∀xP (x)⊃ ∃x¬P (x)

P (z),∀xP (x) → P (z)(∀ →)

∀xP (x) → P (z)(¬ →)

∀xP (x),¬P (z) →(∃ →)

∀xP (x), ∃x¬P (x) →(→ ¬)

∃x¬P (x) → ¬∀xP (x)(→ ⊃)

→ ∃x¬P (x)⊃ ¬∀xP (x)(→ ∧)

→(¬∀xP (x)⊃ ∃x¬P (x)

)∧(∃x¬P (x)⊃ ¬∀xP (x)

)One of the most popular predicates in applications of logic is equality. In-

stead of traditional predicate notation, equality predicate is usually denotedas t1 = t2, where t1 and t2 are terms.Definition 2.5.7. Sequent calculus with equality predicate (denoted asGPR=) is obtained from GPR by adding axiom Γ → ∆, t = t and twoadditional rules:

t1 = t2,Γ{t2/t1} → ∆{t2/t1}(=1)

t1 = t2,Γ → ∆t1 = t2,Γ{t1/t2} → ∆{t1/t2}

(=2)t1 = t2,Γ → ∆

Here t, t1 and t2 are terms.An occurrence of term in a formula is called the main one, if it does not

contain any bound occurrence of variable.Definition 2.5.8. A sequent calculus is called minus-normal, if term t inapplications of rules (→ ∃) and (∀ →) is a main term and part of some formulaof the conclusion of the inference. If the conclusion does not have any mainterms, then t is a new constant.

The equivalence of calculi GPR and minus-normal calculus was provedin 1963 by S. Kanger.

It is already mentioned in page 38 that class of predicate formulas withoutfunction symbols 〈∀∞∃∞, σ〉, where σ is any set of predicates, is decidable.Let’s prove that using minus-normal predicate calculus.Theorem 2.5.9. Class of formulas without function symbols with prefix∀∞∃∞ is decidable.

Proof. Suppose F is some formula without function symbols,

F = ∀x1∀x2 . . . ∀xn∃y1∃y2 . . . ∃ymG(x1, x2, . . . , xn, y1, y2, . . . , ym)

Here G(x1, x2, . . . , xn, y1, y2, . . . , ym) does not contain quantifiers. Supposea1, a2, . . . , ak is a full list of individual constants and free variables in F .Let’s show how to decide if sequent → F is derivable.

Let’s apply rule (→ ∀) to formula F n times. The result is sequent→ ∃y1∃y2 . . . ∃ymG(z1, z2, . . . , zn, y1, y2, . . . , ym), where zi, i ∈ [1, n] are dif-ferent free variables, not equal to ai, i ∈ [1, k]. Now the only way is to

46

Page 49: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

apply rule (→ ∃) m times and after that logical rules. Because the calculusis minus-normal, after applying rule (→ ∃) variables yi, i ∈ [1,m] can onlybe replaced by an element of {a1, a2, . . . , ak, z1, z2, . . . , zn}. Thus only finitenumber of applications of (→ ∃) is possible. Moreover, it is obvious that log-ical rules can also be applied only finite number of times. Thus, only finitenumber of derivation search trees may be obtained. If at least one of thetrees is a derivation of → F , then �F , otherwise, 2F .

2.6 Semantic tableaux method

Suppose, sequent F1, F2, . . . , Fn → G1, G2, . . . , Gm is derivable in sequentcalculus for predicate logic GPR and the derivation is D. Then sequentF1, F2, . . . , Fn,¬G1,¬G2, . . . ,¬Gm → is also derivable and the derivationis:

DF1, F2, . . . , Fn → G1, G2, . . . , Gm (¬ →)

F1, F2, . . . , Fn,¬G1 → G2, G3, . . . , Gm (¬ →)F1, F2, . . . , Fn,¬G1,¬G2 → G3, G4, . . . , Gm

· · ·F1, F2, . . . , Fn,¬G1,¬G2, . . . ,¬Gm →

This technique can be used to move all the formulas from succedent to an-tecedent in any sequent. This eliminates the need to maintain two separatelists of formulas, because only the antecedent is left. Thus the separatorsymbol → can also be omitted.

It is obvious, that in a sequent calculus for such sequents the axiom mustbe F,¬F,Γ → 1. Moreover, the rules must be modified. Let’s take GPR asa base calculus. Rules with main formulas in succedent ((→ ¬), (→ ∧),…) canbe removed. Rules in which the main and side formulas are in antecedent((∧ →), (∨ →),…) can be modified slightly to remove the antecedent part. Nowonly two more rules require further modification. Rule (¬ →) can be replacedby several rules, depending on the form of the main formula:

F,Γ →¬¬F,Γ →

¬F,Γ → ¬G,Γ →¬(F ∧G),Γ →

¬F,¬G,Γ →¬(F ∨G),Γ →

F,¬G,Γ →¬(F ⊃G),Γ →

¬F (t),¬∃xF (x),Γ →¬∃xF (x),Γ →

¬F (z),Γ →¬∀xF (x),Γ →

The change to rule (⊃ →) is obvious:

¬F,Γ → G,Γ →(⊃ →)

F ⊃G,Γ →1Although → is not necessary, it is kept for clarity: to stress that all the formulas are in the antecedent of

the sequent.

47

Page 50: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

The soundness and completeness of such calculus can easily be proved byshowing the equivalence to GPR, which follows immediately from the waythe calculus was formed.

Similar idea was used to create tableaux method (or calculus). Afterassessing all the advantages and disadvantages of sequent calculus, thismethod was described in 1972 by American scientist M. Fitting. Later,in 1994, the method was improved by F. Massacci.

A derivation search tree in tableaux calculus is displayed as orientedtop-down tree:

F1F2F3

F4F6

F7 F8F9

F5

Formula F1 is the root, formulas F5, F7 and F9 are leaves. No more thantwo edges exit one node and when only one edge exits the node, the edgeis omitted. The direction of the edge is also omitted, because it is alwaysthe same: top-down. A path from root to some leave is called a branch.

A derivation search tree of formula F is a tree with ¬F as a root. Everyother node is obtained by applying some rule of the calculus. The rules arepresented in the following form:

Here F is a formula, called premise and Γ is a conclusion. The rule can beapplied, if the premiss is already present in the branch, which is analysed.The conclusion may consist of one or two formulas that after the applicationof the rule are included into the derivation search tree. If the two formulasin the conclusion of the rule are separated by | , then the derivation searchtree branches.

It is said that branch is closed, if it contains both some formula F andits negation ¬F . Otherwise it is open. A tree is closed, if every branch isclosed. A closed tree with root ¬F is a derivation tree (or simply derivation)of formula F in tableaux calculus.

Definition 2.6.1. Tableaux calculus for predicate logic (denoted TPR)consists of the following rules:

Conjunction rules:F ∧GFG

¬(F ∨G)¬F¬G

¬(F ⊃G)F¬G

Disjunction rules:¬(F ∧G)¬F | ¬G

F ∨GF | G

F ⊃G¬F | G

48

Page 51: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Double negation rule:¬¬FF

Quantifier rules:∀xF (x)F (t)

¬∀xF (x)¬F (z)

∃xF (x)F (z)

¬∃xF (x)¬F (t)

Here z is a new free variable, which is not part of any formula of thebranch, and t is some main term.

Example 2.6.2. Let’s derive formula ∃x∀yP (x, y) ⊃ ∀y∃xP (x, y) in tab-leaux calculus TPR. Compare this derivation to the derivation in calculusGPR of sequent → ∃x∀yP (x, y)⊃∀y∃xP (x, y) presented in Example 2.5.5.

F1 = ¬(∃x∀yP (x, y)⊃ ∀y∃xP (x, y)

)F2 = ∃x∀yP (x, y)F3 = ¬∀y∃xP (x, y)F4 = ∀yP (x1, y)F5 = ¬∃xP (x, y1)F6 = P (x1, y1)F7 = ¬P (x1, y1)

Here F1 is the root — a negation of the formula, which must be derived.Formulas F2 and F3 are obtained from F1 using conjunction rule. Then onlyquantifier rules are applied. F4 is obtained from F2, F5 from F3, F6 from F4and F7 from F5.

Example 2.6.3. Let’s derive formula ¬(p ∧ q)⊃ (¬p ∨ ¬q).

¬(¬(p ∧ q)⊃ (¬p ∨ ¬q)

)¬(p ∧ q)¬(¬p ∨ ¬q)

¬p¬¬p¬¬qp

¬q¬¬p¬¬qq

For comparison with derivations in sequent calculus several other deriva-tions using tableaux method are provided.

49

Page 52: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 2.6.4. In Example 2.5.6 derivation in calculus GPR of formula(¬∀xP (x)⊃ ∃x¬P (x)

)∧(∃x¬P (x)⊃ ¬∀xP (x)

)is presented. Let’s derive

it in TPR.¬((¬∀xP (x)⊃ ∃x¬P (x)

)∧(∃x¬P (x)⊃ ¬∀xP (x)

))

¬(¬∀xP (x)⊃ ∃x¬P (x)

)¬∀xP (x)¬∃x¬P (x)

)¬P (z)¬¬P (z)P (z)

¬(∃x¬P (x)⊃ ¬∀xP (x)

)∃x¬P (x)¬¬∀xP (x)¬P (z)∀xP (x)P (z)

Example 2.6.5. Finally let’s use tableaux calculus TPR to derive formula(F ⊃ G) ⊃

((F ⊃ H) ⊃

(F ⊃ (G ∧ H)

)), which was derived in sequent

calculus in Example 1.3.19. This derivation demonstrates a derivation treewith more branches.

F1 = ¬(

(F ⊃G)⊃(

(F ⊃H)⊃(F ⊃ (G ∧H)

)))F2 = F ⊃G

F3 = ¬(

(F ⊃H)⊃(F ⊃ (G ∧H)

))F4 = F ⊃H

F5 = ¬(F ⊃ (G ∧H)

)F6 = F

F7 = ¬(G ∧H)

F8 = ¬F F9 = G

F10 = ¬F F11 = H

F12 = ¬G F13 = ¬HThe order in which the rules are applied is not important. In this deriva-

tion conjunction rules are preferred to disjunction rules, because applicationof disjunction rule branches the derivation tree. Thus formulas F2 and F3are obtained from F1, formulas F4 and F5 — from F3 and formulas F6 andF7 — from F5 by applying conjunction rules. However formulas F8 and F9are obtained from F2, formulas F10 and F11 — from F4 and formulas F12and F13 — from F7 using disjunction rules. All the branches are closed:starting from the left, F6 and F8 closes the first branch, formulas F6 andF10 — the second one, the third one is closed by formulas F9 and F12 andthe last one by F11 and F13.

50

Page 53: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

2.7 Compactness

In this section only propositional formulas are analysed. However, the re-sults presented here are needed for the next section.Definition 2.7.1. A set of formulas is finite satisfiable, if every finite subsetof the set is satisfiable. A set of formulas {F1, F2, . . . } is satisfiable if thereexists an interpretation ν such that ν �Fi for every i ∈ [1,∞).

If a set of formulas is not satisfiable, then it is called contradictory. I.e.a set of propositional formulas F is contradictory if for any interpretationν there is a formula F ∈ F such that ν 2F .Definition 2.7.2. A set of formulas F is maximal, if:

• F is finite satisfiable and• for any formula F either F ∈ F or ¬F ∈ F .

Theorem 2.7.3. There is a bijection between the set of interpretations andthe set of maximal sets of formulas.Proof. For every interpretation ν let’s assign a set of propositional formulasFν = {F : ν � F}. I.e. Fν consists of formulas, which are true withinterpretation ν. It is a maximal set, because interpretation ν satisfiesevery formula (and therefore every finite subset) of Fν and for any formulaF either ν � F and therefore F ∈ Fν or ν 2 F , thus ν �¬F and therefore¬F ∈ Fν . It is obvious that for two different interpretations ν1 and ν2 thesets of formulas Fν1 and Fν2 are different. In fact for two interpretations tobe different they must disagree on at least one propositional variable. Letν1(p) 6= ν2(p). Suppose that ν1(p) = > and ν2(p) = ⊥ (the other case isanalogous). Now formula p ∈ Fν1, however p /∈ Fν2 and therefore Fν1 6= Fν2.This proves that the described correspondence (or function f(ν) = Fν) isinjection.

To show that it is also a bijection let’s find the inverse correspondence tothe one, described in the previous paragraph. For every maximal (and thusfinite satisfiable) set of formulas F , let’s assign interpretation νF such thatfor any propositional variable p it would be true that νF(p) = > iff p ∈ F .Now let’s show, that for any formula F , it is true that νF � F iff F ∈ F .Induction on the length of the formula is used.

Suppose l(F ) = 0, then F is a propositional variable. According to theway νF is defined, νF �F iff F ∈ F .

Suppose the assumption (that νF �F iff F ∈ F) holds if l(F ) < m (thisstatement is called induction hypothesis). Let l(F ) = m. Then differentforms of formula F must be analysed. Say F = ¬G. Then, l(G) = m − 1and according to the induction hypothesis νF � G iff G ∈ F . Suppose,F = ¬G ∈ F , then G /∈ F , because F is finite satisfiable and set {G,¬G} isa finite set, which is not satisfiable. From this and the induction hypothesisit follows that νF 2G and therefore νF � F = ¬G. If F = ¬G /∈ F , thenbecause F is a maximal set G ∈ F . Therefore νF �G and νF 2F = ¬G.

51

Page 54: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Suppose F = G ∧H. Then l(G) < m and l(H) < m, thus the inductionhypothesis holds for G and H. Suppose F = G∧H ∈ F , then ¬G /∈ F and¬H /∈ F . This is because F is finite satisfiable and neither set {¬G,G∧H}nor {¬H,G ∧ H} is satisfiable. Now because F is maximal, G ∈ F andH ∈ F . From the induction hypothesis it follows that νF �G and νF �Hand therefore νF �F = G∧H. If G∧H /∈ F , then because F is a maximalset ¬(G ∧ H) ∈ F . Now F is finite satisfiable and set {¬(G ∧ H), G,H}is not, therefore G /∈ F or H /∈ F . Because of that and according to theinduction hypothesis νF 2G or νF 2H and thus νF 2G ∧H.

The cases, when F = G ∨H, F = G⊃H and F = G↔H are analysedsimilarly.

It is not hard to argue that FνF = F and νFν = ν. Thus both definedcorrespondences are bijections.

The following corollary follows directly from the proof of this theorem:Corollary 2.7.4. For every maximal set of formulas F there is an inter-pretation ν such that for every F ∈ F it is true that ν �F .Theorem 2.7.5 (Compactness). A set of formulas is satisfiable iff it isfinite satisfiable.Proof. If a set is satisfiable, then obviously it is finite satisfiable. That is, ifthere is an interpretation ν with which every formula of a set is true, thenevery formula of any finite subset is also true with ν.

Let’s show that every finite satisfiable set T is satisfiable. It shouldbe noted that not every finite satisfiable set of formulas is maximal. E.g.set {p1, p1 ∧ p2, p1 ∧ p2 ∧ p3, . . . } is finite satisfiable, because interpretationν(pi) = >, i ∈ [1,∞) satisfies every subset, however neither formula p1 ∨ p2nor its negation belong to the set, thus it is not maximal.

To prove that any finite satisfiable set T is also satisfiable it is enoughto find a maximal set F such that T ⊂ F . According to Corollary 2.7.4it is possible to construct interpretation νF such that F ∈ F iff νF � F .Therefore with νF every formula of T would be true.

Let’s construct such maximal set step by step. The set of all the proposi-tional formulas is countable. Therefore, it is possible to list all the formulasin some sequence F1, F2, . . . . Each formula occurs in the sequence exactlyonce. Lets construct a sequence of sets in a following way: T0 = T and

Tn+1 ={Tn ∪ {Fn}, if it is finite satisfiableTn ∪ {¬Fn}, otherwise

At least one of the sets Tn∪{Fn} and Tn∪{¬Fn} is finite satisfiable, if Tnis finite satisfiable. Indeed, suppose that neither Tn ∪ {Fn} nor Tn ∪ {¬Fn}is finite satisfiable, despite that Tn is. In this case there are finite setsT ′ ⊂ Tn ∪ {Fn} and T ′′ ⊂ Tn ∪ {¬Fn} such that neither T ′ nor T ′′ issatisfiable. However, any finite subset of Tn is satisfiable, therefore T ′ 6⊂ Tnand T ′′ 6⊂ Tn. From this it follows that Fn ∈ T ′ and ¬Fn ∈ T ′′. LetT ′ = T ′n ∪ {Fn}, T ′′ = T ′′n ∪ {¬Fn}. Then T ′n ⊂ Tn and T ′′n ⊂ Tn. Now

52

Page 55: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

because Tn is finite satisfiable, there is an interpretation ν with which anyformula of finite set T ′n ∪ T ′′n ⊂ Tn is true. More specifically, any formula ofT ′n and T ′′n is true with ν. Finally, either ν �Fn or ν �¬Fn, and thereforeeither T ′ or T ′′ is finite satisfiable. Thus the contradiction is obtained.

Now let F = ⋃∞i=0 Tn. It is true that T ⊂ F , because T = T0. Moreover

from the construction of F it follows that it is a maximal set. Therefore,according to Corollary 2.7.4 there is an interpretation ν with which anyformula of F (and also those of T ) is true. This proves that T is a satisfiableset.

Corollary 2.7.6. If some (infinite) set of formulas is contradictory, thenthere is a finite contradictory subset of the set.

Proof. Indeed say that set of formulas F is contradictory. Then it is notsatisfiable. According to Theorem 2.7.5 a set is finite satisfiable, only ifit is satisfiable. Thus F is not finite satisfiable. Now according to Defi-nition 2.7.5 there is a finite subset of F , which is not satisfiable and thuscontradictory.

2.8 Semantic trees

Now let’s return to predicate logic. In this section predicate formulas withfunction symbols but without free variables are analysed. Moreover, formu-las must be transformed into normal prenex form and skolemized.

Definition 2.8.1. A Herbrand universe H of formula F is defined as follows:

• Every constant of formula F is part of H. If F does not contain anyconstants, then a ∈ H.

• If fn is n-place function symbol in formula F and t1, t2, . . . , tn ∈ H,then f(t1, t2, . . . , tn) ∈ H

It must be noted that according to the definition Herbrand universe ofany formula is never empty. It is finite, if the formula does not containfunction symbols, or infinite but countable.

Definition 2.8.2. A Herbrand base B of formula F is the set of all theatomic formulas P (t1, t2, . . . , tn), where P n is n-place predicate variable ofF and ti, i ∈ [1, n] are some elements of Herbrand universe of F .

Definition 2.8.3. H-interpretation (or Herbrand interpretation) of formulaF is a set {α1P1, α2P2, . . . }, where αi ∈ {¬,∅} and Pi ∈ B, i ∈ [1,∞). Ifαi = ¬, then it is understood that Pi is false with the H-interpretation,otherwise Pi is true.

French logician J. Herbrand in 1930 proved the following theorem:

Theorem 2.8.4. A formula F is satisfiable iff it is satisfiable in Herbranduniverse of F .

53

Page 56: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

This means that to check if formula is satisfiable there is no need to gothrough all the possible interpretations. It is enough to go through all thepossible values of predicates in Herbrand base (H-interpretations). However,Herbrand base is usually infinite, although if the formula does not containfunction variables, it is finite. Recall, that the formula must be skolemized.Thus Herbrand base of the formula is finite if in the normal prenex formquantifier ∃ does not occur in the scope of quantifier ∀ and, obviously, thenormal prenex form also doesn’t contain function symbols.

If formula F is true with some H-interpretation, then the H-interpretationis called the H-model (or Herbrand model) of the formula.

It must be stressed, that Theorem 2.8.4 applies only to skolemized normalprenex form of the formulas. E.g. formula P (a) ∧ ∃x¬P (x) is satisfiable,however it does not have H-model, because it is not skolemized. Indeed,let M = {a, b}, let’s define P in a following way P (a) = > and P (b) = ⊥.With this interpretation formula is satisfiable. However, H = {a} and theonly possible H-interpretations are {P (a)} and {¬P (a)}. In both cases theformula is false, therefore, the formula does not have a H-model.

Therefore formulas of the form ∀x1∀x2 . . . ∀xnG(x1, x2, . . . , xn), whereG(x1, x2, . . . , xn) does not contain any quantifiers, are analysed. Semantictree is used to check if formula is satisfiable (or rather if it is not satis-fiable). According to the theorem it is enough to analyse only predicateswhich are defined in Herbrand base H of the formula. That is, the values ofthe individual variables are from the set H. Thus a set of formulas withoutquantifiers T = {G(t1, t2, . . . , tn) : ti ∈ H, i ∈ [1, n]} can be inspected. Theformula is satisfiable iff set T is satisfiable. According to Corollary 2.7.6 ofthe compactness theorem, T is not satisfiable (is contradictory), iff there isa finite contradictory subset of T . Let’s denote the subset T ′. Such subsetcontains only finite number of atomic formulas.

Let’s present all the H-interpretations of formula F as the tree. For thatpurpose let’s list the members of Herbrand base B of F in some order.Suppose the order is {P1, P2, P3, . . . }, then the semantic tree of F is a treeof the form:

...P3

...¬P3

P2

...P3

...¬P3

¬P2P1

...P3

...¬P3

P2

...P3

...¬P3

¬P2¬P1

F

Every branch is infinite, if B is infinite (if F contains function variables),and every branch corresponds to some H-interpretation. Now let Ti bea set of formulas of T , which contain only atomic formulas Pj, j ∈ [1, i].First, let’s check if T1 is contradictory, then let’s continue with T2, T3, etc….Recall that if formula F is contradictory, then there is a finite contradictorysubset T ′ ⊂ T with only finite number of atomic formulas. Let all theatomic formulas of T ′ be Pi1, Pi2, . . . , Pim such that ij < ij+1, j ∈ [1,m).

54

Page 57: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Thus T ′ ⊆ Tim. However T ′ is contradictory thus any T ′′ ⊇ T ′ is alsocontradictory and obviously, Tim is contradictory.

To sum up, if F is contradictory, then Tim is contradictory and it will beencountered while checking all the sets starting with T1. However, if F issatisfiable, such set will not be found and the process will continue infinitely.

Similar approach is applied in semantic trees. A finite subbranch rep-resenting interpretation {α1P1, α2P2, . . . , αkPk}, αi ∈ {¬,∅}, i ∈ [1, k] ischosen. It is checked if at least one formula of Tk is false with the inter-pretation. If such formula exists (let’s denote it F ′), then the subtree inthe branch above αkPk is removed and replaced by symbol ⊕. Of course,at first interpretations in which k = 1 are checked, followed by the ones inwhich k = 2 etc…. If F is contradictory, then in such way infinite semantictree can be transformed into finite one. At worst every interpretation inwhich k = im must be checked, however usually the process in most of thebranches terminates much quicker. The contradictory subset T ′ consists offormulas obtained analogously to F ′. If however F is satisfiable, then thisprocess continues infinitely.

A semantic tree is analogous to the truth table method in propositionallogic.Example 2.8.5. Let’s start by finding a finite semantic tree of predicateformula ∀x

(P(x, f(a)

)∧ ¬P

(x, x

)).

H = {a, f(a), f(f(a)

), . . . },B = {P

(a, a

), P(a, f(a)

), P(f(a), f(a)

), . . . }

⊕P (a, a)

⊕P(f(a), f(a)

) ⊕¬P

(f(a), f(a)

)P(a, f(a)

) ⊕¬P

(a, f(a)

)¬P (a, a)

∀x(P(x, f(a)

)∧ ¬P

(x, x

))In this case set T is equal to:

{F1 = P(a, f(a)

)∧ ¬P

(a, a

),

F2 = P(f(a), f(a)

)∧ ¬P

(f(a), f(a)

),

F3 = P(f(f(a)

), f(a)

)∧ ¬P

(f(f(a)

), f(f(a)

)), . . . }

Let’s analyse branches from left to right. With interpretation {P (a, a)} for-mula F1 is false. With interpretations {¬P

(a, a

), P(a, f(a)

), P(f(a), f(a)

)}

and {¬P(a, a

), P(a, f(a)

),¬P

(f(a), f(a)

)} formula F2 is false. With inter-

pretation {¬P(a, a

),¬P

(a, f(a)

)} once again formula F1 is false. Thus the

contradictory subset consists of two formulas: F1 and F2.

55

Page 58: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 2.8.6. Now let’s find a finite semantic tree of another formula:∀x(P(x)∧(¬P

(x)∨Q

(f(x)

))∧ ¬Q

(f(a)

)).

H = {a, f(a), f(f(a)

), . . . }, B = {P

(a), Q(a), P(f(a)

), Q(f(a)

), . . . }.

⊕Q(f(a)

) ⊕¬Q(f(a)

)P(f(a)

) ⊕¬P(f(a)

)Q(a)

⊕Q(f(a)

) ⊕¬Q(f(a)

)P(f(a)

) ⊕¬P(f(a)

)¬Q(a)

P (a)⊕¬P (a)

∀x(P(x)∧(¬P(x)∨Q(f(x)

))∧ ¬Q

(f(a)

))Using the knowledge obtained while making the tree, it is possible to

produce simpler semantic tree. For that purpose let’s reorder the elementsof B as follows: {P

(a), Q(f(a)

), . . . }. The simplified tree is:

⊕Q(f(a))

⊕¬Q(f(a))

P (a)⊕¬P (a)

∀x(P(x)∧(¬P

(x)∨Q

(f(x)

))∧ ¬Q

(f(a)

))

Similar simplifications can be applied to the previous example.

2.9 Resolution method

2.9.1 The description of resolution calculus

Once again, in this section only skolemized normal prenex form predicateformulas are analysed. In order to apply resolution method a set of disjunctsmust be obtained. As mentioned in the previous section, all the analysedformulas are of the form ∀x1∀x2 . . . ∀xnG(x1, x2, . . . , xn). This formula isnot satisfiable iff a set T = {G(t1, t2 . . . , tn) : ti ∈ H, i ∈ [1, n]}, where H isHerbrand universe of the formula, is contradictory. From the fact that H iseither finite or countable and there are only finite number (n) of individualvariables in the formula it follows that T is either finite or countable.

Now let’s transform formula G(x1, x2, . . . , xn) into NCF. Suppose thatNCF of G(x1, x2, . . . , xn) is

m∧j=1

Hj(x1, x2, . . . , xn), where Hj, j ∈ [1,m] aredisjuncts. Let’s analyse a set of disjuncts

S = {Hj(t1, t2, . . . , tn) : ti ∈ H, i ∈ [1, n], j ∈ [1,m]}

It is clear that set S is contradictory iff set T is contradictory. Moreover,from formula G(x1, x2, . . . , xn) only finite number of disjuncts can be pro-duced, therefore set S is also either finite or countable. This means that it

56

Page 59: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

is possible to list every element of S in some order. Let S = {H ′1, H ′2, . . . }.Formulas of S contain neither individual variables nor quantifiers, thus it isnot hard to apply propositional resolution rule to such formulas.

The most straight forward way of applying resolution method in thiscase would be to check if set of disjuncts {H ′1, H ′2} is derivable in resolutioncalculus. If it is derivable, then the formula is not satisfiable. Otherwise,set {H ′1, H ′2, H ′3} must be checked. The compactness Theorem 2.7.5 and theresolution method ensures that if the formula is not satisfiable, then thereis some k for which set {H ′1, H ′2, . . . , H ′k} is derivable in resolution calculus.If the formula is satisfiable, then this process is infinite.

However this procedure is not very convenient. In 1965 American lo-gician J.A. Robinson described another way to apply resolution methodto predicate formulas. Analogous method was also described by RussianS.J. Maslov one year earlier and called reverse method. In order to presentthe method several definitions are needed.

Definition 2.9.1. A substitution α is called a unifier of formulas (terms)F1 and F2, if F1α = F2α.

Definition 2.9.2. A unifier α is the most general one for formulas (terms)F1 and F2, if for any unifier β of F1 and F2 there is a substitution γ, suchthat β = α ◦ γ (i.e. β is a composition of α and γ).

Substitution α is a unifier of set {F1, F2, . . . , Fn}, if F1α = F2α = · · · =Fnα. Substitution α is the most general unifier of the set, if it is a unifierof the set and for any unifier of the set β there is a substitution γ such thatβ = α ◦ γ.

Example 2.9.3. A substitution {c/x, d/y, f(d)/z} is a unifier of formulasP(g(y, c), z

)and P

(g(d, x), f(d)

).

Two formulas (terms) F and G are unifiable if there is a unifier of F andG.

Example 2.9.4. Atomic formulas P(x, f

(f(y)

))and P

(f(z), f

(f(g(a)

)))are unifiable. The unifiers are, for example,

{f(a)/x, g(a)/y, a/z

}and{

f(f(a)

)/x, g(a)/y, f(a)/z

}. The most general unifier is

{f(z)/x, g(a)/y

}.

Of course, not all the expressions are unifiable. E.g. formulas F (t1) andF (t2) are not unifiable, if terms t1 and t2 are:

• two different constants,

• a variable x and term t which contains x, t 6= x,

• a constant and function symbol,

• terms starting with different function symbols.

57

Page 60: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Now a rule of resolution for predicate formulas is:

F ∨ l1 l2 ∨G α(F ∨G)α

Here l1 and l2 are literals, one of which is P (t11, t12, . . . , t1n) and anotherone is ¬P (t21, t22, . . . , t2n). Substitution α is a unifier of P (t11, t12, . . . , t1n) andP (t21, t22, . . . , t2n).

In order to derive formula in resolution calculus the following steps mustbe taken:

1. it must be transformed into normal prenex form;

2. it must be skolemized, ∀ quantifiers must be removed;

3. NCF of skolemized formula must be found;

4. a set composed of the disjuncts of the NCF must be created;

5. the set of disjuncts must be derived in resolution calculus using resolu-tion rule for predicate logic.

Other properties of resolution calculus for predicate logic are the sameas the ones of resolution calculus for propositional logic. So let’s continuewith an example.

Example 2.9.5. Using resolution method let’s prove that if some binaryrelation is irreflexive and transitive, then it is asymmetric.

Let’s denote a binary relation between x and y as predicate P (x, y).Irreflexivity is defined as F1 = ∀x¬P (x, x) and transitivity is defined asF2 = ∀x∀y∀z

((P (x, y) ∧ P (y, z)

)⊃ P (x, z)

). Asymmetry is defined as

F3 = ∀x∀y(P (x, y)⊃ ¬P (y, x)

).

The aim is to prove that from F1 and F2 follows F3. This can be doneby showing that set {F1, F2,¬F3} is contradictory.

Let’s transform the set into set of disjuncts. After removing ∀ quantifierfrom F1, a disjunct ¬P (x, x) is obtained. Formula F2 is also skolemized,thus let’s remove all the ∀ quantifiers and transform it into NCF:(

P (x, y) ∧ P (y, z))⊃ P (x, z) = ¬

(P (x, y) ∧ P (y, z)

)∨ P (x, z) =

= ¬P (x, y) ∨ ¬P (y, z) ∨ P (x, z)

Thus formula F2 results in one disjunct: ¬P (x, y) ∨ ¬P (y, z) ∨ P (x, z).Finally with F3 every step of the algorithm must be performed. First itmust be transformed into normal prenex form:

¬∀x∀y(P (x, y)⊃ ¬P (y, x)

)= ∃x∃y¬

(P (x, y)⊃ ¬P (y, x)

)=

= ∃x∃y¬(¬P (x, y) ∨ ¬P (y, x)

)= ∃x∃y

(P (x, y) ∧ P (y, x)

)58

Page 61: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

After skolemization formula P (a, b)∧P (b, a) is obtained and this resultsin two disjuncts P (a, b) and P (b, a).

Therefore, S = {¬P (x, x),¬P (x, y)∨¬P (y, z)∨P (x, z), P (a, b), P (b, a)}.Now the following derivation can be obtained:

¬P (x, x)P (b, a)

P (a, b) ¬P (x, y) ∨ ¬P (y, z) ∨ P (x, z) {a/x, b/y}¬P (b, z) ∨ P (a, z) {a/z}P (a, a) {a/x}

�Sometimes it is not clear how to start or proceed the derivation search in

resolution calculus. To help with this task, it is possible to add additionalrequirements to the premisses or conclusion of application of resolution rule.Such requirements are called tactics. They usually allow to lessen the num-ber of possible applications of the rule. It is said that tactics is complete, ifempty disjunct is derivable iff it is derivable using the tactics.

Let’s describe several complete tactics.

2.9.2 Linear tactics

Suppose formula F is derivable from set S and T1, T2, . . . Tn is a sequenceof applications of resolution rule in the derivation. If a conclusion of Tn isF and for every i ∈ [2, n] one of the premisses of Ti is a conclusion of Ti−1,then it is said that the derivation follows the linear tactics.Example 2.9.6. Let’s transform the following derivation into the one thatfollows the linear tactics:

DF3 ∨ p

F1 ∨ ¬p ∨ q F2 ∨ ¬qF1 ∨ F2 ∨ ¬p

F1 ∨ F2 ∨ F3

Here D denotes a derivation of F3 ∨ p, which follows linear tactics.The solution is as follows:

DF3 ∨ p F1 ∨ ¬p ∨ q

F1 ∨ F3 ∨ q F2 ∨ ¬qF1 ∨ F2 ∨ F3

Example 2.9.7. Let’s derive the set used in Example 1.3.25 in resolutioncalculus by following the linear tactics:

F¬F ∨H

¬F ∨G ¬G ∨ ¬H¬F ∨ ¬H

¬F�

Notice, that a derivation presented in Example 2.9.5 follows the lineartactics.

59

Page 62: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

2.9.3 Tactics of semantic resolution

Suppose, S is a set of disjuncts and I is some interpretation, which dividesS into two subsets S+ and S−. Here S+ consists of formulas from S thatare true with interpretation I and S− consists of formulas from S that arefalse with interpretation I.

According to the tactics, premisses of the application of resolution rulemust be part of different subsets. After the application, the conclusion isalso assigned to S+ or S− depending on if it is true with I or not.

Example 2.9.8. Let S = {p∨ q∨¬r,¬p∨ q,¬q∨¬r, r} and interpretationI defined as follows: I(p) = >, I(q) = > and I(r) = ⊥.

In this case S+ = {p ∨ q ∨ ¬r,¬p ∨ q,¬q ∨ ¬r} and S− = {r}.The derivation is as follows:

p ∨ q ∨ ¬r rp ∨ q

¬q ∨ ¬r r¬q

p¬p ∨ q

¬q ∨ ¬r r¬q

¬p�

It should be noted that the conclusions are included into subsets as soonas they are obtained. At the end S+ = {p∨ q ∨¬r,¬p∨ q,¬q ∨¬r, p∨ q, p}and S− = {r,¬q,¬p}.

Example 2.9.9. Let’s find the derivation of

S = {p1 ∨ p2, p1 ∨ ¬p2,¬p1 ∨ p2,¬p1 ∨ ¬p2}

using semantic resolution tactics, when the interpretation I is I(p1) = >,I(p2) = ⊥.

Based on the given information S+ = {p1 ∨ p2, p1 ∨ ¬p2,¬p1 ∨ ¬p2} andS− = {¬p1 ∨ p2}. Thus the derivation would be as follows:

p1 ∨ ¬p2p1 ∨ p2 ¬p1 ∨ p2

p2p1

¬p1 ∨ ¬p2 ¬p1 ∨ p2¬p1

The subsets are:

S+ = {p1 ∨ p2, p1 ∨ ¬p2,¬p1 ∨ ¬p2, p1},S− = {¬p1 ∨ p2, p2,¬p1}

Example 2.9.10. Let’s derive the set used in Example 1.3.25 by followingthe semantic resolution tactics. Let I(F ) = I(G) = I(H) = >. ThenS+ = {¬F ∨G,¬F ∨H,F} and S− = {¬G ∨ ¬H}. In that case derivationpresented in Example 2.9.7 follows the semantic resolution tactics. Afterthe derivation only S− is changed. It is equal to {¬G∨¬H,¬F ∨¬H,¬F}.

Example 2.9.11. Let’s derive the set used in Example 2.9.5 by followingthe semantic resolution tactics. In this case Herbrand universe H = {a, b}and Herbrand base B = {P (a, a), P (a, b), P (b, a), P (b, b)}. Now let’s analyse

60

Page 63: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

the most primitive H-interpretation {P (a, a), P (a, b), P (b, a), P (b, b)}. Itdivides the set S into the following parts:

S+ = {¬P (x, y) ∨ ¬P (y, z) ∨ P (x, z), P (a, b), P (b, a)},S− = {¬P (x, x)}

The derivation is:

P (b, a)P (a, b)

¬P (x, y) ∨ ¬P (y, z) ∨ P (x, z) ¬P (x, x) {x/z}¬P (x, y) ∨ ¬P (y, x) {a/x, b/y}¬P (b, a) {}�

2.9.4 Absorption tactics

It is said that disjunct F1 = l ∨ G is absorbed by another disjunct F2, ifF2 = ¬l ∨ G ∨ G′. Here l is a literal, ¬¬l = l, G and G

′ are disjuncts andG′ may be empty.According to absorption tactics, a resolution rule can be applied only if

one of the disjuncts absorbs the other one. More precisely, the rule can beapplied to F1 and F2 with unifier α is either F1α absorbs or is absorbed byF2α.Example 2.9.12. Suppose, it is possible to transform any derivation treeto the one which follows the absorption tactics, if there are no more than napplications of resolution rule (induction hypothesis). A derivation tree ofF ∨G with n+ 1 application of resolution rule is as follows:

D1F ∨ p ∨ q

D2F ∨ p ∨ ¬q

F ∨ pD3

G ∨ ¬p (∗)F ∨G

The (∗) denotes an application of resolution rule which doesn’t follow theabsorption tactics. Let’s prove, that it is possible to derive disjunct F ∨Gin resolution method using absorption tactics.

Let’s analyse the two derivations:D3

G ∨ ¬pD1

F ∨ p ∨ qF ∨G ∨ q

andD3

G ∨ ¬pD2

F ∨ p ∨ ¬qF ∨G ∨ ¬q

Both of them have no more than n applications of resolution rule. Therefore,according to the induction hypothesis, it is possible to derive both disjunctsF ∨ G ∨ q and F ∨ G ∨ ¬q using absorption tactics. Let’s denote theresulting derivations D′1 and D′2. Then the derivation of F ∨G that followsthe absorption tactics is as follows:

D′1F ∨G ∨ q

D′2F ∨G ∨ ¬q

F ∨G

61

Page 64: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Notice that the derivation provided in Example 1.3.25 follows the ab-sorption tactics as well as both derivations presented in Examples 2.9.5 and2.9.11.

2.10 Intuitionistic logic

A lot of theorems of mathematics prove the existence of some object withsome properties. E.g. Gentzen Hauptsatz Theorem 2.5.2 proves that forevery predicate sequent which is derivable in GPRo there is a derivationwithout applications of the cut rule. There are two ways to prove suchtheorem. One is simply to give an example of such object or in a case ofGentzen Hauptsatz describe a way to derive every derivable sequent with-out using the cut rule. Another method is to prove the existence withoutdescribing the existing object. The first type of proof is called constructiveand the second one non-constructive.

The proof of Gentzen Hauptsatz provided in [5] is in fact constructive.It describes how the applications of the cut rule can be eliminated fromderivations of GPRo. However it is not always possible to find a construc-tive proof. In mathematics constructivity is usually lost when using thecontradiction technique. Suppose, that the aim is to prove F . If proof bycontradiction is performed, then hypothesis that ¬F holds is made and thenit is showed, that the hypothesis is wrong and thus ¬¬F is true. Thereforethe conclusion is made that F is also true. However, in intuitionistic logicformulas F and ¬¬F have different meanings.

For a comparison of constructive and non-constructive proofs let’s analysethe to ways to prove the following theorem

Theorem 2.10.1 (Non-constructive proof). There are two irrational num-bers a and b such that ab is a rational number.

Proof. Suppose that√

2√

2 is a rational number. Then if a = b =√

2 weobtain that a and b are irrational, but ab is rational. Otherwise, if

√2√

2/∈ Q,

let’s take a =√

2√

2 and b =√

2. Then

ab =(√

2√

2)√2

=√

2√

2×√

2 =√

22 = 2

Therefore ab ∈ Q.

The theorem is proved, however it is not clear what is the value of a(number b =

√2 in both analysed cases). However, it is possible to give a

constructive proof of this theorem.

Theorem 2.10.2 (Constructive proof). There are two irrational numbersa and b such that ab is a rational number.

62

Page 65: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Proof. Let a =√

2 and b = log2 9. It is obvious that a /∈ Q and b > 0.Now if b ∈ Q, then there are numbers m,n ∈ N\{0} such that log2 9 = m

n .According to the definition of logarithm 2m

n = 9 and thus 2m = 9n. However2m is always even and 9n is always odd for any m,n ∈ N\{0}. Thus b /∈ Q.Now

ab =√

2log2 9 = 212 log2 9 = 2log2 9

12 = 2log2

√9 = 2log2 3 = 3

Obviously 3 ∈ Q and thus ab ∈ Q.From the last proof it is obvious that two irrational numbers are

√2 and

log2 9. However, as mentioned earlier, it is not always possible to provide aconstructive proof. In some cases it is even impossible. The following twotheorems shows such example.Theorem 2.10.3 (Bolzano–Weierstrass). In every bounded sequence thereis a convergent subsequence.

Theorem 2.10.4. There is no algorithm, which describes how to find aconvergent subsequence in any bounded sequence.

In order to have another constructive mathematics, i.e. the one, in whichby proving the existence of some objects it would be possible to find thoseobjects using the proof, another logic is needed. It is called intuitionisticand was created in 1930 by Dutch logician A. Heyting.

Hilbert-type intuitionistic calculus for intuitionistic logics is the same asHPR with one difference:Definition 2.10.5. Hilbert-type calculus for intuitionistic logic (denotedHIN) is obtained from calculus HPR by replacing axiom 4.3 (¬¬A⊃A) by¬A⊃ (A⊃B).

Intuitionistic sequent calculus differs from the predicate one in one aspect:in intuitionistic calculus the succedent of the sequent can have at most oneformula.Definition 2.10.6. Gentzen-type calculus for intuitionistic logic (denotedGIN) is composed of axiom F → F , structural rules:

Weakening:

Γ → ∆ (w →)F,Γ → ∆

Γ → (→ w)Γ → F

Contraction:F, F,Γ → ∆

(c→)F,Γ → ∆

Exchange:

Γ1, G, F,Γ2 → ∆(e→)Γ1, F,G,Γ2 → ∆

63

Page 66: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Logical rules:

Negation:

Γ → F (¬ →)¬F,Γ → ∆

F,Γ →(→ ¬)Γ → ¬F

Conjunction:

F,G,Γ → ∆(∧ →)

F ∧G,Γ → ∆Γ → F Γ → G (→ ∧)Γ → F ∧G

Disjunction:

F,Γ → ∆ G,Γ → ∆(∨ →)

F ∨G,Γ → ∆

Γ → F (→ ∨)1Γ → F ∨GΓ → G (→ ∨)2Γ → F ∨G

Implication:

Γ → F G,Γ → ∆(⊃ →)

F ⊃G,Γ → ∆F,Γ → G

(→ ⊃)Γ → F ⊃G

Quantifier rules:

Existence:

F (z),Γ → ∆(∃ →)

∃xF (x),Γ → ∆Γ → F (t)

(→ ∃)Γ → ∆,∃xF (x)

Universality:

F (t),∀xF (x),Γ → ∆(∀ →)

∀xF (x),Γ → ∆Γ → F (z)

(→ ∀)Γ → ∀xF (x)

Variable z and term t must satisfy the same requirements as in the caseof GPRo.

And the cut rule:

Γ1 → F F,Γ2 → ∆(cut F )Γ1,Γ2 → ∆

Note that set ∆ in this calculus represents one formula or an emptyset. Succedent is not necessary, however it must contain no more than oneformula.

It is possible to prove that every formula which is derivable in GIN isalso derivable without cut. However structural rules cannot be eliminated.Let’s demonstrate this with an example.

64

Page 67: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 2.10.7. Contraction rule is necessary for calculus GIN. Formula¬¬(p ∨ ¬p) is derivable:

p → p(→ ∨)1p → p ∨ ¬p(¬ →)

¬(p ∨ ¬p), p →(e→)

p,¬(p ∨ ¬p) →(→ ¬)

¬(p ∨ ¬p) → ¬p(→ ∨)2¬(p ∨ ¬p) → p ∨ ¬p(¬ →)

¬(p ∨ ¬p),¬(p ∨ ¬p) →(c→)

¬(p ∨ ¬p) →(→ ¬)

→ ¬¬(p ∨ ¬p)However there are no ways to derive it without cut and contraction rules.

The only possible derivation search tree is as follows:

→ p orp →

(→ ¬)→ ¬p(→ ∨)1 or (→ ∨)2→ p ∨ ¬p

(¬ →)¬(p ∨ ¬p) →

(→ ¬)→ ¬¬(p ∨ ¬p)

It is easy to derive sequent → p∨¬p in GPR, however it is not derivablein GIN (if → p and → ¬p are not derivable), because in the succedent ofthe premise of application of (→ ∨) rule only one of the formulas p and ¬pcan occur (similar situation is demonstrated in Example 2.10.7). However,every sequent that is derivable in GIN is also derivable in GPR.

Let’s analyse more examples.

Example 2.10.8. Derivations of sequents → ¬(p∧¬p) and → ¬¬¬p⊃¬pare as follows:

p → p(¬ →)¬p, p →

(e→)p,¬p →(∧ →)

p ∧ ¬p →(→ ¬)

→ ¬(p ∧ ¬p)

p → p(¬ →)¬p, p →

(→ ¬)p → ¬¬p(¬ →)¬¬¬p, p →

(e→)p,¬¬¬p →(→ ¬)¬¬¬p → ¬p

(→ ⊃)→ ¬¬¬p⊃ ¬p

Formula ¬¬p ⊃ p is not derivable in intuitionistic calculus (recall thataxiom 4.3 is changed in HIN), however formula p⊃ ¬¬p is derivable.

Example 2.10.9. Let’s derive sequent → p⊃ (¬p⊃ q) in GIN:

p → p(¬ →)¬p, p → q

(→ ⊃)p → ¬p⊃ q

(→ ⊃)→ p⊃ (¬p⊃ q)

65

Page 68: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 2.10.10. Let’s derive sequent → (p⊃ q)⊃ (¬q ⊃ ¬p) in GIN:

p → p(w →)¬q, p → p(e→)p,¬q → p

q → q(w →)p, q → q(e→)q, p → q(¬ →)¬q, q, p →

(e→)q,¬q, p →(e→)q, p,¬q →(⊃ →)

p⊃ q, p,¬q →(e→)

p, p⊃ q,¬q →(e→)

p,¬q, p⊃ q →(→ ¬)¬q, p⊃ q → ¬p

(→ ⊃)p⊃ q → ¬q ⊃ ¬p

(→ ⊃)→ (p⊃ q)⊃ (¬q ⊃ ¬p)

2.11 Relational algebra

Let’s generalise the definition of a relation.

Definition 2.11.1. A relation between sets A1,A2, . . . ,An is any subset ofCartesian product A1 ×A2 × · · · × An. A relation is finite if the subset isfinite.

The most straight forward way to define a relation is to enumerate allthe elements of the subset. The same approach could be used to definethe constants with which some predicate is true (see Example 2.1.4). Thusrelations can also be presented as predicates. Another way to define arelation is to provide a table of the elements. This approach is the mostcommon in relational algebra.

Although in the interpretation of predicate formula there is only one setM and the domain of all the variables of n-place predicate is the same, inan element of a relation each part usually describes a different property ofthe element and therefore is called an attribute. Each attribute of a relationcan have a different domain.

Example 2.11.2. Let the relation Student describe the students of someuniversity. Let’s define it in set N × E × N, where N is the set of namesand E is the set of e-mails. A relation has three attributes: a name ofthe student, an e-mail and a year the student is in. The relation canbe defined by enumerating all the elements: {(Tom, [email protected], 1),(Helen, [email protected], 2), (Peter, [email protected], 2)} or by provid-ing a table:

Student:Name E-mail Year of studyTom [email protected] 1Helen [email protected] 2Peter [email protected] 2

Predicate Student(x, y, z) is true if (x, y, z) is an element of the relation.

66

Page 69: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

A relational algebra is presented as finite number of such finite relationsand operators, which are used to produce new relations from the existingones. The main operators of relational algebra are: projection, select, union,subtraction, Cartesian product, intersection, join:

1. Projection. Suppose P is a relation with attributes A1,A2, . . . ,An.Then a projection π{Ai1 ,Ai2 ,...,Aim}(P ), where 1 6 i1 < i2 < · · · <im 6 n, is a relation with attributes Ai1,Ai2, . . . ,Aim and elements(a1, a2, . . . , am) such that (x1, x2, . . . , xn) ∈ P , where xij = aj for everyj ∈ [1,m] and other xk are some constants.

In other words, a projection of P is a relation obtained by deletingcolumns that do not represent attributes from {Ai1,Ai2, . . . ,Aim}. Du-plicate rows are removed from the table.

P :

A B Ca a ca b bb c ac d b

πA,B(P ) :

A Ba aa bb cc d

2. Select (denoted σ). Let P be a relation with attributes A1,A2, . . . ,An.Then σF (P ) is a relation with attributes A1,A2, . . . ,An and elementsof P that satisfy formula F . Here F is a formula that consists of termsconnected by logical operators ∧, ∨ or ¬. A term in this context isof the form AiθAj or Aiθa, where Ai and Aj, i, j ∈ [1, n] are someattributes, a is some constant and θ ∈ {=, 6=, >,<,6,>}.

In other words, σF (P ) is obtained from P by deleting the rows, whichdo not satisfy the formula.

Let F =((A = a) ∨ (A = c)

)∧ ¬(B = b).

P :

A B Ca a ca b bb c ac d b

σF (P ) :A B Ca a cc d b

3. Union. Let P and Q be relations with attributes A1,A2, . . . ,An. Thena union of P and Q (denoted P ∪ Q) is a relation with attributesA1,A2, . . . ,An and elements {e : e ∈ P or e ∈ Q}.

67

Page 70: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

A union is obtained by supplementing a table of one relation with therows of the table of the other one. Once again, duplicate rows areremoved.

P :

A B Ca a ca b bb c ac d b

Q:

A B Cd d da a ca b bd c a

P ∪Q :

A B Ca a ca b bb c ac d bd d dd c a

4. Subtraction (denoted −). Let P and Q be relations with attributesA1,A2, . . . ,An. Then P−Q is a relation with attributesA1,A2, . . . ,Anand elements {e : e ∈ P and e /∈ Q}.In other words P − Q is obtained from P by removing rows that apresent in Q.

P :

A B Ca a ca b bb c ac d b

Q:

A B Ca b ba a ca b bd c a

P −Q :A B Ca a cb c ac d b

5. Cartesian product. Let P be a relation with attributes A1,A2, . . . ,AnandQ be a relation with attributes B1,B2, . . . ,Bm. A Cartesian productP × Q is a relation with attributes A1,A2, . . . ,An,B1,B2, . . . ,Bm andelements:

{(a1, a2, . . . , an, b1, b2, . . . , bm) : (a1, a2, . . . , an) ∈ P, (b1, b2, . . . , bm) ∈ Q}

In other words a table of Cartesian product composes of every possiblecombination of rows from tables of relation P and Q.

P :A Ba aa b

Q:C D Ed d da a c

P ×Q :

A B C D Ea a d d da b d d da a a a ca b a a c

6. Intersection. Let P and Q be relations with attributes A1,A2, . . . ,An.An intersection of P and Q (denoted P∩Q) is a relation with attributesA1,A2, . . . ,An and elements {e : e ∈ P and e ∈ Q}.

68

Page 71: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

An intersection contains rows that are present in both tables.

P :

A B Ca a ca b bb c ac d b

Q:

A B Cd d da a ca b bd c a

P ∩Q :A B Ca a ca b b

7. Join. Let P and Q be relations. Then a join is a select of Cartesianproduct of the two. In other words, a join P ./F Q = σF (P × Q).Assume F = (B < D) ∧ ¬(A = 1).

P :A B C3 2 41 2 33 6 7

Q:D E3 25 7

P ./F Q:A B C D E3 2 4 3 23 2 4 5 7

Relational algebra is used in relational databases. The described oper-ations are used to define a query. However, queries are usually presentedusing SQL language. On the other hand, expressions of relational algebraor even formulas of predicate logic can also be used instead. Suppose P andQ are some relations with attributes A, B and C. An examples of a querycould be ∃xP (x, x, x) or ∃z

(P (x, y, z) ∧Q(z, y, x)

). If a query formula has

no free variables (the former one), then the result of the query is either trueor false. Otherwise, if query is defined using formula F (x1, x2, . . . , xn) withfree variables x1, x2, . . . , xn, then the result of the query is set of multiples(a1, a2, . . . , an) such that F (a1, a2, . . . , an) is true.

Example 2.11.3. Suppose P is a relation with attributes A, B and Cdefined as follows:

A B Ca α 3b β 2c α 4a β 5

Let’s define the same query using three different notations:

1. SQL: SELECT A FROM P WHERE C>3,

2. Expression of relational algebra: πA(σC>3(P )

),

3. Formula of predicate logic: ∃y∃z(P (x, y, z) ∧ (z > 3)

).

69

Page 72: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

The result of a query presented as predicate formula in some cases candepend on the domains of the attributes of the relations. Let P be a relationwith attributes A and B defined with a table:

A Ba aa bb a

Let’s analyse the result of query ¬P (x, y). It composes of all the pairs thatare not part of the table. If the domain of both attributes is {a, b}, thenthe result of the query is composed of one element: {(b, b)}. If however adomain is {a, b, c}, then the result is {(a, c), (b, b), (b, c), (c, a), (c, b), (c, c)}.However, negation doesn’t always result in such situation. E.g. a resultof query P (x, y) ∧ ¬P (x, x) doesn’t depend on the domain and is always{(b, a)}.

There are many various requirements for a query, that ensure that itdoes not depend on the domain of the attributes of the relations. In 1972E.F. Codd proved that if the query does not depend on the domain, thenit is possible to present it as an expression of relational algebra.

70

Page 73: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Chapter 3

Deductive databases

3.1 Datalog

Deductive databases were created in a search of new ways to present data.Deductive databases consist of datasets together with rules which are usedto obtain new data from the existing ones. The start of deductive databasesis associated with C.C. Green and B. Raphael article The use of theorem-proving techniques in question-answering systems, presented in 1968.

In a conference in Toulouse (France) several papers were presented, whichare fundamental in the field of deductive databases:

• R. Reiter article about the concept of a closed world;• K.L. Clark article about the negation as a failure;• J.M. Nicolas and K. Yazdanian article about checking he integrity con-

ditions.In this section one deductive database system, called Datalog (data +

logic), is analysed. In databases of Datalog data sets consist of atomicpredicate formulas and the rules are presented using predicate formulas ofcertain form. It is also assumed that at least some of the formulas containsome individual constant. Predicate formulas used in Datalog do not containfunction variables. Thus a term in this context is individual variable orindividual constant. Herbrand universe consists of all the constants of thedeductive database.

Data and logic of deductive database can be presented as disjuncts ofpredicate logic. In this section let’s analyse a special form of a disjunct,called normal disjunct: (l1 ∧ l2 ∧ . . . ∧ ln)⊃ F . Here li, i ∈ [1, n] are literalsand F is some atomic formula. In Datalog syntax such formula is presentedas expression F :− l1, l2, . . . , ln. An atomic formula F is called a headand formula l1, l2, . . . , ln is called a body. If all the literals of the body areatomic formulas, then the formula is called Horn disjunct. If the body ofthe formula is empty (i.e. n = 0), then it is called a fact. In that case,symbol :− is omitted and simply F is written instead. Formulas without ahead are also analysed. Such formulas are called restrictions. If, however,a formula contains both a head and a body, then it is called a rule.

71

Page 74: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Here only facts that do not contain individual variables are analysed.All the variables in the rules are assumed to be bounded by quantifier ∀.The quantifiers are omitted in Datalog syntax. Any set of facts, rules andrestrictions is called a deductive database. If every rule of the database isHorn disjunct, then the database is called Horn deductive database.

Implication in the rule (l1 ∧ l2 ∧ . . . ∧ ln)⊃ F of a database has differentmeaning than in the propositional (or predicate) logic. It is said that Fis derivable (true) only if all the li, i ∈ [1, n] are derivable. More precisely,let x1, x2, . . . , xm be all the individual variables of a rule. Then for somesubstitution α = {y1/x1, y2/x2, . . . , ym/xm} formula Fα is derivable, if everyliα, i ∈ [1, n] is derivable. A fact is always derivable.

A query of such database is a conjunction of literals l1∧ l2∧ . . .∧ ln, wheren > 0. A query in Datalog is presented in a following way: ?−l1∧l2∧. . .∧ln.If n = 0, then it is said that query is empty. Suppose x1, x2, . . . , xm is a setof all the variables that occur in query l1 ∧ l2 ∧ . . . ∧ ln. Let’s denote thequery P (x1, x2, . . . , xm). Then the result of the query is a set of multiples(t1, t2, . . . tm) such that P (t1, t2, . . . tm) is derivable from the database. If aset of variables of query is empty, then the result is simply true if the queryis derivable and false otherwise.Example 3.1.1. A deductive database can be defined as follows.

Facts:Father(John,Eve) Mother(Christine,Eve)Father(Peter,Monica) Mother(Eve,Amy)

Rules:Relative(x, y) :− Father(x, y)Relative(x, y) :− Mother(x, y)Relative(x, z) :− Mother(x, y) ∧ Relative(y, z)Relative(x, z) :− Father(x, y) ∧ Relative(y, z)

Restrictions::− Father(x, x):− Mother(x, x):− Father(x, y) ∧Mother(x, z)

Herbrand universe is {John,Eve,Christine,Peter,Monica, Amy}. Her-brand model is:

Father(John,Eve) Mother(Christine,Eve)Father(Peter,Monica) Mother(Eve,Amy)Relative(John,Eve) Relative(Christine,Eve)Relative(Peter,Monica) Relative(Eve,Amy)Relative(Christine,Amy) Relative(John,Amy)

A set of facts can also be presented as tables:

FatherJohn EvePeter Monica

MotherChristine Eve

Eve Amy

72

Page 75: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

There are three types of predicates in a database of Datalog:

1. Extensional. They are defined using only facts. The set of extensionalpredicates is called extensional database (denoted EDB).

2. Intentional. They are defined by rules. Every predicate, which occursin a head of at least one rule is intentional. The set of intentionalpredicates is called intentional database (denoted IDB). IDB is alsocalled a Datalog program.

3. Equality predicate = and other predicates already included in databasesyntax.

Using equality predicate in syntax of Datalog causes problems in deriva-tion search algorithm. However it can be included into the IDB. Suppose,P (x, y) is part of the Datalog program, then equality predicate (let’s call itE(x, y)) with respect to predicate P (x, y) can be defined using additionalrules:

E(y, x) :−E(x, y)E(x, z) :−E(x, y) ∧ E(y, z)E(x, x) :−P (x, y)E(y, y) :−P (x, y)P (z, y) :−P (x, y), E(x, z)P (x, z) :−P (x, y), E(y, z)

To avoid usage of predicate =, which is built in the syntax of Datalog,equality predicate E(x, y) must be defined with respect to every predicateof the program.

Let’s first analyse base Datalog (it is also called standard Datalog orsimply Datalog). Databases of Datalog satisfy these conditions:

• All the variables that are part of the head of some rule, are also partof the body of the rule;

• All the rules are Horn disjuncts, i.e. all the literals of the body of therule are atomic formulas.

Suppose, P is a Datalog program and I is a set of some main intentionalatomic formulas. Operator TP is defined as follows: TP(I) is a set of atomicformulas F such that there is a rule F ′ ← G1, G2, . . . , Gn in P and substi-tution α such that F ′α = F and for every i ∈ [1, n] formula Giα ∈ I. If Fis a fact, then F ∈ TP(I). If TP(I) = I, then set I is called a fixed point ofoperator TP .

Let MP be a set of all the main atomic formulas, that are derivable inprogram P .

Some properties of operator TP :

• it is monotonic, i.e. if I1 ⊆ I2, then TP(I1) ⊆ TP(I2);

• there always is a smallest fixed point of TP , which is a subset of everyfixed point;

73

Page 76: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• MP is a smallest fixed point of TP ;

From the properties of TP it follows that the result of the query can befound by first finding TP(∅), then TP

(TP(∅)

)etc…. Finally a set MP will

be obtained. Such procedure is called naive or primitive search.

Example 3.1.2. Consider deductive database presented in Example 3.1.1.In that case:

TP(∅) = {Father(John,Eve),Mother(Christine,Eve),

Father(Peter,Monica),Mother(Eve,Amy)}

TP(TP(∅)

)= TP(∅) ∪ {Relative(John,Eve),Relative(Christine,Eve),

Relative(Peter,Monica),Relative(Eve,Amy)}

TP(TP(TP(∅)

))= TP

(TP(∅)

)∪ {Relative(Christine,Amy),

Relative(John,Amy)}

Set TP(TP(TP(∅)

))is a smallest fixed point of operator TP and also a

Herbrand model.

A program is recursive if there is at least one rule, which contains at leastone occurrence of an intentional predicate in its body. A program is calledlinear, if in the body of every rule there is no more than one occurrence ofintentional predicate.

Example 3.1.3. Let the IDB be:

P (x, y) :− Q(x), R(x, y), R(y, x)P (x, x) :− Q(x), S(x, x)T (x) :− R(x, x), P (x, y), S(y, x)

Predicates P and T are intentional, predicates Q, R and S are exten-sional. Datalog program is recursive and linear.

Predicates of EDB are also called program input predicates and someof the predicates of IDB (usually not all of them are chosen) — outputpredicates.

A derivation of some main atomic formula F from deductive databaseaccording to program P can be presented as a tree. It is said that programP is bounded, if there is a natural number k such that the height of everyderivation tree of any formula is no more than k. Number k is called (Data-log) program upper bound. It is said that boundedness problem of programP is decidable if it is possible to calculate the upper bound of the program.However in 1987 H. Gaifman, H. Mairson, Y. Sagiv and M.Y. Vardi provedthat in general boundedness problem is undecidable.

74

Page 77: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

3.2 Programs with negation operator

In standard Datalog if formula F is not derivable from database, then it isassumed that ¬F is derivable.Example 3.2.1. Suppose the database describes the flight schedule. TheEDB is:

Flight(Vilnius,Prague)Flight(Vilnius,Oslo)Flight(Vilnius,Tallinn)Flight(Vilnius,Helsinki)

The IDB is empty and query is ?− Flight(Vilnius,Beijing). Because pred-icate Flight(Vilnius,Beijing) is not derivable, it is assumed that formula¬Flight(Vilnius,Beijing) is true.

Such interpretation of negation is called closed world semantics. It isassumed that ¬F is true if it is not clear (not derivable, impossible toprove) that F is true.

If sets {l1, . . . , li−1, F, li+1, . . . , ln} and {l1, . . . , li−1,¬F, li+1, . . . , ln} areHerbrand models of one database, then it is said that they are indepen-dent from atomic formula F and instead of two models, only one is used:{l1, . . . , li−1, li+1, . . . , ln}. Let’s analyse only Herbrand models, in which neg-ative atomic formulas are omitted and there are no atomic formulas fromwhich they are independent. Suppose that I1, I2, . . . , Im are Herbrand mod-els. Model Ij is called minimal if it is a subset of every model, i.e. Ij ⊆ Ikfor every k ∈ [1,m].

If rules that are not Horn disjuncts are analysed, then it is possible tohave several minimal models for one database.Example 3.2.2. Suppose database is:

P (a)Q(x) :− P (x),¬R(x)R(x) :− P (x),¬Q(x)

This database has two models: {P (a), Q(a)} and {P (a), R(a)}. There-fore, it is impossible to find a single minimal model.

To avoid such situations, usually only the databases in which intentionalpredicates are divided into different levels are analysed. M.N. Emden andR.A. Kowalski proved that if standard Datalog is analysed (i.e. the IDBconsists of Horn disjuncts only), then it always has a single minimal model.

Let’s expand the database concept to allow rules with literals (not onlyatomic formulas) as their heads. In such case semantically all the atomicformulas can be divided into three sets: true (atomic formulas are derivable),false (negations of atomic formulas are derivable) and undefined (neitherformulas nor their negations are derivable) formulas. Such concept is calledopen world semantics: it is assumed that everything that is not derivable isunknown.

75

Page 78: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Definition 3.2.3. It is said that a rule of Datalog deductive database issafe, if every variable in the head of the rule is part of at least one positiveatomic formula in the body of the rule.

Example 3.2.4. The rule P (a, x) ← Q(b, a), R(a, c) is not safe, becausex is not part of the body of the rule. It is not clear with which constantsinstead of x atomic formula P (a, x) is derivable. E.g. can the value of x bechosen outside of Herbrand universe?

To avoid such confusion usually only databases with safe rules are anal-ysed.

3.3 Datalog and relational algebra

The data of relational algebra usually defined in SQL can also be definedusing Datalog.

Example 3.3.1. Predicate master_students(name, surname) definition inSQL:

CREATE VIEW master_students ASSELECT name,surname FROM studentWHERE type_of_studies = ’master’

can be defined using a rule of Datalog:

master_students(name,surname) :−

student(name, surname, type), type = master

Let’s define how seven operators of relational algebra can be defined inDatalog. They are discussed in more detail in Section 2.11.

• Projection R(xi1, xi2, . . . , xim) of relation P (x1, x2, . . . , xn), such thatxij ∈ {x1, x2, . . . , xn}, j ∈ [1,m] and 1 6 i1 < i2 < · · · < im 6 n:

R(xi1, xi2, . . . , xim) :−P (x1, x2, . . . , xn)

• Select operation can be demonstrated using an example. Say that re-lation P (x, y, z) is defined and values of x and z must be selected suchthat y = a. Such select can be expressed using expression of relationalalgebra σy=a(P ) or in Datalog:

R(x, z) :−P (x, a, z)

• Union of relations P (x1, x2, . . . , xn) and Q(x1, x2, . . . , xn):

R(x1, x2, . . . , xn) :−P (x1, x2, . . . , xn)R(x1, x2, . . . , xn) :−Q(x1, x2, . . . , xn)

76

Page 79: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• Difference of relations P (x1, x2, . . . , xn) and Q(x1, x2, . . . , xn):

R(x1, x2, . . . , xn) :−P (x1, x2, . . . , xn),¬Q(x1, x2, . . . , xn)

• Cartesian product of relations P (x1, x2, . . . , xn) and Q(y1, y2, . . . , ym):

R(x1, x2, . . . , xn, y1, y2, . . . , ym) :−P (x1, x2, . . . , xn), Q(y1, y2, . . . , ym)

• Intersection of relations P (x1, x2, . . . , xn) and Q(x1, x2, . . . , xn):

R(x1, x2, . . . , xn) :−P (x1, x2, . . . , xn), Q(x1, x2, . . . , xn)

• Only one type of join is demonstrated:

R(x1, x2, . . . , xn, y1, y2, . . . , ym, z1, z2, . . . , zk) :−

P (x1, x2, . . . , xn, y1, y2, . . . , ym), Q(y1, y2, . . . , ym, z1, z2, . . . , zk)

3.4 Disjunctive Datalog

Disjunctive Datalog expands the definitions even further. The disjuncts indisjunctive Datalog are of the form

F1 ∨ F1 ∨ . . . ∨ Fn :− G1, G2, . . . , Gm,¬H1,¬H2, . . . ,¬Hk

where Fi, i ∈ [1, n], Gj, j ∈ [1,m] and Hl, l ∈ [1, k] are atomic formulas. Aswell as in standard Datalog disjuncts without a body are called facts. If adisjunct contains both a body and a head, then it is called a rule. The setof all the facts is called extensional database (or EDB) and the set of all therules — intentional database (or IDB).

A query of database of disjunctive Datalog is a conjunction of literals:?− l1 ∧ l2 ∧ . . . ∧ ls. An interpretation of database of disjunctive Datalogis some subset of atomic formulas of Herbrand base of the database. It issaid that atomic formula without variables F is true with interpretationI (denoted I � F ) if F ∈ I. Otherwise, it is said that F is false withinterpretation I (denoted I 2F ). Literal ¬F is true with interpretation Iiff I 2F .

Definition 3.4.1. Suppose D is some deductive database of disjunctiveDatalog (D = EDB ∪ IDB). Then set Ground(D) consists of formulas Fαsuch that F ∈ D and α = {a1/x1, a2/x2, . . . , an/xn}, where ai ∈ H, i ∈ [1, n],set H is Herbrand universe of D and x1, x2, . . . , xn is a full list of individualvariables in F .

For better explanation let’s analyse the example.

77

Page 80: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 3.4.2. Let the database D be:

R(a)S(x) ∨ P (x, b) :− R(x)S(x) :− ¬R(x),¬Q(a, x)S(x) :− P (x, b)

In this case

Ground(D) = {R(a), S(a) ∨ P (a, b) :− R(a), S(b) ∨ P (b, b) :− R(b),

S(a) :− ¬R(a),¬Q(a, a), S(b) :− ¬R(b),¬Q(a, b),S(a) :− P (a, b), S(b) :− P (b, b)}

It is said that interpretation I of deductive database D satisfies formulaF ∈ Ground(D) if the following holds:

• if F is a fact, then I �F ;

• if F is a rule of the form G1 ∨ G1 ∨ . . . ∨ Gn :− l1, l2, . . . , lm and∀i ∈ [1,m] : I � li, then there is j ∈ [1, n] such that I �Gj.

Interpretation is called a model of database D if it satisfies every formulaof Ground(D). A model is minimal if it is not a subset of any other model.

Example 3.4.3. Database presented in Example 3.4.2 contains many mod-els, e.g. {R(a), S(a), P (b, a), Q(a, a), Q(a, b)} or {R(a), S(a), S(b), P (a, a)}.However only two of them are minimal: I1 = {R(a), S(a), Q(a, b)} andI2 = {R(a), S(a), S(b)}.

In some cases only rules with positive atomic formulas (i.e. of the formF1 ∨ F1 ∨ . . . ∨ Fn :− G1, G2, . . . , Gm, where Fi, i ∈ [1, n] and Gj, j ∈ [1,m]are atomic formulas) are analysed. A database, which contains only suchrules is called a positive database. An answer set of positive database is anyminimal model of the database.

Example 3.4.4. Let the database be:Facts Rulesp ∨ q c :− q d :− b, cq ∨ r d :− a d ∨ l :− b

b :− q a :− p, r

In this case propositional variables can stand for some atomic formulaswithout individual variables. The models of such deductive database aree.g. M1 = {p, r, a, d}, M2 = {q, b, c, d} and M3 = {q, b, c, d, l}. HoweveronlyM1 andM2 are minimal andM3 is not. ThusM1 andM2 are answersets.

However to define an answer set in any database of disjunctive Dataloganother definition is needed.

78

Page 81: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Definition 3.4.5. Let D be a database of disjunctive Datalog and I bean interpretation of D. Then database DI is obtained from Ground(D) byremoving all the formulas with the body that contains literal ¬F such thatF ∈ I and by removing all the negative literals (formulas of the form ¬G)from other formulas.

It should be noted, that DI is always a positive database.Definition 3.4.6. Let D be a database of disjunctive Datalog then a min-imal model I is an answer set of D if it is an answer set of DI .Example 3.4.7. Let’s continue with database considered in Examples 3.4.2and 3.4.2. In that case

DI1{R(a), S(a) ∨ P (a, b) :− R(a), S(b) ∨ P (b, b) :− R(b),S(a) :− P (a, b), S(b) :− P (b, b)}

DI2 = {R(a), S(a) ∨ P (a, b) :− R(a), S(b) ∨ P (b, b) :− R(b),S(b), S(a) :− P (a, b), S(b) :− P (b, b)}

Interpretation I2 is a minimal model of DI2, however DI1 has even smallermodel than I1 — {R(a), S(a)}. Thus only I2 is an answer set of D.

Suppose that l1∧l2∧ . . .∧ls is a query for database of disjunctive Datalogwithout individual variables. It is said that interpretation I satisfies thequery if I � li for every i ∈ [1, s]. There are two possible approaches todeciding what is the result of the query. One is called brave reasoning andaccording to it the result of a query without individual variables is positiveif at least one answer set of the database satisfies the query. According tocautious reasoning the result is positive if all the answer sets satisfy thequery. Finally if x1, x2, . . . , xn is a full list of individual variables of queryl1 ∧ l2 ∧ . . . ∧ ls, then the result is a set of formulas (l1 ∧ l2 ∧ . . . ∧ ls)α,where α = {a1/x1, a2/x2, . . . , an/xn} is a substitution, aj ∈ H, j ∈ [1, n] and His Herbrand universe, such that the result of query (l1 ∧ l2 ∧ . . . ∧ ls)α ispositive.Definition 3.4.8. It is said that database is stratified, if the set of all thepredicates of the database can be divided into subsets A1,A2, . . . ,An suchthat Ai ∩ Aj = ∅,∀i 6= j and if some predicate P ∈ Ai is part of the headof some rule of the database, then every other predicate, which is part ofthe head of the same rule is part of Ai. Moreover, if some predicate Q ∈ Ajis part of the body of that rule, then j 6 i if the occurrence of the predicateis positive and j < i if the occurrence is negative. The set A1,A2, . . . ,Anis called a stratification of the database.Example 3.4.9. The following database is stratified:

P (a, c) ∨R(c)S(x)← ¬R(x),¬P (a, x)S(x) ∨ T (x, c)← R(x)S(x)← T (x, b)V (x) ∨Q(y)← ¬T (x, y), P (x, a)

79

Page 82: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

The stratification is A1 = {P,R}, A2 = {S, T} and A3 = {V,Q}.

3.5 U-Datalog

U-Datalog additionally defines a concept of update operation. Databases ofU-Datalog can be changed during the execution of the query. There are twotypes of update operations:

• insert, denoted +F ;• delete, denoted −F .

Here F is an atomic formula.A database of U-Datalog together with extensional and intentional da-

tabases contains a set of active rules. An active rule is an expression of theform U1, U2, . . . , Un, l1, l2, . . . , lm → V1, V2, . . . , Vk, where Ui, i ∈ [1, n] andVj, j ∈ [1, k] are update operations and lt, t ∈ [1, k] are literals.

A concept of query is replaced by transaction — a sequence of updateoperations without individual variables. A transaction is executed followingthese steps until the database doesn’t change:

1. A set of update operations U consists of every operation of the trans-action.

2. EDB is updated. For every update operation U ∈ U if U = +F , thenformula F is added into EDB, if U = −F , then formula F is removedfrom EDB.

3. Active rules are used to create a new set of update operations. Forevery active rule U1, U2, . . . , Un, l1, l2, . . . , lm → V1, V2, . . . , Vk if for somesubstitution α every Uiα ∈ U , i ∈ [1, n] and every ljα, j ∈ [1,m] isderivable from EDB and IDB, then Vtα ∈ U ′ for every t ∈ [1, k]. SetU ′ is filled with every update operation generated by every active rule.

4. If U ′ 6= ∅, then set U ′ is a new set of update operations U and thealgorithm is repeated from step 2.

Example 3.5.1. The extensional database is:

stud(John) exam(Algebra, John)stud(Peter) exam(Logics,Peter)failed(Logics, John) nogrant(John)failed(Algebra,Peter) nogrant(Peter)

The intentional database is:

firstyear(x) :− exam(Algebra, x), exam(Logics, x)

The active rules are:+exam(x, y), stud(y)→ −failed(x, y)firstyear(x)→ −nogrant(x)

80

Page 83: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

John and Peter are students. To complete the first year of their studiesthey had to pass algebra and logics exams. John passed algebra but failedin logics, therefore he haven’t completed the first year of his studies andwill not get a grant for the following year. Peter, however, contrary passedlogics and failed algebra exams. Nevertheless he also haven’t completed thefirst year and will not receive a grant.

Suppose that transaction is +exam(Algebra,Peter), i.e. Peter passed al-gebra exam later. The new extensional database is:

stud(John) exam(Algebra, John)stud(Peter) exam(Logics,Peter)failed(Logics, John) nogrant(John)exam(Algebra,Peter)

81

Page 84: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Chapter 4

Modal logics

4.1 Syntax and semantics

Many various propositions can defined in predicate logic, however it is notstraight forward how to define concepts such as knowledge, belief or time.Consider the following examples:

• Proposition the population of Lithuania is between 3 and 4 millions istrue for know, but it is possible that it will be false later. How to defineformula that this proposition is always true?

• Proposition the largest planet of the Solar system is Jupiter is true,but not everybody knows that. How to define formula that everybodyknows that this proposition is true?

• It is not known if proposition the afterlife exists is true or not. It is amatter of belief. How to define formula that someone believes that thisproposition is true?

To formalise these propositions two new operators (called modal opera-tors) are introduced: �, defining necessity, and ♦, defining possibility.

Definition 4.1.1. A modal formula is defined in a following way:

• propositional variable is a formula;

• if F is a formula, then ¬F , �F and ♦F are also formulas.

• if F and G are formulas, then (F ∨G), (F ∧G), (F ⊃G) and (F ↔G)are also formulas.

The priority of unary operators (negation ¬ and two modal operators� and ♦) is the highest. Priorities of other operators are the same as inpropositional logic case. Similarly to propositional logic, some parenthesescan be omitted.

Example 4.1.2. These expressions are modal formulas: �(p⊃(�q∧♦♦p)

),

�♦p, ¬p ∨��(q ∨ p).

82

Page 85: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Semantically modal operators can have many different meanings and themeaning depends on the application. Some of the possibilities are:

�F ♦FSomeone (or some agent) knowsthat F is true

Someone (or some agent) does notknow that F is false

Someone is sure that F is true Someone thinks that F can possiblybe true

Always F Sometimes FF will certainly occur Event F is possibleF is provable F is not improvableAll the paths of non-deterministiccalculus with input data F end infinal states

There is a path of non-deterministiccalculus with input data F thatends in final state

Instead of interpretation of propositional logic, to interpret modal for-mulas Kripke structure is used.

Definition 4.1.3. A Kripke structure of modal formula F is a triple S =〈W ,R, ν〉, where:

• W 6= ∅ is some set, called the set of possible worlds.

• R is a binary relation between elements of set W .

• ν is an interpretation function, which depends on the elements of W .I.e. ν : P ×W → {>,⊥}, where P is a set of propositional variables offormula F .

A pair 〈W ,R〉 of Kripke structure 〈W ,R, ν〉 is called a frame.Kripke structure can be displayed using oriented graph. Worlds of the

structure are the vertices of the graph and the relation is presented usingthe oriented edges of the graph. To display an interpretation, value of everypropositional variable can be displayed next to the name of the world in thegraph. Another approach is to display only the names of those variables,which are true in that world.

Example 4.1.4. W = {w1, w2, w3, w4}, R = {(w1, w2), (w1, w3), (w3, w3)}.Suppose F has only two variables p and q and ν is defined as follows: inworld ν(p, w1) = ν(q, w1) = ⊥, ν(p, w2) = >, ν(q, w2) = ⊥, ν(p, w3) =ν(q, w3) = >, ν(p, w4) = > and ν(q, w4) = ⊥. Then structure (let’s denoteit S) can be expressed using graph:

w1 w2

w3 w4

p = ⊥, q = ⊥ p = >, q = ⊥

p = >, q = > p = >, q = ⊥

83

Page 86: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Similarly to propositional logic the fact that modal formula F is true withinterpretation S in world w is denoted S, w �F and is defined recursively.Definition 4.1.5. Suppose S = 〈W ,R, ν〉 is a Kripke structure of formulaF and w ∈ W , then:

• if F is a propositional variable, then S, w �F iff ν(F,w) = >.• if F = ¬G, then S, w �F iff S, w 2G.• if F = G ∧H, then S, w �F iff S, w �G and S, w �H.• if F = G ∨H, then S, w 2F iff S, w 2G and S, w 2H.• if F = G⊃H, then S, w 2F iff S, w �G and S, w 2H.• if F = G↔ H, then S, w � F iff S, w �G and S, w �H or S, w 2G

and S, w 2H.• if F = �G, then S, w �F iff for every world w1 ∈ W such that wRw1

it is true that S, w1 �G.• if F = ♦G, then S, w �F iff there is a world w1 ∈ W such that wRw1

and S, w1 �G.Example 4.1.6. Let’s analyse structure S defined in Example 4.1.4. For-mula ♦q is true in w1 of that structure (i.e. S, w1 �♦q). The following ex-pressions are also true: S, w1 �♦¬q; S, w1 2�q; S, w1 ��p; S, w1 2�p⊃p;S, w3 ���p; S, w4 2�p⊃ ♦p.

If formula F is true in world w of structure S (i.e. S, w � p), then apair 〈S, w〉 is called a model of formula F . If F is true in every world ofstructure S, then it is said that F is valid in structure S (denoted S �F ).If there is a world w such that S, w �F , then it is said that F is satisfiablein structure S.

Let F be some formula, S be a Kripke structure of F and w a world ofS. Then a local model checking aims to find if S, w � F (i.e. if 〈S, w〉 is amodel of F ). A global model checking aims to find if formula F is valid instructure S. And the aim of mixed model checking is to find every world w′of structure S such that S, w′ �F .Example 4.1.7. Suppose S = 〈W ,R, ν〉 is a Kripke structure. A set ofworlds W = {w0, w1, w2, . . . }. A relation between worlds is: wnRwn+2,wnRwn+3 and wnRwn+5 for all n ∈ [0,∞). Finally an interpretation func-tion ν is defined as follows: ν(p, wi) = >, iff i is even number, ν(q, wj) = >iff j is odd number and ν(r, wk) = >, iff k is prime number. Let’s check ifthe following formulas are satisfiable in structure S:

1. �r;2. �♦q;

3. �(p ∨ (q ∨�r)

).

84

Page 87: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

The solutions are:1. The aim is to find a world in which �r is true. Because of the definition

of R, the world wi must be found such that S, wi+2 � r, S, wi+3 � r andS, wi+5 � r. Now taking into account definition of ν(r, w), the numberi ∈ [0,∞] must be fount such that i + 2, i + 3 and i + 5 are primenumbers. The only such number is 0, because 2, 3 and 5 are primes.Therefore �r is satisfiable in structure S, because S, w0 ��r.

2. Once again, some number i must be found such that for every numberj ∈ {i+2, i+3, i+5} the following would be true: at least one of j+2,j+ 3 or j+ 5 is odd number. It is easy to see that for any j either j+ 2or j + 3 is odd (and another one is even). This fact does not dependneither on the value of j nor on the value of i. Thus formula �♦q isnot only satisfiable, it is valid in structure S.

3. Every number is either odd or even. Thus formula p∨ q is true in everyworld of W . Moreover, for the same reason �(p ∨ q) is true in everyworld of W . It is not hard to argue that if p ∨ q is true in some world,then p ∨ q ∨�r is also true in that world. And thus, �(p ∨ q ∨�r) istrue in every world ofM. Now additional parentheses do not make anydifference, because p∨(q∨�r) ≡ (p∨q)∨�r. Therefore �

(p∨(q∨�r)

)is valid in structure S and thus also satisfiable.

Example 4.1.8. Suppose S = 〈W ,R, ν〉 is a Kripke structure. Let W bea set of all the lines of the plain. Two lines x, y ∈ W are in a relation xRyiff x and y are perpendicular or parallel and x 6= y. Finally interpretationν is defined as follows: ν(p, w) = > iff line w crosses axis Ox. Let’s check ifthe following formulas are satisfiable in structure S:

1. �♦p;2. ��p ∨ ♦♦p.It is easy to show that both formulas are valid in structure S. From the

validity, satisfiability follows immediately.1. Let w be some line of the plain, p(w) be a set of lines that are perpen-

dicular to w and q(w) be a set of lines that are parallel to w, w /∈ q(w).Then the aim is to prove that ♦p is true in every world of p(w)∪ q(w).Let’s take w′ ∈ p(w) ∪ q(w). Formula ♦p is true in world w′ if at leastone line from p(w′) ∪ q(w′) crosses Ox axis. If w is neither parallelnor perpendicular to Ox axis, then neither are lines from p(w) ∪ q(w).Therefore for any w′ ∈ p(w)∪ q(w) all the lines of p(w′)∪ q(w′) crossesOx axis. If w is parallel to Ox axis, then for any w′ ∈ p(w) all thelines of q(w′) crosses Ox axis. Moreover, for any w′ ∈ q(w) all the linesin p(w′) crosses Ox axis. Finally, if w is perpendicular to Ox, thenfor every w′ ∈ p(w), any line from p(w′) crosses Ox axis, and for everyw′ ∈ q(w), any line from q(w′) crosses Ox axis. Therefore, formula �♦pis true in any world w ∈ W and thus it is valid in structure S.

85

Page 88: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

2. It is enough to show that ♦♦p is valid in structure S. From that fact,the validity of ��p ∨ ♦♦p follows immediately. Let w be some line ofthe plain. Let’s take any line w′ ∈ p(w) ∪ q(w). The aim is to show,that there is a line in p(w′) ∪ q(w′), that crosses Ox axis. This can beproved by following the same discussion as in the previous case.It can be noted, that formula ��p is indeed satisfiable in S, howeverit is not valid. Formula is true in world w (with line w), if for any linew′, which is perpendicular or parallel to w (w′ 6= w), it is true thatany line, which is perpendicular or parallel to w′ (except w′), crossesOx axis. This is true, if w is neither parallel, nor perpendicular to Ox.If however w is parallel to Ox, then let’s take some w′ ∈ p(w). In thiscase no line from p(w′)\{Ox} crosses Ox axis and thus S, w 2��p.

Now let’s analyse several other modal formulas.Theorem 4.1.9. The following formulas are valid in any Kripke structure.

1. ♦F ⊃ ¬�¬F ;2. ¬�¬F ⊃ ♦F ;3. �F ⊃ ¬♦¬F ;4. ¬♦¬F ⊃�F ;5. �(F ⊃G)⊃ (�F ⊃�G).

Here F and G are any modal formulas.Proof. To prove the validity of the formulas suppose that Kripke structureS = 〈W ,R, ν〉 is analysed and w ∈ W is some world of the structure. Let’sshow that these formulas are true in world w of such structure (i.e. 〈S, w〉is a model of these formulas).

1. If S, w 2♦F , then because of the definition of implication, 〈S, w〉 is amodel of ♦F ⊃¬�¬F . Suppose that S, w �♦F . Then there is w′ ∈ Wsuch that wRw′ and S, w′ �F . Therefore, S, w′ 2¬F . Now because ofthat S, w 2�¬F and thus S, w �¬�¬F .

2. If S, w 2 ¬�¬F , then 〈S, w〉 is a model of ¬�¬F ⊃ ♦F . SupposeS, w � ¬�¬F . Then S, w 2 �¬F . Now there is w′ ∈ W such thatwRw′ and S, w′ 2 ¬F . Therefore, S, w′ � F . Finally because of thatS, w �♦F .

3. If S, w 2 �F , then 〈S, w〉 is a model of �F ⊃ ¬♦¬F . Suppose thatS, w � �F . Then for all w′ ∈ M such that wRw′ it is true thatS, w′ � F . Therefore, S, w′ 2 ¬F . Now because of that S, w 2 ♦¬Fand thus S, w �¬♦¬F .

4. If S, w 2 ¬♦¬F , then 〈S, w〉 is a model of ¬♦¬F ⊃ �F . SupposeS, w �¬♦¬F . Then S, w 2♦¬F . Now there are no w′ ∈ W such thatwRw′ and S, w′ �¬F , so for all w′ ∈ W such that wRw′ it is true thatS, w′ 2¬F . Therefore, S, w′ �F . Finally because of that S, w ��F .

86

Page 89: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

5. If S, w 2�(F ⊃G), then 〈S, w〉 is a model of �(F ⊃G)⊃ (�F ⊃�G).Suppose S, w ��(F ⊃G). Therefore for any w′ ∈ W such that wRw′it is true that S, w′ �F ⊃G. Because of that, if for all such w′ it is truethat S, w′ �F , then it is also true that S, w′ �G. From this it followsthat S, w � �F and S, w � �G, thus S, w � �F ⊃ �G. If howeverthere is a world w′ such that S, w′ 2F , then S, w 2�F and thereforeS, w ��F ⊃�G.

Corollary 4.1.10. It is possible to use only one modal operator. Usually� is chosen and formulas of the form ♦F are replaced by ¬�¬F .

Definition 4.1.11. A projection of modal formula F into propositionallogic Proj(F ) is obtained from F by deleting all the occurrences of modaloperators.Example 4.1.12. If F = p ∧ (�♦q ∨ ¬�p), then Proj(F ) = p ∧ (q ∨ ¬p).

If formula Proj(F ) is not valid in propositional logic, then there is aKripke structure in which modal formula F is not valid too. To prove thatlet ν be a propositional interpretation with which ν 2 Proj(F ). Now let’sconstruct Kripke structure S = 〈W ,R, ν ′〉, where W = {w}, R = {(w,w)}and ν ′(p, w) = ν(p) for any propositional variable p of F . It is not hard tocheck inductively that S, w 2F .

However, the opposite statement (if Proj(F ) is valid in propositionallogic, then F is valid in every Kripke structure) is not always true. E.g.propositional formula (p∨q)⊃(p∨q) is valid in propositional logic, however�(p∨ q)⊃ (�p∨�q) is not valid in Kripke structure S = 〈W ,R, ν〉, whereW is a set of natural numbers, xRy iff y = x+ 1 or y = x+ 2, ν(p, w) = >iff w is an even number and ν(q, w) = > iff w is an odd number. It is easyto check that S 2�(p ∨ q)⊃ (�p ∨�q).

Let’s analyse properties of the relations that are defined in Definition1.4.2. It is obvious that all of them can be defined in predicate logic. More-over, some of the properties can be defined using modal formulas. Supposethat S = 〈M,R,V〉 is a Kripke structure, then:

• relation R is reflexive, iff formula �F ⊃ F is valid in structure S forany formula F ;

• relation R is complete, iff formula �F ⊃♦F is valid in structure S forany formula F ;

• relation R is symmetric, iff formula F ⊃ �♦F is valid in structure Sfor any formula F ;

• relation R is transitive, iff formula �F ⊃��F is valid in structure Sfor any formula F ;

• relation R is euclidean, iff formula �F ⊃ �♦F is valid in structure Sfor any formula F ;

87

Page 90: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

These formulas have their names. They add interesting properties ofmodal operators, because of that they are included as axioms in some modallogics. The axioms are summarised in the following table:

Name Formula R is:(T) �F ⊃ F reflexive(D) �F ⊃ ♦F complete(B) F ⊃�♦F symmetric(4) �F ⊃��F transitive(5) �F ⊃�♦F euclidean

The logics are defined in the next chapter.

4.2 Hilbert-type calculi

As it was mentioned earlier, only one of two modal operators can be anal-ysed. Thus the Hilbert-type calculus is provided for formulas containing �modal operator only. The calculus is obtained by adding modal axioms anda modal rule to propositional Hilbert-type calculus:Definition 4.2.1. Hilbert-type calculus for modal logics consists of thesame axioms and rules as HPC, Necessity Generalisation rule (NG):

F�F

And axioms that depend on modal logic in question:(K): �(F ⊃G)⊃ (�F ⊃�G);(T): �F ⊃ F ;(D): �F ⊃ ♦F ;(B): F ⊃�♦F ;(4): �F ⊃��F ;(5): �F ⊃�♦F .

Different modal logics are obtained by choosing a different set of modalaxioms. Propositional axioms, MP and NG rules are included in all thecalculi.

The different modal logics are summarised in the following table:Logics Hilbert-type calculus Modal axioms

K HK (K)T HT (K), (T)S4 HS4 (K), (T), (4)S5 HS5 (K), (T), (4), (5)K4 HK4 (K), (4)B HB (K), (B)D HD (K), (D)

K45 HK45 (K), (4), (5)KD45 HKD45 (K), (D), (4), (5)

88

Page 91: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

The table is interpreted as follows: Hilbert-type calculus for modal logicS4 (denoted HS4) contains axioms of HPC, rules MP and NG and modalaxioms (K), (T) and (4). Modal logics that include axiom (K) are callednormal, the other ones are called semi normal. It is known that if modallogic consists of axiom (K) and any combination of axioms (T), (D), (4),(5) and (B), then it is decidable.Example 4.2.2. Let’s find a derivation of formula p⊃ ♦p in calculus HT.First of all, ♦ is not part of the calculus, therefore it must be replaced anda derivation of formula p⊃ ¬�¬p must be found:1. �¬p⊃ ¬p Axiom (T), {¬p/F}.2. (�¬p⊃ ¬p)⊃ (¬¬p⊃ ¬�¬p) Axiom 4.1, {�¬p/F , ¬p/G}.3. ¬¬p⊃ ¬�¬p MP rule from 1 and 2.4. p⊃ ¬¬p Axiom 4.2, {p/F}.5. (¬¬p⊃ ¬�¬p)⊃

(p⊃ (¬¬p⊃ ¬�¬p)

)Axiom 1.1, {¬¬p⊃¬�¬p/F , p/G}.

6. p⊃ (¬¬p⊃ ¬�¬p) MP rule from 3 and 5.7.(p⊃ (¬¬p⊃ ¬�¬p)

)⊃((p⊃ ¬¬p)⊃ (p⊃ ¬�¬p)

)Axiom 1.2, {p/F , ¬¬p/G, ¬�¬p/H}.

8. (p⊃ ¬¬p)⊃ (p⊃ ¬�¬p) MP rule from 6 and 7.9. p⊃ ¬�¬p MP rule from 4 and 8.

Now let’s analyse the following example.Example 4.2.3. Let’s say that S = 〈W ,R, ν〉 is a Kripke structure forformula F = �p ⊃ p, where W = {w1, w2}, R = {(w1, w2)}, ν(p, w1) = ⊥and ν(p, w2) = >. It is possible to demonstrate the structure graphically:

w1 w2

p = ⊥ p = >

Now let’s check, if S, w1 � F . According to the definition S, w1 � �p,because S, w2 � p and w2 is the only world such that w1Rw2. HoweverS, w1 2 p. Therefore S, w1 2�p⊃ p.

This example demonstrates, that it is possible to construct a Kripkestructure, in which axiom (T) is not valid. Indeed, as stated in previoussection, for this axiom to be valid in each world of some Kripke structureS = 〈W ,R, ν〉, the relationR of S must be reflexive. Therefore, the validityof formula in modal logic (the fact that formula F is valid in modal logicL is denoted �L F ) is defined taking into account the requirements of theaxioms, that are part of the logic:

• �KF iff for any Kripke structure S it is true that S �F .• �TF iff for any Kripke structure S with reflexive relation S �F .• �K4F iff for any Kripke structure S with transitive relation S �F .• �S4F iff for any Kripke structure S with reflexive and transitive relationS �F .

Definitions of �S5 F , �B F , �D F , �K45 F and �KD45 F are obtained analo-gously by taking into account the requirements of modal axioms of logics.

89

Page 92: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Analogously, the satisfiability of formulas in modal logics is defined:

• F is satisfiable in modal logic K iff it is satisfiable in some Kripkestructure S.

• F is satisfiable in modal logic T iff it is satisfiable in some Kripkestructure S with reflexive relation.

• F is satisfiable in modal logic K4 iff it is satisfiable in some Kripkestructure S with transitive relation.

• F is satisfiable in modal logic S4 iff it is satisfiable in some Kripkestructure S with reflexive and transitive relation.

This definition can be extended to other logics too.

4.3 Sequent calculi

Definition 4.3.1. Gentzen-type calculus for modal logics is obtained fromGPC by adding modal rules, which depend on logic:

Calculus GK for modal logic K:

Γ2 → F(→ �)Γ1,�Γ2 → ∆,�F

Calculus GK4 for modal logic K4:

Γ2,�Γ2 → F(→ �)Γ1,�Γ2 → ∆,�F

Calculus GT for modal logic T:

F,�F,Γ → ∆(�→)

�F,Γ → ∆Γ2 → F

(→ �)Γ1,�Γ2 → ∆,�F

Calculus GS4 for modal logic S4:

F,�F,Γ → ∆(�→)

�F,Γ → ∆�Γ2 → F

(→ �)Γ1,�Γ2 → ∆,�F

Here �Γ2 is a set of formulas, starting with �. In that case Γ2 is a set offormulas obtained from �Γ2 by removing outermost � occurrence in eachformula.

90

Page 93: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 4.3.2. Let’s derive sequent → ¬�¬(p∨�¬p) in sequent calculusGS4.

p,�¬(p ∨�¬p) → p,�¬p(→ ∨)

p,�¬(p ∨�¬p) → p ∨�¬p(¬ →)

p,¬(p ∨�¬p),�¬(p ∨�¬p) →(�→)

p,�¬(p ∨�¬p) →(→ ¬)

�¬(p ∨�¬p) → ¬p(→ �)

�¬(p ∨�¬p) → p,�¬p(→ ∨)

�¬(p ∨�¬p) → p ∨�¬p(¬ →)

¬(p ∨�¬p),�¬(p ∨�¬p) →(�→)

�¬(p ∨�¬p) →(→ ¬)

→ ¬�¬(p ∨�¬p)The main formula of the application of (�→) rule is repeated in the pre-

miss too. This repetition cannot be omitted, because without it the sequentwouldn’t be derivable:

p →(→ ¬)→ ¬p

(→ �)→ p,�¬p(→ ∨)→ p ∨�¬p(¬ →)

¬(p ∨�¬p) →�¬(p ∨�¬p) →

(→ ¬)→ ¬�¬(p ∨�¬p)

Example 4.3.3. Let’s derive sequent �(p ∧ q) → �p ∧�q in sequent cal-culus of logic T.

p, q → p(∧ →)

p ∧ q → p(→ �)

�(p ∧ q) → �p

p, q → q(∧ →)

p ∧ q → q(→ �)

�(p ∧ q) → �q(→ ∧)

�(p ∧ q) → �p ∧�qSometimes it is not enough to analyse only modal operator �. One such

case is when it is required that negation be only in front of propositionalvariables. Every modal formula can be transformed into such form, however,operator ♦ is necessary. It is easy to extend a calculus to deal with modaloperator ♦ (it must be kept in mind that ♦F can be changed by ¬�¬F ).E.g. modal rules of sequent calculus for logic S4 are as follows:

rules for operator �:F,�F,Γ → ∆

(�→)�F,Γ → ∆

�Γ2 → ♦∆2, F (→ �)Γ1,�Γ2 → ∆1,♦∆2,�F

rules for operator ♦:�Γ2, F → ♦∆2 (♦→)Γ1,�Γ2,♦F → ∆1,♦∆2

Γ → ∆, F,♦F(→ ♦)Γ → ∆,♦F

Here ♦∆2 is a set of formulas, starting with ♦.

91

Page 94: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

4.4 Tableaux calculus

Tableaux calculus for modal logics is similar to the one for predicate logicdefined in Section 2.6. However instead of regular formulas, prefixed formu-las are used. A prefixed formula is an expression of the form σ F , whereσ is a finite sequence of natural numbers, called a prefix, and F is someformula. To derive formula F using tableaux calculus, the derivation searchmust start with prefixed formula 1 ¬F .

Definition 4.4.1. A tableaux calculus for modal logics consists of the fol-lowing rules:

Conjunction rules:σ F ∧Gσ Fσ G

σ ¬(F ∨G)σ ¬Fσ ¬G

σ ¬(F ⊃G)σ Fσ ¬G

Disjunction rules:σ ¬(F ∧G)σ ¬F | σ ¬G

σ F ∨Gσ F | σ G

σ F ⊃Gσ ¬F | σ G

Double negation rule:σ ¬¬Fσ F

Necessity rules:σ �Fσ.n F

σ ¬♦Fσ.n ¬F

where σ.n is any prefix, n ∈ N.Possibility rules:

σ ♦Fσ.k F

σ ¬�Fσ.k ¬F

where σ.k is a new prefix, that does not appear in the branch, k ∈ N.

And additional rules for different modal logics:

Rules (T):σ �Fσ F

σ ¬♦Fσ ¬F

Rules (D):σ �Fσ ♦F

σ ¬♦Fσ ¬�F

Rules (B):σ.n �Fσ F

σ.n ¬♦Fσ ¬F

where σ.n is any prefix, n ∈ N.Rules (4):

σ �Fσ.n �F

σ ¬♦Fσ.n ¬♦F

where σ.n is any prefix, n ∈ N.

92

Page 95: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Rules (4r):σ.n �Fσ �F

σ.n ¬♦Fσ ¬♦F

where σ.n is any prefix, n ∈ N.

Once again, additional rules used in calculus for each logic are sum-marised in a table:

Logics Hilbert-type calculus Additional rulesK TKT TT (T)S4 TS4 (T), (4)S5 TS5 (T), (4), (4r)K4 TK4 (4)B TB (B), (T), (4)D TD (D)

A branch is closed, if it contains two formulas σ F and σ ¬F . A closedtree with 1 ¬F as a root is called a derivation of modal formula F in tableauxcalculus.

Example 4.4.2. Let’s derive formula F = (�♦p∧�♦q)⊃�♦(�♦p∧�♦q)in tableaux calculus TS4:

1 ¬((�♦p ∧�♦q)⊃�♦(�♦p ∧�♦q)

)= F1

1 �♦p ∧�♦q = F21 ¬�♦(�♦p ∧�♦q) = F3

1 �♦p = F41 �♦q = F5

1.1 ¬♦(�♦p ∧�♦q) = F61.1 ¬(�♦p ∧�♦q) = F7

1.1 ¬�♦p = F81.1 �♦p = F10

1.1 ¬�♦q = F91.1 �♦q = F11

Formulas F2 and F3 are obtained by applying conjunction rule to formulaF1. In the same way formulas F4 and F5 are obtained from F2. To obtainformula F6, possibility rule is applied to F3. Formula F7 results from theapplication of rule (T) to F6. Formulas F8 and F9 are the result of applica-tion of disjunction rule to formula F7. Finally, F10 is obtained from F4 andF11 is obtained from F5 after application of (4) rule.

One branch of derivation tree includes prefixed formulas 1.1 ¬�♦p and1.1 �♦p, the other one — 1.1 ¬�♦q and 1.1 �♦q. Thus the tree is closedand it is a derivation of formula F .

If only formulas containing ¬, ∧, ∨, � and ♦ operators are analysed andnegation is always in front of propositional variables, then tableaux systemcan be simplified. Here such systems for logics S4 and S5 are presented.

93

Page 96: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Definition 4.4.3. Simplified tableaux calculus for logic S4 (denoted TS4s)contains only one variant of each conjunction, disjunction, necessity, possi-bility, (T) and (4) rule:

σ F ∧Gσ Fσ G

σ F ∨Gσ F | σ G

σ �Fσ.n F

σ ♦Fσ.k F

σ �Fσ F

σ �Fσ.n �F

As in TS4 case, σ.n is any index, σ.k is a new index, that doesn’t appearin the branch, n, k ∈ N.

Definition 4.4.4. Simplified tableaux calculus for logic S5 (denoted TS5s)can be obtained by enriching calculus TS4s with one variant of (4r) rule:

σ.n �Fσ �F

Simplified tableaux calculi for other modal logics can be obtained fromoriginal tableaux calculi in analogous way.

4.5 Relation to predicate logic

For any modal formula F it is possible to find a predicate formula Tr(F )xwith one free variable x such that F is satisfiable in logic K iff Tr(F )x issatisfiable in predicate logic. Let’s demonstrate how formula Tr(F )x can beobtained:

• Tr(G)x = P (x), if G is a propositional variable. Here P is a predicatevariable into which propositional variable G is transformed. The pred-icate variable is different for different propositional variables of modalformula, however it is the same for different occurrences of the samepropositional variable.

• Tr(¬G)x = ¬Tr(G)x;

• Tr(G ∧H)x = Tr(G)x ∧ Tr(H)x;

• Tr(G ∨H)x = Tr(G)x ∨ Tr(H)x;

• Tr(G⊃H)x = Tr(G)x ⊃ Tr(H)x;

• Tr(�G)x = ∀y(R(x, y) ⊃ Tr(G)y

), here y is a new variable and R is a

predicate variable, which represents the relation of Kripke structure.

• Tr(♦G)x = ∃y(R(x, y) ∧ Tr(G)y

), here y is a new variable.

Example 4.5.1. Let’s find Tr(�♦(p⊃ q)

)x:

Tr(�♦(p⊃ q)

)x

= ∀y(R(x, y)⊃ Tr

(♦(p⊃ q)

)y

)=

= ∀y(R(x, y)⊃ ∃z

(R(y, z) ∧ Tr(p⊃ q)z

))=

94

Page 97: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

= ∀y(R(x, y)⊃ ∃z

(R(y, z) ∧

(Tr(p)z ⊃ Tr(q)z

)))=

= ∀y(R(x, y)⊃ ∃z

(R(y, z) ∧

(P (z)⊃Q(z)

)))

This means that every modal formula can be written and analysed inpredicate logic. However there are predicate formulas which cannot be de-fined using modal logic. Thus predicate logic is more expressive than modallogic. Nevertheless modal logic is expressive enough for some applicationsand it is much easier to solve many problems in modal logic than in predicatelogic. For comparison a complexity of two problems is presented:

Model checking Satisfiability checkingPredicate logic PSPACE Impossible to solve

Modal logic P PSPACE

To define similar transformations for formulas of other modal logics,the requirements of the axioms must be taken into consideration. Letσ ∈ {D,T,K4, S4,B, S5,K45,KD45}, then Fσ is a conjunction of predi-cate formulas, that describe the properties of axioms of modal logic σ. Theformulas are presented in the following table:

Property FormulaReflexivity ∀xR(x, x)

Completeness ∀x∃yR(x, y)Symmetricity ∀x∀y

(R(x, y)⊃R(y, x)

)Transitivity ∀x∀y∀z

((R(x, y) ∧R(y, z)

)⊃R(x, z)

)Euclidicity ∀x∀y∀z

((R(x, y) ∧R(x, z)

)⊃R(y, z)

)E.g. if σ = S4, which contains axioms (T) and (4), then formulas for reflex-ivity and transitivity must be included into Fσ, thus

Fσ = ∀xR(x, x) ∧ ∀x∀y∀z((R(x, y) ∧R(y, z)

)⊃R(x, z)

)

Modal formula G is satisfiable in logic σ iff predicate formula ∃xTr(G)x∧Fσis satisfiable in predicate logic.

Modal formula G is valid if ¬G is not satisfiable. Thus G is valid iff∃xTr(¬G)x∧Fσ is not satisfiable. Therefore, G is valid iff ∀xTr(G)x∨¬Fσis valid.

It was mentioned that complexity of satisfiability checking in modal logicis PSPACE. In fact, when the relation has additional properties, complexitycan be even lower:

Logics ComplexityK, D, T, K4, S4 PSPACE

KD45, S5 NP

95

Page 98: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

4.6 Mints transformation

Definition 4.6.1. Formulas F and G are equivalent (denoted F ≡ G) inmodal logic L, if for any Kripke structure S that satisfy the requirementsof L and any world w of S S, w �F iff S, w �G.

In modal logic S4 these equivalences hold:

• ♦♦p ≡ ♦p;

• ��p ≡ �p;

• �♦�♦p ≡ �♦p;

• ♦�♦�p ≡ ♦�p;

• ¬♦p ≡ �¬p;

• �(p ∧ q) ≡ �p ∧�q;

• ♦(p ∨ q) ≡ ♦p ∨ ♦q;

However, �(p ∨ q) 6≡ �p ∨�q and ♦(p ∧ q) 6≡ ♦p ∧ ♦q.In propositional logic the following statement is correct: if G ≡ H, then

F (G) ≡ F (H) for any formula F . This is not true in modal logics. E.g. fromthe fact that p ≡ q doesn’t follow that �p ≡ �q, because it is impossibleto derive the following sequent:

· · ·· · ·

�p → q(→ �)

p,�p, q, p → �q(�→)

�p, q, p → �q(→ ⊃)

q, p → �p⊃�q · · ·(→ ∧)

q, p → (�p⊃�q) ∧ (�q ⊃�p)(⊃ →)

q, q ⊃ p → (�p⊃�q) ∧ (�q ⊃�p)(⊃ →)

p⊃ q, q ⊃ p → (�p⊃�q) ∧ (�q ⊃�p)(∧ →)

(p⊃ q) ∧ (q ⊃ p) → (�p⊃�q) ∧ (�q ⊃�p)

Although the given derivation search tree is in calculus GS4, similar treescould be constructed for other calculi.

Theorem 4.6.2 (Mints). For any formula F and its subformula G, inmodal logic GS4 from the fact that �(G ≡ H) follows that F (G) ≡ F (H).

Definition 4.6.3. Modal literals are literals of propositional logic and for-mulas of the form �l and ♦l, where l is a literal of propositional logic.

Definition 4.6.4. A modal disjunct is a disjunction of modal literals.

Theorem 4.6.5. For any formula F there is a set of modal disjunctsG1, G2, . . . , Gn and a literal of propositional logic l such that → F is deriv-able in sequent calculus GS4, iff �G1,�G2, . . . ,�Gn, l → is derivable.

96

Page 99: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Let’s define a transformation algorithm. First of all, let’s take sequent→ F . Let’s replace subformulas of the form ¬p, p∨ q, p∧ q, p⊃ q, �p, ♦pby new variables one by one. The change requires that formula �(r↔¬p),�(r↔ (p ∧ q)

), �

(r↔ (p ∨ q)

), �

(r↔ (p⊃ q)

), �(r↔�p) or �(r↔ ♦p)

respectively be included into antecedent (here r is a variable, which replacesthe subformula). All of these formulas can be transformed into form �G,where G is a modal disjunct:

• �(r ↔ ¬p) ≡ �((r ⊃ ¬p) ∧ (¬p ⊃ r)

)≡ �

((¬r ∨ ¬p) ∧ (p ∨ r)

)≡

�(¬r∨¬p)∧�(p∨r) — formulas �(¬r∨¬p) and �(p∨r) are obtained;

• �(r↔ (p ∧ q)

)≡ �

((r ⊃ (p ∧ q)

)∧((p ∧ q) ⊃ r

))≡ �

((¬r ∨ (p ∧

q))∧(¬(p ∧ q) ∨ r

))≡ �

((¬r ∨ p) ∧ (¬r ∨ q) ∧ (¬p ∨ ¬q ∨ r)

)≡

�(¬r∨p)∧�(¬r∨q)∧�(¬p∨¬q∨r) — formulas �(¬r∨p), �(¬r∨q)and �(¬p ∨ ¬q ∨ r) are obtained;

• �(r↔ (p ∨ q)

)≡ �

((r⊃ (p ∨ q)

)∧((p ∨ q)⊃ r

))≡ �

((¬r ∨ p ∨ q

)∧(

¬(p ∨ q) ∨ r))≡ �

((¬r ∨ p ∨ q

)∧((¬p ∧ ¬q) ∨ r

))≡ �

((¬r ∨ p ∨

q) ∧ (¬p ∨ r) ∧ (¬q ∨ r))≡ �(¬r ∨ p ∨ q) ∧ �(¬p ∨ r) ∧ �(¬q ∨ r) —

formulas �(¬r ∨ p ∨ q), �(¬p ∨ r) and �(¬q ∨ r) are obtained;

• �(r↔ (p ⊃ q)

)≡ �

((r ⊃ (p ⊃ q)

)∧((p ⊃ q) ⊃ r

))≡ �

((¬r ∨ ¬p ∨

q)∧(¬(¬p∨ q)∨ r

))≡ �

((¬r ∨¬p∨ q

)∧((p∧¬q)∨ r

))≡ �

((¬r ∨

¬p ∨ q) ∧ (p ∨ r) ∧ (¬q ∨ r))≡ �(¬r ∨ ¬p ∨ q) ∧�(p ∨ r) ∧�(¬q ∨ r)

— formulas �(¬r ∨ ¬p ∨ q), �(p ∨ r) and �(¬q ∨ r) are obtained;

• �(r↔�p) ≡ �((r ⊃�p) ∧ (�p⊃ r)

)≡ �

((¬r ∨�p) ∧ (¬�p ∨ r)

)≡

�(¬r ∨�p)∧�(♦¬p∨ r) — formulas �(¬r ∨�p) and �(♦¬p∨ r) areobtained;

• �(r↔ ♦p) ≡ �((r ⊃ ♦p) ∧ (♦p ⊃ r)

)≡ �

((¬r ∨ ♦p) ∧ (¬♦p ∨ r)

)≡

�(¬r ∨♦p)∧�(�¬p∨ r) — formulas �(¬r ∨♦p) and �(�¬p∨ r) areobtained;

Such reduction finally leaves only one propositional variable in succedent.Let’s call it v. Then instead of v in succedent, ¬v can be included intoantecedent to obtain sequent of the form �G1,�G2, . . . ,�Gn, l → , whereGi, i ∈ [1, n] are modal disjuncts and l is propositional literal. This sequentis derivable in sequent calculus GS4 iff → F is derivable. This theoremwas first proved by G. Mints.

Example 4.6.6. Let’s transform formula ¬�(p ∧ q) ∨ q:

→ ¬�(p ∧ q) ∨ q

97

Page 100: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

�(r↔ (p ∧ q)

)→ ¬�r ∨ q

�(r↔ (p ∧ q)

),�(u↔�r) → ¬u ∨ q

�(r↔ (p ∧ q)

),�(u↔�r),�(v↔¬u) → v ∨ q

�(r↔ (p ∧ q)

),�(u↔�r),�(v↔¬u),�

(w↔ (v ∨ q)

)→ w

�(r↔ (p ∧ q)

),�(u↔�r),�(v↔¬u),�

(w↔ (v ∨ q)

),¬w →

Now formulas in antecedent can be changed into the needed form accord-ing to the proofs above:

�(¬r ∨ p),�(¬r ∨ q),�(¬p ∨ ¬q ∨ r),�(¬u ∨�r),�(♦¬r ∨ u),�(¬v ∨ ¬u),�(v ∨ u),�(¬w ∨ v ∨ q),�(¬v ∨ w),�(¬q ∨ w),¬w →

4.7 Knowledge logics

Logics S5 is often called knowledge or epistemic logic (gr. επιστημη, epistēmē— knowledge). Notation �F is read as agent knows that F . Axioms (T),(4) and (5) are interpreted as follows:

• Axiom (T): �F ⊃F — knowledge or truth axiom ([1]). If agent knowsthat F , then F is true. I.e. all the knowledge of the agent is correct.This axiom is used to distinguish knowledge from belief.

• Axiom (4): �F ⊃��F — positive introspection. If agent knows, thatF , then he (or it) knows that he knows the fact.

• Axiom (5): �F ⊃ �♦F — negative introspection. This formula isequivalent to ¬�F ⊃�¬�F . If agent does not know if F is true, thenhe knows that he doesn’t know the fact. If the knowledge of humans isdiscussed, it is very likely that this axiom doesn’t hold ([11]), howeverit usually holds if knowledge of machines is analysed.

In 1957 S. Kanger presented indexed sequent calculus for knowledge logic.Indexes are natural numbers and they are applied to propositional variables.If index n ∈ N is applied to propositional variable p, then it is writtenas the top right index: pn. Notation F n means that every propositionalvariable in F is indexed with number n. E.g. if F = �

(p⊃ (q ∨�p)

), then

F 2 = �(p2 ⊃ (q2 ∨�p2)

).

Definition 4.7.1. Sequent calculus for epistemic modal knowledge logic S5(denoted GS5) is obtained from GPC by adding two modal rules:

Fm,�F n,Γ → ∆(�→)

�F n,Γ → ∆Γ → ∆, F k

(→ �)Γ → ∆,�F n

Here m is any natural number, k is a natural number such that the con-clusion doesn’t contain any propositional variable indexed by k that occuroutside the scope of modal operators.

98

Page 101: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Theorem 4.7.2 (Kanger). Formula F is valid in knowledge logic S5 iffsequent → F 1 is derivable in the indexed sequence calculus.

Example 4.7.3. Let’s derive formula �p⊃ ♦�p.

�¬�p1,�p1 → �p1(¬ →)

¬�p1,�¬�p1,�p1 →(�→)

�¬�p1,�p1 →(→ ¬)

�p1 → ¬�¬�p1(→ ⊃)

→ �p1 ⊃ ¬�¬�p1

Example 4.7.4. Let’s derive formula ♦�p⊃�p.

p3,�p2 → p3(�→)

�p2 → p3(→ �)

�p2 → �p1(→ ¬)

→ �p1,¬�p2(→ �)

→ �p1,�¬�p1(¬ →)

¬�¬�p1 → �p1(→ ⊃)

→ ¬�¬�p1 ⊃�p1

Examples 4.7.3 and 4.7.4 proves that in epistemic logic �p ≡ ♦�p.Among other equivalences of S5 there are:

• �♦F ≡ ♦F ;

• �♦�F ≡ ♦�F ;

• ♦�♦F ≡ �♦F .

4.8 Multimodal logic

In modal logic one pair of modality operators � and ♦ is analysed. Mul-timodal logics include a finite number n of such pairs: �1, ♦1, �2, ♦2,…,�n, ♦n. If every modality respects the requirements of monomodal logic K(T, K4, S4,…), then a multimodal logic is called Kn (respectively Tn, K4n,S4n,…).

Definition 4.8.1. A multimodal formula is defined as follows:

• propositional variable is a formula; it is also called atomic formula;

• if F is a formula, then ¬F , �kF and ♦kF (k ∈ [1, n]) are also formulas;

• if F and G are formulas, then (F ∧G), (F ∨G), (F ⊃G) and (F ↔G)are also formulas.

Example 4.8.2. Some formulas of multimodal logic: �1♦2�3(p ⊃ ♦1q),¬p⊃ (♦2p ∨�2q).

99

Page 102: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

To interpret formulas of multimodal logic Kripke structure must containone relation for each pair of modal operators. Thus in total n relations mustbe included.Definition 4.8.3. A Kripke structure of multimodal formula F is a multipleS = 〈W ,R1,R2, . . . ,Rn, ν〉, where:

• W 6= ∅ is some set, called the set of possible worlds.• Ri, i ∈ [1, n] is a binary relation between elements of set W for modal-

ities �i and ♦i.• ν is an interpretation function ν : P ×W → {>,⊥}, where P is a set

of propositional variables of formula F .Hilbert-type and sequent calculi for multimodal logics are obtained from

respective calculi for monomodal logics. Here only calculi for Kn are pre-sented.Definition 4.8.4. Hilbert-type calculus for multimodal logics Kn (denotedHKn) consists of the same axioms and rules as HPC, multimodal NecessityGeneralisation rule (NG l):

F�lF

And axiom (Kl): �l(F ⊃G)⊃ (�lF ⊃�lG).Definition 4.8.5. Gentzen-type calculus for multimodal logics Kn (denotedGKn) is obtained from GPC by adding modal rule:

Γ2 → F(→ �l)Γ1,�lΓ2 → ∆,�lF

It is also possible to transform multimodal logic formula into predicatelogic. More precisely, if F is a formula of multimodal logic Kn, then it ispossible to find a formula of predicate logic Tr(F )x with one free variable xsuch that F is satisfiable in Kn iff Tr(F )x is satisfiable in predicate logic.

[F ]τ is defined in a following way:• Tr(G)x = P (x), if G is a propositional variable, here P is predicate

variable in which propositional variable G is transformed;• Tr(¬G)x = ¬Tr(G)x;• Tr(G ∧H)x = Tr(G)x ∧ Tr(H)x;• Tr(G ∨H)x = Tr(G)x ∨ Tr(H)x;• Tr(G⊃H)x = Tr(G)x ⊃ Tr(H)x;

• Tr(�lG)x = ∀y(Rl(x, y)⊃ Tr(G)y

);

• Tr(♦lG)x = ∃y(Rl(x, y) ∧ Tr(G)y

).

Here k ∈ [i, n], y is a new individual variable. Analogously as describedin Section 4.5 formulas of other multimodal logics can be transformed intopredicate logic.

100

Page 103: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Chapter 5

Temporal logics

5.1 Branching time logics

Temporal logics analyse formulas over time. In different logics such conceptsas always in the future, next time or until can be analysed. There is a widevariety of temporal logics. Most of them are:

• propositional or first-order;• finite or infinite;• linear or branching time;• discrete or continuous;• oriented to the future or to the past and the future.Let’s start with logic CTL (Computation Tree Logic), which is one of

branching time logics. This logic combines quantifiers ∀ and ∃ together withmodal operators � and ♦. Branching times means that future is modelledas a tree. The branches of the tree represent different possible scenariosof the future. Thus quantifiers define the situation in different branches:∀ means in every branch and ∃ means there is a branch. Modal operatorsdefine the future in one branch: � means always in the future and ♦ meansat some time in the future. Moreover, two temporal operators are used: ◦means in the next moment of time and U means until.Definition 5.1.1. A CTL formula is defined in a recursive way:

• > and ⊥ are formulas;• propositional variable is a formula; it is also called atomic formula;• if F is a formula, then ¬F is also a formula;• if F and G are formulas, then (F ∧G), (F ∨G), (F ⊃G) and (F ↔G)

are also formulas;• if F is formula, then ◦F , ♦F and �F are auxiliary formulas;• if F and G are formulas, then (F U G) is auxiliary formula;

101

Page 104: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• if F is auxiliary formula, then ∀F and ∃F are formulas.

As the definition states, expressions ��p and ♦♦p are neither formulasnor auxiliary formulas.

Example 5.1.2. Several formula examples: ∀�∃◦∀(¬p U q), ∀�(p ⊃ q),∃�p, ∃�(p ∨ ∃�q).

To interpret formulas of CTL a modified Kripke structure is used. Let’sdefine it:

Definition 5.1.3. A Kripke structure for CTL formula F is a quadruple〈W , I,R, ν〉, where:

• W 6= ∅ is a set of states;

• I ⊆ W , I 6= ∅ is a set of starting states;

• R is a relation in set W , called transition;

• ν : P ×W → {>,⊥}, where P is a set of propositional variables of F ,is an interpretation function.

It must be noted, that usually only finite Kripke structures are analysed(W must be finite). Moreover, it is usually required that the relation R becomplete. A finite sequence of states s0, s1, . . . , sn is called a path from s0to sn, if siRsi+1, i ∈ [0, n− 1].

Example 5.1.4. Suppose Kripke structure 〈W , I,R, ν〉 is defined as fol-lows: W = {s0, s1}, I = {s0}, R = {(s0, s0), (s0, s1), (s1, s1)} and ν is someinterpretation. Such structure can be represented using graph:

s0 s1

All the possible paths from starting state s0 can be demonstrated usinginfinite tree:

s0

s0

s0

s0

. . . . . .

s1

. . .

s1

s1

. . .

s1

s1

s1

. . .

Now let’s define how the formula is interpreted using Kripke structure.The fact that formula F is true in state s of Kripke structure S is denoted(as usual) S, s � F . To state that auxiliary formula G is true in path π ofKripke structure S a similar notation is used: S, π �G.

102

Page 105: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Definition 5.1.5. Suppose S = 〈W , I,R, ν〉 is a Kripke structure ands ∈ W is some state. The definition of S, s � F is by induction on thestructure of F :

• if F = >, then S, s �F ;• if F = ⊥, then S, s 2F ;• if F is a propositional variable, then S, s �F , iff ν(F, s) = >;• if F = G ∧ H, then S, s � F , iff S, s � G and S, s � H. The cases

when F = ¬G, F = G ∨H, F = G ⊃H and F = G↔H are definedanalogously (see e.g. Definition 4.1.5);

• if F = ∀G, then S, s � F , iff for any path π from s it is true thatS, π �G;

• if F = ∃G, then S, s �F , iff there is a path π from s such that S, π �G;• if F = ◦G and π = s0, s1, . . . , then S, π �F , iff S, s1 �G;• if F = ♦G and π = s0, s1, . . . , then S, π �F , iff there is i ∈ [0,∞) such

that S, si �G;• if F = �G and π = s0, s1, . . . , then S, π � �F , iff S, si � G for anyi ∈ [0,∞);

• if F = G U H and π = s0, s1, . . . , then S, π �F , iff there is i ∈ [0,∞)such that S, si �H and for any j ∈ [0, i) it is true that S, sj �G;

Thus now the meaning of quantifiers and temporal operators can beexplained in more detail:

• ∃◦ — there is a path such that in its next state formula is true;• ∀◦ — for any path in its next state formula is true;• ∃♦ — there is a path which contains a state in which formula is true;• ∀♦ — in any path there is a state in which formula is true;• ∃� — there is a path such that in its every state formula is true;• ∀� — for any path in every state formula is true;• ∃U — there is a path such that until some state formula is true;• ∀U — for any path there is a state until which formula is true;These situations can be illustrated by following diagrams:

∃◦p

. . . . . . . . . . . .

p

. . . . . .

∀◦p

p

. . . . . .

p

. . . . . .

p

. . . . . .

103

Page 106: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

∃♦p

. . . . . .

p

. . . . . . . . . . . .

∀♦p

p

. . . . . .

p

. . .

p

. . .

p

. . . . . .

∃�p; p

. . . . . .

p

p

. . . . . . . . . . . .

∀�p; p

p

p

. . .

p

. . .

p

p

. . .

p

. . .

p

p

. . .

p

. . .

∃(p U q); p

. . . . . .

p

. . .

q

. . . . . . . . .

∀(p U q); p

p

q

. . .

q

. . .

p

q

. . .

q

. . .

q

. . . . . .

Definition 5.1.6. It is said that formula F is true in Kripke structureS = 〈W , I,R, ν〉 (denoted S � F ) if for any starting state s ∈ I it is truethat S, s �F .

Definition 5.1.7. It is said that formulas F and G are equivalent if for anyKripke structure S it is true that S �F iff S �G.

Logic CTL is decidable.

5.2 Linear Temporal logic

5.2.1 Syntax and semantics

Propositional Linear Temporal Logic (denoted PLTL) is obtained by en-riching propositional logic with temporal operators ◦, ♦, � and U .

Definition 5.2.1. A PLTL formula is defined in a recursive way:

• > and ⊥ are formulas;

• propositional variable is a formula; it is also called atomic formula;

• if F is a formula, then ¬F , ◦F , �F and ♦F are also formulas;

104

Page 107: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• if F and G are formulas, then (F ∨G), (F ∧G), (F ⊃G), (F↔G) and(F U G) are also formulas.

Example 5.2.2. The following expressions are PLTL formulas: �(p ∨ ◦q),�◦

(♦¬q ⊃ (p U q)

), ¬♦p⊃ ◦♦¬p.

In contrast to branching time, linear time means that time doesn’t branchand only one possible future is analysed. Thus it is interpreted using aKripke structure with discrete linear (every element has exactly one nextelement), reflexive and transitive relation. More precisely:

Definition 5.2.3. A Kripke structure of PLTL formula F is a pair 〈W , ν〉,where:

• W is a sequence of states s0, s1, s2, . . . ;

• ν : P ×W → {>,⊥} is an interpretation function, where P is a set ofpropositional variables of F .

Traditionally the fact that formula F is true in state si of Kripke structureS is denoted as S, si �F .

Definition 5.2.4. Suppose S = 〈W , ν〉 is a Kripke structure, where se-quenceW = s0, s1, . . . and si ∈ W is some state. The definition of S, si �Fis by induction on the structure of F :

• if F = >, then S, si �F ;

• if F = ⊥, then S, si 2F ;

• if F is a propositional variable, then S, si �F , iff ν(p, si) = >;

• if F = ¬G, then S, si �F , iff S, si 2G;

• if F = G ∧H, then S, si �F , iff S, si �G and S, si �H;

• if F = G ∨H, then S, si 2F , iff S, si 2G and S, si 2H;

• if F = G⊃H, then S, si 2F , iff S, si �G and S, si 2H;

• if F = G↔H, then S, si � F , iff S, si �G and S, si �H or S, si 2Gand S, si 2H;

• if F = ◦G, then S, si �F , iff S, si+1 �G;

• if F = �G, then S, si �F , iff for every j > i it is true that S, sj �G;

• if F = ♦G, then S, si �F , iff there is j > i such that S, sj �G;

• if F = G U H, then S, si �F , iff there is j > i such that S, sj �H andfor every k ∈ [i, j) it is true that S, sk �G;

105

Page 108: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Semantics of temporal operators ◦, �, ♦ and U can be explained usingthese schemes:

◦p

p

. . .

�p, p

p

p

p

. . .

♦p

p

. . .

p U q, p

p

q

. . .

It is said that formula of linear temporal logic F is satisfiable if there is aKripke structure S with state si such that S, si �F . It is said that formulaof linear temporal logic is valid (denoted � F ) if it is true in any state ofany interpretation.

Example 5.2.5. Formula �♦q is satisfiable in PLTL. To show that it isenough to find a Kripke structure with infinite set of states in which q istrue. It can be noted that sequence of states in every Kripke structureis the same, thus it is enough to define an interpretation function. Onesuch interpretation function is: ν(q, si) = > iff i is a prime number. Itis easy to see that formula �♦q is true in Kripke structure 〈W , ν〉, whereW = s0, s1, . . . .

Example 5.2.6. Formula �(p⊃ ◦(q U r)

)is satisfiable in PLTL. To show

that it is enough to find a Kripke structure, which has such property: if p istrue in some state si, then starting next state si+1 variable q must be truein all the states up to some state sj, j > i, in which r is true. Of course thesimplest solution is to define an interpretation function in a following way:ν(p, si) = ⊥ for any state si of the Kripke structure. It doesn’t matter whatis the interpretation of propositional variables q and r.

The following formulas are valid in PLTL:

1. �F ⊃ F ;

2. �F ↔��F ;

3. ◦F ↔¬◦¬F ;

Here F is any formula of linear temporal logics. Formula 1 describes reflex-ivity of the structure, formula 2 — transitivity and formula 3 — linearity.

Sometimes in linear temporal logics another operator R, called release,is also used. This operator is dual to operator until: F RG ≡ ¬(¬F U ¬G).Moreover, ♦F ≡ > U F and �F ≡ ⊥R F . Thus for any formula of lineartemporal logic it is possible to find an equivalent formula, in which onlyoperators ¬, ∨, ◦ and U occur.

106

Page 109: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

5.2.2 Hilbert-type calculus

Definition 5.2.7. Hilbert-type calculus for linear temporal logics (denotedHPLTLo) consists of the same axioms and rules as HPC, Necessity Gener-alisation rule (NG):

F�F

And axioms for temporal operators:

5.1 . �(F ⊃G)⊃ (�F ⊃�G);

5.2 . ◦¬F ⊃ ¬◦F ;

5.3 . ¬◦F ⊃ ◦¬F ;

5.4 . ◦(F ⊃G)⊃ (◦F ⊃ ◦G);

5.5 . �F ⊃ (F ∧ ◦�F );

5.6 . �(F ⊃ ◦F )⊃ (F ⊃�F );

5.7 . (F U G)⊃ ♦G;

5.8 . (F U G)⊃(G ∨

(F ∧ ◦(F U G)

));

5.9 .(G ∨

(F ∧ ◦(F U G)

))⊃ (F U G);

D. Gabbay in 1980 proved the soundness and completeness of this calcu-lus.

In linear temporal logic as well as in modal logic the following statementis true:

Lemma 5.2.8. If F (p1, p2, . . . , pn) is valid formula of propositional logic,G1, G2, . . . , Gn are some formulas of linear temporal logic, then formulaF (G1, G2, . . . , Gn) is valid in linear temporal logic.

Example 5.2.9. ¬¬p ⊃ p is valid formula of propositional logic, therefore¬¬�♦q ⊃�♦q is valid formula of linear temporal logic.

Formula p ⊃ (q ⊃ p) is valid in propositional logic, therefore formula(♦p⊃�q)⊃

(◦q ⊃ (♦p⊃�q)

)is valid in PLTL.

Derivation search in calculus HPLTLo is quite difficult, therefore in prac-tice usually a similar calculus (denoted HPLTL1) is used, which composesof axioms 5.1 — 5.9, rules MP, NG and a new rule, called substitution(SUB):

F (p1, p2, . . . , pn)F (G1, G2, . . . , Gn)

107

Page 110: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

In this rule F (p1, p2, . . . , pn) is some valid formula of propositional logicsand G1, G2, . . . , Gn — are some formulas or linear temporal logic.

For convenience let’s include three more rules into calculus:F ⊃G�F ⊃�G

F ⊃G◦F ⊃ ◦G

F ⊃ ◦FF ⊃�F

Let’s name these additional rules AD1, AD2 and AD3 respectively andlet’s denote the resulting calculus HPLTL2. It is easy to prove that theserules are admissible in calculus HPLTL1, thus every formula is derivable inHPLTL2 iff it is derivable in HPLTL1.

Let’s show some examples of derivation in calculus HPLTL2.

Example 5.2.10. Derivation of formula �p⊃��p:1.(p⊃ (q ∧ r)

)⊃ (p⊃ r) Valid formula of propositional logic.

2.(�p⊃ (p ∧ ◦�p)

)⊃ (�p⊃ ◦�p) SUB rule from 1, {�p/p, p/q, ◦�p/r}.

3. �p⊃ (p ∧ ◦�p) Axiom 5.5, {p/F}.4. �p⊃ ◦�p MP rule from 3 and 2.5. �p⊃��p AD3 rule from 4.

Example 5.2.11. Derivation of formula ◦p⊃ ¬◦¬p:1. (p⊃ q)⊃ (¬q ⊃ ¬p) Valid formula of propositional logic.2. (◦¬p⊃ ¬◦p)⊃ (¬¬◦p⊃ ¬◦¬p) SUB rule from 1, {◦¬p/p, ¬◦p/q}.3. ◦¬p⊃ ¬◦p Axiom 5.2, {p/F}.4. ¬¬◦p⊃ ¬◦¬p MP rule from 3 and 2.5. (¬¬p⊃ q)⊃ (p⊃ q) Valid formula of propositional logic.6. (¬¬◦p⊃ ¬◦¬p)⊃ (◦p⊃ ¬◦¬p) SUB rule from 5, {◦p/p, ¬◦¬p/q}.7. ◦p⊃ ¬◦¬p MP rule from 4 and 6.

Some equivalences of PLTL are:

• ◦(F ∧G) ≡ ◦F ∧ ◦G;

• ¬◦F ≡ ◦¬F ;

• ¬�F ≡ ♦¬F ;

• �F ≡ F ∧ ◦�F ;

• ♦F ≡ F ∨ ◦♦F ;

• F U G ≡ G ∨(F ∧ ◦(F U G)

).

5.2.3 Sequent calculus

In 2007 J. Gaintzarian, M. Hermo and others defined a sequent calculuswithout cut [3]. This calculus can be applied to formulas, that do notcontain logical operators ∧, �, ♦ and logical constant >. However, everyformula can be transformed into such form using following equivalences:

• F ∧G ≡ ¬(¬F ∨ ¬G);

• F ⊃G ≡ ¬F ∨G;

108

Page 111: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• �F ≡ ¬♦¬F ;• ♦F ≡ > U F ;• > ≡ ¬⊥.Furthermore, succedent of every sequent in this calculus consist of exactly

one formula.Definition 5.2.12. A sequent calculus for PLTL (denoted GPLTL) consistsof axiom F,Γ → F and following rules:

Logical rules:Γ → F (¬ →)

¬F,Γ → HF,Γ → ⊥

(→ ¬)Γ → ¬F

F,Γ → H G,Γ → H(∨ →)

F ∨G,Γ → H

Γ → F (→ ∨)1Γ → F ∨GΓ → G (→ ∨)2Γ → F ∨G

Temporal rules:Γ1 → F

(→ ◦)◦Γ1,Γ2 → ◦F

◦¬F,Γ → H(¬◦ →)

¬◦F,Γ → HΓ → ¬◦F (→ ◦¬)Γ → ◦¬F

G,Γ → H F,¬G, ◦(F U G),Γ → H(U →)1

F U G,Γ → H

G,Γ → H F,¬G, ◦((F ∧ (¬Γ∨ ∨H)

)U G

),Γ → H

(U →)2F U G,Γ → H

Here ¬Γ∨ is a disjunction of the negations of formulas from Γ. E.g. ifΓ = F1, F2, . . . , Fn, then ¬Γ∨ = ¬F1 ∨ ¬F2 ∨ . . . ∨ ¬Fn. If Γ = ∅, then¬Γ∨ = ⊥.

¬F,Γ → G F,¬◦(F U G),Γ → G(→ U)Γ → F U G

Structural rules:Γ1 → H

(w →)Γ1,Γ2 → H¬F,Γ → ⊥

(→ t)Γ → FΓ → ◦⊥ (◦⊥)Γ → F

Rule (w →) is called weakening and rule (→ t) is called transfer.For convenience, sequents Γ, F,¬F → H and Γ,⊥ → H are also consid-

ered as axioms. These sequents are derivable in GPLTL.The following rules are also admissible in GPLTL:¬G,Γ → F¬F,Γ → G

G,Γ → F¬F,Γ → ¬G

F,Γ → H¬¬F,Γ → H

Γ → ⊥◦Γ → F

109

Page 112: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

5.3 Finite linear temporal logic

5.3.1 Syntax and semantics

In finite linear temporal logic, contrary to PLTL, time is finite. Thatis, Kripke structure contains only finite number of states. However, bothpresent and past is analysed. Together with temporal operators of PLTL(� — always in the future, ♦ — sometime in the future, ◦ — in the nextmoment of time), new temporal operators are used:

←� — always in the

past,←♦ — sometime in the past, ←◦ — in the previous moment of time, �—

certainly in the next moment of time,←�— certainly in the previous moment

of time.

Definition 5.3.1. Formula of finite linear temporal logic is defined as fol-lows:

propositional variable is a formula; it is also called atomic formula;

if F is a formula, then ¬F , ◦F , ←◦F , �F ,←�F , �F ,

←�F , ♦F and

←♦F are

also formulas;

if F and G are formulas, then (F ∨G) and (F ∧G) are also formulas

As it can be noticed from the definition, operation ⊃ and↔ are not used.They can be replaced by ¬, ∧ and ∨. Moreover, usually just formulas inwhich negation occurs only in front of propositional variables are analysed.Such form can always be obtained using the following equivalences:

¬◦F ≡ �¬F ¬�F ≡ ◦¬F ¬�F ≡ ♦¬F ¬♦F ≡ �¬F¬←◦F ≡

←�¬F ¬

←�F ≡ ←◦¬F ¬

←�F ≡

←♦¬F ¬

←♦F ≡

←�¬F

As it was mentioned earlier, time is finite in such logic. To definetime, a time structure is used. A time structure is a finite sequence ofstates s0, s1, . . . , sn. For convenience, notation s0 < s1 < · · · < sn andsi + k = si+k, where i ∈ [0, n − k] is used. Similarly si − k = si−k, wherei ∈ [k, n]. A time structure is used in Kripke structure:

Definition 5.3.2. A Kripke structure for finite linear temporal logic formulaF is a pair 〈W , ν〉, where:

• W is some time structure;

• ν : P × W → {>,⊥}, where P is a set of propositional variables offormula F , is an interpretation function.

The fact that formula F is true in state s of structure S is denotedS, s �F and it is defined in a similar way as for other temporal logics:

110

Page 113: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Definition 5.3.3. Suppose S = 〈W , ν〉 is a Kripke structure for finitelinear temporal logic and s ∈ W is some state. A definition of S, s � F isby induction on the form of formula F :

• if F is a propositional variable, then S, s �F iff ν(F, s) = >;

• if F = ¬G, F = G∧H or F = G∨H, then the definition is analogousto PLTL case in Definition 5.2.4;

• if F = �G, then S, s � F iff for all s′ ∈ W such that s′ > s it is truethat S, s′ �G;

• if F = ♦G, then S, s � F iff there is s′ ∈ W such that s′ > s andS, s′ �G;

• if F =←�G, then S, s � F iff for all s′ ∈ W such that s′ 6 s it is true

that S, s′ �G;

• if F =←♦G, then S, s � F iff there is s′ ∈ W such that s′ 6 s and

S, s′ �G;

• if F = ◦G, then S, s �F iff s + 1 /∈ W (i.e. if W = s0, s1, . . . , sn, thens = sn) or S, s+ 1 �G;

• if F = �G, then S, s �F iff s+ 1 ∈ W (i.e. s 6= sn) and S, s+ 1 �G;

• if F = ←◦G, then S, s �F iff s− 1 /∈ W (i.e. s = s0) or S, s− 1 �G;

• if F =←�G, then S, s �F iff s− 1 ∈ W (i.e. s 6= s0) and S, s− 1 �G.

It is said that formula F is true in Kripke structure S = 〈W , ν〉 (denotedS � F ), where W = s0, s1, . . . , sn, iff F is true in initial state s0. Formulais satisfiable, if there is a Kripke structure in which the formula is true.Formula is valid, if it is true in every Kripke structure.

5.3.2 Tableaux calculus

Once again although the method is similar to the ones presented in Sections2.6 and 4.4, however the expressions used in the method differs. In tableauxcalculus for finite linear temporal logic expressions of the form s : F ||{δ}are analysed. Here s is a state and δ is restriction of the states. A set ofall the restrictions in the branch from root to the current node is denotedas ∆. If an application of the rule does not add a new restriction, then theexpression of the form s : F is presented.

Restrictions are used to decide if the rule can be applied and also to checkif the branch is closed. Moreover, expressions of the form ∆ ` δ are used.This means that from set of restrictions ∆ a restriction δ is derivable. Allthe restrictions used here are comparisons of two states, including operators

111

Page 114: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

=, < and 6. Thus the derivability is understood in traditional arithmeticsense. Several examples are:

• if δ ∈ ∆, then ∆ ` δ;

• ∆ ` s = s;

• if ∆ ` s1 < s2 and ∆ ` s2 < s3, then also ∆ ` s1 < s3 (the same appliesfor operators = and 6);

• if ∆ ` s1 = s2 or ∆ ` s1 < s2, then also ∆ ` s1 6 s2;

• if ∆ ` s1 = s2 + 1, then ∆ ` s2 < s1.It is said that set ∆ is contradictory if:

• ∆ ` s1 < s2 and ∆ ` s2 = s1 or

• ∆ ` s1 < s2 and ∆ ` s2 < s1 or

• ∆ ` s1 < s2 and ∆ ` s2 6 s1.Definition 5.3.4. Tableaux calculus for finite linear temporal logic (de-noted TFLTL) contains the following rules:

s : F ∧Gs : Fs : G

s : F ∨Gs : F | s : G

s : �Fs+ : F

s :←�F

s− : F

The rule to s : �F can be applied if ∆ ` s 6 s+ and the rule to s :←�F

can be applied if ∆ ` s− 6 s.s : ♦F

s′ : F ||{s 6 s′}s : ◦F

s′ : F ||{s′ = s+ 1}s : �F

s′ : F ||{s′ = s+ 1}s :←♦F

s′ : F ||{s′ 6 s}s : ←◦F

s′ : F ||{s = s′ + 1}s :←�F

s′ : F ||{s = s′ + 1}The rule to s : ◦F can be applied if there is s′′ such that ∆ ` s 6 s′′ and

the rule to s : ←◦F can be applied if there is s′′ such that ∆ ` s′′ 6 s. In allthe rules s′ is a new state.

s : Fs : F ||{s < s′} | s : F ||{s = s′} | s : F ||{s′ < s}

This rule is called sync.Definition 5.3.5. It is said that a branch of a derivation search tree isclosed if at least one of the following conditions is satisfied:

• set of restrictions ∆ is contradictory;

• in the branch there are two expressions s′ : F and s′′ : ¬F such that∆ ` s′ = s′′;

• in the branch there is an expression s : F such that ∆ ` s < s0, wheres0 is the initial state.

If a branch is not closed, then it is open.

112

Page 115: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Definition 5.3.6. State s in a branch of a derivation search tree is expandedif all the following conditions are satisfied:

• for every expression s : F ∧G that occurs in the branch and every states′ such that ∆ ` s = s′ expressions s′ : F and s′ : G also occur in thebranch;

• for every expression s : F ∨G that occurs in the branch and every states′ such that ∆ ` s = s′ at least one of expressions s′ : F or s′ : G alsooccurs in the branch;

• for every expression s : �F that occurs in the branch and every states′ such that ∆ ` s 6 s′ expression s′ : F also occurs in the branch;

• for every expression s :←�F that occurs in the branch and every state

s′ such that ∆ ` s′ 6 s expression s′ : F also occurs in the branch;

• for every expression s : ♦F there is s′ such that ∆ ` s 6 s′ andexpression s′ : F also occurs in the branch;

• for every expression s :←♦F there is s′ such that ∆ ` s′ 6 s and

expression s′ : F also occurs in the branch;

• for every expression s : ◦F if ∆ ` s < s′′ for some s′′, then there is s′such that ∆ ` s′ = s+1 and expression s′ : F also occurs in the branch;

• for every expression s : ←◦F if ∆ ` s′′ < s for some s′′, then there is s′such that ∆ ` s = s′+1 and expression s′ : F also occurs in the branch;

• for every expression s : �F there is s′ such that ∆ ` s′ = s + 1 andexpression s′ : F also occurs in the branch;

• for every expression s : ←◦F there is s′ such that ∆ ` s = s′ + 1 andexpression s′ : F also occurs in the branch.

A branch is said to be expanded if all the states that occur in the branchare expanded and set ∆ is fully ordered (i.e. for any two states s1 and s2that are part of ∆ either ∆ ` s1 < s2 or ∆ ` s1 = s2 or ∆ ` s2 < s1).

Calculus TFLTL can be used to check the validity of formula. FormulaF is valid iff it is possible to construct a derivation tree in calculus TFLTLof formula ¬F , in which every branch is closed. However S. Cerrito andM. Cialdea in 1997 described how TFLTL can be used to find a model offormula. A branch of derivation search tree of formula F is a model offormula F iff it is open and expanded.

113

Page 116: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 5.3.7. Let’s find a model of formula �♦p:s0 : �♦ps0 : ♦p

s1 : p||{s0 6 s1}s1 : ♦p

s1 < s0closed

s1 = s0open, expanded

s0 < s1open, expanded

One branch is closed, because s0 6 s1 contradicts to s1 < s0 and thus ∆is contradictory. However two other branches are open and expanded. Thisresults in two models. The middle branch suggests a model with one statein which p is true. And the second branch gives a model with two statess0 < s1 such that p is true in s1. The value of p in s0 can be either true orfalse.

5.3.3 Planning problem

Let’s describe how finite linear temporal logic can be used to solve planningproblems. Suppose that the data of the problem and the goal are describedusing formulas of propositional logic. Next, the actions, that can be per-formed if certain conditions are met, are presented. Conditions are alsodefined using formulas of propositional logic.

The solution must provide a finite sequence of actions, that must be per-formed (and the order of the actions) to achieve the goal. If it is impossibleto solve the problem (i.e. to achieve the goal using defined actions withgiven initial conditions), then the result must be a failure.

To define the problem, formulas of temporal logic with operators �, ♦and ◦ are used.

The initial condition is described using some formula of propositionallogic.

The goal is defined using formula ♦G, where G is formula of propositionallogic. The meaning is some time in the future G will hold.

The actions are defined using formulas of the form �(G⊃ do(a)

), where

G is a formula of propositional logic and a is an action, which can beperformed. The meaning is any time, if condition G holds, action a can beperformed.

In the result of performing an action, some changes in the data occur.They are defined using formula of the form �

(do(a) ⊃ ◦G

). Here G is a

formula of propositional logic and a is an action, which was performed. Themeaning is any time, when action a have been performed, condition G holds.

Restrictions are presented as formulas of the form �G. The meaning isany time G holds.

114

Page 117: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

In some cases incompatibility axioms must also be included. They are ofthe following form:

�(

do(a)⊃(¬ do(a1) ∧ ¬ do(a2) ∧ . . . ∧ ¬ do(an)

))The result is a sequence do(a1), do(a2), . . . , do(am) or failure. If the so-

lution was found, then it is clear that it is possible to reach the goal in mactions.

115

Page 118: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Chapter 6

Hybrid logic

6.1 Introduction

In 1990 P. Blackburn introduced a concept of nominal — the name of thenode. The set of nominals N = {i, j, . . . } differs from the set of proposi-tional variables P = {p, q, . . . }. The same nominal can not denote severalnodes. Nominals are also considered as atomic formulas, therefore expres-sion

(�1(i ∧ p) ⊃ �2(i ∧ q)

)⊃ ♦1(¬p ∨ ¬q) is also a hybrid formula. As

it can be seen from this formula, nominals are usually incorporated intomultimodal logic. For that purpose in most cases logic Kn is used.

Statement in node i formula F is true is denoted @iF . Operator @ iscalled satisfaction operator. It satisfies the following conditions:

• distributivity: @i(F ⊃G)⊃ (@iF ⊃@iG);

• necessity: if `F , then `@iF ;

• autoduality: @iF ≡ ¬@i¬F .

Hybrid logic can be used to analyse structured data. Let’s explain thiswith an example:

Example 6.1.1. Suppose a database of library is presented in an XMLdocument. Only a small extract is presented here:

<journal><publisher>Springer</publisher><name>Lithuanian Mathematical Journal</name>

</journal>

<book><author>Huth</author><author>Ryan</author><year>2004</year><name>Logic in Computer Science</name>

</book>

116

Page 119: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

<book><author>Ben-Ari</author><year>2003</year><name>Mathematical Logic for Computer Science</name>

</book>

This XML can be presented as a tree:Springer

b Lithuanian Mathematical Journal

Huth

Ryan

a c 2004

Logic in Computer Science

Ben-Ari

d 2003

Mathematical Logic for Computer Science

publishername

journal

book

book

authorauthor

yearname

authoryear

name

For analysis of this data formulas of hybrid logic can be used. E.g.�author¬Kanger is true in node b, because Kanger is not among the authorsof the book, defined in the node. Formula �journal�nameLMJ (LMJ standsfor Lithuanian Mathematical Journal) is true in node a. In node c formula♦year> is true, because there is an edge from c called year. For the samereason, formula @a�book(♦author> ∨ ♦publisher>) is true. Statement everybook has at least one author can be defined with formula @a�book♦author>.

6.2 Hybrid logic H(@, ↓)

It was already mentioned that formulas of hybrid logics may contain propo-sitional variables as well as nominals. Hybrid logic H(@, ↓) defines anotheroperator ↓, called bounding operator. This operator marks the current stateby some variable, which can be used later in the formula to denote themarked world. Thus another set of symbols is needed — set of nominalvariables X = {x, y, z, . . . }.Definition 6.2.1. A Formula of hybrid logic H(@, ↓) is defined as follows:

• a propositional variable, nominal or nominal variable is a formula; it isalso called atomic formula;

• if F is a formula, then ¬F , �kF and ♦kF are also formulas;• if F and G are formulas, then (F ∧G), (F ∨G), (F ⊃G) and (F ↔G)

are also formulas;

117

Page 120: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• if i is a nominal and F is a formula, then @iF is also a formula;• if x is a nominal variable and F is a formula, then @xF and ↓x.F are

also formulas.A Kripke structure for hybrid logic is defined in a similar way as the one

for multimodal logic in Definition 4.8.3.Definition 6.2.2. A Kripke structure for hybrid logic formula F is a mul-tiple 〈W ,R1,R2, . . . ,Rn, ν〉, where:

• W is a non empty set of worlds (states);• Ri, i ∈ [1, n] is a binary relation in set W for modalities �i and ♦i;• ν : (P ∪ N ) × W → {>,⊥} is an interpretation function such that

every nominal is true in one world of W only (i.e. suppose i ∈ N is anominal, w ∈ W is some world and ν(i, w) = >, then for every otherw′ ∈ W , w′ 6= w it is true that ν(i, w′) = ⊥).

Additionally, to define, when hybrid formula is true, an assignment func-tion is used. The fact that formula F is true in world w of structure S withassignment function g is denoted S, g, w � F . An assignment function (orsimply assignment) g : X → W is a function that assigns a world to everynominal variable. A variant gxw of assignment g, where x ∈ X and w ∈ W ,is defined as follows:

gxw(y) ={w if y = xg(y) if y 6= x

Definition 6.2.3. Suppose S = 〈W ,R1,R2, . . . ,Rn, ν〉 is a Kripke struc-ture for formula F , w ∈ W is some world and g is some assignment function.Now S, g, w �F is defined recursively:

• if F is a propositional variable or a nominal (i.e. F ∈ P or F ∈ N ),then S, g, w �F iff ν(F,w) = >;

• if F is a nominal variable (i.e. F ∈ X ), then S, g, w �F iff g(x) = w;• if F = ¬G, then S, g, w �F iff S, g, w 2G;• if F = G ∧H, then S, g, w �F iff S, g, w �G and S, g, w �H;• if F = G ∨H, then S, g, w 2F iff S, g, w 2G and S, g, w 2H;• if F = G⊃H, then S, g, w 2F iff S, g, w �G and S, g, w 2H;• if F = G↔ H, then S, g, w � F iff S, g, w � G and S, g, w � H orS, g, w 2G and S, g, w 2H;

• if F = �lG, l ∈ [1, n], then S, g, w � F iff for every w′ ∈ W such thatwRlw

′ it is true that S, g, w′ �G;• if F = ♦lG, l ∈ [1, n], then S, g, w � F iff there is w′ ∈ W such thatwRlw

′ and S, g, w′ �G;

118

Page 121: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

• if F = @iG, i ∈ N and ν(i, w′) = >, then S, g, w �F iff S, g, w′ �G;

• if F = @xG where x ∈ X , then S, g, w �F iff S, g, g(x) �G;

• if F = ↓x.G, then S, g, w �F iff S, gxw, w �G;

Example 6.2.4. Let’s define several properties of relations using hybridlogic formulas:

• Irreflexivity: @x¬♦lx or ↓x.�l¬x;

• Asymmetry: @x¬♦l♦lx or ↓x.�l�l¬x;

• Antisymmetry: @x�l(♦lx⊃ x) or ↓x.�l(♦lx⊃ x);

• Transitivity: @x(♦l♦lx⊃ ♦lx) or ↓x.�l�l↓y.@x♦ly;

• Density1: @x♦lx⊃ ♦l♦lx or ↓x.�l↓y.@x♦l♦ly;

• Trichotomy2: @x♦ly ∨@xy ∨@y♦lx

6.3 Relation to predicate logic

Formulas of hybrid logic H(@, ↓) can be transformed in to predicate logic inthe similar manner as formulas of modal (or multimodal logic). That is, forevery formula F of H(@, ↓) it is possible to find formula Tr(F )x with onefree variable x such that F is satisfiable in H(@, ↓) iff Tr(F )x is satisfiablein predicate logic with equality predicate. Let’s describe the algorithm:

• Tr(F )x = (x = F ), if F ∈ N or F ∈ X ;

• Tr(F )x = P (x), if F ∈ P , here P is predicate variable that correspondsto propositional variable F ;

• Tr(¬G)x = ¬Tr(G)x;

• Tr(G ∧H)x = Tr(G)x ∧ Tr(H)x;

• Tr(G ∨H)x = Tr(G)x ∨ Tr(H)x;

• Tr(G⊃H)x = Tr(G)x ⊃ Tr(H)x;

• Tr(�kG)x = ∀z(Rk(x, z)⊃ Tr(G)z

);

• Tr(♦kG)x = ∃z(Rk(x, z) ∧ Tr(G)z

);

• Tr(@yG)x = Tr(G)y, if y ∈ N or y ∈ X ;

• Tr(↓y.G)x = Tr(G)x{x/y}, here {x/y} is a substitution.

Here z is a new variable.1∀x∀y

(Rk(x, y)⊃ ∃z

(Rk(x, z) ∧Rk(z, y)

))2∀x∀y

(Rk(x, y) ∨ (x = y) ∨Rk(y, x)

)119

Page 122: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Example 6.3.1. Let’s transform formula ↓x.�k�k↓y.@x♦ky (transitivity)into predicate logic:

Tr(↓x.�k�k↓y.@x♦ky)x′ = Tr(�k�k↓y.@x♦ky)x′{x′/x} =

= ∀y′(Rk(x′, y′)⊃ Tr(�k↓y.@x♦ky)y′

){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∀z′

(Rk(y′, z′)⊃ Tr(↓y.@x♦ky)z′

)){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∀z′

(Rk(y′, z′)⊃ Tr(@x♦ky)z′{z′/y}

)){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∀z′

(Rk(y′, z′)⊃ Tr(♦ky)x{z′/y}

)){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∀z′

(Rk(y′, z′)⊃ ∃u

(Rk(x, u) ∧ Tr(y)u

){z′/y}

)){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∀z′

(Rk(y′, z′)⊃ ∃u

(Rk(x, u) ∧ u = y

){z′/y}

)){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∀z′

(Rk(y′, z′)⊃ ∃u

(Rk(x, u) ∧ u = z′

))){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∀z′

(Rk(y′, z′)⊃ ∃u

(Rk(x′, u) ∧ u = z′

)))

Example 6.3.2. Let’s transform formula ↓x.�k(♦kx ⊃ x) (antisymmetry)into predicate logic:

Tr(↓x.�k(♦kx⊃ x)

)x′

= Tr(�k(♦kx⊃ x)

)x′{x′/x} =

= ∀y(Rk(x′, y)⊃ Tr(♦kx⊃ x)y

){x′/x} =

= ∀y(Rk(x′, y)⊃

(Tr(♦kx)y ⊃ Tr(x)y

)){x′/x} =

= ∀y(Rk(x′, y)⊃

(∃z(Rk(y, z) ∧ Tr(x)z

)⊃ y = x

)){x′/x} =

= ∀y(Rk(x′, y)⊃

(∃z(Rk(y, z) ∧ z = x

)⊃ y = x

)){x′/x} =

= ∀y(Rk(x′, y)⊃

(∃z(Rk(y, z) ∧ z = x′

)⊃ y = x′

))

Example 6.3.3. Let’s transform formula ↓x.�k↓y.@x♦k♦ky (density) intopredicate logic:

Tr(↓x.�k↓y.@x♦k♦ky)x′ = Tr(�k↓y.@x♦k♦ky)x′{x′/x} =

= ∀y′(Rk(x′, y′)⊃ Tr(↓y.@x♦k♦ky)y′

){x′/x} =

120

Page 123: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

= ∀y′(Rk(x′, y′)⊃ Tr(@x♦k♦ky)y′{y′/y}

){x′/x} =

= ∀y′(Rk(x′, y′)⊃ Tr(♦k♦ky)x{y′/y}

){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∃z

(Rk(x, z) ∧ Tr(♦ky)z

){y′/y}

){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∃z

(Rk(x, z) ∧ ∃u

(Rk(z, u) ∧ Tr(y)u

)){y′/y}

){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∃z

(Rk(x, z) ∧ ∃u

(Rk(z, u) ∧ u = y

)){y′/y}

){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∃z

(Rk(x, z) ∧ ∃u

(Rk(z, u) ∧ u = y′

))){x′/x} =

= ∀y′(Rk(x′, y′)⊃ ∃z

(Rk(x′, z) ∧ ∃u

(Rk(z, u) ∧ u = y′

)))

Let’s analyse another hybrid logic — H(@,∀). In this logic operator ∀ isincluded instead of operator ↓. Formula ∀xF is true, if formula F is true inevery world x of the Kripke structure. In 2000 C. Areces proved that logicH(@,∀) is equivalent to predicate logic with equality predicate. It followsfrom the fact that every predicate logic formula, which contains only one-place and two-place predicate variables can be transformed into H(@,∀).Let the set of one place predicate variables of the formula be P1, P2, . . . andthe set of two-place predicate variables be R1, R2, . . . . Let’s describe thetransformation:

• Tr(Pk(x)

)= @xpk, where p is propositional variable, which represents

predicate variable P ;• Tr

(Rk(x1, x2)

)= @x1♦kx2;

• Tr(x1 = x2) = @x1x2;• Tr(¬F ) = ¬Tr(F );• Tr(F ∧G) = Tr(F ) ∧ Tr(G);• Tr(F ∨G) = Tr(F ) ∨ Tr(G);• Tr(F ⊃G) = Tr(F )⊃ Tr(G);• Tr(∀xF ) = ∀xTr(F );• Tr(∃xF ) = ¬∀x¬Tr(F );Predicate formula F is satisfiable in predicate logic iff formula Tr(F ) is

satisfiable in hybrid logic H(@,∀).The analogous transformation or predicate formulas into hybrid logic

H(@, ↓) is not known, however such transformation is possible for a groupof predicate logic formulas. The analysed formulas may contain individualconstants, equality predicate, one two-place predicate R and any number ofone-place predicates P1, P2, . . . .

121

Page 124: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Definition 6.3.4. A limited formula is defined as follows:• if t is a term (a term is an individual constant or individual variable),

then Pi(t), i ∈ [1,∞) is a limited formula;• if t1 and t2 are terms, then R(t1, t2) and t1 = t2 are limited formulas;• if F is a limited formula, then ¬F is also a limited formula;• if F and G are limited formulas, then (F ∧G) is also a limited formula;• if F is a limited formula, t is a term and x is an individual variable

such that x 6= t, then ∃x(R(t, x) ∧ F

)is also a limited formula.3

In 1999 C. Areces, P. Blackburn and M. Marx described the transforma-tion of limited formulas into hybrid logic H(@, ↓):

• Tr(R(t1, t2)

)= @t1♦t2;

• Tr(Pi(t)

)= @tpi;

• Tr(t1 = t2) = @t1t2;• Tr(¬F ) = ¬Tr(F );• Tr(F ∧G) = Tr(F ) ∧ Tr(G);

• Tr(∃x(R(t, x) ∧ F

))= @t♦↓x.Tr(F ).

Here t1 and t2 are terms, x is a variable.It was proved that any limited formula F is satisfiable in predicate logic

iff Tr(F ) is satisfiable in H(@, ↓).

3Note, that ∃x(

R(x, x) ∧ (x = x))

is not a limited formula.

122

Page 125: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

Bibliography

[1] R. Fagin, J. Y. Halpern, Y. Moses, and M. Y. Vardi. Reasoning AboutKnowledge. The MIT Press, 2003.

[2] R. Feys. Modal Logics. E. Nauwelaerts, Louvain, 1965.[3] J. Gaintzarain, M. Hermo, P. Lucio, M. Navarro, and F. Orejas. A

cut-free and invariant-free sequent calculus for PLTL. In J. Duparcand T. A. Henzinger, (Eds.), Computer Science Logic, volume 4646 ofLecture Notes in Computer Science, pp. 481–495. Springer, 2007.

[4] G. Gentzen. Untersuchungen über das logische Schließen. I. Mathema-tische Zeitschrift, 39, pp. 176–221, 1935.

[5] G. Gentzen. Investigations into logical deduction. American Philo-sophical Quarterly, 1(4), pp. 288–306, 1964. Originally published in[4]. English translation by M.E. Szabo.

[6] R. Goré. Chapter 6: Tableau methods for modal and temporal logics.In M. D’Agostino, D. M. Gabbay, R. Hähnle, and J. Posegga, (Eds.),Handbook of Tableau Methods, pp. 297–396. Kluwer Academic Publish-ers, Dordrecht, 1999.

[7] D. Hilbert. Die Grundlagen der Mathematik. Abhandlungen aus demMathematischen Seminar der Universität Hamburg, 6(1), pp. 65–85,1928.

[8] G. E. Hughes and M. J. Cresswell. An Introduction to Modal Logic.Methuen and Co, London, 1985.

[9] S. Kanger. Provability in logic. Almgvist & Wiksell, Stockholm, 1957.[10] S. C. Kleene. Introduction to Metamathematics. D. van Nostrand Com-

pany Inc., Princeton, New Jersey, 1950.[11] J.-J. C. Meyer and W. van der Hoek. Epistemic Logic for AI and Com-

puter Science, volume 41 of Cambridge Tracts in Theoretical ComputerScience. Cambridge University Press, 1995.

[12] G. F. Shvarts. Gentzen style systems for K45 and K45D. In A. R. Meyerand M. A. Taitslin, (Eds.), Logic at Botic ’89, volume 363 of LectureNotes in Computer Science, pp. 245–256. Springer-Verlag, Pereslavl-Zalessky, 1989.

123

Page 126: Mathematical Logic Lecture Notes - Pradžiajulius/Tools/logika/Konspektas.pdf · In syllogistic only reasonings of the form if F 1 and F 2, then Fare anal-ysed. Here F 1 and F 2 are

[13] A. S. Troelstra and H. Schwichtenberg. Basic Proof Theory. CambridgeUniversity Press, 1996.

124