@@ -73,9 +73,9 @@ lemma exists_add_eq_of_mem_pool {z : ℤ} (hz : z ∈ pool a t) : ∃ u < t, u +
7373 simp_rw [pool, mem_map, Equiv.coe_toEmbedding, Equiv.subRight_apply] at hz
7474 obtain ⟨y, my, ey⟩ := hz
7575 rw [mem_insert, mem_erase] at my; rcases my with h | h
76- · use t; omega
76+ · use t; lia
7777 · obtain ⟨u, lu, hu⟩ := ih h.2
78- use u; omega
78+ use u; lia
7979
8080include ha
8181
@@ -86,10 +86,10 @@ lemma pool_subset_Icc : ∀ {t}, pool a t ⊆ Icc 0 2014
8686 intro x hx
8787 simp_rw [pool, mem_map, Equiv.coe_toEmbedding, Equiv.subRight_apply] at hx
8888 obtain ⟨y, my, ey⟩ := hx
89- suffices y ∈ Icc 1 2015 by rw [mem_Icc] at this ⊢; omega
89+ suffices y ∈ Icc 1 2015 by rw [mem_Icc] at this ⊢; lia
9090 rw [mem_insert, mem_erase] at my; rcases my with h | ⟨h₁, h₂⟩
9191 · exact h ▸ ha.1 t
92- · have := pool_subset_Icc h₂; rw [mem_Icc] at this ⊢; omega
92+ · have := pool_subset_Icc h₂; rw [mem_Icc] at this ⊢; lia
9393
9494lemma notMem_pool_self : a t ∉ pool a t := by
9595 by_contra h
@@ -105,12 +105,12 @@ lemma card_pool_succ : #(pool a (t + 1)) = #(pool a t) + if 0 ∈ pool a t then
105105 rw [mem_erase, not_and_or]; exact .inr (notMem_pool_self ha)
106106 rw [pool, card_map, card_insert_of_notMem nms, card_erase_eq_ite]
107107 split_ifs with h
108- · have := card_pos.mpr ⟨0 , h⟩; omega
108+ · have := card_pos.mpr ⟨0 , h⟩; lia
109109 · rfl
110110
111111lemma monotone_card_pool : Monotone fun t ↦ #(pool a t) := by
112112 refine monotone_nat_of_le_succ fun t ↦ ?_
113- have := card_pool_succ (t := t) ha; omega
113+ have := card_pool_succ (t := t) ha; lia
114114
115115/-- There exists a point where the number of balls reaches a maximum (which follows from its
116116monotonicity and boundedness). We take its coordinates for the problem's `b` and `N`. -/
@@ -135,12 +135,12 @@ lemma b_pos : 0 < b := by
135135 · exact hbN _ h.le
136136 have cp1 : #(pool a 1 ) = 1 := by
137137 simp_rw [card_pool_succ ha, pool, card_empty, notMem_empty, ite_false]
138- apply absurd (hbN 1 ); omega
138+ apply absurd (hbN 1 ); lia
139139
140140include ht in
141141lemma zero_mem_pool : 0 ∈ pool a t := by
142142 have := card_pool_succ (t := t) ha
143- have := hbN (t + 1 ) (by omega )
143+ have := hbN (t + 1 ) (by lia )
144144 simp_all
145145
146146include ht in
@@ -151,14 +151,14 @@ lemma sum_sub_sum_eq_sub : ∑ x ∈ pool a (t + 1), x - ∑ x ∈ pool a t, x =
151151 rw [mem_erase, not_and_or]; exact .inr (notMem_pool_self ha)
152152 rw [sum_insert nms, sum_erase_eq_sub (h := zero_mem_pool ha hbN ht), sum_sub_distrib, sum_const,
153153 nsmul_one, hbN _ ht]
154- omega
154+ lia
155155
156156/-- The telescoping sum giving the part of the problem's expression within the modulus signs. -/
157157lemma sum_telescope {m n : ℕ} (hm : N ≤ m) (hn : m < n) :
158158 ∑ j ∈ Ico m n, (a j - b) = ∑ x ∈ pool a n, x - ∑ x ∈ pool a m, x :=
159159 calc
160160 _ = ∑ j ∈ Ico m n, (∑ x ∈ pool a (j + 1 ), x - ∑ x ∈ pool a j, x) := by
161- congr! 1 with j hj; rw [sum_sub_sum_eq_sub ha hbN]; simp at hj; omega
161+ congr! 1 with j hj; rw [sum_sub_sum_eq_sub ha hbN]; simp at hj; lia
162162 _ = _ := sum_Ico_sub (∑ x ∈ pool a ·, x) hn.le
163163
164164include ht in
@@ -190,7 +190,7 @@ theorem result (ha : Condition a) :
190190 nth_rw 2 [← Nat.sub_one_add_one_eq_of_pos bp]
191191 rw [← sum_flip, sum_range_succ, tsub_self, Nat.cast_zero, add_zero, ← sum_sub_distrib]
192192 have sc : ∀ x ∈ range (b - 1 ), (2014 - x - (b - 1 - x : ℕ)) = (2015 - b : ℤ) := fun x mx ↦ by
193- rw [mem_range] at mx; omega
193+ rw [mem_range] at mx; lia
194194 rw [sum_congr rfl sc, sum_const, card_range, nsmul_eq_mul, Nat.cast_pred bp]
195195 _ ≤ _ := by
196196 rw [← mul_le_mul_iff_right₀ zero_lt_four, ← mul_assoc,
0 commit comments