Elm Exactly

TheoremnatLookup_filter_ne

StandardElmMech/Prog/Objects.lean:103 · tactic proof

Statement

theorem natLookup_filter_ne {β : Type} : ∀ (f : List (Nat × β)) (n q : Nat), q ≠ n →
    natLookup (f.filter (·.1 != n)) q = natLookup f q
  | [], _, _, _ => rfl
  | (k, v) :: rest, n, q, h => by
    by_cases hk : k = n
    · subst hk
      have : (k == q) = false

Proof

by simpa using Ne.symm h
      simp [natLookup, this, natLookup_filter_ne rest k q h]
    · have hk' : (k != n) = true := by simpa using hk
      simp only [List.filter_cons, hk', ite_true, natLookup]
      split
      · rfl
      · exact natLookup_filter_ne rest n q h

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

Used by

In StandardElmMech/Prog/Objects.lean: Chapter 9's objects of execution (plan step 5): port environments, processes, configurations, events, SleepReady.

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.