论文标题
实施混合语义:从功能到当务之急
Implementing Hybrid Semantics: From Functional to Imperative
论文作者
论文摘要
混合程序将数字控制与微分方程相结合,并且自然出现在广泛的应用领域,从生物学和控制理论到实时软件工程。此类程序固有的离散和连续行为的纠缠超出了既定的计算机科学基础,从而产生了与例如无限迭代和杂种行为与其他效果的结合。最近出现了将杂种作为专用计算效应的系统处理。特别是,已经提出了一种通用理想的功能语言Hybcore,具有声音和适当的操作语义。然而,后一种语义并未为实现Hybcore作为一种可运行的语言提供暗示,适合混合系统模拟(例如,语义具有无数个前提的规则)。我们介绍了Hybcore的当务之急,其语义更简单,可以运行,但与Hybcore的语义相关,在混合元中的水平上。然后,我们建立相应的健全性和充分性定理。为了证明由此产生的语义可以作为实施针对混合域的典型编程工具的坚定基础,我们提出了一个基于Web的原型实现,以评估和检查Haskell和OCAML的GHCI的精神,以评估和检查混合程序。我们实施的主要资产是它正式遵循操作语义规则。
Hybrid programs combine digital control with differential equations, and naturally appear in a wide range of application domains, from biology and control theory to real-time software engineering. The entanglement of discrete and continuous behaviour inherent to such programs goes beyond the established computer science foundations, producing challenges related to e.g. infinite iteration and combination of hybrid behaviour with other effects. A systematic treatment of hybridness as a dedicated computational effect has emerged recently. In particular, a generic idealized functional language HybCore with a sound and adequate operational semantics has been proposed. The latter semantics however did not provide hints to implementing HybCore as a runnable language, suitable for hybrid system simulation (e.g. the semantics features rules with uncountably many premises). We introduce an imperative counterpart of HybCore, whose semantics is simpler and runnable, and yet intimately related with the semantics of HybCore at the level of hybrid monads. We then establish a corresponding soundness and adequacy theorem. To attest that the resulting semantics can serve as a firm basis for the implementation of typical tools of programming oriented to the hybrid domain, we present a web-based prototype implementation to evaluate and inspect hybrid programs, in the spirit of GHCi for Haskell and UTop for OCaml. The major asset of our implementation is that it formally follows the operational semantic rules.