
Before doing this, I have a question :
Is it normal that an object importing gorgias and declared as dynamic can't be abolished ? When I try to do it, I get an error telling me that the object is static !
I tried to look for the reason, like not dynamic predicates declared in the object and used by gorgias but it doesn't seem to be the reason ...
Back to my refactoring problem :
There is 3 files in gorgias :
gorgias, lpwnf and resolve
resolve is doing what it means : it has a resolve/2 pred which is a meta prolog that try to resolve goal but using rule/3 as extended logic clause, and it keep the name of the rule (their first argument, while the second is the head and the third is the body) in a list while resolving.
So if I have :
rule(a(A), test(1), [foo(A)])
rule(foorule, foo(5), [])
and try to resolve(test(1), D), I will get D = [a(5), foorule]
resolve add to the resolving process abducibles (it is just predicates that can be assumed even if they are not in the head of a rule/3)
For now, I decided that is the one responsible of rule/3, abducible/1 (and background for the built_in predicates)
lpwnf has a predicate attack that takes a list of rule names (found by resolve for example, but also by attacks itself before) and try to "attack" each of the predicate with the attack0 rules : the attacks are for example on an abducible by a fact that contradict it, or for a rule, that there is another rule that is prefered to it (because you can put in the head of rule/3 a preference declaration), etc ...
In lpwnf I put too : complement/2 that let the user theory to specify that two predicates are in conflict and conflict/2 that generates conflicts between predicates, based on complement/2 and neg/1 which is the explicit negation as a predicate (lpwnf means : logic programmin without negation as failure

There is also isconsistent/2 that checks that a list of pred is consistent according to conflict/2
in gorgias there is the general algorithm for argumentation : it take a goal, resolve it, check for attacks on it, and then try to defend them, and again try to attack until there is no more attack or it can defend all.
So :
rule/3 are used by resolve and lpwnf
abducible/1 by resolve and lpwnf
background/1 by resolve
resolve/2 is used by gorgias and lpwnf
attacks/5 and isconsistent/2 by gorgias
A user trying to use gorgias will use :
rule/3 to declare rules and preference over rules
complement/2 to specify conflicts between predicates (for example complement(man(A), woman(A)))
abducible/1 to declare predicate that can be assumed (for example abducible(man(_)) that means that if man(test) is to be proved it will be assumed, but not if the contrary holds (so for example if woman(test) hold))
background/1 to declare predicates that should only be evaluated while doing resolve and not added to the list.
And he will call prove/2 to solve the problem.
This explanation is not very good, but I hope it will be sufficient to explain how things are working

Thanks you.