opencompl / fp-lean

Floating Point Semantics Mechanization for Lean

Repository from Github https://github.comopencompl/fp-leanRepository from Github https://github.comopencompl/fp-lean

fp.lean core library docs

A library for bitblasting IEEE754 floating point multiplication.

-- https://github.com/opencompl/fp.lean/blob/5e51278246ed86f5e772ee6697400c163b56d5e3/Fp/Multiplication.lean#L82
theorem mul_one_is_id (a : PackedFloat 5 2) (m : RoundingMode) (ha : ¬a.isNaN)
  : (mul a oneE5M2 m) = a := by
  apply PackedFloat.inj
  simp at ha
  simp [mul, round, BitVec.cons, oneE5M2, -BitVec.shiftLeft_eq', -BitVec.ushiftRight_eq']
  bv_decide

References

  • We use circuits inspired from symfpu for bitblasting.

Trustworthiness: Exhaustive Enumeration Golden testing

Our CI exhaustively enumerates against the FloatX and symfpu libraries for bit-for-bit compatibility.

We would appreciate pull requests that improve our testing. We audited several librares, but settled on our choices since they enable us to test all rounding modes for small bitwidths.

References

About

Floating Point Semantics Mechanization for Lean

License:Apache License 2.0


Languages

Language:Lean 68.4%Language:C++ 19.4%Language:Python 7.1%Language:SMT 2.8%Language:Makefile 1.2%Language:Shell 1.1%