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 τ :=... | 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;... | 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.injecti... | 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 ... | 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 e... | 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 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 | 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... | 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_un... | 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 ... | 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... | 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 h... | 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... | 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 →... | 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... | 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 α)) (· < ·) (... | 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 ↦ ?_, ?_⟩
·... | 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 ⟨ha... | 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.b... | 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_toCol... | 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
... | 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 } :=
... | 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 none... | 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
... | 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 := (Fi... | 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... | 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 : Nontrivia... | 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 ... | 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.