arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.11946cs.LO
收藏

一种用于已验证精确实数计算的命令式语言

An Imperative Language for Verified Exact Real-Number Computation

Andrej Bauer, Sewon Park, Alex Simpson

AI总结:

本研究提出结合一阶命令式编程与极限算子的精确实数计算语言Clerical,通过非确定性守护选择解决实数线性序半可判定性问题,构建域论语义与可靠的Hoare风格规约逻辑,实现模块化验证,并给出OCaml实现与Coq形式化验证。

摘要:

我们提出了Clerical,一种用于精确实数计算的编程语言,它将一阶命令式编程与极限算子相结合,可将实数作为柯西序列的极限进行计算。我们通过引入非确定性守护选择来解决实数线性序的半可判定性问题,基于实数部分比较操作的决策可通过该选择拼接为完整程序。可变状态、非确定性与极限计算之间的相互作用受以下要求约束:计算极限和守护条件的表达式仅能修改局部状态。我们设计了一种域论指称语义,采用了适配我们特定非确定性版本的Plotkin幂域构造变体。我们构建了一种Hoare风格的规约逻辑,证明其对于指称语义是可靠的,并通过实现并验证一个将π计算为sin的最小正零点的程序的正确性,演示了该框架的应用。Clerical的模块化特性使我们能够将该程序拆分为更小的部分进行组合,每个部分都可独立证明正确性。我们提供了Clerical的概念验证OCaml实现,并在Coq证明助手中形式化验证了开发工作的部分内容,尤其是规约逻辑的可靠性。

英文摘要:

We introduce Clerical, a programming language for exact real-number computation that combines first-order imperative-style programming with a limit operator for computation of real numbers as limits of Cauchy sequences. We address the semidecidability of the linear ordering of the reals by incorporating nondeterministic guarded choice, through which decisions based on partial comparison operations on reals can be patched together to give total programs. The interplay between mutable state, nondeterminism, and computation of limits is controlled by the requirement that expressions computing limits and guards modify only local state. We devise a domain-theoretic denotational semantics that uses a variant of Plotkin powerdomain construction tailored to our specific version of nondeterminism. We formulate a Hoare-style specification logic, show that it is sound for the denotational semantics, and illustrate the setup by implementing and proving correct a program for computation of $π$ as the least positive zero of $\sin$. The modular character of Clerical allows us to compose the program from smaller parts, each of which is shown to be correct on its own. We provide a proof-of-concept OCaml implementation of Clerical, and formally verify parts of the development, notably the soundness of specification logic, in the Coq proof assistant.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑