Papers
Topics
Authors
Recent
Search
2000 character limit reached

Flow-Preserving Rewrite Rules

Updated 8 July 2026
  • Flow-Preserving Rewrite Rules are mechanisms that preserve designated structural invariants across different rewriting systems.
  • In algebraic graph rewriting, frameworks like AGREE allow explicit control over embedding, enabling selective preservation of context connections.
  • These rules underpin deterministic behavior in MBQC and maintain type safety in dependent type theory, offering practical benefits in system design.

Flow-preserving rewrite rules are rewrite rules constrained so that a designated structural invariant survives rewriting. The invariant is domain-specific. In algebraic graph transformation, the preserved structure is the embedding of retained items into the surrounding context graph, including which incident connections survive (Corradini et al., 2014). In measurement-based quantum computation (MBQC), the preserved structure is the existence of flow, gflow, or Pauli flow, which guarantees deterministic implementability through an admissible correction scheme and partial order (McElvanney et al., 2022). In dependent type theory, an analogous requirement is subject reduction: if a term rewrites, its type must be preserved (Blanqui, 2020). The term therefore names a family of preservation disciplines rather than a single uniform formalism.

1. Terminological scope and common structure

The phrase “flow-preserving” is used differently across the rewriting literature. In MBQC it refers literally to the preservation of a flow witness on a labelled open graph. In algebraic graph rewriting it refers to controlled preservation of how preserved items connect to the ambient graph. In dependent type theory it is used for preservation of typing under rewriting, which the cited work explicitly frames as a form of flow preservation through subject reduction (Corradini et al., 2014, McElvanney et al., 2022, Blanqui, 2020).

A recurring source of confusion is that preservation of the rewritten object is not the same as preservation of its surrounding structure. AGREE separates preservation of items from preservation of their connections (Corradini et al., 2014). MBQC papers separate preservation of flow from preservation of interpretation: some rule systems preserve both the linear-map semantics and flow, while later work studies rules that preserve only the existence of flow (McElvanney et al., 2023, Backens, 3 Jul 2026). In dependent types, the safe criterion is not merely that left- and right-hand sides can be typed in some environment, but that every typable instance of the left-hand side rewrites to a term of the same type (Blanqui, 2020).

This suggests a common pattern: ordinary rewriting often lets contextual propagation be handled automatically, whereas flow-preserving variants make that propagation an explicit proof obligation or rule parameter.

2. Controlled embedding in algebraic graph rewriting

In algebraic graph rewriting, standard DPO, SPO, and SqPO formalisms describe deletion, copying, merging, and creation of items, but do not let the rule designer directly choose which context connections of preserved items should survive a rewrite. AGREE, “Algebraic Graph Rewriting with controllEd Embedding,” was introduced to address exactly this limitation (Corradini et al., 2014).

An AGREE rule has the form

ρ=(KlL,  KrR,  KtTK),\rho=(K \xrightarrow{l} L,\; K \xrightarrow{r} R,\; K \xrightarrow{t} T_K),

where ll and rr are the usual interface maps and t:KTKt:K\to T_K is an explicit embedding morphism. This extra component is the distinctive mechanism of the framework: the rule specifies not only what is preserved, but also how the preserved part is re-embedded into the rewritten context. The framework is developed in a category C\mathcal C with pullbacks, a stable system of monos MM, an MM-partial map classifier (T,η)(T,\eta), and pushouts along monos.

Rule application proceeds in two phases. First, for a mono match m:LGm:L\to G, one forms

l=φ(t,l):TKT(L),m=φ(m,idL):GT(L),l'=\varphi(t,l):T_K\to T(L), \qquad m=\varphi(m,\mathrm{id}_L):G\to T(L),

and then constructs ll0 as the pullback of

ll1

Second, one takes the pushout of

ll2

to obtain the rewritten object ll3. The first phase is the control point: it is where the embedding morphism determines how the matched subobject interacts with the surrounding context.

The conceptual distinction emphasized by AGREE is between preservation of items and preservation of connections. In standard algebraic rewriting, if a node is preserved, then its incident edges to the unmatched context are typically preserved automatically or determined categorically. AGREE allows these to diverge. A node may survive while some incident edges are selectively kept, dropped, or transformed. The paper notes that this can have non-local effects: preserving a single element may still modify the complement of the matched image in the host object.

To characterize when such effects are absent, the framework introduces strict complements. A rule ll4 is local if

ll5

is an isomorphism, and a rewrite step is local if

ll6

is an isomorphism. The key proposition states that if ll7 is a local rule, then every rewrite step generated by ll8 is local. AGREE also proves that its first phase constructs final pullback complements via the partial map classifier, and that SqPO with monic matches is recovered as the special case ll9. A further result shows that polarized node cloning on graphs is also subsumed by choosing rr0 from the polarized classifier.

The motivating examples illustrate the intended “flow-preserving” behavior. A copied web page may duplicate only outgoing hyperlinks, not incoming ones. A cloned Linux process may alter its environment differently from the original. A social-network anonymization rule may clone a subgraph while preserving only public links. In each case, the identity of

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 Flow-Preserving Rewrite Rules.