I am trying to build an inference engine in prolog.
For example, here are some rules
R1 : A and B -> C
R2 : E and F -> D
R3 : G and T -> H
I wanted to do it like this
c :- a,b
d :- e,f
h :- g,t
but I have to use a predicate "rule/1" defined as follows
rule(Ri) :- "if conditions then conclusions".
For example :
rule(r1) :- "if a and b then c".
How can I do ?
I have found a solution :
and then use the predicate
clause/2
to iterate over the rules, like this :