当前位置:
X-MOL 学术
›
arXiv.cs.PL
›
论文详情
Our official English website, www.x-mol.net, welcomes your
feedback! (Note: you will need to create a separate account there.)
Effectful Programming in Declarative Languages with an Emphasis on Non-Determinism: Applications and Formal Reasoning
arXiv - CS - Programming Languages Pub Date : 2020-06-02 , DOI: arxiv-2006.01531 Sandra Dylus
arXiv - CS - Programming Languages Pub Date : 2020-06-02 , DOI: arxiv-2006.01531 Sandra Dylus
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.
中文翻译:
强调非确定性的声明式语言中的有效编程:应用和形式推理
本论文研究了有效的声明式编程,重点是非确定性作为一种效果。一方面,我们有兴趣开发使用非确定性作为底层实现思想的应用程序。我们讨论了两个使用函数式逻辑编程语言 Curry 的应用程序。这些实现的关键思想是利用 Curry 所采用的非确定性和非严格性之间的相互作用。第一个应用程序研究在比较函数上参数化的排序算法。通过对这些排序函数应用非确定性谓词,我们获得了一个置换枚举函数。我们将 Curry 中的实现与 Haskell 中的实现进行比较,后者使用 monadic 接口来模拟非确定性。我们在这项工作中讨论的另一个应用程序是概率编程库。我们没有将分布建模为事件和概率对列表,而是使用 Curry 的内置非确定性对分布进行建模。在这两种情况下,我们观察到非确定性和非严格性的组合比使用列表来模拟非确定性的实现具有优势。另一方面,我们提出了将形式推理应用于有效的声明式编程语言的想法。为了从简单的效果开始,我们首先专注于对功能子集进行建模。也就是说,利益的影响是整体性和偏向性。然后我们观察到对这两种效应建模的一般方案可以推广以捕获广泛的效应。显然,下一步是将这个想法应用到非确定性模型中。更准确地说,我们为 Curry 的非确定性实现了一个模型:具有调用时间选择的非严格非确定性。因此,我们最终讨论了为什么当前的表示模型是按名称调用而不是 Curry 的按需求调用语义,并给出解决这个问题的想法的展望。
更新日期:2020-06-03
中文翻译:
强调非确定性的声明式语言中的有效编程:应用和形式推理
本论文研究了有效的声明式编程,重点是非确定性作为一种效果。一方面,我们有兴趣开发使用非确定性作为底层实现思想的应用程序。我们讨论了两个使用函数式逻辑编程语言 Curry 的应用程序。这些实现的关键思想是利用 Curry 所采用的非确定性和非严格性之间的相互作用。第一个应用程序研究在比较函数上参数化的排序算法。通过对这些排序函数应用非确定性谓词,我们获得了一个置换枚举函数。我们将 Curry 中的实现与 Haskell 中的实现进行比较,后者使用 monadic 接口来模拟非确定性。我们在这项工作中讨论的另一个应用程序是概率编程库。我们没有将分布建模为事件和概率对列表,而是使用 Curry 的内置非确定性对分布进行建模。在这两种情况下,我们观察到非确定性和非严格性的组合比使用列表来模拟非确定性的实现具有优势。另一方面,我们提出了将形式推理应用于有效的声明式编程语言的想法。为了从简单的效果开始,我们首先专注于对功能子集进行建模。也就是说,利益的影响是整体性和偏向性。然后我们观察到对这两种效应建模的一般方案可以推广以捕获广泛的效应。显然,下一步是将这个想法应用到非确定性模型中。更准确地说,我们为 Curry 的非确定性实现了一个模型:具有调用时间选择的非严格非确定性。因此,我们最终讨论了为什么当前的表示模型是按名称调用而不是 Curry 的按需求调用语义,并给出解决这个问题的想法的展望。