Java Code Examples for kodkod.ast.RelationPredicate#TotalOrdering

The following examples show how to use kodkod.ast.RelationPredicate#TotalOrdering . 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: AbstractVoidVisitor.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/**
 * Visits the children of the predicate if this.visited(pred) returns false.
 * Otherwise does nothing.
 *
 * @ensures pred.relation.accept(this) && (pred.name = FUNCTION =>
 *          pred.domain.accept(this) && pred.range.accept(this)) && (pred.name =
 *          TOTAL_ORDERING => pred.ordered.accept(this) &&
 *          pred.first.accept(this) && pred.last.accept(this) )
 */
@Override
public void visit(RelationPredicate pred) {
    if (visited(pred))
        return;
    pred.relation().accept(this);
    if (pred.name() == RelationPredicate.Name.FUNCTION) {
        final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
        fp.domain().accept(this);
        fp.range().accept(this);
    } else if (pred.name() == RelationPredicate.Name.TOTAL_ORDERING) {
        final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
        tp.ordered().accept(this);
        tp.first().accept(this);
        tp.last().accept(this);
    }
}
 
Example 2
Source File: AbstractDetector.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/**
 * Calls lookup(predicate) and returns the cached value, if any. If no cached
 * value exists, visits each child, caches the disjunction of the children's
 * return values and returns it.
 *
 * @return let x = lookup(predicate) | x != null => x, cache(predicate, some n:
 *         predicate.children | n.accept(this))
 */
@Override
public Boolean visit(RelationPredicate predicate) {
    final Boolean ret = lookup(predicate);
    if (ret != null)
        return ret;
    if (predicate.relation().accept(this))
        return cache(predicate, true);
    if (predicate.name() == RelationPredicate.Name.FUNCTION) {
        final RelationPredicate.Function fp = (RelationPredicate.Function) predicate;
        return cache(predicate, fp.domain().accept(this) || fp.range().accept(this));
    } else if (predicate.name() == RelationPredicate.Name.TOTAL_ORDERING) {
        final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) predicate;
        return cache(predicate, tp.ordered().accept(this) || tp.first().accept(this) || tp.last().accept(this));
    }
    return cache(predicate, false);
}
 
Example 3
Source File: AnnotatedNode.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
@Override
public Boolean visit(RelationPredicate pred) {
    Boolean ans = get(pred);
    if (ans != null)
        return ans;
    pred.relation().accept(this);
    if (pred.name() == RelationPredicate.Name.FUNCTION) {
        final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
        fp.domain().accept(this);
        fp.range().accept(this);
    } else if (pred.name() == RelationPredicate.Name.TOTAL_ORDERING) {
        final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
        tp.ordered().accept(this);
        tp.first().accept(this);
        tp.last().accept(this);
    }
    return noHOL(pred);
}
 
Example 4
Source File: AbstractCollector.java    From kodkod with MIT License 6 votes vote down vote up
/** 
 * Calls lookup(predicate) and returns the cached value, if any.  
 * If no cached value exists, visits each child, caches the
 * disjunction of the children's return values and returns it. 
 * @return let x = lookup(predicate) | 
 *          x != null => x,  
 *          cache(predicate, some n: predicate.children | n.accept(this)) 
 */
public Set<T> visit(RelationPredicate pred) {
	Set<T> ret = lookup(pred);
	if (ret!=null) return ret;
	ret = newSet();
	ret.addAll(pred.relation().accept(this));
	switch(pred.name()) {
	case ACYCLIC : 
		break;
	case FUNCTION :
		final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
		ret.addAll(fp.domain().accept(this));
		ret.addAll(fp.range().accept(this));
		break;
	case TOTAL_ORDERING : 
		final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
		ret.addAll(tp.ordered().accept(this));
		ret.addAll(tp.first().accept(this));
		ret.addAll(tp.last().accept(this));
		break;
	default :
		throw new IllegalArgumentException("unknown relation predicate: " + pred.name());
	}
	return cache(pred,ret);
}
 
Example 5
Source File: AbstractReplacer.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
/**
 * Calls lookup(pred) and returns the cached value, if any. If a replacement has
 * not been cached, visits the formula's children. If nothing changes, the
 * argument is cached and returned, otherwise a replacement formula is cached
 * and returned.
 *
 * @return { p: RelationPredicate | p.name = pred.name && p.relation =
 *         pred.relation.accept(delegate) && p.name = FUNCTION => p.targetMult =
 *         pred.targetMult && p.domain = pred.domain.accept(delegate) && p.range
 *         = pred.range.accept(delegate), p.name = TOTAL_ORDERING => p.ordered =
 *         pred.ordered.accept(delegate) && p.first =
 *         pred.first.accept(delegate) && p.last = pred.last.accept(delegate) }
 */
@Override
public Formula visit(RelationPredicate pred) {
    Formula ret = lookup(pred);
    if (ret != null)
        return ret;

    final Relation r = (Relation) pred.relation().accept(delegate);
    switch (pred.name()) {
        case ACYCLIC :
            ret = (r == pred.relation()) ? pred : r.acyclic();
            break;
        case FUNCTION :
            final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
            final Expression domain = fp.domain().accept(delegate);
            final Expression range = fp.range().accept(delegate);
            ret = (r == fp.relation() && domain == fp.domain() && range == fp.range()) ? fp : (fp.targetMult() == Multiplicity.ONE ? r.function(domain, range) : r.partialFunction(domain, range));
            break;
        case TOTAL_ORDERING :
            final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
            final Relation ordered = (Relation) tp.ordered().accept(delegate);
            final Relation first = (Relation) tp.first().accept(delegate);
            final Relation last = (Relation) tp.last().accept(delegate);
            ret = (r == tp.relation() && ordered == tp.ordered() && first == tp.first() && last == tp.last()) ? tp : r.totalOrder(ordered, first, last);
            break;
        default :
            throw new IllegalArgumentException("unknown relation predicate: " + pred.name());
    }
    return cache(pred, ret);
}
 
Example 6
Source File: AbstractCollector.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
/**
 * Calls lookup(predicate) and returns the cached value, if any. If no cached
 * value exists, visits each child, caches the disjunction of the children's
 * return values and returns it.
 *
 * @return let x = lookup(predicate) | x != null => x, cache(predicate, some n:
 *         predicate.children | n.accept(this))
 */
@Override
public Set<T> visit(RelationPredicate pred) {
    Set<T> ret = lookup(pred);
    if (ret != null)
        return ret;
    ret = newSet();
    ret.addAll(pred.relation().accept(this));
    switch (pred.name()) {
        case ACYCLIC :
            break;
        case FUNCTION :
            final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
            ret.addAll(fp.domain().accept(this));
            ret.addAll(fp.range().accept(this));
            break;
        case TOTAL_ORDERING :
            final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
            ret.addAll(tp.ordered().accept(this));
            ret.addAll(tp.first().accept(this));
            ret.addAll(tp.last().accept(this));
            break;
        default :
            throw new IllegalArgumentException("unknown relation predicate: " + pred.name());
    }
    return cache(pred, ret);
}
 
Example 7
Source File: PrettyPrinter.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
/**
 * @ensures appends the tokenization of the given node to this.tokens
 */
@Override
public void visit(RelationPredicate node) {
    switch (node.name()) {
        case ACYCLIC :
            append("acyclic");
            append("[");
            node.relation().accept(this);
            append("]");
            break;
        case FUNCTION :
            RelationPredicate.Function func = (RelationPredicate.Function) node;
            append("function");
            append("[");
            func.relation().accept(this);
            colon();
            func.domain().accept(this);
            infix("->");
            keyword(func.targetMult());
            func.range().accept(this);
            append("]");
            break;
        case TOTAL_ORDERING :
            RelationPredicate.TotalOrdering ord = (RelationPredicate.TotalOrdering) node;
            append("ord");
            append("[");
            ord.relation().accept(this);
            comma();
            ord.ordered().accept(this);
            comma();
            ord.first().accept(this);
            comma();
            ord.last().accept(this);
            append("]");
            break;
        default :
            throw new AssertionError("unreachable");
    }

}
 
Example 8
Source File: PrettyPrinter.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(RelationPredicate pred) {
    if (visited(pred))
        return;

    if (pred.name() == RelationPredicate.Name.FUNCTION) {
        final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
        visit(fp, fp.name(), fp.domain(), fp.range());
    } else if (pred.name() == RelationPredicate.Name.TOTAL_ORDERING) {
        final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
        visit(tp, tp.name(), tp.ordered(), tp.first(), tp.last());
    } else {
        throw new IllegalArgumentException("Unknown predicate: " + pred);
    }
}
 
Example 9
Source File: AbstractReplacer.java    From kodkod with MIT License 5 votes vote down vote up
/** 
 * Calls lookup(pred) and returns the cached value, if any.  
 * If a replacement has not been cached, visits the formula's 
 * children.  If nothing changes, the argument is cached and
 * returned, otherwise a replacement formula is cached and returned.
 * @return { p: RelationPredicate | p.name = pred.name && p.relation = pred.relation.accept(this) &&
 *                                  p.name = FUNCTION => p.targetMult = pred.targetMult && 
 *                                                       p.domain = pred.domain.accept(this) &&
 *                                                       p.range = pred.range.accept(this),
 *                                  p.name = TOTAL_ORDERING => p.ordered = pred.ordered.accept(this) &&
 *                                                             p.first = pred.first.accept(this) &&
 *                                                             p.last = pred.last.accept(this) }
 */
public Formula visit(RelationPredicate pred) {
	Formula ret = lookup(pred);
	if (ret!=null) return ret;

	final Relation r = (Relation)pred.relation().accept(this);
	switch(pred.name()) {
	case ACYCLIC :  
		ret = (r==pred.relation()) ? pred : r.acyclic(); 
		break;
	case FUNCTION :
		final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
		final Expression domain = fp.domain().accept(this);
		final Expression range = fp.range().accept(this);
		ret = (r==fp.relation() && domain==fp.domain() && range==fp.range()) ?
				fp : 
				(fp.targetMult()==Multiplicity.ONE ? r.function(domain, range) : r.partialFunction(domain,range));
		break;
	case TOTAL_ORDERING : 
		final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
		final Relation ordered = (Relation) tp.ordered().accept(this);
		final Relation first = (Relation)tp.first().accept(this);
		final Relation last = (Relation)tp.last().accept(this);
		ret = (r==tp.relation() && ordered==tp.ordered() && first==tp.first() && last==tp.last()) ? 
				tp : r.totalOrder(ordered, first, last);
		break;
	default :
		throw new IllegalArgumentException("unknown relation predicate: " + pred.name());
	}
	return cache(pred,ret);
}
 
Example 10
Source File: AbstractVoidVisitor.java    From kodkod with MIT License 5 votes vote down vote up
/**
 * Visits the children of the predicate  if
 * this.visited(pred) returns false.  Otherwise does nothing.
 * @ensures pred.relation.accept(this) && 
 *          (pred.name = FUNCTION => pred.domain.accept(this) && pred.range.accept(this)) && 
 *          (pred.name = TOTAL_ORDERING => 
 *            pred.ordered.accept(this) && pred.first.accept(this) && pred.last.accept(this) )
 */
public void visit(RelationPredicate pred) {
	if (visited(pred)) return;
	pred.relation().accept(this);
	if (pred.name()==RelationPredicate.Name.FUNCTION) {
		final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
		fp.domain().accept(this);
		fp.range().accept(this);
	} else if (pred.name()==RelationPredicate.Name.TOTAL_ORDERING) {
		final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
		tp.ordered().accept(this);
		tp.first().accept(this);
		tp.last().accept(this);
	}
}
 
Example 11
Source File: AbstractDetector.java    From kodkod with MIT License 5 votes vote down vote up
/** 
 * Calls lookup(predicate) and returns the cached value, if any.  
 * If no cached value exists, visits each child, caches the
 * disjunction of the children's return values and returns it. 
 * @return let x = lookup(predicate) | 
 *          x != null => x,  
 *          cache(predicate, some n: predicate.children | n.accept(this)) 
 */
public Boolean visit(RelationPredicate predicate) {
	final Boolean ret = lookup(predicate);
	if (ret!=null) return ret;
	if (predicate.relation().accept(this)) 
		return cache(predicate, true);
	if (predicate.name()==RelationPredicate.Name.FUNCTION) {
		final RelationPredicate.Function fp = (RelationPredicate.Function) predicate;
		return cache(predicate, fp.domain().accept(this) || fp.range().accept(this));
	} else if (predicate.name()==RelationPredicate.Name.TOTAL_ORDERING) {
		final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) predicate;
		return cache(predicate, tp.ordered().accept(this) || tp.first().accept(this) || tp.last().accept(this));
	}
	return cache(predicate, false);
}
 
Example 12
Source File: PrettyPrinter.java    From kodkod with MIT License 5 votes vote down vote up
/** @ensures appends the tokenization of the given node to this.tokens */
public void visit(RelationPredicate node) {
	switch(node.name()) { 
	case ACYCLIC : 
		append("acyclic");
		append("[");
		node.relation().accept(this);
		append("]");
		break;
	case FUNCTION : 
		RelationPredicate.Function func = (RelationPredicate.Function)node;
		append("function");
		append("[");
		func.relation().accept(this);
		colon();
		func.domain().accept(this);
		infix("->");
		keyword(func.targetMult());
		func.range().accept(this);
		append("]");
		break;
	case TOTAL_ORDERING : 
		RelationPredicate.TotalOrdering ord = (RelationPredicate.TotalOrdering)node;
		append("ord");
		append("[");
		ord.relation().accept(this);
		comma();
		ord.ordered().accept(this);
		comma();
		ord.first().accept(this);
		comma();
		ord.last().accept(this);
		append("]");
		break;
	default:
		throw new AssertionError("unreachable");
	}
	
}
 
Example 13
Source File: PrettyPrinter.java    From kodkod with MIT License 5 votes vote down vote up
public void visit(RelationPredicate pred) {
	if (visited(pred)) return;
	
	if (pred.name()==RelationPredicate.Name.FUNCTION) {
		final RelationPredicate.Function fp = (RelationPredicate.Function) pred;
		visit(fp, fp.name(),  fp.domain(), fp.range() );
	} else if (pred.name()==RelationPredicate.Name.TOTAL_ORDERING) {
		final RelationPredicate.TotalOrdering tp = (RelationPredicate.TotalOrdering) pred;
		visit(tp, tp.name(),  tp.ordered(), tp.first(), tp.last() );
	} else {
		throw new IllegalArgumentException("Unknown predicate: " + pred);
	}
}
 
Example 14
Source File: SymmetryBreaker.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
/**
 * If possible, breaks symmetry on the given total ordering predicate and
 * returns a formula f such that the meaning of total with respect to
 * this.bounds is equivalent to the meaning of f with respect to this.bounds'.
 * If symmetry cannot be broken on the given predicate, returns null.
 * <p>
 * We break symmetry on the relation constrained by the given predicate iff
 * total.first, total.last, and total.ordered have the same upper bound, which,
 * when cross-multiplied with itself gives the upper bound of total.relation.
 * Assuming that this is the case, we then break symmetry on total.relation,
 * total.first, total.last, and total.ordered using one of the methods described
 * in {@linkplain #breakMatrixSymmetries(Map, boolean)}; the method used depends
 * on the value of the "agressive" flag. The partition that formed the upper
 * bound of total.ordered is removed from this.symmetries.
 * </p>
 *
 * @return null if symmetry cannot be broken on total; otherwise returns a
 *         formula f such that the meaning of total with respect to this.bounds
 *         is equivalent to the meaning of f with respect to this.bounds'
 * @ensures this.symmetries and this.bounds are modified as desribed in
 *          {@linkplain #breakMatrixSymmetries(Map, boolean)} iff total.first,
 *          total.last, and total.ordered have the same upper bound, which, when
 *          cross-multiplied with itself gives the upper bound of total.relation
 * @see #breakMatrixSymmetries(Map,boolean)
 */
private final Formula breakTotalOrder(RelationPredicate.TotalOrdering total, boolean aggressive) {
    final Relation first = total.first(), last = total.last(), ordered = total.ordered(),
                    relation = total.relation();
    final IntSet domain = bounds.upperBound(ordered).indexView();

    if (symmetricColumnPartitions(ordered) != null && bounds.upperBound(first).indexView().contains(domain.min()) && bounds.upperBound(last).indexView().contains(domain.max())) {

        // construct the natural ordering that corresponds to the ordering
        // of the atoms in the universe
        final IntSet ordering = Ints.bestSet(usize * usize);
        int prev = domain.min();
        for (IntIterator atoms = domain.iterator(prev + 1, usize); atoms.hasNext();) {
            int next = atoms.next();
            ordering.add(prev * usize + next);
            prev = next;
        }

        if (ordering.containsAll(bounds.lowerBound(relation).indexView()) && bounds.upperBound(relation).indexView().containsAll(ordering)) {

            // remove the ordered partition from the set of symmetric
            // partitions
            removePartition(domain.min());

            final TupleFactory f = bounds.universe().factory();

            if (aggressive) {
                bounds.boundExactly(first, f.setOf(f.tuple(1, domain.min())));
                bounds.boundExactly(last, f.setOf(f.tuple(1, domain.max())));
                bounds.boundExactly(ordered, bounds.upperBound(total.ordered()));
                bounds.boundExactly(relation, f.setOf(2, ordering));

                return Formula.TRUE;

            } else {
                final Relation firstConst = Relation.unary("SYM_BREAK_CONST_" + first.name());
                final Relation lastConst = Relation.unary("SYM_BREAK_CONST_" + last.name());
                final Relation ordConst = Relation.unary("SYM_BREAK_CONST_" + ordered.name());
                final Relation relConst = Relation.binary("SYM_BREAK_CONST_" + relation.name());
                bounds.boundExactly(firstConst, f.setOf(f.tuple(1, domain.min())));
                bounds.boundExactly(lastConst, f.setOf(f.tuple(1, domain.max())));
                bounds.boundExactly(ordConst, bounds.upperBound(total.ordered()));
                bounds.boundExactly(relConst, f.setOf(2, ordering));

                return Formula.and(first.eq(firstConst), last.eq(lastConst), ordered.eq(ordConst), relation.eq(relConst));
                // return first.eq(firstConst).and(last.eq(lastConst)).and(
                // ordered.eq(ordConst)).and( relation.eq(relConst));
            }

        }
    }

    return null;
}
 
Example 15
Source File: SymmetryBreaker.java    From kodkod with MIT License 4 votes vote down vote up
/**
	 * If possible, breaks symmetry on the given total ordering predicate and returns a formula
	 * f such that the meaning of total with respect to this.bounds is equivalent to the
	 * meaning of f with respect to this.bounds'. If symmetry cannot be broken on the given predicate, returns null.  
	 * 
	 * <p>We break symmetry on the relation constrained by the given predicate iff 
	 * total.first, total.last, and total.ordered have the same upper bound, which, when 
	 * cross-multiplied with itself gives the upper bound of total.relation. Assuming that this is the case, 
	 * we then break symmetry on total.relation, total.first, total.last, and total.ordered using one of the methods
	 * described in {@linkplain #breakMatrixSymmetries(Map, boolean)}; the method used depends
	 * on the value of the "aggressive" flag.
	 * The partition that formed the upper bound of total.ordered is removed from this.symmetries.</p>
	 * 
	 * @return null if symmetry cannot be broken on total; otherwise returns a formula
	 * f such that the meaning of total with respect to this.bounds is equivalent to the
	 * meaning of f with respect to this.bounds' 
	 * @ensures this.symmetries and this.bounds are modified as described in {@linkplain #breakMatrixSymmetries(Map, boolean)}
	 * iff total.first, total.last, and total.ordered have the same upper bound, which, when 
	 * cross-multiplied with itself gives the upper bound of total.relation
	 * 
	 * @see #breakMatrixSymmetries(Map,boolean)
	 */
	private final Formula breakTotalOrder(RelationPredicate.TotalOrdering total, boolean aggressive) {
		final Relation first = total.first(), last = total.last(), ordered = total.ordered(), relation = total.relation();
		final IntSet domain = bounds.upperBound(ordered).indexView();		
	
		if (symmetricColumnPartitions(ordered)!=null && 
			bounds.upperBound(first).indexView().contains(domain.min()) && 
			bounds.upperBound(last).indexView().contains(domain.max())) {
			
			// construct the natural ordering that corresponds to the ordering of the atoms in the universe
			final IntSet ordering = Ints.bestSet(usize*usize);
			int prev = domain.min();
			for(IntIterator atoms = domain.iterator(prev+1, usize); atoms.hasNext(); ) {
				int next = atoms.next();
				ordering.add(prev*usize + next);
				prev = next;
			}
			
			if (ordering.containsAll(bounds.lowerBound(relation).indexView()) &&
				bounds.upperBound(relation).indexView().containsAll(ordering)) {
				
				// remove the ordered partition from the set of symmetric partitions
				removePartition(domain.min());
				
				final TupleFactory f = bounds.universe().factory();
				
				if (aggressive) {
					bounds.boundExactly(first, f.setOf(f.tuple(1, domain.min())));
					bounds.boundExactly(last, f.setOf(f.tuple(1, domain.max())));
					bounds.boundExactly(ordered, bounds.upperBound(total.ordered()));
					bounds.boundExactly(relation, f.setOf(2, ordering));
					
					return Formula.TRUE;
					
				} else {
					final Relation firstConst = Relation.unary("SYM_BREAK_CONST_"+first.name());
					final Relation lastConst = Relation.unary("SYM_BREAK_CONST_"+last.name());
					final Relation ordConst = Relation.unary("SYM_BREAK_CONST_"+ordered.name());
					final Relation relConst = Relation.binary("SYM_BREAK_CONST_"+relation.name());
					bounds.boundExactly(firstConst, f.setOf(f.tuple(1, domain.min())));
					bounds.boundExactly(lastConst, f.setOf(f.tuple(1, domain.max())));
					bounds.boundExactly(ordConst, bounds.upperBound(total.ordered()));
					bounds.boundExactly(relConst, f.setOf(2, ordering));
					
					return Formula.and(first.eq(firstConst), last.eq(lastConst), ordered.eq(ordConst), relation.eq(relConst));
//					return first.eq(firstConst).and(last.eq(lastConst)).and( ordered.eq(ordConst)).and( relation.eq(relConst));
				}

			}
		}
		
		return null;
	}
 
Example 16
Source File: PrettyPrinter.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
/** @effects appends the tokenization of the given node to this.tokens */
public void visit(RelationPredicate node) {
	if (displayed(node)) return;
	final boolean oldTop = notTop();
	switch(node.name()) { 
	case ACYCLIC : 
		append("acyclic");
		append("[");
		node.relation().accept(this);
		append("]");
		break;
	case FUNCTION : 
		RelationPredicate.Function func = (RelationPredicate.Function)node;
		append("function");
		append("[");
		func.relation().accept(this);
		colon();
		func.domain().accept(this);
		infix("->");
		keyword(func.targetMult());
		func.range().accept(this);
		append("]");
		break;
	case TOTAL_ORDERING : 
		RelationPredicate.TotalOrdering ord = (RelationPredicate.TotalOrdering)node;
		append("ord");
		append("[");
		ord.relation().accept(this);
		comma();
		ord.ordered().accept(this);
		comma();
		ord.first().accept(this);
		comma();
		ord.last().accept(this);
		append("]");
		break;
	default:
		throw new AssertionError("unreachable");
	}
	top = oldTop;
}