Zulip Chat Archive
Stream: general
Topic: How to prove ∃ x, a[i]? = some x
Zihao Zhang (Dec 01 2025 at 09:34):
import Mathlib
example {n:Nat}{a:List Char}(h1:n1 + 1 ≤ a.length):∃ x, a[a.length - (n1 + 1)]? = some x:=by
sorry
Zihao Zhang (Dec 01 2025 at 09:35):
I think it is quite trivial, but I can't prove it.
Sébastien Gouëzel (Dec 01 2025 at 09:38):
import Mathlib
example {n1 : ℕ} {a : List Char} (h1 : n1 + 1 ≤ a.length) : ∃ x, a[a.length - (n1 + 1)]? = some x :=
⟨a[a.length - (n1 + 1)], by grind⟩
Zihao Zhang (Dec 01 2025 at 09:47):
Can I just use a theorem to prove this? I think there’s a direct one.
Markus Himmel (Dec 01 2025 at 09:51):
The closest is probably docs#getElem?_pos.
Last updated: Dec 20 2025 at 21:32 UTC