I am working on SWI Prolog. I have some facts in my database. I am unable to figure out how to use 'greater than' operator(>) when constructing a new rule.
I have some facts of the form
student(john,3.2,cs).
student(mike,3.9,cs).
showing that john is a student, has a 3.2 cgpa, and belongs to CS department, similarly for mike.
Now i want to add a rule to my database
deanlist(X) which will return true if X's cgpa is greater than 3.8
According to my knowledge, i can add this rule as follows
deanlist(X):-
X's cgpa is greater than 3.8
if i go with brute force approach, i can enlist all possibilites of cgpa greater than 3.8 using OR operator. Like i can add rule like
deanlist(X):-
student(X,3.81,cs)
; student(X,3.82,cs)
; student(X,3.82,cs)
.......so on to
student(X,4.0,cs).
But i don't want to go that way because it becomes hard coded and should be avoided.
I have explore the following links
http://boklm.eu/prolog/page_10.html#101
http://www.swi-prolog.org/pldoc/man?section=operators
But i could not figure out how to use greater than operator in my case.
Please tell me how to use greater than operator in this case. Thanks