Skip to content

[Merged by Bors] - refactor(Data/Nat/Choose/Central): move and rename four_pow_le_two_mul_add_one_mul_central_binom - #42606

Closed
mo271 wants to merge 4 commits into
leanprover-community:masterfrom
mo271:two_mul_choose_self_le_pow
Closed

mo271 wants to merge 4 commits into
leanprover-community:masterfrom
mo271:two_mul_choose_self_le_pow

Conversation

@mo271

@mo271 mo271 commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

Move four_pow_le_two_mul_add_one_mul_central_binom from Mathlib.Data.Nat.Choose.Sum to Mathlib.Data.Nat.Choose.Central and adjust it to fit the file's API:

  • Rename: four_pow_le_two_mul_add_one_mul_central_binom → four_pow_le_two_mul_add_one_mul_centralBinom (aligning with centralBinom casing convention).
  • Statement: Stated using centralBinom n rather than (2 * n).choose n.
  • Proof: Simplified by using four_pow_le_two_mul_self_mul_centralBinom directly, avoiding an import dependency on Choose.Sum.
  • Deprecation: Added a deprecation alias for the old name.

Open in Gitpod

Adding $4^n$, where we already have it as lower bound in
`four_pow_le_two_mul_add_one_mul_central_binom`.

Having both provides the standard two-sided bounds for the
central binomial coefficient: $$\frac{4^n}{2n+1} \le \binom{2n}{n} \le 4^n$$

Even though there already is `choose_middle_le_pow`, anyone needing
the bound on the central binomial coefficient has to manually discover
and apply choose_le_succ
@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

PR summary 36fc23ef3d

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ four_pow_le_two_mul_add_one_mul_centralBinom

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 -- stale, waiting for the new build)

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

  • +1 new declarations
  • −0 removed declarations
+Nat.four_pow_le_two_mul_add_one_mul_centralBinom

No changes to strong technical debt.
No changes to weak technical debt.

Current commit 36fc23ef3d
Reference commit 239cf0d8f3

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 t-data Data (lists, quotients, numbers, etc) label Aug 10, 2026
Comment thread Mathlib/Data/Nat/Choose/Sum.lean Resolved
Comment thread Mathlib/Data/Nat/Choose/Sum.lean Resolved
@mo271 mo271 changed the title feat(Data/Nat/Choose/Sum): two_mul_choose_self_le_pow refactor(Data/Nat/Choose/Central): move and rename four_pow_le_two_mul_add_one_mul_central_binom Aug 11, 2026

@joneugster joneugster left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

maintainer delegate

Comment thread Mathlib/Data/Nat/Choose/Sum.lean Resolved
Comment thread Mathlib/Data/Nat/Choose/Central.lean Resolved
@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by joneugster.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Sep 13, 2026

@jcommelin jcommelin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks 🎉

bors merge

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Sep 14, 2026
@mathlib-triage mathlib-triage Bot removed the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Sep 14, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Sep 14, 2026
…ul_add_one_mul_central_binom` (#42606)

Move `four_pow_le_two_mul_add_one_mul_central_binom` from [`Mathlib.Data.Nat.Choose.Sum`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Sum.lean) to [`Mathlib.Data.Nat.Choose.Central`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean) and adjust it to fit the file's API:

* **Rename**: `four_pow_le_two_mul_add_one_mul_central_binom` → [`four_pow_le_two_mul_add_one_mul_centralBinom`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean#L123-L128) (aligning with `centralBinom` casing convention).
* **Statement**: Stated using `centralBinom n` rather than `(2 * n).choose n`.
* **Proof**: Simplified by using [`four_pow_le_two_mul_self_mul_centralBinom`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean#L110-L122) directly, avoiding an import dependency on `Choose.Sum`.
* **Deprecation**: Added a deprecation alias for the old name.
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Sep 14, 2026
@mathlib-bors

mathlib-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Build failed (retrying...):

@mathlib-bors mathlib-bors Bot removed the bors-staging This PR is currently being built by bors on the staging branch. label Sep 14, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Sep 14, 2026
…ul_add_one_mul_central_binom` (#42606)

Move `four_pow_le_two_mul_add_one_mul_central_binom` from [`Mathlib.Data.Nat.Choose.Sum`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Sum.lean) to [`Mathlib.Data.Nat.Choose.Central`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean) and adjust it to fit the file's API:

* **Rename**: `four_pow_le_two_mul_add_one_mul_central_binom` → [`four_pow_le_two_mul_add_one_mul_centralBinom`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean#L123-L128) (aligning with `centralBinom` casing convention).
* **Statement**: Stated using `centralBinom n` rather than `(2 * n).choose n`.
* **Proof**: Simplified by using [`four_pow_le_two_mul_self_mul_centralBinom`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean#L110-L122) directly, avoiding an import dependency on `Choose.Sum`.
* **Deprecation**: Added a deprecation alias for the old name.
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Sep 14, 2026
@mathlib-bors

mathlib-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Build failed (retrying...):

@mathlib-bors mathlib-bors Bot removed the bors-staging This PR is currently being built by bors on the staging branch. label Sep 14, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Sep 14, 2026
…ul_add_one_mul_central_binom` (#42606)

Move `four_pow_le_two_mul_add_one_mul_central_binom` from [`Mathlib.Data.Nat.Choose.Sum`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Sum.lean) to [`Mathlib.Data.Nat.Choose.Central`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean) and adjust it to fit the file's API:

* **Rename**: `four_pow_le_two_mul_add_one_mul_central_binom` → [`four_pow_le_two_mul_add_one_mul_centralBinom`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean#L123-L128) (aligning with `centralBinom` casing convention).
* **Statement**: Stated using `centralBinom n` rather than `(2 * n).choose n`.
* **Proof**: Simplified by using [`four_pow_le_two_mul_self_mul_centralBinom`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean#L110-L122) directly, avoiding an import dependency on `Choose.Sum`.
* **Deprecation**: Added a deprecation alias for the old name.
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Sep 14, 2026
@mathlib-bors

mathlib-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Build failed (retrying...):

@mathlib-bors mathlib-bors Bot removed the bors-staging This PR is currently being built by bors on the staging branch. label Sep 14, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Sep 14, 2026
…ul_add_one_mul_central_binom` (#42606)

Move `four_pow_le_two_mul_add_one_mul_central_binom` from [`Mathlib.Data.Nat.Choose.Sum`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Sum.lean) to [`Mathlib.Data.Nat.Choose.Central`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean) and adjust it to fit the file's API:

* **Rename**: `four_pow_le_two_mul_add_one_mul_central_binom` → [`four_pow_le_two_mul_add_one_mul_centralBinom`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean#L123-L128) (aligning with `centralBinom` casing convention).
* **Statement**: Stated using `centralBinom n` rather than `(2 * n).choose n`.
* **Proof**: Simplified by using [`four_pow_le_two_mul_self_mul_centralBinom`](file:///usr/local/google/home/firsching/mathlib4/Mathlib/Data/Nat/Choose/Central.lean#L110-L122) directly, avoiding an import dependency on `Choose.Sum`.
* **Deprecation**: Added a deprecation alias for the old name.
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Sep 14, 2026
@mathlib-bors

mathlib-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title refactor(Data/Nat/Choose/Central): move and rename four_pow_le_two_mul_add_one_mul_central_binom [Merged by Bors] - refactor(Data/Nat/Choose/Central): move and rename four_pow_le_two_mul_add_one_mul_central_binom Sep 14, 2026
@mathlib-bors mathlib-bors Bot closed this Sep 14, 2026
rosborn added a commit to rosborn/mathlib4 that referenced this pull request Sep 15, 2026
* origin/master: (958 commits)
  chore(Combinatorics/SimpleGraph/Trails): golf and cleanup (leanprover-community#41447)
  refactor(Probability/Kernel): remove redundant case split in Invariant.comp (leanprover-community#43805)
  chore: bump toolchain to v4.34.0 (leanprover-community#43798)
  feat(Data/List/SignVariations): add List.signVariations (leanprover-community#43783)
  feat(LinearAlgebra/Span/Basic): add Submodule.prodEquiv (leanprover-community#43664)
  feat(cache): put with native Azure and S3 backends (leanprover-community#43378)
  feat(Combinatorics/SimpleGraph/Walk): more `transfer` API (leanprover-community#41717)
  feat(SimpleGraph): girth-diameter inequality (leanprover-community#25834)
  feat: make `simps?` and `to_dual?`/`to_additive?` more concise (leanprover-community#43775)
  feat(Basic/IsEmpty/Defs): add Fin.isEmpty_iff (leanprover-community#43763)
  feat(Data/ENNReal/Inv): add ENNReal.div_mul_div_cancel (leanprover-community#37954)
  chore(Tactic/Simproc/ExistsAndEq): fix two typos (leanprover-community#43797)
  feat(LinearAlgebra/Matrix/GeneralLinearGroup/Defs): add the proof of the range of toGL to be the ker of the determinant and the induced equivalence (leanprover-community#41786)
  chore(Data/Num/Lemmas): golf `transfer` tactic (leanprover-community#41167)
  refactor(Data/Nat/Choose/Central): move and rename `four_pow_le_two_mul_add_one_mul_central_binom` (leanprover-community#42606)
  feat(Combinatorics/Graph): edge cut of `Graph` (leanprover-community#37865)
  feat(Algebra/QuadraticAlgebra): classify quadratic algebras by their discriminant (leanprover-community#42708)
  fix: use the PR number in the deprecation reminder message (leanprover-community#43786)
  feat(Data/Fintype/Defs): add DecidableLE (∀ a, β a) (leanprover-community#43425)
  chore: redefine `Finsupp.indicator` using `Finsupp.onFinset` (leanprover-community#33434)
  ...

# Conflicts:
#	Mathlib/Tactic/Linter/DirectoryDependency.lean
Kha added a commit to leanprover/downstream-lean4 that referenced this pull request Sep 15, 2026
…bound (#76)

Fixes the red [run
34921296164](https://github.com/leanprover/downstream-lean4/actions/runs/34921296164)
on `master` (`nightly-2026-09-14`, commit d7f4adb `downstream: update
repo mathlib4`).

## mathlib4

**Root cause.** The merge with mathlib master brought in
[mathlib4#42606](leanprover-community/mathlib4#42606),
which renames `Nat.four_pow_le_two_mul_add_one_mul_central_binom` to
`Nat.four_pow_le_two_mul_add_one_mul_centralBinom` and restates it as

```
4 ^ n ≤ (2 * n + 1) * n.centralBinom
```

while the deprecated alias it leaves behind still says

```
4 ^ n ≤ (2 * n + 1) * (2 * n).choose n
```

The two are defeq but not syntactically equal, so lean4#14600's
inexact-deprecation check warns at
`Mathlib/Data/Nat/Choose/Central.lean:131`. `mathlib4` builds with
`--wfail`, so the warning is the failure;
`Mathlib.Data.Nat.Choose.Central` was the only logged target.

mathlib's own CI builds on a release toolchain, which does not have this
check, so markers like this one only ever exist downstream and every
mathlib merge can add another.

**Fix.** Added `+typeChanged` to the `@[deprecated]` attribute, as the
warning's own hint suggests. The marker is not recorded in the
environment, so no dependent `.olean` changes and everything downstream
of the module replays from cache.

**Verified locally** on `nightly-2026-09-14`:

- `mathlib4`: `lake build --wfail Mathlib Archive Counterexamples
Wanted`, `lake test --iofail`, `lake lint` — all pass. Only
`Mathlib.Data.Nat.Choose.Central` rebuilt; the rest replayed.
- `cslib`: `lake build --wfail --iofail`, `lake test --wfail --iofail`,
`lake lint` — all pass with no changes. It was red in the run only
because it was skipped behind `mathlib4`.

Nothing was left unfinished: those two were the entire red set.

<!-- downstream-watch: unattended -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. ready-to-merge This PR has been sent to bors. t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants