TorchLean API

NN.Floats.IEEEExec.RealSemantics

RealSemantics #

Finite-only real semantics for IEEE32Exec.

We interpret a float32 bit-pattern as a real number by decoding its exact dyadic payload (-1)^sign * mant * 2^exp and then mapping to .

The executable kernel has NaN/Inf payloads; these do not have a real interpretation. We therefore provide:

Most theorems should be read under finiteness hypotheses and use toReal? (or lemmas that assume toDyadic? x = some …).

Real interpretation for finite values (undefined for NaN/Inf).

Instances For

    Total real interpretation (maps NaN/Inf to 0; use toReal? for proofs).

    Instances For

      Unfolding lemma for toReal?.

      This lemma is intentionally not [simp]: rewriting toReal? x into a match on toDyadic? x is usually not the best first step.

      @[simp]

      If toDyadic? x = some d, then toReal? x = some (dyadicToReal d).

      @[simp]

      If toDyadic? x = none, then toReal? x = none.

      Unfolding lemma for toReal in terms of toDyadic?.

      This is the form that is most convenient in algebraic proofs: it avoids an intermediate Option.