Elm Exactly

Theoremkeys_atPat

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

Statement

theorem keys_atPat : (p : AAtPat) → KeysIn p.ve (atPatVars p.erase)
  | .wild _ => keysIn_nil _
  | .scon _ _ => keysIn_nil _
  | .var x _ => keysIn_single (by simp [AAtPat.erase, atPatVars])
  | .con _ _ _ => keysIn_nil _
  | .unit => keysIn_nil _
  | .tuple p1 p2 p3 => by
    simp only [AAtPat.ve, AAtPat.erase, atPatVars]
    refine keysIn_modify (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])
    · exact keysIn_mono (keys_patOpt p3) (by intro x hx; simp [hx])
  | .nil _ => keysIn_nil _
  | .record row _ => by
    simp only [AAtPat.ve, AAtPat.erase, atPatVars]
    exact keys_patRowOpt row
  | .paren p => by
    simp only [AAtPat.ve, AAtPat.erase, atPatVars]
    exact keys_pat p

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.