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

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.
*)

(* satbox.mli *)

exception SBI_Incons

val get_additional_preds : unit -> Global.pred_id list
(** Retrieve the list of literals that have been determined through BCP at this level.
Order matters -- this will return the OLDEST FIRST *)

val set_assertion_reasons : Global.pred_id -> Global.pred_id list -> unit
(** Store the reasons for a theory literal being determined. 
This currently needs to be called if using a non-C theory.
*)

val weight_decay : unit -> unit
(** Apply a decay function to the literals' scores. *)

val get_literal_weight : Global.pred_id -> int
(** Return the current weight of a particular literal.  *)

val increase_activity : Global.pred_id -> int -> unit
(** increast a literal's weight by n. *)

val satbox_init : unit -> unit
(** Initialize the satbox.  Must be called *)

val insert_clause : Global.pred_id list -> unit
(** Add a new clause to the current clause set.  This is not backtrackable. *)

val insert_user_lemma : Global.pred_id list -> (int * Global.pred_id list)
(** Add a new user lemma clause to the current clause set.  This will prompt
a BCP phase.  This is backtrackable. *)

val retract_user_lemmas : int -> int
(** Remove the most recent n user lemmas. *)

val initial_bcp : unit -> (int * Global.pred_id list)
(** Perform the preproseccing BCP.  No decisions are made. *)

val restart_search : unit -> int

val backtrack : Global.pred_id -> (int * Global.pred_id list)
(** Backtrack the satbox to just before the decision level of the id, then 
perform a BCP phase.  Order matters in the return list: This should return 
the OLDEST FIRST *)
    
val assert_literals : Global.pred_id list -> (int * Global.pred_id list)
(** Assert a set of theory-propagated literals & return the results of a 
BCP phase.
Order matters.  This expects the NEWEST FIRST.  It returns the 
OLDEST FIRST (via [get_additional_preds], above) *)

val decide_literal : Global.pred_id -> (int * Global.pred_id list)
(** Assert a split decision & then return the result of a BCP phase.
Order matters: This should return the OLDEST FIRST *)

val lit_value : Global.pred_id -> Global.status
(** Return the current [Global.status] value of a literal *)

val lit_level : Global.pred_id -> int
(** Return the decision level at which a literal got a value. 
The return value is not defined for an undetermined literal.
*)

val lit_is_watched : Global.pred_id -> bool
(** Returns true if the literal is currently undetermined and watched. *)

val back_to_level : int -> unit
(** Performs backtracking without a followup BCP phase. *)

val check_model : unit -> bool
(** Checks that the current model is consistent with the actual clauses.  
Note this is expensive and should only be used for debugging purposes.  *)

val print_stats : unit -> unit
(** Print out some statistics for the satbox. *)
