From the source
Amazon's post explains a semantic diff engine that uses anti-unification over an e-graph to show what two formal policies share and where they disagree.
- A textual diff often flags syntactic changes that do not affect meaning, so a real behavioral change, such as an Or where the requirement says and, can get lost in the noise.
- The engine supplies algebraic laws and domain rules that justify equalities, such as equating an external destination with one that is not internal, and shows the shared parts once while keeping both versions of each differing part for review.
- If no differences remain, the policies are equivalent under those laws and rules, though when the rules or the search are incomplete a remaining difference might reflect an equivalence the engine has not found.
- One use case is autoformalization, where an LLM generates formal artifacts from prose and can produce two different formalizations with no ground truth; the model writes the artifact and plays no part in computing the diff.
- Requirements can also become OpenShell sandbox policies or Common Expression Language expressions, and the engine reads encodings of the relevant syntax rather than importing native policies from those formats.
- In a worked example, two candidate rules for the requirement that sensitive data sent to an external destination must be encrypted produce an anti-unifier with two Variants nodes, one of which is a difference in vocabulary rather than meaning.






