I am trying to solve the following problem in Prolog, and I think I have coded it right, but my queries simply return false. Any advice on what to change? The problem is as follows:
"Bagel Alley, the local bagel shop, was always a location of furious activity during the morning commute as people stopped by to get their coffee and bagel on the way to work. Fresh made on site each morning, the bagels were highly popular and the fact that the shop also had great coffee was like icing on the cake! The people who worked at Bagel Alley were cheerful and friendly, as well as competent, so despite the large volume of customers, the wait was never long or unpleasant. Joe and four of his coworkers stopped by this morning to see what everyone was raving about and were pleasantly surprised to find that the shop lived up to its reputation. Determine the name of each coworker, what kind of bagel with its topping, and what flavor and size of coffee (small, medium, or large) each ordered."
Brad got his bagel, which wasn’t wheat, with nothing on it. Walt ordered a small coffee.
The two coworkers who got medium sized coffees were the one who got the hazelnut flavor and the one who got his bagel with peanut butter.
The one who got the onion bagel, but not with butter, also got a French vanilla coffee, but not the small size.
The five coworkers were Joe, the one who got a large coffee, the one who got Amaretto flavored coffee, the one who got a wheat bagel, and the one who got egg & bacon on his bagel.
Rick didn’t order the blueberry bagel but he did get Columbian coffee. The Amaretto coffee was ordered with the cheddar bagel but not by Walt.
The cream cheese did not come with the blueberry bagel but it did come with a large coffee. The sesame bagel came with butter but Carlos didn’t order it.
The Prolog code I have written is here:
bagels(Sol):-
Sol = [[_,_,_,_,_],[_,_,_,_,_],[_,_,_,_,_],[_,_,_,_,_],[_,_,_,_,_]],
member([brad,X,plain,_,_], Sol), X \== wheat,
member([walt,_,_,small,_], Sol),
member([_,_,_,medium1,hazelnut], Sol),
member([_,_,peanut_butter,medium2,_], Sol),
member([_,onion,Y,Z,french_vanilla], Sol), Y \== butter, Z \== small,
member([joe,Ja,Jb,Jc,Jd], Sol),Ja\==wheat,Jb\==egg_bacon,Jc\==large,Jd==amaretto,
member([La,Lb,Lc,large,Ld], Sol), La\==joe,Lb\==wheat,Lc\==egg_bacon,Ld\==amaretto,
member([Aa,Ab,Ac,Ad,amaretto], Sol), Aa\==joe,Ab\==wheat,Ac\==egg_bacon,Ad\==large,
member([Wa,wheat,Wb,Wc,Wd], Sol), Wa\==joe,Wb\==egg_bacon,Wc\==large,Wd\==amaretto,
member([Ea,Eb,egg_bacon,Ec,Ed], Sol), Ea\==joe,Eb\==wheat,Ec\==large,Ed\==amaretto,
member([rick,R,_,_,columbian], Sol),R\==blueberry,
member([A,cheddar,_,_,amaretto], Sol), A\==walt,
member([_,B,cream_cheese,large,_], Sol), B\==blueberry,
member([C,sesame,butter,_,_], Sol), C \== carlos,
member([_,_,_,other,_], Sol),
member([_,_,_,_,other], Sol).
I believe that running the query "bagels(X)." should give me the solution to the problem, but it returns false. Am I missing something? Many thanks in advance!