Elm Exactly

Theoremdedup_step_nodup

StandardElmMech/Eff/MkObj.lean:84, Keeping the last binding of each key · tactic proof

Statement

theorem dedup_step_nodup (acc : List Bind) (k : String) (j : BVal) (h : k ∉ keysOf acc) :
    acc.filter (·.1 != k) ++ [(k, j)] = acc ++ [(k, j)]

Proof

by
  congr 1
  apply List.filter_eq_self.mpr
  intro x hx
  have : x.1 ≠ k := fun he => h (he ▸ List.mem_map_of_mem hx)
  simpa using this

Proved with tactics, which Lean expands into a proof term that its kernel checks.

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.