mirror of
https://github.com/Z3Prover/z3
synced 2026-03-16 18:20:00 +00:00
Add missing Go Goal/FuncEntry/Model APIs and TypeScript Seq higher-order operations (#9006)
* Initial plan * fix: add missing API bindings from discussion #8992 for Go and TypeScript - Go tactic.go: add Goal.Depth(), Goal.Precision(), Goal.Translate(), Goal.ConvertModel() - Go solver.go: add FuncEntry struct, FuncInterp.GetEntry/SetElse/AddEntry, Model.HasInterp - TypeScript types.ts + high-level.ts: add Seq.map/mapi/foldl/foldli 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
6893674392
commit
fbeb4b22eb
4 changed files with 123 additions and 0 deletions
|
|
@ -4422,6 +4422,24 @@ export function createApi(Z3: Z3Core, em?: any): Z3HighLevel {
|
|||
const otherSeq = isSeq(other) ? other : String.val(other);
|
||||
return new BoolImpl(check(Z3.mk_str_le(contextPtr, this.ast, otherSeq.ast)));
|
||||
}
|
||||
|
||||
map(f: Expr<Name>): Seq<Name> {
|
||||
return new SeqImpl(check(Z3.mk_seq_map(contextPtr, f.ast, this.ast)));
|
||||
}
|
||||
|
||||
mapi(f: Expr<Name>, i: Arith<Name> | number | bigint): Seq<Name> {
|
||||
const iExpr = isArith(i) ? i : Int.val(i);
|
||||
return new SeqImpl(check(Z3.mk_seq_mapi(contextPtr, f.ast, iExpr.ast, this.ast)));
|
||||
}
|
||||
|
||||
foldl(f: Expr<Name>, a: Expr<Name>): Expr<Name> {
|
||||
return _toExpr(check(Z3.mk_seq_foldl(contextPtr, f.ast, a.ast, this.ast)));
|
||||
}
|
||||
|
||||
foldli(f: Expr<Name>, i: Arith<Name> | number | bigint, a: Expr<Name>): Expr<Name> {
|
||||
const iExpr = isArith(i) ? i : Int.val(i);
|
||||
return _toExpr(check(Z3.mk_seq_foldli(contextPtr, f.ast, iExpr.ast, a.ast, this.ast)));
|
||||
}
|
||||
}
|
||||
|
||||
class ReSortImpl<SeqSortRef extends SeqSort<Name> = SeqSort<Name>> extends SortImpl implements ReSort<Name, SeqSortRef> {
|
||||
|
|
|
|||
|
|
@ -3597,6 +3597,30 @@ export interface Seq<Name extends string = 'main', ElemSort extends Sort<Name> =
|
|||
* @category Operations
|
||||
*/
|
||||
le(other: Seq<Name, ElemSort> | string): Bool<Name>;
|
||||
|
||||
/**
|
||||
* Apply function f to each element of the sequence (seq.map).
|
||||
* @category Operations
|
||||
*/
|
||||
map(f: Expr<Name>): Seq<Name>;
|
||||
|
||||
/**
|
||||
* Apply function f to each element and its index in the sequence (seq.mapi).
|
||||
* @category Operations
|
||||
*/
|
||||
mapi(f: Expr<Name>, i: Arith<Name> | number | bigint): Seq<Name>;
|
||||
|
||||
/**
|
||||
* Left-fold function f over the sequence with initial accumulator a (seq.foldl).
|
||||
* @category Operations
|
||||
*/
|
||||
foldl(f: Expr<Name>, a: Expr<Name>): Expr<Name>;
|
||||
|
||||
/**
|
||||
* Left-fold function f with index over the sequence with initial accumulator a (seq.foldli).
|
||||
* @category Operations
|
||||
*/
|
||||
foldli(f: Expr<Name>, i: Arith<Name> | number | bigint, a: Expr<Name>): Expr<Name>;
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue