Elm Exactly

Theoremkeys_pat

StandardElmMech/Stat/RefuseScope.lean:506, The keys of the value environments of patterns and bindings · term proof

Statement

theorem keys_pat : (p : APat) → KeysIn p.ve (patVars p.erase)
  | .atpat a => by
    simp only [APat.ve, APat.erase, patVars]
    exact keys_atPat a
  | .con _ _ args _ => by
    simp only [APat.ve, APat.erase, patVars]
    exact keysIn_plusAll (keys_atPatList args)
  | .cons p1 p2 => by
    simp only [APat.ve, APat.erase, patVars]
    refine keysIn_modify ?_ ?_
    · exact keysIn_mono (keys_pat p1) (by intro x hx; simp [hx])
    · exact keysIn_mono (keys_pat p2) (by intro x hx; simp [hx])
  | .as p x => by
    simp only [APat.ve, APat.erase, patVars]
    refine keysIn_modify ?_ (keysIn_single (by simp))
    exact keysIn_mono (keys_pat p) (by intro x hx; simp [hx])

Proof

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

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.