Elm Exactly

Theoremspec_polyrec

StandardElmMech/Stat/SpecExamples.lean:433, The choices of the plan · kernel-checked (decide +kernel)

Polymorphic recursion through an annotation (dynamic-core: "even when a binding is used recursively at an instance other than its own"; Choices, items 4 and 5): main uses f at Int; inside f$Int, f 1.5 is an occurrence at Float, so f$Int requests the default copy f. Both are emitted, f before f$Int (the order of emission, and Appendix A's regrouping puts f, which f$Int refers to, first).

Statement

theorem spec_polyrec :
    onOk polyrecView (endToEnd Btest s_spec_polyrec) =
    some (some ["f", "f$Int", "main"], some [lid "n", lid "f", lid "n"],
          some [lid "text", qlid "Debug" "toString", lid "f$Int"])

Proof

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.

In StandardElmMech/Stat/SpecExamples.lean: The rulings on small programs: A27 (a free number is Float, annotations bind), A87 (the default copy is made), A93 (vacuous variables), polymorphic recursion, copy names, abs$Int, exposing items, payload types, kinds of main, eight copies, renaming invariance, record-pattern copies.

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.