diff --git a/.classpath b/.classpath index 52a207f1a7..ccef8ed1ab 100644 --- a/.classpath +++ b/.classpath @@ -33,6 +33,7 @@ SPDX-License-Identifier: Apache-2.0 + diff --git a/.gitignore b/.gitignore index d25be26a1c..fa19999530 100644 --- a/.gitignore +++ b/.gitignore @@ -46,28 +46,28 @@ solvers_maven_conf/*.asc /common-*.jar /TEST-*.txt /junit -/JUnit.html /JUnit-coverage -/Checkstyle.html -/Checkstyle.xml -/Checkstyle.Test.html -/Checkstyle.Test.xml -/SpotBugs.html -/SpotBugs.xml -/SpotBugs.diff.html -/SpotBugs.diff.xml /Javadoc /Javadoc-z3 /gh-pages .idea/ - +run +Out.smt2 +retrieve-jars.sh +/dependencies /*.so /*.dll /*.jar -build.properties /.apt-generated/ /repository - pom.xml +/Checkstyle.html +/Checkstyle.Test.html +/Checkstyle.Test.xml +/Checkstyle.xml +/JUnit.html +/local_test_run +/rule.refaster +/SpotBugs.xml diff --git a/.idea/JavaSMT.iml b/.idea/JavaSMT.iml index 4062ca5f6b..913b8b1d23 100644 --- a/.idea/JavaSMT.iml +++ b/.idea/JavaSMT.iml @@ -174,6 +174,15 @@ SPDX-License-Identifier: Apache-2.0 + + + + + + + + + diff --git a/build/Checkstyle.exclude.xml b/build/Checkstyle.exclude.xml new file mode 100644 index 0000000000..fb4097de33 --- /dev/null +++ b/build/Checkstyle.exclude.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + diff --git a/build/SpotBugs.exclude.xml b/build/SpotBugs.exclude.xml index 6dc9f83c29..7d2c69ebb7 100644 --- a/build/SpotBugs.exclude.xml +++ b/build/SpotBugs.exclude.xml @@ -28,4 +28,6 @@ SPDX-License-Identifier: Apache-2.0 + + diff --git a/build/ivysettings.xml b/build/ivysettings.xml index be96cf00b5..c8d01d97a7 100644 --- a/build/ivysettings.xml +++ b/build/ivysettings.xml @@ -10,7 +10,6 @@ SPDX-FileCopyrightText: 2018-2020 Dirk Beyer SPDX-License-Identifier: Apache-2.0 --> - + + + diff --git a/src/org/sosy_lab/java_smt/SolverContextFactory.java b/src/org/sosy_lab/java_smt/SolverContextFactory.java index 576285424d..b869aadbec 100644 --- a/src/org/sosy_lab/java_smt/SolverContextFactory.java +++ b/src/org/sosy_lab/java_smt/SolverContextFactory.java @@ -26,10 +26,12 @@ import org.sosy_lab.java_smt.api.FloatingPointRoundingMode; import org.sosy_lab.java_smt.api.SolverContext; import org.sosy_lab.java_smt.basicimpl.AbstractNumeralFormulaManager.NonLinearArithmetic; +import org.sosy_lab.java_smt.basicimpl.Generator; import org.sosy_lab.java_smt.delegate.debugging.DebuggingSolverContext; import org.sosy_lab.java_smt.delegate.logging.LoggingSolverContext; import org.sosy_lab.java_smt.delegate.statistics.StatisticsSolverContext; import org.sosy_lab.java_smt.delegate.synchronize.SynchronizedSolverContext; +import org.sosy_lab.java_smt.solvers.SolverLess.SolverLessContext; import org.sosy_lab.java_smt.solvers.bitwuzla.BitwuzlaSolverContext; import org.sosy_lab.java_smt.solvers.boolector.BoolectorSolverContext; import org.sosy_lab.java_smt.solvers.cvc4.CVC4SolverContext; @@ -60,7 +62,8 @@ public enum Solvers { CVC4, CVC5, YICES2, - BITWUZLA + SOLVERLESS, + BITWUZLA, } @Option(secure = true, description = "Export solver queries in SmtLib format into a file.") @@ -113,6 +116,15 @@ public enum Solvers { + "This affects only the theories of integer and rational arithmetic.") private NonLinearArithmetic nonLinearArithmetic = NonLinearArithmetic.USE; + @Option(secure = true, description = "Enable SMTLIB2 script generation.") + private boolean generateSMTLIB2 = false; + + @Option(secure = true, description = "Run the solver binary instead of using the library.") + private boolean useBinary = false; + + @Option(secure = true, description = "Which Solver SolverLess should use to solve constraints") + private Solvers usedSolverBySolverLess = Solvers.Z3; + private final LogManager logger; private final ShutdownNotifier shutdownNotifier; private final Configuration config; @@ -158,6 +170,11 @@ public SolverContextFactory( Consumer pLoader) throws InvalidConfigurationException { pConfig.inject(this); + if (useBinary && !generateSMTLIB2) { + throw new InvalidConfigurationException( + "Can't use option solver.useBinary without also enabling solver.generateSMTLIB2."); + } + logger = pLogger.withComponentName("JavaSMT"); shutdownNotifier = checkNotNull(pShutdownNotifier); config = pConfig; @@ -208,7 +225,13 @@ public SolverContext generateContext() throws InvalidConfigurationException { @SuppressWarnings("resource") // returns unclosed context object public SolverContext generateContext(Solvers solverToCreate) throws InvalidConfigurationException { - + if (useBinary && solverToCreate != Solvers.PRINCESS) { + throw new InvalidConfigurationException( + String.format( + "Can't use option solver.useBinary with solver %s. Currently only Princess is" + + "supported in binary mode.", + solverToCreate)); + } SolverContext context; try { context = generateContext0(solverToCreate); @@ -234,7 +257,11 @@ public SolverContext generateContext(Solvers solverToCreate) // statistics need to be the most outer wrapping layer. context = new StatisticsSolverContext(context); } - + if (solverToCreate == Solvers.SOLVERLESS) { + Generator.setIsLoggingEnabled(true); + } else { + Generator.setIsLoggingEnabled(generateSMTLIB2); + } return context; } @@ -292,13 +319,15 @@ private SolverContext generateContext0(Solvers solverToCreate) case PRINCESS: return PrincessSolverContext.create( - config, shutdownNotifier, logfile, (int) randomSeed, nonLinearArithmetic); + config, useBinary, shutdownNotifier, logfile, (int) randomSeed, nonLinearArithmetic); case YICES2: return Yices2SolverContext.create(nonLinearArithmetic, shutdownNotifier, loader); case BOOLECTOR: return BoolectorSolverContext.create(config, shutdownNotifier, logfile, randomSeed, loader); + case SOLVERLESS: + return SolverLessContext.create(usedSolverBySolverLess); case BITWUZLA: return BitwuzlaSolverContext.create( diff --git a/src/org/sosy_lab/java_smt/api/FloatingPointRoundingMode.java b/src/org/sosy_lab/java_smt/api/FloatingPointRoundingMode.java index 6208682afa..949952c4fe 100644 --- a/src/org/sosy_lab/java_smt/api/FloatingPointRoundingMode.java +++ b/src/org/sosy_lab/java_smt/api/FloatingPointRoundingMode.java @@ -14,5 +14,22 @@ public enum FloatingPointRoundingMode { NEAREST_TIES_AWAY, TOWARD_POSITIVE, TOWARD_NEGATIVE, - TOWARD_ZERO + TOWARD_ZERO; + + public String getSMTLIBFormat() { + switch (this) { + case NEAREST_TIES_TO_EVEN: + return "RNE"; + case NEAREST_TIES_AWAY: + return "RNA"; + case TOWARD_POSITIVE: + return "RTP"; + case TOWARD_NEGATIVE: + return "RTN"; + case TOWARD_ZERO: + return "RTZ"; + default: + throw new IllegalArgumentException("Unknown rounding mode: " + this); + } + } } diff --git a/src/org/sosy_lab/java_smt/api/FormulaManager.java b/src/org/sosy_lab/java_smt/api/FormulaManager.java index 1af3b02304..d224493523 100644 --- a/src/org/sosy_lab/java_smt/api/FormulaManager.java +++ b/src/org/sosy_lab/java_smt/api/FormulaManager.java @@ -10,9 +10,11 @@ import com.google.common.collect.ImmutableMap; import com.google.errorprone.annotations.CanIgnoreReturnValue; +import java.io.IOException; import java.util.List; import java.util.Map; import org.sosy_lab.common.Appender; +import org.sosy_lab.common.configuration.InvalidConfigurationException; import org.sosy_lab.java_smt.api.visitors.FormulaTransformationVisitor; import org.sosy_lab.java_smt.api.visitors.FormulaVisitor; import org.sosy_lab.java_smt.api.visitors.TraversalProcess; @@ -20,6 +22,25 @@ /** FormulaManager class contains all operations which can be performed on formulas. */ public interface FormulaManager { + /** + * Parses an SMT-LIB2 String and translates it into an equivalent BooleanFormula constraint. + * + * @param pString SMT-LIB2 formula as String that will be parsed + * @return BooleanFormula equivalent to the SMT-LIB2 string + */ + // TODO Clean up exceptions? + BooleanFormula universalParseFromString(String pString) + throws IOException, SolverException, InterruptedException, InvalidConfigurationException; + + /** + * Calls the dumpSMTLIB2 method from the Generator, which will write the assembled SMT-LIB2 to a + * file 'Out.smt2'. + * + * @throws IOException if writing to file fails + */ + // TODO Return a String, instead of writing to a file + void dumpSMTLIB2() throws IOException; + /** * Returns the Integer-Theory. Because most SAT-solvers support automatic casting between Integer- * and Rational-Theory, the Integer- and the RationalFormulaManager both return the same Formulas diff --git a/src/org/sosy_lab/java_smt/api/FormulaType.java b/src/org/sosy_lab/java_smt/api/FormulaType.java index 87e08875e2..633f29503e 100644 --- a/src/org/sosy_lab/java_smt/api/FormulaType.java +++ b/src/org/sosy_lab/java_smt/api/FormulaType.java @@ -274,8 +274,9 @@ public String toString() { } @Override - public String toSMTLIBString() { - return "(_ FloatingPoint " + exponentSize + " " + mantissaSize + ")"; + public String toSMTLIBString() { // SMTLIB2 ALWAYS CONSIDERS SIGN BIT IN THE MANTISSA SIZE! + // returning (_ FloatingPoint 8 23) for single precision is incorrect. + return "(_ FloatingPoint " + exponentSize + " " + mantissaSize + 1 + ")"; } } diff --git a/src/org/sosy_lab/java_smt/api/SolverContext.java b/src/org/sosy_lab/java_smt/api/SolverContext.java index 3fbd476c77..e73c1373c0 100644 --- a/src/org/sosy_lab/java_smt/api/SolverContext.java +++ b/src/org/sosy_lab/java_smt/api/SolverContext.java @@ -53,7 +53,10 @@ enum ProverOptions { GENERATE_UNSAT_CORE_OVER_ASSUMPTIONS, /** Whether the solver should enable support for formulae build in SL theory. */ - ENABLE_SEPARATION_LOGIC + ENABLE_SEPARATION_LOGIC, + + // TODO Document this option + USE_BINARY } /** diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractArrayFormulaManager.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractArrayFormulaManager.java index e2a85a78b6..84611a0918 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractArrayFormulaManager.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractArrayFormulaManager.java @@ -38,8 +38,11 @@ public TE select( // Rational final TFormulaInfo term = select(extractInfo(pArray), extractInfo(pIndex)); - - return (TE) getFormulaCreator().encapsulate(elementType, term); + TE result = (TE) getFormulaCreator().encapsulate(elementType, term); + if (Generator.isLoggingEnabled()) { + ArrayGenerator.logSelect(result, pArray, pIndex); + } + return result; } protected abstract TFormulaInfo select(TFormulaInfo pArray, TFormulaInfo pIndex); @@ -52,7 +55,12 @@ public ArrayFormula store( final FormulaType elementType = getFormulaCreator().getArrayFormulaElementType(pArray); final TFormulaInfo term = store(extractInfo(pArray), extractInfo(pIndex), extractInfo(pValue)); - return getFormulaCreator().encapsulateArray(term, indexType, elementType); + ArrayFormula result = + getFormulaCreator().encapsulateArray(term, indexType, elementType); + if (Generator.isLoggingEnabled()) { + ArrayGenerator.logStore(result, pArray, pIndex, pValue); + } + return result; } protected abstract TFormulaInfo store( @@ -64,10 +72,16 @@ protected abstract TFormulaInfo store( TE extends Formula, FTI extends FormulaType, FTE extends FormulaType> - ArrayFormula makeArray(String pName, FTI pIndexType, FTE pElementType) { + ArrayFormula makeArray(String pName, FTI pIndexType, FTE pElementType) + throws GeneratorException { checkVariableName(pName); final TFormulaInfo namedArrayFormula = internalMakeArray(pName, pIndexType, pElementType); - return getFormulaCreator().encapsulateArray(namedArrayFormula, pIndexType, pElementType); + ArrayFormula result = + getFormulaCreator().encapsulateArray(namedArrayFormula, pIndexType, pElementType); + if (Generator.isLoggingEnabled()) { + ArrayGenerator.logMakeArray(result, pName, pIndexType, pElementType); + } + return result; } @Override @@ -101,8 +115,13 @@ public FormulaType getElementType(ArrayFormula p @Override public BooleanFormula equivalence( ArrayFormula pArray1, ArrayFormula pArray2) { - return getFormulaCreator() - .encapsulateBoolean(equivalence(extractInfo(pArray1), extractInfo(pArray2))); + BooleanFormula result = + getFormulaCreator() + .encapsulateBoolean(equivalence(extractInfo(pArray1), extractInfo(pArray2))); + if (Generator.isLoggingEnabled()) { + ArrayGenerator.logArrayEquivalence(result, pArray1, pArray2); + } + return result; } protected abstract TFormulaInfo equivalence(TFormulaInfo pArray1, TFormulaInfo pArray2); diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractBitvectorFormulaManager.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractBitvectorFormulaManager.java index 19a797a485..3b64ad2664 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractBitvectorFormulaManager.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractBitvectorFormulaManager.java @@ -56,16 +56,27 @@ private void checkSameSize( @Override public BitvectorFormula makeBitvector(int length, IntegerFormula pI) { TFormulaInfo param1 = extractInfo(pI); - return wrap(makeBitvectorImpl(length, param1)); + BitvectorFormula result = wrap(makeBitvectorImpl(length, param1)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logMakeBitVector(result, length, pI); + } + return result; } protected abstract TFormulaInfo makeBitvectorImpl(int length, TFormulaInfo pParam1); @Override - public IntegerFormula toIntegerFormula(BitvectorFormula pI, boolean signed) { + public IntegerFormula toIntegerFormula(BitvectorFormula pI, boolean signed) + throws GeneratorException { TFormulaInfo param1 = extractInfo(pI); - return getFormulaCreator() - .encapsulate(FormulaType.IntegerType, toIntegerFormulaImpl(param1, signed)); + IntegerFormula result = + getFormulaCreator() + .encapsulate(FormulaType.IntegerType, toIntegerFormulaImpl(param1, signed)); + if (Generator.isLoggingEnabled()) { + throw new GeneratorException( + "toIntegerFormula operation is not available for bitvectors in SMTLIB2"); + } + return result; } protected abstract TFormulaInfo toIntegerFormulaImpl(TFormulaInfo pI, boolean signed); @@ -73,7 +84,11 @@ public IntegerFormula toIntegerFormula(BitvectorFormula pI, boolean signed) { @Override public BitvectorFormula negate(BitvectorFormula pNumber) { TFormulaInfo param1 = extractInfo(pNumber); - return wrap(negate(param1)); + BitvectorFormula result = wrap(negate(param1)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVNegate(result, pNumber); + } + return result; } protected abstract TFormulaInfo negate(TFormulaInfo pParam1); @@ -83,8 +98,11 @@ public BitvectorFormula add(BitvectorFormula pNumber1, BitvectorFormula pNumber2 checkSameSize(pNumber1, pNumber2, "add"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(add(param1, param2)); + BitvectorFormula result = wrap(add(param1, param2)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVAdd(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo add(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -94,8 +112,11 @@ public BitvectorFormula subtract(BitvectorFormula pNumber1, BitvectorFormula pNu checkSameSize(pNumber1, pNumber2, "subtract"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(subtract(param1, param2)); + BitvectorFormula result = wrap(subtract(param1, param2)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVSub(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo subtract(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -106,8 +127,15 @@ public BitvectorFormula divide( checkSameSize(pNumber1, pNumber2, "divide"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(divide(param1, param2, signed)); + BitvectorFormula result = wrap(divide(param1, param2, signed)); + if (Generator.isLoggingEnabled()) { + if (signed) { + BitvectorGenerator.logBVSDivide(result, pNumber1, pNumber2); + } else { + BitvectorGenerator.logBVUDivide(result, pNumber1, pNumber2); + } + } + return result; } protected abstract TFormulaInfo divide( @@ -117,10 +145,15 @@ protected abstract TFormulaInfo divide( public BitvectorFormula remainder( BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed) { checkSameSize(pNumber1, pNumber2, "rem"); - TFormulaInfo param1 = extractInfo(pNumber1); - TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(remainder(param1, param2, signed)); + BitvectorFormula result = wrap(remainder(extractInfo(pNumber1), extractInfo(pNumber2), signed)); + if (Generator.isLoggingEnabled()) { + if (signed) { + BitvectorGenerator.logBVSignedRemainder(result, pNumber1, pNumber2); + } else { + BitvectorGenerator.logBVUnsignedRemainder(result, pNumber1, pNumber2); + } + } + return result; } protected abstract TFormulaInfo remainder( @@ -132,7 +165,11 @@ public BitvectorFormula smodulo(BitvectorFormula pNumber1, BitvectorFormula pNum TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - return wrap(smodulo(param1, param2)); + BitvectorFormula result = wrap(smodulo(param1, param2)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVSignedRemainder(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo smodulo(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -142,8 +179,11 @@ public BitvectorFormula multiply(BitvectorFormula pNumber1, BitvectorFormula pNu checkSameSize(pNumber1, pNumber2, "modulo"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(multiply(param1, param2)); + BitvectorFormula result = wrap(multiply(param1, param2)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVMultiply(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo multiply(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -153,8 +193,11 @@ public BooleanFormula equal(BitvectorFormula pNumber1, BitvectorFormula pNumber2 checkSameSize(pNumber1, pNumber2, "compare"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(equal(param1, param2)); + BooleanFormula result = wrapBool(equal(param1, param2)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVEqual(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo equal(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -165,8 +208,15 @@ public BooleanFormula greaterThan( checkSameSize(pNumber1, pNumber2, "compare"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(greaterThan(param1, param2, signed)); + BooleanFormula result = wrapBool(greaterThan(param1, param2, signed)); + if (Generator.isLoggingEnabled()) { + if (signed) { + BitvectorGenerator.logBVSGreaterThan(result, pNumber1, pNumber2); + } else { + BitvectorGenerator.logBVUGreaterThan(result, pNumber1, pNumber2); + } + } + return result; } protected abstract TFormulaInfo greaterThan( @@ -178,8 +228,15 @@ public BooleanFormula greaterOrEquals( checkSameSize(pNumber1, pNumber2, "compare"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(greaterOrEquals(param1, param2, signed)); + BooleanFormula result = wrapBool(greaterOrEquals(param1, param2, signed)); + if (Generator.isLoggingEnabled()) { + if (signed) { + BitvectorGenerator.logBVSGreaterOrEqual(result, pNumber1, pNumber2); + } else { + BitvectorGenerator.logBVUGreaterOrEqual(result, pNumber1, pNumber2); + } + } + return result; } protected abstract TFormulaInfo greaterOrEquals( @@ -191,8 +248,15 @@ public BooleanFormula lessThan( checkSameSize(pNumber1, pNumber2, "compare"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(lessThan(param1, param2, signed)); + BooleanFormula result = wrapBool(lessThan(param1, param2, signed)); + if (Generator.isLoggingEnabled()) { + if (signed) { + BitvectorGenerator.logBVSLessThan(result, pNumber1, pNumber2); + } else { + BitvectorGenerator.logBVULessThan(result, pNumber1, pNumber2); + } + } + return result; } protected abstract TFormulaInfo lessThan( @@ -204,8 +268,15 @@ public BooleanFormula lessOrEquals( checkSameSize(pNumber1, pNumber2, "compare"); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(lessOrEquals(param1, param2, signed)); + BooleanFormula result = wrapBool(lessOrEquals(param1, param2, signed)); + if (Generator.isLoggingEnabled()) { + if (signed) { + BitvectorGenerator.logBVSLessOrEqual(result, pNumber1, pNumber2); + } else { + BitvectorGenerator.logBVULessOrEqual(result, pNumber1, pNumber2); + } + } + return result; } protected abstract TFormulaInfo lessOrEquals( @@ -214,7 +285,11 @@ protected abstract TFormulaInfo lessOrEquals( @Override public BitvectorFormula not(BitvectorFormula pBits) { TFormulaInfo param1 = extractInfo(pBits); - return wrap(not(param1)); + BitvectorFormula result = wrap(not(param1)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVNot(result, pBits); + } + return result; } protected abstract TFormulaInfo not(TFormulaInfo pParam1); @@ -224,8 +299,11 @@ public BitvectorFormula and(BitvectorFormula pBits1, BitvectorFormula pBits2) { checkSameSize(pBits1, pBits2, "combine"); TFormulaInfo param1 = extractInfo(pBits1); TFormulaInfo param2 = extractInfo(pBits2); - - return wrap(and(param1, param2)); + BitvectorFormula result = wrap(and(param1, param2)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVAnd(result, pBits1, pBits2); + } + return result; } protected abstract TFormulaInfo and(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -235,8 +313,11 @@ public BitvectorFormula or(BitvectorFormula pBits1, BitvectorFormula pBits2) { checkSameSize(pBits1, pBits2, "combine"); TFormulaInfo param1 = extractInfo(pBits1); TFormulaInfo param2 = extractInfo(pBits2); - - return wrap(or(param1, param2)); + BitvectorFormula result = wrap(or(param1, param2)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVOr(result, pBits1, pBits2); + } + return result; } protected abstract TFormulaInfo or(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -246,15 +327,23 @@ public BitvectorFormula xor(BitvectorFormula pBits1, BitvectorFormula pBits2) { checkSameSize(pBits1, pBits2, "combine"); TFormulaInfo param1 = extractInfo(pBits1); TFormulaInfo param2 = extractInfo(pBits2); - - return wrap(xor(param1, param2)); + BitvectorFormula result = wrap(xor(param1, param2)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVXor(result, pBits1, pBits2); + } + return result; } protected abstract TFormulaInfo xor(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public BitvectorFormula makeBitvector(int pLength, long i) { - return wrap(makeBitvectorImpl(pLength, i)); + BitvectorFormula result = wrap(makeBitvectorImpl(pLength, i)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logMakeBitVector( + result, pLength, transformValueToRange(pLength, BigInteger.valueOf(i))); + } + return result; } protected TFormulaInfo makeBitvectorImpl(int pLength, long pI) { @@ -263,7 +352,11 @@ protected TFormulaInfo makeBitvectorImpl(int pLength, long pI) { @Override public BitvectorFormula makeBitvector(int pLength, BigInteger i) { - return wrap(makeBitvectorImpl(pLength, i)); + BitvectorFormula result = wrap(makeBitvectorImpl(pLength, i)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logMakeBitVector(result, pLength, transformValueToRange(pLength, i)); + } + return result; } protected abstract TFormulaInfo makeBitvectorImpl(int pLength, BigInteger pI); @@ -289,13 +382,21 @@ protected final BigInteger transformValueToRange(int pLength, BigInteger pI) { @Override public BitvectorFormula makeVariable(BitvectorType type, String pVar) { - return makeVariable(type.getSize(), pVar); + BitvectorFormula result = makeVariable(type.getSize(), pVar); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logMakeBitVecVariable(result, type, pVar); + } + return result; } @Override public BitvectorFormula makeVariable(int pLength, String pVar) { checkVariableName(pVar); - return wrap(makeVariableImpl(pLength, pVar)); + BitvectorFormula result = wrap(makeVariableImpl(pLength, pVar)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logMakeBitVecVariable(result, pLength, pVar); + } + return result; } protected abstract TFormulaInfo makeVariableImpl(int pLength, String pVar); @@ -306,7 +407,15 @@ public BitvectorFormula makeVariable(int pLength, String pVar) { @Override public BitvectorFormula shiftRight( BitvectorFormula pNumber, BitvectorFormula pToShift, boolean signed) { - return wrap(shiftRight(extractInfo(pNumber), extractInfo(pToShift), signed)); + BitvectorFormula result = wrap(shiftRight(extractInfo(pNumber), extractInfo(pToShift), signed)); + if (Generator.isLoggingEnabled()) { + if (signed) { + BitvectorGenerator.logBVSShiftRight(result, pNumber, pToShift); + } else { + BitvectorGenerator.logBVUShiftRight(result, pNumber, pToShift); + } + } + return result; } protected abstract TFormulaInfo shiftRight( @@ -314,7 +423,11 @@ protected abstract TFormulaInfo shiftRight( @Override public BitvectorFormula shiftLeft(BitvectorFormula pNumber, BitvectorFormula toShift) { - return wrap(shiftLeft(extractInfo(pNumber), extractInfo(toShift))); + BitvectorFormula result = wrap(shiftLeft(extractInfo(pNumber), extractInfo(toShift))); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logBVShiftLeft(result, pNumber, toShift); + } + return result; } protected abstract TFormulaInfo shiftLeft(TFormulaInfo pNumber, TFormulaInfo pToShift); @@ -322,6 +435,7 @@ public BitvectorFormula shiftLeft(BitvectorFormula pNumber, BitvectorFormula toS @Override public BitvectorFormula rotateLeft(BitvectorFormula pNumber, int pToRotate) { checkArgument(pToRotate >= 0, "Can not rotate by a negative number %s.", pToRotate); + // TODO: add SMTLib2 layer independent of shift return wrap(rotateLeftByConstant(extractInfo(pNumber), pToRotate)); } @@ -333,6 +447,7 @@ protected TFormulaInfo rotateLeftByConstant(TFormulaInfo pNumber, int pToRotate) @Override public BitvectorFormula rotateLeft(BitvectorFormula pNumber, BitvectorFormula pToRotate) { + // TODO: add SMTLib2 layer independent of shift return wrap(rotateLeft(extractInfo(pNumber), extractInfo(pToRotate))); } @@ -355,6 +470,7 @@ protected TFormulaInfo rotateLeft(TFormulaInfo pNumber, TFormulaInfo pToRotate) @Override public BitvectorFormula rotateRight(BitvectorFormula pNumber, int pToRotate) { checkArgument(pToRotate >= 0, "Can not rotate by a negative number %s.", pToRotate); + // TODO: add SMTLib2 layer independent of shift return wrap(rotateRightByConstant(extractInfo(pNumber), pToRotate)); } @@ -366,6 +482,7 @@ protected TFormulaInfo rotateRightByConstant(TFormulaInfo pNumber, int pToRotate @Override public BitvectorFormula rotateRight(BitvectorFormula pNumber, BitvectorFormula pToRotate) { + // TODO: add SMTLib2 layer independent of shift return wrap(rotateRight(extractInfo(pNumber), extractInfo(pToRotate))); } @@ -387,7 +504,11 @@ protected TFormulaInfo rotateRight(TFormulaInfo pNumber, TFormulaInfo pToRotate) @Override public final BitvectorFormula concat(BitvectorFormula pNumber, BitvectorFormula pAppend) { - return wrap(concat(extractInfo(pNumber), extractInfo(pAppend))); + BitvectorFormula result = wrap(concat(extractInfo(pNumber), extractInfo(pAppend))); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logConcat(result, pNumber, pAppend); + } + return result; } protected abstract TFormulaInfo concat(TFormulaInfo number, TFormulaInfo pAppend); @@ -398,7 +519,11 @@ public final BitvectorFormula extract(BitvectorFormula pNumber, int pMsb, int pL checkArgument(0 <= pLsb, "index out of bounds (negative index %s)", pLsb); checkArgument(pLsb <= pMsb, "invalid range (lsb %s larger than msb %s)", pLsb, pMsb); checkArgument(pMsb < bitsize, "index out of bounds (index %s beyond length %s)", pMsb, bitsize); - return wrap(extract(extractInfo(pNumber), pMsb, pLsb)); + BitvectorFormula result = wrap(extract(extractInfo(pNumber), pMsb, pLsb)); + if (Generator.isLoggingEnabled()) { + BitvectorGenerator.logExtract(result, pNumber, pMsb, pLsb); + } + return result; } protected abstract TFormulaInfo extract(TFormulaInfo pNumber, int pMsb, int pLsb); @@ -407,7 +532,15 @@ public final BitvectorFormula extract(BitvectorFormula pNumber, int pMsb, int pL public final BitvectorFormula extend( BitvectorFormula pNumber, int pExtensionBits, boolean pSigned) { checkArgument(0 <= pExtensionBits, "can not extend a negative number of bits"); - return wrap(extend(extractInfo(pNumber), pExtensionBits, pSigned)); + BitvectorFormula result = wrap(extend(extractInfo(pNumber), pExtensionBits, pSigned)); + if (Generator.isLoggingEnabled()) { + if (pSigned) { + BitvectorGenerator.logSExtend(result, pNumber, pExtensionBits); + } else { + BitvectorGenerator.logUExtend(result, pNumber, pExtensionBits); + } + } + return result; } protected abstract TFormulaInfo extend(TFormulaInfo pNumber, int pExtensionBits, boolean pSigned); @@ -415,18 +548,35 @@ public final BitvectorFormula extend( @Override public int getLength(BitvectorFormula pNumber) { FormulaType type = getFormulaCreator().getFormulaType(pNumber); - return ((FormulaType.BitvectorType) type).getSize(); + int result = ((FormulaType.BitvectorType) type).getSize(); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logMakeNumber(result, String.valueOf(result)); + } + return result; } @Override - public final BooleanFormula distinct(List pBits) { + public final BooleanFormula distinct(List pBits) throws GeneratorException { // optimization if (pBits.size() <= 1) { - return bmgr.makeTrue(); + BooleanFormula nativeTrue = bmgr.makeTrue(); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logMakeTrue(nativeTrue, "true"); + } + return nativeTrue; } else if (pBits.size() > 1L << getLength(pBits.iterator().next())) { - return bmgr.makeFalse(); + BooleanFormula nativeFalse = bmgr.makeFalse(); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logMakeFalse(nativeFalse, "false"); + } + return nativeFalse; } else { - return wrapBool(distinctImpl(Lists.transform(pBits, this::extractInfo))); + BooleanFormula result = wrapBool(distinctImpl(Lists.transform(pBits, this::extractInfo))); + if (Generator.isLoggingEnabled()) { + throw new GeneratorException( + "distinct operation is not available for bitvectors in " + "SMT-LIB2"); + } + return result; } } diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractBooleanFormulaManager.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractBooleanFormulaManager.java index 2a6f552249..0e11ab237a 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractBooleanFormulaManager.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractBooleanFormulaManager.java @@ -61,7 +61,11 @@ private BooleanFormula wrap(TFormulaInfo formulaInfo) { @Override public BooleanFormula makeVariable(String pVar) { checkVariableName(pVar); - return wrap(makeVariableImpl(pVar)); + BooleanFormula result = wrap(makeVariableImpl(pVar)); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logMakeVariable(result, pVar); + } + return result; } protected abstract TFormulaInfo makeVariableImpl(String pVar); @@ -71,7 +75,11 @@ public BooleanFormula makeTrue() { if (trueFormula == null) { trueFormula = wrap(makeBooleanImpl(true)); } - return trueFormula; + BooleanFormula result = trueFormula; + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logMakeTrue(result, "true"); + } + return result; } @Override @@ -79,7 +87,11 @@ public BooleanFormula makeFalse() { if (falseFormula == null) { falseFormula = wrap(makeBooleanImpl(false)); } - return falseFormula; + BooleanFormula result = falseFormula; + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logMakeFalse(result, "false"); + } + return result; } protected abstract TFormulaInfo makeBooleanImpl(boolean value); @@ -87,7 +99,11 @@ public BooleanFormula makeFalse() { @Override public BooleanFormula not(BooleanFormula pBits) { TFormulaInfo param1 = extractInfo(pBits); - return wrap(not(param1)); + BooleanFormula result = wrap(not(param1)); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logNot(result, pBits); + } + return result; } protected abstract TFormulaInfo not(TFormulaInfo pParam1); @@ -96,8 +112,11 @@ public BooleanFormula not(BooleanFormula pBits) { public BooleanFormula and(BooleanFormula pBits1, BooleanFormula pBits2) { TFormulaInfo param1 = extractInfo(pBits1); TFormulaInfo param2 = extractInfo(pBits2); - - return wrap(and(param1, param2)); + BooleanFormula result = wrap(and(param1, param2)); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logAnd(result, pBits1, pBits2); + } + return result; } protected abstract TFormulaInfo and(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -106,14 +125,30 @@ public BooleanFormula and(BooleanFormula pBits1, BooleanFormula pBits2) { public BooleanFormula and(Collection pBits) { switch (pBits.size()) { case 0: - return makeTrue(); + BooleanFormula result0 = makeTrue(); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logMakeTrue(result0, "true"); + } + return result0; case 1: - return pBits.iterator().next(); + BooleanFormula result1 = pBits.iterator().next(); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logAnd(result1, pBits); + } + return result1; case 2: Iterator it = pBits.iterator(); - return and(it.next(), it.next()); + BooleanFormula result2 = and(it.next(), it.next()); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logAnd(result2, pBits); + } + return result2; default: - return wrap(andImpl(Collections2.transform(pBits, this::extractInfo))); + BooleanFormula result = wrap(andImpl(Collections2.transform(pBits, this::extractInfo))); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logAnd(result, pBits); + } + return result; } } @@ -150,8 +185,11 @@ protected TFormulaInfo andImpl(Collection pParams) { public BooleanFormula or(BooleanFormula pBits1, BooleanFormula pBits2) { TFormulaInfo param1 = extractInfo(pBits1); TFormulaInfo param2 = extractInfo(pBits2); - - return wrap(or(param1, param2)); + BooleanFormula result = wrap(or(param1, param2)); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logOr(result, pBits1, pBits2); + } + return result; } @Override @@ -165,22 +203,41 @@ public BooleanFormula or(BooleanFormula... pBits) { public BooleanFormula xor(BooleanFormula pBits1, BooleanFormula pBits2) { TFormulaInfo param1 = extractInfo(pBits1); TFormulaInfo param2 = extractInfo(pBits2); - - return wrap(xor(param1, param2)); + BooleanFormula result = wrap(xor(param1, param2)); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logXor(result, pBits1, pBits2); + } + return result; } @Override public BooleanFormula or(Collection pBits) { switch (pBits.size()) { case 0: - return makeFalse(); + BooleanFormula result0 = makeFalse(); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logMakeFalse(result0, "false"); + } + return result0; case 1: - return pBits.iterator().next(); + BooleanFormula result1 = pBits.iterator().next(); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logOr(result1, pBits); + } + return result1; case 2: Iterator it = pBits.iterator(); - return or(it.next(), it.next()); + BooleanFormula result2 = or(it.next(), it.next()); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logOr(result2, pBits); + } + return result2; default: - return wrap(orImpl(Collections2.transform(pBits, this::extractInfo))); + BooleanFormula result = wrap(orImpl(Collections2.transform(pBits, this::extractInfo))); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logOr(result, pBits); + } + return result; } } @@ -221,7 +278,11 @@ protected TFormulaInfo orImpl(Collection pParams) { public final BooleanFormula equivalence(BooleanFormula pBits1, BooleanFormula pBits2) { TFormulaInfo param1 = extractInfo(pBits1); TFormulaInfo param2 = extractInfo(pBits2); - return wrap(equivalence(param1, param2)); + BooleanFormula result = wrap(equivalence(param1, param2)); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logEquivalence(result, pBits1, pBits2); + } + return result; } protected abstract TFormulaInfo equivalence(TFormulaInfo bits1, TFormulaInfo bits2); @@ -230,7 +291,11 @@ public final BooleanFormula equivalence(BooleanFormula pBits1, BooleanFormula pB public final BooleanFormula implication(BooleanFormula pBits1, BooleanFormula pBits2) { TFormulaInfo param1 = extractInfo(pBits1); TFormulaInfo param2 = extractInfo(pBits2); - return wrap(implication(param1, param2)); + BooleanFormula result = wrap(implication(param1, param2)); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logImplication(result, pBits1, pBits2); + } + return result; } protected TFormulaInfo implication(TFormulaInfo bits1, TFormulaInfo bits2) { @@ -272,7 +337,11 @@ public final T ifThenElse(BooleanFormula pBits, T f1, T f2) f2, t2); TFormulaInfo result = ifThenElse(extractInfo(pBits), extractInfo(f1), extractInfo(f2)); - return getFormulaCreator().encapsulate(t1, result); + var finalResult = getFormulaCreator().encapsulate(t1, result); + if (Generator.isLoggingEnabled()) { + BooleanGenerator.logIfThenElse(finalResult, pBits, f1, f2); + } + return finalResult; } protected abstract TFormulaInfo ifThenElse(TFormulaInfo cond, TFormulaInfo f1, TFormulaInfo f2); diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractEvaluator.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractEvaluator.java index 176dbebd85..a219a69fa1 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractEvaluator.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractEvaluator.java @@ -42,6 +42,9 @@ protected AbstractEvaluator( @Override public final T eval(T f) { Preconditions.checkState(!isClosed()); + if (Generator.isLoggingEnabled()) { + Generator.getLines().append("(get-value (" + f + "))\n"); + } TFormulaInfo evaluation = evalImpl(creator.extractInfo(f)); return evaluation == null ? null : (T) creator.encapsulateWithTypeOf(evaluation); } @@ -50,12 +53,19 @@ public final T eval(T f) { @Override public final BigInteger evaluate(IntegerFormula f) { Preconditions.checkState(!isClosed()); + if (Generator.isLoggingEnabled()) { + Generator.getLines().append("(get-value (" + f + "))\n"); + } return (BigInteger) evaluateImpl(creator.extractInfo(f)); } @Nullable @Override public Rational evaluate(RationalFormula f) { + Preconditions.checkState(!isClosed()); + if (Generator.isLoggingEnabled()) { + Generator.getLines().append("(get-value (" + f + "))\n"); + } Object value = evaluateImpl(creator.extractInfo(f)); if (value instanceof BigInteger) { // We simplified the value internally. Here, we need to convert it back to Rational. @@ -69,6 +79,9 @@ public Rational evaluate(RationalFormula f) { @Override public final Boolean evaluate(BooleanFormula f) { Preconditions.checkState(!isClosed()); + if (Generator.isLoggingEnabled()) { + Generator.getLines().append("(get-value (" + f + "))\n"); + } return (Boolean) evaluateImpl(creator.extractInfo(f)); } @@ -76,6 +89,9 @@ public final Boolean evaluate(BooleanFormula f) { @Override public final String evaluate(StringFormula f) { Preconditions.checkState(!isClosed()); + if (Generator.isLoggingEnabled()) { + Generator.getLines().append("(get-value (" + f + "))\n"); + } return (String) evaluateImpl(creator.extractInfo(f)); } @@ -83,6 +99,9 @@ public final String evaluate(StringFormula f) { @Override public final String evaluate(EnumerationFormula f) { Preconditions.checkState(!isClosed()); + if (Generator.isLoggingEnabled()) { + Generator.getLines().append("(get-value (" + f + "))\n"); + } return (String) evaluateImpl(creator.extractInfo(f)); } @@ -96,6 +115,9 @@ public final String evaluate(EnumerationFormula f) { @Override public final BigInteger evaluate(BitvectorFormula f) { Preconditions.checkState(!isClosed()); + if (Generator.isLoggingEnabled()) { + Generator.getLines().append("(get-value (" + f + "))\n"); + } return (BigInteger) evaluateImpl(creator.extractInfo(f)); } @@ -106,6 +128,9 @@ public final Object evaluate(Formula f) { Preconditions.checkArgument( !(f instanceof ArrayFormula), "cannot compute a simple constant evaluation for an array-formula"); + if (Generator.isLoggingEnabled()) { + Generator.getLines().append("(get-value (" + f + "))\n"); + } return evaluateImpl(creator.extractInfo(f)); } diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractFloatingPointFormulaManager.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractFloatingPointFormulaManager.java index d1e0b5eb9d..6ef83465a9 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractFloatingPointFormulaManager.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractFloatingPointFormulaManager.java @@ -8,8 +8,6 @@ package org.sosy_lab.java_smt.basicimpl; -import static org.sosy_lab.java_smt.basicimpl.AbstractFormulaManager.checkVariableName; - import com.google.common.base.Preconditions; import java.math.BigDecimal; import java.math.BigInteger; @@ -64,80 +62,128 @@ protected FloatingPointFormula wrap(TFormulaInfo pTerm) { } @Override - public FloatingPointFormula makeNumber(Rational n, FormulaType.FloatingPointType type) { - return wrap(makeNumberImpl(n.toString(), type, getDefaultRoundingMode())); + public FloatingPointFormula makeNumber(Rational pN, FormulaType.FloatingPointType pType) { + FloatingPointFormula result = + wrap(makeNumberImpl(pN.toString(), pType, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPoint( + result, pType.getExponentSize(), pType.getMantissaSize(), pN); + } + return result; } @Override public FloatingPointFormula makeNumber( - Rational n, FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) { - return wrap(makeNumberImpl(n.toString(), type, getRoundingMode(pFloatingPointRoundingMode))); + Rational pN, FloatingPointType pType, FloatingPointRoundingMode pRoundingMode) { + FloatingPointFormula result = + wrap(makeNumberImpl(pN.toString(), pType, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPoint( + result, pType.getExponentSize(), pType.getMantissaSize(), pN); + } + return result; } @Override - public FloatingPointFormula makeNumber(double n, FormulaType.FloatingPointType type) { - return wrap(makeNumberImpl(n, type, getDefaultRoundingMode())); + public FloatingPointFormula makeNumber(double pN, FormulaType.FloatingPointType pType) { + FloatingPointFormula result = wrap(makeNumberImpl(pN, pType, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPoint( + result, pType.getExponentSize(), pType.getMantissaSize(), pN); + } + return result; } @Override public FloatingPointFormula makeNumber( - double n, FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) { - return wrap(makeNumberImpl(n, type, getRoundingMode(pFloatingPointRoundingMode))); + double pN, FloatingPointType pType, FloatingPointRoundingMode pRoundingMode) { + FloatingPointFormula result = wrap(makeNumberImpl(pN, pType, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPoint( + result, pType.getExponentSize(), pType.getMantissaSize(), pN); + } + return result; } protected abstract TFormulaInfo makeNumberImpl( - double n, FormulaType.FloatingPointType type, TFormulaInfo pFloatingPointRoundingMode); + double pN, FormulaType.FloatingPointType pType, TFormulaInfo pFloatingPointRoundingMode); @Override - public FloatingPointFormula makeNumber(BigDecimal n, FormulaType.FloatingPointType type) { - return wrap(makeNumberImpl(n, type, getDefaultRoundingMode())); + public FloatingPointFormula makeNumber(BigDecimal pN, FormulaType.FloatingPointType pType) { + FloatingPointFormula result = wrap(makeNumberImpl(pN, pType, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPoint( + result, pType.getExponentSize(), pType.getMantissaSize(), pN); + } + return result; } @Override public FloatingPointFormula makeNumber( - BigDecimal n, FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) { - return wrap(makeNumberImpl(n, type, getRoundingMode(pFloatingPointRoundingMode))); + BigDecimal pN, FloatingPointType pType, FloatingPointRoundingMode pRoundingMode) { + FloatingPointFormula result = wrap(makeNumberImpl(pN, pType, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPoint( + result, pType.getExponentSize(), pType.getMantissaSize(), pN); + } + return result; } protected TFormulaInfo makeNumberImpl( - BigDecimal n, FormulaType.FloatingPointType type, TFormulaInfo pFloatingPointRoundingMode) { - return makeNumberImpl(n.toPlainString(), type, pFloatingPointRoundingMode); + BigDecimal pN, FormulaType.FloatingPointType pType, TFormulaInfo pFloatingPointRoundingMode) { + return makeNumberImpl(pN.toPlainString(), pType, pFloatingPointRoundingMode); } @Override - public FloatingPointFormula makeNumber(String n, FormulaType.FloatingPointType type) { - return wrap(makeNumberImpl(n, type, getDefaultRoundingMode())); + public FloatingPointFormula makeNumber(String pN, FormulaType.FloatingPointType pType) { + FloatingPointFormula result = wrap(makeNumberImpl(pN, pType, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPoint( + result, pType.getExponentSize(), pType.getMantissaSize(), pN); + } + return result; } @Override public FloatingPointFormula makeNumber( - String n, FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode) { - return wrap(makeNumberImpl(n, type, getRoundingMode(pFloatingPointRoundingMode))); + String pN, FloatingPointType pType, FloatingPointRoundingMode pRoundingMode) { + FloatingPointFormula result = wrap(makeNumberImpl(pN, pType, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPoint( + result, pType.getExponentSize(), pType.getMantissaSize(), pN); + } + return result; } /** directly catch the most common special String constants. */ protected TFormulaInfo makeNumberImpl( - String n, FormulaType.FloatingPointType type, TFormulaInfo pFloatingPointRoundingMode) { - if (n.startsWith("+")) { - n = n.substring(1); + String pN, FormulaType.FloatingPointType pType, TFormulaInfo pFloatingPointRoundingMode) { + String input = pN; + if (input.startsWith("+")) { + input = input.substring(1); } - switch (n) { + switch (input) { case "NaN": case "-NaN": - return makeNaNImpl(type); + return makeNaNImpl(pType); case "Infinity": - return makePlusInfinityImpl(type); + return makePlusInfinityImpl(pType); case "-Infinity": - return makeMinusInfinityImpl(type); + return makeMinusInfinityImpl(pType); default: - return makeNumberAndRound(n, type, pFloatingPointRoundingMode); + return makeNumberAndRound(input, pType, pFloatingPointRoundingMode); } } @Override public FloatingPointFormula makeNumber( BigInteger exponent, BigInteger mantissa, boolean signBit, FloatingPointType type) { - return wrap(makeNumberImpl(exponent, mantissa, signBit, type)); + FloatingPointFormula result = wrap(makeNumberImpl(exponent, mantissa, signBit, type)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPointFromBigInteger( + result, exponent, mantissa, signBit, type); + } + return result; } protected abstract TFormulaInfo makeNumberImpl( @@ -153,8 +199,12 @@ protected abstract TFormulaInfo makeNumberAndRound( @Override public FloatingPointFormula makeVariable(String pVar, FormulaType.FloatingPointType pType) { - checkVariableName(pVar); - return wrap(makeVariableImpl(pVar, pType)); + AbstractFormulaManager.checkVariableName(pVar); + FloatingPointFormula result = wrap(makeVariableImpl(pVar, pType)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeFloatingPointVariable(result, pType, pVar); + } + return result; } protected abstract TFormulaInfo makeVariableImpl( @@ -162,21 +212,33 @@ protected abstract TFormulaInfo makeVariableImpl( @Override public FloatingPointFormula makePlusInfinity(FormulaType.FloatingPointType pType) { - return wrap(makePlusInfinityImpl(pType)); + FloatingPointFormula result = wrap(makePlusInfinityImpl(pType)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakePlusInfinity(result, pType); + } + return result; } protected abstract TFormulaInfo makePlusInfinityImpl(FormulaType.FloatingPointType pType); @Override public FloatingPointFormula makeMinusInfinity(FormulaType.FloatingPointType pType) { - return wrap(makeMinusInfinityImpl(pType)); + FloatingPointFormula result = wrap(makeMinusInfinityImpl(pType)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeMinusInfinity(result, pType); + } + return result; } protected abstract TFormulaInfo makeMinusInfinityImpl(FormulaType.FloatingPointType pType); @Override public FloatingPointFormula makeNaN(FormulaType.FloatingPointType pType) { - return wrap(makeNaNImpl(pType)); + FloatingPointFormula result = wrap(makeNaNImpl(pType)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logMakeNaN(result, pType); + } + return result; } protected abstract TFormulaInfo makeNaNImpl(FormulaType.FloatingPointType pType); @@ -184,26 +246,34 @@ public FloatingPointFormula makeNaN(FormulaType.FloatingPointType pType) { @Override public T castTo( FloatingPointFormula pNumber, boolean pSigned, FormulaType pTargetType) { - return getFormulaCreator() - .encapsulate( - pTargetType, - castToImpl(extractInfo(pNumber), pSigned, pTargetType, getDefaultRoundingMode())); + T result = + getFormulaCreator() + .encapsulate( + pTargetType, + castToImpl(extractInfo(pNumber), pSigned, pTargetType, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPCastTo(result, pNumber, pTargetType, pSigned); + } + return result; } @Override public T castTo( - FloatingPointFormula number, - boolean pSigned, - FormulaType targetType, - FloatingPointRoundingMode pFloatingPointRoundingMode) { - return getFormulaCreator() - .encapsulate( - targetType, - castToImpl( - extractInfo(number), - pSigned, - targetType, - getRoundingMode(pFloatingPointRoundingMode))); + FloatingPointFormula pNumber, + boolean signed, + FormulaType pTargetType, + FloatingPointRoundingMode pRoundingMode) { + T result = + getFormulaCreator() + .encapsulate( + pTargetType, + castToImpl( + extractInfo(pNumber), signed, pTargetType, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPCastTo( + result, pNumber, pRoundingMode.getSMTLIBFormat(), pTargetType, signed); + } + return result; } protected abstract TFormulaInfo castToImpl( @@ -214,19 +284,30 @@ protected abstract TFormulaInfo castToImpl( @Override public FloatingPointFormula castFrom( - Formula pNumber, boolean pSigned, FormulaType.FloatingPointType pTargetType) { - return wrap(castFromImpl(extractInfo(pNumber), pSigned, pTargetType, getDefaultRoundingMode())); + Formula pNumber, boolean pSigned, FloatingPointType pTargetType) { + FloatingPointFormula result = + wrap(castFromImpl(extractInfo(pNumber), pSigned, pTargetType, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPCastFrom(result, pNumber, pTargetType); + } + return result; } @Override public FloatingPointFormula castFrom( - Formula number, - boolean signed, - FloatingPointType targetType, - FloatingPointRoundingMode pFloatingPointRoundingMode) { - return wrap( - castFromImpl( - extractInfo(number), signed, targetType, getRoundingMode(pFloatingPointRoundingMode))); + Formula pNumber, + boolean pSigned, + FloatingPointType pTargetType, + FloatingPointRoundingMode pRoundingMode) { + FloatingPointFormula result = + wrap( + castFromImpl( + extractInfo(pNumber), pSigned, pTargetType, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPCastFrom( + result, pNumber, pTargetType, pRoundingMode.getSMTLIBFormat()); + } + return result; } protected abstract TFormulaInfo castFromImpl( @@ -238,7 +319,11 @@ protected abstract TFormulaInfo castFromImpl( @Override public FloatingPointFormula fromIeeeBitvector( BitvectorFormula pNumber, FloatingPointType pTargetType) { - return wrap(fromIeeeBitvectorImpl(extractInfo(pNumber), pTargetType)); + FloatingPointFormula result = wrap(fromIeeeBitvectorImpl(extractInfo(pNumber), pTargetType)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFromIeeeBitvector(result, pNumber, pTargetType); + } + return result; } protected abstract TFormulaInfo fromIeeeBitvectorImpl( @@ -246,15 +331,25 @@ protected abstract TFormulaInfo fromIeeeBitvectorImpl( @Override public BitvectorFormula toIeeeBitvector(FloatingPointFormula pNumber) { - return getFormulaCreator().encapsulateBitvector(toIeeeBitvectorImpl(extractInfo(pNumber))); + BitvectorFormula result = + getFormulaCreator().encapsulateBitvector(toIeeeBitvectorImpl(extractInfo(pNumber))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPCastTo( + result, pNumber, getFormulaCreator().getFormulaType(result), true); + } + return result; } protected abstract TFormulaInfo toIeeeBitvectorImpl(TFormulaInfo pNumber); @Override - public FloatingPointFormula negate(FloatingPointFormula pNumber) { - TFormulaInfo param1 = extractInfo(pNumber); - return wrap(negate(param1)); + public FloatingPointFormula negate(FloatingPointFormula pN) { + TFormulaInfo param = extractInfo(pN); + FloatingPointFormula result = wrap(negate(param)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPNegate(result, pN); + } + return result; } protected abstract TFormulaInfo negate(TFormulaInfo pParam1); @@ -262,34 +357,54 @@ public FloatingPointFormula negate(FloatingPointFormula pNumber) { @Override public FloatingPointFormula abs(FloatingPointFormula pNumber) { TFormulaInfo param1 = extractInfo(pNumber); - return wrap(abs(param1)); + FloatingPointFormula result = wrap(abs(param1)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPAbs(result, pNumber); + } + return result; } protected abstract TFormulaInfo abs(TFormulaInfo pParam1); @Override public FloatingPointFormula max(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { - return wrap(max(extractInfo(pNumber1), extractInfo(pNumber2))); + FloatingPointFormula result = wrap(max(extractInfo(pNumber1), extractInfo(pNumber2))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPMax(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo max(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public FloatingPointFormula min(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { - return wrap(min(extractInfo(pNumber1), extractInfo(pNumber2))); + FloatingPointFormula result = wrap(min(extractInfo(pNumber1), extractInfo(pNumber2))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPMin(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo min(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public FloatingPointFormula sqrt(FloatingPointFormula pNumber) { - return wrap(sqrt(extractInfo(pNumber), getDefaultRoundingMode())); + FloatingPointFormula result = wrap(sqrt(extractInfo(pNumber), getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPSqrt(result, pNumber); + } + return result; } @Override public FloatingPointFormula sqrt( - FloatingPointFormula number, FloatingPointRoundingMode pFloatingPointRoundingMode) { - return wrap(sqrt(extractInfo(number), getRoundingMode(pFloatingPointRoundingMode))); + FloatingPointFormula pNumber, FloatingPointRoundingMode pRoundingMode) { + FloatingPointFormula result = wrap(sqrt(extractInfo(pNumber), getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPSqrt(result, pNumber, pRoundingMode.getSMTLIBFormat()); + } + return result; } protected abstract TFormulaInfo sqrt(TFormulaInfo pNumber, TFormulaInfo pRoundingMode); @@ -298,20 +413,25 @@ public FloatingPointFormula sqrt( public FloatingPointFormula add(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(add(param1, param2, getDefaultRoundingMode())); + FloatingPointFormula result = wrap(add(param1, param2, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPAdd(result, pNumber1, pNumber2); + } + return result; } @Override public FloatingPointFormula add( - FloatingPointFormula number1, - FloatingPointFormula number2, - FloatingPointRoundingMode pFloatingPointRoundingMode) { - return wrap( - add( - extractInfo(number1), - extractInfo(number2), - getRoundingMode(pFloatingPointRoundingMode))); + FloatingPointFormula pNumber1, + FloatingPointFormula pNumber2, + FloatingPointRoundingMode pRoundingMode) { + TFormulaInfo param1 = extractInfo(pNumber1); + TFormulaInfo param2 = extractInfo(pNumber2); + FloatingPointFormula result = wrap(add(param1, param2, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPAdd(result, pNumber1, pNumber2, pRoundingMode.getSMTLIBFormat()); + } + return result; } protected abstract TFormulaInfo add( @@ -322,19 +442,25 @@ public FloatingPointFormula subtract( FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(subtract(param1, param2, getDefaultRoundingMode())); + FloatingPointFormula result = wrap(subtract(param1, param2, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPSub(result, pNumber1, pNumber2); + } + return result; } @Override public FloatingPointFormula subtract( - FloatingPointFormula number1, - FloatingPointFormula number2, - FloatingPointRoundingMode pFloatingPointRoundingMode) { - TFormulaInfo param1 = extractInfo(number1); - TFormulaInfo param2 = extractInfo(number2); - - return wrap(subtract(param1, param2, getRoundingMode(pFloatingPointRoundingMode))); + FloatingPointFormula pNumber1, + FloatingPointFormula pNumber2, + FloatingPointRoundingMode pRoundingMode) { + TFormulaInfo param1 = extractInfo(pNumber1); + TFormulaInfo param2 = extractInfo(pNumber2); + FloatingPointFormula result = wrap(subtract(param1, param2, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPSub(result, pNumber1, pNumber2, pRoundingMode.getSMTLIBFormat()); + } + return result; } protected abstract TFormulaInfo subtract( @@ -344,19 +470,25 @@ protected abstract TFormulaInfo subtract( public FloatingPointFormula divide(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(divide(param1, param2, getDefaultRoundingMode())); + FloatingPointFormula result = wrap(divide(param1, param2, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPDiv(result, pNumber1, pNumber2); + } + return result; } @Override public FloatingPointFormula divide( - FloatingPointFormula number1, - FloatingPointFormula number2, - FloatingPointRoundingMode pFloatingPointRoundingMode) { - TFormulaInfo param1 = extractInfo(number1); - TFormulaInfo param2 = extractInfo(number2); - - return wrap(divide(param1, param2, getRoundingMode(pFloatingPointRoundingMode))); + FloatingPointFormula pNumber1, + FloatingPointFormula pNumber2, + FloatingPointRoundingMode pRoundingMode) { + TFormulaInfo param1 = extractInfo(pNumber1); + TFormulaInfo param2 = extractInfo(pNumber2); + FloatingPointFormula result = wrap(divide(param1, param2, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPDiv(result, pNumber1, pNumber2, pRoundingMode.getSMTLIBFormat()); + } + return result; } protected abstract TFormulaInfo divide( @@ -367,18 +499,25 @@ public FloatingPointFormula multiply( FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(multiply(param1, param2, getDefaultRoundingMode())); + FloatingPointFormula result = wrap(multiply(param1, param2, getDefaultRoundingMode())); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPMul(result, pNumber1, pNumber2); + } + return result; } @Override public FloatingPointFormula multiply( - FloatingPointFormula number1, - FloatingPointFormula number2, - FloatingPointRoundingMode pFloatingPointRoundingMode) { - TFormulaInfo param1 = extractInfo(number1); - TFormulaInfo param2 = extractInfo(number2); - return wrap(multiply(param1, param2, getRoundingMode(pFloatingPointRoundingMode))); + FloatingPointFormula pNumber1, + FloatingPointFormula pNumber2, + FloatingPointRoundingMode pRoundingMode) { + TFormulaInfo param1 = extractInfo(pNumber1); + TFormulaInfo param2 = extractInfo(pNumber2); + FloatingPointFormula result = wrap(multiply(param1, param2, getRoundingMode(pRoundingMode))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPMul(result, pNumber1, pNumber2, pRoundingMode.getSMTLIBFormat()); + } + return result; } protected abstract TFormulaInfo multiply( @@ -394,10 +533,11 @@ public FloatingPointFormula remainder( @Override public BooleanFormula assignment(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { - TFormulaInfo param1 = extractInfo(pNumber1); - TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(assignment(param1, param2)); + BooleanFormula result = wrapBool(assignment(extractInfo(pNumber1), extractInfo(pNumber2))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPAssignment(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo assignment(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -405,10 +545,12 @@ public BooleanFormula assignment(FloatingPointFormula pNumber1, FloatingPointFor @Override public BooleanFormula equalWithFPSemantics( FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { - TFormulaInfo param1 = extractInfo(pNumber1); - TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(equalWithFPSemantics(param1, param2)); + BooleanFormula result = + wrapBool(equalWithFPSemantics(extractInfo(pNumber1), extractInfo(pNumber2))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPEqual(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo equalWithFPSemantics(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -417,8 +559,11 @@ public BooleanFormula equalWithFPSemantics( public BooleanFormula greaterThan(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(greaterThan(param1, param2)); + BooleanFormula result = wrapBool(greaterThan(param1, param2)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPGreaterThan(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo greaterThan(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -426,10 +571,11 @@ public BooleanFormula greaterThan(FloatingPointFormula pNumber1, FloatingPointFo @Override public BooleanFormula greaterOrEquals( FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { - TFormulaInfo param1 = extractInfo(pNumber1); - TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(greaterOrEquals(param1, param2)); + BooleanFormula result = wrapBool(greaterOrEquals(extractInfo(pNumber1), extractInfo(pNumber2))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPGreaterOrEquals(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo greaterOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -438,68 +584,100 @@ public BooleanFormula greaterOrEquals( public BooleanFormula lessThan(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(lessThan(param1, param2)); + BooleanFormula result = wrapBool(lessThan(param1, param2)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPLessThan(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo lessThan(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public BooleanFormula lessOrEquals(FloatingPointFormula pNumber1, FloatingPointFormula pNumber2) { - TFormulaInfo param1 = extractInfo(pNumber1); - TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(lessOrEquals(param1, param2)); + BooleanFormula result = wrapBool(lessOrEquals(extractInfo(pNumber1), extractInfo(pNumber2))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPLessOrEquals(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo lessOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public BooleanFormula isNaN(FloatingPointFormula pNumber) { - return wrapBool(isNaN(extractInfo(pNumber))); + BooleanFormula result = wrapBool(isNaN(extractInfo(pNumber))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPIsNaN(result, pNumber); + } + return result; } protected abstract TFormulaInfo isNaN(TFormulaInfo pParam); @Override public BooleanFormula isInfinity(FloatingPointFormula pNumber) { - return wrapBool(isInfinity(extractInfo(pNumber))); + BooleanFormula result = wrapBool(isInfinity(extractInfo(pNumber))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPIsInfinite(result, pNumber); + } + return result; } protected abstract TFormulaInfo isInfinity(TFormulaInfo pParam); @Override public BooleanFormula isZero(FloatingPointFormula pNumber) { - return wrapBool(isZero(extractInfo(pNumber))); + BooleanFormula result = wrapBool(isZero(extractInfo(pNumber))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPIsZero(result, pNumber); + } + return result; } protected abstract TFormulaInfo isZero(TFormulaInfo pParam); @Override public BooleanFormula isSubnormal(FloatingPointFormula pNumber) { - return wrapBool(isSubnormal(extractInfo(pNumber))); + BooleanFormula result = wrapBool(isSubnormal(extractInfo(pNumber))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPIsSubnormal(result, pNumber); + } + return result; } protected abstract TFormulaInfo isSubnormal(TFormulaInfo pParam); @Override public BooleanFormula isNormal(FloatingPointFormula pNumber) { - return wrapBool(isNormal(extractInfo(pNumber))); + BooleanFormula result = wrapBool(isNormal(extractInfo(pNumber))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPIsNormal(result, pNumber); + } + return result; } protected abstract TFormulaInfo isNormal(TFormulaInfo pParam); @Override public BooleanFormula isNegative(FloatingPointFormula pNumber) { - return wrapBool(isNegative(extractInfo(pNumber))); + BooleanFormula result = wrapBool(isNegative(extractInfo(pNumber))); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPIsNegative(result, pNumber); + } + return result; } protected abstract TFormulaInfo isNegative(TFormulaInfo pParam); @Override public FloatingPointFormula round( - FloatingPointFormula pFormula, FloatingPointRoundingMode pRoundingMode) { - return wrap(round(extractInfo(pFormula), pRoundingMode)); + FloatingPointFormula pNumber, FloatingPointRoundingMode pRoundingMode) { + FloatingPointFormula result = wrap(round(extractInfo(pNumber), pRoundingMode)); + if (Generator.isLoggingEnabled()) { + FloatingPointGenerator.logFPRound(result, pNumber, pRoundingMode.getSMTLIBFormat()); + } + return result; } protected abstract TFormulaInfo round( diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractFormulaManager.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractFormulaManager.java index 5d1d8ba04b..7c260e9174 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractFormulaManager.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractFormulaManager.java @@ -18,13 +18,18 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.Objects; +import org.antlr.v4.runtime.CharStreams; +import org.antlr.v4.runtime.CommonTokenStream; import org.checkerframework.checker.nullness.qual.Nullable; import org.sosy_lab.common.Appender; import org.sosy_lab.java_smt.api.ArrayFormulaManager; import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.BooleanFormulaManager; import org.sosy_lab.java_smt.api.EnumerationFormulaManager; import org.sosy_lab.java_smt.api.FloatingPointFormulaManager; import org.sosy_lab.java_smt.api.Formula; @@ -43,6 +48,9 @@ import org.sosy_lab.java_smt.api.visitors.FormulaTransformationVisitor; import org.sosy_lab.java_smt.api.visitors.FormulaVisitor; import org.sosy_lab.java_smt.api.visitors.TraversalProcess; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Lexer; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Visitor; import org.sosy_lab.java_smt.basicimpl.tactics.NNFVisitor; import org.sosy_lab.java_smt.utils.SolverUtils; @@ -176,6 +184,26 @@ public final FormulaCreator getFormulaCrea return formulaCreator; } + @Override + public BooleanFormula universalParseFromString(String pString) { + Smtlibv2Lexer lexer = new Smtlibv2Lexer(CharStreams.fromString(pString)); + Smtlibv2Parser parser = new Smtlibv2Parser(new CommonTokenStream(lexer)); + Visitor visitor = new Visitor(this); + visitor.visit(parser.start()); + List constraints = visitor.getConstraints(); + + return this.booleanManager.and(constraints); + } + + @Override + public void dumpSMTLIB2() throws IOException { + if (Generator.isLoggingEnabled()) { + Generator.dumpSMTLIB2(); + } else { + throw new UnsupportedOperationException("Generator needs to be enabled"); + } + } + @Override public IntegerFormulaManager getIntegerFormulaManager() { if (integerManager == null) { @@ -193,8 +221,7 @@ public RationalFormulaManager getRationalFormulaManager() { } @Override - public AbstractBooleanFormulaManager - getBooleanFormulaManager() { + public BooleanFormulaManager getBooleanFormulaManager() { return booleanManager; } @@ -480,20 +507,13 @@ public Formula visitFreeVariable(Formula f, String name) { public Formula visitFunction( Formula f, List newArgs, FunctionDeclaration functionDeclaration) { Formula out = pFromToMapping.get(f); - if (out == null) { - return makeApplication(functionDeclaration, newArgs); - } else { - return out; - } + return Objects.requireNonNullElseGet( + out, () -> makeApplication(functionDeclaration, newArgs)); } private Formula replace(Formula f) { Formula out = pFromToMapping.get(f); - if (out == null) { - return f; - } else { - return out; - } + return Objects.requireNonNullElse(out, f); } }); } diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractNumeralFormulaManager.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractNumeralFormulaManager.java index 5c4cbe26b8..e3c730a816 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractNumeralFormulaManager.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractNumeralFormulaManager.java @@ -90,28 +90,44 @@ protected ResultFormulaType wrap(TFormulaInfo pTerm) { @Override public ResultFormulaType makeNumber(long i) { - return wrap(makeNumberImpl(i)); + ResultFormulaType result = wrap(makeNumberImpl(i)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logMakeNumber(result, String.valueOf(i)); + } + return result; } protected abstract TFormulaInfo makeNumberImpl(long i); @Override public ResultFormulaType makeNumber(BigInteger i) { - return wrap(makeNumberImpl(i)); + ResultFormulaType result = wrap(makeNumberImpl(i)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logMakeNumber(result, String.valueOf(i)); + } + return result; } protected abstract TFormulaInfo makeNumberImpl(BigInteger i); @Override public ResultFormulaType makeNumber(String i) { - return wrap(makeNumberImpl(i)); + ResultFormulaType result = wrap(makeNumberImpl(i)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logMakeNumber(result, i); + } + return result; } protected abstract TFormulaInfo makeNumberImpl(String i); @Override public ResultFormulaType makeNumber(Rational pRational) { - return wrap(makeNumberImpl(pRational)); + ResultFormulaType result = wrap(makeNumberImpl(pRational)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logMakeNumber(result, String.valueOf(pRational)); + } + return result; } protected TFormulaInfo makeNumberImpl(Rational pRational) { @@ -120,14 +136,23 @@ protected TFormulaInfo makeNumberImpl(Rational pRational) { @Override public ResultFormulaType makeNumber(double pNumber) { - return wrap(makeNumberImpl(pNumber)); + ResultFormulaType result = wrap(makeNumberImpl(pNumber)); + if (Generator.isLoggingEnabled()) { + // FIXME Broken when used in IntegerFormulaManager + NumeralGenerator.logMakeNumber(result, String.valueOf(pNumber)); + } + return result; } protected abstract TFormulaInfo makeNumberImpl(double pNumber); @Override public ResultFormulaType makeNumber(BigDecimal pNumber) { - return wrap(makeNumberImpl(pNumber)); + ResultFormulaType result = wrap(makeNumberImpl(pNumber)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logMakeNumber(result, String.valueOf(pNumber)); + } + return result; } protected abstract TFormulaInfo makeNumberImpl(BigDecimal pNumber); @@ -172,7 +197,11 @@ private static BigInteger convertBigDecimalToBigInteger(BigDecimal d) @Override public ResultFormulaType makeVariable(String pVar) { checkVariableName(pVar); - return wrap(makeVariableImpl(pVar)); + ResultFormulaType result = wrap(makeVariableImpl(pVar)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logMakeIntVariable(result, pVar); + } + return result; } protected abstract TFormulaInfo makeVariableImpl(String i); @@ -180,7 +209,11 @@ public ResultFormulaType makeVariable(String pVar) { @Override public ResultFormulaType negate(ParamFormulaType pNumber) { TFormulaInfo param1 = extractInfo(pNumber); - return wrap(negate(param1)); + ResultFormulaType result = wrap(negate(param1)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logNegate(result, pNumber); + } + return result; } protected abstract TFormulaInfo negate(TFormulaInfo pParam1); @@ -189,15 +222,22 @@ public ResultFormulaType negate(ParamFormulaType pNumber) { public ResultFormulaType add(ParamFormulaType pNumber1, ParamFormulaType pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(add(param1, param2)); + ResultFormulaType result = wrap(add(param1, param2)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logAdd(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo add(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public ResultFormulaType sum(List operands) { - return wrap(sumImpl(Lists.transform(operands, this::extractInfo))); + ResultFormulaType result = wrap(sumImpl(Lists.transform(operands, this::extractInfo))); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logSum(result, operands); + } + return result; } protected TFormulaInfo sumImpl(List operands) { @@ -212,8 +252,11 @@ protected TFormulaInfo sumImpl(List operands) { public ResultFormulaType subtract(ParamFormulaType pNumber1, ParamFormulaType pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrap(subtract(param1, param2)); + ResultFormulaType result = wrap(subtract(param1, param2)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logSubtract(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo subtract(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -241,7 +284,11 @@ public ResultFormulaType divide(ParamFormulaType pNumber1, ParamFormulaType pNum } } } - return wrap(result); + ResultFormulaType wrappedResult = wrap(result); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logDivide(wrappedResult, pNumber1, pNumber2); + } + return wrappedResult; } /** @@ -273,7 +320,11 @@ public ResultFormulaType modulo(ParamFormulaType pNumber1, ParamFormulaType pNum } } } - return wrap(result); + ResultFormulaType wrappedResult = wrap(result); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logModulo(wrappedResult, pNumber1, pNumber2); + } + return wrappedResult; } /** @@ -288,22 +339,31 @@ protected TFormulaInfo modulo(TFormulaInfo pParam1, TFormulaInfo pParam2) { } public BooleanFormula modularCongruence( - ParamFormulaType pNumber1, ParamFormulaType pNumber2, long pModulo) { + ParamFormulaType pNumber1, ParamFormulaType pNumber2, long pModulo) + throws GeneratorException { Preconditions.checkArgument(pModulo > 0, "modular congruence needs a positive modulo."); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(modularCongruence(param1, param2, pModulo)); + BooleanFormula result = wrapBool(modularCongruence(param1, param2, pModulo)); + if (Generator.isLoggingEnabled()) { + throw new GeneratorException("Modular Congruence is not available in SMTLIB2. "); + } + return result; } public BooleanFormula modularCongruence( - ParamFormulaType pNumber1, ParamFormulaType pNumber2, BigInteger pModulo) { + ParamFormulaType pNumber1, ParamFormulaType pNumber2, BigInteger pModulo) + throws GeneratorException { Preconditions.checkArgument( pModulo.signum() > 0, "modular congruence needs a positive modulo."); TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - return wrapBool(modularCongruence(param1, param2, pModulo)); + BooleanFormula result = wrapBool(modularCongruence(param1, param2, pModulo)); + if (Generator.isLoggingEnabled()) { + throw new GeneratorException("Modular Congruence is not available in SMTLIB2. "); + } + return result; } /** @@ -348,7 +408,11 @@ public ResultFormulaType multiply(ParamFormulaType pNumber1, ParamFormulaType pN } } } - return wrap(result); + ResultFormulaType wrappedResult = wrap(result); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logMultiply(wrappedResult, pNumber1, pNumber2); + } + return wrappedResult; } /** @@ -366,15 +430,22 @@ protected TFormulaInfo multiply(TFormulaInfo pParam1, TFormulaInfo pParam2) { public BooleanFormula equal(ParamFormulaType pNumber1, ParamFormulaType pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(equal(param1, param2)); + BooleanFormula result = wrapBool(equal(param1, param2)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logEqual(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo equal(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public BooleanFormula distinct(List pNumbers) { - return wrapBool(distinctImpl(Lists.transform(pNumbers, this::extractInfo))); + BooleanFormula result = wrapBool(distinctImpl(Lists.transform(pNumbers, this::extractInfo))); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logDistinct(result, pNumbers); + } + return result; } protected abstract TFormulaInfo distinctImpl(List pNumbers); @@ -383,8 +454,11 @@ public BooleanFormula distinct(List pNumbers) { public BooleanFormula greaterThan(ParamFormulaType pNumber1, ParamFormulaType pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(greaterThan(param1, param2)); + BooleanFormula result = wrapBool(greaterThan(param1, param2)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logGreaterThan(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo greaterThan(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -393,8 +467,11 @@ public BooleanFormula greaterThan(ParamFormulaType pNumber1, ParamFormulaType pN public BooleanFormula greaterOrEquals(ParamFormulaType pNumber1, ParamFormulaType pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(greaterOrEquals(param1, param2)); + BooleanFormula result = wrapBool(greaterOrEquals(param1, param2)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logGreaterOrEquals(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo greaterOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -403,8 +480,11 @@ public BooleanFormula greaterOrEquals(ParamFormulaType pNumber1, ParamFormulaTyp public BooleanFormula lessThan(ParamFormulaType pNumber1, ParamFormulaType pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(lessThan(param1, param2)); + BooleanFormula result = wrapBool(lessThan(param1, param2)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logLessThan(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo lessThan(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -413,8 +493,11 @@ public BooleanFormula lessThan(ParamFormulaType pNumber1, ParamFormulaType pNumb public BooleanFormula lessOrEquals(ParamFormulaType pNumber1, ParamFormulaType pNumber2) { TFormulaInfo param1 = extractInfo(pNumber1); TFormulaInfo param2 = extractInfo(pNumber2); - - return wrapBool(lessOrEquals(param1, param2)); + BooleanFormula result = wrapBool(lessOrEquals(param1, param2)); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logLessOrEquals(result, pNumber1, pNumber2); + } + return result; } protected abstract TFormulaInfo lessOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2); @@ -422,16 +505,25 @@ public BooleanFormula lessOrEquals(ParamFormulaType pNumber1, ParamFormulaType p @Override public IntegerFormula floor(ParamFormulaType number) { if (getFormulaCreator().getFormulaType(number) == FormulaType.IntegerType) { - return (IntegerFormula) number; + IntegerFormula result = (IntegerFormula) number; + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logFloor(result, number); + } + return result; } else { - return getFormulaCreator().encapsulate(FormulaType.IntegerType, floor(extractInfo(number))); + IntegerFormula result = + getFormulaCreator().encapsulate(FormulaType.IntegerType, floor(extractInfo(number))); + if (Generator.isLoggingEnabled()) { + NumeralGenerator.logFloor(result, number); + } + return result; } } protected TFormulaInfo floor(TFormulaInfo number) { // identity function for integers, method is overridden for rationals throw new AssertionError( - "method should only be called for RationalFormulae, but type is " + "method should only be called for RationalFormula, but type is " + getFormulaCreator().getFormulaType(number)); } } diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractProver.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractProver.java index 72c894c56f..be1d268199 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractProver.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractProver.java @@ -34,6 +34,7 @@ public abstract class AbstractProver implements BasicProverEnvironment { private final boolean generateUnsatCoresOverAssumptions; protected final boolean enableSL; protected boolean closed = false; + protected boolean useBinary; private final Set evaluators = new LinkedHashSet<>(); @@ -53,6 +54,7 @@ protected AbstractProver(Set pOptions) { generateUnsatCoresOverAssumptions = pOptions.contains(ProverOptions.GENERATE_UNSAT_CORE_OVER_ASSUMPTIONS); enableSL = pOptions.contains(ProverOptions.ENABLE_SEPARATION_LOGIC); + useBinary = pOptions.contains(ProverOptions.USE_BINARY); assertedFormulas.add(LinkedHashMultimap.create()); } @@ -89,6 +91,9 @@ public int size() { @Override public final void push() throws InterruptedException { checkState(!closed); + if (Generator.isLoggingEnabled()) { + Generator.logPush(); + } pushImpl(); assertedFormulas.add(LinkedHashMultimap.create()); } @@ -99,6 +104,9 @@ public final void push() throws InterruptedException { public final void pop() { checkState(!closed); checkState(assertedFormulas.size() > 1, "initial level must remain until close"); + if (Generator.isLoggingEnabled()) { + Generator.logPop(); + } assertedFormulas.remove(assertedFormulas.size() - 1); // remove last popImpl(); } @@ -109,6 +117,9 @@ public final void pop() { @CanIgnoreReturnValue public final @Nullable T addConstraint(BooleanFormula constraint) throws InterruptedException { checkState(!closed); + if (Generator.isLoggingEnabled()) { + Generator.assembleConstraint(constraint); + } T t = addConstraintImpl(constraint); Iterables.getLast(assertedFormulas).put(constraint, t); return t; diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractStringFormulaManager.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractStringFormulaManager.java index 713e3df143..be5317bd0e 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractStringFormulaManager.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractStringFormulaManager.java @@ -42,7 +42,11 @@ private RegexFormula wrapRegex(TFormulaInfo formulaInfo) { @Override public StringFormula makeString(String value) { - return wrapString(makeStringImpl(value)); + StringFormula result = wrapString(makeStringImpl(value)); + if (Generator.isLoggingEnabled()) { + StringGenerator.logMakeString(result, value); + } + return result; } protected abstract TFormulaInfo makeStringImpl(String value); @@ -50,101 +54,163 @@ public StringFormula makeString(String value) { @Override public StringFormula makeVariable(String pVar) { checkVariableName(pVar); - return wrapString(makeVariableImpl(pVar)); + StringFormula result = wrapString(makeVariableImpl(pVar)); + if (Generator.isLoggingEnabled()) { + StringGenerator.logMakeVariable(result, pVar); + } + return result; } protected abstract TFormulaInfo makeVariableImpl(String pVar); @Override public BooleanFormula equal(StringFormula str1, StringFormula str2) { - return wrapBool(equal(extractInfo(str1), extractInfo(str2))); + BooleanFormula result = wrapBool(equal(extractInfo(str1), extractInfo(str2))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logEqual(result, str1, str2); + } + return result; } protected abstract TFormulaInfo equal(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public BooleanFormula greaterThan(StringFormula str1, StringFormula str2) { - return wrapBool(greaterThan(extractInfo(str1), extractInfo(str2))); + BooleanFormula result = wrapBool(greaterThan(extractInfo(str1), extractInfo(str2))); + if (Generator.isLoggingEnabled()) { + throw new UnsupportedOperationException( + "SMTLIB does not allow greater " + + "than or equal to StringFormula! Use str.< or str.<= instead."); + } + return result; } protected abstract TFormulaInfo greaterThan(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public BooleanFormula greaterOrEquals(StringFormula str1, StringFormula str2) { - return wrapBool(greaterOrEquals(extractInfo(str1), extractInfo(str2))); + BooleanFormula result = wrapBool(greaterOrEquals(extractInfo(str1), extractInfo(str2))); + if (Generator.isLoggingEnabled()) { + throw new UnsupportedOperationException( + "SMTLIB does not allow greater " + + "than or equal to StringFormula! Use str.< or str.<= instead."); + } + return result; } protected abstract TFormulaInfo greaterOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public BooleanFormula lessThan(StringFormula str1, StringFormula str2) { - return wrapBool(lessThan(extractInfo(str1), extractInfo(str2))); + BooleanFormula result = wrapBool(lessThan(extractInfo(str1), extractInfo(str2))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logLessThan(result, str1, str2); + } + return result; } protected abstract TFormulaInfo lessThan(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public BooleanFormula lessOrEquals(StringFormula str1, StringFormula str2) { - return wrapBool(lessOrEquals(extractInfo(str1), extractInfo(str2))); + BooleanFormula result = wrapBool(lessOrEquals(extractInfo(str1), extractInfo(str2))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logLessOrEquals(result, str1, str2); + } + return result; } protected abstract TFormulaInfo lessOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public NumeralFormula.IntegerFormula length(StringFormula str) { - return getFormulaCreator().encapsulate(FormulaType.IntegerType, length(extractInfo(str))); + IntegerFormula result = + getFormulaCreator().encapsulate(FormulaType.IntegerType, length(extractInfo(str))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logLength(result, str); + } + return result; } protected abstract TFormulaInfo length(TFormulaInfo pParam); @Override public StringFormula concat(List parts) { + StringFormula result; switch (parts.size()) { case 0: - return makeString(""); // empty sequence + result = makeString(""); // empty sequence + break; case 1: - return Iterables.getOnlyElement(parts); + result = Iterables.getOnlyElement(parts); + break; default: - return wrapString(concatImpl(Lists.transform(parts, this::extractInfo))); + result = wrapString(concatImpl(Lists.transform(parts, this::extractInfo))); + break; + } + if (Generator.isLoggingEnabled()) { + StringGenerator.logConcat(result, parts); } + return result; } protected abstract TFormulaInfo concatImpl(List parts); @Override public BooleanFormula prefix(StringFormula prefix, StringFormula str) { - return wrapBool(prefix(extractInfo(prefix), extractInfo(str))); + BooleanFormula result = wrapBool(prefix(extractInfo(prefix), extractInfo(str))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logPrefix(result, prefix, str); + } + return result; } protected abstract TFormulaInfo prefix(TFormulaInfo prefix, TFormulaInfo str); @Override public BooleanFormula suffix(StringFormula suffix, StringFormula str) { - return wrapBool(suffix(extractInfo(suffix), extractInfo(str))); + BooleanFormula result = wrapBool(suffix(extractInfo(suffix), extractInfo(str))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logSuffix(result, suffix, str); + } + return result; } protected abstract TFormulaInfo suffix(TFormulaInfo suffix, TFormulaInfo str); @Override public BooleanFormula in(StringFormula str, RegexFormula regex) { - return wrapBool(in(extractInfo(str), extractInfo(regex))); + BooleanFormula result = wrapBool(in(extractInfo(str), extractInfo(regex))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logIn(result, str, regex); + } + return result; } protected abstract TFormulaInfo in(TFormulaInfo str, TFormulaInfo regex); @Override public BooleanFormula contains(StringFormula str, StringFormula part) { - return wrapBool(contains(extractInfo(str), extractInfo(part))); + BooleanFormula result = wrapBool(contains(extractInfo(str), extractInfo(part))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logContains(result, str, part); + } + return result; } protected abstract TFormulaInfo contains(TFormulaInfo str, TFormulaInfo part); @Override public IntegerFormula indexOf(StringFormula str, StringFormula part, IntegerFormula startIndex) { - return getFormulaCreator() - .encapsulate( - FormulaType.IntegerType, - indexOf(extractInfo(str), extractInfo(part), extractInfo(startIndex))); + IntegerFormula result = + getFormulaCreator() + .encapsulate( + FormulaType.IntegerType, + indexOf(extractInfo(str), extractInfo(part), extractInfo(startIndex))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logIndexOf(result, str, part, startIndex); + } + return result; } protected abstract TFormulaInfo indexOf( @@ -152,14 +218,23 @@ protected abstract TFormulaInfo indexOf( @Override public StringFormula charAt(StringFormula str, IntegerFormula index) { - return wrapString(charAt(extractInfo(str), extractInfo(index))); + StringFormula result = wrapString(charAt(extractInfo(str), extractInfo(index))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logCharAt(result, str, index); + } + return result; } protected abstract TFormulaInfo charAt(TFormulaInfo str, TFormulaInfo index); @Override public StringFormula substring(StringFormula str, IntegerFormula index, IntegerFormula length) { - return wrapString(substring(extractInfo(str), extractInfo(index), extractInfo(length))); + StringFormula result = + wrapString(substring(extractInfo(str), extractInfo(index), extractInfo(length))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logSubstring(result, str, index, length); + } + return result; } protected abstract TFormulaInfo substring( @@ -168,7 +243,12 @@ protected abstract TFormulaInfo substring( @Override public StringFormula replace( StringFormula fullStr, StringFormula target, StringFormula replacement) { - return wrapString(replace(extractInfo(fullStr), extractInfo(target), extractInfo(replacement))); + StringFormula result = + wrapString(replace(extractInfo(fullStr), extractInfo(target), extractInfo(replacement))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logReplace(result, fullStr, target, replacement); + } + return result; } protected abstract TFormulaInfo replace( @@ -177,8 +257,12 @@ protected abstract TFormulaInfo replace( @Override public StringFormula replaceAll( StringFormula fullStr, StringFormula target, StringFormula replacement) { - return wrapString( - replaceAll(extractInfo(fullStr), extractInfo(target), extractInfo(replacement))); + StringFormula result = + wrapString(replaceAll(extractInfo(fullStr), extractInfo(target), extractInfo(replacement))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logReplaceAll(result, fullStr, target, replacement); + } + return result; } protected abstract TFormulaInfo replaceAll( @@ -186,84 +270,132 @@ protected abstract TFormulaInfo replaceAll( @Override public RegexFormula makeRegex(String value) { - return wrapRegex(makeRegexImpl(value)); + RegexFormula result = wrapRegex(makeRegexImpl(value)); + if (Generator.isLoggingEnabled()) { + StringGenerator.logMakeRegex(result, value); + } + return result; } protected abstract TFormulaInfo makeRegexImpl(String value); @Override public RegexFormula none() { - return wrapRegex(noneImpl()); + RegexFormula result = wrapRegex(noneImpl()); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexNone(result); + } + return result; } protected abstract TFormulaInfo noneImpl(); @Override public RegexFormula all() { - return wrapRegex(allImpl()); + RegexFormula result = wrapRegex(allImpl()); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexAll(result); + } + return result; } protected abstract TFormulaInfo allImpl(); @Override public RegexFormula allChar() { - return wrapRegex(allCharImpl()); + RegexFormula result = wrapRegex(allCharImpl()); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexAllChar(result); + } + return result; } protected abstract TFormulaInfo allCharImpl(); @Override public RegexFormula range(StringFormula start, StringFormula end) { - return wrapRegex(range(extractInfo(start), extractInfo(end))); + RegexFormula result = wrapRegex(range(extractInfo(start), extractInfo(end))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexRange(result, start, end); + } + return result; } protected abstract TFormulaInfo range(TFormulaInfo start, TFormulaInfo end); @Override public RegexFormula concatRegex(List parts) { + RegexFormula result; switch (parts.size()) { case 0: - return none(); // empty sequence + result = none(); // empty sequence + break; case 1: - return Iterables.getOnlyElement(parts); + result = Iterables.getOnlyElement(parts); + break; default: - return wrapRegex(concatRegexImpl(Lists.transform(parts, this::extractInfo))); + result = wrapRegex(concatRegexImpl(Lists.transform(parts, this::extractInfo))); + break; + } + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexConcat(result, parts); } + return result; } protected abstract TFormulaInfo concatRegexImpl(List parts); @Override public RegexFormula union(RegexFormula regex1, RegexFormula regex2) { - return wrapRegex(union(extractInfo(regex1), extractInfo(regex2))); + RegexFormula result = wrapRegex(union(extractInfo(regex1), extractInfo(regex2))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexUnion(result, regex1, regex2); + } + return result; } protected abstract TFormulaInfo union(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public RegexFormula intersection(RegexFormula regex1, RegexFormula regex2) { - return wrapRegex(intersection(extractInfo(regex1), extractInfo(regex2))); + RegexFormula result = wrapRegex(intersection(extractInfo(regex1), extractInfo(regex2))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexIntersection(result, regex1, regex2); + } + return result; } protected abstract TFormulaInfo intersection(TFormulaInfo pParam1, TFormulaInfo pParam2); @Override public RegexFormula closure(RegexFormula regex) { - return wrapRegex(closure(extractInfo(regex))); + RegexFormula result = wrapRegex(closure(extractInfo(regex))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexClosure(result, regex); + } + return result; } protected abstract TFormulaInfo closure(TFormulaInfo pParam); @Override public RegexFormula complement(RegexFormula regex) { - return wrapRegex(complement(extractInfo(regex))); + RegexFormula result = wrapRegex(complement(extractInfo(regex))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexComplement(result, regex); + } + return result; } protected abstract TFormulaInfo complement(TFormulaInfo pParam); @Override public RegexFormula difference(RegexFormula regex1, RegexFormula regex2) { - return wrapRegex(difference(extractInfo(regex1), extractInfo(regex2))); + RegexFormula result = wrapRegex(difference(extractInfo(regex1), extractInfo(regex2))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexDifference(result, regex1, regex2); + } + return result; } protected TFormulaInfo difference(TFormulaInfo pParam1, TFormulaInfo pParam2) { @@ -272,30 +404,51 @@ protected TFormulaInfo difference(TFormulaInfo pParam1, TFormulaInfo pParam2) { @Override public RegexFormula cross(RegexFormula regex) { - return concat(regex, closure(regex)); + RegexFormula result = concat(regex, closure(regex)); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexCross(result, regex); + } + return result; } @Override public RegexFormula optional(RegexFormula regex) { - return union(regex, makeRegex("")); + RegexFormula result = union(regex, makeRegex("")); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexOptional(result, regex); + } + return result; } @Override public RegexFormula times(RegexFormula regex, int repetitions) { - return concatRegex(Collections.nCopies(repetitions, regex)); + RegexFormula result = concatRegex(Collections.nCopies(repetitions, regex)); + if (Generator.isLoggingEnabled()) { + StringGenerator.logRegexTimes(result, regex, repetitions); + } + return result; } @Override public IntegerFormula toIntegerFormula(StringFormula str) { - return getFormulaCreator() - .encapsulate(FormulaType.IntegerType, toIntegerFormula(extractInfo(str))); + IntegerFormula result = + getFormulaCreator() + .encapsulate(FormulaType.IntegerType, toIntegerFormula(extractInfo(str))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logToInteger(result, str); + } + return result; } protected abstract TFormulaInfo toIntegerFormula(TFormulaInfo pParam); @Override public StringFormula toStringFormula(IntegerFormula number) { - return wrapString(toStringFormula(extractInfo(number))); + StringFormula result = wrapString(toStringFormula(extractInfo(number))); + if (Generator.isLoggingEnabled()) { + StringGenerator.logToString(result, number); + } + return result; } protected abstract TFormulaInfo toStringFormula(TFormulaInfo pParam); diff --git a/src/org/sosy_lab/java_smt/basicimpl/AbstractUFManager.java b/src/org/sosy_lab/java_smt/basicimpl/AbstractUFManager.java index 8843b2a100..f8e32158bf 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/AbstractUFManager.java +++ b/src/org/sosy_lab/java_smt/basicimpl/AbstractUFManager.java @@ -40,13 +40,24 @@ protected AbstractUFManager(FormulaCreator FunctionDeclaration declareUF( String pName, FormulaType pReturnType, List> pArgTypes) { checkVariableName(pName); + if (Generator.isLoggingEnabled()) { + // FIXME Find a better way to handle quoted symbols + if (pName.contains("PIPE")) { + pName = pName.replaceAll("PIPE", "|"); + } + } List argTypes = Lists.transform(pArgTypes, this::toSolverType); - return FunctionDeclarationImpl.of( - pName, - FunctionDeclarationKind.UF, - pArgTypes, - pReturnType, - formulaCreator.declareUFImpl(pName, toSolverType(pReturnType), argTypes)); + FunctionDeclaration result = + FunctionDeclarationImpl.of( + pName, + FunctionDeclarationKind.UF, + pArgTypes, + pReturnType, + formulaCreator.declareUFImpl(pName, toSolverType(pReturnType), argTypes)); + if (Generator.isLoggingEnabled()) { + UFGenerator.logMakeFun(result, pName, pReturnType, pArgTypes); + } + return result; } @Override @@ -58,22 +69,40 @@ public FunctionDeclaration declareUF( @Override public T callUF(FunctionDeclaration funcType, Formula... args) { - return formulaCreator.callFunction(funcType, Arrays.asList(args)); + T result = formulaCreator.callFunction(funcType, Arrays.asList(args)); + if (Generator.isLoggingEnabled()) { + UFGenerator.logCallFun(result, funcType, args); + } + return result; } @Override public final T callUF( FunctionDeclaration pFunc, List pArgs) { - return formulaCreator.callFunction(pFunc, pArgs); + T result = formulaCreator.callFunction(pFunc, pArgs); + if (Generator.isLoggingEnabled()) { + UFGenerator.logCallFun(result, pFunc, pArgs); + } + return result; } @Override public T declareAndCallUF( String name, FormulaType pReturnType, List pArgs) { checkVariableName(name); + if (Generator.isLoggingEnabled()) { + // FIXME Find a better way to handle quoted symbols + if (name.contains("PIPE")) { + name = name.replaceAll("PIPE", "|"); + } + } List> argTypes = Lists.transform(pArgs, getFormulaCreator()::getFormulaType); FunctionDeclaration func = declareUF(name, pReturnType, argTypes); - return callUF(func, pArgs); + T result = callUF(func, pArgs); + if (Generator.isLoggingEnabled()) { + UFGenerator.logCallFun(result, declareUF(name, pReturnType, argTypes), pArgs); + } + return result; } @Override diff --git a/src/org/sosy_lab/java_smt/basicimpl/ArrayGenerator.java b/src/org/sosy_lab/java_smt/basicimpl/ArrayGenerator.java new file mode 100644 index 0000000000..18022e5f2d --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/ArrayGenerator.java @@ -0,0 +1,150 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; +import org.sosy_lab.java_smt.api.ArrayFormula; +import org.sosy_lab.java_smt.api.Formula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FormulaType.ArrayFormulaType; +import org.sosy_lab.java_smt.api.FormulaType.BitvectorType; +import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType; +import org.sosy_lab.java_smt.basicimpl.Generator.Keyword; + +public class ArrayGenerator { + private ArrayGenerator() {} + + private static String checkArrayElementSort(FormulaType pElementType) { + checkNotNull(pElementType, "pElementType cannot be null"); + if (pElementType.isIntegerType()) { + return "Int"; + } else if (pElementType.isBooleanType()) { + return "Bool"; + } else if (pElementType.isRationalType()) { + return "Real"; + } else if (pElementType.isBitvectorType()) { + return "(_ BitVec " + ((BitvectorType) pElementType).getSize() + ")"; + } else if (pElementType.isArrayType()) { + return "(Array " + + checkArrayIndexSort(((ArrayFormulaType) pElementType).getIndexType()) + + " " + + checkArrayElementSort(((ArrayFormulaType) pElementType).getElementType()) + + ")"; + } else if (pElementType.isFloatingPointType()) { + return "(_ Floating Point " + + ((FloatingPointType) pElementType).getExponentSize() + + " " + + ((FloatingPointType) pElementType).getMantissaSize() + + ")"; + } else if (pElementType.isStringType()) { + return "String"; + } else { + throw new GeneratorException( + pElementType + "is not available yet in ArrayGenerator as element for Arrays"); + } + } + + private static String checkArrayIndexSort(FormulaType pIndexType) { + checkNotNull(pIndexType, "pIndexType cannot be null"); + if (pIndexType.isIntegerType()) { + return "Int"; + } else if (pIndexType.isBooleanType()) { + return "Bool"; + } else if (pIndexType.isRationalType()) { + return "Real"; + } else if (pIndexType.isBitvectorType()) { + return "(_ BitVec " + ((BitvectorType) pIndexType).getSize() + ")"; + } else if (pIndexType.isArrayType()) { + return "(Array " + + checkArrayIndexSort(((ArrayFormulaType) pIndexType).getIndexType()) + + " " + + checkArrayElementSort(((ArrayFormulaType) pIndexType).getElementType()) + + ")"; + } else if (pIndexType.isFloatingPointType()) { + return "(_ Floating Point " + + ((FloatingPointType) pIndexType).getExponentSize() + + " " + + ((FloatingPointType) pIndexType).getMantissaSize() + + ")"; + } else if (pIndexType.isStringType()) { + return "String"; + } else { + throw new GeneratorException( + pIndexType + "is not available yet in ArrayGenerator as index for Arrays"); + } + } + + protected static void logMakeArray( + ArrayFormula result, + String pName, + FormulaType pIndexType, + FormulaType pElementType) { + Generator.throwExceptionWhenParameterIsNull( + ImmutableList.of(result, pName, pIndexType, pElementType)); + List inputParams = new ArrayList<>(); + inputParams.add(pName); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + FunctionEnvironment newEntry = + new FunctionEnvironment(result, inputParams, functionToString, Keyword.ARRAY); + newEntry.setArrayIndexType(checkArrayIndexSort(pIndexType)); + newEntry.setArrayValueType(checkArrayElementSort(pElementType)); + Generator.getExecutedAggregator().add(newEntry); + } + + protected static void logArrayEquivalence( + Object result, ArrayFormula pArray1, ArrayFormula pArray2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pArray1, pArray2)); + List inputParams = new ArrayList<>(); + inputParams.add(pArray1); + inputParams.add(pArray2); + Function, String> functionToString = + inPlaceInputParams -> + "(= " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logSelect(Object result, ArrayFormula pArray, Formula pIndex) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pArray, pIndex)); + List inputParams = new ArrayList<>(); + inputParams.add(pArray); + inputParams.add(pIndex); + Function, String> functionToString = + inPlaceInputParams -> + "(select " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logStore( + Object result, ArrayFormula pArray, Formula pIndex, Formula pValue) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pArray, pIndex, pValue)); + List inputParams = new ArrayList<>(); + inputParams.add(pArray); + inputParams.add(pIndex); + inputParams.add(pValue); + Function, String> functionToString = + inPlaceInputParams -> + "(store " + + inPlaceInputParams.get(0) + + " " + + inPlaceInputParams.get(1) + + " " + + inPlaceInputParams.get(2) + + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/BinaryModel.java b/src/org/sosy_lab/java_smt/basicimpl/BinaryModel.java new file mode 100644 index 0000000000..0edf6c962a --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/BinaryModel.java @@ -0,0 +1,164 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import ap.parser.IExpression; +import ap.types.Sort; +import com.google.common.collect.ImmutableList; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Writer; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import org.antlr.v4.runtime.CharStreams; +import org.antlr.v4.runtime.CommonTokenStream; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Lexer; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Visitor; +import org.sosy_lab.java_smt.solvers.princess.PrincessEnvironment; + +/** + * Generates a model by executing Princess with the contents of "Out.smt2" as input and parsing + * Princess' output model from the file "Model.smt2" back to JavaSMT. + */ +// TODO Add support for arbitrary SMTLIB compatible solvers +public class BinaryModel extends AbstractModel { + AbstractFormulaManager mgr; + + /** Model.ValuesAssignments for the parsed Princess model. */ + private ImmutableList finalList = ImmutableList.of(); + + private boolean isUnsat; + + public BinaryModel( + AbstractProver prover, + FormulaCreator pCreator, + AbstractFormulaManager pFormulaManager) { + super(prover, pCreator); + mgr = pFormulaManager; + } + + @Override + protected @Nullable IExpression evalImpl(IExpression formula) { + throw new UnsupportedOperationException("Princess (Binary) does not support eval()."); + } + + /** Send the query to the Princess binary and store the result. */ + public void runBinary(String input) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(input)); + // FIXME: This method is called twice, once for isUnsat and once to get the model. + // Instead of running the solver twice we should cache the result. + + // Write SMTLIB2 script to a file + try { + try (Writer fileWriter = + Files.newBufferedWriter(Path.of("Out.smt2"), Charset.defaultCharset())) { + fileWriter.write(input); + fileWriter.flush(); + } + } catch (IOException e) { + throw new GeneratorException("Could not write to file"); + } + + // FIXME: Pull the version from the configuration + String princessJar = "princess_2.13.jar"; + try { + Process process = + new ProcessBuilder() + .command( + "java", + "-cp", + "lib/java/runtime-princess/*:lib/java/runtime-princess/" + princessJar, + "ap.CmdlMain", + "-logo", + "+incremental", + "Out.smt2") // FIXME: Use a temporary file (same for Model.smt2) + .start(); + + StringBuilder output = new StringBuilder(); + try (InputStream is = process.getInputStream()) { + // Wait until the process has finished and throw an exception if an error occurred + int exitCode = process.waitFor(); + if (exitCode != 0) { + try (BufferedReader errorReader = + new BufferedReader( + new InputStreamReader(process.getErrorStream(), Charset.defaultCharset()))) { + String errorMessage = errorReader.lines().collect(Collectors.joining("\n")); + throw new IllegalStateException( + "Process failed with exit code " + exitCode + ": " + errorMessage); + } + } + + try (InputStreamReader isr = new InputStreamReader(is, Charset.defaultCharset())) { + try (BufferedReader br = new BufferedReader(isr)) { + // Read the first line to get the result (either "sat" or "unsat") + isUnsat = br.readLine().equals("unsat"); + + // Read the rest of the file to get the model + String lines = br.readLine(); + while (lines != null) { + output.append(lines).append("\n"); + lines = br.readLine(); + } + + // Parse the model returned by the binary + if (!isUnsat) { + finalList = ImmutableList.copyOf(parseModel(output.toString())); + } + } + } + } + } catch (IOException | InterruptedException e) { + // FIXME: Find a better way to handle IO errors + throw new RuntimeException(e); + } + } + + private List parseModel(String output) { + Generator.throwExceptionWhenParameterIsNull(Collections.singletonList(output)); + Smtlibv2Lexer lexer = new Smtlibv2Lexer(CharStreams.fromString(output)); + Smtlibv2Parser parser = new Smtlibv2Parser(new CommonTokenStream(lexer)); + Visitor visitor = new Visitor(mgr); + visitor.visit(parser.start()); + return visitor.getAssignments(); + } + + @Override + public ImmutableList asList() { + return finalList; + } + + public BinaryModel getModel() throws ModelException { + // TODO: Split of the Model with the values as a separate class + return this; + } + + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + out.append("binary model: \n"); + for (int i = 0; i < finalList.size(); i++) { + out.append(finalList.get(i)); + out.append("\n"); + } + + return String.valueOf(out); + } + + public boolean isUnsat() { + return isUnsat; + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/BitvectorGenerator.java b/src/org/sosy_lab/java_smt/basicimpl/BitvectorGenerator.java new file mode 100644 index 0000000000..d5e5df8769 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/BitvectorGenerator.java @@ -0,0 +1,453 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import static java.lang.Long.parseLong; + +import com.google.common.collect.ImmutableList; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FormulaType.BitvectorType; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.basicimpl.Generator.Keyword; + +public class BitvectorGenerator { + private BitvectorGenerator() {} + + protected static void logMakeBitVector(Object result, int length, BigInteger i) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, i)); + List inputParams = new ArrayList<>(); + inputParams.add(Long.toString(length)); + inputParams.add(i.toString()); + Function, String> functionToString = + inPlaceInputParamsString -> { + // FIXME Fix the conversion to String + String formatString = "%0" + length + "d"; + BigInteger binaryNumber = + new BigInteger( + Long.toBinaryString(parseLong((String) inPlaceInputParamsString.get(1)))); + return "#b" + String.format(formatString, binaryNumber); + }; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logMakeBitVector(BitvectorFormula result, int length, IntegerFormula pI) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pI)); + // TODO We need to convert the integer formula to bitvector. It doesn't have to be a constant. + List inputParams = new ArrayList<>(); + inputParams.add(Long.toString(length)); + inputParams.add(pI.toString()); + Function, String> functionToString = + inPlaceInputParamsString -> { + // FIXME Fix the conversion to String + String formatString = "%0" + length + "d"; + int binaryNumber = + Integer.parseInt( + Long.toBinaryString(parseLong((String) inPlaceInputParamsString.get(1)))); + return "#b" + String.format(formatString, binaryNumber); + }; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logMakeBitVecVariable( + BitvectorFormula result, BitvectorType pType, String pVar) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pType, pVar)); + List inputParams = new ArrayList<>(); + inputParams.add(pVar); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + FunctionEnvironment newEntry = + new FunctionEnvironment(result, inputParams, functionToString, Keyword.BITVEC); + newEntry.setBitVecLength(pType.getSize()); + Generator.getExecutedAggregator().add(newEntry); + } + + protected static void logMakeBitVecVariable(BitvectorFormula result, int pLength, String pVar) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pVar)); + List inputParams = new ArrayList<>(); + inputParams.add(pVar); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + FunctionEnvironment newEntry = + new FunctionEnvironment(result, inputParams, functionToString, Keyword.BITVEC); + newEntry.setBitVecLength(pLength); + Generator.getExecutedAggregator().add(newEntry); + } + + protected static void logBVEqual( + Object result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(= " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVNegate(Object result, BitvectorFormula pNumber) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + Function, String> functionToString = + inPlaceInputParams -> "(bvneg " + inPlaceInputParams.get(0) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVAdd( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(bvadd " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVSub( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(bvsub " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVSDivide( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(bvsdiv " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVUDivide( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(bvudiv " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVSignedRemainder( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(bvsrem " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVUnsignedRemainder( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(bvurem " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVMultiply( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(bvmul " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logBVUGreaterThan( + BooleanFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvugt " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVSGreaterThan( + BooleanFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvsgt " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVUGreaterOrEqual( + BooleanFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvuge " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVSGreaterOrEqual( + BooleanFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvsge " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVULessThan( + BooleanFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvult " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVSLessThan( + BooleanFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvslt " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVULessOrEqual( + BooleanFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvule " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVSLessOrEqual( + BooleanFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvsle " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVNot(Object result, BitvectorFormula pNumber) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + Function, String> saveResult = + inPlaceInputParams -> "(bvnot " + inPlaceInputParams.get(0) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVAnd( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvand " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVOr( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvor " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVXor( + BitvectorFormula result, BitvectorFormula pNumber1, BitvectorFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> saveResult = + inPlaceInputParams -> + "(bvxor " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVSShiftRight( + BitvectorFormula result, BitvectorFormula pNumber, BitvectorFormula toShift) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber, toShift)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + inputParams.add(toShift); + Function, String> saveResult = + inPlaceInputParams -> + "(bvashr " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVUShiftRight( + BitvectorFormula result, BitvectorFormula pNumber, BitvectorFormula toShift) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber, toShift)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + inputParams.add(toShift); + Function, String> saveResult = + inPlaceInputParams -> + "(bvlshr " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logBVShiftLeft( + BitvectorFormula result, BitvectorFormula pNumber, BitvectorFormula toShift) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber, toShift)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + inputParams.add(toShift); + Function, String> saveResult = + inPlaceInputParams -> + "(bvshl " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logConcat( + BitvectorFormula result, BitvectorFormula pNumber, BitvectorFormula append) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber, append)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + inputParams.add(append); + Function, String> saveResult = + inPlaceInputParams -> + "(concat " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logExtract( + BitvectorFormula result, BitvectorFormula pNumber, int pMsb, int pLsb) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + inputParams.add(String.valueOf(pMsb)); + inputParams.add(String.valueOf(pLsb)); + Function, String> saveResult = + inPlaceInputParams -> + "((_ extract " + + inPlaceInputParams.get(1) + + " " + + inPlaceInputParams.get(2) + + ") " + + inPlaceInputParams.get(0) + + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logUExtend( + BitvectorFormula result, BitvectorFormula pNumber, int pExtensionBits) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + inputParams.add(String.valueOf(pExtensionBits)); + Function, String> saveResult = + inPlaceInputParams -> + "((_ zero_extend " + inPlaceInputParams.get(1) + ") " + inPlaceInputParams.get(0) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } + + protected static void logSExtend( + BitvectorFormula result, BitvectorFormula pNumber, int pExtensionBits) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber); + inputParams.add(String.valueOf(pExtensionBits)); + Function, String> saveResult = + inPlaceInputParams -> + "((_ sign_extend " + inPlaceInputParams.get(1) + ") " + inPlaceInputParams.get(0) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, saveResult, Keyword.SKIP)); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/BooleanGenerator.java b/src/org/sosy_lab/java_smt/basicimpl/BooleanGenerator.java new file mode 100644 index 0000000000..501b5fee33 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/BooleanGenerator.java @@ -0,0 +1,181 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.function.Function; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.basicimpl.Generator.Keyword; + +public class BooleanGenerator { + private BooleanGenerator() {} + + protected static void logMakeVariable(Object result, String pVar) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pVar)); + List inputParams = new ArrayList<>(); + inputParams.add(pVar); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.BOOL)); + } + + protected static void logMakeTrue(Object result, String pVar) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pVar)); + List inputParams = new ArrayList<>(); + inputParams.add(pVar); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.DIRECT)); + } + + protected static void logMakeFalse(Object result, String pVar) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pVar)); + List inputParams = new ArrayList<>(); + inputParams.add(pVar); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.DIRECT)); + } + + protected static void logNot(Object result, BooleanFormula pBits) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits)); + List inputParams = new ArrayList<>(); + inputParams.add(pBits); + Function, String> functionToString = + inPlaceInputParams -> "(not " + inPlaceInputParams.get(0) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logOr(Object result, BooleanFormula pBits1, BooleanFormula pBits2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits1, pBits2)); + List inputParams = new ArrayList<>(); + inputParams.add(pBits1); + inputParams.add(pBits2); + Function, String> functionToString = + inPlaceInputParams -> + "(or " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logOr(Object result, Collection pBits1) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits1)); + List inputParams = new ArrayList<>(pBits1); + Function, String> functionToString = + inPlaceInputParams -> { + StringBuilder out = new StringBuilder(); + out.append("(or "); + inPlaceInputParams.forEach( + (c) -> { + out.append(c); + out.append(" "); + }); + return String.valueOf(out.deleteCharAt(out.length() - 1).append(")")); + }; + + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logAnd(Object result, BooleanFormula pBits1, BooleanFormula pBits2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits1, pBits2)); + List inputParams = new ArrayList<>(); + inputParams.add(pBits1); + inputParams.add(pBits2); + Function, String> functionToString = + inPlaceInputParams -> + "(and " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logAnd(Object result, Collection pBits1) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits1)); + List inputParams = new ArrayList<>(pBits1); + Function, String> functionToString = + inPlaceInputParams -> { + StringBuilder out = new StringBuilder(); + out.delete(0, out.length()); + out.append("(and "); + inPlaceInputParams.forEach( + (c) -> { + out.append(c); + out.append(" "); + }); + return String.valueOf(out.deleteCharAt(out.length() - 1).append(")")); + }; + + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logXor(Object result, BooleanFormula pBits1, BooleanFormula pBits2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits1, pBits2)); + List inputParams = new ArrayList<>(); + inputParams.add(pBits1); + inputParams.add(pBits2); + Function, String> functionToString = + inPlaceInputParams -> + "(xor " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logEquivalence( + Object result, BooleanFormula pBits1, BooleanFormula pBits2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits1, pBits2)); + List inputParams = new ArrayList<>(); + inputParams.add(pBits1); + inputParams.add(pBits2); + Function, String> functionToString = + inPlaceInputParams -> + "(= " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logImplication( + Object result, BooleanFormula pBits1, BooleanFormula pBits2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits1, pBits2)); + List inputParams = new ArrayList<>(); + inputParams.add(pBits1); + inputParams.add(pBits2); + Function, String> functionToString = + inPlaceInputParams -> + "(=> " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logIfThenElse(Object result, BooleanFormula pBits1, Object f1, Object f2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits1, f1, f2)); + List inputParams = new ArrayList<>(); + inputParams.add(pBits1); + inputParams.add(f1); + inputParams.add(f2); + Function, String> functionToString = + inPlaceInputParams -> + "(ite " + + inPlaceInputParams.get(0) + + " " + + inPlaceInputParams.get(1) + + " " + + inPlaceInputParams.get(2) + + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/FloatingPointGenerator.java b/src/org/sosy_lab/java_smt/basicimpl/FloatingPointGenerator.java new file mode 100644 index 0000000000..22b49ce5d2 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/FloatingPointGenerator.java @@ -0,0 +1,896 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import com.google.common.collect.ImmutableList; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.MathContext; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import org.sosy_lab.common.rationals.Rational; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FloatingPointFormula; +import org.sosy_lab.java_smt.api.Formula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType; +import org.sosy_lab.java_smt.basicimpl.Generator.Keyword; + +/** + * This class logs all variable declarations, makeFloatingPoints and operations on FloatingPoint in + * order to later generate SMTLIB2 code. + */ +public class FloatingPointGenerator { + + private FloatingPointGenerator() {} + + protected static void logMakeFloatingPoint( + Object result, int exponent, int mantissa, Object value) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, value)); + List inputParams = new ArrayList<>(); + String output = + makeNumberAndRoundStatic(value, FormulaType.getFloatingPointType(exponent, mantissa)); + inputParams.add(output); + Function, String> functionToString = createString -> (String) createString.get(0); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logMakeFloatingPointFromBigInteger( + Object result, + BigInteger exponent, + BigInteger mantissa, + boolean sign, + FloatingPointType type) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(exponent, mantissa, type)); + List inputParams = new ArrayList<>(); + // SIGN BIT + String output = "(fp "; + if (sign) { + output += "#b1 "; + } else { + output += "#b0 "; + } + // EXPONENT + if (exponent.toString().length() == type.getExponentSize()) { + output += "#b"; + } else { + output += "#x"; + } + output += exponent + " "; + // MANTISSA + if (mantissa.toString().length() == type.getMantissaSize()) { + output += "#b"; + } else { + output += "#x"; + } + output += mantissa + ")"; + inputParams.add(output); + Function, String> functionToString = createString -> (String) createString.get(0); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + public static String makeNumberAndRoundStatic(Object pN, FloatingPointType pType) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pN, pType)); + if (pN instanceof Double) { + return convertToSMTLibBinary((Double) pN, pType); + } else if (pN instanceof Integer) { + return convertToSMTLibBinary((Integer) pN, pType); + } else if (pN instanceof BigDecimal) { + return convertToSMTLibBinary((BigDecimal) pN, pType); + } else if (pN instanceof Rational) { + return convertToSMTLibBinary((Rational) pN, pType); + } else if (pN instanceof String) { + String str = (String) pN; + + // Check if the string represents a rational number (fraction) + if (str.matches("-?\\d+/\\d+")) { + // Parse as Rational number (e.g., "3/4") + return convertToSMTLibBinary(Rational.of(str), pType); + } + + // Try to convert to BigDecimal first to avoid precision loss + try { + BigDecimal decimalValue = new BigDecimal(str); + return convertToSMTLibBinary(decimalValue, pType); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Unsupported number format: " + pN, e); + } + } else { + throw new IllegalArgumentException( + "Unsupported number type: " + pN.getClass().getSimpleName()); + } + } + + public static String convertToSMTLibBinaryForInteger(int value, FloatingPointType type) { + int exponentSize = type.getExponentSize(); + int mantissaSize = type.getMantissaSize(); + + // Handle special case for zero + if (value == 0) { + return "(fp #b0 #b" + generateZeros(exponentSize) + " #b" + generateZeros(mantissaSize) + ")"; + } + + // Determine the sign bit + int signBit = (value < 0) ? 1 : 0; + int absValue = Math.abs(value); + + // Calculate exponent and mantissa + int exponent = 0; + while (absValue >= (1 << exponentSize)) { + absValue >>= 1; // equivalent to dividing by 2 + exponent++; + } + + // Bias calculation + int bias = (1 << (exponentSize - 1)) - 1; + int biasedExponent = exponent + bias; + + // Handle denormal numbers (when exponent is too small) + if (biasedExponent <= 0) { + return "(fp #b" + + signBit + + " #b" + + generateZeros(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } + + // Handle overflow (infinity) + if (biasedExponent >= (1 << exponentSize) - 1) { + return "(fp #b" + + signBit + + " #b" + + generateOnes(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } + + // Convert the integer to its binary representation for mantissa + StringBuilder mantissaBits = new StringBuilder(); + while (absValue > 0 && mantissaBits.length() < mantissaSize) { + mantissaBits.insert(0, (absValue & 1)); // Add the least significant bit to mantissa + absValue >>= 1; // shift right to process next bit + } + + // If mantissa is smaller than mantissaSize, pad with zeros + while (mantissaBits.length() < mantissaSize) { + mantissaBits.insert(0, "0"); + } + + // Return the SMT-LIB formatted string + return "(fp #b" + + signBit + + " #b" + + String.format("%" + exponentSize + "s", Integer.toBinaryString(biasedExponent)) + .replace(' ', '0') + + " #b" + + mantissaBits + + ")"; + } + + public static String convertToSMTLibBinary(double value, FloatingPointType type) { + int exponentSize = type.getExponentSize(); + int mantissaSize = type.getMantissaSize(); + + // Handle special cases + if (Double.isNaN(value)) { + return "(fp #b0 #b" + + generateOnes(exponentSize) + + " #b1" + + generateZeros(mantissaSize - 1) + + ")"; + } else if (Double.isInfinite(value)) { + String sign = (value < 0) ? "1" : "0"; + return "(fp #b" + + sign + + " #b" + + generateOnes(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } else if (value == 0.0) { + String sign = (1 / value < 0) ? "1" : "0"; // handle -0.0 + return "(fp #b" + + sign + + " #b" + + generateZeros(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } + + int signBit = (value < 0) ? 1 : 0; + double absValue = Math.abs(value); + + // Calculate exponent and mantissa + int exponent = 0; + while (absValue >= 2.0) { + absValue /= 2.0; + exponent++; + } + while (absValue < 1.0) { + absValue *= 2.0; + exponent--; + } + + // Bias calculation + int bias = (1 << (exponentSize - 1)) - 1; + int biasedExponent = exponent + bias; + + // Handle denormal numbers + if (biasedExponent <= 0) { + return "(fp #b" + + signBit + + " #b" + + generateZeros(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } + + // Handle overflow (infinity) + if (biasedExponent >= (1 << exponentSize) - 1) { + return "(fp #b" + + signBit + + " #b" + + generateOnes(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } + + // Calculate mantissa bits (without the implicit leading 1) + StringBuilder mantissaBits = new StringBuilder(); + double remaining = absValue - 1.0; + + for (int i = 0; i < mantissaSize; i++) { + remaining *= 2; + if (remaining >= 1.0) { + mantissaBits.append("1"); + remaining -= 1.0; + } else { + mantissaBits.append("0"); + } + } + + // Simple rounding + if (remaining >= 0.5) { + // Need to round up + boolean carry = true; + for (int i = mantissaBits.length() - 1; i >= 0 && carry; i--) { + if (mantissaBits.charAt(i) == '0') { + mantissaBits.setCharAt(i, '1'); + carry = false; + } else { + mantissaBits.setCharAt(i, '0'); + } + } + if (carry) { + biasedExponent++; + mantissaBits = new StringBuilder(generateZeros(mantissaSize)); + } + } + + String exponentBits = + String.format("%" + exponentSize + "s", Integer.toBinaryString(biasedExponent)) + .replace(' ', '0'); + + return "(fp #b" + signBit + " #b" + exponentBits + " #b" + mantissaBits + ")"; + } + + public static String convertToSMTLibBinary(BigDecimal value, FloatingPointType type) { + int exponentSize = type.getExponentSize(); + int mantissaSize = type.getMantissaSize(); + + // Handle zero + if (value.compareTo(BigDecimal.ZERO) == 0) { + String sign = (value.signum() < 0) ? "1" : "0"; + return "(fp #b" + + sign + + " #b" + + generateZeros(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } + + int signBit = value.signum() < 0 ? 1 : 0; + BigDecimal absValue = value.abs(); + + // Calculate exponent and mantissa + int exponent = 0; + while (absValue.compareTo(BigDecimal.valueOf(2)) >= 0) { + absValue = absValue.divide(BigDecimal.valueOf(2), MathContext.DECIMAL128); + exponent++; + } + while (absValue.compareTo(BigDecimal.ONE) < 0) { + absValue = absValue.multiply(BigDecimal.valueOf(2), MathContext.DECIMAL128); + exponent--; + } + + // Bias calculation + int bias = (1 << (exponentSize - 1)) - 1; + int biasedExponent = exponent + bias; + + // Handle denormal numbers + if (biasedExponent <= 0) { + return "(fp #b" + + signBit + + " #b" + + generateZeros(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } + + // Handle overflow (infinity) + if (biasedExponent >= (1 << exponentSize) - 1) { + return "(fp #b" + + signBit + + " #b" + + generateOnes(exponentSize) + + " #b" + + generateZeros(mantissaSize) + + ")"; + } + + // Calculate mantissa bits + StringBuilder mantissaBits = new StringBuilder(); + BigDecimal remainder = absValue.subtract(BigDecimal.ONE); + + for (int i = 0; i < mantissaSize; i++) { + remainder = remainder.multiply(BigDecimal.valueOf(2)); + if (remainder.compareTo(BigDecimal.ONE) >= 0) { + mantissaBits.append("1"); + remainder = remainder.subtract(BigDecimal.ONE); + } else { + mantissaBits.append("0"); + } + } + + // Rounding + if (remainder.compareTo(BigDecimal.valueOf(0.5)) >= 0) { + // Need to round up + boolean carry = true; + for (int i = mantissaBits.length() - 1; i >= 0 && carry; i--) { + if (mantissaBits.charAt(i) == '0') { + mantissaBits.setCharAt(i, '1'); + carry = false; + } else { + mantissaBits.setCharAt(i, '0'); + } + } + if (carry) { + biasedExponent++; + mantissaBits = new StringBuilder(generateZeros(mantissaSize)); + } + } + + String exponentBits = Integer.toBinaryString(biasedExponent); + exponentBits = padWithZeros(exponentBits, exponentSize); + + return "(fp #b" + signBit + " #b" + exponentBits + " #b" + mantissaBits + ")"; + } + + public static String convertToSMTLibBinary(Rational value, FloatingPointType type) { + // Input validation + Objects.requireNonNull(value, "Rational value cannot be null"); + Objects.requireNonNull(type, "FloatingPointType cannot be null"); + + final int exponentSize = type.getExponentSize(); + final int mantissaSize = type.getMantissaSize(); + final int bias = (1 << (exponentSize - 1)) - 1; + final Rational two = Rational.ofLong(2); + final Rational one = Rational.ofLong(1); + final Rational half = Rational.ofLongs(1, 2); + + // Handle zero + if (value.equals(Rational.ZERO)) { + String sign = value.signum() < 0 ? "1" : "0"; + return String.format( + "(fp #b%s #b%s #b%s)", sign, generateZeros(exponentSize), generateZeros(mantissaSize)); + } + + final int signBit = value.signum() < 0 ? 1 : 0; + Rational absValue = value.abs(); + + // Calculate exponent + int exponent = 0; + if (absValue.compareTo(one) >= 0) { + while (absValue.compareTo(two) >= 0) { + absValue = absValue.divides(two); + exponent++; + } + } else { + while (absValue.compareTo(one) < 0) { + absValue = absValue.times(two); + exponent--; + } + } + + // Handle special cases after exponent calculation + int biasedExponent = exponent + bias; + + // Handle denormal numbers + if (biasedExponent <= 0) { + return String.format( + "(fp #b%s #b%s #b%s)", signBit, generateZeros(exponentSize), generateZeros(mantissaSize)); + } + + // Handle overflow (infinity) + if (biasedExponent >= (1 << exponentSize) - 1) { + return String.format( + "(fp #b%s #b%s #b%s)", signBit, generateOnes(exponentSize), generateZeros(mantissaSize)); + } + + // Calculate mantissa bits + StringBuilder mantissaBits = new StringBuilder(mantissaSize); + Rational remainder = absValue.minus(one); + + for (int i = 0; i < mantissaSize; i++) { + remainder = remainder.times(two); + if (remainder.compareTo(one) >= 0) { + mantissaBits.append('1'); + remainder = remainder.minus(one); + } else { + mantissaBits.append('0'); + } + } + + // Rounding - round to nearest, ties to even + if (remainder.compareTo(half) > 0 + || (remainder.equals(half) && mantissaBits.charAt(mantissaSize - 1) == '1')) { + // Need to round up + boolean carry = true; + for (int i = mantissaSize - 1; i >= 0 && carry; i--) { + if (mantissaBits.charAt(i) == '0') { + mantissaBits.setCharAt(i, '1'); + carry = false; + } else { + mantissaBits.setCharAt(i, '0'); + } + } + if (carry) { + biasedExponent++; + if (biasedExponent >= (1 << exponentSize) - 1) { + return String.format( + "(fp #b%s #b%s #b%s)", + signBit, generateOnes(exponentSize), generateZeros(mantissaSize)); + } + mantissaBits = new StringBuilder(generateZeros(mantissaSize)); + } + } + + String exponentBits = padWithZeros(Integer.toBinaryString(biasedExponent), exponentSize); + return String.format("(fp #b%s #b%s #b%s)", signBit, exponentBits, mantissaBits); + } + + private static String padWithZeros(String s, int length) { + while (s.length() < length) { + s = "0" + s; + } + return s; + } + + public static String generateOnes(int count) { + return "1".repeat(Math.max(0, count)); + } + + public static String generateZeros(int count) { + return "0".repeat(Math.max(0, count)); + } + + protected static void logMakeFloatingPointVariable( + FloatingPointFormula result, FloatingPointType type, String var) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, type, var)); + List inputParams = new ArrayList<>(); + inputParams.add(var); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + FunctionEnvironment newEntry = + new FunctionEnvironment(result, inputParams, functionToString, Keyword.FLOATING_POINT); + newEntry.floatingPointExponent = type.getExponentSize(); + newEntry.floatingPointMantissa = type.getMantissaSize() + 1; + Generator.getExecutedAggregator().add(newEntry); + } + + protected static void logFPMax( + FloatingPointFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.max", num1, num2); + } + + protected static void logFPMin( + FloatingPointFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.min", num1, num2); + } + + protected static void logMakeNaN(FloatingPointFormula result, FloatingPointType type) { + logSimple( + result, "(_ NaN " + type.getExponentSize() + " " + (type.getMantissaSize() + 1) + ")"); + } + + protected static void logMakePlusInfinity(FloatingPointFormula result, FloatingPointType type) { + logSimple( + result, "(_ +oo " + type.getExponentSize() + " " + (type.getMantissaSize() + 1) + ")"); + } + + protected static void logMakeMinusInfinity(FloatingPointFormula result, FloatingPointType type) { + logSimple( + result, "(_ -oo " + type.getExponentSize() + " " + (type.getMantissaSize() + 1) + ")"); + } + + protected static void logFPAdd( + FloatingPointFormula result, + FloatingPointFormula num1, + FloatingPointFormula num2, + String roundingMode) { + logBinaryOpWithMode(result, "fp.add", roundingMode, num1, num2); + } + + protected static void logFPAdd( + FloatingPointFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.add", num1, num2); + } + + protected static void logFPMul( + FloatingPointFormula result, + FloatingPointFormula num1, + FloatingPointFormula num2, + String roundingMode) { + logBinaryOpWithMode(result, "fp.mul", roundingMode, num1, num2); + } + + protected static void logFPMul( + FloatingPointFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.mul", num1, num2); + } + + protected static void logFPDiv( + FloatingPointFormula result, + FloatingPointFormula num1, + FloatingPointFormula num2, + String roundingMode) { + logBinaryOpWithMode(result, "fp.div", roundingMode, num1, num2); + } + + protected static void logFPDiv( + FloatingPointFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.div", num1, num2); + } + + protected static void logFPSub( + FloatingPointFormula result, + FloatingPointFormula num1, + FloatingPointFormula num2, + String roundingMode) { + logBinaryOpWithMode(result, "fp.sub", roundingMode, num1, num2); + } + + protected static void logFPSub( + FloatingPointFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.sub", num1, num2); + } + + protected static void logFPSqrt( + FloatingPointFormula result, FloatingPointFormula n, String roundingMode) { + logUnaryOpWithMode(result, "fp.sqrt", roundingMode, n); + } + + protected static void logFPSqrt(FloatingPointFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.sqrt", n); + } + + protected static void logFPAbs(FloatingPointFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.abs", n); + } + + protected static void logFPNegate(FloatingPointFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.neg", n); + } + + protected static void logFPGreaterThan( + BooleanFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.gt", num1, num2); + } + + protected static void logFPGreaterOrEquals( + BooleanFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.geq", num1, num2); + } + + protected static void logFPLessThan( + BooleanFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.lt", num1, num2); + } + + protected static void logFPLessOrEquals( + BooleanFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.leq", num1, num2); + } + + protected static void logFPEqual( + BooleanFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "fp.eq", num1, num2); + } + + protected static void logFPIsNaN(BooleanFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.isNaN", n); + } + + protected static void logFPIsZero(BooleanFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.isZero", n); + } + + protected static void logFPIsInfinite(BooleanFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.isInfinite", n); + } + + protected static void logFPIsSubnormal(BooleanFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.isSubnormal", n); + } + + protected static void logFPIsNegative(BooleanFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.isNegative", n); + } + + protected static void logFPIsNormal(BooleanFormula result, FloatingPointFormula n) { + logUnaryOp(result, "fp.isNormal", n); + } + + protected static void logFPRound( + FloatingPointFormula result, FloatingPointFormula n, String roundingMode) { + logUnaryOpWithMode(result, "fp.roundToIntegral", roundingMode, n); + } + + protected static void logFPAssignment( + BooleanFormula result, FloatingPointFormula num1, FloatingPointFormula num2) { + logBinaryOp(result, "=", num1, num2); + } + + protected static void logFPCastTo( + Formula result, + FloatingPointFormula number, + String roundingMode, + FormulaType targetType, + boolean signed) { + Generator.throwExceptionWhenParameterIsNull( + ImmutableList.of(result, number, targetType, roundingMode)); + String command; + if (targetType.isIntegerType() || targetType.isRationalType() || targetType.isBitvectorType()) { + if (targetType.isBitvectorType()) { + if (!signed) { + command = "_ fp.to_ubv"; + } else { + command = "_ fp.to_sbv"; + } + } else { + command = "fp.to_real"; + } + } else { + throw new GeneratorException("Unsupported target type"); + } + List inputParams = new ArrayList<>(); + inputParams.add(number); + inputParams.add(roundingMode); + inputParams.add(command); + + if (targetType.isBitvectorType()) { + FormulaType.BitvectorType bitvectorFormulaFormulaType = + (FormulaType.BitvectorType) targetType; + inputParams.add(bitvectorFormulaFormulaType.getSize()); + Function, String> functionToString = + inPlaceInputParams -> + "((" + + inPlaceInputParams.get(2) + + " " + + inPlaceInputParams.get(3) + + " " + + inPlaceInputParams.get(1) + + ") " + + inPlaceInputParams.get(0) + + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } else if (targetType.isRationalType()) { + Function, String> functionToString = + inPlaceInputParams -> + "((" + + inPlaceInputParams.get(2) + + " " + + inPlaceInputParams.get(1) + + ") " + + inPlaceInputParams.get(0) + + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + } + + protected static void logFPCastTo( + Formula result, FloatingPointFormula number, FormulaType targetType, boolean signed) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, number, targetType)); + String command; + if (targetType.isIntegerType() || targetType.isRationalType() || targetType.isBitvectorType()) { + if (targetType.isBitvectorType()) { + if (!signed) { + command = "_ fp.to_ubv"; + } else { + command = "_ fp.to_sbv"; + } + } else { + command = "fp.to_real"; + } + } else { + throw new GeneratorException("Unsupported target type"); + } + List inputParams = new ArrayList<>(); + inputParams.add(number); + inputParams.add(command); + + if (targetType.isBitvectorType()) { + FormulaType.BitvectorType bitvectorFormulaFormulaType = + (FormulaType.BitvectorType) targetType; + inputParams.add(bitvectorFormulaFormulaType.getSize()); + Function, String> functionToString = + inPlaceInputParams -> + "((" + + inPlaceInputParams.get(1) + + " " + + inPlaceInputParams.get(2) + + ") " + + inPlaceInputParams.get(0) + + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } else if (targetType.isRationalType()) { + Function, String> functionToString = + inPlaceInputParams -> + "((" + inPlaceInputParams.get(1) + ") " + inPlaceInputParams.get(0) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + } + + protected static void logFPCastFrom( + FloatingPointFormula result, Formula number, FloatingPointType type, String roundingMode) { + Generator.throwExceptionWhenParameterIsNull( + ImmutableList.of(result, number, type, roundingMode)); + List inputParams = new ArrayList<>(); + inputParams.add(number); + inputParams.add(roundingMode); + inputParams.add(String.valueOf(type.getExponentSize())); + inputParams.add(String.valueOf(type.getMantissaSize() + 1)); + Function, String> functionToString = + getListStringFunctionForCast(number, inputParams); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logFPCastFrom( + FloatingPointFormula result, Formula number, FloatingPointType type) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, number, type)); + List inputParams = new ArrayList<>(); + inputParams.add(number); + inputParams.add(String.valueOf(type.getExponentSize())); + inputParams.add(String.valueOf(type.getMantissaSize() + 1)); + Function, String> functionToString = + getListStringFunctionForCast(number, inputParams); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + private static Function, String> getListStringFunctionForCast( + Formula number, List inputParams) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(number, inputParams)); + if (inputParams.size() == 4) { + Function, String> functionToString; + if (number instanceof BitvectorFormula) { + functionToString = + inPlaceInputParams -> + "((_ to_fp " + + inPlaceInputParams.get(2) + + " " + + inPlaceInputParams.get(3) + + ")" + + " " + + inPlaceInputParams.get(0) + + ")"; + } else { + functionToString = + inPlaceInputParams -> + "((_ to_fp " + + inPlaceInputParams.get(2) + + " " + + inPlaceInputParams.get(3) + + ")" + + " " + + inPlaceInputParams.get(1) + + " " + + inPlaceInputParams.get(0) + + ")"; + } + return functionToString; + } else { + Function, String> functionToString; + if (number instanceof BitvectorFormula) { + functionToString = + inPlaceInputParams -> + "((_ to_fp " + + inPlaceInputParams.get(1) + + ")" + + " " + + inPlaceInputParams.get(0) + + ")"; + } else { + functionToString = + inPlaceInputParams -> + "((_ to_fp " + + inPlaceInputParams.get(1) + + " " + + inPlaceInputParams.get(2) + + ") " + + inPlaceInputParams.get(0) + + ")"; + } + return functionToString; + } + } + + protected static void logFromIeeeBitvector( + FloatingPointFormula result, BitvectorFormula number, FloatingPointType type) { + logUnaryOp( + result, + "(_ to_fp " + type.getExponentSize() + " " + (type.getMantissaSize() + 1) + ")", + number); + } + + private static void logUnaryOp(Object result, String op, Object n) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, op, n)); + List inputParams = ImmutableList.of(n); + logOperation(result, inputParams, "(" + op + " %s)", Keyword.SKIP); + } + + private static void logUnaryOpWithMode(Object result, String op, String mode, Object n) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, op, mode, n)); + List inputParams = ImmutableList.of(mode, n); + logOperation(result, inputParams, "(" + op + " %s %s)", Keyword.SKIP); + } + + private static void logBinaryOp(Object result, String op, Object num1, Object num2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, op, num1, num2)); + List inputParams = ImmutableList.of(num1, num2); + logOperation(result, inputParams, "(" + op + " %s %s)", Keyword.SKIP); + } + + private static void logBinaryOpWithMode( + Object result, String op, String mode, Object num1, Object num2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, op, mode, num1, num2)); + List inputParams = ImmutableList.of(mode, num1, num2); + logOperation(result, inputParams, "(" + op + " %s %s %s)", Keyword.SKIP); + } + + private static void logSimple(Object result, String expr) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, expr)); + List inputParams = new ArrayList<>(); + logOperation(result, inputParams, expr, Keyword.SKIP); + } + + private static void logOperation( + Object result, List params, String format, Keyword keyword) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, params, format, keyword)); + Function, String> functionToString = + inputs -> String.format(format, inputs.toArray()); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, params, functionToString, keyword)); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/FunctionEnvironment.java b/src/org/sosy_lab/java_smt/basicimpl/FunctionEnvironment.java new file mode 100644 index 0000000000..24d1c65bec --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/FunctionEnvironment.java @@ -0,0 +1,134 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import com.google.common.collect.ImmutableList; +import java.util.List; +import java.util.function.Function; +import org.sosy_lab.java_smt.basicimpl.Generator.Keyword; + +// TODO Use AutoValue +// TODO Can we make this typesafe? +public class FunctionEnvironment { + + Object result; + List inputParams; + Function, String> functionToString; + Keyword expressionType; + int bitVecLength; + int floatingPointMantissa; + int floatingPointExponent; + String ufName = ""; + String ufInputType = ""; + String ufOutputType = ""; + String arrayIndexType = ""; + String arrayValueType = ""; + + protected FunctionEnvironment( + Object pResult, + List pInputParams, + Function, String> pFunctionToString, + Keyword pKeyword) { + Generator.throwExceptionWhenParameterIsNull( + List.of(pResult, pInputParams, pFunctionToString, pKeyword)); + result = pResult; + inputParams = pInputParams; + functionToString = pFunctionToString; + expressionType = pKeyword; + } + + public Object getResult() { + return result; + } + + public int getBitVecLength() { + return bitVecLength; + } + + public void setBitVecLength(int pBitVecLength) { + bitVecLength = pBitVecLength; + } + + public Keyword getExpressionType() { + return expressionType; + } + + public void setExpressionType(Keyword pExpressionType) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pExpressionType)); + expressionType = pExpressionType; + } + + public void setResult(Object pResult) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pResult)); + result = pResult; + } + + public List getInputParams() { + return inputParams; + } + + public void setInputParams(List pInputParams) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pInputParams)); + inputParams = pInputParams; + } + + public Function, String> getFunctionToString() { + return functionToString; + } + + public void setFunctionToString(Function, String> pFunctionToString) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pFunctionToString)); + functionToString = pFunctionToString; + } + + public void setArrayIndexType(String pArrayIndexType) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pArrayIndexType)); + arrayIndexType = pArrayIndexType; + } + + public void setArrayValueType(String pArrayValueType) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pArrayValueType)); + arrayValueType = pArrayValueType; + } + + public String getUFName() { + return ufName; + } + + public void setUFName(String pUFName) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pUFName)); + ufName = pUFName; + } + + public String getArrayIndexType() { + return arrayIndexType; + } + + public String getArrayValueType() { + return arrayValueType; + } + + public String getUFInputType() { + return ufInputType; + } + + public void setUFInputType(String pUFInputType) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pUFInputType)); + ufInputType = pUFInputType; + } + + public String getUFOutputType() { + return ufOutputType; + } + + public void setUFOutputType(String pUFOutputType) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(pUFOutputType)); + ufOutputType = pUFOutputType; + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/Generator.java b/src/org/sosy_lab/java_smt/basicimpl/Generator.java new file mode 100644 index 0000000000..c1dc60a14f --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/Generator.java @@ -0,0 +1,276 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.io.IOException; +import java.io.Writer; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.sosy_lab.java_smt.api.BooleanFormula; + +/** + * Assembles the final SMT-LIB2 constraint from the FormulaEnvironment objects generated by the + * individual Generators. + */ +@SuppressFBWarnings +// this warning is ignored, because Spotbugs fears that the internal structure of the Generator +// is revealed (because the get-functions return the instance variable instead of copies). +// TODO Rewrite Generator as a delegate. Or at least make the methods non-static. +// TODO How to split up this class to support multiple provers per context? +public class Generator { + private Generator() {} + + /** collects assembled SMT-LIB2, its value will be written to Out.smt2. */ + private static StringBuilder lines = new StringBuilder(); + + /** holds FunctionEnvironment for each operation that has been executed. */ + private static final List executedAggregator = new ArrayList<>(); + + /** + * holds FunctionEnvironment for each variable or function that needs to be declared or defined in + * SMT-LIB2. + */ + private static final List registeredVariables = new ArrayList<>(); + + /** Used to determine what kind of SMT-LIB2 string needs to be assembled. */ + public enum Keyword { + DIRECT, + SKIP, + BOOL, + INT, + REAL, + BITVEC, + UFFUN, + ARRAY, + STRING, + FLOATING_POINT + } + + private static boolean loggingEnabled = false; + + // TODO Add an option to set the output path. Better yet, just return the String + private static final String file = "Out.smt2"; + + public static StringBuilder getLines() { + return lines; + } + + public static List getExecutedAggregator() { + return executedAggregator; + } + + public static List getRegisteredVariables() { + return registeredVariables; + } + + protected static void writeToFile(String line, String fileName) throws IOException { + throwExceptionWhenParameterIsNull(ImmutableList.of(line, fileName)); + try { + try (Writer fileWriter = + Files.newBufferedWriter(Path.of(fileName), Charset.defaultCharset())) { + fileWriter.write(line); + fileWriter.flush(); + } + } catch (GeneratorException e) { + throw new GeneratorException("Could not write to file"); + } + } + + public static boolean isLoggingEnabled() { + return loggingEnabled; + } + + public static void setIsLoggingEnabled(boolean pIsLoggingEnabled) { + loggingEnabled = pIsLoggingEnabled; + } + + /** + * Recursively evaluates a Formula to SMT-LIB2, stops when input is a String. + * + * @param constraint Formula or String that is translated to SMT-LIB2 + * @return SMT-LIB2 String that is equivalent to Formula or String input + */ + protected static String evaluateRecursive(Object constraint) { + throwExceptionWhenParameterIsNull(ImmutableList.of(constraint)); + if (constraint instanceof String) { + // Constants + return (String) constraint; + } else { + // Functions of any kind + Optional maybeMethodToEvaluate = + executedAggregator.stream().filter(x -> x.getResult() == constraint).findFirst(); + + Preconditions.checkState(maybeMethodToEvaluate.isPresent()); + FunctionEnvironment methodToEvaluate = maybeMethodToEvaluate.orElseThrow(); + + if (!methodToEvaluate.expressionType.equals(Keyword.DIRECT)) { + registeredVariables.add(methodToEvaluate); + } + List evaluatedInputs = new ArrayList<>(); + for (Object value : methodToEvaluate.getInputParams()) { + String evaluatedInput = evaluateRecursive(value); + evaluatedInputs.add(evaluatedInput); + } + return methodToEvaluate.getFunctionToString().apply(evaluatedInputs); + } + } + + /** + * This method will assemble a valid SMT-LIB2 String from any given JavaSMT constraint and append + * it to the StringBuilder 'lines'. + * + * @param constraint JavaSMT constraint of type BooleanFormula that will be interpreted as + * SMT-LIB2 + */ + // TODO: automatically call on toString() of formulas + public static void assembleConstraint(BooleanFormula constraint) { + throwExceptionWhenParameterIsNull(ImmutableList.of(constraint)); + if (!isLoggingEnabled()) { + throw new GeneratorException("Logging is not enabled"); + } + String result = evaluateRecursive(constraint); + List uniqueRegisteredValues = + registeredVariables.stream().distinct().collect(Collectors.toList()); + String command = "(assert "; + for (FunctionEnvironment variable : uniqueRegisteredValues) { + if (variable.expressionType.equals(Keyword.BOOL)) { + String newEntry = "(declare-const " + variable.inputParams.get(0) + " Bool)\n"; + if (lines.indexOf(newEntry) == -1) { + lines.append(newEntry); + } + } + if (variable.expressionType.equals(Keyword.INT)) { + String newEntry = "(declare-const " + variable.inputParams.get(0) + " Int)\n"; + if (lines.indexOf(newEntry) == -1) { + lines.append(newEntry); + } + } + if (variable.expressionType.equals(Keyword.REAL)) { + String newEntry = "(declare-const " + variable.inputParams.get(0) + " Real)\n"; + if (lines.indexOf(newEntry) == -1) { + lines.append(newEntry); + } + } + if (variable.expressionType.equals(Keyword.STRING)) { + String newEntry = "(declare-const " + variable.inputParams.get(0) + " String)\n"; + if (lines.indexOf(newEntry) == -1) { + lines.append(newEntry); + } + } + if (variable.expressionType.equals(Keyword.BITVEC)) { + String newEntry = + "(declare-const " + + variable.inputParams.get(0) + + " (_ BitVec " + + variable.bitVecLength + + "))\n"; + if (lines.indexOf(newEntry) == -1) { + lines.append(newEntry); + } + } + if (variable.expressionType.equals(Keyword.FLOATING_POINT)) { + String newEntry = + "(declare-const " + + variable.inputParams.get(0) + + " (_ FloatingPoint " + + variable.floatingPointExponent + + " " + + variable.floatingPointMantissa + + "))\n"; + if (lines.indexOf(newEntry) == -1) { + lines.append(newEntry); + } + } + + if (variable.expressionType.equals(Keyword.ARRAY)) { + String newEntry = + "(declare-const " + + variable.inputParams.get(0) + + " (Array " + + variable.arrayIndexType + + " " + + variable.arrayValueType + + "))" + + "\n"; + if (lines.indexOf(newEntry) == -1) { + lines.append(newEntry); + } + } + if (variable.expressionType.equals(Keyword.UFFUN)) { + String newEntry = + "(declare-fun " + + variable.ufName + + " " + + variable.ufInputType + + " " + + variable.ufOutputType + + ")" + + "\n"; + if (lines.indexOf(newEntry) == -1) { + lines.append(newEntry); + } + } + } + String smtlib2Result = command + result + ")\n"; + lines.append(smtlib2Result); + } + + protected static void logPop() { + lines.append("(pop 1)\n"); + } + + protected static void logPush() { + lines.append("(push 1)\n"); + } + + /** + * Adds commands for generating an SMT-LIB2 model and exiting the solver to StringBuilder 'lines' + * and writes the value of 'lines' into a file named 'Out.smt2'. + * + * @throws IOException if writing to file failed + */ + public static void dumpSMTLIB2() throws IOException { + String endSMTLIB2 = "(check-sat)\n(get-model)\n(exit)"; + lines.append(endSMTLIB2); + writeToFile(String.valueOf(lines), file); + // TODO This deletes the old output. What happens if the method is called twice? + lines.delete(0, lines.length() - 1); + } + + public static String getSMTLIB2String() { + String endSMTLIB2 = "(check-sat)\n(get-model)\n(exit)"; + // FIXME Should we really add this to lines? + lines.append(endSMTLIB2); + // TODO GENERATOR URGENTLY NEEDS TO DETECT USED THEORIES AND DECLARE IT HERE + // TODO NOT ALL SOLVER SUPPORT SET-LOGIC ALL! + return "(set-logic ALL)\n" + lines; + } + + public static void resetGenerator() { + lines = new StringBuilder(); + executedAggregator.clear(); + registeredVariables.clear(); + } + + public static void throwExceptionWhenParameterIsNull(List x) { + for (Object o : x) { + if (o == null) { + throw new NullPointerException("Parameters must not be null"); + } + } + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/GeneratorException.java b/src/org/sosy_lab/java_smt/basicimpl/GeneratorException.java new file mode 100644 index 0000000000..022c85f1d4 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/GeneratorException.java @@ -0,0 +1,60 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +/** Exception thrown if there is an error during Generating SMTLIB2. */ +// TODO Do we need those exception classes? +public class GeneratorException extends RuntimeException { + + private static final long serialVersionUID = 176487434783322L; + + /** Constructs an UnsupportedOperationException with no detail message. */ + public GeneratorException() {} + + /** + * Constructs an UnsupportedOperationException with the specified detail message. + * + * @param message the detail message + */ + public GeneratorException(String message) { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. + * + *

Note that the detail message associated with cause is not automatically + * incorporated in this exception's detail message. + * + * @param message the detail message (which is saved for later retrieval by the {@link + * Throwable#getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} + * method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.5 + */ + public GeneratorException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new exception with the specified cause and a detail message of {@code (cause==null + * ? null : cause.toString())} (which typically contains the class and detail message of {@code + * cause}). This constructor is useful for exceptions that are little more than wrappers for other + * throwables (for example, {@link java.security.PrivilegedActionException}). + * + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} + * method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.5 + */ + public GeneratorException(Throwable cause) { + super(cause); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/ModelException.java b/src/org/sosy_lab/java_smt/basicimpl/ModelException.java new file mode 100644 index 0000000000..39cc1adad9 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/ModelException.java @@ -0,0 +1,59 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +/** Exception thrown if there is an error during parsing the model from SMTLIB2. */ +// TODO Do we need those exception classes? +public class ModelException extends RuntimeException { + /** Constructs an UnsupportedOperationException with no detail message. */ + public ModelException() {} + + /** + * Constructs an UnsupportedOperationException with the specified detail message. + * + * @param message the detail message + */ + public ModelException(String message) { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. + * + *

Note that the detail message associated with cause is not automatically + * incorporated in this exception's detail message. + * + * @param message the detail message (which is saved for later retrieval by the {@link + * Throwable#getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} + * method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.5 + */ + public ModelException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new exception with the specified cause and a detail message of {@code (cause==null + * ? null : cause.toString())} (which typically contains the class and detail message of {@code + * cause}). This constructor is useful for exceptions that are little more than wrappers for other + * throwables (for example, {@link java.security.PrivilegedActionException}). + * + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} + * method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.5 + */ + public ModelException(Throwable cause) { + super(cause); + } + + static final long serialVersionUID = -1242599979055084673L; +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/NumeralGenerator.java b/src/org/sosy_lab/java_smt/basicimpl/NumeralGenerator.java new file mode 100644 index 0000000000..9a29634f93 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/NumeralGenerator.java @@ -0,0 +1,243 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import com.google.common.collect.ImmutableList; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; +import org.sosy_lab.java_smt.api.NumeralFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.basicimpl.Generator.Keyword; + +public class NumeralGenerator { + private NumeralGenerator() {} + + /** + * @param result solver returned object for the makeNumber() call. + * @param number the value of the number as String. + */ + protected static void logMakeNumber(Object result, String number) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, number)); + List inputParams = new ArrayList<>(); + Function, String> functionToString; + if (result instanceof IntegerFormula && new BigInteger(number).signum() == -1) { + BigInteger numberValueBigInt = new BigInteger(number); + String absVar = String.valueOf(numberValueBigInt.abs()); + inputParams.add(absVar); + functionToString = inPlaceInputParams -> "(- " + inPlaceInputParams.get(0) + ")"; + + } else { + inputParams.add(number); + functionToString = inPlaceInputParams -> (String) inPlaceInputParams.get(0); + } + + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logMakeIntVariable(Object result, String pVar) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pVar)); + Keyword varType; + if (result instanceof IntegerFormula) { + varType = Keyword.INT; + } else { + varType = Keyword.REAL; + } + List inputParams = new ArrayList<>(); + inputParams.add(pVar); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, varType)); + } + + protected static void logAdd(Object result, NumeralFormula pNumber1, NumeralFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(+ " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logEqual(Object result, NumeralFormula pNumber1, NumeralFormula pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(= " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logNegate(Object result, NumeralFormula pBits) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pBits)); + List inputParams = new ArrayList<>(); + inputParams.add(pBits); + Function, String> functionToString = + inPlaceInputParams -> "(- " + inPlaceInputParams.get(0) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logSum(Object result, List operands) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, operands)); + List inputParams = new ArrayList<>(); + for (Object pOperand : operands) { + inputParams.add(pOperand.toString()); + } + Function, String> functionToString = + inPlaceInputParams -> { + StringBuilder out = new StringBuilder(); + out.append("(+ "); + inPlaceInputParams.forEach( + (c) -> { + out.append(c); + out.append(" "); + }); + return String.valueOf(out.deleteCharAt(out.length() - 1).append(")")); + }; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logSubtract(Object result, Object pNumber1, Object pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(- " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logDivide(Object result, Object pNumber1, Object pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(div " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logModulo(Object result, Object pNumber1, Object pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(mod " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logMultiply(Object result, Object pNumber1, Object pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(* " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logDistinct(Object result, List operands) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, operands)); + List inputParams = new ArrayList<>(); + for (Object pOperand : operands) { + inputParams.add(pOperand.toString()); + } + Function, String> functionToString = + inPlaceInputParams -> { + StringBuilder out = new StringBuilder(); + out.append("(distinct "); + inPlaceInputParams.forEach( + (c) -> { + out.append(c); + out.append(" "); + }); + return String.valueOf(out.deleteCharAt(out.length() - 1).append(")")); + }; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logGreaterThan(Object result, Object pNumber1, Object pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(> " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logGreaterOrEquals(Object result, Object pNumber1, Object pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(>= " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logLessThan(Object result, Object pNumber1, Object pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(< " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logLessOrEquals(Object result, Object pNumber1, Object pNumber2) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pNumber1, pNumber2)); + List inputParams = new ArrayList<>(); + inputParams.add(pNumber1); + inputParams.add(pNumber2); + Function, String> functionToString = + inPlaceInputParams -> + "(<= " + inPlaceInputParams.get(0) + " " + inPlaceInputParams.get(1) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logFloor(Object result, Object number) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, number)); + List inputParams = new ArrayList<>(); + inputParams.add(number); + Function, String> functionToString = + inPlaceInputParams -> "(to_int " + inPlaceInputParams.get(0) + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/PackageSanityTest.java b/src/org/sosy_lab/java_smt/basicimpl/PackageSanityTest.java index d4db7d9956..d00fff4578 100644 --- a/src/org/sosy_lab/java_smt/basicimpl/PackageSanityTest.java +++ b/src/org/sosy_lab/java_smt/basicimpl/PackageSanityTest.java @@ -18,5 +18,11 @@ public class PackageSanityTest extends AbstractPackageSanityTests { { setDistinctValues(FormulaType.class, FormulaType.BooleanType, FormulaType.IntegerType); setDefault(ShutdownNotifier.class, ShutdownManager.create().getNotifier()); + setDefault(FormulaType.BitvectorType.class, FormulaType.getBitvectorTypeWithSize(32)); + setDefault( + FormulaType.FloatingPointType.class, FormulaType.getSinglePrecisionFloatingPointType()); + ignoreClasses(c -> c.getSimpleName().equals("ModelException")); + ignoreClasses(c -> c.getSimpleName().equals("BinaryModel")); + ignoreClasses(c -> c.getSimpleName().equals("GeneratorException")); } } diff --git a/src/org/sosy_lab/java_smt/basicimpl/StringGenerator.java b/src/org/sosy_lab/java_smt/basicimpl/StringGenerator.java new file mode 100644 index 0000000000..9973ac71f1 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/StringGenerator.java @@ -0,0 +1,258 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.RegexFormula; +import org.sosy_lab.java_smt.api.StringFormula; +import org.sosy_lab.java_smt.basicimpl.Generator.Keyword; + +/** This class provides logging Functions for StringFormulas (for later SMTLIB2 code generating). */ +public class StringGenerator { + + private StringGenerator() {} + + protected static void logMakeString(Object result, String value) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, value)); + List params = new ArrayList<>(); + params.add(value); + + // Prüfen, ob value schon als SMT-String formatiert ist (fängt und endet mit Anführungszeichen) + boolean isQuoted = value.startsWith("\"") && value.endsWith("\""); + + String format = isQuoted ? "%s" : "\"%s\""; + + Function, String> functionToString = + inputs -> String.format(format, inputs.toArray()); + + FunctionEnvironment newEntry = + new FunctionEnvironment(result, params, functionToString, Keyword.SKIP); + + Generator.getExecutedAggregator().add(newEntry); + } + + protected static void logMakeRegex(Object result, String value) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, value)); + List params = ImmutableList.of(value); + + // Prüfen, ob der value ein echter SMT-Ausdruck ist + boolean isExpression = value.trim().startsWith("("); + + String format = isExpression ? "(str.to_re %s)" : "(str.to_re \"%s\")"; + + Function, String> functionToString = + inputs -> String.format(format, inputs.toArray()); + + FunctionEnvironment newEntry = + new FunctionEnvironment(result, params, functionToString, Keyword.SKIP); + + Generator.getExecutedAggregator().add(newEntry); + } + + protected static void logMakeVariable(Object result, String pVar) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, pVar)); + List inputParams = new ArrayList<>(); + inputParams.add(pVar); + Function, String> functionToString = + inPlaceInputParams -> (String) inPlaceInputParams.get(0); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.STRING)); + } + + protected static void logConcat(Object result, List parts) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, parts)); + List inputParams = new ArrayList<>(parts); + String format = "(str.++"; + for (int i = 0; i < parts.size(); i++) { + format += " %s"; + } + format += ")"; + logOperation(result, inputParams, format, Keyword.SKIP); + } + + protected static void logEqual(BooleanFormula result, StringFormula str1, StringFormula str2) { + logBinaryOp(result, "=", str1, str2); + } + + protected static void logGreaterThan( + BooleanFormula result, StringFormula str1, StringFormula str2) { + logBinaryOp(result, "str.", str1, str2); + } + + protected static void logGreaterOrEquals( + BooleanFormula result, StringFormula str1, StringFormula str2) { + logBinaryOp(result, "str.ge", str1, str2); + } + + protected static void logLessThan(BooleanFormula result, StringFormula str1, StringFormula str2) { + logBinaryOp(result, "str.<", str1, str2); + } + + protected static void logLessOrEquals( + BooleanFormula result, StringFormula str1, StringFormula str2) { + logBinaryOp(result, "str.<=", str1, str2); + } + + protected static void logPrefix(BooleanFormula result, StringFormula prefix, StringFormula str) { + logBinaryOp(result, "str.prefixof", prefix, str); + } + + protected static void logSuffix(BooleanFormula result, StringFormula suffix, StringFormula str) { + logBinaryOp(result, "str.suffixof", suffix, str); + } + + protected static void logContains(BooleanFormula result, StringFormula str, StringFormula part) { + logBinaryOp(result, "str.contains", str, part); + } + + protected static void logRegexRange(RegexFormula result, StringFormula start, StringFormula end) { + List inputParams = ImmutableList.of(start, end); + logOperation(result, inputParams, "(re.range %s %s)", Keyword.SKIP); + } + + protected static void logRegexUnion( + RegexFormula result, RegexFormula regex1, RegexFormula regex2) { + List inputParams = ImmutableList.of(regex1, regex2); + logOperation(result, inputParams, "(re.union %s %s)", Keyword.SKIP); + } + + protected static void logRegexIntersection( + RegexFormula result, RegexFormula regex1, RegexFormula regex2) { + List inputParams = ImmutableList.of(regex1, regex2); + logOperation(result, inputParams, "(re.inter %s %s)", Keyword.SKIP); + } + + protected static void logRegexClosure(RegexFormula result, RegexFormula regex) { + List inputParams = ImmutableList.of(regex); + logOperation(result, inputParams, "(re.* %s)", Keyword.SKIP); + } + + protected static void logRegexComplement(RegexFormula result, RegexFormula regex) { + List inputParams = ImmutableList.of(regex); + logOperation(result, inputParams, "(re.comp %s)", Keyword.SKIP); + } + + protected static void logRegexDifference( + RegexFormula result, RegexFormula regex1, RegexFormula regex2) { + List inputParams = ImmutableList.of(regex1, regex2); + logOperation(result, inputParams, "(re.diff %s %s)", Keyword.SKIP); + } + + protected static void logIndexOf( + IntegerFormula result, StringFormula str, StringFormula part, IntegerFormula startIndex) { + List inputParams = ImmutableList.of(str, part, startIndex); + logOperation(result, inputParams, "(str.indexof %s %s %s)", Keyword.SKIP); + } + + protected static void logCharAt(Object result, StringFormula str, IntegerFormula index) { + List inputParams = ImmutableList.of(str, index); + logOperation(result, inputParams, "(str.at %s %s)", Keyword.SKIP); + } + + protected static void logSubstring( + Object result, StringFormula str, IntegerFormula index, IntegerFormula length) { + List inputParams = ImmutableList.of(str, index, length); + logOperation(result, inputParams, "(str.substr %s %s %s)", Keyword.SKIP); + } + + protected static void logReplace( + Object result, StringFormula fullStr, StringFormula target, StringFormula replacement) { + List inputParams = ImmutableList.of(fullStr, target, replacement); + logOperation(result, inputParams, "(str.replace %s %s %s)", Keyword.SKIP); + } + + protected static void logReplaceAll( + Object result, StringFormula fullStr, StringFormula target, StringFormula replacement) { + List inputParams = ImmutableList.of(fullStr, target, replacement); + logOperation(result, inputParams, "(str.replaceall %s %s %s)", Keyword.SKIP); + } + + protected static void logRegexAll(RegexFormula result) { + logOperation(result, ImmutableList.of(), "(re.all)", Keyword.SKIP); + } + + protected static void logRegexNone(RegexFormula result) { + logOperation(result, ImmutableList.of(), "(re.none)", Keyword.SKIP); + } + + protected static void logRegexAllChar(RegexFormula result) { + logOperation(result, ImmutableList.of(), "(re.allchar)", Keyword.SKIP); + } + + protected static void logRegexConcat(RegexFormula result, List parts) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, parts)); + List inputParams = new ArrayList<>(parts); + String format = "(re.++"; + for (int i = 0; i < parts.size(); i++) { + format += " %s"; + } + format += ")"; + logOperation(result, inputParams, format, Keyword.SKIP); + } + + protected static void logRegexOptional(RegexFormula result, RegexFormula regex) { + logOperation(result, ImmutableList.of(regex), "(re.opt %s)", Keyword.SKIP); + } + + protected static void logRegexTimes(RegexFormula result, RegexFormula regex, int repetitions) { + logOperation( + result, + ImmutableList.of(regex, repetitions), + "((_ re.^ " + repetitions + ") %s)", + Keyword.SKIP); + } + + protected static void logRegexCross(RegexFormula result, RegexFormula regex) { + logOperation(result, ImmutableList.of(regex), "(re.+ %s)", Keyword.SKIP); + } + + protected static void logLength(IntegerFormula result, StringFormula str) { + List inputParams = ImmutableList.of(str); + logOperation(result, inputParams, "(str.len %s)", Keyword.SKIP); + } + + protected static void logIn(BooleanFormula result, StringFormula str, Object regex) { + List inputParams = ImmutableList.of(str, regex); + logOperation(result, inputParams, "(str.in_re %s %s)", Keyword.SKIP); + } + + protected static void logToInteger(IntegerFormula result, StringFormula str) { + List inputParams = ImmutableList.of(str); + logOperation(result, inputParams, "(str.to_int %s)", Keyword.SKIP); + } + + protected static void logToString(Object result, IntegerFormula number) { + List inputParams = ImmutableList.of(number); + logOperation(result, inputParams, "(str.from_int %s)", Keyword.SKIP); + } + + private static void logBinaryOp(Object result, String op, Object n1, Object n2) { + List inputParams = ImmutableList.of(n1, n2); + logOperation(result, inputParams, "(" + op + " %s %s)", Keyword.SKIP); + } + + private static void logOperation( + Object result, List params, String format, Keyword keyword) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, params, format, keyword)); + long placeholders = format.chars().filter(ch -> ch == '%').count(); + if (params.size() != placeholders) { + throw new IllegalArgumentException( + String.format( + "Mismatch between placeholders (%d) and parameters (%d) for format: %s", + placeholders, params.size(), format)); + } + + Function, String> functionToString = + inputs -> String.format(format, inputs.toArray()); + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, params, functionToString, keyword)); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/UFGenerator.java b/src/org/sosy_lab/java_smt/basicimpl/UFGenerator.java new file mode 100644 index 0000000000..cfc82a1d25 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/UFGenerator.java @@ -0,0 +1,172 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl; + +import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; +import org.sosy_lab.java_smt.api.Formula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FormulaType.ArrayFormulaType; +import org.sosy_lab.java_smt.api.FormulaType.BitvectorType; +import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType; +import org.sosy_lab.java_smt.api.FunctionDeclaration; +import org.sosy_lab.java_smt.basicimpl.Generator.Keyword; + +public class UFGenerator { + private UFGenerator() {} + + protected static String checkUFInputType(ImmutableList> args) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(args)); + StringBuilder inputArgs = new StringBuilder("("); + for (FormulaType arg : args) { + if (arg.isArrayType()) { + inputArgs + .append("(Array ") + .append(checkUFOutputType(((ArrayFormulaType) arg).getIndexType())) + .append(" ") + .append(checkUFOutputType(((ArrayFormulaType) arg).getElementType())) + .append(")"); + } else if (arg.isBitvectorType()) { + inputArgs.append("(_ BitVec ").append(((BitvectorType) arg).getSize()).append(")"); + } else if (arg.isBooleanType()) { + inputArgs.append("Bool"); + } else if (arg.isIntegerType()) { + inputArgs.append("Int"); + } else if (arg.isRationalType()) { + inputArgs.append("Real"); + } else if (arg.isStringType()) { + return "String"; + } else if (arg.isFloatingPointType()) { + FloatingPointType type = (FloatingPointType) arg; + return "(_ FloatingPoint " + + type.getExponentSize() + + " " + + (type.getMantissaSize() + 1) + + ")"; + } else { + throw new GeneratorException(arg + " is not a known sort. "); + } + } + inputArgs.append(")"); + return String.valueOf(inputArgs); + } + + protected static String checkUFOutputType(FormulaType out) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(out)); + if (out.isArrayType()) { + return "(Array " + + checkUFOutputType(((ArrayFormulaType) out).getIndexType()) + + " " + + checkUFOutputType(((ArrayFormulaType) out).getElementType()) + + ")"; + } else if (out.isBitvectorType()) { + return "(_ BitVec " + ((FormulaType.BitvectorType) out).getSize() + ")"; + } else if (out.isBooleanType()) { + return "Bool"; + } else if (out.isIntegerType()) { + return "Int"; + } else if (out.isRationalType()) { + return "Real"; + } else if (out.isStringType()) { + return "String"; + } else if (out.isFloatingPointType()) { + FloatingPointType type = (FloatingPointType) out; + return "(_ FloatingPoint " + + type.getExponentSize() + + " " + + (type.getMantissaSize() + 1) + + ")"; + } else { + throw new GeneratorException(out + " is not a known sort. "); + } + } + + protected static void logMakeFun( + Object result, String pName, FormulaType pReturnType, List> pArgTypes) { + Generator.throwExceptionWhenParameterIsNull( + ImmutableList.of(result, pName, pReturnType, pArgTypes)); + List inputParams = new ArrayList<>(); + + inputParams.add(pName); + inputParams.add(pReturnType); + inputParams.add(pArgTypes); + Function, String> functionToString = + inPlaceInputParams -> + "(declare-fun " + + inPlaceInputParams.get(0) + + " (" + + inPlaceInputParams.get(1) + + ")" + + inPlaceInputParams.get(2) + + ")"; + Generator.getExecutedAggregator() + .add(new FunctionEnvironment(result, inputParams, functionToString, Keyword.SKIP)); + } + + protected static void logCallFun( + Object result, FunctionDeclaration funcType, List pArgs) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, funcType, pArgs)); + + List inputParams = new ArrayList<>(pArgs); + Function, String> functionToString = + inPlaceInputParams -> { + StringBuilder out = new StringBuilder(); + out.append(funcType.getName()).append(" "); + inPlaceInputParams.forEach( + (c) -> { + out.append(c); + out.append(" "); + }); + out.deleteCharAt(out.length() - 1); + if (!inPlaceInputParams.isEmpty()) { + out.insert(0, "("); + out.append(")"); + } + return String.valueOf(out); + }; + FunctionEnvironment newEntry = + new FunctionEnvironment(result, inputParams, functionToString, Keyword.UFFUN); + newEntry.setUFName(funcType.getName()); + newEntry.setUFInputType(checkUFInputType(funcType.getArgumentTypes())); + newEntry.setUFOutputType(checkUFOutputType(funcType.getType())); + Generator.getExecutedAggregator().add(newEntry); + } + + protected static void logCallFun( + Object result, FunctionDeclaration funcType, Formula... args) { + Generator.throwExceptionWhenParameterIsNull(ImmutableList.of(result, funcType, args)); + + List inputParams = new ArrayList<>(Arrays.asList(args)); + Function, String> functionToString = + inPlaceInputParams -> { + StringBuilder out = new StringBuilder(); + out.append(funcType.getName()).append(" "); + inPlaceInputParams.forEach( + (c) -> { + out.append(c); + out.append(" "); + }); + out.deleteCharAt(out.length() - 1); + if (!inPlaceInputParams.isEmpty()) { + out.insert(0, "("); + out.append(")"); + } + return String.valueOf(out); + }; + FunctionEnvironment newEntry = + new FunctionEnvironment(result, inputParams, functionToString, Keyword.UFFUN); + newEntry.setUFName(funcType.getName()); + newEntry.setUFInputType(checkUFInputType(funcType.getArgumentTypes())); + newEntry.setUFOutputType(checkUFOutputType(funcType.getType())); + Generator.getExecutedAggregator().add(newEntry); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/ParserException.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/ParserException.java new file mode 100644 index 0000000000..7048771cf4 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/ParserException.java @@ -0,0 +1,30 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +// TODO Just use IllegalArgumentException? +/** Exception thrown if there is an error during Generating SMTLIB2. */ +public class ParserException extends RuntimeException { + + private static final long serialVersionUID = 7364683736456L; + + public ParserException() {} + + public ParserException(String message) { + super(message); + } + + public ParserException(String message, Throwable cause) { + super(message, cause); + } + + public ParserException(Throwable cause) { + super(cause); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/ParserFormula.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/ParserFormula.java new file mode 100644 index 0000000000..3ee45dfd9c --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/ParserFormula.java @@ -0,0 +1,65 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +import java.util.List; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.sosy_lab.java_smt.api.FormulaType; + +// TODO Make this typesafe +// TODO Do we need the @Nullables? +// TODO Use AutoValue? +public class ParserFormula { + + @Nullable String type; + Object javaSmt; + + @Nullable FormulaType returnType; + + @Nullable List> inputParams; + + public ParserFormula(Object pJavaSmt) { + javaSmt = pJavaSmt; + } + + @Nullable + public String getType() { + return type; + } + + public void setType(String pType) { + type = pType; + } + + public Object getJavaSmt() { + return javaSmt; + } + + public void setJavaSmt(Object pJavaSmt) { + javaSmt = pJavaSmt; + } + + @Nullable + public FormulaType getReturnType() { + return returnType; + } + + public void setReturnType(FormulaType pReturnType) { + returnType = pReturnType; + } + + @Nullable + public List> getInputParams() { + return inputParams; + } + + public void setInputParams(List> pInputParams) { + inputParams = pInputParams; + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 new file mode 100644 index 0000000000..ecee84df0b --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 @@ -0,0 +1,1158 @@ +/** + * SMT-LIB (v2.6) grammar + * + * Grammar is based on the following specification: + * http://smtlib.cs.uiowa.edu/papers/smt-lib-reference-v2.6-r2017-07-18.pdf + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Julian Thome + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + **/ + +/* + * SPDX-FileCopyrightText: 2017 Julian Thome + * + * SPDX-License-Identifier: MIT + */ + +grammar Smtlibv2; + + +// Lexer Rules Start + + +Comment + : Semicolon ~[\r\n]* -> skip + ; + + +ParOpen + : '(' + ; + +ParClose + : ')' + ; + +Semicolon + : ';' + ; + +String + : '"' (PrintableCharNoDquote | WhiteSpaceChar)+ '"' + ; + +QuotedSymbol: + '|' (PrintableCharNoBackslash | WhiteSpaceChar)+ '|' + ; + + +FLOATING_POINT_SORT + : '(_ FloatingPoint' SpaceChar Numeral SpaceChar Numeral ')' + | ShortFloats + ; + +FLOATING_POINT_NUMBER + : '(fp' SpaceChar (Binary | HexDecimal) + SpaceChar (Binary | HexDecimal) + SpaceChar (Binary | HexDecimal) ')' + | '(_ ' [+-]'oo' SpaceChar Numeral SpaceChar Numeral ')' + | '(_ ' [+-]'zero' SpaceChar Numeral SpaceChar Numeral ')' + | '(_ NaN' SpaceChar Numeral SpaceChar Numeral ')' + ; +REGEXVALUES + : 're.none' + | 're.allchar' + | 're.all' + ; + +TO_FP_EXPR + : '((_ to_fp' SpaceChar Numeral SpaceChar Numeral ')' + ; +RE_TIMES_EXPR + : '((_ re.^' SpaceChar Numeral ')' + ; +RE_LOOP_EXPR + : '((_ re.loop' SpaceChar Numeral SpaceChar Numeral ')' + ; +// Predefined Symbols + +PS_Not + : 'not' + ; +PS_Bool + : 'Bool' + ; +PS_ContinuedExecution + : 'continued-execution' + ; +PS_Error + : 'error' + ; +PS_False + : 'false' + ; +PS_ImmediateExit + : 'immediate-exit' + ; +PS_Incomplete + : 'incomplete' + ; +PS_Logic + : 'logic' + ; +PS_Memout + : 'memout' + ; +PS_Sat + : 'sat' + ; +PS_Success + : 'success' + ; +PS_Theory + : 'theory' + ; +PS_True + : 'true' + ; +PS_Unknown + : 'unknown' + ; +PS_Unsupported + : 'unsupported' + ; +PS_Unsat + : 'unsat' + ; + +// RESERVED Words + +// Command names + + +CMD_Assert + : 'assert' + ; +CMD_CheckSat + : 'check-sat' + ; +CMD_CheckSatAssuming + : 'check-sat-assuming' + ; +CMD_DeclareConst + : 'declare-const' + ; +CMD_DeclareDatatype + : 'declare-datatype' + ; +CMD_DeclareDatatypes + : 'declare-datatypes' + ; +CMD_DeclareFun + : 'declare-fun' + ; +CMD_DeclareSort + : 'declare-sort' + ; +CMD_DefineFun + : 'define-fun' + ; +CMD_DefineFunRec + : 'define-fun-rec' + ; +CMD_DefineFunsRec + : 'define-funs-rec' + ; +CMD_DefineSort + : 'define-sort' + ; +CMD_Echo + : 'echo' + ; +CMD_Exit + : 'exit' + ; +CMD_GetAssertions + : 'get-assertions' + ; +CMD_GetAssignment + : 'get-assignment' + ; +CMD_GetInfo + : 'get-info' + ; +CMD_GetModel + : 'get-model' + ; +CMD_GetOption + : 'get-option' + ; +CMD_GetProof + : 'get-proof' + ; +CMD_GetUnsatAssumptions + : 'get-unsat-assumptions' + ; +CMD_GetUnsatCore + : 'get-unsat-core' + ; +CMD_GetValue + : 'get-value' + ; +CMD_Pop + : 'pop' + ; +CMD_Push + : 'push' + ; +CMD_Reset + : 'reset' + ; +CMD_ResetAssertions + : 'reset-assertions' + ; +CMD_SetInfo + : 'set-info' + ; +CMD_SetLogic + : 'set-logic' + ; +CMD_SetOption + : 'set-option' + ; + +// General reserved words + +GRW_Exclamation + : '!' + ; +GRW_Underscore + : '_' + ; +GRW_As + : 'as' + ; +GRW_Binary + : 'BINARY' + ; +GRW_Decimal + : 'DECIMAL' + ; +GRW_Exists + : 'exists' + ; +GRW_Hexadecimal + : 'HEXADECIMAL' + ; +GRW_Forall + : 'forall' + ; +GRW_Let + : 'let' + ; +GRW_Match + : 'match' + ; +GRW_Numeral + : 'NUMERAL' + ; +GRW_Par + : 'par' + ; +GRW_String + : 'string' + ; +GRW_FloatingPoint + : '_ FloatingPoint' + ; + + +Numeral + : '0' + | [1-9] Digit* + ; + +Binary + : '#b' BinaryDigit+ + ; + +HexDecimal + : '#x' HexDigit+ + ; + +Decimal + : Numeral '.' '0'* Numeral + ; + + +fragment HexDigit + : '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' + ; + + +Colon + : ':' + ; + +fragment Digit + : [0-9] + ; +fragment ShortFloats + : 'Float16' + | 'Float32' + | 'Float64' + | 'Float128' + ; + +fragment Sym + : 'a'..'z' + | 'A' .. 'Z' + | '+' + | '=' + | '/' + | '*' + | '%' + | '?' + | '!' + | '$' + | '-' + | '_' + | '~' + | '&' + | '^' + | '<' + | '>=' + | '<=' + | '>' + | '@' + | '.' + ; + + + +fragment BinaryDigit + : [01] + ; + +fragment PrintableChar + : '\u0020' .. '\u007E' + | '\u0080' .. '\uffff' + | EscapedSpace + ; + +fragment PrintableCharNoDquote + : '\u0020' .. '\u0021' + | '\u0023' .. '\u007E' + | '\u0080' .. '\uffff' + | EscapedSpace + ; + +fragment PrintableCharNoBackslash + : '\u0020' .. '\u005B' + | '\u005D' .. '\u007B' + | '\u007D' .. '\u007E' + | '\u0080' .. '\uffff' + | EscapedSpace + ; + +fragment EscapedSpace + : '""' + ; + +fragment WhiteSpaceChar + : '\u0009' + | '\u000A' + | '\u000D' + | Space + ; +fragment Space + : '\u0020' + ; +fragment SpaceChar + : [ \t\r\n] + | WhiteSpaceChar + ; + + +// Lexer Rules End + +// Predefined Keywords + +PK_AllStatistics + : ':all-statistics' + ; +PK_AssertionStackLevels + : ':assertion-stack-levels' + ; +PK_Authors + : ':authors' + ; +PK_Category + : ':category' + ; +PK_Chainable + : ':chainable' + ; +PK_Definition + : ':definition' + ; +PK_DiagnosticOutputChannel + : ':diagnostic-output-channel' + ; +PK_ErrorBehaviour + : ':error-behavior' + ; +PK_Extension + : ':extensions' + ; +PK_Funs + : ':funs' + ; +PK_FunsDescription + : ':funs-description' + ; +PK_GlobalDeclarations + : ':global-declarations' + ; +PK_InteractiveMode + : ':interactive-mode' + ; +PK_Language + : ':language' + ; +PK_LeftAssoc + : ':left-assoc' + ; +PK_License + : ':license' + ; +PK_Named + : ':named' + ; +PK_Name + : ':name' + ; +PK_Notes + : ':notes' + ; +PK_Pattern + : ':pattern' + ; +PK_PrintSuccess + : ':print-success' + ; +PK_ProduceAssertions + : ':produce-assertions' + ; +PK_ProduceAssignments + : ':produce-assignments' + ; +PK_ProduceModels + : ':produce-models' + ; +PK_ProduceProofs + : ':produce-proofs' + ; +PK_ProduceUnsatAssumptions + : ':produce-unsat-assumptions' + ; +PK_ProduceUnsatCores + : ':produce-unsat-cores' + ; +PK_RandomSeed + : ':random-seed' + ; +PK_ReasonUnknown + : ':reason-unknown' + ; +PK_RegularOutputChannel + : ':regular-output-channel' + ; +PK_ReproducibleResourceLimit + : ':reproducible-resource-limit' + ; +PK_RightAssoc + : ':right-assoc' + ; +PK_SmtLibVersion + : ':smt-lib-version' + ; +PK_Sorts + : ':sorts' + ; +PK_SortsDescription + : ':sorts-description' + ; +PK_Source + : ':source' + ; +PK_Status + : ':status' + ; +PK_Theories + : ':theories' + ; +PK_Values + : ':values' + ; +PK_Verbosity + : ':verbosity' + ; +PK_Version + : ':version' + ; + +RS_Model // for model responses + : 'model' + ; + +UndefinedSymbol: + Sym (Digit | Sym)*; + + +// Parser Rules Start + +// Starting rule(s) + +start + : logic EOF #start_logic + | theory_decl EOF #start_theory + | script EOF #start_script + | general_response EOF #start_gen_resp + ; + +generalReservedWord + : GRW_Exclamation + | GRW_Underscore + | GRW_As + | GRW_Binary + | GRW_Decimal + | GRW_Exists + | GRW_Hexadecimal + | GRW_Forall + | GRW_Let + | GRW_Match + | GRW_Numeral + | GRW_Par + | GRW_String + | RS_Model + ; + + +simpleSymbol + : predefSymbol #simp_pre_symb + | UndefinedSymbol #simp_undef_symb + ; + +quotedSymbol + : QuotedSymbol + ; + +predefSymbol + : PS_Not + | PS_Bool + | PS_ContinuedExecution + | PS_Error + | PS_False + | PS_ImmediateExit + | PS_Incomplete + | PS_Logic + | PS_Memout + | PS_Sat + | PS_Success + | PS_Theory + | PS_True + | PS_Unknown + | PS_Unsupported + | PS_Unsat + ; + +predefKeyword + : PK_AllStatistics + | PK_AssertionStackLevels + | PK_Authors + | PK_Category + | PK_Chainable + | PK_Definition + | PK_DiagnosticOutputChannel + | PK_ErrorBehaviour + | PK_Extension + | PK_Funs + | PK_FunsDescription + | PK_GlobalDeclarations + | PK_InteractiveMode + | PK_Language + | PK_LeftAssoc + | PK_License + | PK_Named + | PK_Name + | PK_Notes + | PK_Pattern + | PK_PrintSuccess + | PK_ProduceAssertions + | PK_ProduceAssignments + | PK_ProduceModels + | PK_ProduceProofs + | PK_ProduceUnsatAssumptions + | PK_ProduceUnsatCores + | PK_RandomSeed + | PK_ReasonUnknown + | PK_RegularOutputChannel + | PK_ReproducibleResourceLimit + | PK_RightAssoc + | PK_SmtLibVersion + | PK_Sorts + | PK_SortsDescription + | PK_Source + | PK_Status + | PK_Theories + | PK_Values + | PK_Verbosity + | PK_Version + ; + + + + +numeral + : Numeral + ; + +decimal + : Decimal + ; + +hexadecimal + : HexDecimal + ; + +binary + : Binary + ; + +string + : String + ; + + +to_fp_expr + : TO_FP_EXPR term ')' + | TO_FP_EXPR term term ')' + ; + +special_regex_operations + : RE_LOOP_EXPR term ')' + | RE_TIMES_EXPR term + ; + +keyword + : predefKeyword #pre_key + | Colon simpleSymbol #key_simsymb + ; + +symbol + : simpleSymbol #simpsymb + | quotedSymbol #quotsymb + ; + +// S-expression + +spec_constant + : numeral #spec_constant_num + | decimal #spec_constant_dec + | hexadecimal #spec_constant_hex + | binary #spec_constant_bin + | string #spec_constant_string + | FLOATING_POINT_NUMBER #spec_constant_fp + | REGEXVALUES #spec_constant_regex + ; + + +s_expr + : spec_constant #s_expr_spec + | symbol #s_expr_symb + | keyword #s_expr_key + | ParOpen s_expr* ParClose #multi_s_expr + ; + +// Identifiers + +index + : numeral #idx_num + | symbol #idx_symb + ; + +identifier + : symbol #id_symb + | ParOpen GRW_Underscore symbol index+ ParClose #id_symb_idx + ; + +// Attributes + +attribute_value + : spec_constant #attr_spec + | symbol #attr_symb + | ParOpen s_expr* ParClose #attr_s_expr + ; + +attribute + : keyword #attr_key + | keyword attribute_value #attr_key_attr + ; + +// Sorts + +sort + : FLOATING_POINT_SORT #sortfp + | identifier #sort_id + | ParOpen identifier sort+ ParClose #multisort + ; + + +// Terms and Formulas + +qual_identifer + : identifier #qual_id + | ParOpen GRW_As identifier sort ParClose #qual_id_sort + ; + +var_binding + : ParOpen symbol term ParClose + ; + +sorted_var + : ParOpen symbol sort ParClose + ; + +pattern + : symbol #pattern_symb + | ParOpen symbol symbol+ ParClose #pattern_multisymb + ; + +match_case + : ParOpen pattern term ParClose + ; + +term + : spec_constant #term_spec_const + | qual_identifer #term_qual_id + | to_fp_expr #term_fp_cast + | special_regex_operations #term_special_regex + | ParOpen qual_identifer term+ ParClose #multiterm + | ParOpen GRW_Let ParOpen var_binding+ ParClose term ParClose #term_let + | ParOpen GRW_Forall ParOpen sorted_var+ ParClose term ParClose #term_forall + | ParOpen GRW_Exists ParOpen sorted_var+ ParClose term ParClose #term_exists + | ParOpen GRW_Match term ParOpen match_case+ ParClose ParClose #term_match + | ParOpen GRW_Exclamation term attribute+ ParClose #term_exclam + ; + +sort_symbol_decl + : ParOpen identifier numeral attribute* ParClose; + +meta_spec_constant + : GRW_Numeral + | GRW_Decimal + | GRW_String + ; + +fun_symbol_decl + : ParOpen spec_constant sort attribute* ParClose #fun_symb_spec + | ParOpen meta_spec_constant sort attribute* ParClose #fun_symb_meta + | ParOpen identifier sort+ attribute* ParClose #fun_symb_id + ; + +par_fun_symbol_decl + : fun_symbol_decl #par_fun_symb + | ParOpen GRW_Par ParOpen symbol+ ParClose ParOpen identifier sort+ + attribute* ParClose ParClose #par_fun_multi_symb + ; + +theory_attribute + : PK_Sorts ParOpen sort_symbol_decl+ ParClose #theory_sort + | PK_Funs ParOpen par_fun_symbol_decl+ ParClose #theory_fun + | PK_SortsDescription string #theory_sort_descr + | PK_FunsDescription string #theory_fun_descr + | PK_Definition string #theory_def + | PK_Values string #theory_val + | PK_Notes string #theory_notes + | attribute #theory_attr + ; + +theory_decl + : ParOpen PS_Theory symbol theory_attribute+ ParClose + ; + + +// Logic Declarations + +logic_attribue + : PK_Theories ParOpen symbol+ ParClose #logic_theory + | PK_Language string #logic_language + | PK_Extension string #logic_ext + | PK_Values string #logic_val + | PK_Notes string #logic_notes + | attribute #logic_attr + ; + +logic + : ParOpen PS_Logic symbol logic_attribue+ ParClose + ; + + +// Scripts + +sort_dec + : ParOpen symbol numeral ParClose + ; + +selector_dec + : ParOpen symbol sort ParClose + ; + +constructor_dec + : ParOpen symbol selector_dec* ParClose + ; + +datatype_dec + : ParOpen constructor_dec+ ParClose #data_constr + | ParOpen GRW_Par ParOpen symbol+ ParClose ParOpen constructor_dec+ + ParClose ParClose #data_multisymb + ; + +function_dec + : ParOpen symbol ParOpen sorted_var* ParClose sort ParClose + ; + +function_def + : symbol ParOpen sorted_var* ParClose sort term + ; + +prop_literal + : symbol #prop_symb + | ParOpen PS_Not symbol ParClose #prop_not + ; + + +script + : command* + ; + +cmd_assert + : CMD_Assert term + ; + +cmd_checkSat + : CMD_CheckSat + ; + +cmd_checkSatAssuming + : CMD_CheckSatAssuming ParOpen prop_literal* ParClose + ; + +cmd_declareConst + : CMD_DeclareConst symbol sort + ; + +cmd_declareDatatype + : CMD_DeclareDatatype symbol datatype_dec + ; + +cmd_declareDatatypes + // cardinalitiees for sort_dec and datatype_dec have to be n+1 + : CMD_DeclareDatatypes ParOpen sort_dec+ ParClose ParOpen datatype_dec+ ParClose + ; + +cmd_declareFun + : CMD_DeclareFun symbol ParOpen sort* ParClose sort //here is where the fps need to be added + ; + +cmd_declareSort + : CMD_DeclareSort symbol numeral + ; + +cmd_defineFun + : CMD_DefineFun function_def + ; + +cmd_defineFunRec + : CMD_DefineFunRec function_def + ; + +cmd_defineFunsRec + // cardinalitiees for function_dec and term have to be n+1 + : CMD_DefineFunsRec ParOpen function_dec+ ParClose ParOpen term+ ParClose + ; + +cmd_defineSort + : CMD_DefineSort symbol ParOpen symbol* ParClose sort + ; + +cmd_echo + : CMD_Echo string + ; + +cmd_exit + : CMD_Exit + ; + +cmd_getAssertions + : CMD_GetAssertions + ; + +cmd_getAssignment + : CMD_GetAssignment + ; + +cmd_getInfo + : CMD_GetInfo info_flag + ; + +cmd_getModel + : CMD_GetModel + ; + +cmd_getOption + : CMD_GetOption keyword + ; + +cmd_getProof + : CMD_GetProof + ; + +cmd_getUnsatAssumptions + : CMD_GetUnsatAssumptions + ; + +cmd_getUnsatCore + : CMD_GetUnsatCore + ; + +cmd_getValue + : CMD_GetValue ParOpen term+ ParClose + ; + +cmd_pop + : CMD_Pop numeral + ; + +cmd_push + : CMD_Push numeral + ; + +cmd_reset + : CMD_Reset + ; + +cmd_resetAssertions + : CMD_ResetAssertions + ; + +cmd_setInfo + : CMD_SetInfo attribute + ; + +cmd_setLogic + : CMD_SetLogic symbol + ; + +cmd_setOption + : CMD_SetOption option + ; + +command + : ParOpen cmd_assert ParClose #assert + | ParOpen cmd_checkSat ParClose #check + | ParOpen cmd_checkSatAssuming ParClose #check_assume + | ParOpen cmd_declareConst ParClose #decl_const + | ParOpen cmd_declareDatatype ParClose #decl_data + | ParOpen cmd_declareDatatypes ParClose #decl_datas + | ParOpen cmd_declareFun ParClose #decl_fun + | ParOpen cmd_declareSort ParClose #decl_sort + | ParOpen cmd_defineFun ParClose #def_fun + | ParOpen cmd_defineFunRec ParClose #def_fun_rec + | ParOpen cmd_defineFunsRec ParClose #def_funs_rec + | ParOpen cmd_defineSort ParClose #def_sort + | ParOpen cmd_echo ParClose #echo + | ParOpen cmd_exit ParClose #exit + | ParOpen cmd_getAssertions ParClose #get_assert + | ParOpen cmd_getAssignment ParClose #get_assign + | ParOpen cmd_getInfo ParClose #get_info + | ParOpen cmd_getModel ParClose #get_model + | ParOpen cmd_getOption ParClose #get_option + | ParOpen cmd_getProof ParClose #get_proof + | ParOpen cmd_getUnsatAssumptions ParClose #get_unsat_assume + | ParOpen cmd_getUnsatCore ParClose #get_unsat_core + | ParOpen cmd_getValue ParClose #get_val + | ParOpen cmd_pop ParClose #pop + | ParOpen cmd_push ParClose #push + | ParOpen cmd_reset ParClose #reset + | ParOpen cmd_resetAssertions ParClose #reset_assert + | ParOpen cmd_setInfo ParClose #setInfo + | ParOpen cmd_setLogic ParClose #set_logic + | ParOpen cmd_setOption ParClose #set_option + ; + + +b_value + : PS_True + | PS_False + ; + +option + : PK_DiagnosticOutputChannel string #diagnose + | PK_GlobalDeclarations b_value #global + | PK_InteractiveMode b_value #interactive + | PK_PrintSuccess b_value #print_succ + | PK_ProduceAssertions b_value #prod_assert + | PK_ProduceAssignments b_value #prod_assign + | PK_ProduceModels b_value #prod_mod + | PK_ProduceProofs b_value #prod_proofs + | PK_ProduceUnsatAssumptions b_value #prod_unsat_assume + | PK_ProduceUnsatCores b_value #prod_unsat_core + | PK_RandomSeed numeral #rand_seed + | PK_RegularOutputChannel string #reg_out + | PK_ReproducibleResourceLimit numeral #repro + | PK_Verbosity numeral #verbose + | attribute #opt_attr + ; + +info_flag + : PK_AllStatistics #all_stat + | PK_AssertionStackLevels #assert_stack + | PK_Authors #authors + | PK_ErrorBehaviour #error + | PK_Name #name + | PK_ReasonUnknown #r_unknown + | PK_Version #version + | keyword #info_key + ; + +// responses + +error_behaviour + : PS_ImmediateExit + | PS_ContinuedExecution + ; + +reason_unknown + : PS_Memout #memout + | PS_Incomplete #incomp + | s_expr #r_unnown_s_expr + ; + +model_response + : ParOpen cmd_defineFun ParClose #resp_def_fun + | ParOpen cmd_defineFunRec ParClose #resp_def_fun_rec + | ParOpen cmd_defineFunsRec ParClose #resp_def_funs_rec + ; + +info_response + : PK_AssertionStackLevels numeral #info_assert_stack + | PK_Authors string #info_authors + | PK_ErrorBehaviour error_behaviour #info_error + | PK_Name string #info_name + | PK_ReasonUnknown reason_unknown #info_r_unknown + | PK_Version string #info_version + | attribute #info_attr + ; + +valuation_pair + : ParOpen term term ParClose + ; + +t_valuation_pair + : ParOpen symbol b_value ParClose + ; + +check_sat_response + : PS_Sat + | PS_Unsat + | PS_Unknown + ; + +echo_response + : string + ; + +get_assertions_response + : ParOpen term* ParClose + ; + +get_assignment_response + : ParOpen t_valuation_pair* ParClose + ; + +get_info_response + : ParOpen info_response+ ParClose + ; + +get_model_response + : ParOpen RS_Model model_response* ParClose #rs_model + | ParOpen model_response* ParClose #model_resp + ; + +get_option_response + : attribute_value + ; + +get_proof_response + : s_expr + ; + +get_unsat_assump_response + : ParOpen symbol* ParClose + ; + +get_unsat_core_response + : ParOpen symbol* ParClose + ; + +get_value_response + : ParOpen valuation_pair+ ParClose + ; + +specific_success_response + : check_sat_response #resp_check_sat + | echo_response #resp_echo + | get_assertions_response #resp_get_assert + | get_assignment_response #resp_gett_assign + | get_info_response #resp_get_info + | get_model_response #resp_get_model + | get_option_response #resp_option + | get_proof_response #resp_proof + | get_unsat_assump_response #resp_unsat_assume + | get_unsat_core_response #resp_unsat_core + | get_value_response #resp_value + ; + +general_response + : PS_Success #resp_success + | specific_success_response #resp_spec_successs + | PS_Unsupported #resp_unsupported + | ParOpen PS_Error string ParClose #resp_error + ; + + +// Parser Rules End + +WS : [ \t\r\n]+ -> skip + ; \ No newline at end of file diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2BaseListener.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2BaseListener.java new file mode 100644 index 0000000000..aca20fc037 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2BaseListener.java @@ -0,0 +1,3590 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2021 Alejandro SerranoMena +// +// SPDX-License-Identifier: Apache-2.0 + +// Generated from +// /home/davidg/IdeaProjects/java-smt-working-branch/java-smt/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 by ANTLR 4.13.2 +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.tree.ErrorNode; +import org.antlr.v4.runtime.tree.TerminalNode; + +/** + * This class provides an empty implementation of {@link Smtlibv2Listener}, which can be extended to + * create a listener which only needs to handle a subset of the available methods. + */ +@SuppressWarnings("CheckReturnValue") +public class Smtlibv2BaseListener implements Smtlibv2Listener { + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterStart_logic(Smtlibv2Parser.Start_logicContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitStart_logic(Smtlibv2Parser.Start_logicContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterStart_theory(Smtlibv2Parser.Start_theoryContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitStart_theory(Smtlibv2Parser.Start_theoryContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterStart_script(Smtlibv2Parser.Start_scriptContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitStart_script(Smtlibv2Parser.Start_scriptContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterStart_gen_resp(Smtlibv2Parser.Start_gen_respContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitStart_gen_resp(Smtlibv2Parser.Start_gen_respContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGeneralReservedWord(Smtlibv2Parser.GeneralReservedWordContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGeneralReservedWord(Smtlibv2Parser.GeneralReservedWordContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSimp_pre_symb(Smtlibv2Parser.Simp_pre_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSimp_pre_symb(Smtlibv2Parser.Simp_pre_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSimp_undef_symb(Smtlibv2Parser.Simp_undef_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSimp_undef_symb(Smtlibv2Parser.Simp_undef_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterQuotedSymbol(Smtlibv2Parser.QuotedSymbolContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitQuotedSymbol(Smtlibv2Parser.QuotedSymbolContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPredefSymbol(Smtlibv2Parser.PredefSymbolContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPredefSymbol(Smtlibv2Parser.PredefSymbolContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPredefKeyword(Smtlibv2Parser.PredefKeywordContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPredefKeyword(Smtlibv2Parser.PredefKeywordContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterNumeral(Smtlibv2Parser.NumeralContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitNumeral(Smtlibv2Parser.NumeralContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDecimal(Smtlibv2Parser.DecimalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDecimal(Smtlibv2Parser.DecimalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterHexadecimal(Smtlibv2Parser.HexadecimalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitHexadecimal(Smtlibv2Parser.HexadecimalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterBinary(Smtlibv2Parser.BinaryContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitBinary(Smtlibv2Parser.BinaryContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterString(Smtlibv2Parser.StringContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitString(Smtlibv2Parser.StringContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTo_fp_expr(Smtlibv2Parser.To_fp_exprContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTo_fp_expr(Smtlibv2Parser.To_fp_exprContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSpecial_regex_operations(Smtlibv2Parser.Special_regex_operationsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSpecial_regex_operations(Smtlibv2Parser.Special_regex_operationsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPre_key(Smtlibv2Parser.Pre_keyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPre_key(Smtlibv2Parser.Pre_keyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterKey_simsymb(Smtlibv2Parser.Key_simsymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitKey_simsymb(Smtlibv2Parser.Key_simsymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSimpsymb(Smtlibv2Parser.SimpsymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSimpsymb(Smtlibv2Parser.SimpsymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterQuotsymb(Smtlibv2Parser.QuotsymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitQuotsymb(Smtlibv2Parser.QuotsymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSpec_constant_num(Smtlibv2Parser.Spec_constant_numContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSpec_constant_num(Smtlibv2Parser.Spec_constant_numContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSpec_constant_dec(Smtlibv2Parser.Spec_constant_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSpec_constant_dec(Smtlibv2Parser.Spec_constant_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSpec_constant_hex(Smtlibv2Parser.Spec_constant_hexContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSpec_constant_hex(Smtlibv2Parser.Spec_constant_hexContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSpec_constant_bin(Smtlibv2Parser.Spec_constant_binContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSpec_constant_bin(Smtlibv2Parser.Spec_constant_binContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSpec_constant_string(Smtlibv2Parser.Spec_constant_stringContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSpec_constant_string(Smtlibv2Parser.Spec_constant_stringContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSpec_constant_fp(Smtlibv2Parser.Spec_constant_fpContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSpec_constant_fp(Smtlibv2Parser.Spec_constant_fpContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSpec_constant_regex(Smtlibv2Parser.Spec_constant_regexContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSpec_constant_regex(Smtlibv2Parser.Spec_constant_regexContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterS_expr_spec(Smtlibv2Parser.S_expr_specContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitS_expr_spec(Smtlibv2Parser.S_expr_specContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterS_expr_symb(Smtlibv2Parser.S_expr_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitS_expr_symb(Smtlibv2Parser.S_expr_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterS_expr_key(Smtlibv2Parser.S_expr_keyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitS_expr_key(Smtlibv2Parser.S_expr_keyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterMulti_s_expr(Smtlibv2Parser.Multi_s_exprContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitMulti_s_expr(Smtlibv2Parser.Multi_s_exprContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterIdx_num(Smtlibv2Parser.Idx_numContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitIdx_num(Smtlibv2Parser.Idx_numContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterIdx_symb(Smtlibv2Parser.Idx_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitIdx_symb(Smtlibv2Parser.Idx_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterId_symb(Smtlibv2Parser.Id_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitId_symb(Smtlibv2Parser.Id_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterId_symb_idx(Smtlibv2Parser.Id_symb_idxContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitId_symb_idx(Smtlibv2Parser.Id_symb_idxContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAttr_spec(Smtlibv2Parser.Attr_specContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAttr_spec(Smtlibv2Parser.Attr_specContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAttr_symb(Smtlibv2Parser.Attr_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAttr_symb(Smtlibv2Parser.Attr_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAttr_s_expr(Smtlibv2Parser.Attr_s_exprContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAttr_s_expr(Smtlibv2Parser.Attr_s_exprContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAttr_key(Smtlibv2Parser.Attr_keyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAttr_key(Smtlibv2Parser.Attr_keyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAttr_key_attr(Smtlibv2Parser.Attr_key_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAttr_key_attr(Smtlibv2Parser.Attr_key_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSortfp(Smtlibv2Parser.SortfpContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSortfp(Smtlibv2Parser.SortfpContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSort_id(Smtlibv2Parser.Sort_idContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSort_id(Smtlibv2Parser.Sort_idContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterMultisort(Smtlibv2Parser.MultisortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitMultisort(Smtlibv2Parser.MultisortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterQual_id(Smtlibv2Parser.Qual_idContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitQual_id(Smtlibv2Parser.Qual_idContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterQual_id_sort(Smtlibv2Parser.Qual_id_sortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitQual_id_sort(Smtlibv2Parser.Qual_id_sortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterVar_binding(Smtlibv2Parser.Var_bindingContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitVar_binding(Smtlibv2Parser.Var_bindingContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSorted_var(Smtlibv2Parser.Sorted_varContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSorted_var(Smtlibv2Parser.Sorted_varContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPattern_symb(Smtlibv2Parser.Pattern_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPattern_symb(Smtlibv2Parser.Pattern_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPattern_multisymb(Smtlibv2Parser.Pattern_multisymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPattern_multisymb(Smtlibv2Parser.Pattern_multisymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterMatch_case(Smtlibv2Parser.Match_caseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitMatch_case(Smtlibv2Parser.Match_caseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_spec_const(Smtlibv2Parser.Term_spec_constContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_spec_const(Smtlibv2Parser.Term_spec_constContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_qual_id(Smtlibv2Parser.Term_qual_idContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_qual_id(Smtlibv2Parser.Term_qual_idContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_fp_cast(Smtlibv2Parser.Term_fp_castContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_fp_cast(Smtlibv2Parser.Term_fp_castContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_special_regex(Smtlibv2Parser.Term_special_regexContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_special_regex(Smtlibv2Parser.Term_special_regexContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterMultiterm(Smtlibv2Parser.MultitermContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitMultiterm(Smtlibv2Parser.MultitermContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_let(Smtlibv2Parser.Term_letContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_let(Smtlibv2Parser.Term_letContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_forall(Smtlibv2Parser.Term_forallContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_forall(Smtlibv2Parser.Term_forallContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_exists(Smtlibv2Parser.Term_existsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_exists(Smtlibv2Parser.Term_existsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_match(Smtlibv2Parser.Term_matchContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_match(Smtlibv2Parser.Term_matchContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTerm_exclam(Smtlibv2Parser.Term_exclamContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTerm_exclam(Smtlibv2Parser.Term_exclamContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSort_symbol_decl(Smtlibv2Parser.Sort_symbol_declContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSort_symbol_decl(Smtlibv2Parser.Sort_symbol_declContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterMeta_spec_constant(Smtlibv2Parser.Meta_spec_constantContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitMeta_spec_constant(Smtlibv2Parser.Meta_spec_constantContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterFun_symb_spec(Smtlibv2Parser.Fun_symb_specContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitFun_symb_spec(Smtlibv2Parser.Fun_symb_specContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterFun_symb_meta(Smtlibv2Parser.Fun_symb_metaContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitFun_symb_meta(Smtlibv2Parser.Fun_symb_metaContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterFun_symb_id(Smtlibv2Parser.Fun_symb_idContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitFun_symb_id(Smtlibv2Parser.Fun_symb_idContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPar_fun_symb(Smtlibv2Parser.Par_fun_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPar_fun_symb(Smtlibv2Parser.Par_fun_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPar_fun_multi_symb(Smtlibv2Parser.Par_fun_multi_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPar_fun_multi_symb(Smtlibv2Parser.Par_fun_multi_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_sort(Smtlibv2Parser.Theory_sortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_sort(Smtlibv2Parser.Theory_sortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_fun(Smtlibv2Parser.Theory_funContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_fun(Smtlibv2Parser.Theory_funContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_sort_descr(Smtlibv2Parser.Theory_sort_descrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_sort_descr(Smtlibv2Parser.Theory_sort_descrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_fun_descr(Smtlibv2Parser.Theory_fun_descrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_fun_descr(Smtlibv2Parser.Theory_fun_descrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_def(Smtlibv2Parser.Theory_defContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_def(Smtlibv2Parser.Theory_defContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_val(Smtlibv2Parser.Theory_valContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_val(Smtlibv2Parser.Theory_valContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_notes(Smtlibv2Parser.Theory_notesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_notes(Smtlibv2Parser.Theory_notesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_attr(Smtlibv2Parser.Theory_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_attr(Smtlibv2Parser.Theory_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterTheory_decl(Smtlibv2Parser.Theory_declContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitTheory_decl(Smtlibv2Parser.Theory_declContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterLogic_theory(Smtlibv2Parser.Logic_theoryContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitLogic_theory(Smtlibv2Parser.Logic_theoryContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterLogic_language(Smtlibv2Parser.Logic_languageContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitLogic_language(Smtlibv2Parser.Logic_languageContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterLogic_ext(Smtlibv2Parser.Logic_extContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitLogic_ext(Smtlibv2Parser.Logic_extContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterLogic_val(Smtlibv2Parser.Logic_valContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitLogic_val(Smtlibv2Parser.Logic_valContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterLogic_notes(Smtlibv2Parser.Logic_notesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitLogic_notes(Smtlibv2Parser.Logic_notesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterLogic_attr(Smtlibv2Parser.Logic_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitLogic_attr(Smtlibv2Parser.Logic_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterLogic(Smtlibv2Parser.LogicContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitLogic(Smtlibv2Parser.LogicContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSort_dec(Smtlibv2Parser.Sort_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSort_dec(Smtlibv2Parser.Sort_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSelector_dec(Smtlibv2Parser.Selector_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSelector_dec(Smtlibv2Parser.Selector_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterConstructor_dec(Smtlibv2Parser.Constructor_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitConstructor_dec(Smtlibv2Parser.Constructor_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterData_constr(Smtlibv2Parser.Data_constrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitData_constr(Smtlibv2Parser.Data_constrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterData_multisymb(Smtlibv2Parser.Data_multisymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitData_multisymb(Smtlibv2Parser.Data_multisymbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterFunction_dec(Smtlibv2Parser.Function_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitFunction_dec(Smtlibv2Parser.Function_decContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterFunction_def(Smtlibv2Parser.Function_defContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitFunction_def(Smtlibv2Parser.Function_defContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterProp_symb(Smtlibv2Parser.Prop_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitProp_symb(Smtlibv2Parser.Prop_symbContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterProp_not(Smtlibv2Parser.Prop_notContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitProp_not(Smtlibv2Parser.Prop_notContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterScript(Smtlibv2Parser.ScriptContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitScript(Smtlibv2Parser.ScriptContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_assert(Smtlibv2Parser.Cmd_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_assert(Smtlibv2Parser.Cmd_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_checkSat(Smtlibv2Parser.Cmd_checkSatContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_checkSat(Smtlibv2Parser.Cmd_checkSatContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_checkSatAssuming(Smtlibv2Parser.Cmd_checkSatAssumingContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_checkSatAssuming(Smtlibv2Parser.Cmd_checkSatAssumingContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_declareConst(Smtlibv2Parser.Cmd_declareConstContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_declareConst(Smtlibv2Parser.Cmd_declareConstContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_declareDatatype(Smtlibv2Parser.Cmd_declareDatatypeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_declareDatatype(Smtlibv2Parser.Cmd_declareDatatypeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_declareDatatypes(Smtlibv2Parser.Cmd_declareDatatypesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_declareDatatypes(Smtlibv2Parser.Cmd_declareDatatypesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_declareFun(Smtlibv2Parser.Cmd_declareFunContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_declareFun(Smtlibv2Parser.Cmd_declareFunContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_declareSort(Smtlibv2Parser.Cmd_declareSortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_declareSort(Smtlibv2Parser.Cmd_declareSortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_defineFun(Smtlibv2Parser.Cmd_defineFunContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_defineFun(Smtlibv2Parser.Cmd_defineFunContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_defineFunRec(Smtlibv2Parser.Cmd_defineFunRecContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_defineFunRec(Smtlibv2Parser.Cmd_defineFunRecContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_defineFunsRec(Smtlibv2Parser.Cmd_defineFunsRecContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_defineFunsRec(Smtlibv2Parser.Cmd_defineFunsRecContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_defineSort(Smtlibv2Parser.Cmd_defineSortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_defineSort(Smtlibv2Parser.Cmd_defineSortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_echo(Smtlibv2Parser.Cmd_echoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_echo(Smtlibv2Parser.Cmd_echoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_exit(Smtlibv2Parser.Cmd_exitContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_exit(Smtlibv2Parser.Cmd_exitContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getAssertions(Smtlibv2Parser.Cmd_getAssertionsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getAssertions(Smtlibv2Parser.Cmd_getAssertionsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getAssignment(Smtlibv2Parser.Cmd_getAssignmentContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getAssignment(Smtlibv2Parser.Cmd_getAssignmentContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getInfo(Smtlibv2Parser.Cmd_getInfoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getInfo(Smtlibv2Parser.Cmd_getInfoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getModel(Smtlibv2Parser.Cmd_getModelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getModel(Smtlibv2Parser.Cmd_getModelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getOption(Smtlibv2Parser.Cmd_getOptionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getOption(Smtlibv2Parser.Cmd_getOptionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getProof(Smtlibv2Parser.Cmd_getProofContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getProof(Smtlibv2Parser.Cmd_getProofContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getUnsatAssumptions(Smtlibv2Parser.Cmd_getUnsatAssumptionsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getUnsatAssumptions(Smtlibv2Parser.Cmd_getUnsatAssumptionsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getUnsatCore(Smtlibv2Parser.Cmd_getUnsatCoreContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getUnsatCore(Smtlibv2Parser.Cmd_getUnsatCoreContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_getValue(Smtlibv2Parser.Cmd_getValueContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_getValue(Smtlibv2Parser.Cmd_getValueContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_pop(Smtlibv2Parser.Cmd_popContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_pop(Smtlibv2Parser.Cmd_popContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_push(Smtlibv2Parser.Cmd_pushContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_push(Smtlibv2Parser.Cmd_pushContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_reset(Smtlibv2Parser.Cmd_resetContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_reset(Smtlibv2Parser.Cmd_resetContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_resetAssertions(Smtlibv2Parser.Cmd_resetAssertionsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_resetAssertions(Smtlibv2Parser.Cmd_resetAssertionsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_setInfo(Smtlibv2Parser.Cmd_setInfoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_setInfo(Smtlibv2Parser.Cmd_setInfoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_setLogic(Smtlibv2Parser.Cmd_setLogicContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_setLogic(Smtlibv2Parser.Cmd_setLogicContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCmd_setOption(Smtlibv2Parser.Cmd_setOptionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCmd_setOption(Smtlibv2Parser.Cmd_setOptionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAssert(Smtlibv2Parser.AssertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAssert(Smtlibv2Parser.AssertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCheck(Smtlibv2Parser.CheckContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCheck(Smtlibv2Parser.CheckContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCheck_assume(Smtlibv2Parser.Check_assumeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCheck_assume(Smtlibv2Parser.Check_assumeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDecl_const(Smtlibv2Parser.Decl_constContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDecl_const(Smtlibv2Parser.Decl_constContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDecl_data(Smtlibv2Parser.Decl_dataContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDecl_data(Smtlibv2Parser.Decl_dataContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDecl_datas(Smtlibv2Parser.Decl_datasContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDecl_datas(Smtlibv2Parser.Decl_datasContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDecl_fun(Smtlibv2Parser.Decl_funContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDecl_fun(Smtlibv2Parser.Decl_funContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDecl_sort(Smtlibv2Parser.Decl_sortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDecl_sort(Smtlibv2Parser.Decl_sortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDef_fun(Smtlibv2Parser.Def_funContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDef_fun(Smtlibv2Parser.Def_funContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDef_fun_rec(Smtlibv2Parser.Def_fun_recContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDef_fun_rec(Smtlibv2Parser.Def_fun_recContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDef_funs_rec(Smtlibv2Parser.Def_funs_recContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDef_funs_rec(Smtlibv2Parser.Def_funs_recContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDef_sort(Smtlibv2Parser.Def_sortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDef_sort(Smtlibv2Parser.Def_sortContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterEcho(Smtlibv2Parser.EchoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitEcho(Smtlibv2Parser.EchoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterExit(Smtlibv2Parser.ExitContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitExit(Smtlibv2Parser.ExitContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_assert(Smtlibv2Parser.Get_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_assert(Smtlibv2Parser.Get_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_assign(Smtlibv2Parser.Get_assignContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_assign(Smtlibv2Parser.Get_assignContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_info(Smtlibv2Parser.Get_infoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_info(Smtlibv2Parser.Get_infoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_model(Smtlibv2Parser.Get_modelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_model(Smtlibv2Parser.Get_modelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_option(Smtlibv2Parser.Get_optionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_option(Smtlibv2Parser.Get_optionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_proof(Smtlibv2Parser.Get_proofContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_proof(Smtlibv2Parser.Get_proofContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_unsat_assume(Smtlibv2Parser.Get_unsat_assumeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_unsat_assume(Smtlibv2Parser.Get_unsat_assumeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_unsat_core(Smtlibv2Parser.Get_unsat_coreContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_unsat_core(Smtlibv2Parser.Get_unsat_coreContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_val(Smtlibv2Parser.Get_valContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_val(Smtlibv2Parser.Get_valContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPop(Smtlibv2Parser.PopContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPop(Smtlibv2Parser.PopContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPush(Smtlibv2Parser.PushContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPush(Smtlibv2Parser.PushContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterReset(Smtlibv2Parser.ResetContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitReset(Smtlibv2Parser.ResetContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterReset_assert(Smtlibv2Parser.Reset_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitReset_assert(Smtlibv2Parser.Reset_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSetInfo(Smtlibv2Parser.SetInfoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSetInfo(Smtlibv2Parser.SetInfoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSet_logic(Smtlibv2Parser.Set_logicContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSet_logic(Smtlibv2Parser.Set_logicContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterSet_option(Smtlibv2Parser.Set_optionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitSet_option(Smtlibv2Parser.Set_optionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterB_value(Smtlibv2Parser.B_valueContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitB_value(Smtlibv2Parser.B_valueContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterDiagnose(Smtlibv2Parser.DiagnoseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitDiagnose(Smtlibv2Parser.DiagnoseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGlobal(Smtlibv2Parser.GlobalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGlobal(Smtlibv2Parser.GlobalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInteractive(Smtlibv2Parser.InteractiveContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInteractive(Smtlibv2Parser.InteractiveContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterPrint_succ(Smtlibv2Parser.Print_succContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitPrint_succ(Smtlibv2Parser.Print_succContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterProd_assert(Smtlibv2Parser.Prod_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitProd_assert(Smtlibv2Parser.Prod_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterProd_assign(Smtlibv2Parser.Prod_assignContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitProd_assign(Smtlibv2Parser.Prod_assignContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterProd_mod(Smtlibv2Parser.Prod_modContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitProd_mod(Smtlibv2Parser.Prod_modContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterProd_proofs(Smtlibv2Parser.Prod_proofsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitProd_proofs(Smtlibv2Parser.Prod_proofsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterProd_unsat_assume(Smtlibv2Parser.Prod_unsat_assumeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitProd_unsat_assume(Smtlibv2Parser.Prod_unsat_assumeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterProd_unsat_core(Smtlibv2Parser.Prod_unsat_coreContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitProd_unsat_core(Smtlibv2Parser.Prod_unsat_coreContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterRand_seed(Smtlibv2Parser.Rand_seedContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitRand_seed(Smtlibv2Parser.Rand_seedContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterReg_out(Smtlibv2Parser.Reg_outContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitReg_out(Smtlibv2Parser.Reg_outContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterRepro(Smtlibv2Parser.ReproContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitRepro(Smtlibv2Parser.ReproContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterVerbose(Smtlibv2Parser.VerboseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitVerbose(Smtlibv2Parser.VerboseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterOpt_attr(Smtlibv2Parser.Opt_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitOpt_attr(Smtlibv2Parser.Opt_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAll_stat(Smtlibv2Parser.All_statContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAll_stat(Smtlibv2Parser.All_statContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAssert_stack(Smtlibv2Parser.Assert_stackContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAssert_stack(Smtlibv2Parser.Assert_stackContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterAuthors(Smtlibv2Parser.AuthorsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitAuthors(Smtlibv2Parser.AuthorsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterError(Smtlibv2Parser.ErrorContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitError(Smtlibv2Parser.ErrorContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterName(Smtlibv2Parser.NameContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitName(Smtlibv2Parser.NameContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterR_unknown(Smtlibv2Parser.R_unknownContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitR_unknown(Smtlibv2Parser.R_unknownContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterVersion(Smtlibv2Parser.VersionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitVersion(Smtlibv2Parser.VersionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInfo_key(Smtlibv2Parser.Info_keyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInfo_key(Smtlibv2Parser.Info_keyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterError_behaviour(Smtlibv2Parser.Error_behaviourContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitError_behaviour(Smtlibv2Parser.Error_behaviourContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterMemout(Smtlibv2Parser.MemoutContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitMemout(Smtlibv2Parser.MemoutContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterIncomp(Smtlibv2Parser.IncompContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitIncomp(Smtlibv2Parser.IncompContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterR_unnown_s_expr(Smtlibv2Parser.R_unnown_s_exprContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitR_unnown_s_expr(Smtlibv2Parser.R_unnown_s_exprContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_def_fun(Smtlibv2Parser.Resp_def_funContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_def_fun(Smtlibv2Parser.Resp_def_funContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_def_fun_rec(Smtlibv2Parser.Resp_def_fun_recContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_def_fun_rec(Smtlibv2Parser.Resp_def_fun_recContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_def_funs_rec(Smtlibv2Parser.Resp_def_funs_recContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_def_funs_rec(Smtlibv2Parser.Resp_def_funs_recContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInfo_assert_stack(Smtlibv2Parser.Info_assert_stackContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInfo_assert_stack(Smtlibv2Parser.Info_assert_stackContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInfo_authors(Smtlibv2Parser.Info_authorsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInfo_authors(Smtlibv2Parser.Info_authorsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInfo_error(Smtlibv2Parser.Info_errorContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInfo_error(Smtlibv2Parser.Info_errorContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInfo_name(Smtlibv2Parser.Info_nameContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInfo_name(Smtlibv2Parser.Info_nameContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInfo_r_unknown(Smtlibv2Parser.Info_r_unknownContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInfo_r_unknown(Smtlibv2Parser.Info_r_unknownContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInfo_version(Smtlibv2Parser.Info_versionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInfo_version(Smtlibv2Parser.Info_versionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterInfo_attr(Smtlibv2Parser.Info_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitInfo_attr(Smtlibv2Parser.Info_attrContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterValuation_pair(Smtlibv2Parser.Valuation_pairContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitValuation_pair(Smtlibv2Parser.Valuation_pairContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterT_valuation_pair(Smtlibv2Parser.T_valuation_pairContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitT_valuation_pair(Smtlibv2Parser.T_valuation_pairContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterCheck_sat_response(Smtlibv2Parser.Check_sat_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitCheck_sat_response(Smtlibv2Parser.Check_sat_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterEcho_response(Smtlibv2Parser.Echo_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitEcho_response(Smtlibv2Parser.Echo_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_assertions_response(Smtlibv2Parser.Get_assertions_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_assertions_response(Smtlibv2Parser.Get_assertions_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_assignment_response(Smtlibv2Parser.Get_assignment_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_assignment_response(Smtlibv2Parser.Get_assignment_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_info_response(Smtlibv2Parser.Get_info_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_info_response(Smtlibv2Parser.Get_info_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterRs_model(Smtlibv2Parser.Rs_modelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitRs_model(Smtlibv2Parser.Rs_modelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterModel_resp(Smtlibv2Parser.Model_respContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitModel_resp(Smtlibv2Parser.Model_respContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_option_response(Smtlibv2Parser.Get_option_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_option_response(Smtlibv2Parser.Get_option_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_proof_response(Smtlibv2Parser.Get_proof_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_proof_response(Smtlibv2Parser.Get_proof_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_unsat_assump_response(Smtlibv2Parser.Get_unsat_assump_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_unsat_assump_response(Smtlibv2Parser.Get_unsat_assump_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_unsat_core_response(Smtlibv2Parser.Get_unsat_core_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_unsat_core_response(Smtlibv2Parser.Get_unsat_core_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterGet_value_response(Smtlibv2Parser.Get_value_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitGet_value_response(Smtlibv2Parser.Get_value_responseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_check_sat(Smtlibv2Parser.Resp_check_satContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_check_sat(Smtlibv2Parser.Resp_check_satContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_echo(Smtlibv2Parser.Resp_echoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_echo(Smtlibv2Parser.Resp_echoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_get_assert(Smtlibv2Parser.Resp_get_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_get_assert(Smtlibv2Parser.Resp_get_assertContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_gett_assign(Smtlibv2Parser.Resp_gett_assignContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_gett_assign(Smtlibv2Parser.Resp_gett_assignContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_get_info(Smtlibv2Parser.Resp_get_infoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_get_info(Smtlibv2Parser.Resp_get_infoContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_get_model(Smtlibv2Parser.Resp_get_modelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_get_model(Smtlibv2Parser.Resp_get_modelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_option(Smtlibv2Parser.Resp_optionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_option(Smtlibv2Parser.Resp_optionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_proof(Smtlibv2Parser.Resp_proofContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_proof(Smtlibv2Parser.Resp_proofContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_unsat_assume(Smtlibv2Parser.Resp_unsat_assumeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_unsat_assume(Smtlibv2Parser.Resp_unsat_assumeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_unsat_core(Smtlibv2Parser.Resp_unsat_coreContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_unsat_core(Smtlibv2Parser.Resp_unsat_coreContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_value(Smtlibv2Parser.Resp_valueContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_value(Smtlibv2Parser.Resp_valueContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_success(Smtlibv2Parser.Resp_successContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_success(Smtlibv2Parser.Resp_successContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_spec_successs(Smtlibv2Parser.Resp_spec_successsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_spec_successs(Smtlibv2Parser.Resp_spec_successsContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_unsupported(Smtlibv2Parser.Resp_unsupportedContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_unsupported(Smtlibv2Parser.Resp_unsupportedContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterResp_error(Smtlibv2Parser.Resp_errorContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitResp_error(Smtlibv2Parser.Resp_errorContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void enterEveryRule(ParserRuleContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void exitEveryRule(ParserRuleContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void visitTerminal(TerminalNode node) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing. + */ + @Override + public void visitErrorNode(ErrorNode node) {} +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2BaseVisitor.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2BaseVisitor.java new file mode 100644 index 0000000000..8f17ff46af --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2BaseVisitor.java @@ -0,0 +1,2455 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2021 Alejandro SerranoMena +// +// SPDX-License-Identifier: Apache-2.0 + +// Generated from +// /home/davidg/IdeaProjects/java-smt-working-branch/java-smt/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 by ANTLR 4.13.2 +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; + +/** + * This class provides an empty implementation of {@link Smtlibv2Visitor}, which can be extended to + * create a visitor which only needs to handle a subset of the available methods. + * + * @param The return type of the visit operation. Use {@link Void} for operations with no return + * type. + */ +@SuppressWarnings("CheckReturnValue") +public class Smtlibv2BaseVisitor extends AbstractParseTreeVisitor + implements Smtlibv2Visitor { + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitStart_logic(Smtlibv2Parser.Start_logicContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitStart_theory(Smtlibv2Parser.Start_theoryContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitStart_script(Smtlibv2Parser.Start_scriptContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitStart_gen_resp(Smtlibv2Parser.Start_gen_respContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGeneralReservedWord(Smtlibv2Parser.GeneralReservedWordContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSimp_pre_symb(Smtlibv2Parser.Simp_pre_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSimp_undef_symb(Smtlibv2Parser.Simp_undef_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitQuotedSymbol(Smtlibv2Parser.QuotedSymbolContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPredefSymbol(Smtlibv2Parser.PredefSymbolContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPredefKeyword(Smtlibv2Parser.PredefKeywordContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitNumeral(Smtlibv2Parser.NumeralContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDecimal(Smtlibv2Parser.DecimalContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitHexadecimal(Smtlibv2Parser.HexadecimalContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitBinary(Smtlibv2Parser.BinaryContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitString(Smtlibv2Parser.StringContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTo_fp_expr(Smtlibv2Parser.To_fp_exprContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSpecial_regex_operations(Smtlibv2Parser.Special_regex_operationsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPre_key(Smtlibv2Parser.Pre_keyContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitKey_simsymb(Smtlibv2Parser.Key_simsymbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSimpsymb(Smtlibv2Parser.SimpsymbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitQuotsymb(Smtlibv2Parser.QuotsymbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSpec_constant_num(Smtlibv2Parser.Spec_constant_numContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSpec_constant_dec(Smtlibv2Parser.Spec_constant_decContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSpec_constant_hex(Smtlibv2Parser.Spec_constant_hexContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSpec_constant_bin(Smtlibv2Parser.Spec_constant_binContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSpec_constant_string(Smtlibv2Parser.Spec_constant_stringContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSpec_constant_fp(Smtlibv2Parser.Spec_constant_fpContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSpec_constant_regex(Smtlibv2Parser.Spec_constant_regexContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitS_expr_spec(Smtlibv2Parser.S_expr_specContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitS_expr_symb(Smtlibv2Parser.S_expr_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitS_expr_key(Smtlibv2Parser.S_expr_keyContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitMulti_s_expr(Smtlibv2Parser.Multi_s_exprContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitIdx_num(Smtlibv2Parser.Idx_numContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitIdx_symb(Smtlibv2Parser.Idx_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitId_symb(Smtlibv2Parser.Id_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitId_symb_idx(Smtlibv2Parser.Id_symb_idxContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAttr_spec(Smtlibv2Parser.Attr_specContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAttr_symb(Smtlibv2Parser.Attr_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAttr_s_expr(Smtlibv2Parser.Attr_s_exprContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAttr_key(Smtlibv2Parser.Attr_keyContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAttr_key_attr(Smtlibv2Parser.Attr_key_attrContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSortfp(Smtlibv2Parser.SortfpContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSort_id(Smtlibv2Parser.Sort_idContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitMultisort(Smtlibv2Parser.MultisortContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitQual_id(Smtlibv2Parser.Qual_idContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitQual_id_sort(Smtlibv2Parser.Qual_id_sortContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitVar_binding(Smtlibv2Parser.Var_bindingContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSorted_var(Smtlibv2Parser.Sorted_varContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPattern_symb(Smtlibv2Parser.Pattern_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPattern_multisymb(Smtlibv2Parser.Pattern_multisymbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitMatch_case(Smtlibv2Parser.Match_caseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_spec_const(Smtlibv2Parser.Term_spec_constContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_qual_id(Smtlibv2Parser.Term_qual_idContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_fp_cast(Smtlibv2Parser.Term_fp_castContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_special_regex(Smtlibv2Parser.Term_special_regexContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitMultiterm(Smtlibv2Parser.MultitermContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_let(Smtlibv2Parser.Term_letContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_forall(Smtlibv2Parser.Term_forallContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_exists(Smtlibv2Parser.Term_existsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_match(Smtlibv2Parser.Term_matchContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTerm_exclam(Smtlibv2Parser.Term_exclamContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSort_symbol_decl(Smtlibv2Parser.Sort_symbol_declContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitMeta_spec_constant(Smtlibv2Parser.Meta_spec_constantContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitFun_symb_spec(Smtlibv2Parser.Fun_symb_specContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitFun_symb_meta(Smtlibv2Parser.Fun_symb_metaContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitFun_symb_id(Smtlibv2Parser.Fun_symb_idContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPar_fun_symb(Smtlibv2Parser.Par_fun_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPar_fun_multi_symb(Smtlibv2Parser.Par_fun_multi_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_sort(Smtlibv2Parser.Theory_sortContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_fun(Smtlibv2Parser.Theory_funContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_sort_descr(Smtlibv2Parser.Theory_sort_descrContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_fun_descr(Smtlibv2Parser.Theory_fun_descrContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_def(Smtlibv2Parser.Theory_defContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_val(Smtlibv2Parser.Theory_valContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_notes(Smtlibv2Parser.Theory_notesContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_attr(Smtlibv2Parser.Theory_attrContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitTheory_decl(Smtlibv2Parser.Theory_declContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitLogic_theory(Smtlibv2Parser.Logic_theoryContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitLogic_language(Smtlibv2Parser.Logic_languageContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitLogic_ext(Smtlibv2Parser.Logic_extContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitLogic_val(Smtlibv2Parser.Logic_valContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitLogic_notes(Smtlibv2Parser.Logic_notesContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitLogic_attr(Smtlibv2Parser.Logic_attrContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitLogic(Smtlibv2Parser.LogicContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSort_dec(Smtlibv2Parser.Sort_decContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSelector_dec(Smtlibv2Parser.Selector_decContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitConstructor_dec(Smtlibv2Parser.Constructor_decContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitData_constr(Smtlibv2Parser.Data_constrContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitData_multisymb(Smtlibv2Parser.Data_multisymbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitFunction_dec(Smtlibv2Parser.Function_decContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitFunction_def(Smtlibv2Parser.Function_defContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitProp_symb(Smtlibv2Parser.Prop_symbContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitProp_not(Smtlibv2Parser.Prop_notContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitScript(Smtlibv2Parser.ScriptContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_assert(Smtlibv2Parser.Cmd_assertContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_checkSat(Smtlibv2Parser.Cmd_checkSatContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_checkSatAssuming(Smtlibv2Parser.Cmd_checkSatAssumingContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_declareConst(Smtlibv2Parser.Cmd_declareConstContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_declareDatatype(Smtlibv2Parser.Cmd_declareDatatypeContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_declareDatatypes(Smtlibv2Parser.Cmd_declareDatatypesContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_declareFun(Smtlibv2Parser.Cmd_declareFunContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_declareSort(Smtlibv2Parser.Cmd_declareSortContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_defineFun(Smtlibv2Parser.Cmd_defineFunContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_defineFunRec(Smtlibv2Parser.Cmd_defineFunRecContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_defineFunsRec(Smtlibv2Parser.Cmd_defineFunsRecContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_defineSort(Smtlibv2Parser.Cmd_defineSortContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_echo(Smtlibv2Parser.Cmd_echoContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_exit(Smtlibv2Parser.Cmd_exitContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getAssertions(Smtlibv2Parser.Cmd_getAssertionsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getAssignment(Smtlibv2Parser.Cmd_getAssignmentContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getInfo(Smtlibv2Parser.Cmd_getInfoContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getModel(Smtlibv2Parser.Cmd_getModelContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getOption(Smtlibv2Parser.Cmd_getOptionContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getProof(Smtlibv2Parser.Cmd_getProofContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getUnsatAssumptions(Smtlibv2Parser.Cmd_getUnsatAssumptionsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getUnsatCore(Smtlibv2Parser.Cmd_getUnsatCoreContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_getValue(Smtlibv2Parser.Cmd_getValueContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_pop(Smtlibv2Parser.Cmd_popContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_push(Smtlibv2Parser.Cmd_pushContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_reset(Smtlibv2Parser.Cmd_resetContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_resetAssertions(Smtlibv2Parser.Cmd_resetAssertionsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_setInfo(Smtlibv2Parser.Cmd_setInfoContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_setLogic(Smtlibv2Parser.Cmd_setLogicContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCmd_setOption(Smtlibv2Parser.Cmd_setOptionContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAssert(Smtlibv2Parser.AssertContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCheck(Smtlibv2Parser.CheckContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCheck_assume(Smtlibv2Parser.Check_assumeContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDecl_const(Smtlibv2Parser.Decl_constContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDecl_data(Smtlibv2Parser.Decl_dataContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDecl_datas(Smtlibv2Parser.Decl_datasContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDecl_fun(Smtlibv2Parser.Decl_funContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDecl_sort(Smtlibv2Parser.Decl_sortContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDef_fun(Smtlibv2Parser.Def_funContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDef_fun_rec(Smtlibv2Parser.Def_fun_recContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDef_funs_rec(Smtlibv2Parser.Def_funs_recContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDef_sort(Smtlibv2Parser.Def_sortContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitEcho(Smtlibv2Parser.EchoContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitExit(Smtlibv2Parser.ExitContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_assert(Smtlibv2Parser.Get_assertContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_assign(Smtlibv2Parser.Get_assignContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_info(Smtlibv2Parser.Get_infoContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_model(Smtlibv2Parser.Get_modelContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_option(Smtlibv2Parser.Get_optionContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_proof(Smtlibv2Parser.Get_proofContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_unsat_assume(Smtlibv2Parser.Get_unsat_assumeContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_unsat_core(Smtlibv2Parser.Get_unsat_coreContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_val(Smtlibv2Parser.Get_valContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPop(Smtlibv2Parser.PopContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPush(Smtlibv2Parser.PushContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitReset(Smtlibv2Parser.ResetContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitReset_assert(Smtlibv2Parser.Reset_assertContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSetInfo(Smtlibv2Parser.SetInfoContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSet_logic(Smtlibv2Parser.Set_logicContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitSet_option(Smtlibv2Parser.Set_optionContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitB_value(Smtlibv2Parser.B_valueContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitDiagnose(Smtlibv2Parser.DiagnoseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGlobal(Smtlibv2Parser.GlobalContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInteractive(Smtlibv2Parser.InteractiveContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitPrint_succ(Smtlibv2Parser.Print_succContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitProd_assert(Smtlibv2Parser.Prod_assertContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitProd_assign(Smtlibv2Parser.Prod_assignContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitProd_mod(Smtlibv2Parser.Prod_modContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitProd_proofs(Smtlibv2Parser.Prod_proofsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitProd_unsat_assume(Smtlibv2Parser.Prod_unsat_assumeContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitProd_unsat_core(Smtlibv2Parser.Prod_unsat_coreContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitRand_seed(Smtlibv2Parser.Rand_seedContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitReg_out(Smtlibv2Parser.Reg_outContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitRepro(Smtlibv2Parser.ReproContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitVerbose(Smtlibv2Parser.VerboseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitOpt_attr(Smtlibv2Parser.Opt_attrContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAll_stat(Smtlibv2Parser.All_statContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAssert_stack(Smtlibv2Parser.Assert_stackContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitAuthors(Smtlibv2Parser.AuthorsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitError(Smtlibv2Parser.ErrorContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitName(Smtlibv2Parser.NameContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitR_unknown(Smtlibv2Parser.R_unknownContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitVersion(Smtlibv2Parser.VersionContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInfo_key(Smtlibv2Parser.Info_keyContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitError_behaviour(Smtlibv2Parser.Error_behaviourContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitMemout(Smtlibv2Parser.MemoutContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitIncomp(Smtlibv2Parser.IncompContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitR_unnown_s_expr(Smtlibv2Parser.R_unnown_s_exprContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_def_fun(Smtlibv2Parser.Resp_def_funContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_def_fun_rec(Smtlibv2Parser.Resp_def_fun_recContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_def_funs_rec(Smtlibv2Parser.Resp_def_funs_recContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInfo_assert_stack(Smtlibv2Parser.Info_assert_stackContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInfo_authors(Smtlibv2Parser.Info_authorsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInfo_error(Smtlibv2Parser.Info_errorContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInfo_name(Smtlibv2Parser.Info_nameContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInfo_r_unknown(Smtlibv2Parser.Info_r_unknownContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInfo_version(Smtlibv2Parser.Info_versionContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitInfo_attr(Smtlibv2Parser.Info_attrContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitValuation_pair(Smtlibv2Parser.Valuation_pairContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitT_valuation_pair(Smtlibv2Parser.T_valuation_pairContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitCheck_sat_response(Smtlibv2Parser.Check_sat_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitEcho_response(Smtlibv2Parser.Echo_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_assertions_response(Smtlibv2Parser.Get_assertions_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_assignment_response(Smtlibv2Parser.Get_assignment_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_info_response(Smtlibv2Parser.Get_info_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitRs_model(Smtlibv2Parser.Rs_modelContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitModel_resp(Smtlibv2Parser.Model_respContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_option_response(Smtlibv2Parser.Get_option_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_proof_response(Smtlibv2Parser.Get_proof_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_unsat_assump_response(Smtlibv2Parser.Get_unsat_assump_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_unsat_core_response(Smtlibv2Parser.Get_unsat_core_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitGet_value_response(Smtlibv2Parser.Get_value_responseContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_check_sat(Smtlibv2Parser.Resp_check_satContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_echo(Smtlibv2Parser.Resp_echoContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_get_assert(Smtlibv2Parser.Resp_get_assertContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_gett_assign(Smtlibv2Parser.Resp_gett_assignContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_get_info(Smtlibv2Parser.Resp_get_infoContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_get_model(Smtlibv2Parser.Resp_get_modelContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_option(Smtlibv2Parser.Resp_optionContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_proof(Smtlibv2Parser.Resp_proofContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_unsat_assume(Smtlibv2Parser.Resp_unsat_assumeContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_unsat_core(Smtlibv2Parser.Resp_unsat_coreContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_value(Smtlibv2Parser.Resp_valueContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_success(Smtlibv2Parser.Resp_successContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_spec_successs(Smtlibv2Parser.Resp_spec_successsContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_unsupported(Smtlibv2Parser.Resp_unsupportedContext ctx) { + return visitChildren(ctx); + } + + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling {@link #visitChildren} on {@code + * ctx}. + */ + @Override + public T visitResp_error(Smtlibv2Parser.Resp_errorContext ctx) { + return visitChildren(ctx); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Lexer.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Lexer.java new file mode 100644 index 0000000000..d1ba60f084 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Lexer.java @@ -0,0 +1,1643 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2021 Alejandro SerranoMena +// +// SPDX-License-Identifier: Apache-2.0 + +// Generated from +// /home/davidg/IdeaProjects/java-smt-working-branch/java-smt/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 by ANTLR 4.13.2 +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({ + "all", + "warnings", + "unchecked", + "unused", + "cast", + "CheckReturnValue", + "this-escape" +}) +public class Smtlibv2Lexer extends Lexer { + static { + RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); + } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); + public static final int Comment = 1, + ParOpen = 2, + ParClose = 3, + Semicolon = 4, + String = 5, + QuotedSymbol = 6, + FLOATING_POINT_SORT = 7, + FLOATING_POINT_NUMBER = 8, + REGEXVALUES = 9, + TO_FP_EXPR = 10, + RE_TIMES_EXPR = 11, + RE_LOOP_EXPR = 12, + PS_Not = 13, + PS_Bool = 14, + PS_ContinuedExecution = 15, + PS_Error = 16, + PS_False = 17, + PS_ImmediateExit = 18, + PS_Incomplete = 19, + PS_Logic = 20, + PS_Memout = 21, + PS_Sat = 22, + PS_Success = 23, + PS_Theory = 24, + PS_True = 25, + PS_Unknown = 26, + PS_Unsupported = 27, + PS_Unsat = 28, + CMD_Assert = 29, + CMD_CheckSat = 30, + CMD_CheckSatAssuming = 31, + CMD_DeclareConst = 32, + CMD_DeclareDatatype = 33, + CMD_DeclareDatatypes = 34, + CMD_DeclareFun = 35, + CMD_DeclareSort = 36, + CMD_DefineFun = 37, + CMD_DefineFunRec = 38, + CMD_DefineFunsRec = 39, + CMD_DefineSort = 40, + CMD_Echo = 41, + CMD_Exit = 42, + CMD_GetAssertions = 43, + CMD_GetAssignment = 44, + CMD_GetInfo = 45, + CMD_GetModel = 46, + CMD_GetOption = 47, + CMD_GetProof = 48, + CMD_GetUnsatAssumptions = 49, + CMD_GetUnsatCore = 50, + CMD_GetValue = 51, + CMD_Pop = 52, + CMD_Push = 53, + CMD_Reset = 54, + CMD_ResetAssertions = 55, + CMD_SetInfo = 56, + CMD_SetLogic = 57, + CMD_SetOption = 58, + GRW_Exclamation = 59, + GRW_Underscore = 60, + GRW_As = 61, + GRW_Binary = 62, + GRW_Decimal = 63, + GRW_Exists = 64, + GRW_Hexadecimal = 65, + GRW_Forall = 66, + GRW_Let = 67, + GRW_Match = 68, + GRW_Numeral = 69, + GRW_Par = 70, + GRW_String = 71, + GRW_FloatingPoint = 72, + Numeral = 73, + Binary = 74, + HexDecimal = 75, + Decimal = 76, + Colon = 77, + PK_AllStatistics = 78, + PK_AssertionStackLevels = 79, + PK_Authors = 80, + PK_Category = 81, + PK_Chainable = 82, + PK_Definition = 83, + PK_DiagnosticOutputChannel = 84, + PK_ErrorBehaviour = 85, + PK_Extension = 86, + PK_Funs = 87, + PK_FunsDescription = 88, + PK_GlobalDeclarations = 89, + PK_InteractiveMode = 90, + PK_Language = 91, + PK_LeftAssoc = 92, + PK_License = 93, + PK_Named = 94, + PK_Name = 95, + PK_Notes = 96, + PK_Pattern = 97, + PK_PrintSuccess = 98, + PK_ProduceAssertions = 99, + PK_ProduceAssignments = 100, + PK_ProduceModels = 101, + PK_ProduceProofs = 102, + PK_ProduceUnsatAssumptions = 103, + PK_ProduceUnsatCores = 104, + PK_RandomSeed = 105, + PK_ReasonUnknown = 106, + PK_RegularOutputChannel = 107, + PK_ReproducibleResourceLimit = 108, + PK_RightAssoc = 109, + PK_SmtLibVersion = 110, + PK_Sorts = 111, + PK_SortsDescription = 112, + PK_Source = 113, + PK_Status = 114, + PK_Theories = 115, + PK_Values = 116, + PK_Verbosity = 117, + PK_Version = 118, + RS_Model = 119, + UndefinedSymbol = 120, + WS = 121; + public static String[] channelNames = {"DEFAULT_TOKEN_CHANNEL", "HIDDEN"}; + + public static String[] modeNames = {"DEFAULT_MODE"}; + + private static String[] makeRuleNames() { + return new String[] { + "Comment", + "ParOpen", + "ParClose", + "Semicolon", + "String", + "QuotedSymbol", + "FLOATING_POINT_SORT", + "FLOATING_POINT_NUMBER", + "REGEXVALUES", + "TO_FP_EXPR", + "RE_TIMES_EXPR", + "RE_LOOP_EXPR", + "PS_Not", + "PS_Bool", + "PS_ContinuedExecution", + "PS_Error", + "PS_False", + "PS_ImmediateExit", + "PS_Incomplete", + "PS_Logic", + "PS_Memout", + "PS_Sat", + "PS_Success", + "PS_Theory", + "PS_True", + "PS_Unknown", + "PS_Unsupported", + "PS_Unsat", + "CMD_Assert", + "CMD_CheckSat", + "CMD_CheckSatAssuming", + "CMD_DeclareConst", + "CMD_DeclareDatatype", + "CMD_DeclareDatatypes", + "CMD_DeclareFun", + "CMD_DeclareSort", + "CMD_DefineFun", + "CMD_DefineFunRec", + "CMD_DefineFunsRec", + "CMD_DefineSort", + "CMD_Echo", + "CMD_Exit", + "CMD_GetAssertions", + "CMD_GetAssignment", + "CMD_GetInfo", + "CMD_GetModel", + "CMD_GetOption", + "CMD_GetProof", + "CMD_GetUnsatAssumptions", + "CMD_GetUnsatCore", + "CMD_GetValue", + "CMD_Pop", + "CMD_Push", + "CMD_Reset", + "CMD_ResetAssertions", + "CMD_SetInfo", + "CMD_SetLogic", + "CMD_SetOption", + "GRW_Exclamation", + "GRW_Underscore", + "GRW_As", + "GRW_Binary", + "GRW_Decimal", + "GRW_Exists", + "GRW_Hexadecimal", + "GRW_Forall", + "GRW_Let", + "GRW_Match", + "GRW_Numeral", + "GRW_Par", + "GRW_String", + "GRW_FloatingPoint", + "Numeral", + "Binary", + "HexDecimal", + "Decimal", + "HexDigit", + "Colon", + "Digit", + "ShortFloats", + "Sym", + "BinaryDigit", + "PrintableChar", + "PrintableCharNoDquote", + "PrintableCharNoBackslash", + "EscapedSpace", + "WhiteSpaceChar", + "Space", + "SpaceChar", + "PK_AllStatistics", + "PK_AssertionStackLevels", + "PK_Authors", + "PK_Category", + "PK_Chainable", + "PK_Definition", + "PK_DiagnosticOutputChannel", + "PK_ErrorBehaviour", + "PK_Extension", + "PK_Funs", + "PK_FunsDescription", + "PK_GlobalDeclarations", + "PK_InteractiveMode", + "PK_Language", + "PK_LeftAssoc", + "PK_License", + "PK_Named", + "PK_Name", + "PK_Notes", + "PK_Pattern", + "PK_PrintSuccess", + "PK_ProduceAssertions", + "PK_ProduceAssignments", + "PK_ProduceModels", + "PK_ProduceProofs", + "PK_ProduceUnsatAssumptions", + "PK_ProduceUnsatCores", + "PK_RandomSeed", + "PK_ReasonUnknown", + "PK_RegularOutputChannel", + "PK_ReproducibleResourceLimit", + "PK_RightAssoc", + "PK_SmtLibVersion", + "PK_Sorts", + "PK_SortsDescription", + "PK_Source", + "PK_Status", + "PK_Theories", + "PK_Values", + "PK_Verbosity", + "PK_Version", + "RS_Model", + "UndefinedSymbol", + "WS" + }; + } + + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, + null, + "'('", + "')'", + "';'", + null, + null, + null, + null, + null, + null, + null, + null, + "'not'", + "'Bool'", + "'continued-execution'", + "'error'", + "'false'", + "'immediate-exit'", + "'incomplete'", + "'logic'", + "'memout'", + "'sat'", + "'success'", + "'theory'", + "'true'", + "'unknown'", + "'unsupported'", + "'unsat'", + "'assert'", + "'check-sat'", + "'check-sat-assuming'", + "'declare-const'", + "'declare-datatype'", + "'declare-datatypes'", + "'declare-fun'", + "'declare-sort'", + "'define-fun'", + "'define-fun-rec'", + "'define-funs-rec'", + "'define-sort'", + "'echo'", + "'exit'", + "'get-assertions'", + "'get-assignment'", + "'get-info'", + "'get-model'", + "'get-option'", + "'get-proof'", + "'get-unsat-assumptions'", + "'get-unsat-core'", + "'get-value'", + "'pop'", + "'push'", + "'reset'", + "'reset-assertions'", + "'set-info'", + "'set-logic'", + "'set-option'", + "'!'", + "'_'", + "'as'", + "'BINARY'", + "'DECIMAL'", + "'exists'", + "'HEXADECIMAL'", + "'forall'", + "'let'", + "'match'", + "'NUMERAL'", + "'par'", + "'string'", + "'_ FloatingPoint'", + null, + null, + null, + null, + "':'", + "':all-statistics'", + "':assertion-stack-levels'", + "':authors'", + "':category'", + "':chainable'", + "':definition'", + "':diagnostic-output-channel'", + "':error-behavior'", + "':extensions'", + "':funs'", + "':funs-description'", + "':global-declarations'", + "':interactive-mode'", + "':language'", + "':left-assoc'", + "':license'", + "':named'", + "':name'", + "':notes'", + "':pattern'", + "':print-success'", + "':produce-assertions'", + "':produce-assignments'", + "':produce-models'", + "':produce-proofs'", + "':produce-unsat-assumptions'", + "':produce-unsat-cores'", + "':random-seed'", + "':reason-unknown'", + "':regular-output-channel'", + "':reproducible-resource-limit'", + "':right-assoc'", + "':smt-lib-version'", + "':sorts'", + "':sorts-description'", + "':source'", + "':status'", + "':theories'", + "':values'", + "':verbosity'", + "':version'", + "'model'" + }; + } + + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + + private static String[] makeSymbolicNames() { + return new String[] { + null, + "Comment", + "ParOpen", + "ParClose", + "Semicolon", + "String", + "QuotedSymbol", + "FLOATING_POINT_SORT", + "FLOATING_POINT_NUMBER", + "REGEXVALUES", + "TO_FP_EXPR", + "RE_TIMES_EXPR", + "RE_LOOP_EXPR", + "PS_Not", + "PS_Bool", + "PS_ContinuedExecution", + "PS_Error", + "PS_False", + "PS_ImmediateExit", + "PS_Incomplete", + "PS_Logic", + "PS_Memout", + "PS_Sat", + "PS_Success", + "PS_Theory", + "PS_True", + "PS_Unknown", + "PS_Unsupported", + "PS_Unsat", + "CMD_Assert", + "CMD_CheckSat", + "CMD_CheckSatAssuming", + "CMD_DeclareConst", + "CMD_DeclareDatatype", + "CMD_DeclareDatatypes", + "CMD_DeclareFun", + "CMD_DeclareSort", + "CMD_DefineFun", + "CMD_DefineFunRec", + "CMD_DefineFunsRec", + "CMD_DefineSort", + "CMD_Echo", + "CMD_Exit", + "CMD_GetAssertions", + "CMD_GetAssignment", + "CMD_GetInfo", + "CMD_GetModel", + "CMD_GetOption", + "CMD_GetProof", + "CMD_GetUnsatAssumptions", + "CMD_GetUnsatCore", + "CMD_GetValue", + "CMD_Pop", + "CMD_Push", + "CMD_Reset", + "CMD_ResetAssertions", + "CMD_SetInfo", + "CMD_SetLogic", + "CMD_SetOption", + "GRW_Exclamation", + "GRW_Underscore", + "GRW_As", + "GRW_Binary", + "GRW_Decimal", + "GRW_Exists", + "GRW_Hexadecimal", + "GRW_Forall", + "GRW_Let", + "GRW_Match", + "GRW_Numeral", + "GRW_Par", + "GRW_String", + "GRW_FloatingPoint", + "Numeral", + "Binary", + "HexDecimal", + "Decimal", + "Colon", + "PK_AllStatistics", + "PK_AssertionStackLevels", + "PK_Authors", + "PK_Category", + "PK_Chainable", + "PK_Definition", + "PK_DiagnosticOutputChannel", + "PK_ErrorBehaviour", + "PK_Extension", + "PK_Funs", + "PK_FunsDescription", + "PK_GlobalDeclarations", + "PK_InteractiveMode", + "PK_Language", + "PK_LeftAssoc", + "PK_License", + "PK_Named", + "PK_Name", + "PK_Notes", + "PK_Pattern", + "PK_PrintSuccess", + "PK_ProduceAssertions", + "PK_ProduceAssignments", + "PK_ProduceModels", + "PK_ProduceProofs", + "PK_ProduceUnsatAssumptions", + "PK_ProduceUnsatCores", + "PK_RandomSeed", + "PK_ReasonUnknown", + "PK_RegularOutputChannel", + "PK_ReproducibleResourceLimit", + "PK_RightAssoc", + "PK_SmtLibVersion", + "PK_Sorts", + "PK_SortsDescription", + "PK_Source", + "PK_Status", + "PK_Theories", + "PK_Values", + "PK_Verbosity", + "PK_Version", + "RS_Model", + "UndefinedSymbol", + "WS" + }; + } + + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated public static final String[] tokenNames; + + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + public Smtlibv2Lexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); + } + + @Override + public String getGrammarFileName() { + return "Smtlibv2.g4"; + } + + @Override + public String[] getRuleNames() { + return ruleNames; + } + + @Override + public String getSerializedATN() { + return _serializedATN; + } + + @Override + public String[] getChannelNames() { + return channelNames; + } + + @Override + public String[] getModeNames() { + return modeNames; + } + + @Override + public ATN getATN() { + return _ATN; + } + + public static final String _serializedATN = + "\u0004\u0000y\u06dd\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001" + + "\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004" + + "\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007" + + "\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b" + + "\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002" + + "\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002" + + "\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002" + + "\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002" + + "\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002" + + "\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002" + + "\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007" + + "!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007" + + "&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007" + + "+\u0002,\u0007,\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u0007" + + "0\u00021\u00071\u00022\u00072\u00023\u00073\u00024\u00074\u00025\u0007" + + "5\u00026\u00076\u00027\u00077\u00028\u00078\u00029\u00079\u0002:\u0007" + + ":\u0002;\u0007;\u0002<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002?\u0007" + + "?\u0002@\u0007@\u0002A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002D\u0007" + + "D\u0002E\u0007E\u0002F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002I\u0007" + + "I\u0002J\u0007J\u0002K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002N\u0007" + + "N\u0002O\u0007O\u0002P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002S\u0007" + + "S\u0002T\u0007T\u0002U\u0007U\u0002V\u0007V\u0002W\u0007W\u0002X\u0007" + + "X\u0002Y\u0007Y\u0002Z\u0007Z\u0002[\u0007[\u0002\\\u0007\\\u0002]\u0007" + + "]\u0002^\u0007^\u0002_\u0007_\u0002`\u0007`\u0002a\u0007a\u0002b\u0007" + + "b\u0002c\u0007c\u0002d\u0007d\u0002e\u0007e\u0002f\u0007f\u0002g\u0007" + + "g\u0002h\u0007h\u0002i\u0007i\u0002j\u0007j\u0002k\u0007k\u0002l\u0007" + + "l\u0002m\u0007m\u0002n\u0007n\u0002o\u0007o\u0002p\u0007p\u0002q\u0007" + + "q\u0002r\u0007r\u0002s\u0007s\u0002t\u0007t\u0002u\u0007u\u0002v\u0007" + + "v\u0002w\u0007w\u0002x\u0007x\u0002y\u0007y\u0002z\u0007z\u0002{\u0007" + + "{\u0002|\u0007|\u0002}\u0007}\u0002~\u0007~\u0002\u007f\u0007\u007f\u0002" + + "\u0080\u0007\u0080\u0002\u0081\u0007\u0081\u0002\u0082\u0007\u0082\u0002" + + "\u0083\u0007\u0083\u0002\u0084\u0007\u0084\u0001\u0000\u0001\u0000\u0005" + + "\u0000\u010e\b\u0000\n\u0000\f\u0000\u0111\t\u0000\u0001\u0000\u0001\u0000" + + "\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003" + + "\u0001\u0004\u0001\u0004\u0001\u0004\u0004\u0004\u011e\b\u0004\u000b\u0004" + + "\f\u0004\u011f\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0005" + + "\u0004\u0005\u0127\b\u0005\u000b\u0005\f\u0005\u0128\u0001\u0005\u0001" + + "\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001" + + "\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001" + + "\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001" + + "\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001" + + "\u0006\u0003\u0006\u0145\b\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0003\u0007\u014e\b\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0003\u0007\u0153\b\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0003\u0007\u0158\b\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001" + + "\u0007\u0003\u0007\u0187\b\u0007\u0001\b\u0001\b\u0001\b\u0001\b\u0001" + + "\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001" + + "\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001" + + "\b\u0003\b\u01a0\b\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001" + + "\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001" + + "\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001" + + "\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b" + + "\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b" + + "\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b" + + "\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001" + + "\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e" + + "\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e" + + "\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e" + + "\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f" + + "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u0010" + + "\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011" + + "\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011" + + "\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011" + + "\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012" + + "\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012" + + "\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013" + + "\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014" + + "\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015" + + "\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016" + + "\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017" + + "\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0018" + + "\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019" + + "\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a" + + "\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a" + + "\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001b\u0001\u001b" + + "\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001c\u0001\u001c" + + "\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001d" + + "\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d" + + "\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001e\u0001\u001e\u0001\u001e" + + "\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e" + + "\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e" + + "\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001f\u0001\u001f" + + "\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f" + + "\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f" + + "\u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001" + + " \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001!\u0001!\u0001" + + "!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001" + + "!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001\"\u0001\"\u0001\"\u0001\"\u0001" + + "\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001#\u0001" + + "#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001" + + "#\u0001#\u0001$\u0001$\u0001$\u0001$\u0001$\u0001$\u0001$\u0001$\u0001" + + "$\u0001$\u0001$\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001" + + "%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001&\u0001&\u0001" + + "&\u0001&\u0001&\u0001&\u0001&\u0001&\u0001&\u0001&\u0001&\u0001&\u0001" + + "&\u0001&\u0001&\u0001&\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'" + + "\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'\u0001(\u0001(\u0001(" + + "\u0001(\u0001(\u0001)\u0001)\u0001)\u0001)\u0001)\u0001*\u0001*\u0001" + + "*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001" + + "*\u0001*\u0001*\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001" + + "+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001,\u0001,\u0001" + + ",\u0001,\u0001,\u0001,\u0001,\u0001,\u0001,\u0001-\u0001-\u0001-\u0001" + + "-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001.\u0001.\u0001.\u0001" + + ".\u0001.\u0001.\u0001.\u0001.\u0001.\u0001.\u0001.\u0001/\u0001/\u0001" + + "/\u0001/\u0001/\u0001/\u0001/\u0001/\u0001/\u0001/\u00010\u00010\u0001" + + "0\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u0001" + + "0\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u0001" + + "1\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u0001" + + "1\u00011\u00011\u00011\u00011\u00012\u00012\u00012\u00012\u00012\u0001" + + "2\u00012\u00012\u00012\u00012\u00013\u00013\u00013\u00013\u00014\u0001" + + "4\u00014\u00014\u00014\u00015\u00015\u00015\u00015\u00015\u00015\u0001" + + "6\u00016\u00016\u00016\u00016\u00016\u00016\u00016\u00016\u00016\u0001" + + "6\u00016\u00016\u00016\u00016\u00016\u00016\u00017\u00017\u00017\u0001" + + "7\u00017\u00017\u00017\u00017\u00017\u00018\u00018\u00018\u00018\u0001" + + "8\u00018\u00018\u00018\u00018\u00018\u00019\u00019\u00019\u00019\u0001" + + "9\u00019\u00019\u00019\u00019\u00019\u00019\u0001:\u0001:\u0001;\u0001" + + ";\u0001<\u0001<\u0001<\u0001=\u0001=\u0001=\u0001=\u0001=\u0001=\u0001" + + "=\u0001>\u0001>\u0001>\u0001>\u0001>\u0001>\u0001>\u0001>\u0001?\u0001" + + "?\u0001?\u0001?\u0001?\u0001?\u0001?\u0001@\u0001@\u0001@\u0001@\u0001" + + "@\u0001@\u0001@\u0001@\u0001@\u0001@\u0001@\u0001@\u0001A\u0001A\u0001" + + "A\u0001A\u0001A\u0001A\u0001A\u0001B\u0001B\u0001B\u0001B\u0001C\u0001" + + "C\u0001C\u0001C\u0001C\u0001C\u0001D\u0001D\u0001D\u0001D\u0001D\u0001" + + "D\u0001D\u0001D\u0001E\u0001E\u0001E\u0001E\u0001F\u0001F\u0001F\u0001" + + "F\u0001F\u0001F\u0001F\u0001G\u0001G\u0001G\u0001G\u0001G\u0001G\u0001" + + "G\u0001G\u0001G\u0001G\u0001G\u0001G\u0001G\u0001G\u0001G\u0001G\u0001" + + "H\u0001H\u0001H\u0005H\u0414\bH\nH\fH\u0417\tH\u0003H\u0419\bH\u0001I" + + "\u0001I\u0001I\u0001I\u0004I\u041f\bI\u000bI\fI\u0420\u0001J\u0001J\u0001" + + "J\u0001J\u0004J\u0427\bJ\u000bJ\fJ\u0428\u0001K\u0001K\u0001K\u0005K\u042e" + + "\bK\nK\fK\u0431\tK\u0001K\u0001K\u0001L\u0001L\u0001M\u0001M\u0001N\u0001" + + "N\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001" + + "O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001" + + "O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0003" + + "O\u0458\bO\u0001P\u0001P\u0001P\u0001P\u0001P\u0001P\u0003P\u0460\bP\u0001" + + "Q\u0001Q\u0001R\u0001R\u0003R\u0466\bR\u0001S\u0001S\u0003S\u046a\bS\u0001" + + "T\u0001T\u0003T\u046e\bT\u0001U\u0001U\u0001U\u0001V\u0001V\u0003V\u0475" + + "\bV\u0001W\u0001W\u0001X\u0001X\u0003X\u047b\bX\u0001Y\u0001Y\u0001Y\u0001" + + "Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001" + + "Y\u0001Y\u0001Y\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001" + + "Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001" + + "Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001[\u0001[\u0001[\u0001" + + "[\u0001[\u0001[\u0001[\u0001[\u0001[\u0001\\\u0001\\\u0001\\\u0001\\\u0001" + + "\\\u0001\\\u0001\\\u0001\\\u0001\\\u0001\\\u0001]\u0001]\u0001]\u0001" + + "]\u0001]\u0001]\u0001]\u0001]\u0001]\u0001]\u0001]\u0001^\u0001^\u0001" + + "^\u0001^\u0001^\u0001^\u0001^\u0001^\u0001^\u0001^\u0001^\u0001^\u0001" + + "_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001" + + "_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001" + + "_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001`\u0001`\u0001`\u0001" + + "`\u0001`\u0001`\u0001`\u0001`\u0001`\u0001`\u0001`\u0001`\u0001`\u0001" + + "`\u0001`\u0001`\u0001a\u0001a\u0001a\u0001a\u0001a\u0001a\u0001a\u0001" + + "a\u0001a\u0001a\u0001a\u0001a\u0001b\u0001b\u0001b\u0001b\u0001b\u0001" + + "b\u0001c\u0001c\u0001c\u0001c\u0001c\u0001c\u0001c\u0001c\u0001c\u0001" + + "c\u0001c\u0001c\u0001c\u0001c\u0001c\u0001c\u0001c\u0001c\u0001d\u0001" + + "d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001" + + "d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001d\u0001" + + "e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001" + + "e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001f\u0001f\u0001" + + "f\u0001f\u0001f\u0001f\u0001f\u0001f\u0001f\u0001f\u0001g\u0001g\u0001" + + "g\u0001g\u0001g\u0001g\u0001g\u0001g\u0001g\u0001g\u0001g\u0001g\u0001" + + "h\u0001h\u0001h\u0001h\u0001h\u0001h\u0001h\u0001h\u0001h\u0001i\u0001" + + "i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001j\u0001j\u0001j\u0001j\u0001" + + "j\u0001j\u0001k\u0001k\u0001k\u0001k\u0001k\u0001k\u0001k\u0001l\u0001" + + "l\u0001l\u0001l\u0001l\u0001l\u0001l\u0001l\u0001l\u0001m\u0001m\u0001" + + "m\u0001m\u0001m\u0001m\u0001m\u0001m\u0001m\u0001m\u0001m\u0001m\u0001" + + "m\u0001m\u0001m\u0001n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001" + + "n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001" + + "n\u0001n\u0001n\u0001o\u0001o\u0001o\u0001o\u0001o\u0001o\u0001o\u0001" + + "o\u0001o\u0001o\u0001o\u0001o\u0001o\u0001o\u0001o\u0001o\u0001o\u0001" + + "o\u0001o\u0001o\u0001o\u0001p\u0001p\u0001p\u0001p\u0001p\u0001p\u0001" + + "p\u0001p\u0001p\u0001p\u0001p\u0001p\u0001p\u0001p\u0001p\u0001p\u0001" + + "q\u0001q\u0001q\u0001q\u0001q\u0001q\u0001q\u0001q\u0001q\u0001q\u0001" + + "q\u0001q\u0001q\u0001q\u0001q\u0001q\u0001r\u0001r\u0001r\u0001r\u0001" + + "r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001" + + "r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001r\u0001" + + "r\u0001r\u0001r\u0001s\u0001s\u0001s\u0001s\u0001s\u0001s\u0001s\u0001" + + "s\u0001s\u0001s\u0001s\u0001s\u0001s\u0001s\u0001s\u0001s\u0001s\u0001" + + "s\u0001s\u0001s\u0001s\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001" + + "t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001u\u0001u\u0001u\u0001" + + "u\u0001u\u0001u\u0001u\u0001u\u0001u\u0001u\u0001u\u0001u\u0001u\u0001" + + "u\u0001u\u0001u\u0001v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001" + + "v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001" + + "v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001v\u0001w\u0001w\u0001w\u0001" + + "w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001" + + "w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001" + + "w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001x\u0001x\u0001x\u0001x\u0001" + + "x\u0001x\u0001x\u0001x\u0001x\u0001x\u0001x\u0001x\u0001x\u0001y\u0001" + + "y\u0001y\u0001y\u0001y\u0001y\u0001y\u0001y\u0001y\u0001y\u0001y\u0001" + + "y\u0001y\u0001y\u0001y\u0001y\u0001y\u0001z\u0001z\u0001z\u0001z\u0001" + + "z\u0001z\u0001z\u0001{\u0001{\u0001{\u0001{\u0001{\u0001{\u0001{\u0001" + + "{\u0001{\u0001{\u0001{\u0001{\u0001{\u0001{\u0001{\u0001{\u0001{\u0001" + + "{\u0001{\u0001|\u0001|\u0001|\u0001|\u0001|\u0001|\u0001|\u0001|\u0001" + + "}\u0001}\u0001}\u0001}\u0001}\u0001}\u0001}\u0001}\u0001~\u0001~\u0001" + + "~\u0001~\u0001~\u0001~\u0001~\u0001~\u0001~\u0001~\u0001\u007f\u0001\u007f" + + "\u0001\u007f\u0001\u007f\u0001\u007f\u0001\u007f\u0001\u007f\u0001\u007f" + + "\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0080" + + "\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0081" + + "\u0001\u0081\u0001\u0081\u0001\u0081\u0001\u0081\u0001\u0081\u0001\u0081" + + "\u0001\u0081\u0001\u0081\u0001\u0082\u0001\u0082\u0001\u0082\u0001\u0082" + + "\u0001\u0082\u0001\u0082\u0001\u0083\u0001\u0083\u0001\u0083\u0005\u0083" + + "\u06d2\b\u0083\n\u0083\f\u0083\u06d5\t\u0083\u0001\u0084\u0004\u0084\u06d8" + + "\b\u0084\u000b\u0084\f\u0084\u06d9\u0001\u0084\u0001\u0084\u0000\u0000" + + "\u0085\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b\u0006" + + "\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b\u000e" + + "\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016-\u0017" + + "/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f? A!C\"E#G$I%" + + "K&M\'O(Q)S*U+W,Y-[.]/_0a1c2e3g4i5k6m7o8q9s:u;w}?\u007f@\u0081A\u0083" + + "B\u0085C\u0087D\u0089E\u008bF\u008dG\u008fH\u0091I\u0093J\u0095K\u0097" + + "L\u0099\u0000\u009bM\u009d\u0000\u009f\u0000\u00a1\u0000\u00a3\u0000\u00a5" + + "\u0000\u00a7\u0000\u00a9\u0000\u00ab\u0000\u00ad\u0000\u00af\u0000\u00b1" + + "\u0000\u00b3N\u00b5O\u00b7P\u00b9Q\u00bbR\u00bdS\u00bfT\u00c1U\u00c3V" + + "\u00c5W\u00c7X\u00c9Y\u00cbZ\u00cd[\u00cf\\\u00d1]\u00d3^\u00d5_\u00d7" + + "`\u00d9a\u00dbb\u00ddc\u00dfd\u00e1e\u00e3f\u00e5g\u00e7h\u00e9i\u00eb" + + "j\u00edk\u00efl\u00f1m\u00f3n\u00f5o\u00f7p\u00f9q\u00fbr\u00fds\u00ff" + + "t\u0101u\u0103v\u0105w\u0107x\u0109y\u0001\u0000\r\u0002\u0000\n\n\r\r" + + "\u0002\u0000++--\u0001\u000019\u0003\u000009AFaf\u0001\u000009\u000b\u0000" + + "!!$&*+--//<=??AZ^_az~~\u0003\u0000..>>@@\u0001\u000001\u0002\u0000 ~\u0080" + + "\u8000\uffff\u0003\u0000 !#~\u0080\u8000\uffff\u0004\u0000 []{}~\u0080" + + "\u8000\uffff\u0002\u0000\t\n\r\r\u0003\u0000\t\n\r\r \u06f1\u0000\u0001" + + "\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005" + + "\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001" + + "\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000" + + "\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000" + + "\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000" + + "\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000" + + "\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000" + + "\u0000\u0000\u0000\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000" + + "\u0000\u0000#\u0001\u0000\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000" + + "\'\u0001\u0000\u0000\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001" + + "\u0000\u0000\u0000\u0000-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000" + + "\u0000\u00001\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u0000" + + "5\u0001\u0000\u0000\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001" + + "\u0000\u0000\u0000\u0000;\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000" + + "\u0000\u0000?\u0001\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000" + + "C\u0001\u0000\u0000\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001" + + "\u0000\u0000\u0000\u0000I\u0001\u0000\u0000\u0000\u0000K\u0001\u0000\u0000" + + "\u0000\u0000M\u0001\u0000\u0000\u0000\u0000O\u0001\u0000\u0000\u0000\u0000" + + "Q\u0001\u0000\u0000\u0000\u0000S\u0001\u0000\u0000\u0000\u0000U\u0001" + + "\u0000\u0000\u0000\u0000W\u0001\u0000\u0000\u0000\u0000Y\u0001\u0000\u0000" + + "\u0000\u0000[\u0001\u0000\u0000\u0000\u0000]\u0001\u0000\u0000\u0000\u0000" + + "_\u0001\u0000\u0000\u0000\u0000a\u0001\u0000\u0000\u0000\u0000c\u0001" + + "\u0000\u0000\u0000\u0000e\u0001\u0000\u0000\u0000\u0000g\u0001\u0000\u0000" + + "\u0000\u0000i\u0001\u0000\u0000\u0000\u0000k\u0001\u0000\u0000\u0000\u0000" + + "m\u0001\u0000\u0000\u0000\u0000o\u0001\u0000\u0000\u0000\u0000q\u0001" + + "\u0000\u0000\u0000\u0000s\u0001\u0000\u0000\u0000\u0000u\u0001\u0000\u0000" + + "\u0000\u0000w\u0001\u0000\u0000\u0000\u0000y\u0001\u0000\u0000\u0000\u0000" + + "{\u0001\u0000\u0000\u0000\u0000}\u0001\u0000\u0000\u0000\u0000\u007f\u0001" + + "\u0000\u0000\u0000\u0000\u0081\u0001\u0000\u0000\u0000\u0000\u0083\u0001" + + "\u0000\u0000\u0000\u0000\u0085\u0001\u0000\u0000\u0000\u0000\u0087\u0001" + + "\u0000\u0000\u0000\u0000\u0089\u0001\u0000\u0000\u0000\u0000\u008b\u0001" + + "\u0000\u0000\u0000\u0000\u008d\u0001\u0000\u0000\u0000\u0000\u008f\u0001" + + "\u0000\u0000\u0000\u0000\u0091\u0001\u0000\u0000\u0000\u0000\u0093\u0001" + + "\u0000\u0000\u0000\u0000\u0095\u0001\u0000\u0000\u0000\u0000\u0097\u0001" + + "\u0000\u0000\u0000\u0000\u009b\u0001\u0000\u0000\u0000\u0000\u00b3\u0001" + + "\u0000\u0000\u0000\u0000\u00b5\u0001\u0000\u0000\u0000\u0000\u00b7\u0001" + + "\u0000\u0000\u0000\u0000\u00b9\u0001\u0000\u0000\u0000\u0000\u00bb\u0001" + + "\u0000\u0000\u0000\u0000\u00bd\u0001\u0000\u0000\u0000\u0000\u00bf\u0001" + + "\u0000\u0000\u0000\u0000\u00c1\u0001\u0000\u0000\u0000\u0000\u00c3\u0001" + + "\u0000\u0000\u0000\u0000\u00c5\u0001\u0000\u0000\u0000\u0000\u00c7\u0001" + + "\u0000\u0000\u0000\u0000\u00c9\u0001\u0000\u0000\u0000\u0000\u00cb\u0001" + + "\u0000\u0000\u0000\u0000\u00cd\u0001\u0000\u0000\u0000\u0000\u00cf\u0001" + + "\u0000\u0000\u0000\u0000\u00d1\u0001\u0000\u0000\u0000\u0000\u00d3\u0001" + + "\u0000\u0000\u0000\u0000\u00d5\u0001\u0000\u0000\u0000\u0000\u00d7\u0001" + + "\u0000\u0000\u0000\u0000\u00d9\u0001\u0000\u0000\u0000\u0000\u00db\u0001" + + "\u0000\u0000\u0000\u0000\u00dd\u0001\u0000\u0000\u0000\u0000\u00df\u0001" + + "\u0000\u0000\u0000\u0000\u00e1\u0001\u0000\u0000\u0000\u0000\u00e3\u0001" + + "\u0000\u0000\u0000\u0000\u00e5\u0001\u0000\u0000\u0000\u0000\u00e7\u0001" + + "\u0000\u0000\u0000\u0000\u00e9\u0001\u0000\u0000\u0000\u0000\u00eb\u0001" + + "\u0000\u0000\u0000\u0000\u00ed\u0001\u0000\u0000\u0000\u0000\u00ef\u0001" + + "\u0000\u0000\u0000\u0000\u00f1\u0001\u0000\u0000\u0000\u0000\u00f3\u0001" + + "\u0000\u0000\u0000\u0000\u00f5\u0001\u0000\u0000\u0000\u0000\u00f7\u0001" + + "\u0000\u0000\u0000\u0000\u00f9\u0001\u0000\u0000\u0000\u0000\u00fb\u0001" + + "\u0000\u0000\u0000\u0000\u00fd\u0001\u0000\u0000\u0000\u0000\u00ff\u0001" + + "\u0000\u0000\u0000\u0000\u0101\u0001\u0000\u0000\u0000\u0000\u0103\u0001" + + "\u0000\u0000\u0000\u0000\u0105\u0001\u0000\u0000\u0000\u0000\u0107\u0001" + + "\u0000\u0000\u0000\u0000\u0109\u0001\u0000\u0000\u0000\u0001\u010b\u0001" + + "\u0000\u0000\u0000\u0003\u0114\u0001\u0000\u0000\u0000\u0005\u0116\u0001" + + "\u0000\u0000\u0000\u0007\u0118\u0001\u0000\u0000\u0000\t\u011a\u0001\u0000" + + "\u0000\u0000\u000b\u0123\u0001\u0000\u0000\u0000\r\u0144\u0001\u0000\u0000" + + "\u0000\u000f\u0186\u0001\u0000\u0000\u0000\u0011\u019f\u0001\u0000\u0000" + + "\u0000\u0013\u01a1\u0001\u0000\u0000\u0000\u0015\u01b1\u0001\u0000\u0000" + + "\u0000\u0017\u01be\u0001\u0000\u0000\u0000\u0019\u01d0\u0001\u0000\u0000" + + "\u0000\u001b\u01d4\u0001\u0000\u0000\u0000\u001d\u01d9\u0001\u0000\u0000" + + "\u0000\u001f\u01ed\u0001\u0000\u0000\u0000!\u01f3\u0001\u0000\u0000\u0000" + + "#\u01f9\u0001\u0000\u0000\u0000%\u0208\u0001\u0000\u0000\u0000\'\u0213" + + "\u0001\u0000\u0000\u0000)\u0219\u0001\u0000\u0000\u0000+\u0220\u0001\u0000" + + "\u0000\u0000-\u0224\u0001\u0000\u0000\u0000/\u022c\u0001\u0000\u0000\u0000" + + "1\u0233\u0001\u0000\u0000\u00003\u0238\u0001\u0000\u0000\u00005\u0240" + + "\u0001\u0000\u0000\u00007\u024c\u0001\u0000\u0000\u00009\u0252\u0001\u0000" + + "\u0000\u0000;\u0259\u0001\u0000\u0000\u0000=\u0263\u0001\u0000\u0000\u0000" + + "?\u0276\u0001\u0000\u0000\u0000A\u0284\u0001\u0000\u0000\u0000C\u0295" + + "\u0001\u0000\u0000\u0000E\u02a7\u0001\u0000\u0000\u0000G\u02b3\u0001\u0000" + + "\u0000\u0000I\u02c0\u0001\u0000\u0000\u0000K\u02cb\u0001\u0000\u0000\u0000" + + "M\u02da\u0001\u0000\u0000\u0000O\u02ea\u0001\u0000\u0000\u0000Q\u02f6" + + "\u0001\u0000\u0000\u0000S\u02fb\u0001\u0000\u0000\u0000U\u0300\u0001\u0000" + + "\u0000\u0000W\u030f\u0001\u0000\u0000\u0000Y\u031e\u0001\u0000\u0000\u0000" + + "[\u0327\u0001\u0000\u0000\u0000]\u0331\u0001\u0000\u0000\u0000_\u033c" + + "\u0001\u0000\u0000\u0000a\u0346\u0001\u0000\u0000\u0000c\u035c\u0001\u0000" + + "\u0000\u0000e\u036b\u0001\u0000\u0000\u0000g\u0375\u0001\u0000\u0000\u0000" + + "i\u0379\u0001\u0000\u0000\u0000k\u037e\u0001\u0000\u0000\u0000m\u0384" + + "\u0001\u0000\u0000\u0000o\u0395\u0001\u0000\u0000\u0000q\u039e\u0001\u0000" + + "\u0000\u0000s\u03a8\u0001\u0000\u0000\u0000u\u03b3\u0001\u0000\u0000\u0000" + + "w\u03b5\u0001\u0000\u0000\u0000y\u03b7\u0001\u0000\u0000\u0000{\u03ba" + + "\u0001\u0000\u0000\u0000}\u03c1\u0001\u0000\u0000\u0000\u007f\u03c9\u0001" + + "\u0000\u0000\u0000\u0081\u03d0\u0001\u0000\u0000\u0000\u0083\u03dc\u0001" + + "\u0000\u0000\u0000\u0085\u03e3\u0001\u0000\u0000\u0000\u0087\u03e7\u0001" + + "\u0000\u0000\u0000\u0089\u03ed\u0001\u0000\u0000\u0000\u008b\u03f5\u0001" + + "\u0000\u0000\u0000\u008d\u03f9\u0001\u0000\u0000\u0000\u008f\u0400\u0001" + + "\u0000\u0000\u0000\u0091\u0418\u0001\u0000\u0000\u0000\u0093\u041a\u0001" + + "\u0000\u0000\u0000\u0095\u0422\u0001\u0000\u0000\u0000\u0097\u042a\u0001" + + "\u0000\u0000\u0000\u0099\u0434\u0001\u0000\u0000\u0000\u009b\u0436\u0001" + + "\u0000\u0000\u0000\u009d\u0438\u0001\u0000\u0000\u0000\u009f\u0457\u0001" + + "\u0000\u0000\u0000\u00a1\u045f\u0001\u0000\u0000\u0000\u00a3\u0461\u0001" + + "\u0000\u0000\u0000\u00a5\u0465\u0001\u0000\u0000\u0000\u00a7\u0469\u0001" + + "\u0000\u0000\u0000\u00a9\u046d\u0001\u0000\u0000\u0000\u00ab\u046f\u0001" + + "\u0000\u0000\u0000\u00ad\u0474\u0001\u0000\u0000\u0000\u00af\u0476\u0001" + + "\u0000\u0000\u0000\u00b1\u047a\u0001\u0000\u0000\u0000\u00b3\u047c\u0001" + + "\u0000\u0000\u0000\u00b5\u048c\u0001\u0000\u0000\u0000\u00b7\u04a4\u0001" + + "\u0000\u0000\u0000\u00b9\u04ad\u0001\u0000\u0000\u0000\u00bb\u04b7\u0001" + + "\u0000\u0000\u0000\u00bd\u04c2\u0001\u0000\u0000\u0000\u00bf\u04ce\u0001" + + "\u0000\u0000\u0000\u00c1\u04e9\u0001\u0000\u0000\u0000\u00c3\u04f9\u0001" + + "\u0000\u0000\u0000\u00c5\u0505\u0001\u0000\u0000\u0000\u00c7\u050b\u0001" + + "\u0000\u0000\u0000\u00c9\u051d\u0001\u0000\u0000\u0000\u00cb\u0532\u0001" + + "\u0000\u0000\u0000\u00cd\u0544\u0001\u0000\u0000\u0000\u00cf\u054e\u0001" + + "\u0000\u0000\u0000\u00d1\u055a\u0001\u0000\u0000\u0000\u00d3\u0563\u0001" + + "\u0000\u0000\u0000\u00d5\u056a\u0001\u0000\u0000\u0000\u00d7\u0570\u0001" + + "\u0000\u0000\u0000\u00d9\u0577\u0001\u0000\u0000\u0000\u00db\u0580\u0001" + + "\u0000\u0000\u0000\u00dd\u058f\u0001\u0000\u0000\u0000\u00df\u05a3\u0001" + + "\u0000\u0000\u0000\u00e1\u05b8\u0001\u0000\u0000\u0000\u00e3\u05c8\u0001" + + "\u0000\u0000\u0000\u00e5\u05d8\u0001\u0000\u0000\u0000\u00e7\u05f3\u0001" + + "\u0000\u0000\u0000\u00e9\u0608\u0001\u0000\u0000\u0000\u00eb\u0615\u0001" + + "\u0000\u0000\u0000\u00ed\u0625\u0001\u0000\u0000\u0000\u00ef\u063d\u0001" + + "\u0000\u0000\u0000\u00f1\u065a\u0001\u0000\u0000\u0000\u00f3\u0667\u0001" + + "\u0000\u0000\u0000\u00f5\u0678\u0001\u0000\u0000\u0000\u00f7\u067f\u0001" + + "\u0000\u0000\u0000\u00f9\u0692\u0001\u0000\u0000\u0000\u00fb\u069a\u0001" + + "\u0000\u0000\u0000\u00fd\u06a2\u0001\u0000\u0000\u0000\u00ff\u06ac\u0001" + + "\u0000\u0000\u0000\u0101\u06b4\u0001\u0000\u0000\u0000\u0103\u06bf\u0001" + + "\u0000\u0000\u0000\u0105\u06c8\u0001\u0000\u0000\u0000\u0107\u06ce\u0001" + + "\u0000\u0000\u0000\u0109\u06d7\u0001\u0000\u0000\u0000\u010b\u010f\u0003" + + "\u0007\u0003\u0000\u010c\u010e\b\u0000\u0000\u0000\u010d\u010c\u0001\u0000" + + "\u0000\u0000\u010e\u0111\u0001\u0000\u0000\u0000\u010f\u010d\u0001\u0000" + + "\u0000\u0000\u010f\u0110\u0001\u0000\u0000\u0000\u0110\u0112\u0001\u0000" + + "\u0000\u0000\u0111\u010f\u0001\u0000\u0000\u0000\u0112\u0113\u0006\u0000" + + "\u0000\u0000\u0113\u0002\u0001\u0000\u0000\u0000\u0114\u0115\u0005(\u0000" + + "\u0000\u0115\u0004\u0001\u0000\u0000\u0000\u0116\u0117\u0005)\u0000\u0000" + + "\u0117\u0006\u0001\u0000\u0000\u0000\u0118\u0119\u0005;\u0000\u0000\u0119" + + "\b\u0001\u0000\u0000\u0000\u011a\u011d\u0005\"\u0000\u0000\u011b\u011e" + + "\u0003\u00a7S\u0000\u011c\u011e\u0003\u00adV\u0000\u011d\u011b\u0001\u0000" + + "\u0000\u0000\u011d\u011c\u0001\u0000\u0000\u0000\u011e\u011f\u0001\u0000" + + "\u0000\u0000\u011f\u011d\u0001\u0000\u0000\u0000\u011f\u0120\u0001\u0000" + + "\u0000\u0000\u0120\u0121\u0001\u0000\u0000\u0000\u0121\u0122\u0005\"\u0000" + + "\u0000\u0122\n\u0001\u0000\u0000\u0000\u0123\u0126\u0005|\u0000\u0000" + + "\u0124\u0127\u0003\u00a9T\u0000\u0125\u0127\u0003\u00adV\u0000\u0126\u0124" + + "\u0001\u0000\u0000\u0000\u0126\u0125\u0001\u0000\u0000\u0000\u0127\u0128" + + "\u0001\u0000\u0000\u0000\u0128\u0126\u0001\u0000\u0000\u0000\u0128\u0129" + + "\u0001\u0000\u0000\u0000\u0129\u012a\u0001\u0000\u0000\u0000\u012a\u012b" + + "\u0005|\u0000\u0000\u012b\f\u0001\u0000\u0000\u0000\u012c\u012d\u0005" + + "(\u0000\u0000\u012d\u012e\u0005_\u0000\u0000\u012e\u012f\u0005 \u0000" + + "\u0000\u012f\u0130\u0005F\u0000\u0000\u0130\u0131\u0005l\u0000\u0000\u0131" + + "\u0132\u0005o\u0000\u0000\u0132\u0133\u0005a\u0000\u0000\u0133\u0134\u0005" + + "t\u0000\u0000\u0134\u0135\u0005i\u0000\u0000\u0135\u0136\u0005n\u0000" + + "\u0000\u0136\u0137\u0005g\u0000\u0000\u0137\u0138\u0005P\u0000\u0000\u0138" + + "\u0139\u0005o\u0000\u0000\u0139\u013a\u0005i\u0000\u0000\u013a\u013b\u0005" + + "n\u0000\u0000\u013b\u013c\u0005t\u0000\u0000\u013c\u013d\u0001\u0000\u0000" + + "\u0000\u013d\u013e\u0003\u00b1X\u0000\u013e\u013f\u0003\u0091H\u0000\u013f" + + "\u0140\u0003\u00b1X\u0000\u0140\u0141\u0003\u0091H\u0000\u0141\u0142\u0005" + + ")\u0000\u0000\u0142\u0145\u0001\u0000\u0000\u0000\u0143\u0145\u0003\u009f" + + "O\u0000\u0144\u012c\u0001\u0000\u0000\u0000\u0144\u0143\u0001\u0000\u0000" + + "\u0000\u0145\u000e\u0001\u0000\u0000\u0000\u0146\u0147\u0005(\u0000\u0000" + + "\u0147\u0148\u0005f\u0000\u0000\u0148\u0149\u0005p\u0000\u0000\u0149\u014a" + + "\u0001\u0000\u0000\u0000\u014a\u014d\u0003\u00b1X\u0000\u014b\u014e\u0003" + + "\u0093I\u0000\u014c\u014e\u0003\u0095J\u0000\u014d\u014b\u0001\u0000\u0000" + + "\u0000\u014d\u014c\u0001\u0000\u0000\u0000\u014e\u014f\u0001\u0000\u0000" + + "\u0000\u014f\u0152\u0003\u00b1X\u0000\u0150\u0153\u0003\u0093I\u0000\u0151" + + "\u0153\u0003\u0095J\u0000\u0152\u0150\u0001\u0000\u0000\u0000\u0152\u0151" + + "\u0001\u0000\u0000\u0000\u0153\u0154\u0001\u0000\u0000\u0000\u0154\u0157" + + "\u0003\u00b1X\u0000\u0155\u0158\u0003\u0093I\u0000\u0156\u0158\u0003\u0095" + + "J\u0000\u0157\u0155\u0001\u0000\u0000\u0000\u0157\u0156\u0001\u0000\u0000" + + "\u0000\u0158\u0159\u0001\u0000\u0000\u0000\u0159\u015a\u0005)\u0000\u0000" + + "\u015a\u0187\u0001\u0000\u0000\u0000\u015b\u015c\u0005(\u0000\u0000\u015c" + + "\u015d\u0005_\u0000\u0000\u015d\u015e\u0005 \u0000\u0000\u015e\u015f\u0001" + + "\u0000\u0000\u0000\u015f\u0160\u0007\u0001\u0000\u0000\u0160\u0161\u0005" + + "o\u0000\u0000\u0161\u0162\u0005o\u0000\u0000\u0162\u0163\u0001\u0000\u0000" + + "\u0000\u0163\u0164\u0003\u00b1X\u0000\u0164\u0165\u0003\u0091H\u0000\u0165" + + "\u0166\u0003\u00b1X\u0000\u0166\u0167\u0003\u0091H\u0000\u0167\u0168\u0005" + + ")\u0000\u0000\u0168\u0187\u0001\u0000\u0000\u0000\u0169\u016a\u0005(\u0000" + + "\u0000\u016a\u016b\u0005_\u0000\u0000\u016b\u016c\u0005 \u0000\u0000\u016c" + + "\u016d\u0001\u0000\u0000\u0000\u016d\u016e\u0007\u0001\u0000\u0000\u016e" + + "\u016f\u0005z\u0000\u0000\u016f\u0170\u0005e\u0000\u0000\u0170\u0171\u0005" + + "r\u0000\u0000\u0171\u0172\u0005o\u0000\u0000\u0172\u0173\u0001\u0000\u0000" + + "\u0000\u0173\u0174\u0003\u00b1X\u0000\u0174\u0175\u0003\u0091H\u0000\u0175" + + "\u0176\u0003\u00b1X\u0000\u0176\u0177\u0003\u0091H\u0000\u0177\u0178\u0005" + + ")\u0000\u0000\u0178\u0187\u0001\u0000\u0000\u0000\u0179\u017a\u0005(\u0000" + + "\u0000\u017a\u017b\u0005_\u0000\u0000\u017b\u017c\u0005 \u0000\u0000\u017c" + + "\u017d\u0005N\u0000\u0000\u017d\u017e\u0005a\u0000\u0000\u017e\u017f\u0005" + + "N\u0000\u0000\u017f\u0180\u0001\u0000\u0000\u0000\u0180\u0181\u0003\u00b1" + + "X\u0000\u0181\u0182\u0003\u0091H\u0000\u0182\u0183\u0003\u00b1X\u0000" + + "\u0183\u0184\u0003\u0091H\u0000\u0184\u0185\u0005)\u0000\u0000\u0185\u0187" + + "\u0001\u0000\u0000\u0000\u0186\u0146\u0001\u0000\u0000\u0000\u0186\u015b" + + "\u0001\u0000\u0000\u0000\u0186\u0169\u0001\u0000\u0000\u0000\u0186\u0179" + + "\u0001\u0000\u0000\u0000\u0187\u0010\u0001\u0000\u0000\u0000\u0188\u0189" + + "\u0005r\u0000\u0000\u0189\u018a\u0005e\u0000\u0000\u018a\u018b\u0005." + + "\u0000\u0000\u018b\u018c\u0005n\u0000\u0000\u018c\u018d\u0005o\u0000\u0000" + + "\u018d\u018e\u0005n\u0000\u0000\u018e\u01a0\u0005e\u0000\u0000\u018f\u0190" + + "\u0005r\u0000\u0000\u0190\u0191\u0005e\u0000\u0000\u0191\u0192\u0005." + + "\u0000\u0000\u0192\u0193\u0005a\u0000\u0000\u0193\u0194\u0005l\u0000\u0000" + + "\u0194\u0195\u0005l\u0000\u0000\u0195\u0196\u0005c\u0000\u0000\u0196\u0197" + + "\u0005h\u0000\u0000\u0197\u0198\u0005a\u0000\u0000\u0198\u01a0\u0005r" + + "\u0000\u0000\u0199\u019a\u0005r\u0000\u0000\u019a\u019b\u0005e\u0000\u0000" + + "\u019b\u019c\u0005.\u0000\u0000\u019c\u019d\u0005a\u0000\u0000\u019d\u019e" + + "\u0005l\u0000\u0000\u019e\u01a0\u0005l\u0000\u0000\u019f\u0188\u0001\u0000" + + "\u0000\u0000\u019f\u018f\u0001\u0000\u0000\u0000\u019f\u0199\u0001\u0000" + + "\u0000\u0000\u01a0\u0012\u0001\u0000\u0000\u0000\u01a1\u01a2\u0005(\u0000" + + "\u0000\u01a2\u01a3\u0005(\u0000\u0000\u01a3\u01a4\u0005_\u0000\u0000\u01a4" + + "\u01a5\u0005 \u0000\u0000\u01a5\u01a6\u0005t\u0000\u0000\u01a6\u01a7\u0005" + + "o\u0000\u0000\u01a7\u01a8\u0005_\u0000\u0000\u01a8\u01a9\u0005f\u0000" + + "\u0000\u01a9\u01aa\u0005p\u0000\u0000\u01aa\u01ab\u0001\u0000\u0000\u0000" + + "\u01ab\u01ac\u0003\u00b1X\u0000\u01ac\u01ad\u0003\u0091H\u0000\u01ad\u01ae" + + "\u0003\u00b1X\u0000\u01ae\u01af\u0003\u0091H\u0000\u01af\u01b0\u0005)" + + "\u0000\u0000\u01b0\u0014\u0001\u0000\u0000\u0000\u01b1\u01b2\u0005(\u0000" + + "\u0000\u01b2\u01b3\u0005(\u0000\u0000\u01b3\u01b4\u0005_\u0000\u0000\u01b4" + + "\u01b5\u0005 \u0000\u0000\u01b5\u01b6\u0005r\u0000\u0000\u01b6\u01b7\u0005" + + "e\u0000\u0000\u01b7\u01b8\u0005.\u0000\u0000\u01b8\u01b9\u0005^\u0000" + + "\u0000\u01b9\u01ba\u0001\u0000\u0000\u0000\u01ba\u01bb\u0003\u00b1X\u0000" + + "\u01bb\u01bc\u0003\u0091H\u0000\u01bc\u01bd\u0005)\u0000\u0000\u01bd\u0016" + + "\u0001\u0000\u0000\u0000\u01be\u01bf\u0005(\u0000\u0000\u01bf\u01c0\u0005" + + "(\u0000\u0000\u01c0\u01c1\u0005_\u0000\u0000\u01c1\u01c2\u0005 \u0000" + + "\u0000\u01c2\u01c3\u0005r\u0000\u0000\u01c3\u01c4\u0005e\u0000\u0000\u01c4" + + "\u01c5\u0005.\u0000\u0000\u01c5\u01c6\u0005l\u0000\u0000\u01c6\u01c7\u0005" + + "o\u0000\u0000\u01c7\u01c8\u0005o\u0000\u0000\u01c8\u01c9\u0005p\u0000" + + "\u0000\u01c9\u01ca\u0001\u0000\u0000\u0000\u01ca\u01cb\u0003\u00b1X\u0000" + + "\u01cb\u01cc\u0003\u0091H\u0000\u01cc\u01cd\u0003\u00b1X\u0000\u01cd\u01ce" + + "\u0003\u0091H\u0000\u01ce\u01cf\u0005)\u0000\u0000\u01cf\u0018\u0001\u0000" + + "\u0000\u0000\u01d0\u01d1\u0005n\u0000\u0000\u01d1\u01d2\u0005o\u0000\u0000" + + "\u01d2\u01d3\u0005t\u0000\u0000\u01d3\u001a\u0001\u0000\u0000\u0000\u01d4" + + "\u01d5\u0005B\u0000\u0000\u01d5\u01d6\u0005o\u0000\u0000\u01d6\u01d7\u0005" + + "o\u0000\u0000\u01d7\u01d8\u0005l\u0000\u0000\u01d8\u001c\u0001\u0000\u0000" + + "\u0000\u01d9\u01da\u0005c\u0000\u0000\u01da\u01db\u0005o\u0000\u0000\u01db" + + "\u01dc\u0005n\u0000\u0000\u01dc\u01dd\u0005t\u0000\u0000\u01dd\u01de\u0005" + + "i\u0000\u0000\u01de\u01df\u0005n\u0000\u0000\u01df\u01e0\u0005u\u0000" + + "\u0000\u01e0\u01e1\u0005e\u0000\u0000\u01e1\u01e2\u0005d\u0000\u0000\u01e2" + + "\u01e3\u0005-\u0000\u0000\u01e3\u01e4\u0005e\u0000\u0000\u01e4\u01e5\u0005" + + "x\u0000\u0000\u01e5\u01e6\u0005e\u0000\u0000\u01e6\u01e7\u0005c\u0000" + + "\u0000\u01e7\u01e8\u0005u\u0000\u0000\u01e8\u01e9\u0005t\u0000\u0000\u01e9" + + "\u01ea\u0005i\u0000\u0000\u01ea\u01eb\u0005o\u0000\u0000\u01eb\u01ec\u0005" + + "n\u0000\u0000\u01ec\u001e\u0001\u0000\u0000\u0000\u01ed\u01ee\u0005e\u0000" + + "\u0000\u01ee\u01ef\u0005r\u0000\u0000\u01ef\u01f0\u0005r\u0000\u0000\u01f0" + + "\u01f1\u0005o\u0000\u0000\u01f1\u01f2\u0005r\u0000\u0000\u01f2 \u0001" + + "\u0000\u0000\u0000\u01f3\u01f4\u0005f\u0000\u0000\u01f4\u01f5\u0005a\u0000" + + "\u0000\u01f5\u01f6\u0005l\u0000\u0000\u01f6\u01f7\u0005s\u0000\u0000\u01f7" + + "\u01f8\u0005e\u0000\u0000\u01f8\"\u0001\u0000\u0000\u0000\u01f9\u01fa" + + "\u0005i\u0000\u0000\u01fa\u01fb\u0005m\u0000\u0000\u01fb\u01fc\u0005m" + + "\u0000\u0000\u01fc\u01fd\u0005e\u0000\u0000\u01fd\u01fe\u0005d\u0000\u0000" + + "\u01fe\u01ff\u0005i\u0000\u0000\u01ff\u0200\u0005a\u0000\u0000\u0200\u0201" + + "\u0005t\u0000\u0000\u0201\u0202\u0005e\u0000\u0000\u0202\u0203\u0005-" + + "\u0000\u0000\u0203\u0204\u0005e\u0000\u0000\u0204\u0205\u0005x\u0000\u0000" + + "\u0205\u0206\u0005i\u0000\u0000\u0206\u0207\u0005t\u0000\u0000\u0207$" + + "\u0001\u0000\u0000\u0000\u0208\u0209\u0005i\u0000\u0000\u0209\u020a\u0005" + + "n\u0000\u0000\u020a\u020b\u0005c\u0000\u0000\u020b\u020c\u0005o\u0000" + + "\u0000\u020c\u020d\u0005m\u0000\u0000\u020d\u020e\u0005p\u0000\u0000\u020e" + + "\u020f\u0005l\u0000\u0000\u020f\u0210\u0005e\u0000\u0000\u0210\u0211\u0005" + + "t\u0000\u0000\u0211\u0212\u0005e\u0000\u0000\u0212&\u0001\u0000\u0000" + + "\u0000\u0213\u0214\u0005l\u0000\u0000\u0214\u0215\u0005o\u0000\u0000\u0215" + + "\u0216\u0005g\u0000\u0000\u0216\u0217\u0005i\u0000\u0000\u0217\u0218\u0005" + + "c\u0000\u0000\u0218(\u0001\u0000\u0000\u0000\u0219\u021a\u0005m\u0000" + + "\u0000\u021a\u021b\u0005e\u0000\u0000\u021b\u021c\u0005m\u0000\u0000\u021c" + + "\u021d\u0005o\u0000\u0000\u021d\u021e\u0005u\u0000\u0000\u021e\u021f\u0005" + + "t\u0000\u0000\u021f*\u0001\u0000\u0000\u0000\u0220\u0221\u0005s\u0000" + + "\u0000\u0221\u0222\u0005a\u0000\u0000\u0222\u0223\u0005t\u0000\u0000\u0223" + + ",\u0001\u0000\u0000\u0000\u0224\u0225\u0005s\u0000\u0000\u0225\u0226\u0005" + + "u\u0000\u0000\u0226\u0227\u0005c\u0000\u0000\u0227\u0228\u0005c\u0000" + + "\u0000\u0228\u0229\u0005e\u0000\u0000\u0229\u022a\u0005s\u0000\u0000\u022a" + + "\u022b\u0005s\u0000\u0000\u022b.\u0001\u0000\u0000\u0000\u022c\u022d\u0005" + + "t\u0000\u0000\u022d\u022e\u0005h\u0000\u0000\u022e\u022f\u0005e\u0000" + + "\u0000\u022f\u0230\u0005o\u0000\u0000\u0230\u0231\u0005r\u0000\u0000\u0231" + + "\u0232\u0005y\u0000\u0000\u02320\u0001\u0000\u0000\u0000\u0233\u0234\u0005" + + "t\u0000\u0000\u0234\u0235\u0005r\u0000\u0000\u0235\u0236\u0005u\u0000" + + "\u0000\u0236\u0237\u0005e\u0000\u0000\u02372\u0001\u0000\u0000\u0000\u0238" + + "\u0239\u0005u\u0000\u0000\u0239\u023a\u0005n\u0000\u0000\u023a\u023b\u0005" + + "k\u0000\u0000\u023b\u023c\u0005n\u0000\u0000\u023c\u023d\u0005o\u0000" + + "\u0000\u023d\u023e\u0005w\u0000\u0000\u023e\u023f\u0005n\u0000\u0000\u023f" + + "4\u0001\u0000\u0000\u0000\u0240\u0241\u0005u\u0000\u0000\u0241\u0242\u0005" + + "n\u0000\u0000\u0242\u0243\u0005s\u0000\u0000\u0243\u0244\u0005u\u0000" + + "\u0000\u0244\u0245\u0005p\u0000\u0000\u0245\u0246\u0005p\u0000\u0000\u0246" + + "\u0247\u0005o\u0000\u0000\u0247\u0248\u0005r\u0000\u0000\u0248\u0249\u0005" + + "t\u0000\u0000\u0249\u024a\u0005e\u0000\u0000\u024a\u024b\u0005d\u0000" + + "\u0000\u024b6\u0001\u0000\u0000\u0000\u024c\u024d\u0005u\u0000\u0000\u024d" + + "\u024e\u0005n\u0000\u0000\u024e\u024f\u0005s\u0000\u0000\u024f\u0250\u0005" + + "a\u0000\u0000\u0250\u0251\u0005t\u0000\u0000\u02518\u0001\u0000\u0000" + + "\u0000\u0252\u0253\u0005a\u0000\u0000\u0253\u0254\u0005s\u0000\u0000\u0254" + + "\u0255\u0005s\u0000\u0000\u0255\u0256\u0005e\u0000\u0000\u0256\u0257\u0005" + + "r\u0000\u0000\u0257\u0258\u0005t\u0000\u0000\u0258:\u0001\u0000\u0000" + + "\u0000\u0259\u025a\u0005c\u0000\u0000\u025a\u025b\u0005h\u0000\u0000\u025b" + + "\u025c\u0005e\u0000\u0000\u025c\u025d\u0005c\u0000\u0000\u025d\u025e\u0005" + + "k\u0000\u0000\u025e\u025f\u0005-\u0000\u0000\u025f\u0260\u0005s\u0000" + + "\u0000\u0260\u0261\u0005a\u0000\u0000\u0261\u0262\u0005t\u0000\u0000\u0262" + + "<\u0001\u0000\u0000\u0000\u0263\u0264\u0005c\u0000\u0000\u0264\u0265\u0005" + + "h\u0000\u0000\u0265\u0266\u0005e\u0000\u0000\u0266\u0267\u0005c\u0000" + + "\u0000\u0267\u0268\u0005k\u0000\u0000\u0268\u0269\u0005-\u0000\u0000\u0269" + + "\u026a\u0005s\u0000\u0000\u026a\u026b\u0005a\u0000\u0000\u026b\u026c\u0005" + + "t\u0000\u0000\u026c\u026d\u0005-\u0000\u0000\u026d\u026e\u0005a\u0000" + + "\u0000\u026e\u026f\u0005s\u0000\u0000\u026f\u0270\u0005s\u0000\u0000\u0270" + + "\u0271\u0005u\u0000\u0000\u0271\u0272\u0005m\u0000\u0000\u0272\u0273\u0005" + + "i\u0000\u0000\u0273\u0274\u0005n\u0000\u0000\u0274\u0275\u0005g\u0000" + + "\u0000\u0275>\u0001\u0000\u0000\u0000\u0276\u0277\u0005d\u0000\u0000\u0277" + + "\u0278\u0005e\u0000\u0000\u0278\u0279\u0005c\u0000\u0000\u0279\u027a\u0005" + + "l\u0000\u0000\u027a\u027b\u0005a\u0000\u0000\u027b\u027c\u0005r\u0000" + + "\u0000\u027c\u027d\u0005e\u0000\u0000\u027d\u027e\u0005-\u0000\u0000\u027e" + + "\u027f\u0005c\u0000\u0000\u027f\u0280\u0005o\u0000\u0000\u0280\u0281\u0005" + + "n\u0000\u0000\u0281\u0282\u0005s\u0000\u0000\u0282\u0283\u0005t\u0000" + + "\u0000\u0283@\u0001\u0000\u0000\u0000\u0284\u0285\u0005d\u0000\u0000\u0285" + + "\u0286\u0005e\u0000\u0000\u0286\u0287\u0005c\u0000\u0000\u0287\u0288\u0005" + + "l\u0000\u0000\u0288\u0289\u0005a\u0000\u0000\u0289\u028a\u0005r\u0000" + + "\u0000\u028a\u028b\u0005e\u0000\u0000\u028b\u028c\u0005-\u0000\u0000\u028c" + + "\u028d\u0005d\u0000\u0000\u028d\u028e\u0005a\u0000\u0000\u028e\u028f\u0005" + + "t\u0000\u0000\u028f\u0290\u0005a\u0000\u0000\u0290\u0291\u0005t\u0000" + + "\u0000\u0291\u0292\u0005y\u0000\u0000\u0292\u0293\u0005p\u0000\u0000\u0293" + + "\u0294\u0005e\u0000\u0000\u0294B\u0001\u0000\u0000\u0000\u0295\u0296\u0005" + + "d\u0000\u0000\u0296\u0297\u0005e\u0000\u0000\u0297\u0298\u0005c\u0000" + + "\u0000\u0298\u0299\u0005l\u0000\u0000\u0299\u029a\u0005a\u0000\u0000\u029a" + + "\u029b\u0005r\u0000\u0000\u029b\u029c\u0005e\u0000\u0000\u029c\u029d\u0005" + + "-\u0000\u0000\u029d\u029e\u0005d\u0000\u0000\u029e\u029f\u0005a\u0000" + + "\u0000\u029f\u02a0\u0005t\u0000\u0000\u02a0\u02a1\u0005a\u0000\u0000\u02a1" + + "\u02a2\u0005t\u0000\u0000\u02a2\u02a3\u0005y\u0000\u0000\u02a3\u02a4\u0005" + + "p\u0000\u0000\u02a4\u02a5\u0005e\u0000\u0000\u02a5\u02a6\u0005s\u0000" + + "\u0000\u02a6D\u0001\u0000\u0000\u0000\u02a7\u02a8\u0005d\u0000\u0000\u02a8" + + "\u02a9\u0005e\u0000\u0000\u02a9\u02aa\u0005c\u0000\u0000\u02aa\u02ab\u0005" + + "l\u0000\u0000\u02ab\u02ac\u0005a\u0000\u0000\u02ac\u02ad\u0005r\u0000" + + "\u0000\u02ad\u02ae\u0005e\u0000\u0000\u02ae\u02af\u0005-\u0000\u0000\u02af" + + "\u02b0\u0005f\u0000\u0000\u02b0\u02b1\u0005u\u0000\u0000\u02b1\u02b2\u0005" + + "n\u0000\u0000\u02b2F\u0001\u0000\u0000\u0000\u02b3\u02b4\u0005d\u0000" + + "\u0000\u02b4\u02b5\u0005e\u0000\u0000\u02b5\u02b6\u0005c\u0000\u0000\u02b6" + + "\u02b7\u0005l\u0000\u0000\u02b7\u02b8\u0005a\u0000\u0000\u02b8\u02b9\u0005" + + "r\u0000\u0000\u02b9\u02ba\u0005e\u0000\u0000\u02ba\u02bb\u0005-\u0000" + + "\u0000\u02bb\u02bc\u0005s\u0000\u0000\u02bc\u02bd\u0005o\u0000\u0000\u02bd" + + "\u02be\u0005r\u0000\u0000\u02be\u02bf\u0005t\u0000\u0000\u02bfH\u0001" + + "\u0000\u0000\u0000\u02c0\u02c1\u0005d\u0000\u0000\u02c1\u02c2\u0005e\u0000" + + "\u0000\u02c2\u02c3\u0005f\u0000\u0000\u02c3\u02c4\u0005i\u0000\u0000\u02c4" + + "\u02c5\u0005n\u0000\u0000\u02c5\u02c6\u0005e\u0000\u0000\u02c6\u02c7\u0005" + + "-\u0000\u0000\u02c7\u02c8\u0005f\u0000\u0000\u02c8\u02c9\u0005u\u0000" + + "\u0000\u02c9\u02ca\u0005n\u0000\u0000\u02caJ\u0001\u0000\u0000\u0000\u02cb" + + "\u02cc\u0005d\u0000\u0000\u02cc\u02cd\u0005e\u0000\u0000\u02cd\u02ce\u0005" + + "f\u0000\u0000\u02ce\u02cf\u0005i\u0000\u0000\u02cf\u02d0\u0005n\u0000" + + "\u0000\u02d0\u02d1\u0005e\u0000\u0000\u02d1\u02d2\u0005-\u0000\u0000\u02d2" + + "\u02d3\u0005f\u0000\u0000\u02d3\u02d4\u0005u\u0000\u0000\u02d4\u02d5\u0005" + + "n\u0000\u0000\u02d5\u02d6\u0005-\u0000\u0000\u02d6\u02d7\u0005r\u0000" + + "\u0000\u02d7\u02d8\u0005e\u0000\u0000\u02d8\u02d9\u0005c\u0000\u0000\u02d9" + + "L\u0001\u0000\u0000\u0000\u02da\u02db\u0005d\u0000\u0000\u02db\u02dc\u0005" + + "e\u0000\u0000\u02dc\u02dd\u0005f\u0000\u0000\u02dd\u02de\u0005i\u0000" + + "\u0000\u02de\u02df\u0005n\u0000\u0000\u02df\u02e0\u0005e\u0000\u0000\u02e0" + + "\u02e1\u0005-\u0000\u0000\u02e1\u02e2\u0005f\u0000\u0000\u02e2\u02e3\u0005" + + "u\u0000\u0000\u02e3\u02e4\u0005n\u0000\u0000\u02e4\u02e5\u0005s\u0000" + + "\u0000\u02e5\u02e6\u0005-\u0000\u0000\u02e6\u02e7\u0005r\u0000\u0000\u02e7" + + "\u02e8\u0005e\u0000\u0000\u02e8\u02e9\u0005c\u0000\u0000\u02e9N\u0001" + + "\u0000\u0000\u0000\u02ea\u02eb\u0005d\u0000\u0000\u02eb\u02ec\u0005e\u0000" + + "\u0000\u02ec\u02ed\u0005f\u0000\u0000\u02ed\u02ee\u0005i\u0000\u0000\u02ee" + + "\u02ef\u0005n\u0000\u0000\u02ef\u02f0\u0005e\u0000\u0000\u02f0\u02f1\u0005" + + "-\u0000\u0000\u02f1\u02f2\u0005s\u0000\u0000\u02f2\u02f3\u0005o\u0000" + + "\u0000\u02f3\u02f4\u0005r\u0000\u0000\u02f4\u02f5\u0005t\u0000\u0000\u02f5" + + "P\u0001\u0000\u0000\u0000\u02f6\u02f7\u0005e\u0000\u0000\u02f7\u02f8\u0005" + + "c\u0000\u0000\u02f8\u02f9\u0005h\u0000\u0000\u02f9\u02fa\u0005o\u0000" + + "\u0000\u02faR\u0001\u0000\u0000\u0000\u02fb\u02fc\u0005e\u0000\u0000\u02fc" + + "\u02fd\u0005x\u0000\u0000\u02fd\u02fe\u0005i\u0000\u0000\u02fe\u02ff\u0005" + + "t\u0000\u0000\u02ffT\u0001\u0000\u0000\u0000\u0300\u0301\u0005g\u0000" + + "\u0000\u0301\u0302\u0005e\u0000\u0000\u0302\u0303\u0005t\u0000\u0000\u0303" + + "\u0304\u0005-\u0000\u0000\u0304\u0305\u0005a\u0000\u0000\u0305\u0306\u0005" + + "s\u0000\u0000\u0306\u0307\u0005s\u0000\u0000\u0307\u0308\u0005e\u0000" + + "\u0000\u0308\u0309\u0005r\u0000\u0000\u0309\u030a\u0005t\u0000\u0000\u030a" + + "\u030b\u0005i\u0000\u0000\u030b\u030c\u0005o\u0000\u0000\u030c\u030d\u0005" + + "n\u0000\u0000\u030d\u030e\u0005s\u0000\u0000\u030eV\u0001\u0000\u0000" + + "\u0000\u030f\u0310\u0005g\u0000\u0000\u0310\u0311\u0005e\u0000\u0000\u0311" + + "\u0312\u0005t\u0000\u0000\u0312\u0313\u0005-\u0000\u0000\u0313\u0314\u0005" + + "a\u0000\u0000\u0314\u0315\u0005s\u0000\u0000\u0315\u0316\u0005s\u0000" + + "\u0000\u0316\u0317\u0005i\u0000\u0000\u0317\u0318\u0005g\u0000\u0000\u0318" + + "\u0319\u0005n\u0000\u0000\u0319\u031a\u0005m\u0000\u0000\u031a\u031b\u0005" + + "e\u0000\u0000\u031b\u031c\u0005n\u0000\u0000\u031c\u031d\u0005t\u0000" + + "\u0000\u031dX\u0001\u0000\u0000\u0000\u031e\u031f\u0005g\u0000\u0000\u031f" + + "\u0320\u0005e\u0000\u0000\u0320\u0321\u0005t\u0000\u0000\u0321\u0322\u0005" + + "-\u0000\u0000\u0322\u0323\u0005i\u0000\u0000\u0323\u0324\u0005n\u0000" + + "\u0000\u0324\u0325\u0005f\u0000\u0000\u0325\u0326\u0005o\u0000\u0000\u0326" + + "Z\u0001\u0000\u0000\u0000\u0327\u0328\u0005g\u0000\u0000\u0328\u0329\u0005" + + "e\u0000\u0000\u0329\u032a\u0005t\u0000\u0000\u032a\u032b\u0005-\u0000" + + "\u0000\u032b\u032c\u0005m\u0000\u0000\u032c\u032d\u0005o\u0000\u0000\u032d" + + "\u032e\u0005d\u0000\u0000\u032e\u032f\u0005e\u0000\u0000\u032f\u0330\u0005" + + "l\u0000\u0000\u0330\\\u0001\u0000\u0000\u0000\u0331\u0332\u0005g\u0000" + + "\u0000\u0332\u0333\u0005e\u0000\u0000\u0333\u0334\u0005t\u0000\u0000\u0334" + + "\u0335\u0005-\u0000\u0000\u0335\u0336\u0005o\u0000\u0000\u0336\u0337\u0005" + + "p\u0000\u0000\u0337\u0338\u0005t\u0000\u0000\u0338\u0339\u0005i\u0000" + + "\u0000\u0339\u033a\u0005o\u0000\u0000\u033a\u033b\u0005n\u0000\u0000\u033b" + + "^\u0001\u0000\u0000\u0000\u033c\u033d\u0005g\u0000\u0000\u033d\u033e\u0005" + + "e\u0000\u0000\u033e\u033f\u0005t\u0000\u0000\u033f\u0340\u0005-\u0000" + + "\u0000\u0340\u0341\u0005p\u0000\u0000\u0341\u0342\u0005r\u0000\u0000\u0342" + + "\u0343\u0005o\u0000\u0000\u0343\u0344\u0005o\u0000\u0000\u0344\u0345\u0005" + + "f\u0000\u0000\u0345`\u0001\u0000\u0000\u0000\u0346\u0347\u0005g\u0000" + + "\u0000\u0347\u0348\u0005e\u0000\u0000\u0348\u0349\u0005t\u0000\u0000\u0349" + + "\u034a\u0005-\u0000\u0000\u034a\u034b\u0005u\u0000\u0000\u034b\u034c\u0005" + + "n\u0000\u0000\u034c\u034d\u0005s\u0000\u0000\u034d\u034e\u0005a\u0000" + + "\u0000\u034e\u034f\u0005t\u0000\u0000\u034f\u0350\u0005-\u0000\u0000\u0350" + + "\u0351\u0005a\u0000\u0000\u0351\u0352\u0005s\u0000\u0000\u0352\u0353\u0005" + + "s\u0000\u0000\u0353\u0354\u0005u\u0000\u0000\u0354\u0355\u0005m\u0000" + + "\u0000\u0355\u0356\u0005p\u0000\u0000\u0356\u0357\u0005t\u0000\u0000\u0357" + + "\u0358\u0005i\u0000\u0000\u0358\u0359\u0005o\u0000\u0000\u0359\u035a\u0005" + + "n\u0000\u0000\u035a\u035b\u0005s\u0000\u0000\u035bb\u0001\u0000\u0000" + + "\u0000\u035c\u035d\u0005g\u0000\u0000\u035d\u035e\u0005e\u0000\u0000\u035e" + + "\u035f\u0005t\u0000\u0000\u035f\u0360\u0005-\u0000\u0000\u0360\u0361\u0005" + + "u\u0000\u0000\u0361\u0362\u0005n\u0000\u0000\u0362\u0363\u0005s\u0000" + + "\u0000\u0363\u0364\u0005a\u0000\u0000\u0364\u0365\u0005t\u0000\u0000\u0365" + + "\u0366\u0005-\u0000\u0000\u0366\u0367\u0005c\u0000\u0000\u0367\u0368\u0005" + + "o\u0000\u0000\u0368\u0369\u0005r\u0000\u0000\u0369\u036a\u0005e\u0000" + + "\u0000\u036ad\u0001\u0000\u0000\u0000\u036b\u036c\u0005g\u0000\u0000\u036c" + + "\u036d\u0005e\u0000\u0000\u036d\u036e\u0005t\u0000\u0000\u036e\u036f\u0005" + + "-\u0000\u0000\u036f\u0370\u0005v\u0000\u0000\u0370\u0371\u0005a\u0000" + + "\u0000\u0371\u0372\u0005l\u0000\u0000\u0372\u0373\u0005u\u0000\u0000\u0373" + + "\u0374\u0005e\u0000\u0000\u0374f\u0001\u0000\u0000\u0000\u0375\u0376\u0005" + + "p\u0000\u0000\u0376\u0377\u0005o\u0000\u0000\u0377\u0378\u0005p\u0000" + + "\u0000\u0378h\u0001\u0000\u0000\u0000\u0379\u037a\u0005p\u0000\u0000\u037a" + + "\u037b\u0005u\u0000\u0000\u037b\u037c\u0005s\u0000\u0000\u037c\u037d\u0005" + + "h\u0000\u0000\u037dj\u0001\u0000\u0000\u0000\u037e\u037f\u0005r\u0000" + + "\u0000\u037f\u0380\u0005e\u0000\u0000\u0380\u0381\u0005s\u0000\u0000\u0381" + + "\u0382\u0005e\u0000\u0000\u0382\u0383\u0005t\u0000\u0000\u0383l\u0001" + + "\u0000\u0000\u0000\u0384\u0385\u0005r\u0000\u0000\u0385\u0386\u0005e\u0000" + + "\u0000\u0386\u0387\u0005s\u0000\u0000\u0387\u0388\u0005e\u0000\u0000\u0388" + + "\u0389\u0005t\u0000\u0000\u0389\u038a\u0005-\u0000\u0000\u038a\u038b\u0005" + + "a\u0000\u0000\u038b\u038c\u0005s\u0000\u0000\u038c\u038d\u0005s\u0000" + + "\u0000\u038d\u038e\u0005e\u0000\u0000\u038e\u038f\u0005r\u0000\u0000\u038f" + + "\u0390\u0005t\u0000\u0000\u0390\u0391\u0005i\u0000\u0000\u0391\u0392\u0005" + + "o\u0000\u0000\u0392\u0393\u0005n\u0000\u0000\u0393\u0394\u0005s\u0000" + + "\u0000\u0394n\u0001\u0000\u0000\u0000\u0395\u0396\u0005s\u0000\u0000\u0396" + + "\u0397\u0005e\u0000\u0000\u0397\u0398\u0005t\u0000\u0000\u0398\u0399\u0005" + + "-\u0000\u0000\u0399\u039a\u0005i\u0000\u0000\u039a\u039b\u0005n\u0000" + + "\u0000\u039b\u039c\u0005f\u0000\u0000\u039c\u039d\u0005o\u0000\u0000\u039d" + + "p\u0001\u0000\u0000\u0000\u039e\u039f\u0005s\u0000\u0000\u039f\u03a0\u0005" + + "e\u0000\u0000\u03a0\u03a1\u0005t\u0000\u0000\u03a1\u03a2\u0005-\u0000" + + "\u0000\u03a2\u03a3\u0005l\u0000\u0000\u03a3\u03a4\u0005o\u0000\u0000\u03a4" + + "\u03a5\u0005g\u0000\u0000\u03a5\u03a6\u0005i\u0000\u0000\u03a6\u03a7\u0005" + + "c\u0000\u0000\u03a7r\u0001\u0000\u0000\u0000\u03a8\u03a9\u0005s\u0000" + + "\u0000\u03a9\u03aa\u0005e\u0000\u0000\u03aa\u03ab\u0005t\u0000\u0000\u03ab" + + "\u03ac\u0005-\u0000\u0000\u03ac\u03ad\u0005o\u0000\u0000\u03ad\u03ae\u0005" + + "p\u0000\u0000\u03ae\u03af\u0005t\u0000\u0000\u03af\u03b0\u0005i\u0000" + + "\u0000\u03b0\u03b1\u0005o\u0000\u0000\u03b1\u03b2\u0005n\u0000\u0000\u03b2" + + "t\u0001\u0000\u0000\u0000\u03b3\u03b4\u0005!\u0000\u0000\u03b4v\u0001" + + "\u0000\u0000\u0000\u03b5\u03b6\u0005_\u0000\u0000\u03b6x\u0001\u0000\u0000" + + "\u0000\u03b7\u03b8\u0005a\u0000\u0000\u03b8\u03b9\u0005s\u0000\u0000\u03b9" + + "z\u0001\u0000\u0000\u0000\u03ba\u03bb\u0005B\u0000\u0000\u03bb\u03bc\u0005" + + "I\u0000\u0000\u03bc\u03bd\u0005N\u0000\u0000\u03bd\u03be\u0005A\u0000" + + "\u0000\u03be\u03bf\u0005R\u0000\u0000\u03bf\u03c0\u0005Y\u0000\u0000\u03c0" + + "|\u0001\u0000\u0000\u0000\u03c1\u03c2\u0005D\u0000\u0000\u03c2\u03c3\u0005" + + "E\u0000\u0000\u03c3\u03c4\u0005C\u0000\u0000\u03c4\u03c5\u0005I\u0000" + + "\u0000\u03c5\u03c6\u0005M\u0000\u0000\u03c6\u03c7\u0005A\u0000\u0000\u03c7" + + "\u03c8\u0005L\u0000\u0000\u03c8~\u0001\u0000\u0000\u0000\u03c9\u03ca\u0005" + + "e\u0000\u0000\u03ca\u03cb\u0005x\u0000\u0000\u03cb\u03cc\u0005i\u0000" + + "\u0000\u03cc\u03cd\u0005s\u0000\u0000\u03cd\u03ce\u0005t\u0000\u0000\u03ce" + + "\u03cf\u0005s\u0000\u0000\u03cf\u0080\u0001\u0000\u0000\u0000\u03d0\u03d1" + + "\u0005H\u0000\u0000\u03d1\u03d2\u0005E\u0000\u0000\u03d2\u03d3\u0005X" + + "\u0000\u0000\u03d3\u03d4\u0005A\u0000\u0000\u03d4\u03d5\u0005D\u0000\u0000" + + "\u03d5\u03d6\u0005E\u0000\u0000\u03d6\u03d7\u0005C\u0000\u0000\u03d7\u03d8" + + "\u0005I\u0000\u0000\u03d8\u03d9\u0005M\u0000\u0000\u03d9\u03da\u0005A" + + "\u0000\u0000\u03da\u03db\u0005L\u0000\u0000\u03db\u0082\u0001\u0000\u0000" + + "\u0000\u03dc\u03dd\u0005f\u0000\u0000\u03dd\u03de\u0005o\u0000\u0000\u03de" + + "\u03df\u0005r\u0000\u0000\u03df\u03e0\u0005a\u0000\u0000\u03e0\u03e1\u0005" + + "l\u0000\u0000\u03e1\u03e2\u0005l\u0000\u0000\u03e2\u0084\u0001\u0000\u0000" + + "\u0000\u03e3\u03e4\u0005l\u0000\u0000\u03e4\u03e5\u0005e\u0000\u0000\u03e5" + + "\u03e6\u0005t\u0000\u0000\u03e6\u0086\u0001\u0000\u0000\u0000\u03e7\u03e8" + + "\u0005m\u0000\u0000\u03e8\u03e9\u0005a\u0000\u0000\u03e9\u03ea\u0005t" + + "\u0000\u0000\u03ea\u03eb\u0005c\u0000\u0000\u03eb\u03ec\u0005h\u0000\u0000" + + "\u03ec\u0088\u0001\u0000\u0000\u0000\u03ed\u03ee\u0005N\u0000\u0000\u03ee" + + "\u03ef\u0005U\u0000\u0000\u03ef\u03f0\u0005M\u0000\u0000\u03f0\u03f1\u0005" + + "E\u0000\u0000\u03f1\u03f2\u0005R\u0000\u0000\u03f2\u03f3\u0005A\u0000" + + "\u0000\u03f3\u03f4\u0005L\u0000\u0000\u03f4\u008a\u0001\u0000\u0000\u0000" + + "\u03f5\u03f6\u0005p\u0000\u0000\u03f6\u03f7\u0005a\u0000\u0000\u03f7\u03f8" + + "\u0005r\u0000\u0000\u03f8\u008c\u0001\u0000\u0000\u0000\u03f9\u03fa\u0005" + + "s\u0000\u0000\u03fa\u03fb\u0005t\u0000\u0000\u03fb\u03fc\u0005r\u0000" + + "\u0000\u03fc\u03fd\u0005i\u0000\u0000\u03fd\u03fe\u0005n\u0000\u0000\u03fe" + + "\u03ff\u0005g\u0000\u0000\u03ff\u008e\u0001\u0000\u0000\u0000\u0400\u0401" + + "\u0005_\u0000\u0000\u0401\u0402\u0005 \u0000\u0000\u0402\u0403\u0005F" + + "\u0000\u0000\u0403\u0404\u0005l\u0000\u0000\u0404\u0405\u0005o\u0000\u0000" + + "\u0405\u0406\u0005a\u0000\u0000\u0406\u0407\u0005t\u0000\u0000\u0407\u0408" + + "\u0005i\u0000\u0000\u0408\u0409\u0005n\u0000\u0000\u0409\u040a\u0005g" + + "\u0000\u0000\u040a\u040b\u0005P\u0000\u0000\u040b\u040c\u0005o\u0000\u0000" + + "\u040c\u040d\u0005i\u0000\u0000\u040d\u040e\u0005n\u0000\u0000\u040e\u040f" + + "\u0005t\u0000\u0000\u040f\u0090\u0001\u0000\u0000\u0000\u0410\u0419\u0005" + + "0\u0000\u0000\u0411\u0415\u0007\u0002\u0000\u0000\u0412\u0414\u0003\u009d" + + "N\u0000\u0413\u0412\u0001\u0000\u0000\u0000\u0414\u0417\u0001\u0000\u0000" + + "\u0000\u0415\u0413\u0001\u0000\u0000\u0000\u0415\u0416\u0001\u0000\u0000" + + "\u0000\u0416\u0419\u0001\u0000\u0000\u0000\u0417\u0415\u0001\u0000\u0000" + + "\u0000\u0418\u0410\u0001\u0000\u0000\u0000\u0418\u0411\u0001\u0000\u0000" + + "\u0000\u0419\u0092\u0001\u0000\u0000\u0000\u041a\u041b\u0005#\u0000\u0000" + + "\u041b\u041c\u0005b\u0000\u0000\u041c\u041e\u0001\u0000\u0000\u0000\u041d" + + "\u041f\u0003\u00a3Q\u0000\u041e\u041d\u0001\u0000\u0000\u0000\u041f\u0420" + + "\u0001\u0000\u0000\u0000\u0420\u041e\u0001\u0000\u0000\u0000\u0420\u0421" + + "\u0001\u0000\u0000\u0000\u0421\u0094\u0001\u0000\u0000\u0000\u0422\u0423" + + "\u0005#\u0000\u0000\u0423\u0424\u0005x\u0000\u0000\u0424\u0426\u0001\u0000" + + "\u0000\u0000\u0425\u0427\u0003\u0099L\u0000\u0426\u0425\u0001\u0000\u0000" + + "\u0000\u0427\u0428\u0001\u0000\u0000\u0000\u0428\u0426\u0001\u0000\u0000" + + "\u0000\u0428\u0429\u0001\u0000\u0000\u0000\u0429\u0096\u0001\u0000\u0000" + + "\u0000\u042a\u042b\u0003\u0091H\u0000\u042b\u042f\u0005.\u0000\u0000\u042c" + + "\u042e\u00050\u0000\u0000\u042d\u042c\u0001\u0000\u0000\u0000\u042e\u0431" + + "\u0001\u0000\u0000\u0000\u042f\u042d\u0001\u0000\u0000\u0000\u042f\u0430" + + "\u0001\u0000\u0000\u0000\u0430\u0432\u0001\u0000\u0000\u0000\u0431\u042f" + + "\u0001\u0000\u0000\u0000\u0432\u0433\u0003\u0091H\u0000\u0433\u0098\u0001" + + "\u0000\u0000\u0000\u0434\u0435\u0007\u0003\u0000\u0000\u0435\u009a\u0001" + + "\u0000\u0000\u0000\u0436\u0437\u0005:\u0000\u0000\u0437\u009c\u0001\u0000" + + "\u0000\u0000\u0438\u0439\u0007\u0004\u0000\u0000\u0439\u009e\u0001\u0000" + + "\u0000\u0000\u043a\u043b\u0005F\u0000\u0000\u043b\u043c\u0005l\u0000\u0000" + + "\u043c\u043d\u0005o\u0000\u0000\u043d\u043e\u0005a\u0000\u0000\u043e\u043f" + + "\u0005t\u0000\u0000\u043f\u0440\u00051\u0000\u0000\u0440\u0458\u00056" + + "\u0000\u0000\u0441\u0442\u0005F\u0000\u0000\u0442\u0443\u0005l\u0000\u0000" + + "\u0443\u0444\u0005o\u0000\u0000\u0444\u0445\u0005a\u0000\u0000\u0445\u0446" + + "\u0005t\u0000\u0000\u0446\u0447\u00053\u0000\u0000\u0447\u0458\u00052" + + "\u0000\u0000\u0448\u0449\u0005F\u0000\u0000\u0449\u044a\u0005l\u0000\u0000" + + "\u044a\u044b\u0005o\u0000\u0000\u044b\u044c\u0005a\u0000\u0000\u044c\u044d" + + "\u0005t\u0000\u0000\u044d\u044e\u00056\u0000\u0000\u044e\u0458\u00054" + + "\u0000\u0000\u044f\u0450\u0005F\u0000\u0000\u0450\u0451\u0005l\u0000\u0000" + + "\u0451\u0452\u0005o\u0000\u0000\u0452\u0453\u0005a\u0000\u0000\u0453\u0454" + + "\u0005t\u0000\u0000\u0454\u0455\u00051\u0000\u0000\u0455\u0456\u00052" + + "\u0000\u0000\u0456\u0458\u00058\u0000\u0000\u0457\u043a\u0001\u0000\u0000" + + "\u0000\u0457\u0441\u0001\u0000\u0000\u0000\u0457\u0448\u0001\u0000\u0000" + + "\u0000\u0457\u044f\u0001\u0000\u0000\u0000\u0458\u00a0\u0001\u0000\u0000" + + "\u0000\u0459\u0460\u0007\u0005\u0000\u0000\u045a\u045b\u0005>\u0000\u0000" + + "\u045b\u0460\u0005=\u0000\u0000\u045c\u045d\u0005<\u0000\u0000\u045d\u0460" + + "\u0005=\u0000\u0000\u045e\u0460\u0007\u0006\u0000\u0000\u045f\u0459\u0001" + + "\u0000\u0000\u0000\u045f\u045a\u0001\u0000\u0000\u0000\u045f\u045c\u0001" + + "\u0000\u0000\u0000\u045f\u045e\u0001\u0000\u0000\u0000\u0460\u00a2\u0001" + + "\u0000\u0000\u0000\u0461\u0462\u0007\u0007\u0000\u0000\u0462\u00a4\u0001" + + "\u0000\u0000\u0000\u0463\u0466\u0007\b\u0000\u0000\u0464\u0466\u0003\u00ab" + + "U\u0000\u0465\u0463\u0001\u0000\u0000\u0000\u0465\u0464\u0001\u0000\u0000" + + "\u0000\u0466\u00a6\u0001\u0000\u0000\u0000\u0467\u046a\u0007\t\u0000\u0000" + + "\u0468\u046a\u0003\u00abU\u0000\u0469\u0467\u0001\u0000\u0000\u0000\u0469" + + "\u0468\u0001\u0000\u0000\u0000\u046a\u00a8\u0001\u0000\u0000\u0000\u046b" + + "\u046e\u0007\n\u0000\u0000\u046c\u046e\u0003\u00abU\u0000\u046d\u046b" + + "\u0001\u0000\u0000\u0000\u046d\u046c\u0001\u0000\u0000\u0000\u046e\u00aa" + + "\u0001\u0000\u0000\u0000\u046f\u0470\u0005\"\u0000\u0000\u0470\u0471\u0005" + + "\"\u0000\u0000\u0471\u00ac\u0001\u0000\u0000\u0000\u0472\u0475\u0007\u000b" + + "\u0000\u0000\u0473\u0475\u0003\u00afW\u0000\u0474\u0472\u0001\u0000\u0000" + + "\u0000\u0474\u0473\u0001\u0000\u0000\u0000\u0475\u00ae\u0001\u0000\u0000" + + "\u0000\u0476\u0477\u0005 \u0000\u0000\u0477\u00b0\u0001\u0000\u0000\u0000" + + "\u0478\u047b\u0007\f\u0000\u0000\u0479\u047b\u0003\u00adV\u0000\u047a" + + "\u0478\u0001\u0000\u0000\u0000\u047a\u0479\u0001\u0000\u0000\u0000\u047b" + + "\u00b2\u0001\u0000\u0000\u0000\u047c\u047d\u0005:\u0000\u0000\u047d\u047e" + + "\u0005a\u0000\u0000\u047e\u047f\u0005l\u0000\u0000\u047f\u0480\u0005l" + + "\u0000\u0000\u0480\u0481\u0005-\u0000\u0000\u0481\u0482\u0005s\u0000\u0000" + + "\u0482\u0483\u0005t\u0000\u0000\u0483\u0484\u0005a\u0000\u0000\u0484\u0485" + + "\u0005t\u0000\u0000\u0485\u0486\u0005i\u0000\u0000\u0486\u0487\u0005s" + + "\u0000\u0000\u0487\u0488\u0005t\u0000\u0000\u0488\u0489\u0005i\u0000\u0000" + + "\u0489\u048a\u0005c\u0000\u0000\u048a\u048b\u0005s\u0000\u0000\u048b\u00b4" + + "\u0001\u0000\u0000\u0000\u048c\u048d\u0005:\u0000\u0000\u048d\u048e\u0005" + + "a\u0000\u0000\u048e\u048f\u0005s\u0000\u0000\u048f\u0490\u0005s\u0000" + + "\u0000\u0490\u0491\u0005e\u0000\u0000\u0491\u0492\u0005r\u0000\u0000\u0492" + + "\u0493\u0005t\u0000\u0000\u0493\u0494\u0005i\u0000\u0000\u0494\u0495\u0005" + + "o\u0000\u0000\u0495\u0496\u0005n\u0000\u0000\u0496\u0497\u0005-\u0000" + + "\u0000\u0497\u0498\u0005s\u0000\u0000\u0498\u0499\u0005t\u0000\u0000\u0499" + + "\u049a\u0005a\u0000\u0000\u049a\u049b\u0005c\u0000\u0000\u049b\u049c\u0005" + + "k\u0000\u0000\u049c\u049d\u0005-\u0000\u0000\u049d\u049e\u0005l\u0000" + + "\u0000\u049e\u049f\u0005e\u0000\u0000\u049f\u04a0\u0005v\u0000\u0000\u04a0" + + "\u04a1\u0005e\u0000\u0000\u04a1\u04a2\u0005l\u0000\u0000\u04a2\u04a3\u0005" + + "s\u0000\u0000\u04a3\u00b6\u0001\u0000\u0000\u0000\u04a4\u04a5\u0005:\u0000" + + "\u0000\u04a5\u04a6\u0005a\u0000\u0000\u04a6\u04a7\u0005u\u0000\u0000\u04a7" + + "\u04a8\u0005t\u0000\u0000\u04a8\u04a9\u0005h\u0000\u0000\u04a9\u04aa\u0005" + + "o\u0000\u0000\u04aa\u04ab\u0005r\u0000\u0000\u04ab\u04ac\u0005s\u0000" + + "\u0000\u04ac\u00b8\u0001\u0000\u0000\u0000\u04ad\u04ae\u0005:\u0000\u0000" + + "\u04ae\u04af\u0005c\u0000\u0000\u04af\u04b0\u0005a\u0000\u0000\u04b0\u04b1" + + "\u0005t\u0000\u0000\u04b1\u04b2\u0005e\u0000\u0000\u04b2\u04b3\u0005g" + + "\u0000\u0000\u04b3\u04b4\u0005o\u0000\u0000\u04b4\u04b5\u0005r\u0000\u0000" + + "\u04b5\u04b6\u0005y\u0000\u0000\u04b6\u00ba\u0001\u0000\u0000\u0000\u04b7" + + "\u04b8\u0005:\u0000\u0000\u04b8\u04b9\u0005c\u0000\u0000\u04b9\u04ba\u0005" + + "h\u0000\u0000\u04ba\u04bb\u0005a\u0000\u0000\u04bb\u04bc\u0005i\u0000" + + "\u0000\u04bc\u04bd\u0005n\u0000\u0000\u04bd\u04be\u0005a\u0000\u0000\u04be" + + "\u04bf\u0005b\u0000\u0000\u04bf\u04c0\u0005l\u0000\u0000\u04c0\u04c1\u0005" + + "e\u0000\u0000\u04c1\u00bc\u0001\u0000\u0000\u0000\u04c2\u04c3\u0005:\u0000" + + "\u0000\u04c3\u04c4\u0005d\u0000\u0000\u04c4\u04c5\u0005e\u0000\u0000\u04c5" + + "\u04c6\u0005f\u0000\u0000\u04c6\u04c7\u0005i\u0000\u0000\u04c7\u04c8\u0005" + + "n\u0000\u0000\u04c8\u04c9\u0005i\u0000\u0000\u04c9\u04ca\u0005t\u0000" + + "\u0000\u04ca\u04cb\u0005i\u0000\u0000\u04cb\u04cc\u0005o\u0000\u0000\u04cc" + + "\u04cd\u0005n\u0000\u0000\u04cd\u00be\u0001\u0000\u0000\u0000\u04ce\u04cf" + + "\u0005:\u0000\u0000\u04cf\u04d0\u0005d\u0000\u0000\u04d0\u04d1\u0005i" + + "\u0000\u0000\u04d1\u04d2\u0005a\u0000\u0000\u04d2\u04d3\u0005g\u0000\u0000" + + "\u04d3\u04d4\u0005n\u0000\u0000\u04d4\u04d5\u0005o\u0000\u0000\u04d5\u04d6" + + "\u0005s\u0000\u0000\u04d6\u04d7\u0005t\u0000\u0000\u04d7\u04d8\u0005i" + + "\u0000\u0000\u04d8\u04d9\u0005c\u0000\u0000\u04d9\u04da\u0005-\u0000\u0000" + + "\u04da\u04db\u0005o\u0000\u0000\u04db\u04dc\u0005u\u0000\u0000\u04dc\u04dd" + + "\u0005t\u0000\u0000\u04dd\u04de\u0005p\u0000\u0000\u04de\u04df\u0005u" + + "\u0000\u0000\u04df\u04e0\u0005t\u0000\u0000\u04e0\u04e1\u0005-\u0000\u0000" + + "\u04e1\u04e2\u0005c\u0000\u0000\u04e2\u04e3\u0005h\u0000\u0000\u04e3\u04e4" + + "\u0005a\u0000\u0000\u04e4\u04e5\u0005n\u0000\u0000\u04e5\u04e6\u0005n" + + "\u0000\u0000\u04e6\u04e7\u0005e\u0000\u0000\u04e7\u04e8\u0005l\u0000\u0000" + + "\u04e8\u00c0\u0001\u0000\u0000\u0000\u04e9\u04ea\u0005:\u0000\u0000\u04ea" + + "\u04eb\u0005e\u0000\u0000\u04eb\u04ec\u0005r\u0000\u0000\u04ec\u04ed\u0005" + + "r\u0000\u0000\u04ed\u04ee\u0005o\u0000\u0000\u04ee\u04ef\u0005r\u0000" + + "\u0000\u04ef\u04f0\u0005-\u0000\u0000\u04f0\u04f1\u0005b\u0000\u0000\u04f1" + + "\u04f2\u0005e\u0000\u0000\u04f2\u04f3\u0005h\u0000\u0000\u04f3\u04f4\u0005" + + "a\u0000\u0000\u04f4\u04f5\u0005v\u0000\u0000\u04f5\u04f6\u0005i\u0000" + + "\u0000\u04f6\u04f7\u0005o\u0000\u0000\u04f7\u04f8\u0005r\u0000\u0000\u04f8" + + "\u00c2\u0001\u0000\u0000\u0000\u04f9\u04fa\u0005:\u0000\u0000\u04fa\u04fb" + + "\u0005e\u0000\u0000\u04fb\u04fc\u0005x\u0000\u0000\u04fc\u04fd\u0005t" + + "\u0000\u0000\u04fd\u04fe\u0005e\u0000\u0000\u04fe\u04ff\u0005n\u0000\u0000" + + "\u04ff\u0500\u0005s\u0000\u0000\u0500\u0501\u0005i\u0000\u0000\u0501\u0502" + + "\u0005o\u0000\u0000\u0502\u0503\u0005n\u0000\u0000\u0503\u0504\u0005s" + + "\u0000\u0000\u0504\u00c4\u0001\u0000\u0000\u0000\u0505\u0506\u0005:\u0000" + + "\u0000\u0506\u0507\u0005f\u0000\u0000\u0507\u0508\u0005u\u0000\u0000\u0508" + + "\u0509\u0005n\u0000\u0000\u0509\u050a\u0005s\u0000\u0000\u050a\u00c6\u0001" + + "\u0000\u0000\u0000\u050b\u050c\u0005:\u0000\u0000\u050c\u050d\u0005f\u0000" + + "\u0000\u050d\u050e\u0005u\u0000\u0000\u050e\u050f\u0005n\u0000\u0000\u050f" + + "\u0510\u0005s\u0000\u0000\u0510\u0511\u0005-\u0000\u0000\u0511\u0512\u0005" + + "d\u0000\u0000\u0512\u0513\u0005e\u0000\u0000\u0513\u0514\u0005s\u0000" + + "\u0000\u0514\u0515\u0005c\u0000\u0000\u0515\u0516\u0005r\u0000\u0000\u0516" + + "\u0517\u0005i\u0000\u0000\u0517\u0518\u0005p\u0000\u0000\u0518\u0519\u0005" + + "t\u0000\u0000\u0519\u051a\u0005i\u0000\u0000\u051a\u051b\u0005o\u0000" + + "\u0000\u051b\u051c\u0005n\u0000\u0000\u051c\u00c8\u0001\u0000\u0000\u0000" + + "\u051d\u051e\u0005:\u0000\u0000\u051e\u051f\u0005g\u0000\u0000\u051f\u0520" + + "\u0005l\u0000\u0000\u0520\u0521\u0005o\u0000\u0000\u0521\u0522\u0005b" + + "\u0000\u0000\u0522\u0523\u0005a\u0000\u0000\u0523\u0524\u0005l\u0000\u0000" + + "\u0524\u0525\u0005-\u0000\u0000\u0525\u0526\u0005d\u0000\u0000\u0526\u0527" + + "\u0005e\u0000\u0000\u0527\u0528\u0005c\u0000\u0000\u0528\u0529\u0005l" + + "\u0000\u0000\u0529\u052a\u0005a\u0000\u0000\u052a\u052b\u0005r\u0000\u0000" + + "\u052b\u052c\u0005a\u0000\u0000\u052c\u052d\u0005t\u0000\u0000\u052d\u052e" + + "\u0005i\u0000\u0000\u052e\u052f\u0005o\u0000\u0000\u052f\u0530\u0005n" + + "\u0000\u0000\u0530\u0531\u0005s\u0000\u0000\u0531\u00ca\u0001\u0000\u0000" + + "\u0000\u0532\u0533\u0005:\u0000\u0000\u0533\u0534\u0005i\u0000\u0000\u0534" + + "\u0535\u0005n\u0000\u0000\u0535\u0536\u0005t\u0000\u0000\u0536\u0537\u0005" + + "e\u0000\u0000\u0537\u0538\u0005r\u0000\u0000\u0538\u0539\u0005a\u0000" + + "\u0000\u0539\u053a\u0005c\u0000\u0000\u053a\u053b\u0005t\u0000\u0000\u053b" + + "\u053c\u0005i\u0000\u0000\u053c\u053d\u0005v\u0000\u0000\u053d\u053e\u0005" + + "e\u0000\u0000\u053e\u053f\u0005-\u0000\u0000\u053f\u0540\u0005m\u0000" + + "\u0000\u0540\u0541\u0005o\u0000\u0000\u0541\u0542\u0005d\u0000\u0000\u0542" + + "\u0543\u0005e\u0000\u0000\u0543\u00cc\u0001\u0000\u0000\u0000\u0544\u0545" + + "\u0005:\u0000\u0000\u0545\u0546\u0005l\u0000\u0000\u0546\u0547\u0005a" + + "\u0000\u0000\u0547\u0548\u0005n\u0000\u0000\u0548\u0549\u0005g\u0000\u0000" + + "\u0549\u054a\u0005u\u0000\u0000\u054a\u054b\u0005a\u0000\u0000\u054b\u054c" + + "\u0005g\u0000\u0000\u054c\u054d\u0005e\u0000\u0000\u054d\u00ce\u0001\u0000" + + "\u0000\u0000\u054e\u054f\u0005:\u0000\u0000\u054f\u0550\u0005l\u0000\u0000" + + "\u0550\u0551\u0005e\u0000\u0000\u0551\u0552\u0005f\u0000\u0000\u0552\u0553" + + "\u0005t\u0000\u0000\u0553\u0554\u0005-\u0000\u0000\u0554\u0555\u0005a" + + "\u0000\u0000\u0555\u0556\u0005s\u0000\u0000\u0556\u0557\u0005s\u0000\u0000" + + "\u0557\u0558\u0005o\u0000\u0000\u0558\u0559\u0005c\u0000\u0000\u0559\u00d0" + + "\u0001\u0000\u0000\u0000\u055a\u055b\u0005:\u0000\u0000\u055b\u055c\u0005" + + "l\u0000\u0000\u055c\u055d\u0005i\u0000\u0000\u055d\u055e\u0005c\u0000" + + "\u0000\u055e\u055f\u0005e\u0000\u0000\u055f\u0560\u0005n\u0000\u0000\u0560" + + "\u0561\u0005s\u0000\u0000\u0561\u0562\u0005e\u0000\u0000\u0562\u00d2\u0001" + + "\u0000\u0000\u0000\u0563\u0564\u0005:\u0000\u0000\u0564\u0565\u0005n\u0000" + + "\u0000\u0565\u0566\u0005a\u0000\u0000\u0566\u0567\u0005m\u0000\u0000\u0567" + + "\u0568\u0005e\u0000\u0000\u0568\u0569\u0005d\u0000\u0000\u0569\u00d4\u0001" + + "\u0000\u0000\u0000\u056a\u056b\u0005:\u0000\u0000\u056b\u056c\u0005n\u0000" + + "\u0000\u056c\u056d\u0005a\u0000\u0000\u056d\u056e\u0005m\u0000\u0000\u056e" + + "\u056f\u0005e\u0000\u0000\u056f\u00d6\u0001\u0000\u0000\u0000\u0570\u0571" + + "\u0005:\u0000\u0000\u0571\u0572\u0005n\u0000\u0000\u0572\u0573\u0005o" + + "\u0000\u0000\u0573\u0574\u0005t\u0000\u0000\u0574\u0575\u0005e\u0000\u0000" + + "\u0575\u0576\u0005s\u0000\u0000\u0576\u00d8\u0001\u0000\u0000\u0000\u0577" + + "\u0578\u0005:\u0000\u0000\u0578\u0579\u0005p\u0000\u0000\u0579\u057a\u0005" + + "a\u0000\u0000\u057a\u057b\u0005t\u0000\u0000\u057b\u057c\u0005t\u0000" + + "\u0000\u057c\u057d\u0005e\u0000\u0000\u057d\u057e\u0005r\u0000\u0000\u057e" + + "\u057f\u0005n\u0000\u0000\u057f\u00da\u0001\u0000\u0000\u0000\u0580\u0581" + + "\u0005:\u0000\u0000\u0581\u0582\u0005p\u0000\u0000\u0582\u0583\u0005r" + + "\u0000\u0000\u0583\u0584\u0005i\u0000\u0000\u0584\u0585\u0005n\u0000\u0000" + + "\u0585\u0586\u0005t\u0000\u0000\u0586\u0587\u0005-\u0000\u0000\u0587\u0588" + + "\u0005s\u0000\u0000\u0588\u0589\u0005u\u0000\u0000\u0589\u058a\u0005c" + + "\u0000\u0000\u058a\u058b\u0005c\u0000\u0000\u058b\u058c\u0005e\u0000\u0000" + + "\u058c\u058d\u0005s\u0000\u0000\u058d\u058e\u0005s\u0000\u0000\u058e\u00dc" + + "\u0001\u0000\u0000\u0000\u058f\u0590\u0005:\u0000\u0000\u0590\u0591\u0005" + + "p\u0000\u0000\u0591\u0592\u0005r\u0000\u0000\u0592\u0593\u0005o\u0000" + + "\u0000\u0593\u0594\u0005d\u0000\u0000\u0594\u0595\u0005u\u0000\u0000\u0595" + + "\u0596\u0005c\u0000\u0000\u0596\u0597\u0005e\u0000\u0000\u0597\u0598\u0005" + + "-\u0000\u0000\u0598\u0599\u0005a\u0000\u0000\u0599\u059a\u0005s\u0000" + + "\u0000\u059a\u059b\u0005s\u0000\u0000\u059b\u059c\u0005e\u0000\u0000\u059c" + + "\u059d\u0005r\u0000\u0000\u059d\u059e\u0005t\u0000\u0000\u059e\u059f\u0005" + + "i\u0000\u0000\u059f\u05a0\u0005o\u0000\u0000\u05a0\u05a1\u0005n\u0000" + + "\u0000\u05a1\u05a2\u0005s\u0000\u0000\u05a2\u00de\u0001\u0000\u0000\u0000" + + "\u05a3\u05a4\u0005:\u0000\u0000\u05a4\u05a5\u0005p\u0000\u0000\u05a5\u05a6" + + "\u0005r\u0000\u0000\u05a6\u05a7\u0005o\u0000\u0000\u05a7\u05a8\u0005d" + + "\u0000\u0000\u05a8\u05a9\u0005u\u0000\u0000\u05a9\u05aa\u0005c\u0000\u0000" + + "\u05aa\u05ab\u0005e\u0000\u0000\u05ab\u05ac\u0005-\u0000\u0000\u05ac\u05ad" + + "\u0005a\u0000\u0000\u05ad\u05ae\u0005s\u0000\u0000\u05ae\u05af\u0005s" + + "\u0000\u0000\u05af\u05b0\u0005i\u0000\u0000\u05b0\u05b1\u0005g\u0000\u0000" + + "\u05b1\u05b2\u0005n\u0000\u0000\u05b2\u05b3\u0005m\u0000\u0000\u05b3\u05b4" + + "\u0005e\u0000\u0000\u05b4\u05b5\u0005n\u0000\u0000\u05b5\u05b6\u0005t" + + "\u0000\u0000\u05b6\u05b7\u0005s\u0000\u0000\u05b7\u00e0\u0001\u0000\u0000" + + "\u0000\u05b8\u05b9\u0005:\u0000\u0000\u05b9\u05ba\u0005p\u0000\u0000\u05ba" + + "\u05bb\u0005r\u0000\u0000\u05bb\u05bc\u0005o\u0000\u0000\u05bc\u05bd\u0005" + + "d\u0000\u0000\u05bd\u05be\u0005u\u0000\u0000\u05be\u05bf\u0005c\u0000" + + "\u0000\u05bf\u05c0\u0005e\u0000\u0000\u05c0\u05c1\u0005-\u0000\u0000\u05c1" + + "\u05c2\u0005m\u0000\u0000\u05c2\u05c3\u0005o\u0000\u0000\u05c3\u05c4\u0005" + + "d\u0000\u0000\u05c4\u05c5\u0005e\u0000\u0000\u05c5\u05c6\u0005l\u0000" + + "\u0000\u05c6\u05c7\u0005s\u0000\u0000\u05c7\u00e2\u0001\u0000\u0000\u0000" + + "\u05c8\u05c9\u0005:\u0000\u0000\u05c9\u05ca\u0005p\u0000\u0000\u05ca\u05cb" + + "\u0005r\u0000\u0000\u05cb\u05cc\u0005o\u0000\u0000\u05cc\u05cd\u0005d" + + "\u0000\u0000\u05cd\u05ce\u0005u\u0000\u0000\u05ce\u05cf\u0005c\u0000\u0000" + + "\u05cf\u05d0\u0005e\u0000\u0000\u05d0\u05d1\u0005-\u0000\u0000\u05d1\u05d2" + + "\u0005p\u0000\u0000\u05d2\u05d3\u0005r\u0000\u0000\u05d3\u05d4\u0005o" + + "\u0000\u0000\u05d4\u05d5\u0005o\u0000\u0000\u05d5\u05d6\u0005f\u0000\u0000" + + "\u05d6\u05d7\u0005s\u0000\u0000\u05d7\u00e4\u0001\u0000\u0000\u0000\u05d8" + + "\u05d9\u0005:\u0000\u0000\u05d9\u05da\u0005p\u0000\u0000\u05da\u05db\u0005" + + "r\u0000\u0000\u05db\u05dc\u0005o\u0000\u0000\u05dc\u05dd\u0005d\u0000" + + "\u0000\u05dd\u05de\u0005u\u0000\u0000\u05de\u05df\u0005c\u0000\u0000\u05df" + + "\u05e0\u0005e\u0000\u0000\u05e0\u05e1\u0005-\u0000\u0000\u05e1\u05e2\u0005" + + "u\u0000\u0000\u05e2\u05e3\u0005n\u0000\u0000\u05e3\u05e4\u0005s\u0000" + + "\u0000\u05e4\u05e5\u0005a\u0000\u0000\u05e5\u05e6\u0005t\u0000\u0000\u05e6" + + "\u05e7\u0005-\u0000\u0000\u05e7\u05e8\u0005a\u0000\u0000\u05e8\u05e9\u0005" + + "s\u0000\u0000\u05e9\u05ea\u0005s\u0000\u0000\u05ea\u05eb\u0005u\u0000" + + "\u0000\u05eb\u05ec\u0005m\u0000\u0000\u05ec\u05ed\u0005p\u0000\u0000\u05ed" + + "\u05ee\u0005t\u0000\u0000\u05ee\u05ef\u0005i\u0000\u0000\u05ef\u05f0\u0005" + + "o\u0000\u0000\u05f0\u05f1\u0005n\u0000\u0000\u05f1\u05f2\u0005s\u0000" + + "\u0000\u05f2\u00e6\u0001\u0000\u0000\u0000\u05f3\u05f4\u0005:\u0000\u0000" + + "\u05f4\u05f5\u0005p\u0000\u0000\u05f5\u05f6\u0005r\u0000\u0000\u05f6\u05f7" + + "\u0005o\u0000\u0000\u05f7\u05f8\u0005d\u0000\u0000\u05f8\u05f9\u0005u" + + "\u0000\u0000\u05f9\u05fa\u0005c\u0000\u0000\u05fa\u05fb\u0005e\u0000\u0000" + + "\u05fb\u05fc\u0005-\u0000\u0000\u05fc\u05fd\u0005u\u0000\u0000\u05fd\u05fe" + + "\u0005n\u0000\u0000\u05fe\u05ff\u0005s\u0000\u0000\u05ff\u0600\u0005a" + + "\u0000\u0000\u0600\u0601\u0005t\u0000\u0000\u0601\u0602\u0005-\u0000\u0000" + + "\u0602\u0603\u0005c\u0000\u0000\u0603\u0604\u0005o\u0000\u0000\u0604\u0605" + + "\u0005r\u0000\u0000\u0605\u0606\u0005e\u0000\u0000\u0606\u0607\u0005s" + + "\u0000\u0000\u0607\u00e8\u0001\u0000\u0000\u0000\u0608\u0609\u0005:\u0000" + + "\u0000\u0609\u060a\u0005r\u0000\u0000\u060a\u060b\u0005a\u0000\u0000\u060b" + + "\u060c\u0005n\u0000\u0000\u060c\u060d\u0005d\u0000\u0000\u060d\u060e\u0005" + + "o\u0000\u0000\u060e\u060f\u0005m\u0000\u0000\u060f\u0610\u0005-\u0000" + + "\u0000\u0610\u0611\u0005s\u0000\u0000\u0611\u0612\u0005e\u0000\u0000\u0612" + + "\u0613\u0005e\u0000\u0000\u0613\u0614\u0005d\u0000\u0000\u0614\u00ea\u0001" + + "\u0000\u0000\u0000\u0615\u0616\u0005:\u0000\u0000\u0616\u0617\u0005r\u0000" + + "\u0000\u0617\u0618\u0005e\u0000\u0000\u0618\u0619\u0005a\u0000\u0000\u0619" + + "\u061a\u0005s\u0000\u0000\u061a\u061b\u0005o\u0000\u0000\u061b\u061c\u0005" + + "n\u0000\u0000\u061c\u061d\u0005-\u0000\u0000\u061d\u061e\u0005u\u0000" + + "\u0000\u061e\u061f\u0005n\u0000\u0000\u061f\u0620\u0005k\u0000\u0000\u0620" + + "\u0621\u0005n\u0000\u0000\u0621\u0622\u0005o\u0000\u0000\u0622\u0623\u0005" + + "w\u0000\u0000\u0623\u0624\u0005n\u0000\u0000\u0624\u00ec\u0001\u0000\u0000" + + "\u0000\u0625\u0626\u0005:\u0000\u0000\u0626\u0627\u0005r\u0000\u0000\u0627" + + "\u0628\u0005e\u0000\u0000\u0628\u0629\u0005g\u0000\u0000\u0629\u062a\u0005" + + "u\u0000\u0000\u062a\u062b\u0005l\u0000\u0000\u062b\u062c\u0005a\u0000" + + "\u0000\u062c\u062d\u0005r\u0000\u0000\u062d\u062e\u0005-\u0000\u0000\u062e" + + "\u062f\u0005o\u0000\u0000\u062f\u0630\u0005u\u0000\u0000\u0630\u0631\u0005" + + "t\u0000\u0000\u0631\u0632\u0005p\u0000\u0000\u0632\u0633\u0005u\u0000" + + "\u0000\u0633\u0634\u0005t\u0000\u0000\u0634\u0635\u0005-\u0000\u0000\u0635" + + "\u0636\u0005c\u0000\u0000\u0636\u0637\u0005h\u0000\u0000\u0637\u0638\u0005" + + "a\u0000\u0000\u0638\u0639\u0005n\u0000\u0000\u0639\u063a\u0005n\u0000" + + "\u0000\u063a\u063b\u0005e\u0000\u0000\u063b\u063c\u0005l\u0000\u0000\u063c" + + "\u00ee\u0001\u0000\u0000\u0000\u063d\u063e\u0005:\u0000\u0000\u063e\u063f" + + "\u0005r\u0000\u0000\u063f\u0640\u0005e\u0000\u0000\u0640\u0641\u0005p" + + "\u0000\u0000\u0641\u0642\u0005r\u0000\u0000\u0642\u0643\u0005o\u0000\u0000" + + "\u0643\u0644\u0005d\u0000\u0000\u0644\u0645\u0005u\u0000\u0000\u0645\u0646" + + "\u0005c\u0000\u0000\u0646\u0647\u0005i\u0000\u0000\u0647\u0648\u0005b" + + "\u0000\u0000\u0648\u0649\u0005l\u0000\u0000\u0649\u064a\u0005e\u0000\u0000" + + "\u064a\u064b\u0005-\u0000\u0000\u064b\u064c\u0005r\u0000\u0000\u064c\u064d" + + "\u0005e\u0000\u0000\u064d\u064e\u0005s\u0000\u0000\u064e\u064f\u0005o" + + "\u0000\u0000\u064f\u0650\u0005u\u0000\u0000\u0650\u0651\u0005r\u0000\u0000" + + "\u0651\u0652\u0005c\u0000\u0000\u0652\u0653\u0005e\u0000\u0000\u0653\u0654" + + "\u0005-\u0000\u0000\u0654\u0655\u0005l\u0000\u0000\u0655\u0656\u0005i" + + "\u0000\u0000\u0656\u0657\u0005m\u0000\u0000\u0657\u0658\u0005i\u0000\u0000" + + "\u0658\u0659\u0005t\u0000\u0000\u0659\u00f0\u0001\u0000\u0000\u0000\u065a" + + "\u065b\u0005:\u0000\u0000\u065b\u065c\u0005r\u0000\u0000\u065c\u065d\u0005" + + "i\u0000\u0000\u065d\u065e\u0005g\u0000\u0000\u065e\u065f\u0005h\u0000" + + "\u0000\u065f\u0660\u0005t\u0000\u0000\u0660\u0661\u0005-\u0000\u0000\u0661" + + "\u0662\u0005a\u0000\u0000\u0662\u0663\u0005s\u0000\u0000\u0663\u0664\u0005" + + "s\u0000\u0000\u0664\u0665\u0005o\u0000\u0000\u0665\u0666\u0005c\u0000" + + "\u0000\u0666\u00f2\u0001\u0000\u0000\u0000\u0667\u0668\u0005:\u0000\u0000" + + "\u0668\u0669\u0005s\u0000\u0000\u0669\u066a\u0005m\u0000\u0000\u066a\u066b" + + "\u0005t\u0000\u0000\u066b\u066c\u0005-\u0000\u0000\u066c\u066d\u0005l" + + "\u0000\u0000\u066d\u066e\u0005i\u0000\u0000\u066e\u066f\u0005b\u0000\u0000" + + "\u066f\u0670\u0005-\u0000\u0000\u0670\u0671\u0005v\u0000\u0000\u0671\u0672" + + "\u0005e\u0000\u0000\u0672\u0673\u0005r\u0000\u0000\u0673\u0674\u0005s" + + "\u0000\u0000\u0674\u0675\u0005i\u0000\u0000\u0675\u0676\u0005o\u0000\u0000" + + "\u0676\u0677\u0005n\u0000\u0000\u0677\u00f4\u0001\u0000\u0000\u0000\u0678" + + "\u0679\u0005:\u0000\u0000\u0679\u067a\u0005s\u0000\u0000\u067a\u067b\u0005" + + "o\u0000\u0000\u067b\u067c\u0005r\u0000\u0000\u067c\u067d\u0005t\u0000" + + "\u0000\u067d\u067e\u0005s\u0000\u0000\u067e\u00f6\u0001\u0000\u0000\u0000" + + "\u067f\u0680\u0005:\u0000\u0000\u0680\u0681\u0005s\u0000\u0000\u0681\u0682" + + "\u0005o\u0000\u0000\u0682\u0683\u0005r\u0000\u0000\u0683\u0684\u0005t" + + "\u0000\u0000\u0684\u0685\u0005s\u0000\u0000\u0685\u0686\u0005-\u0000\u0000" + + "\u0686\u0687\u0005d\u0000\u0000\u0687\u0688\u0005e\u0000\u0000\u0688\u0689" + + "\u0005s\u0000\u0000\u0689\u068a\u0005c\u0000\u0000\u068a\u068b\u0005r" + + "\u0000\u0000\u068b\u068c\u0005i\u0000\u0000\u068c\u068d\u0005p\u0000\u0000" + + "\u068d\u068e\u0005t\u0000\u0000\u068e\u068f\u0005i\u0000\u0000\u068f\u0690" + + "\u0005o\u0000\u0000\u0690\u0691\u0005n\u0000\u0000\u0691\u00f8\u0001\u0000" + + "\u0000\u0000\u0692\u0693\u0005:\u0000\u0000\u0693\u0694\u0005s\u0000\u0000" + + "\u0694\u0695\u0005o\u0000\u0000\u0695\u0696\u0005u\u0000\u0000\u0696\u0697" + + "\u0005r\u0000\u0000\u0697\u0698\u0005c\u0000\u0000\u0698\u0699\u0005e" + + "\u0000\u0000\u0699\u00fa\u0001\u0000\u0000\u0000\u069a\u069b\u0005:\u0000" + + "\u0000\u069b\u069c\u0005s\u0000\u0000\u069c\u069d\u0005t\u0000\u0000\u069d" + + "\u069e\u0005a\u0000\u0000\u069e\u069f\u0005t\u0000\u0000\u069f\u06a0\u0005" + + "u\u0000\u0000\u06a0\u06a1\u0005s\u0000\u0000\u06a1\u00fc\u0001\u0000\u0000" + + "\u0000\u06a2\u06a3\u0005:\u0000\u0000\u06a3\u06a4\u0005t\u0000\u0000\u06a4" + + "\u06a5\u0005h\u0000\u0000\u06a5\u06a6\u0005e\u0000\u0000\u06a6\u06a7\u0005" + + "o\u0000\u0000\u06a7\u06a8\u0005r\u0000\u0000\u06a8\u06a9\u0005i\u0000" + + "\u0000\u06a9\u06aa\u0005e\u0000\u0000\u06aa\u06ab\u0005s\u0000\u0000\u06ab" + + "\u00fe\u0001\u0000\u0000\u0000\u06ac\u06ad\u0005:\u0000\u0000\u06ad\u06ae" + + "\u0005v\u0000\u0000\u06ae\u06af\u0005a\u0000\u0000\u06af\u06b0\u0005l" + + "\u0000\u0000\u06b0\u06b1\u0005u\u0000\u0000\u06b1\u06b2\u0005e\u0000\u0000" + + "\u06b2\u06b3\u0005s\u0000\u0000\u06b3\u0100\u0001\u0000\u0000\u0000\u06b4" + + "\u06b5\u0005:\u0000\u0000\u06b5\u06b6\u0005v\u0000\u0000\u06b6\u06b7\u0005" + + "e\u0000\u0000\u06b7\u06b8\u0005r\u0000\u0000\u06b8\u06b9\u0005b\u0000" + + "\u0000\u06b9\u06ba\u0005o\u0000\u0000\u06ba\u06bb\u0005s\u0000\u0000\u06bb" + + "\u06bc\u0005i\u0000\u0000\u06bc\u06bd\u0005t\u0000\u0000\u06bd\u06be\u0005" + + "y\u0000\u0000\u06be\u0102\u0001\u0000\u0000\u0000\u06bf\u06c0\u0005:\u0000" + + "\u0000\u06c0\u06c1\u0005v\u0000\u0000\u06c1\u06c2\u0005e\u0000\u0000\u06c2" + + "\u06c3\u0005r\u0000\u0000\u06c3\u06c4\u0005s\u0000\u0000\u06c4\u06c5\u0005" + + "i\u0000\u0000\u06c5\u06c6\u0005o\u0000\u0000\u06c6\u06c7\u0005n\u0000" + + "\u0000\u06c7\u0104\u0001\u0000\u0000\u0000\u06c8\u06c9\u0005m\u0000\u0000" + + "\u06c9\u06ca\u0005o\u0000\u0000\u06ca\u06cb\u0005d\u0000\u0000\u06cb\u06cc" + + "\u0005e\u0000\u0000\u06cc\u06cd\u0005l\u0000\u0000\u06cd\u0106\u0001\u0000" + + "\u0000\u0000\u06ce\u06d3\u0003\u00a1P\u0000\u06cf\u06d2\u0003\u009dN\u0000" + + "\u06d0\u06d2\u0003\u00a1P\u0000\u06d1\u06cf\u0001\u0000\u0000\u0000\u06d1" + + "\u06d0\u0001\u0000\u0000\u0000\u06d2\u06d5\u0001\u0000\u0000\u0000\u06d3" + + "\u06d1\u0001\u0000\u0000\u0000\u06d3\u06d4\u0001\u0000\u0000\u0000\u06d4" + + "\u0108\u0001\u0000\u0000\u0000\u06d5\u06d3\u0001\u0000\u0000\u0000\u06d6" + + "\u06d8\u0007\f\u0000\u0000\u06d7\u06d6\u0001\u0000\u0000\u0000\u06d8\u06d9" + + "\u0001\u0000\u0000\u0000\u06d9\u06d7\u0001\u0000\u0000\u0000\u06d9\u06da" + + "\u0001\u0000\u0000\u0000\u06da\u06db\u0001\u0000\u0000\u0000\u06db\u06dc" + + "\u0006\u0084\u0000\u0000\u06dc\u010a\u0001\u0000\u0000\u0000\u001b\u0000" + + "\u010f\u011d\u011f\u0126\u0128\u0144\u014d\u0152\u0157\u0186\u019f\u0415" + + "\u0418\u0420\u0428\u042f\u0457\u045f\u0465\u0469\u046d\u0474\u047a\u06d1" + + "\u06d3\u06d9\u0001\u0006\u0000\u0000"; + public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Listener.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Listener.java new file mode 100644 index 0000000000..2695f4e443 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Listener.java @@ -0,0 +1,3418 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2021 Alejandro SerranoMena +// +// SPDX-License-Identifier: Apache-2.0 + +// Generated from +// /home/davidg/IdeaProjects/java-smt-working-branch/java-smt/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 by ANTLR 4.13.2 +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +import org.antlr.v4.runtime.tree.ParseTreeListener; + +/** + * This interface defines a complete listener for a parse tree produced by {@link Smtlibv2Parser}. + */ +public interface Smtlibv2Listener extends ParseTreeListener { + /** + * Enter a parse tree produced by the {@code start_logic} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + */ + void enterStart_logic(Smtlibv2Parser.Start_logicContext ctx); + + /** + * Exit a parse tree produced by the {@code start_logic} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + */ + void exitStart_logic(Smtlibv2Parser.Start_logicContext ctx); + + /** + * Enter a parse tree produced by the {@code start_theory} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + */ + void enterStart_theory(Smtlibv2Parser.Start_theoryContext ctx); + + /** + * Exit a parse tree produced by the {@code start_theory} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + */ + void exitStart_theory(Smtlibv2Parser.Start_theoryContext ctx); + + /** + * Enter a parse tree produced by the {@code start_script} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + */ + void enterStart_script(Smtlibv2Parser.Start_scriptContext ctx); + + /** + * Exit a parse tree produced by the {@code start_script} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + */ + void exitStart_script(Smtlibv2Parser.Start_scriptContext ctx); + + /** + * Enter a parse tree produced by the {@code start_gen_resp} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + */ + void enterStart_gen_resp(Smtlibv2Parser.Start_gen_respContext ctx); + + /** + * Exit a parse tree produced by the {@code start_gen_resp} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + */ + void exitStart_gen_resp(Smtlibv2Parser.Start_gen_respContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#generalReservedWord}. + * + * @param ctx the parse tree + */ + void enterGeneralReservedWord(Smtlibv2Parser.GeneralReservedWordContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#generalReservedWord}. + * + * @param ctx the parse tree + */ + void exitGeneralReservedWord(Smtlibv2Parser.GeneralReservedWordContext ctx); + + /** + * Enter a parse tree produced by the {@code simp_pre_symb} labeled alternative in {@link + * Smtlibv2Parser#simpleSymbol}. + * + * @param ctx the parse tree + */ + void enterSimp_pre_symb(Smtlibv2Parser.Simp_pre_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code simp_pre_symb} labeled alternative in {@link + * Smtlibv2Parser#simpleSymbol}. + * + * @param ctx the parse tree + */ + void exitSimp_pre_symb(Smtlibv2Parser.Simp_pre_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code simp_undef_symb} labeled alternative in {@link + * Smtlibv2Parser#simpleSymbol}. + * + * @param ctx the parse tree + */ + void enterSimp_undef_symb(Smtlibv2Parser.Simp_undef_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code simp_undef_symb} labeled alternative in {@link + * Smtlibv2Parser#simpleSymbol}. + * + * @param ctx the parse tree + */ + void exitSimp_undef_symb(Smtlibv2Parser.Simp_undef_symbContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#quotedSymbol}. + * + * @param ctx the parse tree + */ + void enterQuotedSymbol(Smtlibv2Parser.QuotedSymbolContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#quotedSymbol}. + * + * @param ctx the parse tree + */ + void exitQuotedSymbol(Smtlibv2Parser.QuotedSymbolContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#predefSymbol}. + * + * @param ctx the parse tree + */ + void enterPredefSymbol(Smtlibv2Parser.PredefSymbolContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#predefSymbol}. + * + * @param ctx the parse tree + */ + void exitPredefSymbol(Smtlibv2Parser.PredefSymbolContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#predefKeyword}. + * + * @param ctx the parse tree + */ + void enterPredefKeyword(Smtlibv2Parser.PredefKeywordContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#predefKeyword}. + * + * @param ctx the parse tree + */ + void exitPredefKeyword(Smtlibv2Parser.PredefKeywordContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#numeral}. + * + * @param ctx the parse tree + */ + void enterNumeral(Smtlibv2Parser.NumeralContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#numeral}. + * + * @param ctx the parse tree + */ + void exitNumeral(Smtlibv2Parser.NumeralContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#decimal}. + * + * @param ctx the parse tree + */ + void enterDecimal(Smtlibv2Parser.DecimalContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#decimal}. + * + * @param ctx the parse tree + */ + void exitDecimal(Smtlibv2Parser.DecimalContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#hexadecimal}. + * + * @param ctx the parse tree + */ + void enterHexadecimal(Smtlibv2Parser.HexadecimalContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#hexadecimal}. + * + * @param ctx the parse tree + */ + void exitHexadecimal(Smtlibv2Parser.HexadecimalContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#binary}. + * + * @param ctx the parse tree + */ + void enterBinary(Smtlibv2Parser.BinaryContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#binary}. + * + * @param ctx the parse tree + */ + void exitBinary(Smtlibv2Parser.BinaryContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#string}. + * + * @param ctx the parse tree + */ + void enterString(Smtlibv2Parser.StringContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#string}. + * + * @param ctx the parse tree + */ + void exitString(Smtlibv2Parser.StringContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#to_fp_expr}. + * + * @param ctx the parse tree + */ + void enterTo_fp_expr(Smtlibv2Parser.To_fp_exprContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#to_fp_expr}. + * + * @param ctx the parse tree + */ + void exitTo_fp_expr(Smtlibv2Parser.To_fp_exprContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#special_regex_operations}. + * + * @param ctx the parse tree + */ + void enterSpecial_regex_operations(Smtlibv2Parser.Special_regex_operationsContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#special_regex_operations}. + * + * @param ctx the parse tree + */ + void exitSpecial_regex_operations(Smtlibv2Parser.Special_regex_operationsContext ctx); + + /** + * Enter a parse tree produced by the {@code pre_key} labeled alternative in {@link + * Smtlibv2Parser#keyword}. + * + * @param ctx the parse tree + */ + void enterPre_key(Smtlibv2Parser.Pre_keyContext ctx); + + /** + * Exit a parse tree produced by the {@code pre_key} labeled alternative in {@link + * Smtlibv2Parser#keyword}. + * + * @param ctx the parse tree + */ + void exitPre_key(Smtlibv2Parser.Pre_keyContext ctx); + + /** + * Enter a parse tree produced by the {@code key_simsymb} labeled alternative in {@link + * Smtlibv2Parser#keyword}. + * + * @param ctx the parse tree + */ + void enterKey_simsymb(Smtlibv2Parser.Key_simsymbContext ctx); + + /** + * Exit a parse tree produced by the {@code key_simsymb} labeled alternative in {@link + * Smtlibv2Parser#keyword}. + * + * @param ctx the parse tree + */ + void exitKey_simsymb(Smtlibv2Parser.Key_simsymbContext ctx); + + /** + * Enter a parse tree produced by the {@code simpsymb} labeled alternative in {@link + * Smtlibv2Parser#symbol}. + * + * @param ctx the parse tree + */ + void enterSimpsymb(Smtlibv2Parser.SimpsymbContext ctx); + + /** + * Exit a parse tree produced by the {@code simpsymb} labeled alternative in {@link + * Smtlibv2Parser#symbol}. + * + * @param ctx the parse tree + */ + void exitSimpsymb(Smtlibv2Parser.SimpsymbContext ctx); + + /** + * Enter a parse tree produced by the {@code quotsymb} labeled alternative in {@link + * Smtlibv2Parser#symbol}. + * + * @param ctx the parse tree + */ + void enterQuotsymb(Smtlibv2Parser.QuotsymbContext ctx); + + /** + * Exit a parse tree produced by the {@code quotsymb} labeled alternative in {@link + * Smtlibv2Parser#symbol}. + * + * @param ctx the parse tree + */ + void exitQuotsymb(Smtlibv2Parser.QuotsymbContext ctx); + + /** + * Enter a parse tree produced by the {@code spec_constant_num} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void enterSpec_constant_num(Smtlibv2Parser.Spec_constant_numContext ctx); + + /** + * Exit a parse tree produced by the {@code spec_constant_num} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void exitSpec_constant_num(Smtlibv2Parser.Spec_constant_numContext ctx); + + /** + * Enter a parse tree produced by the {@code spec_constant_dec} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void enterSpec_constant_dec(Smtlibv2Parser.Spec_constant_decContext ctx); + + /** + * Exit a parse tree produced by the {@code spec_constant_dec} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void exitSpec_constant_dec(Smtlibv2Parser.Spec_constant_decContext ctx); + + /** + * Enter a parse tree produced by the {@code spec_constant_hex} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void enterSpec_constant_hex(Smtlibv2Parser.Spec_constant_hexContext ctx); + + /** + * Exit a parse tree produced by the {@code spec_constant_hex} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void exitSpec_constant_hex(Smtlibv2Parser.Spec_constant_hexContext ctx); + + /** + * Enter a parse tree produced by the {@code spec_constant_bin} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void enterSpec_constant_bin(Smtlibv2Parser.Spec_constant_binContext ctx); + + /** + * Exit a parse tree produced by the {@code spec_constant_bin} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void exitSpec_constant_bin(Smtlibv2Parser.Spec_constant_binContext ctx); + + /** + * Enter a parse tree produced by the {@code spec_constant_string} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void enterSpec_constant_string(Smtlibv2Parser.Spec_constant_stringContext ctx); + + /** + * Exit a parse tree produced by the {@code spec_constant_string} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void exitSpec_constant_string(Smtlibv2Parser.Spec_constant_stringContext ctx); + + /** + * Enter a parse tree produced by the {@code spec_constant_fp} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void enterSpec_constant_fp(Smtlibv2Parser.Spec_constant_fpContext ctx); + + /** + * Exit a parse tree produced by the {@code spec_constant_fp} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void exitSpec_constant_fp(Smtlibv2Parser.Spec_constant_fpContext ctx); + + /** + * Enter a parse tree produced by the {@code spec_constant_regex} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void enterSpec_constant_regex(Smtlibv2Parser.Spec_constant_regexContext ctx); + + /** + * Exit a parse tree produced by the {@code spec_constant_regex} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + */ + void exitSpec_constant_regex(Smtlibv2Parser.Spec_constant_regexContext ctx); + + /** + * Enter a parse tree produced by the {@code s_expr_spec} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + */ + void enterS_expr_spec(Smtlibv2Parser.S_expr_specContext ctx); + + /** + * Exit a parse tree produced by the {@code s_expr_spec} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + */ + void exitS_expr_spec(Smtlibv2Parser.S_expr_specContext ctx); + + /** + * Enter a parse tree produced by the {@code s_expr_symb} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + */ + void enterS_expr_symb(Smtlibv2Parser.S_expr_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code s_expr_symb} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + */ + void exitS_expr_symb(Smtlibv2Parser.S_expr_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code s_expr_key} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + */ + void enterS_expr_key(Smtlibv2Parser.S_expr_keyContext ctx); + + /** + * Exit a parse tree produced by the {@code s_expr_key} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + */ + void exitS_expr_key(Smtlibv2Parser.S_expr_keyContext ctx); + + /** + * Enter a parse tree produced by the {@code multi_s_expr} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + */ + void enterMulti_s_expr(Smtlibv2Parser.Multi_s_exprContext ctx); + + /** + * Exit a parse tree produced by the {@code multi_s_expr} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + */ + void exitMulti_s_expr(Smtlibv2Parser.Multi_s_exprContext ctx); + + /** + * Enter a parse tree produced by the {@code idx_num} labeled alternative in {@link + * Smtlibv2Parser#index}. + * + * @param ctx the parse tree + */ + void enterIdx_num(Smtlibv2Parser.Idx_numContext ctx); + + /** + * Exit a parse tree produced by the {@code idx_num} labeled alternative in {@link + * Smtlibv2Parser#index}. + * + * @param ctx the parse tree + */ + void exitIdx_num(Smtlibv2Parser.Idx_numContext ctx); + + /** + * Enter a parse tree produced by the {@code idx_symb} labeled alternative in {@link + * Smtlibv2Parser#index}. + * + * @param ctx the parse tree + */ + void enterIdx_symb(Smtlibv2Parser.Idx_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code idx_symb} labeled alternative in {@link + * Smtlibv2Parser#index}. + * + * @param ctx the parse tree + */ + void exitIdx_symb(Smtlibv2Parser.Idx_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code id_symb} labeled alternative in {@link + * Smtlibv2Parser#identifier}. + * + * @param ctx the parse tree + */ + void enterId_symb(Smtlibv2Parser.Id_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code id_symb} labeled alternative in {@link + * Smtlibv2Parser#identifier}. + * + * @param ctx the parse tree + */ + void exitId_symb(Smtlibv2Parser.Id_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code id_symb_idx} labeled alternative in {@link + * Smtlibv2Parser#identifier}. + * + * @param ctx the parse tree + */ + void enterId_symb_idx(Smtlibv2Parser.Id_symb_idxContext ctx); + + /** + * Exit a parse tree produced by the {@code id_symb_idx} labeled alternative in {@link + * Smtlibv2Parser#identifier}. + * + * @param ctx the parse tree + */ + void exitId_symb_idx(Smtlibv2Parser.Id_symb_idxContext ctx); + + /** + * Enter a parse tree produced by the {@code attr_spec} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + */ + void enterAttr_spec(Smtlibv2Parser.Attr_specContext ctx); + + /** + * Exit a parse tree produced by the {@code attr_spec} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + */ + void exitAttr_spec(Smtlibv2Parser.Attr_specContext ctx); + + /** + * Enter a parse tree produced by the {@code attr_symb} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + */ + void enterAttr_symb(Smtlibv2Parser.Attr_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code attr_symb} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + */ + void exitAttr_symb(Smtlibv2Parser.Attr_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code attr_s_expr} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + */ + void enterAttr_s_expr(Smtlibv2Parser.Attr_s_exprContext ctx); + + /** + * Exit a parse tree produced by the {@code attr_s_expr} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + */ + void exitAttr_s_expr(Smtlibv2Parser.Attr_s_exprContext ctx); + + /** + * Enter a parse tree produced by the {@code attr_key} labeled alternative in {@link + * Smtlibv2Parser#attribute}. + * + * @param ctx the parse tree + */ + void enterAttr_key(Smtlibv2Parser.Attr_keyContext ctx); + + /** + * Exit a parse tree produced by the {@code attr_key} labeled alternative in {@link + * Smtlibv2Parser#attribute}. + * + * @param ctx the parse tree + */ + void exitAttr_key(Smtlibv2Parser.Attr_keyContext ctx); + + /** + * Enter a parse tree produced by the {@code attr_key_attr} labeled alternative in {@link + * Smtlibv2Parser#attribute}. + * + * @param ctx the parse tree + */ + void enterAttr_key_attr(Smtlibv2Parser.Attr_key_attrContext ctx); + + /** + * Exit a parse tree produced by the {@code attr_key_attr} labeled alternative in {@link + * Smtlibv2Parser#attribute}. + * + * @param ctx the parse tree + */ + void exitAttr_key_attr(Smtlibv2Parser.Attr_key_attrContext ctx); + + /** + * Enter a parse tree produced by the {@code sortfp} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + */ + void enterSortfp(Smtlibv2Parser.SortfpContext ctx); + + /** + * Exit a parse tree produced by the {@code sortfp} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + */ + void exitSortfp(Smtlibv2Parser.SortfpContext ctx); + + /** + * Enter a parse tree produced by the {@code sort_id} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + */ + void enterSort_id(Smtlibv2Parser.Sort_idContext ctx); + + /** + * Exit a parse tree produced by the {@code sort_id} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + */ + void exitSort_id(Smtlibv2Parser.Sort_idContext ctx); + + /** + * Enter a parse tree produced by the {@code multisort} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + */ + void enterMultisort(Smtlibv2Parser.MultisortContext ctx); + + /** + * Exit a parse tree produced by the {@code multisort} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + */ + void exitMultisort(Smtlibv2Parser.MultisortContext ctx); + + /** + * Enter a parse tree produced by the {@code qual_id} labeled alternative in {@link + * Smtlibv2Parser#qual_identifer}. + * + * @param ctx the parse tree + */ + void enterQual_id(Smtlibv2Parser.Qual_idContext ctx); + + /** + * Exit a parse tree produced by the {@code qual_id} labeled alternative in {@link + * Smtlibv2Parser#qual_identifer}. + * + * @param ctx the parse tree + */ + void exitQual_id(Smtlibv2Parser.Qual_idContext ctx); + + /** + * Enter a parse tree produced by the {@code qual_id_sort} labeled alternative in {@link + * Smtlibv2Parser#qual_identifer}. + * + * @param ctx the parse tree + */ + void enterQual_id_sort(Smtlibv2Parser.Qual_id_sortContext ctx); + + /** + * Exit a parse tree produced by the {@code qual_id_sort} labeled alternative in {@link + * Smtlibv2Parser#qual_identifer}. + * + * @param ctx the parse tree + */ + void exitQual_id_sort(Smtlibv2Parser.Qual_id_sortContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#var_binding}. + * + * @param ctx the parse tree + */ + void enterVar_binding(Smtlibv2Parser.Var_bindingContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#var_binding}. + * + * @param ctx the parse tree + */ + void exitVar_binding(Smtlibv2Parser.Var_bindingContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#sorted_var}. + * + * @param ctx the parse tree + */ + void enterSorted_var(Smtlibv2Parser.Sorted_varContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#sorted_var}. + * + * @param ctx the parse tree + */ + void exitSorted_var(Smtlibv2Parser.Sorted_varContext ctx); + + /** + * Enter a parse tree produced by the {@code pattern_symb} labeled alternative in {@link + * Smtlibv2Parser#pattern}. + * + * @param ctx the parse tree + */ + void enterPattern_symb(Smtlibv2Parser.Pattern_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code pattern_symb} labeled alternative in {@link + * Smtlibv2Parser#pattern}. + * + * @param ctx the parse tree + */ + void exitPattern_symb(Smtlibv2Parser.Pattern_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code pattern_multisymb} labeled alternative in {@link + * Smtlibv2Parser#pattern}. + * + * @param ctx the parse tree + */ + void enterPattern_multisymb(Smtlibv2Parser.Pattern_multisymbContext ctx); + + /** + * Exit a parse tree produced by the {@code pattern_multisymb} labeled alternative in {@link + * Smtlibv2Parser#pattern}. + * + * @param ctx the parse tree + */ + void exitPattern_multisymb(Smtlibv2Parser.Pattern_multisymbContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#match_case}. + * + * @param ctx the parse tree + */ + void enterMatch_case(Smtlibv2Parser.Match_caseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#match_case}. + * + * @param ctx the parse tree + */ + void exitMatch_case(Smtlibv2Parser.Match_caseContext ctx); + + /** + * Enter a parse tree produced by the {@code term_spec_const} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_spec_const(Smtlibv2Parser.Term_spec_constContext ctx); + + /** + * Exit a parse tree produced by the {@code term_spec_const} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_spec_const(Smtlibv2Parser.Term_spec_constContext ctx); + + /** + * Enter a parse tree produced by the {@code term_qual_id} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_qual_id(Smtlibv2Parser.Term_qual_idContext ctx); + + /** + * Exit a parse tree produced by the {@code term_qual_id} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_qual_id(Smtlibv2Parser.Term_qual_idContext ctx); + + /** + * Enter a parse tree produced by the {@code term_fp_cast} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_fp_cast(Smtlibv2Parser.Term_fp_castContext ctx); + + /** + * Exit a parse tree produced by the {@code term_fp_cast} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_fp_cast(Smtlibv2Parser.Term_fp_castContext ctx); + + /** + * Enter a parse tree produced by the {@code term_special_regex} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_special_regex(Smtlibv2Parser.Term_special_regexContext ctx); + + /** + * Exit a parse tree produced by the {@code term_special_regex} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_special_regex(Smtlibv2Parser.Term_special_regexContext ctx); + + /** + * Enter a parse tree produced by the {@code multiterm} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterMultiterm(Smtlibv2Parser.MultitermContext ctx); + + /** + * Exit a parse tree produced by the {@code multiterm} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitMultiterm(Smtlibv2Parser.MultitermContext ctx); + + /** + * Enter a parse tree produced by the {@code term_let} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_let(Smtlibv2Parser.Term_letContext ctx); + + /** + * Exit a parse tree produced by the {@code term_let} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_let(Smtlibv2Parser.Term_letContext ctx); + + /** + * Enter a parse tree produced by the {@code term_forall} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_forall(Smtlibv2Parser.Term_forallContext ctx); + + /** + * Exit a parse tree produced by the {@code term_forall} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_forall(Smtlibv2Parser.Term_forallContext ctx); + + /** + * Enter a parse tree produced by the {@code term_exists} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_exists(Smtlibv2Parser.Term_existsContext ctx); + + /** + * Exit a parse tree produced by the {@code term_exists} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_exists(Smtlibv2Parser.Term_existsContext ctx); + + /** + * Enter a parse tree produced by the {@code term_match} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_match(Smtlibv2Parser.Term_matchContext ctx); + + /** + * Exit a parse tree produced by the {@code term_match} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_match(Smtlibv2Parser.Term_matchContext ctx); + + /** + * Enter a parse tree produced by the {@code term_exclam} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void enterTerm_exclam(Smtlibv2Parser.Term_exclamContext ctx); + + /** + * Exit a parse tree produced by the {@code term_exclam} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + */ + void exitTerm_exclam(Smtlibv2Parser.Term_exclamContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#sort_symbol_decl}. + * + * @param ctx the parse tree + */ + void enterSort_symbol_decl(Smtlibv2Parser.Sort_symbol_declContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#sort_symbol_decl}. + * + * @param ctx the parse tree + */ + void exitSort_symbol_decl(Smtlibv2Parser.Sort_symbol_declContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#meta_spec_constant}. + * + * @param ctx the parse tree + */ + void enterMeta_spec_constant(Smtlibv2Parser.Meta_spec_constantContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#meta_spec_constant}. + * + * @param ctx the parse tree + */ + void exitMeta_spec_constant(Smtlibv2Parser.Meta_spec_constantContext ctx); + + /** + * Enter a parse tree produced by the {@code fun_symb_spec} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void enterFun_symb_spec(Smtlibv2Parser.Fun_symb_specContext ctx); + + /** + * Exit a parse tree produced by the {@code fun_symb_spec} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void exitFun_symb_spec(Smtlibv2Parser.Fun_symb_specContext ctx); + + /** + * Enter a parse tree produced by the {@code fun_symb_meta} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void enterFun_symb_meta(Smtlibv2Parser.Fun_symb_metaContext ctx); + + /** + * Exit a parse tree produced by the {@code fun_symb_meta} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void exitFun_symb_meta(Smtlibv2Parser.Fun_symb_metaContext ctx); + + /** + * Enter a parse tree produced by the {@code fun_symb_id} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void enterFun_symb_id(Smtlibv2Parser.Fun_symb_idContext ctx); + + /** + * Exit a parse tree produced by the {@code fun_symb_id} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void exitFun_symb_id(Smtlibv2Parser.Fun_symb_idContext ctx); + + /** + * Enter a parse tree produced by the {@code par_fun_symb} labeled alternative in {@link + * Smtlibv2Parser#par_fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void enterPar_fun_symb(Smtlibv2Parser.Par_fun_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code par_fun_symb} labeled alternative in {@link + * Smtlibv2Parser#par_fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void exitPar_fun_symb(Smtlibv2Parser.Par_fun_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code par_fun_multi_symb} labeled alternative in {@link + * Smtlibv2Parser#par_fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void enterPar_fun_multi_symb(Smtlibv2Parser.Par_fun_multi_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code par_fun_multi_symb} labeled alternative in {@link + * Smtlibv2Parser#par_fun_symbol_decl}. + * + * @param ctx the parse tree + */ + void exitPar_fun_multi_symb(Smtlibv2Parser.Par_fun_multi_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code theory_sort} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void enterTheory_sort(Smtlibv2Parser.Theory_sortContext ctx); + + /** + * Exit a parse tree produced by the {@code theory_sort} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void exitTheory_sort(Smtlibv2Parser.Theory_sortContext ctx); + + /** + * Enter a parse tree produced by the {@code theory_fun} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void enterTheory_fun(Smtlibv2Parser.Theory_funContext ctx); + + /** + * Exit a parse tree produced by the {@code theory_fun} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void exitTheory_fun(Smtlibv2Parser.Theory_funContext ctx); + + /** + * Enter a parse tree produced by the {@code theory_sort_descr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void enterTheory_sort_descr(Smtlibv2Parser.Theory_sort_descrContext ctx); + + /** + * Exit a parse tree produced by the {@code theory_sort_descr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void exitTheory_sort_descr(Smtlibv2Parser.Theory_sort_descrContext ctx); + + /** + * Enter a parse tree produced by the {@code theory_fun_descr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void enterTheory_fun_descr(Smtlibv2Parser.Theory_fun_descrContext ctx); + + /** + * Exit a parse tree produced by the {@code theory_fun_descr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void exitTheory_fun_descr(Smtlibv2Parser.Theory_fun_descrContext ctx); + + /** + * Enter a parse tree produced by the {@code theory_def} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void enterTheory_def(Smtlibv2Parser.Theory_defContext ctx); + + /** + * Exit a parse tree produced by the {@code theory_def} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void exitTheory_def(Smtlibv2Parser.Theory_defContext ctx); + + /** + * Enter a parse tree produced by the {@code theory_val} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void enterTheory_val(Smtlibv2Parser.Theory_valContext ctx); + + /** + * Exit a parse tree produced by the {@code theory_val} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void exitTheory_val(Smtlibv2Parser.Theory_valContext ctx); + + /** + * Enter a parse tree produced by the {@code theory_notes} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void enterTheory_notes(Smtlibv2Parser.Theory_notesContext ctx); + + /** + * Exit a parse tree produced by the {@code theory_notes} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void exitTheory_notes(Smtlibv2Parser.Theory_notesContext ctx); + + /** + * Enter a parse tree produced by the {@code theory_attr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void enterTheory_attr(Smtlibv2Parser.Theory_attrContext ctx); + + /** + * Exit a parse tree produced by the {@code theory_attr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + */ + void exitTheory_attr(Smtlibv2Parser.Theory_attrContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#theory_decl}. + * + * @param ctx the parse tree + */ + void enterTheory_decl(Smtlibv2Parser.Theory_declContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#theory_decl}. + * + * @param ctx the parse tree + */ + void exitTheory_decl(Smtlibv2Parser.Theory_declContext ctx); + + /** + * Enter a parse tree produced by the {@code logic_theory} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void enterLogic_theory(Smtlibv2Parser.Logic_theoryContext ctx); + + /** + * Exit a parse tree produced by the {@code logic_theory} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void exitLogic_theory(Smtlibv2Parser.Logic_theoryContext ctx); + + /** + * Enter a parse tree produced by the {@code logic_language} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void enterLogic_language(Smtlibv2Parser.Logic_languageContext ctx); + + /** + * Exit a parse tree produced by the {@code logic_language} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void exitLogic_language(Smtlibv2Parser.Logic_languageContext ctx); + + /** + * Enter a parse tree produced by the {@code logic_ext} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void enterLogic_ext(Smtlibv2Parser.Logic_extContext ctx); + + /** + * Exit a parse tree produced by the {@code logic_ext} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void exitLogic_ext(Smtlibv2Parser.Logic_extContext ctx); + + /** + * Enter a parse tree produced by the {@code logic_val} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void enterLogic_val(Smtlibv2Parser.Logic_valContext ctx); + + /** + * Exit a parse tree produced by the {@code logic_val} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void exitLogic_val(Smtlibv2Parser.Logic_valContext ctx); + + /** + * Enter a parse tree produced by the {@code logic_notes} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void enterLogic_notes(Smtlibv2Parser.Logic_notesContext ctx); + + /** + * Exit a parse tree produced by the {@code logic_notes} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void exitLogic_notes(Smtlibv2Parser.Logic_notesContext ctx); + + /** + * Enter a parse tree produced by the {@code logic_attr} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void enterLogic_attr(Smtlibv2Parser.Logic_attrContext ctx); + + /** + * Exit a parse tree produced by the {@code logic_attr} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + */ + void exitLogic_attr(Smtlibv2Parser.Logic_attrContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#logic}. + * + * @param ctx the parse tree + */ + void enterLogic(Smtlibv2Parser.LogicContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#logic}. + * + * @param ctx the parse tree + */ + void exitLogic(Smtlibv2Parser.LogicContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#sort_dec}. + * + * @param ctx the parse tree + */ + void enterSort_dec(Smtlibv2Parser.Sort_decContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#sort_dec}. + * + * @param ctx the parse tree + */ + void exitSort_dec(Smtlibv2Parser.Sort_decContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#selector_dec}. + * + * @param ctx the parse tree + */ + void enterSelector_dec(Smtlibv2Parser.Selector_decContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#selector_dec}. + * + * @param ctx the parse tree + */ + void exitSelector_dec(Smtlibv2Parser.Selector_decContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#constructor_dec}. + * + * @param ctx the parse tree + */ + void enterConstructor_dec(Smtlibv2Parser.Constructor_decContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#constructor_dec}. + * + * @param ctx the parse tree + */ + void exitConstructor_dec(Smtlibv2Parser.Constructor_decContext ctx); + + /** + * Enter a parse tree produced by the {@code data_constr} labeled alternative in {@link + * Smtlibv2Parser#datatype_dec}. + * + * @param ctx the parse tree + */ + void enterData_constr(Smtlibv2Parser.Data_constrContext ctx); + + /** + * Exit a parse tree produced by the {@code data_constr} labeled alternative in {@link + * Smtlibv2Parser#datatype_dec}. + * + * @param ctx the parse tree + */ + void exitData_constr(Smtlibv2Parser.Data_constrContext ctx); + + /** + * Enter a parse tree produced by the {@code data_multisymb} labeled alternative in {@link + * Smtlibv2Parser#datatype_dec}. + * + * @param ctx the parse tree + */ + void enterData_multisymb(Smtlibv2Parser.Data_multisymbContext ctx); + + /** + * Exit a parse tree produced by the {@code data_multisymb} labeled alternative in {@link + * Smtlibv2Parser#datatype_dec}. + * + * @param ctx the parse tree + */ + void exitData_multisymb(Smtlibv2Parser.Data_multisymbContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#function_dec}. + * + * @param ctx the parse tree + */ + void enterFunction_dec(Smtlibv2Parser.Function_decContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#function_dec}. + * + * @param ctx the parse tree + */ + void exitFunction_dec(Smtlibv2Parser.Function_decContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#function_def}. + * + * @param ctx the parse tree + */ + void enterFunction_def(Smtlibv2Parser.Function_defContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#function_def}. + * + * @param ctx the parse tree + */ + void exitFunction_def(Smtlibv2Parser.Function_defContext ctx); + + /** + * Enter a parse tree produced by the {@code prop_symb} labeled alternative in {@link + * Smtlibv2Parser#prop_literal}. + * + * @param ctx the parse tree + */ + void enterProp_symb(Smtlibv2Parser.Prop_symbContext ctx); + + /** + * Exit a parse tree produced by the {@code prop_symb} labeled alternative in {@link + * Smtlibv2Parser#prop_literal}. + * + * @param ctx the parse tree + */ + void exitProp_symb(Smtlibv2Parser.Prop_symbContext ctx); + + /** + * Enter a parse tree produced by the {@code prop_not} labeled alternative in {@link + * Smtlibv2Parser#prop_literal}. + * + * @param ctx the parse tree + */ + void enterProp_not(Smtlibv2Parser.Prop_notContext ctx); + + /** + * Exit a parse tree produced by the {@code prop_not} labeled alternative in {@link + * Smtlibv2Parser#prop_literal}. + * + * @param ctx the parse tree + */ + void exitProp_not(Smtlibv2Parser.Prop_notContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#script}. + * + * @param ctx the parse tree + */ + void enterScript(Smtlibv2Parser.ScriptContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#script}. + * + * @param ctx the parse tree + */ + void exitScript(Smtlibv2Parser.ScriptContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_assert}. + * + * @param ctx the parse tree + */ + void enterCmd_assert(Smtlibv2Parser.Cmd_assertContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_assert}. + * + * @param ctx the parse tree + */ + void exitCmd_assert(Smtlibv2Parser.Cmd_assertContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_checkSat}. + * + * @param ctx the parse tree + */ + void enterCmd_checkSat(Smtlibv2Parser.Cmd_checkSatContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_checkSat}. + * + * @param ctx the parse tree + */ + void exitCmd_checkSat(Smtlibv2Parser.Cmd_checkSatContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_checkSatAssuming}. + * + * @param ctx the parse tree + */ + void enterCmd_checkSatAssuming(Smtlibv2Parser.Cmd_checkSatAssumingContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_checkSatAssuming}. + * + * @param ctx the parse tree + */ + void exitCmd_checkSatAssuming(Smtlibv2Parser.Cmd_checkSatAssumingContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_declareConst}. + * + * @param ctx the parse tree + */ + void enterCmd_declareConst(Smtlibv2Parser.Cmd_declareConstContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_declareConst}. + * + * @param ctx the parse tree + */ + void exitCmd_declareConst(Smtlibv2Parser.Cmd_declareConstContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_declareDatatype}. + * + * @param ctx the parse tree + */ + void enterCmd_declareDatatype(Smtlibv2Parser.Cmd_declareDatatypeContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_declareDatatype}. + * + * @param ctx the parse tree + */ + void exitCmd_declareDatatype(Smtlibv2Parser.Cmd_declareDatatypeContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_declareDatatypes}. + * + * @param ctx the parse tree + */ + void enterCmd_declareDatatypes(Smtlibv2Parser.Cmd_declareDatatypesContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_declareDatatypes}. + * + * @param ctx the parse tree + */ + void exitCmd_declareDatatypes(Smtlibv2Parser.Cmd_declareDatatypesContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_declareFun}. + * + * @param ctx the parse tree + */ + void enterCmd_declareFun(Smtlibv2Parser.Cmd_declareFunContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_declareFun}. + * + * @param ctx the parse tree + */ + void exitCmd_declareFun(Smtlibv2Parser.Cmd_declareFunContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_declareSort}. + * + * @param ctx the parse tree + */ + void enterCmd_declareSort(Smtlibv2Parser.Cmd_declareSortContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_declareSort}. + * + * @param ctx the parse tree + */ + void exitCmd_declareSort(Smtlibv2Parser.Cmd_declareSortContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_defineFun}. + * + * @param ctx the parse tree + */ + void enterCmd_defineFun(Smtlibv2Parser.Cmd_defineFunContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_defineFun}. + * + * @param ctx the parse tree + */ + void exitCmd_defineFun(Smtlibv2Parser.Cmd_defineFunContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_defineFunRec}. + * + * @param ctx the parse tree + */ + void enterCmd_defineFunRec(Smtlibv2Parser.Cmd_defineFunRecContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_defineFunRec}. + * + * @param ctx the parse tree + */ + void exitCmd_defineFunRec(Smtlibv2Parser.Cmd_defineFunRecContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_defineFunsRec}. + * + * @param ctx the parse tree + */ + void enterCmd_defineFunsRec(Smtlibv2Parser.Cmd_defineFunsRecContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_defineFunsRec}. + * + * @param ctx the parse tree + */ + void exitCmd_defineFunsRec(Smtlibv2Parser.Cmd_defineFunsRecContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_defineSort}. + * + * @param ctx the parse tree + */ + void enterCmd_defineSort(Smtlibv2Parser.Cmd_defineSortContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_defineSort}. + * + * @param ctx the parse tree + */ + void exitCmd_defineSort(Smtlibv2Parser.Cmd_defineSortContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_echo}. + * + * @param ctx the parse tree + */ + void enterCmd_echo(Smtlibv2Parser.Cmd_echoContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_echo}. + * + * @param ctx the parse tree + */ + void exitCmd_echo(Smtlibv2Parser.Cmd_echoContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_exit}. + * + * @param ctx the parse tree + */ + void enterCmd_exit(Smtlibv2Parser.Cmd_exitContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_exit}. + * + * @param ctx the parse tree + */ + void exitCmd_exit(Smtlibv2Parser.Cmd_exitContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getAssertions}. + * + * @param ctx the parse tree + */ + void enterCmd_getAssertions(Smtlibv2Parser.Cmd_getAssertionsContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getAssertions}. + * + * @param ctx the parse tree + */ + void exitCmd_getAssertions(Smtlibv2Parser.Cmd_getAssertionsContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getAssignment}. + * + * @param ctx the parse tree + */ + void enterCmd_getAssignment(Smtlibv2Parser.Cmd_getAssignmentContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getAssignment}. + * + * @param ctx the parse tree + */ + void exitCmd_getAssignment(Smtlibv2Parser.Cmd_getAssignmentContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getInfo}. + * + * @param ctx the parse tree + */ + void enterCmd_getInfo(Smtlibv2Parser.Cmd_getInfoContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getInfo}. + * + * @param ctx the parse tree + */ + void exitCmd_getInfo(Smtlibv2Parser.Cmd_getInfoContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getModel}. + * + * @param ctx the parse tree + */ + void enterCmd_getModel(Smtlibv2Parser.Cmd_getModelContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getModel}. + * + * @param ctx the parse tree + */ + void exitCmd_getModel(Smtlibv2Parser.Cmd_getModelContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getOption}. + * + * @param ctx the parse tree + */ + void enterCmd_getOption(Smtlibv2Parser.Cmd_getOptionContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getOption}. + * + * @param ctx the parse tree + */ + void exitCmd_getOption(Smtlibv2Parser.Cmd_getOptionContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getProof}. + * + * @param ctx the parse tree + */ + void enterCmd_getProof(Smtlibv2Parser.Cmd_getProofContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getProof}. + * + * @param ctx the parse tree + */ + void exitCmd_getProof(Smtlibv2Parser.Cmd_getProofContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getUnsatAssumptions}. + * + * @param ctx the parse tree + */ + void enterCmd_getUnsatAssumptions(Smtlibv2Parser.Cmd_getUnsatAssumptionsContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getUnsatAssumptions}. + * + * @param ctx the parse tree + */ + void exitCmd_getUnsatAssumptions(Smtlibv2Parser.Cmd_getUnsatAssumptionsContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getUnsatCore}. + * + * @param ctx the parse tree + */ + void enterCmd_getUnsatCore(Smtlibv2Parser.Cmd_getUnsatCoreContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getUnsatCore}. + * + * @param ctx the parse tree + */ + void exitCmd_getUnsatCore(Smtlibv2Parser.Cmd_getUnsatCoreContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_getValue}. + * + * @param ctx the parse tree + */ + void enterCmd_getValue(Smtlibv2Parser.Cmd_getValueContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_getValue}. + * + * @param ctx the parse tree + */ + void exitCmd_getValue(Smtlibv2Parser.Cmd_getValueContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_pop}. + * + * @param ctx the parse tree + */ + void enterCmd_pop(Smtlibv2Parser.Cmd_popContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_pop}. + * + * @param ctx the parse tree + */ + void exitCmd_pop(Smtlibv2Parser.Cmd_popContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_push}. + * + * @param ctx the parse tree + */ + void enterCmd_push(Smtlibv2Parser.Cmd_pushContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_push}. + * + * @param ctx the parse tree + */ + void exitCmd_push(Smtlibv2Parser.Cmd_pushContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_reset}. + * + * @param ctx the parse tree + */ + void enterCmd_reset(Smtlibv2Parser.Cmd_resetContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_reset}. + * + * @param ctx the parse tree + */ + void exitCmd_reset(Smtlibv2Parser.Cmd_resetContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_resetAssertions}. + * + * @param ctx the parse tree + */ + void enterCmd_resetAssertions(Smtlibv2Parser.Cmd_resetAssertionsContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_resetAssertions}. + * + * @param ctx the parse tree + */ + void exitCmd_resetAssertions(Smtlibv2Parser.Cmd_resetAssertionsContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_setInfo}. + * + * @param ctx the parse tree + */ + void enterCmd_setInfo(Smtlibv2Parser.Cmd_setInfoContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_setInfo}. + * + * @param ctx the parse tree + */ + void exitCmd_setInfo(Smtlibv2Parser.Cmd_setInfoContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_setLogic}. + * + * @param ctx the parse tree + */ + void enterCmd_setLogic(Smtlibv2Parser.Cmd_setLogicContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_setLogic}. + * + * @param ctx the parse tree + */ + void exitCmd_setLogic(Smtlibv2Parser.Cmd_setLogicContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#cmd_setOption}. + * + * @param ctx the parse tree + */ + void enterCmd_setOption(Smtlibv2Parser.Cmd_setOptionContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#cmd_setOption}. + * + * @param ctx the parse tree + */ + void exitCmd_setOption(Smtlibv2Parser.Cmd_setOptionContext ctx); + + /** + * Enter a parse tree produced by the {@code assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterAssert(Smtlibv2Parser.AssertContext ctx); + + /** + * Exit a parse tree produced by the {@code assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitAssert(Smtlibv2Parser.AssertContext ctx); + + /** + * Enter a parse tree produced by the {@code check} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterCheck(Smtlibv2Parser.CheckContext ctx); + + /** + * Exit a parse tree produced by the {@code check} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitCheck(Smtlibv2Parser.CheckContext ctx); + + /** + * Enter a parse tree produced by the {@code check_assume} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterCheck_assume(Smtlibv2Parser.Check_assumeContext ctx); + + /** + * Exit a parse tree produced by the {@code check_assume} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitCheck_assume(Smtlibv2Parser.Check_assumeContext ctx); + + /** + * Enter a parse tree produced by the {@code decl_const} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDecl_const(Smtlibv2Parser.Decl_constContext ctx); + + /** + * Exit a parse tree produced by the {@code decl_const} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDecl_const(Smtlibv2Parser.Decl_constContext ctx); + + /** + * Enter a parse tree produced by the {@code decl_data} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDecl_data(Smtlibv2Parser.Decl_dataContext ctx); + + /** + * Exit a parse tree produced by the {@code decl_data} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDecl_data(Smtlibv2Parser.Decl_dataContext ctx); + + /** + * Enter a parse tree produced by the {@code decl_datas} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDecl_datas(Smtlibv2Parser.Decl_datasContext ctx); + + /** + * Exit a parse tree produced by the {@code decl_datas} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDecl_datas(Smtlibv2Parser.Decl_datasContext ctx); + + /** + * Enter a parse tree produced by the {@code decl_fun} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDecl_fun(Smtlibv2Parser.Decl_funContext ctx); + + /** + * Exit a parse tree produced by the {@code decl_fun} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDecl_fun(Smtlibv2Parser.Decl_funContext ctx); + + /** + * Enter a parse tree produced by the {@code decl_sort} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDecl_sort(Smtlibv2Parser.Decl_sortContext ctx); + + /** + * Exit a parse tree produced by the {@code decl_sort} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDecl_sort(Smtlibv2Parser.Decl_sortContext ctx); + + /** + * Enter a parse tree produced by the {@code def_fun} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDef_fun(Smtlibv2Parser.Def_funContext ctx); + + /** + * Exit a parse tree produced by the {@code def_fun} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDef_fun(Smtlibv2Parser.Def_funContext ctx); + + /** + * Enter a parse tree produced by the {@code def_fun_rec} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDef_fun_rec(Smtlibv2Parser.Def_fun_recContext ctx); + + /** + * Exit a parse tree produced by the {@code def_fun_rec} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDef_fun_rec(Smtlibv2Parser.Def_fun_recContext ctx); + + /** + * Enter a parse tree produced by the {@code def_funs_rec} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDef_funs_rec(Smtlibv2Parser.Def_funs_recContext ctx); + + /** + * Exit a parse tree produced by the {@code def_funs_rec} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDef_funs_rec(Smtlibv2Parser.Def_funs_recContext ctx); + + /** + * Enter a parse tree produced by the {@code def_sort} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterDef_sort(Smtlibv2Parser.Def_sortContext ctx); + + /** + * Exit a parse tree produced by the {@code def_sort} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitDef_sort(Smtlibv2Parser.Def_sortContext ctx); + + /** + * Enter a parse tree produced by the {@code echo} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterEcho(Smtlibv2Parser.EchoContext ctx); + + /** + * Exit a parse tree produced by the {@code echo} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitEcho(Smtlibv2Parser.EchoContext ctx); + + /** + * Enter a parse tree produced by the {@code exit} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterExit(Smtlibv2Parser.ExitContext ctx); + + /** + * Exit a parse tree produced by the {@code exit} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitExit(Smtlibv2Parser.ExitContext ctx); + + /** + * Enter a parse tree produced by the {@code get_assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_assert(Smtlibv2Parser.Get_assertContext ctx); + + /** + * Exit a parse tree produced by the {@code get_assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_assert(Smtlibv2Parser.Get_assertContext ctx); + + /** + * Enter a parse tree produced by the {@code get_assign} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_assign(Smtlibv2Parser.Get_assignContext ctx); + + /** + * Exit a parse tree produced by the {@code get_assign} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_assign(Smtlibv2Parser.Get_assignContext ctx); + + /** + * Enter a parse tree produced by the {@code get_info} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_info(Smtlibv2Parser.Get_infoContext ctx); + + /** + * Exit a parse tree produced by the {@code get_info} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_info(Smtlibv2Parser.Get_infoContext ctx); + + /** + * Enter a parse tree produced by the {@code get_model} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_model(Smtlibv2Parser.Get_modelContext ctx); + + /** + * Exit a parse tree produced by the {@code get_model} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_model(Smtlibv2Parser.Get_modelContext ctx); + + /** + * Enter a parse tree produced by the {@code get_option} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_option(Smtlibv2Parser.Get_optionContext ctx); + + /** + * Exit a parse tree produced by the {@code get_option} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_option(Smtlibv2Parser.Get_optionContext ctx); + + /** + * Enter a parse tree produced by the {@code get_proof} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_proof(Smtlibv2Parser.Get_proofContext ctx); + + /** + * Exit a parse tree produced by the {@code get_proof} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_proof(Smtlibv2Parser.Get_proofContext ctx); + + /** + * Enter a parse tree produced by the {@code get_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_unsat_assume(Smtlibv2Parser.Get_unsat_assumeContext ctx); + + /** + * Exit a parse tree produced by the {@code get_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_unsat_assume(Smtlibv2Parser.Get_unsat_assumeContext ctx); + + /** + * Enter a parse tree produced by the {@code get_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_unsat_core(Smtlibv2Parser.Get_unsat_coreContext ctx); + + /** + * Exit a parse tree produced by the {@code get_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_unsat_core(Smtlibv2Parser.Get_unsat_coreContext ctx); + + /** + * Enter a parse tree produced by the {@code get_val} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterGet_val(Smtlibv2Parser.Get_valContext ctx); + + /** + * Exit a parse tree produced by the {@code get_val} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitGet_val(Smtlibv2Parser.Get_valContext ctx); + + /** + * Enter a parse tree produced by the {@code pop} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterPop(Smtlibv2Parser.PopContext ctx); + + /** + * Exit a parse tree produced by the {@code pop} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitPop(Smtlibv2Parser.PopContext ctx); + + /** + * Enter a parse tree produced by the {@code push} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterPush(Smtlibv2Parser.PushContext ctx); + + /** + * Exit a parse tree produced by the {@code push} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitPush(Smtlibv2Parser.PushContext ctx); + + /** + * Enter a parse tree produced by the {@code reset} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterReset(Smtlibv2Parser.ResetContext ctx); + + /** + * Exit a parse tree produced by the {@code reset} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitReset(Smtlibv2Parser.ResetContext ctx); + + /** + * Enter a parse tree produced by the {@code reset_assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterReset_assert(Smtlibv2Parser.Reset_assertContext ctx); + + /** + * Exit a parse tree produced by the {@code reset_assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitReset_assert(Smtlibv2Parser.Reset_assertContext ctx); + + /** + * Enter a parse tree produced by the {@code setInfo} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterSetInfo(Smtlibv2Parser.SetInfoContext ctx); + + /** + * Exit a parse tree produced by the {@code setInfo} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitSetInfo(Smtlibv2Parser.SetInfoContext ctx); + + /** + * Enter a parse tree produced by the {@code set_logic} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterSet_logic(Smtlibv2Parser.Set_logicContext ctx); + + /** + * Exit a parse tree produced by the {@code set_logic} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitSet_logic(Smtlibv2Parser.Set_logicContext ctx); + + /** + * Enter a parse tree produced by the {@code set_option} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void enterSet_option(Smtlibv2Parser.Set_optionContext ctx); + + /** + * Exit a parse tree produced by the {@code set_option} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + */ + void exitSet_option(Smtlibv2Parser.Set_optionContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#b_value}. + * + * @param ctx the parse tree + */ + void enterB_value(Smtlibv2Parser.B_valueContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#b_value}. + * + * @param ctx the parse tree + */ + void exitB_value(Smtlibv2Parser.B_valueContext ctx); + + /** + * Enter a parse tree produced by the {@code diagnose} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterDiagnose(Smtlibv2Parser.DiagnoseContext ctx); + + /** + * Exit a parse tree produced by the {@code diagnose} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitDiagnose(Smtlibv2Parser.DiagnoseContext ctx); + + /** + * Enter a parse tree produced by the {@code global} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterGlobal(Smtlibv2Parser.GlobalContext ctx); + + /** + * Exit a parse tree produced by the {@code global} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitGlobal(Smtlibv2Parser.GlobalContext ctx); + + /** + * Enter a parse tree produced by the {@code interactive} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterInteractive(Smtlibv2Parser.InteractiveContext ctx); + + /** + * Exit a parse tree produced by the {@code interactive} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitInteractive(Smtlibv2Parser.InteractiveContext ctx); + + /** + * Enter a parse tree produced by the {@code print_succ} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterPrint_succ(Smtlibv2Parser.Print_succContext ctx); + + /** + * Exit a parse tree produced by the {@code print_succ} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitPrint_succ(Smtlibv2Parser.Print_succContext ctx); + + /** + * Enter a parse tree produced by the {@code prod_assert} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterProd_assert(Smtlibv2Parser.Prod_assertContext ctx); + + /** + * Exit a parse tree produced by the {@code prod_assert} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitProd_assert(Smtlibv2Parser.Prod_assertContext ctx); + + /** + * Enter a parse tree produced by the {@code prod_assign} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterProd_assign(Smtlibv2Parser.Prod_assignContext ctx); + + /** + * Exit a parse tree produced by the {@code prod_assign} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitProd_assign(Smtlibv2Parser.Prod_assignContext ctx); + + /** + * Enter a parse tree produced by the {@code prod_mod} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterProd_mod(Smtlibv2Parser.Prod_modContext ctx); + + /** + * Exit a parse tree produced by the {@code prod_mod} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitProd_mod(Smtlibv2Parser.Prod_modContext ctx); + + /** + * Enter a parse tree produced by the {@code prod_proofs} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterProd_proofs(Smtlibv2Parser.Prod_proofsContext ctx); + + /** + * Exit a parse tree produced by the {@code prod_proofs} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitProd_proofs(Smtlibv2Parser.Prod_proofsContext ctx); + + /** + * Enter a parse tree produced by the {@code prod_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterProd_unsat_assume(Smtlibv2Parser.Prod_unsat_assumeContext ctx); + + /** + * Exit a parse tree produced by the {@code prod_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitProd_unsat_assume(Smtlibv2Parser.Prod_unsat_assumeContext ctx); + + /** + * Enter a parse tree produced by the {@code prod_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterProd_unsat_core(Smtlibv2Parser.Prod_unsat_coreContext ctx); + + /** + * Exit a parse tree produced by the {@code prod_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitProd_unsat_core(Smtlibv2Parser.Prod_unsat_coreContext ctx); + + /** + * Enter a parse tree produced by the {@code rand_seed} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterRand_seed(Smtlibv2Parser.Rand_seedContext ctx); + + /** + * Exit a parse tree produced by the {@code rand_seed} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitRand_seed(Smtlibv2Parser.Rand_seedContext ctx); + + /** + * Enter a parse tree produced by the {@code reg_out} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterReg_out(Smtlibv2Parser.Reg_outContext ctx); + + /** + * Exit a parse tree produced by the {@code reg_out} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitReg_out(Smtlibv2Parser.Reg_outContext ctx); + + /** + * Enter a parse tree produced by the {@code repro} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterRepro(Smtlibv2Parser.ReproContext ctx); + + /** + * Exit a parse tree produced by the {@code repro} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitRepro(Smtlibv2Parser.ReproContext ctx); + + /** + * Enter a parse tree produced by the {@code verbose} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterVerbose(Smtlibv2Parser.VerboseContext ctx); + + /** + * Exit a parse tree produced by the {@code verbose} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitVerbose(Smtlibv2Parser.VerboseContext ctx); + + /** + * Enter a parse tree produced by the {@code opt_attr} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void enterOpt_attr(Smtlibv2Parser.Opt_attrContext ctx); + + /** + * Exit a parse tree produced by the {@code opt_attr} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + */ + void exitOpt_attr(Smtlibv2Parser.Opt_attrContext ctx); + + /** + * Enter a parse tree produced by the {@code all_stat} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void enterAll_stat(Smtlibv2Parser.All_statContext ctx); + + /** + * Exit a parse tree produced by the {@code all_stat} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void exitAll_stat(Smtlibv2Parser.All_statContext ctx); + + /** + * Enter a parse tree produced by the {@code assert_stack} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void enterAssert_stack(Smtlibv2Parser.Assert_stackContext ctx); + + /** + * Exit a parse tree produced by the {@code assert_stack} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void exitAssert_stack(Smtlibv2Parser.Assert_stackContext ctx); + + /** + * Enter a parse tree produced by the {@code authors} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void enterAuthors(Smtlibv2Parser.AuthorsContext ctx); + + /** + * Exit a parse tree produced by the {@code authors} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void exitAuthors(Smtlibv2Parser.AuthorsContext ctx); + + /** + * Enter a parse tree produced by the {@code error} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void enterError(Smtlibv2Parser.ErrorContext ctx); + + /** + * Exit a parse tree produced by the {@code error} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void exitError(Smtlibv2Parser.ErrorContext ctx); + + /** + * Enter a parse tree produced by the {@code name} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void enterName(Smtlibv2Parser.NameContext ctx); + + /** + * Exit a parse tree produced by the {@code name} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void exitName(Smtlibv2Parser.NameContext ctx); + + /** + * Enter a parse tree produced by the {@code r_unknown} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void enterR_unknown(Smtlibv2Parser.R_unknownContext ctx); + + /** + * Exit a parse tree produced by the {@code r_unknown} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void exitR_unknown(Smtlibv2Parser.R_unknownContext ctx); + + /** + * Enter a parse tree produced by the {@code version} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void enterVersion(Smtlibv2Parser.VersionContext ctx); + + /** + * Exit a parse tree produced by the {@code version} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void exitVersion(Smtlibv2Parser.VersionContext ctx); + + /** + * Enter a parse tree produced by the {@code info_key} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void enterInfo_key(Smtlibv2Parser.Info_keyContext ctx); + + /** + * Exit a parse tree produced by the {@code info_key} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + */ + void exitInfo_key(Smtlibv2Parser.Info_keyContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#error_behaviour}. + * + * @param ctx the parse tree + */ + void enterError_behaviour(Smtlibv2Parser.Error_behaviourContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#error_behaviour}. + * + * @param ctx the parse tree + */ + void exitError_behaviour(Smtlibv2Parser.Error_behaviourContext ctx); + + /** + * Enter a parse tree produced by the {@code memout} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + */ + void enterMemout(Smtlibv2Parser.MemoutContext ctx); + + /** + * Exit a parse tree produced by the {@code memout} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + */ + void exitMemout(Smtlibv2Parser.MemoutContext ctx); + + /** + * Enter a parse tree produced by the {@code incomp} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + */ + void enterIncomp(Smtlibv2Parser.IncompContext ctx); + + /** + * Exit a parse tree produced by the {@code incomp} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + */ + void exitIncomp(Smtlibv2Parser.IncompContext ctx); + + /** + * Enter a parse tree produced by the {@code r_unnown_s_expr} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + */ + void enterR_unnown_s_expr(Smtlibv2Parser.R_unnown_s_exprContext ctx); + + /** + * Exit a parse tree produced by the {@code r_unnown_s_expr} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + */ + void exitR_unnown_s_expr(Smtlibv2Parser.R_unnown_s_exprContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_def_fun} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + */ + void enterResp_def_fun(Smtlibv2Parser.Resp_def_funContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_def_fun} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + */ + void exitResp_def_fun(Smtlibv2Parser.Resp_def_funContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_def_fun_rec} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + */ + void enterResp_def_fun_rec(Smtlibv2Parser.Resp_def_fun_recContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_def_fun_rec} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + */ + void exitResp_def_fun_rec(Smtlibv2Parser.Resp_def_fun_recContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_def_funs_rec} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + */ + void enterResp_def_funs_rec(Smtlibv2Parser.Resp_def_funs_recContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_def_funs_rec} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + */ + void exitResp_def_funs_rec(Smtlibv2Parser.Resp_def_funs_recContext ctx); + + /** + * Enter a parse tree produced by the {@code info_assert_stack} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void enterInfo_assert_stack(Smtlibv2Parser.Info_assert_stackContext ctx); + + /** + * Exit a parse tree produced by the {@code info_assert_stack} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void exitInfo_assert_stack(Smtlibv2Parser.Info_assert_stackContext ctx); + + /** + * Enter a parse tree produced by the {@code info_authors} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void enterInfo_authors(Smtlibv2Parser.Info_authorsContext ctx); + + /** + * Exit a parse tree produced by the {@code info_authors} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void exitInfo_authors(Smtlibv2Parser.Info_authorsContext ctx); + + /** + * Enter a parse tree produced by the {@code info_error} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void enterInfo_error(Smtlibv2Parser.Info_errorContext ctx); + + /** + * Exit a parse tree produced by the {@code info_error} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void exitInfo_error(Smtlibv2Parser.Info_errorContext ctx); + + /** + * Enter a parse tree produced by the {@code info_name} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void enterInfo_name(Smtlibv2Parser.Info_nameContext ctx); + + /** + * Exit a parse tree produced by the {@code info_name} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void exitInfo_name(Smtlibv2Parser.Info_nameContext ctx); + + /** + * Enter a parse tree produced by the {@code info_r_unknown} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void enterInfo_r_unknown(Smtlibv2Parser.Info_r_unknownContext ctx); + + /** + * Exit a parse tree produced by the {@code info_r_unknown} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void exitInfo_r_unknown(Smtlibv2Parser.Info_r_unknownContext ctx); + + /** + * Enter a parse tree produced by the {@code info_version} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void enterInfo_version(Smtlibv2Parser.Info_versionContext ctx); + + /** + * Exit a parse tree produced by the {@code info_version} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void exitInfo_version(Smtlibv2Parser.Info_versionContext ctx); + + /** + * Enter a parse tree produced by the {@code info_attr} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void enterInfo_attr(Smtlibv2Parser.Info_attrContext ctx); + + /** + * Exit a parse tree produced by the {@code info_attr} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + */ + void exitInfo_attr(Smtlibv2Parser.Info_attrContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#valuation_pair}. + * + * @param ctx the parse tree + */ + void enterValuation_pair(Smtlibv2Parser.Valuation_pairContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#valuation_pair}. + * + * @param ctx the parse tree + */ + void exitValuation_pair(Smtlibv2Parser.Valuation_pairContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#t_valuation_pair}. + * + * @param ctx the parse tree + */ + void enterT_valuation_pair(Smtlibv2Parser.T_valuation_pairContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#t_valuation_pair}. + * + * @param ctx the parse tree + */ + void exitT_valuation_pair(Smtlibv2Parser.T_valuation_pairContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#check_sat_response}. + * + * @param ctx the parse tree + */ + void enterCheck_sat_response(Smtlibv2Parser.Check_sat_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#check_sat_response}. + * + * @param ctx the parse tree + */ + void exitCheck_sat_response(Smtlibv2Parser.Check_sat_responseContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#echo_response}. + * + * @param ctx the parse tree + */ + void enterEcho_response(Smtlibv2Parser.Echo_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#echo_response}. + * + * @param ctx the parse tree + */ + void exitEcho_response(Smtlibv2Parser.Echo_responseContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#get_assertions_response}. + * + * @param ctx the parse tree + */ + void enterGet_assertions_response(Smtlibv2Parser.Get_assertions_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#get_assertions_response}. + * + * @param ctx the parse tree + */ + void exitGet_assertions_response(Smtlibv2Parser.Get_assertions_responseContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#get_assignment_response}. + * + * @param ctx the parse tree + */ + void enterGet_assignment_response(Smtlibv2Parser.Get_assignment_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#get_assignment_response}. + * + * @param ctx the parse tree + */ + void exitGet_assignment_response(Smtlibv2Parser.Get_assignment_responseContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#get_info_response}. + * + * @param ctx the parse tree + */ + void enterGet_info_response(Smtlibv2Parser.Get_info_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#get_info_response}. + * + * @param ctx the parse tree + */ + void exitGet_info_response(Smtlibv2Parser.Get_info_responseContext ctx); + + /** + * Enter a parse tree produced by the {@code rs_model} labeled alternative in {@link + * Smtlibv2Parser#get_model_response}. + * + * @param ctx the parse tree + */ + void enterRs_model(Smtlibv2Parser.Rs_modelContext ctx); + + /** + * Exit a parse tree produced by the {@code rs_model} labeled alternative in {@link + * Smtlibv2Parser#get_model_response}. + * + * @param ctx the parse tree + */ + void exitRs_model(Smtlibv2Parser.Rs_modelContext ctx); + + /** + * Enter a parse tree produced by the {@code model_resp} labeled alternative in {@link + * Smtlibv2Parser#get_model_response}. + * + * @param ctx the parse tree + */ + void enterModel_resp(Smtlibv2Parser.Model_respContext ctx); + + /** + * Exit a parse tree produced by the {@code model_resp} labeled alternative in {@link + * Smtlibv2Parser#get_model_response}. + * + * @param ctx the parse tree + */ + void exitModel_resp(Smtlibv2Parser.Model_respContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#get_option_response}. + * + * @param ctx the parse tree + */ + void enterGet_option_response(Smtlibv2Parser.Get_option_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#get_option_response}. + * + * @param ctx the parse tree + */ + void exitGet_option_response(Smtlibv2Parser.Get_option_responseContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#get_proof_response}. + * + * @param ctx the parse tree + */ + void enterGet_proof_response(Smtlibv2Parser.Get_proof_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#get_proof_response}. + * + * @param ctx the parse tree + */ + void exitGet_proof_response(Smtlibv2Parser.Get_proof_responseContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#get_unsat_assump_response}. + * + * @param ctx the parse tree + */ + void enterGet_unsat_assump_response(Smtlibv2Parser.Get_unsat_assump_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#get_unsat_assump_response}. + * + * @param ctx the parse tree + */ + void exitGet_unsat_assump_response(Smtlibv2Parser.Get_unsat_assump_responseContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#get_unsat_core_response}. + * + * @param ctx the parse tree + */ + void enterGet_unsat_core_response(Smtlibv2Parser.Get_unsat_core_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#get_unsat_core_response}. + * + * @param ctx the parse tree + */ + void exitGet_unsat_core_response(Smtlibv2Parser.Get_unsat_core_responseContext ctx); + + /** + * Enter a parse tree produced by {@link Smtlibv2Parser#get_value_response}. + * + * @param ctx the parse tree + */ + void enterGet_value_response(Smtlibv2Parser.Get_value_responseContext ctx); + + /** + * Exit a parse tree produced by {@link Smtlibv2Parser#get_value_response}. + * + * @param ctx the parse tree + */ + void exitGet_value_response(Smtlibv2Parser.Get_value_responseContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_check_sat} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_check_sat(Smtlibv2Parser.Resp_check_satContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_check_sat} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_check_sat(Smtlibv2Parser.Resp_check_satContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_echo} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_echo(Smtlibv2Parser.Resp_echoContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_echo} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_echo(Smtlibv2Parser.Resp_echoContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_get_assert} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_get_assert(Smtlibv2Parser.Resp_get_assertContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_get_assert} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_get_assert(Smtlibv2Parser.Resp_get_assertContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_gett_assign} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_gett_assign(Smtlibv2Parser.Resp_gett_assignContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_gett_assign} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_gett_assign(Smtlibv2Parser.Resp_gett_assignContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_get_info} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_get_info(Smtlibv2Parser.Resp_get_infoContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_get_info} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_get_info(Smtlibv2Parser.Resp_get_infoContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_get_model} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_get_model(Smtlibv2Parser.Resp_get_modelContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_get_model} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_get_model(Smtlibv2Parser.Resp_get_modelContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_option} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_option(Smtlibv2Parser.Resp_optionContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_option} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_option(Smtlibv2Parser.Resp_optionContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_proof} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_proof(Smtlibv2Parser.Resp_proofContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_proof} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_proof(Smtlibv2Parser.Resp_proofContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_unsat_assume(Smtlibv2Parser.Resp_unsat_assumeContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_unsat_assume(Smtlibv2Parser.Resp_unsat_assumeContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_unsat_core(Smtlibv2Parser.Resp_unsat_coreContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_unsat_core(Smtlibv2Parser.Resp_unsat_coreContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_value} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void enterResp_value(Smtlibv2Parser.Resp_valueContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_value} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + */ + void exitResp_value(Smtlibv2Parser.Resp_valueContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_success} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + */ + void enterResp_success(Smtlibv2Parser.Resp_successContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_success} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + */ + void exitResp_success(Smtlibv2Parser.Resp_successContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_spec_successs} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + */ + void enterResp_spec_successs(Smtlibv2Parser.Resp_spec_successsContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_spec_successs} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + */ + void exitResp_spec_successs(Smtlibv2Parser.Resp_spec_successsContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_unsupported} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + */ + void enterResp_unsupported(Smtlibv2Parser.Resp_unsupportedContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_unsupported} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + */ + void exitResp_unsupported(Smtlibv2Parser.Resp_unsupportedContext ctx); + + /** + * Enter a parse tree produced by the {@code resp_error} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + */ + void enterResp_error(Smtlibv2Parser.Resp_errorContext ctx); + + /** + * Exit a parse tree produced by the {@code resp_error} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + */ + void exitResp_error(Smtlibv2Parser.Resp_errorContext ctx); +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Parser.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Parser.java new file mode 100644 index 0000000000..d4a6783741 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Parser.java @@ -0,0 +1,15011 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2021 Alejandro SerranoMena +// +// SPDX-License-Identifier: Apache-2.0 + +// Generated from +// /home/davidg/IdeaProjects/java-smt-working-branch/java-smt/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 by ANTLR 4.13.2 +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +import java.util.List; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; +import org.antlr.v4.runtime.tree.*; + +@SuppressWarnings({ + "all", + "warnings", + "unchecked", + "unused", + "cast", + "CheckReturnValue", + "this-escape" +}) +public class Smtlibv2Parser extends Parser { + static { + RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); + } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); + public static final int Comment = 1, + ParOpen = 2, + ParClose = 3, + Semicolon = 4, + String = 5, + QuotedSymbol = 6, + FLOATING_POINT_SORT = 7, + FLOATING_POINT_NUMBER = 8, + REGEXVALUES = 9, + TO_FP_EXPR = 10, + RE_TIMES_EXPR = 11, + RE_LOOP_EXPR = 12, + PS_Not = 13, + PS_Bool = 14, + PS_ContinuedExecution = 15, + PS_Error = 16, + PS_False = 17, + PS_ImmediateExit = 18, + PS_Incomplete = 19, + PS_Logic = 20, + PS_Memout = 21, + PS_Sat = 22, + PS_Success = 23, + PS_Theory = 24, + PS_True = 25, + PS_Unknown = 26, + PS_Unsupported = 27, + PS_Unsat = 28, + CMD_Assert = 29, + CMD_CheckSat = 30, + CMD_CheckSatAssuming = 31, + CMD_DeclareConst = 32, + CMD_DeclareDatatype = 33, + CMD_DeclareDatatypes = 34, + CMD_DeclareFun = 35, + CMD_DeclareSort = 36, + CMD_DefineFun = 37, + CMD_DefineFunRec = 38, + CMD_DefineFunsRec = 39, + CMD_DefineSort = 40, + CMD_Echo = 41, + CMD_Exit = 42, + CMD_GetAssertions = 43, + CMD_GetAssignment = 44, + CMD_GetInfo = 45, + CMD_GetModel = 46, + CMD_GetOption = 47, + CMD_GetProof = 48, + CMD_GetUnsatAssumptions = 49, + CMD_GetUnsatCore = 50, + CMD_GetValue = 51, + CMD_Pop = 52, + CMD_Push = 53, + CMD_Reset = 54, + CMD_ResetAssertions = 55, + CMD_SetInfo = 56, + CMD_SetLogic = 57, + CMD_SetOption = 58, + GRW_Exclamation = 59, + GRW_Underscore = 60, + GRW_As = 61, + GRW_Binary = 62, + GRW_Decimal = 63, + GRW_Exists = 64, + GRW_Hexadecimal = 65, + GRW_Forall = 66, + GRW_Let = 67, + GRW_Match = 68, + GRW_Numeral = 69, + GRW_Par = 70, + GRW_String = 71, + GRW_FloatingPoint = 72, + Numeral = 73, + Binary = 74, + HexDecimal = 75, + Decimal = 76, + Colon = 77, + PK_AllStatistics = 78, + PK_AssertionStackLevels = 79, + PK_Authors = 80, + PK_Category = 81, + PK_Chainable = 82, + PK_Definition = 83, + PK_DiagnosticOutputChannel = 84, + PK_ErrorBehaviour = 85, + PK_Extension = 86, + PK_Funs = 87, + PK_FunsDescription = 88, + PK_GlobalDeclarations = 89, + PK_InteractiveMode = 90, + PK_Language = 91, + PK_LeftAssoc = 92, + PK_License = 93, + PK_Named = 94, + PK_Name = 95, + PK_Notes = 96, + PK_Pattern = 97, + PK_PrintSuccess = 98, + PK_ProduceAssertions = 99, + PK_ProduceAssignments = 100, + PK_ProduceModels = 101, + PK_ProduceProofs = 102, + PK_ProduceUnsatAssumptions = 103, + PK_ProduceUnsatCores = 104, + PK_RandomSeed = 105, + PK_ReasonUnknown = 106, + PK_RegularOutputChannel = 107, + PK_ReproducibleResourceLimit = 108, + PK_RightAssoc = 109, + PK_SmtLibVersion = 110, + PK_Sorts = 111, + PK_SortsDescription = 112, + PK_Source = 113, + PK_Status = 114, + PK_Theories = 115, + PK_Values = 116, + PK_Verbosity = 117, + PK_Version = 118, + RS_Model = 119, + UndefinedSymbol = 120, + WS = 121; + public static final int RULE_start = 0, + RULE_generalReservedWord = 1, + RULE_simpleSymbol = 2, + RULE_quotedSymbol = 3, + RULE_predefSymbol = 4, + RULE_predefKeyword = 5, + RULE_numeral = 6, + RULE_decimal = 7, + RULE_hexadecimal = 8, + RULE_binary = 9, + RULE_string = 10, + RULE_to_fp_expr = 11, + RULE_special_regex_operations = 12, + RULE_keyword = 13, + RULE_symbol = 14, + RULE_spec_constant = 15, + RULE_s_expr = 16, + RULE_index = 17, + RULE_identifier = 18, + RULE_attribute_value = 19, + RULE_attribute = 20, + RULE_sort = 21, + RULE_qual_identifer = 22, + RULE_var_binding = 23, + RULE_sorted_var = 24, + RULE_pattern = 25, + RULE_match_case = 26, + RULE_term = 27, + RULE_sort_symbol_decl = 28, + RULE_meta_spec_constant = 29, + RULE_fun_symbol_decl = 30, + RULE_par_fun_symbol_decl = 31, + RULE_theory_attribute = 32, + RULE_theory_decl = 33, + RULE_logic_attribue = 34, + RULE_logic = 35, + RULE_sort_dec = 36, + RULE_selector_dec = 37, + RULE_constructor_dec = 38, + RULE_datatype_dec = 39, + RULE_function_dec = 40, + RULE_function_def = 41, + RULE_prop_literal = 42, + RULE_script = 43, + RULE_cmd_assert = 44, + RULE_cmd_checkSat = 45, + RULE_cmd_checkSatAssuming = 46, + RULE_cmd_declareConst = 47, + RULE_cmd_declareDatatype = 48, + RULE_cmd_declareDatatypes = 49, + RULE_cmd_declareFun = 50, + RULE_cmd_declareSort = 51, + RULE_cmd_defineFun = 52, + RULE_cmd_defineFunRec = 53, + RULE_cmd_defineFunsRec = 54, + RULE_cmd_defineSort = 55, + RULE_cmd_echo = 56, + RULE_cmd_exit = 57, + RULE_cmd_getAssertions = 58, + RULE_cmd_getAssignment = 59, + RULE_cmd_getInfo = 60, + RULE_cmd_getModel = 61, + RULE_cmd_getOption = 62, + RULE_cmd_getProof = 63, + RULE_cmd_getUnsatAssumptions = 64, + RULE_cmd_getUnsatCore = 65, + RULE_cmd_getValue = 66, + RULE_cmd_pop = 67, + RULE_cmd_push = 68, + RULE_cmd_reset = 69, + RULE_cmd_resetAssertions = 70, + RULE_cmd_setInfo = 71, + RULE_cmd_setLogic = 72, + RULE_cmd_setOption = 73, + RULE_command = 74, + RULE_b_value = 75, + RULE_option = 76, + RULE_info_flag = 77, + RULE_error_behaviour = 78, + RULE_reason_unknown = 79, + RULE_model_response = 80, + RULE_info_response = 81, + RULE_valuation_pair = 82, + RULE_t_valuation_pair = 83, + RULE_check_sat_response = 84, + RULE_echo_response = 85, + RULE_get_assertions_response = 86, + RULE_get_assignment_response = 87, + RULE_get_info_response = 88, + RULE_get_model_response = 89, + RULE_get_option_response = 90, + RULE_get_proof_response = 91, + RULE_get_unsat_assump_response = 92, + RULE_get_unsat_core_response = 93, + RULE_get_value_response = 94, + RULE_specific_success_response = 95, + RULE_general_response = 96; + + private static String[] makeRuleNames() { + return new String[] { + "start", + "generalReservedWord", + "simpleSymbol", + "quotedSymbol", + "predefSymbol", + "predefKeyword", + "numeral", + "decimal", + "hexadecimal", + "binary", + "string", + "to_fp_expr", + "special_regex_operations", + "keyword", + "symbol", + "spec_constant", + "s_expr", + "index", + "identifier", + "attribute_value", + "attribute", + "sort", + "qual_identifer", + "var_binding", + "sorted_var", + "pattern", + "match_case", + "term", + "sort_symbol_decl", + "meta_spec_constant", + "fun_symbol_decl", + "par_fun_symbol_decl", + "theory_attribute", + "theory_decl", + "logic_attribue", + "logic", + "sort_dec", + "selector_dec", + "constructor_dec", + "datatype_dec", + "function_dec", + "function_def", + "prop_literal", + "script", + "cmd_assert", + "cmd_checkSat", + "cmd_checkSatAssuming", + "cmd_declareConst", + "cmd_declareDatatype", + "cmd_declareDatatypes", + "cmd_declareFun", + "cmd_declareSort", + "cmd_defineFun", + "cmd_defineFunRec", + "cmd_defineFunsRec", + "cmd_defineSort", + "cmd_echo", + "cmd_exit", + "cmd_getAssertions", + "cmd_getAssignment", + "cmd_getInfo", + "cmd_getModel", + "cmd_getOption", + "cmd_getProof", + "cmd_getUnsatAssumptions", + "cmd_getUnsatCore", + "cmd_getValue", + "cmd_pop", + "cmd_push", + "cmd_reset", + "cmd_resetAssertions", + "cmd_setInfo", + "cmd_setLogic", + "cmd_setOption", + "command", + "b_value", + "option", + "info_flag", + "error_behaviour", + "reason_unknown", + "model_response", + "info_response", + "valuation_pair", + "t_valuation_pair", + "check_sat_response", + "echo_response", + "get_assertions_response", + "get_assignment_response", + "get_info_response", + "get_model_response", + "get_option_response", + "get_proof_response", + "get_unsat_assump_response", + "get_unsat_core_response", + "get_value_response", + "specific_success_response", + "general_response" + }; + } + + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, + null, + "'('", + "')'", + "';'", + null, + null, + null, + null, + null, + null, + null, + null, + "'not'", + "'Bool'", + "'continued-execution'", + "'error'", + "'false'", + "'immediate-exit'", + "'incomplete'", + "'logic'", + "'memout'", + "'sat'", + "'success'", + "'theory'", + "'true'", + "'unknown'", + "'unsupported'", + "'unsat'", + "'assert'", + "'check-sat'", + "'check-sat-assuming'", + "'declare-const'", + "'declare-datatype'", + "'declare-datatypes'", + "'declare-fun'", + "'declare-sort'", + "'define-fun'", + "'define-fun-rec'", + "'define-funs-rec'", + "'define-sort'", + "'echo'", + "'exit'", + "'get-assertions'", + "'get-assignment'", + "'get-info'", + "'get-model'", + "'get-option'", + "'get-proof'", + "'get-unsat-assumptions'", + "'get-unsat-core'", + "'get-value'", + "'pop'", + "'push'", + "'reset'", + "'reset-assertions'", + "'set-info'", + "'set-logic'", + "'set-option'", + "'!'", + "'_'", + "'as'", + "'BINARY'", + "'DECIMAL'", + "'exists'", + "'HEXADECIMAL'", + "'forall'", + "'let'", + "'match'", + "'NUMERAL'", + "'par'", + "'string'", + "'_ FloatingPoint'", + null, + null, + null, + null, + "':'", + "':all-statistics'", + "':assertion-stack-levels'", + "':authors'", + "':category'", + "':chainable'", + "':definition'", + "':diagnostic-output-channel'", + "':error-behavior'", + "':extensions'", + "':funs'", + "':funs-description'", + "':global-declarations'", + "':interactive-mode'", + "':language'", + "':left-assoc'", + "':license'", + "':named'", + "':name'", + "':notes'", + "':pattern'", + "':print-success'", + "':produce-assertions'", + "':produce-assignments'", + "':produce-models'", + "':produce-proofs'", + "':produce-unsat-assumptions'", + "':produce-unsat-cores'", + "':random-seed'", + "':reason-unknown'", + "':regular-output-channel'", + "':reproducible-resource-limit'", + "':right-assoc'", + "':smt-lib-version'", + "':sorts'", + "':sorts-description'", + "':source'", + "':status'", + "':theories'", + "':values'", + "':verbosity'", + "':version'", + "'model'" + }; + } + + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + + private static String[] makeSymbolicNames() { + return new String[] { + null, + "Comment", + "ParOpen", + "ParClose", + "Semicolon", + "String", + "QuotedSymbol", + "FLOATING_POINT_SORT", + "FLOATING_POINT_NUMBER", + "REGEXVALUES", + "TO_FP_EXPR", + "RE_TIMES_EXPR", + "RE_LOOP_EXPR", + "PS_Not", + "PS_Bool", + "PS_ContinuedExecution", + "PS_Error", + "PS_False", + "PS_ImmediateExit", + "PS_Incomplete", + "PS_Logic", + "PS_Memout", + "PS_Sat", + "PS_Success", + "PS_Theory", + "PS_True", + "PS_Unknown", + "PS_Unsupported", + "PS_Unsat", + "CMD_Assert", + "CMD_CheckSat", + "CMD_CheckSatAssuming", + "CMD_DeclareConst", + "CMD_DeclareDatatype", + "CMD_DeclareDatatypes", + "CMD_DeclareFun", + "CMD_DeclareSort", + "CMD_DefineFun", + "CMD_DefineFunRec", + "CMD_DefineFunsRec", + "CMD_DefineSort", + "CMD_Echo", + "CMD_Exit", + "CMD_GetAssertions", + "CMD_GetAssignment", + "CMD_GetInfo", + "CMD_GetModel", + "CMD_GetOption", + "CMD_GetProof", + "CMD_GetUnsatAssumptions", + "CMD_GetUnsatCore", + "CMD_GetValue", + "CMD_Pop", + "CMD_Push", + "CMD_Reset", + "CMD_ResetAssertions", + "CMD_SetInfo", + "CMD_SetLogic", + "CMD_SetOption", + "GRW_Exclamation", + "GRW_Underscore", + "GRW_As", + "GRW_Binary", + "GRW_Decimal", + "GRW_Exists", + "GRW_Hexadecimal", + "GRW_Forall", + "GRW_Let", + "GRW_Match", + "GRW_Numeral", + "GRW_Par", + "GRW_String", + "GRW_FloatingPoint", + "Numeral", + "Binary", + "HexDecimal", + "Decimal", + "Colon", + "PK_AllStatistics", + "PK_AssertionStackLevels", + "PK_Authors", + "PK_Category", + "PK_Chainable", + "PK_Definition", + "PK_DiagnosticOutputChannel", + "PK_ErrorBehaviour", + "PK_Extension", + "PK_Funs", + "PK_FunsDescription", + "PK_GlobalDeclarations", + "PK_InteractiveMode", + "PK_Language", + "PK_LeftAssoc", + "PK_License", + "PK_Named", + "PK_Name", + "PK_Notes", + "PK_Pattern", + "PK_PrintSuccess", + "PK_ProduceAssertions", + "PK_ProduceAssignments", + "PK_ProduceModels", + "PK_ProduceProofs", + "PK_ProduceUnsatAssumptions", + "PK_ProduceUnsatCores", + "PK_RandomSeed", + "PK_ReasonUnknown", + "PK_RegularOutputChannel", + "PK_ReproducibleResourceLimit", + "PK_RightAssoc", + "PK_SmtLibVersion", + "PK_Sorts", + "PK_SortsDescription", + "PK_Source", + "PK_Status", + "PK_Theories", + "PK_Values", + "PK_Verbosity", + "PK_Version", + "RS_Model", + "UndefinedSymbol", + "WS" + }; + } + + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated public static final String[] tokenNames; + + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getGrammarFileName() { + return "Smtlibv2.g4"; + } + + @Override + public String[] getRuleNames() { + return ruleNames; + } + + @Override + public String getSerializedATN() { + return _serializedATN; + } + + @Override + public ATN getATN() { + return _ATN; + } + + public Smtlibv2Parser(TokenStream input) { + super(input); + _interp = new ParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); + } + + @SuppressWarnings("CheckReturnValue") + public static class StartContext extends ParserRuleContext { + public StartContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_start; + } + + public StartContext() {} + + public void copyFrom(StartContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Start_scriptContext extends StartContext { + public ScriptContext script() { + return getRuleContext(ScriptContext.class, 0); + } + + public TerminalNode EOF() { + return getToken(Smtlibv2Parser.EOF, 0); + } + + public Start_scriptContext(StartContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterStart_script(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitStart_script(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitStart_script(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Start_gen_respContext extends StartContext { + public General_responseContext general_response() { + return getRuleContext(General_responseContext.class, 0); + } + + public TerminalNode EOF() { + return getToken(Smtlibv2Parser.EOF, 0); + } + + public Start_gen_respContext(StartContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterStart_gen_resp(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitStart_gen_resp(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitStart_gen_resp(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Start_logicContext extends StartContext { + public LogicContext logic() { + return getRuleContext(LogicContext.class, 0); + } + + public TerminalNode EOF() { + return getToken(Smtlibv2Parser.EOF, 0); + } + + public Start_logicContext(StartContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterStart_logic(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitStart_logic(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitStart_logic(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Start_theoryContext extends StartContext { + public Theory_declContext theory_decl() { + return getRuleContext(Theory_declContext.class, 0); + } + + public TerminalNode EOF() { + return getToken(Smtlibv2Parser.EOF, 0); + } + + public Start_theoryContext(StartContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterStart_theory(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitStart_theory(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitStart_theory(this); + else return visitor.visitChildren(this); + } + } + + public final StartContext start() throws RecognitionException { + StartContext _localctx = new StartContext(_ctx, getState()); + enterRule(_localctx, 0, RULE_start); + try { + setState(206); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 0, _ctx)) { + case 1: + _localctx = new Start_logicContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(194); + logic(); + setState(195); + match(EOF); + } + break; + case 2: + _localctx = new Start_theoryContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(197); + theory_decl(); + setState(198); + match(EOF); + } + break; + case 3: + _localctx = new Start_scriptContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(200); + script(); + setState(201); + match(EOF); + } + break; + case 4: + _localctx = new Start_gen_respContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(203); + general_response(); + setState(204); + match(EOF); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class GeneralReservedWordContext extends ParserRuleContext { + public TerminalNode GRW_Exclamation() { + return getToken(Smtlibv2Parser.GRW_Exclamation, 0); + } + + public TerminalNode GRW_Underscore() { + return getToken(Smtlibv2Parser.GRW_Underscore, 0); + } + + public TerminalNode GRW_As() { + return getToken(Smtlibv2Parser.GRW_As, 0); + } + + public TerminalNode GRW_Binary() { + return getToken(Smtlibv2Parser.GRW_Binary, 0); + } + + public TerminalNode GRW_Decimal() { + return getToken(Smtlibv2Parser.GRW_Decimal, 0); + } + + public TerminalNode GRW_Exists() { + return getToken(Smtlibv2Parser.GRW_Exists, 0); + } + + public TerminalNode GRW_Hexadecimal() { + return getToken(Smtlibv2Parser.GRW_Hexadecimal, 0); + } + + public TerminalNode GRW_Forall() { + return getToken(Smtlibv2Parser.GRW_Forall, 0); + } + + public TerminalNode GRW_Let() { + return getToken(Smtlibv2Parser.GRW_Let, 0); + } + + public TerminalNode GRW_Match() { + return getToken(Smtlibv2Parser.GRW_Match, 0); + } + + public TerminalNode GRW_Numeral() { + return getToken(Smtlibv2Parser.GRW_Numeral, 0); + } + + public TerminalNode GRW_Par() { + return getToken(Smtlibv2Parser.GRW_Par, 0); + } + + public TerminalNode GRW_String() { + return getToken(Smtlibv2Parser.GRW_String, 0); + } + + public TerminalNode RS_Model() { + return getToken(Smtlibv2Parser.RS_Model, 0); + } + + public GeneralReservedWordContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_generalReservedWord; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGeneralReservedWord(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGeneralReservedWord(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGeneralReservedWord(this); + else return visitor.visitChildren(this); + } + } + + public final GeneralReservedWordContext generalReservedWord() throws RecognitionException { + GeneralReservedWordContext _localctx = new GeneralReservedWordContext(_ctx, getState()); + enterRule(_localctx, 2, RULE_generalReservedWord); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(208); + _la = _input.LA(1); + if (!(((((_la - 59)) & ~0x3f) == 0 && ((1L << (_la - 59)) & 1152921504606855167L) != 0))) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SimpleSymbolContext extends ParserRuleContext { + public SimpleSymbolContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_simpleSymbol; + } + + public SimpleSymbolContext() {} + + public void copyFrom(SimpleSymbolContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Simp_pre_symbContext extends SimpleSymbolContext { + public PredefSymbolContext predefSymbol() { + return getRuleContext(PredefSymbolContext.class, 0); + } + + public Simp_pre_symbContext(SimpleSymbolContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSimp_pre_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSimp_pre_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSimp_pre_symb(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Simp_undef_symbContext extends SimpleSymbolContext { + public TerminalNode UndefinedSymbol() { + return getToken(Smtlibv2Parser.UndefinedSymbol, 0); + } + + public Simp_undef_symbContext(SimpleSymbolContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSimp_undef_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSimp_undef_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSimp_undef_symb(this); + else return visitor.visitChildren(this); + } + } + + public final SimpleSymbolContext simpleSymbol() throws RecognitionException { + SimpleSymbolContext _localctx = new SimpleSymbolContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_simpleSymbol); + try { + setState(212); + _errHandler.sync(this); + switch (_input.LA(1)) { + case PS_Not: + case PS_Bool: + case PS_ContinuedExecution: + case PS_Error: + case PS_False: + case PS_ImmediateExit: + case PS_Incomplete: + case PS_Logic: + case PS_Memout: + case PS_Sat: + case PS_Success: + case PS_Theory: + case PS_True: + case PS_Unknown: + case PS_Unsupported: + case PS_Unsat: + _localctx = new Simp_pre_symbContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(210); + predefSymbol(); + } + break; + case UndefinedSymbol: + _localctx = new Simp_undef_symbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(211); + match(UndefinedSymbol); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class QuotedSymbolContext extends ParserRuleContext { + public TerminalNode QuotedSymbol() { + return getToken(Smtlibv2Parser.QuotedSymbol, 0); + } + + public QuotedSymbolContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_quotedSymbol; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterQuotedSymbol(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitQuotedSymbol(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitQuotedSymbol(this); + else return visitor.visitChildren(this); + } + } + + public final QuotedSymbolContext quotedSymbol() throws RecognitionException { + QuotedSymbolContext _localctx = new QuotedSymbolContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_quotedSymbol); + try { + enterOuterAlt(_localctx, 1); + { + setState(214); + match(QuotedSymbol); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PredefSymbolContext extends ParserRuleContext { + public TerminalNode PS_Not() { + return getToken(Smtlibv2Parser.PS_Not, 0); + } + + public TerminalNode PS_Bool() { + return getToken(Smtlibv2Parser.PS_Bool, 0); + } + + public TerminalNode PS_ContinuedExecution() { + return getToken(Smtlibv2Parser.PS_ContinuedExecution, 0); + } + + public TerminalNode PS_Error() { + return getToken(Smtlibv2Parser.PS_Error, 0); + } + + public TerminalNode PS_False() { + return getToken(Smtlibv2Parser.PS_False, 0); + } + + public TerminalNode PS_ImmediateExit() { + return getToken(Smtlibv2Parser.PS_ImmediateExit, 0); + } + + public TerminalNode PS_Incomplete() { + return getToken(Smtlibv2Parser.PS_Incomplete, 0); + } + + public TerminalNode PS_Logic() { + return getToken(Smtlibv2Parser.PS_Logic, 0); + } + + public TerminalNode PS_Memout() { + return getToken(Smtlibv2Parser.PS_Memout, 0); + } + + public TerminalNode PS_Sat() { + return getToken(Smtlibv2Parser.PS_Sat, 0); + } + + public TerminalNode PS_Success() { + return getToken(Smtlibv2Parser.PS_Success, 0); + } + + public TerminalNode PS_Theory() { + return getToken(Smtlibv2Parser.PS_Theory, 0); + } + + public TerminalNode PS_True() { + return getToken(Smtlibv2Parser.PS_True, 0); + } + + public TerminalNode PS_Unknown() { + return getToken(Smtlibv2Parser.PS_Unknown, 0); + } + + public TerminalNode PS_Unsupported() { + return getToken(Smtlibv2Parser.PS_Unsupported, 0); + } + + public TerminalNode PS_Unsat() { + return getToken(Smtlibv2Parser.PS_Unsat, 0); + } + + public PredefSymbolContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_predefSymbol; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterPredefSymbol(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitPredefSymbol(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPredefSymbol(this); + else return visitor.visitChildren(this); + } + } + + public final PredefSymbolContext predefSymbol() throws RecognitionException { + PredefSymbolContext _localctx = new PredefSymbolContext(_ctx, getState()); + enterRule(_localctx, 8, RULE_predefSymbol); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(216); + _la = _input.LA(1); + if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862720L) != 0))) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PredefKeywordContext extends ParserRuleContext { + public TerminalNode PK_AllStatistics() { + return getToken(Smtlibv2Parser.PK_AllStatistics, 0); + } + + public TerminalNode PK_AssertionStackLevels() { + return getToken(Smtlibv2Parser.PK_AssertionStackLevels, 0); + } + + public TerminalNode PK_Authors() { + return getToken(Smtlibv2Parser.PK_Authors, 0); + } + + public TerminalNode PK_Category() { + return getToken(Smtlibv2Parser.PK_Category, 0); + } + + public TerminalNode PK_Chainable() { + return getToken(Smtlibv2Parser.PK_Chainable, 0); + } + + public TerminalNode PK_Definition() { + return getToken(Smtlibv2Parser.PK_Definition, 0); + } + + public TerminalNode PK_DiagnosticOutputChannel() { + return getToken(Smtlibv2Parser.PK_DiagnosticOutputChannel, 0); + } + + public TerminalNode PK_ErrorBehaviour() { + return getToken(Smtlibv2Parser.PK_ErrorBehaviour, 0); + } + + public TerminalNode PK_Extension() { + return getToken(Smtlibv2Parser.PK_Extension, 0); + } + + public TerminalNode PK_Funs() { + return getToken(Smtlibv2Parser.PK_Funs, 0); + } + + public TerminalNode PK_FunsDescription() { + return getToken(Smtlibv2Parser.PK_FunsDescription, 0); + } + + public TerminalNode PK_GlobalDeclarations() { + return getToken(Smtlibv2Parser.PK_GlobalDeclarations, 0); + } + + public TerminalNode PK_InteractiveMode() { + return getToken(Smtlibv2Parser.PK_InteractiveMode, 0); + } + + public TerminalNode PK_Language() { + return getToken(Smtlibv2Parser.PK_Language, 0); + } + + public TerminalNode PK_LeftAssoc() { + return getToken(Smtlibv2Parser.PK_LeftAssoc, 0); + } + + public TerminalNode PK_License() { + return getToken(Smtlibv2Parser.PK_License, 0); + } + + public TerminalNode PK_Named() { + return getToken(Smtlibv2Parser.PK_Named, 0); + } + + public TerminalNode PK_Name() { + return getToken(Smtlibv2Parser.PK_Name, 0); + } + + public TerminalNode PK_Notes() { + return getToken(Smtlibv2Parser.PK_Notes, 0); + } + + public TerminalNode PK_Pattern() { + return getToken(Smtlibv2Parser.PK_Pattern, 0); + } + + public TerminalNode PK_PrintSuccess() { + return getToken(Smtlibv2Parser.PK_PrintSuccess, 0); + } + + public TerminalNode PK_ProduceAssertions() { + return getToken(Smtlibv2Parser.PK_ProduceAssertions, 0); + } + + public TerminalNode PK_ProduceAssignments() { + return getToken(Smtlibv2Parser.PK_ProduceAssignments, 0); + } + + public TerminalNode PK_ProduceModels() { + return getToken(Smtlibv2Parser.PK_ProduceModels, 0); + } + + public TerminalNode PK_ProduceProofs() { + return getToken(Smtlibv2Parser.PK_ProduceProofs, 0); + } + + public TerminalNode PK_ProduceUnsatAssumptions() { + return getToken(Smtlibv2Parser.PK_ProduceUnsatAssumptions, 0); + } + + public TerminalNode PK_ProduceUnsatCores() { + return getToken(Smtlibv2Parser.PK_ProduceUnsatCores, 0); + } + + public TerminalNode PK_RandomSeed() { + return getToken(Smtlibv2Parser.PK_RandomSeed, 0); + } + + public TerminalNode PK_ReasonUnknown() { + return getToken(Smtlibv2Parser.PK_ReasonUnknown, 0); + } + + public TerminalNode PK_RegularOutputChannel() { + return getToken(Smtlibv2Parser.PK_RegularOutputChannel, 0); + } + + public TerminalNode PK_ReproducibleResourceLimit() { + return getToken(Smtlibv2Parser.PK_ReproducibleResourceLimit, 0); + } + + public TerminalNode PK_RightAssoc() { + return getToken(Smtlibv2Parser.PK_RightAssoc, 0); + } + + public TerminalNode PK_SmtLibVersion() { + return getToken(Smtlibv2Parser.PK_SmtLibVersion, 0); + } + + public TerminalNode PK_Sorts() { + return getToken(Smtlibv2Parser.PK_Sorts, 0); + } + + public TerminalNode PK_SortsDescription() { + return getToken(Smtlibv2Parser.PK_SortsDescription, 0); + } + + public TerminalNode PK_Source() { + return getToken(Smtlibv2Parser.PK_Source, 0); + } + + public TerminalNode PK_Status() { + return getToken(Smtlibv2Parser.PK_Status, 0); + } + + public TerminalNode PK_Theories() { + return getToken(Smtlibv2Parser.PK_Theories, 0); + } + + public TerminalNode PK_Values() { + return getToken(Smtlibv2Parser.PK_Values, 0); + } + + public TerminalNode PK_Verbosity() { + return getToken(Smtlibv2Parser.PK_Verbosity, 0); + } + + public TerminalNode PK_Version() { + return getToken(Smtlibv2Parser.PK_Version, 0); + } + + public PredefKeywordContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_predefKeyword; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterPredefKeyword(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitPredefKeyword(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPredefKeyword(this); + else return visitor.visitChildren(this); + } + } + + public final PredefKeywordContext predefKeyword() throws RecognitionException { + PredefKeywordContext _localctx = new PredefKeywordContext(_ctx, getState()); + enterRule(_localctx, 10, RULE_predefKeyword); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(218); + _la = _input.LA(1); + if (!(((((_la - 78)) & ~0x3f) == 0 && ((1L << (_la - 78)) & 2199023255551L) != 0))) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class NumeralContext extends ParserRuleContext { + public TerminalNode Numeral() { + return getToken(Smtlibv2Parser.Numeral, 0); + } + + public NumeralContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_numeral; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterNumeral(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitNumeral(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitNumeral(this); + else return visitor.visitChildren(this); + } + } + + public final NumeralContext numeral() throws RecognitionException { + NumeralContext _localctx = new NumeralContext(_ctx, getState()); + enterRule(_localctx, 12, RULE_numeral); + try { + enterOuterAlt(_localctx, 1); + { + setState(220); + match(Numeral); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class DecimalContext extends ParserRuleContext { + public TerminalNode Decimal() { + return getToken(Smtlibv2Parser.Decimal, 0); + } + + public DecimalContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_decimal; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDecimal(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDecimal(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDecimal(this); + else return visitor.visitChildren(this); + } + } + + public final DecimalContext decimal() throws RecognitionException { + DecimalContext _localctx = new DecimalContext(_ctx, getState()); + enterRule(_localctx, 14, RULE_decimal); + try { + enterOuterAlt(_localctx, 1); + { + setState(222); + match(Decimal); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class HexadecimalContext extends ParserRuleContext { + public TerminalNode HexDecimal() { + return getToken(Smtlibv2Parser.HexDecimal, 0); + } + + public HexadecimalContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_hexadecimal; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterHexadecimal(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitHexadecimal(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitHexadecimal(this); + else return visitor.visitChildren(this); + } + } + + public final HexadecimalContext hexadecimal() throws RecognitionException { + HexadecimalContext _localctx = new HexadecimalContext(_ctx, getState()); + enterRule(_localctx, 16, RULE_hexadecimal); + try { + enterOuterAlt(_localctx, 1); + { + setState(224); + match(HexDecimal); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class BinaryContext extends ParserRuleContext { + public TerminalNode Binary() { + return getToken(Smtlibv2Parser.Binary, 0); + } + + public BinaryContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_binary; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterBinary(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitBinary(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitBinary(this); + else return visitor.visitChildren(this); + } + } + + public final BinaryContext binary() throws RecognitionException { + BinaryContext _localctx = new BinaryContext(_ctx, getState()); + enterRule(_localctx, 18, RULE_binary); + try { + enterOuterAlt(_localctx, 1); + { + setState(226); + match(Binary); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class StringContext extends ParserRuleContext { + public TerminalNode String() { + return getToken(Smtlibv2Parser.String, 0); + } + + public StringContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_string; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterString(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitString(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitString(this); + else return visitor.visitChildren(this); + } + } + + public final StringContext string() throws RecognitionException { + StringContext _localctx = new StringContext(_ctx, getState()); + enterRule(_localctx, 20, RULE_string); + try { + enterOuterAlt(_localctx, 1); + { + setState(228); + match(String); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class To_fp_exprContext extends ParserRuleContext { + public TerminalNode TO_FP_EXPR() { + return getToken(Smtlibv2Parser.TO_FP_EXPR, 0); + } + + public List term() { + return getRuleContexts(TermContext.class); + } + + public TermContext term(int i) { + return getRuleContext(TermContext.class, i); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public To_fp_exprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_to_fp_expr; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterTo_fp_expr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTo_fp_expr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTo_fp_expr(this); + else return visitor.visitChildren(this); + } + } + + public final To_fp_exprContext to_fp_expr() throws RecognitionException { + To_fp_exprContext _localctx = new To_fp_exprContext(_ctx, getState()); + enterRule(_localctx, 22, RULE_to_fp_expr); + try { + setState(239); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 2, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(230); + match(TO_FP_EXPR); + setState(231); + term(); + setState(232); + match(ParClose); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(234); + match(TO_FP_EXPR); + setState(235); + term(); + setState(236); + term(); + setState(237); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Special_regex_operationsContext extends ParserRuleContext { + public TerminalNode RE_LOOP_EXPR() { + return getToken(Smtlibv2Parser.RE_LOOP_EXPR, 0); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public TerminalNode RE_TIMES_EXPR() { + return getToken(Smtlibv2Parser.RE_TIMES_EXPR, 0); + } + + public Special_regex_operationsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_special_regex_operations; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSpecial_regex_operations(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSpecial_regex_operations(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSpecial_regex_operations(this); + else return visitor.visitChildren(this); + } + } + + public final Special_regex_operationsContext special_regex_operations() + throws RecognitionException { + Special_regex_operationsContext _localctx = + new Special_regex_operationsContext(_ctx, getState()); + enterRule(_localctx, 24, RULE_special_regex_operations); + try { + setState(247); + _errHandler.sync(this); + switch (_input.LA(1)) { + case RE_LOOP_EXPR: + enterOuterAlt(_localctx, 1); + { + setState(241); + match(RE_LOOP_EXPR); + setState(242); + term(); + setState(243); + match(ParClose); + } + break; + case RE_TIMES_EXPR: + enterOuterAlt(_localctx, 2); + { + setState(245); + match(RE_TIMES_EXPR); + setState(246); + term(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class KeywordContext extends ParserRuleContext { + public KeywordContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_keyword; + } + + public KeywordContext() {} + + public void copyFrom(KeywordContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Key_simsymbContext extends KeywordContext { + public TerminalNode Colon() { + return getToken(Smtlibv2Parser.Colon, 0); + } + + public SimpleSymbolContext simpleSymbol() { + return getRuleContext(SimpleSymbolContext.class, 0); + } + + public Key_simsymbContext(KeywordContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterKey_simsymb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitKey_simsymb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitKey_simsymb(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Pre_keyContext extends KeywordContext { + public PredefKeywordContext predefKeyword() { + return getRuleContext(PredefKeywordContext.class, 0); + } + + public Pre_keyContext(KeywordContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterPre_key(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitPre_key(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPre_key(this); + else return visitor.visitChildren(this); + } + } + + public final KeywordContext keyword() throws RecognitionException { + KeywordContext _localctx = new KeywordContext(_ctx, getState()); + enterRule(_localctx, 26, RULE_keyword); + try { + setState(252); + _errHandler.sync(this); + switch (_input.LA(1)) { + case PK_AllStatistics: + case PK_AssertionStackLevels: + case PK_Authors: + case PK_Category: + case PK_Chainable: + case PK_Definition: + case PK_DiagnosticOutputChannel: + case PK_ErrorBehaviour: + case PK_Extension: + case PK_Funs: + case PK_FunsDescription: + case PK_GlobalDeclarations: + case PK_InteractiveMode: + case PK_Language: + case PK_LeftAssoc: + case PK_License: + case PK_Named: + case PK_Name: + case PK_Notes: + case PK_Pattern: + case PK_PrintSuccess: + case PK_ProduceAssertions: + case PK_ProduceAssignments: + case PK_ProduceModels: + case PK_ProduceProofs: + case PK_ProduceUnsatAssumptions: + case PK_ProduceUnsatCores: + case PK_RandomSeed: + case PK_ReasonUnknown: + case PK_RegularOutputChannel: + case PK_ReproducibleResourceLimit: + case PK_RightAssoc: + case PK_SmtLibVersion: + case PK_Sorts: + case PK_SortsDescription: + case PK_Source: + case PK_Status: + case PK_Theories: + case PK_Values: + case PK_Verbosity: + case PK_Version: + _localctx = new Pre_keyContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(249); + predefKeyword(); + } + break; + case Colon: + _localctx = new Key_simsymbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(250); + match(Colon); + setState(251); + simpleSymbol(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SymbolContext extends ParserRuleContext { + public SymbolContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_symbol; + } + + public SymbolContext() {} + + public void copyFrom(SymbolContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class SimpsymbContext extends SymbolContext { + public SimpleSymbolContext simpleSymbol() { + return getRuleContext(SimpleSymbolContext.class, 0); + } + + public SimpsymbContext(SymbolContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterSimpsymb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitSimpsymb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSimpsymb(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class QuotsymbContext extends SymbolContext { + public QuotedSymbolContext quotedSymbol() { + return getRuleContext(QuotedSymbolContext.class, 0); + } + + public QuotsymbContext(SymbolContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterQuotsymb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitQuotsymb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitQuotsymb(this); + else return visitor.visitChildren(this); + } + } + + public final SymbolContext symbol() throws RecognitionException { + SymbolContext _localctx = new SymbolContext(_ctx, getState()); + enterRule(_localctx, 28, RULE_symbol); + try { + setState(256); + _errHandler.sync(this); + switch (_input.LA(1)) { + case PS_Not: + case PS_Bool: + case PS_ContinuedExecution: + case PS_Error: + case PS_False: + case PS_ImmediateExit: + case PS_Incomplete: + case PS_Logic: + case PS_Memout: + case PS_Sat: + case PS_Success: + case PS_Theory: + case PS_True: + case PS_Unknown: + case PS_Unsupported: + case PS_Unsat: + case UndefinedSymbol: + _localctx = new SimpsymbContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(254); + simpleSymbol(); + } + break; + case QuotedSymbol: + _localctx = new QuotsymbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(255); + quotedSymbol(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Spec_constantContext extends ParserRuleContext { + public Spec_constantContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_spec_constant; + } + + public Spec_constantContext() {} + + public void copyFrom(Spec_constantContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Spec_constant_hexContext extends Spec_constantContext { + public HexadecimalContext hexadecimal() { + return getRuleContext(HexadecimalContext.class, 0); + } + + public Spec_constant_hexContext(Spec_constantContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSpec_constant_hex(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSpec_constant_hex(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSpec_constant_hex(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Spec_constant_fpContext extends Spec_constantContext { + public TerminalNode FLOATING_POINT_NUMBER() { + return getToken(Smtlibv2Parser.FLOATING_POINT_NUMBER, 0); + } + + public Spec_constant_fpContext(Spec_constantContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSpec_constant_fp(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSpec_constant_fp(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSpec_constant_fp(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Spec_constant_binContext extends Spec_constantContext { + public BinaryContext binary() { + return getRuleContext(BinaryContext.class, 0); + } + + public Spec_constant_binContext(Spec_constantContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSpec_constant_bin(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSpec_constant_bin(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSpec_constant_bin(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Spec_constant_numContext extends Spec_constantContext { + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public Spec_constant_numContext(Spec_constantContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSpec_constant_num(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSpec_constant_num(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSpec_constant_num(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Spec_constant_regexContext extends Spec_constantContext { + public TerminalNode REGEXVALUES() { + return getToken(Smtlibv2Parser.REGEXVALUES, 0); + } + + public Spec_constant_regexContext(Spec_constantContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSpec_constant_regex(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSpec_constant_regex(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSpec_constant_regex(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Spec_constant_decContext extends Spec_constantContext { + public DecimalContext decimal() { + return getRuleContext(DecimalContext.class, 0); + } + + public Spec_constant_decContext(Spec_constantContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSpec_constant_dec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSpec_constant_dec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSpec_constant_dec(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Spec_constant_stringContext extends Spec_constantContext { + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Spec_constant_stringContext(Spec_constantContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSpec_constant_string(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSpec_constant_string(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSpec_constant_string(this); + else return visitor.visitChildren(this); + } + } + + public final Spec_constantContext spec_constant() throws RecognitionException { + Spec_constantContext _localctx = new Spec_constantContext(_ctx, getState()); + enterRule(_localctx, 30, RULE_spec_constant); + try { + setState(265); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Numeral: + _localctx = new Spec_constant_numContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(258); + numeral(); + } + break; + case Decimal: + _localctx = new Spec_constant_decContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(259); + decimal(); + } + break; + case HexDecimal: + _localctx = new Spec_constant_hexContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(260); + hexadecimal(); + } + break; + case Binary: + _localctx = new Spec_constant_binContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(261); + binary(); + } + break; + case String: + _localctx = new Spec_constant_stringContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(262); + string(); + } + break; + case FLOATING_POINT_NUMBER: + _localctx = new Spec_constant_fpContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(263); + match(FLOATING_POINT_NUMBER); + } + break; + case REGEXVALUES: + _localctx = new Spec_constant_regexContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(264); + match(REGEXVALUES); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class S_exprContext extends ParserRuleContext { + public S_exprContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_s_expr; + } + + public S_exprContext() {} + + public void copyFrom(S_exprContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class S_expr_specContext extends S_exprContext { + public Spec_constantContext spec_constant() { + return getRuleContext(Spec_constantContext.class, 0); + } + + public S_expr_specContext(S_exprContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterS_expr_spec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitS_expr_spec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitS_expr_spec(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class S_expr_symbContext extends S_exprContext { + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public S_expr_symbContext(S_exprContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterS_expr_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitS_expr_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitS_expr_symb(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class S_expr_keyContext extends S_exprContext { + public KeywordContext keyword() { + return getRuleContext(KeywordContext.class, 0); + } + + public S_expr_keyContext(S_exprContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterS_expr_key(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitS_expr_key(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitS_expr_key(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Multi_s_exprContext extends S_exprContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List s_expr() { + return getRuleContexts(S_exprContext.class); + } + + public S_exprContext s_expr(int i) { + return getRuleContext(S_exprContext.class, i); + } + + public Multi_s_exprContext(S_exprContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterMulti_s_expr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitMulti_s_expr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitMulti_s_expr(this); + else return visitor.visitChildren(this); + } + } + + public final S_exprContext s_expr() throws RecognitionException { + S_exprContext _localctx = new S_exprContext(_ctx, getState()); + enterRule(_localctx, 32, RULE_s_expr); + int _la; + try { + setState(278); + _errHandler.sync(this); + switch (_input.LA(1)) { + case String: + case FLOATING_POINT_NUMBER: + case REGEXVALUES: + case Numeral: + case Binary: + case HexDecimal: + case Decimal: + _localctx = new S_expr_specContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(267); + spec_constant(); + } + break; + case QuotedSymbol: + case PS_Not: + case PS_Bool: + case PS_ContinuedExecution: + case PS_Error: + case PS_False: + case PS_ImmediateExit: + case PS_Incomplete: + case PS_Logic: + case PS_Memout: + case PS_Sat: + case PS_Success: + case PS_Theory: + case PS_True: + case PS_Unknown: + case PS_Unsupported: + case PS_Unsat: + case UndefinedSymbol: + _localctx = new S_expr_symbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(268); + symbol(); + } + break; + case Colon: + case PK_AllStatistics: + case PK_AssertionStackLevels: + case PK_Authors: + case PK_Category: + case PK_Chainable: + case PK_Definition: + case PK_DiagnosticOutputChannel: + case PK_ErrorBehaviour: + case PK_Extension: + case PK_Funs: + case PK_FunsDescription: + case PK_GlobalDeclarations: + case PK_InteractiveMode: + case PK_Language: + case PK_LeftAssoc: + case PK_License: + case PK_Named: + case PK_Name: + case PK_Notes: + case PK_Pattern: + case PK_PrintSuccess: + case PK_ProduceAssertions: + case PK_ProduceAssignments: + case PK_ProduceModels: + case PK_ProduceProofs: + case PK_ProduceUnsatAssumptions: + case PK_ProduceUnsatCores: + case PK_RandomSeed: + case PK_ReasonUnknown: + case PK_RegularOutputChannel: + case PK_ReproducibleResourceLimit: + case PK_RightAssoc: + case PK_SmtLibVersion: + case PK_Sorts: + case PK_SortsDescription: + case PK_Source: + case PK_Status: + case PK_Theories: + case PK_Values: + case PK_Verbosity: + case PK_Version: + _localctx = new S_expr_keyContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(269); + keyword(); + } + break; + case ParOpen: + _localctx = new Multi_s_exprContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(270); + match(ParOpen); + setState(274); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536863588L) != 0) + || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 211106232532991L) != 0)) { + { + { + setState(271); + s_expr(); + } + } + setState(276); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(277); + match(ParClose); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class IndexContext extends ParserRuleContext { + public IndexContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_index; + } + + public IndexContext() {} + + public void copyFrom(IndexContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Idx_symbContext extends IndexContext { + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public Idx_symbContext(IndexContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterIdx_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitIdx_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitIdx_symb(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Idx_numContext extends IndexContext { + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public Idx_numContext(IndexContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterIdx_num(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitIdx_num(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitIdx_num(this); + else return visitor.visitChildren(this); + } + } + + public final IndexContext index() throws RecognitionException { + IndexContext _localctx = new IndexContext(_ctx, getState()); + enterRule(_localctx, 34, RULE_index); + try { + setState(282); + _errHandler.sync(this); + switch (_input.LA(1)) { + case Numeral: + _localctx = new Idx_numContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(280); + numeral(); + } + break; + case QuotedSymbol: + case PS_Not: + case PS_Bool: + case PS_ContinuedExecution: + case PS_Error: + case PS_False: + case PS_ImmediateExit: + case PS_Incomplete: + case PS_Logic: + case PS_Memout: + case PS_Sat: + case PS_Success: + case PS_Theory: + case PS_True: + case PS_Unknown: + case PS_Unsupported: + case PS_Unsat: + case UndefinedSymbol: + _localctx = new Idx_symbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(281); + symbol(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class IdentifierContext extends ParserRuleContext { + public IdentifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_identifier; + } + + public IdentifierContext() {} + + public void copyFrom(IdentifierContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Id_symb_idxContext extends IdentifierContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode GRW_Underscore() { + return getToken(Smtlibv2Parser.GRW_Underscore, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List index() { + return getRuleContexts(IndexContext.class); + } + + public IndexContext index(int i) { + return getRuleContext(IndexContext.class, i); + } + + public Id_symb_idxContext(IdentifierContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterId_symb_idx(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitId_symb_idx(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitId_symb_idx(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Id_symbContext extends IdentifierContext { + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public Id_symbContext(IdentifierContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterId_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitId_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitId_symb(this); + else return visitor.visitChildren(this); + } + } + + public final IdentifierContext identifier() throws RecognitionException { + IdentifierContext _localctx = new IdentifierContext(_ctx, getState()); + enterRule(_localctx, 36, RULE_identifier); + int _la; + try { + setState(295); + _errHandler.sync(this); + switch (_input.LA(1)) { + case QuotedSymbol: + case PS_Not: + case PS_Bool: + case PS_ContinuedExecution: + case PS_Error: + case PS_False: + case PS_ImmediateExit: + case PS_Incomplete: + case PS_Logic: + case PS_Memout: + case PS_Sat: + case PS_Success: + case PS_Theory: + case PS_True: + case PS_Unknown: + case PS_Unsupported: + case PS_Unsat: + case UndefinedSymbol: + _localctx = new Id_symbContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(284); + symbol(); + } + break; + case ParOpen: + _localctx = new Id_symb_idxContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(285); + match(ParOpen); + setState(286); + match(GRW_Underscore); + setState(287); + symbol(); + setState(289); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(288); + index(); + } + } + setState(291); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862784L) != 0) + || _la == Numeral + || _la == UndefinedSymbol); + setState(293); + match(ParClose); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Attribute_valueContext extends ParserRuleContext { + public Attribute_valueContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_attribute_value; + } + + public Attribute_valueContext() {} + + public void copyFrom(Attribute_valueContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Attr_s_exprContext extends Attribute_valueContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List s_expr() { + return getRuleContexts(S_exprContext.class); + } + + public S_exprContext s_expr(int i) { + return getRuleContext(S_exprContext.class, i); + } + + public Attr_s_exprContext(Attribute_valueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterAttr_s_expr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitAttr_s_expr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAttr_s_expr(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Attr_specContext extends Attribute_valueContext { + public Spec_constantContext spec_constant() { + return getRuleContext(Spec_constantContext.class, 0); + } + + public Attr_specContext(Attribute_valueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterAttr_spec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitAttr_spec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAttr_spec(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Attr_symbContext extends Attribute_valueContext { + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public Attr_symbContext(Attribute_valueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterAttr_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitAttr_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAttr_symb(this); + else return visitor.visitChildren(this); + } + } + + public final Attribute_valueContext attribute_value() throws RecognitionException { + Attribute_valueContext _localctx = new Attribute_valueContext(_ctx, getState()); + enterRule(_localctx, 38, RULE_attribute_value); + int _la; + try { + setState(307); + _errHandler.sync(this); + switch (_input.LA(1)) { + case String: + case FLOATING_POINT_NUMBER: + case REGEXVALUES: + case Numeral: + case Binary: + case HexDecimal: + case Decimal: + _localctx = new Attr_specContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(297); + spec_constant(); + } + break; + case QuotedSymbol: + case PS_Not: + case PS_Bool: + case PS_ContinuedExecution: + case PS_Error: + case PS_False: + case PS_ImmediateExit: + case PS_Incomplete: + case PS_Logic: + case PS_Memout: + case PS_Sat: + case PS_Success: + case PS_Theory: + case PS_True: + case PS_Unknown: + case PS_Unsupported: + case PS_Unsat: + case UndefinedSymbol: + _localctx = new Attr_symbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(298); + symbol(); + } + break; + case ParOpen: + _localctx = new Attr_s_exprContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(299); + match(ParOpen); + setState(303); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536863588L) != 0) + || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 211106232532991L) != 0)) { + { + { + setState(300); + s_expr(); + } + } + setState(305); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(306); + match(ParClose); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AttributeContext extends ParserRuleContext { + public AttributeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_attribute; + } + + public AttributeContext() {} + + public void copyFrom(AttributeContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Attr_key_attrContext extends AttributeContext { + public KeywordContext keyword() { + return getRuleContext(KeywordContext.class, 0); + } + + public Attribute_valueContext attribute_value() { + return getRuleContext(Attribute_valueContext.class, 0); + } + + public Attr_key_attrContext(AttributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterAttr_key_attr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitAttr_key_attr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAttr_key_attr(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Attr_keyContext extends AttributeContext { + public KeywordContext keyword() { + return getRuleContext(KeywordContext.class, 0); + } + + public Attr_keyContext(AttributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterAttr_key(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitAttr_key(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAttr_key(this); + else return visitor.visitChildren(this); + } + } + + public final AttributeContext attribute() throws RecognitionException { + AttributeContext _localctx = new AttributeContext(_ctx, getState()); + enterRule(_localctx, 40, RULE_attribute); + try { + setState(313); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 14, _ctx)) { + case 1: + _localctx = new Attr_keyContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(309); + keyword(); + } + break; + case 2: + _localctx = new Attr_key_attrContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(310); + keyword(); + setState(311); + attribute_value(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SortContext extends ParserRuleContext { + public SortContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_sort; + } + + public SortContext() {} + + public void copyFrom(SortContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class SortfpContext extends SortContext { + public TerminalNode FLOATING_POINT_SORT() { + return getToken(Smtlibv2Parser.FLOATING_POINT_SORT, 0); + } + + public SortfpContext(SortContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterSortfp(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitSortfp(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSortfp(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class MultisortContext extends SortContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List sort() { + return getRuleContexts(SortContext.class); + } + + public SortContext sort(int i) { + return getRuleContext(SortContext.class, i); + } + + public MultisortContext(SortContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterMultisort(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitMultisort(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitMultisort(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Sort_idContext extends SortContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Sort_idContext(SortContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterSort_id(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitSort_id(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSort_id(this); + else return visitor.visitChildren(this); + } + } + + public final SortContext sort() throws RecognitionException { + SortContext _localctx = new SortContext(_ctx, getState()); + enterRule(_localctx, 42, RULE_sort); + int _la; + try { + setState(326); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 16, _ctx)) { + case 1: + _localctx = new SortfpContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(315); + match(FLOATING_POINT_SORT); + } + break; + case 2: + _localctx = new Sort_idContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(316); + identifier(); + } + break; + case 3: + _localctx = new MultisortContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(317); + match(ParOpen); + setState(318); + identifier(); + setState(320); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(319); + sort(); + } + } + setState(322); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862916L) != 0) + || _la == UndefinedSymbol); + setState(324); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Qual_identiferContext extends ParserRuleContext { + public Qual_identiferContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_qual_identifer; + } + + public Qual_identiferContext() {} + + public void copyFrom(Qual_identiferContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Qual_id_sortContext extends Qual_identiferContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode GRW_As() { + return getToken(Smtlibv2Parser.GRW_As, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Qual_id_sortContext(Qual_identiferContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterQual_id_sort(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitQual_id_sort(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitQual_id_sort(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Qual_idContext extends Qual_identiferContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Qual_idContext(Qual_identiferContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterQual_id(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitQual_id(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitQual_id(this); + else return visitor.visitChildren(this); + } + } + + public final Qual_identiferContext qual_identifer() throws RecognitionException { + Qual_identiferContext _localctx = new Qual_identiferContext(_ctx, getState()); + enterRule(_localctx, 44, RULE_qual_identifer); + try { + setState(335); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 17, _ctx)) { + case 1: + _localctx = new Qual_idContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(328); + identifier(); + } + break; + case 2: + _localctx = new Qual_id_sortContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(329); + match(ParOpen); + setState(330); + match(GRW_As); + setState(331); + identifier(); + setState(332); + sort(); + setState(333); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Var_bindingContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Var_bindingContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_var_binding; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterVar_binding(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitVar_binding(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitVar_binding(this); + else return visitor.visitChildren(this); + } + } + + public final Var_bindingContext var_binding() throws RecognitionException { + Var_bindingContext _localctx = new Var_bindingContext(_ctx, getState()); + enterRule(_localctx, 46, RULE_var_binding); + try { + enterOuterAlt(_localctx, 1); + { + setState(337); + match(ParOpen); + setState(338); + symbol(); + setState(339); + term(); + setState(340); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Sorted_varContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Sorted_varContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_sorted_var; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterSorted_var(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitSorted_var(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSorted_var(this); + else return visitor.visitChildren(this); + } + } + + public final Sorted_varContext sorted_var() throws RecognitionException { + Sorted_varContext _localctx = new Sorted_varContext(_ctx, getState()); + enterRule(_localctx, 48, RULE_sorted_var); + try { + enterOuterAlt(_localctx, 1); + { + setState(342); + match(ParOpen); + setState(343); + symbol(); + setState(344); + sort(); + setState(345); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PatternContext extends ParserRuleContext { + public PatternContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_pattern; + } + + public PatternContext() {} + + public void copyFrom(PatternContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Pattern_symbContext extends PatternContext { + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public Pattern_symbContext(PatternContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterPattern_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitPattern_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPattern_symb(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Pattern_multisymbContext extends PatternContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public List symbol() { + return getRuleContexts(SymbolContext.class); + } + + public SymbolContext symbol(int i) { + return getRuleContext(SymbolContext.class, i); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Pattern_multisymbContext(PatternContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterPattern_multisymb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitPattern_multisymb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPattern_multisymb(this); + else return visitor.visitChildren(this); + } + } + + public final PatternContext pattern() throws RecognitionException { + PatternContext _localctx = new PatternContext(_ctx, getState()); + enterRule(_localctx, 50, RULE_pattern); + int _la; + try { + setState(357); + _errHandler.sync(this); + switch (_input.LA(1)) { + case QuotedSymbol: + case PS_Not: + case PS_Bool: + case PS_ContinuedExecution: + case PS_Error: + case PS_False: + case PS_ImmediateExit: + case PS_Incomplete: + case PS_Logic: + case PS_Memout: + case PS_Sat: + case PS_Success: + case PS_Theory: + case PS_True: + case PS_Unknown: + case PS_Unsupported: + case PS_Unsat: + case UndefinedSymbol: + _localctx = new Pattern_symbContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(347); + symbol(); + } + break; + case ParOpen: + _localctx = new Pattern_multisymbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(348); + match(ParOpen); + setState(349); + symbol(); + setState(351); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(350); + symbol(); + } + } + setState(353); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862784L) != 0) + || _la == UndefinedSymbol); + setState(355); + match(ParClose); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Match_caseContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public PatternContext pattern() { + return getRuleContext(PatternContext.class, 0); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Match_caseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_match_case; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterMatch_case(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitMatch_case(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitMatch_case(this); + else return visitor.visitChildren(this); + } + } + + public final Match_caseContext match_case() throws RecognitionException { + Match_caseContext _localctx = new Match_caseContext(_ctx, getState()); + enterRule(_localctx, 52, RULE_match_case); + try { + enterOuterAlt(_localctx, 1); + { + setState(359); + match(ParOpen); + setState(360); + pattern(); + setState(361); + term(); + setState(362); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TermContext extends ParserRuleContext { + public TermContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_term; + } + + public TermContext() {} + + public void copyFrom(TermContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_special_regexContext extends TermContext { + public Special_regex_operationsContext special_regex_operations() { + return getRuleContext(Special_regex_operationsContext.class, 0); + } + + public Term_special_regexContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTerm_special_regex(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitTerm_special_regex(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_special_regex(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_fp_castContext extends TermContext { + public To_fp_exprContext to_fp_expr() { + return getRuleContext(To_fp_exprContext.class, 0); + } + + public Term_fp_castContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTerm_fp_cast(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitTerm_fp_cast(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_fp_cast(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_existsContext extends TermContext { + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public TerminalNode GRW_Exists() { + return getToken(Smtlibv2Parser.GRW_Exists, 0); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public List sorted_var() { + return getRuleContexts(Sorted_varContext.class); + } + + public Sorted_varContext sorted_var(int i) { + return getRuleContext(Sorted_varContext.class, i); + } + + public Term_existsContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTerm_exists(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTerm_exists(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_exists(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class MultitermContext extends TermContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Qual_identiferContext qual_identifer() { + return getRuleContext(Qual_identiferContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List term() { + return getRuleContexts(TermContext.class); + } + + public TermContext term(int i) { + return getRuleContext(TermContext.class, i); + } + + public MultitermContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterMultiterm(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitMultiterm(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitMultiterm(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_forallContext extends TermContext { + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public TerminalNode GRW_Forall() { + return getToken(Smtlibv2Parser.GRW_Forall, 0); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public List sorted_var() { + return getRuleContexts(Sorted_varContext.class); + } + + public Sorted_varContext sorted_var(int i) { + return getRuleContext(Sorted_varContext.class, i); + } + + public Term_forallContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTerm_forall(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTerm_forall(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_forall(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_qual_idContext extends TermContext { + public Qual_identiferContext qual_identifer() { + return getRuleContext(Qual_identiferContext.class, 0); + } + + public Term_qual_idContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTerm_qual_id(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitTerm_qual_id(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_qual_id(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_spec_constContext extends TermContext { + public Spec_constantContext spec_constant() { + return getRuleContext(Spec_constantContext.class, 0); + } + + public Term_spec_constContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTerm_spec_const(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitTerm_spec_const(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_spec_const(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_letContext extends TermContext { + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public TerminalNode GRW_Let() { + return getToken(Smtlibv2Parser.GRW_Let, 0); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public List var_binding() { + return getRuleContexts(Var_bindingContext.class); + } + + public Var_bindingContext var_binding(int i) { + return getRuleContext(Var_bindingContext.class, i); + } + + public Term_letContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterTerm_let(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTerm_let(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_let(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_matchContext extends TermContext { + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public TerminalNode GRW_Match() { + return getToken(Smtlibv2Parser.GRW_Match, 0); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public List match_case() { + return getRuleContexts(Match_caseContext.class); + } + + public Match_caseContext match_case(int i) { + return getRuleContext(Match_caseContext.class, i); + } + + public Term_matchContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterTerm_match(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTerm_match(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_match(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Term_exclamContext extends TermContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode GRW_Exclamation() { + return getToken(Smtlibv2Parser.GRW_Exclamation, 0); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List attribute() { + return getRuleContexts(AttributeContext.class); + } + + public AttributeContext attribute(int i) { + return getRuleContext(AttributeContext.class, i); + } + + public Term_exclamContext(TermContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTerm_exclam(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTerm_exclam(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTerm_exclam(this); + else return visitor.visitChildren(this); + } + } + + public final TermContext term() throws RecognitionException { + TermContext _localctx = new TermContext(_ctx, getState()); + enterRule(_localctx, 54, RULE_term); + int _la; + try { + setState(435); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 26, _ctx)) { + case 1: + _localctx = new Term_spec_constContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(364); + spec_constant(); + } + break; + case 2: + _localctx = new Term_qual_idContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(365); + qual_identifer(); + } + break; + case 3: + _localctx = new Term_fp_castContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(366); + to_fp_expr(); + } + break; + case 4: + _localctx = new Term_special_regexContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(367); + special_regex_operations(); + } + break; + case 5: + _localctx = new MultitermContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(368); + match(ParOpen); + setState(369); + qual_identifer(); + setState(371); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(370); + term(); + } + } + setState(373); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536870756L) != 0) + || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 140737488355343L) != 0)); + setState(375); + match(ParClose); + } + break; + case 6: + _localctx = new Term_letContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(377); + match(ParOpen); + setState(378); + match(GRW_Let); + setState(379); + match(ParOpen); + setState(381); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(380); + var_binding(); + } + } + setState(383); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(385); + match(ParClose); + setState(386); + term(); + setState(387); + match(ParClose); + } + break; + case 7: + _localctx = new Term_forallContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(389); + match(ParOpen); + setState(390); + match(GRW_Forall); + setState(391); + match(ParOpen); + setState(393); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(392); + sorted_var(); + } + } + setState(395); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(397); + match(ParClose); + setState(398); + term(); + setState(399); + match(ParClose); + } + break; + case 8: + _localctx = new Term_existsContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(401); + match(ParOpen); + setState(402); + match(GRW_Exists); + setState(403); + match(ParOpen); + setState(405); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(404); + sorted_var(); + } + } + setState(407); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(409); + match(ParClose); + setState(410); + term(); + setState(411); + match(ParClose); + } + break; + case 9: + _localctx = new Term_matchContext(_localctx); + enterOuterAlt(_localctx, 9); + { + setState(413); + match(ParOpen); + setState(414); + match(GRW_Match); + setState(415); + term(); + setState(416); + match(ParOpen); + setState(418); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(417); + match_case(); + } + } + setState(420); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(422); + match(ParClose); + setState(423); + match(ParClose); + } + break; + case 10: + _localctx = new Term_exclamContext(_localctx); + enterOuterAlt(_localctx, 10); + { + setState(425); + match(ParOpen); + setState(426); + match(GRW_Exclamation); + setState(427); + term(); + setState(429); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(428); + attribute(); + } + } + setState(431); + _errHandler.sync(this); + _la = _input.LA(1); + } while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)); + setState(433); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Sort_symbol_declContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List attribute() { + return getRuleContexts(AttributeContext.class); + } + + public AttributeContext attribute(int i) { + return getRuleContext(AttributeContext.class, i); + } + + public Sort_symbol_declContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_sort_symbol_decl; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSort_symbol_decl(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSort_symbol_decl(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSort_symbol_decl(this); + else return visitor.visitChildren(this); + } + } + + public final Sort_symbol_declContext sort_symbol_decl() throws RecognitionException { + Sort_symbol_declContext _localctx = new Sort_symbol_declContext(_ctx, getState()); + enterRule(_localctx, 56, RULE_sort_symbol_decl); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(437); + match(ParOpen); + setState(438); + identifier(); + setState(439); + numeral(); + setState(443); + _errHandler.sync(this); + _la = _input.LA(1); + while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)) { + { + { + setState(440); + attribute(); + } + } + setState(445); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(446); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Meta_spec_constantContext extends ParserRuleContext { + public TerminalNode GRW_Numeral() { + return getToken(Smtlibv2Parser.GRW_Numeral, 0); + } + + public TerminalNode GRW_Decimal() { + return getToken(Smtlibv2Parser.GRW_Decimal, 0); + } + + public TerminalNode GRW_String() { + return getToken(Smtlibv2Parser.GRW_String, 0); + } + + public Meta_spec_constantContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_meta_spec_constant; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterMeta_spec_constant(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitMeta_spec_constant(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitMeta_spec_constant(this); + else return visitor.visitChildren(this); + } + } + + public final Meta_spec_constantContext meta_spec_constant() throws RecognitionException { + Meta_spec_constantContext _localctx = new Meta_spec_constantContext(_ctx, getState()); + enterRule(_localctx, 58, RULE_meta_spec_constant); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(448); + _la = _input.LA(1); + if (!(((((_la - 63)) & ~0x3f) == 0 && ((1L << (_la - 63)) & 321L) != 0))) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Fun_symbol_declContext extends ParserRuleContext { + public Fun_symbol_declContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_fun_symbol_decl; + } + + public Fun_symbol_declContext() {} + + public void copyFrom(Fun_symbol_declContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Fun_symb_idContext extends Fun_symbol_declContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List sort() { + return getRuleContexts(SortContext.class); + } + + public SortContext sort(int i) { + return getRuleContext(SortContext.class, i); + } + + public List attribute() { + return getRuleContexts(AttributeContext.class); + } + + public AttributeContext attribute(int i) { + return getRuleContext(AttributeContext.class, i); + } + + public Fun_symb_idContext(Fun_symbol_declContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterFun_symb_id(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitFun_symb_id(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitFun_symb_id(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Fun_symb_specContext extends Fun_symbol_declContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Spec_constantContext spec_constant() { + return getRuleContext(Spec_constantContext.class, 0); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List attribute() { + return getRuleContexts(AttributeContext.class); + } + + public AttributeContext attribute(int i) { + return getRuleContext(AttributeContext.class, i); + } + + public Fun_symb_specContext(Fun_symbol_declContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterFun_symb_spec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitFun_symb_spec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitFun_symb_spec(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Fun_symb_metaContext extends Fun_symbol_declContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Meta_spec_constantContext meta_spec_constant() { + return getRuleContext(Meta_spec_constantContext.class, 0); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List attribute() { + return getRuleContexts(AttributeContext.class); + } + + public AttributeContext attribute(int i) { + return getRuleContext(AttributeContext.class, i); + } + + public Fun_symb_metaContext(Fun_symbol_declContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterFun_symb_meta(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitFun_symb_meta(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitFun_symb_meta(this); + else return visitor.visitChildren(this); + } + } + + public final Fun_symbol_declContext fun_symbol_decl() throws RecognitionException { + Fun_symbol_declContext _localctx = new Fun_symbol_declContext(_ctx, getState()); + enterRule(_localctx, 60, RULE_fun_symbol_decl); + int _la; + try { + setState(487); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 32, _ctx)) { + case 1: + _localctx = new Fun_symb_specContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(450); + match(ParOpen); + setState(451); + spec_constant(); + setState(452); + sort(); + setState(456); + _errHandler.sync(this); + _la = _input.LA(1); + while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)) { + { + { + setState(453); + attribute(); + } + } + setState(458); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(459); + match(ParClose); + } + break; + case 2: + _localctx = new Fun_symb_metaContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(461); + match(ParOpen); + setState(462); + meta_spec_constant(); + setState(463); + sort(); + setState(467); + _errHandler.sync(this); + _la = _input.LA(1); + while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)) { + { + { + setState(464); + attribute(); + } + } + setState(469); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(470); + match(ParClose); + } + break; + case 3: + _localctx = new Fun_symb_idContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(472); + match(ParOpen); + setState(473); + identifier(); + setState(475); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(474); + sort(); + } + } + setState(477); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862916L) != 0) + || _la == UndefinedSymbol); + setState(482); + _errHandler.sync(this); + _la = _input.LA(1); + while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)) { + { + { + setState(479); + attribute(); + } + } + setState(484); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(485); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Par_fun_symbol_declContext extends ParserRuleContext { + public Par_fun_symbol_declContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_par_fun_symbol_decl; + } + + public Par_fun_symbol_declContext() {} + + public void copyFrom(Par_fun_symbol_declContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Par_fun_symbContext extends Par_fun_symbol_declContext { + public Fun_symbol_declContext fun_symbol_decl() { + return getRuleContext(Fun_symbol_declContext.class, 0); + } + + public Par_fun_symbContext(Par_fun_symbol_declContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterPar_fun_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitPar_fun_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPar_fun_symb(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Par_fun_multi_symbContext extends Par_fun_symbol_declContext { + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public TerminalNode GRW_Par() { + return getToken(Smtlibv2Parser.GRW_Par, 0); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public List symbol() { + return getRuleContexts(SymbolContext.class); + } + + public SymbolContext symbol(int i) { + return getRuleContext(SymbolContext.class, i); + } + + public List sort() { + return getRuleContexts(SortContext.class); + } + + public SortContext sort(int i) { + return getRuleContext(SortContext.class, i); + } + + public List attribute() { + return getRuleContexts(AttributeContext.class); + } + + public AttributeContext attribute(int i) { + return getRuleContext(AttributeContext.class, i); + } + + public Par_fun_multi_symbContext(Par_fun_symbol_declContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterPar_fun_multi_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitPar_fun_multi_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPar_fun_multi_symb(this); + else return visitor.visitChildren(this); + } + } + + public final Par_fun_symbol_declContext par_fun_symbol_decl() throws RecognitionException { + Par_fun_symbol_declContext _localctx = new Par_fun_symbol_declContext(_ctx, getState()); + enterRule(_localctx, 62, RULE_par_fun_symbol_decl); + int _la; + try { + setState(515); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 36, _ctx)) { + case 1: + _localctx = new Par_fun_symbContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(489); + fun_symbol_decl(); + } + break; + case 2: + _localctx = new Par_fun_multi_symbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(490); + match(ParOpen); + setState(491); + match(GRW_Par); + setState(492); + match(ParOpen); + setState(494); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(493); + symbol(); + } + } + setState(496); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862784L) != 0) + || _la == UndefinedSymbol); + setState(498); + match(ParClose); + setState(499); + match(ParOpen); + setState(500); + identifier(); + setState(502); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(501); + sort(); + } + } + setState(504); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862916L) != 0) + || _la == UndefinedSymbol); + setState(509); + _errHandler.sync(this); + _la = _input.LA(1); + while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)) { + { + { + setState(506); + attribute(); + } + } + setState(511); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(512); + match(ParClose); + setState(513); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_attributeContext extends ParserRuleContext { + public Theory_attributeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_theory_attribute; + } + + public Theory_attributeContext() {} + + public void copyFrom(Theory_attributeContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_sortContext extends Theory_attributeContext { + public TerminalNode PK_Sorts() { + return getToken(Smtlibv2Parser.PK_Sorts, 0); + } + + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List sort_symbol_decl() { + return getRuleContexts(Sort_symbol_declContext.class); + } + + public Sort_symbol_declContext sort_symbol_decl(int i) { + return getRuleContext(Sort_symbol_declContext.class, i); + } + + public Theory_sortContext(Theory_attributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTheory_sort(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTheory_sort(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_sort(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_notesContext extends Theory_attributeContext { + public TerminalNode PK_Notes() { + return getToken(Smtlibv2Parser.PK_Notes, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Theory_notesContext(Theory_attributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTheory_notes(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitTheory_notes(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_notes(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_defContext extends Theory_attributeContext { + public TerminalNode PK_Definition() { + return getToken(Smtlibv2Parser.PK_Definition, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Theory_defContext(Theory_attributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterTheory_def(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTheory_def(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_def(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_funContext extends Theory_attributeContext { + public TerminalNode PK_Funs() { + return getToken(Smtlibv2Parser.PK_Funs, 0); + } + + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List par_fun_symbol_decl() { + return getRuleContexts(Par_fun_symbol_declContext.class); + } + + public Par_fun_symbol_declContext par_fun_symbol_decl(int i) { + return getRuleContext(Par_fun_symbol_declContext.class, i); + } + + public Theory_funContext(Theory_attributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterTheory_fun(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTheory_fun(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_fun(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_attrContext extends Theory_attributeContext { + public AttributeContext attribute() { + return getRuleContext(AttributeContext.class, 0); + } + + public Theory_attrContext(Theory_attributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTheory_attr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTheory_attr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_attr(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_valContext extends Theory_attributeContext { + public TerminalNode PK_Values() { + return getToken(Smtlibv2Parser.PK_Values, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Theory_valContext(Theory_attributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterTheory_val(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTheory_val(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_val(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_sort_descrContext extends Theory_attributeContext { + public TerminalNode PK_SortsDescription() { + return getToken(Smtlibv2Parser.PK_SortsDescription, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Theory_sort_descrContext(Theory_attributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTheory_sort_descr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitTheory_sort_descr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_sort_descr(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_fun_descrContext extends Theory_attributeContext { + public TerminalNode PK_FunsDescription() { + return getToken(Smtlibv2Parser.PK_FunsDescription, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Theory_fun_descrContext(Theory_attributeContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTheory_fun_descr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitTheory_fun_descr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_fun_descr(this); + else return visitor.visitChildren(this); + } + } + + public final Theory_attributeContext theory_attribute() throws RecognitionException { + Theory_attributeContext _localctx = new Theory_attributeContext(_ctx, getState()); + enterRule(_localctx, 64, RULE_theory_attribute); + int _la; + try { + setState(546); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 39, _ctx)) { + case 1: + _localctx = new Theory_sortContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(517); + match(PK_Sorts); + setState(518); + match(ParOpen); + setState(520); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(519); + sort_symbol_decl(); + } + } + setState(522); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(524); + match(ParClose); + } + break; + case 2: + _localctx = new Theory_funContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(526); + match(PK_Funs); + setState(527); + match(ParOpen); + setState(529); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(528); + par_fun_symbol_decl(); + } + } + setState(531); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(533); + match(ParClose); + } + break; + case 3: + _localctx = new Theory_sort_descrContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(535); + match(PK_SortsDescription); + setState(536); + string(); + } + break; + case 4: + _localctx = new Theory_fun_descrContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(537); + match(PK_FunsDescription); + setState(538); + string(); + } + break; + case 5: + _localctx = new Theory_defContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(539); + match(PK_Definition); + setState(540); + string(); + } + break; + case 6: + _localctx = new Theory_valContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(541); + match(PK_Values); + setState(542); + string(); + } + break; + case 7: + _localctx = new Theory_notesContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(543); + match(PK_Notes); + setState(544); + string(); + } + break; + case 8: + _localctx = new Theory_attrContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(545); + attribute(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Theory_declContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode PS_Theory() { + return getToken(Smtlibv2Parser.PS_Theory, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List theory_attribute() { + return getRuleContexts(Theory_attributeContext.class); + } + + public Theory_attributeContext theory_attribute(int i) { + return getRuleContext(Theory_attributeContext.class, i); + } + + public Theory_declContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_theory_decl; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterTheory_decl(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitTheory_decl(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitTheory_decl(this); + else return visitor.visitChildren(this); + } + } + + public final Theory_declContext theory_decl() throws RecognitionException { + Theory_declContext _localctx = new Theory_declContext(_ctx, getState()); + enterRule(_localctx, 66, RULE_theory_decl); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(548); + match(ParOpen); + setState(549); + match(PS_Theory); + setState(550); + symbol(); + setState(552); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(551); + theory_attribute(); + } + } + setState(554); + _errHandler.sync(this); + _la = _input.LA(1); + } while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)); + setState(556); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Logic_attribueContext extends ParserRuleContext { + public Logic_attribueContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_logic_attribue; + } + + public Logic_attribueContext() {} + + public void copyFrom(Logic_attribueContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Logic_valContext extends Logic_attribueContext { + public TerminalNode PK_Values() { + return getToken(Smtlibv2Parser.PK_Values, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Logic_valContext(Logic_attribueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterLogic_val(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitLogic_val(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitLogic_val(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Logic_attrContext extends Logic_attribueContext { + public AttributeContext attribute() { + return getRuleContext(AttributeContext.class, 0); + } + + public Logic_attrContext(Logic_attribueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterLogic_attr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitLogic_attr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitLogic_attr(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Logic_theoryContext extends Logic_attribueContext { + public TerminalNode PK_Theories() { + return getToken(Smtlibv2Parser.PK_Theories, 0); + } + + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List symbol() { + return getRuleContexts(SymbolContext.class); + } + + public SymbolContext symbol(int i) { + return getRuleContext(SymbolContext.class, i); + } + + public Logic_theoryContext(Logic_attribueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterLogic_theory(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitLogic_theory(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitLogic_theory(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Logic_languageContext extends Logic_attribueContext { + public TerminalNode PK_Language() { + return getToken(Smtlibv2Parser.PK_Language, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Logic_languageContext(Logic_attribueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterLogic_language(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitLogic_language(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitLogic_language(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Logic_extContext extends Logic_attribueContext { + public TerminalNode PK_Extension() { + return getToken(Smtlibv2Parser.PK_Extension, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Logic_extContext(Logic_attribueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterLogic_ext(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitLogic_ext(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitLogic_ext(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Logic_notesContext extends Logic_attribueContext { + public TerminalNode PK_Notes() { + return getToken(Smtlibv2Parser.PK_Notes, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Logic_notesContext(Logic_attribueContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterLogic_notes(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitLogic_notes(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitLogic_notes(this); + else return visitor.visitChildren(this); + } + } + + public final Logic_attribueContext logic_attribue() throws RecognitionException { + Logic_attribueContext _localctx = new Logic_attribueContext(_ctx, getState()); + enterRule(_localctx, 68, RULE_logic_attribue); + int _la; + try { + setState(576); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 42, _ctx)) { + case 1: + _localctx = new Logic_theoryContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(558); + match(PK_Theories); + setState(559); + match(ParOpen); + setState(561); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(560); + symbol(); + } + } + setState(563); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862784L) != 0) + || _la == UndefinedSymbol); + setState(565); + match(ParClose); + } + break; + case 2: + _localctx = new Logic_languageContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(567); + match(PK_Language); + setState(568); + string(); + } + break; + case 3: + _localctx = new Logic_extContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(569); + match(PK_Extension); + setState(570); + string(); + } + break; + case 4: + _localctx = new Logic_valContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(571); + match(PK_Values); + setState(572); + string(); + } + break; + case 5: + _localctx = new Logic_notesContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(573); + match(PK_Notes); + setState(574); + string(); + } + break; + case 6: + _localctx = new Logic_attrContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(575); + attribute(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LogicContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode PS_Logic() { + return getToken(Smtlibv2Parser.PS_Logic, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List logic_attribue() { + return getRuleContexts(Logic_attribueContext.class); + } + + public Logic_attribueContext logic_attribue(int i) { + return getRuleContext(Logic_attribueContext.class, i); + } + + public LogicContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_logic; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterLogic(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitLogic(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitLogic(this); + else return visitor.visitChildren(this); + } + } + + public final LogicContext logic() throws RecognitionException { + LogicContext _localctx = new LogicContext(_ctx, getState()); + enterRule(_localctx, 70, RULE_logic); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(578); + match(ParOpen); + setState(579); + match(PS_Logic); + setState(580); + symbol(); + setState(582); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(581); + logic_attribue(); + } + } + setState(584); + _errHandler.sync(this); + _la = _input.LA(1); + } while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)); + setState(586); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Sort_decContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Sort_decContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_sort_dec; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterSort_dec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitSort_dec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSort_dec(this); + else return visitor.visitChildren(this); + } + } + + public final Sort_decContext sort_dec() throws RecognitionException { + Sort_decContext _localctx = new Sort_decContext(_ctx, getState()); + enterRule(_localctx, 72, RULE_sort_dec); + try { + enterOuterAlt(_localctx, 1); + { + setState(588); + match(ParOpen); + setState(589); + symbol(); + setState(590); + numeral(); + setState(591); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Selector_decContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Selector_decContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_selector_dec; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterSelector_dec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitSelector_dec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSelector_dec(this); + else return visitor.visitChildren(this); + } + } + + public final Selector_decContext selector_dec() throws RecognitionException { + Selector_decContext _localctx = new Selector_decContext(_ctx, getState()); + enterRule(_localctx, 74, RULE_selector_dec); + try { + enterOuterAlt(_localctx, 1); + { + setState(593); + match(ParOpen); + setState(594); + symbol(); + setState(595); + sort(); + setState(596); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Constructor_decContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List selector_dec() { + return getRuleContexts(Selector_decContext.class); + } + + public Selector_decContext selector_dec(int i) { + return getRuleContext(Selector_decContext.class, i); + } + + public Constructor_decContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_constructor_dec; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterConstructor_dec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitConstructor_dec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitConstructor_dec(this); + else return visitor.visitChildren(this); + } + } + + public final Constructor_decContext constructor_dec() throws RecognitionException { + Constructor_decContext _localctx = new Constructor_decContext(_ctx, getState()); + enterRule(_localctx, 76, RULE_constructor_dec); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(598); + match(ParOpen); + setState(599); + symbol(); + setState(603); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == ParOpen) { + { + { + setState(600); + selector_dec(); + } + } + setState(605); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(606); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Datatype_decContext extends ParserRuleContext { + public Datatype_decContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_datatype_dec; + } + + public Datatype_decContext() {} + + public void copyFrom(Datatype_decContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Data_multisymbContext extends Datatype_decContext { + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public TerminalNode GRW_Par() { + return getToken(Smtlibv2Parser.GRW_Par, 0); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public List symbol() { + return getRuleContexts(SymbolContext.class); + } + + public SymbolContext symbol(int i) { + return getRuleContext(SymbolContext.class, i); + } + + public List constructor_dec() { + return getRuleContexts(Constructor_decContext.class); + } + + public Constructor_decContext constructor_dec(int i) { + return getRuleContext(Constructor_decContext.class, i); + } + + public Data_multisymbContext(Datatype_decContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterData_multisymb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitData_multisymb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitData_multisymb(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Data_constrContext extends Datatype_decContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List constructor_dec() { + return getRuleContexts(Constructor_decContext.class); + } + + public Constructor_decContext constructor_dec(int i) { + return getRuleContext(Constructor_decContext.class, i); + } + + public Data_constrContext(Datatype_decContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterData_constr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitData_constr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitData_constr(this); + else return visitor.visitChildren(this); + } + } + + public final Datatype_decContext datatype_dec() throws RecognitionException { + Datatype_decContext _localctx = new Datatype_decContext(_ctx, getState()); + enterRule(_localctx, 78, RULE_datatype_dec); + int _la; + try { + setState(634); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 48, _ctx)) { + case 1: + _localctx = new Data_constrContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(608); + match(ParOpen); + setState(610); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(609); + constructor_dec(); + } + } + setState(612); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(614); + match(ParClose); + } + break; + case 2: + _localctx = new Data_multisymbContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(616); + match(ParOpen); + setState(617); + match(GRW_Par); + setState(618); + match(ParOpen); + setState(620); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(619); + symbol(); + } + } + setState(622); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862784L) != 0) + || _la == UndefinedSymbol); + setState(624); + match(ParClose); + setState(625); + match(ParOpen); + setState(627); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(626); + constructor_dec(); + } + } + setState(629); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(631); + match(ParClose); + setState(632); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Function_decContext extends ParserRuleContext { + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public List sorted_var() { + return getRuleContexts(Sorted_varContext.class); + } + + public Sorted_varContext sorted_var(int i) { + return getRuleContext(Sorted_varContext.class, i); + } + + public Function_decContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_function_dec; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterFunction_dec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitFunction_dec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitFunction_dec(this); + else return visitor.visitChildren(this); + } + } + + public final Function_decContext function_dec() throws RecognitionException { + Function_decContext _localctx = new Function_decContext(_ctx, getState()); + enterRule(_localctx, 80, RULE_function_dec); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(636); + match(ParOpen); + setState(637); + symbol(); + setState(638); + match(ParOpen); + setState(642); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == ParOpen) { + { + { + setState(639); + sorted_var(); + } + } + setState(644); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(645); + match(ParClose); + setState(646); + sort(); + setState(647); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Function_defContext extends ParserRuleContext { + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public List sorted_var() { + return getRuleContexts(Sorted_varContext.class); + } + + public Sorted_varContext sorted_var(int i) { + return getRuleContext(Sorted_varContext.class, i); + } + + public Function_defContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_function_def; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterFunction_def(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitFunction_def(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitFunction_def(this); + else return visitor.visitChildren(this); + } + } + + public final Function_defContext function_def() throws RecognitionException { + Function_defContext _localctx = new Function_defContext(_ctx, getState()); + enterRule(_localctx, 82, RULE_function_def); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(649); + symbol(); + setState(650); + match(ParOpen); + setState(654); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == ParOpen) { + { + { + setState(651); + sorted_var(); + } + } + setState(656); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(657); + match(ParClose); + setState(658); + sort(); + setState(659); + term(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Prop_literalContext extends ParserRuleContext { + public Prop_literalContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_prop_literal; + } + + public Prop_literalContext() {} + + public void copyFrom(Prop_literalContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Prop_notContext extends Prop_literalContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode PS_Not() { + return getToken(Smtlibv2Parser.PS_Not, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Prop_notContext(Prop_literalContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterProp_not(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitProp_not(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitProp_not(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Prop_symbContext extends Prop_literalContext { + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public Prop_symbContext(Prop_literalContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterProp_symb(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitProp_symb(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitProp_symb(this); + else return visitor.visitChildren(this); + } + } + + public final Prop_literalContext prop_literal() throws RecognitionException { + Prop_literalContext _localctx = new Prop_literalContext(_ctx, getState()); + enterRule(_localctx, 84, RULE_prop_literal); + try { + setState(667); + _errHandler.sync(this); + switch (_input.LA(1)) { + case QuotedSymbol: + case PS_Not: + case PS_Bool: + case PS_ContinuedExecution: + case PS_Error: + case PS_False: + case PS_ImmediateExit: + case PS_Incomplete: + case PS_Logic: + case PS_Memout: + case PS_Sat: + case PS_Success: + case PS_Theory: + case PS_True: + case PS_Unknown: + case PS_Unsupported: + case PS_Unsat: + case UndefinedSymbol: + _localctx = new Prop_symbContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(661); + symbol(); + } + break; + case ParOpen: + _localctx = new Prop_notContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(662); + match(ParOpen); + setState(663); + match(PS_Not); + setState(664); + symbol(); + setState(665); + match(ParClose); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ScriptContext extends ParserRuleContext { + public List command() { + return getRuleContexts(CommandContext.class); + } + + public CommandContext command(int i) { + return getRuleContext(CommandContext.class, i); + } + + public ScriptContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_script; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterScript(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitScript(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitScript(this); + else return visitor.visitChildren(this); + } + } + + public final ScriptContext script() throws RecognitionException { + ScriptContext _localctx = new ScriptContext(_ctx, getState()); + enterRule(_localctx, 86, RULE_script); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(672); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == ParOpen) { + { + { + setState(669); + command(); + } + } + setState(674); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_assertContext extends ParserRuleContext { + public TerminalNode CMD_Assert() { + return getToken(Smtlibv2Parser.CMD_Assert, 0); + } + + public TermContext term() { + return getRuleContext(TermContext.class, 0); + } + + public Cmd_assertContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_assert; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterCmd_assert(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCmd_assert(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_assert(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_assertContext cmd_assert() throws RecognitionException { + Cmd_assertContext _localctx = new Cmd_assertContext(_ctx, getState()); + enterRule(_localctx, 88, RULE_cmd_assert); + try { + enterOuterAlt(_localctx, 1); + { + setState(675); + match(CMD_Assert); + setState(676); + term(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_checkSatContext extends ParserRuleContext { + public TerminalNode CMD_CheckSat() { + return getToken(Smtlibv2Parser.CMD_CheckSat, 0); + } + + public Cmd_checkSatContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_checkSat; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_checkSat(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_checkSat(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_checkSat(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_checkSatContext cmd_checkSat() throws RecognitionException { + Cmd_checkSatContext _localctx = new Cmd_checkSatContext(_ctx, getState()); + enterRule(_localctx, 90, RULE_cmd_checkSat); + try { + enterOuterAlt(_localctx, 1); + { + setState(678); + match(CMD_CheckSat); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_checkSatAssumingContext extends ParserRuleContext { + public TerminalNode CMD_CheckSatAssuming() { + return getToken(Smtlibv2Parser.CMD_CheckSatAssuming, 0); + } + + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List prop_literal() { + return getRuleContexts(Prop_literalContext.class); + } + + public Prop_literalContext prop_literal(int i) { + return getRuleContext(Prop_literalContext.class, i); + } + + public Cmd_checkSatAssumingContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_checkSatAssuming; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_checkSatAssuming(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_checkSatAssuming(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_checkSatAssuming(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_checkSatAssumingContext cmd_checkSatAssuming() throws RecognitionException { + Cmd_checkSatAssumingContext _localctx = new Cmd_checkSatAssumingContext(_ctx, getState()); + enterRule(_localctx, 92, RULE_cmd_checkSatAssuming); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(680); + match(CMD_CheckSatAssuming); + setState(681); + match(ParOpen); + setState(685); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862788L) != 0) + || _la == UndefinedSymbol) { + { + { + setState(682); + prop_literal(); + } + } + setState(687); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(688); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_declareConstContext extends ParserRuleContext { + public TerminalNode CMD_DeclareConst() { + return getToken(Smtlibv2Parser.CMD_DeclareConst, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public Cmd_declareConstContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_declareConst; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_declareConst(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_declareConst(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_declareConst(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_declareConstContext cmd_declareConst() throws RecognitionException { + Cmd_declareConstContext _localctx = new Cmd_declareConstContext(_ctx, getState()); + enterRule(_localctx, 94, RULE_cmd_declareConst); + try { + enterOuterAlt(_localctx, 1); + { + setState(690); + match(CMD_DeclareConst); + setState(691); + symbol(); + setState(692); + sort(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_declareDatatypeContext extends ParserRuleContext { + public TerminalNode CMD_DeclareDatatype() { + return getToken(Smtlibv2Parser.CMD_DeclareDatatype, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public Datatype_decContext datatype_dec() { + return getRuleContext(Datatype_decContext.class, 0); + } + + public Cmd_declareDatatypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_declareDatatype; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_declareDatatype(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_declareDatatype(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_declareDatatype(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_declareDatatypeContext cmd_declareDatatype() throws RecognitionException { + Cmd_declareDatatypeContext _localctx = new Cmd_declareDatatypeContext(_ctx, getState()); + enterRule(_localctx, 96, RULE_cmd_declareDatatype); + try { + enterOuterAlt(_localctx, 1); + { + setState(694); + match(CMD_DeclareDatatype); + setState(695); + symbol(); + setState(696); + datatype_dec(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_declareDatatypesContext extends ParserRuleContext { + public TerminalNode CMD_DeclareDatatypes() { + return getToken(Smtlibv2Parser.CMD_DeclareDatatypes, 0); + } + + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public List sort_dec() { + return getRuleContexts(Sort_decContext.class); + } + + public Sort_decContext sort_dec(int i) { + return getRuleContext(Sort_decContext.class, i); + } + + public List datatype_dec() { + return getRuleContexts(Datatype_decContext.class); + } + + public Datatype_decContext datatype_dec(int i) { + return getRuleContext(Datatype_decContext.class, i); + } + + public Cmd_declareDatatypesContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_declareDatatypes; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_declareDatatypes(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_declareDatatypes(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_declareDatatypes(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_declareDatatypesContext cmd_declareDatatypes() throws RecognitionException { + Cmd_declareDatatypesContext _localctx = new Cmd_declareDatatypesContext(_ctx, getState()); + enterRule(_localctx, 98, RULE_cmd_declareDatatypes); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(698); + match(CMD_DeclareDatatypes); + setState(699); + match(ParOpen); + setState(701); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(700); + sort_dec(); + } + } + setState(703); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(705); + match(ParClose); + setState(706); + match(ParOpen); + setState(708); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(707); + datatype_dec(); + } + } + setState(710); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(712); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_declareFunContext extends ParserRuleContext { + public TerminalNode CMD_DeclareFun() { + return getToken(Smtlibv2Parser.CMD_DeclareFun, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List sort() { + return getRuleContexts(SortContext.class); + } + + public SortContext sort(int i) { + return getRuleContext(SortContext.class, i); + } + + public Cmd_declareFunContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_declareFun; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_declareFun(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_declareFun(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_declareFun(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_declareFunContext cmd_declareFun() throws RecognitionException { + Cmd_declareFunContext _localctx = new Cmd_declareFunContext(_ctx, getState()); + enterRule(_localctx, 100, RULE_cmd_declareFun); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(714); + match(CMD_DeclareFun); + setState(715); + symbol(); + setState(716); + match(ParOpen); + setState(720); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862916L) != 0) + || _la == UndefinedSymbol) { + { + { + setState(717); + sort(); + } + } + setState(722); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(723); + match(ParClose); + setState(724); + sort(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_declareSortContext extends ParserRuleContext { + public TerminalNode CMD_DeclareSort() { + return getToken(Smtlibv2Parser.CMD_DeclareSort, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public Cmd_declareSortContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_declareSort; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_declareSort(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_declareSort(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_declareSort(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_declareSortContext cmd_declareSort() throws RecognitionException { + Cmd_declareSortContext _localctx = new Cmd_declareSortContext(_ctx, getState()); + enterRule(_localctx, 102, RULE_cmd_declareSort); + try { + enterOuterAlt(_localctx, 1); + { + setState(726); + match(CMD_DeclareSort); + setState(727); + symbol(); + setState(728); + numeral(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_defineFunContext extends ParserRuleContext { + public TerminalNode CMD_DefineFun() { + return getToken(Smtlibv2Parser.CMD_DefineFun, 0); + } + + public Function_defContext function_def() { + return getRuleContext(Function_defContext.class, 0); + } + + public Cmd_defineFunContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_defineFun; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_defineFun(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_defineFun(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_defineFun(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_defineFunContext cmd_defineFun() throws RecognitionException { + Cmd_defineFunContext _localctx = new Cmd_defineFunContext(_ctx, getState()); + enterRule(_localctx, 104, RULE_cmd_defineFun); + try { + enterOuterAlt(_localctx, 1); + { + setState(730); + match(CMD_DefineFun); + setState(731); + function_def(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_defineFunRecContext extends ParserRuleContext { + public TerminalNode CMD_DefineFunRec() { + return getToken(Smtlibv2Parser.CMD_DefineFunRec, 0); + } + + public Function_defContext function_def() { + return getRuleContext(Function_defContext.class, 0); + } + + public Cmd_defineFunRecContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_defineFunRec; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_defineFunRec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_defineFunRec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_defineFunRec(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_defineFunRecContext cmd_defineFunRec() throws RecognitionException { + Cmd_defineFunRecContext _localctx = new Cmd_defineFunRecContext(_ctx, getState()); + enterRule(_localctx, 106, RULE_cmd_defineFunRec); + try { + enterOuterAlt(_localctx, 1); + { + setState(733); + match(CMD_DefineFunRec); + setState(734); + function_def(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_defineFunsRecContext extends ParserRuleContext { + public TerminalNode CMD_DefineFunsRec() { + return getToken(Smtlibv2Parser.CMD_DefineFunsRec, 0); + } + + public List ParOpen() { + return getTokens(Smtlibv2Parser.ParOpen); + } + + public TerminalNode ParOpen(int i) { + return getToken(Smtlibv2Parser.ParOpen, i); + } + + public List ParClose() { + return getTokens(Smtlibv2Parser.ParClose); + } + + public TerminalNode ParClose(int i) { + return getToken(Smtlibv2Parser.ParClose, i); + } + + public List function_dec() { + return getRuleContexts(Function_decContext.class); + } + + public Function_decContext function_dec(int i) { + return getRuleContext(Function_decContext.class, i); + } + + public List term() { + return getRuleContexts(TermContext.class); + } + + public TermContext term(int i) { + return getRuleContext(TermContext.class, i); + } + + public Cmd_defineFunsRecContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_defineFunsRec; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_defineFunsRec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_defineFunsRec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_defineFunsRec(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_defineFunsRecContext cmd_defineFunsRec() throws RecognitionException { + Cmd_defineFunsRecContext _localctx = new Cmd_defineFunsRecContext(_ctx, getState()); + enterRule(_localctx, 108, RULE_cmd_defineFunsRec); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(736); + match(CMD_DefineFunsRec); + setState(737); + match(ParOpen); + setState(739); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(738); + function_dec(); + } + } + setState(741); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(743); + match(ParClose); + setState(744); + match(ParOpen); + setState(746); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(745); + term(); + } + } + setState(748); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536870756L) != 0) + || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 140737488355343L) != 0)); + setState(750); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_defineSortContext extends ParserRuleContext { + public TerminalNode CMD_DefineSort() { + return getToken(Smtlibv2Parser.CMD_DefineSort, 0); + } + + public List symbol() { + return getRuleContexts(SymbolContext.class); + } + + public SymbolContext symbol(int i) { + return getRuleContext(SymbolContext.class, i); + } + + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public SortContext sort() { + return getRuleContext(SortContext.class, 0); + } + + public Cmd_defineSortContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_defineSort; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_defineSort(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_defineSort(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_defineSort(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_defineSortContext cmd_defineSort() throws RecognitionException { + Cmd_defineSortContext _localctx = new Cmd_defineSortContext(_ctx, getState()); + enterRule(_localctx, 110, RULE_cmd_defineSort); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(752); + match(CMD_DefineSort); + setState(753); + symbol(); + setState(754); + match(ParOpen); + setState(758); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862784L) != 0) + || _la == UndefinedSymbol) { + { + { + setState(755); + symbol(); + } + } + setState(760); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(761); + match(ParClose); + setState(762); + sort(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_echoContext extends ParserRuleContext { + public TerminalNode CMD_Echo() { + return getToken(Smtlibv2Parser.CMD_Echo, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Cmd_echoContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_echo; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterCmd_echo(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCmd_echo(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_echo(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_echoContext cmd_echo() throws RecognitionException { + Cmd_echoContext _localctx = new Cmd_echoContext(_ctx, getState()); + enterRule(_localctx, 112, RULE_cmd_echo); + try { + enterOuterAlt(_localctx, 1); + { + setState(764); + match(CMD_Echo); + setState(765); + string(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_exitContext extends ParserRuleContext { + public TerminalNode CMD_Exit() { + return getToken(Smtlibv2Parser.CMD_Exit, 0); + } + + public Cmd_exitContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_exit; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterCmd_exit(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCmd_exit(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_exit(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_exitContext cmd_exit() throws RecognitionException { + Cmd_exitContext _localctx = new Cmd_exitContext(_ctx, getState()); + enterRule(_localctx, 114, RULE_cmd_exit); + try { + enterOuterAlt(_localctx, 1); + { + setState(767); + match(CMD_Exit); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getAssertionsContext extends ParserRuleContext { + public TerminalNode CMD_GetAssertions() { + return getToken(Smtlibv2Parser.CMD_GetAssertions, 0); + } + + public Cmd_getAssertionsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getAssertions; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getAssertions(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_getAssertions(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getAssertions(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getAssertionsContext cmd_getAssertions() throws RecognitionException { + Cmd_getAssertionsContext _localctx = new Cmd_getAssertionsContext(_ctx, getState()); + enterRule(_localctx, 116, RULE_cmd_getAssertions); + try { + enterOuterAlt(_localctx, 1); + { + setState(769); + match(CMD_GetAssertions); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getAssignmentContext extends ParserRuleContext { + public TerminalNode CMD_GetAssignment() { + return getToken(Smtlibv2Parser.CMD_GetAssignment, 0); + } + + public Cmd_getAssignmentContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getAssignment; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getAssignment(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_getAssignment(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getAssignment(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getAssignmentContext cmd_getAssignment() throws RecognitionException { + Cmd_getAssignmentContext _localctx = new Cmd_getAssignmentContext(_ctx, getState()); + enterRule(_localctx, 118, RULE_cmd_getAssignment); + try { + enterOuterAlt(_localctx, 1); + { + setState(771); + match(CMD_GetAssignment); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getInfoContext extends ParserRuleContext { + public TerminalNode CMD_GetInfo() { + return getToken(Smtlibv2Parser.CMD_GetInfo, 0); + } + + public Info_flagContext info_flag() { + return getRuleContext(Info_flagContext.class, 0); + } + + public Cmd_getInfoContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getInfo; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getInfo(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCmd_getInfo(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getInfo(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getInfoContext cmd_getInfo() throws RecognitionException { + Cmd_getInfoContext _localctx = new Cmd_getInfoContext(_ctx, getState()); + enterRule(_localctx, 120, RULE_cmd_getInfo); + try { + enterOuterAlt(_localctx, 1); + { + setState(773); + match(CMD_GetInfo); + setState(774); + info_flag(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getModelContext extends ParserRuleContext { + public TerminalNode CMD_GetModel() { + return getToken(Smtlibv2Parser.CMD_GetModel, 0); + } + + public Cmd_getModelContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getModel; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getModel(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_getModel(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getModel(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getModelContext cmd_getModel() throws RecognitionException { + Cmd_getModelContext _localctx = new Cmd_getModelContext(_ctx, getState()); + enterRule(_localctx, 122, RULE_cmd_getModel); + try { + enterOuterAlt(_localctx, 1); + { + setState(776); + match(CMD_GetModel); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getOptionContext extends ParserRuleContext { + public TerminalNode CMD_GetOption() { + return getToken(Smtlibv2Parser.CMD_GetOption, 0); + } + + public KeywordContext keyword() { + return getRuleContext(KeywordContext.class, 0); + } + + public Cmd_getOptionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getOption; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getOption(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_getOption(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getOption(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getOptionContext cmd_getOption() throws RecognitionException { + Cmd_getOptionContext _localctx = new Cmd_getOptionContext(_ctx, getState()); + enterRule(_localctx, 124, RULE_cmd_getOption); + try { + enterOuterAlt(_localctx, 1); + { + setState(778); + match(CMD_GetOption); + setState(779); + keyword(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getProofContext extends ParserRuleContext { + public TerminalNode CMD_GetProof() { + return getToken(Smtlibv2Parser.CMD_GetProof, 0); + } + + public Cmd_getProofContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getProof; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getProof(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_getProof(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getProof(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getProofContext cmd_getProof() throws RecognitionException { + Cmd_getProofContext _localctx = new Cmd_getProofContext(_ctx, getState()); + enterRule(_localctx, 126, RULE_cmd_getProof); + try { + enterOuterAlt(_localctx, 1); + { + setState(781); + match(CMD_GetProof); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getUnsatAssumptionsContext extends ParserRuleContext { + public TerminalNode CMD_GetUnsatAssumptions() { + return getToken(Smtlibv2Parser.CMD_GetUnsatAssumptions, 0); + } + + public Cmd_getUnsatAssumptionsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getUnsatAssumptions; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getUnsatAssumptions(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_getUnsatAssumptions(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getUnsatAssumptions(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getUnsatAssumptionsContext cmd_getUnsatAssumptions() + throws RecognitionException { + Cmd_getUnsatAssumptionsContext _localctx = new Cmd_getUnsatAssumptionsContext(_ctx, getState()); + enterRule(_localctx, 128, RULE_cmd_getUnsatAssumptions); + try { + enterOuterAlt(_localctx, 1); + { + setState(783); + match(CMD_GetUnsatAssumptions); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getUnsatCoreContext extends ParserRuleContext { + public TerminalNode CMD_GetUnsatCore() { + return getToken(Smtlibv2Parser.CMD_GetUnsatCore, 0); + } + + public Cmd_getUnsatCoreContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getUnsatCore; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getUnsatCore(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_getUnsatCore(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getUnsatCore(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getUnsatCoreContext cmd_getUnsatCore() throws RecognitionException { + Cmd_getUnsatCoreContext _localctx = new Cmd_getUnsatCoreContext(_ctx, getState()); + enterRule(_localctx, 130, RULE_cmd_getUnsatCore); + try { + enterOuterAlt(_localctx, 1); + { + setState(785); + match(CMD_GetUnsatCore); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_getValueContext extends ParserRuleContext { + public TerminalNode CMD_GetValue() { + return getToken(Smtlibv2Parser.CMD_GetValue, 0); + } + + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List term() { + return getRuleContexts(TermContext.class); + } + + public TermContext term(int i) { + return getRuleContext(TermContext.class, i); + } + + public Cmd_getValueContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_getValue; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_getValue(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_getValue(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_getValue(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_getValueContext cmd_getValue() throws RecognitionException { + Cmd_getValueContext _localctx = new Cmd_getValueContext(_ctx, getState()); + enterRule(_localctx, 132, RULE_cmd_getValue); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(787); + match(CMD_GetValue); + setState(788); + match(ParOpen); + setState(790); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(789); + term(); + } + } + setState(792); + _errHandler.sync(this); + _la = _input.LA(1); + } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536870756L) != 0) + || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 140737488355343L) != 0)); + setState(794); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_popContext extends ParserRuleContext { + public TerminalNode CMD_Pop() { + return getToken(Smtlibv2Parser.CMD_Pop, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public Cmd_popContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_pop; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterCmd_pop(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCmd_pop(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_pop(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_popContext cmd_pop() throws RecognitionException { + Cmd_popContext _localctx = new Cmd_popContext(_ctx, getState()); + enterRule(_localctx, 134, RULE_cmd_pop); + try { + enterOuterAlt(_localctx, 1); + { + setState(796); + match(CMD_Pop); + setState(797); + numeral(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_pushContext extends ParserRuleContext { + public TerminalNode CMD_Push() { + return getToken(Smtlibv2Parser.CMD_Push, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public Cmd_pushContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_push; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterCmd_push(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCmd_push(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_push(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_pushContext cmd_push() throws RecognitionException { + Cmd_pushContext _localctx = new Cmd_pushContext(_ctx, getState()); + enterRule(_localctx, 136, RULE_cmd_push); + try { + enterOuterAlt(_localctx, 1); + { + setState(799); + match(CMD_Push); + setState(800); + numeral(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_resetContext extends ParserRuleContext { + public TerminalNode CMD_Reset() { + return getToken(Smtlibv2Parser.CMD_Reset, 0); + } + + public Cmd_resetContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_reset; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterCmd_reset(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCmd_reset(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_reset(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_resetContext cmd_reset() throws RecognitionException { + Cmd_resetContext _localctx = new Cmd_resetContext(_ctx, getState()); + enterRule(_localctx, 138, RULE_cmd_reset); + try { + enterOuterAlt(_localctx, 1); + { + setState(802); + match(CMD_Reset); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_resetAssertionsContext extends ParserRuleContext { + public TerminalNode CMD_ResetAssertions() { + return getToken(Smtlibv2Parser.CMD_ResetAssertions, 0); + } + + public Cmd_resetAssertionsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_resetAssertions; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_resetAssertions(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_resetAssertions(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_resetAssertions(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_resetAssertionsContext cmd_resetAssertions() throws RecognitionException { + Cmd_resetAssertionsContext _localctx = new Cmd_resetAssertionsContext(_ctx, getState()); + enterRule(_localctx, 140, RULE_cmd_resetAssertions); + try { + enterOuterAlt(_localctx, 1); + { + setState(804); + match(CMD_ResetAssertions); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_setInfoContext extends ParserRuleContext { + public TerminalNode CMD_SetInfo() { + return getToken(Smtlibv2Parser.CMD_SetInfo, 0); + } + + public AttributeContext attribute() { + return getRuleContext(AttributeContext.class, 0); + } + + public Cmd_setInfoContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_setInfo; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_setInfo(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCmd_setInfo(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_setInfo(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_setInfoContext cmd_setInfo() throws RecognitionException { + Cmd_setInfoContext _localctx = new Cmd_setInfoContext(_ctx, getState()); + enterRule(_localctx, 142, RULE_cmd_setInfo); + try { + enterOuterAlt(_localctx, 1); + { + setState(806); + match(CMD_SetInfo); + setState(807); + attribute(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_setLogicContext extends ParserRuleContext { + public TerminalNode CMD_SetLogic() { + return getToken(Smtlibv2Parser.CMD_SetLogic, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public Cmd_setLogicContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_setLogic; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_setLogic(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_setLogic(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_setLogic(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_setLogicContext cmd_setLogic() throws RecognitionException { + Cmd_setLogicContext _localctx = new Cmd_setLogicContext(_ctx, getState()); + enterRule(_localctx, 144, RULE_cmd_setLogic); + try { + enterOuterAlt(_localctx, 1); + { + setState(809); + match(CMD_SetLogic); + setState(810); + symbol(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Cmd_setOptionContext extends ParserRuleContext { + public TerminalNode CMD_SetOption() { + return getToken(Smtlibv2Parser.CMD_SetOption, 0); + } + + public OptionContext option() { + return getRuleContext(OptionContext.class, 0); + } + + public Cmd_setOptionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_cmd_setOption; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCmd_setOption(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCmd_setOption(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCmd_setOption(this); + else return visitor.visitChildren(this); + } + } + + public final Cmd_setOptionContext cmd_setOption() throws RecognitionException { + Cmd_setOptionContext _localctx = new Cmd_setOptionContext(_ctx, getState()); + enterRule(_localctx, 146, RULE_cmd_setOption); + try { + enterOuterAlt(_localctx, 1); + { + setState(812); + match(CMD_SetOption); + setState(813); + option(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CommandContext extends ParserRuleContext { + public CommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_command; + } + + public CommandContext() {} + + public void copyFrom(CommandContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_modelContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getModelContext cmd_getModel() { + return getRuleContext(Cmd_getModelContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_modelContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterGet_model(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitGet_model(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_model(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Decl_datasContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_declareDatatypesContext cmd_declareDatatypes() { + return getRuleContext(Cmd_declareDatatypesContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Decl_datasContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDecl_datas(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDecl_datas(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDecl_datas(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Decl_sortContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_declareSortContext cmd_declareSort() { + return getRuleContext(Cmd_declareSortContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Decl_sortContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDecl_sort(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDecl_sort(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDecl_sort(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class EchoContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_echoContext cmd_echo() { + return getRuleContext(Cmd_echoContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public EchoContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterEcho(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitEcho(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitEcho(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_unsat_assumeContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getUnsatAssumptionsContext cmd_getUnsatAssumptions() { + return getRuleContext(Cmd_getUnsatAssumptionsContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_unsat_assumeContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_unsat_assume(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_unsat_assume(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_unsat_assume(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Decl_dataContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_declareDatatypeContext cmd_declareDatatype() { + return getRuleContext(Cmd_declareDatatypeContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Decl_dataContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDecl_data(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDecl_data(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDecl_data(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class PopContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_popContext cmd_pop() { + return getRuleContext(Cmd_popContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public PopContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterPop(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitPop(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPop(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Def_sortContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_defineSortContext cmd_defineSort() { + return getRuleContext(Cmd_defineSortContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Def_sortContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDef_sort(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDef_sort(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDef_sort(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class AssertContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_assertContext cmd_assert() { + return getRuleContext(Cmd_assertContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public AssertContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterAssert(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitAssert(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAssert(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Def_fun_recContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_defineFunRecContext cmd_defineFunRec() { + return getRuleContext(Cmd_defineFunRecContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Def_fun_recContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterDef_fun_rec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDef_fun_rec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDef_fun_rec(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Def_funContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_defineFunContext cmd_defineFun() { + return getRuleContext(Cmd_defineFunContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Def_funContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDef_fun(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDef_fun(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDef_fun(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_assertContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getAssertionsContext cmd_getAssertions() { + return getRuleContext(Cmd_getAssertionsContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_assertContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterGet_assert(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitGet_assert(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_assert(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Decl_constContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_declareConstContext cmd_declareConst() { + return getRuleContext(Cmd_declareConstContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Decl_constContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDecl_const(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDecl_const(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDecl_const(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Set_logicContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_setLogicContext cmd_setLogic() { + return getRuleContext(Cmd_setLogicContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Set_logicContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterSet_logic(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitSet_logic(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSet_logic(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Check_assumeContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_checkSatAssumingContext cmd_checkSatAssuming() { + return getRuleContext(Cmd_checkSatAssumingContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Check_assumeContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCheck_assume(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCheck_assume(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCheck_assume(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Reset_assertContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_resetAssertionsContext cmd_resetAssertions() { + return getRuleContext(Cmd_resetAssertionsContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Reset_assertContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterReset_assert(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitReset_assert(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitReset_assert(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class CheckContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_checkSatContext cmd_checkSat() { + return getRuleContext(Cmd_checkSatContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public CheckContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterCheck(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitCheck(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCheck(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_assignContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getAssignmentContext cmd_getAssignment() { + return getRuleContext(Cmd_getAssignmentContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_assignContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterGet_assign(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitGet_assign(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_assign(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class PushContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_pushContext cmd_push() { + return getRuleContext(Cmd_pushContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public PushContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterPush(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitPush(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPush(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Def_funs_recContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_defineFunsRecContext cmd_defineFunsRec() { + return getRuleContext(Cmd_defineFunsRecContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Def_funs_recContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterDef_funs_rec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitDef_funs_rec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDef_funs_rec(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class ExitContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_exitContext cmd_exit() { + return getRuleContext(Cmd_exitContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public ExitContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterExit(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitExit(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitExit(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_optionContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getOptionContext cmd_getOption() { + return getRuleContext(Cmd_getOptionContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_optionContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterGet_option(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitGet_option(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_option(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_valContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getValueContext cmd_getValue() { + return getRuleContext(Cmd_getValueContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_valContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterGet_val(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitGet_val(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_val(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Set_optionContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_setOptionContext cmd_setOption() { + return getRuleContext(Cmd_setOptionContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Set_optionContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterSet_option(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitSet_option(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSet_option(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Decl_funContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_declareFunContext cmd_declareFun() { + return getRuleContext(Cmd_declareFunContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Decl_funContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDecl_fun(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDecl_fun(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDecl_fun(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_proofContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getProofContext cmd_getProof() { + return getRuleContext(Cmd_getProofContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_proofContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterGet_proof(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitGet_proof(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_proof(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_unsat_coreContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getUnsatCoreContext cmd_getUnsatCore() { + return getRuleContext(Cmd_getUnsatCoreContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_unsat_coreContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_unsat_core(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_unsat_core(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_unsat_core(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class ResetContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_resetContext cmd_reset() { + return getRuleContext(Cmd_resetContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public ResetContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterReset(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitReset(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitReset(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_infoContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_getInfoContext cmd_getInfo() { + return getRuleContext(Cmd_getInfoContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Get_infoContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterGet_info(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitGet_info(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_info(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class SetInfoContext extends CommandContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_setInfoContext cmd_setInfo() { + return getRuleContext(Cmd_setInfoContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public SetInfoContext(CommandContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterSetInfo(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitSetInfo(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitSetInfo(this); + else return visitor.visitChildren(this); + } + } + + public final CommandContext command() throws RecognitionException { + CommandContext _localctx = new CommandContext(_ctx, getState()); + enterRule(_localctx, 148, RULE_command); + try { + setState(935); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 61, _ctx)) { + case 1: + _localctx = new AssertContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(815); + match(ParOpen); + setState(816); + cmd_assert(); + setState(817); + match(ParClose); + } + break; + case 2: + _localctx = new CheckContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(819); + match(ParOpen); + setState(820); + cmd_checkSat(); + setState(821); + match(ParClose); + } + break; + case 3: + _localctx = new Check_assumeContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(823); + match(ParOpen); + setState(824); + cmd_checkSatAssuming(); + setState(825); + match(ParClose); + } + break; + case 4: + _localctx = new Decl_constContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(827); + match(ParOpen); + setState(828); + cmd_declareConst(); + setState(829); + match(ParClose); + } + break; + case 5: + _localctx = new Decl_dataContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(831); + match(ParOpen); + setState(832); + cmd_declareDatatype(); + setState(833); + match(ParClose); + } + break; + case 6: + _localctx = new Decl_datasContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(835); + match(ParOpen); + setState(836); + cmd_declareDatatypes(); + setState(837); + match(ParClose); + } + break; + case 7: + _localctx = new Decl_funContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(839); + match(ParOpen); + setState(840); + cmd_declareFun(); + setState(841); + match(ParClose); + } + break; + case 8: + _localctx = new Decl_sortContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(843); + match(ParOpen); + setState(844); + cmd_declareSort(); + setState(845); + match(ParClose); + } + break; + case 9: + _localctx = new Def_funContext(_localctx); + enterOuterAlt(_localctx, 9); + { + setState(847); + match(ParOpen); + setState(848); + cmd_defineFun(); + setState(849); + match(ParClose); + } + break; + case 10: + _localctx = new Def_fun_recContext(_localctx); + enterOuterAlt(_localctx, 10); + { + setState(851); + match(ParOpen); + setState(852); + cmd_defineFunRec(); + setState(853); + match(ParClose); + } + break; + case 11: + _localctx = new Def_funs_recContext(_localctx); + enterOuterAlt(_localctx, 11); + { + setState(855); + match(ParOpen); + setState(856); + cmd_defineFunsRec(); + setState(857); + match(ParClose); + } + break; + case 12: + _localctx = new Def_sortContext(_localctx); + enterOuterAlt(_localctx, 12); + { + setState(859); + match(ParOpen); + setState(860); + cmd_defineSort(); + setState(861); + match(ParClose); + } + break; + case 13: + _localctx = new EchoContext(_localctx); + enterOuterAlt(_localctx, 13); + { + setState(863); + match(ParOpen); + setState(864); + cmd_echo(); + setState(865); + match(ParClose); + } + break; + case 14: + _localctx = new ExitContext(_localctx); + enterOuterAlt(_localctx, 14); + { + setState(867); + match(ParOpen); + setState(868); + cmd_exit(); + setState(869); + match(ParClose); + } + break; + case 15: + _localctx = new Get_assertContext(_localctx); + enterOuterAlt(_localctx, 15); + { + setState(871); + match(ParOpen); + setState(872); + cmd_getAssertions(); + setState(873); + match(ParClose); + } + break; + case 16: + _localctx = new Get_assignContext(_localctx); + enterOuterAlt(_localctx, 16); + { + setState(875); + match(ParOpen); + setState(876); + cmd_getAssignment(); + setState(877); + match(ParClose); + } + break; + case 17: + _localctx = new Get_infoContext(_localctx); + enterOuterAlt(_localctx, 17); + { + setState(879); + match(ParOpen); + setState(880); + cmd_getInfo(); + setState(881); + match(ParClose); + } + break; + case 18: + _localctx = new Get_modelContext(_localctx); + enterOuterAlt(_localctx, 18); + { + setState(883); + match(ParOpen); + setState(884); + cmd_getModel(); + setState(885); + match(ParClose); + } + break; + case 19: + _localctx = new Get_optionContext(_localctx); + enterOuterAlt(_localctx, 19); + { + setState(887); + match(ParOpen); + setState(888); + cmd_getOption(); + setState(889); + match(ParClose); + } + break; + case 20: + _localctx = new Get_proofContext(_localctx); + enterOuterAlt(_localctx, 20); + { + setState(891); + match(ParOpen); + setState(892); + cmd_getProof(); + setState(893); + match(ParClose); + } + break; + case 21: + _localctx = new Get_unsat_assumeContext(_localctx); + enterOuterAlt(_localctx, 21); + { + setState(895); + match(ParOpen); + setState(896); + cmd_getUnsatAssumptions(); + setState(897); + match(ParClose); + } + break; + case 22: + _localctx = new Get_unsat_coreContext(_localctx); + enterOuterAlt(_localctx, 22); + { + setState(899); + match(ParOpen); + setState(900); + cmd_getUnsatCore(); + setState(901); + match(ParClose); + } + break; + case 23: + _localctx = new Get_valContext(_localctx); + enterOuterAlt(_localctx, 23); + { + setState(903); + match(ParOpen); + setState(904); + cmd_getValue(); + setState(905); + match(ParClose); + } + break; + case 24: + _localctx = new PopContext(_localctx); + enterOuterAlt(_localctx, 24); + { + setState(907); + match(ParOpen); + setState(908); + cmd_pop(); + setState(909); + match(ParClose); + } + break; + case 25: + _localctx = new PushContext(_localctx); + enterOuterAlt(_localctx, 25); + { + setState(911); + match(ParOpen); + setState(912); + cmd_push(); + setState(913); + match(ParClose); + } + break; + case 26: + _localctx = new ResetContext(_localctx); + enterOuterAlt(_localctx, 26); + { + setState(915); + match(ParOpen); + setState(916); + cmd_reset(); + setState(917); + match(ParClose); + } + break; + case 27: + _localctx = new Reset_assertContext(_localctx); + enterOuterAlt(_localctx, 27); + { + setState(919); + match(ParOpen); + setState(920); + cmd_resetAssertions(); + setState(921); + match(ParClose); + } + break; + case 28: + _localctx = new SetInfoContext(_localctx); + enterOuterAlt(_localctx, 28); + { + setState(923); + match(ParOpen); + setState(924); + cmd_setInfo(); + setState(925); + match(ParClose); + } + break; + case 29: + _localctx = new Set_logicContext(_localctx); + enterOuterAlt(_localctx, 29); + { + setState(927); + match(ParOpen); + setState(928); + cmd_setLogic(); + setState(929); + match(ParClose); + } + break; + case 30: + _localctx = new Set_optionContext(_localctx); + enterOuterAlt(_localctx, 30); + { + setState(931); + match(ParOpen); + setState(932); + cmd_setOption(); + setState(933); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class B_valueContext extends ParserRuleContext { + public TerminalNode PS_True() { + return getToken(Smtlibv2Parser.PS_True, 0); + } + + public TerminalNode PS_False() { + return getToken(Smtlibv2Parser.PS_False, 0); + } + + public B_valueContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_b_value; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterB_value(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitB_value(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitB_value(this); + else return visitor.visitChildren(this); + } + } + + public final B_valueContext b_value() throws RecognitionException { + B_valueContext _localctx = new B_valueContext(_ctx, getState()); + enterRule(_localctx, 150, RULE_b_value); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(937); + _la = _input.LA(1); + if (!(_la == PS_False || _la == PS_True)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class OptionContext extends ParserRuleContext { + public OptionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_option; + } + + public OptionContext() {} + + public void copyFrom(OptionContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Rand_seedContext extends OptionContext { + public TerminalNode PK_RandomSeed() { + return getToken(Smtlibv2Parser.PK_RandomSeed, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public Rand_seedContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterRand_seed(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitRand_seed(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitRand_seed(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class InteractiveContext extends OptionContext { + public TerminalNode PK_InteractiveMode() { + return getToken(Smtlibv2Parser.PK_InteractiveMode, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public InteractiveContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterInteractive(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitInteractive(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInteractive(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class GlobalContext extends OptionContext { + public TerminalNode PK_GlobalDeclarations() { + return getToken(Smtlibv2Parser.PK_GlobalDeclarations, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public GlobalContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterGlobal(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitGlobal(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGlobal(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Prod_assertContext extends OptionContext { + public TerminalNode PK_ProduceAssertions() { + return getToken(Smtlibv2Parser.PK_ProduceAssertions, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public Prod_assertContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterProd_assert(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitProd_assert(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitProd_assert(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Opt_attrContext extends OptionContext { + public AttributeContext attribute() { + return getRuleContext(AttributeContext.class, 0); + } + + public Opt_attrContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterOpt_attr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitOpt_attr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitOpt_attr(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class ReproContext extends OptionContext { + public TerminalNode PK_ReproducibleResourceLimit() { + return getToken(Smtlibv2Parser.PK_ReproducibleResourceLimit, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public ReproContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterRepro(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitRepro(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitRepro(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class VerboseContext extends OptionContext { + public TerminalNode PK_Verbosity() { + return getToken(Smtlibv2Parser.PK_Verbosity, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public VerboseContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterVerbose(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitVerbose(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitVerbose(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Print_succContext extends OptionContext { + public TerminalNode PK_PrintSuccess() { + return getToken(Smtlibv2Parser.PK_PrintSuccess, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public Print_succContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterPrint_succ(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitPrint_succ(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitPrint_succ(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Prod_assignContext extends OptionContext { + public TerminalNode PK_ProduceAssignments() { + return getToken(Smtlibv2Parser.PK_ProduceAssignments, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public Prod_assignContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterProd_assign(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitProd_assign(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitProd_assign(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Prod_unsat_assumeContext extends OptionContext { + public TerminalNode PK_ProduceUnsatAssumptions() { + return getToken(Smtlibv2Parser.PK_ProduceUnsatAssumptions, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public Prod_unsat_assumeContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterProd_unsat_assume(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitProd_unsat_assume(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitProd_unsat_assume(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Prod_unsat_coreContext extends OptionContext { + public TerminalNode PK_ProduceUnsatCores() { + return getToken(Smtlibv2Parser.PK_ProduceUnsatCores, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public Prod_unsat_coreContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterProd_unsat_core(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitProd_unsat_core(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitProd_unsat_core(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class DiagnoseContext extends OptionContext { + public TerminalNode PK_DiagnosticOutputChannel() { + return getToken(Smtlibv2Parser.PK_DiagnosticOutputChannel, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public DiagnoseContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterDiagnose(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitDiagnose(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitDiagnose(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Prod_proofsContext extends OptionContext { + public TerminalNode PK_ProduceProofs() { + return getToken(Smtlibv2Parser.PK_ProduceProofs, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public Prod_proofsContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterProd_proofs(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitProd_proofs(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitProd_proofs(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Prod_modContext extends OptionContext { + public TerminalNode PK_ProduceModels() { + return getToken(Smtlibv2Parser.PK_ProduceModels, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public Prod_modContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterProd_mod(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitProd_mod(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitProd_mod(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Reg_outContext extends OptionContext { + public TerminalNode PK_RegularOutputChannel() { + return getToken(Smtlibv2Parser.PK_RegularOutputChannel, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Reg_outContext(OptionContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterReg_out(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitReg_out(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitReg_out(this); + else return visitor.visitChildren(this); + } + } + + public final OptionContext option() throws RecognitionException { + OptionContext _localctx = new OptionContext(_ctx, getState()); + enterRule(_localctx, 152, RULE_option); + try { + setState(968); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 62, _ctx)) { + case 1: + _localctx = new DiagnoseContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(939); + match(PK_DiagnosticOutputChannel); + setState(940); + string(); + } + break; + case 2: + _localctx = new GlobalContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(941); + match(PK_GlobalDeclarations); + setState(942); + b_value(); + } + break; + case 3: + _localctx = new InteractiveContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(943); + match(PK_InteractiveMode); + setState(944); + b_value(); + } + break; + case 4: + _localctx = new Print_succContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(945); + match(PK_PrintSuccess); + setState(946); + b_value(); + } + break; + case 5: + _localctx = new Prod_assertContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(947); + match(PK_ProduceAssertions); + setState(948); + b_value(); + } + break; + case 6: + _localctx = new Prod_assignContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(949); + match(PK_ProduceAssignments); + setState(950); + b_value(); + } + break; + case 7: + _localctx = new Prod_modContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(951); + match(PK_ProduceModels); + setState(952); + b_value(); + } + break; + case 8: + _localctx = new Prod_proofsContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(953); + match(PK_ProduceProofs); + setState(954); + b_value(); + } + break; + case 9: + _localctx = new Prod_unsat_assumeContext(_localctx); + enterOuterAlt(_localctx, 9); + { + setState(955); + match(PK_ProduceUnsatAssumptions); + setState(956); + b_value(); + } + break; + case 10: + _localctx = new Prod_unsat_coreContext(_localctx); + enterOuterAlt(_localctx, 10); + { + setState(957); + match(PK_ProduceUnsatCores); + setState(958); + b_value(); + } + break; + case 11: + _localctx = new Rand_seedContext(_localctx); + enterOuterAlt(_localctx, 11); + { + setState(959); + match(PK_RandomSeed); + setState(960); + numeral(); + } + break; + case 12: + _localctx = new Reg_outContext(_localctx); + enterOuterAlt(_localctx, 12); + { + setState(961); + match(PK_RegularOutputChannel); + setState(962); + string(); + } + break; + case 13: + _localctx = new ReproContext(_localctx); + enterOuterAlt(_localctx, 13); + { + setState(963); + match(PK_ReproducibleResourceLimit); + setState(964); + numeral(); + } + break; + case 14: + _localctx = new VerboseContext(_localctx); + enterOuterAlt(_localctx, 14); + { + setState(965); + match(PK_Verbosity); + setState(966); + numeral(); + } + break; + case 15: + _localctx = new Opt_attrContext(_localctx); + enterOuterAlt(_localctx, 15); + { + setState(967); + attribute(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_flagContext extends ParserRuleContext { + public Info_flagContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_info_flag; + } + + public Info_flagContext() {} + + public void copyFrom(Info_flagContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class R_unknownContext extends Info_flagContext { + public TerminalNode PK_ReasonUnknown() { + return getToken(Smtlibv2Parser.PK_ReasonUnknown, 0); + } + + public R_unknownContext(Info_flagContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterR_unknown(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitR_unknown(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitR_unknown(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Assert_stackContext extends Info_flagContext { + public TerminalNode PK_AssertionStackLevels() { + return getToken(Smtlibv2Parser.PK_AssertionStackLevels, 0); + } + + public Assert_stackContext(Info_flagContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterAssert_stack(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitAssert_stack(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAssert_stack(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class NameContext extends Info_flagContext { + public TerminalNode PK_Name() { + return getToken(Smtlibv2Parser.PK_Name, 0); + } + + public NameContext(Info_flagContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterName(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitName(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitName(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class ErrorContext extends Info_flagContext { + public TerminalNode PK_ErrorBehaviour() { + return getToken(Smtlibv2Parser.PK_ErrorBehaviour, 0); + } + + public ErrorContext(Info_flagContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterError(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitError(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitError(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class All_statContext extends Info_flagContext { + public TerminalNode PK_AllStatistics() { + return getToken(Smtlibv2Parser.PK_AllStatistics, 0); + } + + public All_statContext(Info_flagContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterAll_stat(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitAll_stat(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAll_stat(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class VersionContext extends Info_flagContext { + public TerminalNode PK_Version() { + return getToken(Smtlibv2Parser.PK_Version, 0); + } + + public VersionContext(Info_flagContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterVersion(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitVersion(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitVersion(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_keyContext extends Info_flagContext { + public KeywordContext keyword() { + return getRuleContext(KeywordContext.class, 0); + } + + public Info_keyContext(Info_flagContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterInfo_key(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitInfo_key(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInfo_key(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class AuthorsContext extends Info_flagContext { + public TerminalNode PK_Authors() { + return getToken(Smtlibv2Parser.PK_Authors, 0); + } + + public AuthorsContext(Info_flagContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterAuthors(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitAuthors(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitAuthors(this); + else return visitor.visitChildren(this); + } + } + + public final Info_flagContext info_flag() throws RecognitionException { + Info_flagContext _localctx = new Info_flagContext(_ctx, getState()); + enterRule(_localctx, 154, RULE_info_flag); + try { + setState(978); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 63, _ctx)) { + case 1: + _localctx = new All_statContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(970); + match(PK_AllStatistics); + } + break; + case 2: + _localctx = new Assert_stackContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(971); + match(PK_AssertionStackLevels); + } + break; + case 3: + _localctx = new AuthorsContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(972); + match(PK_Authors); + } + break; + case 4: + _localctx = new ErrorContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(973); + match(PK_ErrorBehaviour); + } + break; + case 5: + _localctx = new NameContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(974); + match(PK_Name); + } + break; + case 6: + _localctx = new R_unknownContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(975); + match(PK_ReasonUnknown); + } + break; + case 7: + _localctx = new VersionContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(976); + match(PK_Version); + } + break; + case 8: + _localctx = new Info_keyContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(977); + keyword(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Error_behaviourContext extends ParserRuleContext { + public TerminalNode PS_ImmediateExit() { + return getToken(Smtlibv2Parser.PS_ImmediateExit, 0); + } + + public TerminalNode PS_ContinuedExecution() { + return getToken(Smtlibv2Parser.PS_ContinuedExecution, 0); + } + + public Error_behaviourContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_error_behaviour; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterError_behaviour(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitError_behaviour(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitError_behaviour(this); + else return visitor.visitChildren(this); + } + } + + public final Error_behaviourContext error_behaviour() throws RecognitionException { + Error_behaviourContext _localctx = new Error_behaviourContext(_ctx, getState()); + enterRule(_localctx, 156, RULE_error_behaviour); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(980); + _la = _input.LA(1); + if (!(_la == PS_ContinuedExecution || _la == PS_ImmediateExit)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Reason_unknownContext extends ParserRuleContext { + public Reason_unknownContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_reason_unknown; + } + + public Reason_unknownContext() {} + + public void copyFrom(Reason_unknownContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class MemoutContext extends Reason_unknownContext { + public TerminalNode PS_Memout() { + return getToken(Smtlibv2Parser.PS_Memout, 0); + } + + public MemoutContext(Reason_unknownContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterMemout(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitMemout(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitMemout(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class IncompContext extends Reason_unknownContext { + public TerminalNode PS_Incomplete() { + return getToken(Smtlibv2Parser.PS_Incomplete, 0); + } + + public IncompContext(Reason_unknownContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterIncomp(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitIncomp(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitIncomp(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class R_unnown_s_exprContext extends Reason_unknownContext { + public S_exprContext s_expr() { + return getRuleContext(S_exprContext.class, 0); + } + + public R_unnown_s_exprContext(Reason_unknownContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterR_unnown_s_expr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitR_unnown_s_expr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitR_unnown_s_expr(this); + else return visitor.visitChildren(this); + } + } + + public final Reason_unknownContext reason_unknown() throws RecognitionException { + Reason_unknownContext _localctx = new Reason_unknownContext(_ctx, getState()); + enterRule(_localctx, 158, RULE_reason_unknown); + try { + setState(985); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 64, _ctx)) { + case 1: + _localctx = new MemoutContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(982); + match(PS_Memout); + } + break; + case 2: + _localctx = new IncompContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(983); + match(PS_Incomplete); + } + break; + case 3: + _localctx = new R_unnown_s_exprContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(984); + s_expr(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Model_responseContext extends ParserRuleContext { + public Model_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_model_response; + } + + public Model_responseContext() {} + + public void copyFrom(Model_responseContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_def_funContext extends Model_responseContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_defineFunContext cmd_defineFun() { + return getRuleContext(Cmd_defineFunContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Resp_def_funContext(Model_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_def_fun(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_def_fun(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_def_fun(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_def_fun_recContext extends Model_responseContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_defineFunRecContext cmd_defineFunRec() { + return getRuleContext(Cmd_defineFunRecContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Resp_def_fun_recContext(Model_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_def_fun_rec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_def_fun_rec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_def_fun_rec(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_def_funs_recContext extends Model_responseContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public Cmd_defineFunsRecContext cmd_defineFunsRec() { + return getRuleContext(Cmd_defineFunsRecContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Resp_def_funs_recContext(Model_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_def_funs_rec(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_def_funs_rec(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_def_funs_rec(this); + else return visitor.visitChildren(this); + } + } + + public final Model_responseContext model_response() throws RecognitionException { + Model_responseContext _localctx = new Model_responseContext(_ctx, getState()); + enterRule(_localctx, 160, RULE_model_response); + try { + setState(999); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 65, _ctx)) { + case 1: + _localctx = new Resp_def_funContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(987); + match(ParOpen); + setState(988); + cmd_defineFun(); + setState(989); + match(ParClose); + } + break; + case 2: + _localctx = new Resp_def_fun_recContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(991); + match(ParOpen); + setState(992); + cmd_defineFunRec(); + setState(993); + match(ParClose); + } + break; + case 3: + _localctx = new Resp_def_funs_recContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(995); + match(ParOpen); + setState(996); + cmd_defineFunsRec(); + setState(997); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_responseContext extends ParserRuleContext { + public Info_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_info_response; + } + + public Info_responseContext() {} + + public void copyFrom(Info_responseContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_authorsContext extends Info_responseContext { + public TerminalNode PK_Authors() { + return getToken(Smtlibv2Parser.PK_Authors, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Info_authorsContext(Info_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterInfo_authors(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitInfo_authors(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInfo_authors(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_versionContext extends Info_responseContext { + public TerminalNode PK_Version() { + return getToken(Smtlibv2Parser.PK_Version, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Info_versionContext(Info_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterInfo_version(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitInfo_version(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInfo_version(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_attrContext extends Info_responseContext { + public AttributeContext attribute() { + return getRuleContext(AttributeContext.class, 0); + } + + public Info_attrContext(Info_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterInfo_attr(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitInfo_attr(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInfo_attr(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_errorContext extends Info_responseContext { + public TerminalNode PK_ErrorBehaviour() { + return getToken(Smtlibv2Parser.PK_ErrorBehaviour, 0); + } + + public Error_behaviourContext error_behaviour() { + return getRuleContext(Error_behaviourContext.class, 0); + } + + public Info_errorContext(Info_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterInfo_error(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitInfo_error(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInfo_error(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_assert_stackContext extends Info_responseContext { + public TerminalNode PK_AssertionStackLevels() { + return getToken(Smtlibv2Parser.PK_AssertionStackLevels, 0); + } + + public NumeralContext numeral() { + return getRuleContext(NumeralContext.class, 0); + } + + public Info_assert_stackContext(Info_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterInfo_assert_stack(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitInfo_assert_stack(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInfo_assert_stack(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_r_unknownContext extends Info_responseContext { + public TerminalNode PK_ReasonUnknown() { + return getToken(Smtlibv2Parser.PK_ReasonUnknown, 0); + } + + public Reason_unknownContext reason_unknown() { + return getRuleContext(Reason_unknownContext.class, 0); + } + + public Info_r_unknownContext(Info_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterInfo_r_unknown(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitInfo_r_unknown(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInfo_r_unknown(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Info_nameContext extends Info_responseContext { + public TerminalNode PK_Name() { + return getToken(Smtlibv2Parser.PK_Name, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Info_nameContext(Info_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterInfo_name(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitInfo_name(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitInfo_name(this); + else return visitor.visitChildren(this); + } + } + + public final Info_responseContext info_response() throws RecognitionException { + Info_responseContext _localctx = new Info_responseContext(_ctx, getState()); + enterRule(_localctx, 162, RULE_info_response); + try { + setState(1014); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 66, _ctx)) { + case 1: + _localctx = new Info_assert_stackContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1001); + match(PK_AssertionStackLevels); + setState(1002); + numeral(); + } + break; + case 2: + _localctx = new Info_authorsContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1003); + match(PK_Authors); + setState(1004); + string(); + } + break; + case 3: + _localctx = new Info_errorContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1005); + match(PK_ErrorBehaviour); + setState(1006); + error_behaviour(); + } + break; + case 4: + _localctx = new Info_nameContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(1007); + match(PK_Name); + setState(1008); + string(); + } + break; + case 5: + _localctx = new Info_r_unknownContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(1009); + match(PK_ReasonUnknown); + setState(1010); + reason_unknown(); + } + break; + case 6: + _localctx = new Info_versionContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(1011); + match(PK_Version); + setState(1012); + string(); + } + break; + case 7: + _localctx = new Info_attrContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(1013); + attribute(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Valuation_pairContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public List term() { + return getRuleContexts(TermContext.class); + } + + public TermContext term(int i) { + return getRuleContext(TermContext.class, i); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Valuation_pairContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_valuation_pair; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterValuation_pair(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitValuation_pair(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitValuation_pair(this); + else return visitor.visitChildren(this); + } + } + + public final Valuation_pairContext valuation_pair() throws RecognitionException { + Valuation_pairContext _localctx = new Valuation_pairContext(_ctx, getState()); + enterRule(_localctx, 164, RULE_valuation_pair); + try { + enterOuterAlt(_localctx, 1); + { + setState(1016); + match(ParOpen); + setState(1017); + term(); + setState(1018); + term(); + setState(1019); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class T_valuation_pairContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public SymbolContext symbol() { + return getRuleContext(SymbolContext.class, 0); + } + + public B_valueContext b_value() { + return getRuleContext(B_valueContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public T_valuation_pairContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_t_valuation_pair; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterT_valuation_pair(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitT_valuation_pair(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitT_valuation_pair(this); + else return visitor.visitChildren(this); + } + } + + public final T_valuation_pairContext t_valuation_pair() throws RecognitionException { + T_valuation_pairContext _localctx = new T_valuation_pairContext(_ctx, getState()); + enterRule(_localctx, 166, RULE_t_valuation_pair); + try { + enterOuterAlt(_localctx, 1); + { + setState(1021); + match(ParOpen); + setState(1022); + symbol(); + setState(1023); + b_value(); + setState(1024); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Check_sat_responseContext extends ParserRuleContext { + public TerminalNode PS_Sat() { + return getToken(Smtlibv2Parser.PS_Sat, 0); + } + + public TerminalNode PS_Unsat() { + return getToken(Smtlibv2Parser.PS_Unsat, 0); + } + + public TerminalNode PS_Unknown() { + return getToken(Smtlibv2Parser.PS_Unknown, 0); + } + + public Check_sat_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_check_sat_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterCheck_sat_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitCheck_sat_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitCheck_sat_response(this); + else return visitor.visitChildren(this); + } + } + + public final Check_sat_responseContext check_sat_response() throws RecognitionException { + Check_sat_responseContext _localctx = new Check_sat_responseContext(_ctx, getState()); + enterRule(_localctx, 168, RULE_check_sat_response); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1026); + _la = _input.LA(1); + if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & 339738624L) != 0))) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Echo_responseContext extends ParserRuleContext { + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public Echo_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_echo_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterEcho_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitEcho_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitEcho_response(this); + else return visitor.visitChildren(this); + } + } + + public final Echo_responseContext echo_response() throws RecognitionException { + Echo_responseContext _localctx = new Echo_responseContext(_ctx, getState()); + enterRule(_localctx, 170, RULE_echo_response); + try { + enterOuterAlt(_localctx, 1); + { + setState(1028); + string(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_assertions_responseContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List term() { + return getRuleContexts(TermContext.class); + } + + public TermContext term(int i) { + return getRuleContext(TermContext.class, i); + } + + public Get_assertions_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_assertions_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_assertions_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_assertions_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_assertions_response(this); + else return visitor.visitChildren(this); + } + } + + public final Get_assertions_responseContext get_assertions_response() + throws RecognitionException { + Get_assertions_responseContext _localctx = new Get_assertions_responseContext(_ctx, getState()); + enterRule(_localctx, 172, RULE_get_assertions_response); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1030); + match(ParOpen); + setState(1034); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536870756L) != 0) + || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 140737488355343L) != 0)) { + { + { + setState(1031); + term(); + } + } + setState(1036); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1037); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_assignment_responseContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List t_valuation_pair() { + return getRuleContexts(T_valuation_pairContext.class); + } + + public T_valuation_pairContext t_valuation_pair(int i) { + return getRuleContext(T_valuation_pairContext.class, i); + } + + public Get_assignment_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_assignment_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_assignment_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_assignment_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_assignment_response(this); + else return visitor.visitChildren(this); + } + } + + public final Get_assignment_responseContext get_assignment_response() + throws RecognitionException { + Get_assignment_responseContext _localctx = new Get_assignment_responseContext(_ctx, getState()); + enterRule(_localctx, 174, RULE_get_assignment_response); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1039); + match(ParOpen); + setState(1043); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == ParOpen) { + { + { + setState(1040); + t_valuation_pair(); + } + } + setState(1045); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1046); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_info_responseContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List info_response() { + return getRuleContexts(Info_responseContext.class); + } + + public Info_responseContext info_response(int i) { + return getRuleContext(Info_responseContext.class, i); + } + + public Get_info_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_info_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_info_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_info_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_info_response(this); + else return visitor.visitChildren(this); + } + } + + public final Get_info_responseContext get_info_response() throws RecognitionException { + Get_info_responseContext _localctx = new Get_info_responseContext(_ctx, getState()); + enterRule(_localctx, 176, RULE_get_info_response); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1048); + match(ParOpen); + setState(1050); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1049); + info_response(); + } + } + setState(1052); + _errHandler.sync(this); + _la = _input.LA(1); + } while (((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 4398046511103L) != 0)); + setState(1054); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_model_responseContext extends ParserRuleContext { + public Get_model_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_model_response; + } + + public Get_model_responseContext() {} + + public void copyFrom(Get_model_responseContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Model_respContext extends Get_model_responseContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List model_response() { + return getRuleContexts(Model_responseContext.class); + } + + public Model_responseContext model_response(int i) { + return getRuleContext(Model_responseContext.class, i); + } + + public Model_respContext(Get_model_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterModel_resp(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitModel_resp(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitModel_resp(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Rs_modelContext extends Get_model_responseContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode RS_Model() { + return getToken(Smtlibv2Parser.RS_Model, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List model_response() { + return getRuleContexts(Model_responseContext.class); + } + + public Model_responseContext model_response(int i) { + return getRuleContext(Model_responseContext.class, i); + } + + public Rs_modelContext(Get_model_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterRs_model(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitRs_model(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitRs_model(this); + else return visitor.visitChildren(this); + } + } + + public final Get_model_responseContext get_model_response() throws RecognitionException { + Get_model_responseContext _localctx = new Get_model_responseContext(_ctx, getState()); + enterRule(_localctx, 178, RULE_get_model_response); + int _la; + try { + setState(1073); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 72, _ctx)) { + case 1: + _localctx = new Rs_modelContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1056); + match(ParOpen); + setState(1057); + match(RS_Model); + setState(1061); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == ParOpen) { + { + { + setState(1058); + model_response(); + } + } + setState(1063); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1064); + match(ParClose); + } + break; + case 2: + _localctx = new Model_respContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1065); + match(ParOpen); + setState(1069); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == ParOpen) { + { + { + setState(1066); + model_response(); + } + } + setState(1071); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1072); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_option_responseContext extends ParserRuleContext { + public Attribute_valueContext attribute_value() { + return getRuleContext(Attribute_valueContext.class, 0); + } + + public Get_option_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_option_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_option_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_option_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_option_response(this); + else return visitor.visitChildren(this); + } + } + + public final Get_option_responseContext get_option_response() throws RecognitionException { + Get_option_responseContext _localctx = new Get_option_responseContext(_ctx, getState()); + enterRule(_localctx, 180, RULE_get_option_response); + try { + enterOuterAlt(_localctx, 1); + { + setState(1075); + attribute_value(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_proof_responseContext extends ParserRuleContext { + public S_exprContext s_expr() { + return getRuleContext(S_exprContext.class, 0); + } + + public Get_proof_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_proof_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_proof_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_proof_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_proof_response(this); + else return visitor.visitChildren(this); + } + } + + public final Get_proof_responseContext get_proof_response() throws RecognitionException { + Get_proof_responseContext _localctx = new Get_proof_responseContext(_ctx, getState()); + enterRule(_localctx, 182, RULE_get_proof_response); + try { + enterOuterAlt(_localctx, 1); + { + setState(1077); + s_expr(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_unsat_assump_responseContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List symbol() { + return getRuleContexts(SymbolContext.class); + } + + public SymbolContext symbol(int i) { + return getRuleContext(SymbolContext.class, i); + } + + public Get_unsat_assump_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_unsat_assump_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_unsat_assump_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_unsat_assump_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_unsat_assump_response(this); + else return visitor.visitChildren(this); + } + } + + public final Get_unsat_assump_responseContext get_unsat_assump_response() + throws RecognitionException { + Get_unsat_assump_responseContext _localctx = + new Get_unsat_assump_responseContext(_ctx, getState()); + enterRule(_localctx, 184, RULE_get_unsat_assump_response); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1079); + match(ParOpen); + setState(1083); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862784L) != 0) + || _la == UndefinedSymbol) { + { + { + setState(1080); + symbol(); + } + } + setState(1085); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1086); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_unsat_core_responseContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List symbol() { + return getRuleContexts(SymbolContext.class); + } + + public SymbolContext symbol(int i) { + return getRuleContext(SymbolContext.class, i); + } + + public Get_unsat_core_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_unsat_core_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_unsat_core_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_unsat_core_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_unsat_core_response(this); + else return visitor.visitChildren(this); + } + } + + public final Get_unsat_core_responseContext get_unsat_core_response() + throws RecognitionException { + Get_unsat_core_responseContext _localctx = new Get_unsat_core_responseContext(_ctx, getState()); + enterRule(_localctx, 186, RULE_get_unsat_core_response); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1088); + match(ParOpen); + setState(1092); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536862784L) != 0) + || _la == UndefinedSymbol) { + { + { + setState(1089); + symbol(); + } + } + setState(1094); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1095); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Get_value_responseContext extends ParserRuleContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public List valuation_pair() { + return getRuleContexts(Valuation_pairContext.class); + } + + public Valuation_pairContext valuation_pair(int i) { + return getRuleContext(Valuation_pairContext.class, i); + } + + public Get_value_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_value_response; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterGet_value_response(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitGet_value_response(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitGet_value_response(this); + else return visitor.visitChildren(this); + } + } + + public final Get_value_responseContext get_value_response() throws RecognitionException { + Get_value_responseContext _localctx = new Get_value_responseContext(_ctx, getState()); + enterRule(_localctx, 188, RULE_get_value_response); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1097); + match(ParOpen); + setState(1099); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1098); + valuation_pair(); + } + } + setState(1101); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == ParOpen); + setState(1103); + match(ParClose); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class Specific_success_responseContext extends ParserRuleContext { + public Specific_success_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_specific_success_response; + } + + public Specific_success_responseContext() {} + + public void copyFrom(Specific_success_responseContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_unsat_coreContext extends Specific_success_responseContext { + public Get_unsat_core_responseContext get_unsat_core_response() { + return getRuleContext(Get_unsat_core_responseContext.class, 0); + } + + public Resp_unsat_coreContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_unsat_core(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_unsat_core(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_unsat_core(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_echoContext extends Specific_success_responseContext { + public Echo_responseContext echo_response() { + return getRuleContext(Echo_responseContext.class, 0); + } + + public Resp_echoContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterResp_echo(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitResp_echo(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_echo(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_get_assertContext extends Specific_success_responseContext { + public Get_assertions_responseContext get_assertions_response() { + return getRuleContext(Get_assertions_responseContext.class, 0); + } + + public Resp_get_assertContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_get_assert(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_get_assert(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_get_assert(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_proofContext extends Specific_success_responseContext { + public Get_proof_responseContext get_proof_response() { + return getRuleContext(Get_proof_responseContext.class, 0); + } + + public Resp_proofContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterResp_proof(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitResp_proof(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_proof(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_get_modelContext extends Specific_success_responseContext { + public Get_model_responseContext get_model_response() { + return getRuleContext(Get_model_responseContext.class, 0); + } + + public Resp_get_modelContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_get_model(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_get_model(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_get_model(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_check_satContext extends Specific_success_responseContext { + public Check_sat_responseContext check_sat_response() { + return getRuleContext(Check_sat_responseContext.class, 0); + } + + public Resp_check_satContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_check_sat(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_check_sat(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_check_sat(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_get_infoContext extends Specific_success_responseContext { + public Get_info_responseContext get_info_response() { + return getRuleContext(Get_info_responseContext.class, 0); + } + + public Resp_get_infoContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_get_info(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_get_info(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_get_info(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_optionContext extends Specific_success_responseContext { + public Get_option_responseContext get_option_response() { + return getRuleContext(Get_option_responseContext.class, 0); + } + + public Resp_optionContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_option(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitResp_option(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_option(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_unsat_assumeContext extends Specific_success_responseContext { + public Get_unsat_assump_responseContext get_unsat_assump_response() { + return getRuleContext(Get_unsat_assump_responseContext.class, 0); + } + + public Resp_unsat_assumeContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_unsat_assume(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_unsat_assume(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_unsat_assume(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_valueContext extends Specific_success_responseContext { + public Get_value_responseContext get_value_response() { + return getRuleContext(Get_value_responseContext.class, 0); + } + + public Resp_valueContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterResp_value(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitResp_value(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_value(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_gett_assignContext extends Specific_success_responseContext { + public Get_assignment_responseContext get_assignment_response() { + return getRuleContext(Get_assignment_responseContext.class, 0); + } + + public Resp_gett_assignContext(Specific_success_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_gett_assign(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_gett_assign(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_gett_assign(this); + else return visitor.visitChildren(this); + } + } + + public final Specific_success_responseContext specific_success_response() + throws RecognitionException { + Specific_success_responseContext _localctx = + new Specific_success_responseContext(_ctx, getState()); + enterRule(_localctx, 190, RULE_specific_success_response); + try { + setState(1116); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 76, _ctx)) { + case 1: + _localctx = new Resp_check_satContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1105); + check_sat_response(); + } + break; + case 2: + _localctx = new Resp_echoContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1106); + echo_response(); + } + break; + case 3: + _localctx = new Resp_get_assertContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1107); + get_assertions_response(); + } + break; + case 4: + _localctx = new Resp_gett_assignContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(1108); + get_assignment_response(); + } + break; + case 5: + _localctx = new Resp_get_infoContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(1109); + get_info_response(); + } + break; + case 6: + _localctx = new Resp_get_modelContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(1110); + get_model_response(); + } + break; + case 7: + _localctx = new Resp_optionContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(1111); + get_option_response(); + } + break; + case 8: + _localctx = new Resp_proofContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(1112); + get_proof_response(); + } + break; + case 9: + _localctx = new Resp_unsat_assumeContext(_localctx); + enterOuterAlt(_localctx, 9); + { + setState(1113); + get_unsat_assump_response(); + } + break; + case 10: + _localctx = new Resp_unsat_coreContext(_localctx); + enterOuterAlt(_localctx, 10); + { + setState(1114); + get_unsat_core_response(); + } + break; + case 11: + _localctx = new Resp_valueContext(_localctx); + enterOuterAlt(_localctx, 11); + { + setState(1115); + get_value_response(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class General_responseContext extends ParserRuleContext { + public General_responseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_general_response; + } + + public General_responseContext() {} + + public void copyFrom(General_responseContext ctx) { + super.copyFrom(ctx); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_unsupportedContext extends General_responseContext { + public TerminalNode PS_Unsupported() { + return getToken(Smtlibv2Parser.PS_Unsupported, 0); + } + + public Resp_unsupportedContext(General_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_unsupported(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_unsupported(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_unsupported(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_successContext extends General_responseContext { + public TerminalNode PS_Success() { + return getToken(Smtlibv2Parser.PS_Success, 0); + } + + public Resp_successContext(General_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_success(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_success(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_success(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_spec_successsContext extends General_responseContext { + public Specific_success_responseContext specific_success_response() { + return getRuleContext(Specific_success_responseContext.class, 0); + } + + public Resp_spec_successsContext(General_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).enterResp_spec_successs(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) + ((Smtlibv2Listener) listener).exitResp_spec_successs(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_spec_successs(this); + else return visitor.visitChildren(this); + } + } + + @SuppressWarnings("CheckReturnValue") + public static class Resp_errorContext extends General_responseContext { + public TerminalNode ParOpen() { + return getToken(Smtlibv2Parser.ParOpen, 0); + } + + public TerminalNode PS_Error() { + return getToken(Smtlibv2Parser.PS_Error, 0); + } + + public StringContext string() { + return getRuleContext(StringContext.class, 0); + } + + public TerminalNode ParClose() { + return getToken(Smtlibv2Parser.ParClose, 0); + } + + public Resp_errorContext(General_responseContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).enterResp_error(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if (listener instanceof Smtlibv2Listener) ((Smtlibv2Listener) listener).exitResp_error(this); + } + + @Override + public T accept(ParseTreeVisitor visitor) { + if (visitor instanceof Smtlibv2Visitor) + return ((Smtlibv2Visitor) visitor).visitResp_error(this); + else return visitor.visitChildren(this); + } + } + + public final General_responseContext general_response() throws RecognitionException { + General_responseContext _localctx = new General_responseContext(_ctx, getState()); + enterRule(_localctx, 192, RULE_general_response); + try { + setState(1126); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 77, _ctx)) { + case 1: + _localctx = new Resp_successContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1118); + match(PS_Success); + } + break; + case 2: + _localctx = new Resp_spec_successsContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1119); + specific_success_response(); + } + break; + case 3: + _localctx = new Resp_unsupportedContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1120); + match(PS_Unsupported); + } + break; + case 4: + _localctx = new Resp_errorContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(1121); + match(ParOpen); + setState(1122); + match(PS_Error); + setState(1123); + string(); + setState(1124); + match(ParClose); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static final String _serializedATN = + "\u0004\u0001y\u0469\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002" + + "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002" + + "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002" + + "\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b\u0002" + + "\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002\u000f\u0007\u000f" + + "\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002\u0012\u0007\u0012" + + "\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002\u0015\u0007\u0015" + + "\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002\u0018\u0007\u0018" + + "\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002\u001b\u0007\u001b" + + "\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002\u001e\u0007\u001e" + + "\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007!\u0002\"\u0007\"\u0002" + + "#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007&\u0002\'\u0007\'\u0002" + + "(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007+\u0002,\u0007,\u0002" + + "-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u00070\u00021\u00071\u0002" + + "2\u00072\u00023\u00073\u00024\u00074\u00025\u00075\u00026\u00076\u0002" + + "7\u00077\u00028\u00078\u00029\u00079\u0002:\u0007:\u0002;\u0007;\u0002" + + "<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002?\u0007?\u0002@\u0007@\u0002" + + "A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002D\u0007D\u0002E\u0007E\u0002" + + "F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002I\u0007I\u0002J\u0007J\u0002" + + "K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002N\u0007N\u0002O\u0007O\u0002" + + "P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002S\u0007S\u0002T\u0007T\u0002" + + "U\u0007U\u0002V\u0007V\u0002W\u0007W\u0002X\u0007X\u0002Y\u0007Y\u0002" + + "Z\u0007Z\u0002[\u0007[\u0002\\\u0007\\\u0002]\u0007]\u0002^\u0007^\u0002" + + "_\u0007_\u0002`\u0007`\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000" + + "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000" + + "\u0001\u0000\u0001\u0000\u0003\u0000\u00cf\b\u0000\u0001\u0001\u0001\u0001" + + "\u0001\u0002\u0001\u0002\u0003\u0002\u00d5\b\u0002\u0001\u0003\u0001\u0003" + + "\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006" + + "\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001" + + "\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b" + + "\u0001\u000b\u0001\u000b\u0001\u000b\u0003\u000b\u00f0\b\u000b\u0001\f" + + "\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0003\f\u00f8\b\f\u0001\r\u0001" + + "\r\u0001\r\u0003\r\u00fd\b\r\u0001\u000e\u0001\u000e\u0003\u000e\u0101" + + "\b\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001" + + "\u000f\u0001\u000f\u0003\u000f\u010a\b\u000f\u0001\u0010\u0001\u0010\u0001" + + "\u0010\u0001\u0010\u0001\u0010\u0005\u0010\u0111\b\u0010\n\u0010\f\u0010" + + "\u0114\t\u0010\u0001\u0010\u0003\u0010\u0117\b\u0010\u0001\u0011\u0001" + + "\u0011\u0003\u0011\u011b\b\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001" + + "\u0012\u0001\u0012\u0004\u0012\u0122\b\u0012\u000b\u0012\f\u0012\u0123" + + "\u0001\u0012\u0001\u0012\u0003\u0012\u0128\b\u0012\u0001\u0013\u0001\u0013" + + "\u0001\u0013\u0001\u0013\u0005\u0013\u012e\b\u0013\n\u0013\f\u0013\u0131" + + "\t\u0013\u0001\u0013\u0003\u0013\u0134\b\u0013\u0001\u0014\u0001\u0014" + + "\u0001\u0014\u0001\u0014\u0003\u0014\u013a\b\u0014\u0001\u0015\u0001\u0015" + + "\u0001\u0015\u0001\u0015\u0001\u0015\u0004\u0015\u0141\b\u0015\u000b\u0015" + + "\f\u0015\u0142\u0001\u0015\u0001\u0015\u0003\u0015\u0147\b\u0015\u0001" + + "\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001" + + "\u0016\u0003\u0016\u0150\b\u0016\u0001\u0017\u0001\u0017\u0001\u0017\u0001" + + "\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001" + + "\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0004\u0019\u0160" + + "\b\u0019\u000b\u0019\f\u0019\u0161\u0001\u0019\u0001\u0019\u0003\u0019" + + "\u0166\b\u0019\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a" + + "\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b" + + "\u0001\u001b\u0004\u001b\u0174\b\u001b\u000b\u001b\f\u001b\u0175\u0001" + + "\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0004" + + "\u001b\u017e\b\u001b\u000b\u001b\f\u001b\u017f\u0001\u001b\u0001\u001b" + + "\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b" + + "\u0004\u001b\u018a\b\u001b\u000b\u001b\f\u001b\u018b\u0001\u001b\u0001" + + "\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001" + + "\u001b\u0004\u001b\u0196\b\u001b\u000b\u001b\f\u001b\u0197\u0001\u001b" + + "\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b" + + "\u0001\u001b\u0001\u001b\u0004\u001b\u01a3\b\u001b\u000b\u001b\f\u001b" + + "\u01a4\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001" + + "\u001b\u0001\u001b\u0004\u001b\u01ae\b\u001b\u000b\u001b\f\u001b\u01af" + + "\u0001\u001b\u0001\u001b\u0003\u001b\u01b4\b\u001b\u0001\u001c\u0001\u001c" + + "\u0001\u001c\u0001\u001c\u0005\u001c\u01ba\b\u001c\n\u001c\f\u001c\u01bd" + + "\t\u001c\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001e\u0001" + + "\u001e\u0001\u001e\u0001\u001e\u0005\u001e\u01c7\b\u001e\n\u001e\f\u001e" + + "\u01ca\t\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e" + + "\u0001\u001e\u0005\u001e\u01d2\b\u001e\n\u001e\f\u001e\u01d5\t\u001e\u0001" + + "\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0004\u001e\u01dc" + + "\b\u001e\u000b\u001e\f\u001e\u01dd\u0001\u001e\u0005\u001e\u01e1\b\u001e" + + "\n\u001e\f\u001e\u01e4\t\u001e\u0001\u001e\u0001\u001e\u0003\u001e\u01e8" + + "\b\u001e\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0004" + + "\u001f\u01ef\b\u001f\u000b\u001f\f\u001f\u01f0\u0001\u001f\u0001\u001f" + + "\u0001\u001f\u0001\u001f\u0004\u001f\u01f7\b\u001f\u000b\u001f\f\u001f" + + "\u01f8\u0001\u001f\u0005\u001f\u01fc\b\u001f\n\u001f\f\u001f\u01ff\t\u001f" + + "\u0001\u001f\u0001\u001f\u0001\u001f\u0003\u001f\u0204\b\u001f\u0001 " + + "\u0001 \u0001 \u0004 \u0209\b \u000b \f \u020a\u0001 \u0001 \u0001 \u0001" + + " \u0001 \u0004 \u0212\b \u000b \f \u0213\u0001 \u0001 \u0001 \u0001 \u0001" + + " \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0003 \u0223" + + "\b \u0001!\u0001!\u0001!\u0001!\u0004!\u0229\b!\u000b!\f!\u022a\u0001" + + "!\u0001!\u0001\"\u0001\"\u0001\"\u0004\"\u0232\b\"\u000b\"\f\"\u0233\u0001" + + "\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001" + + "\"\u0001\"\u0003\"\u0241\b\"\u0001#\u0001#\u0001#\u0001#\u0004#\u0247" + + "\b#\u000b#\f#\u0248\u0001#\u0001#\u0001$\u0001$\u0001$\u0001$\u0001$\u0001" + + "%\u0001%\u0001%\u0001%\u0001%\u0001&\u0001&\u0001&\u0005&\u025a\b&\n&" + + "\f&\u025d\t&\u0001&\u0001&\u0001\'\u0001\'\u0004\'\u0263\b\'\u000b\'\f" + + "\'\u0264\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'\u0004\'\u026d" + + "\b\'\u000b\'\f\'\u026e\u0001\'\u0001\'\u0001\'\u0004\'\u0274\b\'\u000b" + + "\'\f\'\u0275\u0001\'\u0001\'\u0001\'\u0003\'\u027b\b\'\u0001(\u0001(\u0001" + + "(\u0001(\u0005(\u0281\b(\n(\f(\u0284\t(\u0001(\u0001(\u0001(\u0001(\u0001" + + ")\u0001)\u0001)\u0005)\u028d\b)\n)\f)\u0290\t)\u0001)\u0001)\u0001)\u0001" + + ")\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0003*\u029c\b*\u0001+\u0005" + + "+\u029f\b+\n+\f+\u02a2\t+\u0001,\u0001,\u0001,\u0001-\u0001-\u0001.\u0001" + + ".\u0001.\u0005.\u02ac\b.\n.\f.\u02af\t.\u0001.\u0001.\u0001/\u0001/\u0001" + + "/\u0001/\u00010\u00010\u00010\u00010\u00011\u00011\u00011\u00041\u02be" + + "\b1\u000b1\f1\u02bf\u00011\u00011\u00011\u00041\u02c5\b1\u000b1\f1\u02c6" + + "\u00011\u00011\u00012\u00012\u00012\u00012\u00052\u02cf\b2\n2\f2\u02d2" + + "\t2\u00012\u00012\u00012\u00013\u00013\u00013\u00013\u00014\u00014\u0001" + + "4\u00015\u00015\u00015\u00016\u00016\u00016\u00046\u02e4\b6\u000b6\f6" + + "\u02e5\u00016\u00016\u00016\u00046\u02eb\b6\u000b6\f6\u02ec\u00016\u0001" + + "6\u00017\u00017\u00017\u00017\u00057\u02f5\b7\n7\f7\u02f8\t7\u00017\u0001" + + "7\u00017\u00018\u00018\u00018\u00019\u00019\u0001:\u0001:\u0001;\u0001" + + ";\u0001<\u0001<\u0001<\u0001=\u0001=\u0001>\u0001>\u0001>\u0001?\u0001" + + "?\u0001@\u0001@\u0001A\u0001A\u0001B\u0001B\u0001B\u0004B\u0317\bB\u000b" + + "B\fB\u0318\u0001B\u0001B\u0001C\u0001C\u0001C\u0001D\u0001D\u0001D\u0001" + + "E\u0001E\u0001F\u0001F\u0001G\u0001G\u0001G\u0001H\u0001H\u0001H\u0001" + + "I\u0001I\u0001I\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001" + + "J\u0001J\u0001J\u0003J\u03a8\bJ\u0001K\u0001K\u0001L\u0001L\u0001L\u0001" + + "L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001" + + "L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001L\u0001" + + "L\u0001L\u0001L\u0001L\u0001L\u0001L\u0003L\u03c9\bL\u0001M\u0001M\u0001" + + "M\u0001M\u0001M\u0001M\u0001M\u0001M\u0003M\u03d3\bM\u0001N\u0001N\u0001" + + "O\u0001O\u0001O\u0003O\u03da\bO\u0001P\u0001P\u0001P\u0001P\u0001P\u0001" + + "P\u0001P\u0001P\u0001P\u0001P\u0001P\u0001P\u0003P\u03e8\bP\u0001Q\u0001" + + "Q\u0001Q\u0001Q\u0001Q\u0001Q\u0001Q\u0001Q\u0001Q\u0001Q\u0001Q\u0001" + + "Q\u0001Q\u0003Q\u03f7\bQ\u0001R\u0001R\u0001R\u0001R\u0001R\u0001S\u0001" + + "S\u0001S\u0001S\u0001S\u0001T\u0001T\u0001U\u0001U\u0001V\u0001V\u0005" + + "V\u0409\bV\nV\fV\u040c\tV\u0001V\u0001V\u0001W\u0001W\u0005W\u0412\bW" + + "\nW\fW\u0415\tW\u0001W\u0001W\u0001X\u0001X\u0004X\u041b\bX\u000bX\fX" + + "\u041c\u0001X\u0001X\u0001Y\u0001Y\u0001Y\u0005Y\u0424\bY\nY\fY\u0427" + + "\tY\u0001Y\u0001Y\u0001Y\u0005Y\u042c\bY\nY\fY\u042f\tY\u0001Y\u0003Y" + + "\u0432\bY\u0001Z\u0001Z\u0001[\u0001[\u0001\\\u0001\\\u0005\\\u043a\b" + + "\\\n\\\f\\\u043d\t\\\u0001\\\u0001\\\u0001]\u0001]\u0005]\u0443\b]\n]" + + "\f]\u0446\t]\u0001]\u0001]\u0001^\u0001^\u0004^\u044c\b^\u000b^\f^\u044d" + + "\u0001^\u0001^\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001" + + "_\u0001_\u0001_\u0001_\u0003_\u045d\b_\u0001`\u0001`\u0001`\u0001`\u0001" + + "`\u0001`\u0001`\u0001`\u0003`\u0467\b`\u0001`\u0000\u0000a\u0000\u0002" + + "\u0004\u0006\b\n\f\u000e\u0010\u0012\u0014\u0016\u0018\u001a\u001c\u001e" + + " \"$&(*,.02468:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086" + + "\u0088\u008a\u008c\u008e\u0090\u0092\u0094\u0096\u0098\u009a\u009c\u009e" + + "\u00a0\u00a2\u00a4\u00a6\u00a8\u00aa\u00ac\u00ae\u00b0\u00b2\u00b4\u00b6" + + "\u00b8\u00ba\u00bc\u00be\u00c0\u0000\u0007\u0002\u0000;Gww\u0001\u0000" + + "\r\u001c\u0001\u0000Nv\u0003\u0000??EEGG\u0002\u0000\u0011\u0011\u0019" + + "\u0019\u0002\u0000\u000f\u000f\u0012\u0012\u0003\u0000\u0016\u0016\u001a" + + "\u001a\u001c\u001c\u04b4\u0000\u00ce\u0001\u0000\u0000\u0000\u0002\u00d0" + + "\u0001\u0000\u0000\u0000\u0004\u00d4\u0001\u0000\u0000\u0000\u0006\u00d6" + + "\u0001\u0000\u0000\u0000\b\u00d8\u0001\u0000\u0000\u0000\n\u00da\u0001" + + "\u0000\u0000\u0000\f\u00dc\u0001\u0000\u0000\u0000\u000e\u00de\u0001\u0000" + + "\u0000\u0000\u0010\u00e0\u0001\u0000\u0000\u0000\u0012\u00e2\u0001\u0000" + + "\u0000\u0000\u0014\u00e4\u0001\u0000\u0000\u0000\u0016\u00ef\u0001\u0000" + + "\u0000\u0000\u0018\u00f7\u0001\u0000\u0000\u0000\u001a\u00fc\u0001\u0000" + + "\u0000\u0000\u001c\u0100\u0001\u0000\u0000\u0000\u001e\u0109\u0001\u0000" + + "\u0000\u0000 \u0116\u0001\u0000\u0000\u0000\"\u011a\u0001\u0000\u0000" + + "\u0000$\u0127\u0001\u0000\u0000\u0000&\u0133\u0001\u0000\u0000\u0000(" + + "\u0139\u0001\u0000\u0000\u0000*\u0146\u0001\u0000\u0000\u0000,\u014f\u0001" + + "\u0000\u0000\u0000.\u0151\u0001\u0000\u0000\u00000\u0156\u0001\u0000\u0000" + + "\u00002\u0165\u0001\u0000\u0000\u00004\u0167\u0001\u0000\u0000\u00006" + + "\u01b3\u0001\u0000\u0000\u00008\u01b5\u0001\u0000\u0000\u0000:\u01c0\u0001" + + "\u0000\u0000\u0000<\u01e7\u0001\u0000\u0000\u0000>\u0203\u0001\u0000\u0000" + + "\u0000@\u0222\u0001\u0000\u0000\u0000B\u0224\u0001\u0000\u0000\u0000D" + + "\u0240\u0001\u0000\u0000\u0000F\u0242\u0001\u0000\u0000\u0000H\u024c\u0001" + + "\u0000\u0000\u0000J\u0251\u0001\u0000\u0000\u0000L\u0256\u0001\u0000\u0000" + + "\u0000N\u027a\u0001\u0000\u0000\u0000P\u027c\u0001\u0000\u0000\u0000R" + + "\u0289\u0001\u0000\u0000\u0000T\u029b\u0001\u0000\u0000\u0000V\u02a0\u0001" + + "\u0000\u0000\u0000X\u02a3\u0001\u0000\u0000\u0000Z\u02a6\u0001\u0000\u0000" + + "\u0000\\\u02a8\u0001\u0000\u0000\u0000^\u02b2\u0001\u0000\u0000\u0000" + + "`\u02b6\u0001\u0000\u0000\u0000b\u02ba\u0001\u0000\u0000\u0000d\u02ca" + + "\u0001\u0000\u0000\u0000f\u02d6\u0001\u0000\u0000\u0000h\u02da\u0001\u0000" + + "\u0000\u0000j\u02dd\u0001\u0000\u0000\u0000l\u02e0\u0001\u0000\u0000\u0000" + + "n\u02f0\u0001\u0000\u0000\u0000p\u02fc\u0001\u0000\u0000\u0000r\u02ff" + + "\u0001\u0000\u0000\u0000t\u0301\u0001\u0000\u0000\u0000v\u0303\u0001\u0000" + + "\u0000\u0000x\u0305\u0001\u0000\u0000\u0000z\u0308\u0001\u0000\u0000\u0000" + + "|\u030a\u0001\u0000\u0000\u0000~\u030d\u0001\u0000\u0000\u0000\u0080\u030f" + + "\u0001\u0000\u0000\u0000\u0082\u0311\u0001\u0000\u0000\u0000\u0084\u0313" + + "\u0001\u0000\u0000\u0000\u0086\u031c\u0001\u0000\u0000\u0000\u0088\u031f" + + "\u0001\u0000\u0000\u0000\u008a\u0322\u0001\u0000\u0000\u0000\u008c\u0324" + + "\u0001\u0000\u0000\u0000\u008e\u0326\u0001\u0000\u0000\u0000\u0090\u0329" + + "\u0001\u0000\u0000\u0000\u0092\u032c\u0001\u0000\u0000\u0000\u0094\u03a7" + + "\u0001\u0000\u0000\u0000\u0096\u03a9\u0001\u0000\u0000\u0000\u0098\u03c8" + + "\u0001\u0000\u0000\u0000\u009a\u03d2\u0001\u0000\u0000\u0000\u009c\u03d4" + + "\u0001\u0000\u0000\u0000\u009e\u03d9\u0001\u0000\u0000\u0000\u00a0\u03e7" + + "\u0001\u0000\u0000\u0000\u00a2\u03f6\u0001\u0000\u0000\u0000\u00a4\u03f8" + + "\u0001\u0000\u0000\u0000\u00a6\u03fd\u0001\u0000\u0000\u0000\u00a8\u0402" + + "\u0001\u0000\u0000\u0000\u00aa\u0404\u0001\u0000\u0000\u0000\u00ac\u0406" + + "\u0001\u0000\u0000\u0000\u00ae\u040f\u0001\u0000\u0000\u0000\u00b0\u0418" + + "\u0001\u0000\u0000\u0000\u00b2\u0431\u0001\u0000\u0000\u0000\u00b4\u0433" + + "\u0001\u0000\u0000\u0000\u00b6\u0435\u0001\u0000\u0000\u0000\u00b8\u0437" + + "\u0001\u0000\u0000\u0000\u00ba\u0440\u0001\u0000\u0000\u0000\u00bc\u0449" + + "\u0001\u0000\u0000\u0000\u00be\u045c\u0001\u0000\u0000\u0000\u00c0\u0466" + + "\u0001\u0000\u0000\u0000\u00c2\u00c3\u0003F#\u0000\u00c3\u00c4\u0005\u0000" + + "\u0000\u0001\u00c4\u00cf\u0001\u0000\u0000\u0000\u00c5\u00c6\u0003B!\u0000" + + "\u00c6\u00c7\u0005\u0000\u0000\u0001\u00c7\u00cf\u0001\u0000\u0000\u0000" + + "\u00c8\u00c9\u0003V+\u0000\u00c9\u00ca\u0005\u0000\u0000\u0001\u00ca\u00cf" + + "\u0001\u0000\u0000\u0000\u00cb\u00cc\u0003\u00c0`\u0000\u00cc\u00cd\u0005" + + "\u0000\u0000\u0001\u00cd\u00cf\u0001\u0000\u0000\u0000\u00ce\u00c2\u0001" + + "\u0000\u0000\u0000\u00ce\u00c5\u0001\u0000\u0000\u0000\u00ce\u00c8\u0001" + + "\u0000\u0000\u0000\u00ce\u00cb\u0001\u0000\u0000\u0000\u00cf\u0001\u0001" + + "\u0000\u0000\u0000\u00d0\u00d1\u0007\u0000\u0000\u0000\u00d1\u0003\u0001" + + "\u0000\u0000\u0000\u00d2\u00d5\u0003\b\u0004\u0000\u00d3\u00d5\u0005x" + + "\u0000\u0000\u00d4\u00d2\u0001\u0000\u0000\u0000\u00d4\u00d3\u0001\u0000" + + "\u0000\u0000\u00d5\u0005\u0001\u0000\u0000\u0000\u00d6\u00d7\u0005\u0006" + + "\u0000\u0000\u00d7\u0007\u0001\u0000\u0000\u0000\u00d8\u00d9\u0007\u0001" + + "\u0000\u0000\u00d9\t\u0001\u0000\u0000\u0000\u00da\u00db\u0007\u0002\u0000" + + "\u0000\u00db\u000b\u0001\u0000\u0000\u0000\u00dc\u00dd\u0005I\u0000\u0000" + + "\u00dd\r\u0001\u0000\u0000\u0000\u00de\u00df\u0005L\u0000\u0000\u00df" + + "\u000f\u0001\u0000\u0000\u0000\u00e0\u00e1\u0005K\u0000\u0000\u00e1\u0011" + + "\u0001\u0000\u0000\u0000\u00e2\u00e3\u0005J\u0000\u0000\u00e3\u0013\u0001" + + "\u0000\u0000\u0000\u00e4\u00e5\u0005\u0005\u0000\u0000\u00e5\u0015\u0001" + + "\u0000\u0000\u0000\u00e6\u00e7\u0005\n\u0000\u0000\u00e7\u00e8\u00036" + + "\u001b\u0000\u00e8\u00e9\u0005\u0003\u0000\u0000\u00e9\u00f0\u0001\u0000" + + "\u0000\u0000\u00ea\u00eb\u0005\n\u0000\u0000\u00eb\u00ec\u00036\u001b" + + "\u0000\u00ec\u00ed\u00036\u001b\u0000\u00ed\u00ee\u0005\u0003\u0000\u0000" + + "\u00ee\u00f0\u0001\u0000\u0000\u0000\u00ef\u00e6\u0001\u0000\u0000\u0000" + + "\u00ef\u00ea\u0001\u0000\u0000\u0000\u00f0\u0017\u0001\u0000\u0000\u0000" + + "\u00f1\u00f2\u0005\f\u0000\u0000\u00f2\u00f3\u00036\u001b\u0000\u00f3" + + "\u00f4\u0005\u0003\u0000\u0000\u00f4\u00f8\u0001\u0000\u0000\u0000\u00f5" + + "\u00f6\u0005\u000b\u0000\u0000\u00f6\u00f8\u00036\u001b\u0000\u00f7\u00f1" + + "\u0001\u0000\u0000\u0000\u00f7\u00f5\u0001\u0000\u0000\u0000\u00f8\u0019" + + "\u0001\u0000\u0000\u0000\u00f9\u00fd\u0003\n\u0005\u0000\u00fa\u00fb\u0005" + + "M\u0000\u0000\u00fb\u00fd\u0003\u0004\u0002\u0000\u00fc\u00f9\u0001\u0000" + + "\u0000\u0000\u00fc\u00fa\u0001\u0000\u0000\u0000\u00fd\u001b\u0001\u0000" + + "\u0000\u0000\u00fe\u0101\u0003\u0004\u0002\u0000\u00ff\u0101\u0003\u0006" + + "\u0003\u0000\u0100\u00fe\u0001\u0000\u0000\u0000\u0100\u00ff\u0001\u0000" + + "\u0000\u0000\u0101\u001d\u0001\u0000\u0000\u0000\u0102\u010a\u0003\f\u0006" + + "\u0000\u0103\u010a\u0003\u000e\u0007\u0000\u0104\u010a\u0003\u0010\b\u0000" + + "\u0105\u010a\u0003\u0012\t\u0000\u0106\u010a\u0003\u0014\n\u0000\u0107" + + "\u010a\u0005\b\u0000\u0000\u0108\u010a\u0005\t\u0000\u0000\u0109\u0102" + + "\u0001\u0000\u0000\u0000\u0109\u0103\u0001\u0000\u0000\u0000\u0109\u0104" + + "\u0001\u0000\u0000\u0000\u0109\u0105\u0001\u0000\u0000\u0000\u0109\u0106" + + "\u0001\u0000\u0000\u0000\u0109\u0107\u0001\u0000\u0000\u0000\u0109\u0108" + + "\u0001\u0000\u0000\u0000\u010a\u001f\u0001\u0000\u0000\u0000\u010b\u0117" + + "\u0003\u001e\u000f\u0000\u010c\u0117\u0003\u001c\u000e\u0000\u010d\u0117" + + "\u0003\u001a\r\u0000\u010e\u0112\u0005\u0002\u0000\u0000\u010f\u0111\u0003" + + " \u0010\u0000\u0110\u010f\u0001\u0000\u0000\u0000\u0111\u0114\u0001\u0000" + + "\u0000\u0000\u0112\u0110\u0001\u0000\u0000\u0000\u0112\u0113\u0001\u0000" + + "\u0000\u0000\u0113\u0115\u0001\u0000\u0000\u0000\u0114\u0112\u0001\u0000" + + "\u0000\u0000\u0115\u0117\u0005\u0003\u0000\u0000\u0116\u010b\u0001\u0000" + + "\u0000\u0000\u0116\u010c\u0001\u0000\u0000\u0000\u0116\u010d\u0001\u0000" + + "\u0000\u0000\u0116\u010e\u0001\u0000\u0000\u0000\u0117!\u0001\u0000\u0000" + + "\u0000\u0118\u011b\u0003\f\u0006\u0000\u0119\u011b\u0003\u001c\u000e\u0000" + + "\u011a\u0118\u0001\u0000\u0000\u0000\u011a\u0119\u0001\u0000\u0000\u0000" + + "\u011b#\u0001\u0000\u0000\u0000\u011c\u0128\u0003\u001c\u000e\u0000\u011d" + + "\u011e\u0005\u0002\u0000\u0000\u011e\u011f\u0005<\u0000\u0000\u011f\u0121" + + "\u0003\u001c\u000e\u0000\u0120\u0122\u0003\"\u0011\u0000\u0121\u0120\u0001" + + "\u0000\u0000\u0000\u0122\u0123\u0001\u0000\u0000\u0000\u0123\u0121\u0001" + + "\u0000\u0000\u0000\u0123\u0124\u0001\u0000\u0000\u0000\u0124\u0125\u0001" + + "\u0000\u0000\u0000\u0125\u0126\u0005\u0003\u0000\u0000\u0126\u0128\u0001" + + "\u0000\u0000\u0000\u0127\u011c\u0001\u0000\u0000\u0000\u0127\u011d\u0001" + + "\u0000\u0000\u0000\u0128%\u0001\u0000\u0000\u0000\u0129\u0134\u0003\u001e" + + "\u000f\u0000\u012a\u0134\u0003\u001c\u000e\u0000\u012b\u012f\u0005\u0002" + + "\u0000\u0000\u012c\u012e\u0003 \u0010\u0000\u012d\u012c\u0001\u0000\u0000" + + "\u0000\u012e\u0131\u0001\u0000\u0000\u0000\u012f\u012d\u0001\u0000\u0000" + + "\u0000\u012f\u0130\u0001\u0000\u0000\u0000\u0130\u0132\u0001\u0000\u0000" + + "\u0000\u0131\u012f\u0001\u0000\u0000\u0000\u0132\u0134\u0005\u0003\u0000" + + "\u0000\u0133\u0129\u0001\u0000\u0000\u0000\u0133\u012a\u0001\u0000\u0000" + + "\u0000\u0133\u012b\u0001\u0000\u0000\u0000\u0134\'\u0001\u0000\u0000\u0000" + + "\u0135\u013a\u0003\u001a\r\u0000\u0136\u0137\u0003\u001a\r\u0000\u0137" + + "\u0138\u0003&\u0013\u0000\u0138\u013a\u0001\u0000\u0000\u0000\u0139\u0135" + + "\u0001\u0000\u0000\u0000\u0139\u0136\u0001\u0000\u0000\u0000\u013a)\u0001" + + "\u0000\u0000\u0000\u013b\u0147\u0005\u0007\u0000\u0000\u013c\u0147\u0003" + + "$\u0012\u0000\u013d\u013e\u0005\u0002\u0000\u0000\u013e\u0140\u0003$\u0012" + + "\u0000\u013f\u0141\u0003*\u0015\u0000\u0140\u013f\u0001\u0000\u0000\u0000" + + "\u0141\u0142\u0001\u0000\u0000\u0000\u0142\u0140\u0001\u0000\u0000\u0000" + + "\u0142\u0143\u0001\u0000\u0000\u0000\u0143\u0144\u0001\u0000\u0000\u0000" + + "\u0144\u0145\u0005\u0003\u0000\u0000\u0145\u0147\u0001\u0000\u0000\u0000" + + "\u0146\u013b\u0001\u0000\u0000\u0000\u0146\u013c\u0001\u0000\u0000\u0000" + + "\u0146\u013d\u0001\u0000\u0000\u0000\u0147+\u0001\u0000\u0000\u0000\u0148" + + "\u0150\u0003$\u0012\u0000\u0149\u014a\u0005\u0002\u0000\u0000\u014a\u014b" + + "\u0005=\u0000\u0000\u014b\u014c\u0003$\u0012\u0000\u014c\u014d\u0003*" + + "\u0015\u0000\u014d\u014e\u0005\u0003\u0000\u0000\u014e\u0150\u0001\u0000" + + "\u0000\u0000\u014f\u0148\u0001\u0000\u0000\u0000\u014f\u0149\u0001\u0000" + + "\u0000\u0000\u0150-\u0001\u0000\u0000\u0000\u0151\u0152\u0005\u0002\u0000" + + "\u0000\u0152\u0153\u0003\u001c\u000e\u0000\u0153\u0154\u00036\u001b\u0000" + + "\u0154\u0155\u0005\u0003\u0000\u0000\u0155/\u0001\u0000\u0000\u0000\u0156" + + "\u0157\u0005\u0002\u0000\u0000\u0157\u0158\u0003\u001c\u000e\u0000\u0158" + + "\u0159\u0003*\u0015\u0000\u0159\u015a\u0005\u0003\u0000\u0000\u015a1\u0001" + + "\u0000\u0000\u0000\u015b\u0166\u0003\u001c\u000e\u0000\u015c\u015d\u0005" + + "\u0002\u0000\u0000\u015d\u015f\u0003\u001c\u000e\u0000\u015e\u0160\u0003" + + "\u001c\u000e\u0000\u015f\u015e\u0001\u0000\u0000\u0000\u0160\u0161\u0001" + + "\u0000\u0000\u0000\u0161\u015f\u0001\u0000\u0000\u0000\u0161\u0162\u0001" + + "\u0000\u0000\u0000\u0162\u0163\u0001\u0000\u0000\u0000\u0163\u0164\u0005" + + "\u0003\u0000\u0000\u0164\u0166\u0001\u0000\u0000\u0000\u0165\u015b\u0001" + + "\u0000\u0000\u0000\u0165\u015c\u0001\u0000\u0000\u0000\u01663\u0001\u0000" + + "\u0000\u0000\u0167\u0168\u0005\u0002\u0000\u0000\u0168\u0169\u00032\u0019" + + "\u0000\u0169\u016a\u00036\u001b\u0000\u016a\u016b\u0005\u0003\u0000\u0000" + + "\u016b5\u0001\u0000\u0000\u0000\u016c\u01b4\u0003\u001e\u000f\u0000\u016d" + + "\u01b4\u0003,\u0016\u0000\u016e\u01b4\u0003\u0016\u000b\u0000\u016f\u01b4" + + "\u0003\u0018\f\u0000\u0170\u0171\u0005\u0002\u0000\u0000\u0171\u0173\u0003" + + ",\u0016\u0000\u0172\u0174\u00036\u001b\u0000\u0173\u0172\u0001\u0000\u0000" + + "\u0000\u0174\u0175\u0001\u0000\u0000\u0000\u0175\u0173\u0001\u0000\u0000" + + "\u0000\u0175\u0176\u0001\u0000\u0000\u0000\u0176\u0177\u0001\u0000\u0000" + + "\u0000\u0177\u0178\u0005\u0003\u0000\u0000\u0178\u01b4\u0001\u0000\u0000" + + "\u0000\u0179\u017a\u0005\u0002\u0000\u0000\u017a\u017b\u0005C\u0000\u0000" + + "\u017b\u017d\u0005\u0002\u0000\u0000\u017c\u017e\u0003.\u0017\u0000\u017d" + + "\u017c\u0001\u0000\u0000\u0000\u017e\u017f\u0001\u0000\u0000\u0000\u017f" + + "\u017d\u0001\u0000\u0000\u0000\u017f\u0180\u0001\u0000\u0000\u0000\u0180" + + "\u0181\u0001\u0000\u0000\u0000\u0181\u0182\u0005\u0003\u0000\u0000\u0182" + + "\u0183\u00036\u001b\u0000\u0183\u0184\u0005\u0003\u0000\u0000\u0184\u01b4" + + "\u0001\u0000\u0000\u0000\u0185\u0186\u0005\u0002\u0000\u0000\u0186\u0187" + + "\u0005B\u0000\u0000\u0187\u0189\u0005\u0002\u0000\u0000\u0188\u018a\u0003" + + "0\u0018\u0000\u0189\u0188\u0001\u0000\u0000\u0000\u018a\u018b\u0001\u0000" + + "\u0000\u0000\u018b\u0189\u0001\u0000\u0000\u0000\u018b\u018c\u0001\u0000" + + "\u0000\u0000\u018c\u018d\u0001\u0000\u0000\u0000\u018d\u018e\u0005\u0003" + + "\u0000\u0000\u018e\u018f\u00036\u001b\u0000\u018f\u0190\u0005\u0003\u0000" + + "\u0000\u0190\u01b4\u0001\u0000\u0000\u0000\u0191\u0192\u0005\u0002\u0000" + + "\u0000\u0192\u0193\u0005@\u0000\u0000\u0193\u0195\u0005\u0002\u0000\u0000" + + "\u0194\u0196\u00030\u0018\u0000\u0195\u0194\u0001\u0000\u0000\u0000\u0196" + + "\u0197\u0001\u0000\u0000\u0000\u0197\u0195\u0001\u0000\u0000\u0000\u0197" + + "\u0198\u0001\u0000\u0000\u0000\u0198\u0199\u0001\u0000\u0000\u0000\u0199" + + "\u019a\u0005\u0003\u0000\u0000\u019a\u019b\u00036\u001b\u0000\u019b\u019c" + + "\u0005\u0003\u0000\u0000\u019c\u01b4\u0001\u0000\u0000\u0000\u019d\u019e" + + "\u0005\u0002\u0000\u0000\u019e\u019f\u0005D\u0000\u0000\u019f\u01a0\u0003" + + "6\u001b\u0000\u01a0\u01a2\u0005\u0002\u0000\u0000\u01a1\u01a3\u00034\u001a" + + "\u0000\u01a2\u01a1\u0001\u0000\u0000\u0000\u01a3\u01a4\u0001\u0000\u0000" + + "\u0000\u01a4\u01a2\u0001\u0000\u0000\u0000\u01a4\u01a5\u0001\u0000\u0000" + + "\u0000\u01a5\u01a6\u0001\u0000\u0000\u0000\u01a6\u01a7\u0005\u0003\u0000" + + "\u0000\u01a7\u01a8\u0005\u0003\u0000\u0000\u01a8\u01b4\u0001\u0000\u0000" + + "\u0000\u01a9\u01aa\u0005\u0002\u0000\u0000\u01aa\u01ab\u0005;\u0000\u0000" + + "\u01ab\u01ad\u00036\u001b\u0000\u01ac\u01ae\u0003(\u0014\u0000\u01ad\u01ac" + + "\u0001\u0000\u0000\u0000\u01ae\u01af\u0001\u0000\u0000\u0000\u01af\u01ad" + + "\u0001\u0000\u0000\u0000\u01af\u01b0\u0001\u0000\u0000\u0000\u01b0\u01b1" + + "\u0001\u0000\u0000\u0000\u01b1\u01b2\u0005\u0003\u0000\u0000\u01b2\u01b4" + + "\u0001\u0000\u0000\u0000\u01b3\u016c\u0001\u0000\u0000\u0000\u01b3\u016d" + + "\u0001\u0000\u0000\u0000\u01b3\u016e\u0001\u0000\u0000\u0000\u01b3\u016f" + + "\u0001\u0000\u0000\u0000\u01b3\u0170\u0001\u0000\u0000\u0000\u01b3\u0179" + + "\u0001\u0000\u0000\u0000\u01b3\u0185\u0001\u0000\u0000\u0000\u01b3\u0191" + + "\u0001\u0000\u0000\u0000\u01b3\u019d\u0001\u0000\u0000\u0000\u01b3\u01a9" + + "\u0001\u0000\u0000\u0000\u01b47\u0001\u0000\u0000\u0000\u01b5\u01b6\u0005" + + "\u0002\u0000\u0000\u01b6\u01b7\u0003$\u0012\u0000\u01b7\u01bb\u0003\f" + + "\u0006\u0000\u01b8\u01ba\u0003(\u0014\u0000\u01b9\u01b8\u0001\u0000\u0000" + + "\u0000\u01ba\u01bd\u0001\u0000\u0000\u0000\u01bb\u01b9\u0001\u0000\u0000" + + "\u0000\u01bb\u01bc\u0001\u0000\u0000\u0000\u01bc\u01be\u0001\u0000\u0000" + + "\u0000\u01bd\u01bb\u0001\u0000\u0000\u0000\u01be\u01bf\u0005\u0003\u0000" + + "\u0000\u01bf9\u0001\u0000\u0000\u0000\u01c0\u01c1\u0007\u0003\u0000\u0000" + + "\u01c1;\u0001\u0000\u0000\u0000\u01c2\u01c3\u0005\u0002\u0000\u0000\u01c3" + + "\u01c4\u0003\u001e\u000f\u0000\u01c4\u01c8\u0003*\u0015\u0000\u01c5\u01c7" + + "\u0003(\u0014\u0000\u01c6\u01c5\u0001\u0000\u0000\u0000\u01c7\u01ca\u0001" + + "\u0000\u0000\u0000\u01c8\u01c6\u0001\u0000\u0000\u0000\u01c8\u01c9\u0001" + + "\u0000\u0000\u0000\u01c9\u01cb\u0001\u0000\u0000\u0000\u01ca\u01c8\u0001" + + "\u0000\u0000\u0000\u01cb\u01cc\u0005\u0003\u0000\u0000\u01cc\u01e8\u0001" + + "\u0000\u0000\u0000\u01cd\u01ce\u0005\u0002\u0000\u0000\u01ce\u01cf\u0003" + + ":\u001d\u0000\u01cf\u01d3\u0003*\u0015\u0000\u01d0\u01d2\u0003(\u0014" + + "\u0000\u01d1\u01d0\u0001\u0000\u0000\u0000\u01d2\u01d5\u0001\u0000\u0000" + + "\u0000\u01d3\u01d1\u0001\u0000\u0000\u0000\u01d3\u01d4\u0001\u0000\u0000" + + "\u0000\u01d4\u01d6\u0001\u0000\u0000\u0000\u01d5\u01d3\u0001\u0000\u0000" + + "\u0000\u01d6\u01d7\u0005\u0003\u0000\u0000\u01d7\u01e8\u0001\u0000\u0000" + + "\u0000\u01d8\u01d9\u0005\u0002\u0000\u0000\u01d9\u01db\u0003$\u0012\u0000" + + "\u01da\u01dc\u0003*\u0015\u0000\u01db\u01da\u0001\u0000\u0000\u0000\u01dc" + + "\u01dd\u0001\u0000\u0000\u0000\u01dd\u01db\u0001\u0000\u0000\u0000\u01dd" + + "\u01de\u0001\u0000\u0000\u0000\u01de\u01e2\u0001\u0000\u0000\u0000\u01df" + + "\u01e1\u0003(\u0014\u0000\u01e0\u01df\u0001\u0000\u0000\u0000\u01e1\u01e4" + + "\u0001\u0000\u0000\u0000\u01e2\u01e0\u0001\u0000\u0000\u0000\u01e2\u01e3" + + "\u0001\u0000\u0000\u0000\u01e3\u01e5\u0001\u0000\u0000\u0000\u01e4\u01e2" + + "\u0001\u0000\u0000\u0000\u01e5\u01e6\u0005\u0003\u0000\u0000\u01e6\u01e8" + + "\u0001\u0000\u0000\u0000\u01e7\u01c2\u0001\u0000\u0000\u0000\u01e7\u01cd" + + "\u0001\u0000\u0000\u0000\u01e7\u01d8\u0001\u0000\u0000\u0000\u01e8=\u0001" + + "\u0000\u0000\u0000\u01e9\u0204\u0003<\u001e\u0000\u01ea\u01eb\u0005\u0002" + + "\u0000\u0000\u01eb\u01ec\u0005F\u0000\u0000\u01ec\u01ee\u0005\u0002\u0000" + + "\u0000\u01ed\u01ef\u0003\u001c\u000e\u0000\u01ee\u01ed\u0001\u0000\u0000" + + "\u0000\u01ef\u01f0\u0001\u0000\u0000\u0000\u01f0\u01ee\u0001\u0000\u0000" + + "\u0000\u01f0\u01f1\u0001\u0000\u0000\u0000\u01f1\u01f2\u0001\u0000\u0000" + + "\u0000\u01f2\u01f3\u0005\u0003\u0000\u0000\u01f3\u01f4\u0005\u0002\u0000" + + "\u0000\u01f4\u01f6\u0003$\u0012\u0000\u01f5\u01f7\u0003*\u0015\u0000\u01f6" + + "\u01f5\u0001\u0000\u0000\u0000\u01f7\u01f8\u0001\u0000\u0000\u0000\u01f8" + + "\u01f6\u0001\u0000\u0000\u0000\u01f8\u01f9\u0001\u0000\u0000\u0000\u01f9" + + "\u01fd\u0001\u0000\u0000\u0000\u01fa\u01fc\u0003(\u0014\u0000\u01fb\u01fa" + + "\u0001\u0000\u0000\u0000\u01fc\u01ff\u0001\u0000\u0000\u0000\u01fd\u01fb" + + "\u0001\u0000\u0000\u0000\u01fd\u01fe\u0001\u0000\u0000\u0000\u01fe\u0200" + + "\u0001\u0000\u0000\u0000\u01ff\u01fd\u0001\u0000\u0000\u0000\u0200\u0201" + + "\u0005\u0003\u0000\u0000\u0201\u0202\u0005\u0003\u0000\u0000\u0202\u0204" + + "\u0001\u0000\u0000\u0000\u0203\u01e9\u0001\u0000\u0000\u0000\u0203\u01ea" + + "\u0001\u0000\u0000\u0000\u0204?\u0001\u0000\u0000\u0000\u0205\u0206\u0005" + + "o\u0000\u0000\u0206\u0208\u0005\u0002\u0000\u0000\u0207\u0209\u00038\u001c" + + "\u0000\u0208\u0207\u0001\u0000\u0000\u0000\u0209\u020a\u0001\u0000\u0000" + + "\u0000\u020a\u0208\u0001\u0000\u0000\u0000\u020a\u020b\u0001\u0000\u0000" + + "\u0000\u020b\u020c\u0001\u0000\u0000\u0000\u020c\u020d\u0005\u0003\u0000" + + "\u0000\u020d\u0223\u0001\u0000\u0000\u0000\u020e\u020f\u0005W\u0000\u0000" + + "\u020f\u0211\u0005\u0002\u0000\u0000\u0210\u0212\u0003>\u001f\u0000\u0211" + + "\u0210\u0001\u0000\u0000\u0000\u0212\u0213\u0001\u0000\u0000\u0000\u0213" + + "\u0211\u0001\u0000\u0000\u0000\u0213\u0214\u0001\u0000\u0000\u0000\u0214" + + "\u0215\u0001\u0000\u0000\u0000\u0215\u0216\u0005\u0003\u0000\u0000\u0216" + + "\u0223\u0001\u0000\u0000\u0000\u0217\u0218\u0005p\u0000\u0000\u0218\u0223" + + "\u0003\u0014\n\u0000\u0219\u021a\u0005X\u0000\u0000\u021a\u0223\u0003" + + "\u0014\n\u0000\u021b\u021c\u0005S\u0000\u0000\u021c\u0223\u0003\u0014" + + "\n\u0000\u021d\u021e\u0005t\u0000\u0000\u021e\u0223\u0003\u0014\n\u0000" + + "\u021f\u0220\u0005`\u0000\u0000\u0220\u0223\u0003\u0014\n\u0000\u0221" + + "\u0223\u0003(\u0014\u0000\u0222\u0205\u0001\u0000\u0000\u0000\u0222\u020e" + + "\u0001\u0000\u0000\u0000\u0222\u0217\u0001\u0000\u0000\u0000\u0222\u0219" + + "\u0001\u0000\u0000\u0000\u0222\u021b\u0001\u0000\u0000\u0000\u0222\u021d" + + "\u0001\u0000\u0000\u0000\u0222\u021f\u0001\u0000\u0000\u0000\u0222\u0221" + + "\u0001\u0000\u0000\u0000\u0223A\u0001\u0000\u0000\u0000\u0224\u0225\u0005" + + "\u0002\u0000\u0000\u0225\u0226\u0005\u0018\u0000\u0000\u0226\u0228\u0003" + + "\u001c\u000e\u0000\u0227\u0229\u0003@ \u0000\u0228\u0227\u0001\u0000\u0000" + + "\u0000\u0229\u022a\u0001\u0000\u0000\u0000\u022a\u0228\u0001\u0000\u0000" + + "\u0000\u022a\u022b\u0001\u0000\u0000\u0000\u022b\u022c\u0001\u0000\u0000" + + "\u0000\u022c\u022d\u0005\u0003\u0000\u0000\u022dC\u0001\u0000\u0000\u0000" + + "\u022e\u022f\u0005s\u0000\u0000\u022f\u0231\u0005\u0002\u0000\u0000\u0230" + + "\u0232\u0003\u001c\u000e\u0000\u0231\u0230\u0001\u0000\u0000\u0000\u0232" + + "\u0233\u0001\u0000\u0000\u0000\u0233\u0231\u0001\u0000\u0000\u0000\u0233" + + "\u0234\u0001\u0000\u0000\u0000\u0234\u0235\u0001\u0000\u0000\u0000\u0235" + + "\u0236\u0005\u0003\u0000\u0000\u0236\u0241\u0001\u0000\u0000\u0000\u0237" + + "\u0238\u0005[\u0000\u0000\u0238\u0241\u0003\u0014\n\u0000\u0239\u023a" + + "\u0005V\u0000\u0000\u023a\u0241\u0003\u0014\n\u0000\u023b\u023c\u0005" + + "t\u0000\u0000\u023c\u0241\u0003\u0014\n\u0000\u023d\u023e\u0005`\u0000" + + "\u0000\u023e\u0241\u0003\u0014\n\u0000\u023f\u0241\u0003(\u0014\u0000" + + "\u0240\u022e\u0001\u0000\u0000\u0000\u0240\u0237\u0001\u0000\u0000\u0000" + + "\u0240\u0239\u0001\u0000\u0000\u0000\u0240\u023b\u0001\u0000\u0000\u0000" + + "\u0240\u023d\u0001\u0000\u0000\u0000\u0240\u023f\u0001\u0000\u0000\u0000" + + "\u0241E\u0001\u0000\u0000\u0000\u0242\u0243\u0005\u0002\u0000\u0000\u0243" + + "\u0244\u0005\u0014\u0000\u0000\u0244\u0246\u0003\u001c\u000e\u0000\u0245" + + "\u0247\u0003D\"\u0000\u0246\u0245\u0001\u0000\u0000\u0000\u0247\u0248" + + "\u0001\u0000\u0000\u0000\u0248\u0246\u0001\u0000\u0000\u0000\u0248\u0249" + + "\u0001\u0000\u0000\u0000\u0249\u024a\u0001\u0000\u0000\u0000\u024a\u024b" + + "\u0005\u0003\u0000\u0000\u024bG\u0001\u0000\u0000\u0000\u024c\u024d\u0005" + + "\u0002\u0000\u0000\u024d\u024e\u0003\u001c\u000e\u0000\u024e\u024f\u0003" + + "\f\u0006\u0000\u024f\u0250\u0005\u0003\u0000\u0000\u0250I\u0001\u0000" + + "\u0000\u0000\u0251\u0252\u0005\u0002\u0000\u0000\u0252\u0253\u0003\u001c" + + "\u000e\u0000\u0253\u0254\u0003*\u0015\u0000\u0254\u0255\u0005\u0003\u0000" + + "\u0000\u0255K\u0001\u0000\u0000\u0000\u0256\u0257\u0005\u0002\u0000\u0000" + + "\u0257\u025b\u0003\u001c\u000e\u0000\u0258\u025a\u0003J%\u0000\u0259\u0258" + + "\u0001\u0000\u0000\u0000\u025a\u025d\u0001\u0000\u0000\u0000\u025b\u0259" + + "\u0001\u0000\u0000\u0000\u025b\u025c\u0001\u0000\u0000\u0000\u025c\u025e" + + "\u0001\u0000\u0000\u0000\u025d\u025b\u0001\u0000\u0000\u0000\u025e\u025f" + + "\u0005\u0003\u0000\u0000\u025fM\u0001\u0000\u0000\u0000\u0260\u0262\u0005" + + "\u0002\u0000\u0000\u0261\u0263\u0003L&\u0000\u0262\u0261\u0001\u0000\u0000" + + "\u0000\u0263\u0264\u0001\u0000\u0000\u0000\u0264\u0262\u0001\u0000\u0000" + + "\u0000\u0264\u0265\u0001\u0000\u0000\u0000\u0265\u0266\u0001\u0000\u0000" + + "\u0000\u0266\u0267\u0005\u0003\u0000\u0000\u0267\u027b\u0001\u0000\u0000" + + "\u0000\u0268\u0269\u0005\u0002\u0000\u0000\u0269\u026a\u0005F\u0000\u0000" + + "\u026a\u026c\u0005\u0002\u0000\u0000\u026b\u026d\u0003\u001c\u000e\u0000" + + "\u026c\u026b\u0001\u0000\u0000\u0000\u026d\u026e\u0001\u0000\u0000\u0000" + + "\u026e\u026c\u0001\u0000\u0000\u0000\u026e\u026f\u0001\u0000\u0000\u0000" + + "\u026f\u0270\u0001\u0000\u0000\u0000\u0270\u0271\u0005\u0003\u0000\u0000" + + "\u0271\u0273\u0005\u0002\u0000\u0000\u0272\u0274\u0003L&\u0000\u0273\u0272" + + "\u0001\u0000\u0000\u0000\u0274\u0275\u0001\u0000\u0000\u0000\u0275\u0273" + + "\u0001\u0000\u0000\u0000\u0275\u0276\u0001\u0000\u0000\u0000\u0276\u0277" + + "\u0001\u0000\u0000\u0000\u0277\u0278\u0005\u0003\u0000\u0000\u0278\u0279" + + "\u0005\u0003\u0000\u0000\u0279\u027b\u0001\u0000\u0000\u0000\u027a\u0260" + + "\u0001\u0000\u0000\u0000\u027a\u0268\u0001\u0000\u0000\u0000\u027bO\u0001" + + "\u0000\u0000\u0000\u027c\u027d\u0005\u0002\u0000\u0000\u027d\u027e\u0003" + + "\u001c\u000e\u0000\u027e\u0282\u0005\u0002\u0000\u0000\u027f\u0281\u0003" + + "0\u0018\u0000\u0280\u027f\u0001\u0000\u0000\u0000\u0281\u0284\u0001\u0000" + + "\u0000\u0000\u0282\u0280\u0001\u0000\u0000\u0000\u0282\u0283\u0001\u0000" + + "\u0000\u0000\u0283\u0285\u0001\u0000\u0000\u0000\u0284\u0282\u0001\u0000" + + "\u0000\u0000\u0285\u0286\u0005\u0003\u0000\u0000\u0286\u0287\u0003*\u0015" + + "\u0000\u0287\u0288\u0005\u0003\u0000\u0000\u0288Q\u0001\u0000\u0000\u0000" + + "\u0289\u028a\u0003\u001c\u000e\u0000\u028a\u028e\u0005\u0002\u0000\u0000" + + "\u028b\u028d\u00030\u0018\u0000\u028c\u028b\u0001\u0000\u0000\u0000\u028d" + + "\u0290\u0001\u0000\u0000\u0000\u028e\u028c\u0001\u0000\u0000\u0000\u028e" + + "\u028f\u0001\u0000\u0000\u0000\u028f\u0291\u0001\u0000\u0000\u0000\u0290" + + "\u028e\u0001\u0000\u0000\u0000\u0291\u0292\u0005\u0003\u0000\u0000\u0292" + + "\u0293\u0003*\u0015\u0000\u0293\u0294\u00036\u001b\u0000\u0294S\u0001" + + "\u0000\u0000\u0000\u0295\u029c\u0003\u001c\u000e\u0000\u0296\u0297\u0005" + + "\u0002\u0000\u0000\u0297\u0298\u0005\r\u0000\u0000\u0298\u0299\u0003\u001c" + + "\u000e\u0000\u0299\u029a\u0005\u0003\u0000\u0000\u029a\u029c\u0001\u0000" + + "\u0000\u0000\u029b\u0295\u0001\u0000\u0000\u0000\u029b\u0296\u0001\u0000" + + "\u0000\u0000\u029cU\u0001\u0000\u0000\u0000\u029d\u029f\u0003\u0094J\u0000" + + "\u029e\u029d\u0001\u0000\u0000\u0000\u029f\u02a2\u0001\u0000\u0000\u0000" + + "\u02a0\u029e\u0001\u0000\u0000\u0000\u02a0\u02a1\u0001\u0000\u0000\u0000" + + "\u02a1W\u0001\u0000\u0000\u0000\u02a2\u02a0\u0001\u0000\u0000\u0000\u02a3" + + "\u02a4\u0005\u001d\u0000\u0000\u02a4\u02a5\u00036\u001b\u0000\u02a5Y\u0001" + + "\u0000\u0000\u0000\u02a6\u02a7\u0005\u001e\u0000\u0000\u02a7[\u0001\u0000" + + "\u0000\u0000\u02a8\u02a9\u0005\u001f\u0000\u0000\u02a9\u02ad\u0005\u0002" + + "\u0000\u0000\u02aa\u02ac\u0003T*\u0000\u02ab\u02aa\u0001\u0000\u0000\u0000" + + "\u02ac\u02af\u0001\u0000\u0000\u0000\u02ad\u02ab\u0001\u0000\u0000\u0000" + + "\u02ad\u02ae\u0001\u0000\u0000\u0000\u02ae\u02b0\u0001\u0000\u0000\u0000" + + "\u02af\u02ad\u0001\u0000\u0000\u0000\u02b0\u02b1\u0005\u0003\u0000\u0000" + + "\u02b1]\u0001\u0000\u0000\u0000\u02b2\u02b3\u0005 \u0000\u0000\u02b3\u02b4" + + "\u0003\u001c\u000e\u0000\u02b4\u02b5\u0003*\u0015\u0000\u02b5_\u0001\u0000" + + "\u0000\u0000\u02b6\u02b7\u0005!\u0000\u0000\u02b7\u02b8\u0003\u001c\u000e" + + "\u0000\u02b8\u02b9\u0003N\'\u0000\u02b9a\u0001\u0000\u0000\u0000\u02ba" + + "\u02bb\u0005\"\u0000\u0000\u02bb\u02bd\u0005\u0002\u0000\u0000\u02bc\u02be" + + "\u0003H$\u0000\u02bd\u02bc\u0001\u0000\u0000\u0000\u02be\u02bf\u0001\u0000" + + "\u0000\u0000\u02bf\u02bd\u0001\u0000\u0000\u0000\u02bf\u02c0\u0001\u0000" + + "\u0000\u0000\u02c0\u02c1\u0001\u0000\u0000\u0000\u02c1\u02c2\u0005\u0003" + + "\u0000\u0000\u02c2\u02c4\u0005\u0002\u0000\u0000\u02c3\u02c5\u0003N\'" + + "\u0000\u02c4\u02c3\u0001\u0000\u0000\u0000\u02c5\u02c6\u0001\u0000\u0000" + + "\u0000\u02c6\u02c4\u0001\u0000\u0000\u0000\u02c6\u02c7\u0001\u0000\u0000" + + "\u0000\u02c7\u02c8\u0001\u0000\u0000\u0000\u02c8\u02c9\u0005\u0003\u0000" + + "\u0000\u02c9c\u0001\u0000\u0000\u0000\u02ca\u02cb\u0005#\u0000\u0000\u02cb" + + "\u02cc\u0003\u001c\u000e\u0000\u02cc\u02d0\u0005\u0002\u0000\u0000\u02cd" + + "\u02cf\u0003*\u0015\u0000\u02ce\u02cd\u0001\u0000\u0000\u0000\u02cf\u02d2" + + "\u0001\u0000\u0000\u0000\u02d0\u02ce\u0001\u0000\u0000\u0000\u02d0\u02d1" + + "\u0001\u0000\u0000\u0000\u02d1\u02d3\u0001\u0000\u0000\u0000\u02d2\u02d0" + + "\u0001\u0000\u0000\u0000\u02d3\u02d4\u0005\u0003\u0000\u0000\u02d4\u02d5" + + "\u0003*\u0015\u0000\u02d5e\u0001\u0000\u0000\u0000\u02d6\u02d7\u0005$" + + "\u0000\u0000\u02d7\u02d8\u0003\u001c\u000e\u0000\u02d8\u02d9\u0003\f\u0006" + + "\u0000\u02d9g\u0001\u0000\u0000\u0000\u02da\u02db\u0005%\u0000\u0000\u02db" + + "\u02dc\u0003R)\u0000\u02dci\u0001\u0000\u0000\u0000\u02dd\u02de\u0005" + + "&\u0000\u0000\u02de\u02df\u0003R)\u0000\u02dfk\u0001\u0000\u0000\u0000" + + "\u02e0\u02e1\u0005\'\u0000\u0000\u02e1\u02e3\u0005\u0002\u0000\u0000\u02e2" + + "\u02e4\u0003P(\u0000\u02e3\u02e2\u0001\u0000\u0000\u0000\u02e4\u02e5\u0001" + + "\u0000\u0000\u0000\u02e5\u02e3\u0001\u0000\u0000\u0000\u02e5\u02e6\u0001" + + "\u0000\u0000\u0000\u02e6\u02e7\u0001\u0000\u0000\u0000\u02e7\u02e8\u0005" + + "\u0003\u0000\u0000\u02e8\u02ea\u0005\u0002\u0000\u0000\u02e9\u02eb\u0003" + + "6\u001b\u0000\u02ea\u02e9\u0001\u0000\u0000\u0000\u02eb\u02ec\u0001\u0000" + + "\u0000\u0000\u02ec\u02ea\u0001\u0000\u0000\u0000\u02ec\u02ed\u0001\u0000" + + "\u0000\u0000\u02ed\u02ee\u0001\u0000\u0000\u0000\u02ee\u02ef\u0005\u0003" + + "\u0000\u0000\u02efm\u0001\u0000\u0000\u0000\u02f0\u02f1\u0005(\u0000\u0000" + + "\u02f1\u02f2\u0003\u001c\u000e\u0000\u02f2\u02f6\u0005\u0002\u0000\u0000" + + "\u02f3\u02f5\u0003\u001c\u000e\u0000\u02f4\u02f3\u0001\u0000\u0000\u0000" + + "\u02f5\u02f8\u0001\u0000\u0000\u0000\u02f6\u02f4\u0001\u0000\u0000\u0000" + + "\u02f6\u02f7\u0001\u0000\u0000\u0000\u02f7\u02f9\u0001\u0000\u0000\u0000" + + "\u02f8\u02f6\u0001\u0000\u0000\u0000\u02f9\u02fa\u0005\u0003\u0000\u0000" + + "\u02fa\u02fb\u0003*\u0015\u0000\u02fbo\u0001\u0000\u0000\u0000\u02fc\u02fd" + + "\u0005)\u0000\u0000\u02fd\u02fe\u0003\u0014\n\u0000\u02feq\u0001\u0000" + + "\u0000\u0000\u02ff\u0300\u0005*\u0000\u0000\u0300s\u0001\u0000\u0000\u0000" + + "\u0301\u0302\u0005+\u0000\u0000\u0302u\u0001\u0000\u0000\u0000\u0303\u0304" + + "\u0005,\u0000\u0000\u0304w\u0001\u0000\u0000\u0000\u0305\u0306\u0005-" + + "\u0000\u0000\u0306\u0307\u0003\u009aM\u0000\u0307y\u0001\u0000\u0000\u0000" + + "\u0308\u0309\u0005.\u0000\u0000\u0309{\u0001\u0000\u0000\u0000\u030a\u030b" + + "\u0005/\u0000\u0000\u030b\u030c\u0003\u001a\r\u0000\u030c}\u0001\u0000" + + "\u0000\u0000\u030d\u030e\u00050\u0000\u0000\u030e\u007f\u0001\u0000\u0000" + + "\u0000\u030f\u0310\u00051\u0000\u0000\u0310\u0081\u0001\u0000\u0000\u0000" + + "\u0311\u0312\u00052\u0000\u0000\u0312\u0083\u0001\u0000\u0000\u0000\u0313" + + "\u0314\u00053\u0000\u0000\u0314\u0316\u0005\u0002\u0000\u0000\u0315\u0317" + + "\u00036\u001b\u0000\u0316\u0315\u0001\u0000\u0000\u0000\u0317\u0318\u0001" + + "\u0000\u0000\u0000\u0318\u0316\u0001\u0000\u0000\u0000\u0318\u0319\u0001" + + "\u0000\u0000\u0000\u0319\u031a\u0001\u0000\u0000\u0000\u031a\u031b\u0005" + + "\u0003\u0000\u0000\u031b\u0085\u0001\u0000\u0000\u0000\u031c\u031d\u0005" + + "4\u0000\u0000\u031d\u031e\u0003\f\u0006\u0000\u031e\u0087\u0001\u0000" + + "\u0000\u0000\u031f\u0320\u00055\u0000\u0000\u0320\u0321\u0003\f\u0006" + + "\u0000\u0321\u0089\u0001\u0000\u0000\u0000\u0322\u0323\u00056\u0000\u0000" + + "\u0323\u008b\u0001\u0000\u0000\u0000\u0324\u0325\u00057\u0000\u0000\u0325" + + "\u008d\u0001\u0000\u0000\u0000\u0326\u0327\u00058\u0000\u0000\u0327\u0328" + + "\u0003(\u0014\u0000\u0328\u008f\u0001\u0000\u0000\u0000\u0329\u032a\u0005" + + "9\u0000\u0000\u032a\u032b\u0003\u001c\u000e\u0000\u032b\u0091\u0001\u0000" + + "\u0000\u0000\u032c\u032d\u0005:\u0000\u0000\u032d\u032e\u0003\u0098L\u0000" + + "\u032e\u0093\u0001\u0000\u0000\u0000\u032f\u0330\u0005\u0002\u0000\u0000" + + "\u0330\u0331\u0003X,\u0000\u0331\u0332\u0005\u0003\u0000\u0000\u0332\u03a8" + + "\u0001\u0000\u0000\u0000\u0333\u0334\u0005\u0002\u0000\u0000\u0334\u0335" + + "\u0003Z-\u0000\u0335\u0336\u0005\u0003\u0000\u0000\u0336\u03a8\u0001\u0000" + + "\u0000\u0000\u0337\u0338\u0005\u0002\u0000\u0000\u0338\u0339\u0003\\." + + "\u0000\u0339\u033a\u0005\u0003\u0000\u0000\u033a\u03a8\u0001\u0000\u0000" + + "\u0000\u033b\u033c\u0005\u0002\u0000\u0000\u033c\u033d\u0003^/\u0000\u033d" + + "\u033e\u0005\u0003\u0000\u0000\u033e\u03a8\u0001\u0000\u0000\u0000\u033f" + + "\u0340\u0005\u0002\u0000\u0000\u0340\u0341\u0003`0\u0000\u0341\u0342\u0005" + + "\u0003\u0000\u0000\u0342\u03a8\u0001\u0000\u0000\u0000\u0343\u0344\u0005" + + "\u0002\u0000\u0000\u0344\u0345\u0003b1\u0000\u0345\u0346\u0005\u0003\u0000" + + "\u0000\u0346\u03a8\u0001\u0000\u0000\u0000\u0347\u0348\u0005\u0002\u0000" + + "\u0000\u0348\u0349\u0003d2\u0000\u0349\u034a\u0005\u0003\u0000\u0000\u034a" + + "\u03a8\u0001\u0000\u0000\u0000\u034b\u034c\u0005\u0002\u0000\u0000\u034c" + + "\u034d\u0003f3\u0000\u034d\u034e\u0005\u0003\u0000\u0000\u034e\u03a8\u0001" + + "\u0000\u0000\u0000\u034f\u0350\u0005\u0002\u0000\u0000\u0350\u0351\u0003" + + "h4\u0000\u0351\u0352\u0005\u0003\u0000\u0000\u0352\u03a8\u0001\u0000\u0000" + + "\u0000\u0353\u0354\u0005\u0002\u0000\u0000\u0354\u0355\u0003j5\u0000\u0355" + + "\u0356\u0005\u0003\u0000\u0000\u0356\u03a8\u0001\u0000\u0000\u0000\u0357" + + "\u0358\u0005\u0002\u0000\u0000\u0358\u0359\u0003l6\u0000\u0359\u035a\u0005" + + "\u0003\u0000\u0000\u035a\u03a8\u0001\u0000\u0000\u0000\u035b\u035c\u0005" + + "\u0002\u0000\u0000\u035c\u035d\u0003n7\u0000\u035d\u035e\u0005\u0003\u0000" + + "\u0000\u035e\u03a8\u0001\u0000\u0000\u0000\u035f\u0360\u0005\u0002\u0000" + + "\u0000\u0360\u0361\u0003p8\u0000\u0361\u0362\u0005\u0003\u0000\u0000\u0362" + + "\u03a8\u0001\u0000\u0000\u0000\u0363\u0364\u0005\u0002\u0000\u0000\u0364" + + "\u0365\u0003r9\u0000\u0365\u0366\u0005\u0003\u0000\u0000\u0366\u03a8\u0001" + + "\u0000\u0000\u0000\u0367\u0368\u0005\u0002\u0000\u0000\u0368\u0369\u0003" + + "t:\u0000\u0369\u036a\u0005\u0003\u0000\u0000\u036a\u03a8\u0001\u0000\u0000" + + "\u0000\u036b\u036c\u0005\u0002\u0000\u0000\u036c\u036d\u0003v;\u0000\u036d" + + "\u036e\u0005\u0003\u0000\u0000\u036e\u03a8\u0001\u0000\u0000\u0000\u036f" + + "\u0370\u0005\u0002\u0000\u0000\u0370\u0371\u0003x<\u0000\u0371\u0372\u0005" + + "\u0003\u0000\u0000\u0372\u03a8\u0001\u0000\u0000\u0000\u0373\u0374\u0005" + + "\u0002\u0000\u0000\u0374\u0375\u0003z=\u0000\u0375\u0376\u0005\u0003\u0000" + + "\u0000\u0376\u03a8\u0001\u0000\u0000\u0000\u0377\u0378\u0005\u0002\u0000" + + "\u0000\u0378\u0379\u0003|>\u0000\u0379\u037a\u0005\u0003\u0000\u0000\u037a" + + "\u03a8\u0001\u0000\u0000\u0000\u037b\u037c\u0005\u0002\u0000\u0000\u037c" + + "\u037d\u0003~?\u0000\u037d\u037e\u0005\u0003\u0000\u0000\u037e\u03a8\u0001" + + "\u0000\u0000\u0000\u037f\u0380\u0005\u0002\u0000\u0000\u0380\u0381\u0003" + + "\u0080@\u0000\u0381\u0382\u0005\u0003\u0000\u0000\u0382\u03a8\u0001\u0000" + + "\u0000\u0000\u0383\u0384\u0005\u0002\u0000\u0000\u0384\u0385\u0003\u0082" + + "A\u0000\u0385\u0386\u0005\u0003\u0000\u0000\u0386\u03a8\u0001\u0000\u0000" + + "\u0000\u0387\u0388\u0005\u0002\u0000\u0000\u0388\u0389\u0003\u0084B\u0000" + + "\u0389\u038a\u0005\u0003\u0000\u0000\u038a\u03a8\u0001\u0000\u0000\u0000" + + "\u038b\u038c\u0005\u0002\u0000\u0000\u038c\u038d\u0003\u0086C\u0000\u038d" + + "\u038e\u0005\u0003\u0000\u0000\u038e\u03a8\u0001\u0000\u0000\u0000\u038f" + + "\u0390\u0005\u0002\u0000\u0000\u0390\u0391\u0003\u0088D\u0000\u0391\u0392" + + "\u0005\u0003\u0000\u0000\u0392\u03a8\u0001\u0000\u0000\u0000\u0393\u0394" + + "\u0005\u0002\u0000\u0000\u0394\u0395\u0003\u008aE\u0000\u0395\u0396\u0005" + + "\u0003\u0000\u0000\u0396\u03a8\u0001\u0000\u0000\u0000\u0397\u0398\u0005" + + "\u0002\u0000\u0000\u0398\u0399\u0003\u008cF\u0000\u0399\u039a\u0005\u0003" + + "\u0000\u0000\u039a\u03a8\u0001\u0000\u0000\u0000\u039b\u039c\u0005\u0002" + + "\u0000\u0000\u039c\u039d\u0003\u008eG\u0000\u039d\u039e\u0005\u0003\u0000" + + "\u0000\u039e\u03a8\u0001\u0000\u0000\u0000\u039f\u03a0\u0005\u0002\u0000" + + "\u0000\u03a0\u03a1\u0003\u0090H\u0000\u03a1\u03a2\u0005\u0003\u0000\u0000" + + "\u03a2\u03a8\u0001\u0000\u0000\u0000\u03a3\u03a4\u0005\u0002\u0000\u0000" + + "\u03a4\u03a5\u0003\u0092I\u0000\u03a5\u03a6\u0005\u0003\u0000\u0000\u03a6" + + "\u03a8\u0001\u0000\u0000\u0000\u03a7\u032f\u0001\u0000\u0000\u0000\u03a7" + + "\u0333\u0001\u0000\u0000\u0000\u03a7\u0337\u0001\u0000\u0000\u0000\u03a7" + + "\u033b\u0001\u0000\u0000\u0000\u03a7\u033f\u0001\u0000\u0000\u0000\u03a7" + + "\u0343\u0001\u0000\u0000\u0000\u03a7\u0347\u0001\u0000\u0000\u0000\u03a7" + + "\u034b\u0001\u0000\u0000\u0000\u03a7\u034f\u0001\u0000\u0000\u0000\u03a7" + + "\u0353\u0001\u0000\u0000\u0000\u03a7\u0357\u0001\u0000\u0000\u0000\u03a7" + + "\u035b\u0001\u0000\u0000\u0000\u03a7\u035f\u0001\u0000\u0000\u0000\u03a7" + + "\u0363\u0001\u0000\u0000\u0000\u03a7\u0367\u0001\u0000\u0000\u0000\u03a7" + + "\u036b\u0001\u0000\u0000\u0000\u03a7\u036f\u0001\u0000\u0000\u0000\u03a7" + + "\u0373\u0001\u0000\u0000\u0000\u03a7\u0377\u0001\u0000\u0000\u0000\u03a7" + + "\u037b\u0001\u0000\u0000\u0000\u03a7\u037f\u0001\u0000\u0000\u0000\u03a7" + + "\u0383\u0001\u0000\u0000\u0000\u03a7\u0387\u0001\u0000\u0000\u0000\u03a7" + + "\u038b\u0001\u0000\u0000\u0000\u03a7\u038f\u0001\u0000\u0000\u0000\u03a7" + + "\u0393\u0001\u0000\u0000\u0000\u03a7\u0397\u0001\u0000\u0000\u0000\u03a7" + + "\u039b\u0001\u0000\u0000\u0000\u03a7\u039f\u0001\u0000\u0000\u0000\u03a7" + + "\u03a3\u0001\u0000\u0000\u0000\u03a8\u0095\u0001\u0000\u0000\u0000\u03a9" + + "\u03aa\u0007\u0004\u0000\u0000\u03aa\u0097\u0001\u0000\u0000\u0000\u03ab" + + "\u03ac\u0005T\u0000\u0000\u03ac\u03c9\u0003\u0014\n\u0000\u03ad\u03ae" + + "\u0005Y\u0000\u0000\u03ae\u03c9\u0003\u0096K\u0000\u03af\u03b0\u0005Z" + + "\u0000\u0000\u03b0\u03c9\u0003\u0096K\u0000\u03b1\u03b2\u0005b\u0000\u0000" + + "\u03b2\u03c9\u0003\u0096K\u0000\u03b3\u03b4\u0005c\u0000\u0000\u03b4\u03c9" + + "\u0003\u0096K\u0000\u03b5\u03b6\u0005d\u0000\u0000\u03b6\u03c9\u0003\u0096" + + "K\u0000\u03b7\u03b8\u0005e\u0000\u0000\u03b8\u03c9\u0003\u0096K\u0000" + + "\u03b9\u03ba\u0005f\u0000\u0000\u03ba\u03c9\u0003\u0096K\u0000\u03bb\u03bc" + + "\u0005g\u0000\u0000\u03bc\u03c9\u0003\u0096K\u0000\u03bd\u03be\u0005h" + + "\u0000\u0000\u03be\u03c9\u0003\u0096K\u0000\u03bf\u03c0\u0005i\u0000\u0000" + + "\u03c0\u03c9\u0003\f\u0006\u0000\u03c1\u03c2\u0005k\u0000\u0000\u03c2" + + "\u03c9\u0003\u0014\n\u0000\u03c3\u03c4\u0005l\u0000\u0000\u03c4\u03c9" + + "\u0003\f\u0006\u0000\u03c5\u03c6\u0005u\u0000\u0000\u03c6\u03c9\u0003" + + "\f\u0006\u0000\u03c7\u03c9\u0003(\u0014\u0000\u03c8\u03ab\u0001\u0000" + + "\u0000\u0000\u03c8\u03ad\u0001\u0000\u0000\u0000\u03c8\u03af\u0001\u0000" + + "\u0000\u0000\u03c8\u03b1\u0001\u0000\u0000\u0000\u03c8\u03b3\u0001\u0000" + + "\u0000\u0000\u03c8\u03b5\u0001\u0000\u0000\u0000\u03c8\u03b7\u0001\u0000" + + "\u0000\u0000\u03c8\u03b9\u0001\u0000\u0000\u0000\u03c8\u03bb\u0001\u0000" + + "\u0000\u0000\u03c8\u03bd\u0001\u0000\u0000\u0000\u03c8\u03bf\u0001\u0000" + + "\u0000\u0000\u03c8\u03c1\u0001\u0000\u0000\u0000\u03c8\u03c3\u0001\u0000" + + "\u0000\u0000\u03c8\u03c5\u0001\u0000\u0000\u0000\u03c8\u03c7\u0001\u0000" + + "\u0000\u0000\u03c9\u0099\u0001\u0000\u0000\u0000\u03ca\u03d3\u0005N\u0000" + + "\u0000\u03cb\u03d3\u0005O\u0000\u0000\u03cc\u03d3\u0005P\u0000\u0000\u03cd" + + "\u03d3\u0005U\u0000\u0000\u03ce\u03d3\u0005_\u0000\u0000\u03cf\u03d3\u0005" + + "j\u0000\u0000\u03d0\u03d3\u0005v\u0000\u0000\u03d1\u03d3\u0003\u001a\r" + + "\u0000\u03d2\u03ca\u0001\u0000\u0000\u0000\u03d2\u03cb\u0001\u0000\u0000" + + "\u0000\u03d2\u03cc\u0001\u0000\u0000\u0000\u03d2\u03cd\u0001\u0000\u0000" + + "\u0000\u03d2\u03ce\u0001\u0000\u0000\u0000\u03d2\u03cf\u0001\u0000\u0000" + + "\u0000\u03d2\u03d0\u0001\u0000\u0000\u0000\u03d2\u03d1\u0001\u0000\u0000" + + "\u0000\u03d3\u009b\u0001\u0000\u0000\u0000\u03d4\u03d5\u0007\u0005\u0000" + + "\u0000\u03d5\u009d\u0001\u0000\u0000\u0000\u03d6\u03da\u0005\u0015\u0000" + + "\u0000\u03d7\u03da\u0005\u0013\u0000\u0000\u03d8\u03da\u0003 \u0010\u0000" + + "\u03d9\u03d6\u0001\u0000\u0000\u0000\u03d9\u03d7\u0001\u0000\u0000\u0000" + + "\u03d9\u03d8\u0001\u0000\u0000\u0000\u03da\u009f\u0001\u0000\u0000\u0000" + + "\u03db\u03dc\u0005\u0002\u0000\u0000\u03dc\u03dd\u0003h4\u0000\u03dd\u03de" + + "\u0005\u0003\u0000\u0000\u03de\u03e8\u0001\u0000\u0000\u0000\u03df\u03e0" + + "\u0005\u0002\u0000\u0000\u03e0\u03e1\u0003j5\u0000\u03e1\u03e2\u0005\u0003" + + "\u0000\u0000\u03e2\u03e8\u0001\u0000\u0000\u0000\u03e3\u03e4\u0005\u0002" + + "\u0000\u0000\u03e4\u03e5\u0003l6\u0000\u03e5\u03e6\u0005\u0003\u0000\u0000" + + "\u03e6\u03e8\u0001\u0000\u0000\u0000\u03e7\u03db\u0001\u0000\u0000\u0000" + + "\u03e7\u03df\u0001\u0000\u0000\u0000\u03e7\u03e3\u0001\u0000\u0000\u0000" + + "\u03e8\u00a1\u0001\u0000\u0000\u0000\u03e9\u03ea\u0005O\u0000\u0000\u03ea" + + "\u03f7\u0003\f\u0006\u0000\u03eb\u03ec\u0005P\u0000\u0000\u03ec\u03f7" + + "\u0003\u0014\n\u0000\u03ed\u03ee\u0005U\u0000\u0000\u03ee\u03f7\u0003" + + "\u009cN\u0000\u03ef\u03f0\u0005_\u0000\u0000\u03f0\u03f7\u0003\u0014\n" + + "\u0000\u03f1\u03f2\u0005j\u0000\u0000\u03f2\u03f7\u0003\u009eO\u0000\u03f3" + + "\u03f4\u0005v\u0000\u0000\u03f4\u03f7\u0003\u0014\n\u0000\u03f5\u03f7" + + "\u0003(\u0014\u0000\u03f6\u03e9\u0001\u0000\u0000\u0000\u03f6\u03eb\u0001" + + "\u0000\u0000\u0000\u03f6\u03ed\u0001\u0000\u0000\u0000\u03f6\u03ef\u0001" + + "\u0000\u0000\u0000\u03f6\u03f1\u0001\u0000\u0000\u0000\u03f6\u03f3\u0001" + + "\u0000\u0000\u0000\u03f6\u03f5\u0001\u0000\u0000\u0000\u03f7\u00a3\u0001" + + "\u0000\u0000\u0000\u03f8\u03f9\u0005\u0002\u0000\u0000\u03f9\u03fa\u0003" + + "6\u001b\u0000\u03fa\u03fb\u00036\u001b\u0000\u03fb\u03fc\u0005\u0003\u0000" + + "\u0000\u03fc\u00a5\u0001\u0000\u0000\u0000\u03fd\u03fe\u0005\u0002\u0000" + + "\u0000\u03fe\u03ff\u0003\u001c\u000e\u0000\u03ff\u0400\u0003\u0096K\u0000" + + "\u0400\u0401\u0005\u0003\u0000\u0000\u0401\u00a7\u0001\u0000\u0000\u0000" + + "\u0402\u0403\u0007\u0006\u0000\u0000\u0403\u00a9\u0001\u0000\u0000\u0000" + + "\u0404\u0405\u0003\u0014\n\u0000\u0405\u00ab\u0001\u0000\u0000\u0000\u0406" + + "\u040a\u0005\u0002\u0000\u0000\u0407\u0409\u00036\u001b\u0000\u0408\u0407" + + "\u0001\u0000\u0000\u0000\u0409\u040c\u0001\u0000\u0000\u0000\u040a\u0408" + + "\u0001\u0000\u0000\u0000\u040a\u040b\u0001\u0000\u0000\u0000\u040b\u040d" + + "\u0001\u0000\u0000\u0000\u040c\u040a\u0001\u0000\u0000\u0000\u040d\u040e" + + "\u0005\u0003\u0000\u0000\u040e\u00ad\u0001\u0000\u0000\u0000\u040f\u0413" + + "\u0005\u0002\u0000\u0000\u0410\u0412\u0003\u00a6S\u0000\u0411\u0410\u0001" + + "\u0000\u0000\u0000\u0412\u0415\u0001\u0000\u0000\u0000\u0413\u0411\u0001" + + "\u0000\u0000\u0000\u0413\u0414\u0001\u0000\u0000\u0000\u0414\u0416\u0001" + + "\u0000\u0000\u0000\u0415\u0413\u0001\u0000\u0000\u0000\u0416\u0417\u0005" + + "\u0003\u0000\u0000\u0417\u00af\u0001\u0000\u0000\u0000\u0418\u041a\u0005" + + "\u0002\u0000\u0000\u0419\u041b\u0003\u00a2Q\u0000\u041a\u0419\u0001\u0000" + + "\u0000\u0000\u041b\u041c\u0001\u0000\u0000\u0000\u041c\u041a\u0001\u0000" + + "\u0000\u0000\u041c\u041d\u0001\u0000\u0000\u0000\u041d\u041e\u0001\u0000" + + "\u0000\u0000\u041e\u041f\u0005\u0003\u0000\u0000\u041f\u00b1\u0001\u0000" + + "\u0000\u0000\u0420\u0421\u0005\u0002\u0000\u0000\u0421\u0425\u0005w\u0000" + + "\u0000\u0422\u0424\u0003\u00a0P\u0000\u0423\u0422\u0001\u0000\u0000\u0000" + + "\u0424\u0427\u0001\u0000\u0000\u0000\u0425\u0423\u0001\u0000\u0000\u0000" + + "\u0425\u0426\u0001\u0000\u0000\u0000\u0426\u0428\u0001\u0000\u0000\u0000" + + "\u0427\u0425\u0001\u0000\u0000\u0000\u0428\u0432\u0005\u0003\u0000\u0000" + + "\u0429\u042d\u0005\u0002\u0000\u0000\u042a\u042c\u0003\u00a0P\u0000\u042b" + + "\u042a\u0001\u0000\u0000\u0000\u042c\u042f\u0001\u0000\u0000\u0000\u042d" + + "\u042b\u0001\u0000\u0000\u0000\u042d\u042e\u0001\u0000\u0000\u0000\u042e" + + "\u0430\u0001\u0000\u0000\u0000\u042f\u042d\u0001\u0000\u0000\u0000\u0430" + + "\u0432\u0005\u0003\u0000\u0000\u0431\u0420\u0001\u0000\u0000\u0000\u0431" + + "\u0429\u0001\u0000\u0000\u0000\u0432\u00b3\u0001\u0000\u0000\u0000\u0433" + + "\u0434\u0003&\u0013\u0000\u0434\u00b5\u0001\u0000\u0000\u0000\u0435\u0436" + + "\u0003 \u0010\u0000\u0436\u00b7\u0001\u0000\u0000\u0000\u0437\u043b\u0005" + + "\u0002\u0000\u0000\u0438\u043a\u0003\u001c\u000e\u0000\u0439\u0438\u0001" + + "\u0000\u0000\u0000\u043a\u043d\u0001\u0000\u0000\u0000\u043b\u0439\u0001" + + "\u0000\u0000\u0000\u043b\u043c\u0001\u0000\u0000\u0000\u043c\u043e\u0001" + + "\u0000\u0000\u0000\u043d\u043b\u0001\u0000\u0000\u0000\u043e\u043f\u0005" + + "\u0003\u0000\u0000\u043f\u00b9\u0001\u0000\u0000\u0000\u0440\u0444\u0005" + + "\u0002\u0000\u0000\u0441\u0443\u0003\u001c\u000e\u0000\u0442\u0441\u0001" + + "\u0000\u0000\u0000\u0443\u0446\u0001\u0000\u0000\u0000\u0444\u0442\u0001" + + "\u0000\u0000\u0000\u0444\u0445\u0001\u0000\u0000\u0000\u0445\u0447\u0001" + + "\u0000\u0000\u0000\u0446\u0444\u0001\u0000\u0000\u0000\u0447\u0448\u0005" + + "\u0003\u0000\u0000\u0448\u00bb\u0001\u0000\u0000\u0000\u0449\u044b\u0005" + + "\u0002\u0000\u0000\u044a\u044c\u0003\u00a4R\u0000\u044b\u044a\u0001\u0000" + + "\u0000\u0000\u044c\u044d\u0001\u0000\u0000\u0000\u044d\u044b\u0001\u0000" + + "\u0000\u0000\u044d\u044e\u0001\u0000\u0000\u0000\u044e\u044f\u0001\u0000" + + "\u0000\u0000\u044f\u0450\u0005\u0003\u0000\u0000\u0450\u00bd\u0001\u0000" + + "\u0000\u0000\u0451\u045d\u0003\u00a8T\u0000\u0452\u045d\u0003\u00aaU\u0000" + + "\u0453\u045d\u0003\u00acV\u0000\u0454\u045d\u0003\u00aeW\u0000\u0455\u045d" + + "\u0003\u00b0X\u0000\u0456\u045d\u0003\u00b2Y\u0000\u0457\u045d\u0003\u00b4" + + "Z\u0000\u0458\u045d\u0003\u00b6[\u0000\u0459\u045d\u0003\u00b8\\\u0000" + + "\u045a\u045d\u0003\u00ba]\u0000\u045b\u045d\u0003\u00bc^\u0000\u045c\u0451" + + "\u0001\u0000\u0000\u0000\u045c\u0452\u0001\u0000\u0000\u0000\u045c\u0453" + + "\u0001\u0000\u0000\u0000\u045c\u0454\u0001\u0000\u0000\u0000\u045c\u0455" + + "\u0001\u0000\u0000\u0000\u045c\u0456\u0001\u0000\u0000\u0000\u045c\u0457" + + "\u0001\u0000\u0000\u0000\u045c\u0458\u0001\u0000\u0000\u0000\u045c\u0459" + + "\u0001\u0000\u0000\u0000\u045c\u045a\u0001\u0000\u0000\u0000\u045c\u045b" + + "\u0001\u0000\u0000\u0000\u045d\u00bf\u0001\u0000\u0000\u0000\u045e\u0467" + + "\u0005\u0017\u0000\u0000\u045f\u0467\u0003\u00be_\u0000\u0460\u0467\u0005" + + "\u001b\u0000\u0000\u0461\u0462\u0005\u0002\u0000\u0000\u0462\u0463\u0005" + + "\u0010\u0000\u0000\u0463\u0464\u0003\u0014\n\u0000\u0464\u0465\u0005\u0003" + + "\u0000\u0000\u0465\u0467\u0001\u0000\u0000\u0000\u0466\u045e\u0001\u0000" + + "\u0000\u0000\u0466\u045f\u0001\u0000\u0000\u0000\u0466\u0460\u0001\u0000" + + "\u0000\u0000\u0466\u0461\u0001\u0000\u0000\u0000\u0467\u00c1\u0001\u0000" + + "\u0000\u0000N\u00ce\u00d4\u00ef\u00f7\u00fc\u0100\u0109\u0112\u0116\u011a" + + "\u0123\u0127\u012f\u0133\u0139\u0142\u0146\u014f\u0161\u0165\u0175\u017f" + + "\u018b\u0197\u01a4\u01af\u01b3\u01bb\u01c8\u01d3\u01dd\u01e2\u01e7\u01f0" + + "\u01f8\u01fd\u0203\u020a\u0213\u0222\u022a\u0233\u0240\u0248\u025b\u0264" + + "\u026e\u0275\u027a\u0282\u028e\u029b\u02a0\u02ad\u02bf\u02c6\u02d0\u02e5" + + "\u02ec\u02f6\u0318\u03a7\u03c8\u03d2\u03d9\u03e7\u03f6\u040a\u0413\u041c" + + "\u0425\u042d\u0431\u043b\u0444\u044d\u045c\u0466"; + public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Visitor.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Visitor.java new file mode 100644 index 0000000000..4c46fd2cb1 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Visitor.java @@ -0,0 +1,1943 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2021 Alejandro SerranoMena +// +// SPDX-License-Identifier: Apache-2.0 + +// Generated from +// /home/davidg/IdeaProjects/java-smt-working-branch/java-smt/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2.g4 by ANTLR 4.13.2 +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +import org.antlr.v4.runtime.tree.ParseTreeVisitor; + +/** + * This interface defines a complete generic visitor for a parse tree produced by {@link + * Smtlibv2Parser}. + * + * @param The return type of the visit operation. Use {@link Void} for operations with no return + * type. + */ +public interface Smtlibv2Visitor extends ParseTreeVisitor { + /** + * Visit a parse tree produced by the {@code start_logic} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitStart_logic(Smtlibv2Parser.Start_logicContext ctx); + + /** + * Visit a parse tree produced by the {@code start_theory} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitStart_theory(Smtlibv2Parser.Start_theoryContext ctx); + + /** + * Visit a parse tree produced by the {@code start_script} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitStart_script(Smtlibv2Parser.Start_scriptContext ctx); + + /** + * Visit a parse tree produced by the {@code start_gen_resp} labeled alternative in {@link + * Smtlibv2Parser#start}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitStart_gen_resp(Smtlibv2Parser.Start_gen_respContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#generalReservedWord}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGeneralReservedWord(Smtlibv2Parser.GeneralReservedWordContext ctx); + + /** + * Visit a parse tree produced by the {@code simp_pre_symb} labeled alternative in {@link + * Smtlibv2Parser#simpleSymbol}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSimp_pre_symb(Smtlibv2Parser.Simp_pre_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code simp_undef_symb} labeled alternative in {@link + * Smtlibv2Parser#simpleSymbol}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSimp_undef_symb(Smtlibv2Parser.Simp_undef_symbContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#quotedSymbol}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitQuotedSymbol(Smtlibv2Parser.QuotedSymbolContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#predefSymbol}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPredefSymbol(Smtlibv2Parser.PredefSymbolContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#predefKeyword}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPredefKeyword(Smtlibv2Parser.PredefKeywordContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#numeral}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitNumeral(Smtlibv2Parser.NumeralContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#decimal}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDecimal(Smtlibv2Parser.DecimalContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#hexadecimal}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitHexadecimal(Smtlibv2Parser.HexadecimalContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#binary}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitBinary(Smtlibv2Parser.BinaryContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#string}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitString(Smtlibv2Parser.StringContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#to_fp_expr}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTo_fp_expr(Smtlibv2Parser.To_fp_exprContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#special_regex_operations}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSpecial_regex_operations(Smtlibv2Parser.Special_regex_operationsContext ctx); + + /** + * Visit a parse tree produced by the {@code pre_key} labeled alternative in {@link + * Smtlibv2Parser#keyword}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPre_key(Smtlibv2Parser.Pre_keyContext ctx); + + /** + * Visit a parse tree produced by the {@code key_simsymb} labeled alternative in {@link + * Smtlibv2Parser#keyword}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitKey_simsymb(Smtlibv2Parser.Key_simsymbContext ctx); + + /** + * Visit a parse tree produced by the {@code simpsymb} labeled alternative in {@link + * Smtlibv2Parser#symbol}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSimpsymb(Smtlibv2Parser.SimpsymbContext ctx); + + /** + * Visit a parse tree produced by the {@code quotsymb} labeled alternative in {@link + * Smtlibv2Parser#symbol}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitQuotsymb(Smtlibv2Parser.QuotsymbContext ctx); + + /** + * Visit a parse tree produced by the {@code spec_constant_num} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSpec_constant_num(Smtlibv2Parser.Spec_constant_numContext ctx); + + /** + * Visit a parse tree produced by the {@code spec_constant_dec} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSpec_constant_dec(Smtlibv2Parser.Spec_constant_decContext ctx); + + /** + * Visit a parse tree produced by the {@code spec_constant_hex} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSpec_constant_hex(Smtlibv2Parser.Spec_constant_hexContext ctx); + + /** + * Visit a parse tree produced by the {@code spec_constant_bin} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSpec_constant_bin(Smtlibv2Parser.Spec_constant_binContext ctx); + + /** + * Visit a parse tree produced by the {@code spec_constant_string} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSpec_constant_string(Smtlibv2Parser.Spec_constant_stringContext ctx); + + /** + * Visit a parse tree produced by the {@code spec_constant_fp} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSpec_constant_fp(Smtlibv2Parser.Spec_constant_fpContext ctx); + + /** + * Visit a parse tree produced by the {@code spec_constant_regex} labeled alternative in {@link + * Smtlibv2Parser#spec_constant}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSpec_constant_regex(Smtlibv2Parser.Spec_constant_regexContext ctx); + + /** + * Visit a parse tree produced by the {@code s_expr_spec} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitS_expr_spec(Smtlibv2Parser.S_expr_specContext ctx); + + /** + * Visit a parse tree produced by the {@code s_expr_symb} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitS_expr_symb(Smtlibv2Parser.S_expr_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code s_expr_key} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitS_expr_key(Smtlibv2Parser.S_expr_keyContext ctx); + + /** + * Visit a parse tree produced by the {@code multi_s_expr} labeled alternative in {@link + * Smtlibv2Parser#s_expr}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitMulti_s_expr(Smtlibv2Parser.Multi_s_exprContext ctx); + + /** + * Visit a parse tree produced by the {@code idx_num} labeled alternative in {@link + * Smtlibv2Parser#index}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitIdx_num(Smtlibv2Parser.Idx_numContext ctx); + + /** + * Visit a parse tree produced by the {@code idx_symb} labeled alternative in {@link + * Smtlibv2Parser#index}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitIdx_symb(Smtlibv2Parser.Idx_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code id_symb} labeled alternative in {@link + * Smtlibv2Parser#identifier}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitId_symb(Smtlibv2Parser.Id_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code id_symb_idx} labeled alternative in {@link + * Smtlibv2Parser#identifier}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitId_symb_idx(Smtlibv2Parser.Id_symb_idxContext ctx); + + /** + * Visit a parse tree produced by the {@code attr_spec} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAttr_spec(Smtlibv2Parser.Attr_specContext ctx); + + /** + * Visit a parse tree produced by the {@code attr_symb} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAttr_symb(Smtlibv2Parser.Attr_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code attr_s_expr} labeled alternative in {@link + * Smtlibv2Parser#attribute_value}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAttr_s_expr(Smtlibv2Parser.Attr_s_exprContext ctx); + + /** + * Visit a parse tree produced by the {@code attr_key} labeled alternative in {@link + * Smtlibv2Parser#attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAttr_key(Smtlibv2Parser.Attr_keyContext ctx); + + /** + * Visit a parse tree produced by the {@code attr_key_attr} labeled alternative in {@link + * Smtlibv2Parser#attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAttr_key_attr(Smtlibv2Parser.Attr_key_attrContext ctx); + + /** + * Visit a parse tree produced by the {@code sortfp} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSortfp(Smtlibv2Parser.SortfpContext ctx); + + /** + * Visit a parse tree produced by the {@code sort_id} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSort_id(Smtlibv2Parser.Sort_idContext ctx); + + /** + * Visit a parse tree produced by the {@code multisort} labeled alternative in {@link + * Smtlibv2Parser#sort}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitMultisort(Smtlibv2Parser.MultisortContext ctx); + + /** + * Visit a parse tree produced by the {@code qual_id} labeled alternative in {@link + * Smtlibv2Parser#qual_identifer}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitQual_id(Smtlibv2Parser.Qual_idContext ctx); + + /** + * Visit a parse tree produced by the {@code qual_id_sort} labeled alternative in {@link + * Smtlibv2Parser#qual_identifer}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitQual_id_sort(Smtlibv2Parser.Qual_id_sortContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#var_binding}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitVar_binding(Smtlibv2Parser.Var_bindingContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#sorted_var}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSorted_var(Smtlibv2Parser.Sorted_varContext ctx); + + /** + * Visit a parse tree produced by the {@code pattern_symb} labeled alternative in {@link + * Smtlibv2Parser#pattern}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPattern_symb(Smtlibv2Parser.Pattern_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code pattern_multisymb} labeled alternative in {@link + * Smtlibv2Parser#pattern}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPattern_multisymb(Smtlibv2Parser.Pattern_multisymbContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#match_case}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitMatch_case(Smtlibv2Parser.Match_caseContext ctx); + + /** + * Visit a parse tree produced by the {@code term_spec_const} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_spec_const(Smtlibv2Parser.Term_spec_constContext ctx); + + /** + * Visit a parse tree produced by the {@code term_qual_id} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_qual_id(Smtlibv2Parser.Term_qual_idContext ctx); + + /** + * Visit a parse tree produced by the {@code term_fp_cast} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_fp_cast(Smtlibv2Parser.Term_fp_castContext ctx); + + /** + * Visit a parse tree produced by the {@code term_special_regex} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_special_regex(Smtlibv2Parser.Term_special_regexContext ctx); + + /** + * Visit a parse tree produced by the {@code multiterm} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitMultiterm(Smtlibv2Parser.MultitermContext ctx); + + /** + * Visit a parse tree produced by the {@code term_let} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_let(Smtlibv2Parser.Term_letContext ctx); + + /** + * Visit a parse tree produced by the {@code term_forall} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_forall(Smtlibv2Parser.Term_forallContext ctx); + + /** + * Visit a parse tree produced by the {@code term_exists} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_exists(Smtlibv2Parser.Term_existsContext ctx); + + /** + * Visit a parse tree produced by the {@code term_match} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_match(Smtlibv2Parser.Term_matchContext ctx); + + /** + * Visit a parse tree produced by the {@code term_exclam} labeled alternative in {@link + * Smtlibv2Parser#term}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTerm_exclam(Smtlibv2Parser.Term_exclamContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#sort_symbol_decl}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSort_symbol_decl(Smtlibv2Parser.Sort_symbol_declContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#meta_spec_constant}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitMeta_spec_constant(Smtlibv2Parser.Meta_spec_constantContext ctx); + + /** + * Visit a parse tree produced by the {@code fun_symb_spec} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitFun_symb_spec(Smtlibv2Parser.Fun_symb_specContext ctx); + + /** + * Visit a parse tree produced by the {@code fun_symb_meta} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitFun_symb_meta(Smtlibv2Parser.Fun_symb_metaContext ctx); + + /** + * Visit a parse tree produced by the {@code fun_symb_id} labeled alternative in {@link + * Smtlibv2Parser#fun_symbol_decl}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitFun_symb_id(Smtlibv2Parser.Fun_symb_idContext ctx); + + /** + * Visit a parse tree produced by the {@code par_fun_symb} labeled alternative in {@link + * Smtlibv2Parser#par_fun_symbol_decl}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPar_fun_symb(Smtlibv2Parser.Par_fun_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code par_fun_multi_symb} labeled alternative in {@link + * Smtlibv2Parser#par_fun_symbol_decl}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPar_fun_multi_symb(Smtlibv2Parser.Par_fun_multi_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code theory_sort} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_sort(Smtlibv2Parser.Theory_sortContext ctx); + + /** + * Visit a parse tree produced by the {@code theory_fun} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_fun(Smtlibv2Parser.Theory_funContext ctx); + + /** + * Visit a parse tree produced by the {@code theory_sort_descr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_sort_descr(Smtlibv2Parser.Theory_sort_descrContext ctx); + + /** + * Visit a parse tree produced by the {@code theory_fun_descr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_fun_descr(Smtlibv2Parser.Theory_fun_descrContext ctx); + + /** + * Visit a parse tree produced by the {@code theory_def} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_def(Smtlibv2Parser.Theory_defContext ctx); + + /** + * Visit a parse tree produced by the {@code theory_val} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_val(Smtlibv2Parser.Theory_valContext ctx); + + /** + * Visit a parse tree produced by the {@code theory_notes} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_notes(Smtlibv2Parser.Theory_notesContext ctx); + + /** + * Visit a parse tree produced by the {@code theory_attr} labeled alternative in {@link + * Smtlibv2Parser#theory_attribute}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_attr(Smtlibv2Parser.Theory_attrContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#theory_decl}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitTheory_decl(Smtlibv2Parser.Theory_declContext ctx); + + /** + * Visit a parse tree produced by the {@code logic_theory} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitLogic_theory(Smtlibv2Parser.Logic_theoryContext ctx); + + /** + * Visit a parse tree produced by the {@code logic_language} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitLogic_language(Smtlibv2Parser.Logic_languageContext ctx); + + /** + * Visit a parse tree produced by the {@code logic_ext} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitLogic_ext(Smtlibv2Parser.Logic_extContext ctx); + + /** + * Visit a parse tree produced by the {@code logic_val} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitLogic_val(Smtlibv2Parser.Logic_valContext ctx); + + /** + * Visit a parse tree produced by the {@code logic_notes} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitLogic_notes(Smtlibv2Parser.Logic_notesContext ctx); + + /** + * Visit a parse tree produced by the {@code logic_attr} labeled alternative in {@link + * Smtlibv2Parser#logic_attribue}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitLogic_attr(Smtlibv2Parser.Logic_attrContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#logic}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitLogic(Smtlibv2Parser.LogicContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#sort_dec}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSort_dec(Smtlibv2Parser.Sort_decContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#selector_dec}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSelector_dec(Smtlibv2Parser.Selector_decContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#constructor_dec}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitConstructor_dec(Smtlibv2Parser.Constructor_decContext ctx); + + /** + * Visit a parse tree produced by the {@code data_constr} labeled alternative in {@link + * Smtlibv2Parser#datatype_dec}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitData_constr(Smtlibv2Parser.Data_constrContext ctx); + + /** + * Visit a parse tree produced by the {@code data_multisymb} labeled alternative in {@link + * Smtlibv2Parser#datatype_dec}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitData_multisymb(Smtlibv2Parser.Data_multisymbContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#function_dec}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitFunction_dec(Smtlibv2Parser.Function_decContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#function_def}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitFunction_def(Smtlibv2Parser.Function_defContext ctx); + + /** + * Visit a parse tree produced by the {@code prop_symb} labeled alternative in {@link + * Smtlibv2Parser#prop_literal}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitProp_symb(Smtlibv2Parser.Prop_symbContext ctx); + + /** + * Visit a parse tree produced by the {@code prop_not} labeled alternative in {@link + * Smtlibv2Parser#prop_literal}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitProp_not(Smtlibv2Parser.Prop_notContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#script}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitScript(Smtlibv2Parser.ScriptContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_assert}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_assert(Smtlibv2Parser.Cmd_assertContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_checkSat}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_checkSat(Smtlibv2Parser.Cmd_checkSatContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_checkSatAssuming}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_checkSatAssuming(Smtlibv2Parser.Cmd_checkSatAssumingContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_declareConst}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_declareConst(Smtlibv2Parser.Cmd_declareConstContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_declareDatatype}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_declareDatatype(Smtlibv2Parser.Cmd_declareDatatypeContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_declareDatatypes}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_declareDatatypes(Smtlibv2Parser.Cmd_declareDatatypesContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_declareFun}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_declareFun(Smtlibv2Parser.Cmd_declareFunContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_declareSort}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_declareSort(Smtlibv2Parser.Cmd_declareSortContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_defineFun}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_defineFun(Smtlibv2Parser.Cmd_defineFunContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_defineFunRec}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_defineFunRec(Smtlibv2Parser.Cmd_defineFunRecContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_defineFunsRec}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_defineFunsRec(Smtlibv2Parser.Cmd_defineFunsRecContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_defineSort}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_defineSort(Smtlibv2Parser.Cmd_defineSortContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_echo}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_echo(Smtlibv2Parser.Cmd_echoContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_exit}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_exit(Smtlibv2Parser.Cmd_exitContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getAssertions}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getAssertions(Smtlibv2Parser.Cmd_getAssertionsContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getAssignment}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getAssignment(Smtlibv2Parser.Cmd_getAssignmentContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getInfo}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getInfo(Smtlibv2Parser.Cmd_getInfoContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getModel}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getModel(Smtlibv2Parser.Cmd_getModelContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getOption}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getOption(Smtlibv2Parser.Cmd_getOptionContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getProof}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getProof(Smtlibv2Parser.Cmd_getProofContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getUnsatAssumptions}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getUnsatAssumptions(Smtlibv2Parser.Cmd_getUnsatAssumptionsContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getUnsatCore}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getUnsatCore(Smtlibv2Parser.Cmd_getUnsatCoreContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_getValue}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_getValue(Smtlibv2Parser.Cmd_getValueContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_pop}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_pop(Smtlibv2Parser.Cmd_popContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_push}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_push(Smtlibv2Parser.Cmd_pushContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_reset}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_reset(Smtlibv2Parser.Cmd_resetContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_resetAssertions}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_resetAssertions(Smtlibv2Parser.Cmd_resetAssertionsContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_setInfo}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_setInfo(Smtlibv2Parser.Cmd_setInfoContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_setLogic}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_setLogic(Smtlibv2Parser.Cmd_setLogicContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#cmd_setOption}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCmd_setOption(Smtlibv2Parser.Cmd_setOptionContext ctx); + + /** + * Visit a parse tree produced by the {@code assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAssert(Smtlibv2Parser.AssertContext ctx); + + /** + * Visit a parse tree produced by the {@code check} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCheck(Smtlibv2Parser.CheckContext ctx); + + /** + * Visit a parse tree produced by the {@code check_assume} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCheck_assume(Smtlibv2Parser.Check_assumeContext ctx); + + /** + * Visit a parse tree produced by the {@code decl_const} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDecl_const(Smtlibv2Parser.Decl_constContext ctx); + + /** + * Visit a parse tree produced by the {@code decl_data} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDecl_data(Smtlibv2Parser.Decl_dataContext ctx); + + /** + * Visit a parse tree produced by the {@code decl_datas} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDecl_datas(Smtlibv2Parser.Decl_datasContext ctx); + + /** + * Visit a parse tree produced by the {@code decl_fun} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDecl_fun(Smtlibv2Parser.Decl_funContext ctx); + + /** + * Visit a parse tree produced by the {@code decl_sort} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDecl_sort(Smtlibv2Parser.Decl_sortContext ctx); + + /** + * Visit a parse tree produced by the {@code def_fun} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDef_fun(Smtlibv2Parser.Def_funContext ctx); + + /** + * Visit a parse tree produced by the {@code def_fun_rec} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDef_fun_rec(Smtlibv2Parser.Def_fun_recContext ctx); + + /** + * Visit a parse tree produced by the {@code def_funs_rec} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDef_funs_rec(Smtlibv2Parser.Def_funs_recContext ctx); + + /** + * Visit a parse tree produced by the {@code def_sort} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDef_sort(Smtlibv2Parser.Def_sortContext ctx); + + /** + * Visit a parse tree produced by the {@code echo} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitEcho(Smtlibv2Parser.EchoContext ctx); + + /** + * Visit a parse tree produced by the {@code exit} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitExit(Smtlibv2Parser.ExitContext ctx); + + /** + * Visit a parse tree produced by the {@code get_assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_assert(Smtlibv2Parser.Get_assertContext ctx); + + /** + * Visit a parse tree produced by the {@code get_assign} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_assign(Smtlibv2Parser.Get_assignContext ctx); + + /** + * Visit a parse tree produced by the {@code get_info} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_info(Smtlibv2Parser.Get_infoContext ctx); + + /** + * Visit a parse tree produced by the {@code get_model} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_model(Smtlibv2Parser.Get_modelContext ctx); + + /** + * Visit a parse tree produced by the {@code get_option} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_option(Smtlibv2Parser.Get_optionContext ctx); + + /** + * Visit a parse tree produced by the {@code get_proof} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_proof(Smtlibv2Parser.Get_proofContext ctx); + + /** + * Visit a parse tree produced by the {@code get_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_unsat_assume(Smtlibv2Parser.Get_unsat_assumeContext ctx); + + /** + * Visit a parse tree produced by the {@code get_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_unsat_core(Smtlibv2Parser.Get_unsat_coreContext ctx); + + /** + * Visit a parse tree produced by the {@code get_val} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_val(Smtlibv2Parser.Get_valContext ctx); + + /** + * Visit a parse tree produced by the {@code pop} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPop(Smtlibv2Parser.PopContext ctx); + + /** + * Visit a parse tree produced by the {@code push} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPush(Smtlibv2Parser.PushContext ctx); + + /** + * Visit a parse tree produced by the {@code reset} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitReset(Smtlibv2Parser.ResetContext ctx); + + /** + * Visit a parse tree produced by the {@code reset_assert} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitReset_assert(Smtlibv2Parser.Reset_assertContext ctx); + + /** + * Visit a parse tree produced by the {@code setInfo} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSetInfo(Smtlibv2Parser.SetInfoContext ctx); + + /** + * Visit a parse tree produced by the {@code set_logic} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSet_logic(Smtlibv2Parser.Set_logicContext ctx); + + /** + * Visit a parse tree produced by the {@code set_option} labeled alternative in {@link + * Smtlibv2Parser#command}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitSet_option(Smtlibv2Parser.Set_optionContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#b_value}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitB_value(Smtlibv2Parser.B_valueContext ctx); + + /** + * Visit a parse tree produced by the {@code diagnose} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitDiagnose(Smtlibv2Parser.DiagnoseContext ctx); + + /** + * Visit a parse tree produced by the {@code global} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGlobal(Smtlibv2Parser.GlobalContext ctx); + + /** + * Visit a parse tree produced by the {@code interactive} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInteractive(Smtlibv2Parser.InteractiveContext ctx); + + /** + * Visit a parse tree produced by the {@code print_succ} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitPrint_succ(Smtlibv2Parser.Print_succContext ctx); + + /** + * Visit a parse tree produced by the {@code prod_assert} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitProd_assert(Smtlibv2Parser.Prod_assertContext ctx); + + /** + * Visit a parse tree produced by the {@code prod_assign} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitProd_assign(Smtlibv2Parser.Prod_assignContext ctx); + + /** + * Visit a parse tree produced by the {@code prod_mod} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitProd_mod(Smtlibv2Parser.Prod_modContext ctx); + + /** + * Visit a parse tree produced by the {@code prod_proofs} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitProd_proofs(Smtlibv2Parser.Prod_proofsContext ctx); + + /** + * Visit a parse tree produced by the {@code prod_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitProd_unsat_assume(Smtlibv2Parser.Prod_unsat_assumeContext ctx); + + /** + * Visit a parse tree produced by the {@code prod_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitProd_unsat_core(Smtlibv2Parser.Prod_unsat_coreContext ctx); + + /** + * Visit a parse tree produced by the {@code rand_seed} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitRand_seed(Smtlibv2Parser.Rand_seedContext ctx); + + /** + * Visit a parse tree produced by the {@code reg_out} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitReg_out(Smtlibv2Parser.Reg_outContext ctx); + + /** + * Visit a parse tree produced by the {@code repro} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitRepro(Smtlibv2Parser.ReproContext ctx); + + /** + * Visit a parse tree produced by the {@code verbose} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitVerbose(Smtlibv2Parser.VerboseContext ctx); + + /** + * Visit a parse tree produced by the {@code opt_attr} labeled alternative in {@link + * Smtlibv2Parser#option}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitOpt_attr(Smtlibv2Parser.Opt_attrContext ctx); + + /** + * Visit a parse tree produced by the {@code all_stat} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAll_stat(Smtlibv2Parser.All_statContext ctx); + + /** + * Visit a parse tree produced by the {@code assert_stack} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAssert_stack(Smtlibv2Parser.Assert_stackContext ctx); + + /** + * Visit a parse tree produced by the {@code authors} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitAuthors(Smtlibv2Parser.AuthorsContext ctx); + + /** + * Visit a parse tree produced by the {@code error} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitError(Smtlibv2Parser.ErrorContext ctx); + + /** + * Visit a parse tree produced by the {@code name} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitName(Smtlibv2Parser.NameContext ctx); + + /** + * Visit a parse tree produced by the {@code r_unknown} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitR_unknown(Smtlibv2Parser.R_unknownContext ctx); + + /** + * Visit a parse tree produced by the {@code version} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitVersion(Smtlibv2Parser.VersionContext ctx); + + /** + * Visit a parse tree produced by the {@code info_key} labeled alternative in {@link + * Smtlibv2Parser#info_flag}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInfo_key(Smtlibv2Parser.Info_keyContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#error_behaviour}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitError_behaviour(Smtlibv2Parser.Error_behaviourContext ctx); + + /** + * Visit a parse tree produced by the {@code memout} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitMemout(Smtlibv2Parser.MemoutContext ctx); + + /** + * Visit a parse tree produced by the {@code incomp} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitIncomp(Smtlibv2Parser.IncompContext ctx); + + /** + * Visit a parse tree produced by the {@code r_unnown_s_expr} labeled alternative in {@link + * Smtlibv2Parser#reason_unknown}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitR_unnown_s_expr(Smtlibv2Parser.R_unnown_s_exprContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_def_fun} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_def_fun(Smtlibv2Parser.Resp_def_funContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_def_fun_rec} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_def_fun_rec(Smtlibv2Parser.Resp_def_fun_recContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_def_funs_rec} labeled alternative in {@link + * Smtlibv2Parser#model_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_def_funs_rec(Smtlibv2Parser.Resp_def_funs_recContext ctx); + + /** + * Visit a parse tree produced by the {@code info_assert_stack} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInfo_assert_stack(Smtlibv2Parser.Info_assert_stackContext ctx); + + /** + * Visit a parse tree produced by the {@code info_authors} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInfo_authors(Smtlibv2Parser.Info_authorsContext ctx); + + /** + * Visit a parse tree produced by the {@code info_error} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInfo_error(Smtlibv2Parser.Info_errorContext ctx); + + /** + * Visit a parse tree produced by the {@code info_name} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInfo_name(Smtlibv2Parser.Info_nameContext ctx); + + /** + * Visit a parse tree produced by the {@code info_r_unknown} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInfo_r_unknown(Smtlibv2Parser.Info_r_unknownContext ctx); + + /** + * Visit a parse tree produced by the {@code info_version} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInfo_version(Smtlibv2Parser.Info_versionContext ctx); + + /** + * Visit a parse tree produced by the {@code info_attr} labeled alternative in {@link + * Smtlibv2Parser#info_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitInfo_attr(Smtlibv2Parser.Info_attrContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#valuation_pair}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitValuation_pair(Smtlibv2Parser.Valuation_pairContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#t_valuation_pair}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitT_valuation_pair(Smtlibv2Parser.T_valuation_pairContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#check_sat_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitCheck_sat_response(Smtlibv2Parser.Check_sat_responseContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#echo_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitEcho_response(Smtlibv2Parser.Echo_responseContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#get_assertions_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_assertions_response(Smtlibv2Parser.Get_assertions_responseContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#get_assignment_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_assignment_response(Smtlibv2Parser.Get_assignment_responseContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#get_info_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_info_response(Smtlibv2Parser.Get_info_responseContext ctx); + + /** + * Visit a parse tree produced by the {@code rs_model} labeled alternative in {@link + * Smtlibv2Parser#get_model_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitRs_model(Smtlibv2Parser.Rs_modelContext ctx); + + /** + * Visit a parse tree produced by the {@code model_resp} labeled alternative in {@link + * Smtlibv2Parser#get_model_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitModel_resp(Smtlibv2Parser.Model_respContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#get_option_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_option_response(Smtlibv2Parser.Get_option_responseContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#get_proof_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_proof_response(Smtlibv2Parser.Get_proof_responseContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#get_unsat_assump_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_unsat_assump_response(Smtlibv2Parser.Get_unsat_assump_responseContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#get_unsat_core_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_unsat_core_response(Smtlibv2Parser.Get_unsat_core_responseContext ctx); + + /** + * Visit a parse tree produced by {@link Smtlibv2Parser#get_value_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_value_response(Smtlibv2Parser.Get_value_responseContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_check_sat} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_check_sat(Smtlibv2Parser.Resp_check_satContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_echo} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_echo(Smtlibv2Parser.Resp_echoContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_get_assert} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_get_assert(Smtlibv2Parser.Resp_get_assertContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_gett_assign} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_gett_assign(Smtlibv2Parser.Resp_gett_assignContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_get_info} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_get_info(Smtlibv2Parser.Resp_get_infoContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_get_model} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_get_model(Smtlibv2Parser.Resp_get_modelContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_option} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_option(Smtlibv2Parser.Resp_optionContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_proof} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_proof(Smtlibv2Parser.Resp_proofContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_unsat_assume} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_unsat_assume(Smtlibv2Parser.Resp_unsat_assumeContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_unsat_core} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_unsat_core(Smtlibv2Parser.Resp_unsat_coreContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_value} labeled alternative in {@link + * Smtlibv2Parser#specific_success_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_value(Smtlibv2Parser.Resp_valueContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_success} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_success(Smtlibv2Parser.Resp_successContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_spec_successs} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_spec_successs(Smtlibv2Parser.Resp_spec_successsContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_unsupported} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_unsupported(Smtlibv2Parser.Resp_unsupportedContext ctx); + + /** + * Visit a parse tree produced by the {@code resp_error} labeled alternative in {@link + * Smtlibv2Parser#general_response}. + * + * @param ctx the parse tree + * @return the visitor result + */ + T visitResp_error(Smtlibv2Parser.Resp_errorContext ctx); +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Visitor.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Visitor.java new file mode 100644 index 0000000000..78603262a0 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Visitor.java @@ -0,0 +1,2303 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; + +import static com.google.common.base.Preconditions.checkArgument; + +import com.google.common.base.Splitter; +import com.google.common.base.Supplier; +import com.google.common.collect.Iterables; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.sosy_lab.java_smt.api.ArrayFormula; +import org.sosy_lab.java_smt.api.ArrayFormulaManager; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BitvectorFormulaManager; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.BooleanFormulaManager; +import org.sosy_lab.java_smt.api.FloatingPointFormula; +import org.sosy_lab.java_smt.api.FloatingPointFormulaManager; +import org.sosy_lab.java_smt.api.FloatingPointRoundingMode; +import org.sosy_lab.java_smt.api.FloatingPointRoundingModeFormula; +import org.sosy_lab.java_smt.api.Formula; +import org.sosy_lab.java_smt.api.FormulaManager; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FormulaType.BitvectorType; +import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType; +import org.sosy_lab.java_smt.api.FunctionDeclaration; +import org.sosy_lab.java_smt.api.IntegerFormulaManager; +import org.sosy_lab.java_smt.api.Model; +import org.sosy_lab.java_smt.api.Model.ValueAssignment; +import org.sosy_lab.java_smt.api.NumeralFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.RationalFormula; +import org.sosy_lab.java_smt.api.RationalFormulaManager; +import org.sosy_lab.java_smt.api.RegexFormula; +import org.sosy_lab.java_smt.api.StringFormula; +import org.sosy_lab.java_smt.api.StringFormulaManager; +import org.sosy_lab.java_smt.api.UFManager; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_assertContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_declareConstContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_declareFunContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_defineSortContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_popContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_pushContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Decl_sortContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Function_defContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Id_symbContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Id_symb_idxContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.MultisortContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.MultitermContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Qual_id_sortContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Resp_get_modelContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Sort_idContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.SortfpContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Term_exclamContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Term_existsContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Term_forallContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Term_fp_castContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Term_letContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Term_qual_idContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Term_spec_constContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Term_special_regexContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.To_fp_exprContext; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Var_bindingContext; +import scala.Tuple2; + +/** + * Implements a method from smtlibv2BaseVisitor for each node in a parse tree that requires some + * form of action in order to transform the parsed SMT-LIB2 into JavaSMT. + */ +@SuppressWarnings({ + "CheckReturnValue", + "unchecked", + "NonApiType", + "StringSplitter", + "UnnecessaryParentheses" +}) +public class Visitor extends Smtlibv2BaseVisitor { + + /** + * saves all created Formulas that are not part of a let statement as ParserFormula objects with + * their variable name or value as key. + */ + // TODO Are these declarations? + private final Map variables = new HashMap<>(); + + /** + * saves all created Formulas that are part of a let statement as ParserFormula objects with their + * variable name or value as key. + */ + // TODO They are declarations! + private final Map letVariables = new HashMap<>(); + + /** saves each 'assert' statement interpreted as a BooleanFormula object as an entry. */ + // TODO Here we collect the formulas + private final List constraints = new ArrayList<>(); + + private final FormulaManager fmgr; + private final BooleanFormulaManager bmgr; + private final @Nullable IntegerFormulaManager imgr; + private final @Nullable RationalFormulaManager rmgr; + private final @Nullable BitvectorFormulaManager bvmgr; + private final @Nullable ArrayFormulaManager amgr; + private final UFManager ufmgr; + private final @Nullable FloatingPointFormulaManager fpmgr; + private final @Nullable StringFormulaManager smgr; + List assignments = new ArrayList<>(); + + // TODO Should we support push,etc? + public List getConstraints() { + return constraints; + } + + // TODO This seems to be used to collect function definitions in the model: + // Do we actually need it? + public List getAssignments() { + return assignments; + } + + /** is set to 'true' if a node 'model' is encountered. */ + private boolean isModel = false; + + // TODO Does the visitor use its own solver instance, or should the formulas be added to an + // existing instance? + public Visitor(FormulaManager manager) { + fmgr = manager; + bmgr = manager.getBooleanFormulaManager(); + imgr = safeGetManager(manager::getIntegerFormulaManager); + rmgr = safeGetManager(manager::getRationalFormulaManager); + bvmgr = safeGetManager(manager::getBitvectorFormulaManager); + amgr = safeGetManager(manager::getArrayFormulaManager); + fpmgr = safeGetManager(manager::getFloatingPointFormulaManager); + smgr = safeGetManager(manager::getStringFormulaManager); + ufmgr = manager.getUFManager(); + } + + private T safeGetManager(Supplier supplier) { + try { + return supplier.get(); + } catch (UnsupportedOperationException e) { + return null; + } + } + + @Override + // TODO Is this for sort declarations? If so, we may not need it. + public List visitId_symb(Id_symbContext ctx) { + List sort = new ArrayList<>(); + sort.add(ctx.getText()); + return sort; + } + + @Override + public List visitId_symb_idx(Id_symb_idxContext ctx) { + List sort = new ArrayList<>(); + sort.add(ctx.symbol().getText()); + for (int i = 0; i < ctx.index().size(); i++) { + sort.add(ctx.index(i).getText()); + } + return sort; + } + + @Override + public FormulaType.ArrayFormulaType visitMultisort(MultisortContext ctx) { + FormulaType.ArrayFormulaType result; + if (ctx.identifier().getText().equals("Array")) { + FormulaType idx = (FormulaType) visit(ctx.sort(0)); + FormulaType elem = (FormulaType) visit(ctx.sort(1)); + result = FormulaType.getArrayType(idx, elem); + } else { + throw new ParserException(ctx.identifier().getText() + " is not a known sort. "); + } + + return result; + } + + /** + * Returns all the first parts without numbers of legal Strings how a floating Point can be + * defined in SMTLIB2 where Integers are used as exponent and mantissa. + * + * @return ArrayList with the fitting strings + */ + private static List getAllAllowedFPBeginningsWithInts() { + List beginnings = new ArrayList<>(); + beginnings.add("(_ FloatingPoint"); + beginnings.add("(_ +oo"); + beginnings.add("(_ -oo"); + beginnings.add("(_ +zero"); + beginnings.add("(_ -zero"); + beginnings.add("(_ NaN"); + return beginnings; + } + + /** + * Returns all the first parts without numbers of legal Strings how a floating Point can be + * defined in SMTLIB2 where non-Integers are used, f.e. Bitvector Floating-Points. + * + * @return ArrayList with the fitting strings + */ + private static List getAllAllowedFPBeginningsWithoutInts() { + List beginnings = new ArrayList<>(); + beginnings.add("Float16"); + beginnings.add("Float32"); + beginnings.add("Float64"); + beginnings.add("Float128"); + return beginnings; + } + + /** + * Checks if the beginning of the String matches one from a list. + * + * @param checkedString String which beginning should be checked + * @param listWithBeginnings ArrayList with the Strings that could match the checkedString + * @return true if at least one item of the list matches the beginning of the String + */ + public static boolean beginningMatchesList( + String checkedString, List listWithBeginnings) { + for (String x : listWithBeginnings) { + if (checkedString.startsWith(x)) { + return true; + } + } + return false; + } + + /** + * Checks if the String has the format of a Bitvector in SMTLIBv2 and creates the matching + * FormulaType. + * + * @param type SMTLIB2 String (not a whole file, just one Formula) + * @return matching FormulaType + */ + public static FormulaType parseToBitVecFormulaTypeIfMatching(String type) { + String bvSize; + if (type.startsWith("(_BitVec")) { + bvSize = Iterables.get(Splitter.on("_BitVec").split(type), 1); + bvSize = Iterables.get(Splitter.on(')').split(bvSize), 0); + return FormulaType.getBitvectorTypeWithSize(Integer.parseInt(bvSize)); + } + throw new ParserException("Invalid Bitvector format: " + type); + } + + /** + * Checks if the String has the format of a FloatingPoint in SMTLIBv2 and creates the matching + * FormulaType. + * + * @param type SMTLIB2 String (not a whole file, just one Formula) + * @return matching FormulaType + */ + public static FormulaType parseToFPOnlyNumeral(String type) { + if (beginningMatchesList(type, getAllAllowedFPBeginningsWithInts())) { + Pattern pattern = Pattern.compile("\\(_ FloatingPoint (\\d+) (\\d+)\\)"); + Matcher matcher = pattern.matcher(type); + if (matcher.matches()) { + int exponent = Integer.parseInt(matcher.group(1)); + int mantissa = Integer.parseInt(matcher.group(2)); + return FormulaType.getFloatingPointType(exponent, mantissa - 1); + } else { + throw new ParserException("Invalid FloatingPoint format: " + type); + } + } else if (beginningMatchesList(type, getAllAllowedFPBeginningsWithoutInts())) { + if (type.startsWith("Float16")) { + int exponent = 5; + int mantissa = 10; + return FormulaType.getFloatingPointType(exponent, mantissa); + } + if (type.startsWith("Float32")) { + return FormulaType.getSinglePrecisionFloatingPointType(); + } + if (type.startsWith("Float64")) { + return FormulaType.getDoublePrecisionFloatingPointType(); + } + if (type.startsWith("Float128")) { + int exponent = 15; + int mantissa = 112; + return FormulaType.getFloatingPointType(exponent, mantissa); + } + } + throw new ParserException("Invalid Floating Point Format: " + type); + } + + private ParserFormula createParserFormulaForString(String operand) { + if (!(operand.startsWith("\"") && operand.endsWith("\""))) { + throw new ParserException("Invalid string format: " + operand); + } + String content = operand.substring(1, operand.length() - 1).replace("\"\"", "\""); + return new ParserFormula(Objects.requireNonNull(smgr).makeString(content)); + } + + /** + * Gets the size in bits of a bitvector string. + * + * @param bitVec The bitvector string (starts with #b or #x) + * @return The size in bits + * @throws IllegalArgumentException if the format is invalid + */ + private int getBitVecSize(String bitVec) { + if (bitVec.startsWith("#b")) { + return bitVec.length() - 2; + } else if (bitVec.startsWith("#x")) { + return (bitVec.length() - 2) * 4; + } else { + throw new IllegalArgumentException("Invalid BitVector format: " + bitVec); + } + } + + /** + * Parses a bitvector string to a BitvectorFormula. + * + * @param bitVec The bitvector string (starts with #b) + * @return The BitvectorFormula + * @throws IllegalArgumentException if the format is invalid + */ + private BitvectorFormula parseStringToBitVectorFormula(String bitVec) { + if (!bitVec.startsWith("#b")) { + throw new IllegalArgumentException("Invalid BitVector format: " + bitVec); + } + String binaryValue = bitVec.substring(2); + int bitSize = binaryValue.length(); + int value = Integer.parseInt(binaryValue, 2); + return Objects.requireNonNull(bvmgr).makeBitvector(bitSize, value); + } + + /** + * Parses a hex vector string to a BitvectorFormula. + * + * @param hexVec The hex vector string (starts with #x) + * @return The BitvectorFormula + * @throws IllegalArgumentException if the format is invalid + */ + private BitvectorFormula parseHexVector(String hexVec) { + if (!hexVec.startsWith("#x")) { + throw new IllegalArgumentException("Invalid HexVector format: " + hexVec); + } + String hexValue = hexVec.substring(2); + int bitSize = hexValue.length() * 4; + BigInteger value = new BigInteger(hexValue, 16); + return Objects.requireNonNull(bvmgr).makeBitvector(bitSize, value); + } + + /** + * Sees if a SMT2 String is a Bitvector + * + * @param smt2 Smt2 String + * @return true if it starts with "(_Bitvec" + */ + public static boolean isABitVecInSMT2(String smt2) { + return smt2.startsWith("(_BitVec"); + } + + /** + * Sees if SMT2 String is a FloatingPoint by comparing it's beginning to the accepted ways of + * defining a Floating-Point in SMT2 + * + * @param smt2 String in smt2 format + * @return true if at least one beginning is matched + */ + public static boolean isAFloatingPointInSMT2(String smt2) { + return beginningMatchesList(smt2, getAllAllowedFPBeginningsWithInts()) + || beginningMatchesList(smt2, getAllAllowedFPBeginningsWithoutInts()); + } + + @Override + public FormulaType visitSortfp(SortfpContext ctx) { + String type = ctx.getText(); + return parseToFPOnlyNumeral(type); + } + + @Override + public FormulaType visitSort_id(Sort_idContext ctx) { + String type = ctx.getText(); + + if (isABitVecInSMT2(type)) { + return parseToBitVecFormulaTypeIfMatching(type); + } + if (isAFloatingPointInSMT2(type)) { + return parseToFPOnlyNumeral(type); + } + + switch (type) { + case "Int": + return FormulaType.IntegerType; + case "Bool": + return FormulaType.BooleanType; + case "Real": + return FormulaType.RationalType; + case "String": + return FormulaType.StringType; + default: + throw new ParserException(type + " is not a known sort."); + } + } + + @Override + public Tuple2> visitQual_id_sort(Qual_id_sortContext ctx) { + String operator = ctx.identifier().getText(); + FormulaType sort = (FormulaType) visit(ctx.sort()); + Tuple2> result = new Tuple2<>(operator, sort); + return result; + } + + @Override + public Object visitVar_binding(Var_bindingContext ctx) { + String name = ctx.symbol().getText(); + Formula formula = (Formula) visit(ctx.term()); + letVariables.put(name, new ParserFormula(formula)); + return visitChildren(ctx); + } + + public static boolean isInteger(String strNum) { + try { + Integer.parseInt(strNum); + } catch (NumberFormatException nfe) { + return false; + } + return true; + } + + public static boolean isFloat(String strNum) { + try { + Float.parseFloat(strNum); + } catch (NumberFormatException nfe) { + return false; + } + return true; + } + + public static boolean isDouble(String strNum) { + try { + Double.parseDouble(strNum); + } catch (NumberFormatException nfe) { + return false; + } + return true; + } + + public static boolean isLong(String strNum) { + try { + Long.parseLong(strNum); + } catch (NumberFormatException nfe) { + return false; + } + return true; + } + + public static boolean isBigInteger(String strNum) { + boolean ret = true; + try { + BigInteger x = new BigInteger(strNum); + if (!x.equals(new BigInteger(strNum))) { + ret = false; + } + } catch (NumberFormatException nfe) { + return false; + } + return ret; + } + + // TODO Use an enum here + public static String getNumericType(String strNum) { + if (isInteger(strNum)) { + return "Integer"; + } else if (isLong(strNum)) { + return "Long"; + } else if (isBigInteger(strNum)) { + return "BigInteger"; + } else if (isFloat(strNum)) { + return "Float"; + } else if (isDouble(strNum)) { + return "Double"; + } else { + return "other"; + } + } + + @Override + public Object visitTerm_spec_const(Term_spec_constContext ctx) { + String operand = ctx.getText(); + + if (variables.containsKey(operand)) { + return variables.get(operand).javaSmt; + } else if (getNumericType(operand).equals("Integer") + || getNumericType(operand).equals("Long") + || getNumericType(operand).equals("BigInteger")) { + variables.put(operand, new ParserFormula(Objects.requireNonNull(imgr).makeNumber(operand))); + return variables.get(operand).javaSmt; + } else if (getNumericType(operand).equals("Double") + || getNumericType(operand).equals("Float")) { + variables.put(operand, new ParserFormula(Objects.requireNonNull(rmgr).makeNumber(operand))); + return variables.get(operand).javaSmt; + } else if (beginningMatchesList(operand, getAllAlowedFPConstantBeginnings())) { + return parseFPNumberConstant(operand); + } else if (operand.startsWith("\"")) { + variables.put(operand, createParserFormulaForString(operand)); + return variables.get(operand).javaSmt; + } else if (operand.startsWith("#b")) { + variables.put(operand, new ParserFormula(parseStringToBitVectorFormula(operand))); + return variables.get(operand).javaSmt; + } else if (operand.startsWith("#x")) { + variables.put(operand, new ParserFormula(parseHexVector(operand))); + return variables.get(operand).javaSmt; + } else if (operand.equals("re.none")) { + variables.put(operand, new ParserFormula(Objects.requireNonNull(smgr).none())); + return variables.get(operand).javaSmt; + } else if (operand.equals("re.all")) { + variables.put(operand, new ParserFormula(Objects.requireNonNull(smgr).all())); + return variables.get(operand).javaSmt; + } else if (operand.equals("re.allchar")) { + variables.put(operand, new ParserFormula(Objects.requireNonNull(smgr).allChar())); + return variables.get(operand).javaSmt; + } else { + throw new ParserException("Operand " + operand + " is unknown."); + } + } + + public static List getAllAlowedFPConstantBeginnings() { + List beginnings = new ArrayList<>(); + beginnings.add("(fp #b"); + beginnings.add("(_ +oo"); + beginnings.add("(_ -oo"); + beginnings.add("(_ +zero"); + beginnings.add("(_ -zero"); + beginnings.add("(_ NaN"); + return beginnings; + } + + public Object parseValues(String operand) { + if (variables.containsKey(operand)) { + return variables.get(operand).javaSmt; + } else if (getNumericType(operand).equals("Integer") + || getNumericType(operand).equals("Long") + || getNumericType(operand).equals("BigInteger")) { + variables.put(operand, new ParserFormula(Objects.requireNonNull(imgr).makeNumber(operand))); + return variables.get(operand).javaSmt; + } else if (getNumericType(operand).equals("Double") + || getNumericType(operand).equals("Float")) { + variables.put(operand, new ParserFormula(Objects.requireNonNull(rmgr).makeNumber(operand))); + return variables.get(operand).javaSmt; + } else if (operand.startsWith("(fp #b")) { + return parseFPNumberConstant(operand); + } else if (operand.startsWith("\"")) { + variables.put(operand, createParserFormulaForString(operand)); + return variables.get(operand).javaSmt; + } else if (operand.startsWith("#b")) { + return parseStringToBitVectorFormula(operand); + } else if (operand.startsWith("#x")) { + return parseHexVector(operand); + } else { + throw new ParserException("Operand " + operand + " is unknown."); + } + } + + @Nonnull + private Object parseFPNumberConstant(String operand) { + + Pattern pattern = + Pattern.compile( + "\\(fp (#b[01]+|#x[0-9A-Fa-f]+) (#b[01]+|#x[0-9A-Fa-f]+) (#b[01]+|#x[0-9A-Fa-f]+)\\)"); + Matcher matcher = pattern.matcher(operand); + Pattern specialPattern = Pattern.compile("\\(_ (NaN|[+-]?oo|[+-]?zero) (\\d+) (\\d+)\\)"); + Matcher specialMatcher = specialPattern.matcher(operand); + if (!matcher.matches() && !specialMatcher.matches()) { + throw new ParserException("Invalid FloatingPoint format: " + operand); + } + FloatingPointFormula fp; + if (matcher.matches()) { + String signBitStr = matcher.group(1); + String exponentStr = matcher.group(2); + String mantissaStr = matcher.group(3); + + boolean signBit = signBitStr.equals("#b1") || signBitStr.equals("#x1"); + BigInteger exponent = null; + BigInteger mantissa = null; + if (exponentStr.startsWith("#b")) { + exponent = new BigInteger(exponentStr.substring(2), 2); + } else { + exponent = new BigInteger(exponentStr.substring(2), 16); + } + if (mantissaStr.startsWith("#b")) { + mantissa = new BigInteger(mantissaStr.substring(2), 2); + } else { + mantissa = new BigInteger(mantissaStr.substring(2), 16); + } + int exponentSize = getBitVecSize(exponentStr); + int mantissaSize = getBitVecSize(mantissaStr); + fp = + fpmgr.makeNumber( + exponent, + mantissa, + signBit, + FormulaType.getFloatingPointType(exponentSize, mantissaSize)); + + variables.put(operand, new ParserFormula(fp)); + return fp; + } else if (specialMatcher.matches()) { + String specialValue = specialMatcher.group(1); + int exponentSize = Integer.parseInt(specialMatcher.group(2)); + int mantissaSize = Integer.parseInt(specialMatcher.group(3)) - 1; + FloatingPointType type = FormulaType.getFloatingPointType(exponentSize, mantissaSize); + + switch (specialValue) { + case "NaN": + fp = fpmgr.makeNaN(type); + break; + case "+oo": + fp = fpmgr.makePlusInfinity(type); + break; + case "-oo": + fp = fpmgr.makeMinusInfinity(type); + break; + case "+zero": + fp = fpmgr.makeNumber(0.0, type); + break; + case "-zero": + fp = fpmgr.makeNumber(-0.0, type); + break; + default: + throw new ParserException("Unrecognized special FloatingPoint format: " + operand); + } + } else { + throw new ParserException("Invalid FloatingPoint format: " + operand); + } + variables.put(operand, new ParserFormula(fp)); + return fp; + } + + @Override + public Object visitTerm_qual_id(Term_qual_idContext ctx) { + String operand = replaceReservedChars(ctx.getText()); + if (letVariables.containsKey(operand)) { + if (!(letVariables.get(operand).type == null) + && Objects.equals(letVariables.get(operand).type, "UF") + && letVariables.get(operand).inputParams == null) { + return ufmgr.callUF( + (FunctionDeclaration) letVariables.get(operand).javaSmt, new ArrayList<>()); + } + return letVariables.get(operand).javaSmt; + } else if (variables.containsKey(operand)) { + if (!(variables.get(operand).type == null) + && Objects.equals(variables.get(operand).type, "UF") + && !(variables.get(operand).inputParams == null) + && Objects.requireNonNull(variables.get(operand).inputParams).isEmpty()) { + return ufmgr.callUF( + (FunctionDeclaration) variables.get(operand).javaSmt, new ArrayList<>()); + } + return variables.get(operand).javaSmt; + } else if (operand.equals("false")) { + variables.put(operand, new ParserFormula(bmgr.makeFalse())); + return variables.get(operand).javaSmt; + } else if (operand.equals("true")) { + variables.put(operand, new ParserFormula(bmgr.makeTrue())); + return variables.get(operand).javaSmt; + } else if (getAllSMTLIB2RoundingModes().contains(operand)) { + return new FloatingPointRoundingModeFormula() { + @Override + public String toString() { + return operand; + } + }; + } else { + throw new ParserException("Operand " + operand + " is unknown."); + } + } + + /** + * gets the operands used in a nested term. + * + * @param ctx current MultitermContext + * @param operands List of the operands transformed to Formula objects + */ + public void getOperands(MultitermContext ctx, List operands) { + + for (int i = 0; i < ctx.term().size(); ++i) { + Object operand = visit(ctx.term(i)); + if (operand != null) { + operands.add((Formula) operand); + } + } + } + + /** + * gets the operands used in a nested term. + * + * @param ctx current MultitermContext + * @param operands List of the operands transformed to Formula objects + */ + public List getOperandsAsString(MultitermContext ctx, List operands) { + List output = new ArrayList<>(); + for (int i = 0; i < ctx.term().size(); ++i) { + if (ctx.term().get(i) != null) { + output.add(ctx.term().get(i).getText()); + } + } + return output; + } + + // TODO Can we get a better return type? + @Override + public Object visitMultiterm(MultitermContext ctx) { + Object identifier = visit(ctx.qual_identifer()); + List operators = null; + String operator = ""; + FormulaType sort = null; + if (identifier instanceof List) { + operators = (List) identifier; + operator = Objects.requireNonNull(operators).get(0); + } else if (identifier instanceof Tuple2) { + operator = ((Tuple2>) identifier)._1; + sort = ((Tuple2>) identifier)._2; + } + operator = replaceReservedChars(operator); + + Object ufOperator = null; + if (variables.containsKey(operator)) { + ufOperator = variables.get(operator).javaSmt; + operator = "UF"; + } + + List operands = new ArrayList<>(); + getOperands(ctx, operands); + switch (operator) { + case "and": + try { + List booleanOperands = + operands.stream().map(e -> (BooleanFormula) e).collect(Collectors.toList()); + return bmgr.and(booleanOperands); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of Boolean type"); + } + case "or": + try { + List booleanOperands = + operands.stream().map(e -> (BooleanFormula) e).collect(Collectors.toList()); + return bmgr.or(booleanOperands); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of Boolean type"); + } + case "xor": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two boolean operands as input."); + } else { + try { + Iterator it = operands.iterator(); + return bmgr.xor((BooleanFormula) it.next(), (BooleanFormula) it.next()); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of Boolean type"); + } + } + case "not": + if (operands.size() != 1) { + throw new ParserException(operator + " takes one boolean operand as input."); + } else { + try { + Iterator it = operands.iterator(); + return bmgr.not((BooleanFormula) it.next()); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of Boolean type"); + } + } + case "=>": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two boolean operands as input."); + } else { + try { + Iterator it = operands.iterator(); + return bmgr.implication((BooleanFormula) it.next(), (BooleanFormula) it.next()); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of Boolean type"); + } + } + case "ite": + if (operands.size() != 3) { + throw new ParserException(operator + " takes three boolean operands as input."); + } else { + try { + Iterator it = operands.iterator(); + return bmgr.ifThenElse((BooleanFormula) it.next(), it.next(), it.next()); + } catch (Exception e) { + throw new ParserException( + "Condition for " + + operator + + " need to be of Boolean type and the types of both branches need to match."); + } + } + case "+": + // numeral operators + if (!operands.isEmpty()) { + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr) + .add(numeralOperands.get(0), numeralOperands.get(1)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .add(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr).sum(numeralOperands); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr).sum(integerOperands); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else { + throw new ParserException(operator + " takes at least one numeral operand as input. "); + } + case "-": + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr) + .subtract(numeralOperands.get(0), numeralOperands.get(1)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .subtract(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else if (operands.size() == 1) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr).negate(numeralOperands.get(0)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr).negate(integerOperands.get(0)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else { + throw new ParserException( + operator + " takes either one or two numeral operands as input. "); + } + case "div": + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr) + .divide(numeralOperands.get(0), numeralOperands.get(1)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .divide(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else { + throw new ParserException(operator + " takes two numeral operands as input. "); + } + case "mod": + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + throw new ParserException(operator + " is not available for Reals. "); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .modulo(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of integer type"); + } + } else { + throw new ParserException(operator + " takes two integer operands as input. "); + } + case "*": + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr) + .multiply(numeralOperands.get(0), numeralOperands.get(1)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .multiply(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else { + throw new ParserException(operator + " takes two numeral operands as input. "); + } + case "distinct": + if (!operands.isEmpty()) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr).distinct(numeralOperands); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr).distinct(integerOperands); + } + } catch (Exception e) { + throw new UnsupportedOperationException( + "JavaSMT support distinct only for numeral types!"); + } + } else { + throw new ParserException(operator + " takes at least one numeral operand as input. "); + } + case ">": + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr) + .greaterThan(numeralOperands.get(0), numeralOperands.get(1)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .greaterThan(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else { + throw new ParserException(operator + " takes two numeral operands as input. "); + } + case ">=": + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr) + .greaterOrEquals(numeralOperands.get(0), numeralOperands.get(1)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .greaterOrEquals(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else { + throw new ParserException(operator + " takes two numeral operands as input. "); + } + case "<": + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr) + .lessThan(numeralOperands.get(0), numeralOperands.get(1)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .lessThan(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else { + throw new ParserException(operator + " takes two numeral operands as input. "); + } + case "<=": + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr) + .lessOrEquals(numeralOperands.get(0), numeralOperands.get(1)); + } else { + List integerOperands = + operands.stream().map(e -> (IntegerFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(imgr) + .lessOrEquals(integerOperands.get(0), integerOperands.get(1)); + } + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of numeral type"); + } + } else { + throw new ParserException(operator + " takes two numeral operands as input. "); + } + + case "to_int": + if (operands.size() == 1) { + try { + List numeralOperands = + operands.stream().map(e -> (NumeralFormula) e).collect(Collectors.toList()); + return Objects.requireNonNull(rmgr).floor(numeralOperands.get(0)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of real type"); + } + } else { + throw new ParserException(operator + " takes one real operands as input. "); + } + + case "bvneg": + // BitVec operators + if (operands.size() != 1) { + throw new ParserException(operator + " takes one bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr).negate((BitvectorFormula) operands.get(0)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvadd": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .add((BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvsmod": + throw new UnsupportedOperationException("bvsmod is not supported in JavaSMT"); + case "bvsub": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .subtract((BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvsdiv": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .divide( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), true); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvudiv": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .divide( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), false); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvsrem": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .remainder( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), true); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvurem": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .remainder( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), false); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvmul": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .multiply((BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvsgt": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .greaterThan( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), true); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvugt": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .greaterThan( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), false); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvsge": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .greaterOrEquals( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), true); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvuge": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .greaterOrEquals( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), false); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvslt": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .lessThan( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), true); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvult": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .lessThan( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), false); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvsle": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .lessOrEquals( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), true); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvule": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .lessOrEquals( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), false); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvnot": + if (operands.size() != 1) { + throw new ParserException(operator + " takes one bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr).not((BitvectorFormula) operands.get(0)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvand": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .and((BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvor": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .or((BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvxor": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .xor((BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvashr": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .shiftRight( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), true); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvlshr": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .shiftRight( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1), false); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "bvshl": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .shiftLeft((BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "concat": + if (operands.size() != 2) { + throw new ParserException(operator + " takes two bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .concat((BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "extract": + if (operands.size() == 1) { + if (Objects.requireNonNull(operators).size() == 3 + && isInteger(operators.get(2)) + && isInteger(operators.get(1))) { + int right = Integer.parseInt(operators.get(2)); + int left = Integer.parseInt(operators.get(1)); + try { + return Objects.requireNonNull(bvmgr) + .extract((BitvectorFormula) operands.get(0), left, right); + } catch (Exception e) { + throw new ParserException( + "Operands for " + operator + " need to be of bitvector type"); + } + } else { + throw new ParserException( + operator + " takes one bitvector and two integers as input. "); + } + } else { + throw new ParserException( + operator + " takes one bitvector and two integers as " + "input."); + } + case "zero_extend": + if (operands.size() == 1) { + if (Objects.requireNonNull(operators).size() == 2 && isInteger(operators.get(1))) { + int extension = Integer.parseInt(operators.get(1)); + try { + return Objects.requireNonNull(bvmgr) + .extend((BitvectorFormula) operands.get(0), extension, false); + } catch (Exception e) { + throw new ParserException( + "Operands for " + operator + " need to be of bitvector type"); + } + } else { + throw new ParserException(operator + " takes one bitvector and one integer as input. "); + } + } else { + throw new ParserException(operator + " takes one bitvector and one integer as input."); + } + case "sign_extend": + if (operands.size() == 1) { + if (Objects.requireNonNull(operators).size() == 2 && isInteger(operators.get(1))) { + int extension = Integer.parseInt(operators.get(1)); + try { + return Objects.requireNonNull(bvmgr) + .extend((BitvectorFormula) operands.get(0), extension, true); + } catch (Exception e) { + throw new ParserException( + "Operands for " + operator + " need to be of bitvector type"); + } + } else { + throw new ParserException(operator + " takes one bitvector and one integer as input. "); + } + } else { + throw new ParserException(operator + " takes one bitvector and one integer as input."); + } + case "bv2int": + if (operands.size() != 1) { + throw new ParserException(operator + " takes one bitvector operand as input."); + } else { + try { + return Objects.requireNonNull(bvmgr) + .toIntegerFormula((BitvectorFormula) operands.get(0), false); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of bitvector type"); + } + } + case "int2bv": + case "rotate_left": + case "rotate_right": + case "repeat": + throw new ParserException(operator + " is not available in JavaSMT"); + + case "select": + // array operators + if (operands.size() == 2) { + try { + return Objects.requireNonNull(amgr) + .select((ArrayFormula) operands.get(0), operands.get(1)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of Array type"); + } + } else { + throw new ParserException(operator + " takes one array and one index as input. "); + } + case "store": + if (operands.size() == 3) { + try { + return Objects.requireNonNull(amgr) + .store( + (ArrayFormula) operands.get(0), + operands.get(1), + operands.get(2)); + } catch (Exception e) { + throw new ParserException("Operands for " + operator + " need to be of Array type"); + } + } else { + throw new ParserException(operator + " takes one array and one index as input. "); + } + case "const": + // TODO I believe JavaSMT now supports const arrays? + if (isModel) { + variables.put( + "temp", + new ParserFormula( + Objects.requireNonNull(amgr) + .makeArray( + "(as const (Array " + + getArrayStrings( + ((FormulaType.ArrayFormulaType) + Objects.requireNonNull(sort)) + .getIndexType()) + + " " + + getArrayStrings( + ((FormulaType.ArrayFormulaType) sort).getElementType()) + + ") " + + operands.get(0) + + ")", + (FormulaType.ArrayFormulaType) sort))); + return variables.get("temp").javaSmt; + } else { + throw new UnsupportedOperationException("\"as const\" is not supported by JavaSMT"); + } + case "fp.abs": + if (operands.size() == 1) { + return Objects.requireNonNull(fpmgr).abs((FloatingPointFormula) operands.get(0)); + } else { + throw new ParserException( + "fp.abs requires exactly one " + "FloatingPointFormula operand."); + } + case "fp.neg": + if (operands.size() == 1) { + return Objects.requireNonNull(fpmgr).negate((FloatingPointFormula) operands.get(0)); + } else { + throw new ParserException( + "fp.neg requires exactly one " + "FloatingPointFormula operand."); + } + case "fp.add": + if (operands.size() == 3) { + return Objects.requireNonNull(fpmgr) + .add( + (FloatingPointFormula) operands.get(1), + (FloatingPointFormula) operands.get(2), + parseRoundingModesToJavaSMTFormat(operands.get(0).toString())); + } else { + throw new ParserException( + "fp.add requires a rounding mode and exactly two " + + "FloatingPointFormula operands."); + } + case "fp.sub": + if (operands.size() == 3) { + return Objects.requireNonNull(fpmgr) + .subtract( + (FloatingPointFormula) operands.get(1), + (FloatingPointFormula) operands.get(2), + parseRoundingModesToJavaSMTFormat(operands.get(0).toString())); + } else { + throw new ParserException( + "fp.sub requires a rounding mode and exactly two " + + "FloatingPointFormula operands."); + } + case "fp.mul": + if (operands.size() == 3) { + return Objects.requireNonNull(fpmgr) + .multiply( + (FloatingPointFormula) operands.get(1), + (FloatingPointFormula) operands.get(2), + parseRoundingModesToJavaSMTFormat(operands.get(0).toString())); + } else { + throw new ParserException( + "fp.mul requires a rounding mode and exactly two " + + "FloatingPointFormula operands."); + } + case "fp.div": + if (operands.size() == 3) { + return Objects.requireNonNull(fpmgr) + .divide( + (FloatingPointFormula) operands.get(1), + (FloatingPointFormula) operands.get(2), + parseRoundingModesToJavaSMTFormat(operands.get(0).toString())); + } else { + throw new ParserException( + "fp.div requires a rounding mode and exactly two " + + "FloatingPointFormula operands."); + } + case "fp.fma": + // TODO: Seems to not be supported yet, but can be implemented + throw new UnsupportedOperationException("fp.fma isn't supported by JavaSMT"); + case "fp.sqrt": + if (operands.size() == 2) { + return Objects.requireNonNull(fpmgr) + .sqrt( + (FloatingPointFormula) operands.get(1), + parseRoundingModesToJavaSMTFormat(operands.get(0).toString())); + } else { + throw new ParserException( + "fp.sqrt requires a rounding mode and exactly one " + + "FloatingPointFormula operand."); + } + case "fp.rem": + throw new UnsupportedOperationException("fp.rem is not supported by JavaSMT"); + case "fp.roundToIntegral": + throw new UnsupportedOperationException("fp.roundToIntegral is not supported by JavaSMT"); + case "fp.min": + if (operands.size() == 2) { + return Objects.requireNonNull(fpmgr) + .min((FloatingPointFormula) operands.get(0), (FloatingPointFormula) operands.get(1)); + } else { + throw new ParserException( + "fp.min requires exactly two " + "FloatingPointFormula operands."); + } + case "fp.max": + if (operands.size() == 2) { + return Objects.requireNonNull(fpmgr) + .max((FloatingPointFormula) operands.get(0), (FloatingPointFormula) operands.get(1)); + } else { + throw new ParserException( + "fp.max requires exactly two " + "FloatingPointFormula operands."); + } + case "fp.leq": + if (operands.size() == 2) { + return Objects.requireNonNull(fpmgr) + .lessOrEquals( + (FloatingPointFormula) operands.get(0), (FloatingPointFormula) operands.get(1)); + } else { + throw new ParserException( + "fp.leq requires exactly two " + "FloatingPointFormula operands."); + } + case "fp.lt": + if (operands.size() == 2) { + return Objects.requireNonNull(fpmgr) + .lessThan( + (FloatingPointFormula) operands.get(0), (FloatingPointFormula) operands.get(1)); + } else { + throw new ParserException( + "fp.lt requires exactly two " + "FloatingPointFormula operands."); + } + case "fp.geq": + if (operands.size() == 2) { + return Objects.requireNonNull(fpmgr) + .greaterOrEquals( + (FloatingPointFormula) operands.get(0), (FloatingPointFormula) operands.get(1)); + } else { + throw new ParserException( + "fp.geq requires exactly two " + "FloatingPointFormula operands."); + } + case "fp.gt": + if (operands.size() == 2) { + return Objects.requireNonNull(fpmgr) + .greaterThan( + (FloatingPointFormula) operands.get(0), (FloatingPointFormula) operands.get(1)); + } else { + throw new ParserException( + "fp.gt requires exactly two " + "FloatingPointFormula operands."); + } + case "fp.eq": + if (operands.size() == 2) { + return Objects.requireNonNull(fpmgr) + .equalWithFPSemantics( + (FloatingPointFormula) operands.get(0), (FloatingPointFormula) operands.get(1)); + } else { + throw new ParserException( + "fp.eq requires exactly two " + "FloatingPointFormula operands."); + } + case "fp.isNormal": + if (operands.size() == 1) { + return Objects.requireNonNull(fpmgr).isNormal((FloatingPointFormula) operands.get(0)); + } else { + throw new ParserException( + "fp.isNormal requires exactly one " + "FloatingPointFormula operand."); + } + case "fp.isSubnormal": + if (operands.size() == 1) { + return Objects.requireNonNull(fpmgr).isSubnormal((FloatingPointFormula) operands.get(0)); + } else { + throw new ParserException( + "fp.isSubnormal requires exactly one " + "FloatingPointFormula operand."); + } + case "fp.isZero": + if (operands.size() == 1) { + return Objects.requireNonNull(fpmgr).isZero((FloatingPointFormula) operands.get(0)); + } else { + throw new ParserException( + "fp.isZero requires exactly one " + "FloatingPointFormula operand."); + } + case "fp.isInfinite": + if (operands.size() == 1) { + return Objects.requireNonNull(fpmgr).isInfinity((FloatingPointFormula) operands.get(0)); + } else { + throw new ParserException( + "fp.isZero requires exactly one " + "FloatingPointFormula operand."); + } + case "fp.isNaN": + if (operands.size() == 1) { + return Objects.requireNonNull(fpmgr).isNaN((FloatingPointFormula) operands.get(0)); + } else { + throw new ParserException( + "fp.isNaN requires exactly one " + "FloatingPointFormula operand."); + } + case "fp.isNegative": + if (operands.size() == 1) { + return Objects.requireNonNull(fpmgr).isNegative((FloatingPointFormula) operands.get(0)); + } else { + throw new ParserException( + "fp.isNegative requires exactly one " + "FloatingPointFormula operand."); + } + case "fp.isPositive": + throw new UnsupportedOperationException("fp.isPositive is not supported by JavaSMT"); + case "str.++": + List stringFormulas = new ArrayList<>(); + for (Object operand : operands) { + checkArgument( + (operand instanceof StringFormula), + "All operands of str.++ must be a StringFormula."); + stringFormulas.add((StringFormula) operand); + } + return Objects.requireNonNull(smgr).concat(stringFormulas); + case "str.len": + if (operands.size() != 1) { + throw new ParserException("str.len requires exactly 1 operand."); + } + return Objects.requireNonNull(smgr).length((StringFormula) operands.get(0)); + case "str.at": + if (operands.size() != 2) { + throw new ParserException("str.at requires exactly 2 operands."); + } + return Objects.requireNonNull(smgr) + .charAt((StringFormula) operands.get(0), (IntegerFormula) operands.get(1)); + + case "str.<": + if (operands.size() != 2) { + throw new ParserException("str.< requires exactly 2 operands."); + } + return Objects.requireNonNull(smgr) + .lessThan((StringFormula) operands.get(0), (StringFormula) operands.get(1)); + case "str.<=": + if (operands.size() != 2) { + throw new ParserException("str.<= requires exactly 2 operands."); + } + return Objects.requireNonNull(smgr) + .lessOrEquals((StringFormula) operands.get(0), (StringFormula) operands.get(1)); + case "str.substr": + if (operands.size() != 3) { + throw new ParserException("str.substr requires exactly 3 operands."); + } + return Objects.requireNonNull(smgr) + .substring( + (StringFormula) operands.get(0), + (IntegerFormula) operands.get(1), + (IntegerFormula) operands.get(2)); + case "str.prefixof": + if (operands.size() != 2) { + throw new ParserException("str.prefixof requires exactly 2 operands."); + } + return Objects.requireNonNull(smgr) + .prefix((StringFormula) operands.get(0), (StringFormula) operands.get(1)); + case "str.suffixof": + if (operands.size() != 2) { + throw new ParserException("str.suffixof requires exactly 2 operands."); + } + return Objects.requireNonNull(smgr) + .suffix((StringFormula) operands.get(0), (StringFormula) operands.get(1)); + case "str.contains": + if (operands.size() != 2) { + throw new ParserException("str.contains requires exactly 2 operands."); + } + return Objects.requireNonNull(smgr) + .contains((StringFormula) operands.get(0), (StringFormula) operands.get(1)); + case "str.indexof": + if (operands.size() != 3) { + throw new ParserException("str.indexof requires exactly 3 operands."); + } + return Objects.requireNonNull(smgr) + .indexOf( + (StringFormula) operands.get(0), + (StringFormula) operands.get(1), + (IntegerFormula) operands.get(2)); + case "str.replace": + if (operands.size() != 3) { + throw new ParserException("str.replace requires exactly 3 operands."); + } + return Objects.requireNonNull(smgr) + .replace( + (StringFormula) operands.get(0), + (StringFormula) operands.get(1), + (StringFormula) operands.get(2)); + case "str.replace_all": + if (operands.size() != 3) { + throw new ParserException("str.replace_all requires exactly 3 operands."); + } + return Objects.requireNonNull(smgr) + .replaceAll( + (StringFormula) operands.get(0), + (StringFormula) operands.get(1), + (StringFormula) operands.get(2)); + case "str.to_int": + if (operands.size() != 1) { + throw new ParserException("str.to_int requires exactly 1 operand."); + } + return Objects.requireNonNull(smgr).toIntegerFormula((StringFormula) operands.get(0)); + case "str.from_int": + if (operands.size() != 1) { + throw new ParserException("str.from_int requires exactly 1 operand."); + } + return Objects.requireNonNull(smgr).toStringFormula((IntegerFormula) operands.get(0)); + case "str.to_code": + throw new UnsupportedOperationException("str.to_code is not supported in JavaSMT"); + case "str.from_code": + throw new UnsupportedOperationException("str.from_code is not supported in JavaSMT"); + case "str.to_re": + if (operands.size() != 1) { + throw new ParserException("str.to_re requires exactly 1 operand."); + } + String reInString = getOperandsAsString(ctx, operands).get(0); + String regexContent = + reInString.substring(1, reInString.length() - 1).replace("\"\"", "\""); + return Objects.requireNonNull(smgr).makeRegex(regexContent); + case "str.is_digit": + throw new UnsupportedOperationException("str.is_digit is not supported in JavaSMT"); + case "str.in_re": + if (operands.size() != 2) { + throw new ParserException("str.in_re requires exactly 2 operands."); + } + if (!(operands.get(1) instanceof RegexFormula)) { + throw new ParserException("Second operand of str.in_re must be a RegexFormula."); + } + return Objects.requireNonNull(smgr) + .in((StringFormula) operands.get(0), (RegexFormula) operands.get(1)); + case "str.replace_re": + case "str.replace_re_all": + throw new UnsupportedOperationException( + "str.replace_re_all and str.replace_re" + " are not supported in JavaSMT"); + case "re.none": + if (!operands.isEmpty()) { + throw new ParserException("re.none requires no operands"); + } + return Objects.requireNonNull(smgr).none(); + case "re.all": + if (!operands.isEmpty()) { + throw new ParserException("re.all requires no operands"); + } + return Objects.requireNonNull(smgr).all(); + case "re.++": + List regexFormulas = new ArrayList<>(); + for (Object operand : operands) { + checkArgument( + (operand instanceof RegexFormula), + "All operands of re.++ must be a " + "RegexFormula."); + regexFormulas.add((RegexFormula) operand); + } + return Objects.requireNonNull(smgr).concatRegex(regexFormulas); + case "re.union": + if (operands.size() != 2) { + throw new ParserException("re.union requires exactly two operands."); + } + return Objects.requireNonNull(smgr) + .union((RegexFormula) operands.get(0), (RegexFormula) operands.get(1)); + case "re.*": + if (operands.size() != 1) { + throw new ParserException("re.* requires exactly one operand."); + } + return Objects.requireNonNull(smgr).closure((RegexFormula) operands.get(0)); + case "re.allchar": + if (!operands.isEmpty()) { + throw new ParserException("re.allchar requires exactly 0 operands."); + } + return Objects.requireNonNull(smgr).allChar(); + case "re.inter": + if (operands.size() != 2) { + throw new ParserException("re.inter requires exactly two operands."); + } + return Objects.requireNonNull(smgr) + .intersection((RegexFormula) operands.get(0), (RegexFormula) operands.get(1)); + case "re.comp": + if (operands.size() != 1) { + throw new ParserException("re.comp requires exactly one operand."); + } + return Objects.requireNonNull(smgr).complement((RegexFormula) operands.get(0)); + case "re.diff": + if (operands.size() != 2) { + throw new ParserException("re.diff requires exactly two operands."); + } + return Objects.requireNonNull(smgr) + .difference((RegexFormula) operands.get(0), (RegexFormula) operands.get(1)); + case "re.+": + if (operands.size() != 1) { + throw new ParserException("re.+ requires exactly one operand."); + } + return Objects.requireNonNull(smgr).cross((RegexFormula) operands.get(0)); + case "re.opt": + if (operands.size() != 1) { + throw new ParserException("re.opt requires exactly one operand."); + } + return Objects.requireNonNull(smgr).optional((RegexFormula) operands.get(0)); + case "re.range": + if (operands.size() != 2) { + throw new ParserException("re.range requires exactly one operand."); + } + return Objects.requireNonNull(smgr) + .range((StringFormula) operands.get(0), (StringFormula) operands.get(1)); + case "UF": + // UF + try { + return ufmgr.callUF( + (FunctionDeclaration) Objects.requireNonNull(ufOperator), + operands); + } catch (Exception e) { + throw new ParserException(operator + " takes one array and one index as input. "); + } + case "=": + // overloaded operators + if (operands.size() == 2) { + try { + if (operands.stream().anyMatch(c -> c instanceof ArrayFormula)) { + return Objects.requireNonNull(amgr) + .equivalence( + (ArrayFormula) operands.get(0), + (ArrayFormula) operands.get(1)); + } else if (operands.stream().anyMatch(c -> c instanceof RationalFormula)) { + // if (operands.stream().anyMatch(c -> variables.containsKey(c))) + return Objects.requireNonNull(rmgr) + .equal((NumeralFormula) operands.get(0), (NumeralFormula) operands.get(1)); + } else if (operands.stream().anyMatch(c -> c instanceof IntegerFormula)) { + return Objects.requireNonNull(imgr) + .equal((IntegerFormula) operands.get(0), (IntegerFormula) operands.get(1)); + } else if (operands.stream().anyMatch(c -> c instanceof BooleanFormula)) { + return bmgr.equivalence( + (BooleanFormula) operands.get(0), (BooleanFormula) operands.get(1)); + } else if (operands.stream().anyMatch(c -> c instanceof BitvectorFormula)) { + BooleanFormula result = + Objects.requireNonNull(bvmgr) + .equal( + (BitvectorFormula) operands.get(0), (BitvectorFormula) operands.get(1)); + return result; + } else if (operands.stream().anyMatch(c -> c instanceof FloatingPointFormula)) { + return Objects.requireNonNull(fpmgr) + .assignment( + (FloatingPointFormula) operands.get(0), + (FloatingPointFormula) operands.get(1)); + } else if (operands.stream().anyMatch(c -> c instanceof StringFormula)) { + return Objects.requireNonNull(smgr) + .equal((StringFormula) operands.get(0), (StringFormula) operands.get(1)); + } else { + throw new ParserException( + "Operands for " + operator + " need to be of the same type" + operands); + } + + } catch (Exception e) { + throw new ParserException( + "Operands for " + operator + " need to be of the same type" + operands); + } + } else { + throw new ParserException(operator + " takes two equal types of operands as input. "); + } + default: + throw new ParserException("Operator " + operator + " is not supported for operands type."); + } + } + + @Override + public Object visitTerm_let(Term_letContext ctx) { + for (int i = 0; i < ctx.var_binding().size(); i++) { + visit(ctx.var_binding(i)); + } + Formula formula = (Formula) visit(ctx.term()); + for (int j = 0; j < ctx.var_binding().size(); j++) { + letVariables.remove(ctx.var_binding(j).symbol().getText()); + } + return formula; + } + + @Override + public Object visitTerm_forall(Term_forallContext ctx) { + throw new ParserException("Parser does not support Quantifiers"); + } + + @Override + public Object visitTerm_exists(Term_existsContext ctx) { + throw new ParserException("Parser does not support Quantifiers"); + } + + @Override + public Object visitTerm_exclam(Term_exclamContext ctx) { + throw new ParserException("Parser does not support Attributed Expressions"); + } + + @Override + public Object visitFunction_def(Function_defContext ctx) { + String variable = replaceReservedChars(ctx.symbol().getText()); + + List> javaSorts; + List inputParams = new ArrayList<>(); + if (!ctx.sorted_var().isEmpty()) { + for (int i = 0; i < ctx.sorted_var().size(); i++) { + String name = ctx.sorted_var(i).symbol().getText(); + FormulaType sort = (FormulaType) visit(ctx.sorted_var(i).sort()); + Formula temp = mapKey(sort, name); + variables.put(name, new ParserFormula(temp)); + inputParams.add(temp); + } + } + javaSorts = inputParams.stream().map(fmgr::getFormulaType).collect(Collectors.toList()); + + FormulaType returnTypes = (FormulaType) visit(ctx.sort()); + + Formula key; + Formula input = (Formula) visit(ctx.term()); + if (!inputParams.isEmpty()) { + ParserFormula temp = new ParserFormula(ufmgr.declareUF(variable, returnTypes, javaSorts)); + temp.setType("UF"); + temp.setReturnType(returnTypes); + temp.setInputParams(javaSorts); + variables.put(variable, temp); + key = + ufmgr.callUF( + (FunctionDeclaration) variables.get(variable).javaSmt, + inputParams); + } else { + key = mapKey(returnTypes, variable); + } + + Formula value = input; + variables.put(variable, new ParserFormula(input)); + + String keyString = replaceReplacedChars(key.toString()); + String valueString = value.toString(); + // TODO Does this add function definitions to the model? + // UPDATE Actually this is used together with `visitResp_get_model` to parse the model returned + // by the solver after (get-model) is used. + if (isModel) { + Model.ValueAssignment assignment = + new ValueAssignment( + key, value, mapEquivalence(key, value), keyString, valueString, new ArrayList<>()); + assignments.add(assignment); + } + return visitChildren(ctx); + } + + @Override + public Object visitCmd_assert(Cmd_assertContext ctx) { + Object result = visitChildren(ctx); + try { + constraints.add((BooleanFormula) result); + return result; + } catch (Exception pE) { + throw new ParserException("constraints need to be of Boolean type"); + } + } + + @Override + public Object visitTerm_fp_cast(Term_fp_castContext ctx1) { + To_fp_exprContext ctx = ctx1.to_fp_expr(); + int exponent; + int mantissa; + String roundingMode; + String value; + + String fpExpr = ctx.getText(); + + Pattern pattern = Pattern.compile("\\(_ to_fp (\\d+) (\\d+)\\)"); + Matcher matcher = pattern.matcher(fpExpr); + if (matcher.find()) { + exponent = Integer.parseInt(matcher.group(1)); + mantissa = Integer.parseInt(matcher.group(2)); + } else { + throw new ParserException("Illegal Floating Point conversion: " + ctx.getText()); + } + ParserFormula result; + if (ctx.term().size() == 2) { + roundingMode = ctx.term(0).getText(); + value = ctx.term(1).getText(); + result = + new ParserFormula( + fpmgr.castFrom( + (Formula) parseValues(value), + ((parseValues(value) instanceof BitvectorFormula) + && getBitVecSize(value) == exponent + mantissa + 1), + FormulaType.getFloatingPointType(exponent, mantissa - 1), + parseRoundingModesToJavaSMTFormat(roundingMode))); + variables.put(fpExpr, result); + return variables.get(fpExpr).javaSmt; + } else if (ctx.term().size() == 1) { + if (ctx.term().get(0).getText().startsWith("#b")) { + result = + new ParserFormula( + fpmgr.fromIeeeBitvector( + parseStringToBitVectorFormula(ctx.term(0).getText()), + FormulaType.getFloatingPointType(exponent, mantissa - 1))); + variables.put(fpExpr, result); + return variables.get(fpExpr).javaSmt; + } + value = ctx.term(0).getText(); + result = + new ParserFormula( + fpmgr.castFrom( + (Formula) parseValues(value), + ((parseValues(value) instanceof BitvectorFormula) + && getBitVecSize(value) == exponent + mantissa + 1), + FormulaType.getFloatingPointType(exponent, mantissa - 1))); + variables.put(fpExpr, result); + return variables.get(fpExpr).javaSmt; + } else { + throw new ParserException("Illegal Floating Point conversion: " + ctx.getText()); + } + } + + @Override + public Object visitTerm_special_regex(Term_special_regexContext ctx1) { + String regexExpr = ctx1.getText(); + + if (regexExpr.startsWith("((_ re.loop")) { + throw new UnsupportedOperationException("Loop is not supported in JavaSMT."); + } + + Pattern powerPattern = Pattern.compile("\\(_ re.\\^ (\\d+)\\)"); + Matcher powerMatcher = powerPattern.matcher(regexExpr); + + if (powerMatcher.find()) { + int times = Integer.parseInt(powerMatcher.group(1)); + RegexFormula e = smgr.makeRegex(ctx1.special_regex_operations().term().getText()); + ParserFormula result = new ParserFormula(smgr.times(e, times)); + + variables.put(regexExpr, result); + return variables.get(regexExpr).javaSmt; + } else { + throw new ParserException("Illegal Regular Expression conversion: " + ctx1.getText()); + } + } + + @Override + public Object visitCmd_declareConst(Cmd_declareConstContext ctx) { + String variableSymbol = ctx.symbol().getText(); + FormulaType sort = (FormulaType) visit(ctx.sort()); + + if (sort.isBooleanType()) { + variables.put(variableSymbol, new ParserFormula(bmgr.makeVariable(variableSymbol))); + } else if (sort.isIntegerType()) { + variables.put( + variableSymbol, + new ParserFormula(Objects.requireNonNull(imgr).makeVariable(variableSymbol))); + } else if (sort.isRationalType()) { + variables.put( + variableSymbol, + new ParserFormula(Objects.requireNonNull(rmgr).makeVariable(variableSymbol))); + } else if (sort.isBitvectorType()) { + variables.put( + variableSymbol, + new ParserFormula( + Objects.requireNonNull(bvmgr) + .makeVariable(((FormulaType.BitvectorType) sort).getSize(), variableSymbol))); + } else if (sort.isFloatingPointType()) { + variables.put( + variableSymbol, + new ParserFormula( + Objects.requireNonNull(fpmgr) + .makeVariable(variableSymbol, (FormulaType.FloatingPointType) sort))); + } else if (sort.isStringType()) { + variables.put( + variableSymbol, + new ParserFormula(Objects.requireNonNull(smgr).makeVariable(variableSymbol))); + } else if (sort.isArrayType()) { + variables.put( + variableSymbol, + new ParserFormula( + Objects.requireNonNull(amgr) + .makeArray( + variableSymbol, + ((FormulaType.ArrayFormulaType) sort).getIndexType(), + ((FormulaType.ArrayFormulaType) sort).getElementType()))); + } + return visitChildren(ctx); + } + + /** + * maps FormulaType to the corresponding SMT-LIB2 sort for the String representation of the model. + * + * @param type FormulaType that needs to be translated to SMT-LIB2 + * @return String representation of FormulaType in SMT-LIB2 + */ + public static String getArrayStrings(FormulaType type) { + + if (type.isBooleanType()) { + return "Bool"; + } else if (type.isIntegerType()) { + return "Int"; + } else if (type.isRationalType()) { + return "Real"; + } else if (type.isFloatingPointType()) { + return "(_ FloatingPoint "; + } else if (type.isBitvectorType()) { + return "(_ BitVec " + ((BitvectorType) type).getSize() + ")"; + } else if (type.isArrayType()) { + return "(Array " + + getArrayStrings(((FormulaType.ArrayFormulaType) type).getIndexType()) + + " " + + getArrayStrings(((FormulaType.ArrayFormulaType) type).getElementType()); + } else { + throw new ParserException(type + " is not a known Sort."); + } + } + + /** + * creates a Formula object to use as the key in ValueAssignments for model from the given + * FormulaType. + * + * @param sorts FormulaType of the value in ValueAssignments + * @param variable String representation of the key in ValueAssignments + * @return Formula matching the given FormulaType 'sorts' + */ + public Formula mapKey(FormulaType sorts, String variable) { + + if (sorts.isBooleanType()) { + return bmgr.makeVariable(variable); + } else if (sorts.isIntegerType()) { + return Objects.requireNonNull(imgr).makeVariable(variable); + } else if (sorts.isRationalType()) { + return Objects.requireNonNull(rmgr).makeVariable(variable); + } else if (sorts.isBitvectorType()) { + return Objects.requireNonNull(bvmgr) + .makeVariable(((FormulaType.BitvectorType) sorts).getSize(), variable); + } else if (sorts.isArrayType()) { + return Objects.requireNonNull(amgr) + .makeArray( + variable, + ((FormulaType.ArrayFormulaType) sorts).getIndexType(), + ((FormulaType.ArrayFormulaType) sorts).getElementType()); + } else { + throw new ParserException(sorts + " is not of a known Sort."); + } + } + + /** + * Assembles a BooleanFormula for the ValueAssignment field 'formula' by applying + * BooleanFormulaManager.equivalence() to key Formula and value Formula. + * + * @param key Variable name as Formula + * @param value Variable value as Formula + * @return Equivalence of key and value + */ + public BooleanFormula mapEquivalence(Formula key, Formula value) { + if (key instanceof BooleanFormula) { + return bmgr.equivalence((BooleanFormula) key, (BooleanFormula) value); + } else if (key instanceof IntegerFormula) { + return Objects.requireNonNull(imgr).equal((IntegerFormula) key, (IntegerFormula) value); + } else if (key instanceof RationalFormula) { + return Objects.requireNonNull(rmgr).equal((RationalFormula) key, (RationalFormula) value); + } else if (key instanceof BitvectorFormula) { + return Objects.requireNonNull(bvmgr).equal((BitvectorFormula) key, (BitvectorFormula) value); + } else if (key instanceof ArrayFormula) { + return Objects.requireNonNull(amgr) + .equivalence( + (ArrayFormula) key, (ArrayFormula) value); + } else { + throw new ParserException(key + " is not a valid Sort"); + } + } + + /** + * Checks if String contains forbidden characters and temporarily replaces them, can be undone + * with 'replaceReplacedChars()'. + * + * @param variable String that is checked and modified if necessary + * @return String with no forbidden characters + */ + // TODO This won't work for something like "|PIPE|" + // But, do we need to replace the symbols anyway? Maybe we just remove the "|"s? + public String replaceReservedChars(String variable) { + if (variable.startsWith("|")) { + return variable.replaceAll("\\|", "PIPE"); + } else if (variable.contains("\\")) { + return variable.replaceAll("\\\\", "BACKSLASH"); + } else { + return variable; + } + } + + /** + * Reverses 'replaceReservedChars'. + * + * @param variable String that is checked for necessary char replacements + * @return modified String + */ + public String replaceReplacedChars(String variable) { + if (variable.contains("PIPE")) { + return variable.replaceAll("PIPE", "|"); + } else if (variable.contains("BACKSLASH")) { + return variable.replaceAll("BACKSLASH", "\\"); + } else { + return variable; + } + } + + @Override + public Object visitCmd_declareFun(Cmd_declareFunContext ctx) { + String variable = replaceReservedChars(ctx.symbol().getText()); + + FormulaType returnType = (FormulaType) visit(ctx.sort(ctx.sort().size() - 1)); + + List> inputParams = new ArrayList<>(); + if (ctx.sort().size() > 1) { + for (int i = 0; i < ctx.sort().size() - 1; i++) { + inputParams.add((FormulaType) visit(ctx.sort(i))); + } + } + ParserFormula temp = new ParserFormula(ufmgr.declareUF(variable, returnType, inputParams)); + temp.setType("UF"); + temp.setReturnType(returnType); + temp.setInputParams(inputParams); + variables.put(variable, temp); + + return visitChildren(ctx); + } + + /** + * Method for parsing a String to the matching Rounding Mode from the FloatingPointRoundMode + * Interface + * + * @param mode SMTLIB2 String + * @return matching FloatingPointRoundingMode + */ + public static FloatingPointRoundingMode parseRoundingModesToJavaSMTFormat(String mode) { + switch (mode) { + case "RNE": + case "roundNearestTiesToEven": + return FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN; + case "RNA": + case "roundNearestTiesToAway": + return FloatingPointRoundingMode.NEAREST_TIES_AWAY; + case "RTP": + case "roundTowardPositive": + return FloatingPointRoundingMode.TOWARD_POSITIVE; + case "RTN": + case "roundTowardNegative": + return FloatingPointRoundingMode.TOWARD_NEGATIVE; + case "RTZ": + case "roundTowardZero": + return FloatingPointRoundingMode.TOWARD_ZERO; + default: + throw new ParserException("Unbekannter Rounding Mode: " + mode); + } + } + + public static List getAllSMTLIB2RoundingModes() { + return Arrays.asList( + "RNE", + "RNA", + "RTP", + "RTN", + "RTZ", + "roundNearestTiesToEven", + "roundNearestTiesToAway", + "roundTowardPositive", + "roundTowardNegative", + "roundTowardZero"); + } + + @Override + public Object visitCmd_pop(Cmd_popContext ctx) { + throw new UnsupportedOperationException("Parser does not support \"pop\""); + } + + @Override + public Object visitCmd_push(Cmd_pushContext ctx) { + throw new UnsupportedOperationException("Parser does not support \"push\""); + } + + @Override + public Object visitDecl_sort(Decl_sortContext ctx) { + throw new UnsupportedOperationException("JavaSMT does not support \"declare-sort\""); + } + + @Override + public Object visitCmd_defineSort(Cmd_defineSortContext ctx) { + throw new UnsupportedOperationException("JavaSMT does not support \"define-sort\""); + } + + @Override + public Object visitResp_get_model(Resp_get_modelContext ctx) { + isModel = true; + return visitChildren(ctx); + } +} diff --git a/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/package-info.java b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/package-info.java new file mode 100644 index 0000000000..ae45f35199 --- /dev/null +++ b/src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/package-info.java @@ -0,0 +1,14 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +/** Parser for the SMTLIB2 format. */ +@com.google.errorprone.annotations.CheckReturnValue +@javax.annotation.ParametersAreNonnullByDefault +@org.sosy_lab.common.annotations.FieldsAreNonnullByDefault +@org.sosy_lab.common.annotations.ReturnValuesAreNonnullByDefault +package org.sosy_lab.java_smt.basicimpl.parserInterpreter; diff --git a/src/org/sosy_lab/java_smt/delegate/debugging/DebuggingFormulaManager.java b/src/org/sosy_lab/java_smt/delegate/debugging/DebuggingFormulaManager.java index bce91f6207..39be3105dc 100644 --- a/src/org/sosy_lab/java_smt/delegate/debugging/DebuggingFormulaManager.java +++ b/src/org/sosy_lab/java_smt/delegate/debugging/DebuggingFormulaManager.java @@ -17,6 +17,7 @@ import java.util.Map; import org.sosy_lab.common.Appender; import org.sosy_lab.common.Appenders; +import org.sosy_lab.common.configuration.InvalidConfigurationException; import org.sosy_lab.java_smt.api.ArrayFormulaManager; import org.sosy_lab.java_smt.api.BitvectorFormulaManager; import org.sosy_lab.java_smt.api.BooleanFormula; @@ -31,6 +32,7 @@ import org.sosy_lab.java_smt.api.QuantifiedFormulaManager; import org.sosy_lab.java_smt.api.RationalFormulaManager; import org.sosy_lab.java_smt.api.SLFormulaManager; +import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.api.StringFormulaManager; import org.sosy_lab.java_smt.api.Tactic; import org.sosy_lab.java_smt.api.UFManager; @@ -273,4 +275,15 @@ public String unescape(String variableName) { debugging.assertThreadLocal(); return delegate.unescape(variableName); } + + @Override + public BooleanFormula universalParseFromString(String pString) + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + return delegate.universalParseFromString(pString); + } + + @Override + public void dumpSMTLIB2() throws IOException { + delegate.dumpSMTLIB2(); + } } diff --git a/src/org/sosy_lab/java_smt/delegate/statistics/StatisticsFormulaManager.java b/src/org/sosy_lab/java_smt/delegate/statistics/StatisticsFormulaManager.java index 133ce870d9..518a0ab51f 100644 --- a/src/org/sosy_lab/java_smt/delegate/statistics/StatisticsFormulaManager.java +++ b/src/org/sosy_lab/java_smt/delegate/statistics/StatisticsFormulaManager.java @@ -16,6 +16,7 @@ import java.util.Map; import org.sosy_lab.common.Appender; import org.sosy_lab.common.Appenders; +import org.sosy_lab.common.configuration.InvalidConfigurationException; import org.sosy_lab.java_smt.api.ArrayFormulaManager; import org.sosy_lab.java_smt.api.BitvectorFormulaManager; import org.sosy_lab.java_smt.api.BooleanFormula; @@ -30,6 +31,7 @@ import org.sosy_lab.java_smt.api.QuantifiedFormulaManager; import org.sosy_lab.java_smt.api.RationalFormulaManager; import org.sosy_lab.java_smt.api.SLFormulaManager; +import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.api.StringFormulaManager; import org.sosy_lab.java_smt.api.Tactic; import org.sosy_lab.java_smt.api.UFManager; @@ -130,6 +132,17 @@ public BooleanFormula parse(String pS) throws IllegalArgumentException { return delegate.parse(pS); } + @Override + public BooleanFormula universalParseFromString(String pString) + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + return delegate.universalParseFromString(pString); + } + + @Override + public void dumpSMTLIB2() throws IOException { + delegate.dumpSMTLIB2(); + } + @Override public Appender dumpFormula(BooleanFormula pT) { return new Appenders.AbstractAppender() { diff --git a/src/org/sosy_lab/java_smt/delegate/synchronize/SynchronizedFormulaManager.java b/src/org/sosy_lab/java_smt/delegate/synchronize/SynchronizedFormulaManager.java index 215f162cad..e8f643ee9b 100644 --- a/src/org/sosy_lab/java_smt/delegate/synchronize/SynchronizedFormulaManager.java +++ b/src/org/sosy_lab/java_smt/delegate/synchronize/SynchronizedFormulaManager.java @@ -16,6 +16,7 @@ import java.util.Map; import org.sosy_lab.common.Appender; import org.sosy_lab.common.Appenders; +import org.sosy_lab.common.configuration.InvalidConfigurationException; import org.sosy_lab.java_smt.api.ArrayFormulaManager; import org.sosy_lab.java_smt.api.BitvectorFormulaManager; import org.sosy_lab.java_smt.api.BooleanFormula; @@ -31,6 +32,7 @@ import org.sosy_lab.java_smt.api.RationalFormulaManager; import org.sosy_lab.java_smt.api.SLFormulaManager; import org.sosy_lab.java_smt.api.SolverContext; +import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.api.StringFormulaManager; import org.sosy_lab.java_smt.api.Tactic; import org.sosy_lab.java_smt.api.UFManager; @@ -164,6 +166,17 @@ public BooleanFormula parse(String pS) throws IllegalArgumentException { } } + @Override + public BooleanFormula universalParseFromString(String pString) + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + return delegate.universalParseFromString(pString); + } + + @Override + public void dumpSMTLIB2() throws IOException { + delegate.dumpSMTLIB2(); + } + @Override public Appender dumpFormula(BooleanFormula pT) { return new Appenders.AbstractAppender() { diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyEnv.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyEnv.java new file mode 100644 index 0000000000..62b355b53c --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyEnv.java @@ -0,0 +1,8 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +public class DummyEnv {} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyFunction.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyFunction.java new file mode 100644 index 0000000000..02d6df7770 --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyFunction.java @@ -0,0 +1,70 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.util.List; +import java.util.Objects; + +public class DummyFunction { + private String name; + private DummyType returnType; + private List argumentTypes; + + public DummyFunction() {} + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DummyType getReturnType() { + return returnType; + } + + public void setReturnType(DummyType returnType) { + this.returnType = returnType; + } + + public List getArgumentTypes() { + return argumentTypes; + } + + public void setArgumentTypes(List argumentTypes) { + this.argumentTypes = argumentTypes; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Function Name: ").append(name).append(", Return Type: ").append(returnType); + if (argumentTypes != null && !argumentTypes.isEmpty()) { + sb.append(", Argument Types: ").append(argumentTypes); + } + return sb.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof DummyFunction)) { + return false; + } + DummyFunction that = (DummyFunction) o; + return Objects.equals(name, that.name) + && Objects.equals(returnType, that.returnType) + && Objects.equals(argumentTypes, that.argumentTypes); + } + + @Override + public int hashCode() { + return Objects.hash(name, returnType, argumentTypes); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyType.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyType.java new file mode 100644 index 0000000000..c772dd1eec --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/DummyType.java @@ -0,0 +1,224 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import org.sosy_lab.java_smt.api.FloatingPointRoundingMode; + +@SuppressWarnings({"all", "overrides"}) +public class DummyType { + /** This class ensures Type-safety for DummyFormulas. */ + private int bitvectorLength; + + private int exponent; + private int mantissa; + private Type arrayIndexType; + private Type arrayElementType; + public Type myType; + public FloatingPointRoundingMode roundingMode; + + public DummyType(int bitvectorLength) { + this.bitvectorLength = bitvectorLength; + this.myType = Type.BITVECTOR; + } + + public DummyType(Type pType) { + if (pType == Type.FLOATING_POINT + || pType == Type.ARRAY + || pType == Type.BITVECTOR + || pType == Type.FLOATINGPOINTROUNDINGMODE) { + throw new UnsupportedOperationException( + "Floating point, RoundModes, array types and Bitvectors need more " + "information"); + } + this.myType = pType; + } + + public DummyType(FloatingPointRoundingMode roundingMode) { + this.roundingMode = roundingMode; + this.myType = Type.FLOATINGPOINTROUNDINGMODE; + } + + public DummyType(int exponent, int mantissa) { + this.exponent = exponent; + this.mantissa = mantissa; + this.roundingMode = FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN; + this.myType = Type.FLOATING_POINT; + } + + public DummyType(int exponent, int mantissa, FloatingPointRoundingMode roundingMode) { + this.exponent = exponent; + this.mantissa = mantissa; + this.roundingMode = roundingMode; + this.myType = Type.FLOATING_POINT; + } + + public DummyType(Type indexType, Type elementType) { + this.myType = Type.ARRAY; + this.arrayIndexType = indexType; + this.arrayElementType = elementType; + } + + public enum Type { + REGEX, + STRING, + FLOATING_POINT, + INTEGER, + BITVECTOR, + ARRAY, + RATIONAL, + BOOLEAN, + FLOATINGPOINTROUNDINGMODE + } + + public boolean isFloatingPoint() { + return myType == Type.FLOATING_POINT; + } + + public boolean isBitvector() { + return myType == Type.BITVECTOR; + } + + public boolean isInteger() { + return myType == Type.INTEGER; + } + + public boolean isRational() { + return myType == Type.RATIONAL; + } + + public boolean isBoolean() { + return myType == Type.BOOLEAN; + } + + public boolean isString() { + return myType == Type.STRING; + } + + public boolean isRegex() { + return myType == Type.REGEX; + } + + public boolean isArray() { + return myType == Type.ARRAY; + } + + public boolean isFloatingPointRoundingMode() { + return myType == Type.FLOATINGPOINTROUNDINGMODE; + } + + public int getBitvectorLength() { + if (myType != Type.BITVECTOR) { + throw new UnsupportedOperationException("Not a bitvector type"); + } + return bitvectorLength; + } + + public int getExponent() { + if (myType != Type.FLOATING_POINT) { + throw new UnsupportedOperationException("Not a floating point type"); + } + return exponent; + } + + public int getMantissa() { + if (myType != Type.FLOATING_POINT) { + throw new UnsupportedOperationException("Not a floating point type"); + } + return mantissa; + } + + public FloatingPointRoundingMode getRoundingMode() { + if (myType != Type.FLOATINGPOINTROUNDINGMODE && myType != Type.FLOATING_POINT) { + throw new UnsupportedOperationException("Not a floating point rounding mode type"); + } + return roundingMode; + } + + public Type getArrayIndexType() { + if (myType != Type.ARRAY) { + throw new UnsupportedOperationException("Not an array type"); + } + return arrayIndexType; + } + + public Type getArrayElementType() { + if (myType != Type.ARRAY) { + throw new UnsupportedOperationException("Not an array type"); + } + return arrayElementType; + } + + @Override + public String toString() { + if (isFloatingPoint()) { + return "FloatingPoint<" + getExponent() + ", " + getMantissa() + ">"; + } + if (isBitvector()) { + return "Bitvector<" + getBitvectorLength() + ">"; + } + if (isArray()) { + return "Array<" + getArrayIndexType() + ", " + getArrayElementType() + ">"; + } + if (isFloatingPointRoundingMode()) { + return getRoundingMode().getSMTLIBFormat(); + } + + return myType.toString(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (other instanceof DummyType) { + DummyType otherType = (DummyType) other; + if (otherType.myType == this.myType) { + if (this.myType == Type.BITVECTOR) { + return otherType.bitvectorLength == this.bitvectorLength; + } + if (this.myType == Type.FLOATINGPOINTROUNDINGMODE) { + return otherType.roundingMode == this.roundingMode; + } + if (this.myType == Type.FLOATING_POINT) { + return otherType.exponent == this.exponent && otherType.mantissa == this.mantissa; + } + if (this.myType == Type.ARRAY) { + return otherType.arrayIndexType == this.arrayIndexType + && otherType.arrayElementType == this.arrayElementType; + } + return true; + } + } + return false; + } + + @Override + public int hashCode() { + int result = myType.hashCode(); + + switch (myType) { + case BITVECTOR: + result = 37 * result + bitvectorLength; // Using 37 instead of 31 + break; + case FLOATINGPOINTROUNDINGMODE: + result = 41 * result + (roundingMode != null ? roundingMode.hashCode() : 0); // Using 41 + break; + case FLOATING_POINT: + result = 43 * result + exponent; // Using 43 + result = 47 * result + mantissa; // Using 47 + break; + case ARRAY: + result = 53 * result + (arrayIndexType != null ? arrayIndexType.hashCode() : 0); // Using 53 + result = + 59 * result + (arrayElementType != null ? arrayElementType.hashCode() : 0); // Using 59 + break; + default: + break; + } + + return result; + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SMTLIB2Formula.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SMTLIB2Formula.java new file mode 100644 index 0000000000..1b615f52e8 --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SMTLIB2Formula.java @@ -0,0 +1,380 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.util.Objects; +import org.sosy_lab.java_smt.api.ArrayFormula; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FloatingPointFormula; +import org.sosy_lab.java_smt.api.Formula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.NumeralFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.RationalFormula; + +@SuppressWarnings({"StringCaseLocaleUsage", "rawtypes", "Immutable"}) +public class SMTLIB2Formula + implements Formula, + BitvectorFormula, + FloatingPointFormula, + ArrayFormula, + NumeralFormula, + BooleanFormula, + IntegerFormula, + RationalFormula { + private String name = "anonymous"; + private SMTLIB2Formula firstArrayParameter = null; + private SMTLIB2Formula secondArrayParameter = null; + private String representation = ""; + private final DummyType formulaType; + private String value = ""; + + public SMTLIB2Formula(DummyType pFormulaType) { + if (pFormulaType.isArray()) { + SMTLIB2Formula formula = createDummyFormulaArrayFromString(pFormulaType.toString()); + firstArrayParameter = formula.getFirstArrayParameter(); + secondArrayParameter = formula.getSecondArrayParameter(); + representation = formula.representation; + formulaType = formula.formulaType; + value = formula.value; + name = formula.name; + } else { + formulaType = pFormulaType; + } + updateRepresentation(); + } + + public SMTLIB2Formula(boolean value) { + formulaType = new DummyType(DummyType.Type.BOOLEAN); + this.value = String.valueOf(value); + updateRepresentation(); + } + + public SMTLIB2Formula(DummyType pFormulaType, String pRepresentation) { + formulaType = pFormulaType; + representation = pRepresentation; + if (pFormulaType.isInteger() || pFormulaType.isRational()) { + value = pRepresentation; + } + updateRepresentation(); + } + + public SMTLIB2Formula( + SMTLIB2Formula pFirstArrayParameter, + SMTLIB2Formula pSecondArrayParameter) { // if it represents an array + representation = ""; + formulaType = + new DummyType( + pFirstArrayParameter.getFormulaType().myType, + pSecondArrayParameter.getFormulaType().myType); + firstArrayParameter = pFirstArrayParameter; + secondArrayParameter = pSecondArrayParameter; + updateRepresentation(); + } + + public SMTLIB2Formula(int exponent, int mantissa) { // if it represents a FloatingPoint + formulaType = new DummyType(exponent, mantissa); + updateRepresentation(); + } + + public SMTLIB2Formula(int pBitvectorLength) { + formulaType = new DummyType(pBitvectorLength); + updateRepresentation(); + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + /** + * Helper method which transforms any FormulaType Object into the matching DummyFormula. + * + * @param pType FormulaType-Object + * @return DummyFormula with the correct Type. + */ + public static SMTLIB2Formula getDummyFormulaFromObject(FormulaType pType) { + if (pType.isArrayType()) { + FormulaType.ArrayFormulaType arrayType = (FormulaType.ArrayFormulaType) pType; + FormulaType indexType = arrayType.getIndexType(); + FormulaType elementType = arrayType.getElementType(); + return new SMTLIB2Formula( + getDummyFormulaFromObject(indexType), getDummyFormulaFromObject(elementType)); + } else if (pType.isBitvectorType()) { + FormulaType.BitvectorType bitvectorType = (FormulaType.BitvectorType) pType; + int size = bitvectorType.getSize(); + return new SMTLIB2Formula(size); + } else if (pType.isBooleanType()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } else if (pType.isFloatingPointType()) { + FormulaType.FloatingPointType floatingPointType = (FormulaType.FloatingPointType) pType; + int exponentSize = floatingPointType.getExponentSize(); + int mantissaSize = floatingPointType.getMantissaSize(); + return new SMTLIB2Formula(exponentSize, mantissaSize); + } else if (pType.isNumeralType()) { + if (pType.isIntegerType()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } else if (pType.isRationalType()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL)); + } + } else if (pType.isStringType()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + } else if (pType.isRegexType()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } else { + throw new IllegalArgumentException("Unsupported FormulaType: " + pType); + } + throw new RuntimeException("Unsupported FormulaType: " + pType); + } + + /** + * This method is an internal helper method which creates the internal representation of an + * ArrayFormula to be later extracted by the FormulaCreator. + * + * @return The correct representation as a String + */ + private String getArrayRepresentation() { + StringBuilder representationBuilder = new StringBuilder("Array<"); + + if (firstArrayParameter.getFormulaType().isArray()) { + representationBuilder.append(firstArrayParameter.getArrayRepresentation()); + } else { + representationBuilder.append(firstArrayParameter.getFormulaType()); + } + + representationBuilder.append(", "); + + if (secondArrayParameter.getFormulaType().isArray()) { + representationBuilder.append(secondArrayParameter.getArrayRepresentation()); + } else { + representationBuilder.append(secondArrayParameter.getFormulaType()); + } + + representationBuilder.append(">"); + return representationBuilder.toString(); + } + + /** + * This is the reverse Method to be used in the FormulaCreator. It extracts the indexElement and + * the Element types from the string to create a matching ArrayFormula + * + * @param input String in the Array Element, Element + * @return DummyFormula representing the Array without values. + */ + public static SMTLIB2Formula createDummyFormulaArrayFromString(String input) { + input = input.trim(); + + if (input.startsWith("Array<") && input.endsWith(">")) { + + String content = input.substring(6, input.length() - 1).trim(); + int commaIndex = findTopLevelCommaIndex(content); + if (commaIndex == -1) { + throw new IllegalArgumentException("Invalid Array representation: " + input); + } + + String firstParameter = content.substring(0, commaIndex).trim(); + String secondParameter = content.substring(commaIndex + 1).trim(); + + SMTLIB2Formula firstArrayParameter = createDummyFormulaArrayFromString(firstParameter); + SMTLIB2Formula secondArrayParameter = createDummyFormulaArrayFromString(secondParameter); + + return new SMTLIB2Formula(firstArrayParameter, secondArrayParameter); + } + + try { + String convertedType = input.toUpperCase(); + switch (convertedType.substring(0, 3)) { + case "INT": + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + case "RAT": + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL)); + case "BOO": + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + case "STR": + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + case "REG": + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + case "BIT": + return new SMTLIB2Formula( + new DummyType(SolverLessFormulaCreator.extractBitvectorLengthFromString(input))); + case "FLO": + return new SMTLIB2Formula( + new DummyType( + SolverLessFormulaCreator.extractExponentFromString(input), + SolverLessFormulaCreator.extractMantissaFromString(input))); + default: + throw new IllegalArgumentException("Unsupported type: " + input); + } + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Invalid representation or unsupported type: " + input, e); + } + } + + /** + * Internal helper Method which is needed to determine at which index the "," is in order to + * correctly extract the index and the element types. + * + * @param content String in the internal array representation + * @return index of the "," otherwise -1 + */ + private static int findTopLevelCommaIndex(String content) { + int depth = 0; + for (int i = 0; i < content.length(); i++) { + char c = content.charAt(i); + if (c == '<') { + depth++; + } else if (c == '>') { + depth--; + } else if (c == ',' && depth == 0) { + return i; + } + } + return -1; + } + + /** + * This method ensures that the DummyFormula has the format which the FormulaCreator needs to + * extract the information and create a matching DummyFormula from the representation-string. This + * is necessary as the Bitvector, FloatingPoint and Array FormulaTypes need more information as + * just the FormulaType. The Values are represented too. + */ + private void updateRepresentation() { + switch (formulaType.myType) { + case BITVECTOR: + this.representation = "Bitvector<" + getBitvectorLength() + ">"; + break; + case FLOATING_POINT: + this.representation = "FloatingPoint<" + getExponent() + ", " + getMantissa() + ">"; + break; + case ARRAY: + this.representation = getArrayRepresentation(); + break; + case BOOLEAN: + this.representation = "Boolean<" + value + ">"; + break; + case INTEGER: + case RATIONAL: + case REGEX: + case STRING: + this.representation = value; + break; + default: + this.representation = formulaType.toString(); + break; + } + } + + public DummyType getFormulaType() { + return formulaType; + } + + /** + * This method transforms this DummyFormula into the matching FormulaType Object. + * + * @return matching Formula Type Object. + */ + public FormulaType getFormulaTypeForCreator() { + switch (formulaType.myType) { + case BITVECTOR: + return FormulaType.getBitvectorTypeWithSize(getBitvectorLength()); + case FLOATING_POINT: + return FormulaType.getFloatingPointType(getExponent(), getMantissa()); + case ARRAY: + return FormulaType.getArrayType( + firstArrayParameter.getFormulaTypeForCreator(), + secondArrayParameter.getFormulaTypeForCreator()); + case RATIONAL: + return FormulaType.RationalType; + case STRING: + return FormulaType.StringType; + case REGEX: + return FormulaType.RegexType; + case INTEGER: + return FormulaType.IntegerType; + default: + return FormulaType.BooleanType; + } + } + + public int getExponent() { + return formulaType.getExponent(); + } + + public int getMantissa() { + return formulaType.getMantissa(); + } + + public int getBitvectorLength() { + return formulaType.getBitvectorLength(); + } + + public SMTLIB2Formula getFirstArrayParameter() { + return firstArrayParameter; + } + + public SMTLIB2Formula getSecondArrayParameter() { + return secondArrayParameter; + } + + public String getValue() { + return value; + } + + public void setValue(String pValue) { + value = pValue; + updateRepresentation(); + } + + @Override + public String toString() { + return representation; + } + + public void setRepresentation(String pS) { + representation = pS; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof SMTLIB2Formula)) { + return false; + } + + SMTLIB2Formula that = (SMTLIB2Formula) obj; + + if (!name.equals(that.name)) { + return false; + } + if (!value.equals(that.value)) { + return false; + } + if (!representation.equals(that.representation)) { + return false; + } + if (!formulaType.equals(that.formulaType)) { + return false; + } + + if (formulaType.isArray()) { + return firstArrayParameter.equals(that.firstArrayParameter) + && secondArrayParameter.equals(that.secondArrayParameter); + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash( + name, value, representation, formulaType, firstArrayParameter, secondArrayParameter); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessArrayFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessArrayFormulaManager.java new file mode 100644 index 0000000000..da5f0cb193 --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessArrayFormulaManager.java @@ -0,0 +1,73 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import org.sosy_lab.java_smt.api.ArrayFormula; +import org.sosy_lab.java_smt.api.Formula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.basicimpl.AbstractArrayFormulaManager; +import org.sosy_lab.java_smt.basicimpl.FormulaCreator; + +public class SolverLessArrayFormulaManager + extends AbstractArrayFormulaManager { + + public SolverLessArrayFormulaManager(SolverLessFormulaCreator pCreator) { + super(pCreator); + } + + protected SolverLessArrayFormulaManager( + FormulaCreator pFormulaCreator) { + super(pFormulaCreator); + } + + @Override + public T2 select( + ArrayFormula pArray, T1 pIndex) { + return super.select(pArray, pIndex); + } + + @Override + protected SMTLIB2Formula select(SMTLIB2Formula pArray, SMTLIB2Formula pIndex) { + if (pArray.getSecondArrayParameter().getFormulaType().isArray()) { + return new SMTLIB2Formula( + pArray.getSecondArrayParameter().getFirstArrayParameter(), + pArray.getSecondArrayParameter().getSecondArrayParameter()); + } + return pArray.getSecondArrayParameter(); + } + + @Override + protected SMTLIB2Formula store( + SMTLIB2Formula pArray, SMTLIB2Formula pIndex, SMTLIB2Formula pValue) { + SMTLIB2Formula result = new SMTLIB2Formula(pIndex, pValue); + result.setName(pArray.getName()); + return result; + } + + @Override + protected SMTLIB2Formula internalMakeArray( + String pName, FormulaType pIndexType, FormulaType pElementType) { + SMTLIB2Formula result = + new SMTLIB2Formula( + SMTLIB2Formula.getDummyFormulaFromObject(pIndexType), + SMTLIB2Formula.getDummyFormulaFromObject(pElementType)); + result.setName(pName); + return result; + } + + @Override + protected SMTLIB2Formula internalMakeArray( + FormulaType pIndexType, FormulaType pElementType, SMTLIB2Formula elseElem) { + return new SMTLIB2Formula( + SMTLIB2Formula.getDummyFormulaFromObject(pIndexType), + SMTLIB2Formula.getDummyFormulaFromObject(pElementType)); + } + + @Override + protected SMTLIB2Formula equivalence(SMTLIB2Formula pArray1, SMTLIB2Formula pArray2) { + return new SMTLIB2Formula(pArray1.equals(pArray2)); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessBitvectorFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessBitvectorFormulaManager.java new file mode 100644 index 0000000000..8b3f792849 --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessBitvectorFormulaManager.java @@ -0,0 +1,176 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.math.BigInteger; +import java.util.List; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.basicimpl.AbstractBitvectorFormulaManager; + +public class SolverLessBitvectorFormulaManager + extends AbstractBitvectorFormulaManager { + + protected SolverLessBitvectorFormulaManager( + SolverLessFormulaCreator pSolverLessFormulaCreator, + SolverLessBooleanFormulaManager pSolverLessBooleanFormulaManager) { + super(pSolverLessFormulaCreator, pSolverLessBooleanFormulaManager); + } + + @Override + protected SMTLIB2Formula makeBitvectorImpl(int length, SMTLIB2Formula pParam1) { + return new SMTLIB2Formula(length); + } + + @Override + protected SMTLIB2Formula toIntegerFormulaImpl(SMTLIB2Formula pI, boolean signed) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + + @Override + protected SMTLIB2Formula makeBitvectorImpl(int pLength, long pI) { + return new SMTLIB2Formula(pLength); + } + + @Override + protected SMTLIB2Formula distinctImpl(List pBits) { + return super.distinctImpl(pBits); + } + + @Override + protected SMTLIB2Formula negate(SMTLIB2Formula pParam1) { + return new SMTLIB2Formula(pParam1.getBitvectorLength()); + } + + @Override + protected SMTLIB2Formula add(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(Math.max(pParam1.getBitvectorLength(), pParam2.getBitvectorLength())); + } + + @Override + protected SMTLIB2Formula subtract(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(Math.max(pParam1.getBitvectorLength(), pParam2.getBitvectorLength())); + } + + @Override + protected SMTLIB2Formula divide(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, boolean signed) { + return new SMTLIB2Formula(Math.max(pParam1.getBitvectorLength(), pParam2.getBitvectorLength())); + } + + @Override + protected SMTLIB2Formula remainder( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, boolean signed) { + return new SMTLIB2Formula(pParam1.getBitvectorLength()); + } + + @Override + protected SMTLIB2Formula smodulo(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(pParam1.getBitvectorLength()); + } + + @Override + protected SMTLIB2Formula multiply(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(Math.max(pParam1.getBitvectorLength(), pParam2.getBitvectorLength())); + } + + @Override + protected SMTLIB2Formula equal(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula greaterThan( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, boolean signed) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula greaterOrEquals( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, boolean signed) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula lessThan( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, boolean signed) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula lessOrEquals( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, boolean signed) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula not(SMTLIB2Formula pParam1) { + return new SMTLIB2Formula(pParam1.getBitvectorLength()); + } + + @Override + protected SMTLIB2Formula and(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(Math.max(pParam1.getBitvectorLength(), pParam2.getBitvectorLength())); + } + + @Override + protected SMTLIB2Formula or(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula( + Math.max( + pParam1.getBitvectorLength(), + pParam2.getBitvectorLength())); // Boolean formulas do not have a length. + } + + @Override + protected SMTLIB2Formula xor(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(Math.max(pParam1.getBitvectorLength(), pParam2.getBitvectorLength())); + } + + @Override + protected SMTLIB2Formula makeBitvectorImpl(int pLength, BigInteger pI) { + return new SMTLIB2Formula(pLength); + } + + @Override + protected SMTLIB2Formula makeVariableImpl(int pLength, String pVar) { + SMTLIB2Formula result = new SMTLIB2Formula(pLength); + result.setName(pVar); + return result; + } + + @Override + protected SMTLIB2Formula shiftRight( + SMTLIB2Formula pNumber, SMTLIB2Formula toShift, boolean signed) { + return new SMTLIB2Formula(pNumber.getBitvectorLength()); + } + + @Override + protected SMTLIB2Formula shiftLeft(SMTLIB2Formula pExtract, SMTLIB2Formula pExtract2) { + return new SMTLIB2Formula(pExtract.getBitvectorLength()); + } + + @Override + protected SMTLIB2Formula concat(SMTLIB2Formula number, SMTLIB2Formula pAppend) { + int newLength = number.getBitvectorLength() + pAppend.getBitvectorLength(); + return new SMTLIB2Formula(newLength); + } + + @Override + protected SMTLIB2Formula extract(SMTLIB2Formula pNumber, int pMsb, int pLsb) { + int newLength = pMsb - pLsb + 1; + return new SMTLIB2Formula(newLength); + } + + @Override + protected SMTLIB2Formula extend(SMTLIB2Formula pNumber, int pExtensionBits, boolean pSigned) { + return new SMTLIB2Formula(pNumber.getBitvectorLength() + pExtensionBits); + } + + public FormulaType getFormulaType(SMTLIB2Formula formula) { + if (formula.getFormulaType().isBitvector()) { + return FormulaType.getBitvectorTypeWithSize(formula.getBitvectorLength()); + } + return formula.getFormulaTypeForCreator(); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessBooleanFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessBooleanFormulaManager.java new file mode 100644 index 0000000000..4a73c43e9a --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessBooleanFormulaManager.java @@ -0,0 +1,87 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.util.Objects; +import org.sosy_lab.java_smt.basicimpl.AbstractBooleanFormulaManager; + +public class SolverLessBooleanFormulaManager + extends AbstractBooleanFormulaManager { + + public SolverLessBooleanFormulaManager(SolverLessFormulaCreator pCreator) { + super(pCreator); + } + + @Override + protected SMTLIB2Formula makeVariableImpl(String pVar) { + SMTLIB2Formula result = new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + result.setName(pVar); + return result; + } + + @Override + protected SMTLIB2Formula makeBooleanImpl(boolean value) { + return new SMTLIB2Formula(value); + } + + @Override + protected SMTLIB2Formula not(SMTLIB2Formula pParam1) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula and(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula or(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula xor(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + if (Objects.equals(pParam1.getValue(), "") || Objects.equals(pParam2.getValue(), "")) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + return new SMTLIB2Formula( + Boolean.logicalXor( + Boolean.parseBoolean(pParam1.getValue()), Boolean.parseBoolean(pParam2.getValue()))); + } + + @Override + protected SMTLIB2Formula equivalence(SMTLIB2Formula bits1, SMTLIB2Formula bits2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected boolean isTrue(SMTLIB2Formula bits) { + if (Objects.equals(bits.getValue(), "")) { + return false; + } + return Boolean.parseBoolean(bits.getValue()); + } + + @Override + protected boolean isFalse(SMTLIB2Formula bits) { + if (Objects.equals(bits.getValue(), "")) { + return false; + } + return !Boolean.parseBoolean(bits.getValue()); + } + + @Override + protected SMTLIB2Formula ifThenElse(SMTLIB2Formula cond, SMTLIB2Formula f1, SMTLIB2Formula f2) { + if (Objects.equals(cond.getValue(), "")) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + if (Boolean.parseBoolean(cond.getValue())) { + return f1; + } else { + return f2; + } + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessContext.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessContext.java new file mode 100644 index 0000000000..6d937f9a8b --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessContext.java @@ -0,0 +1,74 @@ +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.util.Set; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.InterpolatingProverEnvironment; +import org.sosy_lab.java_smt.api.OptimizationProverEnvironment; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.basicimpl.AbstractSolverContext; + +public final class SolverLessContext extends AbstractSolverContext { + + Solvers usedSolverForSMTSolving = Solvers.Z3; + + private SolverLessContext(SolverLessFormulaManager pManager) { + super(pManager); + } + + public static SolverLessContext create(Solvers usedSolverForActualSMTSolving) { + SolverLessFormulaCreator creator = new SolverLessFormulaCreator(); + SolverLessBooleanFormulaManager bmgr = new SolverLessBooleanFormulaManager(creator); + SolverLessFormulaManager manager = new SolverLessFormulaManager(creator, bmgr); + SolverLessContext result = new SolverLessContext(manager); + result.setUsedSolverForSMTSolving(usedSolverForActualSMTSolving); + return result; + } + + @Override + public String getVersion() { + return "SolverLess 1.0. Please note that this Solver has no SMT-Solving capabilities. It is " + + "only used for SMTLIB2 generating."; + } + + @Override + public Solvers getSolverName() { + return Solvers.SOLVERLESS; + } + + public Solvers getUsedSolverForSMTSolving() { + return usedSolverForSMTSolving; + } + + public void setUsedSolverForSMTSolving(Solvers pUsedSolverForSMTSolving) { + usedSolverForSMTSolving = pUsedSolverForSMTSolving; + } + + @Override + public ProverEnvironment newProverEnvironment0(Set pOptions) { + return new SolverlessProverEnvironment(this, pOptions); + } + + @Override + protected boolean supportsAssumptionSolving() { + return false; + } + + @Override + protected InterpolatingProverEnvironment newProverEnvironmentWithInterpolation0( + Set pOptions) { + throw new UnsupportedOperationException("SolverLess does not support interpolation."); + } + + @Override + protected OptimizationProverEnvironment newOptimizationProverEnvironment0( + Set pOptions) { + throw new UnsupportedOperationException("SolverLess does not support optimization."); + } + + @Override + public void close() {} +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFloatingPointFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFloatingPointFormulaManager.java new file mode 100644 index 0000000000..58e52820ab --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFloatingPointFormulaManager.java @@ -0,0 +1,242 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.math.BigInteger; +import org.sosy_lab.java_smt.api.FloatingPointRoundingMode; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FormulaType.BitvectorType; +import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType; +import org.sosy_lab.java_smt.basicimpl.AbstractFloatingPointFormulaManager; + +@SuppressWarnings("StringSplitter") +public class SolverLessFloatingPointFormulaManager + extends AbstractFloatingPointFormulaManager< + SMTLIB2Formula, DummyType, DummyEnv, DummyFunction> { + + protected SolverLessFloatingPointFormulaManager(SolverLessFormulaCreator creator) { + super(creator); + } + + @Override + protected SMTLIB2Formula getDefaultRoundingMode() { + return new SMTLIB2Formula(new DummyType(FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN)); + } + + @Override + protected SMTLIB2Formula getRoundingModeImpl( + FloatingPointRoundingMode pFloatingPointRoundingMode) { + return new SMTLIB2Formula(new DummyType(pFloatingPointRoundingMode)); + } + + @Override + protected SMTLIB2Formula makeNumberImpl( + double pN, FloatingPointType pType, SMTLIB2Formula pFloatingPointRoundingMode) { + return new SMTLIB2Formula( + new DummyType( + pType.getExponentSize(), + pType.getMantissaSize(), + pFloatingPointRoundingMode.getFormulaType().getRoundingMode())); + } + + @Override + protected SMTLIB2Formula makeNumberImpl( + BigInteger exponent, BigInteger mantissa, boolean signBit, FloatingPointType type) { + return new SMTLIB2Formula(new DummyType(type.getExponentSize(), type.getMantissaSize())); + } + + @Override + protected SMTLIB2Formula makeNumberAndRound( + String pN, FloatingPointType pType, SMTLIB2Formula pFloatingPointRoundingMode) { + return new SMTLIB2Formula(new DummyType(pType.getExponentSize(), pType.getMantissaSize())); + } + + @Override + protected SMTLIB2Formula makePlusInfinityImpl(FloatingPointType pType) { + return new SMTLIB2Formula(pType.getExponentSize(), pType.getMantissaSize()); + } + + @Override + protected SMTLIB2Formula makeMinusInfinityImpl(FloatingPointType pType) { + + return new SMTLIB2Formula(pType.getExponentSize(), pType.getMantissaSize()); + } + + @Override + protected SMTLIB2Formula makeNaNImpl(FloatingPointType pType) { + return new SMTLIB2Formula(pType.getExponentSize(), pType.getMantissaSize()); + } + + @Override + protected SMTLIB2Formula makeVariableImpl(String pVar, FloatingPointType pType) { + SMTLIB2Formula formula = new SMTLIB2Formula(pType.getExponentSize(), pType.getMantissaSize()); + formula.setName(pVar); + return formula; + } + + // Rest of the methods remain unchanged... + @Override + protected SMTLIB2Formula castToImpl( + SMTLIB2Formula pNumber, + boolean pSigned, + FormulaType pTargetType, + SMTLIB2Formula pRoundingMode) { + if (pTargetType.isFloatingPointType()) { + FloatingPointType targetType = (FloatingPointType) pTargetType; + return new SMTLIB2Formula(targetType.getExponentSize(), targetType.getMantissaSize()); + } + if (pTargetType.isIntegerType()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + if (pTargetType.isBitvectorType()) { + BitvectorType targetType = (BitvectorType) pTargetType; + return new SMTLIB2Formula(targetType.getSize()); + } + if (pTargetType.isRationalType()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL)); + } + return null; + } + + @Override + protected SMTLIB2Formula castFromImpl( + SMTLIB2Formula pNumber, + boolean pSigned, + FloatingPointType pTargetType, + SMTLIB2Formula pRoundingMode) { + return new SMTLIB2Formula(pTargetType.getExponentSize(), pTargetType.getMantissaSize()); + } + + @Override + protected SMTLIB2Formula fromIeeeBitvectorImpl( + SMTLIB2Formula pNumber, FloatingPointType pTargetType) { + return new SMTLIB2Formula(pTargetType.getExponentSize(), pTargetType.getMantissaSize()); + } + + @Override + protected SMTLIB2Formula toIeeeBitvectorImpl(SMTLIB2Formula pNumber) { + return new SMTLIB2Formula(pNumber.getExponent(), pNumber.getMantissa()); + } + + @Override + protected SMTLIB2Formula negate(SMTLIB2Formula pParam1) { + return new SMTLIB2Formula(pParam1.getExponent(), pParam1.getMantissa()); + } + + @Override + protected SMTLIB2Formula abs(SMTLIB2Formula pParam1) { + return new SMTLIB2Formula(pParam1.getExponent(), pParam1.getMantissa()); + } + + @Override + protected SMTLIB2Formula max(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(pParam1.getExponent(), pParam1.getMantissa()); + } + + @Override + protected SMTLIB2Formula min(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(pParam1.getExponent(), pParam1.getMantissa()); + } + + @Override + protected SMTLIB2Formula sqrt(SMTLIB2Formula pNumber, SMTLIB2Formula pRoundingMode) { + return new SMTLIB2Formula(pNumber.getExponent(), pNumber.getMantissa()); + } + + @Override + protected SMTLIB2Formula add( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, SMTLIB2Formula pRoundingMode) { + return new SMTLIB2Formula(pParam1.getExponent(), pParam1.getMantissa()); + } + + @Override + protected SMTLIB2Formula subtract( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, SMTLIB2Formula pFloatingPointRoundingMode) { + return new SMTLIB2Formula(pParam1.getExponent(), pParam1.getMantissa()); + } + + @Override + protected SMTLIB2Formula divide( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, SMTLIB2Formula pFloatingPointRoundingMode) { + return new SMTLIB2Formula(pParam1.getExponent(), pParam1.getMantissa()); + } + + @Override + protected SMTLIB2Formula multiply( + SMTLIB2Formula pParam1, SMTLIB2Formula pParam2, SMTLIB2Formula pFloatingPointRoundingMode) { + return new SMTLIB2Formula(pParam1.getExponent(), pParam1.getMantissa()); + } + + @Override + protected SMTLIB2Formula remainder(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return null; + } + + @Override + protected SMTLIB2Formula assignment(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula equalWithFPSemantics(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula greaterThan(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula greaterOrEquals(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula lessThan(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula lessOrEquals(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula isNaN(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula isInfinity(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula isZero(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula isSubnormal(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula isNormal(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula isNegative(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula round(SMTLIB2Formula pFormula, FloatingPointRoundingMode pRoundingMode) { + return new SMTLIB2Formula(pFormula.getExponent(), pFormula.getMantissa()); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFormulaCreator.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFormulaCreator.java new file mode 100644 index 0000000000..b7fc05a5fe --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFormulaCreator.java @@ -0,0 +1,293 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import static com.google.common.base.Preconditions.checkArgument; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.sosy_lab.java_smt.api.ArrayFormula; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FloatingPointFormula; +import org.sosy_lab.java_smt.api.Formula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.RationalFormula; +import org.sosy_lab.java_smt.api.visitors.FormulaVisitor; +import org.sosy_lab.java_smt.basicimpl.FormulaCreator; + +@SuppressWarnings({"StringSplitter", "overloads"}) +public class SolverLessFormulaCreator + extends FormulaCreator { + + private final Map uninterpretedFunctions = new HashMap<>(); + + protected SolverLessFormulaCreator() { + super( + new DummyEnv(), + new DummyType(DummyType.Type.BOOLEAN), + new DummyType(DummyType.Type.INTEGER), + new DummyType(DummyType.Type.RATIONAL), + new DummyType(DummyType.Type.STRING), + new DummyType(DummyType.Type.REGEX)); + } + + @Override + public DummyType getBitvectorType(int bitwidth) { + return new DummyType(bitwidth); + } + + @Override + public DummyType getFloatingPointType(FloatingPointType type) { + return new DummyType(type.getExponentSize(), type.getMantissaSize()); + } + + @Override + public DummyType getArrayType(DummyType indexType, DummyType elementType) { + return new DummyType(indexType.myType, elementType.myType); + } + + @Override + public SMTLIB2Formula makeVariable(DummyType pDummyType, String varName) { + SMTLIB2Formula result = new SMTLIB2Formula(pDummyType); + result.setName(varName); + return result; + } + + @Override + @SuppressWarnings("unchecked") + public FormulaType getFormulaType(T formula) { + if (formula instanceof SMTLIB2Formula) { + SMTLIB2Formula solverLessFormula = (SMTLIB2Formula) formula; + switch (solverLessFormula.getFormulaType().myType) { + case BITVECTOR: + return (FormulaType) + FormulaType.getBitvectorTypeWithSize(solverLessFormula.getBitvectorLength()); + case FLOATING_POINT: + return (FormulaType) + FormulaType.getFloatingPointType( + solverLessFormula.getExponent(), solverLessFormula.getMantissa()); + case ARRAY: + return (FormulaType) + FormulaType.getArrayType( + solverLessFormula.getFirstArrayParameter().getFormulaTypeForCreator(), + solverLessFormula.getSecondArrayParameter().getFormulaTypeForCreator()); + case RATIONAL: + return (FormulaType) FormulaType.RationalType; + case STRING: + return (FormulaType) FormulaType.StringType; + case REGEX: + return (FormulaType) FormulaType.RegexType; + case INTEGER: + return (FormulaType) FormulaType.IntegerType; + default: + return (FormulaType) FormulaType.BooleanType; + } + } + if (formula instanceof BitvectorFormula) { + return (FormulaType) + FormulaType.getBitvectorTypeWithSize(extractInfo(formula).getBitvectorLength()); + } + if (formula instanceof ArrayFormula) { + return (FormulaType) + FormulaType.getArrayType( + extractInfo(formula).getFirstArrayParameter().getFormulaTypeForCreator(), + extractInfo(formula).getSecondArrayParameter().getFormulaTypeForCreator()); + } + return super.getFormulaType(formula); + } + + @Override + public FormulaType getFormulaType(SMTLIB2Formula formula) { + return formula.getFormulaTypeForCreator(); + } + + @Override + public R visit(FormulaVisitor visitor, Formula formula, SMTLIB2Formula f) { + return null; + } + + @Override + protected SMTLIB2Formula extractInfo(Formula pT) { + if (pT instanceof SMTLIB2Formula) { + return (SMTLIB2Formula) pT; + } + if (pT instanceof BitvectorFormula) { + return new SMTLIB2Formula(extractBitvectorLengthFromString(pT.toString())); + } + if (pT instanceof FloatingPointFormula) { + return new SMTLIB2Formula( + extractExponentFromString(pT.toString()), extractMantissaFromString(pT.toString())); + } + if (pT instanceof RationalFormula) { + if (pT.toString().isEmpty()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL)); + } + SMTLIB2Formula result = + new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL), pT.toString()); + return result; + } + if (pT instanceof IntegerFormula) { + if (pT.toString().isEmpty()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + SMTLIB2Formula result = + new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER), pT.toString()); + return result; + } + if (pT instanceof BooleanFormula) { + if (pT.toString().isEmpty()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + SMTLIB2Formula result = new SMTLIB2Formula(Boolean.parseBoolean(pT.toString())); + return result; + } + if (pT instanceof ArrayFormula) { + SMTLIB2Formula.createDummyFormulaArrayFromString(pT.toString()); + } + + return super.extractInfo(pT); + } + + public static int extractBitvectorLengthFromString(String representation) { + if (representation.startsWith("Bitvector<") && representation.endsWith(">")) { + try { + String lengthStr = representation.substring(10, representation.length() - 1); + return Integer.parseInt(lengthStr); + } catch (NumberFormatException | StringIndexOutOfBoundsException e) { + throw new IllegalArgumentException( + "Invalid Bitvector representation: " + representation, e); + } + } + throw new IllegalArgumentException("Invalid Bitvector representation: " + representation); + } + + public static int extractExponentFromString(String representation) { + if (representation.startsWith("FloatingPoint<") && representation.endsWith(">")) { + try { + String[] parts = representation.substring(14, representation.length() - 1).split(","); + if (parts.length != 2) { + throw new IllegalArgumentException( + "Invalid FloatingPoint representation: " + representation); + } + return Integer.parseInt(parts[0].trim()); + } catch (NumberFormatException | StringIndexOutOfBoundsException e) { + throw new IllegalArgumentException( + "Invalid FloatingPoint representation: " + representation, e); + } + } else if (representation.startsWith("(fp #b")) { + try { + String[] parts = representation.split(" "); + if (parts.length != 4) { + throw new IllegalArgumentException( + "Invalid FloatingPoint representation: " + representation); + } + return parts[2].length() - 2; // Remove #b prefix and count bits + } catch (Exception e) { + throw new IllegalArgumentException( + "Invalid FloatingPoint representation: " + representation, e); + } + } + throw new IllegalArgumentException("Invalid FloatingPoint representation: " + representation); + } + + public static int extractMantissaFromString(String representation) { + if (representation.startsWith("FloatingPoint<") && representation.endsWith(">")) { + try { + String[] parts = representation.substring(14, representation.length() - 1).split(","); + if (parts.length != 2) { + throw new IllegalArgumentException( + "Invalid FloatingPoint representation: " + representation); + } + return Integer.parseInt(parts[1].trim()); + } catch (NumberFormatException | StringIndexOutOfBoundsException e) { + throw new IllegalArgumentException( + "Invalid FloatingPoint representation: " + representation, e); + } + } else if (representation.startsWith("(fp #b")) { + try { + String[] parts = representation.split(" "); + if (parts.length != 4) { + throw new IllegalArgumentException( + "Invalid FloatingPoint representation: " + representation); + } + return parts[3].length() - 2; // Remove #b prefix and count bits + } catch (Exception e) { + throw new IllegalArgumentException( + "Invalid FloatingPoint representation: " + representation, e); + } + } + throw new IllegalArgumentException("Invalid FloatingPoint representation: " + representation); + } + + @Override + public DummyFunction declareUFImpl( + String pName, DummyType pReturnType, List pArgTypes) { + checkArgument(!pName.isEmpty(), "UF name cannot be null or empty"); + + return uninterpretedFunctions.computeIfAbsent( + pName, + key -> { + DummyFunction function = new DummyFunction(); + function.setName(key); + function.setReturnType(pReturnType); + function.setArgumentTypes(pArgTypes); + return function; + }); + } + + @Override + public SMTLIB2Formula callFunctionImpl(DummyFunction declaration, List args) { + checkArgument(!args.contains(null), "Arguments cannot be null"); + List expectedTypes = declaration.getArgumentTypes(); + if (args.size() != expectedTypes.size()) { + throw new IllegalArgumentException( + String.format("Expected %d arguments, but got %d", expectedTypes.size(), args.size())); + } + for (int i = 0; i < args.size(); i++) { + DummyType expected = expectedTypes.get(i); + DummyType actual = args.get(i).getFormulaType(); + if (!expected.equals(actual)) { + throw new IllegalArgumentException( + String.format("Argument %d has type %s, but expected %s", i, actual, expected)); + } + } + SMTLIB2Formula result; + if (declaration.getReturnType().isBitvector()) { + for (SMTLIB2Formula arg : args) { + if (arg.getFormulaType().isBitvector()) { + result = new SMTLIB2Formula(arg.getBitvectorLength()); + } + } + } + if (declaration.getReturnType().isFloatingPoint()) { + for (SMTLIB2Formula arg : args) { + if (arg.getFormulaType().isFloatingPoint()) { + result = new SMTLIB2Formula(arg.getExponent(), arg.getMantissa()); + } + } + } + if (declaration.getReturnType().isArray()) { + for (SMTLIB2Formula arg : args) { + if (arg.getFormulaType().isArray()) { + result = new SMTLIB2Formula(arg.getFirstArrayParameter(), arg.getSecondArrayParameter()); + } + } + } + result = new SMTLIB2Formula(declaration.getReturnType()); + result.setName(declaration.getName()); + + return result; + } + + @Override + protected DummyFunction getBooleanVarDeclarationImpl(SMTLIB2Formula pSMTLIB2Formula) { + return new DummyFunction(); // not supported + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFormulaManager.java new file mode 100644 index 0000000000..8b92d0a7ab --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessFormulaManager.java @@ -0,0 +1,53 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.io.IOException; +import org.sosy_lab.common.Appender; +import org.sosy_lab.common.Appenders; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.basicimpl.AbstractFormulaManager; +import org.sosy_lab.java_smt.basicimpl.Generator; + +public class SolverLessFormulaManager + extends AbstractFormulaManager { + + protected SolverLessFormulaManager( + SolverLessFormulaCreator pCreator, SolverLessBooleanFormulaManager bmgr) { + super( + pCreator, + new SolverLessUFManager(pCreator), + bmgr, + new SolverLessIntegerFormulaManager(pCreator), + new SolverLessRationalFormulaManager(pCreator), + new SolverLessBitvectorFormulaManager(pCreator, bmgr), + new SolverLessFloatingPointFormulaManager(pCreator), + null, + new SolverLessArrayFormulaManager(pCreator), + null, + new SolverLessStringFormulaManager(pCreator), + null); + } + + @Override + public Appender dumpFormula(final SMTLIB2Formula formula) { + assert getFormulaCreator().getFormulaType(formula) == FormulaType.BooleanType + : "Only BooleanFormulas may be dumped"; + + return new Appenders.AbstractAppender() { + @Override + public void appendTo(Appendable out) throws IOException { + Generator.assembleConstraint(formula); + out.append(Generator.getLines()); + } + }; + } + + @Override + public SMTLIB2Formula parse(String smtLib) throws IllegalArgumentException { + return (SMTLIB2Formula) universalParseFromString(smtLib); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessIntegerFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessIntegerFormulaManager.java new file mode 100644 index 0000000000..55fb2bdcdf --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessIntegerFormulaManager.java @@ -0,0 +1,68 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.math.BigDecimal; +import java.math.BigInteger; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.IntegerFormulaManager; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; + +public class SolverLessIntegerFormulaManager + extends SolverLessNumeralFormulaManager + implements IntegerFormulaManager { + + public SolverLessIntegerFormulaManager(SolverLessFormulaCreator pCreator) { + super(pCreator); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(long i) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER), String.valueOf(i)); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(BigInteger i) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER), String.valueOf(i)); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(String i) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER), i); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(double pNumber) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER), String.valueOf(pNumber)); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(BigDecimal pNumber) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER), String.valueOf(pNumber)); + } + + @Override + protected SMTLIB2Formula makeVariableImpl(String i) { + SMTLIB2Formula result = new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + result.setName(i); + return result; + } + + @Override + protected SMTLIB2Formula add(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + + @Override + protected SMTLIB2Formula subtract(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + + @Override + public FormulaType getFormulaType() { + return FormulaType.IntegerType; + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessNumeralFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessNumeralFormulaManager.java new file mode 100644 index 0000000000..5a45e98533 --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessNumeralFormulaManager.java @@ -0,0 +1,75 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.util.List; +import org.sosy_lab.java_smt.api.NumeralFormula; +import org.sosy_lab.java_smt.basicimpl.AbstractNumeralFormulaManager; + +public abstract class SolverLessNumeralFormulaManager< + T extends NumeralFormula, Y extends NumeralFormula> + extends AbstractNumeralFormulaManager< + SMTLIB2Formula, DummyType, DummyEnv, T, Y, DummyFunction> { + public SolverLessNumeralFormulaManager(SolverLessFormulaCreator creator) { + super(creator, NonLinearArithmetic.APPROXIMATE_FALLBACK); + } + + @Override + protected boolean isNumeral(SMTLIB2Formula val) { + return val.getFormulaType().isInteger() || val.getFormulaType().isRational(); + } + + @Override + protected SMTLIB2Formula negate(SMTLIB2Formula pParam1) { + return new SMTLIB2Formula(pParam1.getFormulaType()); + } + + @Override + protected SMTLIB2Formula add(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + if (pParam1.getFormulaType().isRational() || pParam2.getFormulaType().isRational()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL)); + } + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + + @Override + protected SMTLIB2Formula subtract(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + if (pParam1.getFormulaType().isRational() || pParam2.getFormulaType().isRational()) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL)); + } + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + + @Override + protected SMTLIB2Formula equal(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula distinctImpl(List pNumbers) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula greaterThan(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula greaterOrEquals(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula lessThan(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula lessOrEquals(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessRationalFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessRationalFormulaManager.java new file mode 100644 index 0000000000..5892bb69ca --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessRationalFormulaManager.java @@ -0,0 +1,67 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.math.BigDecimal; +import java.math.BigInteger; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.NumeralFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.RationalFormula; +import org.sosy_lab.java_smt.api.RationalFormulaManager; + +public class SolverLessRationalFormulaManager + extends SolverLessNumeralFormulaManager + implements RationalFormulaManager { + + public SolverLessRationalFormulaManager(SolverLessFormulaCreator creator) { + super(creator); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(long i) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL), Long.toString(i)); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(BigInteger i) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL), i.toString()); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(String i) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL), i); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(double pNumber) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL), Double.toString(pNumber)); + } + + @Override + protected SMTLIB2Formula makeNumberImpl(BigDecimal pNumber) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL), pNumber.toPlainString()); + } + + @Override + protected SMTLIB2Formula makeVariableImpl(String i) { + SMTLIB2Formula result = new SMTLIB2Formula(new DummyType(DummyType.Type.RATIONAL)); + result.setName(i); + return result; + } + + @Override + protected SMTLIB2Formula floor(SMTLIB2Formula number) { + return new SMTLIB2Formula( + new DummyType(DummyType.Type.INTEGER), + String.valueOf( + Integer.parseInt(String.valueOf((int) Double.parseDouble(number.toString()))))); + } + + @Override + public FormulaType getFormulaType() { + return FormulaType.RationalType; + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessStringFormulaManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessStringFormulaManager.java new file mode 100644 index 0000000000..2d11220b8d --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessStringFormulaManager.java @@ -0,0 +1,173 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.util.List; +import org.sosy_lab.java_smt.basicimpl.AbstractStringFormulaManager; + +public class SolverLessStringFormulaManager + extends AbstractStringFormulaManager { + + protected SolverLessStringFormulaManager(SolverLessFormulaCreator pCreator) { + super(pCreator); + } + + @Override + protected SMTLIB2Formula makeStringImpl(String value) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING), value); + } + + @Override + protected SMTLIB2Formula makeVariableImpl(String pVar) { + SMTLIB2Formula result = new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + result.setName(pVar); + return result; + } + + @Override + protected SMTLIB2Formula equal(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula greaterThan(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula greaterOrEquals(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula lessThan(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula lessOrEquals(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula length(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + + @Override + protected SMTLIB2Formula concatImpl(List parts) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + } + + @Override + protected SMTLIB2Formula prefix(SMTLIB2Formula prefix, SMTLIB2Formula str) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula suffix(SMTLIB2Formula suffix, SMTLIB2Formula str) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula in(SMTLIB2Formula str, SMTLIB2Formula regex) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula contains(SMTLIB2Formula str, SMTLIB2Formula part) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.BOOLEAN)); + } + + @Override + protected SMTLIB2Formula indexOf( + SMTLIB2Formula str, SMTLIB2Formula part, SMTLIB2Formula startIndex) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + + @Override + protected SMTLIB2Formula charAt(SMTLIB2Formula str, SMTLIB2Formula index) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + } + + @Override + protected SMTLIB2Formula substring( + SMTLIB2Formula str, SMTLIB2Formula index, SMTLIB2Formula length) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + } + + @Override + protected SMTLIB2Formula replace( + SMTLIB2Formula fullStr, SMTLIB2Formula target, SMTLIB2Formula replacement) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + } + + @Override + protected SMTLIB2Formula replaceAll( + SMTLIB2Formula fullStr, SMTLIB2Formula target, SMTLIB2Formula replacement) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + } + + @Override + protected SMTLIB2Formula makeRegexImpl(String value) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX), value); + } + + @Override + protected SMTLIB2Formula noneImpl() { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula allImpl() { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula allCharImpl() { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula range(SMTLIB2Formula start, SMTLIB2Formula end) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula concatRegexImpl(List parts) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula union(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula intersection(SMTLIB2Formula pParam1, SMTLIB2Formula pParam2) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula closure(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula complement(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.REGEX)); + } + + @Override + protected SMTLIB2Formula toIntegerFormula(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.INTEGER)); + } + + @Override + protected SMTLIB2Formula toStringFormula(SMTLIB2Formula pParam) { + return new SMTLIB2Formula(new DummyType(DummyType.Type.STRING)); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessUFManager.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessUFManager.java new file mode 100644 index 0000000000..ae3de03108 --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverLessUFManager.java @@ -0,0 +1,15 @@ +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import org.sosy_lab.java_smt.basicimpl.AbstractUFManager; + +public class SolverLessUFManager + extends AbstractUFManager { + + protected SolverLessUFManager(SolverLessFormulaCreator pCreator) { + super(pCreator); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverlessProverEnvironment.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverlessProverEnvironment.java new file mode 100644 index 0000000000..a8c29a8d24 --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/SolverlessProverEnvironment.java @@ -0,0 +1,121 @@ +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.solvers.SolverLess; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import org.sosy_lab.common.ShutdownManager; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.log.BasicLogManager; +import org.sosy_lab.common.log.LogManager; +import org.sosy_lab.java_smt.SolverContextFactory; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.Model; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; +import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; +import org.sosy_lab.java_smt.api.SolverException; +import org.sosy_lab.java_smt.basicimpl.Generator; + +public class SolverlessProverEnvironment implements ProverEnvironment { + SolverContext differentSolverContext; + private final ProverEnvironment prover; + + public SolverlessProverEnvironment(SolverLessContext solverContext, Set pOptions) { + try { + if (solverContext.getUsedSolverForSMTSolving().equals(Solvers.SOLVERLESS)) { + throw new InvalidConfigurationException( + "Used Solver must not be SolverLess! SolverLess has no SMT-Solving capabilities."); + } + Configuration config = + Configuration.builder().setOption("solver.generateSMTLIB2", String.valueOf(true)).build(); + LogManager logger = BasicLogManager.create(config); + ShutdownManager shutdown = ShutdownManager.create(); + differentSolverContext = + SolverContextFactory.createSolverContext( + config, logger, shutdown.getNotifier(), Solvers.Z3); + } catch (Exception e) { + throw new RuntimeException( + "Problem creating solver differentSolverContext:" + e.getMessage(), e); + } + try { + prover = differentSolverContext.newProverEnvironment(pOptions.toArray(new ProverOptions[0])); + } catch (Exception e) { + throw new RuntimeException( + "Problem creating solver differentSolverContext" + e.getMessage(), e); + } + } + + @Override + public Void addConstraint(BooleanFormula constraint) { + Generator.assembleConstraint(constraint); // formula is generated then reparsed and given to z3 + String smtlib2String = String.valueOf(Generator.getLines()); + try { + prover.addConstraint( + differentSolverContext.getFormulaManager().universalParseFromString(smtlib2String)); + } catch (Exception e) { + throw new RuntimeException("Problem whilst parsing and reparsing " + e.getMessage(), e); + } + return null; + } + + @Override + public void push() throws InterruptedException { + prover.push(); + } + + @Override + public void pop() { + prover.pop(); + } + + @Override + public int size() { + return prover.size(); + } + + @Override + public boolean isUnsat() throws SolverException, InterruptedException { + return prover.isUnsat(); + } + + @Override + public boolean isUnsatWithAssumptions(Collection assumptions) + throws SolverException, InterruptedException { + return prover.isUnsatWithAssumptions(assumptions); + } + + @Override + public Model getModel() throws SolverException { + return prover.getModel(); + } + + @Override + public List getUnsatCore() { + return prover.getUnsatCore(); + } + + @Override + public Optional> unsatCoreOverAssumptions( + Collection assumptions) throws SolverException, InterruptedException { + return prover.unsatCoreOverAssumptions(assumptions); + } + + @Override + public void close() { + prover.close(); + differentSolverContext.close(); + } + + @Override + public R allSat(AllSatCallback callback, List important) + throws InterruptedException, SolverException { + return prover.allSat(callback, important); + } +} diff --git a/src/org/sosy_lab/java_smt/solvers/SolverLess/package-info.java b/src/org/sosy_lab/java_smt/solvers/SolverLess/package-info.java new file mode 100644 index 0000000000..df1ae92dc8 --- /dev/null +++ b/src/org/sosy_lab/java_smt/solvers/SolverLess/package-info.java @@ -0,0 +1,10 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * This package contains classes that are used to generate the SMT formulas and functions in a + * solver-independent way. + */ +package org.sosy_lab.java_smt.solvers.SolverLess; diff --git a/src/org/sosy_lab/java_smt/solvers/boolector/BoolectorAbstractProver.java b/src/org/sosy_lab/java_smt/solvers/boolector/BoolectorAbstractProver.java index 1608cc098c..de35ece712 100644 --- a/src/org/sosy_lab/java_smt/solvers/boolector/BoolectorAbstractProver.java +++ b/src/org/sosy_lab/java_smt/solvers/boolector/BoolectorAbstractProver.java @@ -10,6 +10,7 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Collections2; +import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Optional; @@ -23,6 +24,7 @@ import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.basicimpl.AbstractProverWithAllSat; import org.sosy_lab.java_smt.basicimpl.CachingModel; +import org.sosy_lab.java_smt.basicimpl.Generator; import org.sosy_lab.java_smt.solvers.boolector.BtorJNI.TerminationCallback; abstract class BoolectorAbstractProver extends AbstractProverWithAllSat { @@ -82,6 +84,14 @@ public void close() { */ @Override public boolean isUnsat() throws SolverException, InterruptedException { + if (Generator.isLoggingEnabled()) { + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + // FIXME Find a better way to handle the IOException + throw new RuntimeException(pE); + } + } Preconditions.checkState(!closed); wasLastSatCheckSat = false; final int result = BtorJNI.boolector_sat(btor); diff --git a/src/org/sosy_lab/java_smt/solvers/cvc4/CVC4TheoremProver.java b/src/org/sosy_lab/java_smt/solvers/cvc4/CVC4TheoremProver.java index 94b7f0dd15..ede5cb211a 100644 --- a/src/org/sosy_lab/java_smt/solvers/cvc4/CVC4TheoremProver.java +++ b/src/org/sosy_lab/java_smt/solvers/cvc4/CVC4TheoremProver.java @@ -17,6 +17,7 @@ import edu.stanford.CVC4.Result; import edu.stanford.CVC4.SExpr; import edu.stanford.CVC4.SmtEngine; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -33,6 +34,7 @@ import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.basicimpl.AbstractProverWithAllSat; +import org.sosy_lab.java_smt.basicimpl.Generator; import org.sosy_lab.java_smt.basicimpl.ShutdownHook; class CVC4TheoremProver extends AbstractProverWithAllSat @@ -183,6 +185,13 @@ public ImmutableList getModelAssignments() throws SolverExcepti @Override @SuppressWarnings("try") public boolean isUnsat() throws InterruptedException, SolverException { + if (Generator.isLoggingEnabled()) { + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + throw new RuntimeException(pE); + } + } Preconditions.checkState(!closed); closeAllEvaluators(); changedSinceLastSatQuery = false; diff --git a/src/org/sosy_lab/java_smt/solvers/cvc5/CVC5AbstractProver.java b/src/org/sosy_lab/java_smt/solvers/cvc5/CVC5AbstractProver.java index 32e83314b1..9c63c49d98 100644 --- a/src/org/sosy_lab/java_smt/solvers/cvc5/CVC5AbstractProver.java +++ b/src/org/sosy_lab/java_smt/solvers/cvc5/CVC5AbstractProver.java @@ -17,6 +17,7 @@ import io.github.cvc5.Solver; import io.github.cvc5.Term; import io.github.cvc5.UnknownExplanation; +import java.io.IOException; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; @@ -35,6 +36,7 @@ import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.basicimpl.AbstractProverWithAllSat; +import org.sosy_lab.java_smt.basicimpl.Generator; abstract class CVC5AbstractProver extends AbstractProverWithAllSat { @@ -175,6 +177,14 @@ public ImmutableList getModelAssignments() throws SolverExcepti @Override @SuppressWarnings("try") public boolean isUnsat() throws InterruptedException, SolverException { + if (Generator.isLoggingEnabled()) { + // TODO: lift to abstract level + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + throw new RuntimeException(pE); + } + } Preconditions.checkState(!closed); closeAllEvaluators(); changedSinceLastSatQuery = false; diff --git a/src/org/sosy_lab/java_smt/solvers/mathsat5/Mathsat5AbstractProver.java b/src/org/sosy_lab/java_smt/solvers/mathsat5/Mathsat5AbstractProver.java index 39ace99503..e0ee833b28 100644 --- a/src/org/sosy_lab/java_smt/solvers/mathsat5/Mathsat5AbstractProver.java +++ b/src/org/sosy_lab/java_smt/solvers/mathsat5/Mathsat5AbstractProver.java @@ -34,6 +34,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.primitives.Longs; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -50,6 +51,7 @@ import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.basicimpl.AbstractProver; import org.sosy_lab.java_smt.basicimpl.CachingModel; +import org.sosy_lab.java_smt.basicimpl.Generator; import org.sosy_lab.java_smt.solvers.mathsat5.Mathsat5NativeApi.AllSatModelCallback; /** Common base class for {@link Mathsat5TheoremProver} and {@link Mathsat5InterpolatingProver}. */ @@ -98,6 +100,13 @@ private long buildConfig(Set opts) { @Override public boolean isUnsat() throws InterruptedException, SolverException { + if (Generator.isLoggingEnabled()) { + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + throw new RuntimeException(pE); + } + } Preconditions.checkState(!closed); final long hook = msat_set_termination_callback(curEnv, context.getTerminationTest()); diff --git a/src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtAbstractProver.java b/src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtAbstractProver.java index 34960c0640..adaaeddb8e 100644 --- a/src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtAbstractProver.java +++ b/src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtAbstractProver.java @@ -11,6 +11,7 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -28,6 +29,7 @@ import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.basicimpl.AbstractProverWithAllSat; +import org.sosy_lab.java_smt.basicimpl.Generator; import org.sosy_lab.java_smt.basicimpl.ShutdownHook; import org.sosy_lab.java_smt.solvers.opensmt.OpenSmtSolverContext.OpenSMTOptions; import org.sosy_lab.java_smt.solvers.opensmt.api.Logic; @@ -225,6 +227,13 @@ protected String getReasonFromSolverFeatures( @SuppressWarnings("try") // ShutdownHook is never referenced, and this is correct. public boolean isUnsat() throws InterruptedException, SolverException { Preconditions.checkState(!closed); + if (Generator.isLoggingEnabled()) { + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + throw new RuntimeException(pE); + } + } closeAllEvaluators(); changedSinceLastSatQuery = false; diff --git a/src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtFormulaCreator.java b/src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtFormulaCreator.java index 9500666d40..c133dd7541 100644 --- a/src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtFormulaCreator.java +++ b/src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtFormulaCreator.java @@ -361,15 +361,6 @@ public R visit(FormulaVisitor visitor, Formula formula, PTRef f) { ImmutableList.Builder argTerms = ImmutableList.builder(); ImmutableList.Builder> argTypes = ImmutableList.builder(); - /* FIXME: Caused crashes in ModelEvaluationTest - VectorPTRef subterms = logic.getPterm(f).getArgs(); - - for (PTRef sub : subterms) { - argTerms.add(encapsulate(sub)); - argTypes.add(getFormulaType(sub)); - } - */ - Pterm pterm = logic.getPterm(f); for (int i = 0; i < pterm.size(); i++) { PTRef sub = pterm.at(i); diff --git a/src/org/sosy_lab/java_smt/solvers/princess/PrincessAbstractProver.java b/src/org/sosy_lab/java_smt/solvers/princess/PrincessAbstractProver.java index d475a00284..be02037581 100644 --- a/src/org/sosy_lab/java_smt/solvers/princess/PrincessAbstractProver.java +++ b/src/org/sosy_lab/java_smt/solvers/princess/PrincessAbstractProver.java @@ -36,7 +36,9 @@ import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.basicimpl.AbstractProverWithAllSat; +import org.sosy_lab.java_smt.basicimpl.BinaryModel; import org.sosy_lab.java_smt.basicimpl.CachingModel; +import org.sosy_lab.java_smt.basicimpl.Generator; import scala.Enumeration.Value; @SuppressWarnings("ClassTypeParameterName") @@ -53,6 +55,8 @@ abstract class PrincessAbstractProver extends AbstractProverWithAllSat { private final PrincessFormulaCreator creator; protected boolean wasLastSatCheckSat = false; // and stack is not changed + private final BinaryModel binaryModel; + protected PrincessAbstractProver( PrincessFormulaManager pMgr, PrincessFormulaCreator creator, @@ -66,6 +70,7 @@ protected PrincessAbstractProver( trackingStack.push(new Level()); partitions.push(PathCopyingPersistentTreeMap.of()); + binaryModel = new BinaryModel(this, creator, mgr); } /** @@ -76,17 +81,26 @@ protected PrincessAbstractProver( public boolean isUnsat() throws SolverException { Preconditions.checkState(!closed); wasLastSatCheckSat = false; - final Value result = api.checkSat(true); - if (result.equals(SimpleAPI.ProverStatus$.MODULE$.Sat())) { - wasLastSatCheckSat = true; - return false; - } else if (result.equals(SimpleAPI.ProverStatus$.MODULE$.Unsat())) { - return true; - } else if (result.equals(SimpleAPI.ProverStatus$.MODULE$.OutOfMemory())) { - throw new SolverException( - "Princess ran out of stack or heap memory, try increasing their sizes."); + // TODO Log the isUnsat call + if (useBinary) { + String input = Generator.getSMTLIB2String(); + binaryModel.runBinary(input); + boolean isUnsat = binaryModel.isUnsat(); + wasLastSatCheckSat = !isUnsat; + return isUnsat; } else { - throw new SolverException("Princess' checkSat call returned " + result); + final Value result = api.checkSat(true); + if (result.equals(SimpleAPI.ProverStatus$.MODULE$.Sat())) { + wasLastSatCheckSat = true; + return false; + } else if (result.equals(SimpleAPI.ProverStatus$.MODULE$.Unsat())) { + return true; + } else if (result.equals(SimpleAPI.ProverStatus$.MODULE$.OutOfMemory())) { + throw new SolverException( + "Princess ran out of stack or heap memory, try increasing their sizes."); + } else { + throw new SolverException("Princess' checkSat call returned " + result); + } } } @@ -135,7 +149,11 @@ public Model getModel() throws SolverException { Preconditions.checkState(!closed); Preconditions.checkState(wasLastSatCheckSat, NO_MODEL_HELP); checkGenerateModels(); - return new CachingModel(getEvaluatorWithoutChecks()); + if (useBinary) { + return binaryModel.getModel(); + } else { + return new CachingModel(getEvaluatorWithoutChecks()); + } } @Override @@ -168,6 +186,10 @@ public boolean isUnsatWithAssumptions(Collection pAssumptions) public List getUnsatCore() { Preconditions.checkState(!closed); checkGenerateUnsatCores(); + if (useBinary) { + // FIXME: Add support for unsat core + throw new UnsupportedOperationException(); + } final List result = new ArrayList<>(); final Set core = asJava(api.getUnsatCore()); for (Object partitionId : core) { diff --git a/src/org/sosy_lab/java_smt/solvers/princess/PrincessEnvironment.java b/src/org/sosy_lab/java_smt/solvers/princess/PrincessEnvironment.java index ede3155b8f..0897640cd4 100644 --- a/src/org/sosy_lab/java_smt/solvers/princess/PrincessEnvironment.java +++ b/src/org/sosy_lab/java_smt/solvers/princess/PrincessEnvironment.java @@ -86,7 +86,7 @@ * for all stacks. */ @Options(prefix = "solver.princess") -class PrincessEnvironment { +public class PrincessEnvironment { @Option( secure = true, diff --git a/src/org/sosy_lab/java_smt/solvers/princess/PrincessSolverContext.java b/src/org/sosy_lab/java_smt/solvers/princess/PrincessSolverContext.java index 36a7444539..16db32a07b 100644 --- a/src/org/sosy_lab/java_smt/solvers/princess/PrincessSolverContext.java +++ b/src/org/sosy_lab/java_smt/solvers/princess/PrincessSolverContext.java @@ -27,15 +27,19 @@ public final class PrincessSolverContext extends AbstractSolverContext { private final PrincessFormulaManager manager; private final PrincessFormulaCreator creator; + private final boolean useBinary; - private PrincessSolverContext(PrincessFormulaManager manager, PrincessFormulaCreator creator) { + private PrincessSolverContext( + PrincessFormulaManager manager, PrincessFormulaCreator creator, boolean useBinary) { super(manager); this.manager = manager; this.creator = creator; + this.useBinary = useBinary; } public static SolverContext create( Configuration config, + boolean useBinary, ShutdownNotifier pShutdownNotifier, @Nullable PathCounterTemplate pLogfileTemplate, int pRandomSeed, @@ -64,7 +68,7 @@ public static SolverContext create( bitvectorTheory, arrayTheory, quantifierTheory); - return new PrincessSolverContext(manager, creator); + return new PrincessSolverContext(manager, creator, useBinary); } @SuppressWarnings("resource") @@ -74,6 +78,9 @@ protected ProverEnvironment newProverEnvironment0(Set options) { throw new UnsupportedOperationException( "Princess does not support unsat core generation with assumptions yet"); } + if (useBinary) { + options.add(ProverOptions.USE_BINARY); + } return (PrincessTheoremProver) creator.getEnv().getNewProver(false, manager, creator, options); } @@ -81,6 +88,9 @@ protected ProverEnvironment newProverEnvironment0(Set options) { @Override protected InterpolatingProverEnvironment newProverEnvironmentWithInterpolation0( Set options) { + if (useBinary) { + options.add(ProverOptions.USE_BINARY); + } return (PrincessInterpolatingProver) creator.getEnv().getNewProver(true, manager, creator, options); } diff --git a/src/org/sosy_lab/java_smt/solvers/smtinterpol/SmtInterpolAbstractProver.java b/src/org/sosy_lab/java_smt/solvers/smtinterpol/SmtInterpolAbstractProver.java index 79b8cfccfd..306103332e 100644 --- a/src/org/sosy_lab/java_smt/solvers/smtinterpol/SmtInterpolAbstractProver.java +++ b/src/org/sosy_lab/java_smt/solvers/smtinterpol/SmtInterpolAbstractProver.java @@ -24,6 +24,7 @@ import de.uni_freiburg.informatik.ultimate.logic.Script.LBool; import de.uni_freiburg.informatik.ultimate.logic.Sort; import de.uni_freiburg.informatik.ultimate.logic.Term; +import java.io.IOException; import java.util.ArrayDeque; import java.util.Collection; import java.util.Deque; @@ -44,6 +45,7 @@ import org.sosy_lab.java_smt.basicimpl.AbstractProver; import org.sosy_lab.java_smt.basicimpl.CachingModel; import org.sosy_lab.java_smt.basicimpl.FormulaCreator; +import org.sosy_lab.java_smt.basicimpl.Generator; @SuppressWarnings("ClassTypeParameterName") abstract class SmtInterpolAbstractProver extends AbstractProver { @@ -103,6 +105,13 @@ protected String addConstraint0(BooleanFormula constraint) { @Override public boolean isUnsat() throws InterruptedException { + if (Generator.isLoggingEnabled()) { + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + throw new RuntimeException(pE); + } + } checkState(!closed); // We actually terminate SmtInterpol during the analysis diff --git a/src/org/sosy_lab/java_smt/solvers/yices2/Yices2TheoremProver.java b/src/org/sosy_lab/java_smt/solvers/yices2/Yices2TheoremProver.java index 30b6eda2a5..e56ffc1e5d 100644 --- a/src/org/sosy_lab/java_smt/solvers/yices2/Yices2TheoremProver.java +++ b/src/org/sosy_lab/java_smt/solvers/yices2/Yices2TheoremProver.java @@ -25,6 +25,7 @@ import com.google.common.base.Preconditions; import com.google.common.primitives.Ints; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -41,6 +42,7 @@ import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.basicimpl.AbstractProverWithAllSat; import org.sosy_lab.java_smt.basicimpl.CachingModel; +import org.sosy_lab.java_smt.basicimpl.Generator; /** * Info about the option {@link ProverOptions#GENERATE_UNSAT_CORE}: Yices provides the unsat core @@ -118,6 +120,13 @@ protected void pushImpl() throws InterruptedException { @Override public boolean isUnsat() throws SolverException, InterruptedException { + if (Generator.isLoggingEnabled()) { + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + throw new RuntimeException(pE); + } + } Preconditions.checkState(!closed); boolean unsat; if (generateUnsatCores) { // unsat core does not work with incremental mode diff --git a/src/org/sosy_lab/java_smt/solvers/z3/Z3AbstractProver.java b/src/org/sosy_lab/java_smt/solvers/z3/Z3AbstractProver.java index e409058777..989834be17 100644 --- a/src/org/sosy_lab/java_smt/solvers/z3/Z3AbstractProver.java +++ b/src/org/sosy_lab/java_smt/solvers/z3/Z3AbstractProver.java @@ -36,6 +36,7 @@ import org.sosy_lab.java_smt.api.SolverException; import org.sosy_lab.java_smt.basicimpl.AbstractProverWithAllSat; import org.sosy_lab.java_smt.basicimpl.CachingModel; +import org.sosy_lab.java_smt.basicimpl.Generator; abstract class Z3AbstractProver extends AbstractProverWithAllSat { @@ -124,6 +125,9 @@ protected Z3Model getEvaluatorWithoutChecks() { @Override protected Void addConstraintImpl(BooleanFormula f) throws InterruptedException { Preconditions.checkState(!closed); + if (Generator.isLoggingEnabled()) { + Generator.assembleConstraint(f); + } long e = creator.extractInfo(f); try { if (storedConstraints != null) { // Unsat core generation is on. diff --git a/src/org/sosy_lab/java_smt/solvers/z3/Z3OptimizationProver.java b/src/org/sosy_lab/java_smt/solvers/z3/Z3OptimizationProver.java index b1eddb2a6b..3a139f7e90 100644 --- a/src/org/sosy_lab/java_smt/solvers/z3/Z3OptimizationProver.java +++ b/src/org/sosy_lab/java_smt/solvers/z3/Z3OptimizationProver.java @@ -14,6 +14,7 @@ import com.microsoft.z3.Native.IntPtr; import com.microsoft.z3.Z3Exception; import com.microsoft.z3.enumerations.Z3_lbool; +import java.io.IOException; import java.util.Collection; import java.util.Map.Entry; import java.util.Optional; @@ -29,6 +30,7 @@ import org.sosy_lab.java_smt.api.OptimizationProverEnvironment; import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; import org.sosy_lab.java_smt.api.SolverException; +import org.sosy_lab.java_smt.basicimpl.Generator; class Z3OptimizationProver extends Z3AbstractProver implements OptimizationProverEnvironment { @@ -133,6 +135,13 @@ protected long getUnsatCore0() { @Override public boolean isUnsat() throws Z3SolverException, InterruptedException { + if (Generator.isLoggingEnabled()) { + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + throw new RuntimeException(pE); + } + } Preconditions.checkState(!closed); logSolverStack(); return check() == OptStatus.UNSAT; diff --git a/src/org/sosy_lab/java_smt/solvers/z3/Z3TheoremProver.java b/src/org/sosy_lab/java_smt/solvers/z3/Z3TheoremProver.java index 6a1cba2f4f..e1a56ae2dc 100644 --- a/src/org/sosy_lab/java_smt/solvers/z3/Z3TheoremProver.java +++ b/src/org/sosy_lab/java_smt/solvers/z3/Z3TheoremProver.java @@ -13,6 +13,7 @@ import com.microsoft.z3.Native; import com.microsoft.z3.Z3Exception; import com.microsoft.z3.enumerations.Z3_lbool; +import java.io.IOException; import java.util.Collection; import java.util.Map.Entry; import java.util.Set; @@ -24,6 +25,7 @@ import org.sosy_lab.java_smt.api.ProverEnvironment; import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; import org.sosy_lab.java_smt.api.UserPropagator; +import org.sosy_lab.java_smt.basicimpl.Generator; class Z3TheoremProver extends Z3AbstractProver implements ProverEnvironment { @@ -83,6 +85,14 @@ protected void assertContraintAndTrack(long constraint, long symbol) { @Override public boolean isUnsat() throws Z3SolverException, InterruptedException { + if (Generator.isLoggingEnabled()) { + // TODO: lift to abstract level + try { + Generator.dumpSMTLIB2(); + } catch (IOException pE) { + throw new RuntimeException(pE); + } + } Preconditions.checkState(!closed); logSolverStack(); int result; diff --git a/src/org/sosy_lab/java_smt/test/ArrayFormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/ArrayFormulaManagerTest.java index 6d1853e903..dc8f66fbcc 100644 --- a/src/org/sosy_lab/java_smt/test/ArrayFormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/ArrayFormulaManagerTest.java @@ -38,6 +38,11 @@ public void init() { requireArrays(); } + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } + @Test public void testIntIndexIntValue() throws SolverException, InterruptedException { requireIntegers(); diff --git a/src/org/sosy_lab/java_smt/test/ArraySMTLIB2GeneratorTest.java b/src/org/sosy_lab/java_smt/test/ArraySMTLIB2GeneratorTest.java new file mode 100644 index 0000000000..c666e9a74f --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/ArraySMTLIB2GeneratorTest.java @@ -0,0 +1,385 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; + +import java.util.Objects; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.ArrayFormula; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.RationalFormula; +import org.sosy_lab.java_smt.basicimpl.Generator; + +public class ArraySMTLIB2GeneratorTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Test + public void simpleTestDeclareIntArray() { + requireArrays(); + requireIntegers(); + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.IntegerType); + IntegerFormula numberToBeStored = imgr.makeNumber(3); + IntegerFormula index = imgr.makeNumber(0); + ArrayFormula result = amgr.store(a1, index, numberToBeStored); + BooleanFormula constraint = amgr.equivalence(amgr.store(a1, index, numberToBeStored), result); + + String expectedResult = + "(declare-const a1 (Array Int Int))\n" + "(assert (= (store a1 0 3) (store a1 0 3)))\n"; + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeArrayInteger() { + requireArrays(); + requireIntegers(); + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.IntegerType); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray("a2", FormulaType.IntegerType, FormulaType.IntegerType); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c1 = + amgr.makeArray( + "c1", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.IntegerType, FormulaType.IntegerType)))); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c2 = + amgr.makeArray( + "c2", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.IntegerType, FormulaType.IntegerType)))); + + BooleanFormula constraint1 = amgr.equivalence(a1, a2); + BooleanFormula constraint3 = amgr.equivalence(c1, c2); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a1 (Array Int Int))\n" + + "(declare-const a2 (Array Int Int))\n" + + "(assert (= a1 a2))\n" + + "(declare-const c1 (Array (Array Int Int) (Array (Array Int Int) (Array Int Int))))\n" + + "(declare-const c2 (Array (Array Int Int) (Array (Array Int Int) (Array Int Int))))\n" + + "(assert (= c1 c2))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeArrayRationals() { + requireArrays(); + requireRationals(); + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.RationalType, FormulaType.RationalType); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray("a2", FormulaType.RationalType, FormulaType.RationalType); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c1 = + amgr.makeArray( + "c1", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.RationalType, FormulaType.RationalType), + FormulaType.getArrayType( + FormulaType.getArrayType( + FormulaType.RationalType, FormulaType.RationalType), + FormulaType.getArrayType( + FormulaType.RationalType, FormulaType.RationalType)))); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c2 = + amgr.makeArray( + "c2", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.RationalType, FormulaType.RationalType), + FormulaType.getArrayType( + FormulaType.getArrayType( + FormulaType.RationalType, FormulaType.RationalType), + FormulaType.getArrayType( + FormulaType.RationalType, FormulaType.RationalType)))); + + BooleanFormula constraint1 = amgr.equivalence(a1, a2); + BooleanFormula constraint3 = amgr.equivalence(c1, c2); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a1 (Array Real Real))\n" + + "(declare-const a2 (Array Real Real))\n" + + "(assert (= a1 a2))\n" + + "(declare-const c1 (Array (Array Real Real) (Array (Array Real Real) (Array Real" + + " Real))))\n" + + "(declare-const c2 (Array (Array Real Real) (Array (Array Real Real) (Array Real" + + " Real))))\n" + + "(assert (= c1 c2))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeArrayBooleans() { + assume() + .withMessage("Bitwuzla doesn't support booleans in arrays") + .that(solverToUse()) + .isNotEqualTo(Solvers.BITWUZLA); + requireArrays(); + requireBooleanArgumentArrays(); + requireAllSortArrays(); + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.BooleanType, FormulaType.BooleanType); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray("a2", FormulaType.BooleanType, FormulaType.BooleanType); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c1 = + amgr.makeArray( + "c1", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.BooleanType, FormulaType.BooleanType)))); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c2 = + amgr.makeArray( + "c2", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.BooleanType, FormulaType.BooleanType)))); + + BooleanFormula constraint1 = amgr.equivalence(a1, a2); + BooleanFormula constraint3 = amgr.equivalence(c1, c2); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a1 (Array Bool Bool))\n" + + "(declare-const a2 (Array Bool Bool))\n" + + "(assert (= a1 a2))\n" + + "(declare-const c1 (Array (Array Bool Bool) (Array (Array Bool Bool) (Array Bool" + + " Bool))))\n" + + "(declare-const c2 (Array (Array Bool Bool) (Array (Array Bool Bool) (Array Bool" + + " Bool))))\n" + + "(assert (= c1 c2))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeArrayBitvectors() { + requireArrays(); + requireBitvectors(); + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray( + "a1", + FormulaType.getBitvectorTypeWithSize(3), + FormulaType.getBitvectorTypeWithSize(3)); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray( + "a2", + FormulaType.getBitvectorTypeWithSize(3), + FormulaType.getBitvectorTypeWithSize(3)); + + BooleanFormula constraint1 = amgr.equivalence(a1, a2); + + Generator.assembleConstraint(constraint1); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a1 (Array (_ BitVec 3) (_ BitVec 3)))\n" + + "(declare-const a2 (Array (_ BitVec 3) (_ BitVec 3)))\n" + + "(assert (= a1 a2))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeArrayMixed() { + requireArrays(); + requireBitvectors(); + requireRationals(); + requireIntegers(); + requireBooleanArgumentArrays(); + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.RationalType); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray("a2", FormulaType.IntegerType, FormulaType.RationalType); + ArrayFormula b1 = + amgr.makeArray("b1", FormulaType.getBitvectorTypeWithSize(3), FormulaType.BooleanType); + ArrayFormula b2 = + amgr.makeArray("b2", FormulaType.getBitvectorTypeWithSize(3), FormulaType.BooleanType); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c1 = + amgr.makeArray( + "c1", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.IntegerType, FormulaType.getBitvectorTypeWithSize(3))))); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c2 = + amgr.makeArray( + "c2", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.IntegerType, FormulaType.getBitvectorTypeWithSize(3))))); + + BooleanFormula constraint1 = amgr.equivalence(a1, a2); + BooleanFormula constraint2 = amgr.equivalence(b1, b2); + BooleanFormula constraint3 = amgr.equivalence(c1, c2); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint2); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a1 (Array Int Real))\n" + + "(declare-const a2 (Array Int Real))\n" + + "(assert (= a1 a2))\n" + + "(declare-const b1 (Array (_ BitVec 3) Bool))\n" + + "(declare-const b2 (Array (_ BitVec 3) Bool))\n" + + "(assert (= b1 b2))\n" + + "(declare-const c1 (Array (Array Int Int) (Array (Array Bool Bool) (Array Int (_" + + " BitVec 3)))))\n" + + "(declare-const c2 (Array (Array Int Int) (Array (Array Bool Bool) (Array Int (_" + + " BitVec 3)))))\n" + + "(assert (= c1 c2))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testStore() { + requireArrays(); + requireIntegers(); + assume().that(solverToUse()).isNotEqualTo(Solvers.Z3); + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.IntegerType); + + ArrayFormula term1 = + amgr.store(a1, imgr.makeNumber(3), imgr.makeNumber(2)); + BooleanFormula constraint = amgr.equivalence(a1, term1); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a1 (Array Int Int))\n" + "(assert (= a1 (store a1 3 2)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testSelect() { + requireArrays(); + requireIntegers(); + assume().that(solverToUse()).isNotEqualTo(Solvers.Z3); + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.IntegerType); + + IntegerFormula term1 = amgr.select(a1, imgr.makeNumber(2)); + BooleanFormula constraint = imgr.equal(term1, imgr.makeNumber(5)); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a1 (Array Int Int))\n" + "(assert (= (select a1 2) 5))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } +} diff --git a/src/org/sosy_lab/java_smt/test/BitVectorSMTLIB2GeneratorTest.java b/src/org/sosy_lab/java_smt/test/BitVectorSMTLIB2GeneratorTest.java new file mode 100644 index 0000000000..1829a39a16 --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/BitVectorSMTLIB2GeneratorTest.java @@ -0,0 +1,820 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; + +import java.math.BigInteger; +import java.util.Objects; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.basicimpl.Generator; + +@SuppressWarnings("checkstyle:linelength") +public class BitVectorSMTLIB2GeneratorTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Test + public void easyBitVecDeclarationTest() { + requireBitvectors(); + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(32, "a"); + BitvectorFormula b = Objects.requireNonNull(bvmgr).makeVariable(32, "b"); + BooleanFormula constraint = bvmgr.equal(a, b); + + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = + "(declare-const a (_ BitVec 32))\n" + + "(declare-const b (_ BitVec 32))\n" + + "(assert (= a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void easyBitVecDeclarationTest2() { + requireBitvectors(); + BitvectorFormula a = bvmgr.makeBitvector(32, new BigInteger("10", 2)); + BitvectorFormula b = bvmgr.makeVariable(32, "b"); + BooleanFormula constraint = bvmgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = + "(declare-const b (_ BitVec 32))\n" + "(assert (= #b00000000000000000000000000000010 b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeVariable() { + requireBitvectors(); + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(32, "a"); + BitvectorFormula b = bvmgr.makeVariable(32, "b"); + BitvectorFormula c = bvmgr.makeVariable(FormulaType.getBitvectorTypeWithSize(5), "c"); + BitvectorFormula d = bvmgr.makeVariable(FormulaType.getBitvectorTypeWithSize(5), "d"); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.add(a, b)); + BooleanFormula constraint2 = bvmgr.equal(c, d); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint2); + + /* + avoid such high numbers with Boolector and Princess + BitvectorFormula e = bvmgr.makeVariable(214748366, "e"); + BitvectorFormula f = bvmgr.makeVariable(214748366, "f"); + BooleanFormula constraint3 = bvmgr.equal(e, f); + Generator.assembleConstraint(constraint3); + */ + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ BitVec 32))\n" + + "(declare-const b (_ BitVec 32))\n" + + "(assert (= a (bvadd a b)))\n" + + "(declare-const c (_ BitVec 5))\n" + + "(declare-const d (_ BitVec 5))\n" + + "(assert (= c d))\n"; + // + "(declare-const e (_ BitVec 214748366))\n" + // + "(declare-const f (_ BitVec 214748366))\n" + // + "(assert (= e f))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeBitVectorWithIntegerFormulas() { + requireBitvectors(); + assume().that(solverToUse()).isNotEqualTo(Solvers.Z3); + requireIntegers(); + requireBitvectorToInt(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula a = bvmgr.makeBitvector(5, imgr.makeNumber(10)); + BitvectorFormula b = bvmgr.makeBitvector(5, imgr.makeNumber(10)); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 263255258); + BooleanFormula constraint1 = bvmgr.equal(c, d); + BooleanFormula constraint2 = bvmgr.equal(a, b); + BooleanFormula constraint3 = bvmgr.equal(e, f); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint2); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(assert (= #b111111110110 #b000000010100))\n" + + "(assert (= #b01010 #b01010))\n" + + "(assert (= #b111111110110 #b000000010100))\n"; + String expectedResultOthers = + "(assert (= #b111111110110 #b000000010100))\n" + + "(assert (= #b01010 #b01010))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011011010))\n"; + assertThat( + expectedResultMathsat5.equals(actualResult) + || expectedResultOthers.equals(actualResult)) + .isTrue(); + } + + @Test + public void testMakeBitVectorWithoutIntegerFormulas() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula a = bvmgr.makeBitvector(5, 10); + BitvectorFormula b = bvmgr.makeBitvector(5, 10); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 263255258); + BooleanFormula constraint1 = bvmgr.equal(c, d); + BooleanFormula constraint2 = bvmgr.equal(a, b); + BooleanFormula constraint3 = bvmgr.equal(e, f); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint2); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(assert (= #b111111110110 #b000000010100))\n" + + "(assert (= #b01010 #b01010))\n" + + "(assert (= #b111111110110 #b000000010100))\n"; + String expectedResultOthers = + "(assert (= #b111111110110 #b000000010100))\n" + + "(assert (= #b01010 #b01010))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011011010))\n"; + assertThat( + expectedResultMathsat5.equals(actualResult) + || expectedResultOthers.equals(actualResult)) + .isTrue(); + } + + @Test + public void testAdd() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula a = bvmgr.makeBitvector(5, 10); + BitvectorFormula b = bvmgr.makeBitvector(5, 0); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 263255258); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.add(c, d)); + BooleanFormula constraint2 = bvmgr.equal(a, bvmgr.add(a, b)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.add(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint2); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(assert (= #b111111110110 (bvadd #b111111110110 #b000000010100)))\n" + + "(assert (= #b01010 #b01010))\n" + + "(assert (= #b111111110110 (bvadd #b111111110110 #b000000010100)))\n"; + String expectedResultOthers = + "(assert (= #b111111110110 (bvadd #b111111110110 #b000000010100)))\n" + + "(assert (= #b01010 (bvadd #b01010 #b00000)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvadd" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011011010)))\n"; + assertThat( + expectedResultMathsat5.equals(actualResult) + || expectedResultOthers.equals(actualResult)) + .isTrue(); + } + + @Test + public void testNegate() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = + bvmgr.equal(bvmgr.negate(c), bvmgr.add(bvmgr.negate(c), bvmgr.negate(d))); + BooleanFormula constraint3 = + bvmgr.equal(bvmgr.negate(e), bvmgr.add(bvmgr.negate(e), bvmgr.negate(f))); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(assert (= (bvneg #b111111110110) #b111111110110))\n" + + "(assert (= (bvneg" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110)" + + " (bvneg" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110)))\n"; + String expectedResultOthers = + "(assert (= (bvneg #b111111110110) (bvadd (bvneg #b111111110110) (bvneg" + + " #b000000010100))))\n" + + "(assert (= (bvneg" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110)" + + " (bvadd (bvneg" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110)" + + " (bvneg" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))))\n"; + assertThat( + expectedResultMathsat5.equals(actualResult) + || expectedResultOthers.equals(actualResult)) + .isTrue(); + } + + @Test + public void testSubtract() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.subtract(c, d)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.subtract(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(assert (= #b111111110110 (bvsub #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110))\n"; + String expectedResultOthers = + "(assert (= #b111111110110 (bvsub #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvsub" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat( + expectedResultMathsat5.equals(actualResult) + || expectedResultOthers.equals(actualResult)) + .isTrue(); + } + + @Test + public void testDivide() { + // Does not work for CVC4 due to "BigInteger argument out of bounds" + requireBitvectors(); + assume() + .withMessage("Solver %s cannot handle this BigInterger argument", solverToUse()) + .that(solverToUse()) + .isNotEqualTo(Solvers.CVC4); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.divide(c, d, true)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.divide(e, f, false)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultOthers = + "(assert (= #b111111110110 (bvsdiv #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvudiv" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + String expectedResultYices = + "(assert (= #b111111110110 (bvsdiv #b111111110110 " + + "#b000000010100)))\n" + + "(assert (= #b111111110110 (bvsdiv #b111111110110 #b000000010100)))\n"; + assertThat( + expectedResultYices.equals(actualResult) || expectedResultOthers.equals(actualResult)) + .isTrue(); + } + + @Test + public void testBVRemainder() { + // Does not work for CVC4 due to "BigInteger argument out of bounds" + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.remainder(c, d, true)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.remainder(e, f, false)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultOthers = + "(assert (= #b111111110110 (bvsrem #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvurem" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + String expectedResultYices = + "(assert (= #b111111110110 #b111111110110))\n" + + "(assert (= #b111111110110 #b111111110110))\n"; + String expectedResultMathsat5 = + "(assert (= #b111111110110 #b111111110110))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvurem" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat( + expectedResultYices.equals(actualResult) + || expectedResultOthers.equals(actualResult) + || expectedResultMathsat5.equals(actualResult)) + .isTrue(); + } + + // TODO: add smodulo test + + @Test + public void testMultiply() { + // Does not work for CVC4 due to "BigInteger argument out of bounds" + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.multiply(c, d)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.multiply(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultOthers = + "(assert (= #b111111110110 (bvmul #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvmul" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + String expectedResultYices = + "(assert (= #b111111110110 #b111111110110))\n" + + "(assert (= #b111111110110 #b111111110110))\n"; + String expectedResultMathsat5 = + "(assert (= #b111111110110 (bvmul #b111111110110 #b000000010100)))\n" + + "(assert (= #b111111110110 (bvmul #b111111110110 #b000000010100)))\n"; + assertThat( + expectedResultYices.equals(actualResult) + || expectedResultOthers.equals(actualResult) + || expectedResultMathsat5.equals(actualResult)) + .isTrue(); + } + + @Test + public void testGreaterThan() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.greaterThan(c, d, true); + BooleanFormula constraint3 = bvmgr.greaterThan(e, f, false); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(assert (bvsgt #b111111110110 #b000000010100))\n" + + "(assert (bvugt" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testGreaterOrEqual() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.greaterOrEquals(c, d, true); + BooleanFormula constraint3 = bvmgr.greaterOrEquals(e, f, false); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(assert (bvsge #b111111110110 #b000000010100))\n" + + "(assert (bvuge" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testLessThan() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.lessThan(c, d, true); + BooleanFormula constraint3 = bvmgr.lessThan(e, f, false); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(assert (bvslt #b111111110110 #b000000010100))\n" + + "(assert (bvult" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testLessOrEqual() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.lessOrEquals(c, d, true); + BooleanFormula constraint3 = bvmgr.lessOrEquals(e, f, false); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(assert (bvsle #b111111110110 #b000000010100))\n" + + "(assert (bvule" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testNot() { + requireBitvectors(); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(bvmgr.not(c), bvmgr.not(d)); + BooleanFormula constraint3 = bvmgr.equal(bvmgr.not(e), bvmgr.not(f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(assert (= (bvnot #b111111110110) (bvnot #b000000010100)))\n" + + "(assert (= (bvnot #b111111110110) (bvnot #b000000010100)))\n"; + String expectedResultOthers = + "(assert (= (bvnot #b111111110110) (bvnot #b000000010100)))\n" + + "(assert (= (bvnot" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110)" + + " (bvnot" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat( + expectedResultMathsat5.equals(actualResult) + || expectedResultOthers.equals(actualResult)) + .isTrue(); + } + + @Test + public void testAnd() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.and(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.and(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a #b000000010100))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + String expectedResultZ3 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvand #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvand" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat(expectedResultMathsat5.equals(actualResult) || expectedResultZ3.equals(actualResult)) + .isTrue(); + } + + @Test + public void testOr() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.or(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.or(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a #b111111110110))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110))\n"; + String expectedResultZ3 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvor #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvor" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat(expectedResultMathsat5.equals(actualResult) || expectedResultZ3.equals(actualResult)) + .isTrue(); + } + + @Test + public void testXor() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.xor(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.xor(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvxor #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110))\n"; + String expectedResultZ3 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvxor #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvxor" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat(expectedResultMathsat5.equals(actualResult) || expectedResultZ3.equals(actualResult)) + .isTrue(); + } + + @Test + public void testShiftRight() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.shiftRight(c, d, true)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.shiftRight(e, f, false)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvashr #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110))\n"; + String expectedResultZ3 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvashr #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvlshr" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat(expectedResultMathsat5.equals(actualResult) || expectedResultZ3.equals(actualResult)) + .isTrue(); + } + + @Test + public void testShiftLeft() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.shiftLeft(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.shiftLeft(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultOthers = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvshl #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvshl" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvshl #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110))\n"; + assertThat( + expectedResultOthers.equals(actualResult) + || expectedResultMathsat5.equals(actualResult)) + .isTrue(); + } + + @Test + public void testConcat() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(24, "a"); + BitvectorFormula b = bvmgr.makeVariable(200, "b"); + BitvectorFormula c = bvmgr.makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.concat(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.concat(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 24))\n" + + "(assert (= a (concat #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 200))\n" + + "(assert (= b (concat" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat(actualResult).isEqualTo(expectedResultMathsat5); + } + + @Test + public void testExtract() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(6, "a"); + BitvectorFormula b = bvmgr.makeVariable(50, "b"); + BitvectorFormula c = bvmgr.makeBitvector(12, -10); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.extract(c, 11, 6)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.extract(f, 99, 50)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 6))\n" + + "(assert (= a ((_ extract 11 6) #b111111110110)))\n" + + "(declare-const b (_ BitVec 50))\n" + + "(assert (= b ((_ extract 99 50)" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat(actualResult).isEqualTo(expectedResultMathsat5); + } + + @Test + public void testExtend() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(18, "a"); + BitvectorFormula b = bvmgr.makeVariable(150, "b"); + BitvectorFormula c = bvmgr.makeBitvector(12, -10); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.extend(c, 6, true)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.extend(f, 50, false)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 18))\n" + + "(assert (= a ((_ sign_extend 6) #b111111110110)))\n" + + "(declare-const b (_ BitVec 150))\n" + + "(assert (= b ((_ zero_extend 50)" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + assertThat(actualResult).isEqualTo(expectedResultMathsat5); + } + + @Test + public void testNested() { + requireBitvectors(); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(5, "a"); + BitvectorFormula b = bvmgr.makeVariable(5, "b"); + BitvectorFormula c = bvmgr.makeBitvector(5, -10); + BitvectorFormula f = bvmgr.makeBitvector(5, 0); + BitvectorFormula term1 = bvmgr.add(a, b); + BitvectorFormula term2 = bvmgr.divide(c, f, true); + BitvectorFormula term3 = bvmgr.remainder(a, c, true); + BitvectorFormula term4 = bvmgr.xor(b, f); + BitvectorFormula term5 = bvmgr.subtract(term1, term2); + BitvectorFormula term6 = bvmgr.and(term5, term3); + BitvectorFormula term7 = bvmgr.shiftLeft(term6, term4); + BooleanFormula constraint = bvmgr.equal(a, term7); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultOthers = + "(declare-const a (_ BitVec 5))\n" + + "(declare-const b (_ BitVec 5))\n" + + "(assert (= a (bvshl (bvand (bvsub (bvadd a b) (bvsdiv #b10110 #b00000)) (bvsrem a" + + " #b10110)) (bvxor b #b00000))))\n"; + String expectedResultMathsat5 = + "(declare-const a (_ BitVec 5))\n" + + "(declare-const b (_ BitVec 5))\n" + + "(assert (= a (bvshl (bvand (bvsub (bvadd a b) (bvsdiv #b10110 #b00000)) (bvsrem a " + + "#b10110)) b)))\n"; + assertThat( + expectedResultOthers.equals(actualResult) + || expectedResultMathsat5.equals(actualResult)) + .isTrue(); + } +} diff --git a/src/org/sosy_lab/java_smt/test/BitvectorFormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/BitvectorFormulaManagerTest.java index 8ab062564e..4c6bad7165 100644 --- a/src/org/sosy_lab/java_smt/test/BitvectorFormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/BitvectorFormulaManagerTest.java @@ -22,8 +22,6 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.ArrayFormula; import org.sosy_lab.java_smt.api.BitvectorFormula; @@ -40,7 +38,6 @@ * Tests bitvectors for all solvers that support it. Notice: Boolector does not support integer * theory or bitvectors length 1. */ -@RunWith(Parameterized.class) public class BitvectorFormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { private static final BitvectorType bvType4 = FormulaType.getBitvectorTypeWithSize(4); @@ -50,6 +47,11 @@ public void init() { requireBitvectors(); } + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } + @Test public void bvType() { int[] testValues; diff --git a/src/org/sosy_lab/java_smt/test/BooleanFormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/BooleanFormulaManagerTest.java index 2af4869e12..affd3fe620 100644 --- a/src/org/sosy_lab/java_smt/test/BooleanFormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/BooleanFormulaManagerTest.java @@ -15,6 +15,7 @@ import com.google.common.collect.ImmutableSet; import java.util.List; import org.junit.AssumptionViolatedException; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.BooleanFormula; @@ -26,6 +27,11 @@ */ public class BooleanFormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } + @Test public void testConstBoolean() { assertThat(bmgr.isTrue(bmgr.makeBoolean(true))).isTrue(); diff --git a/src/org/sosy_lab/java_smt/test/BooleanFormulaSubjectTest.java b/src/org/sosy_lab/java_smt/test/BooleanFormulaSubjectTest.java index 93a067acdc..ded1c32d68 100644 --- a/src/org/sosy_lab/java_smt/test/BooleanFormulaSubjectTest.java +++ b/src/org/sosy_lab/java_smt/test/BooleanFormulaSubjectTest.java @@ -9,6 +9,7 @@ package org.sosy_lab.java_smt.test; import static com.google.common.truth.ExpectFailure.assertThat; +import static com.google.common.truth.TruthJUnit.assume; import static org.sosy_lab.java_smt.test.BooleanFormulaSubject.booleanFormulasOf; import com.google.common.base.Throwables; @@ -17,6 +18,7 @@ import com.google.common.truth.SimpleSubjectBuilder; import org.junit.Before; import org.junit.Test; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.BooleanFormula; import org.sosy_lab.java_smt.api.SolverException; @@ -30,6 +32,11 @@ public class BooleanFormulaSubjectTest extends SolverBasedTest0.ParameterizedSol private BooleanFormula contradiction; private BooleanFormula tautology; + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } + @Before public void setupFormulas() { if (imgr != null) { diff --git a/src/org/sosy_lab/java_smt/test/BooleanSMTLIB2GeneratorTest.java b/src/org/sosy_lab/java_smt/test/BooleanSMTLIB2GeneratorTest.java new file mode 100644 index 0000000000..1e1e8c8524 --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/BooleanSMTLIB2GeneratorTest.java @@ -0,0 +1,203 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; + +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.basicimpl.Generator; + +@SuppressWarnings("checkstyle:linelength") +public class BooleanSMTLIB2GeneratorTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Test + public void testMakeVariable() { + BooleanFormula a = bmgr.makeVariable("a"); + Generator.assembleConstraint(a); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(declare-const a Bool)\n" + "(assert a)\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeTrue() { + BooleanFormula a = bmgr.makeTrue(); + Generator.assembleConstraint(a); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(assert true)\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeFalse() { + BooleanFormula a = bmgr.makeFalse(); + Generator.assembleConstraint(a); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(assert false)\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testNot() { + BooleanFormula a = bmgr.not(bmgr.makeVariable("a")); + Generator.assembleConstraint(a); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(declare-const a Bool)\n" + "(assert (not a))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testBinaryOr() { + BooleanFormula result = bmgr.or(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (or a b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testCollectionOr() { + BooleanFormula result = + bmgr.or(bmgr.makeVariable("a"), bmgr.makeVariable("b"), bmgr.makeVariable("c")); + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const c Bool)\n" + + "(assert (or a b c))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testBinaryAnd() { + BooleanFormula result = bmgr.and(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (and a b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testCollectionAnd() { + BooleanFormula result = + bmgr.and(bmgr.makeVariable("a"), bmgr.makeVariable("b"), bmgr.makeVariable("c")); + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const c Bool)\n" + + "(assert (and a b c))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testXor() { + BooleanFormula result = bmgr.xor(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (xor a b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testEquivalence() { + BooleanFormula result = bmgr.equivalence(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (= a b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testImplication() { + BooleanFormula result = bmgr.implication(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (=> a b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIfThenElse() { + BooleanFormula result = + bmgr.ifThenElse(bmgr.makeVariable("a"), bmgr.makeVariable("b"), bmgr.makeVariable("c")); + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const c Bool)\n" + + "(assert (ite a b c))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @SuppressWarnings("CheckReturnValue") + @Test + public void testNestedTerms() { + BooleanFormula term1 = bmgr.and(bmgr.makeBoolean(true), bmgr.makeVariable("a")); + BooleanFormula term2 = bmgr.and(term1, bmgr.makeVariable("e"), bmgr.makeTrue()); + BooleanFormula term3 = bmgr.or(bmgr.makeVariable("b"), bmgr.makeFalse()); + BooleanFormula term4 = bmgr.or(term3, term2, term1, bmgr.makeVariable("f")); + BooleanFormula term5 = bmgr.implication(term2, term1); + BooleanFormula term6 = bmgr.xor(bmgr.makeVariable("c"), bmgr.makeVariable("d")); + BooleanFormula term7 = bmgr.equivalence(term3, term4); + + BooleanFormula result = bmgr.ifThenElse(term5, term6, term7); + + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Bool)\n" + + "(declare-const e Bool)\n" + + "(declare-const c Bool)\n" + + "(declare-const d Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const f Bool)\n" + + "(assert (ite (=> (and a e true) a) (xor c d) (= b (or b (and a e true) a f))))\n"; + // Solverless does not support simplification yet. However, the expression is equivalent. + String expectedResultSolverless = + "(declare-const a Bool)\n" + + "(declare-const e Bool)\n" + + "(declare-const c Bool)\n" + + "(declare-const d Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const f Bool)\n" + + "(assert (ite (=> (and (and true a) e true) (and true a)) (xor c d) (= (or b false)" + + " (or (or b false) (and (and true a) e true) (and true a) f))))\n"; + assertThat( + actualResult.equals(expectedResult) || actualResult.equals(expectedResultSolverless)); + } +} diff --git a/src/org/sosy_lab/java_smt/test/DebugModeTest.java b/src/org/sosy_lab/java_smt/test/DebugModeTest.java index 0f88c9cab3..c8a45bd20d 100644 --- a/src/org/sosy_lab/java_smt/test/DebugModeTest.java +++ b/src/org/sosy_lab/java_smt/test/DebugModeTest.java @@ -40,7 +40,6 @@ public class DebugModeTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { private SolverContextFactory debugFactory; - private SolverContext debugContext; private UFManager debugFmgr; private BooleanFormulaManager debugBmgr; @@ -50,6 +49,7 @@ public class DebugModeTest extends SolverBasedTest0.ParameterizedSolverBasedTest @Before public void init() throws InvalidConfigurationException { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); Configuration debugConfig = Configuration.builder() .setOption("solver.solver", solverToUse().toString()) diff --git a/src/org/sosy_lab/java_smt/test/EnumerationFormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/EnumerationFormulaManagerTest.java index 0413e9adb3..86acecbdd1 100644 --- a/src/org/sosy_lab/java_smt/test/EnumerationFormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/EnumerationFormulaManagerTest.java @@ -9,6 +9,7 @@ package org.sosy_lab.java_smt.test; import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; import static junit.framework.TestCase.assertEquals; import static org.junit.Assert.assertThrows; @@ -31,6 +32,10 @@ import org.sosy_lab.java_smt.api.visitors.TraversalProcess; public class EnumerationFormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Before public void init() { diff --git a/src/org/sosy_lab/java_smt/test/ExceptionHandlerTest.java b/src/org/sosy_lab/java_smt/test/ExceptionHandlerTest.java index 114b31a579..c2d9a6ffb4 100644 --- a/src/org/sosy_lab/java_smt/test/ExceptionHandlerTest.java +++ b/src/org/sosy_lab/java_smt/test/ExceptionHandlerTest.java @@ -8,10 +8,18 @@ package org.sosy_lab.java_smt.test; +import static com.google.common.truth.TruthJUnit.assume; + +import org.junit.Before; import org.junit.Test; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; /** Test that exception handling is set up properly. */ public class ExceptionHandlerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void setup() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Test(expected = Exception.class) @SuppressWarnings("CheckReturnValue") diff --git a/src/org/sosy_lab/java_smt/test/FloatingPointFormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/FloatingPointFormulaManagerTest.java index 50d629a905..f8ea237653 100644 --- a/src/org/sosy_lab/java_smt/test/FloatingPointFormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/FloatingPointFormulaManagerTest.java @@ -42,6 +42,10 @@ public class FloatingPointFormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } // numbers are small enough to be precise with single precision private static final int[] SINGLE_PREC_INTS = new int[] {0, 1, 2, 5, 10, 20, 50, 100, 200, 500}; diff --git a/src/org/sosy_lab/java_smt/test/FloatingPointSMTLIB2GeneratorTest.java b/src/org/sosy_lab/java_smt/test/FloatingPointSMTLIB2GeneratorTest.java new file mode 100644 index 0000000000..e1cb23c86b --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/FloatingPointSMTLIB2GeneratorTest.java @@ -0,0 +1,629 @@ +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Objects; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.common.rationals.Rational; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FloatingPointFormula; +import org.sosy_lab.java_smt.api.FloatingPointRoundingMode; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType; +import org.sosy_lab.java_smt.basicimpl.Generator; + +@SuppressWarnings({"all"}) +public class FloatingPointSMTLIB2GeneratorTest + extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Test + public void testMakeVariable() { + requireFloats(); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeFloatingPoint() { + requireFloats(); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FormulaType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula c = + fpmgr.makeVariable("c", FormulaType.getSinglePrecisionFloatingPointType()); + BooleanFormula assign1 = + fpmgr.equalWithFPSemantics( + a, + fpmgr.makeNumber( + 10.0, + FloatingPointType.getSinglePrecisionFloatingPointType(), + FloatingPointRoundingMode.TOWARD_ZERO)); + BooleanFormula assign2 = + fpmgr.equalWithFPSemantics( + b, fpmgr.makeNumber(15.0, FormulaType.getSinglePrecisionFloatingPointType())); + BooleanFormula assign3 = + fpmgr.equalWithFPSemantics( + c, fpmgr.makeNumber(25.0, FormulaType.getSinglePrecisionFloatingPointType())); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(fpmgr.add(a, b), c); + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a (fp #b0 #b10000010 #b01000000000000000000000)))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq b (fp #b0 #b10000010 #b11100000000000000000000)))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq c (fp #b0 #b10000011 #b10010000000000000000000)))\n" + + "(assert (fp.eq (fp.add a b) c))\n"; + Generator.assembleConstraint(assign1); + Generator.assembleConstraint(assign2); + Generator.assembleConstraint(assign3); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPAdd() { + requireFloats(); + Objects.requireNonNull(fpmgr); + FloatingPointFormula result = + fpmgr.makeVariable("result", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(fpmgr.add(a, b), result); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const result (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp.add a b) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPSub() { + requireFloats(); + Objects.requireNonNull(fpmgr); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula result = + fpmgr.makeVariable("result", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(fpmgr.subtract(a, b), result); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const result (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp.sub a b) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPDiv() { + requireFloats(); + Objects.requireNonNull(fpmgr); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula result = + fpmgr.makeVariable("result", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(fpmgr.divide(a, b), result); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const result (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp.div a b) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPMul() { + requireFloats(); + Objects.requireNonNull(fpmgr); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula result = + fpmgr.makeVariable("result", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(fpmgr.multiply(a, b), result); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const result (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp.mul a b) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPSqrt() { + requireFloats(); + Objects.requireNonNull(fpmgr); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula result = + fpmgr.makeVariable("result", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(fpmgr.sqrt(a), result); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const result (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp.sqrt a) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPIsNaN() { + requireFloats(); + Objects.requireNonNull(fpmgr); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula isNaN = fpmgr.isNaN(a); + + Generator.assembleConstraint(isNaN); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + "(assert (fp.isNaN a))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPIsZero() { + requireFloats(); + Objects.requireNonNull(fpmgr); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula isZero = fpmgr.isZero(a); + + Generator.assembleConstraint(isZero); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + "(assert (fp.isZero a))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPMax() { + requireFloats(); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula max = + fpmgr.makeVariable("max", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(fpmgr.max(a, b), max); + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const max (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp.max a b) max))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFPMin() { + requireFloats(); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula min = + fpmgr.makeVariable("min", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(fpmgr.min(a, b), min); + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const min (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp.min a b) min))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakePlusInfinity() { + requireFloats(); + FloatingPointFormula plusInfinity = + fpmgr.makeVariable("plusInfinity", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = + fpmgr.equalWithFPSemantics( + plusInfinity, + fpmgr.makePlusInfinity(FloatingPointType.getSinglePrecisionFloatingPointType())); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const plusInfinity (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq plusInfinity (_ +oo 8 24)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeMinusInfinity() { + requireFloats(); + FloatingPointFormula minusInfinity = + fpmgr.makeVariable( + "minusInfinity", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = + fpmgr.equalWithFPSemantics( + minusInfinity, + fpmgr.makeMinusInfinity(FloatingPointType.getSinglePrecisionFloatingPointType())); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const minusInfinity (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq minusInfinity (_ -oo 8 24)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNaN() { + requireFloats(); + FloatingPointFormula nan = + fpmgr.makeVariable("nan", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = + fpmgr.equalWithFPSemantics( + nan, fpmgr.makeNaN(FloatingPointType.getSinglePrecisionFloatingPointType())); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const nan (_ FloatingPoint 8 24))\n" + "(assert (fp.eq nan (_ NaN 8 24)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testCastTo() { + requireFloats(); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + BitvectorFormula castResult = bvmgr.makeVariable(32, "castResult"); + BooleanFormula constraint = + bvmgr.equal(fpmgr.castTo(a, true, FormulaType.getBitvectorTypeWithSize(32)), castResult); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const castResult (_ BitVec 32))\n" + + "(assert (= ((_ fp.to_sbv 32) a) castResult))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testCastFrom() { + assume() + .withMessage("Bitwuzla and Mathsat5 do not support boolean casting") + .that(!solverToUse().equals(Solvers.BITWUZLA) && !solverToUse().equals(Solvers.MATHSAT5)) + .isTrue(); + requireFloats(); + BooleanFormula b = bmgr.makeVariable("b"); + FloatingPointFormula castResult = + fpmgr.makeVariable("result", FloatingPointType.getSinglePrecisionFloatingPointType()); + + Generator.assembleConstraint( + fpmgr.equalWithFPSemantics( + castResult, + fpmgr.castFrom(b, true, FloatingPointType.getSinglePrecisionFloatingPointType()))); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const result (_ FloatingPoint 8 24))\n" + + "(declare-const b Bool)\n" + + "(assert (fp.eq result ((_ to_fp 8 24) b)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFromIeeeBitvector() { + requireFloats(); + requireBitvectors(); + String bvs = "00000000000000000000000000000000"; + BitvectorFormula bv = bvmgr.makeBitvector(32, new BigInteger(bvs, 2)); + FloatingPointFormula result = + fpmgr.makeVariable("result", FloatingPointType.getSinglePrecisionFloatingPointType()); + + Generator.assembleConstraint( + fpmgr.equalWithFPSemantics( + fpmgr.fromIeeeBitvector(bv, FloatingPointType.getSinglePrecisionFloatingPointType()), + result)); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const result (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq ((_ to_fp 8 24) #b00000000000000000000000000000000) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFromIeeeBitvectorWithVariable() { + requireFloats(); + requireBitvectors(); + BitvectorFormula bv = bvmgr.makeVariable(32, "bv"); + FloatingPointFormula result = + fpmgr.makeVariable("result", FloatingPointType.getSinglePrecisionFloatingPointType()); + + Generator.assembleConstraint( + fpmgr.equalWithFPSemantics( + fpmgr.fromIeeeBitvector(bv, FloatingPointType.getSinglePrecisionFloatingPointType()), + result)); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const bv (_ BitVec 32))\n" + + "(declare-const result (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq ((_ to_fp 8 24) bv) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRound() { + requireFloats(); + FloatingPointFormula a = + fpmgr.makeVariable("a", FloatingPointType.getSinglePrecisionFloatingPointType()); + + Generator.assembleConstraint( + fpmgr.equalWithFPSemantics( + a, fpmgr.round(a, FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN))); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a (fp.roundToIntegral RNE " + + "a)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberFromRational() { + requireFloats(); + FloatingPointFormula num = + fpmgr.makeNumber( + Rational.ofString("3/2"), FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula var = + fpmgr.makeVariable("x", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(num, var); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = + "(declare-const x (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp #b0 #b01111111 #b10000000000000000000000) x))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberFromRationalWithRoundingMode() { + requireFloats(); + assume() + .withMessage("Bitwuzla does not allow rational FloatingPoints") + .that(solverToUse()) + .isNotEqualTo(Solvers.BITWUZLA); + FloatingPointFormula num = + fpmgr.makeNumber( + Rational.ofString("1/3"), + FloatingPointType.getSinglePrecisionFloatingPointType(), + FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN); + FloatingPointFormula var = + fpmgr.makeVariable("x", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(num, var); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + assertThat(actualResult) + .isEqualTo( + "(declare-const x (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp #b0 #b01111101 #b01010101010101010101011) x))\n"); + } + + @Test + public void testMakeNumberFromBigDecimal() { + requireFloats(); + FloatingPointFormula num = + fpmgr.makeNumber( + new BigDecimal("3.1415926535"), + FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula var = + fpmgr.makeVariable("x", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(num, var); + + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + // Exact value depends on rounding, but we can check the structure + assertThat(actualResult).contains("(declare-const x (_ FloatingPoint 8 24))"); + assertThat(actualResult).contains("(assert (fp.eq "); + assertThat(actualResult).contains("x))"); + assertThat(actualResult) + .isEqualTo( + "(declare-const x (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp #b0 #b10000000 #b10010010000111111011011) x))\n"); + } + + @Test + public void testMakeNumberFromBigDecimalWithRoundingMode() { + requireFloats(); + FloatingPointFormula num = + fpmgr.makeNumber( + new BigDecimal("2.7182818284"), + FloatingPointType.getSinglePrecisionFloatingPointType(), + FloatingPointRoundingMode.TOWARD_NEGATIVE); + FloatingPointFormula var = + fpmgr.makeVariable("x", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(num, var); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + assertThat(actualResult) + .isEqualTo( + "(declare-const x (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp #b0 #b10000000 #b01011011111100001010100) x))\n"); + } + + @Test + public void testMakeNumberFromString() { + requireFloats(); + FloatingPointFormula num = + fpmgr.makeNumber("1.5", FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula var = + fpmgr.makeVariable("x", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(num, var); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = + "(declare-const x (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp #b0 #b01111111 #b10000000000000000000000) x))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberFromStringWithRoundingMode() { + requireFloats(); + FloatingPointFormula num = + fpmgr.makeNumber( + "0.1", + FloatingPointType.getSinglePrecisionFloatingPointType(), + FloatingPointRoundingMode.TOWARD_ZERO); + FloatingPointFormula var = + fpmgr.makeVariable("x", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(num, var); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + // Exact value depends on rounding, but we can check the structure + assertThat(actualResult).contains("(declare-const x (_ FloatingPoint 8 24))"); + assertThat(actualResult).contains("(assert (fp.eq "); + assertThat(actualResult).contains("x))"); + assertThat(actualResult) + .isEqualTo( + "(declare-const x (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp #b0 #b01111011 #b10011001100110011001101) x))\n"); + } + + @Test + public void testMakeNumberFromComponents() { + requireFloats(); + FloatingPointFormula num = + fpmgr.makeNumber( + BigInteger.valueOf(127), // exponent + BigInteger.valueOf(1), // mantissa + false, // sign bit (false = positive) + FloatingPointType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula var = + fpmgr.makeVariable("x", FloatingPointType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(num, var); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + assertThat(actualResult) + .isEqualTo( + "(declare-const x (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq (fp #b0 #x127 #x1) x))\n"); + } +} diff --git a/src/org/sosy_lab/java_smt/test/FormulaClassifierTest.java b/src/org/sosy_lab/java_smt/test/FormulaClassifierTest.java index 68e0198be0..b2966d57c4 100644 --- a/src/org/sosy_lab/java_smt/test/FormulaClassifierTest.java +++ b/src/org/sosy_lab/java_smt/test/FormulaClassifierTest.java @@ -45,6 +45,11 @@ public void init() { classifier = new FormulaClassifier(context); } + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } + private void requireNonlinear() { // INFO: OpenSMT does not allow nonlinear formulas, even when the solver is not called assume() diff --git a/src/org/sosy_lab/java_smt/test/FormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/FormulaManagerTest.java index 8c91fa5268..10eb29515d 100644 --- a/src/org/sosy_lab/java_smt/test/FormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/FormulaManagerTest.java @@ -19,6 +19,7 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.Map; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.ArrayFormula; @@ -30,6 +31,10 @@ import org.sosy_lab.java_smt.api.SolverException; public class FormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Test public void testEmptySubstitution() throws SolverException, InterruptedException { diff --git a/src/org/sosy_lab/java_smt/test/InterpolatingProverTest.java b/src/org/sosy_lab/java_smt/test/InterpolatingProverTest.java index 8b4b26b1e5..91d8ee16f9 100644 --- a/src/org/sosy_lab/java_smt/test/InterpolatingProverTest.java +++ b/src/org/sosy_lab/java_smt/test/InterpolatingProverTest.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.common.UniqueIdGenerator; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; @@ -36,6 +37,10 @@ /** This class contains some simple Junit-tests to check the interpolation-API of our solvers. */ @SuppressWarnings({"resource", "LocalVariableName"}) public class InterpolatingProverTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } // INFO: OpenSmt only support interpolation for QF_LIA, QF_LRA and QF_UF @Override diff --git a/src/org/sosy_lab/java_smt/test/InterpolatingProverWithAssumptionsWrapperTest.java b/src/org/sosy_lab/java_smt/test/InterpolatingProverWithAssumptionsWrapperTest.java index 1a6dcca2f7..b3fee3af76 100644 --- a/src/org/sosy_lab/java_smt/test/InterpolatingProverWithAssumptionsWrapperTest.java +++ b/src/org/sosy_lab/java_smt/test/InterpolatingProverWithAssumptionsWrapperTest.java @@ -14,7 +14,6 @@ public class InterpolatingProverWithAssumptionsWrapperTest extends SolverFormulaWithAssumptionsTest { - // INFO: OpenSmt only support interpolation for QF_LIA, QF_LRA and QF_UF @Override protected Logics logicToUse() { diff --git a/src/org/sosy_lab/java_smt/test/ModelEvaluationTest.java b/src/org/sosy_lab/java_smt/test/ModelEvaluationTest.java index ec82b870b7..f79cc33aaf 100644 --- a/src/org/sosy_lab/java_smt/test/ModelEvaluationTest.java +++ b/src/org/sosy_lab/java_smt/test/ModelEvaluationTest.java @@ -8,6 +8,7 @@ package org.sosy_lab.java_smt.test; +import static com.google.common.truth.TruthJUnit.assume; import static org.sosy_lab.java_smt.test.ProverEnvironmentSubject.assertThat; import com.google.common.collect.Lists; @@ -15,6 +16,7 @@ import java.util.ArrayList; import java.util.List; import org.checkerframework.checker.nullness.qual.NonNull; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.common.configuration.ConfigurationBuilder; import org.sosy_lab.common.rationals.Rational; @@ -28,6 +30,10 @@ /** Test that we can request evaluations from models. */ public class ModelEvaluationTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } /** * This is the default boolean value for unknown model evaluations. For unknown model evaluation diff --git a/src/org/sosy_lab/java_smt/test/ModelTest.java b/src/org/sosy_lab/java_smt/test/ModelTest.java index 3fa91e29bc..e4a1b92a23 100644 --- a/src/org/sosy_lab/java_smt/test/ModelTest.java +++ b/src/org/sosy_lab/java_smt/test/ModelTest.java @@ -51,6 +51,10 @@ /** Test that values from models are appropriately parsed. */ public class ModelTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } // A list of variables to test that model variable names are correctly applied private static final ImmutableList VARIABLE_NAMES = diff --git a/src/org/sosy_lab/java_smt/test/NonLinearArithmeticTest.java b/src/org/sosy_lab/java_smt/test/NonLinearArithmeticTest.java index 786ae61578..f43822c8fc 100644 --- a/src/org/sosy_lab/java_smt/test/NonLinearArithmeticTest.java +++ b/src/org/sosy_lab/java_smt/test/NonLinearArithmeticTest.java @@ -35,6 +35,10 @@ @RunWith(Parameterized.class) public class NonLinearArithmeticTest extends SolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } // Boolector, CVC4, SMTInterpol, MathSAT5 and OpenSMT do not fully support non-linear arithmetic // (though SMTInterpol and MathSAT5 support some parts) diff --git a/src/org/sosy_lab/java_smt/test/NonLinearArithmeticWithModuloTest.java b/src/org/sosy_lab/java_smt/test/NonLinearArithmeticWithModuloTest.java index 16b811f764..be52491e2f 100644 --- a/src/org/sosy_lab/java_smt/test/NonLinearArithmeticWithModuloTest.java +++ b/src/org/sosy_lab/java_smt/test/NonLinearArithmeticWithModuloTest.java @@ -9,6 +9,7 @@ package org.sosy_lab.java_smt.test; import static com.google.common.collect.ImmutableList.toImmutableList; +import static com.google.common.truth.TruthJUnit.assume; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; @@ -16,6 +17,7 @@ import java.util.List; import java.util.function.Supplier; import org.junit.AssumptionViolatedException; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -30,6 +32,10 @@ @RunWith(Parameterized.class) public class NonLinearArithmeticWithModuloTest extends SolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Parameters(name = "{0} {1}") public static Iterable getAllSolversAndTheories() { diff --git a/src/org/sosy_lab/java_smt/test/NumeralFormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/NumeralFormulaManagerTest.java index 4461a7495a..572d657367 100644 --- a/src/org/sosy_lab/java_smt/test/NumeralFormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/NumeralFormulaManagerTest.java @@ -9,12 +9,15 @@ package org.sosy_lab.java_smt.test; import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; import static org.junit.Assert.assertThrows; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; +import org.junit.Before; import org.junit.Test; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.BooleanFormula; import org.sosy_lab.java_smt.api.Formula; import org.sosy_lab.java_smt.api.FormulaType; @@ -25,6 +28,10 @@ import org.sosy_lab.java_smt.api.visitors.DefaultFormulaVisitor; public class NumeralFormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Test public void distinctTest() throws SolverException, InterruptedException { diff --git a/src/org/sosy_lab/java_smt/test/NumeralSMTLIB2GeneratorTest.java b/src/org/sosy_lab/java_smt/test/NumeralSMTLIB2GeneratorTest.java new file mode 100644 index 0000000000..5eba52d19a --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/NumeralSMTLIB2GeneratorTest.java @@ -0,0 +1,784 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.NumeralFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.RationalFormula; +import org.sosy_lab.java_smt.basicimpl.Generator; + +public class NumeralSMTLIB2GeneratorTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Test + public void testMakeVariableInteger() { + requireIntegers(); + IntegerFormula a = imgr.makeVariable("a"); + IntegerFormula b = imgr.makeVariable("b"); + BooleanFormula constraint = imgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Int)\n" + "(declare-const b Int)\n" + "(assert (= a b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberInteger() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(10); + IntegerFormula b = imgr.makeVariable("b"); + BooleanFormula constraint = imgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = "(declare-const b Int)\n" + "(assert (= 10 b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberIntegerWithBigInteger() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(new BigInteger("10")); + IntegerFormula b = imgr.makeVariable("b"); + BooleanFormula constraint = imgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = "(declare-const b Int)\n" + "(assert (= 10 b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberRationalWithPoint() { + requireRationals(); + RationalFormula a = rmgr.makeNumber(10.0); + RationalFormula b = rmgr.makeVariable("b"); + BooleanFormula constraint = rmgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = "(declare-const b Real)\n" + "(assert (= 10.0 b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberRationalWithBigInteger() { + requireRationals(); + RationalFormula a = rmgr.makeNumber(new BigInteger("10")); + RationalFormula b = rmgr.makeVariable("b"); + BooleanFormula constraint = rmgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = "(declare-const b Real)\n" + "(assert (= 10 b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberRationalWithBigDecimal() { + requireRationals(); + assert rmgr != null; + RationalFormula a = rmgr.makeNumber(new BigDecimal("10.3")); + RationalFormula b = rmgr.makeVariable("b"); + BooleanFormula constraint = rmgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = "(declare-const b Real)\n" + "(assert (= 10.3 b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeNumberRationalWithString() { + requireRationals(); + RationalFormula a = rmgr.makeNumber("10"); + RationalFormula b = rmgr.makeVariable("b"); + BooleanFormula constraint = rmgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = "(declare-const b Real)\n" + "(assert (= 10 b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalSimpleAdd() { + requireRationals(); + RationalFormula a = rmgr.makeVariable("a"); + RationalFormula b = rmgr.makeVariable("b"); + RationalFormula c = rmgr.makeVariable("c"); + BooleanFormula constraint = rmgr.equal(a, rmgr.add(b, c)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = + "(declare-const a Real)\n" + + "(declare-const b Real)\n" + + "(declare-const c Real)\n" + + "(assert (= a (+ b c)))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalSimpleAddWithValues() { + requireRationals(); + RationalFormula a = rmgr.makeNumber(10); + RationalFormula c = rmgr.makeNumber(20.0); + BooleanFormula constraint = rmgr.equal(a, c); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = "(assert (= 10 20.0))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeVariableRational() { + requireRationals(); + NumeralFormula a = Objects.requireNonNull(rmgr).makeVariable("a"); + NumeralFormula b = rmgr.makeVariable("b"); + BooleanFormula constraint = rmgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a Real)\n" + "(declare-const b Real)\n" + "(assert (= a b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerMakeNumberEqualsAndAdd() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(a, imgr.add(b, imgr.add(c, e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(assert (= 1 (+ (- 5) (+ 3 2147483647))))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalsMakeNumberEqualsAndAdd() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = rmgr.equal(a, rmgr.add(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (= -1 (+ 17/5 2147483647/1000)))\n"; + String expectedResultSMTInterpol = "(assert (= (- 1.0) (+ 3.4 2147483.647)))\n"; + String expectedResultCVC4 = "(assert (= (- 1) (+ (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultCVC5 = "(assert (= (- 1.0) (+ (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultZ3 = "(assert (= (- 1.0) (+ (/ 17.0 5.0) (/ 2147483647.0 1000.0))))\n"; + String expectedSolverless = "(assert (= -1 (+ 3.4 2147483.647)))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedSolverless)) + .isTrue(); + } + + @Test + public void testIntegerSubtract() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(a, imgr.subtract(b, imgr.subtract(c, e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(assert (= 1 (- (- 5) (- 3 2147483647))))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalSubtract() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = rmgr.equal(a, rmgr.subtract(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (= -1 (- 17/5 2147483647/1000)))\n"; + String expectedResultSMTInterpol = "(assert (= (- 1.0) (- 3.4 2147483.647)))\n"; + String expectedResultCVC4 = "(assert (= (- 1) (- (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultCVC5 = "(assert (= (- 1.0) (- (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultZ3 = "(assert (= (- 1.0) (- (/ 17.0 5.0) (/ 2147483647.0 1000.0))))\n"; + String expectedSolverless = "(assert (= -1 (- 3.4 2147483.647)))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedSolverless)) + .isTrue(); + } + + @Test + public void testIntegerNegate() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + BooleanFormula constraint = + imgr.equal( + imgr.subtract(imgr.negate(b), imgr.negate(a)), + imgr.subtract(imgr.negate(c), imgr.negate(e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(assert (= (- (- (- 5)) (- 1)) (- (- 3) (- 2147483647))))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalNegate() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = + rmgr.equal(rmgr.negate(a), rmgr.subtract(rmgr.negate(c), rmgr.negate(e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (= (- -1) (- (- 17/5) (- 2147483647/1000))))\n"; + String expectedResultSMTInterpol = "(assert (= (- (- 1.0)) (- (- 3.4) (- 2147483.647))))\n"; + String expectedResultCVC4 = "(assert (= (- (- 1)) (- (- (/ 17 5)) (- (/ 2147483647 1000)))))\n"; + String expectedResultCVC5 = + "(assert (= (- (- 1.0)) (- (- (/ 17 5)) (- (/ 2147483647 1000)))))\n"; + String expectedResultZ3 = + "(assert (= (- (- 1.0)) (- (- (/ 17.0 5.0)) (- (/ 2147483647.0 1000.0)))))\n"; + String expectedSolverless = "(assert (= (- -1) (- (- 3.4) (- 2147483.647))))\n"; + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedSolverless)) + .isTrue(); + } + + @Test + public void testIntegerSum() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + List d = new ArrayList<>(); + d.add(a); + d.add(b); + d.add(c); + d.add(e); + + BooleanFormula constraint = imgr.equal(e, imgr.sum(d)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (= 2147483647 (+ 1 -5 3 2147483647)))\n"; + String expectedResultOthers = "(assert (= 2147483647 (+ 1 (- 5) 3 2147483647)))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultOthers)) + .isTrue(); + } + + @Test + public void testRationalSum() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + List d = new ArrayList<>(); + d.add(a); + d.add(c); + d.add(e); + + BooleanFormula constraint = rmgr.equal(a, rmgr.sum(d)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (= -1 (+ -1 17/5 2147483647/1000)))\n"; + String expectedResultSMTInterpol = "(assert (= -1 (+ (- 1.0) 3.4 2147483.647)))\n"; + String expectedResultCVC4 = "(assert (= -1 (+ (- 1) (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultCVC5 = "(assert (= -1 (+ (- 1.0) (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultZ3 = "(assert (= -1 (+ (- 1.0) (/ 17.0 5.0) (/ 2147483647.0 1000.0))))\n"; + String expectedResultSolverless = "(assert (= -1 (+ -1 3.4 2147483.647)))\n"; + System.out.println(actualResult); + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedResultSolverless)) + .isTrue(); + } + + @Test + public void testIntegerDivide() { + requireIntegers(); + // OpenSMT does not allow division by zero + assume().that(solverToUse()).isNotEqualTo(Solvers.OPENSMT); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + BooleanFormula constraint = imgr.equal(a, imgr.divide(b, imgr.divide(c, e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(assert (= 1 (div (- 5) (div 3 2147483647))))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalDivide() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = rmgr.equal(a, rmgr.divide(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (= -1 (div 17/5 2147483647/1000)))\n"; + String expectedResultSMTInterpol = "(assert (= (- 1.0) (div 3.4 2147483.647)))\n"; + String expectedResultCVC4 = "(assert (= (- 1) (div (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultCVC5 = "(assert (= (- 1.0) (div (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultZ3 = "(assert (= (- 1.0) (div (/ 17.0 5.0) (/ 2147483647.0 1000.0))))\n"; + String expectedSolverless = "(assert (= -1 (div 3.4 2147483.647)))\n"; + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedSolverless)) + .isTrue(); + } + + /** not available for Mathsat. */ + @Test + public void testIntegerModulo() { + requireIntegers(); + assume() + .withMessage("Solver %s does not support modulo. ", solverToUse()) + .that(solverToUse()) + .isNotEqualTo(Solvers.MATHSAT5); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(a, imgr.modulo(b, imgr.modulo(c, e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultOthers = "(assert (= 1 (mod (- 5) (mod 3 2147483647))))\n"; + String expectedResultYices = "(assert (= 1 1))\n"; + assertThat( + actualResult.equals(expectedResultOthers) || actualResult.equals(expectedResultYices)) + .isTrue(); + } + + @Test + public void testIntegerMultiply() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(a, imgr.multiply(b, imgr.multiply(c, e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(assert (= 1 (* (- 5) (* 3 2147483647))))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalMultiply() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = rmgr.equal(a, rmgr.multiply(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (= -1 (* 17/5 2147483647/1000)))\n"; + String expectedResultSMTInterpol = "(assert (= (- 1.0) (* 3.4 2147483.647)))\n"; + String expectedResultCVC4 = "(assert (= (- 1) (* (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultCVC5 = "(assert (= (- 1.0) (* (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultZ3 = "(assert (= (- 1.0) (* (/ 17.0 5.0) (/ 2147483647.0 1000.0))))\n"; + String expectedSolverless = "(assert (= -1 (* 3.4 2147483.647)))\n"; + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedSolverless)) + .isTrue(); + } + + @Test + public void testIntegerDistinct() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + List d = new ArrayList<>(); + d.add(a); + d.add(b); + d.add(c); + d.add(e); + + BooleanFormula constraint = imgr.distinct(d); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (distinct 1 -5 3 2147483647))\n"; + String expectedResultOthers = "(assert (distinct 1 (- 5) 3 2147483647))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultOthers)) + .isTrue(); + } + + @Test + public void testRationalDistinct() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + List d = new ArrayList<>(); + d.add(a); + d.add(c); + d.add(e); + + BooleanFormula constraint = rmgr.distinct(d); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (distinct -1 17/5 2147483647/1000))\n"; + String expectedResultSMTInterpol = "(assert (distinct (- 1.0) 3.4 2147483.647))\n"; + String expectedResultCVC4 = "(assert (distinct (- 1) (/ 17 5) (/ 2147483647 1000)))\n"; + String expectedResultCVC5 = "(assert (distinct (- 1.0) (/ 17 5) (/ 2147483647 1000)))\n"; + String expectedResultZ3 = "(assert (distinct (- 1.0) (/ 17.0 5.0) (/ 2147483647.0 1000.0)))\n"; + String expectedResultSolverless = "(assert (distinct -1 3.4 2147483.647))\n"; + System.out.println(actualResult); + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedResultSolverless)) + .isTrue(); + } + + @Test + public void testIntegerGreaterThan() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = bmgr.and(imgr.greaterThan(a, b), imgr.greaterThan(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (> 3 2147483647))\n"; + String expectedResultOthers = "(assert (and (> 1 (- 5)) (> 3 2147483647)))\n"; + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultOthers)) + .isTrue(); + } + + @Test + public void testRationalGreaterThan() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + + BooleanFormula constraint = bmgr.and(rmgr.greaterThan(a, c), rmgr.greaterThan(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (> -1 3.4))\n"; + String expectedResultSMTInterpol = "(assert (and (> (- 1.0) 3.4) (> 3.4 2147483.647)))\n"; + String expectedResultCVC4 = + "(assert (and (> (- 1) (/ 17 5)) (> (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultCVC5 = + "(assert (and (> (- 1.0) (/ 17 5)) (> (/ 17 5) (/ 2147483647 1000))))\n"; + String expectedResultZ3 = + "(assert (and (> (- 1.0) (/ 17.0 5.0)) (> (/ 17.0 5.0) (/ " + "2147483647.0 1000.0))))\n"; + String expectedSolverless = "(assert (and (> -1 3.4) (> 3.4 2147483.647)))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedSolverless)) + .isTrue(); + } + + @Test + public void testIntegerGreaterOrEquals() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = bmgr.and(imgr.greaterOrEquals(a, b), imgr.greaterOrEquals(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + System.out.println(actualResult); + String expectedResultMathsat5 = "(assert (>= 3 2147483647))\n"; + String expectedResultOthers = "(assert (and (>= 1 (- 5)) (>= 3 2147483647)))\n"; + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultOthers)) + .isTrue(); + } + + @Test + public void testRationalGreaterOrEquals() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + + BooleanFormula constraint = bmgr.and(rmgr.greaterOrEquals(a, c), rmgr.greaterOrEquals(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (>= -1 3.4))\n"; + String expectedResultSMTInterpol = "(assert (and (>= (- 1.0) 3.4) (>= 3.4 2147483.647)))\n"; + String expectedResultCVC4 = + "(assert (and (>= (- 1) (/ 17 5)) (>= (/ 17 5) (/ 2147483647 1000)" + ")))\n"; + String expectedResultCVC5 = + "(assert (and (>= (- 1.0) (/ 17 5)) (>= (/ 17 5) (/ 2147483647 " + "1000))))\n"; + String expectedResultZ3 = + "(assert (and (>= (- 1.0) (/ 17.0 5.0)) (>= (/ 17.0 5.0) (/ " + "2147483647.0 1000.0))))\n"; + String expectedSolverless = "(assert (and (>= -1 3.4) (>= 3.4 2147483.647)))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedSolverless)) + .isTrue(); + } + + @Test + public void testIntegerLessThan() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = bmgr.and(imgr.lessThan(a, b), imgr.lessThan(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (< 1 (- 5)))\n"; + String expectedResultOthers = "(assert (and (< 1 (- 5)) (< 3 2147483647)))\n"; + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultOthers)) + .isTrue(); + } + + @Test + public void testRationalLessThan() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + + BooleanFormula constraint = bmgr.and(rmgr.lessThan(a, c), rmgr.lessThan(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (< -1 3.4))\n"; + String expectedResultSMTInterpol = "(assert (and (< (- 1.0) 3.4) (< 3.4 2147483.647)))\n"; + String expectedResultCVC4 = + "(assert (and (< (- 1) (/ 17 5)) (< (/ 17 5) (/ 2147483647 1000)" + ")))\n"; + String expectedResultCVC5 = + "(assert (and (< (- 1.0) (/ 17 5)) (< (/ 17 5) (/ 2147483647 " + "1000))))\n"; + String expectedResultZ3 = + "(assert (and (< (- 1.0) (/ 17.0 5.0)) (< (/ 17.0 5.0) (/ " + "2147483647.0 1000.0))))\n"; + String expectedSolverless = "(assert (and (< -1 3.4) (< 3.4 2147483.647)))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedSolverless)) + .isTrue(); + } + + @Test + public void testIntegerLessOrEqual() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = bmgr.and(imgr.lessOrEquals(a, b), imgr.lessOrEquals(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (<= 1 (- 5)))\n"; + String expectedResultOthers = "(assert (and (<= 1 (- 5)) (<= 3 2147483647)))\n"; + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultOthers)) + .isTrue(); + } + + @Test + public void testRationalLessOrEqual() { + requireRationals(); + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + + BooleanFormula constraint = bmgr.and(rmgr.lessOrEquals(a, c), rmgr.lessOrEquals(c, e)); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResultMathsat5 = "(assert (<= -1 17/5))\n"; + String expectedResultSMTInterpol = "(assert (and (<= (- 1.0) 3.4) (<= 3.4 2147483.647)))\n"; + String expectedResultCVC4 = + "(assert (and (<= (- 1) (/ 17 5)) (<= (/ 17 5) (/ 2147483647 1000)" + ")))\n"; + String expectedResultCVC5 = + "(assert (and (<= (- 1.0) (/ 17 5)) (<= (/ 17 5) (/ 2147483647 " + "1000))))\n"; + String expectedResultZ3 = + "(assert (and (<= (- 1.0) (/ 17.0 5.0)) (<= (/ 17.0 5.0) (/ " + "2147483647.0 1000.0))))\n"; + String expectedSolverLessResult = "(assert (and (<= -1 3.4) (<= 3.4 2147483.647)))\n"; + String expectedResultYices2 = "(assert (<= -1 3.4))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(expectedResultYices2) + || actualResult.equals(expectedSolverLessResult)) + .isTrue(); + } + + @Test + public void testIntegerFloor() { + requireIntegers(); + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(-5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + BooleanFormula constraint = + imgr.equal( + imgr.subtract(imgr.floor(b), imgr.floor(a)), + imgr.subtract(imgr.floor(c), imgr.floor(e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = "(assert (= (- (- 5) 1) (- 3 2147483647)))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalFloor() { + requireRationals(); + // OpenSMT does not support 'floor' + assume().that(solverToUse()).isNotEqualTo(Solvers.OPENSMT); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(-1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = + imgr.equal(rmgr.floor(a), imgr.subtract(rmgr.floor(c), rmgr.floor(e))); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + System.out.println(actualResult); + String expectedResultMathsat5 = "(assert (= -1 (- (to_int 3.4) (to_int 2147483.647))))\n"; + String expectedResultSMTInterpol = + "(assert (= (to_int (- 1.0)) (- (to_int 3.4) (to_int 2147483.647))))\n"; + String expectedResultCVC4 = + "(assert (= (to_int (- 1)) (- (to_int (/ 17 5)) (to_int (/ " + "2147483647 1000)))))\n"; + String expectedResultCVC5 = + "(assert (= (to_int (- 1.0)) (- (to_int (/ 17 5)) (to_int (/ 2147483647 1000)))))\n"; + String expectedResultZ3 = + "(assert (= (to_int (- 1.0)) (- (to_int (/ 17.0 5.0)) (to_int (/ 2147483647.0" + + " 1000.0)))))\n"; + String newExpectedResult = "(assert (= (to_int -1) (- (to_int 3.4) (to_int 2147483.647))))\n"; + + assertThat( + actualResult.equals(expectedResultMathsat5) + || actualResult.equals(expectedResultSMTInterpol) + || actualResult.equals(expectedResultCVC4) + || actualResult.equals(expectedResultCVC5) + || actualResult.equals(expectedResultZ3) + || actualResult.equals(newExpectedResult)) + .isTrue(); + } +} diff --git a/src/org/sosy_lab/java_smt/test/OptimizationTest.java b/src/org/sosy_lab/java_smt/test/OptimizationTest.java index ca2beefc6d..a7f0467ac1 100644 --- a/src/org/sosy_lab/java_smt/test/OptimizationTest.java +++ b/src/org/sosy_lab/java_smt/test/OptimizationTest.java @@ -27,6 +27,10 @@ import org.sosy_lab.java_smt.api.SolverException; public class OptimizationTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Override protected ConfigurationBuilder createTestConfigBuilder() { diff --git a/src/org/sosy_lab/java_smt/test/ProverEnvironmentSubjectTest.java b/src/org/sosy_lab/java_smt/test/ProverEnvironmentSubjectTest.java index 743ea4b7d4..86145ed06a 100644 --- a/src/org/sosy_lab/java_smt/test/ProverEnvironmentSubjectTest.java +++ b/src/org/sosy_lab/java_smt/test/ProverEnvironmentSubjectTest.java @@ -9,6 +9,7 @@ package org.sosy_lab.java_smt.test; import static com.google.common.truth.ExpectFailure.assertThat; +import static com.google.common.truth.TruthJUnit.assume; import static org.sosy_lab.java_smt.test.ProverEnvironmentSubject.proverEnvironments; import com.google.common.base.Throwables; @@ -17,6 +18,7 @@ import com.google.common.truth.SimpleSubjectBuilder; import org.junit.Before; import org.junit.Test; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.BasicProverEnvironment; import org.sosy_lab.java_smt.api.BooleanFormula; import org.sosy_lab.java_smt.api.ProverEnvironment; @@ -24,6 +26,10 @@ import org.sosy_lab.java_smt.api.SolverException; public class ProverEnvironmentSubjectTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private BooleanFormula simpleFormula; private BooleanFormula contradiction; diff --git a/src/org/sosy_lab/java_smt/test/ProverEnvironmentTest.java b/src/org/sosy_lab/java_smt/test/ProverEnvironmentTest.java index 861d441372..9246f0d7f5 100644 --- a/src/org/sosy_lab/java_smt/test/ProverEnvironmentTest.java +++ b/src/org/sosy_lab/java_smt/test/ProverEnvironmentTest.java @@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableList; import java.util.List; import java.util.Optional; +import org.junit.Before; import org.junit.Test; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.BasicProverEnvironment; import org.sosy_lab.java_smt.api.BooleanFormula; import org.sosy_lab.java_smt.api.Model; @@ -32,6 +34,10 @@ import org.sosy_lab.java_smt.api.SolverException; public class ProverEnvironmentTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Test public void assumptionsTest() throws SolverException, InterruptedException { diff --git a/src/org/sosy_lab/java_smt/test/QuantifierManagerTest.java b/src/org/sosy_lab/java_smt/test/QuantifierManagerTest.java index cf712ef5d7..c8a0cbe0b0 100644 --- a/src/org/sosy_lab/java_smt/test/QuantifierManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/QuantifierManagerTest.java @@ -36,6 +36,10 @@ @SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE", justification = "test code") public class QuantifierManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private IntegerFormula x; private ArrayFormula a; diff --git a/src/org/sosy_lab/java_smt/test/RationalFormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/RationalFormulaManagerTest.java index 1515133f88..9b635adab1 100644 --- a/src/org/sosy_lab/java_smt/test/RationalFormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/RationalFormulaManagerTest.java @@ -16,6 +16,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.Formula; @@ -28,6 +29,10 @@ import org.sosy_lab.java_smt.api.visitors.DefaultFormulaVisitor; public class RationalFormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private static final double[] SOME_DOUBLES = new double[] { diff --git a/src/org/sosy_lab/java_smt/test/SMTLIB2FloatingPointTest.java b/src/org/sosy_lab/java_smt/test/SMTLIB2FloatingPointTest.java new file mode 100644 index 0000000000..8bace2e080 --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/SMTLIB2FloatingPointTest.java @@ -0,0 +1,742 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Objects; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.rationals.Rational; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FloatingPointFormula; +import org.sosy_lab.java_smt.api.FloatingPointRoundingMode; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverException; +import org.sosy_lab.java_smt.basicimpl.Generator; + +@SuppressWarnings({"CheckReturnValue", "ReturnValueIgnored"}) +public class SMTLIB2FloatingPointTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void setup() { + Generator.setIsLoggingEnabled(true); + } + + @After + public void teardown() { + Generator.setIsLoggingEnabled(false); + Generator.resetGenerator(); + } + + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Before + public void setUp() { + assume().that(fpmgr).isNotNull(); + } + + @Test + public void testCastFloatingPointWithDoubles() + throws SolverException, InterruptedException, IOException, InvalidConfigurationException { + assume() + .withMessage("Bitwuzla doesn't support rational theory") + .that(!solverToUse().equals(Solvers.BITWUZLA)) + .isTrue(); + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a ((_ to_fp 8 24) RNE 10.0)))\n" + + "(assert (fp.eq b ((_ to_fp 8 24) RNE 10.0)))\n" + + "(assert (fp.eq c ((_ to_fp 8 24) RNE 20.0)))\n" + + "(assert (fp.eq (fp.add RNE a b) c))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + FloatingPointFormula a = + Objects.requireNonNull(fpmgr) + .makeVariable("a", FormulaType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + Objects.requireNonNull(fpmgr) + .makeVariable("b", FormulaType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula c = + Objects.requireNonNull(fpmgr) + .makeVariable("c", FormulaType.getSinglePrecisionFloatingPointType()); + BooleanFormula constraint1 = + fpmgr.equalWithFPSemantics( + a, + fpmgr.castFrom( + rmgr.makeNumber(10.0), true, FormulaType.getSinglePrecisionFloatingPointType())); + BooleanFormula constraint2 = + fpmgr.equalWithFPSemantics( + b, + fpmgr.castFrom( + rmgr.makeNumber(10.0), true, FormulaType.getSinglePrecisionFloatingPointType())); + BooleanFormula constraint3 = + fpmgr.equalWithFPSemantics( + c, + fpmgr.castFrom( + rmgr.makeNumber(20.0), true, FormulaType.getSinglePrecisionFloatingPointType())); + BooleanFormula constraint4 = fpmgr.equalWithFPSemantics(fpmgr.add(a, b), c); + BooleanFormula expectedResult = bmgr.and(constraint1, constraint2, constraint3, constraint4); + assertThat(actualResult).isNotNull(); + assertThat(actualResult).isEqualTo(expectedResult); + } + + private final FormulaType.FloatingPointType fpType = + FormulaType.getSinglePrecisionFloatingPointType(); + + @Test + public void testMakeFloatingPointFromDouble() + throws SolverException, InterruptedException, IOException, InvalidConfigurationException { + requireStrings(); + String smtInput = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a (fp #b0 #x82 #b01000000000000000000000)))\n" + + "(assert (fp.eq b (fp #b0 #x82 #b01000000000000000000000)))\n" + + "(assert (fp.eq (fp.add RNE a b) c))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(smtInput); + + FloatingPointFormula a = Objects.requireNonNull(fpmgr).makeVariable("a", fpType); + FloatingPointFormula b = Objects.requireNonNull(fpmgr).makeVariable("b", fpType); + FloatingPointFormula c = Objects.requireNonNull(fpmgr).makeVariable("c", fpType); + + BooleanFormula expectedResult = + bmgr.and( + fpmgr.equalWithFPSemantics( + a, + fpmgr.makeNumber( + new BigInteger("82", 16), + new BigInteger("01000000000000000000000", 2), + false, + fpType)), + fpmgr.equalWithFPSemantics( + b, + fpmgr.makeNumber( + new BigInteger("82", 16), + new BigInteger("01000000000000000000000", 2), + false, + fpType)), + fpmgr.equalWithFPSemantics(fpmgr.add(a, b), c)); + assertThat(actualResult).isNotNull(); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeFloatingPointFromReal() + throws SolverException, InterruptedException, IOException, InvalidConfigurationException { + assume().withMessage("Whole Real theory is not supported in JavaSMT yet").that(false).isTrue(); + String smtInput = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a ((_ to_fp 8 24) RNE 3/2)))\n" + + "(assert (fp.eq b ((_ to_fp 8 24) RNE 3/2)))\n" + + "(assert (fp.eq (fp.add RNE a b) c))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(smtInput); + + FloatingPointFormula a = Objects.requireNonNull(fpmgr).makeVariable("a", fpType); + FloatingPointFormula b = Objects.requireNonNull(fpmgr).makeVariable("b", fpType); + FloatingPointFormula c = Objects.requireNonNull(fpmgr).makeVariable("c", fpType); + + BooleanFormula expectedResult = + bmgr.and( + fpmgr.equalWithFPSemantics( + a, + fpmgr.makeNumber( + Rational.of(new BigInteger("3", 10), new BigInteger("2", 10)), fpType)), + fpmgr.equalWithFPSemantics( + b, + fpmgr.makeNumber( + Rational.of(new BigInteger("3", 10), new BigInteger("2", 10)), fpType)), + fpmgr.equalWithFPSemantics(c, fpmgr.add(a, b))); + Generator.assembleConstraint(actualResult); + assertThat(actualResult).isNotNull(); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeFloatingPointFromBigDecimal() + throws SolverException, InterruptedException, IOException, InvalidConfigurationException { + assume() + .withMessage("Bitwuzla doesn't support rational theory") + .that(!solverToUse().equals(Solvers.BITWUZLA)) + .isTrue(); + String smtInput = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a ((_ to_fp 8 24) RNE 3.14159)))\n" + + "(assert (fp.eq b ((_ to_fp 8 24) RNE 3.14159)))\n" + + "(assert (fp.eq c ((_ to_fp 8 24) RNE 6.28318)))\n" + + "(assert (fp.eq (fp.add RNE a b) c))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(smtInput); + + FloatingPointFormula a = Objects.requireNonNull(fpmgr).makeVariable("a", fpType); + FloatingPointFormula b = Objects.requireNonNull(fpmgr).makeVariable("b", fpType); + FloatingPointFormula c = Objects.requireNonNull(fpmgr).makeVariable("c", fpType); + + BooleanFormula constraint = + bmgr.and( + fpmgr.equalWithFPSemantics(a, fpmgr.makeNumber(new BigDecimal("3.14159"), fpType)), + fpmgr.equalWithFPSemantics(b, fpmgr.makeNumber(new BigDecimal("3.14159"), fpType)), + fpmgr.equalWithFPSemantics(c, fpmgr.makeNumber(new BigDecimal("6.28318"), fpType)), + fpmgr.equalWithFPSemantics(c, fpmgr.add(a, b))); + Generator.assembleConstraint(actualResult); + assertThat(actualResult).isNotNull(); + assertThat(constraint.equals(actualResult)); + } + + @Test + public void testMakeFloatingPointFromString() + throws SolverException, InterruptedException, IOException, InvalidConfigurationException { + requireStrings(); + assume() + .withMessage("Bitwuzla doesn't support String theory") + .that(!solverToUse().equals(Solvers.BITWUZLA) && !solverToUse().equals(Solvers.MATHSAT5)) + .isTrue(); + String smtInput = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a ((_ to_fp 8 24) RNE \"2.71828\")))\n" + + "(assert (fp.eq b ((_ to_fp 8 24) RNE \"2.71828\")))\n" + + "(assert (fp.eq (fp.add RNE a b) c))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(smtInput); + + FloatingPointFormula a = Objects.requireNonNull(fpmgr).makeVariable("a", fpType); + FloatingPointFormula b = Objects.requireNonNull(fpmgr).makeVariable("b", fpType); + FloatingPointFormula c = Objects.requireNonNull(fpmgr).makeVariable("c", fpType); + BooleanFormula expectedResult = + bmgr.and( + fpmgr.equalWithFPSemantics(a, fpmgr.makeNumber("2.71828", fpType)), + fpmgr.equalWithFPSemantics(b, fpmgr.makeNumber("2.71828", fpType)), + fpmgr.equalWithFPSemantics(c, fpmgr.add(a, b))); + Generator.assembleConstraint(actualResult); + assertThat(actualResult).isNotNull(); + assertThat(actualResult.equals(expectedResult)); + } + + @Test + public void testDeclareFloatingPoints() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a b))\n"; + + checkAndCreate(x); + } + + private void checkAndCreate(String pX) + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + BooleanFormula actualResult = mgr.universalParseFromString(pX); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + Generator.assembleConstraint(actualResult); + BooleanFormula constraint = fpmgr.equalWithFPSemantics(a, b); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointAddition() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq c (fp.add RNE a b)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula c = fpmgr.makeVariable("c", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula additionResult = + fpmgr.add(a, b, FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(c, additionResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareFloatingPointsWithBits() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireFloats(); + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a (fp #b0 #b10000010 #b01000000000000000000000)))\n" + + "(assert (fp.eq b (fp #b0 #b10000010 #b01000000000000000000000)))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + FloatingPointFormula c = + fpmgr.makeNumber( + new BigInteger("82", 16), new BigInteger("01000000000000000000000", 2), false, fpType); + FloatingPointFormula d = + fpmgr.makeNumber( + new BigInteger("82", 16), new BigInteger("01000000000000000000000", 2), false, fpType); + FloatingPointFormula a = + fpmgr.makeVariable("a", FormulaType.getSinglePrecisionFloatingPointType()); + FloatingPointFormula b = + fpmgr.makeVariable("b", FormulaType.getSinglePrecisionFloatingPointType()); + BooleanFormula expectedResult = + bmgr.and(fpmgr.equalWithFPSemantics(a, c), fpmgr.equalWithFPSemantics(b, d)); + Generator.assembleConstraint(actualResult); + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testComplexFP() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireFloats(); + assume().that(solverToUse()).isNotEqualTo(Solvers.BITWUZLA); + assume() + .withMessage("For some reason very slow here") + .that(solverToUse()) + .isNotEqualTo(Solvers.MATHSAT5); + String x = + "(declare-fun |c::main::$tmp::return_value_nondet_double$1@1!0&0#1|\n" + + " ()\n" + + " (_ FloatingPoint 11 53))\n" + + "(declare-fun |nondet$symex::nondet0| () (_ FloatingPoint 11 53))\n" + + "(declare-fun |c::main::main::1::x@1!0&0#1| () (_ FloatingPoint 11 53))\n" + + "(declare-fun |execution_statet::guard_exec@0!0| () Bool)\n" + + "(assert (= |nondet$symex::nondet0|\n" + + " |c::main::$tmp::return_value_nondet_double$1@1!0&0#1|))\n" + + "(assert (= |c::main::$tmp::return_value_nondet_double$1@1!0&0#1|\n" + + " |c::main::main::1::x@1!0&0#1|))\n" + + "(assert (let ((a!1 (not (=> true\n" + + " (=> |execution_statet::guard_exec@0!0|\n" + + " (fp.eq |c::main::main::1::x@1!0&0#1|\n" + + " |c::main::main::1::x@1!0&0#1|))))))\n" + + " a!1))"; + + BooleanFormula parsed = mgr.universalParseFromString(x); + Generator.assembleConstraint(parsed); + System.out.println(parsed + "\n-----------\n"); + System.out.println(Generator.getSMTLIB2String()); + ProverEnvironment proverEnvironment = context.newProverEnvironment(); + proverEnvironment.addConstraint(parsed); + assertThat(proverEnvironment.isUnsat()).isFalse(); + } + + @Test + public void testComplexFP2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireFloats(); + assume().that(solverToUse()).isNotEqualTo(Solvers.BITWUZLA); + assume() + .withMessage("For some reason very slow here") + .that(solverToUse()) + .isNotEqualTo(Solvers.MATHSAT5); + String x = + "(declare-fun |c::main::$tmp::return_value_nondet_double$1@1!0&0#1|\n" + + " ()\n" + + " (_ FloatingPoint 11 53))\n" + + "(declare-fun |nondet$symex::nondet0| () (_ FloatingPoint 11 53))\n" + + "(declare-fun |c::main::main::1::x@1!0&0#1| () (_ FloatingPoint 11 53))\n" + + "(declare-fun |execution_statet::guard_exec@0!0| () Bool)\n" + + "(assert (= |nondet$symex::nondet0|\n" + + " |c::main::$tmp::return_value_nondet_double$1@1!0&0#1|))\n" + + "(assert (= |c::main::$tmp::return_value_nondet_double$1@1!0&0#1|\n" + + " |c::main::main::1::x@1!0&0#1|))\n" + + "(assert (let ((a!1 (not (=> true\n" + + " (=> |execution_statet::guard_exec@0!0|\n" + + " (fp.eq |c::main::main::1::x@1!0&0#1|\n" + + " |c::main::main::1::x@1!0&0#1|))))))\n" + + " a!1))"; + + BooleanFormula parsed = mgr.universalParseFromString(x); + Generator.assembleConstraint(parsed); + System.out.println(parsed + "\n-----------\n"); + System.out.println(Generator.getSMTLIB2String()); + ProverEnvironment proverEnvironment = context.newProverEnvironment(); + proverEnvironment.addConstraint(parsed); + assertThat(proverEnvironment.isUnsat()).isFalse(); + } + + @Test + public void testDeclareFloatingPointsWithBitVectors() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireFloats(); + requireBitvectors(); + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq a ((_ to_fp 8 24) #b00000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + FloatingPointFormula a = + fpmgr.makeVariable("a", FormulaType.getSinglePrecisionFloatingPointType()); + BitvectorFormula bitvector = + bvmgr.makeBitvector(32, new BigInteger("00000000000000000000000000000000", 2)); + FloatingPointFormula b = + fpmgr.fromIeeeBitvector(bitvector, FormulaType.getSinglePrecisionFloatingPointType()); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = fpmgr.equalWithFPSemantics(a, b); + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareFloat8() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 5 3))\n" + + "(declare-const b (_ FloatingPoint 5 3))\n" + + "(assert (fp.eq a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(5, 2)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(5, 2)); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(a, b); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareFloat16() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a Float16)\n" + "(declare-const b Float16)\n" + "(assert (fp.eq a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(5, 10)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(5, 10)); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(a, b); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareFloat32() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a Float32)\n" + "(declare-const b Float32)\n" + "(assert (fp.eq a b))\n"; + + checkAndCreate(x); + } + + @Test + public void testDeclareFloat64() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a Float64)\n" + "(declare-const b Float64)\n" + "(assert (fp.eq a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(11, 52)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(11, 52)); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(a, b); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareFloat128() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a Float128)\n" + "(declare-const b Float128)\n" + "(assert (fp.eq a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(15, 112)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(15, 112)); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(a, b); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointMultiplication() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq c (fp.mul RNE a b)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula c = fpmgr.makeVariable("c", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula multiplicationResult = + fpmgr.multiply(a, b, FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(c, multiplicationResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointSubtraction() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq c (fp.sub RNE a b)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula c = fpmgr.makeVariable("c", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula subtractionResult = + fpmgr.subtract(a, b, FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(c, subtractionResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointDivision() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq c (fp.div RNE a b)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula c = fpmgr.makeVariable("c", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula divisionResult = + fpmgr.divide(a, b, FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(c, divisionResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointNegation() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq b (fp.neg a)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula negationResult = fpmgr.negate(a); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(b, negationResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointAbsoluteValue() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq b (fp.abs a)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula absResult = fpmgr.abs(a); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(b, absResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointMax() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq c (fp.max a b)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula c = fpmgr.makeVariable("c", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula maxResult = fpmgr.max(a, b); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(c, maxResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointMin() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(declare-const c (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq c (fp.min a b)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula c = fpmgr.makeVariable("c", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula minResult = fpmgr.min(a, b); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(c, minResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointSquareRoot() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const a (_ FloatingPoint 8 24))\n" + + "(declare-const b (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq b (fp.sqrt RNE a)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula a = fpmgr.makeVariable("a", FormulaType.getFloatingPointType(8, 23)); + FloatingPointFormula b = fpmgr.makeVariable("b", FormulaType.getFloatingPointType(8, 23)); + + FloatingPointFormula sqrtResult = fpmgr.sqrt(a, FloatingPointRoundingMode.NEAREST_TIES_TO_EVEN); + + BooleanFormula constraint = fpmgr.equalWithFPSemantics(b, sqrtResult); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointInfinity() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const inf (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq inf (_ +oo 8 " + + "24)))" + + "\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula inf = + fpmgr.makeVariable("inf", FormulaType.getSinglePrecisionFloatingPointType()); + + BooleanFormula constraint = + fpmgr.equalWithFPSemantics( + inf, fpmgr.makePlusInfinity(FormulaType.getSinglePrecisionFloatingPointType())); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testFloatingPointNaN() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = + "(declare-const nan (_ FloatingPoint 8 24))\n" + + "(assert (fp.eq nan (_ NaN 8 " + + "24)))" + + "\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FloatingPointFormula nan = fpmgr.makeVariable("nan", FormulaType.getFloatingPointType(8, 23)); + + BooleanFormula constraint = + fpmgr.equalWithFPSemantics( + nan, fpmgr.makeNaN(FormulaType.getSinglePrecisionFloatingPointType())); + Generator.assembleConstraint(actualResult); + BooleanFormula expectedResult = constraint; + Generator.assembleConstraint(expectedResult); + assertThat(actualResult).isEqualTo(expectedResult); + } +} diff --git a/src/org/sosy_lab/java_smt/test/SMTLIB2ParserInterpreterTest.java b/src/org/sosy_lab/java_smt/test/SMTLIB2ParserInterpreterTest.java new file mode 100644 index 0000000000..382cf5ab60 --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/SMTLIB2ParserInterpreterTest.java @@ -0,0 +1,3779 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; + +import com.google.common.collect.ImmutableList; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.ArrayFormula; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FunctionDeclaration; +import org.sosy_lab.java_smt.api.Model; +import org.sosy_lab.java_smt.api.Model.ValueAssignment; +import org.sosy_lab.java_smt.api.NumeralFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.RationalFormula; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; +import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; +import org.sosy_lab.java_smt.api.SolverException; +import org.sosy_lab.java_smt.basicimpl.BinaryModel; +import org.sosy_lab.java_smt.basicimpl.Generator; +import org.sosy_lab.java_smt.basicimpl.parserInterpreter.ParserException; + +@SuppressWarnings("checkstyle:linelength") +public class SMTLIB2ParserInterpreterTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + /* ARRAY CONSTRAINT TESTS. */ + @Test + public void testMakeArrayInteger() + throws SolverException, InterruptedException, InvalidConfigurationException, IOException { + requireArrays(); + requireIntegers(); + + String a = + "(declare-const a1 (Array Int Int))\n" + + "(declare-const a2 (Array Int Int))\n" + + "(assert (= a1 a2))\n" + + "(declare-const c1 (Array (Array Int Int) (Array (Array Int Int) (Array Int Int))))\n" + + "(declare-const c2 (Array (Array Int Int) (Array (Array Int Int) (Array Int Int))))\n" + + "(assert (= c1 c2))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.IntegerType); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray("a2", FormulaType.IntegerType, FormulaType.IntegerType); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c1 = + amgr.makeArray( + "c1", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.IntegerType, FormulaType.IntegerType)))); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c2 = + amgr.makeArray( + "c2", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.IntegerType, FormulaType.IntegerType)))); + + BooleanFormula constraint = bmgr.and(amgr.equivalence(a1, a2), amgr.equivalence(c1, c2)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeArrayRationals() + throws SolverException, InterruptedException, InvalidConfigurationException, IOException { + requireArrays(); + requireRationals(); + + String a = + "(declare-const a1 (Array Real Real))\n" + + "(declare-const a2 (Array Real Real))\n" + + "(assert (= a1 a2))\n" + + "(declare-const c1 (Array (Array Real Real) (Array (Array Real Real) (Array Real" + + " Real))))\n" + + "(declare-const c2 (Array (Array Real Real) (Array (Array Real Real) (Array Real" + + " Real))))\n" + + "(assert (= c1 c2))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.RationalType, FormulaType.RationalType); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray("a2", FormulaType.RationalType, FormulaType.RationalType); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c1 = + amgr.makeArray( + "c1", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.RationalType, FormulaType.RationalType), + FormulaType.getArrayType( + FormulaType.getArrayType( + FormulaType.RationalType, FormulaType.RationalType), + FormulaType.getArrayType( + FormulaType.RationalType, FormulaType.RationalType)))); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c2 = + amgr.makeArray( + "c2", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.RationalType, FormulaType.RationalType), + FormulaType.getArrayType( + FormulaType.getArrayType( + FormulaType.RationalType, FormulaType.RationalType), + FormulaType.getArrayType( + FormulaType.RationalType, FormulaType.RationalType)))); + + BooleanFormula constraint = bmgr.and(amgr.equivalence(a1, a2), amgr.equivalence(c1, c2)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeArrayBooleans() + throws SolverException, InterruptedException, InvalidConfigurationException, IOException { + requireArrays(); + requireRationals(); + requireBooleanArgumentArrays(); + + String a = + "(declare-const a1 (Array Bool Bool))\n" + + "(declare-const a2 (Array Bool Bool))\n" + + "(assert (= a1 a2))\n" + + "(declare-const c1 (Array (Array Bool Bool) (Array (Array Bool Bool) (Array Bool" + + " Bool))))\n" + + "(declare-const c2 (Array (Array Bool Bool) (Array (Array Bool Bool) (Array Bool" + + " Bool))))\n" + + "(assert (= c1 c2))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.BooleanType, FormulaType.BooleanType); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray("a2", FormulaType.BooleanType, FormulaType.BooleanType); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c1 = + amgr.makeArray( + "c1", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.BooleanType, FormulaType.BooleanType)))); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c2 = + amgr.makeArray( + "c2", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.BooleanType, FormulaType.BooleanType)))); + + BooleanFormula constraint = bmgr.and(amgr.equivalence(a1, a2), amgr.equivalence(c1, c2)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeArrayBitvectors() + throws SolverException, InterruptedException, InvalidConfigurationException, IOException { + requireArrays(); + requireBitvectors(); + + String a = + "(declare-const a1 (Array (_ BitVec 3) (_ BitVec 3)))\n" + + "(declare-const a2 (Array (_ BitVec 3) (_ BitVec 3)))\n" + + "(assert (= a1 a2))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray( + "a1", + FormulaType.getBitvectorTypeWithSize(3), + FormulaType.getBitvectorTypeWithSize(3)); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray( + "a2", + FormulaType.getBitvectorTypeWithSize(3), + FormulaType.getBitvectorTypeWithSize(3)); + + BooleanFormula constraint = amgr.equivalence(a1, a2); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeMixed() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireArrays(); + requireBitvectors(); + requireRationals(); + requireIntegers(); + requireBooleanArgumentArrays(); + + String a = + "(declare-const a1 (Array Int Real))\n" + + "(declare-const a2 (Array Int Real))\n" + + "(assert (= a1 a2))\n" + + "(declare-const b1 (Array (_ BitVec 3) Bool))\n" + + "(declare-const b2 (Array (_ BitVec 3) Bool))\n" + + "(assert (= b1 b2))\n" + + "(declare-const c1 (Array (Array Int Int) (Array (Array Bool Bool) (Array Int (_" + + " BitVec 3)))))\n" + + "(declare-const c2 (Array (Array Int Int) (Array (Array Bool Bool) (Array Int (_" + + " BitVec 3)))))\n" + + "(assert (= c1 c2))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.RationalType); + ArrayFormula a2 = + Objects.requireNonNull(amgr) + .makeArray("a2", FormulaType.IntegerType, FormulaType.RationalType); + ArrayFormula b1 = + amgr.makeArray("b1", FormulaType.getBitvectorTypeWithSize(3), FormulaType.BooleanType); + ArrayFormula b2 = + amgr.makeArray("b2", FormulaType.getBitvectorTypeWithSize(3), FormulaType.BooleanType); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c1 = + amgr.makeArray( + "c1", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.IntegerType, FormulaType.getBitvectorTypeWithSize(3))))); + ArrayFormula< + ArrayFormula, + ArrayFormula< + ArrayFormula, + ArrayFormula>> + c2 = + amgr.makeArray( + "c2", + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType( + FormulaType.IntegerType, FormulaType.getBitvectorTypeWithSize(3))))); + + BooleanFormula constraint = + bmgr.and(amgr.equivalence(a1, a2), amgr.equivalence(b1, b2), amgr.equivalence(c1, c2)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testStore() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireArrays(); + requireIntegers(); + + String a = "(declare-const a1 (Array Int Int))\n" + "(assert (= a1 (store a1 3 2)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.IntegerType); + + ArrayFormula term1 = + amgr.store(a1, imgr.makeNumber(3), imgr.makeNumber(2)); + BooleanFormula constraint = amgr.equivalence(a1, term1); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testSelect() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireArrays(); + requireIntegers(); + + String a = "(declare-const a1 (Array Int Int))\n" + "(assert (= (select a1 2) 5))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + ArrayFormula a1 = + Objects.requireNonNull(amgr) + .makeArray("a1", FormulaType.IntegerType, FormulaType.IntegerType); + + IntegerFormula term1 = amgr.select(a1, imgr.makeNumber(2)); + BooleanFormula constraint = imgr.equal(term1, imgr.makeNumber(5)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + /* BOOL CONSTRAINT TESTS */ + @Test + public void testMakeVariable() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(declare-const a Bool)\n" + "(assert a)\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = bmgr.makeVariable("a"); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeTrue() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(assert true)\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = bmgr.makeTrue(); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeFalse() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(assert false)\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = bmgr.makeFalse(); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testNot() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(declare-const a Bool)\n" + "(assert (not a))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = bmgr.not(bmgr.makeVariable("a")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testBinaryOr() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (or a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = bmgr.or(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testCollectionOr() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = + "(declare-const a Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const c Bool)\n" + + "(assert (or a b c))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = + bmgr.or(bmgr.makeVariable("a"), bmgr.makeVariable("b"), bmgr.makeVariable("c")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testBinaryAnd() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (and a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = bmgr.and(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testCollectionAnd() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = + "(declare-const a Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const c Bool)\n" + + "(assert (and a b c))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = + bmgr.and(bmgr.makeVariable("a"), bmgr.makeVariable("b"), bmgr.makeVariable("c")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testXor() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (xor a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = bmgr.xor(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testEquivalence() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (= a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = + bmgr.equivalence(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testImplication() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = "(declare-const a Bool)\n" + "(declare-const b Bool)\n" + "(assert (=> a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = + bmgr.implication(bmgr.makeVariable("a"), bmgr.makeVariable("b")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIfThenElse() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = + "(declare-const a Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const c Bool)\n" + + "(assert (ite a b c))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = + bmgr.ifThenElse(bmgr.makeVariable("a"), bmgr.makeVariable("b"), bmgr.makeVariable("c")); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testNestedTerms() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String a = + "(declare-const a Bool)\n" + + "(declare-const e Bool)\n" + + "(declare-const c Bool)\n" + + "(declare-const d Bool)\n" + + "(declare-const b Bool)\n" + + "(declare-const f Bool)\n" + + "(assert (ite (=> (and a e true) a) (xor c d) (= b (or b (and a e true) a f))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(a); + + BooleanFormula expectedResult = + bmgr.ifThenElse( + bmgr.implication( + bmgr.and( + bmgr.and(bmgr.makeBoolean(true), bmgr.makeVariable("a")), + bmgr.makeVariable("e"), + bmgr.makeTrue()), + bmgr.and(bmgr.makeBoolean(true), bmgr.makeVariable("a"))), + bmgr.xor(bmgr.makeVariable("c"), bmgr.makeVariable("d")), + bmgr.equivalence( + bmgr.or(bmgr.makeVariable("b"), bmgr.makeFalse()), + bmgr.or( + bmgr.or(bmgr.makeVariable("b"), bmgr.makeFalse()), + bmgr.and( + bmgr.and(bmgr.makeBoolean(true), bmgr.makeVariable("a")), + bmgr.makeVariable("e"), + bmgr.makeTrue()), + bmgr.and(bmgr.makeBoolean(true), bmgr.makeVariable("a")), + bmgr.makeVariable("f")))); + assertThat(actualResult).isEqualTo(expectedResult); + } + + /* UF CONSTRAINT TESTS */ + @Test + public void testdeclareUFBoolean() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBooleanUFs(); + requireNoArgumentsInUFs(); + assume() + .withMessage("Bitwuzla doesn't support 0 arity UFs") + .that(!solverToUse().equals(Solvers.BITWUZLA)) + .isTrue(); + String x = + "(declare-fun a (Bool) Bool)\n" + + "(declare-fun b () Bool)\n" + + "(assert (= (a false) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FunctionDeclaration a = + fmgr.declareUF("a", FormulaType.BooleanType, FormulaType.BooleanType); + FunctionDeclaration b = + fmgr.declareUF("b", FormulaType.BooleanType, new ArrayList<>()); + + BooleanFormula c = fmgr.callUF(a, bmgr.makeFalse()); + BooleanFormula d = fmgr.callUF(b); + + BooleanFormula constraint = bmgr.equivalence(c, d); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFInteger() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = + "(declare-fun a (Int) Int)\n" + "(declare-fun b () Int)\n" + "(assert (= (a 4) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FunctionDeclaration a = + fmgr.declareUF("a", FormulaType.IntegerType, FormulaType.IntegerType); + FunctionDeclaration b = + fmgr.declareUF("b", FormulaType.IntegerType, new ArrayList<>()); + + IntegerFormula c = fmgr.callUF(a, imgr.makeNumber(4)); + IntegerFormula d = fmgr.callUF(b); + + BooleanFormula constraint = imgr.equal(c, d); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFRational() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = + "(declare-fun a (Real) Real)\n" + "(declare-fun b () Real)\n" + "(assert (= (a 4.0) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FunctionDeclaration a = + fmgr.declareUF("a", FormulaType.RationalType, FormulaType.RationalType); + FunctionDeclaration b = + fmgr.declareUF("b", FormulaType.RationalType, new ArrayList<>()); + + RationalFormula c = fmgr.callUF(a, Objects.requireNonNull(rmgr).makeNumber(4)); + RationalFormula d = fmgr.callUF(b); + + BooleanFormula constraint = rmgr.equal(c, d); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFBitvectors() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + requireNoArgumentsInUFs(); + assume() + .withMessage("Bitwuzla doesn't support 0 arity UFs") + .that(!solverToUse().equals(Solvers.BITWUZLA)) + .isTrue(); + + String x = + "(declare-fun a ((_ BitVec 4)) (_ BitVec 4))\n" + + "(declare-fun b () (_ BitVec 4))\n" + + "(assert (= (a #b0010) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FunctionDeclaration a = + fmgr.declareUF( + "a", FormulaType.getBitvectorTypeWithSize(4), FormulaType.getBitvectorTypeWithSize(4)); + FunctionDeclaration b = + fmgr.declareUF("b", FormulaType.getBitvectorTypeWithSize(4), new ArrayList<>()); + + BitvectorFormula c = fmgr.callUF(a, Objects.requireNonNull(bvmgr).makeBitvector(4, 2)); + BitvectorFormula d = fmgr.callUF(b); + + BooleanFormula constraint = bvmgr.equal(c, d); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFArrays() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireArrays(); + requireIntegers(); + + String x = + "(declare-fun constr ((Array Int Int)(Array Int Int)) Bool)\n" + + "(declare-fun a ((Array (Array Int Int) Int)) (Array Int Int))\n" + + "(declare-const test (Array (Array Int Int) Int))\n" + + "(declare-fun b () (Array Int Int))\n" + + "(assert (constr (a test) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + FunctionDeclaration> a = + fmgr.declareUF( + "a", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + FunctionDeclaration> b = + fmgr.declareUF( + "b", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + new ArrayList<>()); + FunctionDeclaration constr = + fmgr.declareUF( + "constr", + FormulaType.BooleanType, + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType)); + + ArrayFormula c = + fmgr.callUF( + a, + Objects.requireNonNull(amgr) + .makeArray( + "test", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + ArrayFormula d = fmgr.callUF(b); + + BooleanFormula constraint = fmgr.callUF(constr, c, d); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFBoolean() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBooleanUFs(); + requireNoArgumentsInUFs(); + assume() + .withMessage("Bitwuzla doesn't support 0 arity UFs") + .that(!solverToUse().equals(Solvers.BITWUZLA)) + .isTrue(); + String x = + "(declare-fun a (Bool) Bool)\n" + + "(declare-fun b () Bool)\n" + + "(assert (= (a false) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BooleanFormula a = fmgr.declareAndCallUF("a", FormulaType.BooleanType, bmgr.makeFalse()); + BooleanFormula b = fmgr.declareAndCallUF("b", FormulaType.BooleanType); + + BooleanFormula constraint = bmgr.equivalence(a, b); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFInteger() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = + "(declare-fun a (Int) Int)\n" + "(declare-fun b () Int)\n" + "(assert (= (a 4) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = fmgr.declareAndCallUF("a", FormulaType.IntegerType, imgr.makeNumber(4)); + IntegerFormula b = fmgr.declareAndCallUF("b", FormulaType.IntegerType); + + BooleanFormula constraint = imgr.equal(a, b); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFRational() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = + "(declare-fun a (Real) Real)\n" + "(declare-fun b () Real)\n" + "(assert (= (a 4.0) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = + fmgr.declareAndCallUF( + "a", FormulaType.RationalType, Objects.requireNonNull(rmgr).makeNumber(4)); + RationalFormula b = fmgr.declareAndCallUF("b", FormulaType.RationalType); + + BooleanFormula constraint = rmgr.equal(a, b); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFBitvectors() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + requireNoArgumentsInUFs(); + assume() + .withMessage("Bitwuzla doesn't support 0 arity UFs") + .that(solverToUse()) + .isNotEqualTo(Solvers.BITWUZLA); + + String x = + "(declare-fun a ((_ BitVec 4)) (_ BitVec 4))\n" + + "(declare-fun b () (_ BitVec 4))\n" + + "(assert (= (a #b0010) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = + fmgr.declareAndCallUF( + "a", + FormulaType.getBitvectorTypeWithSize(4), + Objects.requireNonNull(bvmgr).makeBitvector(4, 2)); + BitvectorFormula b = + fmgr.declareAndCallUF("b", FormulaType.getBitvectorTypeWithSize(4), new ArrayList<>()); + + BooleanFormula constraint = bvmgr.equal(a, b); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFArrays() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + requireArrays(); + + String x = + "(declare-fun constr ((Array Int Int)(Array Int Int)) Bool)\n" + + "(declare-fun a ((Array (Array Int Int) Int)) (Array Int Int))\n" + + "(declare-const test (Array (Array Int Int) Int))\n" + + "(declare-fun b () (Array Int Int))\n" + + "(assert (constr (a test) b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + ArrayFormula a = + fmgr.declareAndCallUF( + "a", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + Objects.requireNonNull(amgr) + .makeArray( + "test", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + ArrayFormula b = + fmgr.declareAndCallUF( + "b", FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType)); + + BooleanFormula constraint = fmgr.declareAndCallUF("constr", FormulaType.BooleanType, a, b); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + /* NUMERAL CONSTRAINT TESTS*/ + + @Test + public void testMakeVariableInteger() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(declare-const a Int)\n" + "(declare-const b Int)\n" + "(assert (= a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeVariable("a"); + IntegerFormula b = imgr.makeVariable("b"); + BooleanFormula constraint = imgr.equal(a, b); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeVariableRational() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(declare-const a Real)\n" + "(declare-const b Real)\n" + "(assert (= a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + NumeralFormula a = Objects.requireNonNull(rmgr).makeVariable("a"); + NumeralFormula b = rmgr.makeVariable("b"); + BooleanFormula constraint = rmgr.equal(a, b); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerMakeNumberEqualsAndAdd() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + assume() + .withMessage("Solver %s always adds zero", solverToUse()) + .that(solverToUse()) + .isNoneOf(Solvers.CVC5, Solvers.CVC4, Solvers.PRINCESS, Solvers.SMTINTERPOL); + + String x = "(assert (= (+ 1 5) (+ 3 2147483647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(imgr.add(a, b), imgr.add(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalsMakeNumberEqualsAndAdd() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + assume() + .withMessage("Solver %s always adds zero", solverToUse()) + .that(solverToUse()) + .isNoneOf(Solvers.CVC5, Solvers.CVC4, Solvers.SMTINTERPOL); + + String x = "(assert (= 1.0 (+ 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = rmgr.equal(a, rmgr.add(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerSubtract() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (= 1 (- 5 (- 3 2147483647))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(a, imgr.subtract(b, imgr.subtract(c, e))); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalSubtract() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (= 1.0 (- 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = rmgr.equal(a, rmgr.subtract(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerNegate() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (= (- (- 5) (- 1)) (- (- 3) (- 2147483647))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + BooleanFormula constraint = + imgr.equal( + imgr.subtract(imgr.negate(b), imgr.negate(a)), + imgr.subtract(imgr.negate(c), imgr.negate(e))); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalNegate() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (= (- 1.0) (- (- 3.4) (- 2147483.647))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = + rmgr.equal(rmgr.negate(a), rmgr.subtract(rmgr.negate(c), rmgr.negate(e))); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerSum() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (= 2147483647 (+ 1 5 3 2147483647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + List d = new ArrayList<>(); + d.add(a); + d.add(b); + d.add(c); + d.add(e); + + BooleanFormula constraint = imgr.equal(e, imgr.sum(d)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalSum() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (= 1.0 (+ 1.0 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + List d = new ArrayList<>(); + d.add(a); + d.add(c); + d.add(e); + + BooleanFormula constraint = rmgr.equal(a, rmgr.sum(d)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerDivide() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + assume().that(solverToUse()).isNotEqualTo(Solvers.OPENSMT); + + String x = "(assert (= 1 (div 5 (div 3 2147483647))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(a, imgr.divide(b, imgr.divide(c, e))); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalDivide() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (= 1.0 (div 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = rmgr.equal(a, rmgr.divide(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerModulo() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + assume() + .withMessage("Solver %s does not support modulo. ", solverToUse()) + .that(solverToUse()) + .isNotEqualTo(Solvers.MATHSAT5); + + String x = "(assert (= 1 (mod 5 (mod 3 2147483647))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(a, imgr.modulo(b, imgr.modulo(c, e))); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerMultiply() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (= 1 (* 5 (* 3 2147483647))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = imgr.equal(a, imgr.multiply(b, imgr.multiply(c, e))); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalMultiply() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (= 1.0 (* 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = rmgr.equal(a, rmgr.multiply(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerDistinct() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (distinct 1 5 3 2147483647))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + List d = new ArrayList<>(); + d.add(a); + d.add(b); + d.add(c); + d.add(e); + + BooleanFormula constraint = imgr.distinct(d); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalDistinct() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (distinct 1.0 3.4 2147483.647))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + List d = new ArrayList<>(); + d.add(a); + d.add(c); + d.add(e); + + BooleanFormula constraint = rmgr.distinct(d); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testEqual() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + String x = "(assert (= 5 5))"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + IntegerFormula a = imgr.makeNumber(5); + IntegerFormula b = imgr.makeNumber(5); + BooleanFormula constraint = imgr.equal(a, b); + + assertThat(actualResult).isEqualTo(constraint); + } + + @Test + public void testIntegerGreaterThan() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (and (> 1 5) (> 3 2147483647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = bmgr.and(imgr.greaterThan(a, b), imgr.greaterThan(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalGreaterThan() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (and (> 1.0 3.4) (> 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + + BooleanFormula constraint = bmgr.and(rmgr.greaterThan(a, c), rmgr.greaterThan(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerGreaterOrEquals() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (and (>= 1 5) (>= 3 2147483647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = bmgr.and(imgr.greaterOrEquals(a, b), imgr.greaterOrEquals(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalGreaterOrEquals() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (and (>= 1.0 3.4) (>= 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + + BooleanFormula constraint = bmgr.and(rmgr.greaterOrEquals(a, c), rmgr.greaterOrEquals(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerLessThan() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (and (< 1 5) (< 3 2147483647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = bmgr.and(imgr.lessThan(a, b), imgr.lessThan(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalLessThan() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (and (< 1.0 3.4) (< 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + + BooleanFormula constraint = bmgr.and(rmgr.lessThan(a, c), rmgr.lessThan(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIntegerLessOrEqual() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (and (<= 1 5) (<= 3 2147483647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + + BooleanFormula constraint = bmgr.and(imgr.lessOrEquals(a, b), imgr.lessOrEquals(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalLessOrEqual() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + + String x = "(assert (and (<= 1.0 3.4) (<= 3.4 2147483.647)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + + BooleanFormula constraint = bmgr.and(rmgr.lessOrEquals(a, c), rmgr.lessOrEquals(c, e)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test(expected = ParserException.class) + public void testIntegerFloor() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + // Broken for anything but Princess + assume().that(solverToUse()).isEqualTo(Solvers.PRINCESS); + + String x = "(assert (= (- (to_int 5) (to_int 1)) (- (to_int 3) (to_int 2147483647))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + IntegerFormula a = imgr.makeNumber(1); + IntegerFormula b = imgr.makeNumber(5); + IntegerFormula c = imgr.makeNumber("3"); + IntegerFormula e = imgr.makeNumber(2147483647); + BooleanFormula expectedResult = + imgr.equal( + imgr.subtract(imgr.floor(b), imgr.floor(a)), + imgr.subtract(imgr.floor(c), imgr.floor(e))); + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRationalFloor() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + // OpenSMT does not support 'floor' + assume().that(solverToUse()).isNotEqualTo(Solvers.OPENSMT); + + String x = "(assert (= (to_int 1.0) (- (to_int 3.4) (to_int 2147483.647))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + RationalFormula a = Objects.requireNonNull(rmgr).makeNumber(1); + RationalFormula c = rmgr.makeNumber("3.4"); + RationalFormula e = rmgr.makeNumber(2147483.647); + BooleanFormula constraint = + imgr.equal(rmgr.floor(a), imgr.subtract(rmgr.floor(c), rmgr.floor(e))); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + /* BITVEC CONSTRAINT TESTS*/ + + @Test + public void testMakeVariableBV() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 32))\n" + + "(declare-const b (_ BitVec 32))\n" + + "(assert (= a (bvadd a b)))\n" + + "(declare-const c (_ BitVec 5))\n" + + "(declare-const d (_ BitVec 5))\n" + + "(assert (= c d))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(32, "a"); + BitvectorFormula b = bvmgr.makeVariable(32, "b"); + BitvectorFormula c = bvmgr.makeVariable(FormulaType.getBitvectorTypeWithSize(5), "c"); + BitvectorFormula d = bvmgr.makeVariable(FormulaType.getBitvectorTypeWithSize(5), "d"); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.add(a, b)); + BooleanFormula constraint2 = bvmgr.equal(c, d); + BooleanFormula constraint = bmgr.and(constraint1, constraint2); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testAdd() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (= #b111111110110 (bvadd #b111111110110 #b000000010100)))\n" + + "(assert (= #b01010 (bvadd #b01010 #b00000)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvadd" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011011010)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula a = bvmgr.makeBitvector(5, 10); + BitvectorFormula b = bvmgr.makeBitvector(5, 0); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 263255258); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.add(c, d)); + BooleanFormula constraint2 = bvmgr.equal(a, bvmgr.add(a, b)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.add(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint2); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint2, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testNegate() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (= (bvneg #b111111110110) (bvadd (bvneg #b111111110110) (bvneg" + + " #b000000010100))))\n" + + "(assert (= (bvneg" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110)" + + " (bvadd (bvneg" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110)" + + " (bvneg" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = + bvmgr.equal(bvmgr.negate(c), bvmgr.add(bvmgr.negate(c), bvmgr.negate(d))); + BooleanFormula constraint3 = + bvmgr.equal(bvmgr.negate(e), bvmgr.add(bvmgr.negate(e), bvmgr.negate(f))); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testSubtract() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (= #b111111110110 (bvsub #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvsub" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.subtract(c, d)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.subtract(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDivide() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + assume().that(solverToUse()).isNotEqualTo(Solvers.CVC4); + + String x = + "(assert (= #b111111110110 (bvsdiv #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvudiv" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.divide(c, d, true)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.divide(e, f, false)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + System.out.println(Generator.getLines()); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testBVRemainder() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (= #b111111110110 (bvsrem #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvurem" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.remainder(c, d, true)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.remainder(e, f, false)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testBVSignedModulo() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + assume().withMessage("Bvsmod is not supported in JavaSMT.").that(true).isFalse(); + + String x = "(assert (= #b111111110110 (bvsmod #b111111110110 #b000000010100)))"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BooleanFormula expectedResult = bvmgr.equal(c, bvmgr.smodulo(c, d)); + Generator.assembleConstraint(expectedResult); + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMultiply() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (= #b111111110110 (bvmul #b111111110110 #b000000010100)))\n" + + "(assert (=" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " (bvmul" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(c, bvmgr.multiply(c, d)); + BooleanFormula constraint3 = bvmgr.equal(e, bvmgr.multiply(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testGreaterThan() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (bvsgt #b111111110110 #b000000010100))\n" + + "(assert (bvugt" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.greaterThan(c, d, true); + BooleanFormula constraint3 = bvmgr.greaterThan(e, f, false); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testGreaterOrEqual() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (bvsge #b111111110110 #b000000010100))\n" + + "(assert (bvuge" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.greaterOrEquals(c, d, true); + BooleanFormula constraint3 = bvmgr.greaterOrEquals(e, f, false); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testLessThan() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (bvslt #b111111110110 #b000000010100))\n" + + "(assert (bvult" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.lessThan(c, d, true); + BooleanFormula constraint3 = bvmgr.lessThan(e, f, false); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testLessOrEqual() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (bvsle #b111111110110 #b000000010100))\n" + + "(assert (bvule" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.lessOrEquals(c, d, true); + BooleanFormula constraint3 = bvmgr.lessOrEquals(e, f, false); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testNotBV() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(assert (= (bvnot #b111111110110) (bvnot #b000000010100)))\n" + + "(assert (= (bvnot" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110)" + + " (bvnot" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(bvmgr.not(c), bvmgr.not(d)); + BooleanFormula constraint3 = bvmgr.equal(bvmgr.not(e), bvmgr.not(f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testAndBV() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvand #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvand" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.and(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.and(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testOrBV() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvor #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvor" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.or(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.or(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testBVXor() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvxor #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvxor" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.xor(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.xor(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testShiftRight() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvashr #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvlshr" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.shiftRight(c, d, true)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.shiftRight(e, f, false)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testShiftLeft() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 12))\n" + + "(assert (= a (bvshl #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 100))\n" + + "(assert (= b (bvshl" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(12, "a"); + BitvectorFormula b = bvmgr.makeVariable(100, "b"); + BitvectorFormula c = Objects.requireNonNull(bvmgr).makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = Objects.requireNonNull(bvmgr).makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.shiftLeft(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.shiftLeft(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testConcat() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 24))\n" + + "(assert (= a (concat #b111111110110 #b000000010100)))\n" + + "(declare-const b (_ BitVec 200))\n" + + "(assert (= b (concat" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000001111101100001111010011010110" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(24, "a"); + BitvectorFormula b = bvmgr.makeVariable(200, "b"); + BitvectorFormula c = bvmgr.makeBitvector(12, -10); + BitvectorFormula d = bvmgr.makeBitvector(12, 20); + BitvectorFormula e = bvmgr.makeBitvector(100, 263255254); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.concat(c, d)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.concat(e, f)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testExtract() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 6))\n" + + "(assert (= a ((_ extract 11 6) #b111111110110)))\n" + + "(declare-const b (_ BitVec 50))\n" + + "(assert (= b ((_ extract 99 50)" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(6, "a"); + BitvectorFormula b = bvmgr.makeVariable(50, "b"); + BitvectorFormula c = bvmgr.makeBitvector(12, -10); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.extract(c, 11, 6)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.extract(f, 99, 50)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testExtend() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(declare-const a (_ BitVec 18))\n" + + "(assert (= a ((_ sign_extend 6) #b111111110110)))\n" + + "(declare-const b (_ BitVec 150))\n" + + "(assert (= b ((_ zero_extend 50)" + + " #b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BitvectorFormula a = Objects.requireNonNull(bvmgr).makeVariable(18, "a"); + BitvectorFormula b = bvmgr.makeVariable(150, "b"); + BitvectorFormula c = bvmgr.makeBitvector(12, -10); + BitvectorFormula f = bvmgr.makeBitvector(100, 0); + BooleanFormula constraint1 = bvmgr.equal(a, bvmgr.extend(c, 6, true)); + BooleanFormula constraint3 = bvmgr.equal(b, bvmgr.extend(f, 50, false)); + + Generator.assembleConstraint(constraint1); + Generator.assembleConstraint(constraint3); + BooleanFormula constraint = bmgr.and(constraint1, constraint3); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + /* EXCEPTION TESTS */ + + @Test(expected = ParserException.class) + public void testExceptionAnd() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (and 1 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionOr() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (or 1 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionXor() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (xor 1 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionXor3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (xor true false false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionNot() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (not 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionNot2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (not true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionImplication() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (=> 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionImplication3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (=> false false true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionIfThenElse() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (ite 4 5 6))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionIfThenElse2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (ite true false)\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionAdd() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (+ true true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionSubtract() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (- true true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionSubtract3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (- 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionDivide() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (div true true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionDivide3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (div 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionMod() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (mod true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionMod3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (mod 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionMultiply() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (* true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionMultiply3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (* 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = UnsupportedOperationException.class) + public void testExceptionDistinct() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (distinct false true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionGreaterThan() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (> true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionGreaterThan3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (> 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionGreaterOrEqual() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (>= true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionGreaterOrEqual3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (>= 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionLessThan() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (< true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionLessThan3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (< 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionLessOrEquals() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (<= true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionLessOrEqual3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (<= 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionToInt() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (to_int true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionToInt2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (to_int 3 4 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVNeg() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvneg false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVNeg2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvneg #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVAdd() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvadd true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVAdd3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvadd #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVSub() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvsub true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVSub3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvsub #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsdiv() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvsdiv true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsdiv3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvsdiv #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVudiv() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvudiv true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVudiv3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvudiv #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsrem() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvsrem true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsrem3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvsrem #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVurem() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvurem true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVurem3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvurem #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVmul() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvmul true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVmul3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvmul #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsgt() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvsgt true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsgt3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvsgt #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVugt() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvugt true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVugt3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvugt #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsge() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvsge true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsge3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvsge #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVuge() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvuge true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVuge3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvuge #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVslt() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvslt true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVslt3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvslt #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVult() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvult true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVult3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvult #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsle() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvsle true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsle3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvsle #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVule() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvule true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVule3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvule #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVnot() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvnot true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVnot2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvnot #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVand() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvand true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVand3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvand #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVor() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvor true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVor3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvor #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVxor() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvxor true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVxor3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvxor #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVashr() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvashr true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVashr3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvashr #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVlshr() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvlshr true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVlshr3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvlshr #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVshl() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bvshl true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVshl3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (bvshl #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVconcat() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (concat true false))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVconcat3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert (concat #b001 #b100 #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVextract() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert ((_ extract true false) #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVextract2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert ((_ extract 1) #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVextract3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert ((_ extract 1 3) true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVzeroExtend() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert ((_ zero_extend true) #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVzeroExtend2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert ((_ zero_extend 4) true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVZeroExtend3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + requireBitvectors(); + + String x = "(assert ((_ zero_extend 4 1) #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsignExtend() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert ((_ sign_extend true) #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsignExtend2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert ((_ sign_extend 4) true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVsignExtend3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = "(assert ((_ sign_extend 4 1) #b100))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVtoInt() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (bv2int true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionBVtoInt2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + requireBitvectorToInt(); + + String x = "(assert (bv2int #b100 #b100)\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionIntToBV() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + requireBitvectors(); + + String x = "(assert (int2bv #b100)\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionSelect() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + requireArrays(); + + String x = "(declare-const all1 (Array Int Int))\n" + "(assert (select all1 true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionSelect2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (select true 1))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionSelect3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + requireArrays(); + + String x = "(declare-const all1 (Array Int Int))\n" + "(assert (select all1 1 5))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionStore() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + requireArrays(); + + String x = "(declare-const all1 (Array Int Int))\n" + "(assert (select all1 1 true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionStore2() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (select true 1 3))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionStore3() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + requireArrays(); + + String x = "(declare-const all1 (Array Int Int))\n" + "(assert (select all1 1))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = UnsupportedOperationException.class) + public void testExceptionNewSort() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(declare-sort Type 0)\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionForAll() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + // MathSAT does not support arrays with Bool arguments + assume().that(solverToUse()).isNotEqualTo(Solvers.MATHSAT5); + + String x = + "(declare-fun subtype (Bool Bool) Bool)\n" + + "(declare-fun array-of (Bool) Bool)\n" + + "(assert (forall ((x Bool)) (subtype x x)))\n\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionExists() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + // MathSAT does not support arrays with Bool arguments + assume().that(solverToUse()).isNotEqualTo(Solvers.MATHSAT5); + + String x = + "(declare-fun subtype (Bool Bool) Bool)\n" + + "(declare-fun array-of (Bool) Bool)\n" + + "(assert (exists ((x Bool)) (subtype x x)))\n\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = ParserException.class) + public void testExceptionExclam() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(assert (! (=> p q) :named PQ))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = UnsupportedOperationException.class) + public void testExceptionPop() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(pop 1)\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + @Test(expected = UnsupportedOperationException.class) + public void testExceptionPush() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(push 1)\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat(actualResult).isEqualTo(null); + } + + /*PARSE MODEL TESTS*/ + + @Test + public void testDefineFunctionBoolEmptyInput() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + + String x = "(define-fun bla () Bool true)\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BooleanFormula constraint = bmgr.makeTrue(); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDefineFunctionBoolWithInput() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBooleanUFs(); + + String x = "(define-fun bla ((x Bool)) Bool (= x true))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + + BooleanFormula constraint = bmgr.makeTrue(); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDefineFunctionInt() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(define-fun bla () Int (- 3 4))\n" + "(assert (= bla bla))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + IntegerFormula drei = imgr.makeNumber(3); + IntegerFormula vier = imgr.makeNumber(4); + IntegerFormula sub = imgr.subtract(drei, vier); + BooleanFormula constraint = imgr.equal(sub, sub); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDefineFunctionIntWithInput() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + + String x = "(define-fun bla ((x Int)) Int (- 3 x))\n" + "(assert (= bla bla))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + IntegerFormula drei = imgr.makeNumber(3); + IntegerFormula xVar = imgr.makeVariable("x"); + IntegerFormula sub = imgr.subtract(drei, xVar); + BooleanFormula constraint = imgr.equal(sub, sub); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDefineFunctionReal() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + assume().that(solverToUse()).isNotEqualTo(Solvers.OPENSMT); + + String x = "(define-fun bla () Real (- 3 4.0))\n" + "(assert (= bla bla))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + IntegerFormula drei = imgr.makeNumber(3); + RationalFormula vier = Objects.requireNonNull(rmgr).makeNumber(4.0); + RationalFormula sub = rmgr.subtract(drei, vier); + BooleanFormula constraint = rmgr.equal(sub, sub); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDefineFunctionRealWithInput() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireRationals(); + assume().that(solverToUse()).isNotEqualTo(Solvers.OPENSMT); + + String x = "(define-fun bla ((x Real)) Real (- 3 x))\n" + "(assert (= bla bla))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + IntegerFormula drei = imgr.makeNumber(3); + RationalFormula xVar = Objects.requireNonNull(rmgr).makeVariable("x"); + RationalFormula sub = rmgr.subtract(drei, xVar); + BooleanFormula constraint = rmgr.equal(sub, sub); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDefineFunctionBitVec() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(define-fun bla () (_ BitVec 5) (bvsub #b10000 #b00001))\n" + "(assert (= bla bla))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + BitvectorFormula first = Objects.requireNonNull(bvmgr).makeBitvector(5, 16); + BitvectorFormula second = bvmgr.makeBitvector(5, 1); + BitvectorFormula sub = bvmgr.subtract(first, second); + BooleanFormula constraint = bvmgr.equal(sub, sub); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDefineFunctionBitVecWithInput() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String x = + "(define-fun bla ((x (_ BitVec 5))) (_ BitVec 5) (bvsub #b10000 x))\n" + + "(assert (= bla bla))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + BitvectorFormula first = Objects.requireNonNull(bvmgr).makeBitvector(5, 16); + BitvectorFormula second = bvmgr.makeVariable(5, "x"); + BitvectorFormula sub = bvmgr.subtract(first, second); + BooleanFormula constraint = bvmgr.equal(sub, sub); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDefineFunctionArray() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + requireArrays(); + + String x = + "(declare-const a (Array Int Int))\n" + + "(define-fun bla () (Array Int Int) a)\n" + + "(assert (= a a))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(x); + + ArrayFormula a = + Objects.requireNonNull(amgr) + .makeArray("a", FormulaType.IntegerType, FormulaType.IntegerType); + BooleanFormula constraint = amgr.equivalence(a, a); + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + /* OTHER FUNCTION TESTS*/ + + @Test + public void testLetExpression() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireIntegers(); + assume() + .that(solverToUse()) + .isNoneOf(Solvers.OPENSMT, Solvers.CVC4, Solvers.SMTINTERPOL, Solvers.YICES2); + + String s = + "(declare-const x Int)\n" + + "(declare-const y Int)\n" + + "(declare-const z Int)\n" + + "(assert (= z (let ((a (* x y)) (b (div a y))) (* a b))))\n"; + BooleanFormula actualResult = mgr.universalParseFromString(s); + IntegerFormula x = imgr.makeVariable("x"); + IntegerFormula y = imgr.makeVariable("y"); + IntegerFormula z = imgr.makeVariable("z"); + BooleanFormula constraint = + imgr.equal(z, imgr.multiply(imgr.multiply(x, y), imgr.divide(imgr.multiply(x, y), y))); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testBinaryNumber() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String s = "(declare-const x (_ BitVec 3))\n" + "(assert (= x #b110))"; + BooleanFormula actualResult = mgr.universalParseFromString(s); + BitvectorFormula x = Objects.requireNonNull(bvmgr).makeVariable(3, "x"); + BooleanFormula constraint = bvmgr.equal(x, bvmgr.makeBitvector(3, 6)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testHexNumber() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireBitvectors(); + + String s = "(declare-const x (_ BitVec 12))\n" + "(assert (= x #x110))"; + BooleanFormula actualResult = mgr.universalParseFromString(s); + BitvectorFormula x = Objects.requireNonNull(bvmgr).makeVariable(12, "x"); + BooleanFormula constraint = bvmgr.equal(x, bvmgr.makeBitvector(12, 272)); + + BooleanFormula expectedResult = constraint; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + public void clearGenerator() { + Generator.setIsLoggingEnabled(true); + Generator.getLines().delete(0, Generator.getLines().length()); + Generator.getRegisteredVariables().clear(); + Generator.getExecutedAggregator().clear(); + } + + /* MODEL TESTS */ + + public String modelToString(ImmutableList modelList) { + StringBuilder out = new StringBuilder(); + out.append("binary model: \n"); + for (int i = 0; i < modelList.size(); i++) { + out.append(modelList.get(i)); + out.append("\n"); + } + + return String.valueOf(out); + } + + @Test + public void testModelBool() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + assume() + .withMessage("Test is being ignored, because AppVeyor cannot execute this test.") + .that(false) + .isTrue(); + clearGenerator(); + assume().that(solverToUse()).isEqualTo(Solvers.PRINCESS); + String a = + "(declare-const c Bool)\n" + + "(declare-const d Bool)\n" + + "(assert (and (and d d) (and (not c) (not c))))\n"; + + BooleanFormula b = mgr.universalParseFromString(a); + Model.ValueAssignment entry1 = + new ValueAssignment( + bmgr.makeVariable("d"), + bmgr.makeTrue(), + bmgr.equivalence(bmgr.makeVariable("d"), bmgr.makeTrue()), + "d", + "true", + new ArrayList<>()); + Model.ValueAssignment entry2 = + new ValueAssignment( + bmgr.makeVariable("c"), + bmgr.makeFalse(), + bmgr.equivalence(bmgr.makeVariable("c"), bmgr.makeFalse()), + "c", + "false", + new ArrayList<>()); + List temp = new ArrayList<>(); + temp.add(entry1); + temp.add(entry2); + String expectedResult = modelToString(ImmutableList.copyOf(temp)); + + try (ProverEnvironment prover = + context.newProverEnvironment( + SolverContext.ProverOptions.GENERATE_MODELS, ProverOptions.USE_BINARY)) { + prover.addConstraint(b); + boolean isUnsat = prover.isUnsat(); + if (!isUnsat) { + try (Model model = prover.getModel()) { + BinaryModel binaryModel = (BinaryModel) model; + try (binaryModel) { + String actualResult = modelToString(binaryModel.asList()); + assertThat(actualResult).isEqualTo(expectedResult); + } + } + } + } + } + + @Test + public void testModelBitvector() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + assume() + .withMessage("Test is being ingored, because BinaryModel is broken.") + .that(false) + .isTrue(); + requireBitvectors(); + clearGenerator(); + assume().that(solverToUse()).isEqualTo(Solvers.PRINCESS); + String a = + "(declare-const c (_ BitVec 3))\n" + + "(declare-const d (_ BitVec 3))\n" + + "(assert (= (bvadd c #b101) (bvadd d #b101)))\n"; + + BooleanFormula b = mgr.universalParseFromString(a); + Model.ValueAssignment entry1 = + new ValueAssignment( + Objects.requireNonNull(bvmgr).makeVariable(3, "d"), + bvmgr.makeBitvector(3, 7), + bvmgr.equal(bvmgr.makeVariable(3, "d"), bvmgr.makeBitvector(3, 7)), + "d", + bvmgr.makeBitvector(3, 7).toString(), + new ArrayList<>()); + Model.ValueAssignment entry2 = + new ValueAssignment( + bvmgr.makeVariable(3, "c"), + bvmgr.makeBitvector(3, 7), + bvmgr.equal(bvmgr.makeVariable(3, "c"), bvmgr.makeBitvector(3, 7)), + "c", + bvmgr.makeBitvector(3, 7).toString(), + new ArrayList<>()); + List temp = new ArrayList<>(); + temp.add(entry1); + temp.add(entry2); + String expectedResult = modelToString(ImmutableList.copyOf(temp)); + + try (ProverEnvironment prover = + context.newProverEnvironment( + SolverContext.ProverOptions.GENERATE_MODELS, ProverOptions.USE_BINARY)) { + prover.addConstraint(b); + boolean isUnsat = prover.isUnsat(); + if (!isUnsat) { + try (Model model = prover.getModel()) { + BinaryModel binaryModel = (BinaryModel) model; + try (binaryModel) { + String actualResult = modelToString(binaryModel.asList()); + assertThat(actualResult).isEqualTo(expectedResult); + } + } + } + } + } + + @Test + public void testModelArrayInt() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + assume() + .withMessage("Test is being ignored, because AppVeyor cannot execute this test.") + .that(false) + .isTrue(); + requireIntegers(); + requireArrays(); + requireArrayModel(); + clearGenerator(); + assume().that(solverToUse()).isEqualTo(Solvers.PRINCESS); + String a = + "(declare-const c (Array Int Int))\n" + + "(declare-const d (Array Int Int))\n" + + "(assert (= c d))\n"; + + BooleanFormula b = mgr.universalParseFromString(a); + Model.ValueAssignment entry2 = + new ValueAssignment( + Objects.requireNonNull(amgr) + .makeArray("c", FormulaType.IntegerType, FormulaType.IntegerType), + amgr.makeArray("c", FormulaType.IntegerType, FormulaType.IntegerType), + amgr.equivalence( + amgr.makeArray("c", FormulaType.IntegerType, FormulaType.IntegerType), + amgr.makeArray("c", FormulaType.IntegerType, FormulaType.IntegerType)), + "c", + "(as const (Array Int Int) 0)", + new ArrayList<>()); + Model.ValueAssignment entry1 = + new ValueAssignment( + amgr.makeArray("d", FormulaType.IntegerType, FormulaType.IntegerType), + amgr.makeArray("d", FormulaType.IntegerType, FormulaType.IntegerType), + amgr.equivalence( + amgr.makeArray("d", FormulaType.IntegerType, FormulaType.IntegerType), + amgr.makeArray("d", FormulaType.IntegerType, FormulaType.IntegerType)), + "d", + "(as const (Array Int Int) 0)", + new ArrayList<>()); + List temp = new ArrayList<>(); + temp.add(entry1); + temp.add(entry2); + String expectedResult = modelToString(ImmutableList.copyOf(temp)); + + try (ProverEnvironment prover = + context.newProverEnvironment( + SolverContext.ProverOptions.GENERATE_MODELS, ProverOptions.USE_BINARY)) { + prover.addConstraint(b); + boolean isUnsat = prover.isUnsat(); + if (!isUnsat) { + try (Model model = prover.getModel()) { + BinaryModel binaryModel = (BinaryModel) model; + try (binaryModel) { + String actualResult = modelToString(binaryModel.asList()); + assertThat(actualResult).isEqualTo(expectedResult); + } + } + } + } + } + + @Test + public void testModelArrayBitVec() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + assume() + .withMessage("Test is being ingored, because BinaryModel is broken.") + .that(false) + .isTrue(); + requireArrays(); + requireBitvectors(); + clearGenerator(); + assume().that(solverToUse()).isEqualTo(Solvers.PRINCESS); + String a = + "(declare-const c (Array (_ BitVec 32) (_ BitVec 32)))\n" + + "(declare-const d (Array (_ BitVec 32) (_ BitVec 32)))\n" + + "(assert (= c d))\n"; + + BooleanFormula b = mgr.universalParseFromString(a); + Model.ValueAssignment entry2 = + new ValueAssignment( + Objects.requireNonNull(amgr) + .makeArray( + "c", + FormulaType.getBitvectorTypeWithSize(32), + FormulaType.getBitvectorTypeWithSize(32)), + amgr.makeArray( + "c", + FormulaType.getBitvectorTypeWithSize(32), + FormulaType.getBitvectorTypeWithSize(32)), + amgr.equivalence( + amgr.makeArray( + "c", + FormulaType.getBitvectorTypeWithSize(32), + FormulaType.getBitvectorTypeWithSize(32)), + amgr.makeArray( + "c", + FormulaType.getBitvectorTypeWithSize(32), + FormulaType.getBitvectorTypeWithSize(32))), + "c", + "(as const (Array (_ BitVec 32) (_ BitVec 32)) mod_cast(0, 4294967295, 0))", + new ArrayList<>()); + Model.ValueAssignment entry1 = + new ValueAssignment( + amgr.makeArray( + "d", + FormulaType.getBitvectorTypeWithSize(32), + FormulaType.getBitvectorTypeWithSize(32)), + amgr.makeArray( + "d", + FormulaType.getBitvectorTypeWithSize(32), + FormulaType.getBitvectorTypeWithSize(32)), + amgr.equivalence( + amgr.makeArray( + "d", + FormulaType.getBitvectorTypeWithSize(32), + FormulaType.getBitvectorTypeWithSize(32)), + amgr.makeArray( + "d", + FormulaType.getBitvectorTypeWithSize(32), + FormulaType.getBitvectorTypeWithSize(32))), + "d", + "(as const (Array (_ BitVec 32) (_ BitVec 32)) mod_cast(0, 4294967295, 0))", + new ArrayList<>()); + List temp = new ArrayList<>(); + temp.add(entry1); + temp.add(entry2); + String expectedResult = modelToString(ImmutableList.copyOf(temp)); + + try (ProverEnvironment prover = + context.newProverEnvironment( + SolverContext.ProverOptions.GENERATE_MODELS, ProverOptions.USE_BINARY)) { + prover.addConstraint(b); + boolean isUnsat = prover.isUnsat(); + if (!isUnsat) { + try (Model model = prover.getModel()) { + BinaryModel binaryModel = (BinaryModel) model; + try (binaryModel) { + String actualResult = modelToString(binaryModel.asList()); + assertThat(actualResult).isEqualTo(expectedResult); + } + } + } + } + } + + @Test + public void testModelArrayBool() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + assume() + .withMessage("Test is being ignored, because AppVeyor cannot execute this test.") + .that(false) + .isTrue(); + requireArrays(); + requireArrayModel(); + clearGenerator(); + assume().that(solverToUse()).isEqualTo(Solvers.PRINCESS); + String a = + "(declare-const c (Array Bool Bool))\n" + + "(declare-const d (Array Bool Bool))\n" + + "(assert (= c d))\n"; + + BooleanFormula b = mgr.universalParseFromString(a); + Model.ValueAssignment entry2 = + new ValueAssignment( + Objects.requireNonNull(amgr) + .makeArray("c", FormulaType.BooleanType, FormulaType.BooleanType), + amgr.makeArray("c", FormulaType.BooleanType, FormulaType.BooleanType), + amgr.equivalence( + amgr.makeArray("c", FormulaType.BooleanType, FormulaType.BooleanType), + amgr.makeArray("c", FormulaType.BooleanType, FormulaType.BooleanType)), + "c", + "(as const (Array Bool Bool) true)", + new ArrayList<>()); + Model.ValueAssignment entry1 = + new ValueAssignment( + amgr.makeArray("d", FormulaType.BooleanType, FormulaType.BooleanType), + amgr.makeArray("d", FormulaType.BooleanType, FormulaType.BooleanType), + amgr.equivalence( + amgr.makeArray("d", FormulaType.BooleanType, FormulaType.BooleanType), + amgr.makeArray("d", FormulaType.BooleanType, FormulaType.BooleanType)), + "d", + "(as const (Array Bool Bool) true)", + new ArrayList<>()); + List temp = new ArrayList<>(); + temp.add(entry1); + temp.add(entry2); + String expectedResult = modelToString(ImmutableList.copyOf(temp)); + + try (ProverEnvironment prover = + context.newProverEnvironment( + SolverContext.ProverOptions.GENERATE_MODELS, ProverOptions.USE_BINARY)) { + prover.addConstraint(b); + boolean isUnsat = prover.isUnsat(); + if (!isUnsat) { + try (Model model = prover.getModel()) { + BinaryModel binaryModel = (BinaryModel) model; + try (binaryModel) { + String actualResult = modelToString(binaryModel.asList()); + assertThat(actualResult).isEqualTo(expectedResult); + } + } + } + } + } + + @Test + public void testModelArrayArray() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + assume() + .withMessage("Test is being ignored, because AppVeyor cannot execute this test.") + .that(false) + .isTrue(); + requireArrays(); + requireArrayModel(); + clearGenerator(); + assume().that(solverToUse()).isEqualTo(Solvers.PRINCESS); + String a = + "(declare-const c (Array (Array Bool Bool) (Array Bool Bool)))\n" + + "(declare-const d (Array (Array Bool Bool) (Array Bool Bool)))\n" + + "(assert (= c d))\n"; + + BooleanFormula b = mgr.universalParseFromString(a); + Model.ValueAssignment entry2 = + new ValueAssignment( + Objects.requireNonNull(amgr) + .makeArray( + "c", + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType)), + amgr.makeArray( + "c", + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType)), + amgr.equivalence( + amgr.makeArray( + "c", + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType)), + amgr.makeArray( + "c", + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType))), + "c", + "(as const (Array (Array Bool Bool (Array Bool Bool) (as const (Array Bool Bool)" + + " true))", + new ArrayList<>()); + Model.ValueAssignment entry1 = + new ValueAssignment( + amgr.makeArray( + "d", + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType)), + amgr.makeArray( + "d", + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType)), + amgr.equivalence( + amgr.makeArray( + "d", + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType)), + amgr.makeArray( + "d", + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType), + FormulaType.getArrayType(FormulaType.BooleanType, FormulaType.BooleanType))), + "d", + "(as const (Array (Array Bool Bool (Array Bool Bool) (as const (Array Bool Bool)" + + " true))", + new ArrayList<>()); + List temp = new ArrayList<>(); + temp.add(entry1); + temp.add(entry2); + String expectedResult = modelToString(ImmutableList.copyOf(temp)); + + try (ProverEnvironment prover = + context.newProverEnvironment( + SolverContext.ProverOptions.GENERATE_MODELS, ProverOptions.USE_BINARY)) { + prover.addConstraint(b); + boolean isUnsat = prover.isUnsat(); + if (!isUnsat) { + try (Model model = prover.getModel()) { + BinaryModel binaryModel = (BinaryModel) model; + try (binaryModel) { + String actualResult = modelToString(binaryModel.asList()); + assertThat(actualResult).isEqualTo(expectedResult); + } + } + } + } + } +} diff --git a/src/org/sosy_lab/java_smt/test/SMTLIB2StringTest.java b/src/org/sosy_lab/java_smt/test/SMTLIB2StringTest.java new file mode 100644 index 0000000000..8c62050fcb --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/SMTLIB2StringTest.java @@ -0,0 +1,504 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; + +import java.io.IOException; +import java.util.Objects; +import org.junit.Before; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FunctionDeclaration; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.RegexFormula; +import org.sosy_lab.java_smt.api.SolverException; +import org.sosy_lab.java_smt.api.StringFormula; +import org.sosy_lab.java_smt.basicimpl.Generator; + +@SuppressWarnings({"CheckReturnValue", "ReturnValueIgnored", "EqualsIncompatibleType"}) +public class SMTLIB2StringTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void setUp() { + assume().that(smgr).isNotNull(); + } + + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Test + public void testDeclareString() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n"; + BooleanFormula actualResult = Objects.requireNonNull(mgr).universalParseFromString(x); + + StringFormula a = Objects.requireNonNull(smgr).makeVariable("a"); + + assertThat(actualResult).isNotNull(); + assertThat(a).isNotNull(); + } + + @Test + public void testMakeString() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (= a \"Hello\"))"; + + BooleanFormula parsed = mgr.universalParseFromString(x); + StringFormula a = smgr.makeVariable("a"); + BooleanFormula constraint = smgr.equal(a, smgr.makeString("Hello")); + assertThat(parsed).isEqualTo(constraint); + } + + @Test + public void testStringEquality() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(declare-const b String)\n" + "(assert (= a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + assert smgr != null; + StringFormula a = smgr.makeVariable("a"); + StringFormula b = smgr.makeVariable("b"); + + BooleanFormula constraint = smgr.equal(a, b); + + assertThat(actualResult).isEqualTo(constraint); + } + + @Test + public void testStringConcatenation() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(declare-const b String)\n" + + "(declare-const c String)\n" + + "(assert (= c (str.++ a b)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + StringFormula b = smgr.makeVariable("b"); + StringFormula c = smgr.makeVariable("c"); + + StringFormula concatenationResult = smgr.concat(a, b); + + BooleanFormula constraint = smgr.equal(c, concatenationResult); + + assertThat(actualResult).isEqualTo(constraint); + } + + @Test + public void testStringConcatenationWithValues() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const d String)\n" + "(assert (= d (str.++ \"a\" \"b\" \"c\")))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + StringFormula a = smgr.makeString("a"); + StringFormula b = smgr.makeString("b"); + StringFormula c = smgr.makeString("c"); + StringFormula d = smgr.makeVariable("d"); + + BooleanFormula constraint = smgr.equal(d, smgr.concat(a, b, c)); + + assertThat(actualResult).isEqualTo(constraint); + } + + @Test + public void testStringLength() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + String x = + "(declare-const a String)\n" + + "(declare-const len Int)\n" + + "(assert (= len (str.len a)))\n"; + + BooleanFormula expectedResult = mgr.universalParseFromString(x); + StringFormula a = smgr.makeVariable("a"); + IntegerFormula len = imgr.makeVariable("len"); + + IntegerFormula lengthResult = smgr.length(a); + + BooleanFormula constraint = imgr.equal(len, lengthResult); + assertThat(constraint).isEqualTo(expectedResult); + } + + @Test + public void testStringSubstring() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(declare-const sub String)\n" + + "(declare-const start Int)\n" + + "(declare-const length Int)\n" + + "(assert (= sub (str.substr a start length)))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + StringFormula sub = smgr.makeVariable("sub"); + IntegerFormula start = mgr.getIntegerFormulaManager().makeVariable("start"); + IntegerFormula length = mgr.getIntegerFormulaManager().makeVariable("length"); + + StringFormula substringResult = smgr.substring(a, start, length); + + BooleanFormula constraint = smgr.equal(sub, substringResult); + + assertThat(actualResult).isEqualTo(constraint); + } + + @Test + public void testStringContains() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(declare-const b String)\n" + + "(assert (str.contains a b))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + StringFormula b = smgr.makeVariable("b"); + + BooleanFormula containsResult = smgr.contains(a, b); + + assertThat(actualResult).isEqualTo(containsResult); + } + + @Test + public void testStringPrefix() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(declare-const prefix String)\n" + + "(assert (str.prefixof prefix a))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + StringFormula prefix = smgr.makeVariable("prefix"); + + BooleanFormula prefixResult = smgr.prefix(prefix, a); + + assertThat(actualResult).isEqualTo(prefixResult); + } + + @Test + public void testStringSuffix() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(declare-const suffix String)\n" + + "(assert (str.suffixof suffix a))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + StringFormula suffix = smgr.makeVariable("suffix"); + + BooleanFormula suffixResult = smgr.suffix(suffix, a); + + assertThat(actualResult).isEqualTo(suffixResult); + } + + @Test + public void testStringRegexMatch() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (and (str.<= \"a\" a) (str.<= a \"z\")))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + BooleanFormula regexMatch = + bmgr.and( + smgr.lessOrEquals(smgr.makeString("a"), a), smgr.lessOrEquals(a, smgr.makeString("z"))); + + assertThat(actualResult).isEqualTo(regexMatch); + } + + @Test + public void testRegexInRe() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(assert (str.in_re a (re.++ (str.to_re \"a\") (str.to_re \"b\"))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + assertThat( + actualResult.equals( + "(str.in_re a (re.++ (str.to_re \"\\Qa\\E\") (str.to_re " + "\"\\Qb\\E\")))")); + } + + @Test + public void testRegexNone() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (str.in_re a re.none))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + BooleanFormula regexMatch = smgr.in(a, smgr.none()); + + assertThat(actualResult).isEqualTo(regexMatch); + } + + @Test + public void testRegexAll() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (str.in_re a re.all))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + BooleanFormula regexMatch = smgr.in(a, smgr.all()); + + assertThat(actualResult).isEqualTo(regexMatch); + } + + @Test + public void testRegexConcat() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(assert (str.in_re a (re.++ (str.to_re \"a\") (str.to_re \"b\")))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + assertThat( + actualResult.equals( + "(str.in_re a (re.++ (str.to_re \"\\Qa\\E\") (str.to_re " + "\"\\Qb\\E\")))")); + } + + @Test + public void testRegexUnion() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(assert (str.in_re a (re.union (str.to_re \"a\") (str.to_re \"b\"))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + assertThat( + actualResult.equals( + "(str.in_re a (re.union (str.to_re \"\\Qa\\E\") (str.to_re \"\\Qb\\E\")))")); + } + + @Test + public void testRegexClosure() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (str.in_re a (re.* (str.to_re \"a\"))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + assertThat(actualResult.equals("(str.in_re a (re.* (str.to_re \"\\Qa\\E\")))")); + } + + @Test + public void testRegexAllChar() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (str.in_re a re.allchar))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + BooleanFormula regexMatch = smgr.in(a, smgr.allChar()); + + assertThat(actualResult).isEqualTo(regexMatch); + } + + @Test + public void testRegexIntersection() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(assert (str.in_re a (re.inter (str.to_re \"a\") (str.to_re \"b\"))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + assertThat( + actualResult.equals( + "(str.in_re a (re.inter (str.to_re \"\\Qa\\E\") (str.to_re " + "\"\\Qb\\E\")))")); + } + + @Test + public void testRegexComplement() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + "(assert (str.in_re a (re.comp (str.to_re \"a\"))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + StringFormula a = smgr.makeVariable("a"); + RegexFormula regex = smgr.complement(smgr.makeRegex("a")); + BooleanFormula regexMatch = smgr.in(a, regex); + + assertThat(actualResult.equals(regexMatch)); + } + + @Test + public void testRegexDifference() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = + "(declare-const a String)\n" + + "(assert (str.in_re a (re.diff (str.to_re \"a\") (str.to_re \"b\"))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat( + actualResult.equals( + "(str.in_re a (re.inter (str.to_re \"\\Qa\\E\") (re.comp (str" + + ".to_re \"\\Qb\\E\"))))")); + } + + @Test + public void testRegexCross() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (str.in_re a (re.+ (str.to_re \"a\"))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat( + actualResult.equals( + "(str.in_re a (re.++ (str.to_re \"\\Qa\\E\") (re.* (str.to_re \"\\Qa\\E\"))))")); + } + + @Test + public void testRegexOptional() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (str.in_re a (re.opt (str.to_re \"a\"))))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + assertThat( + actualResult.equals( + "(str.in_re a (re.++ (str.to_re \"\\Qa\\E\") (re.* (str.to_re " + "\"\\Qa\\E\")))))")); + } + + @Test + public void testRegexRange() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + requireStrings(); + String x = "(declare-const a String)\n" + "(assert (str.in_re a (re.range \"a\" \"z\")))\n"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + + StringFormula a = smgr.makeVariable("a"); + RegexFormula regex = smgr.range(smgr.makeString("a"), smgr.makeString("z")); + BooleanFormula regexMatch = smgr.in(a, regex); + + assertThat(actualResult).isEqualTo(regexMatch); + } + + @Test + public void testDeclareUFString() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + String x = + "(set-info :license \"https://creativecommons.org/licenses/by/4.0/\")\n" + + "(set-info :category \"random\")\n" + + "(set-info :status sat)\n" + + "\n" + + "(declare-fun i () String)\n" + + "(declare-fun b () String)\n" + + "(declare-fun g () String)\n" + + "(declare-fun f () String)\n" + + "(assert (= (str.++ \"cefcdf\" b \"bgcdfedb\" g \"fgafb\" g \"gefdgcbadf\") (str.++" + + " g \"ef\" i \"dcbbf\" g \"f\" g \"bbg\" f \"gefdg\" g \"badf\") ))\n" + + "(check-sat)\n" + + "\n" + + "(exit)"; + + BooleanFormula actualResult = mgr.universalParseFromString(x); + FunctionDeclaration i = + mgr.getUFManager().declareUF("i", FormulaType.StringType); + FunctionDeclaration b = + mgr.getUFManager().declareUF("b", FormulaType.StringType); + FunctionDeclaration g = + mgr.getUFManager().declareUF("g", FormulaType.StringType); + FunctionDeclaration f = + mgr.getUFManager().declareUF("f", FormulaType.StringType); + BooleanFormula constraint = + smgr.equal( + smgr.concat( + smgr.makeString("cefcdf"), + fmgr.callUF(b), + smgr.makeString("bgcdfedb"), + fmgr.callUF(g), + smgr.makeString("fgafb"), + fmgr.callUF(g), + smgr.makeString("gefdgcbadf")), + smgr.concat( + fmgr.callUF(g), + smgr.makeString("ef"), + fmgr.callUF(i), + smgr.makeString("dcbbf"), + fmgr.callUF(g), + smgr.makeString("f"), + fmgr.callUF(g), + smgr.makeString("bbg"), + fmgr.callUF(f), + smgr.makeString("gefdg"), + fmgr.callUF(g), + smgr.makeString("badf"))); + + Generator.assembleConstraint(actualResult); + assertThat(actualResult).isEqualTo(constraint); + } + + @Test + public void testComplexStringRegex() + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + String x = + "(declare-const X String)\n" + + "(assert (not (str.in_re X (re.++ (str.to_re \"/filename=\") (re.* (re.comp" + + " (str.to_re \"\\u{a}\"))) (str.to_re \".otf/i\\u{a}\")))))\n" + + "(assert (str.in_re X (re.++ (str.to_re \"/filename=\") (re.* (re.comp (str.to_re" + + " \"\\u{a}\"))) (str.to_re \".xlw/i\\u{a}\"))))\n" + + "(check-sat)"; + parseGenerateReparseAndCheckSat(x, false); + } + + private void parseGenerateReparseAndCheckSat(String pX, boolean isUnsat) + throws IOException, SolverException, InterruptedException, InvalidConfigurationException { + BooleanFormula parse = mgr.universalParseFromString(pX); + System.out.println(parse + "\n--------\n"); + Generator.assembleConstraint(parse); + String reparsed = Generator.getSMTLIB2String(); + System.out.println(reparsed); + BooleanFormula result = mgr.universalParseFromString(reparsed); + ProverEnvironment proverEnvironment = context.newProverEnvironment(); + proverEnvironment.addConstraint(result); + if (isUnsat) { + assertThat(proverEnvironment.isUnsat()).isTrue(); + } else { + assertThat(proverEnvironment.isUnsat()).isFalse(); + } + } +} diff --git a/src/org/sosy_lab/java_smt/test/SolverAllSatTest.java b/src/org/sosy_lab/java_smt/test/SolverAllSatTest.java index 0ef9a46b14..f208adb1df 100644 --- a/src/org/sosy_lab/java_smt/test/SolverAllSatTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverAllSatTest.java @@ -67,6 +67,7 @@ protected Logics logicToUse() { @Before public void setupEnvironment() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); switch (proverEnv) { case "normal": env = context.newProverEnvironment(ProverOptions.GENERATE_ALL_SAT); diff --git a/src/org/sosy_lab/java_smt/test/SolverBasedTest0.java b/src/org/sosy_lab/java_smt/test/SolverBasedTest0.java index f38248560d..0b70d4af3d 100644 --- a/src/org/sosy_lab/java_smt/test/SolverBasedTest0.java +++ b/src/org/sosy_lab/java_smt/test/SolverBasedTest0.java @@ -52,6 +52,7 @@ import org.sosy_lab.java_smt.api.StringFormula; import org.sosy_lab.java_smt.api.StringFormulaManager; import org.sosy_lab.java_smt.api.UFManager; +import org.sosy_lab.java_smt.basicimpl.Generator; import org.sosy_lab.java_smt.solvers.opensmt.Logics; /** @@ -128,6 +129,9 @@ protected ConfigurationBuilder createTestConfigBuilder() { if (solverToUse() == Solvers.OPENSMT) { newConfig.setOption("solver.opensmt.logic", logicToUse().toString()); } + if (solverToUse() == Solvers.SOLVERLESS) { + newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } return newConfig; } @@ -191,6 +195,9 @@ public final void initSolver() throws InvalidConfigurationException { } catch (UnsupportedOperationException e) { emgr = null; } + if (Generator.isLoggingEnabled()) { + Generator.resetGenerator(); + } } @After @@ -200,6 +207,42 @@ public final void closeSolver() { } } + /** Skip test if the solver does not support Booleans in UFs. */ + protected final void requireBooleanUFs() { + assume() + .withMessage( + "Solver %s does not support making UFs with Boolean return values", solverToUse()) + .that(solverToUse()) + .isNotEqualTo(Solvers.MATHSAT5); + } + + /** Skip test if the solver does not support Booleans as arguments in Arrays. */ + protected final void requireBooleanArgumentArrays() { + assume() + .withMessage( + "Solver %s does not support making Arrays with Bool as arguments", solverToUse()) + .that(solverToUse()) + .isNoneOf(Solvers.MATHSAT5, Solvers.SMTINTERPOL); + } + + /** Skip test if the solver does not support any other sort than bitvector in Arrays. */ + protected final void requireAllSortArrays() { + assume() + .withMessage( + "Solver %s does not support making Arrays with sorts other than bitvectors", + solverToUse()) + .that(solverToUse()) + .isNotEqualTo(Solvers.BOOLECTOR); + } + + /** Skip test if the solver does not support UFs without arguments. */ + protected final void requireNoArgumentsInUFs() { + assume() + .withMessage("Solver %s does not support making UFs without input Arguments", solverToUse()) + .that(solverToUse()) + .isNotEqualTo(Solvers.BOOLECTOR); + } + /** Skip test if the solver does not support integers. */ protected final void requireIntegers() { assume() @@ -239,6 +282,8 @@ protected final void requireQuantifiers() { .withMessage("Solver %s does not support quantifiers", solverToUse()) .that(qmgr) .isNotNull(); + // FIXME: Disabled while we're testing the binary backend + assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); } /** Skip test if the solver does not support arrays. */ @@ -297,6 +342,8 @@ protected final void requireInterpolation() { .that(e) .isNull(); } + // FIXME: Disabled while we're testing the binary backend + assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); } protected void requireParser() { @@ -304,6 +351,8 @@ protected void requireParser() { .withMessage("Solver %s does not support parsing formulae", solverToUse()) .that(solverToUse()) .isNoneOf(Solvers.CVC4, Solvers.BOOLECTOR, Solvers.YICES2, Solvers.CVC5); + // FIXME: Disabled while we're testing the binary backend + assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); } protected void requireArrayModel() { diff --git a/src/org/sosy_lab/java_smt/test/SolverConcurrencyTest.java b/src/org/sosy_lab/java_smt/test/SolverConcurrencyTest.java index 3f9e1da75a..77dc9b1861 100644 --- a/src/org/sosy_lab/java_smt/test/SolverConcurrencyTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverConcurrencyTest.java @@ -64,6 +64,11 @@ public class SolverConcurrencyTest { private static final int NUMBER_OF_THREADS = 4; private static final int TIMEOUT_SECONDS = 30; + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } + /** * As some Solvers are slower/faster, we choose an appropriate number of formulas to solve here. */ diff --git a/src/org/sosy_lab/java_smt/test/SolverContextFactoryTest.java b/src/org/sosy_lab/java_smt/test/SolverContextFactoryTest.java index 5d9523999a..a3e6619de2 100644 --- a/src/org/sosy_lab/java_smt/test/SolverContextFactoryTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverContextFactoryTest.java @@ -37,6 +37,10 @@ */ @RunWith(Parameterized.class) public class SolverContextFactoryTest { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private static final String OS = StandardSystemProperty.OS_NAME.value().toLowerCase(Locale.getDefault()).replace(" ", ""); diff --git a/src/org/sosy_lab/java_smt/test/SolverContextTest.java b/src/org/sosy_lab/java_smt/test/SolverContextTest.java index e74606355c..fb8d352b85 100644 --- a/src/org/sosy_lab/java_smt/test/SolverContextTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverContextTest.java @@ -11,11 +11,16 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.TruthJUnit.assume; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.BooleanFormula; public class SolverContextTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Test public void testMultipleContextClose() { diff --git a/src/org/sosy_lab/java_smt/test/SolverFormulaIODeclarationsTest.java b/src/org/sosy_lab/java_smt/test/SolverFormulaIODeclarationsTest.java index 2ea0975084..b41f98fd62 100644 --- a/src/org/sosy_lab/java_smt/test/SolverFormulaIODeclarationsTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverFormulaIODeclarationsTest.java @@ -9,6 +9,7 @@ package org.sosy_lab.java_smt.test; import static com.google.common.truth.Truth.assert_; +import static com.google.common.truth.TruthJUnit.assume; import static org.junit.Assert.assertThrows; import static org.sosy_lab.java_smt.api.FormulaType.BooleanType; import static org.sosy_lab.java_smt.api.FormulaType.IntegerType; @@ -25,6 +26,10 @@ public class SolverFormulaIODeclarationsTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Before public void checkThatSolverIsAvailable() { diff --git a/src/org/sosy_lab/java_smt/test/SolverFormulaIOTest.java b/src/org/sosy_lab/java_smt/test/SolverFormulaIOTest.java index 7f4c231545..3345b15caf 100644 --- a/src/org/sosy_lab/java_smt/test/SolverFormulaIOTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverFormulaIOTest.java @@ -21,6 +21,7 @@ import com.google.common.truth.TruthJUnit; import java.util.List; import java.util.function.Supplier; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.BitvectorFormula; @@ -32,6 +33,11 @@ @SuppressWarnings("checkstyle:linelength") public class SolverFormulaIOTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } + private static final String MATHSAT_DUMP1 = "(set-info :source |printed by MathSAT|)\n" + "(declare-fun a () Bool)\n" diff --git a/src/org/sosy_lab/java_smt/test/SolverFormulaWithAssumptionsTest.java b/src/org/sosy_lab/java_smt/test/SolverFormulaWithAssumptionsTest.java index 2bef74b3ef..41e8c4df13 100644 --- a/src/org/sosy_lab/java_smt/test/SolverFormulaWithAssumptionsTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverFormulaWithAssumptionsTest.java @@ -17,6 +17,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.common.configuration.InvalidConfigurationException; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; @@ -29,6 +30,10 @@ public class SolverFormulaWithAssumptionsTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } // INFO: OpenSmt only support interpolation for QF_LIA, QF_LRA and QF_UF @Override diff --git a/src/org/sosy_lab/java_smt/test/SolverStackInterpolationTest.java b/src/org/sosy_lab/java_smt/test/SolverStackInterpolationTest.java index dd49e2c03d..931ccee8c3 100644 --- a/src/org/sosy_lab/java_smt/test/SolverStackInterpolationTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverStackInterpolationTest.java @@ -17,7 +17,6 @@ import org.sosy_lab.java_smt.solvers.opensmt.Logics; public class SolverStackInterpolationTest extends SolverStackTest0 { - @Override protected Logics logicToUse() { return Logics.QF_LIA; diff --git a/src/org/sosy_lab/java_smt/test/SolverStackTest0.java b/src/org/sosy_lab/java_smt/test/SolverStackTest0.java index 94617e98c2..6ab0ca7c00 100644 --- a/src/org/sosy_lab/java_smt/test/SolverStackTest0.java +++ b/src/org/sosy_lab/java_smt/test/SolverStackTest0.java @@ -19,6 +19,7 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.List; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.common.UniqueIdGenerator; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; @@ -36,6 +37,10 @@ @SuppressWarnings("resource") public abstract class SolverStackTest0 extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } protected abstract BasicProverEnvironment newEnvironmentForTest( SolverContext pContext, ProverOptions... options); diff --git a/src/org/sosy_lab/java_smt/test/SolverTacticsTest.java b/src/org/sosy_lab/java_smt/test/SolverTacticsTest.java index db5b9841ae..a0d1f1c7bf 100644 --- a/src/org/sosy_lab/java_smt/test/SolverTacticsTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverTacticsTest.java @@ -10,6 +10,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assert_; +import static com.google.common.truth.TruthJUnit.assume; import static org.sosy_lab.java_smt.api.FormulaType.BooleanType; import static org.sosy_lab.java_smt.api.FormulaType.IntegerType; @@ -18,6 +19,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.BooleanFormula; @@ -33,6 +35,10 @@ @SuppressWarnings("LocalVariableName") public class SolverTacticsTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Test public void nnfTacticDefaultTest1() throws SolverException, InterruptedException { @@ -199,7 +205,7 @@ public void ufEliminationNestedUfsTest() throws SolverException, InterruptedExce } @Test - public void ufEliminationNesteQuantifierTest() throws InterruptedException { + public void ufEliminationNestedQuantifierTest() throws InterruptedException { requireIntegers(); requireQuantifiers(); // f := exists v1,v2v,v3,v4 : uf(v1, v3) == uf(v2, v4) @@ -220,6 +226,7 @@ public void ufEliminationNesteQuantifierTest() throws InterruptedException { mgr.applyTactic(f, Tactic.ACKERMANNIZATION); assert_().fail(); } catch (IllegalArgumentException expected) { + // Ignore the exception } } diff --git a/src/org/sosy_lab/java_smt/test/SolverTheoriesTest.java b/src/org/sosy_lab/java_smt/test/SolverTheoriesTest.java index a8cc9081d8..54ff808b73 100644 --- a/src/org/sosy_lab/java_smt/test/SolverTheoriesTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverTheoriesTest.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.Random; import org.junit.AssumptionViolatedException; +import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; @@ -37,6 +38,10 @@ @SuppressWarnings("LocalVariableName") public class SolverTheoriesTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } @Test public void basicBoolTest() throws SolverException, InterruptedException { @@ -737,11 +742,6 @@ public void testMakeBitVectorArray() { requireArrays(); requireBitvectors(); - assume() - .withMessage("Solver does not support bit-vector arrays.") - .that(solver) - .isNotEqualTo(Solvers.PRINCESS); - BitvectorFormula _i = mgr.getBitvectorFormulaManager().makeVariable(64, "i"); ArrayFormula _b = amgr.makeArray( @@ -755,6 +755,9 @@ public void testMakeBitVectorArray() { // Mathsat5 has a different internal representation of the formula assertThat(_b_at_i.toString()).isEqualTo("(`read_T(18)_T(20)` b i)"); break; + case PRINCESS: + assertThat(_b_at_i.toString()).isEqualTo("select(b, i)"); + break; case BOOLECTOR: assume() .withMessage("Solver %s does not printing formulae.", solverToUse()) @@ -798,11 +801,6 @@ public void testNestedBitVectorArray() { requireBitvectors(); requireIntegers(); - assume() - .withMessage("Solver does not support bit-vector arrays.") - .that(solver) - .isNotEqualTo(Solvers.PRINCESS); - IntegerFormula _i = imgr.makeVariable("i"); ArrayFormula> multi = amgr.makeArray( @@ -818,6 +816,9 @@ public void testNestedBitVectorArray() { String readWrite = "(`read_int_T(18)` (`read_int_T(19)` multi i) i)"; assertThat(valueInMulti.toString()).isEqualTo(readWrite); break; + case PRINCESS: + assertThat(valueInMulti.toString()).isEqualTo("select(select(multi, i), i)"); + break; default: assertThat(valueInMulti.toString()).isEqualTo("(select (select multi i) i)"); } diff --git a/src/org/sosy_lab/java_smt/test/SolverThreadLocalityTest.java b/src/org/sosy_lab/java_smt/test/SolverThreadLocalityTest.java index 2cda68f4f0..90c7e19519 100644 --- a/src/org/sosy_lab/java_smt/test/SolverThreadLocalityTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverThreadLocalityTest.java @@ -47,6 +47,7 @@ public class SolverThreadLocalityTest extends SolverBasedTest0.ParameterizedSolv @Before public void makeThreads() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); executor = Executors.newFixedThreadPool(2); } diff --git a/src/org/sosy_lab/java_smt/test/SolverVisitorTest.java b/src/org/sosy_lab/java_smt/test/SolverVisitorTest.java index 8a7eb0eb1d..ba02c9a7c5 100644 --- a/src/org/sosy_lab/java_smt/test/SolverVisitorTest.java +++ b/src/org/sosy_lab/java_smt/test/SolverVisitorTest.java @@ -59,6 +59,10 @@ import org.sosy_lab.java_smt.api.visitors.TraversalProcess; public class SolverVisitorTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } /** visit a formula and fail on OTHER, i.e., unexpected function declaration type. */ private final class FunctionDeclarationVisitorNoOther diff --git a/src/org/sosy_lab/java_smt/test/StringFormulaManagerTest.java b/src/org/sosy_lab/java_smt/test/StringFormulaManagerTest.java index 98bd7e8d4b..031edb32e0 100644 --- a/src/org/sosy_lab/java_smt/test/StringFormulaManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/StringFormulaManagerTest.java @@ -30,6 +30,10 @@ @SuppressWarnings("ConstantConditions") @SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE", justification = "test code") public class StringFormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private static final ImmutableList WORDS = ImmutableList.of( diff --git a/src/org/sosy_lab/java_smt/test/StringSMTLIB2GeneratorTest.java b/src/org/sosy_lab/java_smt/test/StringSMTLIB2GeneratorTest.java new file mode 100644 index 0000000000..551a95a70b --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/StringSMTLIB2GeneratorTest.java @@ -0,0 +1,257 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; + +import java.util.List; +import java.util.Objects; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.RegexFormula; +import org.sosy_lab.java_smt.api.StringFormula; +import org.sosy_lab.java_smt.basicimpl.Generator; + +public class StringSMTLIB2GeneratorTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Test + public void testMakeStringVariable() { + requireStrings(); + StringFormula a = Objects.requireNonNull(smgr).makeVariable("a"); + StringFormula test = Objects.requireNonNull(smgr).makeVariable("test"); + BooleanFormula constraint = smgr.equal(a, test); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a String)\n" + "(declare-const test String)\n" + "(assert (= a test))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testMakeString() { + requireStrings(); + StringFormula a = Objects.requireNonNull(smgr).makeString("a"); + StringFormula b = Objects.requireNonNull(smgr).makeVariable("a"); + BooleanFormula constraint = smgr.equal(a, b); + Generator.assembleConstraint(constraint); + String actualResult = String.valueOf(Generator.getLines()); + String expectedResult = "(declare-const a String)\n" + "(assert (= \"a\" a))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testConcat() { + requireStrings(); + StringFormula a = smgr.makeVariable("a"); + StringFormula b = smgr.makeVariable("b"); + StringFormula result = smgr.makeVariable("result"); + BooleanFormula constraint = smgr.equal(smgr.concat(a, b), result); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const a String)\n" + + "(declare-const b String)\n" + + "(declare-const result String)\n" + + "(assert (= (str.++ a b) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testContains() { + requireStrings(); + StringFormula str = Objects.requireNonNull(smgr).makeVariable("str"); + StringFormula part = smgr.makeString("part"); + BooleanFormula constraint = smgr.contains(str, part); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const str String)\n" + "(assert (str.contains str \"part\"))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testIndexOf() { + requireStrings(); + StringFormula str = Objects.requireNonNull(smgr).makeVariable("str"); + StringFormula part = smgr.makeString("find"); + IntegerFormula startIndex = imgr.makeNumber(0); + IntegerFormula result = imgr.makeVariable("result"); + Generator.assembleConstraint(imgr.equal(smgr.indexOf(str, part, startIndex), result)); + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const str String)\n" + + "(declare-const result Int)\n" + + "(assert (= (str.indexof str \"find\" 0) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testStringMultipleConcat() { + requireStrings(); + StringFormula a = Objects.requireNonNull(smgr).makeVariable("a"); + StringFormula b = Objects.requireNonNull(smgr).makeVariable("b"); + StringFormula c = Objects.requireNonNull(smgr).makeVariable("c"); + StringFormula d = Objects.requireNonNull(smgr).makeVariable("d"); + BooleanFormula result = smgr.equal(d, smgr.concat(a, b, c)); + + String expectedResult = + "(declare-const d String)\n" + + "(declare-const a String)\n" + + "(declare-const b String)\n" + + "(declare-const c String)\n" + + "(assert (= d (str.++ a b c)))\n"; + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testRegexMultipleConcat() { + requireStrings(); + RegexFormula a = Objects.requireNonNull(smgr).makeRegex("a"); + RegexFormula b = Objects.requireNonNull(smgr).makeRegex("b"); + RegexFormula c = Objects.requireNonNull(smgr).makeRegex("c"); + StringFormula d = Objects.requireNonNull(smgr).makeVariable("d"); + BooleanFormula result = smgr.in(d, smgr.concatRegex(List.of(a, b, c))); + String expectedResult = + "(declare-const d String)\n" + + "(assert (str.in_re d (re.++ (str.to_re \"a\") (str.to_re \"b\") (str.to_re" + + " \"c\"))))\n"; + Generator.assembleConstraint(result); + String actualResult = String.valueOf(Generator.getLines()); + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testSubstring() { + requireStrings(); + + StringFormula str = Objects.requireNonNull(smgr).makeVariable("str"); + IntegerFormula startIndex = imgr.makeNumber(2); + IntegerFormula length = imgr.makeNumber(4); + StringFormula result = smgr.makeVariable("result"); + + Generator.assembleConstraint(smgr.equal(smgr.substring(str, startIndex, length), result)); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const str String)\n" + + "(declare-const result String)\n" + + "(assert (= (str.substr str 2 4) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testReplace() { + requireStrings(); + StringFormula str = Objects.requireNonNull(smgr).makeVariable("str"); + StringFormula target = smgr.makeString("target"); + StringFormula replacement = smgr.makeString("replace"); + StringFormula result = smgr.makeVariable("result"); + + Generator.assembleConstraint(smgr.equal(smgr.replace(str, target, replacement), result)); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const str String)\n" + + "(declare-const result String)\n" + + "(assert (= (str.replace str \"target\" \"replace\") result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testLength() { + requireStrings(); + StringFormula str = Objects.requireNonNull(smgr).makeVariable("str"); + IntegerFormula result = imgr.makeVariable("result"); + + Generator.assembleConstraint(imgr.equal(smgr.length(str), result)); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const str String)\n" + + "(declare-const result Int)\n" + + "(assert (= (str.len str) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testInRegex() { + requireStrings(); + StringFormula str = Objects.requireNonNull(smgr).makeVariable("str"); + BooleanFormula result = smgr.in(str, smgr.makeRegex(".*test.*")); + + Generator.assembleConstraint(result); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const str String)\n" + "(assert (str.in_re str (str.to_re \".*test.*\")))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testToInteger() { + requireStrings(); + StringFormula str = Objects.requireNonNull(smgr).makeVariable("str"); + IntegerFormula result = imgr.makeVariable("result"); + + Generator.assembleConstraint(imgr.equal(smgr.toIntegerFormula(str), result)); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const str String)\n" + + "(declare-const result Int)\n" + + "(assert (= (str.to_int str) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testToString() { + requireStrings(); + StringFormula result = Objects.requireNonNull(smgr).makeVariable("result"); + IntegerFormula number = imgr.makeNumber("42"); + + Generator.assembleConstraint(smgr.equal(smgr.toStringFormula(number), result)); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-const result String)\n" + "(assert (= (str.from_int 42) result))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } +} diff --git a/src/org/sosy_lab/java_smt/test/TimeoutTest.java b/src/org/sosy_lab/java_smt/test/TimeoutTest.java index 80af046e9a..cf3ab3fca9 100644 --- a/src/org/sosy_lab/java_smt/test/TimeoutTest.java +++ b/src/org/sosy_lab/java_smt/test/TimeoutTest.java @@ -8,6 +8,7 @@ package org.sosy_lab.java_smt.test; +import static com.google.common.truth.TruthJUnit.assume; import static org.junit.Assert.assertThrows; import com.google.common.truth.TruthJUnit; @@ -15,6 +16,7 @@ import java.util.List; import java.util.Random; import java.util.function.Supplier; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -29,6 +31,10 @@ /** Check that timeout is handled gracefully. */ @RunWith(Parameterized.class) public class TimeoutTest extends SolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private static final int TIMOUT_MILLISECONDS = 10000; diff --git a/src/org/sosy_lab/java_smt/test/TranslateFormulaTest.java b/src/org/sosy_lab/java_smt/test/TranslateFormulaTest.java index f789912019..b59527b5d1 100644 --- a/src/org/sosy_lab/java_smt/test/TranslateFormulaTest.java +++ b/src/org/sosy_lab/java_smt/test/TranslateFormulaTest.java @@ -38,14 +38,21 @@ /** Testing formula serialization. */ @RunWith(Parameterized.class) public class TranslateFormulaTest { - private final LogManager logger = LogManager.createTestLogManager(); - private SolverContext from; private SolverContext to; private FormulaManager managerFrom; private FormulaManager managerTo; + @Before + public void excludeSolverless() { + assume() + .withMessage("Solverless should be excluded from all tests") + .that(translateFrom) + .isNotEqualTo(Solvers.SOLVERLESS); + assume().that(translateTo).isNotEqualTo(Solvers.SOLVERLESS); + } + @Parameter(0) public Solvers translateFrom; @@ -93,14 +100,16 @@ private void requireParserTo() { assume() .withMessage("Solver %s does not support parsing formulae", translateTo) .that(translateTo) - .isNoneOf(Solvers.CVC4, Solvers.BOOLECTOR, Solvers.YICES2, Solvers.CVC5); + .isNoneOf( + Solvers.CVC4, Solvers.BOOLECTOR, Solvers.YICES2, Solvers.CVC5, Solvers.SOLVERLESS); } private void requireParserFrom() { assume() .withMessage("Solver %s does not support parsing formulae", translateFrom) .that(translateFrom) - .isNoneOf(Solvers.CVC4, Solvers.BOOLECTOR, Solvers.YICES2, Solvers.CVC5); + .isNoneOf( + Solvers.CVC4, Solvers.BOOLECTOR, Solvers.YICES2, Solvers.CVC5, Solvers.SOLVERLESS); } private void requireIntegers() { @@ -157,7 +166,7 @@ public void testTranslatingForContextSibling() throws SolverException, Interrupt assume() .withMessage("Solver does not support shared terms or dump/parse") .that(translateTo) - .isNoneOf(Solvers.CVC4, Solvers.CVC5, Solvers.YICES2); + .isNoneOf(Solvers.CVC4, Solvers.CVC5, Solvers.YICES2, Solvers.SOLVERLESS); BooleanFormula inputFrom = createTestFormula(managerFrom); BooleanFormula inputTo = createTestFormula(managerTo); diff --git a/src/org/sosy_lab/java_smt/test/UFManagerTest.java b/src/org/sosy_lab/java_smt/test/UFManagerTest.java index 9a8fa079e5..c9ea4fc327 100644 --- a/src/org/sosy_lab/java_smt/test/UFManagerTest.java +++ b/src/org/sosy_lab/java_smt/test/UFManagerTest.java @@ -14,6 +14,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.truth.Truth; import java.util.List; +import org.junit.Before; import org.junit.Test; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.Formula; @@ -26,6 +27,10 @@ import org.sosy_lab.java_smt.api.visitors.ExpectedFormulaVisitor; public class UFManagerTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private static final ImmutableList VALID_NAMES = ImmutableList.of("Func", "(Func)"); diff --git a/src/org/sosy_lab/java_smt/test/UFSMTLIB2GeneratorTest.java b/src/org/sosy_lab/java_smt/test/UFSMTLIB2GeneratorTest.java new file mode 100644 index 0000000000..9d7cb7aa58 --- /dev/null +++ b/src/org/sosy_lab/java_smt/test/UFSMTLIB2GeneratorTest.java @@ -0,0 +1,592 @@ +// This file is part of JavaSMT, +// an API wrapper for a collection of SMT solvers: +// https://github.com/sosy-lab/java-smt +// +// SPDX-FileCopyrightText: 2024 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 + +package org.sosy_lab.java_smt.test; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; + +import java.util.ArrayList; +import java.util.Objects; +import org.junit.Test; +import org.sosy_lab.common.configuration.ConfigurationBuilder; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.ArrayFormula; +import org.sosy_lab.java_smt.api.BitvectorFormula; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.FormulaType; +import org.sosy_lab.java_smt.api.FunctionDeclaration; +import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; +import org.sosy_lab.java_smt.api.NumeralFormula.RationalFormula; +import org.sosy_lab.java_smt.basicimpl.Generator; + +public class UFSMTLIB2GeneratorTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + + @Override + protected ConfigurationBuilder createTestConfigBuilder() { + ConfigurationBuilder newConfig = super.createTestConfigBuilder(); + return newConfig.setOption("solver.generateSMTLIB2", String.valueOf(true)); + } + + @Test + public void testDeclareUFBooleanWithInput() { + requireBooleanUFs(); + FunctionDeclaration a = + fmgr.declareUF("a", FormulaType.BooleanType, FormulaType.BooleanType); + FunctionDeclaration b = + fmgr.declareUF("b", FormulaType.BooleanType, FormulaType.BooleanType); + + BooleanFormula c = fmgr.callUF(a, bmgr.makeFalse()); + BooleanFormula d = fmgr.callUF(b, bmgr.makeTrue()); + + BooleanFormula constraint = bmgr.equivalence(c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a (Bool) Bool)\n" + + "(declare-fun b (Bool) Bool)\n" + + "(assert (= (a false) (b true)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFBooleanEmptyInput() { + requireBooleanUFs(); + requireNoArgumentsInUFs(); + assume() + .withMessage("Bitwuzla does not support 0 arity UFs") + .that(solverToUse()) + .isNotEqualTo(Solvers.BITWUZLA); + FunctionDeclaration a = fmgr.declareUF("a", FormulaType.BooleanType); + FunctionDeclaration b = fmgr.declareUF("b", FormulaType.BooleanType); + + BooleanFormula c = fmgr.callUF(a); + BooleanFormula d = fmgr.callUF(b); + + BooleanFormula constraint = bmgr.equivalence(c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a () Bool)\n" + "(declare-fun b () Bool)\n" + "(assert (= a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFIntegerWithInput() { + requireIntegers(); + FunctionDeclaration a = + fmgr.declareUF("a", FormulaType.IntegerType, FormulaType.IntegerType); + FunctionDeclaration b = + fmgr.declareUF("b", FormulaType.IntegerType, FormulaType.IntegerType); + + IntegerFormula c = fmgr.callUF(a, imgr.makeNumber(4)); + IntegerFormula d = fmgr.callUF(b, imgr.makeNumber(9)); + + BooleanFormula constraint = imgr.equal(c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a (Int) Int)\n" + + "(declare-fun b (Int) Int)\n" + + "(assert (= (a 4) (b 9)))" + + "\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFIntegerWithoutInput() { + requireIntegers(); + requireNoArgumentsInUFs(); + FunctionDeclaration a = fmgr.declareUF("a", FormulaType.IntegerType); + FunctionDeclaration b = fmgr.declareUF("b", FormulaType.IntegerType); + + IntegerFormula c = fmgr.callUF(a); + IntegerFormula d = fmgr.callUF(b); + + BooleanFormula constraint = imgr.equal(c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a () Int)\n" + "(declare-fun b () Int)\n" + "(assert (= a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFRationalWithInput() { + requireRationals(); + FunctionDeclaration a = + fmgr.declareUF("a", FormulaType.RationalType, FormulaType.RationalType); + FunctionDeclaration b = + fmgr.declareUF("b", FormulaType.RationalType, FormulaType.RationalType); + + RationalFormula c = fmgr.callUF(a, Objects.requireNonNull(rmgr).makeNumber(4)); + RationalFormula d = fmgr.callUF(b, Objects.requireNonNull(rmgr).makeNumber(9)); + + BooleanFormula constraint = rmgr.equal(c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a (Real) Real)\n" + + "(declare-fun b (Real) Real)\n" + + "(assert (= (a 4) (b " + + "9)))" + + "\n"; + + String expectedResultSMTInterpol = + "(declare-fun a (Real) Real)\n" + + "(declare-fun b (Real) Real)\n" + + "(assert (= (a 4.0) " + + "(b 9.0)))\n"; + + assertThat( + actualResult.equals(expectedResult) || actualResult.equals(expectedResultSMTInterpol)) + .isTrue(); + } + + @Test + public void testDeclareUFRationalEmptyInput() { + requireRationals(); + requireNoArgumentsInUFs(); + FunctionDeclaration a = fmgr.declareUF("a", FormulaType.RationalType); + FunctionDeclaration b = fmgr.declareUF("b", FormulaType.RationalType); + + RationalFormula c = fmgr.callUF(a); + RationalFormula d = fmgr.callUF(b); + + BooleanFormula constraint = Objects.requireNonNull(rmgr).equal(c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a () Real)\n" + "(declare-fun b () Real)\n" + "(assert (= a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFBitvectorsWithInput() { + requireBitvectors(); + FunctionDeclaration a = + fmgr.declareUF( + "a", FormulaType.getBitvectorTypeWithSize(4), FormulaType.getBitvectorTypeWithSize(4)); + FunctionDeclaration b = + fmgr.declareUF( + "b", FormulaType.getBitvectorTypeWithSize(4), FormulaType.getBitvectorTypeWithSize(4)); + + BitvectorFormula c = fmgr.callUF(a, Objects.requireNonNull(bvmgr).makeBitvector(4, 2)); + BitvectorFormula d = fmgr.callUF(b, Objects.requireNonNull(bvmgr).makeBitvector(4, 3)); + + BooleanFormula constraint = bvmgr.equal(c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a ((_ BitVec 4)) (_ BitVec 4))\n" + + "(declare-fun b ((_ BitVec 4)) (_ BitVec 4))\n" + + "(assert (= (a #b0010) (b #b0011)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFBitvectorsEmptyInput() { + requireBitvectors(); + requireNoArgumentsInUFs(); + assume() + .withMessage("Bitwuzla does not support 0 arity UFs") + .that(solverToUse()) + .isNotEqualTo(Solvers.BITWUZLA); + FunctionDeclaration a = + fmgr.declareUF("a", FormulaType.getBitvectorTypeWithSize(4)); + FunctionDeclaration b = + fmgr.declareUF("b", FormulaType.getBitvectorTypeWithSize(4)); + + BitvectorFormula c = fmgr.callUF(a); + BitvectorFormula d = fmgr.callUF(b); + + BooleanFormula constraint = Objects.requireNonNull(bvmgr).equal(c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a () (_ BitVec 4))\n" + + "(declare-fun b () (_ BitVec 4))\n" + + "(assert (= a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFArraysWithInput() { + requireArrays(); + requireIntegers(); + FunctionDeclaration> a = + fmgr.declareUF( + "a", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + FunctionDeclaration> b = + fmgr.declareUF( + "b", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType( + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + FunctionDeclaration constr = + fmgr.declareUF( + "constr", + FormulaType.BooleanType, + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType)); + + ArrayFormula c = + fmgr.callUF( + a, + Objects.requireNonNull(amgr) + .makeArray( + "test", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + ArrayFormula d = + fmgr.callUF( + b, + Objects.requireNonNull(amgr) + .makeArray( + "test", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + + BooleanFormula constraint = fmgr.callUF(constr, c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun constr ((Array Int Int)(Array Int Int)) Bool)\n" + + "(declare-fun a ((Array (Array Int Int) Int)) (Array Int Int))\n" + + "(declare-const test (Array (Array Int Int) Int))\n" + + "(declare-fun b ((Array (Array Int Int) Int)) (Array Int Int))\n" + + "(assert (constr (a test) (b test)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareUFArraysEmptyInput() { + requireArrays(); + requireIntegers(); + requireNoArgumentsInUFs(); + FunctionDeclaration> a = + fmgr.declareUF( + "a", FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType)); + FunctionDeclaration> b = + fmgr.declareUF( + "b", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + new ArrayList<>()); + FunctionDeclaration constr = + fmgr.declareUF( + "constr", + FormulaType.BooleanType, + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType)); + + ArrayFormula c = fmgr.callUF(a); + ArrayFormula d = fmgr.callUF(b); + + BooleanFormula constraint = fmgr.callUF(constr, c, d); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun constr ((Array Int Int)(Array Int Int)) Bool)\n" + + "(declare-fun a () (Array Int Int))\n" + + "(declare-fun b () (Array Int Int))\n" + + "(assert (constr a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFBooleanWithInput() { + requireBooleanUFs(); + BooleanFormula a = fmgr.declareAndCallUF("a", FormulaType.BooleanType, bmgr.makeFalse()); + BooleanFormula b = fmgr.declareAndCallUF("b", FormulaType.BooleanType, bmgr.makeTrue()); + + BooleanFormula constraint = bmgr.equivalence(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a (Bool) Bool)\n" + + "(declare-fun b (Bool) Bool)\n" + + "(assert (= (a false) (b true)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFBooleanEmptyInput() { + requireBooleanUFs(); + requireNoArgumentsInUFs(); + assume() + .withMessage("Bitwuzla does not support 0 arity UFs") + .that(solverToUse()) + .isNotEqualTo(Solvers.BITWUZLA); + BooleanFormula a = fmgr.declareAndCallUF("a", FormulaType.BooleanType); + BooleanFormula b = fmgr.declareAndCallUF("b", FormulaType.BooleanType); + + BooleanFormula constraint = bmgr.equivalence(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a () Bool)\n" + "(declare-fun b () Bool)\n" + "(assert (= a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFIntegerWithInput() { + requireIntegers(); + IntegerFormula a = fmgr.declareAndCallUF("a", FormulaType.IntegerType, imgr.makeNumber(4)); + IntegerFormula b = fmgr.declareAndCallUF("b", FormulaType.IntegerType, imgr.makeNumber(9)); + + BooleanFormula constraint = imgr.equal(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a (Int) Int)\n" + + "(declare-fun b (Int) Int)\n" + + "(assert (= (a 4) (b 9)))" + + "\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFIntegerEmptyInput() { + requireIntegers(); + requireNoArgumentsInUFs(); + IntegerFormula a = fmgr.declareAndCallUF("a", FormulaType.IntegerType); + IntegerFormula b = fmgr.declareAndCallUF("b", FormulaType.IntegerType); + + BooleanFormula constraint = imgr.equal(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a () Int)\n" + "(declare-fun b () Int)\n" + "(assert (= a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFRationalWithInput() { + requireRationals(); + RationalFormula a = + fmgr.declareAndCallUF( + "a", FormulaType.RationalType, Objects.requireNonNull(rmgr).makeNumber(4)); + RationalFormula b = fmgr.declareAndCallUF("b", FormulaType.RationalType, rmgr.makeNumber(9)); + + BooleanFormula constraint = rmgr.equal(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a (Real) Real)\n" + + "(declare-fun b (Real) Real)\n" + + "(assert (= (a 4) (b " + + "9)))\n"; + + String expectedResultSMTInterpol = + "(declare-fun a (Real) Real)\n" + + "(declare-fun b (Real) Real)\n" + + "(assert (= (a 4.0) " + + "(b 9.0)))\n"; + + assertThat( + expectedResult.equals(actualResult) || actualResult.equals(expectedResultSMTInterpol)) + .isTrue(); + } + + @Test + public void testDeclareAndCallUFRationalEmptyInput() { + requireRationals(); + requireNoArgumentsInUFs(); + RationalFormula a = fmgr.declareAndCallUF("a", FormulaType.RationalType); + RationalFormula b = fmgr.declareAndCallUF("b", FormulaType.RationalType); + + BooleanFormula constraint = Objects.requireNonNull(rmgr).equal(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a () Real)\n" + "(declare-fun b () Real)\n" + "(assert (= a b))\n"; + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFBitvectorsWithInput() { + requireBitvectors(); + BitvectorFormula a = + fmgr.declareAndCallUF( + "a", + FormulaType.getBitvectorTypeWithSize(4), + Objects.requireNonNull(bvmgr).makeBitvector(4, 2)); + BitvectorFormula b = + fmgr.declareAndCallUF( + "b", FormulaType.getBitvectorTypeWithSize(4), bvmgr.makeBitvector(4, 2)); + + BooleanFormula constraint = bvmgr.equal(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a ((_ BitVec 4)) (_ BitVec 4))\n" + + "(declare-fun b ((_ BitVec 4)) (_ BitVec 4))\n" + + "(assert (= (a #b0010) (b #b0010)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFBitvectorsEmptyInput() { + requireBitvectors(); + requireNoArgumentsInUFs(); + assume() + .withMessage("Bitwuzla does not support 0 arity UFs") + .that(solverToUse()) + .isNotEqualTo(Solvers.BITWUZLA); + BitvectorFormula a = fmgr.declareAndCallUF("a", FormulaType.getBitvectorTypeWithSize(4)); + BitvectorFormula b = fmgr.declareAndCallUF("b", FormulaType.getBitvectorTypeWithSize(4)); + + BooleanFormula constraint = Objects.requireNonNull(bvmgr).equal(a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun a () (_ BitVec 4))\n" + + "(declare-fun b () (_ BitVec 4))\n" + + "(assert (= a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFArraysWithInput() { + requireArrays(); + requireIntegers(); + ArrayFormula a = + fmgr.declareAndCallUF( + "a", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + Objects.requireNonNull(amgr) + .makeArray( + "test", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + ArrayFormula b = + fmgr.declareAndCallUF( + "b", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + amgr.makeArray( + "test", + FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType), + FormulaType.IntegerType)); + + BooleanFormula constraint = fmgr.declareAndCallUF("constr", FormulaType.BooleanType, a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun constr ((Array Int Int)(Array Int Int)) Bool)\n" + + "(declare-fun a ((Array (Array Int Int) Int)) (Array Int Int))\n" + + "(declare-const test (Array (Array Int Int) Int))\n" + + "(declare-fun b ((Array (Array Int Int) Int)) (Array Int Int))\n" + + "(assert (constr (a test) (b test)))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } + + @Test + public void testDeclareAndCallUFArraysEmptyInput() { + requireArrays(); + requireIntegers(); + requireNoArgumentsInUFs(); + ArrayFormula a = + fmgr.declareAndCallUF( + "a", FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType)); + ArrayFormula b = + fmgr.declareAndCallUF( + "b", FormulaType.getArrayType(FormulaType.IntegerType, FormulaType.IntegerType)); + + BooleanFormula constraint = fmgr.declareAndCallUF("constr", FormulaType.BooleanType, a, b); + + Generator.assembleConstraint(constraint); + + String actualResult = String.valueOf(Generator.getLines()); + + String expectedResult = + "(declare-fun constr ((Array Int Int)(Array Int Int)) Bool)\n" + + "(declare-fun a () (Array Int Int))\n" + + "(declare-fun b () (Array Int Int))\n" + + "(assert (constr a b))\n"; + + assertThat(actualResult).isEqualTo(expectedResult); + } +} diff --git a/src/org/sosy_lab/java_smt/test/UfEliminationTest.java b/src/org/sosy_lab/java_smt/test/UfEliminationTest.java index c2e40f1d13..d25375722a 100644 --- a/src/org/sosy_lab/java_smt/test/UfEliminationTest.java +++ b/src/org/sosy_lab/java_smt/test/UfEliminationTest.java @@ -31,6 +31,10 @@ import org.sosy_lab.java_smt.utils.UfElimination.Result; public class UfEliminationTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private UfElimination ackermannization; @@ -242,6 +246,7 @@ public void quantifierTest() { ackermannization.eliminateUfs(f); assert_().fail(); } catch (IllegalArgumentException expected) { + // Ignore the exception } } diff --git a/src/org/sosy_lab/java_smt/test/VariableNamesEscaperTest.java b/src/org/sosy_lab/java_smt/test/VariableNamesEscaperTest.java index 0e3a6cd039..1d6ffdf2de 100644 --- a/src/org/sosy_lab/java_smt/test/VariableNamesEscaperTest.java +++ b/src/org/sosy_lab/java_smt/test/VariableNamesEscaperTest.java @@ -16,7 +16,6 @@ /** inherits many tests from {@link VariableNamesTest}. */ public class VariableNamesEscaperTest extends VariableNamesTest { - @Override boolean allowInvalidNames() { return false; diff --git a/src/org/sosy_lab/java_smt/test/VariableNamesInvalidTest.java b/src/org/sosy_lab/java_smt/test/VariableNamesInvalidTest.java index 49c1e19c2d..7e5ff1209f 100644 --- a/src/org/sosy_lab/java_smt/test/VariableNamesInvalidTest.java +++ b/src/org/sosy_lab/java_smt/test/VariableNamesInvalidTest.java @@ -8,13 +8,21 @@ package org.sosy_lab.java_smt.test; +import static com.google.common.truth.TruthJUnit.assume; + import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.junit.Before; import org.junit.Test; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.api.Formula; import org.sosy_lab.java_smt.api.FormulaType; @SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE") public class VariableNamesInvalidTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } // currently the only invalid String is the empty String diff --git a/src/org/sosy_lab/java_smt/test/VariableNamesTest.java b/src/org/sosy_lab/java_smt/test/VariableNamesTest.java index b743f74fcf..d1ab716e86 100644 --- a/src/org/sosy_lab/java_smt/test/VariableNamesTest.java +++ b/src/org/sosy_lab/java_smt/test/VariableNamesTest.java @@ -22,6 +22,7 @@ import java.util.Map; import java.util.function.BiFunction; import java.util.function.Function; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -43,6 +44,10 @@ @RunWith(Parameterized.class) @SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE") public class VariableNamesTest extends SolverBasedTest0 { + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } private static final ImmutableList NAMES = ImmutableList.of( diff --git a/src/org/sosy_lab/java_smt/test/example/PrettyPrinterTest.java b/src/org/sosy_lab/java_smt/test/example/PrettyPrinterTest.java index db0b86c512..3a11ac0ad0 100644 --- a/src/org/sosy_lab/java_smt/test/example/PrettyPrinterTest.java +++ b/src/org/sosy_lab/java_smt/test/example/PrettyPrinterTest.java @@ -11,9 +11,11 @@ package org.sosy_lab.java_smt.test.example; import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; import org.junit.Before; import org.junit.Test; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; import org.sosy_lab.java_smt.test.SolverBasedTest0.ParameterizedSolverBasedTest0; import org.sosy_lab.java_smt.utils.PrettyPrinter; import org.sosy_lab.java_smt.utils.PrettyPrinter.PrinterOption; @@ -39,6 +41,11 @@ public void init() { pp = new PrettyPrinter(context.getFormulaManager()); } + @Before + public void checkNotSolverless() { + assume().that(solverToUse()).isNotEqualTo(Solvers.SOLVERLESS); + } + @Test public void testPrettyPrintOnlyBoolean() { requireParser(); diff --git a/src/org/sosy_lab/java_smt/utils/ParseGenerateAndReparse.java b/src/org/sosy_lab/java_smt/utils/ParseGenerateAndReparse.java new file mode 100644 index 0000000000..5200f39ddd --- /dev/null +++ b/src/org/sosy_lab/java_smt/utils/ParseGenerateAndReparse.java @@ -0,0 +1,201 @@ +// Copyright (C) 2007-2016 Dirk Beyer +// SPDX-FileCopyrightText: 2025 2020 Dirk Beyer +// +// SPDX-License-Identifier: Apache-2.0 +package org.sosy_lab.java_smt.utils; + +import com.microsoft.z3.Context; +import com.microsoft.z3.Solver; +import com.microsoft.z3.Status; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Locale; +import org.sosy_lab.common.ShutdownManager; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.log.BasicLogManager; +import org.sosy_lab.common.log.LogManager; +import org.sosy_lab.java_smt.SolverContextFactory; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; +import org.sosy_lab.java_smt.api.BooleanFormula; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; +import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; +import org.sosy_lab.java_smt.api.SolverException; +import org.sosy_lab.java_smt.basicimpl.Generator; + +/** This file is meant for the Evaluation of the Parser/Generator. */ +class ParseGenerateAndReparse { + private ParseGenerateAndReparse() {} + + public static void main(String[] args) + throws InvalidConfigurationException, InterruptedException, SolverException { + if (args.length < 3) { + System.err.println("Usage: java ParseGenerateAndReparseTest "); + System.exit(1); + } + + String smt2FilePath = args[0]; + String smt2FileContent; + try { + smt2FileContent = Files.readString(Path.of(smt2FilePath), Charset.defaultCharset()); + } catch (IOException e) { + System.err.println("Fehler beim Lesen der SMT2-Datei: " + smt2FilePath); + e.printStackTrace(); + System.exit(1); + return; + } + + String solverName = args[1]; + Solvers solver; + try { + solver = Solvers.valueOf(solverName.toUpperCase(Locale.ROOT)); + } catch (IllegalArgumentException e) { + System.err.println("Invalid solver name: " + solverName); + System.exit(1); + return; + } + boolean expectedIsUnsat = false; + boolean foundInFile = false; + + if (smt2FileContent.contains("(set-info :status sat)")) { + expectedIsUnsat = false; + foundInFile = true; + } else if (smt2FileContent.contains("(set-info :status unsat)")) { + expectedIsUnsat = true; + foundInFile = true; + } + + String mode = args[2].toUpperCase(Locale.ROOT); + Configuration config = + Configuration.builder() + .setOption("solver.generateSMTLIB2", "true") + .setOption("solver.usedSolverBySolverLess", solverName) + .build(); + LogManager logger = BasicLogManager.create(config); + ShutdownManager shutdown = ShutdownManager.create(); + + if (mode.equals("GENERATE_AND_REPARSE")) { + // PARSE REGENERATE THEN NATIVE PARSE + try (SolverContext solverLessContext = + SolverContextFactory.createSolverContext( + config, logger, shutdown.getNotifier(), Solvers.SOLVERLESS)) { + + // JAVASMT'S PARSER + BooleanFormula formula = + solverLessContext.getFormulaManager().universalParseFromString(smt2FileContent); + // JAVASMT'S GENERATOR + Generator.assembleConstraint(formula); + String regenerated = Generator.getSMTLIB2String(); + // NATIVE PARSE + checkResult(checkNativeParseAndIsUnsat(solver, regenerated), expectedIsUnsat, foundInFile); + } catch (Exception pE) { + printError(pE); + } + } + if (mode.equals("NATIVE")) { + try { + // NATIVE PARSE + checkResult( + checkNativeParseAndIsUnsat(solver, smt2FileContent), expectedIsUnsat, foundInFile); + } catch (Exception pE) { + printError(pE); + } + } + if (mode.equals("PARSE")) { + try (SolverContext realSolverContext = + SolverContextFactory.createSolverContext( + config, logger, shutdown.getNotifier(), solver); + ProverEnvironment realProverEnvironment = + realSolverContext.newProverEnvironment(ProverOptions.GENERATE_MODELS)) { + try { + // JAVASMT'S PARSER + BooleanFormula javaSMTParsed = + realSolverContext.getFormulaManager().universalParseFromString(smt2FileContent); + realProverEnvironment.addConstraint(javaSMTParsed); + // JAVASMT'S PARSE + checkResult(realProverEnvironment.isUnsat(), expectedIsUnsat, foundInFile); + } catch (Exception pE) { + printError(pE); + } + } + } + } + + public static void checkResult( + boolean actualIsUnsat, boolean expectedIsUnsat, boolean foundInFile) { + if (foundInFile) { + if (actualIsUnsat != expectedIsUnsat) { + System.out.println( + "FALSE: actualIsUnsat :" + + actualIsUnsat + + " does not match expectedIsUnsat :" + + expectedIsUnsat); + System.exit(1); + } else { + System.out.println( + "SUCCESS: PROPERTY HOLDS: expectedIsUnsat = " + + expectedIsUnsat + + " = " + + "actualIsUnsat = " + + actualIsUnsat); + System.exit(0); + } + } else { + System.out.println("SUCCESS: isUnsat = " + actualIsUnsat); + System.exit(0); + } + } + + public static boolean checkNativeParseAndIsUnsat(Solvers solver, String smt2) + throws SolverException, InterruptedException, InvalidConfigurationException { + switch (solver) { + case Z3: + return nativeZ3ParseAndIsUnsat(smt2); + case MATHSAT5: + return nativeMathSatParseAndIsUnsat(smt2); + case BITWUZLA: + return nativeBitwuzlaParseAndIsUnsat(smt2); + default: + throw new SolverException("Unsupported solver: " + solver); + } + } + + public static boolean nativeZ3ParseAndIsUnsat(String smt2) { + try (Context ctx = new Context()) { + Solver solver = ctx.mkSolver(); + solver.fromString(smt2); + Status status = solver.check(); + return status == Status.UNSATISFIABLE; + } + } + + public static boolean nativeBitwuzlaParseAndIsUnsat(String smt2) + throws InvalidConfigurationException, InterruptedException, SolverException { + SolverContext bitwuz = SolverContextFactory.createSolverContext(Solvers.BITWUZLA); + ProverEnvironment prover = bitwuz.newProverEnvironment(ProverOptions.GENERATE_MODELS); + prover.addConstraint(bitwuz.getFormulaManager().parse(smt2)); + return prover.isUnsat(); + } + + public static boolean nativeMathSatParseAndIsUnsat(String smt2) + throws InvalidConfigurationException, InterruptedException, SolverException { + SolverContext mathsat = SolverContextFactory.createSolverContext(Solvers.MATHSAT5); + ProverEnvironment prover = mathsat.newProverEnvironment(ProverOptions.GENERATE_MODELS); + prover.addConstraint(mathsat.getFormulaManager().parse(smt2)); + return prover.isUnsat(); + } + + public static void printError(Exception pE) { + if (pE instanceof UnsupportedOperationException) { + System.out.println("UNSUPPORTED: "); + } else { + System.out.println("ERROR: "); + } + pE.printStackTrace(); + System.exit(1); + throw new RuntimeException(pE); + } +}