This question is related to this one : Prolog - Reduce the knowledge base by deduction
I've removed all the fact and rules that can deducted but I now have to write new facts which have been deducted.
As an example :
conclusion_premise( is_a( X, thing), is_a( X, house ) )
will become : is_a( X, thing) :- is_a( X, house).
In a way I need to split the rule conclusion_premise(A,B)
but how can I get A = is_a(X, thing)
and B = is_a(X, house)
.
Thanks again.
EDITED
So far I have this to clean up the database :
clean_database:-
findall( Conclusion, ( conclusion_premise( Conclusion, Premise ), Premise ), L ),
list_to_set( L, L_no_duplicate),
removeFactcs(L_no_duplicate),
conclusion_premise(A,B), B, retract(conclusion_premise(A,B)).
% need somehow to add the rule that have been deducted.
removeFactcs([]).
removeFactcs([X|XS]) :-
retract(X),
removeFactcs(XS).