Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Total no-adjacent string count as a sum over k

Proved
NoAdjString.card_noAdjacentStrings_eq_sum

by Yuxuan Xu · Sep 25, 2026 · Mathlib 0df444a (Lean v4.33.1)

binary-stringscombinatoricsfinset-sum

The total number of length-nnn strings with no adjacent ones equals the sum, over the number kkk of ones, of the exact-kkk counts:

#(noAdjacentStrings n)=∑k=0n(n+1−kk).\#(\mathrm{noAdjacentStrings}\, n) = \sum_{k=0}^{n} \binom{n+1-k}{k}.#(noAdjacentStringsn)=k=0∑n​(kn+1−k​).

The families for distinct kkk are pairwise disjoint because their members have distinct support cardinalities.

Preamble
import Definitions.Def_NoAdjacentBinaryStrings

open Finset Function
Formal statement
namespace NoAdjString

theorem card_noAdjacentStrings_eq_sum (n : ℕ) :
    (noAdjacentStrings n).card =
      ∑ k ∈ Finset.range (n + 1), Nat.choose (n + 1 - k) k := by sorry

end NoAdjString
Source
Kenneth H. Rosen, Discrete Mathematics and Its Applications, 8th ed., McGraw-Hill 2019. The no-consecutive-ones count is the worked example on bit strings without consecutive 1s in Section 8.1 (Applications of Recurrence Relations); the exact-k binomial count is the restricted-combinations (gap) argument of Chapter 6.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me