Search in sources :

Example 51 with Expression

use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.

the class ALG195_1 method ax16_22.

/**
 * Parametrization of axioms 16-22.
 *
 * @requires e is unary, h is binary
 */
Formula ax16_22(Relation e, Relation h) {
    // op2(e,...)
    final Expression expr0 = e.join(op2);
    // op2(e,e)
    final Expression expr1 = e.join(expr0);
    // op2(e,op2(e,e))
    final Expression expr2 = expr1.join(expr0);
    // op2(op2(e,op2(e,e)),op2(e,op2(e,e)))
    final Expression expr3 = expr2.join(expr2.join(op2));
    // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),...)
    final Expression expr3a = expr3.join(op2);
    // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e)
    final Expression expr4 = e.join(expr3a);
    // h(e10) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),op2(e,op2(e,e)))
    final Formula f0 = e1[0].join(h).eq(expr2.join(expr3a));
    // h(e11) = op2(e,e)
    final Formula f1 = e1[1].join(h).eq(expr1);
    // h(e12) = op2(op2(e,op2(e,e)),op2(e,op2(e,e)))
    final Formula f2 = e1[2].join(h).eq(expr3);
    // h(e13) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e)
    final Formula f3 = e1[3].join(h).eq(expr4);
    // h(e14) = op2(e,op2(e,e))
    final Formula f4 = e1[4].join(h).eq(expr2);
    // h1(e15) = e
    final Formula f5 = e1[5].join(h).eq(e);
    // h(e16) =
    // op2(op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e),op2(e,op2(e,e)))
    final Formula f6 = e1[6].join(h).eq(expr2.join(expr4.join(op2)));
    return f0.and(f1).and(f2).and(f3).and(f4).and(f5).and(f6);
}
Also used : Formula(kodkod.ast.Formula) Expression(kodkod.ast.Expression)

Example 52 with Expression

use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.

the class ALG212 method distLong.

/**
 * Returns the dist_long conjecture.
 *
 * @return dist_long
 */
public final Formula distLong() {
    // all u, w, x, y, z: A | f[f[x][y][z]][u][w] =
    // f[f[x][u][w]][f[y][u][w]][f[z][u][w]]
    final Variable u = Variable.unary("u");
    final Variable w = Variable.unary("w");
    final Variable x = Variable.unary("x");
    final Variable y = Variable.unary("y");
    final Variable z = Variable.unary("z");
    final Expression e0 = z.join(y.join(x.join(f)));
    final Expression e1 = w.join(u.join(e0.join(f)));
    final Expression e2 = w.join(u.join(x.join(f)));
    final Expression e3 = w.join(u.join(y.join(f)));
    final Expression e4 = w.join(u.join(z.join(f)));
    final Expression e5 = e4.join(e3.join(e2.join(f)));
    return e1.eq(e5).forAll(u.oneOf(UNIV).and(w.oneOf(UNIV)).and(x.oneOf(UNIV)).and(y.oneOf(UNIV)).and(z.oneOf(UNIV)));
}
Also used : Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Example 53 with Expression

use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.

the class ALG195 method ax16_22.

/**
 * Parametrization of axioms 16-22.
 *
 * @requires e is unary, h is binary
 */
@Override
Formula ax16_22(Relation e, Relation h) {
    // op2(e,...)
    final Expression expr0 = e.join(op2);
    // op2(e,e)
    final Expression expr1 = e.join(expr0);
    // op2(e,op2(e,e))
    final Expression expr2 = expr1.join(expr0);
    // op2(op2(e,op2(e,e)),op2(e,op2(e,e)))
    final Expression expr3 = expr2.join(expr2.join(op2));
    // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),...)
    final Expression expr3a = expr3.join(op2);
    // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e)
    final Expression expr4 = e.join(expr3a);
    // h(e10) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),op2(e,op2(e,e)))
    final Formula f0 = e1[0].join(h).eq(expr2.join(expr3a));
    // h(e11) = op2(e,e)
    final Formula f1 = e1[1].join(h).eq(expr1);
    // h(e12) = op2(op2(e,op2(e,e)),op2(e,op2(e,e)))
    final Formula f2 = e1[2].join(h).eq(expr3);
    // h(e13) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e)
    final Formula f3 = e1[3].join(h).eq(expr4);
    // h(e14) = op2(e,op2(e,e))
    final Formula f4 = e1[4].join(h).eq(expr2);
    // h(e16) =
    // op2(op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e),op2(e,op2(e,e)))
    final Formula f6 = e1[6].join(h).eq(expr2.join(expr4.join(op2)));
    return and(f0, f1, f2, f3, f4, f6);
}
Also used : Formula(kodkod.ast.Formula) Expression(kodkod.ast.Expression)

Example 54 with Expression

use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.

the class GEO092 method proposition2141.

/*
     * fof(proposition_2_14_1,conjecture, ( ! [C1,C2,P] : ( ( meet(P,C1,C2) &
     * open(sum(C1,C2)) ) => ! [Q] : ( Q != P => ~ ( incident_c(Q,C1) &
     * incident_c(Q,C2) ) ) ) )).
     */
/**
 * Returns the conjecture proposition_2_14_1.
 *
 * @return proposition_2_14_1
 */
public final Formula proposition2141() {
    // all c1, c2: curve, p: point |
    // p->c1->c2 in meet && c1->c2 in sum.open =>
    // all q: point - p | c1 + c2 !in q.incident
    final Variable c1 = Variable.unary("C1");
    final Variable c2 = Variable.unary("C2");
    final Variable p = Variable.unary("P");
    final Variable q = Variable.unary("Q");
    final Expression e0 = c1.product(c2);
    final Formula f0 = p.product(e0).in(meet).and(e0.in(sum.join(open)));
    final Formula f1 = c1.union(c2).in(q.join(incident)).not().forAll(q.oneOf(point.difference(p)));
    return f0.implies(f1).forAll(c1.oneOf(curve).and(c2.oneOf(curve)).and(p.oneOf(point)));
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Example 55 with Expression

use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.

the class GEO158 method endPointDefn.

/**
 * 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)));
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Aggregations

Expression (kodkod.ast.Expression)127 Formula (kodkod.ast.Formula)95 Variable (kodkod.ast.Variable)80 IntExpression (kodkod.ast.IntExpression)49 Relation (kodkod.ast.Relation)26 BinaryExpression (kodkod.ast.BinaryExpression)22 Decls (kodkod.ast.Decls)22 Bounds (kodkod.instance.Bounds)21 TupleSet (kodkod.instance.TupleSet)20 Universe (kodkod.instance.Universe)20 SumExpression (kodkod.ast.SumExpression)19 TupleFactory (kodkod.instance.TupleFactory)19 Solution (kodkod.engine.Solution)17 QuantifiedFormula (kodkod.ast.QuantifiedFormula)14 Solver (kodkod.engine.Solver)14 BinaryIntExpression (kodkod.ast.BinaryIntExpression)13 ConstantExpression (kodkod.ast.ConstantExpression)13 IfExpression (kodkod.ast.IfExpression)13 IfIntExpression (kodkod.ast.IfIntExpression)13 NaryExpression (kodkod.ast.NaryExpression)13