use of kodkod.ast.Formula 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));
}
use of kodkod.ast.Formula in project org.alloytools.alloy by AlloyTools.
the class LAT258 method main.
/**
* Usage: java examples.tptp.LAT258 [scope]
*/
public static void main(String[] args) {
if (args.length < 1)
usage();
try {
final int n = Integer.parseInt(args[0]);
final LAT258 model = new LAT258();
final Bounds b = model.bounds(n);
final Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
final Formula f = model.checkGoalToBeProved();
System.out.println(f);
// System.out.println(b);
final Solution s = solver.solve(f, b);
System.out.println(s);
} catch (NumberFormatException nfe) {
usage();
} catch (HigherOrderDeclException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnboundLeafException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of kodkod.ast.Formula 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)));
}
use of kodkod.ast.Formula 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)));
}
use of kodkod.ast.Formula in project org.alloytools.alloy by AlloyTools.
the class CeilingsAndFloors method noSharing.
/**
* Returns the noSharing constraint.
*
* @return all m, n: Man | !(m = n) => !(m.floor = n.floor || m.ceiling =
* n.ceiling)
*/
public Formula noSharing() {
final Variable m = Variable.unary("m1"), n = Variable.unary("n1");
// all m, n: Man | !(m = n) => !(m.floor = n.floor || m.ceiling =
// n.ceiling)
final Formula body = (m.join(floor).eq(n.join(floor))).or(m.join(ceiling).eq(n.join(ceiling)));
return (m.eq(n).not().implies(body.not())).forAll(m.oneOf(Man).and(n.oneOf(Man)));
}
Aggregations