Typed Horn Logic