prove(Fact):- if_then(Conditions,Fact), infer_each(Conditions). prove(Fact):- ask(Fact). infer_each([]). infer_each([Fact|Rest]):- prove(Fact), infer_each(Rest). ask(Fact):- write('Is it true that '), write(Fact), write('?'), nl, read(Ans), Ans=yes. run:- retractall(if_then(_,_)), write('Select a knowledge base ...'), read(KB), load_files([KB], [compilation_mode(assert_all)]), write('Type in a goal ...'), read(Goal), prove(Goal), write('Proved!'), nl, !. run:- write('Not proved!'), nl.