Elm Exactly

Theoremex_flat_none

StandardElmMech/Eff/Examples.lean:114 · kernel-checked (decide +kernel)

Cmd.batch [Cmd.none, Cmd.none] flattens to the empty multiset.

Statement

theorem ex_flat_none :
    (exValue (ap (qv "Cmd" "batch") [listE [qv "Cmd" "none", qv "Cmd" "none"]]) >>= flat) = some []

Proof

by
  have h : (exValue (ap (qv "Cmd" "batch") [listE [qv "Cmd" "none", qv "Cmd" "none"]]) >>= flat).map List.isEmpty
      = some true := by decide +kernel
  cases hf : (exValue (ap (qv "Cmd" "batch") [listE [qv "Cmd" "none", qv "Cmd" "none"]]) >>= flat) with
  | none => simp [hf] at h
  | some cs => simp [hf] at h; simp [h]

Proved by decide +kernel: Lean's kernel itself runs the decision procedure, here the evaluator, and checks that the answer is true, so nothing outside the kernel is trusted.

In StandardElmMech/Eff/Examples.lean: Task.perform, Task.sequence of six tasks reduced to its outcome, Task.attempt of a failing task, and the flattening of Cmd.batch [Cmd.none, Cmd.none], by the kernel.

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.