Elm Exactly

Theoremfind?_filter_not

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

Statement

theorem find?_filter_not (f : FMap K V) (ks : List K) (k : K) (hk : k ∉ ks) :
    find? (f.filter fun p => !decide (p.1 ∈ ks)) k = find? f k

Proof

by
  induction f with
  | nil => rfl
  | cons p r ih =>
    obtain ⟨k', v⟩ := p
    rw [List.filter_cons]
    by_cases hc : k' ∈ ks
    · have : k' ≠ k := fun e => hk (e ▸ hc)
      simp only [hc, decide_true, Bool.not_true, Bool.false_eq_true, ↓reduceIte, ih, find?, this]
    · simp only [hc, decide_false, Bool.not_false, ↓reduceIte, find?, ih]

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.