Example #1
0
def replaceNthNT(term: PPTerm, ntId: int, newSubTerm: PPTerm) -> PPTerm:
    newTerm = ASTUtils.applyTdOnce(term, ASTUtils.isNthNT(ntId),
                                   lambda nt: newSubTerm)
    return newTerm
Example #2
0
def expandNthNT(term: PPTerm, ntId: int, expand: Callable[[PPTermNT],
                                                          PPTerm]) -> PPTerm:
    newTerm = ASTUtils.applyTdOnce(term, ASTUtils.isNthNT(ntId), expand)
    return newTerm