论文标题

在声明语言中有效的编程,重点是非确定性:应用和正式推理

Effectful Programming in Declarative Languages with an Emphasis on Non-Determinism: Applications and Formal Reasoning

论文作者

Dylus, Sandra

论文摘要

本文研究有效的声明性编程,重点是非确定性。一方面,我们有兴趣使用非确定性作为基本实施思想来开发应用程序。我们使用功能逻辑编程语言咖喱讨论两个应用程序。这些实施的关键思想是利用库里采用的非确定性和非严重性的相互作用。第一个申请研究了对比较函数进行参数化算法的排序。通过将非确定性谓词应用于这些排序函数,我们获得了排列枚举函数。我们将Curry中的实现与Haskell中的实现进行了比较,该实现使用Monadic界面来建模非确定性。我们在这项工作中讨论的另一个应用程序是用于概率编程的库。我们使用咖喱的内置非确定性对分布进行建模,而不是将分布建模为事件和概率对列表。在这两种情况下,我们都会发现,非确定性和非严重性的结合在使用列表的实施方面具有对非确定性的实施的优势。另一方面,我们提出了一个想法,将正式推理应用于有效的声明性编程语言上。为了从简单的效果开始,我们首先专注于对功能子集建模。也就是说,感兴趣的影响是整体和偏见。然后,我们观察到,可以将这两种效应建模的一般方案推广以捕获广泛的效果。显然,下一步是将这个想法应用于建模非确定性。更确切地说,我们为咖喱的非确定主义实施了一个模型:与呼叫时间选择的非严格的非决策。因此,我们最终讨论了为什么当前的表示模型逐个名称而不是咖喱的呼叫语义,并给出解决这个问题的想法的前景。

This thesis investigates effectful declarative programming with an emphasis on non-determinism as an effect. On the one hand, we are interested in developing applications using non-determinism as underlying implementation idea. We discuss two applications using the functional logic programming language Curry. The key idea of these implementations is to exploit the interplay of non-determinism and non-strictness that Curry employs. The first application investigates sorting algorithms parametrised over a comparison function. By applying a non-deterministic predicate to these sorting functions, we gain a permutation enumeration function. We compare the implementation in Curry with an implementation in Haskell that uses a monadic interface to model non-determinism. The other application that we discuss in this work is a library for probabilistic programming. Instead of modelling distributions as list of event and probability pairs, we model distributions using Curry's built-in non-determinism. In both cases we observe that the combination of non-determinism and non-strictness has advantages over an implementation using lists to model non-determinism. On the other hand, we present an idea to apply formal reasoning on effectful declarative programming languages. In order to start with simple effects, we focus on modelling a functional subset first. That is, the effects of interest are totality and partiality. We then observe that the general scheme to model these two effects can be generalised to capture a wide range of effects. Obviously, the next step is to apply the idea to model non-determinism. More precisely, we implement a model for the non-determinism of Curry: non-strict non-determinism with call-time choice. Therefore, we finally discuss why the current representation models call-by-name rather than Curry's call-by-need semantics and give an outlook on ideas to tackle this problem.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源