What changed
AWS introduced a semantic diffing tool that leverages anti-unification to compare formal policies. This tool helps identify meaningful differences in policy expressions by finding the most specific common pattern between two expressions. The approach is based on Plotkin’s 1970 paper and uses e-graphs to track expressions known to be equal, along with algebraic laws and domain rules that justify those equalities.
What this means in practice
The tool is designed to assist in autoformalization, where natural language requirements are translated into formal languages such as SMT-LIB, Cedar, Dogwood, OpenShell, or CEL. When a large language model generates multiple formalizations of the same requirement, the semantic diffing tool highlights where they agree and where they differ. This helps reviewers focus on the varying parts of the policies, ensuring that any discrepancies in meaning are identified. The tool also supports the comparison of policies across different formats, such as OpenShell and CEL, which may express the same requirement differently.
Limitations and availability
The tool is part of an open-source engine and is not yet available as a standalone product. It requires users to encode the relevant syntax as terms and declare the equalities used in the comparison. The engine does not import native policies from the four formats directly. The approach is described as a formal-methods analogue of semantic entropy, similar to the method described by Farquhar et al. in Nature (2024). The tool assumes users can read S-expression syntax and understand authorization policies. E-graphs and anti-unification are explained as they come up in the process.
