logic programming foundations 2405349