Filter-based applications

This pull request adds an API for creating predicate-based applications. All the boolean operators are lifted to the application API. In addition, you can use the `filter` operator to turn a predicate-based application into a policy-based application.

Depends on #342.