Use this theorem
Create a project
lake +leanprover/lean4:v4.35.0 new myproject std.toml cd myprojectStandard template, not
math: themathtemplate adds its own Mathlib requirement pinned to the Lean release tag, not to the Mathlib commit this package is built and tested with, so you would get a second, different Mathlib. Mathlib comes in through this package. Skip this step in an existing project with the same Lean and Mathlib.Add the dependency to
lakefile.toml[[require]] name = "formalizations" git = "https://github.com/karlesmarin/formalizations" rev = "v0.15.0"Import the minimal module
import Formalizations.Reusable.CombinatoricsIn a file of the project, e.g.
Example.lean.Paste the example
open Formalizations.Reusable Filter Topology Classical /-- Bondy: from a family of at most `|X|` distinct sets one element of `X` can be deleted without losing any member, so the erased family has the same size. -/ example (X : Finset β) (hX : X.Nonempty) (F : Finset (Finset β)) (hF : F.card β€ X.card) : β x β X, (F.image (fun A => A.erase x)).card = F.card := by obtain β¨x, hx, hinjβ© := bondy_exists_erase_injOn X hX F hF exact β¨x, hx, Finset.card_image_of_injOn hinjβ©Steps 3 and 4 together are a complete Lean file:
FormalizationsTest/ReusableCombinatoricsExample.leanat v0.15.0, compiled by the CI.Fetch and check
lake update lake lean Example.leanlake updatefetches this package and Mathlib, and Mathlib's update hook downloads the compiled Mathlib (lake exe cache get).lake lean Example.leanbuilds the imports of the file (steps 3 and 4) and checks it. If the file belongs to alean_libof your project,lake build <lib>does the same. Avoid a barelake buildin a project from the standard template: its default target is the executable, whose link compiles every imported Mathlib module to native code. Same versions required: Leanv4.35.0, Mathlibf0b4c81.
Alternative: import Formalizations.Reusable imports the whole layer (all areas).
Bondy's theorem: if X is a nonempty finite set and F a family of at most |X| distinct finite sets, some x β X can be deleted from every member of F keeping them distinct.
Lean statement
theorem bondy_exists_erase_injOn {Ξ± : Type*} [DecidableEq Ξ±] (X : Finset Ξ±) (hX : X.Nonempty)
(F : Finset (Finset Ξ±)) (hcard : F.card β€ X.card) :
β x β X, Set.InjOn (fun A : Finset Ξ± => A.erase x) (F : Set (Finset Ξ±))Links
Lean docstring
Bondy's theorem on induced subsets. Let X be a nonempty finite set and F a family of at most |X| distinct finite sets. Then some x β X can be deleted from every member of F without merging two of them: A β¦ A.erase x is injective on F. The sets need not be subsets of X. Typical uses: test covers and separating systems, and deleting a coordinate of a binary code without identifying two codewords.
- Archive:
Bondy.exists_erase_injOn(Formalizations.Combinatorics.SetFamily.Bondy, proved by the linear-algebra argument overZMod 2); the module cites no paper DOI of ours. - Classical reference: J. A. Bondy, Induced subsets, J. Combin. Theory Ser. B 12 (1972) 201β202.
- Example: for
X = {1, 2}andF = {β , {1}}, deleting2keeps the two sets distinct.
Upstream
a classical theorem with a self-contained linear-algebra proof; Mathlib has no theory of separating systems for it to extend
Depends on, in this repository
None besides the archive module (repo_dependencies = []).