Search in sources :

Example 31 with Expression

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

the class GEO159 method betweenDefn.

/**
 * Returns the between_c_defn axiom.
 *
 * @return between_c_defn
 */
public final Formula betweenDefn() {
    // all c, p, q, r: point |
    // c->p->q->r in between <=> p != r && some p.endPoint & r.endPoint &
    // q.innerPoint & partOf.c
    final Variable c = Variable.unary("C");
    final Variable p = Variable.unary("P");
    final Variable q = Variable.unary("Q");
    final Variable r = Variable.unary("R");
    final Expression e = p.join(endPoint).intersection(r.join(endPoint)).intersection(q.join(innerPoint)).intersection(partOf.join(c));
    final Formula f0 = c.product(p).product(q).product(r).in(between);
    final Formula f1 = p.eq(q).not().and(e.some());
    return f0.iff(f1).forAll(p.oneOf(point).and(q.oneOf(point)).and(r.oneOf(point)).and(c.oneOf(curve)));
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Example 32 with Expression

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

the class LAT258 method leastUpperBoundJoin.

/**
 * Returns the least_upper_bound_join axiom.
 *
 * @return the least_upper_bound_join axiom.
 */
public final Formula leastUpperBoundJoin() {
    final Variable a = Variable.unary("A"), b = Variable.unary("B");
    final Expression e0 = b.join(a.join(meet));
    final Formula f0 = e0.some().implies(a.join(lessThan).intersection(b.join(lessThan)).in(e0.join(lessThan)));
    return f0.forAll(a.oneOf(UNIV).and(b.oneOf(UNIV)));
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Example 33 with Expression

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

the class LAT258 method lowerBoundMeet.

/**
 * Returns the lower_bound_meet axiom.
 *
 * @return the lower_bound_meet axiom.
 */
public final Formula lowerBoundMeet() {
    final Variable c = Variable.unary("C");
    final Expression e0 = c.join(lessThan);
    final Formula f0 = meet.join(c).in(e0.product(e0));
    // all c: univ | meet.c in c.lessThan->c.lessThan
    return f0.forAll(c.oneOf(UNIV));
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Example 34 with Expression

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

the class LAT258 method greatestLowerBoundMeet.

/*
     * fof(greatest_lower_bound_meet,axiom,( ! [A,B,C,D] : ( ( meet(A,B,C) &
     * less_than(D,A) & less_than(D,B) ) => less_than(D,C) ) )).
     */
/**
 * Returns the greatest_lower_bound_meet axiom.
 *
 * @return the greatest_lower_bound_meet axiom.
 */
public final Formula greatestLowerBoundMeet() {
    final Variable a = Variable.unary("A"), b = Variable.unary("B");
    final Expression e0 = b.join(a.join(meet));
    final Formula f0 = e0.some().implies(lessThan.join(a).intersection(lessThan.join(b)).in(lessThan.join(e0)));
    return f0.forAll(a.oneOf(UNIV).and(b.oneOf(UNIV)));
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Example 35 with Expression

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

the class LAT258 method loLeDistr.

/**
 * Returns the lo_le_distr axiom.
 *
 * @return the lo_le_distr axiom.
 */
public final Formula loLeDistr() {
    final Variable a = Variable.unary("A"), b = Variable.unary("B"), c = Variable.unary("C");
    final Expression h = c.join(b.join(join));
    final Expression d = h.join(a.join(meet));
    final Expression e = b.join(a.join(meet));
    final Expression f = c.join(a.join(meet));
    final Expression g = f.join(e.join(join));
    final Formula f0 = d.product(g).in(lessThan);
    // (c.(a.meet)).((b.(a.meet)).join) in lessThan
    return f0.forAll(a.oneOf(UNIV).and(b.oneOf(UNIV)).and(c.oneOf(UNIV)));
}
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