Semantic diffing of formal policies with anti-unification | Amazon Web Services
When reviewing code, you start with a diff. You wouldn’t compare two 3,000-line files by eye and hope to spot every change. Formal policies can be even harder to compare because a textual diff often highlights syntactic changes that don’t affect meaning. Reorder two conjuncts, swap the arguments of an equality, or use an equivalent predicate, and much of the file might appear changed. A real change in behavior, such as an Or where the requirement says and, can get lost in that noise.
A semantic diff shows what two policies have in common and where they disagree. The open source engine used in this post computes this diff using anti-unification, which finds a most specific common pattern for two expressions. Plotkin’s 1970 papergives the classical formulation. The engine works over an e-graph, which keeps track of expressions known to be equal. We supply the algebraic laws...
Copyright of this story solely belongs to aws.amazon.com. To see the full text click HERE