
Product
Introducing Manifest Alerts
Socket now detects supply chain risks in project manifests, starting with missing lockfiles that can make dependency installs non-reproducible.
@isl-lang/isl-smt
Advanced tools
SMT solver integration for ISL - satisfiability checking for preconditions, postconditions, and refinement types
SMT (Satisfiability Modulo Theories) solver integration for ISL verification.
npm install @isl-lang/isl-smt
For real SMT solving (recommended for production), install Z3:
# macOS
brew install z3
# Ubuntu/Debian
apt-get install z3
# Windows (with chocolatey)
choco install z3
# Or download from: https://github.com/Z3Prover/z3/releases
import { solve, Expr, Sort } from '@isl-lang/isl-smt';
// Check if x > 0 AND x < 10 is satisfiable
const result = await solve(
Expr.and(
Expr.gt(Expr.var('x', Sort.Int()), Expr.int(0)),
Expr.lt(Expr.var('x', Sort.Int()), Expr.int(10))
),
{ timeout: 5000 }
);
if (result.verdict === 'disproved') {
console.log('Satisfiable with model:', result.model);
// { x: 5 } (or any value 1-9)
}
The builtin solver handles common cases without requiring external solvers:
import { solve } from '@isl-lang/isl-smt';
const result = await solve(formula, {
solver: 'builtin', // default
timeout: 5000,
});
Capabilities:
Use when:
Full SMT solving with Z3:
import { solve, isZ3Available } from '@isl-lang/isl-smt';
if (await isZ3Available()) {
const result = await solve(formula, {
solver: 'z3',
timeout: 10000,
});
}
Capabilities:
Alternative solver with CVC5:
import { solve, isCVC5Available } from '@isl-lang/isl-smt';
if (await isCVC5Available()) {
const result = await solve(formula, {
solver: 'cvc5',
timeout: 10000,
});
}
Let the library choose the best available solver:
import { getSolverAvailability, solve } from '@isl-lang/isl-smt';
const availability = await getSolverAvailability();
console.log('Best available:', availability.bestAvailable);
// 'z3', 'cvc5', or 'builtin'
| Theory | Builtin | Z3 | CVC5 |
|---|---|---|---|
| Booleans | Yes | Yes | Yes |
| Integers (bounded) | Yes | Yes | Yes |
| Integers (unbounded) | No | Yes | Yes |
| Reals | Limited | Yes | Yes |
| Strings | No | Yes | Yes |
| Arrays | No | Yes | Yes |
| Bitvectors | No | Yes | Yes |
| Quantifiers | No | Yes | Yes |
Boolean:
and, or, not, implies, iffArithmetic:
+, -, *, div, mod=, !=, <, <=, >, >=abs, min, maxQuantifiers (Z3/CVC5 only):
forall, existsArrays (Z3/CVC5 only):
select, storeEvery solve operation has a hard timeout to prevent hanging:
const result = await solve(formula, { timeout: 5000 }); // 5 seconds
// Result can be:
// - { verdict: 'proved' } // Formula is valid
// - { verdict: 'disproved', model } // Found counterexample
// - { verdict: 'unknown', reason } // Could not determine (timeout, etc.)
Guarantees:
For formal verification, attach solver evidence to results:
import { verifyFormal } from '@isl-lang/isl-smt';
const { batchResult, proofBundle } = await verifyFormal(domain, {
solver: 'z3',
timeout: 10000,
generateEvidence: true,
});
// Each entry has solver evidence
for (const entry of proofBundle) {
console.log(`${entry.name}: ${entry.verdict}`);
if (entry.solverEvidence) {
console.log(` Solver: ${entry.solverEvidence.solver}`);
console.log(` Status: ${entry.solverEvidence.status}`);
console.log(` Duration: ${entry.solverEvidence.durationMs}ms`);
console.log(` Query hash: ${entry.solverEvidence.queryHash}`);
}
}
interface ProofBundleEntry {
id: string; // Unique identifier
kind: 'precondition_satisfiability' | 'postcondition_implication' | 'refinement_constraint';
name: string; // Name of verified item
expression: string; // SMT-LIB expression
verdict: 'proved' | 'disproved' | 'unknown';
verdictSource: 'runtime_only' | 'solver_only' | 'runtime_then_solver';
// Solver evidence (if generateEvidence: true)
solverEvidence?: {
queryHash: string; // SHA-256 hash for reproducibility
solver: 'builtin' | 'z3' | 'cvc5';
status: 'sat' | 'unsat' | 'unknown' | 'timeout' | 'error';
model?: Record<string, unknown>;
reason?: string;
durationMs: number;
smtLibQuery?: string; // Raw SMT-LIB for debugging
timestamp: string;
};
}
When runtime verification returns "unknown", use SMT to resolve:
import { resolveUnknown } from '@isl-lang/isl-smt';
// In your verifier, when you get an unknown result:
if (result.triState === 'unknown') {
const resolution = await resolveUnknown(
clause.expression,
clause.inputValues,
{ solver: 'z3', timeout: 5000 }
);
if (resolution.resolved?.verdict === 'proved') {
result.triState = true;
result.reason = 'Proved by SMT solver';
}
// Attach evidence to proof bundle
if (resolution.evidence) {
proofBundle.solverEvidence = resolution.evidence;
}
}
Results are cached by query hash for determinism:
import { getGlobalCache, resetGlobalCache } from '@isl-lang/isl-smt';
// Get cache statistics
const stats = getGlobalCache().getStats();
console.log('Cache hit rate:', stats.hitRate);
// Clear cache if needed
resetGlobalCache();
The library automatically detects solver binaries:
| Platform | Search Locations |
|---|---|
| Windows | z3.exe in PATH, C:\Program Files\Z3\bin, C:\z3\bin |
| macOS | z3 in PATH, /usr/local/bin, /opt/homebrew/bin |
| Linux | z3 in PATH, /usr/bin, /usr/local/bin |
Custom path:
import { checkSolverAvailability } from '@isl-lang/isl-smt';
const availability = await checkSolverAvailability('z3', '/custom/path/to/z3');
solve(formula, options) - High-level solve with tri-state outputcreateSolver(options) - Create solver instancetranslate(formula, declarations) - Generate SMT-LIB stringisZ3Available() - Check Z3 availabilityisCVC5Available() - Check CVC5 availabilitygetSolverAvailability() - Get all solver infogetBestAvailableSolver() - Get best available solververifySMT(domain, options) - Verify ISL domainverifyFormal(domain, options) - Formal mode with evidenceresolveUnknown(expr, values, options) - Resolve unknown resultscheckSatExternal(smtlib, config) - Run external solver directlyrunSolver(smtlib, config) - Low-level solver executionimport {
verifySMT,
resolveUnknown,
getSolverAvailability,
} from '@isl-lang/isl-smt';
async function verifyWithSMT(domain) {
// Check what's available
const { bestAvailable } = await getSolverAvailability();
console.log(`Using solver: ${bestAvailable}`);
// Run verification
const result = await verifySMT(domain, {
solver: bestAvailable,
timeout: 10000,
verbose: true,
});
console.log('Summary:');
console.log(` Total: ${result.summary.total}`);
console.log(` SAT: ${result.summary.sat}`);
console.log(` UNSAT: ${result.summary.unsat}`);
console.log(` Unknown: ${result.summary.unknown}`);
// Try to resolve unknowns
for (const r of result.results) {
if (r.result.status === 'unknown') {
console.log(`Attempting to resolve: ${r.name}`);
const resolution = await resolveUnknown(
/* expression from clause */,
/* input values */,
{ solver: 'z3', timeout: 30000 }
);
console.log(` Result: ${resolution.resolved?.verdict}`);
}
}
return result;
}
MIT
FAQs
SMT solver integration for ISL - satisfiability checking for preconditions, postconditions, and refinement types
We found that @isl-lang/isl-smt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now detects supply chain risks in project manifests, starting with missing lockfiles that can make dependency installs non-reproducible.

Research
/Security News
The trojanized extensions use TinyGo-compiled WebAssembly and Solana transaction memos to resolve command-and-control infrastructure.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.