We introduce a new setting, the category of $\omega$PAP spaces, for reasoning denotationally about expressive differentiable and probabilistic programming languages. Our semantics is general enough to assign meanings to most practical probabilistic and differentiable programs, including those that use general recursion, higher-order functions, discontinuous primitives, and both discrete and continuous sampling. But crucially, it is also specific enough to exclude many pathological denotations, enabling us to establish new results about both deterministic differentiable programs and probabilistic programs. In the deterministic setting, we prove very general correctness theorems for automatic differentiation and its use within gradient descent. In the probabilistic setting, we establish the almost-everywhere differentiability of probabilistic programs' trace density functions, and the existence of convenient base measures for density computation in Monte Carlo inference. In some cases these results were previously known, but required detailed proofs with an operational flavor; by contrast, all our proofs work directly with programs' denotations.
翻译:我们引入了一个新的设置, 即 $\ omga$PAP 空间, 用于对显性、 可区别性和概率性编程语言进行评分的推理。 我们的语义非常笼统,足以给最实际的概率性和可区别性程序分配意义, 包括使用一般递归、 高阶功能、 高阶功能、 不连续的原始程序, 以及离散和连续抽样的程序。 但是, 关键是, 它也足够具体, 足以排除许多病理学评分, 使我们能够为确定性、 可区别的程序和概率性程序建立新的结果。 在确定性环境中, 我们证明我们非常一般地正确, 用于自动区分和在梯度下使用。 在概率化环境中, 我们几乎在每个地方都建立了概率性方案的痕量密度功能, 以及在蒙特卡洛 推断中存在方便的密度计算基度测量标准。 这些结果以前是已知的, 但需要有操作性的详细证据; 相比之下, 我们的所有证据都直接与程序解析。