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.
翻译:递归调用递归数据对于生成概率分布十分有用,而概率编程能够以模块化且直观的方式表达这些分布上的计算。精确推理同样具有重要价值,但遗憾的是,现有概率编程语言无法对递归数据上的递归调用执行精确推理,迫使程序员手动编写许多应用程序。我们引入了一种概率语言,其中可自然表达多种递归形式,并能精确执行推理。例如,概率下推自动机及其泛化可轻松表达,且其多项式时间解析算法能够自动推导得出。我们通过与非函数化和重函数化相关的程序变换来消除递归数据类型。这些变换由线性类型系统保证正确性,且若存在成功变换方案,贪婪算法能够保证找到该方案。