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 /-- Under Hall's condition, the union of three tight sets is tight. -/ example (t : ℕ → Finset ℕ) (hall : ∀ v : Finset ℕ, v.card ≤ (v.biUnion t).card) (s u v : Finset ℕ) (hs : (s.biUnion t).card = s.card) (hu : (u.biUnion t).card = u.card) (hv : (v.biUnion t).card = v.card) : ((s ∪ u ∪ v).biUnion t).card = (s ∪ u ∪ v).card := (card_biUnion_union_inter_eq_of_tight hall (card_biUnion_union_inter_eq_of_tight hall hs hu).1 hv).1Steps 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).
Under Hall's condition |v| ≤ |v.biUnion t| for all v, the union and the intersection of two tight sets (|s.biUnion t| = |s|) are tight.
Lean statement
theorem card_biUnion_union_inter_eq_of_tight {ι α : Type*} [DecidableEq ι] [DecidableEq α]
{t : ι → Finset α} {s u : Finset ι} (hall : ∀ v : Finset ι, v.card ≤ (v.biUnion t).card)
(hs : (s.biUnion t).card = s.card) (hu : (u.biUnion t).card = u.card) :
((s ∪ u).biUnion t).card = (s ∪ u).card ∧ ((s ∩ u).biUnion t).card = (s ∩ u).cardLinks
Lean docstring
Tight sets of a Hall family form a lattice. Let t : ι → Finset α satisfy Hall's condition |v| ≤ |v.biUnion t| for every v : Finset ι, and call s tight when |s.biUnion t| = |s|. Then the union and the intersection of two tight sets are tight. This is the critical-set step of the Halmos–Vaughan proof of Hall's theorem and the source of the Dulmage–Mendelsohn decomposition.
- Archive:
Finset.card_biUnion_union_eq_card_unionandFinset.card_biUnion_inter_eq_card_inter(Formalizations.Combinatorics.Hall.Tight), paired into one statement here; the module cites no paper DOI of ours. - Classical reference: P. R. Halmos, H. E. Vaughan, Amer. J. Math. 72 (1950) 214–215; L. Lovász, M. D. Plummer, Matching Theory (1986), ch. 1.
- Example: for the identity family
t i = {i}every set is tight, and so are unions and intersections.
Upstream
two omega corollaries of R0028; they belong next to Mathlib.Combinatorics.Hall.Finite
Depends on, in this repository
None besides the archive module (repo_dependencies = []).