本文整理汇总了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);
}