"""Prove that a conjunction can be swapped without adding an axiom."""

from judgment import Session, implies


def main():
    s = Session()
    p = s.prop("P")
    q = s.prop("Q")
    p_and_q = p & q
    q_and_p = q & p
    expected = implies(p_and_q, q_and_p)

    forward = s.proof()
    premise = forward.assume(p_and_q)
    swapped = forward.conjoin(forward.right(premise), forward.left(premise))
    theorem = forward.finish(swapped)

    assert theorem.statement().same_as(expected)
    assert len(theorem.hypotheses()) == 0
    assert len(theorem.axioms()) == 0
    print("Proved: (P and Q) implies (Q and P)")
    print("Remaining hypotheses: 0")


if __name__ == "__main__":
    main()
