Elm Exactly

Theoremspec_rename_invariant

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

An instance of reduceProgram_rename (the invariance lemma: specialisation reads a type only through what a renaming preserves, Choices, item 2): the annotated program inference gives for spec_exposing, renamed by swapFresh, reduces to the same program. The renaming is not the identity on it: the instance of text in main, a fresh variable for msg, is renamed.

Statement

theorem spec_rename_invariant :
    (inferProgram Btest (bareOf s_spec_exposing)).toOption.map (renameView "text") =
    some (true, [[.var (.fresh 1 .any)]], [[.var (.fresh 1001 .any)]])

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.