3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00
z3/examples/ml/ml_example.ml
Christoph M. Wintersteiger c2ff90720e ML API: mk_context added.
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
2015-01-19 17:01:35 +00:00

34 lines
1.1 KiB
OCaml

(*
Copyright (C) 2012 Microsoft Corporation
Author: CM Wintersteiger (cwinter) 2012-12-17
*)
open Z3
open Z3.Arithmetic
exception ExampleException of string
let _ =
if not (Log.open_ "z3.log") then
raise (ExampleException "Log couldn't be opened.")
else
(
Printf.printf "Running Z3 version %s\n" Version.to_string ;
let cfg = (Some [("model", "true"); ("proof", "false")]) in
let ctx = (mk_context cfg) in
let is = (Symbol.mk_int ctx 42) in
let ss = (Symbol.mk_string ctx "mySymbol") in
let bs = (Sort.mk_bool ctx) in
let ints = (mk_int_sort ctx) in
let rs = (mk_real_sort ctx) in
Printf.printf "int symbol: %s\n" (Symbol.to_string (is :> symbol));
Printf.printf "string symbol: %s\n" (Symbol.to_string (ss :> symbol));
Printf.printf "bool sort: %s\n" (Sort.to_string bs);
Printf.printf "int sort: %s\n" (Sort.to_string ints);
Printf.printf "real sort: %s\n" (Sort.to_string rs);
Printf.printf "Disposing...\n";
Gc.full_major ()
);
Printf.printf "Exiting.\n";
;;