Rewrite Rule Inference Using Equality Saturation

08/23/2021
by   Chandrakana Nandi, et al.
0

Many compilers, synthesizers, and theorem provers rely on rewrite rules to simplify expressions or prove equivalences. Developing rewrite rules can be difficult: rules may be subtly incorrect, profitable rules are easy to miss, and rulesets must be rechecked or extended whenever semantics are tweaked. Large rulesets can also be challenging to apply: redundant rules slow down rule-based search and frustrate debugging. This paper explores how equality saturation, a promising technique that uses e-graphs to apply rewrite rules, can also be used to infer rewrite rules. E-graphs can compactly represent the exponentially large sets of enumerated terms and potential rewrite rules. We show that equality saturation efficiently shrinks both sets, leading to faster synthesis of smaller, more general rulesets. We prototyped these strategies in a tool dubbed ruler. Compared to a similar tool built on CVC4, ruler synthesizes 5.8X smaller rulesets 25X faster without compromising on proving power. In an end-to-end case study, we show ruler-synthesized rules which perform as well as those crafted by domain experts, and addressed a longstanding issue in a popular open source tool.

READ FULL TEXT
POST COMMENT

Comments

There are no comments yet.

Authors

page 17

page 18

11/23/2021

Caviar: An E-graph Based TRS for Automatic Code Optimization

Term Rewriting Systems (TRS) are used in compilers to simplify and prove...
01/27/2018

SWRL2SPIN: A tool for transforming SWRL rule bases in OWL ontologies to object-oriented SPIN rules

SWRL is a semantic web rule language that combines OWL ontologies with H...
01/05/2021

Equality Saturation for Tensor Graph Superoptimization

One of the major optimizations employed in deep learning frameworks is g...
11/25/2019

Checking Chase Termination over Ontologies of Existential Rules with Equality

The chase is a sound and complete algorithm for conjunctive query answer...
05/22/2018

Rule-Based Drawing, Analysis and Generation of Graphs for Mason's Mark Design

We are developing a rule-based implementation of a tool to analyse and g...
04/07/2020

egg: Fast and Extensible E-graphs

An e-graph efficiently represents a congruence relation over many expres...
04/07/2020

egg: Easy, Efficient, and Extensible E-graphs

An E-graph is a data structure that can efficiently encode the congruenc...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.