Elm Exactly

Theoremfind?_addQ

StandardElmMech/Stat/RefuseScope.lean:1105, The context of a provider map binds only what the map provides · term proof

Statement

theorem find?_addQ (q : ModId) (f : IEnv → IEnv) : (QE : FMap ModId IEnv) → (q' : ModId) →
    FMap.find? (addQ q f QE) q' = if q = q' then some (f ((FMap.find? QE q).getD IEnv.empty)) else FMap.find? QE q'
  | [], q' => by
    simp only [addQ, FMap.find?]
    split <;> simp
  | (q0, I) :: rest, q' => by
    simp only [addQ]
    by_cases h0 : q0 = q
    · subst h0
      simp only [ite_true, FMap.find?]
      by_cases h1 : q0 = q' <;> simp [h1]
    · simp only [h0, ite_false, FMap.find?]
      rw [find?_addQ q f rest q']
      by_cases h1 : q0 = q'
      · subst h1
        simp [Ne.symm h0]
      · simp [h1]

Proof

Proved by a term, which Lean's kernel checks directly.

Used by

In StandardElmMech/Stat/RefuseScope.lean: Refusals by scope, constructor arity and imports, for one module and for a module after a helper (scopeFailB).

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.