File ‹~~/src/Tools/Argo/argo_solver.ML›
signature ARGO_SOLVER =
sig
type context
val context: context
val assert: Argo_Expr.expr list -> context -> context
val model_of: context -> string * Argo_Expr.typ -> bool option
end
structure Argo_Solver: ARGO_SOLVER =
struct
type context = {
next_axiom: int,
prf: Argo_Proof.context,
core: Argo_Core.context}
fun mk_context next_axiom prf core: context = {next_axiom=next_axiom, prf=prf, core=core}
val context = mk_context 0 Argo_Proof.solver_context Argo_Core.context
val simp_context =
Argo_Rewr.context
|> Argo_Rewr.nnf
|> Argo_Rewr.norm_prop
|> Argo_Rewr.norm_ite
|> Argo_Rewr.norm_eq
|> Argo_Rewr.norm_arith
val simp_axiom = Argo_Rewr.with_proof (Argo_Rewr.rewrite simp_context)
fun add_axiom e ({next_axiom, prf, core}: context) =
let
val _ = Argo_Expr.check e
val (p, prf) = Argo_Proof.mk_axiom next_axiom prf
val (ep, prf) = simp_axiom (e, p) prf
val (prf, core) = Argo_Clausify.clausify simp_context ep (prf, core)
in mk_context (next_axiom + 1) prf core end
fun assert es cx =
let val {next_axiom, prf, core}: context = fold add_axiom es cx
in mk_context next_axiom prf (Argo_Core.run core) end
fun model_of ({core, ...}: context) = Argo_Core.model_of core
end