import planner. main => S0=[s,s,s,s], % best_plan(S0,Plan), plan_unbounded(S0,Plan), % best_plan_unbounded(S0,Plan), writeln(Plan). final([n,n,n,n]) => true. action([F,F,G,C],S1,Action,ActionCost) ?=> Action=farmer_wolf, ActionCost=1, opposite(F,F1), S1=[F1,F1,G,C], not unsafe(S1). action([F,W,F,C],S1,Action,ActionCost) ?=> Action=farmer_goat, ActionCost=1, opposite(F,F1), S1=[F1,W,F1,C], not unsafe(S1). action([F,W,G,F],S1,Action,ActionCost) ?=> Action=farmer_cabbage, ActionCost=1, opposite(F,F1), S1=[F1,W,G,F1], not unsafe(S1). action([F,W,G,C],S1,Action,ActionCost) => Action=farmer_alone, ActionCost=1, opposite(F,F1), S1=[F1,W,G,C], not unsafe(S1). index (+,-) (-,+) opposite(n,s). opposite(s,n). unsafe([F,W,G,_C]),W==G,F!==W => true. unsafe([F,_W,G,C]),G==C,F!==G => true.