Skip to content

Conversation

@bollu
Copy link
Contributor

@bollu bollu commented Dec 19, 2025

Develop a new rounding circuit, based on SymFPU's design and "handbook of floating point reasoning".

We also develop a bunch of infra to allow us to compute on BVs
without having to worry about extension, by writing custom functions
which extend appropriately. Their `toInt` lemmas will not have modulos,
which will do the right thing when performing arithemtic.
info: Fp/Division.lean:600:0: PANIC at List.get!Internal Init.GetElem:328:18: invalid index
backtrace:
0   libleanshared.dylib                 0x00000001149692fc _ZN4leanL15lean_panic_implEPKcmb + 268
1   libleanshared.dylib                 0x00000001149697d0 lean_panic_fn + 40
2   libleanshared.dylib                 0x0000000110276ed4 l___private_Lean_Elab_Tactic_BVDecide_Frontend_BVDecide_0__Lean_Elab_Tactic_BVDecide_Frontend_DiagnosisM_diagnose_transformEquation + 7064
3   libleanshared.dylib                 0x000000011027bf34 l___private_Init_Data_Array_Basic_0__Array_forIn_x27Unsafe_loop___at___00Lean_Elab_Tactic_BVDecide_Frontend_DiagnosisM_diagnose_spec__5 + 416
4   libleanshared.dylib                 0x000000011027cbe0 l_Lean_Elab_Tactic_BVDecide_Frontend_DiagnosisM_diagnose + 88
5   libleanshared.dylib                 0x000000011497e2f0 lean_apply_7 + 184
6   libleanshared.dylib                 0x000000011026e9bc l_Lean_Elab_Tactic_BVDecide_Frontend_DiagnosisM_run___lam__0 + 116
7   libleanshared.dylib                 0x000000011497bf34 lean_apply_5 + 1020
8   libleanshared.dylib                 0x000000011026e810 l_Lean_MVarId_withContext___at___00Lean_Elab_Tactic_BVDecide_Frontend_DiagnosisM_run_spec__0___redArg + 44
9   libleanshared.dylib                 0x000000011027e104 l_Lean_Elab_Tactic_BVDecide_Frontend_explainCounterExampleQuality + 220
}
else
-- we are in the <1.-----> case.
if hExTooBig : inUf.ex > BitVec.ofInt e (maxNormalExp e') then -- + BitVec.ofInt e s' then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rounding should be done in terms of PackedFloat's e and s and not the UnpackedFloat's version, which can fit a larger range of values. So, the output type should be EUnpackedFloat (exponentWidth e' s') (s' + 1). Otherwise, the condition in this line is too week maxNormalExp (exponentWidth e' s') >= maxNormalExp e'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants