Inequalities solver using prolog

170 views Asked by At

I am new to Prolog and inequalities.I want to solve following type of inequality question using Prolog. I am using SWI-Prolog.

eg: 2x+3>5 is the question.How can I write a program to get the answer of this program x>1.

2

There are 2 answers

0
E.K On

Try the not() condition

not(2x+3 = 5)

3
false On

It is not quite clear what you want, but you might want to solve these equations in the rationals. In this case, library(clpq) might be interesting to you. Below is running in SWI 6.

?- use_module(library(clpq)).
% library(clpq) compiled into clpq 0.25 sec, 2,727 clauses
true.

?- {2*X+3>5}.
{X>1}.