File: Mathlib/Combinatorics/HalesJewett.lean

full_name: Combinatorics.Subspace.proper
code: /-- The type of combinatorial subspaces. A subspace `l : Subspace η α ι` in the hypercube `ι → α`
defines a function `(η → α) → ι → α` from `η → α` to the hypercube, such that for each coordinate
`i : ι` and direction `e : η`, the function `fun x ↦ l x i` is either `fun x ↦ x e` for some
direction `e : η` or constant. We require subspaces to be non-degenerate in the sense that, for
every `e : η`, `fun x ↦ l x i` is `fun x ↦ x e` for at least one `i`.

Formally, a subspace is represented by a word `l.idxFun : ι → α ⊕ η` which says whether
`fun x ↦ l x i` is `fun x ↦ x e` (corresponding to `l.idxFun i = Sum.inr e`) or constantly `a`
(corresponding to `l.idxFun i = Sum.inl a`).

When `α` has size `1` there can be many elements of `Subspace η α ι` defining the same function. -/
@[ext]
structure Subspace (η α ι : Type*) where
  /-- The word representing a combinatorial subspace. `l.idxfun i = Sum.inr e` means that
  `l x i = x e` for all `x` and `l.idxfun i = some a` means that `l x i = a` for all `x`. -/
  idxFun : ι → α ⊕ η
  /-- We require combinatorial subspaces to be nontrivial in the sense that `fun x ↦ l x i` is
  `fun x ↦ x e` for at least one coordinate `i`. -/
  proper : ∀ e, ∃ i, idxFun i = Sum.inr e
goal: ∃ i, self.idxFun i = Sum.inr e

full_name: Combinatorics.Subspace
code: /-- The type of combinatorial subspaces. A subspace `l : Subspace η α ι` in the hypercube `ι → α`
defines a function `(η → α) → ι → α` from `η → α` to the hypercube, such that for each coordinate
`i : ι` and direction `e : η`, the function `fun x ↦ l x i` is either `fun x ↦ x e` for some
direction `e : η` or constant. We require subspaces to be non-degenerate in the sense that, for
every `e : η`, `fun x ↦ l x i` is `fun x ↦ x e` for at least one `i`.

Formally, a subspace is represented by a word `l.idxFun : ι → α ⊕ η` which says whether
`fun x ↦ l x i` is `fun x ↦ x e` (corresponding to `l.idxFun i = Sum.inr e`) or constantly `a`
(corresponding to `l.idxFun i = Sum.inl a`).

When `α` has size `1` there can be many elements of `Subspace η α ι` defining the same function. -/
@[ext]
structure Subspace (η α ι : Type*) where
  /-- The word representing a combinatorial subspace. `l.idxfun i = Sum.inr e` means that
  `l x i = x e` for all `x` and `l.idxfun i = some a` means that `l x i = a` for all `x`. -/
  idxFun : ι → α ⊕ η
  /-- We require combinatorial subspaces to be nontrivial in the sense that `fun x ↦ l x i` is
  `fun x ↦ x e` for at least one coordinate `i`. -/
  proper : ∀ e, ∃ i, idxFun i = Sum.inr e
goal: Type (max (max u_5 u_6) u_7)

full_name: Combinatorics.Subspace.idxFun
code: /-- The type of combinatorial subspaces. A subspace `l : Subspace η α ι` in the hypercube `ι → α`
defines a function `(η → α) → ι → α` from `η → α` to the hypercube, such that for each coordinate
`i : ι` and direction `e : η`, the function `fun x ↦ l x i` is either `fun x ↦ x e` for some
direction `e : η` or constant. We require subspaces to be non-degenerate in the sense that, for
every `e : η`, `fun x ↦ l x i` is `fun x ↦ x e` for at least one `i`.

Formally, a subspace is represented by a word `l.idxFun : ι → α ⊕ η` which says whether
`fun x ↦ l x i` is `fun x ↦ x e` (corresponding to `l.idxFun i = Sum.inr e`) or constantly `a`
(corresponding to `l.idxFun i = Sum.inl a`).

When `α` has size `1` there can be many elements of `Subspace η α ι` defining the same function. -/
@[ext]
structure Subspace (η α ι : Type*) where
  /-- The word representing a combinatorial subspace. `l.idxfun i = Sum.inr e` means that
  `l x i = x e` for all `x` and `l.idxfun i = some a` means that `l x i = a` for all `x`. -/
  idxFun : ι → α ⊕ η
  /-- We require combinatorial subspaces to be nontrivial in the sense that `fun x ↦ l x i` is
  `fun x ↦ x e` for at least one coordinate `i`. -/
  proper : ∀ e, ∃ i, idxFun i = Sum.inr e
goal: ι → α ⊕ η

full_name: Combinatorics.Subspace.instInhabited
code: /-- The combinatorial subspace corresponding to the identity embedding `(ι → α) → (ι → α)`. -/
instance : Inhabited (Subspace ι α ι) 
goal: Inhabited (Combinatorics.Subspace ι α ι)

full_name: Combinatorics.Subspace.toFun
code: /-- Consider a subspace `l : Subspace η α ι` as a function `(η → α) → ι → α`. -/
@[coe] def toFun (l : Subspace η α ι) (x : η → α) (i : ι) : α 
goal: α

full_name: Combinatorics.Subspace.instCoeFun
code: instance instCoeFun : CoeFun (Subspace η α ι) (fun _ ↦ (η → α) → ι → α) 
goal: CoeFun (Combinatorics.Subspace η α ι) fun x => (η → α) → ι → α

full_name: Combinatorics.Subspace.coe_apply
code: lemma coe_apply (l : Subspace η α ι) (x : η → α) (i : ι) : l x i = (l.idxFun i).elim id x 
goal: ↑l x i = Sum.elim id x (l.idxFun i)

full_name: Combinatorics.Subspace.coe_injective
code: lemma coe_injective [Nontrivial α] : Injective ((⇑) : Subspace η α ι → (η → α) → ι → α) 
goal: Function.Injective Combinatorics.Subspace.toFun

full_name: Combinatorics.Subspace.apply_def
code: lemma apply_def (l : Subspace η α ι) (x : η → α) (i : ι) : l x i = (l.idxFun i).elim id x 
goal: ↑l x i = Sum.elim id x (l.idxFun i)

full_name: Combinatorics.Subspace.apply_inl
code: lemma apply_inl (h : l.idxFun i = Sum.inl a) : l x i = a 
goal: ↑l x i = a

full_name: Combinatorics.Subspace.apply_inr
code: lemma apply_inr (h : l.idxFun i = Sum.inr e) : l x i = x e 
goal: ↑l x i = x e

full_name: Combinatorics.Subspace.IsMono
code: /-- Given a coloring `C` of `ι → α` and a combinatorial subspace `l` of `ι → α`, `l.IsMono C`
means that `l` is monochromatic with regard to `C`. -/
def IsMono (C : (ι → α) → κ) (l : Subspace η α ι) : Prop 
goal: Prop

full_name: Combinatorics.Subspace.reindex
code: /-- Change the index types of a subspace. -/
def reindex (l : Subspace η α ι) (eη : η ≃ η') (eα : α ≃ α') (eι : ι ≃ ι') : Subspace η' α' ι' 
goal: Combinatorics.Subspace η' α' ι'

full_name: Combinatorics.Subspace.reindex_apply
code: @[simp] lemma reindex_apply (l : Subspace η α ι) (eη : η ≃ η') (eα : α ≃ α') (eι : ι ≃ ι') (x i) :
    l.reindex eη eα eι x i = eα (l (eα.symm ∘ x ∘ eη) <| eι.symm i) 
goal: ↑(l.reindex eη eα eι) x i = eα (↑l (⇑eα.symm ∘ x ∘ ⇑eη) (eι.symm i))

full_name: Combinatorics.Subspace.reindex_isMono
code: @[simp] lemma reindex_isMono {eη : η ≃ η'} {eα : α ≃ α'} {eι : ι ≃ ι'} {C : (ι' → α') → κ} :
    (l.reindex eη eα eι).IsMono C ↔ l.IsMono fun x ↦ C <| eα ∘ x ∘ eι.symm 
goal: Combinatorics.Subspace.IsMono C (l.reindex eη eα eι) ↔ Combinatorics.Subspace.IsMono (fun x => C (⇑eα ∘ x ∘ ⇑eι.symm)) l

full_name: Combinatorics.Subspace.IsMono.reindex
code: protected lemma IsMono.reindex {eη : η ≃ η'} {eα : α ≃ α'} {eι : ι ≃ ι'} {C : (ι → α) → κ}
    (hl : l.IsMono C) : (l.reindex eη eα eι).IsMono fun x ↦ C <| eα.symm ∘ x ∘ eι 
goal: Combinatorics.Subspace.IsMono (fun x => C (⇑eα.symm ∘ x ∘ ⇑eι)) (l.reindex eη eα eι)

full_name: Combinatorics.Line.proper
code: /-- The type of combinatorial lines. A line `l : Line α ι` in the hypercube `ι → α` defines a
function `α → ι → α` from `α` to the hypercube, such that for each coordinate `i : ι`, the function
`fun x ↦ l x i` is either `id` or constant. We require lines to be nontrivial in the sense that
`fun x ↦ l x i` is `id` for at least one `i`.

Formally, a line is represented by a word `l.idxFun : ι → Option α` which says whether
`fun x ↦ l x i` is `id` (corresponding to `l.idxFun i = none`) or constantly `y` (corresponding to
`l.idxFun i = some y`).

When `α` has size `1` there can be many elements of `Line α ι` defining the same function. -/
@[ext]
structure Line (α ι : Type*) where
  /-- The word representing a combinatorial line. `l.idxfun i = none` means that
  `l x i = x` for all `x` and `l.idxfun i = some y` means that `l x i = y`. -/
  idxFun : ι → Option α
  /-- We require combinatorial lines to be nontrivial in the sense that `fun x ↦ l x i` is `id` for
  at least one coordinate `i`. -/
  proper : ∃ i, idxFun i = none
goal: ∃ i, self.idxFun i = none

full_name: Combinatorics.Line
code: /-- The type of combinatorial lines. A line `l : Line α ι` in the hypercube `ι → α` defines a
function `α → ι → α` from `α` to the hypercube, such that for each coordinate `i : ι`, the function
`fun x ↦ l x i` is either `id` or constant. We require lines to be nontrivial in the sense that
`fun x ↦ l x i` is `id` for at least one `i`.

Formally, a line is represented by a word `l.idxFun : ι → Option α` which says whether
`fun x ↦ l x i` is `id` (corresponding to `l.idxFun i = none`) or constantly `y` (corresponding to
`l.idxFun i = some y`).

When `α` has size `1` there can be many elements of `Line α ι` defining the same function. -/
@[ext]
structure Line (α ι : Type*) where
  /-- The word representing a combinatorial line. `l.idxfun i = none` means that
  `l x i = x` for all `x` and `l.idxfun i = some y` means that `l x i = y`. -/
  idxFun : ι → Option α
  /-- We require combinatorial lines to be nontrivial in the sense that `fun x ↦ l x i` is `id` for
  at least one coordinate `i`. -/
  proper : ∃ i, idxFun i = none
goal: Type (max u_5 u_6)

full_name: Combinatorics.Line.idxFun
code: /-- The type of combinatorial lines. A line `l : Line α ι` in the hypercube `ι → α` defines a
function `α → ι → α` from `α` to the hypercube, such that for each coordinate `i : ι`, the function
`fun x ↦ l x i` is either `id` or constant. We require lines to be nontrivial in the sense that
`fun x ↦ l x i` is `id` for at least one `i`.

Formally, a line is represented by a word `l.idxFun : ι → Option α` which says whether
`fun x ↦ l x i` is `id` (corresponding to `l.idxFun i = none`) or constantly `y` (corresponding to
`l.idxFun i = some y`).

When `α` has size `1` there can be many elements of `Line α ι` defining the same function. -/
@[ext]
structure Line (α ι : Type*) where
  /-- The word representing a combinatorial line. `l.idxfun i = none` means that
  `l x i = x` for all `x` and `l.idxfun i = some y` means that `l x i = y`. -/
  idxFun : ι → Option α
  /-- We require combinatorial lines to be nontrivial in the sense that `fun x ↦ l x i` is `id` for
  at least one coordinate `i`. -/
  proper : ∃ i, idxFun i = none
goal: ι → Option α

full_name: Combinatorics.Line.toFun
code: /-- Consider a line `l : Line α ι` as a function `α → ι → α`. -/
@[coe] def toFun (l : Line α ι) (x : α) (i : ι) : α 
goal: α

full_name: Combinatorics.Line.instCoeFun
code: instance instCoeFun : CoeFun (Line α ι) fun _ => α → ι → α 
goal: CoeFun (Combinatorics.Line α ι) fun x => α → ι → α

full_name: Combinatorics.Line.coe_apply
code: lemma coe_apply (l : Line α ι) (x : α) (i : ι) : l x i = (l.idxFun i).getD x 
goal: (fun x i => (l.idxFun i).getD x) x i = (l.idxFun i).getD x

full_name: Combinatorics.Line.coe_injective
code: lemma coe_injective [Nontrivial α] : Injective ((⇑) : Line α ι → α → ι → α) 
goal: Function.Injective fun x x_1 i => (x.idxFun i).getD x_1

full_name: Combinatorics.Line.IsMono
code: /-- A line is monochromatic if all its points are the same color. -/
def IsMono {α ι κ} (C : (ι → α) → κ) (l : Line α ι) : Prop 
goal: Prop

full_name: Combinatorics.Line.toSubspaceUnit
code: /-- Consider a line as a one-dimensional subspace. -/
def toSubspaceUnit (l : Line α ι) : Subspace Unit α ι 
goal: Combinatorics.Subspace Unit α ι

full_name: Combinatorics.Line.toSubspaceUnit_apply
code: @[simp] lemma toSubspaceUnit_apply (l : Line α ι) (a) : ⇑l.toSubspaceUnit a = l (a ()) 
goal: ↑l.toSubspaceUnit a = (fun x i => (l.idxFun i).getD x) (a ())

full_name: Combinatorics.Line.toSubspaceUnit_isMono
code: @[simp] lemma toSubspaceUnit_isMono {C : (ι → α) → κ} : l.toSubspaceUnit.IsMono C ↔ l.IsMono C 
goal: Combinatorics.Subspace.IsMono C l.toSubspaceUnit ↔ Combinatorics.Line.IsMono C l

full_name: Combinatorics.Line.toSubspace
code: /-- Consider a line in `ι → η → α` as a `η`-dimensional subspace in `ι × η → α`. -/
def toSubspace (l : Line (η → α) ι) : Subspace η α (ι × η) 
goal: Combinatorics.Subspace η α (ι × η)

full_name: Combinatorics.Line.toSubspace_apply
code: @[simp] lemma toSubspace_apply (l : Line (η → α) ι) (a ie) :
    ⇑l.toSubspace a ie = l a ie.1 ie.2 
goal: ↑l.toSubspace a ie = (fun x i => (l.idxFun i).getD x) a ie.1 ie.2

full_name: Combinatorics.Line.toSubspace_isMono
code: @[simp] lemma toSubspace_isMono {l : Line (η → α) ι} {C : (ι × η → α) → κ} :
    l.toSubspace.IsMono C ↔ l.IsMono fun x : ι → η → α  ↦ C fun (i, e) ↦ x i e 
goal: Combinatorics.Subspace.IsMono C l.toSubspace ↔
  Combinatorics.Line.IsMono
    (fun x =>
      C fun x_1 =>
        match x_1 with
        | (i, e) => x i e)
    l

full_name: Combinatorics.Line.diagonal
code: /-- The diagonal line. It is the identity at every coordinate. -/
def diagonal (α ι) [Nonempty ι] : Line α ι 
goal: Combinatorics.Line α ι

full_name: Combinatorics.Line.instInhabitedOfNonempty
code: instance (α ι) [Nonempty ι] : Inhabited (Line α ι) 
goal: Inhabited (Combinatorics.Line α ι)

full_name: Combinatorics.Line.AlmostMono.line
code: /-- The type of lines that are only one color except possibly at their endpoints. -/
structure AlmostMono {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying line of an almost monochromatic line, where the coordinate dimension `α` is
  extended by an additional symbol `none`, thought to be marking the endpoint of the line. -/
  line : Line (Option α) ι
  /-- The main color of an almost monochromatic line. -/
  color : κ
  /-- The proposition that the underlying line of an almost monochromatic line assumes its main
  color except possibly at the endpoints. -/
  has_color : ∀ x : α, C (line (some x)) = color
goal: Combinatorics.Line (Option α) ι

full_name: Combinatorics.Line.AlmostMono
code: /-- The type of lines that are only one color except possibly at their endpoints. -/
structure AlmostMono {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying line of an almost monochromatic line, where the coordinate dimension `α` is
  extended by an additional symbol `none`, thought to be marking the endpoint of the line. -/
  line : Line (Option α) ι
  /-- The main color of an almost monochromatic line. -/
  color : κ
  /-- The proposition that the underlying line of an almost monochromatic line assumes its main
  color except possibly at the endpoints. -/
  has_color : ∀ x : α, C (line (some x)) = color
goal: Type (max (max u_5 u_6) u_7)

full_name: Combinatorics.Line.AlmostMono.color
code: /-- The type of lines that are only one color except possibly at their endpoints. -/
structure AlmostMono {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying line of an almost monochromatic line, where the coordinate dimension `α` is
  extended by an additional symbol `none`, thought to be marking the endpoint of the line. -/
  line : Line (Option α) ι
  /-- The main color of an almost monochromatic line. -/
  color : κ
  /-- The proposition that the underlying line of an almost monochromatic line assumes its main
  color except possibly at the endpoints. -/
  has_color : ∀ x : α, C (line (some x)) = color
goal: κ

full_name: Combinatorics.Line.AlmostMono.has_color
code: /-- The type of lines that are only one color except possibly at their endpoints. -/
structure AlmostMono {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying line of an almost monochromatic line, where the coordinate dimension `α` is
  extended by an additional symbol `none`, thought to be marking the endpoint of the line. -/
  line : Line (Option α) ι
  /-- The main color of an almost monochromatic line. -/
  color : κ
  /-- The proposition that the underlying line of an almost monochromatic line assumes its main
  color except possibly at the endpoints. -/
  has_color : ∀ x : α, C (line (some x)) = color
goal: C ((fun x i => (self.line.idxFun i).getD x) (some x)) = self.color

full_name: Combinatorics.Line.instInhabitedAlmostMonoDefaultOfNonempty
code: instance {α ι κ : Type*} [Nonempty ι] [Inhabited κ] :
    Inhabited (AlmostMono fun _ : ι → Option α => (default : κ)) 
goal: Inhabited (Combinatorics.Line.AlmostMono fun x => default)

full_name: Combinatorics.Line.ColorFocused.distinct_colors
code: /-- The type of collections of lines such that
- each line is only one color except possibly at its endpoint
- the lines all have the same endpoint
- the colors of the lines are distinct.
Used in the proof `exists_mono_in_high_dimension`. -/
structure ColorFocused {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying multiset of almost monochromatic lines of a color-focused collection. -/
  lines : Multiset (AlmostMono C)
  /-- The common endpoint of the lines in the color-focused collection. -/
  focus : ι → Option α
  /-- The proposition that all lines in a color-focused collection have the same endpoint. -/
  is_focused : ∀ p ∈ lines, p.line none = focus
  /-- The proposition that all lines in a color-focused collection of lines have distinct colors. -/
  distinct_colors : (lines.map AlmostMono.color).Nodup
goal: (Multiset.map Combinatorics.Line.AlmostMono.color self.lines).Nodup

full_name: Combinatorics.Line.ColorFocused.lines
code: /-- The type of collections of lines such that
- each line is only one color except possibly at its endpoint
- the lines all have the same endpoint
- the colors of the lines are distinct.
Used in the proof `exists_mono_in_high_dimension`. -/
structure ColorFocused {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying multiset of almost monochromatic lines of a color-focused collection. -/
  lines : Multiset (AlmostMono C)
  /-- The common endpoint of the lines in the color-focused collection. -/
  focus : ι → Option α
  /-- The proposition that all lines in a color-focused collection have the same endpoint. -/
  is_focused : ∀ p ∈ lines, p.line none = focus
  /-- The proposition that all lines in a color-focused collection of lines have distinct colors. -/
  distinct_colors : (lines.map AlmostMono.color).Nodup
goal: Multiset (Combinatorics.Line.AlmostMono C)

full_name: Combinatorics.Line.ColorFocused.focus
code: /-- The type of collections of lines such that
- each line is only one color except possibly at its endpoint
- the lines all have the same endpoint
- the colors of the lines are distinct.
Used in the proof `exists_mono_in_high_dimension`. -/
structure ColorFocused {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying multiset of almost monochromatic lines of a color-focused collection. -/
  lines : Multiset (AlmostMono C)
  /-- The common endpoint of the lines in the color-focused collection. -/
  focus : ι → Option α
  /-- The proposition that all lines in a color-focused collection have the same endpoint. -/
  is_focused : ∀ p ∈ lines, p.line none = focus
  /-- The proposition that all lines in a color-focused collection of lines have distinct colors. -/
  distinct_colors : (lines.map AlmostMono.color).Nodup
goal: ι → Option α

full_name: Combinatorics.Line.ColorFocused
code: /-- The type of collections of lines such that
- each line is only one color except possibly at its endpoint
- the lines all have the same endpoint
- the colors of the lines are distinct.
Used in the proof `exists_mono_in_high_dimension`. -/
structure ColorFocused {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying multiset of almost monochromatic lines of a color-focused collection. -/
  lines : Multiset (AlmostMono C)
  /-- The common endpoint of the lines in the color-focused collection. -/
  focus : ι → Option α
  /-- The proposition that all lines in a color-focused collection have the same endpoint. -/
  is_focused : ∀ p ∈ lines, p.line none = focus
  /-- The proposition that all lines in a color-focused collection of lines have distinct colors. -/
  distinct_colors : (lines.map AlmostMono.color).Nodup
goal: Type (max (max u_5 u_6) u_7)

full_name: Combinatorics.Line.ColorFocused.is_focused
code: /-- The type of collections of lines such that
- each line is only one color except possibly at its endpoint
- the lines all have the same endpoint
- the colors of the lines are distinct.
Used in the proof `exists_mono_in_high_dimension`. -/
structure ColorFocused {α ι κ : Type*} (C : (ι → Option α) → κ) where
  /-- The underlying multiset of almost monochromatic lines of a color-focused collection. -/
  lines : Multiset (AlmostMono C)
  /-- The common endpoint of the lines in the color-focused collection. -/
  focus : ι → Option α
  /-- The proposition that all lines in a color-focused collection have the same endpoint. -/
  is_focused : ∀ p ∈ lines, p.line none = focus
  /-- The proposition that all lines in a color-focused collection of lines have distinct colors. -/
  distinct_colors : (lines.map AlmostMono.color).Nodup
goal: p ∈ self.lines → (fun x i => (p.line.idxFun i).getD x) none = self.focus

full_name: Combinatorics.Line.instInhabitedColorFocused
code: instance {α ι κ} (C : (ι → Option α) → κ) : Inhabited (ColorFocused C) 
goal: Inhabited (Combinatorics.Line.ColorFocused C)

full_name: Combinatorics.Line.map
code: /-- A function `f : α → α'` determines a function `line α ι → line α' ι`. For a coordinate `i`
`l.map f` is the identity at `i` if `l` is, and constantly `f y` if `l` is constantly `y` at `i`. -/
def map {α α' ι} (f : α → α') (l : Line α ι) : Line α' ι 
goal: Combinatorics.Line α' ι

full_name: Combinatorics.Line.vertical
code: /-- A point in `ι → α` and a line in `ι' → α` determine a line in `ι ⊕ ι' → α`. -/
def vertical {α ι ι'} (v : ι → α) (l : Line α ι') : Line α (ι ⊕ ι') 
goal: Combinatorics.Line α (ι ⊕ ι')

full_name: Combinatorics.Line.horizontal
code: /-- A line in `ι → α` and a point in `ι' → α` determine a line in `ι ⊕ ι' → α`. -/
def horizontal {α ι ι'} (l : Line α ι) (v : ι' → α) : Line α (ι ⊕ ι') 
goal: Combinatorics.Line α (ι ⊕ ι')

full_name: Combinatorics.Line.prod
code: /-- One line in `ι → α` and one in `ι' → α` together determine a line in `ι ⊕ ι' → α`. -/
def prod {α ι ι'} (l : Line α ι) (l' : Line α ι') : Line α (ι ⊕ ι') 
goal: Combinatorics.Line α (ι ⊕ ι')

full_name: Combinatorics.Line.apply_def
code: theorem apply_def (l : Line α ι) (x : α) : l x = fun i => (l.idxFun i).getD x 
goal: (fun x i => (l.idxFun i).getD x) x = fun i => (l.idxFun i).getD x

full_name: Combinatorics.Line.apply_none
code: theorem apply_none {α ι} (l : Line α ι) (x : α) (i : ι) (h : l.idxFun i = none) : l x i = x 
goal: (fun x i => (l.idxFun i).getD x) x i = x

full_name: Combinatorics.Line.apply_some
code: lemma apply_some (h : l.idxFun i = some a) : l x i = a 
goal: (fun x i => (l.idxFun i).getD x) x i = a

full_name: Combinatorics.Line.map_apply
code: @[simp]
theorem map_apply {α α' ι} (f : α → α') (l : Line α ι) (x : α) : l.map f (f x) = f ∘ l x 
goal: (fun x i => ((Combinatorics.Line.map f l).idxFun i).getD x) (f x) = f ∘ (fun x i => (l.idxFun i).getD x) x

full_name: Combinatorics.Line.vertical_apply
code: @[simp]
theorem vertical_apply {α ι ι'} (v : ι → α) (l : Line α ι') (x : α) :
    l.vertical v x = Sum.elim v (l x) 
goal: (fun x i => ((Combinatorics.Line.vertical v l).idxFun i).getD x) x = Sum.elim v ((fun x i => (l.idxFun i).getD x) x)

full_name: Combinatorics.Line.horizontal_apply
code: @[simp]
theorem horizontal_apply {α ι ι'} (l : Line α ι) (v : ι' → α) (x : α) :
    l.horizontal v x = Sum.elim (l x) v 
goal: (fun x i => ((l.horizontal v).idxFun i).getD x) x = Sum.elim ((fun x i => (l.idxFun i).getD x) x) v

full_name: Combinatorics.Line.prod_apply
code: @[simp]
theorem prod_apply {α ι ι'} (l : Line α ι) (l' : Line α ι') (x : α) :
    l.prod l' x = Sum.elim (l x) (l' x) 
goal: (fun x i => ((l.prod l').idxFun i).getD x) x =
  Sum.elim ((fun x i => (l.idxFun i).getD x) x) ((fun x i => (l'.idxFun i).getD x) x)

full_name: Combinatorics.Line.diagonal_apply
code: @[simp]
theorem diagonal_apply {α ι} [Nonempty ι] (x : α) : Line.diagonal α ι x = fun _ => x 
goal: (fun x i => ((Combinatorics.Line.diagonal α ι).idxFun i).getD x) x = fun x_1 => x

full_name: _private.Mathlib.Combinatorics.HalesJewett.0.Combinatorics.Line.exists_mono_in_high_dimension'
code: /-- The **Hales-Jewett theorem**. This version has a restriction on universe levels which is
necessary for the proof. See `exists_mono_in_high_dimension` for a fully universe-polymorphic
version. -/
private theorem exists_mono_in_high_dimension' :
    ∀ (α : Type u) [Finite α] (κ : Type max v u) [Finite κ],
      ∃ (ι : Type) (_ : Fintype ι), ∀ C : (ι → α) → κ, ∃ l : Line α ι, l.IsMono C 
goal: ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, Combinatorics.Line.IsMono C l

full_name: Combinatorics.Line.exists_mono_in_high_dimension
code: /-- The **Hales-Jewett theorem**: For any finite types `α` and `κ`, there exists a finite type `ι`
such that whenever the hypercube `ι → α` is `κ`-colored, there is a monochromatic combinatorial
line. -/
theorem exists_mono_in_high_dimension (α : Type u) [Finite α] (κ : Type v) [Finite κ] :
    ∃ (ι : Type) (_ : Fintype ι), ∀ C : (ι → α) → κ, ∃ l : Line α ι, l.IsMono C 
goal: ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, Combinatorics.Line.IsMono C l

full_name: Combinatorics.exists_mono_homothetic_copy
code: /-- A generalization of Van der Waerden's theorem: if `M` is a finitely colored commutative
monoid, and `S` is a finite subset, then there exists a monochromatic homothetic copy of `S`. -/
theorem exists_mono_homothetic_copy {M κ : Type*} [AddCommMonoid M] (S : Finset M) [Finite κ]
    (C : M → κ) : ∃ a > 0, ∃ (b : M) (c : κ), ∀ s ∈ S, C (a • s + b) = c 
goal: ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c

full_name: Combinatorics.Subspace.exists_mono_in_high_dimension
code: /-- The **multidimensional Hales-Jewett theorem**, aka **extended Hales-Jewett theorem**: For any
finite types `η`, `α` and `κ`, there exists a finite type `ι` such that whenever the hypercube
`ι → α` is `κ`-colored, there is a monochromatic combinatorial subspace of dimension `η`. -/
theorem exists_mono_in_high_dimension (α κ η) [Finite α] [Finite κ] [Finite η] :
    ∃ (ι : Type) (_ : Fintype ι), ∀ C : (ι → α) → κ, ∃ l : Subspace η α ι, l.IsMono C 
goal: ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, Combinatorics.Subspace.IsMono C l

full_name: Combinatorics.Subspace.exists_mono_in_high_dimension_fin
code: /-- A variant of the **extended Hales-Jewett theorem** `exists_mono_in_high_dimension` where the
returned type is some `Fin n` instead of a general fintype. -/
theorem exists_mono_in_high_dimension_fin (α κ η) [Finite α] [Finite κ] [Finite η] :
    ∃ n, ∀ C : (Fin n → α) → κ, ∃ l : Subspace η α (Fin n), l.IsMono C 
goal: ∃ n, ∀ (C : (Fin n → α) → κ), ∃ l, Combinatorics.Subspace.IsMono C l