-
|
Hi, I'm trying to play a bit with Smt.ml. I've written the following snippet: open Smtml
module AltErgo = Solver.Batch (Altergo_mappings)
module Bitwuzla = Solver.Batch (Bitwuzla_mappings)
let solver_ae = AltErgo.create ()
let solver_bitwuzla = Bitwuzla.create ()
let f = Symbol.make Ty.Ty_app "f"
let x = Expr.symbol (Symbol.make Ty.Ty_bool "x")
let cond = Expr.app f [ x ]
let () =
let res_ae =
match AltErgo.check solver_ae [ cond ] with
| `Sat -> "sat"
| `Unsat -> "unsat"
| `Unknown -> "unknown"
in
print_endline res_ae
let () =
let res_bitwuzla =
match Bitwuzla.check solver_bitwuzla [ cond ] with
| `Sat -> "sat"
| `Unsat -> "unsat"
| `Unknown -> "unknown"
in
print_endline res_bitwuzlaUnfortunately, both solvers fail with an error
Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
filipeom
Nov 28, 2025
Replies: 1 comment 4 replies
-
|
Hi!
Thanks for using Smt.ml! Uninterpreted functions are still a quite recent addition, so the API is indeed a bit rough.
To fix your example, you need to define the symbol `f` with its return type (in this case, `Ty_bool`), rather than `Ty_app`. The library then infers the full function signature based on the arguments you pass to `Expr.app`.
Here is the corrected snippet:
```ocaml
let f = Symbol.make Ty.Ty_bool "f" (* Make 'f' boolean so the App has bool return *)
let x = Expr.symbol (Symbol.make Ty.Ty_bool "x")
let cond = Expr.app f [ x ] (* Because 'x' and 'f' are bools. This app gets the inferred signature: bool -> bool *)
```
All uninterpreted functions take the type of the symbol passed as the first argument to `Expr.app` as their return value. The input types are derived automatically from the argument list.
Regarding the backends: AltErgo was very recently added to Smt.ml, so while this fix solves the `Unsupported theory: app` error generally, let me know if you run into specific issues with AE.
- If this is a currently missing feature of Smt.ml, is support for it planned?
We actually have a prototype for typechecking the construction of expressions at compile-time. However, `Apps` are not currently included in that check. We are actively working to extend this and improve the API for expression construction.
Let me know if you have any other questions!
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @remigerme sorry for the slow response. This slipped my inbox.
Unfortunately we have yet to implemented model completion for uninterpreted functions. We're going to do it eventually. But, that is the reason you don't see a model for f yet.
I tested it with bitwuzla and z3 …