Formal Verification Methods 1: Propositional Logic

Similar documents
COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011

SAT Solvers: Theory and Practice

Part 1: Propositional Logic

Tutorial 1: Modern SMT Solvers and Verification

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

LOGIC PROPOSITIONAL REASONING

Propositional Logic: Evaluating the Formulas

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Lecture 2 Propositional Logic & SAT

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

CS156: The Calculus of Computation

An instance of SAT is defined as (X, S)

Lecture Notes on SAT Solvers & DPLL

Foundations of Artificial Intelligence

Propositional and First Order Reasoning

Comp487/587 - Boolean Formulas

Decision Procedures for Satisfiability and Validity in Propositional Logic

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Warm-Up Problem. Is the following true or false? 1/35

Logic and Inferences

A brief introduction to Logic. (slides from

Propositional Reasoning

Propositional Logic: Methods of Proof (Part II)

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

Part 1: Propositional Logic

Conjunctive Normal Form and SAT

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving III & Binary Decision Diagrams. Sanjit A. Seshia EECS, UC Berkeley

Conjunctive Normal Form and SAT

Propositional Logic: Methods of Proof. Chapter 7, Part II

Lecture 9: The Splitting Method for SAT

Tecniche di Verifica. Introduction to Propositional Logic

Conjunctive Normal Form and SAT

Classical Propositional Logic

Propositional Logic: Methods of Proof (Part II)

Satisfiability Modulo Theories

Foundations of Artificial Intelligence

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Propositional Logic: Models and Proofs

CSE507. Introduction. Computer-Aided Reasoning for Software. Emina Torlak courses.cs.washington.edu/courses/cse507/17wi/

Mathematical Logic Part Three

CS156: The Calculus of Computation Zohar Manna Autumn 2008

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

Propositional Logic: Methods of Proof (Part II)

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

Intelligent Agents. Pınar Yolum Utrecht University

Introduction to Artificial Intelligence. Logical Agents

Critical Reading of Optimization Methods for Logical Inference [1]

Clause/Term Resolution and Learning in the Evaluation of Quantified Boolean Formulas

Verification using Satisfiability Checking, Predicate Abstraction, and Craig Interpolation. Himanshu Jain THESIS ORAL TALK

VLSI CAD: Lecture 4.1. Logic to Layout. Computational Boolean Algebra Representations: Satisfiability (SAT), Part 1

An Introduction to SAT Solving

Logical Agents. Chapter 7

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Worst-Case Upper Bound for (1, 2)-QSAT

Proof Methods for Propositional Logic

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

2.2: Logical Equivalence: The Laws of Logic

Kecerdasan Buatan M. Ali Fauzi

Deliberative Agents Knowledge Representation I. Deliberative Agents

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Subbarao Kambhampati, Dieter Fox, Henry Kautz )

CS206 Lecture 03. Propositional Logic Proofs. Plan for Lecture 03. Axioms. Normal Forms

Propositional Calculus

CS 173 Lecture 2: Propositional Logic

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008

Topic 1: Propositional logic

Logical Agents. Chapter 7

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Foundations of Artificial Intelligence

ECE473 Lecture 15: Propositional Logic

Tautologies, Contradictions, and Contingencies

Reasoning with Quantified Boolean Formulas

Topics in Model-Based Reasoning

Satisfiability and SAT Solvers. CS 270 Math Foundations of CS Jeremy Johnson

CS:4420 Artificial Intelligence

Deductive Systems. Lecture - 3

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Propositional Logic Language

Machine Learning and Logic: Fast and Slow Thinking

Propositional Resolution

CS 771 Artificial Intelligence. Propositional Logic

Propositional and Predicate Logic. jean/gbooks/logic.html

Agenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World

CS 512, Spring 2017, Handout 10 Propositional Logic: Conjunctive Normal Forms, Disjunctive Normal Forms, Horn Formulas, and other special forms

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Equivalences. Proposition 2.8: The following equivalences are valid for all formulas φ, ψ, χ: (φ φ) φ. Idempotency Idempotency Commutativity

Advanced Artificial Intelligence, DT4048

1 Propositional Logic

1 Propositional Logic

Propositional logic. Programming and Modal Logic

Class Assignment Strategies

From SAT To SMT: Part 1. Vijay Ganesh MIT

Branching. Teppo Niinimäki. Helsinki October 14, 2011 Seminar: Exact Exponential Algorithms UNIVERSITY OF HELSINKI Department of Computer Science

Introduction to Solving Combinatorial Problems with SAT

Transcription:

Formal Verification Methods 1: Propositional Logic John Harrison Intel Corporation Course overview Propositional logic A resurgence of interest Logic and circuits Normal forms The Davis-Putnam procedure Stålmarck s method Conclusions

Overview We aim to give a broad overview of the current verification methods employed in the hardware industry. 1. Propositional Logic 2. Symbolic Simulation 3. Model Checking 4. General Theorem Proving 5. Floating Point Verification We start with the simplest logic (propositional logic) and work our way up to higher order logic. The last lecture focuses on our own work, verifying floating-point algorithms using the HOL higher order logic theorem prover.

Propositional Logic By the second week of this summer school, we probably all know what propositional logic is. English Standard Boolean Other false 0 F true 1 T not p p p p, p p and q p q pq p&q, p q p or q p q p + q p q, p or q p implies q p q p q p q, p q p iff q p q p = q p q, p q In the context of circuits, it s often referred to as Boolean algebra, and many designers use the Boolean notation.

A resurgence of interest! Traditionally, propositional logic has been regarded as fairly boring, and is usually regarded as a stepping-stone on the way to first order logic (and beyond). There are severe limitations to what can be said with propositional logic. Propositional logic is trivially decidable in theory......but the usual methods aren t efficient enough for interesting problems. However, the last decade has seen a remarkable upsurge of interest in propositional logic. In fact, it s arguably the hottest topic in automated theorem proving!

Why? Why the resurgence? There are many interesting problems that can be expressed in propositional logic Efficient algorithms can often decide large, interesting problems Propositional satisfiability was the original NP-complete problem. The theory of NP completeness shows that many difficult combinatorial problems can in principle be reduced to propositional satisfiability checking. Recently it has become clear that reducing problems to propositional logic can often be a good way to solve them in practice!

Logic and circuits The correspondence between digital logic circuits and propositional logic has been known for a long time. Digital design circuit logic gate input wire internal wire voltage level Propositional Logic formula propositional connective atom subexpression truth value Many problems in circuit design and verification can be reduced to propositional tautology or satisfiability checking. For example optimization correctess: φ φ is a tautology.

Encoding as SAT Many other apparently difficult combinatorial problems can be encoded as Boolean satisfiability (SAT), e.g. scheduling, planning. Using circuit representations for multipliers, we can encode factorization problems as Boolean satisfiability. Here s 6 is a prime number : ( (out 0 x 0 y 0 ) (out 1 (x 0 y 1 (x 1 y 0 ))) (v 2 2 (x 0 y 1 ) x 1 y 0 ) (u 0 2 ((x 1 y 1 ) v 2 2)) (u 1 2 (x 1 y 1 ) v 2 2) (out 2 u 0 2) (out 3 u 1 2) out 0 out 1 out 2 out 3 ) We can read off the factorization 6 = 2 3 from a refuting assignment.

Efficient methods The naive truth table method is quite impractical for formulas with more than a dozen primitive propositions. Practical use of propositional logic mostly relies on one of the following algorithms for deciding tautology or satisfiability: Binary decision diagrams (BDDs) The Davis-Putnam method (DP, DPLL) Stålmarck s method BDDs will be discussed in the next lecture. This time we focus on Davis-Putnam, while also explaining the basic idea of Stålmarck s method.

DP and DPLL Actually, the original Davis-Putnam procedure is not much used now. What is usually called the Davis-Putnam method is actually a later refinement due to Davis, Loveland and Logemann (hence DPLL). We formulate it as a test for satisfiability. It has three main components: Transformation to conjunctive normal form (CNF) Application of simplification rules Splitting

Normal forms In ordinary algebra we can reach a sum of products form of an expression by: Eliminating operations other than addition, multiplication and negation, e.g. x y x + y. Pushing negations inwards, e.g. ( x) x and (x + y) x + y. Distributing multiplication over addition, e.g. x(y + z) xy + xz. In logic we can do exactly the same, e.g. p q p q, (p q) p q and p (q r) (p q) (p r). The first two steps give negation normal form (NNF). Following with the last (distribution) step gives disjunctive normal form (DNF), analogous to a sum-of-products.

Conjunctive normal form Conjunctive normal form (CNF) is the dual of DNF, where we reverse the roles of and and or in the distribution step to reach a product of sums : p (q r) (p q) (p r) (p q) r (p r) (q r) Reaching such a CNF is the first step of the Davis-Putnam procedure. Unfortunately the naive distribution algorithm can cause the size of the formula to grow exponentially not a good start. Consider for example: (p 1 p 2 p n ) (q 1 p 2 q n )

Definitional CNF A cleverer approach is to introduce new variables to stand for subformulas. Although this isn t logically equivalent, it does preserve satisfiability. For example, we can go from: (p (q r)) s introduce new variables for subformulas: (p 1 q r) (p 2 p p 1 ) (p 3 p 2 s) p 3 then transform to (3-)CNF in the usual way: ( p 1 q) ( p 1 r) (p 1 q r) ( p 2 p p 1 ) (p 2 p) (p 2 p 1 ) ( p 3 p 2 ) ( p 3 s) (p 3 p 2 s) p 3

Clausal form It s convenient to think of the CNF form as a set of sets: Each disjunction p 1 p n is thought of as the set {p 1,...,p n }, called a clause. The overall formula, a conjunction of clauses C 1 C m is though of as a set {C 1,...,C m }. Since and and or are associative, commutative and idempotent, nothing of logical significance is lost in this interpretation. Special cases: an empty clause means (and is hence unsatisfiable) and an empty set of clauses means (and is hence satisfiable).

Simplification rules At the core of the Davis-Putnam method are two transformations on the set of clauses: I The 1-literal rule: if a unit clause p appears, remove p from other clauses and remove all clauses including p. II The affirmative-negative rule: if p occurs only negated, or only unnegated, delete all clauses involving p. These both preserve satisfiability of the set of clause sets.

Splitting In general, the simplification rules will not lead to a conclusion. We need to perform case splits. Given a clause set, simply choose a variable p, and consider the two new sets {p} and { p}. { p} {p} I, II I, II 0 1 In general, these case-splits need to be nested, and in the worst case, behaviour is exponential. But usually, performing the intermediate simplifications between case splits makes performance much better than with truth tables.

Industrial strength SAT solvers For big applications, there are several important tweaks to the basic DPLL algorithm: Highly efficient data structures Good heuristics for picking split variables Intelligent non-chronological backtracking / conflict clauses Some well-known provers are GRASP SATO Chaff Chaff pays close attention to low-level details like memory hierarchy, and seems to be the current favourite.

Stålmarck s algorithm Stålmarck s dilemma rule attempts to avoid nested case splits by feeding back common information from both branches. { p} {p} R R 0 1 ( 0 1 ) This and other algorithms are used in a successful commercial tool suite marketed by Prover Technology.

Summary Propositional logic is no longer the ugly sister of theorem proving A wide variety of practical problems can usefully be encoded in SAT There is intense interest in efficient algorithms for SAT Many of the most successful systems are still based on minor refinements of the ancient Davis-Putnam procedure Can we invent a better SAT algorithm?