Theoremlookup_mkObj
A lookup in mkObj kvs finds the last binding of the key in kvs.
Statement
theorem lookup_mkObj (kvs : List Bind) (k : String) :
(match BVal.mkObj kvs with | .obj o => o.lookup k | _ => none) = lookupLast kvs kProof
by
unfold BVal.mkObj BVal.object
simp only
rw [lookup_ofList]
show fmLookup (sortByKey (dedupLastByKey kvs)) k = _
rw [lookup_sortByKey k _ (by unfold dedupLastByKey; exact dedup_keys_nodup _ [] List.nodup_nil)]
unfold dedupLastByKey
rw [dedup_foldl_lookup]
cases lookupLast kvs k <;> rflProved with tactics, which Lean expands into a proof term that its kernel checks.
Theorems it uses
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.