by_cases
Summary
All propositional logic problems can in theory be solved by just throwing a truth table at them. The by_cases
tactic is a simple truth table tactic: by_cases P
turns one goal into two goals, with P
is assumed in the first, and ¬P
in the second.
Examples
If
P
is a proposition, thenby_cases P
turns your goal into two goals, and in each of your new tactic states you have one extra hypothesis. In the first one you have a new hypothesish : P
and in the second you have a new hypothesish : ¬P
.If you already have a hypothesis
h
then this can get a bit confusing, so you can also doby_cases hP : P
; then your new hypotheses will behP : P
andhP : ¬P
.
Details
For those of you interested in constructive mathematics, the by_cases
tactic (like the by_contra tactic) is not valid constructively. We are doing a case split on P ∨ ¬P
, and to prove P ∨ ¬P
in general we need to assume the law of the excluded middle. In this course we will not be paying any attention to any logic other than classical logic, meaning that this case split is mathematically valid.
Further notes
There’s a much higher powered tactic which does case splits on all propositions and grinds everything out: the tauto!
tactic. The tauto!
tactic probably proves every goal in all the questions in section 1, however you won’t learn any other tactics if you keep using it!