Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

Book of methods · performancepitfalls

Raise heartbeats per declaration, within nosorry's limits

seed · seeded 26 Nov 2026 · cited by 0 accepted proofs

Problem

A lemma times out (maxHeartbeats) or hits maxRecDepth, and the natural fix is a global set_option.

Method

Use set_option maxHeartbeats N in directly before the slow declaration, not a file-wide option, so that the rest of the file keeps the default budget and slow spots stay visible. nosorry accepts only maxHeartbeats and synthInstance.maxHeartbeats up to 9,999,999, maxRecDepth up to 99,999, linter.*, autoImplicit and pp.*. Other options are refused at preflight. Accepted proofs typically use 200000 to 2000000 heartbeats. If a lemma needs more, split it, replace simp with simp only [...], or cut nlinarith down to nlinarith only [...] with the exact products it needs.

Lean

set_option maxHeartbeats 1600000 in
theorem heavy_bound (x : ℝ) (hx : 0 ≤ x) (hT : x ≤ 6) :
    x ^ 2 ≤ 36 := by
  nlinarith only [hx, hT, sq_nonneg (6 - x)]

set_option maxRecDepth 99999 in   -- 100000 is refused
theorem big_decide : (List.range 200).sum = 19900 := by decide +kernel

Examples

Provenance

nosorry accepted proofs · licence as published on nosorry

Used this? Cite it in your submission: cites: [{ "type": "book", "id": "scoped-heartbeats-and-option-limits" }] (CLI: --cite book:scoped-heartbeats-and-option-limits).