Java Code Examples for kodkod.ast.Expression#in()
The following examples show how to use
kodkod.ast.Expression#in() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GEO158.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * 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))); }
Example 2
Source File: GEO158.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * 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))); }
Example 3
Source File: GEO158.java From kodkod with MIT License | 6 votes |
/** * 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))); }
Example 4
Source File: TranslateAlloyToKodkod.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * 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); } }
Example 5
Source File: Skolemizer.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * 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)); }
Example 6
Source File: AbstractWorldDefinitions.java From kodkod with MIT License | 5 votes |
/** * 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); }
Example 7
Source File: GEO158.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * 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))); }
Example 8
Source File: AbstractWorldDefinitions.java From kodkod with MIT License | 5 votes |
/** * 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); }
Example 9
Source File: MED001.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * 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)); }
Example 10
Source File: MED001.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * 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)); }
Example 11
Source File: AbstractWorldDefinitions.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * 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); }
Example 12
Source File: ToyLists.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
private Formula prefix(Expression a, Expression b) { return a.in(prefixes(b)); }
Example 13
Source File: ToyLists.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
private Formula equiv(Expression a, Expression b) { return a.in(equivTo(b)); }
Example 14
Source File: Trees.java From kodkod with MIT License | 3 votes |
/** * 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)))); }
Example 15
Source File: Trees.java From org.alloytools.alloy with Apache License 2.0 | 3 votes |
/** * 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)))); }
Example 16
Source File: AbstractWorldDefinitions.java From org.alloytools.alloy with Apache License 2.0 | 2 votes |
/** * Returns the application of the Authentic predicate. * * @return application of the Authentic predicate. */ public Formula Authentic(Expression s, Expression p) { return p.in(s.join(abAuthPurse)); }
Example 17
Source File: SET967.java From kodkod with MIT License | 2 votes |
/** * Returns a in empty * @return a in empty */ final Formula empty(Expression a) { return a.in(empty); }
Example 18
Source File: SET943.java From org.alloytools.alloy with Apache License 2.0 | 2 votes |
/** * Returns a in empty * * @return a in empty */ final Formula empty(Expression a) { return a.in(empty); }
Example 19
Source File: ToyLists.java From kodkod with MIT License | votes |
private Formula equiv(Expression a, Expression b) { return a.in(equivTo(b)); }
Example 20
Source File: ToyLists.java From kodkod with MIT License | votes |
private Formula prefix(Expression a, Expression b) { return a.in(prefixes(b)); }