More and more languages have a need for constraint solving capabilities for features like error detection or automatic code generation. Imagine a dependently typed language that can immediately implement a program as soon as its type is given. In SAT-solving, there have been several techniques to speed up a search process for satisfying assignments to variables that could be used for program synthesis. One of these techniques is clause learning where, if a search branch runs into a conflict, the cause of the conflict is analysed and used to create a new clause that lets a branch fail earlier if the conflict arises again. We provide a framework with which this technique can come for free not just for Boolean solvers, but for any constraint solver running on recursive algebraic data types. We achieve this by tracking the read operations that happen before a variable is assigned and use this information to create the dependency graph needed for conflict analysis. Our results are implemented in Agda for best readability, but they transfer to other functional languages as well. For brevity, we do not provide an entire search system utilizing the clause learning, but it will become clear from the formalisms that our technique indeed enables a clause learning search system to be built.
翻译:越来越多的语言需要为错误探测或自动代码生成等特征的解答能力设置限制。 想象一种依赖性输入的语言, 一旦给出了程序类型, 就可以立即执行程序。 在 SAT 解析中, 有一些技术可以加速搜索进程, 满足可用于程序合成的变量的指定。 其中一种技术是条款学习, 如果搜索分支进入冲突, 冲突的原因会被分析并用来创建一个新条款, 如果冲突再次出现, 分支会提前失败 。 我们提供了一个框架, 这种技术不仅可以免费为布林解答器使用, 也可以为循环代数数据类型上的任何制约解答器使用。 我们通过跟踪变量被指定前发生的读算操作来实现这一目标, 并使用此信息创建冲突分析所需的依赖性图表。 我们的结果在阿格达实施, 以便最好的可读性, 但是它们会转移到其他功能性语言 。 关于简洁性, 我们没有提供整个搜索系统, 使用该条款学习, 但是从形式主义中可以清楚地看到, 我们的技术确实能够使条款的搜索系统得以建立。