Recursive calls over recursive data are 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.
翻译:对递归数据进行递归调用有助于生成概率分布,而概率编程允许以模块化和直观的方式表达对这些分布的计算。精确推断也很有用,但不幸的是,现有的概率编程语言不能在对递归数据的递归调用上执行精确推断,迫使程序员手动编写许多应用程序。我们介绍了一种概率语言,在其中可以自然地表达各种递归,而且可以完全进行推断。例如,概率下推自动机及其广义化很容易表达,并且可以自动导出针对它们的多项式时间分析算法。我们使用与去函数化和再函数化相关的程序转换来消除递归数据类型。这些转换通过一个线性类型系统保证正确性,并且贪心算法保证可以成功选择转换方式(如果有一种选择方案的话)。