Daniel Kroening and Ofer Strichman Decision Procedure

Slides:



Advertisements
Similar presentations
SMT Solvers (an extension of SAT) Kenneth Roe. Slide thanks to C. Barrett & S. A. Seshia, ICCAD 2009 Tutorial 2 Boolean Satisfiability (SAT) ⋁ ⋀ ¬ ⋁ ⋀
Advertisements

Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
Lab 10 : Arithmetic Systems : Adder System Layout: Slide #2 Slide #3 Slide #4 Slide #5 Arithmetic Overflow: 2’s Complement Conversions: 8 Bit Adder/Subtractor.
Parallel Adder Recap To add two n-bit numbers together, n full-adders should be cascaded. Each full-adder represents a column in the long addition. The.
Interpolants [Craig 1957] G(y,z) F(x,y)
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
Representations Example: Numbers –145 –CVL – –91 –
Fixed-Point Arithmetics: Part I
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
1/25 Pointer Logic Changki PSWLAB Pointer Logic Daniel Kroening and Ofer Strichman Decision Procedure.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Operations on data CHAPTER 4.
Arithmetic for Computers
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Copyright © Cengage Learning. All rights reserved. CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS.
General Fixed Radix Number Systems Nonredundant Positive radix, ß n digits in digit set Vector:
Computer Arithmetic Nizamettin AYDIN
Binary Arithmetic Stephen Boyd March 14, Two's Complement Most significant bit represents sign. 0 = positive 1 = negative Positive numbers behave.
CMPE 325 Computer Architecture II Cem Ergün Eastern Mediterranean University Integer Representation and the ALU.
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 3.
Binary Decision Diagrams (BDDs)
Quantified Formulas - Decision Procedure Daniel Kroening, Ofer Strichman Presented by Changki Hong 07 NOV 08.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
ECEN 248 Lab 4: Multiplexer Based Arithmetic Logic Unit
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
By Jariya Phongsai A two's-complement system is a system in which negative numbers are represented by the two's complement of the absolute value; this.
Modeling Data in Formal Verification Bits, Bit Vectors, or Words Karam AbdElkader Based on: Presentations form Randal E. Bryant - Carnegie Mellon University.
08 ARTH Page 1 ECEn/CS 224 Number Representation and Binary Arithmetic.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
Two’s and one’s complement arithmetic CLOCK ARITHMETIC.
Number Systems and Computer Arithmetic Winter 2014 COMP 1380 Discrete Structures I Computing Science Thompson Rivers University.
1/20 Arrays Changki PSWLAB Arrays Daniel Kroening and Ofer Strichman Decision Procedure.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
1 A framework for eager encoding Daniel Kroening ETH, Switzerland Ofer Strichman Technion, Israel (Executive summary) (submitted to: Formal Aspects of.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
Computer Engineering page 1 Integer arithmetic Depends what you mean by “integer”. Assume at 3-bit string. –Then we define: zero = 000 one = 001 Use zero,
Representing Positive and Negative Numbers
Daniel Kroening and Ofer Strichman 1 Decision Procedures for Equality Logic 1.
Decision Procedures in First Order Logic
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Solving Linear Arithmetic with SAT-based MC
William Stallings Computer Organization and Architecture 7th Edition
ECEG-3202 Computer Architecture and Organization
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
ECE 352 Digital System Fundamentals
Copyright © Cengage Learning. All rights reserved.
ECE 352 Digital System Fundamentals
Presentation transcript:

Daniel Kroening and Ofer Strichman Decision Procedure Bit Vector Daniel Kroening and Ofer Strichman Decision Procedure

Decision procedures Decision procedures which we learnt.. SAT Solver BDDs Decision procedure for equality logic … However, what kind of logic do we need to express bit- wise operations and bit-wise arithmetic? Logics which we covered can not express those kind of operations. We need bit-vector logic.

We need bit-vector logic Bit-wise operators : bit-wise AND, shift … Bit-wise arithmetic : bit addition, bit multiplication … Since bit-vector has finite domain, so we need to consider overflow problem which can not be happened in unbounded type operations, such as integer domain. We want to verify large formulas Program analysis tools that generate bit-vector formulas: CBMC SATABS F-Soft …

Contents Introduction to bit-vector logic Syntax Semantics Decision procedures for bit-vector logic Flattening bit-vector logic Incremental flattening Conclusion

Bit-vector logic syntax

Semantics Following formula obviously holds over the integer domain: However, this equivalence no longer holds over the bit- vectors. Subtraction operation may generate an overflow. Example

Width and Encoding The meaning of a bit-vector formula obviously depends on the width of the expression in bits the encoding - whether it is signed or unsigned Typical encodings: Binary encoding - unsigned Two’s complement - signed

Examples The width of the expression in bits The encoding unsatisfiable for one bit wide bit vectors, but satisfiable for larger widths. The encoding means different with respect to each encoding schemes. Notation to clarify width and encoding width in bits U: unsigned binary encoding S : signed two’s complement

Definition of bit-vector Definition. A bit vector b is a vector of bits with a given length l (or dimension) : The i-th bit of the bit vector is denoted by … bits

λ - Notation for bit-vectors A lambda expression for a bit vector with bits has the form is an expression that denotes the value of the i-th bit. Example The expression above denotes the bit vector 10101010.

Examples (cond.) The vector of length l that consists of zeros: A function that inverts a bit vector: A bit-wise OR:

Semantics for arithmetic operators (1/3) What is the answer for the below C program ? On 8 bits architectures, this is 44 which is not 300. Therefore, Bit vector arithmetic uses modular arithmetic.

Semantics for arithmetic operators (2/3) Semantics for addition and subtraction: Semantics for relational operators:

Semantics for arithmetic operators (3/3) Semantics for shift : logical left shift logical right shift arithmetic right shift - the sign bit of a is replicated

Decision procedure for bit-vector Bit-vector flattening Most commonly used decision procedure Transform bit-vector logic to propositional logic, which is then passed to SAT solver. Algorithm Input : A formula in bit-vector arithmetic Output : An equisatisfiable Boolean formula Convert each term into new Boolean variable Set each bit of each term to a new Boolean variable Add constraint for each atom Add constraint for each term

Example Bit-vector formula Convert each term into new Boolean variable Set each bit of each term to a new Boolean variable Add constraint for each atom Add constraint for each term

Example (l-bit Adder) 1-bit adder can be defined as follows: Carry bit can be defined as follows:

Example (l-bit Adder) l-bit Adder can be defined as follows: The constraints generated by algorithm for the formula is following:

Incremental bit flattening (1/4) Some arithmetic operation result in very hard formulas Multiplication Multiplier is defined recursively for , where denotes the width of the second operand: Therefore, we want to check satisfiability of a given formula without checking satisfiability of sub-formulas which have complicated arithmetic operations such as multiplication.

Incremental bit flattening (2/4) Example This formula is obviously unsatisfiable Since first two conjuncts are inconsistent and last two conjuncts are also inconsistent. SAT solver wants to make a decision of first two conjuncts because a and b are used frequently than x and y. However, this decision isn’t good because last two conjuncts are rather easy to check satisfiability since relation bit-vector operation is less complicate than multiplication bit-vector operation.

Incremental bit flattening (3/4) UNSAT SAT YES Pick ‘easy’ part convert to CNF : Boolean part of : set of terms that encoded to CNF formula : set of terms that are inconsistent with the current satisfying assignment

Incremental bit flattening (4/4) Idea : add ‘easy’ parts of the formula first Only add hard parts when needed only gets stronger - that’s why it is incremental

Conclusion We can compute bit-wise operations and arithmetics using bit-vector logic. There are decision procedures which check satisfiability of given bit-vector logic formula.