}
/** Simplify (a.(a->b)) into b when semantically equivalent */
private final Expression condense(Expression x) {
while (x instanceof BinaryExpression) {
BinaryExpression b = (BinaryExpression)x;
if (b.op() == ExprOperator.JOIN && b.left() instanceof Relation && b.right() instanceof BinaryExpression) {
Relation r = (Relation) (b.left());
try {
if (sol.query(true, r, false).size()!=1) return x;
if (sol.query(false, r, false).size()!=1) return x;
} catch(Err er) {
return x;
}
b = (BinaryExpression)(b.right());
if (b.op() == ExprOperator.PRODUCT && b.left()==r) {
x = b.right();
continue;
}
}
break;
}