Prolog with inequalities

436 views Asked by At

I found this inequality solving program from some Internet source.It works well.This is the program.

:-use_module(library(clpq)).

dec_inc(Left,Right):-
   copy_term(Left-Right,CopyLeft-CopyRight).
   tell_cs(CopyLeft).
   max(CopyRight,Right,Leq).
   tell_cs(Leq).

max([],[],[]).
max([E=<_|Ps],[_=<P1|P1s],[K=<P1|Ls]):-
   sup(E,K),
   max(Ps,P1s,Ls).

tell_cs([]).
tell_cs([C|Cs]):-                                   
   {C},
   tell_cs(Cs).

The problem I have regarding this program is when I run the program using capital letter variable it works.But it doesn't work for simple letter variables.

This is the syntax i used to solve this problem.

eg:-

{2*X+3>=5}.

This works and gives the correct answer.

{2*x+3>=5}.

When i run this, Prolog says

ERROR: Unhandled exception: nf(y,_G3082): argument 1 must be a a numeric expression

I'm using SWI-Prolog version 6.6.0.What is the problem here and how can I solve it.

0

There are 0 answers