Skip to content

perf: faster equation generation for match with value patterns - #16465

Merged
leodemoura merged 1 commit into
masterfrom
match-eqns-dite-tree
Nov 14, 2026
Merged

leodemoura merged 1 commit into
masterfrom
match-eqns-dite-tree

Conversation

@leodemoura

Copy link
Copy Markdown
Member

This PR makes generating the equations of a match with many value patterns faster. For a match with two discriminants and 64 alternatives such as | "name", 0 => .. followed by a catch-all, it takes 0.38s instead of 1.16s.

The proof of the catch-all equation processed each test x = v with general purpose tactics whose cost is proportional to the number of alternatives. It now traverses all tests in one pass, using an index to find the hypothesis that refutes each case.

🤖 Generated with Claude Code

This PR makes generating the equations of a `match` with many value patterns faster. For a `match` with two discriminants and 64 alternatives such as `| "name", 0 => ..` followed by a catch-all, it takes 0.38s instead of 1.16s.

The proof of the catch-all equation processed each test `x = v` with general purpose tactics whose cost is proportional to the number of alternatives. It now traverses all tests in one pass, using an index to find the hypothesis that refutes each case.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@leodemoura
leodemoura enabled auto-merge November 14, 2026 16:07
@leodemoura
leodemoura added this pull request to the merge queue Nov 14, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 14, 2026
Merged via the queue into master with commit f3f9132 Nov 14, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant