(** Why3 driver for Z3 >= 4.4 *)

prelude ";; produced by z3_gnatprove_ce.drv ;;"
(* no set-logic for Z3 *)
prelude "(set-info :source |VC generated by SPARK 2014|)"
prelude "(set-info :smt-lib-version 2.0)"
prelude "(set-info :category industrial)"
prelude "(set-info :status unknown)"
prelude "(set-option :smt.mbqi false)"
prelude "(set-option :smt.macro-finder true)"

import "smt-libv2.gen"
import "smt-libv2-bv.gen"
import "z3_bv.gen"
import "smt-libv2-floats.gen"
import "smt-libv2-gnatprove.gen"
import "smt-libv2-floats-gnatprove.gen"
import "smt-libv2-floats-int_via_bv.gen"
import "discrimination.gen"
printer "smtv2"

(* Counterexamples: set model parser *)
model_parser "smtv2"

transformation "remove_unused_keep_constants"
transformation "inline_trivial"
transformation "eliminate_builtin"
transformation "detect_polymorphism"
transformation "eliminate_inductive"
transformation "eliminate_algebraic_if_poly"
transformation "eliminate_literal"
transformation "eliminate_gnatprove_guard_epsilon"
transformation "eliminate_epsilon"


transformation "simplify_formula"
(*transformation "simplify_trivial_quantification"*)

(* Prepare for counter-example query: get rid of some quantifiers (makes it
possible to query model values of the variables in premises) and introduce
counter-example projections  *)
transformation "prepare_for_counterexmp"

transformation "discriminate_if_poly"
transformation "encoding_smt_if_poly"

(** Error messages specific to Z3 *)

outofmemory "(error \".*out of memory\")\\|Cannot allocate memory\\|Maximal allocation counts .* have been exceeded\\|(error \".*number of configured allocations exceeded\")"
timeout "interrupted by timeout"
steps ":rlimit-count *\\([0-9]+\\)" 1

(** Z3 needs "(push)" to provide models *)
theory BuiltIn
  meta "counterexample_need_smtlib_push" ""
  meta "get_counterexmp" ""
end
