Skip to content

chore(Data/Finset/Card): rename pred_card_le_card_erase to sub_one_card_le_card_erase#36832

Open
KryptosAI wants to merge 4 commits intoleanprover-community:masterfrom
KryptosAI:rename-pred-card-le-card-erase
Open

chore(Data/Finset/Card): rename pred_card_le_card_erase to sub_one_card_le_card_erase#36832
KryptosAI wants to merge 4 commits intoleanprover-community:masterfrom
KryptosAI:rename-pred-card-le-card-erase

Conversation

@KryptosAI
Copy link
Copy Markdown
Contributor

@KryptosAI KryptosAI commented Mar 18, 2026

Summary

The name pred_card_le_card_erase suggests Nat.pred but the statement uses - 1 (i.e., Nat.sub 1). Rename to sub_one_card_le_card_erase to match the actual statement.

A deprecated alias is added for backwards compatibility.

Files changed

  • Mathlib/Data/Finset/Card.lean — definition renamed + deprecated alias
  • Mathlib/Data/Finset/Powerset.lean — reference updated
  • Mathlib/Combinatorics/Additive/SubsetSum.lean — reference updated
  • Mathlib/Algebra/Polynomial/EraseLead.lean — reference updated

Addresses the Finset.pred_card_le_card_erase item in #21584.

AI disclosure

I used Claude Code to explore the codebase (finding all references to rename) and to draft the PR description. I reviewed and understand all changes — these are straightforward renames with a deprecated alias.

…_card_le_card_erase`

The name `pred_card_le_card_erase` suggests `Nat.pred` but the statement
uses `- 1` (i.e., `Nat.sub 1`). Rename to `sub_one_card_le_card_erase`
to match the actual statement.

A deprecated alias is added for backwards compatibility.
Updates downstream references in Powerset.lean, SubsetSum.lean,
and EraseLead.lean.

Addresses part of leanprover-community#21584.
@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Mar 18, 2026
@github-actions
Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 18, 2026

PR summary 6ef8cc2731

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ card_eq_add_one
+ card_eq_add_one_iff_cons
+ card_sub_one_le_card_erase
+ sub_one_card_le_card_erase

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/technical-debt-metrics.sh 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).

Copy link
Copy Markdown
Collaborator

@Multramate Multramate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also do this change for card_eq_succ and card_eq_succ_iff_cons? Thanks!

Comment thread Mathlib/Data/Finset/Card.lean Outdated
Multiset.card_erase_le

theorem pred_card_le_card_erase : #s - 1 ≤ #(s.erase a) := by grind
theorem sub_one_card_le_card_erase : #s - 1 ≤ #(s.erase a) := by grind
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
theorem sub_one_card_le_card_erase : #s - 1 ≤ #(s.erase a) := by grind
theorem card_sub_one_le_card_erase : #s - 1 ≤ #(s.erase a) := by grind

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 0d4ae07. I renamed this to card_sub_one_le_card_erase, and I left deprecated aliases for both pred_card_le_card_erase and sub_one_card_le_card_erase.

@KryptosAI
Copy link
Copy Markdown
Contributor Author

Also addressed the consistency suggestion from the approved review in 0d4ae07: card_eq_succ / card_eq_succ_iff_cons are now card_eq_add_one / card_eq_add_one_iff_cons, with deprecated aliases left in place for the previous names.

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

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants