Skip to content

feat(NumberTheory/AdditionChain): addition chains and the doubling bound - #42510

Open
williamjblair wants to merge 1 commit into
leanprover-community:masterfrom
williamjblair:addition-chain
Open

feat(NumberTheory/AdditionChain): addition chains and the doubling bound#42510
williamjblair wants to merge 1 commit into
leanprover-community:masterfrom
williamjblair:addition-chain

Conversation

@williamjblair

@williamjblair williamjblair commented Aug 6, 2026

Copy link
Copy Markdown

An addition chain for n is a strictly increasing list 1 = a₀ < a₁ < ⋯ < a_r = n in which every entry after the first is a sum of two earlier entries. Nat.additionChainLength n is the least r over all such chains, the classical ℓ(n).

additionChainLength is an sInf over List ℕ, so an explicit chain bounds it above (Nat.additionChainLength_le), but nothing bounds it below until the search is confined. List.IsAdditionChain.getLast_le_two_pow confines it: a step at most doubles, so r steps cannot reach past 2 ^ r. That gives Nat.lt_additionChainLength_of_two_pow_lt, and the two bounds together pin down individual values.

Nat.exists_isAdditionChain shows every positive n ends some chain, so the length is a minimum of a nonempty set rather than sInf ∅.


Mathlib has nothing on addition chains at present. This came out of formal-conjectures, where it underlies the Scholz conjecture.

I could not run scripts/lint-bib.sh locally (no bibtool), so the new knuth1997 entry is formatted by hand to match its neighbours.

Open in Gitpod

An addition chain for `n` is a strictly increasing list starting at `1` in which
every later entry is a sum of two earlier ones. This adds the predicate, the
minimal length `Nat.additionChainLength`, and the two bounds that make it usable:
an explicit chain bounds it above, and the fact that a step at most doubles bounds
it below.

Also proves every positive `n` has a chain, so the length is a genuine minimum
rather than `sInf ∅`.
@grunweg grunweg added the t-number-theory Number theory (also use t-algebra or t-analysis to specialize) label Aug 7, 2026
mo271 pushed a commit to google-deepmind/formal-conjectures that referenced this pull request Aug 7, 2026
`List.le_getLast_of_pairwise_lt`, added in #4752, already exists in
Mathlib as `List.Pairwise.rel_getLast`. It needs `(· ≤ ·)` rather than
`(· < ·)`, since it asks for a reflexive relation, so the two call sites
become

```lean
have hsub := (List.pairwise_append.mp hsorted).1.imp le_of_lt
have hla := hsub.rel_getLast hays
```

I noticed this while preparing the same file for Mathlib in
leanprover-community/mathlib4#42510.

`lake --wfail build` is clean over the library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-number-theory Number theory (also use t-algebra or t-analysis to specialize)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants