Skip to content

Commit 158ad96

Browse files
authored
Upgrade KSMT and add solver theory specialization for jvm (#218)
1 parent 0acf657 commit 158ad96

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object Versions {
1313
const val kotlinx_collections = "0.3.5"
1414
const val kotlinx_coroutines = "1.6.4"
1515
const val kotlinx_serialization = "1.4.1"
16-
const val ksmt = "0.5.21"
16+
const val ksmt = "0.5.26"
1717
const val logback = "1.4.8"
1818
const val mockk = "1.13.4"
1919
const val rd = "2023.2.0"

usvm-jvm/src/main/kotlin/org/usvm/machine/JcSolverFactory.kt

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.usvm.machine
33
import io.ksmt.KContext
44
import io.ksmt.solver.KSolver
55
import io.ksmt.solver.KSolverConfiguration
6+
import io.ksmt.solver.KTheory
67
import io.ksmt.solver.runner.KSolverRunnerManager
78
import io.ksmt.solver.yices.KYicesSolver
89
import io.ksmt.solver.yices.KYicesSolverConfiguration
@@ -30,8 +31,18 @@ private object SameProcessSolverFactory : SolverFactory {
3031
solverType: SolverType
3132
): KSolver<out KSolverConfiguration> = when (solverType) {
3233
// Yices with Fp support via SymFpu
33-
SolverType.YICES -> KSymFpuSolver(KYicesSolver(ctx), ctx)
34-
SolverType.Z3 -> KZ3Solver(ctx)
34+
SolverType.YICES -> KSymFpuSolver(KYicesSolver(ctx), ctx).apply {
35+
configure {
36+
// Fp theory is handled by the SymFpu
37+
optimizeForTheories(setOf(KTheory.Array, KTheory.BV, KTheory.UF))
38+
}
39+
}
40+
41+
SolverType.Z3 -> KZ3Solver(ctx).apply {
42+
configure {
43+
optimizeForTheories(setOf(KTheory.Array, KTheory.BV, KTheory.UF, KTheory.FP))
44+
}
45+
}
3546
}
3647

3748
override fun close() {
@@ -52,8 +63,18 @@ private class AnotherProcessSolverFactory : SolverFactory {
5263
solverType: SolverType
5364
): KSolver<out KSolverConfiguration> = when (solverType) {
5465
// Yices with Fp support via SymFpu
55-
SolverType.YICES -> solverManager.createSolver(ctx, YicesWithSymFpu::class)
56-
SolverType.Z3 -> solverManager.createSolver(ctx, KZ3Solver::class)
66+
SolverType.YICES -> solverManager.createSolver(ctx, YicesWithSymFpu::class).apply {
67+
configure {
68+
// Fp theory is handled by the SymFpu
69+
optimizeForTheories(setOf(KTheory.Array, KTheory.BV, KTheory.UF))
70+
}
71+
}
72+
73+
SolverType.Z3 -> solverManager.createSolver(ctx, KZ3Solver::class).apply {
74+
configure {
75+
optimizeForTheories(setOf(KTheory.Array, KTheory.BV, KTheory.UF, KTheory.FP))
76+
}
77+
}
5778
}
5879

5980
override fun close() {

0 commit comments

Comments
 (0)