-
Notifications
You must be signed in to change notification settings - Fork 56
Update SMTInterpol and add new theories #648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
daniel-raffler
wants to merge
10
commits into
master
Choose a base branch
from
smtinterpol-newTheories
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5095671
SmtInterpol: Update to version 2.5-1465
daniel-raffler 764dafe
SmtInterpol: Add bitvector theory
daniel-raffler 646c88b
SmtInterpol: Add quantifier theory
daniel-raffler 73954e3
SmtInterpol: Better error handling for incomplete theories
daniel-raffler 4ae6510
SmtInterpol: Fix handling of decimals in the visitor
daniel-raffler 3b0c23a
SmtInterpol: Downgrade to 2.5-1388-ga5a4ab0c
daniel-raffler 8f3f43d
Errorprone
daniel-raffler 29da9d4
Checkstyle
daniel-raffler 676bb9d
Merge branch 'master' into smtinterpol-newTheories
daniel-raffler 037ac56
SmtInterpol: Check for collisions before declaring new function symbols
daniel-raffler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
197 changes: 197 additions & 0 deletions
197
src/org/sosy_lab/java_smt/solvers/smtinterpol/SmtInterpolBitvectorFormulaManager.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| /* | ||
| * This file is part of JavaSMT, | ||
| * an API wrapper for a collection of SMT solvers: | ||
| * https://github.com/sosy-lab/java-smt | ||
| * | ||
| * SPDX-FileCopyrightText: 2026 Dirk Beyer <https://www.sosy-lab.org> | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.sosy_lab.java_smt.solvers.smtinterpol; | ||
|
|
||
| import static com.google.common.base.Preconditions.checkArgument; | ||
|
|
||
| import de.uni_freiburg.informatik.ultimate.logic.FunctionSymbol; | ||
| import de.uni_freiburg.informatik.ultimate.logic.Script; | ||
| import de.uni_freiburg.informatik.ultimate.logic.Sort; | ||
| import de.uni_freiburg.informatik.ultimate.logic.Term; | ||
| import java.math.BigInteger; | ||
| import org.sosy_lab.java_smt.basicimpl.AbstractBitvectorFormulaManager; | ||
| import org.sosy_lab.java_smt.basicimpl.AbstractBooleanFormulaManager; | ||
| import org.sosy_lab.java_smt.basicimpl.FormulaCreator; | ||
|
|
||
| public class SmtInterpolBitvectorFormulaManager | ||
| extends AbstractBitvectorFormulaManager<Term, Sort, Script, FunctionSymbol> { | ||
| protected SmtInterpolBitvectorFormulaManager( | ||
| FormulaCreator<Term, Sort, Script, FunctionSymbol> pCreator, | ||
| AbstractBooleanFormulaManager<Term, Sort, Script, FunctionSymbol> pBmgr) { | ||
| super(pCreator, pBmgr); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term makeBitvectorImpl(int length, Term pParam1) { | ||
| return getFormulaCreator() | ||
| .getEnv() | ||
| .term("int_to_bv", new String[] {String.valueOf(length)}, null, pParam1); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term toIntegerFormulaImpl(Term pI, boolean signed) { | ||
| return getFormulaCreator().getEnv().term(signed ? "sbv_to_int" : "ubv_to_int", pI); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term negate(Term pParam1) { | ||
| return getFormulaCreator().getEnv().term("bvneg", pParam1); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term add(Term pParam1, Term pParam2) { | ||
| return getFormulaCreator().getEnv().term("bvadd", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term subtract(Term pParam1, Term pParam2) { | ||
| return getFormulaCreator().getEnv().term("bvsub", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term divide(Term pParam1, Term pParam2, boolean signed) { | ||
| return getFormulaCreator().getEnv().term(signed ? "bvsdiv" : "bvudiv", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term remainder(Term pParam1, Term pParam2, boolean signed) { | ||
| return getFormulaCreator().getEnv().term(signed ? "bvsrem" : "bvurem", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term smodulo(Term pParam1, Term pParam2) { | ||
| return getFormulaCreator().getEnv().term("bvsmod", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term multiply(Term pParam1, Term pParam2) { | ||
| return getFormulaCreator().getEnv().term("bvmul", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term equal(Term pParam1, Term pParam2) { | ||
| return getFormulaCreator().getEnv().term("=", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term greaterThan(Term pParam1, Term pParam2, boolean signed) { | ||
| return getFormulaCreator().getEnv().term(signed ? "bvsgt" : "bvugt", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term greaterOrEquals(Term pParam1, Term pParam2, boolean signed) { | ||
| return getFormulaCreator().getEnv().term(signed ? "bvsge" : "bvuge", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term lessThan(Term pParam1, Term pParam2, boolean signed) { | ||
| return getFormulaCreator().getEnv().term(signed ? "bvslt" : "bvult", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term lessOrEquals(Term pParam1, Term pParam2, boolean signed) { | ||
| return getFormulaCreator().getEnv().term(signed ? "bvsle" : "bvule", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term not(Term pParam1) { | ||
| return getFormulaCreator().getEnv().term("bvnot", pParam1); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term and(Term pParam1, Term pParam2) { | ||
| return getFormulaCreator().getEnv().term("bvand", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term or(Term pParam1, Term pParam2) { | ||
| return getFormulaCreator().getEnv().term("bvor", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term xor(Term pParam1, Term pParam2) { | ||
| return getFormulaCreator().getEnv().term("bvxor", pParam1, pParam2); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term makeBitvectorImpl(int pLength, BigInteger pI) { | ||
| var raw = pI; | ||
| if (pI.signum() < 0) { | ||
| var positive = pI.negate(); | ||
| var value = BigInteger.ZERO; | ||
| for (var p = 0; p < Math.max(pLength, pI.bitLength() + 1); p++) { | ||
| if (p < positive.bitLength()) { | ||
| value = !positive.testBit(p) ? value.setBit(p) : value; | ||
| } else { | ||
| value = value.setBit(p); | ||
| } | ||
| } | ||
| raw = value.add(BigInteger.ONE); | ||
| } | ||
| checkArgument(raw.bitLength() <= pLength); | ||
| return getFormulaCreator() | ||
| .getEnv() | ||
| .getTheory() | ||
| .constant(raw, formulaCreator.getBitvectorType(pLength)); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term makeVariableImpl(int pLength, String pVar) { | ||
| return getFormulaCreator().makeVariable(getFormulaCreator().getBitvectorType(pLength), pVar); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term shiftRight(Term pNumber, Term toShift, boolean signed) { | ||
| return getFormulaCreator().getEnv().term(signed ? "bvashr" : "bvlshr", pNumber, toShift); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term shiftLeft(Term pNumber, Term pToShift) { | ||
| return getFormulaCreator().getEnv().term("bvshl", pNumber, pToShift); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term rotateRightByConstant(Term pNumber, int pToRotate) { | ||
| return getFormulaCreator() | ||
| .getEnv() | ||
| .term("rotate_right", new String[] {String.valueOf(pToRotate)}, null, pNumber); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term rotateLeftByConstant(Term pNumber, int pToRotate) { | ||
| return getFormulaCreator() | ||
| .getEnv() | ||
| .term("rotate_left", new String[] {String.valueOf(pToRotate)}, null, pNumber); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term concat(Term number, Term pAppend) { | ||
| return getFormulaCreator().getEnv().term("concat", number, pAppend); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term extract(Term pNumber, int pMsb, int pLsb) { | ||
| return getFormulaCreator() | ||
| .getEnv() | ||
| .term("extract", new String[] {String.valueOf(pMsb), String.valueOf(pLsb)}, null, pNumber); | ||
| } | ||
|
|
||
| @Override | ||
| protected Term extend(Term pNumber, int pExtensionBits, boolean pSigned) { | ||
| return getFormulaCreator() | ||
| .getEnv() | ||
| .term( | ||
| pSigned ? "sign_extend" : "zero_extend", | ||
| new String[] {String.valueOf(pExtensionBits)}, | ||
| null, | ||
| pNumber); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.