Prolog with simplification