CakeML / CakeML/cakeml

Floating point determinism

Open
#753 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Standard ML
Stars
1.2k
Forks
104
Avg merge
2d 21h
Merged PRs (30d)
16

Description

Currently, the floating point semantics of all CakeML ILs just delegates to `machine_ieee`, which uses a @ term to select a NaN to return in cases where that is the result. This makes the behavior of basic floating point operations dependent on the HOL model. While it is philosophically unsatisfactory for a physical value which is subjectable to experiment to not be model-theoretically absolute, it's not problematic for program verification: any statement you can prove about fp64 math is true for all models, including the model which agrees with ARM VFP semantics.

If native floats are added for any other architecture, this breaks down, as different architectures have different rules for NaN propagation, invalid float-to-int conversions, and probably other things. It would also be unsuitable for hardware verification, as hardware cannot simultaneously match all HOL models.

I believe we need to either pick a deterministic semantics for floating point and commit to emulating it on all platforms, or somehow make the semantics explicitly nondeterministic.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.