本文整理汇总了Java中kodkod.ast.Expression.in方法的典型用法代码示例。如果您正苦于以下问题:Java Expression.in方法的具体用法?Java Expression.in怎么用?Java Expression.in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.Expression
的用法示例。
在下文中一共展示了Expression.in方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: domainConstraint
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns a formula that properly constrains the given skolem's domain.
*
* @requires !nonSkolems.isEmpty()
* @return a formula that properly constrains the given skolem's domain.
*/
private Formula domainConstraint(Decl skolemDecl, Relation skolem) {
final Iterator<DeclInfo> itr = nonSkolems.iterator();
Decls rangeDecls = null;
while (itr.hasNext()) {
Decl d = itr.next().decl;
Decl dd = d.variable().oneOf(d.expression());
rangeDecls = rangeDecls != null ? rangeDecls.and(dd) : dd;
}
// System.out.println(skolemDecl.expression());
Expression skolemDomain = skolem;
for (int i = 0, max = skolemDecl.variable().arity(); i < max; i++) {
skolemDomain = skolemDomain.join(Expression.UNIV);
}
return skolemDomain.in(Formula.TRUE.comprehension(rangeDecls));
}
示例2: endPointDefn
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns the end_point_defn axiom.
*
* @return end_point_defn
*/
public final Formula endPointDefn() {
/*
* all P: Point, C: Curve | P->C in endPoint iff (P->C in incident &&
* all C1, C2: partOf.C & P.incident | C1->C2 in partOf || C2->C1 in
* partOf)
*/
final Variable c = Variable.unary("C");
final Variable p = Variable.unary("P");
final Expression e0 = p.product(c);
final Formula f0 = e0.in(endPoint);
final Formula f1 = e0.in(incident);
final Variable c1 = Variable.unary("C1"), c2 = Variable.unary("C2");
final Formula f2 = c1.product(c2).in(partOf).or(c2.product(c1).in(partOf));
final Expression e1 = partOf.join(c).intersection(p.join(incident));
final Formula f3 = f2.forAll(c1.oneOf(e1).and(c2.oneOf(e1)));
return f0.iff(f1.and(f3)).forAll(p.oneOf(point).and(c.oneOf(curve)));
}
示例3: meetDefn
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns the meet_defn axiom.
*
* @return meet_defn
*/
public final Formula meetDefn() {
// all P: Point, C, C1: Curve | P->C->C1 in meet iff
// (P->C in incident && P->C1 in incident &&
// incident.C & incident.C1 in endPoint.C & endPoint.C1)
final Variable c = Variable.unary("C");
final Variable c1 = Variable.unary("C1");
final Variable p = Variable.unary("P");
final Formula f0 = p.product(c).product(c1).in(meet);
final Formula f1 = p.product(c).in(incident).and(p.product(c1).in(incident));
final Expression e0 = incident.join(c).intersection(incident.join(c1));
final Expression e1 = endPoint.join(c).intersection(endPoint.join(c1));
final Formula f2 = e0.in(e1);
final Formula f3 = f0.iff(f1.and(f2));
return f3.forAll(p.oneOf(point).and(c.oneOf(curve)).and(c1.oneOf(curve)));
}
示例4: isIn
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Helper method that translates the formula "a in b" into a Kodkod formula.
*/
private Formula isIn(Expression a, Expr right) throws Err {
Expression b;
if (right instanceof ExprBinary && right.mult != 0 && ((ExprBinary) right).op.isArrow) {
// Handles possible "binary" or higher-arity multiplicity
return isInBinary(a, (ExprBinary) right);
}
switch (right.mult()) {
case EXACTLYOF :
b = cset(right);
return a.eq(b);
case ONEOF :
b = cset(right);
return a.one().and(a.in(b));
case LONEOF :
b = cset(right);
return a.lone().and(a.in(b));
case SOMEOF :
b = cset(right);
return a.some().and(a.in(b));
default :
b = cset(right);
return a.in(b);
}
}
示例5: innerPointDefn
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns the inner_point_defn axiom.
*
* @return inner_point_defn
*/
public final Formula innerPointDefn() {
// all P: Point, C: Curve | P->C in innerPoint iff
// (P->C in incident && no P->C & endPoint)
final Variable c = Variable.unary("C");
final Variable p = Variable.unary("P");
final Expression e0 = p.product(c);
final Formula f0 = e0.in(innerPoint);
final Formula f1 = e0.in(incident).and(e0.intersection(endPoint).no());
return f0.iff(f1).forAll(p.oneOf(point).and(c.oneOf(curve)));
}
示例6: insulin_completion
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns the insulin_completion axiom.
*
* @return insulin_completion
*/
public final Formula insulin_completion() {
final Variable x0 = Variable.unary("X0");
final Expression x1 = UNIV.difference(x0.join(gt));
final Formula f0 = x1.in(uptakelg.union(uptakepg));
return f0.implies(x1.in(drugi)).forAll(x0.oneOf(UNIV));
}
示例7: su_completion
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns the su_completion axiom.
*
* @return su_completion
*/
public final Formula su_completion() {
final Variable x0 = Variable.unary("X0");
final Expression x1 = UNIV.difference(x0.join(gt));
final Formula f0 = x1.in(bsecretioni);
return f0.implies(x1.in(drugsu).and(x0.in(bcapacityex).not())).forAll(x0.oneOf(UNIV));
}
示例8: Abstract
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns the application of the Abstract predicate.
*
* @return application of the Abstract predicate.
*/
public Formula Abstract(Expression s) {
final Expression e0 = s.join(abAuthPurse).join(abBalance).join(s).intersection(
s.join(abAuthPurse).join(abLost).join(s));
final Formula f0 = e0.no();
final Expression e1 = s.join(abAuthPurse).product(Expression.UNIV);
final Expression e2 = e1.intersection((abBalance.union(abLost)).join(s));
final Formula f1 = e2.in(AbPurse.product(Coin));
final Variable c = Variable.unary("c");
final Formula f2 = e2.join(c).lone().forAll(c.oneOf(Coin));
return Formula.and(f0, f1, f2);
}
示例9: AbWorldSecureOp
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns the application of the AbWorldSecureOp predicate.
*
* @return application of the AbWorldSecureOp predicate.
*/
public Formula AbWorldSecureOp(Expression s, Expression sprime, Expression a_in, Expression a_out) {
final Formula f0 = AbOp(a_out);
final Formula f1 = a_in.in(TransferDetails);
final Expression e0 = a_in.join(from);
final Expression e1 = a_in.join(to);
final Expression e2 = s.join(abAuthPurse).difference(e0).difference(e1);
final Expression e3 = sprime.join(abAuthPurse).difference(e0).difference(e1);
final Formula f2 = e2.eq(e3);
final Formula f3 = XiAbPurse(s, sprime, e2);
return Formula.and(f0, f1, f2, f3);
}
示例10: isIn
import kodkod.ast.Expression; //导入方法依赖的package包/类
/** Helper method that translates the formula "a in b" into a Kodkod formula. */
private Formula isIn(Expression a, Expr right) throws Err {
Expression b;
if (right instanceof ExprBinary && right.mult!=0 && ((ExprBinary)right).op.isArrow) {
// Handles possible "binary" or higher-arity multiplicity
return isInBinary(a, (ExprBinary)right);
}
switch(right.mult()) {
case EXACTLYOF: b=cset(right); return a.eq(b);
case ONEOF: b=cset(right); return a.one().and(a.in(b));
case LONEOF: b=cset(right); return a.lone().and(a.in(b));
case SOMEOF: b=cset(right); return a.some().and(a.in(b));
default: b=cset(right); return a.in(b);
}
}
示例11: domainConstraint
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns a formula that properly constrains the given skolem's domain.
* @requires !nonSkolems.isEmpty()
* @return a formula that properly constrains the given skolem's domain.
*/
private Formula domainConstraint(Decl skolemDecl, Relation skolem) {
final Iterator<DeclInfo> itr = nonSkolems.iterator();
Decls rangeDecls = itr.next().decl;
while(itr.hasNext()) {
rangeDecls = rangeDecls.and(itr.next().decl);
}
// System.out.println(skolemDecl.expression());
Expression skolemDomain = skolem;
for(int i = 0, max = skolemDecl.variable().arity(); i < max; i++) {
skolemDomain = skolemDomain.join(Expression.UNIV);
}
return skolemDomain.in(Formula.TRUE.comprehension(rangeDecls));
}
示例12: equiv
import kodkod.ast.Expression; //导入方法依赖的package包/类
private Formula equiv(Expression a, Expression b) {
return a.in(equivTo(b));
}
示例13: prefix
import kodkod.ast.Expression; //导入方法依赖的package包/类
private Formula prefix(Expression a, Expression b) {
return a.in(prefixes(b));
}
示例14: testFelix_11122006
import kodkod.ast.Expression; //导入方法依赖的package包/类
public final void testFelix_11122006() {
Relation x0 = Relation.nary("Q", 1);
Relation x1 = Relation.nary("B", 1);
Relation x2 = Relation.nary("A", 1);
Relation x3 = Relation.nary("QQ", 3);
List<String> atomlist = Arrays.asList("A", "B", "Q");
Universe universe = new Universe(atomlist);
TupleFactory factory = universe.factory();
Bounds bounds = new Bounds(universe);
TupleSet x0_upper = factory.noneOf(1);
x0_upper.add(factory.tuple("Q"));
bounds.boundExactly(x0, x0_upper);
TupleSet x1_upper = factory.noneOf(1);
x1_upper.add(factory.tuple("B"));
bounds.boundExactly(x1, x1_upper);
TupleSet x2_upper = factory.noneOf(1);
x2_upper.add(factory.tuple("A"));
bounds.boundExactly(x2, x2_upper);
TupleSet x3_upper = factory.noneOf(3);
x3_upper.add(factory.tuple("Q").product(factory.tuple("A")).product(factory.tuple("A")));
x3_upper.add(factory.tuple("Q").product(factory.tuple("B")).product(factory.tuple("B")));
bounds.bound(x3, x3_upper);
Expression x7 = x2.product(x2);
Expression x8 = x0.join(x3);
Formula x6 = x7.in(x8);
Formula x5 = x6.not();
Expression x18 = x1.product(x1);
Expression x17 = x7.union(x18);
Expression x16 = x0.product(x17);
Formula x15 = x3.in(x16);
Formula x4 = x5.and(x15);
Solver solver = new Solver();
solver.options().setSolver(SATFactory.DefaultSAT4J);
solver.options().setBitwidth(4);
solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT);
// System.out.println(bounds);
// System.out.println(x4);
Solution sol = solver.solve(x4, bounds);
assertEquals(sol.outcome(), Solution.Outcome.SATISFIABLE);
// System.out.println(sol.toString());
}
示例15: inCycle
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Returns the inCycle predicate.
*
* @return
*
* <pre>
* pred InCycle(v: V, c: V -> V) {
* v in v.c or
* some v': v.c | v' in v.^(c - v->v' - v'->v)
* }
* </pre>
*/
public final Formula inCycle(Expression/* V */ v, Expression/* V->V */ c) {
final Formula f0 = v.in(v.join(c));
final Variable vp = Variable.unary("v'");
final Formula f1 = vp.in(v.join((c.difference(v.product(vp)).difference(vp.product(v))).closure()));
return f0.or(f1.forSome(vp.oneOf(v.join(c))));
}