Search in sources :

Example 66 with Variable

use of kodkod.ast.Variable 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 67 with Variable

use of kodkod.ast.Variable 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)

Example 68 with Variable

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

the class GEO158 method c5.

/**
 * Returns the c5 axiom.
 *
 * @return c5
 */
public final Formula c5() {
    // all C: Curve, P, Q, R: endPoint.C |
    // P = Q || P = R || Q = R
    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 e0 = endPoint.join(c);
    final Formula f0 = p.eq(q).or(p.eq(r)).or(q.eq(r));
    return f0.forAll(c.oneOf(curve).and(p.oneOf(e0)).and(q.oneOf(e0)).and(r.oneOf(e0)));
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Example 69 with Variable

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

the class GEO158 method decls.

/**
 * Returns all the 'type' declarations.
 *
 * @return the type declarations
 */
public Formula decls() {
    final Expression cc = curve.product(curve);
    final Expression pc = point.product(curve);
    final Formula f0 = partOf.in(cc);
    final Formula f1 = closed.in(curve).and(open.in(curve));
    final Formula f2 = meet.in(point.product(cc)).and(sum.in(curve.product(cc)));
    final Formula f3 = incident.in(pc).and(endPoint.in(pc)).and(innerPoint.in(pc));
    // all C1, C2: Curve | one C2.(C1.sum)
    final Variable c1 = Variable.unary("C1");
    final Variable c2 = Variable.unary("C2");
    final Formula f4 = c2.join(c1.join(sum)).one().forAll(c1.oneOf(curve).and(c2.oneOf(curve)));
    return f0.and(f1).and(f2).and(f3).and(f4);
}
Also used : Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Example 70 with Variable

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

the class GEO158 method c6.

/**
 * Returns the c6 axiom.
 *
 * @return c6
 */
public final Formula c6() {
    // all C: Curve, P: endPoint.C | some endPoint.C - P
    final Variable c = Variable.unary("C");
    final Variable p = Variable.unary("P");
    final Expression e0 = endPoint.join(c);
    return e0.difference(p).some().forAll(c.oneOf(curve).and(p.oneOf(e0)));
}
Also used : Variable(kodkod.ast.Variable) Expression(kodkod.ast.Expression)

Aggregations

Variable (kodkod.ast.Variable)221 Formula (kodkod.ast.Formula)151 Expression (kodkod.ast.Expression)80 Decls (kodkod.ast.Decls)24 Solution (kodkod.engine.Solution)24 Relation (kodkod.ast.Relation)23 IntExpression (kodkod.ast.IntExpression)22 Bounds (kodkod.instance.Bounds)21 Universe (kodkod.instance.Universe)21 ArrayList (java.util.ArrayList)19 TupleFactory (kodkod.instance.TupleFactory)19 TupleSet (kodkod.instance.TupleSet)15 Solver (kodkod.engine.Solver)14 Decl (kodkod.ast.Decl)12 QuantifiedFormula (kodkod.ast.QuantifiedFormula)10 Test (org.junit.Test)10 Instance (kodkod.instance.Instance)8 BinaryExpression (kodkod.ast.BinaryExpression)5 SumExpression (kodkod.ast.SumExpression)3 Expr (edu.mit.csail.sdg.ast.Expr)2