"""Inspect a deferred claim and recover it by name or exact goal identity."""

from judgment import Session, implies


def main() raises:
    var s = Session()
    var P = s.prop("P")
    var Q = s.prop("Q")
    var proof = s.theorem("swap", implies(P & Q, Q & P))
    var h = proof.intro("h")
    var step = proof.have("first_component", Q)
    step.sorry()
    proof.exact(proof.conjoin(step.fact(), proof.left(h)))
    print(proof.format())

    var goals = proof.obligations()
    var missing = proof.select("first_component")
    missing.resume()
    missing = proof.select(goals[0])
    missing.exact(missing.right(missing.fact("h")))
    print(proof.format())
    print(proof.finish())
    print(proof.format())
