Java Code Examples for kodkod.ast.Formula#iff()

The following examples show how to use kodkod.ast.Formula#iff() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GEO158.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the meet_defn axiom.
 *
 * @return meet_defn
 */
public final Formula meetDefn() {
    // all P: Point, C, C1: Curve | P->C->C1 in meet iff
    // (P->C in incident && P->C1 in incident &&
    // incident.C & incident.C1 in endPoint.C & endPoint.C1)
    final Variable c = Variable.unary("C");
    final Variable c1 = Variable.unary("C1");
    final Variable p = Variable.unary("P");

    final Formula f0 = p.product(c).product(c1).in(meet);
    final Formula f1 = p.product(c).in(incident).and(p.product(c1).in(incident));
    final Expression e0 = incident.join(c).intersection(incident.join(c1));
    final Expression e1 = endPoint.join(c).intersection(endPoint.join(c1));
    final Formula f2 = e0.in(e1);

    final Formula f3 = f0.iff(f1.and(f2));

    return f3.forAll(p.oneOf(point).and(c.oneOf(curve)).and(c1.oneOf(curve)));
}
 
Example 2
Source File: GEO158.java    From kodkod with MIT License 6 votes vote down vote up
/**
 * Returns the meet_defn axiom.
 * @return meet_defn 
 */
public final Formula meetDefn() { 
	//  all P: Point, C, C1: Curve | P->C->C1 in meet iff
	//   (P->C in incident && P->C1 in incident &&
	//		    incident.C & incident.C1 in endPoint.C & endPoint.C1)
	final Variable c = Variable.unary("C");
	final Variable c1 = Variable.unary("C1");
	final Variable p = Variable.unary("P");
	
	final Formula f0 = p.product(c).product(c1).in(meet);
	final Formula f1 = p.product(c).in(incident).and(p.product(c1).in(incident));
	final Expression e0 = incident.join(c).intersection(incident.join(c1));
	final Expression e1 = endPoint.join(c).intersection(endPoint.join(c1));
	final Formula f2 = e0.in(e1);
	
	final Formula f3 = f0.iff(f1.and(f2));
	
	return f3.forAll(p.oneOf(point).and(c.oneOf(curve)).and(c1.oneOf(curve)));
}