Elm Exactly

Theorema88_roundtrip_negzero

StandardElmMech/Eff/RoundTrip.lean:442, The exceptions are needed · native_decide (trusts the compiled evaluator)

A88: -0 encodes as 0, which decodes as +0: the round trip loses the sign. [native] (a float's bits)

Statement

theorem a88_roundtrip_negzero :
    enc .float (.sv (.float (-0.0))) = some (.num 0) ∧
    (dec .float (.num 0)).map (fun v => match v with | .sv (.float x) => isNegZero x | _ => true) = some false ∧
    isNegZero (-0.0) = true

Proof

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 A88 of the book, where the implementations disagreed or were silent and the definition decides.

In StandardElmMech/Eff/RoundTrip.lean: The round trip of encoding and decoding (roundtrip), except where A88 says otherwise (NoExc), under the named hypothesis FloatRoundTrip; the exceptions shown to be needed.

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.