Table of Contents
Fetching ...

Egglog Python: A Pythonic Library for E-graphs

Saul Shanabrook

TL;DR

The paper addresses bringing e-graph techniques, particularly equality saturation, to Python by delivering Python bindings for the experimental egg-smol library. It presents a high-level Pythonic API built on the Rust core via PyO3, designed for familiarity and compatibility with Python tooling while preserving e-graph semantics. The authors compare the Python bindings to the existing s-expression interface and to snake-egg, highlighting typing advantages, editor support, and cross-library rewrite capabilities. Future work envisions embedding Python types, API simplification, upstream prototyping, exporting/importing e-graph descriptions, modular state management, and Jupyter-based visualization to broaden adoption and impact in the Python ecosystem.

Abstract

E-graphs have emerged as a versatile data structure with applications in synthesis, optimization, and verification through techniques such as equality saturation. This paper introduces Python bindings for the experimental egglog library (previously called egg-smol), which aims to bring the benefits of e-graphs to the Python ecosystem. The bindings offer a high-level, Pythonic API providing an accessible and familiar interface for Python users. By integrating e-graph techniques with Python, we hope to enable collaboration and innovation across various domains in the scientific computing and machine learning communities. We discuss the advantages of using Python bindings for both Python and existing egg-smol users, as well as possible future directions for development.

Egglog Python: A Pythonic Library for E-graphs

TL;DR

The paper addresses bringing e-graph techniques, particularly equality saturation, to Python by delivering Python bindings for the experimental egg-smol library. It presents a high-level Pythonic API built on the Rust core via PyO3, designed for familiarity and compatibility with Python tooling while preserving e-graph semantics. The authors compare the Python bindings to the existing s-expression interface and to snake-egg, highlighting typing advantages, editor support, and cross-library rewrite capabilities. Future work envisions embedding Python types, API simplification, upstream prototyping, exporting/importing e-graph descriptions, modular state management, and Jupyter-based visualization to broaden adoption and impact in the Python ecosystem.

Abstract

E-graphs have emerged as a versatile data structure with applications in synthesis, optimization, and verification through techniques such as equality saturation. This paper introduces Python bindings for the experimental egglog library (previously called egg-smol), which aims to bring the benefits of e-graphs to the Python ecosystem. The bindings offer a high-level, Pythonic API providing an accessible and familiar interface for Python users. By integrating e-graph techniques with Python, we hope to enable collaboration and innovation across various domains in the scientific computing and machine learning communities. We discuss the advantages of using Python bindings for both Python and existing egg-smol users, as well as possible future directions for development.
Paper Structure (12 sections, 3 figures)