Recursive calls over recursive data are widely useful for generating probability distributions, and probabilistic programming allows computations over these distributions to be expressed in a modular and intuitive way. Exact inference is also useful, but unfortunately, existing probabilistic programming languages do not perform exact inference on recursive calls over recursive data, forcing programmers to code many applications manually. We introduce a probabilistic language in which a wide variety of recursion can be expressed naturally, and inference carried out exactly. For instance, probabilistic pushdown automata and their generalizations are easy to express, and polynomial-time parsing algorithms for them are derived automatically. We eliminate recursive data types using program transformations related to defunctionalization and refunctionalization. These transformations are assured correct by a linear type system, and a successful choice of transformations, if there is one, is guaranteed to be found by a greedy algorithm.
翻译:对递归数据的精确调用对于产生概率分布非常有用,而且概率编程可以使这些分布的计算能够以模块和直觉的方式表达。精确的推论也是有用的,但不幸的是,现有的概率编程语言对循环调用对循环数据并不产生精确的推论,迫使程序员手工对许多应用程序进行编码。我们采用了一种概率语言,可以自然地表达各种递解,并精确地进行推论。例如,概率推移自动数据及其一般化很容易表达,并且自动生成其多时分配算法。我们用与分解和再功能化有关的程序转换来消除循环数据类型。这些转换得到线性类型系统保证正确无误,如果有的话,则保证通过贪婪算法来成功选择变法。