}
public static IStrategoTerm pushAmbiguities(IStrategoTerm term) {
if (isApplication(term, "amb") && term.getSubterm(0).isList() && term.getSubterm(0).getSubtermCount() == 2) {
IStrategoTerm left = pushAmbiguities(term.getSubterm(0).getSubterm(0));
IStrategoTerm right = pushAmbiguities(term.getSubterm(0).getSubterm(1));
if (left.getTermType() == IStrategoTerm.APPL &&
right.getTermType() == IStrategoTerm.APPL &&
left.getSubtermCount() == right.getSubtermCount() &&
((IStrategoAppl) left).getConstructor().equals(((IStrategoAppl) right).getConstructor())) {
IStrategoTerm[] ambKids = new IStrategoTerm[left.getSubtermCount()];
for (int i = 0; i < left.getSubtermCount(); i++)
ambKids[i] = makeAppl("amb",
ImploderAttachment.getElementSort(left.getSubterm(i)),
2,
makeList(ImploderAttachment.getElementSort(term.getSubterm(0)),
left.getSubterm(i), right.getSubterm(i)));
return makeAppl(
((IStrategoAppl) left).getConstructor().getName(),
ImploderAttachment.getElementSort(left),
left.getSubtermCount(),