Skip to content

refactor: rename the diag name token to diagonal - #43494

Open
wrenna-robson wants to merge 9 commits into
leanprover-community:masterfrom
wrenna-robson:rename-diag-to-diagonal
Open

refactor: rename the diag name token to diagonal#43494
wrenna-robson wants to merge 9 commits into
leanprover-community:masterfrom
wrenna-robson:rename-diag-to-diagonal

Conversation

@wrenna-robson

@wrenna-robson wrenna-robson commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Per recent discussion on Zulip, we want to move away from diag should not be used as a name token. This renames every declaration where diag abbreviates diagonal to spell it out in full, with a @[deprecated] alias for each. It also renames the directory Mathlib/Algebra/Order/Antidiag/ to Antidiagonal/.

I've tried to split it into reviewable commits by area (Prod/offDiag, Sym2/Finset.diag, antidiag, CategoryTheory, misc, leftovers) plus a small diagaonal typo fix. I will try and break it up into discrete sub-PRs if necessary.

Out of scope, handled in follow-ups:

  • Set.diagonal / Prod.diagonalSet- to be handled in feat(Data/Set): add Set.diag #38380
  • the Matrix.diag / blockDiag / IsDiag constructor/extractor swap - there's one or two of these where something is being constructed/extracted or where
  • the diag-means-diagram cases ((Co)limitPresentation.diag, Galois.EssSurj.quotientDiag, CommDiag), which will be renamed to diagram

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

PR summary 8280979c1f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ A_maps_to_offDiagonal_judgePair
+ Eventually.diagonal_of_prod
+ Eventually.diagonal_of_prod_left
+ Eventually.diagonal_of_prod_right
+ FiberBundle.Prod.isInducing_diagonal
+ Finite.offDiagonal
+ Finite.toFinset_offDiagonal
+ Functor.final_diagonal_of_isFiltered
+ Functor.initial_diagonal_of_isFiltered
+ IsDiagonal
+ IsDiagonal.decidablePred
+ IsDiagonal.map
+ IsEquipartition.card_biUnion_offDiagonal_le
+ IsEquipartition.card_biUnion_offDiagonal_le'
+ IsPoly₂.diagonal
+ IsSubterminal.isIso_diagonal
+ IsSubterminal.isoDiagonal
+ Nodup.mem_offDiagonal
+ Nodup.of_offDiagonal
+ Nodup.offDiagonal
+ Nontrivial.offDiagonal_nonempty
+ Perm.offDiagonal
+ Subsingleton.offDiagonal_eq_empty
+ _root_.Finset.coe_infsep_of_offDiagonal_empty
+ _root_.Finset.coe_infsep_of_offDiagonal_nonempty
+ card_diagonalSet_compl
+ card_finMulAntidiagonal_of_squarefree
+ card_finMulAntidiagonal_pi
+ card_finsuppAntidiagonal_nat_eq_choose
+ card_finsuppAntidiagonal_nat_eq_multichoose
+ card_image_diagonal
+ card_image_offDiagonal
+ card_piDiagonal
+ card_subtype_diagonal
+ card_subtype_not_diagonal
+ card_toFinset_of_isDiagonal
+ card_toFinset_of_not_isDiagonal
+ coe_offDiagonal
+ coeff_mul_antidiagonal
+ commutator_diagonal2_transvection
+ continuous_diagonal
+ coprod.codiagonal
+ coprod.diagonal_comp
+ coprod.map_codiagonal
+ coprod.map_comp_inl_inr_codiagonal
+ coprod.map_inl_inr_codiagonal
+ count_coe_finsuppAntidiagonalEquiv_apply
+ count_offDiagonal_eq_mul_sub_ite
+ decidablePred_mem_diagonalSet
+ deleteEdges_of_subset_diagonalSet
+ derivSeries_apply_diagonal
+ diagonal2
+ diagonal2_coe
+ diagonal2_coe'
+ diagonal2_decompose
+ diagonal2_def
+ diagonal2_inv
+ diagonal2_mul_inv
+ diagonal2_smul_single_i₁
+ diagonal2_smul_single_i₂
+ diagonal2n
+ diagonal2n_coe
+ diagonalElem
+ diagonalElemEquiv
+ diagonalElem_mk
+ diagonalSet
+ diagonalSet_compl_eq_fromRel_ne
+ diagonalSet_eq_fromRel_eq
+ diagonalSet_eq_setOfPred_isDiagonal
+ diagonalSet_eq_univ_of_subsingleton
+ diagonalSet_subset_fromRel
+ diagonalSub
+ diagonal_apply
+ diagonal_card
+ diagonal_commute
+ diagonal_comp
+ diagonal_decompose
+ diagonal_def
+ diagonal_diagonalElem
+ diagonal_empty
+ diagonal_eq_diagonal2n_prod
+ diagonal_eq_empty
+ diagonal_eq_filter
+ diagonal_iff
+ diagonal_induction
+ diagonal_insert
+ diagonal_inter
+ diagonal_isDiagonal
+ diagonal_left
+ diagonal_mem_sym2_iff
+ diagonal_mem_sym2_mem_iff
+ diagonal_mono
+ diagonal_nonempty
+ diagonal_of_map_from_obj
+ diagonal_right
+ diagonal_singleton
+ diagonal_sub_val
+ diagonal_subinterval_eq
+ diagonal_toMatrix_directSum_collectedBasis_eq_zero_of_mapsTo_ne
+ diagonal_union
+ diagonal_union_offDiagonal
+ diagonal_δ
+ diagonal_ε
+ diagonal_η
+ diagonal_μ
+ diagonal_σ
+ disjoint_diagonalSet_fromRel
+ divisorsAntidiagonal
+ divisorsAntidiagonal_natCast
+ divisorsAntidiagonal_neg
+ divisorsAntidiagonal_neg_natCast
+ divisorsAntidiagonal_ofNat
+ divisorsAntidiagonal_zero
+ dropFun_diagonal
+ dvd_of_mem_finMulAntidiagonal
+ edgeSet_sdiff_sdiff_isDiagonal
+ edgeSet_subset_compl_diagonalSet
+ exists_cartanMatrix_diagonal_mul_posDef
+ exists_cartanMatrix_mul_diagonal_posDef
+ externalProductCompDiagonalIso
+ filter_image_mk_isDiagonal
+ filter_image_mk_not_isDiagonal
+ finMulAntidiagonal
+ finMulAntidiagonal_eq_piFinset_divisors_filter
+ finMulAntidiagonal_existsUnique_prime_dvd
+ finMulAntidiagonal_one
+ finMulAntidiagonal_three
+ finMulAntidiagonal_zero_left
+ finMulAntidiagonal_zero_right
+ finset_congr_piAntidiagonal_eq_antidiagonal
+ finsuppAntidiagonal
+ finsuppAntidiagonalEquiv
+ finsuppAntidiagonalEquivSubtype
+ finsuppAntidiagonalEquiv_symm_apply_apply
+ finsuppAntidiagonal_empty
+ finsuppAntidiagonal_empty_of_ne_zero
+ finsuppAntidiagonal_empty_zero
+ finsuppAntidiagonal_insert
+ finsuppAntidiagonal_mono
+ finsuppAntidiagonal_zero
+ fintypeOffDiagonal
+ fromEdgeSet_not_isDiagonal
+ fromRel_subset_compl_diagonalSet
+ fst_comp_diagonal
+ fst_diagonal
+ image_apply_finMulAntidiagonal
+ image_diagonal
+ image_diagonal_union_image_offDiagonal
+ image_fst_divisorsAntidiagonal
+ image_piFinTwoEquiv_finMulAntidiagonal
+ image_snd_divisorsAntidiagonal
+ instance : (diagonal C).Monoidal
+ instance [Infinite α] : Infinite {a : Sym2 α // a.IsDiagonal}
+ instance [Infinite α] : Infinite {a : Sym2 α // ¬a.IsDiagonal}
+ instance [IsCofilteredOrEmpty C] (X : C × C) : IsCofiltered (CostructuredArrow (diagonal C) X) := by
+ instance [IsFilteredOrEmpty C] (X : C × C) : IsFiltered (StructuredArrow X (diagonal C)) := by
+ instance {X : C} [HasBinaryProduct X X] : IsSplitMono (prod.diagonal X)
+ isDiagonal_map
+ isDiagonal_mk_of_mem_diagonal
+ isDiagonal_of_subsingleton
+ isSubterminal_of_isIso_diagonal
+ iteratedFDeriv_zero_apply_diagonal
+ length_offDiagonal
+ length_offDiagonal'
+ mapRange_finsuppAntidiagonal_eq
+ mapRange_finsuppAntidiagonal_subset
+ map_comp_diagonal
+ map_neg_divisorsAntidiagonal
+ map_nsmul_piAntidiagonal
+ map_nsmul_piAntidiagonal_univ
+ map_prodComm_divisorsAntidiagonal
+ map_prodMap_offDiagonal
+ map_sym_eq_piAntidiagonal
+ measurable_diagonal
+ measurable_diagonal'
+ mem_diagonal
+ mem_diagonalSet
+ mem_divisorsAntidiagonal
+ mem_finMulAntidiagonal
+ mem_finsuppAntidiagonal
+ mem_finsuppAntidiagonal'
+ mem_finsuppAntidiagonal_insert
+ mem_offDiagonal_iff_getElem
+ mem_piAntidiagonal
+ mem_piDiagonal
+ mk_isDiagonal_iff
+ natCard_subtype_diagonal
+ natCard_subtype_not_diagonal
+ ncard_diagonalSet
+ ncard_diagonalSet_compl
+ ne_zero_of_mem_finMulAntidiagonal
+ neg_mem_divisorsAntidiagonal
+ nodup_offDiagonal
+ not_isDiagonal_mk_of_mem_offDiagonal
+ not_isDiagonal_of_mem_edgeFinset
+ not_isDiagonal_of_mem_edgeSet
+ not_mem_edgeSet_of_isDiagonal
+ not_separatedNhds_rat_irrational_antidiagonal
+ nsmul_piAntidiagonal
+ nsmul_piAntidiagonal_univ
+ of_diagonal
+ offDiagonal_card
+ offDiagonal_cons_perm
+ offDiagonal_eq_empty
+ offDiagonal_eq_sep_prod
+ offDiagonal_filter_lt_eq_filter_le
+ offDiagonal_nil
+ offDiagonal_nonempty
+ offDiagonal_subset_prod
+ offDiagonal_univ
+ onDiagonal
+ pairwiseDisjoint_piAntidiagonal_map_addRightEmbedding
+ piAntidiagonal
+ piAntidiagonal_cons
+ piAntidiagonal_empty
+ piAntidiagonal_empty_of_ne_zero
+ piAntidiagonal_empty_zero
+ piAntidiagonal_insert
+ piAntidiagonal_univ_fin_eq_antidiagonalTuple
+ piAntidiagonal_zero
+ piDiagonal
+ piDiagonal_subset_piFinset
+ prod.comp_diagonal
+ prod.diagonal_map
+ prod.diagonal_map_fst_snd
+ prod.diagonal_map_fst_snd_comp
+ prod_diagonal
+ prod_eq_of_mem_finMulAntidiagonal
+ prod_prod_Ioi_mul_eq_prod_prod_off_diagonal
+ prod_range_diagonal_flip
+ product_sdiff_diagonal
+ product_sdiff_offDiagonal
+ proj₁AdjDiagonal
+ range_diagonal
+ single_eq_pi_diagonal
+ snd_comp_diagonal
+ snd_diagonal
+ sum_diag
+ sum_pow_eq_sum_piAntidiagonal
+ sum_pow_eq_sum_piAntidiagonal_of_commute
+ sum_sym2_filter_not_isDiagonal
+ swap_comp_diagonal
+ swap_mem_divisorsAntidiagonal
+ tendsto_diagonal
+ tendsto_diagonal_uniformity
+ toFinset_offDiagonal
+ toFinsuppAntidiagonal
+ toFinsuppAntidiagonal_injective
+ toFinsuppAntidiagonal_mem_finsuppAntidiagonal
+ two_mul_card_image_offDiagonal
+ ιMultiDual_apply_diagonal
+ ιMultiDual_apply_nondiagonal
++ diagonal_injective
++ disjoint_diagonal_offDiagonal
++ mem_offDiagonal
++ ofDiagonalEquivalence
++ ofDiagonalEquivalence'
++ ofDiagonalEquivalence.functor
++ ofDiagonalEquivalence.inverse
++ offDiagonal_empty
++ offDiagonal_insert
++ offDiagonal_inter
++ offDiagonal_mono
++ offDiagonal_union
++ prod.diagonal
++ prodMk_mem_divisorsAntidiagonal
+++ offDiagonal
+++ offDiagonal_singleton
++++++++-+++ diagonal
+++--- offDiag
+++--- offDiag_singleton
++-- diag_injective
++-- mem_offDiag
++-- ofDiagEquivalence
++-- ofDiagEquivalence'
++-- ofDiagEquivalence.functor
++-- ofDiagEquivalence.inverse
++-- offDiag_empty
++-- offDiag_insert
++-- offDiag_inter
++-- offDiag_mono
++-- offDiag_union
++-- prodMk_mem_divisorsAntidiag
+--+ range_diag
- _root_.Finset.coe_infsep_of_offDiag_empty
- _root_.Finset.coe_infsep_of_offDiag_nonempty
- card_finMulAntidiag_pi
- diag_decompose
- exists_cartanMatrix_diagaonal_mul_posDef
- exists_cartanMatrix_mul_diagaonal_posDef
- instance : (diag C).Monoidal
- instance [Infinite α] : Infinite {a : Sym2 α // a.IsDiag}
- instance [Infinite α] : Infinite {a : Sym2 α // ¬a.IsDiag}
- instance [IsCofilteredOrEmpty C] (X : C × C) : IsCofiltered (CostructuredArrow (diag C) X) := by
- instance [IsFilteredOrEmpty C] (X : C × C) : IsFiltered (StructuredArrow X (diag C)) := by
- instance {X : C} [HasBinaryProduct X X] : IsSplitMono (diag X)
- not_separatedNhds_rat_irrational_antidiag
--+++++++++++--------- diag

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 8280979).

  • +346 new declarations
  • −57 removed declarations

(showing first 200 of 403 lines)

+AddMonoidAlgebra.coeff_mul_antidiagonal
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.functor_map_left_left
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.functor_obj_hom
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.functor_obj_left_hom
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.functor_obj_left_left
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.functor_obj_left_right_as
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.functor_obj_right_as
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.inverse_map_left
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.inverse_obj_hom
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.inverse_obj_left
-CategoryTheory.CostructuredArrow.ofDiagEquivalence.inverse_obj_right_as
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence'
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.functor
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.functor_map_left_left
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.functor_obj_hom
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.functor_obj_left_hom
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.functor_obj_left_left
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.functor_obj_left_right_as
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.functor_obj_right_as
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.inverse
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.inverse_map_left
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.inverse_obj_hom
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.inverse_obj_left
+CategoryTheory.CostructuredArrow.ofDiagonalEquivalence.inverse_obj_right_as
-CategoryTheory.Functor.diag_map
-CategoryTheory.Functor.diag_obj
+CategoryTheory.Functor.diagonal
+CategoryTheory.Functor.diagonal_map
+CategoryTheory.Functor.diagonal_obj
+CategoryTheory.Functor.diagonal_δ
+CategoryTheory.Functor.diagonal_ε
+CategoryTheory.Functor.diagonal_η
+CategoryTheory.Functor.diagonal_μ
+CategoryTheory.Functor.final_diagonal_of_isFiltered
+CategoryTheory.Functor.initial_diagonal_of_isFiltered
-CategoryTheory.Functor.instMonoidalProdDiag
+CategoryTheory.Functor.instMonoidalProdDiagonal
+CategoryTheory.Functor.relativelyRepresentable.diagonal_iff
+CategoryTheory.Functor.relativelyRepresentable.diagonal_of_map_from_obj
+CategoryTheory.Functor.relativelyRepresentable.of_diagonal
+CategoryTheory.IsSubterminal.isIso_diagonal
-CategoryTheory.IsSubterminal.isoDiag_hom
-CategoryTheory.IsSubterminal.isoDiag_inv
+CategoryTheory.IsSubterminal.isoDiagonal
+CategoryTheory.IsSubterminal.isoDiagonal_hom
+CategoryTheory.IsSubterminal.isoDiagonal_inv
+CategoryTheory.Limits.coprod.codiagonal
+CategoryTheory.Limits.coprod.diagonal_comp
-CategoryTheory.Limits.coprod.map_codiag_assoc
+CategoryTheory.Limits.coprod.map_codiagonal
+CategoryTheory.Limits.coprod.map_codiagonal_assoc
-CategoryTheory.Limits.coprod.map_comp_inl_inr_codiag_assoc
+CategoryTheory.Limits.coprod.map_comp_inl_inr_codiagonal
+CategoryTheory.Limits.coprod.map_comp_inl_inr_codiagonal_assoc
-CategoryTheory.Limits.coprod.map_inl_inr_codiag_assoc
+CategoryTheory.Limits.coprod.map_inl_inr_codiagonal
+CategoryTheory.Limits.coprod.map_inl_inr_codiagonal_assoc
-CategoryTheory.Limits.instIsSplitMonoDiag
+CategoryTheory.Limits.instIsSplitMonoDiagonal
+CategoryTheory.Limits.prod.comp_diagonal
-CategoryTheory.Limits.prod.diag_map_assoc
-CategoryTheory.Limits.prod.diag_map_fst_snd_assoc
-CategoryTheory.Limits.prod.diag_map_fst_snd_comp_assoc
+CategoryTheory.Limits.prod.diagonal
+CategoryTheory.Limits.prod.diagonal_map
+CategoryTheory.Limits.prod.diagonal_map_assoc
+CategoryTheory.Limits.prod.diagonal_map_fst_snd
+CategoryTheory.Limits.prod.diagonal_map_fst_snd_assoc
+CategoryTheory.Limits.prod.diagonal_map_fst_snd_comp
+CategoryTheory.Limits.prod.diagonal_map_fst_snd_comp_assoc
-CategoryTheory.MonoidalCategory.externalProductCompDiagIso_hom_app_app
-CategoryTheory.MonoidalCategory.externalProductCompDiagIso_inv_app_app
+CategoryTheory.MonoidalCategory.externalProductCompDiagonalIso
+CategoryTheory.MonoidalCategory.externalProductCompDiagonalIso_hom_app_app
+CategoryTheory.MonoidalCategory.externalProductCompDiagonalIso_inv_app_app
-CategoryTheory.NonPreadditiveAbelian.diag_σ_assoc
+CategoryTheory.NonPreadditiveAbelian.diagonal_σ
+CategoryTheory.NonPreadditiveAbelian.diagonal_σ_assoc
-CategoryTheory.StructuredArrow.ofDiagEquivalence.functor_map_right_right
-CategoryTheory.StructuredArrow.ofDiagEquivalence.functor_obj_hom
-CategoryTheory.StructuredArrow.ofDiagEquivalence.functor_obj_left_as
-CategoryTheory.StructuredArrow.ofDiagEquivalence.functor_obj_right_hom
-CategoryTheory.StructuredArrow.ofDiagEquivalence.functor_obj_right_left_as
-CategoryTheory.StructuredArrow.ofDiagEquivalence.functor_obj_right_right
-CategoryTheory.StructuredArrow.ofDiagEquivalence.inverse_map_right
-CategoryTheory.StructuredArrow.ofDiagEquivalence.inverse_obj_hom
-CategoryTheory.StructuredArrow.ofDiagEquivalence.inverse_obj_left_as
-CategoryTheory.StructuredArrow.ofDiagEquivalence.inverse_obj_right
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence'
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.functor
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.functor_map_right_right
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.functor_obj_hom
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.functor_obj_left_as
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.functor_obj_right_hom
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.functor_obj_right_left_as
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.functor_obj_right_right
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.inverse
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.inverse_map_right
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.inverse_obj_hom
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.inverse_obj_left_as
+CategoryTheory.StructuredArrow.ofDiagonalEquivalence.inverse_obj_right
-CategoryTheory.instIsCofilteredCostructuredArrowProdDiagOfIsCofilteredOrEmpty
+CategoryTheory.instIsCofilteredCostructuredArrowProdDiagonalOfIsCofilteredOrEmpty
-CategoryTheory.instIsFilteredStructuredArrowProdDiagOfIsFilteredOrEmpty
+CategoryTheory.instIsFilteredStructuredArrowProdDiagonalOfIsFilteredOrEmpty
+CategoryTheory.isSubterminal_of_isIso_diagonal
-ContinuousAddMonoidHom.diag_toFun
+ContinuousAddMonoidHom.diagonal
+ContinuousAddMonoidHom.diagonal_toFun
-ContinuousMonoidHom.diag_toFun
+ContinuousMonoidHom.diagonal
+ContinuousMonoidHom.diagonal_toFun
+FiberBundle.Prod.isInducing_diagonal
+Filter.Eventually.diagonal_of_prod
+Filter.Eventually.diagonal_of_prod_left
+Filter.Eventually.diagonal_of_prod_right
+Filter.tendsto_diagonal
+Finpartition.IsEquipartition.card_biUnion_offDiagonal_le
+Finpartition.IsEquipartition.card_biUnion_offDiagonal_le'
+Finset.card_finsuppAntidiagonal_nat_eq_choose
+Finset.card_finsuppAntidiagonal_nat_eq_multichoose
+Finset.card_piDiagonal
+Finset.coe_infsep_of_offDiagonal_empty
+Finset.coe_infsep_of_offDiagonal_nonempty
+Finset.coe_offDiagonal
+Finset.count_coe_finsuppAntidiagonalEquiv_apply
+Finset.diagonal
+Finset.diagonal_card
+Finset.diagonal_empty
+Finset.diagonal_eq_empty
+Finset.diagonal_eq_filter
+Finset.diagonal_insert
+Finset.diagonal_inter
+Finset.diagonal_mem_sym2_iff
+Finset.diagonal_mem_sym2_mem_iff
+Finset.diagonal_mono
+Finset.diagonal_nonempty
+Finset.diagonal_singleton
+Finset.diagonal_union
+Finset.diagonal_union_offDiagonal
+Finset.disjoint_diagonal_offDiagonal
+Finset.finset_congr_piAntidiagonal_eq_antidiagonal
-Finset.finsuppAntidiagEquivSubtype_apply_coe
-Finset.finsuppAntidiagEquivSubtype_symm_apply_coe
+Finset.finsuppAntidiagonal
+Finset.finsuppAntidiagonalEquiv
+Finset.finsuppAntidiagonalEquivSubtype
+Finset.finsuppAntidiagonalEquivSubtype_apply_coe
+Finset.finsuppAntidiagonalEquivSubtype_symm_apply_coe
+Finset.finsuppAntidiagonalEquiv_symm_apply_apply
+Finset.finsuppAntidiagonal_empty
+Finset.finsuppAntidiagonal_empty_of_ne_zero
+Finset.finsuppAntidiagonal_empty_zero
+Finset.finsuppAntidiagonal_insert
+Finset.finsuppAntidiagonal_mono
+Finset.finsuppAntidiagonal_zero
+Finset.image_diagonal
+Finset.image_diagonal_union_image_offDiagonal
+Finset.isDiagonal_mk_of_mem_diagonal
+Finset.mapRange_finsuppAntidiagonal_eq
+Finset.mapRange_finsuppAntidiagonal_subset
+Finset.map_nsmul_piAntidiagonal
+Finset.map_nsmul_piAntidiagonal_univ
+Finset.map_sym_eq_piAntidiagonal
+Finset.mem_diagonal
+Finset.mem_finsuppAntidiagonal
+Finset.mem_finsuppAntidiagonal'
+Finset.mem_finsuppAntidiagonal_insert
+Finset.mem_offDiagonal
+Finset.mem_piAntidiagonal
+Finset.mem_piDiagonal
+Finset.not_isDiagonal_mk_of_mem_offDiagonal
+Finset.nsmul_piAntidiagonal
+Finset.nsmul_piAntidiagonal_univ
+Finset.offDiagonal
+Finset.offDiagonal_card
+Finset.offDiagonal_empty
+Finset.offDiagonal_filter_lt_eq_filter_le
+Finset.offDiagonal_insert
+Finset.offDiagonal_inter
+Finset.offDiagonal_mono
+Finset.offDiagonal_singleton
+Finset.offDiagonal_union
+Finset.pairwiseDisjoint_piAntidiagonal_map_addRightEmbedding
+Finset.piAntidiagonal
+Finset.piAntidiagonal_cons
+Finset.piAntidiagonal_empty
+Finset.piAntidiagonal_empty_of_ne_zero
+Finset.piAntidiagonal_empty_zero
+Finset.piAntidiagonal_insert
+Finset.piAntidiagonal_univ_fin_eq_antidiagonalTuple
+Finset.piAntidiagonal_zero
+Finset.piDiagonal
+Finset.piDiagonal_subset_piFinset
+Finset.prod_diagonal
+Finset.prod_prod_Ioi_mul_eq_prod_prod_off_diagonal
+Finset.prod_range_diagonal_flip
+Finset.product_sdiff_diagonal

Increase in strong tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (strong)
misnamed declarations: definition names with an underscore 477 1
No changes to weak technical debt.

Current commit 8280979c1f
Reference commit 21118bea64

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the file-removed A Lean module was (re)moved without a `deprecated_module` annotation label Sep 6, 2026
@wrenna-robson wrenna-robson added the LLM-generated PRs with substantial input from LLMs - review accordingly label Sep 6, 2026
@github-actions github-actions Bot removed the file-removed A Lean module was (re)moved without a `deprecated_module` annotation label Sep 6, 2026
@SnirBroshi

SnirBroshi commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

How about a separate PR per area or per def? And also one PR at a time, to avoid wasting your time if the maintainers change their mind. (I'd start with the antidiag ones, then offDiag, then diag)

@grunweg

grunweg commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for doing this clean-up! With my maintainer hat on, may I ask you do to two things:

  • can you link to where the discussion was had (I trust you that this is true, but right now I cannot easily find it)
  • split the PR at smaller boundaries --- if your commits are already nicely split, that would be easy :-)

@wrenna-robson

Copy link
Copy Markdown
Collaborator Author

How about a separate PR per area or per def? And also one PR at a time, to avoid wasting your time if the maintainers change their mind. (I'd start with the antidiag ones, then offDiag, then diag)

I would frankly find this a lot more unmanageable to do.

@wrenna-robson

wrenna-robson commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

@grunweg Certainly: I believe this is the thread. https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/antidiagonal.20vs.20antidiag/with/622080434

I was working on #38380, entirely ignorant of this until a few days ago.

In terms of breaking up this PR: I can do that, though I will wait until I have a working build first (a lot easier to do that way). My strategy for this thus far has been to throw Claude at it because it's tedious work but essentially is just a matter of renaming things and fixing downstream issues. To be clear - I'm not using Claude to generate this text (that would be IMO quite rude)! But in my experience a big "touch-everything" PR like this is something it is quite useful to have machine-assistance with.

There are some PRs I want to do on top of this. #38380 will rename Set.diagonal and add in a new Set.diagonal to match Finseet.diagonal (err, which is currently Finset.diag). I haven't touched Matrixdiag and Matrix.diagonal in this because it is unclear exactly what they should be (there was some different of opinions). I think there are a few places where "diag" means "diagram" and I think it would make sense to do that, but that isn't part of this PR. This PR is just "rename everything called diag/offDiag and similar" (with the caveat that Function.diag becomes Prod.diagonal because it should always have been in Prod. namespace - that's my error).

Let me land this so that CI works, and then we can look at where we are, and I'll perhaps seek to break it up. I don't think it ought to be too bad to review - as long as you check the redefinitions are OK, everything else is just downstream of that.

@SnirBroshi

Copy link
Copy Markdown
Collaborator

I would frankly find this a lot more unmanageable to do.

In terms of breaking up this PR: I can do that

I'm confused as to how your opinion changed that fast, but I'm happy that we all agree :)

@wrenna-robson

wrenna-robson commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

I would frankly find this a lot more unmanageable to do.

In terms of breaking up this PR: I can do that

I'm confused as to how your opinion changed that fast, but I'm happy that we all agree :)

There's no contradiction - I would find it a lot more unmanageable, but I am trying to be a considerate community member and show willing. It just means it will take a lot, lot longer.

@wrenna-robson

wrenna-robson commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@grunweg Alright, I'm running green. If you do want this split up, how would you like that to be done? I'm minded to rebase the branch so that the history is more easily reviewable, if you're happy for it all to be on this PR.

@wrenna-robson
wrenna-robson force-pushed the rename-diag-to-diagonal branch 2 times, most recently from d37bfad to e133a78 Compare September 7, 2026 08:50
@SnirBroshi

Copy link
Copy Markdown
Collaborator

Could you avoid renaming (and deprecating) any files in this PR, to not break their git history? Ideally they should only move after the declaration renames are complete, and then the old modules reintroduced in a 3rd PR.

@wrenna-robson
wrenna-robson force-pushed the rename-diag-to-diagonal branch 2 times, most recently from 9163797 to 66b2038 Compare September 7, 2026 10:03
@wrenna-robson

Copy link
Copy Markdown
Collaborator Author

Could you avoid renaming (and deprecating) any files in this PR, to not break their git history? Ideally they should only move after the declaration renames are complete, and then the old modules reintroduced in a 3rd PR.

Ah, so maintain Diag in file names for this PR and then follow up with that later?

@wrenna-robson

Copy link
Copy Markdown
Collaborator Author

I've (alright, Claude did with my supervising gently to make it actually do the work during my morning meeting) reorged the commits so that they're more logically separate.

…iagonal)

`Function.diag` (the map `a ↦ (a, a)`) is renamed to `Prod.diagonal` and
moved into the `Prod` namespace, alongside its lemmas (`diag_apply` →
`Prod.diagonal_apply`, etc.) and the downstream map lemmas `tendsto_diag`,
`continuous_diag`, `measurable_diag`, `tendsto_diag_uniformity`,
`Eventually.diag_of_prod{,_left,_right}`, `FiberBundle.Prod.isInducing_diag`,
`Function.diag_def` (in `Kernel.Deterministic`), plus the collision fix in
`Topology/Algebra/ProperAction/Basic.lean` where the bare `diagonal` had
become ambiguous with the pre-existing `Set.diagonal`.

Deprecated aliases are provided for every renamed declaration, and the alias
for `Function.diag` is kept `protected` to match the original declaration
(otherwise `open Function` reintroduces `diag` ambiguously).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNPGZ1QMoRHjVquVwdfFTU
`Set.offDiag`, `Finset.diag`/`Finset.offDiag`, `List.offDiag` and the
off-diagonal lemmas on `Set`/`Finset`/`List`: `offDiag` → `offDiagonal`,
`Finset.diag` → `Finset.diagonal` (built from `Prod.diagonal`, renamed in
the previous commit). The declarations stay in `Data/List/OffDiag.lean`;
the module itself is not renamed in this PR (that can follow once the
declaration renames have landed).

Also covers the two `Finset.diag` call sites that don't touch `Sym2` and so
belong here rather than with the `Sym2` commit: `Finset.prod_diag`/`sum_diag`
and `A_maps_to_offDiag_judgePair` in `Archive/Imo1998Q2`.

Deprecated aliases are provided for every renamed declaration, including a
few missed on the first pass (`Set.Nontrivial.offDiag_nonempty`,
`Set.Subsingleton.offDiag_eq_empty`). Also fixes an unrelated `diagaonal`
typo in the Cartan matrix lemma names in `RootSystem/CartanMatrix.lean`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNPGZ1QMoRHjVquVwdfFTU
…tream)

* `Sym2.diag` → `Sym2.diagonal`, `Sym2.IsDiag` → `Sym2.IsDiagonal`,
  `Sym2.diagElem` → `Sym2.diagonalElem`, `Sym2.diagSet` → `Sym2.diagonalSet`,
  and all `isDiag_*` / `IsDiag.*` / `*_isDiag` lemmas, with fallout through
  `Combinatorics/SimpleGraph/*` (`not_isDiag_of_mem_edgeSet`,
  `edgeSet_subset_compl_diagSet`, …), including the dot-notation alias
  `Sym2.IsDiag.not_mem_edgeSet` which needed re-adding under the new
  `Sym2.IsDiagonal` namespace to keep firing.
* The `Finset`-of-`Sym2` API (`Finset.diag`/`offDiag` restated for `Sym2`,
  `QuadraticForm` polarisation) that's built on both renames together.

Deprecated aliases for every renamed declaration; long lines re-wrapped;
`scripts/nolints.json` updated for the renamed `Sym2` instances/defs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNPGZ1QMoRHjVquVwdfFTU
Rename the `antidiag` name token to `antidiagonal` throughout:

* `Finset.piAntidiag` → `Finset.piAntidiagonal`
* `Finset.finsuppAntidiag` → `Finset.finsuppAntidiagonal` (+ `…Equiv`, `…EquivSubtype`)
* `Finset.finMulAntidiag` → `Finset.finMulAntidiagonal`
* `Nat.Partition.toFinsuppAntidiag` → `toFinsuppAntidiagonal`
* `Int.divisorsAntidiag` → `Int.divisorsAntidiagonal` (+ lemmas)
* `MonoidAlgebra.coeff_mul_antidiag` / `AddMonoidAlgebra.coeff_mul_antidiag`
  → `…coeff_mul_antidiagonal`

The declarations stay in their existing `Mathlib/Algebra/Order/Antidiag/*.lean`
modules; the modules themselves are not renamed in this PR (that can follow
once the declaration renames have landed). `docs/1000.yaml` is updated to
point the Multinomial theorem entry at the renamed `…_piAntidiagonal_of_commute`.

Every renamed declaration gets a `@[deprecated (since := "2026-09-06")]`
alias (dropping the redundant explicit `to_additive` name where it's exactly
what `to_additive` autogenerates, and the alias mkalias generated for the
private, unreferenceable `card_finMulAntidiagonal_pi`).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNPGZ1QMoRHjVquVwdfFTU
…l decls)

Rename the `diag` name token where it abbreviates "diagonal" in the core
`CategoryTheory` diagonal-of-an-object construction and its consequences:

* `CategoryTheory.Limits.diag`/`codiag` → `diagonal`/`codiagonal`, then
  further namespaced as `Limits.prod.diagonal`/`Limits.coprod.codiagonal`
  (matching its own lemma prefixes `prod.diagonal_map`,
  `coprod.map_codiagonal`, …) once the plain `diagonal` name collided with
  `pullback.diagonal` via `open pullback` in `Limits/Shapes/Diagonal.lean`;
  the `Limits.diag`/`Limits.codiag` deprecated aliases are retargeted
  accordingly, with downstream uses in `ModelCategory/Cylinder.lean` and
  `ModelCategory/PathObject.lean` updated to match.
* `CategoryTheory.Functor.diag` → `Functor.diagonal`
* `IsSubterminal.isIso_diag`/`isoDiag`/`isSubterminal_of_isIso_diag` → `…diagonal…`
* `Abelian.NonPreadditive` `diag_σ`, `Monoidal.Functor` `diag_ε/η/μ/δ` → `diagonal_*`
* `StructuredArrow`/`CostructuredArrow.ofDiagEquivalence(') ` → `ofDiagonalEquivalence(')`
* `Functor.{final,initial}_diag_of_isFiltered` → `…_diagonal_…`
* `externalProductCompDiagIso` → `externalProductCompDiagonalIso`
* `MorphismProperty.Representable` `of_diag`/`diag_iff`/`diag_of_map_from_obj` → `…diagonal…`

The `(Co)limitPresentation.diag` field and `Galois.EssSurj.quotientDiag` abbreviate
"diagram", not "diagonal", and are deliberately left untouched.

Every renamed declaration gets a `@[deprecated (since := "2026-09-06")]` alias.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNPGZ1QMoRHjVquVwdfFTU
`TypeVec` `prod.diag`, `diagSub`, `fst_diag`, `snd_diag`, `dropFun_diag`,
`diag_sub_val` → `…diagonal…`, with the downstream use in
`QPF/Multivariate/Constructions/Cofix.lean` updated to match.

This is the multivariate-QPF `TypeVec` machinery, unrelated to the core
`CategoryTheory` diagonal construction renamed in the previous commit
beyond sharing the `diag` token.

Every renamed declaration gets a `@[deprecated (since := "2026-09-06")]` alias.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNPGZ1QMoRHjVquVwdfFTU
Rename remaining `diag`-as-"diagonal" declarations outside Matrix/Set/uniformity:

* `OrderHom.diag`/`onDiag` → `OrderHom.diagonal`/`onDiagonal`
* `LinearMap.diag` (Pi) → `LinearMap.diagonal` (+ `single_eq_pi_diag`), which made
  the bare `diagonal` ambiguous with `Matrix.diagonal` in
  `RingTheory/MatrixPolynomialAlgebra.lean` and `LinearAlgebra/Matrix/Diagonal.lean`;
  qualified accordingly. Downstream reference in `RingTheory/Coalgebra/Basic.lean`
  updated to match.
* `SimplexCategory.diag` → `SimplexCategory.diagonal` (+ `diag_subinterval_eq`),
  with the `SimplicialObject.diagonal`/`Quasicategory` call sites (which
  reference it, and became ambiguous where a file opens both
  `SimplicialObject` and `SimplexCategory`) updated and qualified to match.
* `FormalMultilinearSeries.derivSeries_apply_diag`,
  `HasFPowerSeriesOnBall.iteratedFDeriv_zero_apply_diag` → `…_diagonal`
* `SpecialLinearGroup.diag2`/`diag2n`/`diag2_*`/`diag_commute`/`diag_eq_diag2n_prod`/
  `commutator_diag2_transvection` → `diagonal2`/`diagonal2n`/…
* `diag_toMatrix_directSum_collectedBasis_eq_zero_of_mapsTo_ne` → `diagonal_…`
* `exteriorPower.ιMultiDual_apply_diag`/`_nondiag` → `…_diagonal`/`_nondiagonal`
* `IsClub.diag` → `IsClub.diagonal`
* `WittVector.IsPoly₂.diag` → `IsPoly₂.diagonal`
* `Finset.prod_range_diag_flip`/`prod_prod_Ioi_mul_eq_prod_prod_off_diag` → `…diagonal…`
* `TopPair.diag`/`proj₁AdjDiag` → `TopPair.diagonal`/`proj₁AdjDiagonal`

Every renamed declaration gets a `@[deprecated (since := "2026-09-06")]` alias.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNPGZ1QMoRHjVquVwdfFTU
* `Finset.piDiag` → `Finset.piDiagonal` (+ `mem_piDiag`, `card_piDiag`,
  `piDiag_subset_piFinset`)
* `Nat.diag_induction` → `Nat.diagonal_induction`
* `IsHeckeTriple.diag_left`/`diag_right` → `diagonal_left`/`diagonal_right`
* `ContinuousMonoidHom.diag` → `ContinuousMonoidHom.diagonal`

Every renamed declaration gets a `@[deprecated (since := "2026-09-06")]` alias.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNPGZ1QMoRHjVquVwdfFTU
@wrenna-robson
wrenna-robson force-pushed the rename-diag-to-diagonal branch from 020d5e3 to 62bf013 Compare September 7, 2026 18:31
@wrenna-robson

Copy link
Copy Markdown
Collaborator Author

@SnirBroshi should be clear now.

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

Labels

LLM-generated PRs with substantial input from LLMs - review accordingly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants