具有不平等的Prolog

时间:2015-01-12 17:31:30

标签: 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=<P1|Ls]):-
   sup(E,K),
   max(Ps,P1s,Ls).

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

我对这个程序的问题是,当我使用大写字母变量运行程序时,它可以工作。但它不适用于简单的字母变量。

这是我用来解决这个问题的语法。

例如: -

{2*X+3>=5}.

这样可以正确回答。

{2*x+3>=5}.

当我运行时,Prolog说

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

我正在使用SWI-Prolog版本6.6.0。这里有什么问题,我该如何解决呢。

0 个答案:

没有答案