Efficient Algorithms for Isomorphisms of Simple Types Yoav Zibin Technion—Israel Institute of Technology Joint work with: Joseph (Yossi) Gil (Technion)

Slides:



Advertisements
Similar presentations
Randomized Algorithms Introduction Rom Aschner & Michal Shemesh.
Advertisements

A General Algorithm for Subtree Similarity-Search The Hebrew University of Jerusalem ICDE 2014, Chicago, USA Sara Cohen, Nerya Or 1.
Lecture 24 MAS 714 Hartmut Klauck
Variational Methods for Graphical Models Micheal I. Jordan Zoubin Ghahramani Tommi S. Jaakkola Lawrence K. Saul Presented by: Afsaneh Shirazi.
Size-estimation framework with applications to transitive closure and reachability Presented by Maxim Kalaev Edith Cohen AT&T Bell Labs 1996.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
CSE Lecture 3 – Algorithms I
Markov Decision Process
D ATABASE S YSTEMS I R ELATIONAL A LGEBRA. 22 R ELATIONAL Q UERY L ANGUAGES Query languages (QL): Allow manipulation and retrieval of data from a database.
Incremental Algorithms for Dispatching in Dynamically Typed Languages Yoav Zibin Technion—Israel Institute of Technology Joint work with: Yossi (Joseph)
Transform & Conquer Replacing One Problem With Another Saadiq Moolla.
1 Sorting Problem: Given a sequence of elements, find a permutation such that the resulting sequence is sorted in some order. We have already seen: –Insertion.
Convex Hulls Computational Geometry, WS 2006/07 Lecture 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 52 Database Systems I Relational Algebra.
Linear Algebraic Equations
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
Counting and Representing Intersections Among Triangles in R 3 Esther Ezra and Micha Sharir.
Complexity Analysis (Part I)
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
Data Flow Analysis Compiler Design Nov. 8, 2005.
Maximum Likelihood (ML), Expectation Maximization (EM)
Discrete Mathematics Recursion and Sequences
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Copyright © 2009 Pearson Education, Inc. CHAPTER 5: Exponential and Logarithmic Functions 5.1 Inverse Functions 5.2 Exponential Functions and Graphs 5.3.
Lection 1: Introduction Computational Geometry Prof.Dr.Th.Ottmann 1 History: Proof-based, algorithmic, axiomatic geometry, computational geometry today.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
Comp 249 Programming Methodology Chapter 15 Linked Data Structure - Part B Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
Algebra Form and Function by McCallum Connally Hughes-Hallett et al. Copyright 2010 by John Wiley & Sons. All rights reserved. 6.1 Integer Powers and the.
Mathematics Review and Asymptotic Notation
Equality and Inequality Meeting 4. Equations An equation is a statement that two mathematical expressions are equal. The values of the unknown that make.
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.
CSCE350 Algorithms and Data Structure Lecture 17 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
Analysis of Algorithms
File Organization and Processing Week 13 Divide and Conquer.
Exact methods for ALB ALB problem can be considered as a shortest path problem The complete graph need not be developed since one can stop as soon as in.
The Selection Problem. 2 Median and Order Statistics In this section, we will study algorithms for finding the i th smallest element in a set of n elements.
The Volcano Query Optimization Framework S. Sudarshan (based on description in Prasan Roy’s thesis Chapter 2)
CSC 211 Data Structures Lecture 13
Christopher Moh 2005 Competition Programming Analyzing and Solving problems.
Complexity of Functions with Cartesian GP and Recursion. John Woodward. School of Computer Science, The University of Birmingham, United Kingdom. 1 OVERVIEW.
A deterministic near-linear time algorithm for finding minimum cuts in planar graphs Thank you, Steve, for presenting it for us!!! Parinya Chalermsook.
CHAPTER 4 FUNCTIONS Relation – a set of ordered pairs Domain – The set of all possible input values in a relation or function (the x values of ordered.
Algorithmic Analysis Charl du Plessis and Robert Ketteringham.
Disjunctive Normal Form CS 270: Math Foundation of CS Jeremy Johnson.
Technology Mapping. 2 Technology mapping is the phase of logic synthesis when gates are selected from a technology library to implement the circuit. Technology.
LIMITATIONS OF ALGORITHM POWER
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 23 Algorithm Efficiency.
Section 5.5 Solving Exponential and Logarithmic Equations Copyright ©2013, 2009, 2006, 2001 Pearson Education, Inc.
1. Searching The basic characteristics of any searching algorithm is that searching should be efficient, it should have less number of computations involved.
STROUD Worked examples and exercises are in the text Programme 10: Sequences PROGRAMME 10 SEQUENCES.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
1 Chapter 2 Algorithm Analysis Reading: Chapter 2.
Unconstrained Submodular Maximization Moran Feldman The Open University of Israel Based On Maximizing Non-monotone Submodular Functions. Uriel Feige, Vahab.
The material in this lecture should be review. If you have not seen it before, you should be able to learn it quickly – and on your own. So we are going.
CMPT 438 Algorithms.
Linear Inequalities in One Variable
Randomized Min-Cut Algorithm
Randomized Algorithms
Orthogonal Range Searching and Kd-Trees
Graph Algorithms Using Depth First Search
Solving Exponential and Logarithmic Equations
Randomized Algorithms
Exponents and Radicals review: Chapter 1
Recurrences (Method 4) Alexandra Stefan.
1.5 Linear Inequalities.
2.3 Represent Relations & Functions p. 33
Chapter 11 Sets, and Selection
Presentation transcript:

Efficient Algorithms for Isomorphisms of Simple Types Yoav Zibin Technion—Israel Institute of Technology Joint work with: Joseph (Yossi) Gil (Technion) Jeffrey Considine (Boston University)

Type Isomorphism Two types are isomorphic iff there is a one-to-one mapping between their values, for example Easier to grasp in arithmetical notation (Distributive) (Currying) (Associative & Commutative)

First Order Ishomorphism Tarski ’ s High-School Algebra Problem [1951]: The following axioms are complete if the expressions involve only products and exponentiations [Soloviev ’ 83] ?

The problem and Our results Input: two types of size  n, given as expression trees Output: are the types isomorphic? Key idea: solve the problem for all sub-expressions of the two types Input: a collection of types whose total size  n Output: a partitioning into equivalence classes Varianttimespace First order isomorphism n 2 log n  n log 2 nn2  nn2  n Linear isomorphism (without the distributive axiom ) n log n  nn  nn  n

Practical Motivation Search for a function in a large library, using its type as a key Functions with isomorphic types are returned Example (using second order isomorphism) We only deal with first order isomorphism LanguageNameType ML of Edinburgh CAML itlist list_it (`a  `b  `b)  `a list  `b  `b Haskell foldl (`b  `a  `b)  `b  `a list  `b SML of New Jersey fold (`a  `b  `b)  `a list  `b  `b The Edinburgh SML Library fold_left (`a  `b  `b)  `b  `a list  `b

Linear Isomorphism Without the distributive axiom Essence of previous algorithms Stage 1: bring types to a normal form Stage 2: sort the terms of product types Stage 3: compare the resulting structures Our Observation: Sorting  Multi-set equality Time: O(n log n)  O(n) Example: abracadabra = carrabadaba Sorting: aaaaabbcdrr Multi-set equality: [in the paper] ?

Our Normal form for Linear Isomorphism Exhaustively apply the rule The representation remains linear Alternating products-functions

Comparing normal forms For height=0: partition primitive types For odd heights: partition products (as multi-sets) For even heights: partition functions (as ordered pairs) Iterate by height The types are isomorphic

Back to First Order Isomorphism Exhaustively apply : Recursively sort the terms of each product The equality is true

Catch: exponential blowup Due to the distributive law: The “ C ” sub-expression is duplicated

Expression Tree  Graph Apply instead the “ sharing ” rule: The resulting graph is a directed acyclic graph (DAG) Could still leadto O(n 2 ) space [Next Slide] This rule increase the representation by a constant It can be applied at most n 2 times The “ C ” sub-expression is shared

Our observation Exhaustively apply the sharing rule, with the “ outer-most ” opportunity first inner-most 1st: O(n 2 ) spaceouter-most 1st: O(n) space

Sharing of terms in products     m n d e ff d e Sharing forest

Sharing (cont.) Products have 3 kinds of terms Primitive types: a, b, c, … Exponents: X Y Shared products: , , , , , , , , … Catch question: how to discover that  and  are isomorphic? Na ï ve solution: Calculate the inherited terms i-terms(  )= i-terms(  )={d,e,f,m,n} Requires O(n 2 ) time and space Tree Partitioning [next slides] Requires O(n log 2 n) time and O(n) space     m n d e ff d e Sharing forest

Tree Partitioning Input: a tree T, and a multi-set terms(v) for each node v  T Output: a partitioning of the nodes according to the inherited multi-sets i-terms(v) terms(  ) = {d} i-terms(  ) = {a,b,c,d}

Dual representation terms(  ) = {} terms(  ) = {a,b,c} terms(  ) = {} terms(  ) = {d} terms(  ) = {} terms(  ) = {a,c,d} terms(  ) = {} terms(  ) = {a,a} F a = { , , ,  } F b = {  } F c = { ,  } F d = { ,  } Multi-sets of nodes (products) in which the value (term) occurs

Efficient representation of families Find a preorder of the tree Descendants of a node define an interval A family F defines |F | intervals, which partition the preorder into at most 2|F |+1 segments Example: F a = { , , ,  }

Intersecting all partitions A solution for the Tree Partitioning problem

Open problems Our algorithms runs in O(n log 2 n) time Reduce this time Obtain lower bounds Search for a linear-time random algorithm Our algorithm assumed the input type is represented as an expression tree Generalize our algorithm for a DAG representation A subtyping algorithm

The End Any questions?