Documentation

FormalConjectures.ForMathlib.Combinatorics.AP.Basic

Arithmetic Progressions #

Main definitions:

def Set.IsAPOfLengthWith {α : Type u_1} [AddCommMonoid α] (s : Set α) (l : ℕ∞) (a d : α) :

A set $S$ is an arithmetic progression of length $l$ with first term $a$ and difference $d$ if $S = \{a, a + d, ..., a + (l - 1)d\}$, if $l$ if finite, else $S = {a, a + d, a + 2d, ...}. This can be written as Set.IsAPOfLengthWith a l a d, where l : ℕ∞ may take the infinite value .

Equations
Instances For
    def List.IsAPOfLengthWith {α : Type u_1} [AddCommMonoid α] (s : List α) (l : ) (a d : α) :

    A list version of Set.IsAPOfLengthWith. Useful when order preservation is required, for example when considering images under arbitrary functions.

    Equations
    Instances For
      theorem Set.IsAPOfLengthWith.card {α : Type u_1} [AddCommMonoid α] {s : Set α} {l : ℕ∞} {a d : α} (h : s.IsAPOfLengthWith l a d) :
      ENat.card s = l
      theorem Set.IsAPOfLengthWith.eq {α : Type u_1} [AddCommMonoid α] {s : Set α} {l : ℕ∞} {a d : α} (h : s.IsAPOfLengthWith l a d) :
      s = {x : α | ∃ (n : ) (_ : n < l), a + n d = x}
      @[simp]
      theorem Set.IsAPOfLengthWith.zero {α : Type u_1} [AddCommMonoid α] {s : Set α} {a d : α} :

      An arithmetic progression with first term a and difference d is of length zero if and only if s is empty.

      @[simp]
      theorem Set.IsAPOfLengthWith.one {α : Type u_1} [AddCommMonoid α] {s : Set α} {a d : α} :

      An arithmetic progression with first term a and difference d is of length one if and only if s is a singleton.

      theorem List.IsAPOfLengthWith.length {α : Type u_1} [AddCommMonoid α] {s : List α} {l : } {a d : α} (h : s.IsAPOfLengthWith l a d) :
      s.length = l
      @[simp]
      theorem List.IsAPOfLengthWith.zero {α : Type u_1} [AddCommMonoid α] {s : List α} {a d : α} :

      An arithmetic progression with first term a and difference d is of length zero if and only if s is empty.

      @[simp]
      theorem List.IsAPOfLengthWith.one {α : Type u_1} [AddCommMonoid α] {s : List α} {a d : α} :

      An arithmetic progression with first term a and difference d is of length one if and only if s is a singleton.

      theorem Set.isAPOfLengthWith_pair {α : Type u_2} [DecidableEq α] [AddCommGroup α] {a b : α} (hab : a b) :
      {a, b}.IsAPOfLengthWith 2 a (b - a)

      In an abelian additive group α, the set {a, b} with a ≠ b is an arithmetic progression of length 2 with first term a and difference b - a.

      theorem Nat.isAPOfLengthWith_pair {a b : } (hab : a < b) :
      {a, b}.IsAPOfLengthWith 2 a (b - a)

      The set {a, b} : Set with a < b is an arithmetic progression of length 2 with first term a and difference b - a.

      def Set.IsAPOfLength {α : Type u_1} [AddCommMonoid α] (s : Set α) (l : ℕ∞) :

      The predicate that a set s is an arithmetic progression of length l (possibly infinite). This predicate does not assert a specific value for the first term or the difference of the arithmetic progression.

      Equations
      Instances For
        def List.IsAPOfLength {α : Type u_1} [AddCommMonoid α] (s : List α) (l : ) :

        A list version of Set.IsAPOfLength. Useful when order preservation is required, for example when considering images under arbitrary functions.

        Equations
        Instances For
          theorem Set.IsAPOfLength.card {α : Type u_1} [AddCommMonoid α] {s : Set α} {l : ℕ∞} (h : s.IsAPOfLength l) :
          ENat.card s = l
          theorem Set.IsAPOfLength.eq {α : Type u_1} [AddCommMonoid α] {s : Set α} {l : ℕ∞} (h : s.IsAPOfLength l) :
          ∃ (a : α) (d : α), s = {x : α | ∃ (n : ) (_ : n < l), a + n d = x}
          @[simp]
          theorem Set.IsAPOfLength.zero {α : Type u_1} [AddCommMonoid α] {s : Set α} :

          Only the empty set is a finite arithmetic progression of length $0$.

          @[simp]
          theorem Set.IsAPOfLength.one {α : Type u_1} [AddCommMonoid α] {s : Set α} :
          s.IsAPOfLength 1 ∃ (a : α), s = {a}

          Only singletons are finite arithmetic progressions of length $1$.

          theorem Set.IsAPOfLength.congr {α : Type u_1} [AddCommMonoid α] {s : Set α} {l₁ l₂ : ℕ∞} (h₁ : s.IsAPOfLength l₁) (h₂ : s.IsAPOfLength l₂) :
          l₁ = l₂

          If a set is an arithmetic progression of lengths l₁ and l₂, then the lengths are equal.

          theorem List.IsAPOfLength.length {α : Type u_1} [AddCommMonoid α] {s : List α} {l : } (h : s.IsAPOfLength l) :
          s.length = l
          @[simp]
          theorem List.IsAPOfLength.zero {α : Type u_1} [AddCommMonoid α] {s : List α} :

          Only the empty list is a finite arithmetic progression of length $0$.

          @[simp]
          theorem List.IsAPOfLength.one {α : Type u_1} [AddCommMonoid α] {s : List α} :
          s.IsAPOfLength 1 ∃ (a : α), s = [a]

          Only singletons are finite arithmetic progressions of length $1$.

          theorem List.IsAPOfLength.congr {α : Type u_1} [AddCommMonoid α] {s : List α} {l₁ l₂ : } (h₁ : s.IsAPOfLength l₁) (h₂ : s.IsAPOfLength l₂) :
          l₁ = l₂

          If a list is an arithmetic progression of lengths l₁ and l₂, then the lengths are equal.

          theorem Set.isAPOfLength_pair {α : Type u_2} [DecidableEq α] [AddCommGroup α] {a b : α} (hab : a b) :
          theorem Nat.isAPOfLength_pair {a b : } (hab : a < b) :
          theorem Set.not_isAPOfLength_empty {α : Type u_1} [AddCommMonoid α] {l : ℕ∞} (hl : 0 < l) :

          The empty set is not an arithmetic progression of positive length.

          def Set.IsAPOfLengthFree {α : Type u_1} [AddCommMonoid α] (s : Set α) (l : ℕ∞) :

          We say that a set s is free of arithmetic progressions of length l if s contains no non-trivial arithmetic progressions of length l. Written as Set.IsAPOfLengthFree s l. -

          Equations
          Instances For
            theorem Set.isAPOfLengthFree_one {α : Type u_1} [AddCommMonoid α] (s : Set α) :

            Any set is free of arithmetic progressions of length 1, because such APs are all trivial.

            theorem Set.isAPOfLengthFree_zero {α : Type u_1} [AddCommMonoid α] (s : Set α) :

            Any set is free of arithmetic progressions of length 0, because such APs are all trivial.

            theorem Set.IsAPOfLength.not_isAPOfLengthFree {α : Type u_1} [AddCommMonoid α] {s : Set α} {l : ℕ∞} (hs : s.IsAPOfLength l) (hl : 1 < l) :

            Any non-trivial arithmetic progression cannot be free of arithmetic progressions.

            noncomputable def Set.IsAPOfLengthFree.maxCard (k N : ) :

            Define the largest possible size of a subset of $\{1, \dots, N\}$ that does not contain any non-trivial $k$-term arithmetic progression.

            Equations
            Instances For
              def ContainsMonoAPofLength {α : Type u_1} [AddCommMonoid α] {κ : Type} [Finite κ] {M : Set α} (coloring : Mκ) (k : ) :
              Equations
              Instances For