Given a set of constraints, I would like to efficiently generate the set of values.
Suppose I have a few constraints on my Thungus[1]:
goodThungus(X) :-
X > 100,
X < 1000.
sin(X) = 0.
Now, I can check a Thungus by asking:
goodThungus(500).
I would like to generate all good Thungi. I'm ...
Hi,
i have a problem with a variable in Prolog.
I must resolve the tantrix domino in prolog, this is a game size by 56 hexagonal tile with 4 different color on sides.
The tantrix domino consist to align the different tile so the colour match. Each tile can be rotated to match the colors with the previous tile.
In Prolog i have three d...
hi,
I have been learning prolog.. I'm using a editor named prol1.1.1 I need to write rule to compare 2 strings, when i give something like
rel(a1,b1).
rel(a2,b2).
rel(b2,c2).
associatedWith(X,Y,Z) :- rel(X,Y),rel(Y,Z).
?- associatedWith(X,Y,Z).
it works
but when i give
?- associatedWith(X,Y,Z),X=\=Z.
i get parser exception
Par...
Hello.
I have written a set of two predicates to test whether a number is a square number.
patrat_perfect(A):- patr(A, 0).
patr(A, S):- A =:= S * S.
patr(A,S):- A > S * S, T is S+1, patrat(A, T).
patr(A,S):- A < S * S, fail.
The first predicate, patrat_perfect simply execute a call for the second predicate with the value 0 for the...
Are there any? Academic, Industry, mix, conferences on logic with a strong Prolog flavor?
...
I am trying to write a predicate to transform an array of elements into a set of elements. In order to do so, I have created the following predicates in swi-prolog:
sterge(_, [], []).
sterge(A, [A|L], New):-
sterge(A, L, New).
sterge(A, [B|L], [B|New]):-
A \= B,
sterge(A, L, New).
multime(A, New):-
mult(A, [], New).
mult([], ...
I can't make any sense out of this: If I give prolog reverse([], A). it works fine, if I give it reverse(A, []). and answer ; on first suggestion it hangs!
Why? (Same result for both gnuprolog and sicstus prolog!)
aioobe@r60:~$ prolog
GNU Prolog 1.3.0
By Daniel Diaz
Copyright (C) 1999-2007 Daniel Diaz
| ?- reverse([], A).
A = []
yes
...
http://muaddibspace.blogspot.com/2008/01/type-inference-for-simply-typed-lambda.html is a concise definition of the simply typed lambda calculus in Prolog.
It looks okay, but then he purports to assign a type to the Y combinator... whereas in a very real sense the entire purpose of adding types to lambda calculus is to refuse to assign ...
Hi there,
I am trying to use a a java-prolog layer on top of my current agent-based simulation. I am running Mac OS X Snow Leopard and Netbeans 6.9 and tried to use JPL from swi-prolog however I haven't managed to run a test successfully due to problems with the libraries and their paths. I need a very fast implementation and I was wond...
I need to make GUI in visual studio to link prolog files. I want to know how to get swi-prolog files to be included in my visual studio 2008?
...
i downloaded the tuprolog and i'm not able to get the result for the following query, while i get answer in PROL ide.. can someone help?
verb(admit-1).
verb(work-4).
nsubjpass(admit-1, patient-2).
agent(admit-1, doctor-3).
nsubj(work-4, who-5).
aux(work-4, be-6).
rcmod(doctor-3, work-4).
prep_in(work-4, clinic-7).
aggregation('part of...
Hi,
I'm getting this exception
Exception in thread "main" alice.tuprolog.InvalidTheoryException: The term part is not ended with a period.
at alice.tuprolog.TheoryManager.consult(Unknown Source)
at alice.tuprolog.Prolog.addTheory(Unknown Source)
at alice.tuprolog.Prolog.setTheory(Unknown Source)
at javaapplication9.Main...
emissionOf(alpha).
emissionOf(beta).
detected(proton), detected(electron) :- emissionOf(alpha), emissionOf(beta).
I'm facing the problem that for some (probably obvious) reason Prolog doesn't accept the last line of the above code. The reason has something to do with:
detected(proton), detected(electron)
If I try just
detected(pr...
at work there was discussion of using prolog as the backend for a rules engine on an web-app. how would this get tied into existing systems? are there available prolog libraries for other languages allowing invocation of prolog modules.
...
question is:
when we key in mem([1,2,3,4,5]).
we will get the output as bellow:
odd=3
even=2
my coding is like that but cannot run. can help me check where is my mistake??
mem(X,[X|L]).
mem(X,[element|L]):-
mem([X,L]).
count([],L,L).
count([X|H],L1,L2):-
write(even),
X%2=0,nl,
write(odd),
X%2>=1,nl,
count...
I need write a set of clauses that take a list of integer lists and return a single list with all the elements doubled.
For example:
?- double([[1,2],[3]], X).
Yes
X = [2,4,6]
I have a set of clauses called mega_append that return a single list from a list of lists.
For example:
?- mega_append([[1,2],[3]], X).
Yes
X = [1,2,3]
Her...
I have defined a prolog file with the following code:
divisible(X, Y) :-
X mod Y =:= 0.
divisibleBy(X, Y) :-
divisible(X, Y).
op(35,xfx,divisibleBy).
Prolog is complaining that
'$record_clause'/2: No permission to modify static_procedure `op/3'
What am I doing wrong? I want to define an divisibleBy operator that will a...
Predicates
is_a(X,Y) X is a doctor/handyman
drives(X,Y) X drives Y
We are given that a doctor drives a sportscar and a handyman drives a 4WD
is_a(john,doctor).
is_a(david,handyman).
Now i want the code decide what kind of car john/david are driving. I tried doing:
drives(X,sportscar) :- is_a(X,doctor).
drives(Y,4WD) :- is_a...
I have the following inequalities on 21 variables:
http://pastebin.com/raw.php?i=FTU970Em
When I run "Reduce[ineq,Integers]" on this, Mathematica hangs for a
long time.
That makes sense: there are MANY sets of values for x[1]..x[21] that
satisfy the inequalities.
All I really want is bounds for each variable (eg, "2 <= x[i] <= ...
i need to check if a string is available in given prolog statement
example
related('also-5','be-8').
i want to check if be is there in this statement how to do?
please give me some link to detailed tutorial on string handling in prolog
...