"""Inspect a theorem application before selecting it."""

from judgment import Session


def main():
    s = Session()
    identity = s.theorem("identity_refl")
    A = identity.type_var("A")
    x = identity.var("x", A)
    identity.goal(x == x)
    identity.rfl()
    _ = identity.finish()

    P = s.prop("P")
    proof = s.theorem("discovered", P == P)
    candidates = proof.suggest("identity")
    print("Candidate:", candidates[0].name())
    print("Remaining premises:", len(candidates[0].premises()))
    _ = proof.apply(candidates[0])
    print(proof.finish())


if __name__ == "__main__":
    main()
