Algorithms for the Satisfiability Problem

Total Page:16

File Type:pdf, Size:1020Kb

Algorithms for the Satisfiability Problem Algorithms for the Satisfiability Problem John Franco University of Cincinnati School of Computing Sciences and Informatics Cincinnati, OH [email protected] and Sean Weaver U.S. Department of Defense Ft. George G. Meade, Maryland [email protected] Contents 1 Logic 1 2 Representations and Structures 7 2.1 (0, ±1)Matrix .......................... 8 2.2 Binary Decision Diagrams . 9 2.3 ImplicationGraph ........................ 10 2.4 Propositional Connection Graph . 11 2.5 Variable-Clause Matching Graph . 11 2.6 FormulaDigraph ......................... 11 2.7 SatisfiabilityIndex . 12 2.8 And/InverterGraphs. 13 3 Applications 14 3.1 Consistency Analysis in Scenario Projects . 14 3.2 TestingofVLSICircuits . 17 3.3 Diagnosis of Circuit Faults . 19 3.4 Functional Verification of Hardware Design . 21 3.5 BoundedModelChecking . 25 3.6 Combinational Equivalence Checking . 26 3.7 Transformations to Satisfiability . 27 3.8 Boolean Data Mining . 32 4 General Algorithms 34 4.1 Efficient Transformation to CNF Formulas . 34 4.2 Resolution............................. 41 4.3 ExtendedResolution . 44 4.4 Davis-Putnam Resolution . 44 4.5 Davis-Putnam Loveland Logemann Resolution . 45 4.6 Conflict-Driven Clause Learning . 50 4.6.1 ConflictAnalysis . 50 i 4.6.2 Conflict Clause Memory Management . 51 4.6.3 LazyStructures. 52 4.6.4 CDCLHeuristics . 53 4.6.5 Restarts.......................... 53 4.7 Satisfiability Modulo Theories . 54 4.8 StochasticLocalSearch . 60 4.8.1 Walksat .......................... 60 4.8.2 Novelty Family . 62 4.8.3 Discrete Lagrangian Methods . 63 4.9 Binary Decision Diagrams . 64 4.9.1 Existential Quantification . 67 4.9.2 Reductions and Inferences . 68 4.9.3 Restrict .......................... 71 4.9.4 Generalized Co-factor . 73 4.9.5 Strengthen ........................ 75 4.10 Decompositions .. .. .. .. .. .. .. .. 79 4.10.1 Monotone Decomposition . 79 4.10.2 Autarkies and Safe Assignments . 83 4.11 Branch-and-bound . 85 4.12 AlgebraicMethods . 88 4.12.1 Gr¨obner Bases Applied to SAT . 88 4.12.2 Integer Programming . 94 5 Algorithms for Easy Classes of CNF Formulas 95 5.1 2-SAT ............................... 95 5.2 HornFormulas .......................... 96 5.3 RenamableHornFormulas. 99 5.4 Linear Programming Relaxations . 99 5.5 q-HornFormulas ......................... 103 5.6 Matched Formulas . 105 5.7 Generalized Matched Formulas . 106 ii 5.8 Nested and Extended Nested Satisfiability . 106 5.9 Linear Autark Formulas . 112 5.10 Minimally Unsatisfiable Formulas . 116 5.11 Bounded Resolvent Length Resolution . 123 5.12 ComparisonofClasses . 124 5.13 Probabilistic comparison of incomparable classes. 126 6 Other Topics 129 7 Acknowledgment 130 A Glossary 141 iii Abstract The Satisfiability problem (SAT) has gained considerable attention over the past decade for two reasons. First, the performance of compet- itive SAT solvers has improved enormously due to the implementation of new algorithmic concepts. Second, so many real-world problems that are not naturally expressed as instances of SAT can be transformed to SAT instances and solved relatively efficiently using one of the ever improving SAT solvers or solvers based on SAT. This chapter attempts to clarify these successes by presenting the important advances in SAT algorithm design as well as the classic implementations of SAT solvers. Some applications to which SAT solvers have been successfully applied are also presented. The first section of the chapter presents some logic background and notation that will be necessary to understand and express the algo- rithms presented. The second section presents several representations for SAT instances in preparation for discussing the wide variety of SAT solver implementations that have been tried. The third section presents some applications of SAT. The final two sections presents algorithms for SAT, including search and heuristic algorithms plus systems that use SAT to manage the logic of complex computations. 1 Logic An instance of Satisfiability is a propositional logic expression in Conjunctive Normal Form (CNF), the meaning of which is described in the next few paragraphs. The most elementary object comprising a CNF expression is the Boolean variable, shortened to variable in the context of this chapter. A variable takes one of two values from the set {0, 1}. A variable v may be negated in which case it is denoted ¬v. The value of ¬v is opposite that of v. A literal is either a variable or a negated variable. The term positive literal is used to refer to a variable and the term negative literal is used to refer to a negated variable. The polarity of a literal is positive or negative accordingly. The building blocks of propositional expressions are binary Boolean op- erators. A binary Boolean operator is a function Ob : {0, 1}×{0, 1} → {0, 1}. Often, such functions are presented in tabular form, called truth tables, as illustrated in Figure 10. There are 16 possible binary operators and the most common (and useful) are ∨ (or), ∧ (and), → (implies), ↔ (equivalent), and ⊕ (xor, alternatively exclusive-or). Mappings defining the common opera- tors are shown in Figure 1. The only interesting unary Boolean operator, denoted ¬ (negation), is a mapping from 0 to 1 and 1 to 0. If ¬l is a literal then ¬¬l is the same as l. A formula is a propositional expression consisting of literals, parenthe- ses, and operators which has some semantic content and whose syntax is described recursively as follows: 1. Any single variable is a formula. 2. If ψ is a formula, then so is ¬ψ. 1 Operator Symbol Mapping Or ∨ {00 → 0; 10, 01, 11 → 1} And ∧ {00, 01, 10 → 0; 11 → 1} Implies → {01 → 0; 00, 10, 11 → 1} Equivalent ↔ {01, 10 → 0; 00, 11 → 1} XOR ⊕ {00, 11 → 0; 01, 10 → 1} Table 1: The most common binary Boolean operators and their mappings Operator Symbol Mapping Or ∨ {00 → 0; 10, 01, 11, 1⊥, ⊥1 → 1; 0⊥, ⊥0, ⊥⊥ → ⊥} And ∧ {00, 01, 10 → 0; 11 → 1; ?⊥, ⊥?, ⊥⊥ → ⊥} Implies → {10 → 0; 00, 01, 11, 0⊥ → 1; 1⊥, ⊥? → ⊥} Equivalent ↔ {01, 10 → 0; 00, 11 → 1; ?⊥, ⊥?, ⊥⊥ → ⊥} XOR ⊕ {00, 11 → 0; 01, 10 → 1; ?⊥, ⊥?, ⊥⊥ → ⊥} Negate ¬ {0 → 1; 1 → 0, ⊥ → ⊥} Table 2: Boolean operator mappings with ⊥. Symbol ? means 1 or 0. 3. If ψ1 and ψ2 are both formulas and O is a Boolean binary operator, then (ψ1 O ψ2) is a formula, ψ1 is called the left operand of O, and ψ2 is called the right operand of O. Formulas can be simplified by removing some or all parentheses. Parentheses around nestings involving the same associative operators such as ∨, ∧, and ↔ may be removed. For example, (ψ1 ∨ (ψ2 ∨ ψ3)), ((ψ1 ∨ ψ2) ∨ ψ3), and (ψ1 ∨ ψ2 ∨ ψ3) are considered to be the same formula. In the case of non- associative operators such as →, parentheses may be removed but right associativity is then assumed. The following is an example of a simplified formula: (¬v0 ∨ v1 ∨¬v7) ∧ (¬v2 ∨ v3) ∧ (v0 ∨¬v6 ∨¬v7) ∧ (¬v4 ∨ v5 ∨ v9) A useful parameter associated with a formula is depth. The depth of a formula is determined as follows: 1. The depth of a formula consisting of a single variable is 0. 2. The depth of a formula ¬ψ is the depth of ψ plus 1. 3. The depth of a formula (ψ1 O ψ2) is the maximum of the depth of ψ1 and the depth of ψ2 plus 1. A truth assignment or assignment is a set of variables all of whom have value 1. If M is an assignment and V is a set of variables then, if v ∈ V and v∈ / M, v has value 0. Any assignment of values to the variables of a formula induces a value on the formula. A formula is evaluated from innermost ¬ or parentheses out using mappings associated with the Boolean operators that are found in Table 1. 2 Many algorithms that will be considered later iteratively build assign- ments and it will be necessary to distinguish variables that have been as- signed a value from those that have not been. In such cases, a variable will be allowed to hold a third value, denoted ⊥, which means the variable is unassigned. This requires that the evaluation of operations be augmented to account for ⊥ as shown in Table 2. If M is an assignment of values to a set of variables where at least one variable has value ⊥ then M is said to be a partial assignment. Formulas that are dealt with in this chapter often have many components of the same type which are called clauses. Two common special types of clauses are disjunctive and conjunctive clauses. A disjunctive clause is a formula consisting only of literals and the operator ∨. If all the literals of a clause are negative (positive) then the clause is called a negative clause (respectively, positive clause). In this chapter disjunctive clauses will usually be represented as sets of literals. When it is understood that an object is a disjunctive clause, it will be referred to simply as a clause. The following two lines show the same formula of four clauses expressed, above, in conventional logic notation and, below, as a set of sets of literals. (¬v0 ∨ v1 ∨¬v7) ∧ (¬v2 ∨ v3) ∧ (v0 ∨¬v6 ∨¬v7) ∧ (¬v4 ∨ v5 ∨ v9) {{¬v0, v1, ¬v7}, {¬v2, v3}, {v0, ¬v6, ¬v7}, {¬v4, v5, v9}} A conjunctive clause is a formula consisting only of literals and the operator ∧. A conjunctive clause will also usually be represented as a set of literals and called a clause when it is unambiguous to do so. The number of literals in any clause is referred to as the width of the clause. Often, formulas are expressed in some normal form. Four of the most frequently arising forms are defined as follows. A CNF formula is a formula consisting of a conjunction of two or more disjunctive clauses. Given CNF formula ψ and Lψ, the set of all literals in ψ, a literal l is said to be a pure literal in ψ if l ∈ Lψ but ¬l∈ / Lψ.
Recommended publications
  • A Horn Clause That Implies an Undecidable Set of Horn Clauses ?
    A Horn Clause that Implies an Undecidable Set of Horn Clauses ? Jerzy Marcinkowski Institute of Computer Science University of Wroc law, [email protected] Abstract In this paper we prove that there exists a Horn clause H such that the problem: given a Horn clause G. Is G a consequence of H ? is not recursive. Equivalently, there exists a one-clause PROLOG program such that there is no PROLOG im- plementation answering TRUE if the program implies a given goal and FALSE otherwise. We give a short survey of earlier results concerning clause implication and prove a classical Linial-Post theorem as a consequence of one of them. 1 Introduction 1.1 Introduction Our main interest is the analysis of the decidability of the implication problem H1 =)H2 where H1 and H2 are Horn clauses in the language of the first order logic without equality. We adopt the following taxonomy: A literal is an atomic formula (an atom) or its negation. An atom is of the form Q(t1; t2; : : : tk) where Q is a k-ary predicate symbol and t's are first order terms constructed from function symbols, variables and constants. A clause is a universal closure of a disjunction of literals. A Horn clause (or a program clause) is a clause with at most one positive (i.e. not negated ) literal. A Horn clause with k negative and one positive literal will be called a k-clause (here we do not obey the standard that a k- clause is a disjunction of k literals). A Horn clause can be in the usual way written in an implication form.
    [Show full text]
  • 7. Logic Programming in Prolog
    Artificial Intelligence 7. Logic Programming in Prolog Prof. Bojana Dalbelo Baˇsi´c Assoc. Prof. Jan Snajderˇ University of Zagreb Faculty of Electrical Engineering and Computing Academic Year 2019/2020 Creative Commons Attribution{NonCommercial{NoDerivs 3.0 v1.10 Dalbelo Baˇsi´c, Snajderˇ (UNIZG FER) AI { Logic programming AY 2019/2020 1 / 38 Outline 1 Logic programming and Prolog 2 Inference on Horn clauses 3 Programming in Prolog 4 Non-declarative aspects of Prolog Dalbelo Baˇsi´c, Snajderˇ (UNIZG FER) AI { Logic programming AY 2019/2020 2 / 38 Outline 1 Logic programming and Prolog 2 Inference on Horn clauses 3 Programming in Prolog 4 Non-declarative aspects of Prolog Dalbelo Baˇsi´c, Snajderˇ (UNIZG FER) AI { Logic programming AY 2019/2020 3 / 38 Logic programming Logic programming: use of logic inference as a way of programming Main idea: define the problem in terms of logic formulae, then let the computer do the problem solving (program execution = inference) This is a typical declarative programming approach: express the logic of computation, don't bother with the control flow We focus on the description of the problem (declarative), rather than on how the program is executed (procedural) However, we still need some flow control mechanism, thus: Algorithm = Logic + Control Different from automated theorem proving because: 1 explicit control flow is hard-wired into the program 2 not the full expressivity of FOL is supported Dalbelo Baˇsi´c, Snajderˇ (UNIZG FER) AI { Logic programming AY 2019/2020 4 / 38 Refresher: Declarative programming
    [Show full text]
  • Solving Non-Linear Horn Clauses Using a Linear Horn Clause Solver ∗
    Solving non-linear Horn clauses using a linear Horn clause solver ∗ Bishoksan Kafle John P. Gallagher Pierre Ganty Roskilde University, Denmark Roskilde University, Denmark IMDEA Software Institute, Spain [email protected] IMDEA Software Institute, Spain [email protected] [email protected] In this paper we show that checking satisfiability of a set of non-linear Horn clauses (also called a non-linear Horn clause program) can be achieved using a solver for linear Horn clauses. We achieve this by interleaving a program transformation with a satisfiability checker for linear Horn clauses (also called a solver for linear Horn clauses). The program transformation is based on the notion of tree dimension, which we apply to a set of non-linear clauses, yielding a set whose derivation trees have bounded dimension. Such a set of clauses can be linearised. The main algorithm then proceeds by applying the linearisation transformation and solver for linear Horn clauses to a sequence of sets of clauses with successively increasing dimension bound. The approach is then further developed by using a solution of clauses of lower dimension to (partially) linearise clauses of higher dimension. We constructed a prototype implementation of this approach and performed some experiments on a set of verification problems, which shows some promise. 1 Introduction Many software verification problems can be reduced to checking satisfiability of a set of Horn clauses (the verification conditions). In this paper we propose an approach for checking satisfiability of a set of non-linear Horn clauses (clauses whose body contains more than one non-constraint atom) using a linear Horn clause solver.
    [Show full text]
  • Horn Clause Solvers for Program Verification
    Horn Clause Solvers for Program Verification Nikolaj Bjørner, Arie Gurfinkel, Ken McMillan and Andrey Rybalchenko Microsoft Research, Software Engineering Institute Abstract. Automatic program verification and symbolic model check- ing tools interface with theorem proving technologies that check satisfi- ability of formulas. A theme pursued in the past years by the authors of this paper has been to encode symbolic model problems directly as Horn clauses and develop dedicated solvers for Horn clauses. Our solvers are called Duality, HSF, SeaHorn, and µZ and we have devoted considerable attention in recent papers to algorithms for solving Horn clauses. This paper complements these strides as we summarize main useful properties of Horn clauses, illustrate encodings of procedural program verification into Horn clauses and then highlight a number of useful simplification strategies at the level of Horn clauses. Solving Horn clauses amounts to establishing Existential positive Fixed-point Logic formulas, a perspec- tive that was promoted by Blass and Gurevich. 1 Introduction We make the overall claim that Constrained Horn Clauses provide a suitable ba- sis for automatic program verification, that is, symbolic model checking. To sub- stantiate this claim, this paper provides a self-contained, but narrowly selected, account for the use of Horn clauses in symbolic model checking. It is based on experiences the authors had while building tools for solving Horn clauses. At the practical level, we have been advocating the use of uniform formats, such as the SMT-LIB [6] standard as a format for representing and exchanging symbolic model checking problems as Horn clauses. The authors and many of our colleagues have developed several tools over the past years that solve Horn clauses in this format.
    [Show full text]
  • Horn Clauses A Definite Clause Is a Clause with Exactly One Positive Literal
    PROPOSITIONAL LOGIC (2) based on Huth & Ruan Logic in Computer Science: Modelling and Reasoning about Systems Cambridge University Press, 2004 Russell & Norvig Artificial Intelligence: A Modern Approach Prentice Hall, 2010 Clauses Clauses are formulas consisting only of and (brackets within a clause are not allowed!) they can also be written using →, (after →) and (before →) Clause without positive literal Empty clause Clause without is considered negative literal false an atom or its negation is called a literal Conjunctive & Disjunctive Normal Form A formula is in conjunctive normal form if it consists of a conjunction of clauses “conjunction of disjunctions” A formula is in disjunctive normal form if it consists of a disjunction of conjunctions Conjunctive & Disjunctive Normal Form The transformation from CNF to DNF is exponential Conjunctive Normal Form Any formula can be written in CNF (consequently, any formula can also be written in DNF, but the DNF formula may be exponentially larger) Checking Satisfiability of Formulas in DNF Checking DNF satisfiability is easy: process one conjunction at a time; if at least one conjunction is not a contradiction, the formula is satisfiable → DNF satisfiability can be decided in polynomial time Conversion to DNF is not feasible in most cases (exponential blowup) Checking Satisfiability of Formulas in CNF No polynomial algorithm is known for checking the satisfiability of arbitrary CNF formulas Example: we could use such an algorithm to solve graph coloring with k colors • for each node i, create
    [Show full text]
  • History of Logic Programming
    LOGIC PROGRAMMING Robert Kowalski 1 INTRODUCTION The driving force behind logic programming is the idea that a single formalism suffices for both logic and computation, and that logic subsumes computation. But logic, as this series of volumes proves, is a broad church, with many denomi- nations and communities, coexisting in varying degrees of harmony. Computing is, similarly, made up of many competing approaches and divided into largely disjoint areas, such as programming, databases, and artificial intelligence. On the surface, it might seem that both logic and computing suffer from a similar lack of cohesion. But logic is in better shape, with well-understood relationships between different formalisms. For example, first-order logic extends propositional logic, higher-order logic extends first-order logic, and modal logic extends classical logic. In contrast, in Computing, there is hardly any relationship between, for example, Turing machines as a model of computation and relational algebra as a model of database queries. Logic programming aims to remedy this deficiency and to unify different areas of computing by exploiting the greater generality of logic. It does so by building upon and extending one of the simplest, yet most powerful logics imaginable, namely the logic of Horn clauses. In this paper, which extends a shorter history of logic programming (LP) in the 1970s [Kowalski, 2013], I present a personal view of the history of LP, focusing on logical, rather than on technological issues. I assume that the reader has some background in logic, but not necessarily in LP. As a consequence, this paper might also serve a secondary function, as a survey of some of the main developments in the logic of LP.
    [Show full text]
  • Horn Formula Minimization
    Rochester Institute of Technology RIT Scholar Works Theses 2006 Horn formula minimization Tom Chang Follow this and additional works at: https://scholarworks.rit.edu/theses Recommended Citation Chang, Tom, "Horn formula minimization" (2006). Thesis. Rochester Institute of Technology. Accessed from This Master's Project is brought to you for free and open access by RIT Scholar Works. It has been accepted for inclusion in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact [email protected]. M.S. Project Report Tom Chang ([email protected]) May 7, 2004 1 Acknowledgement Throughout this project and my graduate studies here in RIT, I have received help from numerous sources. I would like to take this chance to express my gratitude. First I want to thank Professor Edith Hemaspaandra, without whose guidance, advice, patience and encourage- ment, this project would not have been possible. I also want to thank Pro- fessor Stanislaw P. Radziszowski and Professor Christopher Homan for taking the time to review and critique my work, and Professor Hans-Peter Bischof for guiding me and believing in me throughout the years. I want to thank the Laboratory for Applied Computing for financially supporting me through my project. Lastly, I want to thank my family and friends here in Rochester for supporting me and for always being there. 2 Contents 1 Abstract 5 2 Introduction 6 3 Basic terminology 7 3.1Booleanfunctions......................... 7 3.2Booleanformulas......................... 7 3.3Hornformulas........................... 8 3.4ImplicatesofaBooleanfunction................. 9 3.5Resolution............................. 10 4SAT 11 4.1GeneralSAT........................... 11 4.22-SAT............................... 13 4.3HornSAT............................
    [Show full text]
  • Solution of P Versus NP Problem Frank Vega
    Solution of P versus NP Problem Frank Vega To cite this version: Frank Vega. Solution of P versus NP Problem. 2015. hal-01161668 HAL Id: hal-01161668 https://hal.archives-ouvertes.fr/hal-01161668 Preprint submitted on 8 Jun 2015 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. P VERSUS NP A Millennium Prize Problem selected by the Clay Mathematics Institute Solution of P versus NP Problem Frank Vega June 7, 2015 Abstract: The P versus NP problem is one of the most important and unsolved problems in computer science. This consists in knowing the answer of the following question: Is P equal to NP? This incognita was first mentioned in a letter written by Kurt Godel¨ to John von Neumann in 1956. However, the precise statement of the P versus NP problem was introduced in 1971 by Stephen Cook in a seminal paper. We consider a new complexity class, called equivalent-P, which has a close relation with this problem. The class equivalent-P has those languages that contain ordered pairs of instances, where each one belongs to a specific problem in P, such that the two instances share a same solution, that is, the same certificate.
    [Show full text]
  • A New Approach to Conceive ASP Solvers
    A new approach to conceive ASP solvers Tarek Khaled Supervisor : Bela¨ıd Benhamou Aix Marseille Universite,´ LIS, Marseille, France. ftarek.khaled,[email protected] Abstract. The Answer set programming (ASP) is a non-monotonic declarative programming paradigm that is widely used for the formulation of problems in artificial intelligence. The ASP paradigm provides also a general framework for the resolution of decision and optimization problems. The idea behind ASP is to represent a problem as a logic program and solve that problem by computing sta- ble models. In our work, we propose a new method for searching stable models of logical programs. This method is based on a relatively new semantic that had not been exploited yet. This semantic captures and extends that one of the stable models. The method performs a DPLL enumerative process only on a restricted set of literals called the strong back-door (STB). This method has the advantage to use a Horn clause representation having the same size as the input logic pro- gram and has constant spatial complexity. It avoids the heaviness induced by the loop management from which suffer most of the ASP solvers based on the Clark completion. 1 Introduction The ASP is increasingly used, and this is due to the availability of several efficient ASP solvers like smodels [1], Clasp [2] and those based on SAT solvers like ASSAT [3] and Cmodels [4]. The natural way to use ASP is to express a problem as a logic program with default negation. To get a concise expression of the problem, the logic program is expressed in First Order Logic (FOL).
    [Show full text]
  • Logic Programming
    Logic Programming Having just studied the use of Alloy as a tool for checking specifications of software systems, we turn our attention in this module to a related question: whether, once we have a sufficiently detailed specification for a software system, we might be able to simply “execute” the specification as a program that meets it. More realistically, the question we shall explore is whether specifications for programs can be “compiled” or otherwise translated into specification-compliant executable code without any additional coding burden. 1 Short answer: no We must, of course, be reasonable about our expectations! There is no way we could expect that the brief characterization of file systems we gave in the last module provides sufficient information to derive a working file system implemented on actual hardware. To begin with, we omitted many features possessed by real file systems: user permissions, handling of concurrent reads/writes, etc. In principle, we could enhance the model to incorporate these. But what about actually interacting with a disk drive? Could this behaviour be derived? Maybe, but not without a lot of help! 2 Long answer: read on In module 8, we discussed the axiom schema of replacement, which speaks of binary predicates P such that if P (x; y) holds, then the value of x uniquely determines the value of y. For example, we might have P (x; y) = (x = 1 y = 2) (x = 3 y = 4) : ^ _ ^ Then from the knowledge that x = 1, we can derive y = 2; similarly, if we know that x = 3 (and also that P holds, of course), then we can conclude y = 4.
    [Show full text]
  • Notes for Chapter 12 Logic Programming
    Notes for Chapter 12 Logic Programming • The AI War • Basic Concepts of Logic Programming • Prolog • Review questions The AI War • How machines should learn: inductive or deductive? • Deductive: Expert => rules => knowledge, top-down approach, expert systems used LISP, Prolog, and shell languages CLIPS and JESS; programs suffered from: brittle and expensive to maintain. • Inductive: knowledge <= rules <= Data, bottom-up, machine learning and data mining – extracts patterns from data and learns from examples, such as Decision Tree, Artificial NN, Genetic Algorithm; starting from 1980’s. Logic Programming: Motivation • Logic is used to represent program • Deductions are used as computation • A higher level language does more automatically – we can concentrate more on what is to be done and less on how to do it • Ideal: Algorithm = logic (what) + Control (how) – only specify logic and let system take care of control Logic Programming: Theoretical foundation • predicate calculus, Horn Clauses – knowledge representations • Refutation system, unification, instantiation – auto deduction methods • resolution principle – inference engine behind Prolog Differences between Procedural P. and Logic P. • Architecture:Von • Abstract model (dealing Neumann machine with objects and their (sequential steps) relationships) • Syntax: Sequence of • Logic formulas (Horn statements (a, s, I) Clauses) • Computation: Sequential statements • Deduction of the execution clauses • Control: Logic and • Logic and control can control are mixed be separated together
    [Show full text]
  • Lecture 2: March 20, 2015 2.1 Introduction
    Automatic Software Verification Spring Semester, 2015 Lecture 2: March 20, 2015 Lecturer: Prof. Mooly Sagiv Scribe: Kalev Alpernas and Elizabeth Firman 2.1 Introduction In this lecture we will go over the subject of Satisfiability of Propositional For- mulas. The Satisfiability Problem Given a boolean formula in propositional logic, we would like to determine whether the formula: • is valid i.e. do all possible assignments satisfy the formula. In case the formula is not valid, we sometimes would also like to find a counterexample - a non-satisfying assignment. • is satisfiable i.e. there exists an assignment which satisfies the formula. In case there exists a satisfying assignment, we sometimes would also like to find that assignment. As we saw in last week's lecture, we use the result of this problem to verify program. We write the problem, and the negation of the invariant we would like to check as propositional formulas, and check whether they are satisfiable. If there exists a satisfying assignment, then we have found a bug in the program. Otherwise, we have proved that the invariant holds. Our input formula has 2n possible assignments, which means that exhaus- tively checking all assignments is not a feasible approach. In this lecture we will see a few different approaches to solving this problem. Example 1. We consider for example the following propositional formula: ' = (a _ b) ^ (:a _:b _ c) In Figure 2.1 we can see a tree representing the truth state of '. The colour Green represents a satisfying assignment, and Red represents a non-satisfying assignment.
    [Show full text]