A Semantics for Typed Logic Programs