Elm Exactly

Theoremfind?_isSome_iff

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

Statement

theorem find?_isSome_iff (f : FMap K V) (k : K) : (find? f k).isSome ↔ k ∈ f.keys

Proof

by
  induction f with
  | nil => simp [find?, keys]
  | cons p r ih =>
    obtain ⟨k', v⟩ := p
    simp only [find?, keys, List.map_cons, List.mem_cons]
    split
    · rename_i h; subst h; simp
    · rename_i h; simp only [keys] at ih; rw [ih]; constructor
      · exact Or.inr
      · rintro (e | e)
        · exact absurd e.symm h
        · exact e

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

Used by

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.