Semantic diffing of formal policies with anti-unification
A textual diff of two formal policies flags every cosmetic change and hides the one that alters behavior. This post shows how to compute a symbolic, deterministic semantic diff with an open-source anti-unification engine, so reviewers see only the genuine disagreements between two candidate authorization policies.
First seen by Oriel on .
AI summary
AWS presents an open source semantic diff engine that uses anti-unification over e-graphs to expose meaningful disagreements between formal policy translations while suppressing differences covered by declared equivalences.
- The engine stores shared structure once and localizes disagreements in Variants nodes, whose alternatives can reconstruct both original policies modulo declared algebra and rewrites.
- Associativity, commutativity, idempotence, identity elements, and explicit domain rewrites let the comparison ignore reordered, duplicated, regrouped, or equivalently expressed policy terms.
- Its compression ratio measures shared structure, but does not prove correctness; remaining differences may reflect incomplete rules or search, and agreeing candidates can share mistakes.
- A worked policy example filters out reordered conjuncts and swapped Eq arguments while retaining substantive And-versus-Or and Lte-versus-Lt disagreements.
- The Rust engine accepts S-expression encodings rather than native Cedar, Dogwood, OpenShell, or CEL policies, and supports exact or budget-limited Monte Carlo search.
#formal methods #anti-unification #e-graphs #policy analysis
Generated by gpt-5.6-sol. Check the original for details.
Aliases
| Source | External ID | URL |
|---|---|---|
| AWS Machine Learning Blog | e385fb30922b28f568762a23f0c6b0abe2c192d9 | https://aws.amazon.com/blogs/machine-learning/semantic-diffing-of-formal-policies-with-anti-unification/ Read discussion |