:- use_module(input).
:- use_module(lub_operations, [set_union/1]).
:- use_module(facts,[fact/1]).
:- use_module(utilities, [showfacts/0]).

:- use_module(library(lists),[select/3]).

%% interface

  go(File) :-
          retractall(fact(_)),
          load_file(File),
          eager(true),
          fail.
          
  go(_) :-  showfacts.

%% logic

  eager(true) :-                       % to trigger it all off
          my_clause(Head,[]),
          eager(Head).

  eager(Atom) :-                       
          set_union(Atom),
          my_clause(Head,Body),
          select(Atom,Body,Rest),
          prove(Rest),
          eager(Head).


  prove([B|Bs]) :- fact(B), prove(Bs).  
  prove([]).



