Elm Exactly

Theoremex_attempt_err

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

Task.attempt identity (Task.fail 3) is a task leaf whose task succeeds with Err 3.

Statement

theorem ex_attempt_err :
    (match exValue (ap (qv "Task" "attempt") [v "identity", ap (qv "Task" "fail") [i 3]]) with
      | some (.leaf .task t) => iterateTask 50 t
      | _ => none) = some (.succeed (.con conErr [.int 3]))

Proof

optEq_sound (by decide +kernel)

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.

Theorems it uses

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.