Documentation

IMOSLLean4.Main.IMO2009.C2

IMO 2009 C2 #

For each $n ∈ ℕ$, find the largest integer $k$ such that there exist $k$ triples $(a_1, b_1, c_1), …, (a_k, b_k, c_k)$ with the following properties:

Answer #

$⌊2n/3⌋ + 1$.

Solution #

We follow the official solution.

Extra lemmas #

For any finite set S ⊆ ℕ, the sum of all elements of S is at least C(#S, 2).

theorem IMOSL.IMO2009C2.card_choose_le_sum_of_inj {ι : Type u_1} {f : ι} (hf : Function.Injective f) (I : Finset ι) :
I.card.choose 2 iI, f i

If f : ι → ℕ is injective, thenf or any finite set I ⊆ ι, the sum of f(i) across all i ∈ I is at least C(#I, 2).

theorem IMOSL.IMO2009C2.fin_cast_sub_two_mul_injective (k : ) :
Function.Injective fun (i : Fin k) => 2 * (k - 1 - i)

The map f : Fin k → ℕ defined by f(i) = 2(k - i - 1) is injective.

Start of the problem #

structure IMOSL.IMO2009C2.GoodTripleFn (n : ) (ι : Type u_1) :
Type u_1

A collection ((x_{0i}, x_{1i}, x_{2i}))_{i ∈ ι} of triples is called n-good if x_{ji} ≠ x_{ji'} whenever i ≠ i' and x_{0i} + x_{1i} + x_{2i} = n for all i.

Instances For
    def IMOSL.IMO2009C2.GoodTripleFn.ofEmbedding {κ : Type u_1} {ι : Type u_2} {n : } (f : κ ι) (X : GoodTripleFn n ι) :

    Subcollection of an n-good collection, which is also an n-good collection.

    Equations
    Instances For

      If there is an ι-indexed n-good collection and |κ| ≤ |ι|, then there is also a κ-indexed n-good collection.

      theorem IMOSL.IMO2009C2.GoodTripleFn.card_bound {ι : Type u_1} {n : } [Fintype ι] (X : GoodTripleFn n ι) :
      Fintype.card ι 2 * n / 3 + 1

      If there is an ι-indexed n-good collection, then |ι| ≤ 2n/3 + 1.

      def IMOSL.IMO2009C2.GoodTripleFn.add_val {n : } {ι : Type u_1} (X : GoodTripleFn n ι) (j₀ : Fin 3) (v : ) :
      GoodTripleFn (n + v) ι

      Creating a new n-good collection by adding a fixed value to a fixed coordinate.

      Equations
      Instances For

        Construction of a 3k-good collection of 2k + 1 triples.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Construction of a 3k + 1-good collection of 2k + 1 triples.

          Equations
          Instances For

            Construction of a 3k + 2-good collection of 2k + 2 triples.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              If |ι| ≤ 2n/3 + 1, then there is an ι-indexed n-good collection.

              There exists an ι-indexed n-good collection if and only if ι ≤ ⌊2n/3⌋ + 1.

              Final solution