:- module(tp, [go/1]).

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


%% interface

  go(File) :-
      retractall(fact(_)),
      load_file(File),
      iterate,
      showfacts.

%% control

 iterate :- operator, fail.
 iterate :- retract(flag), iterate.
 iterate.

%% logic

  operator :- 
      my_clause(Head,Body),  
      prove(Body), 
      set_union(Head).

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

