Elm Exactly

Theoremfind?_modify

StandardElmMech/Stat/FMap.lean:79 · tactic proof

Statement

theorem find?_modify (f g : FMap K V) (k : K) :
    find? (modify f g) k = (find? g k).or (find? f k)

Proof

by
  unfold modify
  rw [find?_append]
  cases hg : find? g k with
  | some v => simp
  | none =>
    have : k ∉ g.keys := fun h => by
      have := (find?_isSome_iff g k).mpr h; rw [hg] at this; cases this
    simpa using find?_filter_not f g.keys k this

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

Theorems it uses

In StandardElmMech/Stat/FMap.lean: Finite maps for the static semantics (association lists, first occurrence wins), with their lemmas.

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.