Zulip Chat Archive
Stream: new members
Topic: Cases for impossible values by hypothesis
Dominic Steinitz (Oct 29 2024 at 08:37):
I was surprised I had to explicitly do something with 0 as it is ruled out by hypothesis. I assume there is a better way to do this.
example (n : ℕ) (h : n > 0) : n = n - 1 + 1 := by
cases n with
| zero => contradiction
| succ m => rfl
Luigi Massacci (Oct 29 2024 at 08:44):
Indeed you didn’t have to ; )
Luigi Massacci (Oct 29 2024 at 08:44):
import Mathlib
example (n : ℕ) (h : n > 0) : n = n - 1 + 1 := by
cases h with
| _ => rfl
Last updated: May 02 2025 at 03:31 UTC