Answer Set Programming (ASP) is a widely used declarative programming paradigm that has shown great potential in solving complex computational problems. However, the inability to natively support non-integer arithmetic has been highlighted as a major drawback in real-world applications. This feature is crucial to accurately model and manage real-world data and information as emerged in various contexts, such as the smooth movement of video game characters, the 3D movement of mechanical arms, and data streamed by sensors. Nevertheless, extending ASP in this direction, without affecting its declarative nature and its well-defined semantics, poses non-trivial challenges; thus, no ASP system is able to reason natively with non-integer domains. Indeed, the widespread floating-point arithmetic is not applicable to the ASP case, as the reproducibility of results cannot be guaranteed and the semantics of an ASP program would not be uniquely and declaratively determined, regardless of the employed machine or solver. To overcome such limitations and in the realm of pure ASP, this paper proposes an extension of ASP in which non-integers are approximated to rational numbers, fully granting reproducibility and declarativity. We provide a well-defined semantics for the ASP-Core-2 standard extended with rational numbers and an implementation thereof. We hope this work could serve as a stepping stone towards a more expressive and versatile ASP language that can handle a broader range of real-world problems.
翻译:回答集编程(ASP)是一种广泛使用的声明式编程范式,在解决复杂计算问题方面展现出巨大潜力。然而,无法原生支持非整数算术已被视为其在现实应用中的主要缺陷。这一特性对于精确建模和管理现实世界数据与信息至关重要——例如视频游戏角色的平滑移动、机械臂的三维运动以及传感器流式传输的数据等场景。尽管如此,在不影响ASP声明式本质及其清晰语义的前提下进行扩展,仍面临重大挑战,因此当前尚无ASP系统能原生处理非整数域。事实上,广泛使用的浮点运算并不适用于ASP场景,因为其结果的可复现性无法保证,且无论采用何种机器或求解器,ASP程序的语义都无法被唯一且声明式地确定。为克服这些局限并在纯ASP框架内解决此问题,本文提出了一种扩展方案:将非整数近似为有理数,从而完全保证结果的可复现性与声明性。我们为扩展了有理数的ASP-Core-2标准定义了清晰的语义,并提供了具体实现。希望这项工作能作为构建更具表达力与通用性、可处理更广泛现实问题的ASP语言的基石。