import proveit
from proveit import defaults
from proveit import A, B, C, D
from proveit.logic import Implies, Not, Or
from proveit.logic.booleans.disjunction import left_in_bool, right_in_bool
left_in_bool.proof().disable(); right_in_bool.proof().disable() # disable these to avoid a longer proof
theory = proveit.Theory() # the theorem's theory
%proving destructive_dilemma
Prove by applying the constructive_dilemma after taking contraposing $A \Rightarrow C$ to $\lnot C \Rightarrow \lnot A$ and $B \Rightarrow D$ to $\lnot D \Rightarrow \lnot B$.
defaults.assumptions = destructive_dilemma.all_conditions()
Implies(A, C).contrapose()
Implies(B, D).contrapose()
Or(Not(C), Not(D)).derive_via_multi_dilemma(Or(Not(A), Not(B)))
%qed