Identifying Reversible Functions From an ROBDD Adam MacDonald.

Slides:



Advertisements
Similar presentations
Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Advertisements

The Dictionary ADT: Skip List Implementation
Representing Boolean Functions for Symbolic Model Checking Supratik Chakraborty IIT Bombay.
CS252: Systems Programming Ninghui Li Program Interview Questions.
TOPIC : Reduced Ordered Binary Decision Diagrams UNIT 1: Modeling Digital Circuits Module 1 : Functional Modeling.
AVL Trees COL 106 Amit Kumar Shweta Agrawal Slide Courtesy : Douglas Wilhelm Harder, MMath, UWaterloo
IT University of Copenhagen Lecture 7: BDD Construction and Manipulation 1. BDD construction 2. Boolean operations on BDDs 3. BDD-Based configuration.
File Processing : Hash 2015, Spring Pusan National University Ki-Joune Li.
Lower bound for sorting, radix sort COMP171 Fall 2005.
Introduction to Trees. Tree example Consider this program structure diagram as itself a data structure. main readinprintprocess sortlookup.
File Management Chapter 12. File Management A file is a named entity used to save results from a program or provide data to a program. Access control.
CPSC 335 Computer Science University of Calgary Canada.
Binary Decision Diagrams. ROBDDs Slide 2 Example Directed acyclic graph non-terminal node terminal node What function is represented by the graph?
2 -1 Analysis of algorithms Best case: easiest Worst case Average case: hardest.
Logic Verification 1 Outline –Logic Verification Problem –Verification Approaches –Recursive Learning Approach Goal –Understand verification problem –Understand.
ECE Synthesis & Verification - Lecture 10 1 ECE 697B (667) Spring 2006 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Binary.
ECE 667 Synthesis & Verification - BDD 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Binary Decision Diagrams (BDD)
Elementary Data Structures and Algorithms
© 2006 Pearson Addison-Wesley. All rights reserved13 B-1 Chapter 13 (excerpts) Advanced Implementation of Tables CS102 Sections 51 and 52 Marc Smith and.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
IT University of Copenhagen Lecture 8: Binary Decision Diagrams 1. Classical Boolean expression representations 2. If-then-else Normal Form (INF) 3. Binary.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 20: Binary Trees.
External Sorting Chapter 13.. Why Sort? A classic problem in computer science! Data requested in sorted order  e.g., find students in increasing gpa.
Achieving fast (approximate) event matching in large-scale content- based publish/subscribe networks Yaxiong Zhao and Jie Wu The speaker will be graduating.
(c) University of Washingtonhashing-1 CSC 143 Java Hashing Set Implementation via Hashing.
Data Structures and Algorithms Semester Project – Fall 2010 Faizan Kazi Comparison of Binary Search Tree and custom Hash Tree data structures.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Data Structures Trees.
Digitaalsüsteemide verifitseerimise kursus1 Formal verification: BDD BDDs applied in equivalence checking.
Comp 249 Programming Methodology Chapter 15 Linked Data Structure - Part B Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
Chapter 19 - basic definitions - order statistics ( findkth( ) ) - balanced binary search trees - Java implementations Binary Search Trees 1CSCI 3333 Data.
CS212: DATA STRUCTURES Lecture 10:Hashing 1. Outline 2  Map Abstract Data type  Map Abstract Data type methods  What is hash  Hash tables  Bucket.
1 Time Analysis Analyzing an algorithm = estimating the resources it requires. Time How long will it take to execute? Impossible to find exact value Depends.
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Today  Table/List operations  Parallel Arrays  Efficiency and Big ‘O’  Searching.
CS 267: Automated Verification Lecture 6: Binary Decision Diagrams Instructor: Tevfik Bultan.
Computer Algorithms Submitted by: Rishi Jethwa Suvarna Angal.
© 2006 Pearson Addison-Wesley. All rights reserved13 B-1 Chapter 13 (continued) Advanced Implementation of Tables.
CSS446 Spring 2014 Nan Wang.  Java Collection Framework ◦ Set ◦ Map 2.
Targil 6 Notes This week: –Linear time Sort – continue: Radix Sort Some Cormen Questions –Sparse Matrix representation & usage. Bucket sort Counting sort.
CSC 211 Data Structures Lecture 13
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
CSC 221: Recursion. Recursion: Definition Function that solves a problem by relying on itself to compute the correct solution for a smaller version of.
Outline Binary Trees Binary Search Tree Treaps. Binary Trees The empty set (null) is a binary tree A single node is a binary tree A node has a left child.
Can’t provide fast insertion/removal and fast lookup at the same time Vectors, Linked Lists, Stack, Queues, Deques 4 Data Structures - CSCI 102 Copyright.
Memory Management during Run Generation in External Sorting – Larson & Graefe.
Chapter 10 Hashing. The search time of each algorithm depend on the number n of elements of the collection S of the data. A searching technique called.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Hash Table March COP 3502, UCF 1. Outline Hash Table: – Motivation – Direct Access Table – Hash Table Solutions for Collision Problem: – Open.
1 Algorithms  Algorithms are simply a list of steps required to solve some particular problem  They are designed as abstractions of processes carried.
Hash Tables © Rick Mercer.  Outline  Discuss what a hash method does  translates a string key into an integer  Discuss a few strategies for implementing.
B+ Trees: An IO-Aware Index Structure Lecture 13.
Heaps and basic data structures David Kauchak cs161 Summer 2009.
2-0 Copyright © 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin “ Introduction to the Design & Analysis of Algorithms, ” 2 nd ed., Ch. 2 Theoretical.
Lecture - 11 on Data Structures. Prepared by, Jesmin Akhter, Lecturer, IIT,JU Threaded Trees Binary trees have a lot of wasted space: the leaf nodes each.
Binary decision diagrams (BDD’s) Compact representation of a logic function ROBDD’s (reduced ordered BDD’s) are a canonical representation: equivalence.
1. Searching The basic characteristics of any searching algorithm is that searching should be efficient, it should have less number of computations involved.
Binary Decision Diagrams Prof. Shobha Vasudevan ECE, UIUC ECE 462.
BDD-based Synthesis of Reversible Logic for Large Functions Robert Wille Rolf Drechsler DAC’09 Presenter: Meng-yen Li.
COMP 103 Course Review. 2 Menu  A final word on hash collisions in Open Addressing / Probing  Course Summary  What we have covered  What you should.
CMPT 438 Algorithms.
Sorting and "Big Oh" ASFA AP Computer Science A SortingBigOh.
COMP261 Lecture 23 B Trees.
COSC160: Data Structures Linked Lists
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Data Structures and Algorithms
Advanced Implementation of Tables
2018, Spring Pusan National University Ki-Joune Li
Quick-Sort 2/25/2019 2:22 AM Quick-Sort     2
Analysis of Algorithms
Presentation transcript:

Identifying Reversible Functions From an ROBDD Adam MacDonald

Background Reversible functions  Number of inputs = number of outputs  Mapping from output to input Each output configuration is unique  n variables: 2 n inputs and 2 n outputs possible  Outputs = reordered truth table in 2 in 1 out 2 out 1

Background

Background Binary Decision Diagrams  Function is represented by a tree of decisions Pros  Output to N variable function found in N time  Simplified to eliminate redundancy Cons  NP-hard construction  Takes about 2 minutes for n = 15 10

Project Outline BDD library implementation Implement efficient method for detecting if a given BDD is reversible Analysis

BDD Implementation “Node” class  Pointers to other ‘low’ and ‘high’ Nodes “BDD” class  Nodes stored in a large table  Functions point to a “root” Node  All functions share common Nodes  Hash table for looking up Nodes by attributes

Construction Adding a function  Start with a list of terms (eg ) “Build”  Recursively apply Shannon’s decomposition  Uses co-factor operation (single AND and OR operation) “Make”  Build and link nodes using hash table lookup  Separate table for each level  Hash key from ‘low’ and ‘high’ attributes

“Reversible” Class BDD’s constructed for testing  Fast-random Adds a random number of random terms  Slow-random Randomly assigns each value of the truth table  Reversible Randomly re-orders the truth table itself

Reversibility Algorithm Initial checks  Number of outputs = number of inputs  For each output bit, equal number of 1’s and 0’s Sat-Count: linear time Less than 1% of functions pass (for n > 3)  For testing, need to filter these out and continue  BDD’s after this point are “almost-reversible”

Reversibility Algorithm Search the entire truth table  When a duplicate is found, quit If the function is reversible:  Need to check 2 n inputs  n output bits in each row  n time to calculate each output bit  Algorithm is O(n 2 2 n )

Randomization Statistics If the function is not reversible:  Assume outputs are randomly assigned  Algorithm terminates once a duplicate is found  Problem resembles the “birthday” problem  n = 10, 2 n = 1024: need to check 41  n = 20, 2 n = 1 million: need to check 1284  Grows like 2 n/2 = n

Optimization Faster method for finding output values  All possible inputs are traversed in order  Variable assignments = sequential binary values Can maintain a ‘cursor’ on the tree  Move around the BDD in small steps  Faster than starting at the root each time  Takes constant time

Optimization Implementation  Maintain a Stack of decisions made  Can move upwards  Can make decisions from any point Last decision = “current” bit  Occurs at a terminal node

Optimization Case 1: Current bit is unchanged  Return the same output value as before

Optimization Case 2: Current bit is a 1  It must have been 0 previously  Step backwards a level in the stack  Make decisions from here

Optimization Case 3: Current bit is a 0  It must have been 1 previously  Step backwards to the most recent 0-1 transition  Make decisions from here

Analysis Testing on reversible functions  Worst case times  Slow traversal method vs. Fast method

Analysis Isolate time for each ‘traversal’ call  Divide by n2 n

Analysis Practical performance  The new method is faster for n > 15  Still, both methods are terribly slow  Factor of n has little effect Extrapolated running time: n = 20: 2.3 seconds n = 30: 1 hour n = 50: 196 years n = 75: 10 billion years

Analysis The good news  Random functions are rarely reversible  Finding the first duplicate is FAST Running time on a random function  n = 15: 4 microseconds  n = 50: 4 minutes (compared to 196 years)  n = 70: 4 days

Analysis This algorithm can very quickly:  Prove that a function is not reversible A duplicate will probably be found very quickly If a duplicate is not found quickly, then it will…  Prove that a function is reversible… … within some statistical accuracy 95% accuracy: run for twice the average

Conclusion This algorithm is practical when:  100% accuracy is not required  You don’t think the function is reversible The longer the algorithm is run for, the more sure you are that a function is reversible 2, 3 or 4 times a ‘suggested’ running time is a practical amount, giving > 99% accuracy. My optimizations are helpful, but not necessary