<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% light_meal.prolog
% http://www.swi-prolog.org/man/clpqr.html
% from Mark Wallace: Constraint Programming.  1995 paper

:- use_module(library(clpq)).

lightmeal(A,M,D) :-
{I &gt; 0, J &gt; 0, K &gt; 0,
 I + J + K =&lt; 10},
    appetizer(A,I),
    main(M,J),
    dessert(D,K).

main(M,I) :- meat(M,I).
main(M,I) :- fish(M,I).

appetizer(raddishes,1).
appetizer(pasta,10).

meat(beef,10).
meat(pork,7).

fish(sole, 2).
fish(tuna, 4).

dessert(fruit, 2).
dessert(icecream, 6).
</pre></body></html>