Theoremex_sequence
Task.sequence of six succeeding tasks reduces to succeed [1, ..., 6]; six elements exercise foldrHelper's unrolling by four and its recursion.
Statement
theorem ex_sequence :
(seqTask 6 >>= iterateTask 200) = some (.succeed (Val.ofList ((List.range 6).map fun (j : Nat) => Val.int ((j : Int) + 1))))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.