prolog,logic,logic-programming

Prolog is searching the matches one by one, and returning query result for EACH input, not for all of them. To collect all of the matching values, you can use bagof, setof or findall metapredicates. Here is the code that is doing what you have defined: input(80). input(30). input(25). input(90)....

prolog,artificial-intelligence,logic-programming,progol

I think you can learn with positive data only in progol? http://link.springer.com/chapter/10.1007/3-540-63494-0_65 Muggleton, Stephen. "Learning from positive data." Inductive logic programming. Springer Berlin Heidelberg, 1997. 358-376. Set learning from positive data only mode to on by doing this in Progol: |- set(posonly)? ...

Is there a way? Of course: -Pick 2 members of the original list, place them in T1. -Pick 3 members in the rest and place them in T2. -The rest is T3: teams(L, T1, T2, T3) :- pick2(L, T1, L1), pick3(L1, T2, T3). pick2(L, [M1, M2], Rest) :- member(M1, L),...

Here's your spec again: The predicate should return True if list contains some false elements in the first n-1 element or if last element is True. Let's define predicate xor_check/1 like this: xor_check(List) :- booleans(List), append(ButLast,[Last],List), xor_check__aux(Last,ButLast). Above code is based on xor_check__aux/2, which in turn builds on memberd/2: xor_check__aux(true,_)....

prolog,logic-programming,logical-purity

Is the above predicate plus/3 really pure? It has some odd behavior: Sometimes it accepts arithmetic expressions, and sometimes not ; and this although all arguments are evaluated: ?- plus(3,5-3,5). true ... ?- plus(3,2,3+2). false. ?- plus(3,2,3+b). ERROR: </2: Arithmetic: `b/0' is not a function ?- plus(3,2,3+Z). ERROR: </2:...

You have a recursive clause but not a base clause. Thus, when you finish traversing the list, the last call is pred([]), which will fail as it doesn't unify with the head of you single clause for the predicate.

bash,prolog,swi-prolog,logic-programming

I think this has nothing/not much to do with SWI-prolog itself, but more with the command line handler. If I place the goal between single quotes (''), it works: swipl -s consultingfile.pl -g 'start(1)' The brackets are probably wrongly interpreted by the shell. If I use your command it gives:...

logic,proof,logic-programming,first-order-logic

My guess would be model theory since the fixpoint semantics of a logic program is its model. However, we know that |= coincides with |- for logic programs, so the semantics based on proving (=resolution) coincide with the semantics based on the fixed points (models). The preceding discussion is valid...

prolog,logic-programming,minikanren

First, allow me to compliment you on your fine pw0n1e icon. This is a tricky question to answer, largely because there are so many variants of both miniKanren and Prolog. miniKanren and Prolog are really families of languages, which makes it difficult to compare their features, or even how they...