Elm Exactly

Theoremnever_eval

StandardElmMech/Theorems.lean:57, The values of Basics written in Elm (sec:appendix-dynamic-basis-elm) · kernel-checked (decide +kernel)

The text of never (recursive) evaluates in E_K, by r:d-dec-rec, to Rec of its closure.

Statement

theorem never_eval :
    EvalDec E_K (.val (.var "never" (lams [neverPat] neverBody) none))
      (recVE [("never", .closure neverPat neverBody E_K [])])

Proof

by
  have hv : EvalValBind E_K (.var "never" (lams [neverPat] neverBody) none)
      (fmPlus [("never", .closure neverPat neverBody E_K [])] []) :=
    EvalValBind.r_d_valbind_var _ _ _ _ _ _ (EvalExp.r_d_exp_lambda _ _ _) (EvalValBindOpt.opt_none _)
  have he : fmPlus [("never", Val.closure neverPat neverBody E_K [])] ([] : ValEnv) =
      [("never", .closure neverPat neverBody E_K [])] := by simp [fmPlus]
  rw [he] at hv
  exact EvalDec.r_d_dec_rec _ _ _ hv (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.

Rules of the book it uses

In StandardElmMech/Theorems.lean: The command #mod_program_theorems (one theorem per program, in module form, in Lib.Btest; tagged [library] when the program names a core library value), budgetNative, the rulings stated directly, and theorems that D1 makes possible (a43_one_unique, a51_one_choice, log_order_demo).

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.