:- module(tp_abs, [go/2]).


:- use_module(input_normalize).
:- use_module(unification_operations, [unify/2]).
:- use_module(lub_operations, [lub/1]).

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


%% interface

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

%% control

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

%% logic

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

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

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







