1

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.

false
  • 10,182
  • 12
  • 93
  • 182
ict
  • 105
  • 1
  • 5

2 Answers2

2

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}.
false
  • 10,182
  • 12
  • 93
  • 182
  • thnks.It worked.I want to get this answer through .pl file.So i need kind of prolog coding for that.That's what I'm looking for. – ict Aug 26 '14 at 18:36
  • Not sure what you want, but first, consult the manual on CLPQ. – false Aug 26 '14 at 18:37
  • well,what you have given can run directly via prolog compiler.But i need to do coding on a pl file and then compile it.So I need to solve above type of question by identifying left hands side and right hand side seperately .likewise. – ict Aug 26 '14 at 18:45
-1

Try the not() condition

not(2x+3 = 5)

E.K
  • 135
  • 10