Elm Exactly

Theoremshape_self

StandardElmMech/Src/Graph.lean:109, Facts about growing · tactic proof

A shaped set is the filter of range n by its own membership.

Statement

theorem shape_self {n : Nat} {s : List Nat} (h : Shape n s) :
    s = (List.range n).filter fun j => s.contains j

Proof

by
  obtain ⟨q, rfl⟩ := h
  apply (List.filter_congr _).symm
  intro j hj
  have hj' : j < n := List.mem_range.mp hj
  simp [List.mem_filter, hj']

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

Used by

In StandardElmMech/Src/Graph.lean: Reachability on graphs over 0 .. n-1 (Plus, Reach) and its decider, proved correct (plusB_iff, reachB_iff).

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.