(*
This file is part of the dpll(t) engine sammy
Copyright (C) 2004  The University of Iowa
Michael 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.
*)
                                                                                

(* expressions.mli *)

(** Expressions used by the parser. *)

(** ite_wrapper stores an expression and a list of equalities that define a possible ite that was found beneath.  
An empty list shows that no ites have been encountered so far*)
type ite_wrapper =
    I of Formula.exprtype * Formula.exprtype list

(** should be raised if making an and expression and are given an empty list*)
exception And_must_have_at_least_one_argument

(** should be raised if an uninterpreted function is attempted to be built as an interpreted function*)
exception Not_interpreted_function

(** should be raised if an uninterpreted predicate is attempted to be built as an interpreted predicate*)
exception Not_interpreted_predicate

(** append_list a b
@param a list of elements
@param b list of elements
@return the list a appended to the list b

tail recursive
*)
val append_list : ('a list) -> ('a list) -> ('a list)

(** makes a function with the name a and the arguments b and returns the id of the newly created function*)
val make_function_pred : string -> Formula.exprtype list -> Global.pred_id

(** returns an AND expression made from the input expression list *)
val make_and_expr : Formula.exprtype list -> Formula.exprtype

(** returns an expression made of IFF and the input list of exprtessions *)
val make_iff_expr : Formula.exprtype list -> Formula.exprtype

(** returns an expression that negates the input expression *)
val make_not_expr : Formula.exprtype-> Formula.exprtype

(** returns an expression that is the OR of all the input expressions*)
val make_or_expr : Formula.exprtype list -> Formula.exprtype

(** returns an implication expression a -> b *)
val make_impl_expr : Formula.exprtype -> Formula.exprtype -> Formula.exprtype

(** returns an XOR expression made from the input expressions*)
val make_xor_expr : Formula.exprtype list -> Formula.exprtype

(** returns an equivelent expression to an ITE where all the expressions are booleans *)
val make_ite_expr : Formula.exprtype -> Formula.exprtype -> Formula.exprtype -> Formula.exprtype

(** returns an equality expression made from the input list of expressions*)
val make_equality_expr : Formula.exprtype list -> Escjava_label.label -> Formula.exprtype

(** returns a disequality expression made from the input list of expressions*)
val make_disequality_expr : Formula.exprtype list -> Escjava_label.label -> Formula.exprtype

(** takes in the name of a predicate, and a list of arguments, and constructs a predicate expression.*)
val build_predicate_expr : string -> ite_wrapper list -> Escjava_label.label ->Formula.exprtype

(** takes in the name of a function, the function's id, and a list of arguments, and constructs a function expression*)
val build_function_expr : string -> int -> ite_wrapper list -> ite_wrapper

(** returns true if the predicate in question should be handled by cvc *)
val is_interpreted_predicate : string -> bool

(** builds an interpreted predicate expression from the given name and arguement list *)
val build_interpreted_predicate : string -> ite_wrapper list -> Escjava_label.label -> Formula.exprtype

(** returns true if the function in question should be handled by cvc *)
val is_interpreted_function : string -> bool

(** builds an interpreted function expression from the given name and arguement list *)
val build_interpreted_function : string -> ite_wrapper list -> ite_wrapper
