'If there is a substitution corresponding to this variable,
return the substituted category.'

def substitute(self, substitutions):

    for (var, cat) in substitutions:
        if (var == self):
            return cat
    return self
