According to my last post in the URL: https://swi-prolog.discourse.group/t/operands-and-equation-questions/3007
It is possible to use the equation for example: my_and(bool1(a, b), bool2(c, d)). when ever I want?
In my program It loaded from other file as a predicate: some_predicate :- my_and(bool1(a, b), bool2(c, d)).
When I want to run it, I just do some_predicate.
I want to analyze it at first and extract all Atoms into a list such as [a, b, c, d].
Also for every new fact that inserted to DB, I would like to check if this equation is satisfied.
My first thought was to assign it into a variable (A) and call to a predicate which was implemented by me extract_atoms(A, List)., and then for every new fact just to do call(A).
It seems a bit problematic since the assignment is not possible.
I’m not sure how this gonna help me
My question was about the way to use this equation, as I mentioned, in 2 different ways in the same program:
Extract the Atoms into a list at first.
Check if new asserted rule is satisfying the equation (assume I have a lot of them, and for every new rule it should be checked).
Note: This equation is not part of my code, it came from other file which contain it.
Main idea of my code:
equation = read_file(equation.pl)
atoms_list = extract_atoms(equation)
while new fact is coming:
if the last inserted rule satisfied the equation:
return true