Zulip Chat Archive
Stream: new members
Topic: timeout at whnf in array heavy code
One Happy Fellow (Dec 10 2025 at 09:49):
hi, I'm implementing SHA-256 is lean and I've run into problem with this function: https://github.com/happyfellow-one/lush/blob/master/lush/Crypto/SHA.lean#L99
I'm getting (deterministic) timeout at `whnf`, maximum number of heartbeats (200000) has been reached and I can't find the source of the error. I've tried replacing the proofs that indexes are valid with (by sorry) but it didn't help.
Could you help me with debugging this? Thanks!
Michael Rothgang (Dec 10 2025 at 10:02):
Can you make an #mwe?
One Happy Fellow (Dec 10 2025 at 10:14):
This file is self contained if that's what you meant? If you mean that the example is too large I'll try making a smaller one.
Johannes Tantow (Dec 10 2025 at 10:14):
Adding '(by simp[hworkinglen]) to every array access operation and replacing trivial with simp[working] suffices in the web editor
One Happy Fellow (Dec 10 2025 at 10:27):
Thank you! Do you have an idea why I get a timeout otherwise? Or if there's a way to avoid annotating all array accesses with the simp proofs?
Henrik Böving (Dec 10 2025 at 10:48):
Likely because the default tactic for doing Array access proofs gets lost due to the size of the Array literals
One Happy Fellow (Dec 10 2025 at 14:05):
I managed to solve it by wrapping working[i] in a function which constructed the proof term for array access, thanks all for help! I still have zero intuition about why lean struggled so much in this case though :(
Last updated: Dec 20 2025 at 21:32 UTC