mirror of
https://github.com/Z3Prover/z3
synced 2026-05-17 07:29:28 +00:00
Go/OCaml API gaps: substitution, AST introspection, Spacer, Goal completion (#9277)
* fix: address issues 1,2,4,5 and add Goal API to Go bindings Issue 2 (Go): Add Substitute, SubstituteVars, SubstituteFuns to Expr Issue 4 (Go): Add GetDecl, NumArgs, Arg to Expr for AST app introspection Goal API (Go): Add IsInconsistent and ToDimacsString to Goal ASTVector (Go): Add public Size, Get, String methods ASTMap (Go): Add ASTMap type with full CRUD API in spacer.go Issue 1 (Go): Add Spacer fixedpoint methods QueryFromLvl, GetGroundSatAnswer, GetRulesAlongTrace, GetRuleNamesAlongTrace, AddInvariant, GetReachable Issue 1 (Go): Add context-level QE functions ModelExtrapolate, QeLite, QeModelProject, QeModelProjectSkolem, QeModelProjectWithWitness Issue 5 (OCaml): Add substitute_funs to z3.ml and z3.mli Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/afa18588-47af-4720-8cea-55fe0544ae55 Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * fix: add substitute_funs to Expr module sig in z3.ml The internal sig...end block in z3.ml (the module type declaration for Expr) was missing val substitute_funs, causing OCaml compiler error: The value substitute_funs is required but not provided Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/c6662702-46a3-4aa0-b225-d6b73c2a2505 Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
1566d3cc41
commit
68e528eaf7
6 changed files with 290 additions and 0 deletions
|
|
@ -475,6 +475,7 @@ sig
|
|||
val substitute : expr -> expr list -> expr list -> expr
|
||||
val substitute_one : expr -> expr -> expr -> expr
|
||||
val substitute_vars : expr -> expr list -> expr
|
||||
val substitute_funs : expr -> FuncDecl.func_decl list -> expr list -> expr
|
||||
val translate : expr -> context -> expr
|
||||
val to_string : expr -> string
|
||||
val is_numeral : expr -> bool
|
||||
|
|
@ -537,6 +538,13 @@ end = struct
|
|||
let substitute_vars x to_ =
|
||||
Z3native.substitute_vars (gc x) x (List.length to_) to_
|
||||
|
||||
let substitute_funs x from to_ =
|
||||
let len = List.length from in
|
||||
if List.length to_ <> len then
|
||||
raise (Error "Argument sizes do not match")
|
||||
else
|
||||
Z3native.substitute_funs (gc x) x len from to_
|
||||
|
||||
let translate (x:expr) to_ctx =
|
||||
if gc x = to_ctx then
|
||||
x
|
||||
|
|
|
|||
|
|
@ -531,6 +531,10 @@ sig
|
|||
For every [i] smaller than [num_exprs], the variable with de-Bruijn index [i] is replaced with term [to[i]]. *)
|
||||
val substitute_vars : Expr.expr -> Expr.expr list -> expr
|
||||
|
||||
(** Substitute every application of [from[i]] with [to[i]] in the expression.
|
||||
The [from] and [to] lists must have the same length. *)
|
||||
val substitute_funs : Expr.expr -> FuncDecl.func_decl list -> Expr.expr list -> expr
|
||||
|
||||
(** Translates (copies) the term to another context.
|
||||
@return A copy of the term which is associated with the other context *)
|
||||
val translate : Expr.expr -> context -> expr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue