Elm Exactly

Theoremexec_take

StandardElmMech/Prog/Exec.lean:137 · term proof

Every prefix of an execution under the book's host is an execution.

Statement

theorem exec_take {PE : PortEnv} {r : List (String × Val)} :
    ∀ (n : Nat) {K hs π hs'}, Exec PE r .any K hs π hs' → ∃ hs'', Exec PE r .any K hs (π.take n) hs''
  | 0, _, _, _, _, _ => ⟨_, .nil _ _⟩
  | _, _, _, _, _, .nil K hs => ⟨hs, by simp; exact .nil K hs⟩
  | n + 1, _, _, _, _, .cons _ _ _ _ _ _ _ hst hh hπ =>
    let ⟨hs'', h'⟩

Proof

exec_take n hπ
    ⟨hs'', by simp only [List.take_succ_cons]; exact .cons _ _ _ _ _ _ _ hst hh h'⟩

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

Used by

In StandardElmMech/Prog/Exec.lean: Hosts (any, none, the test runner's echo), executions with and without logs, a worker's executions (WorkerExec, its log as D9 defines it), traces and Tr (tr_nil, tr_prefix, tr_empty_iff_no_start).

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.