lean4-htt/tests/elab_bench
Joachim Breitner 26ad4d6972
feat: name the functional argument to brecOn in structural recursion (#12987)
This PR extracts the functional (lambda) passed to `brecOn` in
structural
recursion into a named `_f` helper definition (e.g. `foo._f`), similar
to
how well-founded recursion uses `._unary`. This way the functional shows
up
with a helpful name in kernel diagnostics rather than as an anonymous
lambda.

The `_f` definition is added with `.abbrev` kernel reducibility hints
and
the `@[reducible]` elaborator attribute, so the kernel unfolds it
eagerly
after `brecOn` iota-reduces. For inductive predicates, the previous
inline
lambda behavior is kept.

To ensure that parent definitions still get the correct reducibility
height
(since `getMaxHeight` ignores `.abbrev` definitions), each `_f`'s body
height is registered via a new `defHeightOverrideExt` environment
extension.
`getMaxHeight` checks this extension for all definitions, making the
height
computation transparent to the extraction.

This change improves code size (a bit). It may regress kernel reduction
times,
especially if a function defined by structural recursion is used in
kernel reduction
proofs on the hot path. Functions defined by structural recursion are
not particularly
fast to reduce anyways (due to the `.brecOn` construction), so already
now it may be
worth writing a kernel-reduction-friendly function manually (using the
recursor directly,
avoiding overloaded operations). This change will guide you in knowing
which function to
optimize.


🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 13:40:18 +00:00
..
big_beq.lean
big_beq.lean.out.ignored
big_beq_rec.lean
big_beq_rec.lean.out.ignored
big_deceq.lean
big_deceq.lean.out.ignored
big_deceq_rec.lean
big_deceq_rec.lean.out.ignored
big_do.lean
big_do.lean.out.expected
big_match.lean
big_match.lean.out.ignored
big_match_nat.lean
big_match_nat.lean.out.ignored
big_match_nat_split.lean
big_match_nat_split.lean.out.ignored
big_match_partial.lean
big_match_partial.lean.out.ignored
big_omega.lean
big_omega_MT.lean
big_omega_MT.lean.init.sh
big_struct.lean
big_struct_dep.lean
big_struct_dep1.lean
bv_decide_inequality.lean
bv_decide_inequality.lean.no_test chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
bv_decide_large_aig.lean
bv_decide_large_aig.lean.out.expected
bv_decide_mod.lean
bv_decide_mod.lean.no_test chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
bv_decide_mul.lean
bv_decide_realworld.lean
bv_decide_rewriter.lean
cbv_aes.lean chore: disable cbv usage warning (#12986) 2026-03-19 14:12:04 +00:00
cbv_arm_ldst.lean chore: disable cbv usage warning (#12986) 2026-03-19 14:12:04 +00:00
cbv_arm_ldst.lean.no_test chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
cbv_decide.lean chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
cbv_decide.lean.out.ignored
cbv_dedup.lean chore: disable cbv usage warning (#12986) 2026-03-19 14:12:04 +00:00
cbv_divisors.lean chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
cbv_divisors.lean.out.ignored
cbv_leroy.lean chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
cbv_leroy.lean.out.ignored
cbv_merge_sort.lean chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
cbv_merge_sort.lean.out.ignored
cbv_system_f.lean
cbv_system_f.lean.no_test chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
charactersIn.lean chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
charactersIn.lean.out.ignored
delayed_assign.lean test: add instantiateMVars tests and benchmark for delayed assignments (#12808) 2026-03-06 10:59:13 +00:00
delayed_sharing.lean test: add instantiateMVars tests and benchmark for delayed assignments (#12808) 2026-03-06 10:59:13 +00:00
grind_bitvec2.lean
grind_bitvec2.lean.no_test chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
grind_list2.lean
grind_ring_5.lean
iterators.lean
mut_rec_wf.lean
mut_rec_wf.lean.out.ignored
omega_stress.lean
omega_stress.lean.out.ignored
reduceMatch.lean
riscv-ast.lean
riscv-ast.lean.no_test chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
run_bench.sh chore: speed up test suite slightly (#12969) 2026-03-20 12:24:32 +00:00
run_test.sh chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
simp_arith1.lean
simp_bubblesort_256.lean
simp_congr.lean
simp_congr.lean.init.sh
simp_local.lean
simp_subexpr.lean
simp_subexpr.lean.out.ignored
string_simp_ne.lean feat: name the functional argument to brecOn in structural recursion (#12987) 2026-03-23 13:40:18 +00:00
string_simp_ne.lean.out.ignored test: add elab_bench for string literal simp performance (#12883) 2026-03-11 16:06:26 +00:00
workspaceSymbols.lean
workspaceSymbols.lean.out.ignored