TheoremfmLookup_filter
Statement
theorem fmLookup_filter {β : Type} (f : List (String × β)) (P : String → Bool) (a : String) :
fmLookup (f.filter (fun p => P p.1)) a = if P a then fmLookup f a else noneProof
by
induction f with
| nil => simp [fmLookup]
| cons p f ih =>
obtain ⟨k, x⟩ := p
simp only [List.filter_cons]
by_cases hk : k = a
· subst hk; by_cases hP : P k <;> simp [hP, fmLookup, ih]
· have hka : (k == a) = false := by simpa using hk
split <;> simp [fmLookup, hka, ih]Proved with tactics, which Lean expands into a proof term that its kernel checks.
Used by
In StandardElmMech/Mod/Properties.lean: The frame lemmas (a module's derivation reads the basis only at the modules it imports) and Btest_agrees.
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.