"""Develop a named intermediate claim independently of its continuation."""

from judgment import Session, implies


def main():
    s = Session()
    P = s.prop("P")
    Q = s.prop("Q")
    proof = s.theorem("swap_with_claim", implies(P & Q, Q & P))
    h = proof.intro()

    step = proof.have("first_component", Q)
    step.sorry()
    proof.exact(proof.conjoin(step.fact(), proof.left(h)))

    # The continuation is solved, but the intermediate claim still needs proof.
    step.resume()
    step.exact(step.right(h))
    theorem = proof.finish()
    print(theorem)
    print("Axiom dependencies:", len(theorem.axioms()))


if __name__ == "__main__":
    main()
