3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-02 21:37:02 +00:00
This commit is contained in:
Nikolaj Bjorner 2022-08-21 18:28:19 -07:00
commit f6e4a45f4b
32 changed files with 118 additions and 97 deletions

View file

@ -8,7 +8,7 @@ import { Arith, Bool, Model, Z3AssertionError, Z3HighLevel } from './types';
*
* **NOTE**: The set of solutions might be infinite.
* Always ensure to limit amount generated, either by knowing that the
* solution space is constrainted, or by taking only a specified
* solution space is constrained, or by taking only a specified
* amount of solutions
* ```typescript
* import { sliceAsync } from 'iter-tools';
@ -46,7 +46,7 @@ async function* allSolutions<Name extends string>(...assertions: Bool<Name>[]):
.filter(decl => decl.arity() === 0)
.map(decl => {
const term = decl.call();
// TODO(ritave): Assert not an array / uinterpeted sort
// TODO(ritave): Assert not an array / uninterpreted sort
const value = model.eval(term, true);
return term.neq(value);
}),

View file

@ -224,6 +224,12 @@ export function createApi(Z3: Z3Core): Z3HighLevel {
function _toExpr(ast: Z3_ast): Bool<Name> | IntNum<Name> | RatNum<Name> | Arith<Name> | Expr<Name> {
const kind = check(Z3.get_ast_kind(contextPtr, ast));
if (kind === Z3_ast_kind.Z3_QUANTIFIER_AST) {
if (Z3.is_quantifier_forall(contextPtr, ast))
return new BoolImpl(ast);
if (Z3.is_quantifier_exists(contextPtr, ast))
return new BoolImpl(ast);
if (Z3.is_lambda(contextPtr, ast))
return new ExprImpl(ast);
assert(false);
}
const sortKind = check(Z3.get_sort_kind(contextPtr, Z3.get_sort(contextPtr, ast)));

View file

@ -617,7 +617,7 @@ export interface Arith<Name extends string = 'main'> extends Expr<Name, ArithSor
*/
mul(other: Arith<Name> | number | bigint | string): Arith<Name>;
/**
* Substract second number from the first one
* Subtract second number from the first one
*/
sub(other: Arith<Name> | number | bigint | string): Arith<Name>;
/**
@ -709,7 +709,7 @@ export interface RatNum<Name extends string = 'main'> extends Arith<Name> {
}
/**
* A Sort represting Bit Vector numbers of specified {@link BitVecSort.size size}
* A Sort representing Bit Vector numbers of specified {@link BitVecSort.size size}
*
* @typeParam Bits - A number representing amount of bits for this sort
* @category Bit Vectors
@ -878,42 +878,42 @@ export interface BitVec<Bits extends number = number, Name extends string = 'mai
/**
* Creates a signed less-or-equal operation (`<=`)
* @category Comparision
* @category Comparison
*/
sle(other: CoercibleToBitVec<Bits, Name>): Bool<Name>;
/**
* Creates an unsigned less-or-equal operation (`<=`)
* @category Comparision
* @category Comparison
*/
ule(other: CoercibleToBitVec<Bits, Name>): Bool<Name>;
/**
* Creates a signed less-than operation (`<`)
* @category Comparision
* @category Comparison
*/
slt(other: CoercibleToBitVec<Bits, Name>): Bool<Name>;
/**
* Creates an unsigned less-than operation (`<`)
* @category Comparision
* @category Comparison
*/
ult(other: CoercibleToBitVec<Bits, Name>): Bool<Name>;
/**
* Creates a signed greater-or-equal operation (`>=`)
* @category Comparision
* @category Comparison
*/
sge(other: CoercibleToBitVec<Bits, Name>): Bool<Name>;
/**
* Creates an unsigned greater-or-equal operation (`>=`)
* @category Comparision
* @category Comparison
*/
uge(other: CoercibleToBitVec<Bits, Name>): Bool<Name>;
/**
* Creates a signed greater-than operation (`>`)
* @category Comparision
* @category Comparison
*/
sgt(other: CoercibleToBitVec<Bits, Name>): Bool<Name>;
/**
* Creates an unsigned greater-than operation (`>`)
* @category Comparision
* @category Comparison
*/
ugt(other: CoercibleToBitVec<Bits, Name>): Bool<Name>;