Chapter 28: Complete formalization of Pigeon-hole and Double Counting#129
Open
subfish-zhou wants to merge 2 commits intomo271:mainfrom
Open
Chapter 28: Complete formalization of Pigeon-hole and Double Counting#129subfish-zhou wants to merge 2 commits intomo271:mainfrom
subfish-zhou wants to merge 2 commits intomo271:mainfrom
Conversation
Fully formalized all 12 propositions from Chapter 28 of 'Proofs from THE BOOK': - Pigeon-hole principle and 4 claims (coprime, divisibility, Erdős–Szekeres, contiguous sum) - Double counting, average divisor count with asymptotic bound - Handshaking lemma, C₄-free edge bound (Reiman's theorem) - Abstract Sperner's lemma (parity argument) - Brouwer fixed point theorem for n=2 (via covering spaces) All proofs compile with zero sorry, zero errors, zero warnings. Merged ErdosSzekeres.lean and Brouwer.lean into Chapter_28.lean. This formalization was produced by OpenClaw (https://github.com/openclaw/openclaw).
- Add docstring for handshaking lemma citing Mathlib's SimpleGraph.sum_degrees_eq_twice_card_edges and explaining why our double-counting proof is more faithful to the book - Add faithfulness note to Erdős–Szekeres section comparing book's single-label strategy with Mathlib Archive's dual-label approach - Add docstring for Triangulation.triangles (docBlame linter) - Remove unused arguments: _hn in claim1_coprime, DecidableEq in double_counting, hn in sum_divisor_count/avg_divisor_count_le_harmonic - Zero sorry, zero errors, zero warnings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chapter 28: Complete formalization of Pigeon-hole and Double Counting
Overview
This PR completes the formalization of Chapter 28 (Pigeon-hole and double counting) from Proofs from THE BOOK. All 12 propositions from the chapter are now formalized in Lean 4 with zero
sorry, zero errors, and zero warnings.This formalization was produced entirely by OpenClaw, an open-source AI agent framework powered by Claude Opus 4.6 (Anthropic) via GitHub Copilot. The agent autonomously analyzed the LaTeX blueprint, planned proof strategies, wrote Lean 4 proofs, and verified compilation. Human involvement was limited to task initiation, periodic review, and high-level guidance.
What Changed
FormalBook/Chapter_28.lean: 87 → ~930 lines.blueprint/src/chapter/chapter28.tex: Updated with\lean{}tags and proof annotations.Proposition Correspondence
chapter28.pigeon_hole_principlechapter28.claim1_coprimechapter28.claim2_divisiblechapter28.claim3_erdos_szekeresTheorems100.erdos_szekeres)chapter28.claim4_contiguous_sumchapter28.double_countingFinset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelowchapter28.sum_divisor_countavg_divisor_count_le_harmonic+avg_divisor_count_lower_boundchapter28.handshakingchapter28.sum_choose_deg_le_choose_cardchapter28.c4_free_edge_boundchapter28.sperner_lemmachapter28.brouwer_fixed_point_2dAreas Requiring Human Review
1. Sperner's Lemma — Abstracted Geometric Conditions
The book proves Sperner's lemma for triangulations of a triangle with boundary coloring constraints. Our formalization proves an abstract parity version: given a finset with a coloring function mapping to {0,1,2}, if the sum is odd, then the number of elements colored 1 is odd.
What's missing: The geometric infrastructure — triangulation of a simplex, boundary coloring conditions derived from the labeling rule λ(v) = min{i : f(v)ᵢ < vᵢ}, and the dual-graph door-counting argument that establishes the odd-sum hypothesis.
Why: Mathlib currently lacks formalized barycentric coordinates, simplicial triangulations, and mesh refinement. The abstract parity core is mathematically correct and is the combinatorial heart of the proof, but the geometric "interface" is assumed rather than derived.
Reviewer action: Verify that the abstract statement (
sperner_lemma,sperner_lemma_exists) correctly captures the combinatorial content. The geometric gap is documented in comments.2. Brouwer Fixed Point Theorem — Alternative Proof Path
The book derives Brouwer from Sperner via triangulation sequences + compactness. Our proof uses a completely different approach:
Why the detour: The Sperner → Brouwer path requires barycentric subdivision, triangulation sequences with mesh → 0, and Bolzano–Weierstrass extraction — none of which are in Mathlib. The covering space approach uses
IsCoveringMap,SimplyConnectedSpace, andContractibleSpace, all available in Mathlib.Consequence: Sperner's lemma and Brouwer's theorem are both proven but logically independent in this formalization. The book's "Sperner implies Brouwer" narrative is not captured.
Reviewer action: Verify the retraction construction (
rRfunction) and the no-retraction argument. The ray-sphere intersection involves a quadratic formula — check that the discriminant bound and root selection are correct.Acknowledgment
This formalization was produced by OpenClaw, an open-source AI agent framework, powered by Claude Opus 4.6 (Anthropic) via GitHub Copilot. The agent autonomously analyzed the LaTeX source, planned proof strategies, wrote and verified Lean 4 proofs through an orchestrator-worker architecture. Human involvement was limited to task initiation, periodic oversight, and final review.