Logic Programs with Intensional Functions