Elm Exactly

Theorema48_float

StandardElmMech/Theorems.lean:267, The rulings, stated directly (kernel-checked) · native_decide (trusts the compiled evaluator)

A48: at floats APPLY(max) and APPLY(min) are IEEE 754-2019 maximum and minimum, whatever the order of the arguments: NaN when either is NaN, +0 for max and -0 for min of the two zeros. Floats are compared as printed, so this is proved by native_decide. [native]

Statement

theorem a48_float :
    let f (x : Float) : Val

Proof

.sv (.float x)
    let nan : Float := 0 / 0
    let nz : Float := -0
    ([applySet .max [f nan, f 1], applySet .max [f 1, f nan],
      applySet .min [f nan, f 1], applySet .min [f 1, f nan],
      applySet .max [f 0, f nz], applySet .max [f nz, f 0],
      applySet .min [f 0, f nz], applySet .min [f nz, f 0]].map (·.map showElmSigned))
      = [["NaN"], ["NaN"], ["NaN"], ["NaN"], ["+0"], ["+0"], ["-0"], ["-0"]] := by
  native_decide

Proved by native_decide: the decision procedure is compiled and run, and its answer is trusted. This is used where values are compared as they print, floats above all, which the kernel cannot compare.

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

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.