
COMP6463 Overview of Logic and Computation: Propositional Logic Alwen Tiu The Australian National University 2011 Alwen Tiu (ANU) COMP6463 2011 1 / 35 Outline Lecture 1 Introduction to propositional logic: syntax and semantics. Lecture 2 Normal forms and the resolution proof method for unsatisfiability checking. Lecture 3 Efficient representation of boolean functions: Binary Decision Diagram (BDD). Lecture 4 Satisfiability checking: the DP and DPLL algorithms. Lecture 5 Methods for validity checking: the tableaux method and the compactness theorem. Slides will be made available at: http://users.rsise.anu.edu.au/~tiu/teaching/comp6463 Alwen Tiu (ANU) COMP6463 2011 2 / 35 References Most standard textbooks on logic include a chapter on propositional logic,e.g., Michael Huth and Mark Ryan. Logic in Computer Science, Cambridge University Press, 2nd Edition, 2004. A. Aho and J.D. Ullman. Foundations of Computer Science (Chapter 12). Available online for free. http://infolab.stanford.edu/~ullman/focs.html For details of implementation of automated reasoning tools for propositional logic: John Harrison. Handbook of Practical Logic and Automated Reasoning. Cambridge University Press, 2009. Alwen Tiu (ANU) COMP6463 2011 3 / 35 What is propositional logic? Propositional logic is concerned with propositions, i.e., statements which can be either true or false, and compositions of their truth values. Atomic propositions can be any sentences, e.g., I It is raining. I Joe takes his umbrella. I x < 0: I x = 0: These sentences are considered atomic, i.e., the particular subjects/objects they mention are irrelevant. Atomic sentences are denoted by letters, such as, a, b, c, etc. These are called propositional variables. Alwen Tiu (ANU) COMP6463 2011 4 / 35 Composing propositions Atomic propositions can be composed to form complex sentences, e.g., It is raining and Joe takes his umbrella. Or x ≤ 0 or x = 0: We are interested in studying the truth value of the combined propositions, and how their truth can be systematically computed. That is, assuming we know the truth values of atomic propositions, how do we compute or reason about the truth values of their compositions. Alwen Tiu (ANU) COMP6463 2011 5 / 35 Some problems in propositional logic The satisfiability (SAT) problem: given a (complex) formula, how do we assign truth values to the atomic propositions in the formula so that the formula becomes true? The validity problem: is a formula always true no matter how we assign truth values to atomic propositions? E.g., statements like \it is raining or it is not raining" is always true. The unsatisfiability problem: converse of the validity problem. Some statements cannot be made true, e.g., logical paradoxes like 1 \The following statement is true". 2 \The preceding statement is false". Alwen Tiu (ANU) COMP6463 2011 6 / 35 Some applications of propositional logic Propositional logic has many applications in different areas of computer science (apart from digitial circuits design). Complexity: the notion of NP-completeness was motivated by the satisfiability problem. Hardware and software verification: model state transitions of a complex system and its properties as propositional formulae, and use SAT solvers to prove its properties. Automated reasoning: many problems in automated reasoning can be translated into satisfiability problems in propositional logic. Artificial intelligence: knowledge representation, planning and diagnoses. Alwen Tiu (ANU) COMP6463 2011 7 / 35 Syntax vs Semantics One important feature of logic is the separation of the form (syntax) of a symbolic expression and its meaning (semantics). Typically, we are concerned with (i) some particular set of allowed formal expressions, and (ii) their corresponding meanings. The two are connected via an interpretation: Interpretation Expression / Meaning A big part of formal symbolic logic is the study of syntactic manipulation of the forms, independently of the semantics. Alwen Tiu (ANU) COMP6463 2011 8 / 35 The syntax of propositional logic Assume a countably infinite set of propositional variables, denoted by lower case letters, e.g., a, b, p, q, etc., representing atomic propositions. The language of formulae is defined inductively as follows: I > (`true') and ? (`false') are formulae. I Every propositional variable is a formula (also called an atomic formula). I If A is a formula then :A (`not A') is a formula. I If A and B are formulae then so are: I A ^ B (A `and' B), I A _ B (A `or' B), I and A ! B (A `implies' B). A literal is an atomic formula or its negation, e.g., a, :a, c, :c, etc. Assume : has the highest precedence, so :x _ y means (:x) _ y: Alwen Tiu (ANU) COMP6463 2011 9 / 35 Formulae as an inductive data type The set of propositional formulae can be defined as an inductive data type in functional programming languages. A typical definition in Haskell-like language would look like this: data Formula a = False | True | Atom a | Not (Formula a) | And (Formula a) (Formula a) | Or (Formula a) (Formula a) | Imp (Formula a) (Formula a) Alwen Tiu (ANU) COMP6463 2011 10 / 35 Formulae as expression trees A formula can also be viewed as a tree whose leaf nodes are propositional variables and ? and >, and whose internal nodes are logical connectives. Example: the expression tree for (p !:q) _? _ nn @ nn @@ nnn @ nnn @@ nnn @ ! n ? ~ AA ~~ AA ~~ AA ~~ AA p ~ : q Alwen Tiu (ANU) COMP6463 2011 11 / 35 The structural induction principle for formulae A useful proof principle to prove properties of a formula is by structural induction on the formation of the formula. To prove a property P holds for every formula F : Base cases: prove P for atomic formula, > and ?: Inductive cases: I Assuming P holds for A (the induction hypothesis), show that P holds for :A: I Assuming P holds for A and B, show that P holds for A ^ B, A _ B, and A ! B: Alwen Tiu (ANU) COMP6463 2011 12 / 35 Subformulae A formula A is an immediate subformula of B if one of the following holds: I B is :A; I B is A ^ C, or C ^ A, or A _ C, or C _ A, A ! C or C ! A, for some formula C: We write A ≺ B if A is an immediate subformula of B. Let ≺∗ be the transitive closure of ≺ : We say that A is a subformula of B if A ≺∗ B: View as expression trees, A is a subformula of B if A appears as a subtree in B. Alwen Tiu (ANU) COMP6463 2011 13 / 35 Strong induction principle Just as induction on natural numbers, we also have a strong induction principle on formulae, using the subformula relation. To prove a property P holds for every formula F : Base cases: if F is either an atomic formula or > or ?, then prove P for F directly. Inductive cases: otherwise, assuming P holds for every A such that A ≺∗ F , show that P holds for F : Alwen Tiu (ANU) COMP6463 2011 14 / 35 Semantics The meaning of a propositional formula is simply true or false. The truth value of a formula depends on the interpretation of its propositional variables (as truth values). A boolean valuation is a function from the set of propositional variables to truth values, i.e., the set f0; 1g (denoting `false' and `true'). Given a boolean valuation M and a formula F , we write M j= F to denote that M is true under the valuation M, and M 6j= F if F is false under the valuation M: Alwen Tiu (ANU) COMP6463 2011 15 / 35 Semantics The relation j= is defined inductively on the structure of formulae as follows: M j= > ; M 6j= ?: M j= p iff (if and only if) M(p) = 1: M j= :A iff M 6j= A: M j= A ^ B iff M j= A and M j= B: M j= A _ B iff M j= A or M j= B: M j= A ! B iff M 6j= A or M j= B: When M j= F holds, we say that M is a model for F : Alwen Tiu (ANU) COMP6463 2011 16 / 35 Finite model property Let Var(F ) bet the set of propositional variables in F . Then the truth value of F is dependent only on the valuations of Var(F ). Lemma Let F be a formula and let M1 and M2 be two boolean valuations such that M1(p) = M2(p) for every p 2 Var(F ): Then M1 j= F if and only if M2 j= F : Proof. Exercise: prove by structural induction on F . A consequence of this is that we can represent finitely all models of F . Alwen Tiu (ANU) COMP6463 2011 17 / 35 Representing models of a formula Since the truth value of a formula F depends only on the valuation of its propositional variables, a model M of F can be represented by listing the finite mappings on Var(F ). For example, if F = (a ^ b) _ (c ! d) then M = fa 7! 0; b 7! 1; c 7! 1; d 7! 1g is a model of F . Alwen Tiu (ANU) COMP6463 2011 18 / 35 Boolean functions and truth tables An easy way to characterise the semantics of logical connectives is to view them as boolean functions. A boolean variable x is a variable ranging over f0; 1g. We use x; y; z, possibly with subscripts, to denote boolean variables. So a propositional variable is a boolean variable. A boolean function f of n arguments is a function from f0; 1gn to f0; 1g: A boolean function can be defined via a truth table: I the columns correspond to the variables and the output of the function, I the rows of the tables correspond to all possible combination of input and their output.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages35 Page
-
File Size-