Introduction
In numerical computing and hardware synthesis, determining the range of possible values for a mathematical expression is a fundamental task. Standard Interval Arithmetic (IA) is often employed for this purpose, but it is limited by the "dependency problem." IA treats multiple occurrences of the same variable as independent entities. For instance, if $x \in [0, 1]$, IA calculates $x - x$ as $[0, 1] - [0, 1] = [-1, 1]$, failing to recognize that the result must be zero. Traditionally, overcoming this requires manual or heuristic-based algebraic rearrangement to minimize variable repetition, a process that is often computationally expensive and non-exhaustive.
Methodology: E-Graphs and Information Fusion
This paper proposes a novel approach by performing abstract interpretation directly on an e-graph. An e-graph is a data structure that represents an equivalence relation over expressions, compactly storing many mathematically equivalent forms of the same formula.
The core contribution is a "tightening relationship" that leverages the e-graph's structure:
- Representation: An initial expression is converted into an e-graph using the
egglibrary. - Rewriting: A set of algebraic rules (such as distributivity or the quadratic formula) are applied to populate the graph with equivalent forms.
- Intersection (The "Meet" Operation): For every expression within an equivalence class, the system calculates its interval bound. Since all expressions in a class are equivalent, the true value must reside in the intersection of all calculated intervals.
As the e-graph grows through rewriting, the bounds monotonically narrow. This "information fusion" allows the system to harvest the tightest lower and upper bounds from different equivalent forms simultaneously, without needing to select a single "optimal" expression.
Evaluation and Results
The authors evaluated this technique on several "stress-test" expressions known to be problematic for standard IA. The results demonstrate that the e-graph approach significantly reduces interval width by discovering forms that mitigate variable dependency.
Key highlights include:
- Quadratic forms: For $x^2 - 2x + 1$, the interval width was reduced by 80%, narrowing from $[-2, 3]$ to $[0, 1]$.
- Square root differences: The expression $\sqrt{x+1} - \sqrt{x}$ saw a 93% reduction in interval width.
- Rational functions: For $x / (x+y)$, the width was reduced by 33%.
The computational overhead remained minimal, with the egg library processing these examples in seconds, suggesting the approach is viable for real-time analysis of small to medium-sized expressions.
Discussion and Future Work
While promising, the current implementation focuses on simple intervals and relatively small expressions. Future research directions include:
- Scalability: Testing the approach on large-scale expressions found in formal program verification.
- Relational Domains: Extending the analysis to track dependencies between different variables (e.g., using octagons or polyhedra) to further tighten bounds.
- Tool Integration: Incorporating this technique into floating-point optimization tools like Herbie or comparing its performance against specialized error analysis tools like Gappa.
Summary updated