Prolog 不等式序言

Prolog 不等式序言,prolog,inequalities,clpq,Prolog,Inequalities,Clpq,我从互联网上找到了这个不等式求解程序。它运行得很好。这就是程序 :-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=&l

我从互联网上找到了这个不等式求解程序。它运行得很好。这就是程序

:-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).
这是有效的,并给出了正确的答案

{2*x+3>=5}.
当我运行这个时,Prolog说

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

我使用的是SWI Prolog版本6.6.0。这里的问题是什么?我如何解决它。

Prolog中以小写开头的字符串不是变量。它们是原子。具体来说,
x
不是一个数字,而是原子,
'x'
,因此是错误。请参阅Prolog文档或有关Prolog基础知识的教程。可能的副本
ERROR: Unhandled exception: nf(y,_G3082): argument 1 must be a a numeric expression