Skip to content

Commit e0be9d8

Browse files
committed
- reverted defineFun changes
1 parent 6b18557 commit e0be9d8

File tree

3 files changed

+7
-161
lines changed

3 files changed

+7
-161
lines changed

src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Visitor.java

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_assertContext;
5757
import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_declareConstContext;
5858
import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_declareFunContext;
59+
import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_defineFunContext;
5960
import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_defineSortContext;
6061
import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_popContext;
6162
import org.sosy_lab.java_smt.basicimpl.parserInterpreter.Smtlibv2Parser.Cmd_pushContext;
@@ -2300,4 +2301,9 @@ public Object visitResp_get_model(Resp_get_modelContext ctx) {
23002301
isModel = true;
23012302
return visitChildren(ctx);
23022303
}
2304+
2305+
@Override
2306+
public Object visitCmd_defineFun(Cmd_defineFunContext ctx) {
2307+
throw new UnsupportedOperationException("JavaSMT does not support \"define-fun\"");
2308+
}
23032309
}

src/org/sosy_lab/java_smt/test/SMTLIB2ParserInterpreterTest.java

-159
Original file line numberDiff line numberDiff line change
@@ -3145,165 +3145,6 @@ public void testExceptionPush()
31453145

31463146
/*PARSE MODEL TESTS*/
31473147

3148-
@Test
3149-
public void testDefineFunctionBoolEmptyInput()
3150-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3151-
3152-
String x = "(define-fun bla () Bool true)\n";
3153-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3154-
3155-
BooleanFormula constraint = bmgr.makeTrue();
3156-
3157-
BooleanFormula expectedResult = constraint;
3158-
3159-
assertThat(actualResult).isEqualTo(expectedResult);
3160-
}
3161-
3162-
@Test
3163-
public void testDefineFunctionBoolWithInput()
3164-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3165-
requireBooleanUFs();
3166-
3167-
String x = "(define-fun bla ((x Bool)) Bool (= x true))\n";
3168-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3169-
3170-
BooleanFormula constraint = bmgr.makeTrue();
3171-
3172-
BooleanFormula expectedResult = constraint;
3173-
3174-
assertThat(actualResult).isEqualTo(expectedResult);
3175-
}
3176-
3177-
@Test
3178-
public void testDefineFunctionInt()
3179-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3180-
requireIntegers();
3181-
3182-
String x = "(define-fun bla () Int (- 3 4))\n" + "(assert (= bla bla))\n";
3183-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3184-
IntegerFormula drei = imgr.makeNumber(3);
3185-
IntegerFormula vier = imgr.makeNumber(4);
3186-
IntegerFormula sub = imgr.subtract(drei, vier);
3187-
BooleanFormula constraint = imgr.equal(sub, sub);
3188-
3189-
BooleanFormula expectedResult = constraint;
3190-
3191-
assertThat(actualResult).isEqualTo(expectedResult);
3192-
}
3193-
3194-
@Test
3195-
public void testDefineFunctionIntWithInput()
3196-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3197-
requireIntegers();
3198-
3199-
String x = "(define-fun bla ((x Int)) Int (- 3 x))\n" + "(assert (= bla bla))\n";
3200-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3201-
IntegerFormula drei = imgr.makeNumber(3);
3202-
IntegerFormula xVar = imgr.makeVariable("x");
3203-
IntegerFormula sub = imgr.subtract(drei, xVar);
3204-
BooleanFormula constraint = imgr.equal(sub, sub);
3205-
3206-
BooleanFormula expectedResult = constraint;
3207-
3208-
assertThat(actualResult).isEqualTo(expectedResult);
3209-
}
3210-
3211-
@Test
3212-
public void testDefineFunctionReal()
3213-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3214-
requireRationals();
3215-
assume().that(solverToUse()).isNotEqualTo(Solvers.OPENSMT);
3216-
3217-
String x = "(define-fun bla () Real (- 3 4.0))\n" + "(assert (= bla bla))\n";
3218-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3219-
IntegerFormula drei = imgr.makeNumber(3);
3220-
RationalFormula vier = Objects.requireNonNull(rmgr).makeNumber(4.0);
3221-
RationalFormula sub = rmgr.subtract(drei, vier);
3222-
BooleanFormula constraint = rmgr.equal(sub, sub);
3223-
3224-
BooleanFormula expectedResult = constraint;
3225-
3226-
assertThat(actualResult).isEqualTo(expectedResult);
3227-
}
3228-
3229-
@Test
3230-
public void testDefineFunctionRealWithInput()
3231-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3232-
requireRationals();
3233-
assume().that(solverToUse()).isNotEqualTo(Solvers.OPENSMT);
3234-
3235-
String x = "(define-fun bla ((x Real)) Real (- 3 x))\n" + "(assert (= bla bla))\n";
3236-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3237-
IntegerFormula drei = imgr.makeNumber(3);
3238-
RationalFormula xVar = Objects.requireNonNull(rmgr).makeVariable("x");
3239-
RationalFormula sub = rmgr.subtract(drei, xVar);
3240-
BooleanFormula constraint = rmgr.equal(sub, sub);
3241-
3242-
BooleanFormula expectedResult = constraint;
3243-
3244-
assertThat(actualResult).isEqualTo(expectedResult);
3245-
}
3246-
3247-
@Test
3248-
public void testDefineFunctionBitVec()
3249-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3250-
requireBitvectors();
3251-
3252-
String x =
3253-
"(define-fun bla () (_ BitVec 5) (bvsub #b10000 #b00001))\n" + "(assert (= bla bla))\n";
3254-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3255-
BitvectorFormula first = Objects.requireNonNull(bvmgr).makeBitvector(5, 16);
3256-
BitvectorFormula second = bvmgr.makeBitvector(5, 1);
3257-
BitvectorFormula sub = bvmgr.subtract(first, second);
3258-
BooleanFormula constraint = bvmgr.equal(sub, sub);
3259-
3260-
BooleanFormula expectedResult = constraint;
3261-
3262-
assertThat(actualResult).isEqualTo(expectedResult);
3263-
}
3264-
3265-
@Test
3266-
public void testDefineFunctionBitVecWithInput()
3267-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3268-
requireBitvectors();
3269-
3270-
String x =
3271-
"(define-fun bla ((x (_ BitVec 5))) (_ BitVec 5) (bvsub #b10000 x))\n"
3272-
+ "(assert (= bla bla))\n";
3273-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3274-
BitvectorFormula first = Objects.requireNonNull(bvmgr).makeBitvector(5, 16);
3275-
BitvectorFormula second = bvmgr.makeVariable(5, "x");
3276-
BitvectorFormula sub = bvmgr.subtract(first, second);
3277-
BooleanFormula constraint = bvmgr.equal(sub, sub);
3278-
3279-
BooleanFormula expectedResult = constraint;
3280-
3281-
assertThat(actualResult).isEqualTo(expectedResult);
3282-
}
3283-
3284-
@Test
3285-
public void testDefineFunctionArray()
3286-
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {
3287-
requireIntegers();
3288-
requireArrays();
3289-
3290-
String x =
3291-
"(declare-const a (Array Int Int))\n"
3292-
+ "(define-fun bla () (Array Int Int) a)\n"
3293-
+ "(assert (= a a))\n";
3294-
BooleanFormula actualResult = mgr.universalParseFromString(x);
3295-
3296-
ArrayFormula<IntegerFormula, IntegerFormula> a =
3297-
Objects.requireNonNull(amgr)
3298-
.makeArray("a", FormulaType.IntegerType, FormulaType.IntegerType);
3299-
BooleanFormula constraint = amgr.equivalence(a, a);
3300-
BooleanFormula expectedResult = constraint;
3301-
3302-
assertThat(actualResult).isEqualTo(expectedResult);
3303-
}
3304-
3305-
/* OTHER FUNCTION TESTS*/
3306-
33073148
@Test
33083149
public void testLetExpression()
33093150
throws IOException, SolverException, InterruptedException, InvalidConfigurationException {

src/org/sosy_lab/java_smt/test/SMTLIB2StringTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.sosy_lab.java_smt.api.StringFormula;
2525
import org.sosy_lab.java_smt.basicimpl.Generator;
2626

27-
@SuppressWarnings({"CheckReturnValue", "ReturnValueIgnored","EqualsIncompatibleType"})
27+
@SuppressWarnings({"CheckReturnValue", "ReturnValueIgnored", "EqualsIncompatibleType"})
2828
public class SMTLIB2StringTest extends SolverBasedTest0.ParameterizedSolverBasedTest0 {
2929
@Before
3030
public void setUp() {
@@ -343,7 +343,6 @@ public void testRegexIntersection()
343343

344344
BooleanFormula actualResult = mgr.universalParseFromString(x);
345345

346-
347346
assertThat(
348347
actualResult.equals(
349348
"(str.in_re a (re.inter (str.to_re \"\\Qa\\E\") (str.to_re " + "\"\\Qb\\E\")))"));

0 commit comments

Comments
 (0)