Elm Exactly

Theoremspec_record_pattern_copy

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

A copy of a destructuring binding with a record pattern (ruling A99, which closes step 10's Issues, item 4): x is used at Int, so the binding has its default copy { x = x } = { x = 1 } at Float and the copy at Int { x = x$Int } = { x = 1 }, which binds the new variable x$Int to the same field x; the use refers to the copy at Int.

Statement

theorem spec_record_pattern_copy :
    onOk (fun r => rhs r "Main" "main") (endToEnd Btest s_spec_record_pattern_copy) =
    some (some
      (StandardElm.Exp.app
         (StandardElm.Exp.atexp (StandardElm.AtExp.var { qual

Proof

none, id := "text" }))
         (StandardElm.AtExp.paren
           (StandardElm.Exp.app
             (StandardElm.Exp.atexp (StandardElm.AtExp.var { qual := some "Debug", id := "toString" }))
             (StandardElm.AtExp.paren
               (StandardElm.Exp.atexp
                 (StandardElm.AtExp.letE
                   (StandardElm.Dec.val
                     (StandardElm.ValBind.pat
                       (StandardElm.AtPat.record (some (StandardElm.PatRow.field "x" "x" none)))
                       (StandardElm.Exp.atexp
                         (StandardElm.AtExp.record
                           (some (StandardElm.ExpRow.field
                              "x"
                              (StandardElm.Exp.atexp (StandardElm.AtExp.scon (StandardElm.SCon.intF 1)))
                              none))))))
                   (StandardElm.Exp.atexp
                     (StandardElm.AtExp.letE
                       (StandardElm.Dec.val
                         (StandardElm.ValBind.pat
                           (StandardElm.AtPat.record (some (StandardElm.PatRow.field "x" "x$Int" none)))
                           (StandardElm.Exp.atexp
                             (StandardElm.AtExp.record
                               (some (StandardElm.ExpRow.field
                                  "x"
                                  (StandardElm.Exp.atexp (StandardElm.AtExp.scon (StandardElm.SCon.int 1)))
                                  none))))))
                       (StandardElm.Exp.app
                         (StandardElm.Exp.app
                           (StandardElm.Exp.atexp (StandardElm.AtExp.op "//"))
                           (StandardElm.AtExp.paren
                             (StandardElm.Exp.atexp (StandardElm.AtExp.var { qual := none, id := "x$Int" }))))
                         (StandardElm.AtExp.paren
                           (StandardElm.Exp.atexp (StandardElm.AtExp.scon (StandardElm.SCon.int 2)))))))))))))) := 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.

About ruling A99 of the book, where the implementations disagreed or were silent and the definition decides.

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.