创建

登录 ReadmeX

或

了解我们如何处理你的信息: 隐私政策

ReadmeX

陪你读懂 AI 动态

今天,想先了解什么?

选一份动态总结,或直接聊聊你的问题。

社区和关注动态总结只属于你自己。

资讯

开源引擎语义比较形式化策略

AI 总结

一款开源引擎利用电子图上的反统一比较形式化策略,并考虑代数定律和用户提供的领域规则。结果只展示一次共享结构,并保留每个差异的两个版本供审查。若没有剩余差异,则策略在这些定律和规则下等价;但规则或搜索不完整时,仍可能存在未被发现的等价关系。示例涵盖 Cedar、Dogwood、OpenShell、CEL,以及由大语言模型根据自然语言需求生成的形式化产物。大语言模型负责生成产物,但不参与计算差异;引擎负责比较候选形式化结果并帮助识别分歧。

深度见解

语义比较能够揭示文本变更可能掩盖的实质性策略分歧,适用于审查同一需求生成的多个大语言模型形式化结果。等价性结论仍取决于所提供的定律、领域规则以及搜索的完整性。

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

原文约 23 分钟读完阅读原文
群聊

还没有评论,来说说你的看法。