use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class MED001 method insulin_effect.
/**
* Returns the insulin_effect axiom.
*
* @return insulin_effect
*/
public final Formula insulin_effect() {
final Variable x0 = Variable.unary("X0");
final Expression x1 = UNIV.difference(x0.join(gt));
return x1.in(drugi).implies(x1.in(uptakelg.intersection(uptakepg))).forAll(x0.oneOf(UNIV));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class MED001 method sulfonylurea_effect.
/**
* Returns the sulfonylurea_effect axiom.
*
* @return sulfonylurea_effect
*/
public final Formula sulfonylurea_effect() {
final Variable x0 = Variable.unary("X0");
final Expression x1 = UNIV.difference(x0.join(gt));
return x1.in(drugi).and(x0.in(bcapacityex).not()).implies(x1.in(bsecretioni)).forAll(x0.oneOf(UNIV));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class NUM374 method wilkie.
/**
* Returns the wilkie conjecture.
*
* @return wilkie
*/
public final Formula wilkie() {
// ! [C,P,Q,R,S,A,B] :
// ( ( C = product(A,A)
// & P = sum(n1,A)
// & Q = sum(P,C)
// & R = sum(n1,product(A,C))
// & S = sum(sum(n1,C),product(C,C)) )
// =>
// product(exponent(sum(exponent(P,A),exponent(Q,A)),B),exponent(sum(exponent(R,B),exponent(S,B)),A))
// =
// product(exponent(sum(exponent(P,B),exponent(Q,B)),A),exponent(sum(exponent(R,A),exponent(S,A)),B))
// ) )).
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 Variable s = Variable.unary("S");
final Variable a = Variable.unary("A");
final Variable b = Variable.unary("B");
final Formula f0 = c.eq(product(a, a));
final Formula f1 = p.eq(sum(n1, a));
final Formula f2 = q.eq(sum(p, c));
final Formula f3 = r.eq(sum(n1, product(a, c)));
final Formula f4 = s.eq(sum(sum(n1, c), product(c, c)));
final Expression e0 = product(exponent(sum(exponent(p, a), exponent(q, a)), b), exponent(sum(exponent(r, b), exponent(s, b)), a));
final Expression e1 = product(exponent(sum(exponent(p, b), exponent(q, b)), a), exponent(sum(exponent(r, a), exponent(s, a)), b));
final Formula f5 = e0.eq(e1);
return (f0.and(f1).and(f2).and(f3).and(f4)).implies(f5).forAll(c.oneOf(UNIV).and(p.oneOf(UNIV)).and(q.oneOf(UNIV)).and(r.oneOf(UNIV)).and(s.oneOf(UNIV)).and(a.oneOf(UNIV)).and(b.oneOf(UNIV)));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class TOP020 method product_top.
/**
* Returns product_top axiom.
*
* @return product_top
*/
public final Formula product_top() {
final Variable s = Variable.unary("S");
final Variable t = Variable.unary("T");
final Variable x = Variable.unary("X");
final Formula f0 = a_member_of(x, coerce_to_class(the_product_top_space_of(s, t)));
final Expression e0 = member.join(coerce_to_class(s));
final Expression e1 = member.join(coerce_to_class(t));
final Formula f1 = ordered.intersection(e0.product(e1).product(x)).some();
return f0.implies(f1).forAll(s.oneOf(UNIV).and(t.oneOf(UNIV)).and(x.oneOf(UNIV)));
}
use of kodkod.ast.Expression in project org.alloytools.alloy by AlloyTools.
the class BoundsComputer method allocatePrimSig.
// ==============================================================================================================//
/**
* Allocate relations for nonbuiltin PrimSigs bottom-up.
*/
private Expression allocatePrimSig(PrimSig sig) throws Err {
// Recursively allocate all children expressions, and form the union of
// them
Expression sum = null;
for (PrimSig child : sig.children()) {
Expression childexpr = allocatePrimSig(child);
if (sum == null) {
sum = childexpr;
continue;
}
// subsigs are disjoint
sol.addFormula(sum.intersection(childexpr).no(), child.isSubsig);
sum = sum.union(childexpr);
}
TupleSet lower = lb.get(sig).clone(), upper = ub.get(sig).clone();
if (sum == null) {
// If sig doesn't have children, then sig should make a fresh
// relation for itself
sum = sol.addRel(sig.label, lower, upper);
} else if (sig.isAbstract == null) {
// relation to act as the remainder.
for (PrimSig child : sig.children()) {
// Remove atoms that are KNOWN to be in a subsig;
// it's okay to mistakenly leave some atoms in, since we will
// never solve for the "remainder" relation directly;
// instead, we union the remainder with the children, then solve
// for the combined solution.
// (Thus, the more we can remove, the more efficient it gets,
// but it is not crucial for correctness)
TupleSet childTS = sol.query(false, sol.a2k(child), false);
lower.removeAll(childTS);
upper.removeAll(childTS);
}
sum = sum.union(sol.addRel(sig.label + " remainder", lower, upper));
}
sol.addSig(sig, sum);
return sum;
}
Aggregations