本文整理匯總了Java中gov.nasa.jpf.constraints.expressions.Quantifier類的典型用法代碼示例。如果您正苦於以下問題:Java Quantifier類的具體用法?Java Quantifier怎麽用?Java Quantifier使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Quantifier類屬於gov.nasa.jpf.constraints.expressions包,在下文中一共展示了Quantifier類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: translateQuantifier
import gov.nasa.jpf.constraints.expressions.Quantifier; //導入依賴的package包/類
public Expression<Boolean> translateQuantifier(Tree n) {
Quantifier q;
switch(n.getType()) {
case EXISTS:
q = Quantifier.EXISTS;
break;
case FORALL:
q = Quantifier.FORALL;
break;
default:
throw new UnexpectedTokenException(n, FORALL, EXISTS);
}
List<? extends Variable<?>> vars = translateTypedVarList(n.getChild(0));
pushContext(vars);
Expression<Boolean> body = translateBoolExpression(n.getChild(1));
popContext();
return new QuantifierExpression(q, vars, body);
}
示例2: eliminationTest
import gov.nasa.jpf.constraints.expressions.Quantifier; //導入依賴的package包/類
@Test
public void eliminationTest() throws IOException {
Properties conf = new Properties();
conf.setProperty("symbolic.dp", "z3");
ConstraintSolverFactory factory = new ConstraintSolverFactory(conf);
NativeZ3Solver solver = (NativeZ3Solver)factory.createSolver();
Variable x = new Variable(BuiltinTypes.INTEGER, "x");
Variable a = new Variable(BuiltinTypes.INTEGER, "a");
Variable b = new Variable(BuiltinTypes.INTEGER, "b");
Constant zero = new Constant(BuiltinTypes.INTEGER, 0);
//Expression expr = new NumericBooleanExpression(x, NumericComparator.EQ, x);
Expression expr = new NumericBooleanExpression(
x,
NumericComparator.EQ,
new NumericCompound<>(a, NumericOperator.PLUS, b));
expr = ExpressionUtil.and(expr,
new NumericBooleanExpression(a, NumericComparator.GT, zero),
new NumericBooleanExpression(b, NumericComparator.GT, zero));
List bound = new ArrayList<>();
bound.add(a);
bound.add(b);
QuantifierExpression qe = new QuantifierExpression(Quantifier.EXISTS, bound, expr);
System.out.println("gov.nasa.jpf.constraints.api.QuantifierEliminationTest.eliminationTest()");
StringBuilder aa = new StringBuilder();
qe.print(aa);
System.out.println(aa.toString());
assertNotNull(solver.eliminateQuantifiers(qe));
}
示例3: visit
import gov.nasa.jpf.constraints.expressions.Quantifier; //導入依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public Expression<?> visit(QuantifierExpression q, Boolean data) {
Quantifier quant = q.getQuantifier();
if(data)
quant = quant.negate();
return new QuantifierExpression(quant, q.getBoundVariables(), (Expression<Boolean>)visit(q.getBody(), data));
}
示例4: forall
import gov.nasa.jpf.constraints.expressions.Quantifier; //導入依賴的package包/類
public static QuantifierExpression forall(Expression<Boolean> expr, Variable<?>... vars) {
return new QuantifierExpression(Quantifier.FORALL, Arrays.asList(vars), expr);
}