




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This set of lecture notes has been prepared as a material for a logic course given ... Logical formalisms are applied in many areas of computer science.
Typology: Study notes
1 / 125
This page cannot be seen from the preview
Don't miss anything!





























































































http://www.ida.liu.se/∼andsz
This set of lecture notes is mainly based on the books [BDRS95, BDRS98, DLSS02, Sza92, Sza95] and papers [DLS97, NOS99]. An excellent textbook on mathematical logic is [EFT94]. These sources contain a comprehensive list of the relevant literature.
1.2 Introduction to Logics
Logical formalisms are applied in many areas of computer science. The extensive use of those formalisms resulted in defining hundreds of logics that fit nicely to particular application areas. Let us then first clarify what do we mean by a logic.
Recall first the rˆole of logic in the clarification of human reasoning. In order to make the reasoning fruitful, first of all we have to decide what is the subject of reasoning or, in other words, what are we going to talk about and what language are we going to use. The next step is to associate a precise meaning to basic notions of the language, in order to avoid ambiguities and misunderstandings. Finally we have to state clearly what kind of opinions (sentences) can be formu- lated in the language we deal with and, moreover, which of those opinions are true (valid), and which are false (invalid). Now we can investigate the subject of reasoning via the validity of expressed opinions. Such an abstraction defines a specific logic.
Traditionally, there are two methodologies^1 to introduce a logic:
Both methodologies first require to chose a language that suits best a particular application. Of course we use different vocabulary talking about politics and about computer science. Moreover, we even use different linguistic tools. Logical language is defined by means of basic concepts, formulas and logical connectives or operators. Thus a syntax of the language is to be defined, so that one obtains a precise definition what are well formed sentences or formulas.
Having a language syntax defined, one knows how to “speak” correctly and does not know what do the spoken sentences mean and whether these are true or false. Thus a meaning (also called an interpretation) is to be attached to any well formed formula of the logic. The meaning is given either by the notion of provability, or satisfiability. Namely, a sentence (formula) is considered valid provided that it can be proved (syntactical approach) or it is valid in models accepted as semantical structures (semantical approach).
(^1) And it is often desirable and even necessary to follow both methodologies, assuming that they lead to compatible results.
I find the semantical approach more fundamental and consider the syntactic approach as (still extremely important) tool. Thus logic will always be presented here primarily via the underlying semantics, showing also how various types of proof systems for the logics can be constructed. We then accept the following definition of logic.
Definition 1.2.1 By a logic we shall mean triple L = 〈F, C, |=〉, where:
For I ∈ C and α ∈ F , if I |= α then we say that interpretation I satisfies formula α or I is a model od α. For C′^ ⊆ C and F ′^ ⊆ F , by C′^ |= F ′^ we shall mean that for any interpretation I ∈ C′^ and any formula α ∈ F ′^ we have that I |= α.
A formula is a tautology of L iff for any interpretation I ∈ C, we have that I |= α. A formula is satisfiable iff there is an interpretation I ∈ C, such that I |= α.
Another fundamental notion in logics is that of consequence. Namely, Definition 1.2.1 provides us with a meaning of a formula, but at that abstract level we still do not know what it means that a formula is a consequence of other formulas. In the following definition we clarify the concept.
Definition 1.2.2 Let L = 〈F, C, |=〉 be a logic. Then we say that a formula α ∈ F is a semantic consequence of a set of formulas F ′^ ⊆ F iff for any interpretation I ∈ C we have that
I |= F ′^ implies I |= α.
1.3 Introduction to Proof Systems
Observe that the definition of tautologies does not provide us with any tools for systematically proving that a given formula is indeed a tautology of a given logic or is a consequence of a set of formulas.
One of possible ways of providing such tools is to define suitable proof systems. Traditionally proof systems are often used to define new logic instead of defining them via semantics. Then one immediately obtains tools for proving the validity of formulas.
Hilbert-like axiomatic methods based on proof systems are accepted as a basis for formal and verifiable reasoning about both tautologies and properties of
from sets of formulas, so sequent calculus allows us to derive sequents from other sequents. Moreover, Gentzen- and Hilbert-like proofs go in opposite directions. That is to say, in Hilbert-like systems the formula to be proved is obtained in the final stage of the proof, while in a Gentzen-like proof it is a starting point of the proof. The Gentzen-like (naˆıve) proof procedure can then be formulated as follows, where formula α is to be proved valid.
Start the whole proof from sequent ∅ ⇒ {α}. If the sequent (or all other sequents obtained during derivation, if any) is (are) indecom- posable (i.e. rules are no longer applicable) then check whether all of the final sequents are axioms. If the answer is yes, then α is proved valid, otherwise it is invalid. If some sequent is decomposable then first decompose it and then repeat the described procedure.
Axioms in Gentzen-like proof systems are usually very simple. For instance, any sequent A ⇒ B such that A ∩ B = ∅ is an axiom in many proof systems for tautologies. Derivation rules, however, take the more complicated form S B, where S is a set of sequents and B is a sequent. A rule S B is often denoted
by
Note that Hilbert-like proof systems are easy to use while reasoning about the- ories. One has only to add specific axioms of a theory to axioms of logic and then to apply derivation rules. Many theories do have nice Gentzen-like ax- iomatizations. However, obtaining them is often not a trivial task. Moreover, implementation of Gentzen-like axiomatizations of theories raises new problems and considerably complicates the process of finding proofs.
Let us summarize the above discussion with the following definitions.
Definition 1.3.1 Let L be a logic.
Note that separating axioms from rules in the case of Hilbert-like proof systems is not necessary. Such a separation, however, allows us to treat both Gentzen- and Hilbert-like proof systems uniformly. Note also that axioms and derivation rules are usually given by schemes rather than by specific sequents, formulas or sets. For instance, writing p, p → q q we always think of p and q as variables ranging over set of formulas. Thus the above scheme of rules defines (usually infinitely) many rules that can be obtained by substituting p and q with specific formulas.
Definition 1.3.2 Let P = 〈Ax, C〉 be a Gentzen (Hilbert)-like proof system for logic L. By a proof in P we mean a rooted tree labelled by sequents (formulas) such that
We say that the sequent (formula) s is provable in P iff there is a proof in P with a root labelled by s.
Since we are not going to discuss here applications of Gentzen-style proofs of theories, the next definition concerns Hilbert-like proof systems only.
Definition 1.3.3 Let P = 〈HAx, H〉 be a Hilbert-like proof system for logic L. By a syntactic consequence (w.r.t. P ) of a set of formulas A we mean any formula provable in the proof system 〈HAx ∪ A, H〉. The set of syntactic consequences (w.r.t. P ) of set A is denoted by CP (A).
We conclude this section with an informal discussion of soundness and com- pleteness. As mentioned in the introduction, soundness is always the most fundamental property of any reasonable proof system. Soundness means that all proved conclusions are semantically true. In terms of procedures, one can define soundness as correctness of the procedure implementing the proof system. All the results of the procedure must then be correct. Completeness, however, means that all semantically true conclusions can be obtained as results of the procedure. In other words, soundness means that all answers given by a proof system are correct, while completeness means that all correct answers can be obtained using the proof system. As soundness is then always required, com- pleteness serves as a measure of the quality of proof systems.
According to the methodology described in section 1.2 we first have to decide upon the language we deal with.
Propositional logic is used to investigate properties of complex sentences built from elementary sentences by using propositional connectives like negation, con- junction, disjunction, implication, etc. Whether complex sentences are true or not, depends solely on logical values of elementary sentences involved in them. For example, elementary sentence p implies elementary sentence q if and when p is false or q is true. Thus in classical propositional logic we need a language containing constants denoting truth values, a set of propositional variables that serve to represent elementary sentences, and the set of propositional connectives used to build complex sentences. The sentences (or formulas) of the logic are formed from elementary sentences by applying propositional connectives. The meaning associated with complex sentences is given by valuations of elementary sentences together with a method of calculating values of complex sentences from their components.
Let V 0 be a set of propositional variables (or boolean variables), i.e. variables representing truth values True, False standing for true and false, respectively. The set {True, False} is denoted by Bool. We further assume that truth values are ordered, False ≤ True, and use min(.. .) and max(.. .) to denote minimum and maximum of a given set of truth values.
We build propositional formulas (sentences) from truth values and propositional variables by applying propositional connectives ¬, ∧, ∨, →, ≡, standing for nega-
Any formula can be equivalently transformed into CNF, DNF and NNF. The transformation, into CNF or DNF may exponentially increase the size of the formula, while the transformation into NNF may increase or decrease the size of the formula by a constant factor.
Algorithm 2.3.1 Input: Formula α ∈ F 0.
Output: Formula β ∈ F 0 such that β ≡ α and β is in NNF.
Algorithm: Move negation inside of the formula α using the following rules, until no rule is applicable:
sub-formula substitute by ¬True False ¬False True ¬¬γ γ ¬(α ∨ β) (¬α) ∧ (¬β) ¬(α ∧ β) (¬α) ∨ (¬β) ¬(α → β) α ∧ (¬β) ¬(α ≡ β) [α ∧ (¬β)] ∨ [(¬α) ∧ β]
2.4 The Complexity of Propositional Calculus
Theorem 2.4.1 [Cook] The problem of checking satisfiability of propositional formulas is NPTime-complete. Checking whether a formula is a propositional tautology is a co-NPTime-complete problem.
There are some special cases where the reasoning is in PTime. One of the most interesting cases is provided by the following theorem.
Theorem 2.4.2 The problem of checking satisfiability of propositional Horn clauses is in PTime.
2.5 Exercises