Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

Open-source engine semantically diffs formal policies

AI summary

An open-source engine uses anti-unification over an e-graph to compare formal policies while accounting for algebraic laws and user-supplied domain rules. It shows shared structure once and retains both versions of each difference for review. If no differences remain, the policies are equivalent under those laws and rules, although incomplete rules or search may hide an equivalence. Examples cover Cedar, Dogwood, OpenShell, CEL, and formal artifacts generated from natural-language requirements by LLMs. The LLM generates the artifact but does not compute the diff; the engine compares candidate formalizations and helps identify disagreements.

In-depth insight

Semantic comparison can reveal substantive policy disagreements that textual changes may obscure, including when reviewing multiple LLM-generated formalizations of the same requirement. Equivalence conclusions remain conditional on the supplied laws, domain rules and search completeness.

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 paper gives the classical formulation. The engine works over an e-graph, which keeps track of expressions known to be equal. We supply the algebraic laws and domain rules that justify those equalities, such as equating an external destination with one that isn’t internal. The result shows the shared parts once and keeps both versions of each differing part for review. If no differences remain, the policies are equivalent under those laws and rules. When the rules or the search are incomplete, a remaining difference might reflect an equivalence the engine has not found.

#semi-persistent#Cedar#Dogwood#OpenShell#Common Expression Language#SMT-LIB#Z3#cvc5

Original · 23 min readRead the original
Group chat

No comments yet. Start the conversation.