Papers
Topics
Authors
Recent
Search
2000 character limit reached

Lifting E-Graphs: Context-Aware Structures

Updated 17 July 2026
  • The paper introduces lifting e-graphs, embedding context as an intrinsic aspect of terms to canonicalize alpha-equivalent structures.
  • It employs thinning bitvectors to manage variable omission, ensuring scope correctness and improved sharing across context dimensions.
  • The design leverages thinning-aware union-find and smart constructors to normalize redundant lifts and support efficient equality saturation.

Lifting e-graphs are an e-graph architecture in which context-thinning, or lifting, is built into the representation of terms rather than treated as an external normalization device. In this formulation, the relevant semantic object is a term together with its context, and terms can be lifted to larger contexts by dropping variables through a thinning. The design is intended to support rigid α\alpha canonical variables, improve sharing across context dimensions, and preserve scope correctness in equality saturation (Zucker, 22 Jun 2026).

1. Motivation and semantic perspective

The motivating problem is that ordinary e-graphs are effective for ground terms, but variables make representation subtle. Standard approaches either use names, which breaks sharing and can be scope-hygiene unsound in rewrites, or use nameless indices, which improves alpha-sharing but still misses common structure across terms that inhabit different-sized contexts (Zucker, 22 Jun 2026). Lifting e-graphs address this by making context an intrinsic part of the term.

The central design philosophy is stated explicitly: “The context x,y_x,y \mapsto \_ is not where a term is; it is part of what a term is.” In the paper’s running intuition, the expressions xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R} and x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R} are neither equal nor type-compatible, even though ordinary notation can obscure that distinction (Zucker, 22 Jun 2026). This motivates a context-indexed, dimension-aware syntax in which variables are nameless, function symbols are interpreted at a specific context dimension, and lifting operations relate terms across contexts.

A plausible implication is that the representation is not merely an implementation refinement over de Bruijn-style encodings; it changes the unit of canonicalization from a syntax tree to a context-indexed semantic object. That interpretation is consistent with the paper’s insistence that different ambient dimensions correspond to different functions.

2. Context-indexed syntax and the role of lifting

The paper first presents a naive well-dimensioned nameless representation. A term in context size dd is interpreted as a function RdR\mathbb{R}^d \to \mathbb{R}, and variables are written as vardi\operatorname{var}_{di}, meaning the ii-th variable in a dd-variable context (Zucker, 22 Jun 2026). The semantics is pointwise and compositional:

42d=v0,v1,,vd142 vardi=v0,v1,,vd1vi sind(t)=v0,,vd1sin(t(v0,,vd1)) t+ds=v0,,vd1t(v0,,vd1)+s(v0,,vd1).\begin{aligned} \llbracket 42_d \rrbracket &= v_0, v_1, \ldots, v_{d-1} \mapsto 42 \ \llbracket \operatorname{var}_{di} \rrbracket &= v_0, v_1, \ldots, v_{d-1} \mapsto v_i \ \llbracket \sin_d(t) \rrbracket &= v_0, \ldots, v_{d-1} \mapsto \sin(\llbracket t \rrbracket(v_0, \ldots, v_{d-1})) \ \llbracket t +_d s \rrbracket &= v_0, \ldots, v_{d-1} \mapsto \llbracket t \rrbracket(v_0, \ldots, v_{d-1}) + \llbracket s \rrbracket(v_0, \ldots, v_{d-1}). \end{aligned}

This representation already collapses alpha-renamings, but it does not identify terms related by dropping irrelevant variables. The paper’s basic example is that

x,y_x,y \mapsto \_0 and x,y_x,y \mapsto \_1

are related, but not shared (Zucker, 22 Jun 2026). Lifting is introduced precisely to close that gap.

The lifting combinator is defined using a thinning bitvector x,y_x,y \mapsto \_2:

x,y_x,y \mapsto \_3

Semantically, lifting applies the original function to the subsequence of arguments selected by the thinning. The Python sketch given is:

dd2

The paper uses this to relate the one-variable and two-variable sine terms:

x,y_x,y \mapsto \_4

and

x,y_x,y \mapsto \_5

The two-dimensional form is therefore represented as the one-dimensional form lifted into a larger context, rather than as an unrelated node (Zucker, 22 Jun 2026).

3. Thinnings as context embeddings

A thinning is represented by a bitvector in which x,y_x,y \mapsto \_6 means “keep this variable” and x,y_x,y \mapsto \_7 means “drop this variable” (Zucker, 22 Jun 2026). The paper emphasizes three equivalent intuitions: thinnings are strictly monotone maps between finite ordered sets, subsequence selectors, and a compact representation of repeated de Bruijn shifts. They form a category under composition.

The basic interface is given as:

dd3

This organization makes context inclusion explicit and compositional. In practical terms, a thinning records how a smaller context embeds into a larger one while preserving the order of retained variables. That representation underwrites two rewrite laws that the implementation treats as fundamental (Zucker, 22 Jun 2026).

The first is the lift-pulling, or homomorphism, law:

x,y_x,y \mapsto \_8

The second is the lift-composition, or compaction, law:

x,y_x,y \mapsto \_9

The first expresses that adding redundant arguments and then applying a function pointwise commutes with applying the function first; the second states that nested context embeddings collapse to a single composed thinning. Together they provide the algebraic basis for canonicalization in the lifting e-graph (Zucker, 22 Jun 2026).

A plausible implication is that the system internalizes free-variable control as a structural property of term formation. The paper itself notes that “thinness” can act as a kind of nameless free-variable analysis: if a term can be represented with a thinner lifting, then it is constant in the dropped directions.

4. Built-in lifting in the e-graph representation

The main implementation move is to bake lifting into the e-graph representation rather than represent it as an ordinary node or a separate normalization pass (Zucker, 22 Jun 2026). This begins with fat identifiers:

dd4

A fat identifier carries both a thinning bitvector and the underlying e-class integer. Ordinary e-nodes then become:

dd5

Each child is therefore already context-aware. Because the lifting annotation sits on the identifier itself, lifting is not interned as a separate node and can be inspected immediately.

The operational center of the design is the lift-pulling smart constructor. When building a node, it:

  1. examines the thinnings on all child IDs,
  2. finds the common lifting they share,
  3. peels that common lift off,
  4. interns the node at the thinned or core level,
  5. then reattaches the common lift to the resulting ID (Zucker, 22 Jun 2026).

This realizes the rewrite

xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}0

as a canonical construction procedure. The paper states that the smart constructor ensures that if an expression is “more lifted than necessary,” it still hashes to the same interned structure after normalization. The stated consequences are reduced memory use, better sharing, and faster comparison of lifting relationships (Zucker, 22 Jun 2026).

Even without union-find, the paper characterizes this as an alpha-aware hash cons. The comparison to Co-de Bruijn normalization is explicit: context-management structure is pushed outward so that the core term becomes canonical. This suggests that the canonical form is defined not solely by syntactic shape, but by a normalized decomposition into core syntax plus a residual context embedding.

5. Thinning-aware union-find and equality management

Ordinary union-find is insufficient because equality must respect both e-class identity and thinning structure. The key observation is that if xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}1, then, because lifting is injective, one may conclude xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}2 (Zucker, 22 Jun 2026). The paper compares this to injective datatype reasoning of the form xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}3. Accordingly, the union-find must be thinning-aware: shared lifts should be peeled away before merging base classes.

The formal shape is:

dd6

A new set is created in a specific scope by:

dd7

Roots therefore begin with identity thinning in their current scope. The find operation composes thinnings along the parent path:

dd8

The invariant is that the thinning associated with a node is the accumulated embedding from the node’s local context into the root context (Zucker, 22 Jun 2026). The paper also defines the weakest common thinning

dd9

together with a helper div(f : Thin, g : Thin) that computes the residual thinning when xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}4 is thinner than xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}5. Union then computes the common thinning, creates a fresh set at its codomain, and points both representatives to it with residual annotations:

RdR\mathbb{R}^d \to \mathbb{R}0

The paper isolates three special situations. In the ordinary injective case, a shared lift is peeled and the base classes are unioned: xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}6. In the forced-orientation case, exemplified by xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}7, the constant must be lifted into the one-variable context, yielding xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}8, and this can be oriented only as xsin(x):R1Rx \mapsto \sin(x) : \mathbb{R}^1 \to \mathbb{R}9. In the incompatible-but-related case, exemplified by x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}0, the union-find creates a fresh representative x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}1 so that x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}2 and x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}3 (Zucker, 22 Jun 2026).

These cases show that the union structure is not merely annotation-preserving; it may constrain orientation and may require the creation of a fresh “least common context.” The paper presents this as the thinning analogue of the fresh-meet behavior seen in factor union-find.

E-matching in a lifting e-graph is described as largely standard, but thinnings must be propagated during descent into a pattern (Zucker, 22 Jun 2026). The justification is lift-pushing:

x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}4

This allows matching to decompose a lifted pattern after pushing the lift inward. The paper notes, however, that union-find may contain redundant liftings such as nodes of the form x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}5. A simple implementation choice is to fail matching on such nodes, since they typically correspond to redundant variables and are unlikely to be useful; in principle, equations involving thinnings may also be solved to obtain multiple matches (Zucker, 22 Jun 2026).

The approach is positioned relative to several neighboring lines of work. Compared to ordinary e-graphs, it augments syntax-plus-equivalence-class structure with a first-class representation of context embeddings and can represent alpha-equivalent terms, context-shifted variants, and the “same core term, different number of dropped variables” while preserving canonical structure. Compared to slotted e-graphs, the difference is framed as one of emphasis: slotted e-graphs manage variables as first-class slots, whereas lifting e-graphs make context embeddings and thinnings first-class and bake lifting into the identifier. The work is also explicitly inspired by Co-De Bruijn notation: normalize by pulling lifts outward, represent context inclusion structurally, and treat variable omission as part of the term representation. The paper further remarks that while hashing modulo alpha-equivalence pursues similar sharing goals, it is unclear how to extend such techniques cleanly to highly shared e-graphs (Zucker, 22 Jun 2026).

The paper identifies several advantages and limitations. The stated advantages are better sharing across context dimensions, canonical handling of variables without names, built-in support for rigid alpha-canonical variables, avoidance of scope bugs such as variable leakage, lift normalization that reduces redundant structure, thinness as a free-variable or dependency analysis, and support for e-graph-style equality saturation with context-sensitive terms. The stated limitations are greater complexity than ordinary e-graphs, possible multiple solutions or failures in e-matching over redundant liftings, constrained different-context unification, and the fact that binders such as x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}6, x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}7, x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}8, x,ysin(x):R2Rx,y \mapsto \sin(x) : \mathbb{R}^2 \to \mathbb{R}9, and substitution would require related but slightly different transfer rules (Zucker, 22 Jun 2026).

The terminology should also be distinguished from an unrelated graph-theoretic usage. In graph theory, the lifting graph is a graph on the edges incident with a vertex dd0, where adjacency records whether a pair of edges is dd1-liftable while preserving local edge-connectivity; its complement is the non-admissibility graph or bad graph (Assem, 2022). That notion concerns splitting-off operations in edge-connected graphs rather than context-indexed e-graph representations. The shared word “lifting” therefore denotes different constructions in the two literatures.

A plausible overall interpretation is that lifting e-graphs convert context management from auxiliary bookkeeping into an algebraic invariant of the congruence structure itself. That interpretation follows the paper’s stated takeaway: contexts are intrinsic to terms, thinnings encode context inclusion, smart constructors hoist lifts, fat identifiers store thinning together with e-class identity, and thin-aware union-find preserves the injective structure of lifting while supporting equivalence saturation (Zucker, 22 Jun 2026).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Lifting E-Graphs.