import proveit
from proveit import defaults
from proveit import A, B
from proveit.logic import in_bool, Or
theory = proveit.Theory() # the theorem's theory
%proving or_if_left
We will prove this using unfold_is_bool_explicit
, proving $(B = \top) \lor (B = \bot)$, rather than unfold_is_bool
to prove $B \lor (\lnot B)$. The latter would make this proof shorter, but requires constructive_dilemma
which will use this theorem for convenience.
defaults.assumptions = or_if_left.all_conditions()
BeqT_or_BeqF = in_bool(B).unfold(assumptions=[in_bool(B)])
BeqT = BeqT_or_BeqF.operands[0]
BeqF = BeqT_or_BeqF.operands[1]
By proving $\vdash (B = \top) \in \mathbb{B}$ and $\vdash (B = \bot) \in \mathbb{B}$ (under no assumptions) we can force the proof to be shorter than otherwise (since it automatically deduces these assuming $B \in \mathbb{B}$ in a convoluted manner).
in_bool(BeqT).prove(assumptions=[])
in_bool(BeqF).prove(assumptions=[])
Or(A, B).prove(assumptions=[A, BeqT])
Or(A, B).prove(assumptions=[A, BeqF])
BeqT_or_BeqF.derive_via_singular_dilemma(Or(A, B), assumptions=[in_bool(B), A])
%qed