Registry Mirror
Skip to content

Conversation

@Kha

@Kha Kha commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

This PR makes inductive and structure commands no longer wait for earlier declarations in the file to be elaborated and checked, so that parallel elaboration continues across them.

Environment.addDeclCore now checks an inductive type declaration against Environment.uncheckedKernelEnv and adds the resulting constants to checked asynchronously. mkCasesOn uses the same environment, and the auxiliary recursors of nested inductive types are now registered by addDeclCore itself.

@Kha Kha added the downstream Request a downstream-lean4 adaptation PR. label Nov 20, 2026
@Kha

Kha commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Nov 20, 2026 •

Copy link
Copy Markdown

Benchmark results for cd6018d against 8009d0a are in. There are significant results. @Kha

  • 🟥 build//instructions: +13.5G (+0.15%)

Large changes (36✅, 4🟥)

  • ✅ build/profile/blocked (unaccounted)//wall-clock: -29s (-28.95%)
  • ✅ compiled/incr_header_save//maxrss: -93MiB (-5.00%)
  • ✅ elab/big_beq//maxrss: -71MiB (-4.02%)
  • ✅ elab/big_beq_rec//maxrss: -70MiB (-3.97%)
  • ✅ elab/big_deceq//maxrss: -70MiB (-4.02%)
  • ✅ elab/big_deceq_rec//maxrss: -71MiB (-4.05%)
  • ✅ elab/big_match//maxrss: -70MiB (-3.95%)
  • ✅ elab/big_match_nat//maxrss: -70MiB (-4.02%)
  • ✅ elab/big_match_nat_split//maxrss: -70MiB (-4.00%)
  • ✅ elab/big_match_partial//maxrss: -71MiB (-3.98%)
  • ✅ elab/cbv_decide//maxrss: -91MiB (-4.96%)
  • ✅ elab/cbv_divisors//maxrss: -84MiB (-4.82%)
  • ✅ elab/cbv_merge_sort//maxrss: -87MiB (-4.78%)
  • ✅ elab/delayed_assign//maxrss: -88MiB (-5.05%)
  • ✅ elab/delayed_lift//maxrss: -90MiB (-5.10%)
  • ✅ elab/delayed_sharing//maxrss: -89MiB (-5.15%)
  • 🟥 elab/deriving_mutual_block//instructions: +7.5G (+12.76%)
  • ✅ elab/deriving_mutual_block//maxrss: -87MiB (-4.46%)
  • 🟥 elab/deriving_mutual_block//task-clock: +574ms (+12.88%)
  • 🟥 elab/deriving_mutual_block//wall-clock: +578ms (+12.91%)
  • and 19 more
  • and 1 hidden

Medium changes (19✅, 6🟥)

  • 🟥 build/module/Init.Data.Nat.Internal.Linear//instructions: +1.9G (+4.09%)
  • ✅ compiled/const_fold//maxrss: -2MiB (-0.14%)
  • 🟥 elab/big_beq//instructions: +66.0M (+1.11%)
  • 🟥 elab/big_beq_rec//instructions: +131.5M (+1.26%)
  • ✅ elab/big_match_lits//maxrss: -69MiB (-3.46%)
  • 🟥 elab/big_match_partial//instructions: +68.5M (+0.77%)
  • ✅ elab/bv_decide_incremental//maxrss: -69MiB (-3.40%)
  • ✅ elab/do_nested_match_bind//maxrss: -86MiB (-4.72%)
  • 🟥 elab/let_to_have_chain//instructions: +7.9M (+0.42%)
  • ✅ elab/many_commands//maxrss: -85MiB (-1.94%)
  • ✅ elab/many_opens//maxrss: -88MiB (-5.02%)
  • 🟥 elab/mut_rec_wf//instructions: +330.7M (+2.32%)
  • ✅ elab/realizations//maxrss: -88MiB (-2.16%)
  • ✅ elab/simp_arith1//maxrss: -30MiB (-4.70%)
  • ✅ elab/sym_arith_norm//maxrss: -87MiB (-4.97%)
  • ✅ elab/sym_let_to_have_closed_body//maxrss: -88MiB (-4.05%)
  • ✅ elab/sym_lift_lets_chain//maxrss: -86MiB (-4.77%)
  • ✅ elab/sym_lift_lets_spine//maxrss: -88MiB (-4.70%)
  • ✅ elab/trailingZeros//maxrss: -28MiB (-2.97%)
  • ✅ elab/wf_mutual_block//maxrss: -94MiB (-5.19%)
  • and 5 more

Small changes (40✅, 150🟥)

  • 🟥 compiled/rbmap_checkpoint//instructions: +431.1k (+0.00%)
  • 🟥 compiled/rbmap_checkpoint//task-clock: +734ms (+55.13%)
  • 🟥 compiled/rbmap_checkpoint//wall-clock: +774ms (+57.18%)
  • ✅ elab/big_match_string//maxrss: -69MiB (-3.72%)
  • ✅ elab/bitvec_zero_counts//maxrss: -21MiB (-2.24%)
  • ✅ elab/bv_decide_rewriter//maxrss: -21MiB (-3.67%)
  • ✅ elab/bv_decide_sym_rewriter//maxrss: -26MiB (-4.43%)
  • ✅ elab/bv_epr_RP001-5//maxrss: -22MiB (-4.33%)
  • ✅ elab/bv_epr_tptp_msc015-1-010//maxrss: -20MiB (-3.04%)
  • ✅ elab/bv_epr_veil_chord_ring_maintenance_inherit_manual6//maxrss: -20MiB (-3.42%)
  • ✅ elab/bv_epr_veil_paxos_epr_join_round_coherence//maxrss: -21MiB (-3.83%)
  • ✅ elab/bv_epr_veil_paxos_first_order_join_round_one_b_max_vote_properties2//maxrss: -20MiB (-3.73%)
  • ✅ elab/bv_epr_veil_reliable_broadcast_net_byz_send_echo_vote_sent//maxrss: -23MiB (-4.43%)
  • ✅ elab/bv_epr_veil_ring_dec_recv_single_leader//maxrss: -23MiB (-4.24%)
  • ✅ elab/bv_epr_veil_stellar_consensus_change_ballot_intertwined_safe//maxrss: -18MiB (-3.37%)
  • ✅ elab/bv_epr_veil_suzuki_kasami_rcv_privilege_unique_tokens//maxrss: -23MiB (-4.36%)
  • ✅ elab/bv_epr_veil_tutorial_ring_recv_single_leader//maxrss: -17MiB (-3.13%)
  • ✅ elab/bv_normalize_cast//maxrss: -21MiB (-4.27%)
  • ✅ elab/cbv_leroy//maxrss: -92MiB (-4.82%)
  • ✅ elab/cbv_system_f//maxrss: -81MiB (-3.54%)
  • and 25 more
  • and 145 hidden

@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 20, 2026
@Kha
Kha marked this pull request as ready for review November 20, 2026 13:27
@Kha
Kha marked this pull request as draft November 22, 2026 16:31
@Kha
Kha force-pushed the inductive-nonblocking-add branch from 0f65296 to c21c3d7 Compare November 23, 2026 15:21
@Kha

Kha commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Nov 23, 2026 •

Copy link
Copy Markdown

Benchmark results for c21c3d7 against 7e2fc6a are in. There are significant results. @Kha

  • 🟥 build//instructions: +80.6G (+0.89%)

Large changes (8✅, 70🟥)

  • ✅ build/profile/blocked (unaccounted)//wall-clock: -37s (-36.81%)
  • 🟥 build/profile/process pre-definitions//wall-clock: +9s (+25.75%)
  • ✅ elab/big_beq//task-clock: -62ms (-9.49%)
  • 🟥 elab/big_beq_rec//maxrss: +144MiB (+8.16%)
  • 🟥 elab/big_deceq//maxrss: +144MiB (+8.27%)
  • 🟥 elab/big_deceq_rec//maxrss: +144MiB (+8.23%)
  • 🟥 elab/big_match//maxrss: +145MiB (+8.12%)
  • 🟥 elab/big_match_lits//maxrss: +144MiB (+7.16%)
  • 🟥 elab/big_match_nat//maxrss: +147MiB (+8.45%)
  • 🟥 elab/big_match_nat_split//maxrss: +145MiB (+8.21%)
  • 🟥 elab/big_match_partial//maxrss: +144MiB (+8.11%)
  • 🟥 elab/big_struct//instructions: +88.8M (+4.85%)
  • 🟥 elab/big_struct_dep//instructions: +468.0M (+5.26%)
  • 🟥 elab/big_struct_dep//task-clock: +10s (+1599.27%)
  • 🟥 elab/big_struct_dep//wall-clock: +172ms (+27.19%)
  • 🟥 elab/big_struct_dep1//instructions: +191.5M (+4.82%)
  • 🟥 elab/bv_decide_incremental//maxrss: +138MiB (+6.85%)
  • 🟥 elab/bv_decide_rewriter//maxrss: +80MiB (+12.43%)
  • 🟥 elab/bv_stress_structures_1//instructions: +563.6M (+5.18%)
  • 🟥 elab/bv_stress_structures_1//maxrss: +106MiB (+16.52%)
  • and 57 more
  • and 1 hidden

Medium changes (2✅, 81🟥)

  • ✅ build//wall-clock: -4s (-3.41%)
  • 🟥 build/module/Init.Data.BitVec.Lemmas//instructions: +1.5G (+1.63%) (reduced significance based on absolute threshold)
  • 🟥 build/profile/linting//wall-clock: +4s (+8.84%)
  • 🟥 build/profile/type checking//wall-clock: +7s (+8.02%)
  • 🟥 compiled/incr_header_save//maxrss: +89MiB (+4.64%)
  • ✅ elab/big_beq//wall-clock: -61ms (-8.86%)
  • 🟥 elab/big_match//instructions: +186.0M (+2.44%)
  • 🟥 elab/big_match_lits//instructions: +1.8G (+0.73%)
  • 🟥 elab/big_match_nat_split//instructions: +48.9M (+0.87%)
  • 🟥 elab/big_match_string//maxrss: +144MiB (+7.82%)
  • 🟥 elab/big_omega//instructions: +86.2M (+0.70%)
  • 🟥 elab/big_struct_dep//maxrss: +51MiB (+9.34%)
  • 🟥 elab/bitvec_zero_counts//instructions: +70.7M (+0.36%)
  • 🟥 elab/bitvec_zero_counts//maxrss: +30MiB (+3.50%)
  • 🟥 elab/bv_decide_mul//maxrss: +78MiB (+9.78%)
  • 🟥 elab/bv_decide_rewriter//instructions: +99.4M (+2.50%)
  • 🟥 elab/bv_epr_RP001-5//instructions: +15.3M (+1.10%)
  • 🟥 elab/bv_epr_RP001-5//maxrss: +79MiB (+13.66%)
  • 🟥 elab/bv_epr_tptp_gra120-1//maxrss: +69MiB (+10.90%)
  • 🟥 elab/bv_epr_tptp_grp192-3-004//maxrss: +68MiB (+10.67%)
  • and 63 more

Small changes (11✅, 2260🟥)

  • 🟥 build//task-clock: +50s (+3.06%)
  • 🟥 build/profile/attribute application//wall-clock: +490ms (+6.71%)
  • 🟥 build/profile/compilation (LCNF impure)//wall-clock: +1s (+3.72%)
  • 🟥 build/profile/compilation (LCNF mono)//wall-clock: +1s (+3.25%)
  • 🟥 build/profile/elaboration//wall-clock: +9s (+4.76%)
  • 🟥 elab/big_beq//instructions: +23.1M (+0.39%)
  • 🟥 elab/big_deceq//instructions: +9.8M (+0.36%)
  • ✅ elab/big_match_nat//task-clock: -19ms (-5.06%)
  • ✅ elab/big_match_nat//wall-clock: -23ms (-5.75%)
  • 🟥 elab/big_match_partial//instructions: +42.4M (+0.48%)
  • 🟥 elab/big_match_string//instructions: +169.5M (+0.52%)
  • 🟥 elab/big_omega//maxrss: +27MiB (+4.65%)
  • 🟥 elab/big_omega_MT//instructions: +80.2M (+0.65%)
  • 🟥 elab/big_omega_MT//maxrss: +28MiB (+4.81%)
  • 🟥 elab/big_struct//maxrss: +27MiB (+5.79%)
  • 🟥 elab/big_struct_dep1//maxrss: +43MiB (+8.96%)
  • 🟥 elab/big_struct_dep1//task-clock: +36ms (+11.57%)
  • 🟥 elab/bv_decide_inequality//maxrss: +56MiB (+6.72%)
  • 🟥 elab/bv_decide_large_aig//maxrss: +49MiB (+3.75%)
  • 🟥 elab/bv_decide_realworld//maxrss: +75MiB (+9.29%)
  • and 59 more
  • and 2192 hidden

@downstream-lean4

Copy link
Copy Markdown

The adaptation PR for this PR is leanprover/downstream-lean4#269.

@Kha
Kha force-pushed the inductive-nonblocking-add branch from c21c3d7 to 5f618b7 Compare November 24, 2026 13:44
@Kha

Kha commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Nov 24, 2026 •

Copy link
Copy Markdown

Benchmark results for 5f618b7 against 8009d0a are in. There are significant results. @Kha

  • 🟥 build//instructions: +17.9G (+0.20%)

Large changes (7✅, 10🟥)

  • ✅ build/profile/blocked (unaccounted)//wall-clock: -36s (-35.93%)
  • 🟥 build/profile/type checking//wall-clock: +10s (+11.68%)
  • 🟥 elab/big_struct_dep//task-clock: +10s (+1614.73%)
  • 🟥 elab/bv_stress_structures_2//task-clock: +869ms (+80.18%)
  • ✅ elab/grind_bitvec2//wall-clock: -1s (-44.97%)
  • 🟥 elab/grind_field_kernel_cancel//maxrss: +1GiB (+128.41%)
  • 🟥 elab/grind_field_kernel_cancel//task-clock: +5s (+201.32%)
  • ✅ elab/grind_field_kernel_cancel//wall-clock: -2s (-76.69%)
  • ✅ elab/lia_case_splits//wall-clock: -313ms (-32.06%)
  • 🟥 elab/many_commands//instructions: +4.2G (+2.50%)
  • 🟥 elab/many_commands//maxrss: +337MiB (+7.72%)
  • 🟥 elab/structural_eqdef_simp_proj//task-clock: +1s (+17.96%)
  • ✅ elab/structural_eqdef_simp_proj//wall-clock: -2s (-50.71%)
  • ✅ misc/import Init.Data.BitVec.Lemmas//wall-clock: -1s (-49.02%)
  • 🟥 misc/import Init.Prelude//instructions: +128.9M (+1.45%)
  • ✅ misc/re-elab Init.Data.BitVec.Lemmas//wall-clock: -7s (-25.95%)
  • and 1 hidden

Medium changes (10🟥)

  • 🟥 build/profile/linting//wall-clock: +6s (+13.80%)
  • 🟥 build/profile/process pre-definitions//wall-clock: +5s (+16.08%)
  • 🟥 elab/big_struct_dep//wall-clock: +159ms (+25.65%)
  • 🟥 elab/bitvec_zero_counts//instructions: +42.1M (+0.21%)
  • 🟥 elab/bv_stress_structures_1//task-clock: +824ms (+81.08%)
  • 🟥 elab/realizations//instructions: +3.9G (+1.10%)
  • 🟥 elab/riscv-ast//instructions: +462.1M (+1.01%)
  • 🟥 elab/riscv-ast//task-clock: +2s (+38.94%)
  • 🟥 elab/share_common_rec_app//instructions: +542.9M (+1.12%)
  • 🟥 misc/import Init.Data.BitVec.Lemmas//task-clock: +1s (+11.64%)

Small changes (5✅, 1004🟥)

  • 🟥 build//task-clock: +1m 4s (+3.91%)
  • ✅ build//wall-clock: -2s (-2.06%)
  • 🟥 build/profile/attribute application//wall-clock: +453ms (+6.06%)
  • 🟥 build/profile/compilation (IR)//wall-clock: +367ms (+6.16%)
  • 🟥 build/profile/compilation (LCNF base)//wall-clock: +6s (+3.71%)
  • 🟥 build/profile/compilation (LCNF impure)//wall-clock: +1s (+5.53%)
  • 🟥 build/profile/compilation (LCNF mono)//wall-clock: +2s (+5.38%)
  • 🟥 build/profile/do element elaborator//wall-clock: +2s (+4.25%)
  • 🟥 build/profile/elaboration//wall-clock: +9s (+4.46%)
  • 🟥 build/profile/tactic execution//wall-clock: +7s (+5.18%)
  • 🟥 build/profile/typeclass inference//wall-clock: +4s (+4.71%)
  • 🟥 elab/big_deceq//instructions: +9.6M (+0.36%)
  • 🟥 elab/big_struct//instructions: +9.7M (+0.54%)
  • 🟥 elab/big_struct_dep1//instructions: +20.0M (+0.50%)
  • 🟥 elab/big_struct_dep1//task-clock: +23ms (+7.51%)
  • 🟥 elab/bv_stress_structures_1//instructions: +62.1M (+0.57%)
  • 🟥 elab/bv_stress_structures_2//instructions: +61.7M (+0.48%)
  • 🟥 elab/cbv_arm_ldst//instructions: +162.8M (+0.41%)
  • 🟥 elab/grind_bitvec2//task-clock: +2s (+10.40%)
  • 🟥 elab/iterators//instructions: +4.0M (+0.21%)
  • and 13 more
  • and 976 hidden

@Kha

Kha commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Nov 26, 2026 •

Copy link
Copy Markdown

Benchmark results for b3b6bf8 against 8009d0a are in. There are significant results. @Kha

  • 🟥 build//instructions: +21.1G (+0.23%)

Large changes (10✅, 13🟥)

  • ✅ build/profile/blocked (unaccounted)//wall-clock: -37s (-36.33%)
  • 🟥 build/profile/linting//wall-clock: +7s (+14.38%)
  • 🟥 build/profile/type checking//wall-clock: +11s (+12.33%)
  • 🟥 elab/big_struct_dep//task-clock: +10s (+1616.70%)
  • 🟥 elab/bitvec_zero_counts//instructions: +187.2M (+0.95%)
  • 🟥 elab/bv_stress_structures_2//task-clock: +917ms (+84.60%)
  • ✅ elab/grind_bitvec2//wall-clock: -1s (-44.48%)
  • 🟥 elab/grind_field_kernel_cancel//maxrss: +441MiB (+44.87%)
  • 🟥 elab/grind_field_kernel_cancel//task-clock: +4s (+170.69%)
  • ✅ elab/grind_field_kernel_cancel//wall-clock: -2s (-78.00%)
  • ✅ elab/lia_case_splits//wall-clock: -307ms (-31.44%)
  • 🟥 elab/many_commands//instructions: +4.2G (+2.51%)
  • 🟥 elab/many_commands//maxrss: +336MiB (+7.70%)
  • 🟥 elab/structural_eqdef_simp_proj//task-clock: +1s (+18.03%)
  • ✅ elab/structural_eqdef_simp_proj//wall-clock: -2s (-50.28%)
  • 🟥 elab/trailingZeros//instructions: +159.0M (+0.63%)
  • ✅ misc/import Init.Data.BitVec.Lemmas//wall-clock: -1s (-48.52%)
  • 🟥 misc/import Init.Prelude//instructions: +133.6M (+1.50%)
  • ✅ misc/re-elab Init.Data.BitVec.Lemmas//wall-clock: -7s (-26.17%)
  • ✅ vcgen/IfsJP/20/kernel//wall-clock: -195ms (-23.98%)
  • and 2 more
  • and 1 hidden

Medium changes (3✅, 13🟥)

  • 🟥 build/profile/process pre-definitions//wall-clock: +5s (+15.92%)
  • 🟥 elab/big_struct//instructions: +12.1M (+0.66%)
  • 🟥 elab/big_struct_dep//wall-clock: +145ms (+23.44%)
  • 🟥 elab/bv_stress_structures_1//task-clock: +816ms (+80.27%)
  • 🟥 elab/cbv_leroy//instructions: +220.4M (+0.65%)
  • 🟥 elab/cbv_system_f//instructions: +496.4M (+0.76%)
  • ✅ elab/cbv_system_f//wall-clock: -307ms (-5.11%)
  • 🟥 elab/grind_field_kernel_cancel//instructions: +494.3M (+1.49%)
  • 🟥 elab/realizations//instructions: +4.2G (+1.20%)
  • 🟥 elab/riscv-ast//instructions: +491.7M (+1.08%)
  • 🟥 elab/riscv-ast//task-clock: +2s (+44.62%)
  • 🟥 elab/share_common_rec_app//instructions: +553.3M (+1.14%)
  • 🟥 misc/import Init.Data.BitVec.Lemmas//task-clock: +1s (+11.18%)
  • 🟥 misc/leanchecker --fresh Init//instructions: +1.5G (+0.60%)
  • ✅ misc/leanchecker --fresh Init//maxrss: -54MiB (-8.81%)
  • ✅ vcgen/PurePrecond/4400/kernel//wall-clock: -33ms (-5.91%)

Small changes (11✅, 1222🟥)

  • 🟥 build//task-clock: +1m (+3.69%)
  • ✅ build//wall-clock: -3s (-2.62%)
  • 🟥 build/profile/attribute application//wall-clock: +403ms (+5.39%)
  • 🟥 build/profile/compilation (IR)//wall-clock: +383ms (+6.44%)
  • 🟥 build/profile/compilation (LCNF base)//wall-clock: +5s (+3.21%)
  • 🟥 build/profile/compilation (LCNF impure)//wall-clock: +1s (+4.08%)
  • 🟥 build/profile/compilation (LCNF mono)//wall-clock: +2s (+4.87%)
  • 🟥 build/profile/elaboration//wall-clock: +8s (+4.29%)
  • 🟥 build/profile/simp//wall-clock: +6s (+5.58%)
  • 🟥 build/profile/tactic execution//wall-clock: +7s (+5.18%)
  • 🟥 build/profile/typeclass inference//wall-clock: +3s (+3.76%)
  • 🟥 elab/big_deceq//instructions: +10.9M (+0.41%)
  • 🟥 elab/big_match_lits//instructions: +528.5M (+0.21%)
  • 🟥 elab/big_struct_dep1//instructions: +21.5M (+0.54%)
  • 🟥 elab/big_struct_dep1//task-clock: +21ms (+6.86%)
  • ✅ elab/bv_decide_mod//instructions: -2.1G (-1.06%)
  • ✅ elab/bv_epr_tptp_msc015-1-010//maxrss: -34MiB (-5.20%)
  • 🟥 elab/bv_stress_structures_1//instructions: +69.1M (+0.64%)
  • 🟥 elab/bv_stress_structures_1//maxrss: +33MiB (+5.72%)
  • 🟥 elab/bv_stress_structures_2//instructions: +75.6M (+0.59%)
  • and 27 more
  • and 1186 hidden

@Kha

Kha commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Nov 26, 2026 •

Copy link
Copy Markdown

Benchmark results for b07fca1 against 8009d0a are in. There are significant results. @Kha

  • 🟥 build//instructions: +20.1G (+0.22%)

Large changes (10✅, 13🟥)

  • ✅ build/profile/blocked (unaccounted)//wall-clock: -37s (-36.28%)
  • 🟥 build/profile/type checking//wall-clock: +10s (+11.53%)
  • 🟥 elab/big_struct_dep//task-clock: +10s (+1643.64%)
  • 🟥 elab/big_struct_dep//wall-clock: +165ms (+26.60%)
  • 🟥 elab/bitvec_zero_counts//instructions: +189.0M (+0.96%)
  • 🟥 elab/bv_stress_structures_2//task-clock: +887ms (+81.83%)
  • ✅ elab/grind_bitvec2//wall-clock: -1s (-44.02%)
  • 🟥 elab/grind_field_kernel_cancel//maxrss: +457MiB (+46.41%)
  • 🟥 elab/grind_field_kernel_cancel//task-clock: +5s (+183.47%)
  • ✅ elab/grind_field_kernel_cancel//wall-clock: -2s (-77.22%)
  • ✅ elab/lia_case_splits//wall-clock: -312ms (-31.96%)
  • 🟥 elab/many_commands//instructions: +4.3G (+2.57%)
  • 🟥 elab/many_commands//maxrss: +333MiB (+7.63%)
  • 🟥 elab/structural_eqdef_simp_proj//task-clock: +1s (+21.28%)
  • ✅ elab/structural_eqdef_simp_proj//wall-clock: -2s (-50.56%)
  • 🟥 elab/trailingZeros//instructions: +158.8M (+0.63%)
  • ✅ misc/import Init.Data.BitVec.Lemmas//wall-clock: -1s (-48.89%)
  • 🟥 misc/import Init.Prelude//instructions: +134.8M (+1.51%)
  • ✅ misc/re-elab Init.Data.BitVec.Lemmas//wall-clock: -7s (-26.09%)
  • ✅ vcgen/IfsJP/20/kernel//wall-clock: -103ms (-12.60%)
  • and 2 more
  • and 1 hidden

Medium changes (1✅, 10🟥)

  • 🟥 build/profile/linting//wall-clock: +6s (+14.06%)
  • 🟥 build/profile/process pre-definitions//wall-clock: +6s (+16.31%)
  • 🟥 elab/bv_stress_structures_1//task-clock: +857ms (+84.37%)
  • 🟥 elab/cbv_leroy//instructions: +219.6M (+0.65%)
  • 🟥 elab/grind_field_kernel_cancel//instructions: +494.0M (+1.49%)
  • 🟥 elab/realizations//instructions: +4.1G (+1.15%)
  • 🟥 elab/riscv-ast//instructions: +496.8M (+1.09%)
  • 🟥 elab/riscv-ast//task-clock: +2s (+43.31%)
  • 🟥 elab/share_common_rec_app//instructions: +546.8M (+1.13%)
  • 🟥 misc/import Init.Data.BitVec.Lemmas//task-clock: +1s (+12.08%)
  • ✅ misc/leanchecker --fresh Init//maxrss: -54MiB (-8.85%)

Small changes (9✅, 1191🟥)

  • 🟥 build//task-clock: +1m 4s (+3.91%)
  • ✅ build//wall-clock: -3s (-2.78%)
  • 🟥 build/profile/attribute application//wall-clock: +571ms (+7.63%)
  • 🟥 build/profile/compilation (LCNF base)//wall-clock: +7s (+4.21%)
  • 🟥 build/profile/compilation (LCNF impure)//wall-clock: +1s (+4.68%)
  • 🟥 build/profile/compilation (LCNF mono)//wall-clock: +3s (+5.75%)
  • 🟥 build/profile/do element elaborator//wall-clock: +2s (+3.87%)
  • 🟥 build/profile/elaboration//wall-clock: +9s (+4.80%)
  • 🟥 build/profile/simp//wall-clock: +6s (+5.21%)
  • 🟥 build/profile/typeclass inference//wall-clock: +4s (+4.42%)
  • 🟥 elab/big_deceq//instructions: +10.7M (+0.40%)
  • 🟥 elab/big_match_lits//instructions: +498.7M (+0.20%)
  • 🟥 elab/big_match_partial//instructions: +21.0M (+0.24%)
  • 🟥 elab/big_struct//instructions: +11.2M (+0.62%)
  • 🟥 elab/big_struct_dep//maxrss: +25MiB (+5.12%)
  • 🟥 elab/big_struct_dep1//instructions: +19.7M (+0.50%)
  • 🟥 elab/big_struct_dep1//task-clock: +25ms (+8.23%)
  • ✅ elab/bv_decide_mod//instructions: -2.1G (-1.07%)
  • 🟥 elab/bv_stress_structures_1//instructions: +63.9M (+0.59%)
  • 🟥 elab/bv_stress_structures_1//maxrss: +33MiB (+5.76%)
  • and 27 more
  • and 1153 hidden

Kha and others added 8 commits November 26, 2026 14:35
This PR fixes a race in `Runtime.markPersistent` on objects that other threads are using, which could revive such an object with a wrong reference count and lead to a use after free.

`lean_mark_persistent` wrote a zero count into thread-shared objects with a plain store. A reference count adjustment that another thread had in flight then landed on top of the zero. For a thread-shared object it now atomically stores a count from the middle of the sticky range, where adjustments in flight cannot move it back out; such an object is never freed and its count is no longer adjusted, but it is not reported by `lean_is_persistent`. Objects owned by the current thread still get a zero count. The interpreter's symbol cache, which relied on persistent names having stable addresses, accepts all never-freed names.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This PR marks the type of each declaration as persistent when it is added to the environment, so that elaboration and kernel checking on multiple threads no longer contend on the reference counts of these terms. The new option `Elab.persistentSignatures` controls this; the language server turns it off by default, as it adds declarations again on every edit.

The types are marked in `addDecl`, including the types of the constants the kernel generates for inductive types, and when the signature of a theorem is committed before its proof is elaborated.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`List.toByteArray_append'.ext` and `List.mergeSort_zipIdx.go` were each used by a later theorem. They are now the private top-level theorems `Array.ext_of_toList_eq` and `List.mergeSort_zipIdx_from`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Kernel checks of asynchronously added declarations no longer wait for the check of the preceding declaration: the declaration is added to the kernel environment unchecked, and checked against the preceding environment in its own task.

Known breakage: `elab/kernelErrorFollowup.lean` and `elab/issue14484.lean` fail because a declaration rejected by the kernel is no longer replaced by an axiom in the kernel environment seen by later declarations and `#print axioms`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment chain

Kernel checks now run against the new `Environment.uncheckedKernelEnv`, which contains preceding declarations before their checks have finished, while `checked` still waits for each check result and replaces rejected declarations with axioms as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A theorem added via `addConstAsync` now enters `uncheckedKernelEnv` as an axiom as soon as its signature is committed, so that kernel checks do not wait for earlier proofs to be elaborated either; the kernel does not unfold theorems. Constants of other environment branches that a declaration refers to, such as auxiliary declarations of a proof or realizations, are added on demand via `uncheckedKernelEnvFor`. `uncheckedKernelEnv` is now also kept across asynchronous compilation and realizations instead of being reset to `checked`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Constants are no longer added to `uncheckedKernelEnv` on demand when a declaration refers to them. Realized constants are now added when a realization is merged into the environment. Auxiliary declarations created inside a proof are in the environment of that proof only, so a later declaration referring to one of them is rejected by the kernel.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Kha
Kha force-pushed the inductive-nonblocking-add branch from b07fca1 to fa208d0 Compare November 26, 2026 15:00
@Kha

Kha commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Nov 26, 2026 •

Copy link
Copy Markdown

Benchmark results for fa208d0 against e1228b8 are in. There are significant results. @Kha

  • 🟥 build//instructions: +16.3G (+0.17%)

Large changes (19✅, 9🟥)

  • ✅ build/profile/blocked (unaccounted)//wall-clock: -38s (-36.85%)
  • 🟥 build/profile/type checking//wall-clock: +12s (+13.27%)
  • ✅ compiled/ilean_roundtrip//instructions: -1.0M (-0.01%)
  • ✅ compiled/liasolver//instructions: -1.1M (-0.03%)
  • ✅ compiled/phashmap//instructions: -1.1M (-0.01%)
  • ✅ compiled/rbmap_library//instructions: -1.1M (-0.01%)
  • ✅ compiled/workspaceSymbolsNewRanges//instructions: -1.0M (-0.16%)
  • ✅ elab/big_struct_dep//wall-clock: -304ms (-47.43%)
  • 🟥 elab/bitvec_zero_counts//instructions: +197.5M (+0.99%)
  • 🟥 elab/bv_stress_structures_1//instructions: +860.9M (+7.85%)
  • 🟥 elab/bv_stress_structures_2//instructions: +870.2M (+6.77%)
  • ✅ elab/deriving_mutual_block//task-clock: -343ms (-7.66%)
  • ✅ elab/deriving_mutual_block//wall-clock: -344ms (-7.64%)
  • ✅ elab/grind_bitvec2//wall-clock: -1s (-47.03%)
  • 🟥 elab/grind_field_kernel_cancel//maxrss: +432MiB (+42.92%)
  • 🟥 elab/grind_field_kernel_cancel//task-clock: +4s (+165.90%)
  • ✅ elab/grind_field_kernel_cancel//wall-clock: -2s (-78.05%)
  • ✅ elab/lia_case_splits//wall-clock: -302ms (-30.67%)
  • ✅ elab/structural_eqdef_simp_proj//wall-clock: -2s (-53.35%)
  • 🟥 elab/trailingZeros//instructions: +164.4M (+0.65%)
  • and 7 more
  • and 1 hidden

Medium changes (6✅, 13🟥)

  • 🟥 build/profile/process pre-definitions//wall-clock: +7s (+19.21%)
  • ✅ compiled/incr_header_load//instructions: -1.0M (-0.24%)
  • 🟥 elab/big_struct_dep//instructions: +53.2M (+0.59%)
  • ✅ elab/deriving_mutual_block//instructions: -569.0M (-0.96%)
  • ✅ elab/enum_update//wall-clock: -163ms (-10.38%)
  • 🟥 elab/grind_field_kernel_cancel//instructions: +501.5M (+1.51%)
  • 🟥 elab/grind_ring_5//instructions: +4.3M (+0.36%)
  • 🟥 elab/many_commands//instructions: +3.3G (+2.00%)
  • 🟥 elab/many_commands//maxrss: +240MiB (+5.22%)
  • 🟥 elab/riscv-ast//instructions: +367.7M (+0.80%)
  • 🟥 elab/share_common_rec_app//instructions: +413.2M (+0.85%)
  • ✅ elab/simp_local//instructions: -227.7M (-0.75%)
  • ✅ elab/simp_subexpr//instructions: -114.4M (-1.29%)
  • ✅ elab/structural_eqdef_simp_proj//instructions: -1.1G (-1.35%)
  • 🟥 lake/inundation/build/clean//instructions: +423.8M (+0.21%)
  • 🟥 lake/inundation/precompileLibrary/clean//instructions: +472.1M (+0.16%)
  • 🟥 lake/inundation/precompileModules/clean//instructions: +477.1M (+0.14%)
  • 🟥 misc/import Init.Data.BitVec.Lemmas//task-clock: +1s (+11.46%)
  • 🟥 misc/import Init.Prelude//instructions: +99.2M (+1.10%)

Small changes (84✅, 1199🟥)

  • 🟥 build//task-clock: +1m 3s (+3.62%)
  • ✅ build//wall-clock: -3s (-3.11%)
  • 🟥 build/profile/attribute application//wall-clock: +555ms (+7.28%)
  • 🟥 build/profile/compilation (LCNF base)//wall-clock: +7s (+4.04%)
  • 🟥 build/profile/compilation (LCNF impure)//wall-clock: +1s (+5.19%)
  • 🟥 build/profile/compilation (LCNF mono)//wall-clock: +2s (+4.26%)
  • 🟥 build/profile/do element elaborator//wall-clock: +2s (+3.86%)
  • 🟥 build/profile/elaboration//wall-clock: +10s (+4.96%)
  • 🟥 build/profile/import//wall-clock: +4s (+5.59%)
  • 🟥 build/profile/linting//wall-clock: +4s (+8.63%)
  • 🟥 build/profile/parsing//wall-clock: +1s (+5.07%)
  • 🟥 compiled/async/http_h1_client//instructions: +19.5k (+0.00%)
  • 🟥 compiled/async/http_h1_incremental//instructions: +35.8k (+0.00%)
  • 🟥 compiled/async/http_h1_server//instructions: +20.5k (+0.00%)
  • 🟥 compiled/async/http_header_ofstring//instructions: +21.5k (+0.00%)
  • 🟥 compiled/async/http_headers//instructions: +18.4k (+0.00%)
  • 🟥 compiled/async/http_request_line//instructions: +22.5k (+0.00%)
  • ✅ compiled/fmtSExprFull//instructions: -1.1M (-0.02%)
  • 🟥 compiled/hashmap//instructions: +19.2k (+0.00%)
  • 🟥 compiled/iterators//instructions: +19.6k (+0.00%)
  • and 44 more
  • and 1219 hidden

A kernel check holds on to its reduction caches until it is done, so the memory of concurrent checks adds up; in `Mathlib.CategoryTheory.Sites.SheafCohomology.MayerVietoris`, eight overlapping checks doubled the peak memory of the file. Checks now wait for one of `maxParallelKernelChecks` slots.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This PR makes `inductive` and `structure` commands no longer wait for earlier declarations in the file to be elaborated and checked, so that parallel elaboration continues across them.

`Environment.addDeclCore` now checks an inductive type declaration against `Environment.uncheckedKernelEnv` and adds the resulting constants to `checked` asynchronously. `mkCasesOn` uses the same environment, and the auxiliary recursors of nested inductive types are now registered by `addDeclCore` itself.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Kha
Kha force-pushed the inductive-nonblocking-add branch from fa208d0 to dc2eab2 Compare November 26, 2026 20:37
@Kha

Kha commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

!bench

@leanprover-radar

leanprover-radar commented Nov 26, 2026 •

Copy link
Copy Markdown

Benchmark results for dc2eab2 against e1228b8 are in. There are significant results. @Kha

  • 🟥 build//instructions: +15.4G (+0.16%)

Large changes (16✅, 7🟥)

  • ✅ build/profile/blocked (unaccounted)//wall-clock: -40s (-37.91%)
  • 🟥 build/profile/process pre-definitions//wall-clock: +8s (+22.89%)
  • ✅ compiled/ilean_roundtrip//instructions: -1.0M (-0.01%)
  • ✅ compiled/liasolver//instructions: -1.0M (-0.03%)
  • ✅ compiled/phashmap//instructions: -1.0M (-0.01%)
  • ✅ compiled/rbmap_library//instructions: -1.0M (-0.01%)
  • ✅ compiled/workspaceSymbolsNewRanges//instructions: -1.0M (-0.15%)
  • ✅ elab/big_struct_dep//wall-clock: -307ms (-47.94%)
  • 🟥 elab/bv_stress_structures_1//instructions: +885.1M (+8.07%)
  • 🟥 elab/bv_stress_structures_2//instructions: +878.4M (+6.83%)
  • ✅ elab/deriving_mutual_block//task-clock: -343ms (-7.65%)
  • ✅ elab/deriving_mutual_block//wall-clock: -339ms (-7.53%)
  • ✅ elab/grind_bitvec2//wall-clock: -1s (-46.55%)
  • 🟥 elab/grind_field_kernel_cancel//maxrss: +170MiB (+16.90%)
  • 🟥 elab/grind_field_kernel_cancel//task-clock: +1s (+39.84%)
  • ✅ elab/grind_field_kernel_cancel//wall-clock: -1s (-59.24%)
  • ✅ elab/lia_case_splits//wall-clock: -307ms (-31.15%)
  • ✅ elab/structural_eqdef_simp_proj//wall-clock: -2s (-53.26%)
  • 🟥 interpreted/iterators//instructions: +174.2M (+0.67%)
  • ✅ lake/inundation/startup//instructions: -959.1k (-0.40%)
  • and 2 more
  • and 1 hidden

Medium changes (5✅, 11🟥)

  • 🟥 build/profile/type checking//wall-clock: +10s (+10.81%)
  • 🟥 elab/big_struct_dep//instructions: +46.9M (+0.52%)
  • 🟥 elab/bitvec_zero_counts//instructions: +47.3M (+0.24%)
  • ✅ elab/deriving_mutual_block//instructions: -568.8M (-0.96%)
  • 🟥 elab/many_commands//instructions: +3.7G (+2.21%)
  • 🟥 elab/many_commands//maxrss: +366MiB (+7.98%)
  • 🟥 elab/riscv-ast//instructions: +378.3M (+0.83%)
  • ✅ elab/riscv-ast//wall-clock: -900ms (-26.47%)
  • 🟥 elab/share_common_rec_app//instructions: +391.3M (+0.81%)
  • ✅ elab/simp_local//instructions: -232.2M (-0.76%)
  • ✅ elab/simp_subexpr//instructions: -116.8M (-1.32%)
  • ✅ elab/structural_eqdef_simp_proj//instructions: -1.1G (-1.39%)
  • 🟥 lake/inundation/build/clean//instructions: +436.9M (+0.22%)
  • 🟥 lake/inundation/precompileLibrary/clean//instructions: +490.8M (+0.16%)
  • 🟥 lake/inundation/precompileModules/clean//instructions: +490.5M (+0.15%)
  • 🟥 misc/import Init.Prelude//instructions: +108.0M (+1.20%)

Small changes (89✅, 1284🟥)

  • 🟥 build//task-clock: +1m 8s (+3.89%)
  • ✅ build//wall-clock: -3s (-2.73%)
  • 🟥 build/profile/C code generation//wall-clock: +708ms (+5.37%)
  • 🟥 build/profile/attribute application//wall-clock: +693ms (+9.10%)
  • 🟥 build/profile/compilation (LCNF base)//wall-clock: +5s (+2.95%)
  • 🟥 build/profile/compilation (LCNF impure)//wall-clock: +1s (+4.31%)
  • 🟥 build/profile/compilation (LCNF mono)//wall-clock: +1s (+3.32%)
  • 🟥 build/profile/do element elaborator//wall-clock: +2s (+3.11%)
  • 🟥 build/profile/elaboration//wall-clock: +12s (+6.32%)
  • 🟥 build/profile/import//wall-clock: +5s (+6.04%)
  • 🟥 build/profile/initialization//wall-clock: +3s (+3.55%)
  • 🟥 build/profile/linting//wall-clock: +4s (+8.93%)
  • 🟥 compiled/async/http_h1_client//instructions: +19.5k (+0.00%)
  • 🟥 compiled/async/http_h1_incremental//instructions: +35.8k (+0.00%)
  • 🟥 compiled/async/http_h1_server//instructions: +17.4k (+0.00%)
  • 🟥 compiled/async/http_h1_writer//instructions: +17.9k (+0.00%)
  • 🟥 compiled/async/http_header_ofstring//instructions: +21.5k (+0.00%)
  • 🟥 compiled/async/http_headers//instructions: +21.5k (+0.00%)
  • 🟥 compiled/const_fold//instructions: +17.9k (+0.00%)
  • 🟥 compiled/deriv//instructions: +18.4k (+0.00%)
  • and 46 more
  • and 1307 hidden

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

downstream Request a downstream-lean4 adaptation PR. 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.

2 participants