Templates are now matched by generating a predicate and a logic goal
that calls the predicate.