Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0cbf059
Indices: Extend the API to support indexed function symbols, such as …
daniel-raffler Aug 25, 2025
ded5888
Indices: Add support for indexed functions symbols to the solver back…
daniel-raffler Aug 25, 2025
d6b07be
Merge branch 'master' into indexed_functions
daniel-raffler Dec 2, 2025
ad9d945
Fix merge
daniel-raffler Dec 2, 2025
38655e6
Indices: Fix handling of bv_extract and bv_concat in Princess
daniel-raffler Dec 2, 2025
25335f3
Indices: Fix CVC5 visitor for sep.nil
daniel-raffler Dec 2, 2025
ff489e0
Merge branch 'refs/heads/master' into indexed_functions
daniel-raffler Feb 27, 2026
1c90042
Indices: Add support for new solver "Z3 with interpolation"
daniel-raffler Feb 27, 2026
a0fdbc1
Indices: Add tests for visiting indexed functions
daniel-raffler Feb 27, 2026
493cd94
Indices: Fix indices in CVC5 visitor
daniel-raffler Mar 28, 2026
699b0ba
Merge branch 'refs/heads/master' into indexed_functions
daniel-raffler Mar 28, 2026
b5406d7
Indices: Add support for indexed functions in the tracer
daniel-raffler Mar 28, 2026
8a5f5d3
Indices: Add support for indices in Yices, and update the tests
daniel-raffler Mar 28, 2026
ca554e3
Merge branch 'refs/heads/master' into indexed_functions
daniel-raffler Mar 29, 2026
0e184c2
Indices: Remove duplicate code
daniel-raffler Mar 29, 2026
bbae8f0
Apply refaster patch
daniel-raffler Mar 29, 2026
80ee861
Merge branch 'refs/heads/master' into indexed_functions
daniel-raffler Mar 29, 2026
2620a91
Merge branch 'master' into indexed_functions
daniel-raffler Jun 5, 2026
9cbe382
Merge branch 'master' into indexed_functions
daniel-raffler Aug 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/org/sosy_lab/java_smt/api/FunctionDeclaration.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public interface FunctionDeclaration<E extends Formula> {
*/
String getName();

/**
* @return List of indices for the function
*/
ImmutableList<Integer> getIndices();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extend the documentation for this interface method.
Here, we need some strong argument and description for differentiation between args and indices.


/**
* @return Sort of the function output.
*/
Expand Down
144 changes: 143 additions & 1 deletion src/org/sosy_lab/java_smt/api/FunctionDeclarationKind.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,5 +323,147 @@ public enum FunctionDeclarationKind {
* Solvers support a lot of different built-in theories. We enforce standardization only across a
* small subset.
*/
OTHER
OTHER;

public static int getArity(FunctionDeclarationKind pKind) {
return switch (pKind) {
case AND,
OR,
IFF,
XOR,
IMPLIES,
DISTINCT,
SUB,
ADD,
DIV,
MUL,
LT,
LTE,
GT,
GTE,
EQ,
BV_CONCAT,
BV_OR,
BV_AND,
BV_XOR,
BV_SUB,
BV_ADD,
BV_MUL,
STR_CONCAT,
STR_LT,
STR_LE,
RE_CONCAT,
RE_DIFFERENCE,
RE_UNION,
RE_INTERSECT ->
-1;
case RE_NONE, SEP_NIL -> 0;
case INT_TO_BV,
NOT,
UMINUS,
EQ_ZERO,
GTE_ZERO,
FLOOR,
TO_REAL,
CONST,
BV_EXTRACT,
BV_SIGN_EXTENSION,
BV_ZERO_EXTENSION,
BV_NOT,
BV_NEG,
BV_ROTATE_LEFT_BY_INT,
BV_ROTATE_RIGHT_BY_INT,
UBV_TO_INT,
SBV_TO_INT,
FP_NEG,
FP_ABS,
FP_IS_NAN,
FP_IS_INF,
FP_IS_ZERO,
FP_IS_NEGATIVE,
FP_IS_SUBNORMAL,
FP_IS_NORMAL,
FP_AS_IEEEBV,
FP_FROM_IEEEBV,
RE_PLUS,
RE_STAR,
INT_TO_STR,
STR_FROM_CODE,
STR_TO_CODE,
STR_LENGTH,
STR_TO_INT,
STR_TO_RE,
RE_COMPLEMENT,
RE_OPTIONAL ->
1;
case SELECT,
MODULO,
BV_SDIV,
BV_UDIV,
BV_SREM,
BV_UREM,
BV_SMOD,
BV_ULT,
BV_SLT,
BV_ULE,
BV_SLE,
BV_UGT,
BV_SGT,
BV_UGE,
BV_SGE,
BV_SHL,
BV_LSHR,
BV_ASHR,
BV_ROTATE_LEFT,
BV_ROTATE_RIGHT,
BV_UCASTTO_FP,
BV_SCASTTO_FP,
FP_MAX,
FP_MIN,
FP_SQRT,
FP_REM,
FP_LT,
FP_LE,
FP_GE,
FP_GT,
FP_EQ,
FP_ROUND_TO_INTEGRAL,
FP_CASTTO_FP,
FP_CASTTO_SBV,
FP_CASTTO_UBV,
STR_CHAR_AT,
STR_CONTAINS,
STR_IN_RE,
STR_PREFIX,
STR_SUFFIX,
RE_RANGE,
SEP_PTO,
SEP_EMP,
SEP_STAR,
SEP_WAND ->
2;
case ITE,
STORE,
FP_SUB,
FP_ADD,
FP_DIV,
FP_MUL,
STR_INDEX_OF,
STR_REPLACE,
STR_REPLACE_ALL,
STR_SUBSTRING ->
3;
default ->
throw new IllegalArgumentException(String.format("Unsupported kind: \"%s\"", pKind));
};
}

public static int getNumIndices(FunctionDeclarationKind pKind) {
// TODO Add missing kinds
return switch (pKind) {
case BV_ROTATE_LEFT_BY_INT, BV_ROTATE_RIGHT_BY_INT, BV_SIGN_EXTENSION, BV_ZERO_EXTENSION -> 1;
case BV_EXTRACT -> 2;
default -> 0;
};
}
}
19 changes: 18 additions & 1 deletion src/org/sosy_lab/java_smt/basicimpl/FunctionDeclarationImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
public record FunctionDeclarationImpl<F extends Formula, T>(
FunctionDeclarationKind getKind,
String getName,
ImmutableList<Integer> getIndices,
FormulaType<F> getType,
ImmutableList<FormulaType<?>> getArgumentTypes,
T getSolverDeclaration)
Expand All @@ -31,6 +32,7 @@ public record FunctionDeclarationImpl<F extends Formula, T>(
public FunctionDeclarationImpl {
checkNotNull(getKind);
checkNotNull(getName);
checkNotNull(getIndices);
checkNotNull(getType);
checkNotNull(getArgumentTypes);
checkNotNull(getSolverDeclaration);
Expand All @@ -39,11 +41,26 @@ public record FunctionDeclarationImpl<F extends Formula, T>(
public static <F extends Formula, T> FunctionDeclarationImpl<F, T> of(
String name,
FunctionDeclarationKind kind,
List<Integer> pIndices,
List<FormulaType<?>> pArgumentTypes,
FormulaType<F> pReturnType,
T pDeclaration) {
return new FunctionDeclarationImpl<>(
kind, name, pReturnType, ImmutableList.copyOf(pArgumentTypes), pDeclaration);
kind,
name,
ImmutableList.copyOf(pIndices),
pReturnType,
ImmutableList.copyOf(pArgumentTypes),
pDeclaration);
}

public static <F extends Formula, T> FunctionDeclaration<F> of(
String name,
FunctionDeclarationKind kind,
List<FormulaType<?>> pArgumentTypes,
FormulaType<F> pReturnType,
T pDeclaration) {
return of(name, kind, ImmutableList.of(), pArgumentTypes, pReturnType, pDeclaration);
}

@Override
Expand Down
Loading
Loading