An infinite loop is generated when the inferential motor is activated to make the necessary inferences.
The rules and facts have been defined according to a specific syntax for the meta-interpreter I am using.
The rule is a quintuple in which the second field is the consequence of the rule while the third field are the conditions for activating a rule.
The cycle is caused by the updating of the id (I1) through the term nextID, which I used to make sure that each assert the id is incremented This is my knowledge base:
Rules:
rule(1,[gn(Name,Surname,I1),retract(nextID(I)),nextID(I1)],
and([person(Name,Surname),nextID(I),call_p(I1 is I+1),Name=='john']),1,1).
Facts:
fact(1,nextID(0),1).
fact(2,person(john,black),1).
How should I modify the rule in such a way that the infinite loop is not created?