Zulip Chat Archive
Stream: lean4
Topic: getElem and List.get
Eric Wieser (Nov 15 2024 at 23:24):
Does this lemma exist anywhere?
example {α} {l : List α} (i : Fin l.length) : l[i] = l.get i := by
sorry
It's true by rfl
, which makes it hard to search for.
Henrik Böving (Nov 15 2024 at 23:50):
Why would it be heard to search for because of that?: https://loogle.lean-lang.org/?q=List.get%2C+GetElem.getElem, gets you docs#List.get_eq_getElem
Eric Wieser (Nov 16 2024 at 01:22):
That theorem doesn't close the goal here though
Eric Wieser (Nov 16 2024 at 01:23):
example {α} {l : List α} (i : Fin l.length) : l[i] = l.get i := by
rw [List.get_eq_getElem]
-- goal is `l[i] = l[↑i]`
Eric Wieser (Nov 16 2024 at 01:23):
Henrik Böving said:
Why would it be heard to search for because of that?:
Because exact?
won't look beyond rfl
, IIRC
François G. Dorais (Nov 16 2024 at 01:24):
@Kim Morrison There might be some specialized needs for fget
after all.
Markus Himmel (Nov 16 2024 at 06:30):
The missing lemma to close the goal is docs#Fin.getElem_fin. simp
finds both of these lemmas. I'm not sure whether there should be a lemma that combines the two, because docs#Fin.instGetElemFinVal is very general, so this lemma would need to be stated for a lot of other types with GetElem
in addition to lists.
Last updated: May 02 2025 at 03:31 UTC