I am playing the Natural Number Game found here and am trying to prove a theorem in Lean4. The theorem states that if a natural number x
is less than or equal to 0, then x
must be 0. The formal statement is ∀ (x : ℕ), x ≤ 0 → x = 0
.
Here's my current code:
theorem le_zero (x : ℕ) (hx : x ≤ 0) : x = 0 := by {
apply le_trans x 0 x at hx,
cases x with d,
rfl,
symm,
-- Now I have a goal of `succ d = 0`
apply zero_le at hx,
-- Stuck here, it says 'oops'
}
I applied le_trans
and then used cases
to handle the base case x = 0
and the successor case x = succ d
. The base case is easily solved with rfl
, but I'm stuck on the successor case.
succ d
can never be0
. So your mistake has to be before you got to the goalsucc d = 0
. Hint 2: Have you tried it on paper? $\endgroup$