Skip to content

"maximum number of heartbeats" on BitVec.[sdiv|srem] proof with ac_nf #7612

Closed

Description

@tobiasgrosser
#eval Lean.versionString -- "4.19.0-nightly-2025-03-19"

theorem extracted_1 (x y : BitVec 9) :
    (y - y.srem x).sdiv x = y.sdiv x := by
  ac_nf

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

The following call to ac_nf triggers:

(deterministic) timeout at `whnf`, maximum number of heartbeats (200000) has been reached
Use `set_option maxHeartbeats <num>` to set the limit.

Additional diagnostic information may be available using the `set_option diagnostics true` command.

Context

I tested this with https://github.com/leanprover/lean4-nightly/releases/tag/nightly-2025-03-18, where the very same code works flawlessly. Looking at the changelog of https://github.com/leanprover/lean4-nightly/releases/tag/nightly-2025-03-19, leanprover/lean4-nightly@3857603 may have triggered a regression. @nomeata may be able to confirm.

Steps to Reproduce

  1. Copy test case into latest lean
  2. Wait for error

Expected behavior: Tactic finishes instantly with an unmodified goal state.

Actual behavior: Error triggered and proof fails.

Versions

nightly-2025-03-19 and nightly-2025-03-20 fail
nightly-2025-03-18 works

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Activity

  1. added
    bug
    on Mar 21, 2025
  2. changed the title [-]maximum number of heartbeats on sdiv proof[/-] [+]"maximum number of heartbeats" on sdiv proof with `ac_nf`[/+] on Mar 21, 2025
  3. changed the title [-]"maximum number of heartbeats" on sdiv proof with `ac_nf`[/-] [+]"maximum number of heartbeats" on BitVec.[sdiv|srem] proof with `ac_nf`[/+] on Mar 21, 2025
  4. changed the title [-]"maximum number of heartbeats" on BitVec.[sdiv|srem] proof with `ac_nf`[/-] [+]"maximum number of heartbeats" on `BitVec.[sdiv|srem]` proof with `ac_nf`[/+] on Mar 21, 2025
  5. nomeata commented on Mar 21, 2025

    @nomeata
    Collaborator

    Sigh, thanks for the report. It looks like there is no change at all that will not break something or another thing.

    Ah, but this is not the kernel, right? So probably marking divCore and modCode as irreducible should fix this.

  6. nomeata commented on Mar 21, 2025

    @nomeata
    Collaborator

    Previously that tactic didn't close the goal, right?

    It seems that

    set_option allowUnsafeReducibility true
    attribute [irreducible] Nat.div Nat.modCore
    
    theorem extracted_1 (x y : BitVec 9) :
        (y - y.srem x).sdiv x = y.sdiv x := by
      ac_nf
    

    helps. Will prepare a PR.

  7. tobiasgrosser commented on Mar 21, 2025

    @tobiasgrosser
    ContributorAuthor

    No, it did not. It just did not hang.

  8. added a commit that references this issue on Mar 21, 2025
    6931e91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions