0

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).
Vini
  • 116
  • 1
  • 7
  • @GuyCoder Thanks for your reply. I'm aware of the `=..` and it's use like this example `?- foo(hello, X) =.. List. List = [foo, hello, X] ` but I can't get it to work. – Vini Apr 22 '18 at 17:42
  • @GuyCoder Yes that is exactly what I'm trying to do. – Vini Apr 22 '18 at 18:34

0 Answers0