(*
This file is part of the dpll(t) engine sammy
Copyright (C) 2004  The University of Iowa
Mike Decoster

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*)

(** Instantiation functionality and clause conversion. *)

exception Dontknow
exception Expression_must_be_quantified

exception Quantifier_must_have_binders

exception Var_instantiated_as_var

type instantiation_return_type = 
       FINISH
     | EXHAUSTED_INSTANTIATIONS
     | INSTANTIATIONS of Pred.pred list * Global.pred_id list list


class skolemizer : Pred_db.pred_db * Term_db.term_db ->
object

(** to be called immediately before the dpllt procedure is started *)
method finish_initial_registration : unit

method declare_abstractions_and_normalize : Pred.pred list -> Formula.exprtype -> int -> int ->(Pred.pred list * Formula.exprtype)
(**
    Returns an equivalent formula where all EXISTS phi are converted to 
    NOT FORALL NOT phi, and saves the quantifiers as abstractions.  The first int param specifies how deep in the quantifiers we currently are.

    The second int param specifies how deep we are in the formula, connective wise.
    Skolemize must be called first.
*)

method skolemize : Formula.exprtype -> Formula.exprtype
(** Returns a skolemized version of the input formula. *)

method to_cnf : Formula.exprtype -> Global.pred_id list list
(** Returns a set of proto-clauses based on the input formula. *)

(*method get_new_lemmas : instantiation_return_type*)
method get_new_lemmas : instantiation_return_type
(*Pred.pred list * Global.pred_id list list*)
(** Performs instantiation on the current model and returns FINISH if no quantifiers needed to be instantiatied
EXHAUSTED_INSTANTIATIONS if all the quantifiers in the partial model have been instantiated already(need to try something else)
or INSTANTIATIONS which contains a list of new predicates (possibly empty) and a set of new proto-clauses.
*)

method get_number_of_instantiations : unit -> int

method clear : unit
(** Completely clears all stored data in the skolemizer.  To be used with a complete restart.*)

method reset : unit
(** Clears all stored data besides the maximum depth to instantiate.*)

method get_max_quant_depth : int

method set_max_quant_depth : int -> unit

method increment_max_quant_depth : unit

method get_max_instances_per_instantiate : int
      
method set_max_instances_per_instantiate : int -> unit
      
method increase_max_instances_per_instantiate : unit
                            
method deepen : unit

method get_current_depth : int
(** Returns the number of times [deepen] has been called (resets to 0 when [clear] is called). *)

method remove_pred : Global.pred_id -> unit
(** Remove reference to one (abstract) predicate.  To be used in incremental system backtracking. *)

method set_rand_seed: int -> unit

method set_max_instances_per_call: int -> unit
end
