重新思考 Answer Set Programming 模板
Rethinking Answer Set Programming Templates
AI总结:
本文提出 Answer Set Programming 的模板机制,利用命名约定和 UUID 实现谓词局部化,以在可空上下文中强制不变量并兼容主流求解引擎。
摘要:
在命令式编程中,领域驱动设计方法通过将关注领域的不变量具体化为代码,帮助应对软件开发的复杂性。代码因此更清晰、更安全,因为任何隐含假设都会被移除,转而采用不变量,从而支持快速失败思维并立即报告意外情况。本文为 Answer Set Programming 引入一种模板概念:除 don't repeat yourself 原则外,它还通过简单的命名约定强制某些谓词具有局部性。局部谓词会被映射到主流求解引擎采用的常见全局命名空间,并使用通用唯一标识符以避免名称冲突。这样一来,局部谓词可用于在可能为空的应用上下文中,对模板的预期结果强制施加不变量,并且独立于可能添加到该上下文中的其他规则。以这种方式转译的模板应用可由主流引擎处理,也可安全地与其他知识设计者共享,即使他们对模板一无所知。
英文摘要:
In imperative programming, the Domain-Driven Design methodology helps in coping with the complexity of software development by materializing in code the invariants of a domain of interest. Code is cleaner and more secure because any implicit assumption is removed in favor of invariants, thus enabling a fail fast mindset and the immediate reporting of unexpected conditions. This article introduces a notion of template for Answer Set Programming that, in addition to the don't repeat yourself principle, enforces locality of some predicates by means of a simple naming convention. Local predicates are mapped to the usual global namespace adopted by mainstream engines, using universally unique identifiers to avoid name clashes. This way, local predicates can be used to enforce invariants on the expected outcome of a template in a possibly empty context of application, independently by other rules that can be added to such a context. Template applications transpiled this way can be processed by mainstream engines and safely shared with other knowledge designers, even when they have zero knowledge of templates.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。