def index_fact(fact, index, negated=False):
    """
    Returns a representation of 'fact' containing the step number and a
    leading 'not-' if the fact is negated
    """
    name = str(fact)
    if negated:
        name = 'not-' + name
    return "%s-%d" % (name, index)