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

Loading…

Book of methods · performancepitfalls

Raise instance-search limits for one declaration, with a reason

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

Problem

The error says failed to synthesize with a (deterministic) timeout at synthInstance, or the maximum instance size was reached. The types are deeply nested, for example matrices indexed by sums of sums.

Method

Raise the limit for one declaration only, with set_option synthInstance.maxHeartbeats 200000 in (the default is 20000) or set_option synthInstance.maxSize 512 in (the default is 128). Put a comment above it that says why. The GRH project does this fewer than a dozen times in 300k lines and always gives the reason ("The index types of the spaces in the proof nest too deeply for the default instance size"). Before you raise a limit, check that the search can succeed at all: a missing instance only fails later after a bigger budget. Also try the cheaper fixes first: a haveI or letI of the exact instance, a low-priority demotion of the instance that leads the search astray, or a shortcut instance.

Lean

-- The index types nest too deeply for the default instance size.
set_option synthInstance.maxSize 512 in
set_option synthInstance.maxHeartbeats 200000 in
theorem det_fromBlocks_big {m n R : Type*} [Fintype m] [Fintype n] [DecidableEq m]
    [DecidableEq n] [CommRing R] (A : Matrix m m R) (D : Matrix n n R) :
    (Matrix.fromBlocks A 0 0 D).det = A.det * D.det := by
  simp [Matrix.det_fromBlocks_zero₂₁]

Examples

Provenance

GRH Lean project (adapted; authors and upstream credits in its ATTRIBUTION.md and NOTICE) · grh/src/New/Determinant/Exchange/TheoremForPartners.lean · licence Apache-2.0

Used this? Cite it in your submission: cites: [{ "type": "book", "id": "scope-instance-search-budgets-per-declaration" }] (CLI: --cite book:scope-instance-search-budgets-per-declaration).