fact stringlengths 6 3.84k | type stringclasses 11 values | library stringclasses 32 values | imports listlengths 1 14 | filename stringlengths 20 95 | symbolic_name stringlengths 1 90 | docstring stringlengths 7 20k ⌀ |
|---|---|---|---|---|---|---|
@[simps apply_app]
Functor.sectionsEquivHom (F : C ⥤ Type u₂) (X : Type u₂) [Unique X] :
F.sections ≃ ((const _).obj X ⟶ F) where
toFun s :=
{ app j x := s.1 j
naturality _ _ _ := by ext x; simp }
invFun τ := ⟨fun j ↦ τ.app _ (default : X), fun φ ↦ (congr_fun (τ.naturality φ) _).symm⟩
right_inv τ := by
ext _ (x : X)
rw [Unique.eq_default x] | def | CategoryTheory | [
"Mathlib.CategoryTheory.Functor.Hom",
"Mathlib.CategoryTheory.Products.Basic",
"Mathlib.Data.ULift",
"Mathlib.Logic.Function.ULift"
] | Mathlib/CategoryTheory/Yoneda.lean | Functor.sectionsEquivHom | A type-level equivalence between sections of a functor and morphisms from a terminal functor
to it. We use the constant functor on a given singleton type here as a specific choice of terminal
functor. |
Functor.sectionsEquivHom_naturality {F G : C ⥤ Type u₂} (f : F ⟶ G) (X : Type u₂) [Unique X]
(x : F.sections) :
(G.sectionsEquivHom X) ((sectionsFunctor C).map f x) = (F.sectionsEquivHom X) x ≫ f := by
rfl | lemma | CategoryTheory | [
"Mathlib.CategoryTheory.Functor.Hom",
"Mathlib.CategoryTheory.Products.Basic",
"Mathlib.Data.ULift",
"Mathlib.Logic.Function.ULift"
] | Mathlib/CategoryTheory/Yoneda.lean | Functor.sectionsEquivHom_naturality | null |
Functor.sectionsEquivHom_naturality_symm {F G : C ⥤ Type u₂} (f : F ⟶ G) (X : Type u₂)
[Unique X] (τ : (const C).obj X ⟶ F) :
(G.sectionsEquivHom X).symm (τ ≫ f) =
(sectionsFunctor C).map f ((F.sectionsEquivHom X).symm τ) := by
rfl | lemma | CategoryTheory | [
"Mathlib.CategoryTheory.Functor.Hom",
"Mathlib.CategoryTheory.Products.Basic",
"Mathlib.Data.ULift",
"Mathlib.Logic.Function.ULift"
] | Mathlib/CategoryTheory/Yoneda.lean | Functor.sectionsEquivHom_naturality_symm | null |
@[simps!]
noncomputable sectionsFunctorNatIsoCoyoneda (X : Type max u₁ u₂) [Unique X] :
Functor.sectionsFunctor.{v₁, max u₁ u₂} C ≅ coyoneda.obj (op ((Functor.const C).obj X)) :=
NatIso.ofComponents fun F ↦ (F.sectionsEquivHom X).toIso | def | CategoryTheory | [
"Mathlib.CategoryTheory.Functor.Hom",
"Mathlib.CategoryTheory.Products.Basic",
"Mathlib.Data.ULift",
"Mathlib.Logic.Function.ULift"
] | Mathlib/CategoryTheory/Yoneda.lean | sectionsFunctorNatIsoCoyoneda | A natural isomorphism between the sections functor `(C ⥤ Type _) ⥤ Type _` and the co-Yoneda
embedding of a terminal functor, specifically a constant functor on a given singleton type `X`. |
@[simps!]
homNatIso {D : Type u₂} [Category.{v₂} D] {F : C ⥤ D} (hF : F.FullyFaithful) (X : C) :
F.op ⋙ yoneda.obj (F.obj X) ⋙ uliftFunctor.{v₁} ≅ yoneda.obj X ⋙ uliftFunctor.{v₂} :=
NatIso.ofComponents
(fun Y => Equiv.toIso (Equiv.ulift.trans <| hF.homEquiv.symm.trans Equiv.ulift.symm))
(fun f => by ext; exact Equiv.ulift.injective (hF.map_injective (by simp))) | def | CategoryTheory | [
"Mathlib.CategoryTheory.Functor.Hom",
"Mathlib.CategoryTheory.Products.Basic",
"Mathlib.Data.ULift",
"Mathlib.Logic.Function.ULift"
] | Mathlib/CategoryTheory/Yoneda.lean | homNatIso | `FullyFaithful.homEquiv` as a natural isomorphism. |
@[simps!]
homNatIsoMaxRight {D : Type u₂} [Category.{max v₁ v₂} D] {F : C ⥤ D} (hF : F.FullyFaithful)
(X : C) : F.op ⋙ yoneda.obj (F.obj X) ≅ yoneda.obj X ⋙ uliftFunctor.{v₂} :=
NatIso.ofComponents
(fun Y => Equiv.toIso (hF.homEquiv.symm.trans Equiv.ulift.symm))
(fun f => by ext; exact Equiv.ulift.injective (hF.map_injective (by simp))) | def | CategoryTheory | [
"Mathlib.CategoryTheory.Functor.Hom",
"Mathlib.CategoryTheory.Products.Basic",
"Mathlib.Data.ULift",
"Mathlib.Logic.Function.ULift"
] | Mathlib/CategoryTheory/Yoneda.lean | homNatIsoMaxRight | `FullyFaithful.homEquiv` as a natural isomorphism. |
@[simps!]
compYonedaCompWhiskeringLeft {D : Type u₂} [Category.{v₂} D] {F : C ⥤ D}
(hF : F.FullyFaithful) : F ⋙ yoneda ⋙ (whiskeringLeft _ _ _).obj F.op ⋙
(Functor.whiskeringRight _ _ _).obj uliftFunctor.{v₁} ≅
yoneda ⋙ (Functor.whiskeringRight _ _ _).obj uliftFunctor.{v₂} :=
NatIso.ofComponents (fun X => hF.homNatIso _)
(fun f => by ext; exact Equiv.ulift.injective (hF.map_injective (by simp))) | def | CategoryTheory | [
"Mathlib.CategoryTheory.Functor.Hom",
"Mathlib.CategoryTheory.Products.Basic",
"Mathlib.Data.ULift",
"Mathlib.Logic.Function.ULift"
] | Mathlib/CategoryTheory/Yoneda.lean | compYonedaCompWhiskeringLeft | `FullyFaithful.homEquiv` as a natural isomorphism. |
@[simps!]
compYonedaCompWhiskeringLeftMaxRight {D : Type u₂} [Category.{max v₁ v₂} D] {F : C ⥤ D}
(hF : F.FullyFaithful) : F ⋙ yoneda ⋙ (whiskeringLeft _ _ _).obj F.op ≅
yoneda ⋙ (Functor.whiskeringRight _ _ _).obj uliftFunctor.{v₂} :=
NatIso.ofComponents (fun X => hF.homNatIsoMaxRight _)
(fun f => by ext; exact Equiv.ulift.injective (hF.map_injective (by simp))) | def | CategoryTheory | [
"Mathlib.CategoryTheory.Functor.Hom",
"Mathlib.CategoryTheory.Products.Basic",
"Mathlib.Data.ULift",
"Mathlib.Logic.Function.ULift"
] | Mathlib/CategoryTheory/Yoneda.lean | compYonedaCompWhiskeringLeftMaxRight | `FullyFaithful.homEquiv` as a natural isomorphism. |
@[deprecated Colex (since := "2025-08-28")]
protected Colex (α) where
/-- `toColex` is the "identity" function between `Finset α` and `Finset.Colex α`. -/
protected toColex ::
/-- `ofColex` is the "identity" function between `Finset.Colex α` and `Finset α`. -/
protected (ofColex : Finset α)
open Colex | structure | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | Colex | Type synonym of `Finset α` equipped with the colexicographic order rather than the inclusion
order. |
@[deprecated toColex_ofColex (since := "2025-08-28")]
protected toColex_ofColex (s : Finset.Colex α) :
Finset.Colex.toColex (Finset.Colex.ofColex s) = s :=
rfl
set_option linter.deprecated false in
@[deprecated ofColex_toColex (since := "2025-08-28")] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_ofColex | null |
protected ofColex_toColex (s : Finset α) :
Finset.Colex.ofColex (Finset.Colex.toColex s) = s :=
rfl
set_option linter.deprecated false in
@[deprecated toColex_inj (since := "2025-08-28")] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | ofColex_toColex | null |
protected toColex_inj {s t : Finset α} :
Finset.Colex.toColex s = Finset.Colex.toColex t ↔ s = t := by
simp
set_option linter.deprecated false in
@[deprecated ofColex_inj (since := "2025-08-28")] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_inj | null |
protected ofColex_inj {s t : Finset.Colex α} :
Finset.Colex.ofColex s = Finset.Colex.ofColex t ↔ s = t := by
cases s; cases t; simp
set_option linter.deprecated false in
@[deprecated toColex_inj (since := "2025-08-28")] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | ofColex_inj | null |
toColex_ne_toColex {s t : Finset α} :
Finset.Colex.toColex s ≠ Finset.Colex.toColex t ↔ s ≠ t := by
simp
set_option linter.deprecated false in
@[deprecated ofColex_inj (since := "2025-08-28")] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_ne_toColex | null |
ofColex_ne_ofColex {s t : Finset.Colex α} :
Finset.Colex.ofColex s ≠ Finset.Colex.ofColex t ↔ s ≠ t := by
simp [Finset.ofColex_inj]
set_option linter.deprecated false in
@[deprecated toColex_inj (since := "2025-08-28")] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | ofColex_ne_ofColex | null |
toColex_injective : Injective (Finset.Colex.toColex : Finset α → Finset.Colex α) :=
fun _ _ ↦ Finset.toColex_inj.1
set_option linter.deprecated false in
@[deprecated ofColex_inj (since := "2025-08-28")] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_injective | null |
ofColex_injective : Injective (Finset.Colex.ofColex : Finset.Colex α → Finset α) :=
fun _ _ ↦ Finset.ofColex_inj.1 | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | ofColex_injective | null |
instLE : LE (Colex (Finset α)) where
le s t := ∀ ⦃a⦄, a ∈ ofColex s → a ∉ ofColex t → ∃ b, b ∈ ofColex t ∧ b ∉ ofColex s ∧ a ≤ b | instance | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | instLE | null |
private trans_aux (hst : toColex s ≤ toColex t) (htu : toColex t ≤ toColex u)
(has : a ∈ s) (hat : a ∉ t) : ∃ b, b ∈ u ∧ b ∉ s ∧ a ≤ b := by
classical
let s' : Finset α := {b ∈ s | b ∉ t ∧ a ≤ b}
have ⟨b, hb, hbmax⟩ := s'.exists_maximal ⟨a, by simp [s', has, hat]⟩
simp only [s', mem_filter, and_imp] at hb hbmax
have ⟨c, hct, hcs, hbc⟩ := hst hb.1 hb.2.1
by_cases hcu : c ∈ u
· exact ⟨c, hcu, hcs, hb.2.2.trans hbc⟩
have ⟨d, hdu, hdt, hcd⟩ := htu hct hcu
have had : a ≤ d := hb.2.2.trans <| hbc.trans hcd
refine ⟨d, hdu, fun hds ↦ not_lt_iff_le_imp_ge.2 (hbmax hds hdt had) ?_, had⟩
exact hbc.trans_lt <| hcd.lt_of_ne <| ne_of_mem_of_not_mem hct hdt | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | trans_aux | null |
private antisymm_aux (hst : toColex s ≤ toColex t) (hts : toColex t ≤ toColex s) : s ⊆ t := by
intro a has
by_contra! hat
have ⟨_b, hb₁, hb₂, _⟩ := trans_aux hst hts has hat
exact hb₂ hb₁ | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | antisymm_aux | null |
instPartialOrder : PartialOrder (Colex (Finset α)) where
le_refl _ _ ha ha' := (ha' ha).elim
le_antisymm _ _ hst hts := (antisymm_aux hst hts).antisymm (antisymm_aux hts hst)
le_trans s t u hst htu a has hau := by
by_cases hat : a ∈ ofColex t
· have ⟨b, hbu, hbt, hab⟩ := htu hat hau
by_cases hbs : b ∈ ofColex s
· have ⟨c, hcu, hcs, hbc⟩ := trans_aux hst htu hbs hbt
exact ⟨c, hcu, hcs, hab.trans hbc⟩
· exact ⟨b, hbu, hbs, hab⟩
· exact trans_aux hst htu has hat | instance | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | instPartialOrder | null |
le_def {s t : Colex (Finset α)} :
s ≤ t ↔ ∀ ⦃a⦄, a ∈ ofColex s → a ∉ ofColex t → ∃ b, b ∈ ofColex t ∧ b ∉ ofColex s ∧ a ≤ b :=
Iff.rfl | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | le_def | null |
toColex_le_toColex :
toColex s ≤ toColex t ↔ ∀ ⦃a⦄, a ∈ s → a ∉ t → ∃ b, b ∈ t ∧ b ∉ s ∧ a ≤ b := Iff.rfl | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_le_toColex | null |
toColex_lt_toColex :
toColex s < toColex t ↔ s ≠ t ∧ ∀ ⦃a⦄, a ∈ s → a ∉ t → ∃ b, b ∈ t ∧ b ∉ s ∧ a ≤ b := by
simp [lt_iff_le_and_ne, toColex_le_toColex, and_comm] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_lt_toColex | null |
toColex_mono : Monotone (@toColex (Finset α)) :=
fun _s _t hst _a has hat ↦ (hat <| hst has).elim | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_mono | If `s ⊆ t`, then `s ≤ t` in the colex order. Note the converse does not hold, as inclusion does
not form a linear order. |
toColex_strictMono : StrictMono (@toColex (Finset α)) :=
toColex_mono.strictMono_of_injective toColex.injective | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_strictMono | If `s ⊂ t`, then `s < t` in the colex order. Note the converse does not hold, as inclusion does
not form a linear order. |
toColex_le_toColex_of_subset (h : s ⊆ t) : toColex s ≤ toColex t := toColex_mono h | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_le_toColex_of_subset | If `s ⊆ t`, then `s ≤ t` in the colex order. Note the converse does not hold, as inclusion does
not form a linear order. |
toColex_lt_toColex_of_ssubset (h : s ⊂ t) : toColex s < toColex t := toColex_strictMono h | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_lt_toColex_of_ssubset | If `s ⊂ t`, then `s < t` in the colex order. Note the converse does not hold, as inclusion does
not form a linear order. |
instOrderBot : OrderBot (Colex (Finset α)) where
bot := toColex ∅
bot_le s a ha := by cases ha
@[simp] lemma toColex_empty : toColex (∅ : Finset α) = ⊥ := rfl
@[simp] lemma ofColex_bot : ofColex (⊥ : Colex (Finset α)) = ∅ := rfl | instance | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | instOrderBot | null |
forall_le_mono (hst : toColex s ≤ toColex t) (ht : ∀ b ∈ t, b ≤ a) : ∀ b ∈ s, b ≤ a := by
rintro b hb
by_cases b ∈ t
· exact ht _ ‹_›
· obtain ⟨c, hct, -, hbc⟩ := hst hb ‹_›
exact hbc.trans <| ht _ hct | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | forall_le_mono | If `s ≤ t` in colex, and all elements in `t` are small, then all elements in `s` are small. |
forall_lt_mono (hst : toColex s ≤ toColex t) (ht : ∀ b ∈ t, b < a) : ∀ b ∈ s, b < a := by
rintro b hb
by_cases b ∈ t
· exact ht _ ‹_›
· obtain ⟨c, hct, -, hbc⟩ := hst hb ‹_›
exact hbc.trans_lt <| ht _ hct | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | forall_lt_mono | If `s ≤ t` in colex, and all elements in `t` are small, then all elements in `s` are small. |
toColex_le_singleton : toColex s ≤ toColex {a} ↔ ∀ b ∈ s, b ≤ a ∧ (a ∈ s → b = a) := by
simp only [toColex_le_toColex, mem_singleton, exists_eq_left]
refine forall₂_congr fun b _ ↦ ?_; obtain rfl | hba := eq_or_ne b a <;> aesop | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_le_singleton | `s ≤ {a}` in colex iff all elements of `s` are strictly less than `a`, except possibly `a` in
which case `s = {a}`. |
toColex_lt_singleton : toColex s < toColex {a} ↔ ∀ b ∈ s, b < a := by
rw [lt_iff_le_and_ne, toColex_le_singleton, ne_eq, toColex_inj]
refine ⟨fun h b hb ↦ (h.1 _ hb).1.lt_of_ne ?_,
fun h ↦ ⟨fun b hb ↦ ⟨(h _ hb).le, fun ha ↦ (lt_irrefl _ <| h _ ha).elim⟩, ?_⟩⟩ <;> rintro rfl
· refine h.2 <| eq_singleton_iff_unique_mem.2 ⟨hb, fun c hc ↦ (h.1 _ hc).2 hb⟩
· simp at h | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_lt_singleton | `s < {a}` in colex iff all elements of `s` are strictly less than `a`. |
singleton_le_toColex : (toColex {a} : Colex (Finset α)) ≤ toColex s ↔ ∃ x ∈ s, a ≤ x := by
simp [toColex_le_toColex]; by_cases a ∈ s <;> aesop | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | singleton_le_toColex | `{a} ≤ s` in colex iff `s` contains an element greater than or equal to `a`. |
singleton_le_singleton : (toColex ({a} : Finset α)) ≤ toColex {b} ↔ a ≤ b := by
simp [toColex_le_singleton, eq_comm] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | singleton_le_singleton | Colex is an extension of the base order. |
singleton_lt_singleton : (toColex ({a} : Finset α)) < toColex {b} ↔ a < b := by
simp [toColex_lt_singleton] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | singleton_lt_singleton | Colex is an extension of the base order. |
le_iff_sdiff_subset_lowerClosure {s t : Colex (Finset α)} :
s ≤ t ↔ (↑(ofColex s) : Set α) \ ↑(ofColex t) ⊆
lowerClosure (↑(ofColex t) \ ↑(ofColex s) : Set α) := by
simp [le_def, Set.subset_def, and_assoc] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | le_iff_sdiff_subset_lowerClosure | null |
instDecidableLE [DecidableLE α] : DecidableLE (Colex (Finset α)) :=
fun s t ↦ decidable_of_iff'
(∀ ⦃a⦄, a ∈ ofColex s → a ∉ ofColex t → ∃ b, b ∈ ofColex t ∧ b ∉ ofColex s ∧ a ≤ b) Iff.rfl | instance | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | instDecidableLE | null |
instDecidableLT [DecidableLE α] : DecidableLT (Colex (Finset α)) :=
decidableLTOfDecidableLE | instance | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | instDecidableLT | null |
toColex_sdiff_le_toColex_sdiff (hus : u ⊆ s) (hut : u ⊆ t) :
toColex (s \ u) ≤ toColex (t \ u) ↔ toColex s ≤ toColex t := by
simp_rw [toColex_le_toColex, ← and_imp, ← and_assoc, ← mem_sdiff,
sdiff_sdiff_sdiff_cancel_right (show u ≤ s from hus),
sdiff_sdiff_sdiff_cancel_right (show u ≤ t from hut)] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_sdiff_le_toColex_sdiff | The colexigraphic order is insensitive to removing the same elements from both sets. |
toColex_sdiff_lt_toColex_sdiff (hus : u ⊆ s) (hut : u ⊆ t) :
toColex (s \ u) < toColex (t \ u) ↔ toColex s < toColex t :=
lt_iff_lt_of_le_iff_le' (toColex_sdiff_le_toColex_sdiff hut hus) <|
toColex_sdiff_le_toColex_sdiff hus hut
@[simp] lemma toColex_sdiff_le_toColex_sdiff' :
toColex (s \ t) ≤ toColex (t \ s) ↔ toColex s ≤ toColex t := by
simpa using toColex_sdiff_le_toColex_sdiff (inter_subset_left (s₁ := s)) inter_subset_right
@[simp] lemma toColex_sdiff_lt_toColex_sdiff' :
toColex (s \ t) < toColex (t \ s) ↔ toColex s < toColex t := by
simpa using toColex_sdiff_lt_toColex_sdiff (inter_subset_left (s₁ := s)) inter_subset_right | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_sdiff_lt_toColex_sdiff | The colexigraphic order is insensitive to removing the same elements from both sets. |
@[simp] cons_le_cons (ha hb) : toColex (s.cons a ha) ≤ toColex (s.cons b hb) ↔ a ≤ b := by
obtain rfl | hab := eq_or_ne a b
· simp
classical
rw [← toColex_sdiff_le_toColex_sdiff', cons_sdiff_cons hab, cons_sdiff_cons hab.symm,
singleton_le_singleton]
@[simp] lemma cons_lt_cons (ha hb) : toColex (s.cons a ha) < toColex (s.cons b hb) ↔ a < b :=
lt_iff_lt_of_le_iff_le' (cons_le_cons _ _) (cons_le_cons _ _)
variable [DecidableEq α] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | cons_le_cons | null |
insert_le_insert (ha : a ∉ s) (hb : b ∉ s) :
toColex (insert a s) ≤ toColex (insert b s) ↔ a ≤ b := by
rw [← cons_eq_insert _ _ ha, ← cons_eq_insert _ _ hb, cons_le_cons] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | insert_le_insert | null |
insert_lt_insert (ha : a ∉ s) (hb : b ∉ s) :
toColex (insert a s) < toColex (insert b s) ↔ a < b := by
rw [← cons_eq_insert _ _ ha, ← cons_eq_insert _ _ hb, cons_lt_cons] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | insert_lt_insert | null |
erase_le_erase (ha : a ∈ s) (hb : b ∈ s) :
toColex (s.erase a) ≤ toColex (s.erase b) ↔ b ≤ a := by
obtain rfl | hab := eq_or_ne a b
· simp
classical
rw [← toColex_sdiff_le_toColex_sdiff', erase_sdiff_erase hab hb, erase_sdiff_erase hab.symm ha,
singleton_le_singleton] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | erase_le_erase | null |
erase_lt_erase (ha : a ∈ s) (hb : b ∈ s) :
toColex (s.erase a) < toColex (s.erase b) ↔ b < a :=
lt_iff_lt_of_le_iff_le' (erase_le_erase hb ha) (erase_le_erase ha hb) | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | erase_lt_erase | null |
instLinearOrder : LinearOrder (Colex (Finset α)) where
le_total s t := by
classical
obtain rfl | hts := eq_or_ne t s
· simp
have ⟨a, ha, hamax⟩ := exists_max_image _ id
(symmDiff_nonempty.2 <| ofColex.injective.ne_iff.2 hts)
simp_rw [mem_symmDiff] at ha hamax
exact ha.imp (fun ha b hbs hbt ↦ ⟨a, ha.1, ha.2, hamax _ <| Or.inr ⟨hbs, hbt⟩⟩)
(fun ha b hbt hbs ↦ ⟨a, ha.1, ha.2, hamax _ <| Or.inl ⟨hbt, hbs⟩⟩)
toDecidableLE := instDecidableLE
toDecidableLT := instDecidableLT
open scoped symmDiff | instance | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | instLinearOrder | null |
private max_mem_aux {s t : Colex (Finset α)} (hst : s ≠ t) :
(ofColex s ∆ ofColex t).Nonempty := by
simpa | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | max_mem_aux | null |
toColex_lt_toColex_iff_exists_forall_lt :
toColex s < toColex t ↔ ∃ a ∈ t, a ∉ s ∧ ∀ b ∈ s, b ∉ t → b < a := by
rw [← not_le, toColex_le_toColex, not_forall]
simp only [not_forall, not_exists, not_and, not_le, exists_prop] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_lt_toColex_iff_exists_forall_lt | null |
lt_iff_exists_forall_lt {s t : Colex (Finset α)} :
s < t ↔ ∃ a ∈ ofColex t, a ∉ ofColex s ∧ ∀ b ∈ ofColex s, b ∉ ofColex t → b < a :=
toColex_lt_toColex_iff_exists_forall_lt | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | lt_iff_exists_forall_lt | null |
toColex_le_toColex_iff_max'_mem :
toColex s ≤ toColex t ↔ ∀ hst : s ≠ t, (s ∆ t).max' (symmDiff_nonempty.2 hst) ∈ t := by
refine ⟨fun h hst ↦ ?_, fun h a has hat ↦ ?_⟩
· set m := (s ∆ t).max' (symmDiff_nonempty.2 hst)
by_contra hmt
have hms : m ∈ s := by
simpa [m, mem_symmDiff, hmt] using max'_mem _ <| symmDiff_nonempty.2 hst
have ⟨b, hbt, hbs, hmb⟩ := h hms hmt
exact lt_irrefl _ <| (max'_lt_iff _ _).1 (hmb.lt_of_ne <| ne_of_mem_of_not_mem hms hbs) _ <|
mem_symmDiff.2 <| Or.inr ⟨hbt, hbs⟩
· have hst : s ≠ t := ne_of_mem_of_not_mem' has hat
refine ⟨_, h hst, ?_, le_max' _ _ <| mem_symmDiff.2 <| Or.inl ⟨has, hat⟩⟩
simpa [mem_symmDiff, h hst] using max'_mem _ <| symmDiff_nonempty.2 hst | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_le_toColex_iff_max'_mem | null |
le_iff_max'_mem {s t : Colex (Finset α)} :
s ≤ t ↔ ∀ h : s ≠ t, (ofColex s ∆ ofColex t).max' (max_mem_aux h) ∈ ofColex t :=
toColex_le_toColex_iff_max'_mem | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | le_iff_max'_mem | null |
toColex_lt_toColex_iff_max'_mem :
toColex s < toColex t ↔ ∃ hst : s ≠ t, (s ∆ t).max' (symmDiff_nonempty.2 hst) ∈ t := by
rw [lt_iff_le_and_ne, toColex_le_toColex_iff_max'_mem]; aesop | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_lt_toColex_iff_max'_mem | null |
lt_iff_max'_mem {s t : Colex (Finset α)} :
s < t ↔ ∃ h : s ≠ t, (ofColex s ∆ ofColex t).max' (max_mem_aux h) ∈ ofColex t := by
rw [lt_iff_le_and_ne, le_iff_max'_mem]; aesop | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | lt_iff_max'_mem | null |
lt_iff_exists_filter_lt :
toColex s < toColex t ↔ ∃ w ∈ t \ s, {a ∈ s | w < a} = {a ∈ t | w < a} := by
simp only [lt_iff_exists_forall_lt, mem_sdiff, filter_inj, and_assoc]
refine ⟨fun h ↦ ?_, ?_⟩
· let u := {w ∈ t \ s | ∀ a ∈ s, a ∉ t → a < w}
have mem_u {w : α} : w ∈ u ↔ w ∈ t ∧ w ∉ s ∧ ∀ a ∈ s, a ∉ t → a < w := by simp [u, and_assoc]
have hu : u.Nonempty := h.imp fun _ ↦ mem_u.2
let m := max' _ hu
have ⟨hmt, hms, hm⟩ : m ∈ t ∧ m ∉ s ∧ ∀ a ∈ s, a ∉ t → a < m := mem_u.1 <| max'_mem _ _
refine ⟨m, hmt, hms, fun a hma ↦ ⟨fun has ↦ not_imp_comm.1 (hm _ has) hma.asymm, fun hat ↦ ?_⟩⟩
by_contra has
have hau : a ∈ u := mem_u.2 ⟨hat, has, fun b hbs hbt ↦ (hm _ hbs hbt).trans hma⟩
exact hma.not_ge <| le_max' _ _ hau
· rintro ⟨w, hwt, hws, hw⟩
refine ⟨w, hwt, hws, fun a has hat ↦ ?_⟩
by_contra! hwa
exact hat <| (hw <| hwa.lt_of_ne <| ne_of_mem_of_not_mem hwt hat).1 has | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | lt_iff_exists_filter_lt | null |
erase_le_erase_min' (hst : toColex s ≤ toColex t) (hcard : #s ≤ #t) (ha : a ∈ s) :
toColex (s.erase a) ≤
toColex (t.erase <| min' t <| card_pos.1 <| (card_pos.2 ⟨a, ha⟩).trans_le hcard) := by
generalize_proofs ht
set m := min' t ht
obtain rfl | h' := eq_or_ne s t
· exact (erase_le_erase ha <| min'_mem _ _).2 <| min'_le _ _ <| ha
replace hst := hst.lt_of_ne <| toColex_inj.not.2 h'
simp only [lt_iff_exists_filter_lt, mem_sdiff, filter_inj, and_assoc] at hst
obtain ⟨w, hwt, hws, hw⟩ := hst
obtain hwa | haw := (ne_of_mem_of_not_mem ha hws).symm.lt_or_gt
· have hma : m < a := (min'_le _ _ hwt).trans_lt hwa
refine (lt_iff_exists_forall_lt.2 ⟨a, mem_erase.2 ⟨hma.ne', (hw hwa).1 ha⟩,
notMem_erase _ _, fun b hbs hbt ↦ ?_⟩).le
change b ∉ t.erase m at hbt
rw [mem_erase, not_and_or, not_ne_iff] at hbt
obtain rfl | hbt := hbt
· assumption
· by_contra! hab
exact hbt <| (hw <| hwa.trans_le hab).1 <| mem_of_mem_erase hbs
obtain rfl | hmw : m = w ∨ m < w := (min'_le _ _ hwt).eq_or_lt
· have : erase t m ⊆ erase s a := by
rintro b hb
rw [mem_erase] at hb ⊢
exact ⟨(haw.trans_le <| min'_le _ _ hb.2).ne',
(hw <| hb.1.lt_of_le' <| min'_le _ _ hb.2).2 hb.2⟩
rw [eq_of_subset_of_card_le this]
rw [card_erase_of_mem ha, card_erase_of_mem (min'_mem _ _)]
exact tsub_le_tsub_right hcard _
· refine (lt_iff_exists_forall_lt.2 ⟨w, mem_erase.2 ⟨hmw.ne', hwt⟩, mt mem_of_mem_erase hws,
fun b hbs hbt ↦ ?_⟩).le
change b ∉ t.erase m at hbt
rw [mem_erase, not_and_or, not_ne_iff] at hbt
obtain rfl | hbt := hbt
· assumption
· by_contra! hwb
exact hbt <| (hw <| hwb.lt_of_ne <| ne_of_mem_of_not_mem hwt hbt).1 <| mem_of_mem_erase hbs | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | erase_le_erase_min' | If `s ≤ t` in colex and `#s ≤ #t`, then `s \ {a} ≤ t \ {min t}` for any `a ∈ s`. |
toColex_image_le_toColex_image (hf : StrictMono f) :
toColex (s.image f) ≤ toColex (t.image f) ↔ toColex s ≤ toColex t := by
simp [toColex_le_toColex, hf.le_iff_le, hf.injective.eq_iff] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_image_le_toColex_image | Strictly monotone functions preserve the colex ordering. |
toColex_image_lt_toColex_image (hf : StrictMono f) :
toColex (s.image f) < toColex (t.image f) ↔ toColex s < toColex t :=
lt_iff_lt_of_le_iff_le <| toColex_image_le_toColex_image hf | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_image_lt_toColex_image | Strictly monotone functions preserve the colex ordering. |
toColex_image_ofColex_strictMono (hf : StrictMono f) :
StrictMono fun s ↦ toColex <| image f <| ofColex s :=
fun _s _t ↦ (toColex_image_lt_toColex_image hf).2 | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | toColex_image_ofColex_strictMono | null |
instBoundedOrder : BoundedOrder (Colex (Finset α)) where
top := toColex univ
le_top _x := toColex_le_toColex_of_subset <| subset_univ _
@[simp] lemma toColex_univ : toColex (univ : Finset α) = ⊤ := rfl
@[simp] lemma ofColex_top : ofColex (⊤ : Colex (Finset α)) = univ := rfl | instance | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | instBoundedOrder | null |
IsInitSeg (𝒜 : Finset (Finset α)) (r : ℕ) : Prop :=
(𝒜 : Set (Finset α)).Sized r ∧
∀ ⦃s t : Finset α⦄, s ∈ 𝒜 → toColex t < toColex s ∧ #t = r → t ∈ 𝒜
@[simp] lemma isInitSeg_empty : IsInitSeg (∅ : Finset (Finset α)) r := by simp [IsInitSeg] | def | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | IsInitSeg | `𝒜` is an initial segment of the colexigraphic order on sets of `r`, and that if `t` is below
`s` in colex where `t` has size `r` and `s` is in `𝒜`, then `t` is also in `𝒜`. In effect, `𝒜` is
downwards closed with respect to colex among sets of size `r`. |
IsInitSeg.total (h₁ : IsInitSeg 𝒜₁ r) (h₂ : IsInitSeg 𝒜₂ r) : 𝒜₁ ⊆ 𝒜₂ ∨ 𝒜₂ ⊆ 𝒜₁ := by
classical
simp_rw [← sdiff_eq_empty_iff_subset, ← not_nonempty_iff_eq_empty]
by_contra! h
have ⟨⟨s, hs⟩, t, ht⟩ := h
rw [mem_sdiff] at hs ht
obtain hst | hst | hts := trichotomous_of (α := Colex (Finset α)) (· < ·) (toColex s) (toColex t)
· exact hs.2 <| h₂.2 ht.1 ⟨hst, h₁.1 hs.1⟩
· simp only [toColex_inj] at hst
exact ht.2 <| hst ▸ hs.1
· exact ht.2 <| h₁.2 hs.1 ⟨hts, h₂.1 ht.1⟩
variable [Fintype α] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | IsInitSeg.total | Initial segments are nested in some way. In particular, if they're the same size they're equal. |
initSeg (s : Finset α) : Finset (Finset α) := {t | #s = #t ∧ toColex t ≤ toColex s}
@[simp] | def | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | initSeg | The initial segment of the colexicographic order on sets with `#s` elements and ending at
`s`. |
mem_initSeg : t ∈ initSeg s ↔ #s = #t ∧ toColex t ≤ toColex s := by simp [initSeg] | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | mem_initSeg | null |
mem_initSeg_self : s ∈ initSeg s := by simp
@[simp] lemma initSeg_nonempty : (initSeg s).Nonempty := ⟨s, mem_initSeg_self⟩ | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | mem_initSeg_self | null |
isInitSeg_initSeg : IsInitSeg (initSeg s) #s := by
refine ⟨fun t ht => (mem_initSeg.1 ht).1.symm, fun t₁ t₂ ht₁ ht₂ ↦ mem_initSeg.2 ⟨ht₂.2.symm, ?_⟩⟩
rw [mem_initSeg] at ht₁
exact ht₂.1.le.trans ht₁.2 | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | isInitSeg_initSeg | null |
IsInitSeg.exists_initSeg (h𝒜 : IsInitSeg 𝒜 r) (h𝒜₀ : 𝒜.Nonempty) :
∃ s : Finset α, #s = r ∧ 𝒜 = initSeg s := by
have hs := sup'_mem (ofColex ⁻¹' 𝒜) (LinearOrder.supClosed _) 𝒜 h𝒜₀ toColex
(fun a ha ↦ by simpa using ha)
refine ⟨_, h𝒜.1 hs, ?_⟩
ext t
rw [mem_initSeg]
refine ⟨fun p ↦ ?_, ?_⟩
· rw [h𝒜.1 p, h𝒜.1 hs]
exact ⟨rfl, le_sup' _ p⟩
rintro ⟨cards, le⟩
obtain p | p := le.eq_or_lt
· rwa [toColex_inj.1 p]
· exact h𝒜.2 hs ⟨p, cards ▸ h𝒜.1 hs⟩ | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | IsInitSeg.exists_initSeg | null |
isInitSeg_iff_exists_initSeg :
IsInitSeg 𝒜 r ∧ 𝒜.Nonempty ↔ ∃ s : Finset α, #s = r ∧ 𝒜 = initSeg s := by
refine ⟨fun h𝒜 ↦ h𝒜.1.exists_initSeg h𝒜.2, ?_⟩
rintro ⟨s, rfl, rfl⟩
exact ⟨isInitSeg_initSeg, initSeg_nonempty⟩ | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | isInitSeg_iff_exists_initSeg | Being a nonempty initial segment of colex is equivalent to being an `initSeg`. |
geomSum_ofColex_strictMono (hn : 2 ≤ n) : StrictMono fun s ↦ ∑ k ∈ ofColex s, n ^ k := by
intro s t hst
rw [lt_iff_exists_forall_lt] at hst
obtain ⟨a, hat, has, ha⟩ := hst
rw [← sum_sdiff_lt_sum_sdiff]
exact (Nat.geomSum_lt hn <| by simpa).trans_le <| single_le_sum (fun _ _ ↦ by cutsat) <|
mem_sdiff.2 ⟨hat, has⟩ | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | geomSum_ofColex_strictMono | null |
geomSum_le_geomSum_iff_toColex_le_toColex (hn : 2 ≤ n) :
∑ k ∈ s, n ^ k ≤ ∑ k ∈ t, n ^ k ↔ toColex s ≤ toColex t :=
(geomSum_ofColex_strictMono hn).le_iff_le | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | geomSum_le_geomSum_iff_toColex_le_toColex | For finsets of naturals, the colexicographic order is equivalent to the order induced by the
`n`-ary expansion. |
geomSum_lt_geomSum_iff_toColex_lt_toColex (hn : 2 ≤ n) :
∑ i ∈ s, n ^ i < ∑ i ∈ t, n ^ i ↔ toColex s < toColex t :=
(geomSum_ofColex_strictMono hn).lt_iff_lt | lemma | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | geomSum_lt_geomSum_iff_toColex_lt_toColex | For finsets of naturals, the colexicographic order is equivalent to the order induced by the
`n`-ary expansion. |
geomSum_injective {n : ℕ} (hn : 2 ≤ n) :
Function.Injective (fun s : Finset ℕ ↦ ∑ i ∈ s, n ^ i) := by
intro _ _ h
rwa [le_antisymm_iff, geomSum_le_geomSum_iff_toColex_le_toColex hn,
geomSum_le_geomSum_iff_toColex_le_toColex hn, ← le_antisymm_iff] at h | theorem | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | geomSum_injective | null |
lt_geomSum_of_mem {a : ℕ} (hn : 2 ≤ n) (hi : a ∈ s) : a < ∑ i ∈ s, n ^ i :=
(a.lt_pow_self hn).trans_le <| single_le_sum (by simp) hi
@[simp] theorem toFinset_bitIndices_twoPowSum (s : Finset ℕ) :
(∑ i ∈ s, 2 ^ i).bitIndices.toFinset = s := by
simp [← (geomSum_injective rfl.le).eq_iff, List.sum_toFinset _ Nat.bitIndices_sorted.nodup]
@[simp] theorem twoPowSum_toFinset_bitIndices (n : ℕ) :
∑ i ∈ n.bitIndices.toFinset, 2 ^ i = n := by
simp [List.sum_toFinset _ Nat.bitIndices_sorted.nodup] | theorem | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | lt_geomSum_of_mem | null |
@[simps] equivBitIndices : ℕ ≃ Finset ℕ where
toFun n := n.bitIndices.toFinset
invFun s := ∑ i ∈ s, 2^i
left_inv := twoPowSum_toFinset_bitIndices
right_inv := toFinset_bitIndices_twoPowSum | def | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | equivBitIndices | The equivalence between `ℕ` and `Finset ℕ` that maps `∑ i ∈ s, 2^i` to `s`. |
@[simps] orderIsoColex : ℕ ≃o Colex (Finset ℕ) where
toFun n := toColex (equivBitIndices n)
invFun s := equivBitIndices.symm (ofColex s)
left_inv n := equivBitIndices.symm_apply_apply n
right_inv s := equivBitIndices.apply_symm_apply _
map_rel_iff' := by simp [← (Finset.geomSum_le_geomSum_iff_toColex_le_toColex rfl.le)] | def | Combinatorics | [
"Mathlib.Algebra.Order.Ring.GeomSum",
"Mathlib.Data.Finset.Slice",
"Mathlib.Data.Nat.BitIndices",
"Mathlib.Order.SupClosed",
"Mathlib.Order.UpperLower.Closure"
] | Mathlib/Combinatorics/Colex.lean | orderIsoColex | The equivalence `Nat.equivBitIndices` enumerates `Finset ℕ` in colexicographic order. |
Dual :=
P | def | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | Dual | A type synonym. |
Nondegenerate : Prop where
exists_point : ∀ l : L, ∃ p, p ∉ l
exists_line : ∀ p, ∃ l : L, p ∉ l
eq_or_eq : ∀ {p₁ p₂ : P} {l₁ l₂ : L}, p₁ ∈ l₁ → p₂ ∈ l₁ → p₁ ∈ l₂ → p₂ ∈ l₂ → p₁ = p₂ ∨ l₁ = l₂ | class | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | Nondegenerate | A configuration is nondegenerate if:
1) there does not exist a line that passes through all of the points,
2) there does not exist a point that is on all of the lines,
3) there is at most one line through any two points,
4) any two lines have at most one intersection point.
Conditions 3 and 4 are equivalent. |
HasPoints extends Nondegenerate P L where
/-- Intersection of two lines -/
mkPoint : ∀ {l₁ l₂ : L}, l₁ ≠ l₂ → P
mkPoint_ax : ∀ {l₁ l₂ : L} (h : l₁ ≠ l₂), mkPoint h ∈ l₁ ∧ mkPoint h ∈ l₂ | class | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasPoints | A nondegenerate configuration in which every pair of lines has an intersection point. |
HasLines extends Nondegenerate P L where
/-- Line through two points -/
mkLine : ∀ {p₁ p₂ : P}, p₁ ≠ p₂ → L
mkLine_ax : ∀ {p₁ p₂ : P} (h : p₁ ≠ p₂), p₁ ∈ mkLine h ∧ p₂ ∈ mkLine h
open Nondegenerate
open HasPoints (mkPoint mkPoint_ax)
open HasLines (mkLine mkLine_ax) | class | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasLines | A nondegenerate configuration in which every pair of points has a line through them. |
Dual.Nondegenerate [Nondegenerate P L] : Nondegenerate (Dual L) (Dual P) where
exists_point := @exists_line P L _ _
exists_line := @exists_point P L _ _
eq_or_eq := @fun l₁ l₂ p₁ p₂ h₁ h₂ h₃ h₄ => (@eq_or_eq P L _ _ p₁ p₂ l₁ l₂ h₁ h₃ h₂ h₄).symm | instance | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | Dual.Nondegenerate | null |
Dual.hasLines [HasPoints P L] : HasLines (Dual L) (Dual P) :=
{ Dual.Nondegenerate _ _ with
mkLine := @mkPoint P L _ _
mkLine_ax := @mkPoint_ax P L _ _ } | instance | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | Dual.hasLines | null |
Dual.hasPoints [HasLines P L] : HasPoints (Dual L) (Dual P) :=
{ Dual.Nondegenerate _ _ with
mkPoint := @mkLine P L _ _
mkPoint_ax := @mkLine_ax P L _ _ } | instance | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | Dual.hasPoints | null |
HasPoints.existsUnique_point [HasPoints P L] (l₁ l₂ : L) (hl : l₁ ≠ l₂) :
∃! p, p ∈ l₁ ∧ p ∈ l₂ :=
⟨mkPoint hl, mkPoint_ax hl, fun _ hp =>
(eq_or_eq hp.1 (mkPoint_ax hl).1 hp.2 (mkPoint_ax hl).2).resolve_right hl⟩ | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasPoints.existsUnique_point | null |
HasLines.existsUnique_line [HasLines P L] (p₁ p₂ : P) (hp : p₁ ≠ p₂) :
∃! l : L, p₁ ∈ l ∧ p₂ ∈ l :=
HasPoints.existsUnique_point (Dual L) (Dual P) p₁ p₂ hp
variable {P L} | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasLines.existsUnique_line | null |
Nondegenerate.exists_injective_of_card_le [Nondegenerate P L] [Fintype P] [Fintype L]
(h : Fintype.card L ≤ Fintype.card P) : ∃ f : L → P, Function.Injective f ∧ ∀ l, f l ∉ l := by
classical
let t : L → Finset P := fun l => Set.toFinset { p | p ∉ l }
suffices ∀ s : Finset L, #s ≤ (s.biUnion t).card by
obtain ⟨f, hf1, hf2⟩ := (Finset.all_card_le_biUnion_card_iff_exists_injective t).mp this
exact ⟨f, hf1, fun l => Set.mem_toFinset.mp (hf2 l)⟩
intro s
by_cases hs₀ : #s = 0
· simp_rw [hs₀, zero_le]
by_cases hs₁ : #s = 1
· obtain ⟨l, rfl⟩ := Finset.card_eq_one.mp hs₁
obtain ⟨p, hl⟩ := exists_point (P := P) l
rw [Finset.card_singleton, Finset.singleton_biUnion, Nat.one_le_iff_ne_zero]
exact Finset.card_ne_zero_of_mem (Set.mem_toFinset.mpr hl)
suffices #(s.biUnion t)ᶜ ≤ #sᶜ by
rw [Finset.card_compl, Finset.card_compl, tsub_le_iff_left] at this
replace := h.trans this
rwa [← add_tsub_assoc_of_le s.card_le_univ, le_tsub_iff_left (le_add_left s.card_le_univ),
add_le_add_iff_right] at this
have hs₂ : #(s.biUnion t)ᶜ ≤ 1 := by
refine Finset.card_le_one_iff.mpr @fun p₁ p₂ hp₁ hp₂ => ?_
simp_rw [t, Finset.mem_compl, Finset.mem_biUnion, not_exists, not_and,
Set.mem_toFinset, Set.mem_setOf_eq, Classical.not_not] at hp₁ hp₂
obtain ⟨l₁, l₂, hl₁, hl₂, hl₃⟩ :=
Finset.one_lt_card_iff.mp (Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hs₀, hs₁⟩)
exact (eq_or_eq (hp₁ l₁ hl₁) (hp₂ l₁ hl₁) (hp₁ l₂ hl₂) (hp₂ l₂ hl₂)).resolve_right hl₃
by_cases hs₃ : #sᶜ = 0
· rw [hs₃, Nat.le_zero]
rw [Finset.card_compl, tsub_eq_zero_iff_le, (Finset.card_le_univ _).ge_iff_eq', eq_comm,
Finset.card_eq_iff_eq_univ] at hs₃ ⊢
rw [hs₃]
rw [Finset.eq_univ_iff_forall] at hs₃ ⊢
exact fun p =>
Exists.elim (exists_line p)-- If `s = univ`, then show `s.bUnion t = univ`
fun l hl => Finset.mem_biUnion.mpr ⟨l, Finset.mem_univ l, Set.mem_toFinset.mpr hl⟩
· exact hs₂.trans (Nat.one_le_iff_ne_zero.mpr hs₃)
variable (L) | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | Nondegenerate.exists_injective_of_card_le | If a nondegenerate configuration has at least as many points as lines, then there exists
an injective function `f` from lines to points, such that `f l` does not lie on `l`. |
noncomputable lineCount (p : P) : ℕ :=
Nat.card { l : L // p ∈ l }
variable (P) {L} | def | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | lineCount | Number of points on a given line. |
noncomputable pointCount (l : L) : ℕ :=
Nat.card { p : P // p ∈ l }
variable (L) | def | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | pointCount | Number of lines through a given point. |
sum_lineCount_eq_sum_pointCount [Fintype P] [Fintype L] :
∑ p : P, lineCount L p = ∑ l : L, pointCount P l := by
classical
simp only [lineCount, pointCount, Nat.card_eq_fintype_card, ← Fintype.card_sigma]
apply Fintype.card_congr
calc
(Σ p, { l : L // p ∈ l }) ≃ { x : P × L // x.1 ∈ x.2 } :=
(Equiv.subtypeProdEquivSigmaSubtype (· ∈ ·)).symm
_ ≃ { x : L × P // x.2 ∈ x.1 } := (Equiv.prodComm P L).subtypeEquiv fun x => Iff.rfl
_ ≃ Σ l, { p // p ∈ l } := Equiv.subtypeProdEquivSigmaSubtype fun (l : L) (p : P) => p ∈ l
variable {P L} | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | sum_lineCount_eq_sum_pointCount | null |
HasLines.pointCount_le_lineCount [HasLines P L] {p : P} {l : L} (h : p ∉ l)
[Finite { l : L // p ∈ l }] : pointCount P l ≤ lineCount L p := by
by_cases hf : Infinite { p : P // p ∈ l }
· exact (le_of_eq Nat.card_eq_zero_of_infinite).trans (zero_le (lineCount L p))
haveI := fintypeOfNotInfinite hf
cases nonempty_fintype { l : L // p ∈ l }
rw [lineCount, pointCount, Nat.card_eq_fintype_card, Nat.card_eq_fintype_card]
have : ∀ p' : { p // p ∈ l }, p ≠ p' := fun p' hp' => h ((congr_arg (· ∈ l) hp').mpr p'.2)
exact
Fintype.card_le_of_injective (fun p' => ⟨mkLine (this p'), (mkLine_ax (this p')).1⟩)
fun p₁ p₂ hp =>
Subtype.ext ((eq_or_eq p₁.2 p₂.2 (mkLine_ax (this p₁)).2
((congr_arg (_ ∈ ·) (Subtype.ext_iff.mp hp)).mpr (mkLine_ax (this p₂)).2)).resolve_right
fun h' => (congr_arg (p ∉ ·) h').mp h (mkLine_ax (this p₁)).1) | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasLines.pointCount_le_lineCount | null |
HasPoints.lineCount_le_pointCount [HasPoints P L] {p : P} {l : L} (h : p ∉ l)
[hf : Finite { p : P // p ∈ l }] : lineCount L p ≤ pointCount P l :=
@HasLines.pointCount_le_lineCount (Dual L) (Dual P) _ _ l p h hf
variable (P L) | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasPoints.lineCount_le_pointCount | null |
HasLines.card_le [HasLines P L] [Fintype P] [Fintype L] :
Fintype.card P ≤ Fintype.card L := by
classical
by_contra hc₂
obtain ⟨f, hf₁, hf₂⟩ := Nondegenerate.exists_injective_of_card_le (le_of_not_ge hc₂)
have :=
calc
∑ p, lineCount L p = ∑ l, pointCount P l := sum_lineCount_eq_sum_pointCount P L
_ ≤ ∑ l, lineCount L (f l) :=
(Finset.sum_le_sum fun l _ => HasLines.pointCount_le_lineCount (hf₂ l))
_ = ∑ p ∈ univ.map ⟨f, hf₁⟩, lineCount L p := by rw [sum_map]; dsimp
_ < ∑ p, lineCount L p := by
obtain ⟨p, hp⟩ := not_forall.mp (mt (Fintype.card_le_of_surjective f) hc₂)
refine sum_lt_sum_of_subset (subset_univ _) (mem_univ p) ?_ ?_ fun p _ _ ↦ zero_le _
· simpa only [Finset.mem_map, exists_prop, Finset.mem_univ, true_and]
· rw [lineCount, Nat.card_eq_fintype_card, Fintype.card_pos_iff]
obtain ⟨l, _⟩ := @exists_line P L _ _ p
exact
let this := not_exists.mp hp l
⟨⟨mkLine this, (mkLine_ax this).2⟩⟩
exact lt_irrefl _ this | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasLines.card_le | If a nondegenerate configuration has a unique line through any two points, then `|P| ≤ |L|`. |
HasPoints.card_le [HasPoints P L] [Fintype P] [Fintype L] :
Fintype.card L ≤ Fintype.card P :=
@HasLines.card_le (Dual L) (Dual P) _ _ _ _
variable {P L} | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasPoints.card_le | If a nondegenerate configuration has a unique point on any two lines, then `|L| ≤ |P|`. |
HasLines.exists_bijective_of_card_eq [HasLines P L] [Fintype P] [Fintype L]
(h : Fintype.card P = Fintype.card L) :
∃ f : L → P, Function.Bijective f ∧ ∀ l, pointCount P l = lineCount L (f l) := by
classical
obtain ⟨f, hf1, hf2⟩ := Nondegenerate.exists_injective_of_card_le (ge_of_eq h)
have hf3 := (Fintype.bijective_iff_injective_and_card f).mpr ⟨hf1, h.symm⟩
exact ⟨f, hf3, fun l ↦ (sum_eq_sum_iff_of_le fun l _ ↦ pointCount_le_lineCount (hf2 l)).1
((hf3.sum_comp _).trans (sum_lineCount_eq_sum_pointCount P L)).symm _ <| mem_univ _⟩ | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasLines.exists_bijective_of_card_eq | null |
HasLines.lineCount_eq_pointCount [HasLines P L] [Fintype P] [Fintype L]
(hPL : Fintype.card P = Fintype.card L) {p : P} {l : L} (hpl : p ∉ l) :
lineCount L p = pointCount P l := by
classical
obtain ⟨f, hf1, hf2⟩ := HasLines.exists_bijective_of_card_eq hPL
let s : Finset (P × L) := Set.toFinset { i | i.1 ∈ i.2 }
have step1 : ∑ i : P × L, lineCount L i.1 = ∑ i : P × L, pointCount P i.2 := by
rw [← Finset.univ_product_univ, Finset.sum_product_right, Finset.sum_product]
simp_rw [Finset.sum_const, Finset.card_univ, hPL, sum_lineCount_eq_sum_pointCount]
have step2 : ∑ i ∈ s, lineCount L i.1 = ∑ i ∈ s, pointCount P i.2 := by
rw [s.sum_finset_product Finset.univ fun p => Set.toFinset { l | p ∈ l }]
on_goal 1 =>
rw [s.sum_finset_product_right Finset.univ fun l => Set.toFinset { p | p ∈ l }, eq_comm]
· refine sum_bijective _ hf1 (by simp) fun l _ ↦ ?_
simp_rw [hf2, sum_const, Set.toFinset_card, ← Nat.card_eq_fintype_card]
change pointCount P l • _ = lineCount L (f l) • _
rw [hf2]
all_goals simp_rw [s, Finset.mem_univ, true_and, Set.mem_toFinset]; exact fun p => Iff.rfl
have step3 : ∑ i ∈ sᶜ, lineCount L i.1 = ∑ i ∈ sᶜ, pointCount P i.2 := by
rwa [← s.sum_add_sum_compl, ← s.sum_add_sum_compl, step2, add_left_cancel_iff] at step1
rw [← Set.toFinset_compl] at step3
exact
((Finset.sum_eq_sum_iff_of_le fun i hi =>
HasLines.pointCount_le_lineCount (by exact Set.mem_toFinset.mp hi)).mp
step3.symm (p, l) (Set.mem_toFinset.mpr hpl)).symm | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasLines.lineCount_eq_pointCount | null |
HasPoints.lineCount_eq_pointCount [HasPoints P L] [Fintype P] [Fintype L]
(hPL : Fintype.card P = Fintype.card L) {p : P} {l : L} (hpl : p ∉ l) :
lineCount L p = pointCount P l :=
(@HasLines.lineCount_eq_pointCount (Dual L) (Dual P) _ _ _ _ hPL.symm l p hpl).symm | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasPoints.lineCount_eq_pointCount | null |
noncomputable HasLines.hasPoints [HasLines P L] [Fintype P] [Fintype L]
(h : Fintype.card P = Fintype.card L) : HasPoints P L :=
let this : ∀ l₁ l₂ : L, l₁ ≠ l₂ → ∃ p : P, p ∈ l₁ ∧ p ∈ l₂ := fun l₁ l₂ hl => by
classical
obtain ⟨f, _, hf2⟩ := HasLines.exists_bijective_of_card_eq h
haveI : Nontrivial L := ⟨⟨l₁, l₂, hl⟩⟩
haveI := Fintype.one_lt_card_iff_nontrivial.mp ((congr_arg _ h).mpr Fintype.one_lt_card)
have h₁ : ∀ p : P, 0 < lineCount L p := fun p =>
Exists.elim (exists_ne p) fun q hq =>
(congr_arg _ Nat.card_eq_fintype_card).mpr
(Fintype.card_pos_iff.mpr ⟨⟨mkLine hq, (mkLine_ax hq).2⟩⟩)
have h₂ : ∀ l : L, 0 < pointCount P l := fun l => (congr_arg _ (hf2 l)).mpr (h₁ (f l))
obtain ⟨p, hl₁⟩ := Fintype.card_pos_iff.mp ((congr_arg _ Nat.card_eq_fintype_card).mp (h₂ l₁))
by_cases hl₂ : p ∈ l₂
· exact ⟨p, hl₁, hl₂⟩
have key' : Fintype.card { q : P // q ∈ l₂ } = Fintype.card { l : L // p ∈ l } :=
((HasLines.lineCount_eq_pointCount h hl₂).trans Nat.card_eq_fintype_card).symm.trans
Nat.card_eq_fintype_card
have : ∀ q : { q // q ∈ l₂ }, p ≠ q := fun q hq => hl₂ ((congr_arg (· ∈ l₂) hq).mpr q.2)
let f : { q : P // q ∈ l₂ } → { l : L // p ∈ l } := fun q =>
⟨mkLine (this q), (mkLine_ax (this q)).1⟩
have hf : Function.Injective f := fun q₁ q₂ hq =>
Subtype.ext ((eq_or_eq q₁.2 q₂.2 (mkLine_ax (this q₁)).2
((congr_arg (_ ∈ ·) (Subtype.ext_iff.mp hq)).mpr (mkLine_ax (this q₂)).2)).resolve_right
fun h => (congr_arg (p ∉ ·) h).mp hl₂ (mkLine_ax (this q₁)).1)
have key' := ((Fintype.bijective_iff_injective_and_card f).mpr ⟨hf, key'⟩).2
obtain ⟨q, hq⟩ := key' ⟨l₁, hl₁⟩
exact ⟨q, (congr_arg (_ ∈ ·) (Subtype.ext_iff.mp hq)).mp (mkLine_ax (this q)).2, q.2⟩
{ ‹HasLines P L› with
mkPoint := fun {l₁ l₂} hl => Classical.choose (this l₁ l₂ hl)
mkPoint_ax := fun {l₁ l₂} hl => Classical.choose_spec (this l₁ l₂ hl) } | def | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasLines.hasPoints | If a nondegenerate configuration has a unique line through any two points, and if `|P| = |L|`,
then there is a unique point on any two lines. |
noncomputable HasPoints.hasLines [HasPoints P L] [Fintype P] [Fintype L]
(h : Fintype.card P = Fintype.card L) : HasLines P L :=
let this := @HasLines.hasPoints (Dual L) (Dual P) _ _ _ _ h.symm
{ ‹HasPoints P L› with
mkLine := @fun _ _ => this.mkPoint
mkLine_ax := @fun _ _ => this.mkPoint_ax }
variable (P L) | def | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | HasPoints.hasLines | If a nondegenerate configuration has a unique point on any two lines, and if `|P| = |L|`,
then there is a unique line through any two points. |
ProjectivePlane extends HasPoints P L, HasLines P L where
exists_config :
∃ (p₁ p₂ p₃ : P) (l₁ l₂ l₃ : L),
p₁ ∉ l₂ ∧ p₁ ∉ l₃ ∧ p₂ ∉ l₁ ∧ p₂ ∈ l₂ ∧ p₂ ∈ l₃ ∧ p₃ ∉ l₁ ∧ p₃ ∈ l₂ ∧ p₃ ∉ l₃ | class | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | ProjectivePlane | A projective plane is a nondegenerate configuration in which every pair of lines has
an intersection point, every pair of points has a line through them,
and which has three points in general position. |
noncomputable order : ℕ :=
lineCount L (Classical.choose (@exists_config P L _ _)) - 1 | def | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | order | The order of a projective plane is one less than the number of lines through an arbitrary point.
Equivalently, it is one less than the number of points on an arbitrary line. |
card_points_eq_card_lines [Fintype P] [Fintype L] : Fintype.card P = Fintype.card L :=
le_antisymm (HasLines.card_le P L) (HasPoints.card_le P L)
variable {P} | theorem | Combinatorics | [
"Mathlib.Combinatorics.Hall.Basic",
"Mathlib.LinearAlgebra.Matrix.Rank",
"Mathlib.LinearAlgebra.Projectivization.Constructions"
] | Mathlib/Combinatorics/Configuration.lean | card_points_eq_card_lines | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.