Documentation

Batteries.Data.Float.Lemmas

Returns true if the bits represent an NaN value

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem Float.Model.UnpackedFloat.pack_unpack {spec : Format} (b : BitVec spec.numBits) (hspec : 2 spec.exponentBits := by decide) :
    pack spec (unpack spec b) = if isNaNBits b = true then packedNaN spec else b
    theorem Float.Model.UnpackedFloat.pack_unpack_of_valid {spec : Format} {b : BitVec spec.numBits} (hvalid : spec.Valid b) (hspec : 2 spec.exponentBits := by decide) :
    pack spec (unpack spec b) = b
    theorem Float.Model.UnpackedFloat.unpack_inj_of_valid {spec : Format} {b b' : BitVec spec.numBits} (hb : spec.Valid b) (hb' : spec.Valid b') (hspec : 2 spec.exponentBits := by decide) :
    unpack spec b = unpack spec b' b = b'
    @[simp]
    theorem Float.Model.UnpackedFloat.unpack_packedZero {spec : Format} {sign : Sign} :
    unpack spec (packedZero spec sign) = zero sign
    theorem Float.Model.UnpackedFloat.unpack_eq_notANumber_iff_of_valid {spec : Format} {b : BitVec spec.numBits} (hvalid : spec.Valid b) (hspec : 2 spec.exponentBits := by decide) :
    theorem Float.Model.UnpackedFloat.unpack_eq_zero_iff_of_valid {spec : Format} {sign : Sign} {b : BitVec spec.numBits} (hvalid : spec.Valid b) (hspec : 2 spec.exponentBits := by decide) :
    unpack spec b = zero sign b = packedZero spec sign
    theorem Float.Model.UnpackedFloat.isNaN_unpack_iff_of_valid {spec : Format} {b : BitVec spec.numBits} (hvalid : spec.Valid b) (hspec : 2 spec.exponentBits := by decide) :
    (unpack spec b).isNaN = true b = packedNaN spec
    theorem Float.Model.UnpackedFloat.unpack_beq_unpack_iff {spec : Format} {b b' : BitVec spec.numBits} (hb : spec.Valid b) (hb' : spec.Valid b') (hspec : 2 spec.exponentBits := by decide) :
    theorem Float.toBits_inj {f f' : Float} :
    f.toBits = f'.toBits f = f'
    theorem Float32.toBits_inj {f f' : Float32} :
    f.toBits = f'.toBits f = f'
    @[simp]
    theorem Float.beq_iff_ne_nan_and_eq {f f' : Float} :
    (f == f') = true f nan f' nan (f = f' f = 0 f' = -0 f = -0 f' = 0)
    theorem Float32.beq_iff_ne_nan_and_eq {f f' : Float32} :
    (f == f') = true f nan f' nan (f = f' f = 0 f' = -0 f = -0 f' = 0)
    @[simp]
    @[simp]
    @[simp]
    @[simp]
    @[simp]
    theorem Float.beq_self_iff {f : Float} :
    (f == f) = true f nan
    @[simp]
    theorem Float32.beq_self_iff {f : Float32} :
    (f == f) = true f nan
    @[simp]
    @[simp]
    @[simp]
    theorem Float.bne_eq {f : Float} :
    (f != f) = !f == f

    This theorem is true for all types but most other types have LawfulBEq where bne_self_eq_false or bne_iff_ne apply.

    @[simp]
    theorem Float32.bne_eq {f : Float32} :
    (f != f) = !f == f

    This theorem is true for all types but most other types have LawfulBEq where bne_self_eq_false or bne_iff_ne apply.

    Boolean equality on Floats is symmetric and transitive, but not reflexive, as demonstrated by nan != nan.

    Boolean equality on Float32s is symmetric and transitive, but not reflexive, as demonstrated by nan != nan.