refactor(QueryTracking/Birthday): extract pair-count lemma to ToMathlib#420
Open
BoltonBailey wants to merge 1 commit into
Open
refactor(QueryTracking/Birthday): extract pair-count lemma to ToMathlib#420BoltonBailey wants to merge 1 commit into
BoltonBailey wants to merge 1 commit into
Conversation
…oMathlib
Complete the birthday-bound union step by proving the count of strictly
increasing pairs `{(i,j) : Fin n × Fin n | i < j}` equals `n.choose 2`,
and split the log-collision bound into a tight `C(n,2)/|C|` statement plus
the `n²/(2|C|)` corollary.
The combinatorial cardinality fact is extracted into a new general
`ToMathlib/Combinatorics/FinPairs.lean` (`Finset.card_filter_fst_lt_snd`
and its Gauss-sum helper), replacing the inline induction.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🤖 PR SummaryFormalization and Lemma Extraction
Proof Completion
Refactoring
Statistics
Lean Declarations ✏️ **Added:** 4 declaration(s)
📋 **Additional Analysis**Attribution and File Headers * Header Year: In ToMathlib/Combinatorics/FinPairs.lean, the copyright year is set to 2026. Verify if this should be the current calendar year. * Prologue Layout: There is no blank line between the header and the code in FinPairs.lean. Additionally, the stray word 'module' on line 7 is a syntax error and violates the layout rules. ### Documentation Expectations * Section Headers: FinPairs.lean uses '@[expose] public section' (line 21). Project instructions require using '/-! ## Section title -/' for inline section breaks. Note that 'public section' and '@[expose]' are not standard Lean 4 syntax. ### Style Notes * Syntax Errors: The keyword 'module' on line 7 of FinPairs.lean must be removed. * Imports: FinPairs.lean uses 'public import'. Ordinary source files should use standard 'import' unless re-exporting is explicitly required by the architecture. * Naming: The new theorem 'probEvent_logCollision_le_birthday_total_tight' in Birthday.lean uses mixed lowerCamelCase and snake_case. While it follows existing naming in that file, Mathlib convention for theorems is pure snake_case. * TODOs: A '-- TODO' comment remains on line 32 of FinPairs.lean regarding proof simplification. Ensure this is resolved or intentionally preserved.📄 **Per-File Summaries**
Last updated: 2026-05-31 16:01 UTC. |
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.
This PR refactors a result in the birthday file. It reduces the quantity of code in that file by refactoring out a the fact that the number of pairs of type Fin n such that p.1 < p.2 is n.choose 2 to another file.
🤖 Generated with Claude Code