Tutorial 5: Church Programming


#1

The unit on modelling human cognition introduced a framework based on the creation of generative models of the physical and social worlds that enable probabilistic inference about objects, agents, and events. The Church programming language was designed to facilitate the implementation and testing of such models. In this tutorial, you will first learn the syntax and some basic primitives of the Church language, and how to define functions that implement simple probabilistic models and inference methods. The concepts are then explored through examples such as hypothesis testing in the domain of coin-flipping, and reasoning about the goals and beliefs of an agent.

image

Josh Tenenbaum and colleagues propose that our intuitions about properties like the stability of a stack of blocks, may derive from “probabilistic programs” that can simulate, with some uncertainty, the physics that governs how objects behave in space and time. Such programs can be implemented and tested using probabilistic programming languages such as the Church language. (Image courtesy of Josh Tenenbaum, used with permission.)

Unit Activities

Useful Background

  • Introductions to probability and probabilistic approaches to modelling behaviour
  • Video lectures on computational models of cognition by Josh Tenenbaum
  • Introduction to computer programming

Syllabus: Brains, Minds & Machines
#2

Tutorial 5.1: Church Programming Language Part 1


Description: Learn the Church programming language, which facilitates the implementation and testing of generative models of physical and social worlds that enable probabilistic inferences about objects, agents and events.

Instructor: Tomer Ullman


Click here for the tutorial transcript

Click here for the tutorial slides


Syllabus: Brains, Minds & Machines
#3

Tutorial 5.2: Church Programming Language Part 2


Description: Learn the Church programming language, which facilitates the implementation and testing of generative models of physical and social worlds that enable probabilistic inferences about objects, agents and events.

Instructor: Tomer Ullman


Click here for the tutorial transcript

Click here for the tutorial slides


Syllabus: Brains, Minds & Machines
#4

Code

Church_examples (RTF) contains the code examples described in the two-part tutorial video. These examples can be executed by copying the code into one of the following Church programming environments. Code can also be written from scratch and modified in these environments:

  1. First edition of the Probabilistic Models of Cognition electronic text, cited in the section below on Future Study , which includes a separate Play space where code can be copied, modified, and executed
  2. webchurch engine that runs Church code in a web browser, which is available on GitHub for download onto your local computer

Further Study

Goodman, N. D., and J. B. Tenenbaum. Probabilistic Models of Cognition, First Edition (electronic).

  • This interactive text introduces many probabilistic modeling techniques and contains an embedded Church programming environment with coding examples throughout the text that can be modified and executed in place. The text also includes a separate Play space and Church language reference.

Goodman, N. D, and J. B. Tenenbaum. Probabilistic Models of Cognition, Second Edition (electronic). With programming exercises written in the web-based probabilistic programming language, WebPPL.

Goodman, N. D., and A. Stuhlmüller. The Design and Implementation of Probabilistic Programming Languages . (electronic)

  • This online text describes how probablistic programming languages (PPLs) can be embedded in other languages, and introduces the WebPPL language, a web-based PPL embedded in JavaScript.

forestdb.org: A repository of probabilistic models implemented in the Church language

The Church language is one of several probabilistic programming languages. Learn more about such languages at the Probabilistic-Programming wiki.


Syllabus: Brains, Minds & Machines