Implementing a variable-sized bit-vector theory for KeY Olivier Borne May 18, 2009.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Variables on Both Sides of the Equation
Satisfiability Modulo Theories (An introduction)
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Chapter 9 Imperative and object-oriented languages 1.
Comp 205: Comparative Programming Languages Functional Programming Languages: Haskell Lecture notes, exercises, etc., can be found at:
ECI 2007: Specification and Verification of Object- Oriented Programs Lecture 5.
Chapter 2 – Combinational Logic Circuits Part 1 – Gate Circuits and Boolean Equations Logic and Computer Design Fundamentals.
2.5 The Chain Rule If f and g are both differentiable and F is the composite function defined by F(x)=f(g(x)), then F is differentiable and F′ is given.
The Implicit Mapping into Feature Space. In order to learn non-linear relations with a linear machine, we need to select a set of non- linear features.
1 A propositional world Ofer Strichman School of Computer Science, Carnegie Mellon University.
1 Type Type system for a programming language = –set of types AND – rules that specify how a typed program is allowed to behave Why? –to generate better.
3-5 Solving Equations with the variable on each side Objective: Students will solve equations with the variable on each side and equations with grouping.
1Chapter 2. 2 Example 3Chapter 2 4 EXAMPLE 5Chapter 2.
A) Find the velocity of the particle at t=8 seconds. a) Find the position of the particle at t=4 seconds. WARMUP.
Unsigned and Signed Numbers. Hexadecimal Number 217A 16 Position Digits A Value = 2x x x16 + Ax1 = 2x x x16.
Solving Equations with variables on both sides of the Equals Chapter 3.5.
Section Section Summary Introduction to Boolean Algebra Boolean Expressions and Boolean Functions Identities of Boolean Algebra Duality The Abstract.
Objective: The student will recognize arithmetic sequences, extend and write formulas for arithmetic sequences. S. Calahan.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To be able to use the bitwise logical operators in programs ❏ To be able to use.
Rewrite Equations and Formulas Lesson 3.8 OBJ: To recognize and solve literal equations; to rewrite equations and formulas.
CSI-2111 Computer Architecture Ipage Revision  Objective : To examine basic concepts of: –2.1 Numbering Systems –2.2 Binary Numbers –2.3 Boolean.
MAT 3237 Differential Equations Section 18.4 Series Solutions Part I
9.4 FLOATING-POINT REPRESENTATION
The Multiplication Principle of Equality 2.3a 1.Solve linear equations using the multiplication principle. 2.Solve linear equations using both the addition.
Notes 2.4– Solving Equations with Variables on Both Sides.
Page 1 Adapted after Dr. Menezes Recurrence 1 …..
4.1 Antiderivatives and Indefinite Integration Definition of Antiderivative: A function F is called an antiderivative of the function f if for every x.
Matrices Section 2.6. Section Summary Definition of a Matrix Matrix Arithmetic Transposes and Powers of Arithmetic Zero-One matrices.
Do Now (3x + y) – (2x + y) 4(2x + 3y) – (8x – y)
Digital Representations ME 4611 Binary Representation Only two states (0 and 1) Easy to implement electronically %0= (0) 10 %1= (1) 10 %10= (2) 10 %11=
Objectives Multiply expressions containing variables. Divide expressions containing variables. Page 96 Multiplying and Dividing Expressions Why? When solving.
integer integer The set of whole numbers and their opposites.
Steps for Solving Equations with Variables on Both Sides 1.Distribute when necessary. 2.Combine like terms if possible. 3.Add or subtract to get the variables.
Multi-Step Equations & Inequalities 1. Explain the difference between a constant term and the coefficient of a variable. Give examples!
Solve Equations With Variables on Both Sides. Steps to Solve Equations with Variables on Both Sides  1) Do distributive property  2) Combine like terms.
2-4 Solving Equations with Variables on Both Sides.
Definition Characteristics Examples Non-examples integer Definition Characteristics Examples Non-examples The set of ______ numbers and their ___________.
1. 4 [ -2(4 + 1) ÷ 5] – 4 ÷ x + (-8) = 4. Equations with Fractions Equations w/ Distributive Property Equations & Combining Like Terms Equations.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Computer Systems Laboratory Stanford University Clark W. Barrett David L. Dill Aaron Stump A Framework for Cooperating Decision Procedures.
Fuzzy Relations( 關係 ), Fuzzy Graphs( 圖 形 ), and Fuzzy Arithmetic( 運算 ) Chapter 4.
MTH 091 Sections 3.1 and 9.2 Simplifying Algebraic Expressions.
3.5 Solving Equations with Variables on Both Sides.
Chapter 12. Chapter Summary Boolean Functions Representing Boolean Functions Logic Gates Minimization of Circuits (not currently included in overheads)
The Addition/Subtraction Principle of Equality
Chapter 0 Review of Algebra.
Section 2: Integer & Floating Point Numbers
Bellwork (this is done on loose leaf paper)
2 Understanding Variables and Solving Equations.
Variables on Both Sides with Equations
Expressions and Assignment Statements
Solving Linear Systems by Linear Combinations
Do Now 1) t + 3 = – 2 2) 18 – 4v = 42.
OBJECTIVE: Students will solve multistep equations.
Lesson 2.2a EQ: How do I solve a literal equation for a specified variable? Standard(CED.4) Equations.
Arithmetic Sequences as functions
Background In his classic 1972 paper on definitional interpreters, John Reynolds introduced two key techniques: Continuation-passing style - Makes.
Equations with Variables on Both Sides
Learn to solve equations with integers.
Combining Like terms.
Warm Up Solve. 1. 2x + 9x – 3x + 8 = –4 = 6x + 22 – 4x 3. + = 5
Solving 1-Step Integer Equations
Warm Up 9/12/18 Solve x. 1) 3x – 7 = 5 + 2x
Rewriting Equations Equivalent Equations.
U12-6 Unit 12 Warm-Up – 05/01 Write the equation for the Combined Gas Law. What variable is held constant when using this law? Rearrange the Combined Gas.
Solving literal equations
CSE 370 – Winter Number syst.; Logic functions- 1
One-step addition & subtraction equations: fractions & decimals
Numbers & Algebra review.
Presentation transcript:

Implementing a variable-sized bit-vector theory for KeY Olivier Borne May 18, 2009

Current state public boolean some(ip1, ip2) { return ip1 & netmask == ip2 & netmask; } Applications for embedded systems and network do use such representation (e.g. Sun SPOT) There is no support for bitwise operations in KeY develop a bitwise arithmetic

Bitwise representations of integers Explicit data-type bv: operations (&,|, projection) are defined on bv Implicit as normal integers Operation are defined on int Examples : 2 & 1, 4 | (2 & 0) int

Bit-vector : fixed or variable size? Bounded model for integers (sign bit, overflow) : Unbounded : closer to natural numbers but need formalization From now on : variable-sized bit-vectors sign bitbinary representation … …

x  n = (x / 2 n )x  n = (x / 2 n ) % 2 Projectors and functions bitProjector : x  n BitIntervalProjector : x  (i, j) 13 … … …  13  2 13 … x  (i,j) = (x/2 j ) 13  (3,1) … x  (i,j) = (x/2 j ) % 2 i-j+1 …

Projectors and functions Composition : a ⊗ n b Example : 13 ⊗ 2 5 …01101 ⊗2⊗2 …00101 …01101 ⊗2⊗2 …00101 … ⊗ 2 5 = 53

Bitwise functions Bitwise functions are defined with projectors Example : \find((a & b)  n)) Exceptions are the shift-right and shift-left, with arithmetic definitions shift-right : a >> b := a/2 b shift-left : a << b := a * 2 b

Example 2 & [(4|c) & 2 ] = 2 & c 2 & [2 & (4|c) ] (commute) = (2 & 2) & (4|c) (associate) = 2 & (4|c) (identity) = (2 & 4) | (2 & c) (distribute) = 0 | (2 & c) (literal) = 2 & c (neutral element)

Bit-blasting Problematic : avoid the bit-blasting A solution is to use large chunks of bit-vectors = = = =

Bit-vector chunks algorithm (based on a paper from David Cyrluk et al.) x ⊗ 6 y  (0, 0) ⊗ 5 z  (4, 4) ⊗ 4 0 = x ⊗ 6 z ⊗ 1 x  (2, 2) Normal form with bit-vector chunks of the same size : x ⊗ 6 y  (0, 0) ⊗ 5 z  (4, 4) ⊗ 4 0 ⊗ 1 0 = x ⊗ 6 z  (4, 4) ⊗ 5 z  (3, 3) ⊗ 4 z  (2, 0) ⊗ 1 x  (2, 2) Solved by solving the conjunction of equations

Bit-vector chunks algorithm Solve each equation : csolve( x = x ) = ∅ csolve(y  (0,0) = z  (4,4)) = {y=r (1) 2 ⊗ 1 c (1) [1], z=r (2) 6 ⊗ 1 c (1) [1] ⊗ 4 a (1) [4] } csolve(z  (4,4) = z  (3,3)) = {z = r (2) 6 ⊗ 1 b (1) [1] ⊗ 1 b (1) [1] ⊗ 1 a (2) [3] } Equations are rearranged for constant propagations and chunk size adjustments r (2) 6 c (1) [1] a (1) [1] ’a (1) [3] ” r (2) 6 b (1) [1] a (2) [3] 0 [3] r (3) 4 r (2) 6 c (1) [1] a (1) [1] ’a (1) [3] ” r (2) 6 b (1) [1] a (2) [3] r (2) 6 a (4) [1] ’a (4) [1] ”0 [3]

Algorithm in KeY Canonizer : rewrite taclets  Rewrite rule n°1 : t  (i, j)  (k, l) = t  (k+j, l+j)  Rewrite rule n°2 : t  (i, j) ⊗ j-k t  (j-1, k) = t  (i, k) Taclet for rule n°1 : \schemaVar int t, i, j, k, l; \find(t  (i, j)  (k, l)) \replacewith(t  (k+j, l+j))

Algorithm in KeY Bit-vector chunk splitting : combination applying equations and splitting taclet Taclet : bitvector_split_composition { \find(var  (high, low)) \sameUpdateLevel \add(==> z >= low & z <= high)\replacewith( var  (high, z) ⊗ z-low var  (z, low)) };

Mapping bitwise functions to composition There is still a gap between a bitwise formula and such equations to avoid bit-blasting Example for closing the gap : chunk decomposition using preconditions There must be some knowledge about members of the equation to make a decomposition If/else approach (described in paper)

Summary & Future Work The extension of the fixe-sized algorithm seems very promising to cope with bitwise operations and can used into KeY Future work : concentrate on the automation of the algorithm and closing the gap using this chunk decomposition approach