Traditional textual diffs are insufficient for comparing formal policies because they often highlight syntactic changes that do not alter the policy's meaning. Reordering elements or using equivalent predicates can make a policy appear significantly changed, obscuring actual behavioral differences. A semantic diff, in contrast, focuses on what two policies share and where their actual disagreements lie.
An open-source engine computes semantic diffs by employing anti-unification to find the most specific common pattern between two expressions. This process occurs on an e-graph, which tracks expressions known to be equivalent. The engine integrates algebraic laws and domain-specific rules, such as equating an external destination with a non-internal one, to justify these equivalences. The output displays shared policy components once and presents both versions of differing parts for review. If no differences remain, the policies are considered equivalent under the applied laws and rules.
One key application is in autoformalization, where natural language requirements are translated into formal languages like SMT-LIB, Cedar, or Dogwood. When large language models (LLMs) generate these formal artifacts, running the model multiple times can produce varying formalizations without a clear ground truth. A semantic diff reveals areas of agreement and disagreement between these LLM-generated outputs. By comparing multiple candidates, reviewers can identify consistent parts and focus their attention on the varying sections, streamlining the review process.
The semantic diffing approach is also relevant for other policy languages and formats, including OpenShell sandbox policies and Common Expression Language (CEL) expressions. OpenShell uses YAML to define filesystem and network access for agents, while CEL is embedded in applications to evaluate policy conditions. The engine's ability to handle different formal languages and formats extends its utility across various policy management scenarios.
✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →
One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.
One email a day. Unsubscribe in one click, any time.
Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.
▶ Play today's briefNew every morning, and the back catalogue is archived by date.
An open-source engine now computes semantic differences between formal policies using anti-unification on an e-graph. This method identifies behavioral changes by accounting for algebraic laws and domain rules, unlike textual diffs that highlight syntactic variations. The engine helps in reviewing autoformalized policies and comparing different formalizations generated by large language models.