Reputation: 1662
So I'm working with I/O in prolog and I'm getting
Error: Arguments are not sufficiently instantiated
What puzzles me is why I'm not getting any information on what predicate is causing the issue.
(EDIT: In the image L2 is the name of the prolog-file shown to the left, [L2.pl] gives the same error.)
What the program should do:
The program is supposed to verify a temporal logic statement. It will read a file (Input) and from the file get: an adjacency list of how states are connected (T); another adjacency list of what formulas each state contains (L); a state (S) and a temporal logic formula (F). Then it should check if the formula F is true in state S.
Here's example of how the Input-file can look:
[[s0, [s0, s2, s1]],
[s1, [s1, s0]],
[s2, [s0, s2]]].
[[s0, [p, q]],
[s1, [p]],
[s2, [q, r]]].
s0.
p
Right now I've only implemented a trivial check to see if formula F is in state S. But the program don't want to compile and I don't understand why.
Upvotes: 0
Views: 106
Reputation: 58244
In Prolog, if you enter an identifier that is capitalized, it's considered a variable, even if it's used in the query to load a file:
?- [L2].
This attempts to load (or consult) a file whose name is given by the variable, L2
. Of course, L2
is not instantiated in the above, so this will fail with an instantiation error. For the same reason, the following will also fail:
?- [L2.pl].
The consult [...]
requires an atom for a file name. If you want an atom that starts with a capital letter, you need to use quotes. So the following will work:
?- ['L2'].
Or
?- ['L2.pl'].
Upvotes: 3