Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [instantiation-error]

An instantiation error occurs in Prolog when an argument is insufficiently instantiated. It is frequently encountered with (is)/2 and the built-ins for arithmetical comparison like (>)/2 and (=:=)/2 that all expect variable free expressions.

0
votes
2answers
37 views

C++ Using Abstract Classes in Template Classes

Suppose I have a template class such as: template <class type, size> class myTemplate and I had an abstract base class: class myDataType and various derived classes class subDataType1 : ...
0
votes
1answer
79 views

Why this Goldbach's conjecture program does not work in Prolog?

Why does this program does not work in Prolog ? % Goldbach's conjecture. % Goldbach's conjecture says that every positive even number greater % than 2 is the sum of two prime numbers. Example: 28 =...
0
votes
0answers
54 views

Simple Prolog Hangman game error

I am trying to develop a simple hangman game as a homework for a subject in university. It is very simples but I am having trouble and I am unable to make it work. This the code: member(El,[El|_]). ...
1
vote
0answers
31 views

How to count base clauses in another module in Prolog

In list.pl there is: :- module(list, [people/1, friend/2]). people([a, b, c, d, e]). friend(a, c). friend(b, c). friend(c, d). friend(c, e). There may be another friend relations and people in ...
0
votes
0answers
50 views

is/2: Arguments are not sufficiently instantiated

I am trying to write a prolog code to find Bezout constants for gcd. I tried this code : gcdCoef(A,B,X,Y) :- Z is A*X + B*Y, gcd(A,B,Z). but when I Execute the query ?- gcdCoef(12,20,M,N). it gives ...
1
vote
1answer
87 views

Prolog - Arguments insufficiently instantiated

I am new to prolog, and I have built the following sample function: bar(Fruit) :- Fruit = fruit(apple, X), A is abs(X) + 0, between(0,10,A). foo(L) :- findall(X, bar(fruit(apple, X)), L)....
0
votes
0answers
53 views

Prolog findall - Arguments are not sufficiently instantiated

location(T1,R,C) :- T0 is T1 - 1, RN is R - 1, RS is R + 1, CW is C - 1, CE is C + 1, ( ((action(T0,eat);action(T0,clockWise);action(T0,counterClockWise)), location(T0,R,C)); (...
1
vote
2answers
81 views

findall Arguments are not sufficiently instantiated

I have simplified my code down to; findall(T,(T > 0, T < 50),List). Why would this fail with given error.
0
votes
2answers
93 views

Prolog - Arguments are not sufficiently instantiated. lists/recursion

I am trying to get the maximum number from a given list 'L' and assign it to a variable, so I used to write the following function: max(L,X):- [H|Q]=L, (X<H -> X=H), length(Q,QLEN), ...
2
votes
1answer
65 views

Why does =:= give an error when the variable is not instantiated, but == doesn't?

3 == X. would result in the answer 'no', but 3 =:= X would result in an error : ! Instantiation error in argument 2 of (=:=)/2 ! goal: 3=:=_409 Why is this happening? Shouldn't both of them ...
2
votes
1answer
63 views

Recurrence results stored in list in Prolog

I am trying to create a Prolog program for solving the recurrent equation: f(1)=2, f(2)=5, f(n)=f(n-1)+2*f(n-2) I managed with the rec function below, but I have trouble when I want to store the ...
1
vote
1answer
79 views

Prolog - Arguments are not sufficiently instantiated. Recursion depth

I'm new to prolog and want to limit recursion depth, but it keeps throwing "Arguments are not sufficiently instantiated" error. I'll generalise the problem to a graph. edge(a,b). edge(a,x). edge(b,c)....
0
votes
0answers
50 views

Homework Prolog Help: =:=/2: Arguments are not sufficiently instantiated

I don't want to have to post the whole homework assignment and all my code online, so I'll just put where the specific problems takes place. I can add and explain more if necessary. But essentially, ...
2
votes
2answers
77 views

Prolog Arguments are not sufficiently instantiated, R is [H|R1]

I've read a few questions that are an identical question but different code, sadly another one is being posted. I'm following my professors notes and modeling my insert statement identical to their ...
2
votes
0answers
38 views

Error occurring while evaluation of expression in prolog

I am very new to Prolog. I need to find all the paths from Source to Destination in a maze. I wrote the following clause so that I do not have to write all the edge relations explicitly: neighbour(X,...
4
votes
4answers
16k views

Program to generate fibonacci series in GNU Prolog is giving an instantiation error

This is my code:- fib(0,0). fib(1,1). fib(F,N) :- N>1, N1 is N-1, N2 is N-2, F is F1+F2, fib(F1,N1), fib(F2,N2), write(F," ,"). On consulting in GNU Prolog, I am ...
0
votes
0answers
81 views

Prolog counting max distance of not negative sum in 2 lists

what i want to find is the maximum J-I (in terms of arrays) where the element of the first list is bigger than the element of the second list and get that max difference. My problem is that i cannot ...
4
votes
1answer
122 views

Prolog: Head of a variable list is not instantated

I'm writing a simple code generating a simple list with 5 numbers whose first variable should be positive and I'm trying to understand why this code fails test([H|T]) :- H > 0, length(T,4). when ...
0
votes
1answer
1k views

Prolog — Arguments are not sufficiently instantiated

I am trying to check for even/odd players and even/odd columns in a game by counting the players and the columns. At some point, it seems I am not instantiating my variables correctly. Here is how I ...
1
vote
0answers
83 views

Prolog - Solve Logic Puzzle

I'm trying to experiment with Prolog and wanted to be able to use it to solve an LSAT problem question. I wrote the following: actor("Mark",B):- B >= 0, B < 5, D < B,...
0
votes
1answer
68 views

Prolog: arguments not sufficiently instantiated (sum of list 1+2+…+n)

I need to write a predicate listsum(L, S) which is true iff L is a list of natural numbers increasing from 1 to a certain n (i.e. [1,2,..,n]). Now I got it working for queries of the kind listsum(L, &...
1
vote
1answer
310 views

Checking whether the tree is avl-tree in prolog. error

My programm is not working correct. When I try to test it I have an error. My example for testing: if_avl_tree(t(t(t(nil/0, 3, nil/0)/1, 7, t(t(nil/0, 9, nil/0)/1, 11, nil/0)/2)/3, 16, t(nil/0, 25, ...
1
vote
1answer
60 views

Prolog - average predicate: Arguments not sufficiently instantiated

I have a list of cars (auto in german), where the first Variable is the license-plate and the second one the speed: [auto(eu-ts884, 69), auto(dn-gh184, 64), auto(ac-lj123, 72)]. Now I try to write ...
5
votes
1answer
2k views

Can this be made tail-recursive in Prolog?

I'm learning Prolog, and as an exercise, I'm experimenting with a simple database that calculates the sum of all numbers up to the given number (i.e. 0=0, 1=1, 2=3, 3=6, 4=10, ...). Easy enough: ...
1
vote
1answer
57 views

prolog arguments are not sufficently instantiated

I am trying to find max,mid and min number from 3 given number. The code is: t_max(X,Y,Z):- A is max(max(X,Y),max(Y,Z)), C is min(min(X,Y),min(Y,Z)), (X>=A,X=<C)->B is X; (Y&...
4
votes
2answers
292 views

Enumerating binary trees in Prolog

I am trying to create Prolog rules to enumerate 'binary trees' in list form in Prolog. I am new to Prolog. A tree with 0 nodes is an empty list: [] A tree with 1 node is: [[],[]] A tree with 2 ...
2
votes
2answers
141 views

Prolog:: f(x) recursion

I'm a beginner to Prolog and have two requirements: f(1) = 1 f(x) = 5x + x^2 + f(x - 1) rules: f(1,1). f(X,Y) :- Y is 5 * X + X * X + f(X-1,Y). query: f(4,X). Output: ERROR: is/2: Arguments ...
2
votes
1answer
1k views

Resolve quadratic equation in prolog

I got problem with quadrating equation implementation in prolog. I know some basics but at same point I can not understand output of swish.swi console. I would appreciate any help or suggestions from ...
1
vote
1answer
54 views

Counting variables during recursion

I want to create a program, which should determine the differences between two lists with equal length and give out the number of differences in a variable. My code so far is: difference([],[],0). ...
0
votes
1answer
113 views

Arguments aren't sufficient instantiated

I read my code for an hour but I'm not able to understand where the problem is. I read that this error means that I use an argument I didn't instantiate before but I can't see where it is. Can you ...
1
vote
1answer
87 views

Prolog arguments are not sufficiently instantiated (function which calculates list length)

I made a function which calculates a list length. Below is my code. listLength(LIST) :- solve(LIST, LENGTH), write(LENGTH). solve([], _). solve([_|T], LENGTH) :- ADD is LENGTH + 1, solve(T, ADD). ...
1
vote
2answers
344 views

Prolog count numbers of elements Error

I'm learning prolog, and I want to count a specific element occurence in a list. So here is the code - count(_, [], _) := !. count(El, [El|T], N) :- N1 is N + 1, count(El, T, N1). count(El,...
2
votes
1answer
85 views

Prolog: ERROR: >/2: Arguments are not sufficiently instantiated

The code at the end on my post is supposed to answer the following puzzle: Brown, Clark, Jones and Smith are 4 substantial citizens who serve their community as achitect, banker, doctor and ...
3
votes
1answer
280 views

Prolog ERROR: is/2: Arguments are not sufficiently instantiated

I'm new to Prolog. I wrote a very short program as follows: plus(X,Y,R):- R is X+Y. When I run it, I get the following problem: ?- plus(1,1,2). true ?- plus(1,1,X). X=2 ?- plus(1,X,2). ERROR: is/2: ...
1
vote
1answer
401 views

Labeling in Prolog constraint programming

I am new to Prolog and currently working on a simple constraint programming problem. So I have four real numbers A,B,C,D with the property such that A+B+C+d = ABC*D = 7.11 Since it is easier to work ...
1
vote
1answer
479 views

Simple Prolog program: “Arguments are not sufficiently instantiated” error

I am writing a Prolog predicate that cuts first three elements off a numbered list and prints the result. An example of a numbered list: [e(f,1),e(o,2),e(o,3),e(b,4),e(a,5),e(r,6)]. The original ...
2
votes
2answers
71 views

Prolog: Predicate that tells if given integer is a power of two and is usable as a generator

I would like to have a predicate isPowTwo/1 which holds for every power of two. Here is my approach: isPowTwo(N) :- N > 0, N is N /\ (-N). It works good, if I give integers to it: ?- isPowTwo(2)....
1
vote
1answer
272 views

Solving linear programming with Prolog

I am trying to solve first linear programming problem example on http://www.zweigmedia.com/RealWorld/tutorialsf4/framesLinProGr.html. X and Y are zero or positives, their sum can be upto 50, 2X+Y can ...
4
votes
2answers
2k views

Not sufficiently instantiated arguments in `is/2`

For my "Declarative Languages" class we have to write a prolog program that solves Tangram puzzles. A puzzle is identified by a list of coordinates of the points of the puzzle. For example, puzzle(7,[...
2
votes
1answer
85 views

Trying to generate list of non-zero integers in Prolog

I'm trying to define the function int(?X) in prolog which is a non-zero integer number generator which works like this: ?- int(X). X = 1 ; X = -1 ; X = 2 ; X = -2 ; I tried the following with no ...
2
votes
1answer
60 views

Prolog Difference Of Squares

I want to find difference between square of a+1 and square of a is 2a+1 in prolog. For this reason i wrote code like this: :- use_module(library(clpfd)). kare(X,Y):- Y #= X*X. abc(A,B,F) :- ...
0
votes
1answer
46 views

Why Arguments are not sufficiently instantiated?

it is my implementation of finding minimum on list: min(L, M) :- min(L, M, M). min([], M, M). min([Head|Tail], Acc, M) :- NewAcc is min(Acc, Head), min(Tail, NewAcc, M). min([1,2,3,4,5,6], 1). ...
2
votes
4answers
145 views

Searching in files in prolog

hello i was trying to create a code that would find a given character from an input file and print out it position, here's what i came out with "with a help from similar problems I've found" process2(...
2
votes
1answer
99 views

Can between/3 not be recursive?

I've seen the Prolog Prologue definition of between/3: between(Lower, Upper, Lower) :- Lower =< Upper. between(Lower1, Upper, X) :- Lower1 < Upper, Lower2 is Lower1 + 1, between(...
1
vote
1answer
284 views

Instantiation fault ECLiPSe CSP

I have problems with my CSP under ECLiPSe. I wish to add a constraint to my cryptogram which requires that the number represented by TWO is divisible by 2. [eclipse 11]: test(Xs). instantiation fault ...
10
votes
5answers
20k views

Simple prolog program. Getting error: >/2: Arguments are not sufficiently instantiated

I made a Prolog predicate posAt(List1,P,List2) that tests whether the element at position P of List1 and List2 are equal: posAt([X|Z], 1, [Y|W]) :- X = Y. posAt([Z|X], K, [W|Y]) :- K > 1, ...
1
vote
1answer
5k views

SWI-Prolog: ERROR: is/2: Arguments are not sufficiently instantiated

I'm trying to create a program that prints how many smooth numbers are within an interval. A part of the code is here: countsmooth(_, [], _, _, Count) :- Count is 0. countsmooth(X, [H|T], Min, Max,...
3
votes
2answers
626 views

Keep getting the error message “Arguments are not sufficiently instantiated” can't understand why

Keep getting the error Arguments are not sufficiently instantiated for the multiplication by addition rule I wrote as shown below. mult(_, 0, 0). %base case for ...
1
vote
1answer
79 views

Argument not sufficiently instantiated

So, I just started with Prolog, and I keep getting this error of Singleton variable (Quo,C) and Argumnets not substantially instantiated. Quo:- read(A), read(B), C is A/B, write(C). ...
3
votes
1answer
456 views

Error using string_to_atom: Arguments are not sufficiently instantiated

I'm working on a URI parser in Prolog, but at the moment I'm stuck with something much simpler. I am exploring a string to find a particular char, ":", and when I find it, I want to have a string that ...