Theoremlookup_sortByKey
Statement
theorem lookup_sortByKey (k : String) : ∀ l : List Bind, (keysOf l).Nodup →
fmLookup (sortByKey l) k = fmLookup l k
| [], _ => rfl
| (a, v) :: l, hn => by
simp only [keysOf, List.map_cons, List.nodup_cons] at hn
show fmLookup (insertByKey (a, v) (sortByKey l)) k = _
rw [lookup_insertByKey k (a, v) _ (fun hm => hn.1 ((keysOf_sortByKey_perm l).mem_iff.mp hm)),
lookup_sortByKey k l hn.2]
by_cases h : a = k <;> simp [fmLookup, h]Proof
Proved by a term, which Lean's kernel checks directly.
Used by
In StandardElmMech/Eff/MkObj.lean: A76: mkObj ignores the order of distinct keys (a76_mkObj_perm), a lookup finds the last binding (lookup_mkObj), and decoding ignores keys outside the record type (a76_dec_extra_key).
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.