imo.imo2006_q5
⟷
Archive.Imo.Imo2006Q5
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -3,7 +3,7 @@ Copyright (c) 2022 Violeta Hernández Palacios. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios
-/
-import Data.Polynomial.RingDivision
+import Algebra.Polynomial.RingDivision
import Dynamics.PeriodicPts
#align_import imo.imo2006_q5 from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -53,7 +53,7 @@ absolute value. -/
theorem Int.natAbs_eq_of_chain_dvd {l : Cycle ℤ} {x y : ℤ} (hl : l.Chain (· ∣ ·)) (hx : x ∈ l)
(hy : y ∈ l) : x.natAbs = y.natAbs :=
by
- rw [Cycle.chain_iff_pairwise] at hl
+ rw [Cycle.chain_iff_pairwise] at hl
exact Int.natAbs_eq_of_dvd_dvd (hl x hx y hy) (hl y hy x hx)
#align imo2006_q5.int.nat_abs_eq_of_chain_dvd Imo2006Q5.Int.natAbs_eq_of_chain_dvd
@@ -115,19 +115,19 @@ theorem Polynomial.isPeriodicPt_eval_two {P : Polynomial ℤ} {t : ℤ}
· exact (irrefl 0 hk).elim
· have H := IH k
rw [hk'.is_fixed_pt.eq, sub_self, Int.sign_zero, eq_comm, Int.sign_eq_zero_iff_zero,
- sub_eq_zero] at H
+ sub_eq_zero] at H
simp [is_periodic_pt, is_fixed_pt, H]
· -- We take two nonequal consecutive entries.
- rw [Cycle.chain_map, periodic_orbit_chain' _ ht] at HC'
- push_neg at HC'
+ rw [Cycle.chain_map, periodic_orbit_chain' _ ht] at HC'
+ push_neg at HC'
cases' HC' with n hn
-- They must have opposite sign, so that P^{k + 1}(t) - P^k(t) = P^{k + 2}(t) - P^{k + 1}(t).
cases' Int.natAbs_eq_natAbs_iff.1 (Habs n n.succ) with hn' hn'
· apply (hn _).elim
convert hn' <;> simp only [Function.iterate_succ_apply']
-- We deduce P^{k + 2}(t) = P^k(t) and hence P(P(t)) = t.
- · rw [neg_sub, sub_right_inj] at hn'
- simp only [Function.iterate_succ_apply'] at hn'
+ · rw [neg_sub, sub_right_inj] at hn'
+ simp only [Function.iterate_succ_apply'] at hn'
exact @is_periodic_pt_of_mem_periodic_pts_of_is_periodic_pt_iterate _ _ t 2 n ht hn'.symm
#align imo2006_q5.polynomial.is_periodic_pt_eval_two Imo2006Q5.Polynomial.isPeriodicPt_eval_two
@@ -147,8 +147,8 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
simpa using hP
have hPX' : P - X ≠ 0 := by
intro h
- rw [h, nat_degree_zero] at hPX
- rw [← hPX] at hP
+ rw [h, nat_degree_zero] at hPX
+ rw [← hPX] at hP
exact (zero_le_one.not_lt hP).elim
-- If every root of P(P(t)) - t is also a root of P(t) - t, then we're done.
by_cases H : (P.comp P - X).roots.toFinset ⊆ (P - X).roots.toFinset
@@ -159,10 +159,10 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
-- Otherwise, take a, b with P(a) = b, P(b) = a, a ≠ b.
· rcases Finset.not_subset.1 H with ⟨a, ha, hab⟩
replace ha := is_root_of_mem_roots (Multiset.mem_toFinset.1 ha)
- simp [sub_eq_zero] at ha
- simp [mem_roots hPX'] at hab
+ simp [sub_eq_zero] at ha
+ simp [mem_roots hPX'] at hab
set b := P.eval a
- rw [sub_eq_zero] at hab
+ rw [sub_eq_zero] at hab
-- More auxiliary lemmas on degrees.
have hPab : (P + X - a - b).natDegree = P.nat_degree :=
by
@@ -176,8 +176,8 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
exact zero_lt_one.trans hP
have hPab' : P + X - a - b ≠ 0 := by
intro h
- rw [h, nat_degree_zero] at hPab
- rw [← hPab] at hP
+ rw [h, nat_degree_zero] at hPab
+ rw [← hPab] at hP
exact (zero_le_one.not_lt hP).elim
-- We claim that every root of P(P(t)) - t is a root of P(t) + t - a - b. This allows us to
-- conclude the problem.
@@ -189,7 +189,7 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
· -- Let t be a root of P(P(t)) - t, define u = P(t).
intro t ht
replace ht := is_root_of_mem_roots (Multiset.mem_toFinset.1 ht)
- simp [sub_eq_zero] at ht
+ simp [sub_eq_zero] at ht
simp only [mem_roots hPab', sub_eq_iff_eq_add, Multiset.mem_toFinset, is_root.def, eval_sub,
eval_add, eval_X, eval_C, eval_int_cast, Int.cast_id, zero_add]
-- An auxiliary lemma proved earlier implies we only need to show |t - a| = |u - b| and
@@ -215,7 +215,7 @@ theorem imo2006_q5 {P : Polynomial ℤ} (hP : 1 < P.natDegree) {k : ℕ} (hk : 0
apply (Finset.card_le_card fun t ht => _).trans (imo2006_q5' hP)
have hP' : P.comp P - X ≠ 0 := by simpa using polynomial.iterate_comp_sub_X_ne hP zero_lt_two
replace ht := is_root_of_mem_roots (Multiset.mem_toFinset.1 ht)
- simp only [sub_eq_zero, is_root.def, eval_sub, iterate_comp_eval, eval_X] at ht
+ simp only [sub_eq_zero, is_root.def, eval_sub, iterate_comp_eval, eval_X] at ht
simpa [mem_roots hP', sub_eq_zero] using polynomial.is_periodic_pt_eval_two ⟨k, hk, ht⟩
#align imo2006_q5 imo2006_q5
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -154,7 +154,7 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
by_cases H : (P.comp P - X).roots.toFinset ⊆ (P - X).roots.toFinset
·
exact
- (Finset.card_le_of_subset H).trans
+ (Finset.card_le_card H).trans
((Multiset.toFinset_card_le _).trans ((card_roots' _).trans_eq hPX))
-- Otherwise, take a, b with P(a) = b, P(b) = a, a ≠ b.
· rcases Finset.not_subset.1 H with ⟨a, ha, hab⟩
@@ -184,7 +184,7 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
suffices H' : (P.comp P - X).roots.toFinset ⊆ (P + X - a - b).roots.toFinset
·
exact
- (Finset.card_le_of_subset H').trans
+ (Finset.card_le_card H').trans
((Multiset.toFinset_card_le _).trans <| (card_roots' _).trans_eq hPab)
· -- Let t be a root of P(P(t)) - t, define u = P(t).
intro t ht
@@ -212,7 +212,7 @@ open imo2006_q5
theorem imo2006_q5 {P : Polynomial ℤ} (hP : 1 < P.natDegree) {k : ℕ} (hk : 0 < k) :
((P.comp^[k]) X - X).roots.toFinset.card ≤ P.natDegree :=
by
- apply (Finset.card_le_of_subset fun t ht => _).trans (imo2006_q5' hP)
+ apply (Finset.card_le_card fun t ht => _).trans (imo2006_q5' hP)
have hP' : P.comp P - X ≠ 0 := by simpa using polynomial.iterate_comp_sub_X_ne hP zero_lt_two
replace ht := is_root_of_mem_roots (Multiset.mem_toFinset.1 ht)
simp only [sub_eq_zero, is_root.def, eval_sub, iterate_comp_eval, eval_X] at ht
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2022 Violeta Hernández Palacios. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios
-/
-import Mathbin.Data.Polynomial.RingDivision
-import Mathbin.Dynamics.PeriodicPts
+import Data.Polynomial.RingDivision
+import Dynamics.PeriodicPts
#align_import imo.imo2006_q5 from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2022 Violeta Hernández Palacios. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios
-
-! This file was ported from Lean 3 source module imo.imo2006_q5
-! leanprover-community/mathlib commit 08b081ea92d80e3a41f899eea36ef6d56e0f1db0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Polynomial.RingDivision
import Mathbin.Dynamics.PeriodicPts
+#align_import imo.imo2006_q5 from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
+
/-!
# IMO 2006 Q5
mathlib commit https://github.com/leanprover-community/mathlib/commit/bf2428c9486c407ca38b5b3fb10b87dad0bc99fa
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios
! This file was ported from Lean 3 source module imo.imo2006_q5
-! leanprover-community/mathlib commit 308826471968962c6b59c7ff82a22757386603e3
+! leanprover-community/mathlib commit 08b081ea92d80e3a41f899eea36ef6d56e0f1db0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -14,6 +14,9 @@ import Mathbin.Dynamics.PeriodicPts
/-!
# IMO 2006 Q5
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
Let $P(x)$ be a polynomial of degree $n>1$ with integer coefficients, and let $k$ be a positive
integer. Consider the polynomial $Q(x) = P(P(\ldots P(P(x))\ldots))$, where $P$ occurs $k$ times.
Prove that there are at most $n$ integers $t$ such that $Q(t)=t$.
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3209ddf94136d36e5e5c624b10b2a347cc9d090
nat_cast
/int_cast
/rat_cast
to natCast
/intCast
/ratCast
(#11486)
Now that I am defining NNRat.cast
, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast
/intCast
/ratCast
over nat_cast
/int_cast
/rat_cast
, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -161,7 +161,7 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
rw [natDegree_add_eq_left_of_natDegree_lt]
simpa using hP
rwa [natDegree_sub_eq_left_of_natDegree_lt]
- rw [h₁, natDegree_int_cast]
+ rw [h₁, natDegree_intCast]
exact zero_lt_one.trans hP
have hPab' : P + (X : ℤ[X]) - a - b ≠ 0 := by
intro h
@@ -178,7 +178,7 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
replace ht := isRoot_of_mem_roots (Multiset.mem_toFinset.1 ht)
rw [IsRoot.def, eval_sub, eval_comp, eval_X, sub_eq_zero] at ht
simp only [mem_roots hPab', sub_eq_iff_eq_add, Multiset.mem_toFinset, IsRoot.def,
- eval_sub, eval_add, eval_X, eval_C, eval_int_cast, Int.cast_id, zero_add]
+ eval_sub, eval_add, eval_X, eval_C, eval_intCast, Int.cast_id, zero_add]
-- An auxiliary lemma proved earlier implies we only need to show |t - a| = |u - b| and
-- |t - b| = |u - a|. We prove this by establishing that each side of either equation divides
-- the other.
@@ -150,8 +150,8 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
-- Otherwise, take a, b with P(a) = b, P(b) = a, a ≠ b.
· rcases Finset.not_subset.1 H with ⟨a, ha, hab⟩
replace ha := isRoot_of_mem_roots (Multiset.mem_toFinset.1 ha)
- rw [IsRoot.definition, eval_sub, eval_comp, eval_X, sub_eq_zero] at ha
- rw [Multiset.mem_toFinset, mem_roots hPX', IsRoot.definition, eval_sub, eval_X, sub_eq_zero]
+ rw [IsRoot.def, eval_sub, eval_comp, eval_X, sub_eq_zero] at ha
+ rw [Multiset.mem_toFinset, mem_roots hPX', IsRoot.def, eval_sub, eval_X, sub_eq_zero]
at hab
set b := P.eval a
-- More auxiliary lemmas on degrees.
@@ -176,8 +176,8 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
· -- Let t be a root of P(P(t)) - t, define u = P(t).
intro t ht
replace ht := isRoot_of_mem_roots (Multiset.mem_toFinset.1 ht)
- rw [IsRoot.definition, eval_sub, eval_comp, eval_X, sub_eq_zero] at ht
- simp only [mem_roots hPab', sub_eq_iff_eq_add, Multiset.mem_toFinset, IsRoot.definition,
+ rw [IsRoot.def, eval_sub, eval_comp, eval_X, sub_eq_zero] at ht
+ simp only [mem_roots hPab', sub_eq_iff_eq_add, Multiset.mem_toFinset, IsRoot.def,
eval_sub, eval_add, eval_X, eval_C, eval_int_cast, Int.cast_id, zero_add]
-- An auxiliary lemma proved earlier implies we only need to show |t - a| = |u - b| and
-- |t - b| = |u - a|. We prove this by establishing that each side of either equation divides
@@ -201,8 +201,8 @@ theorem imo2006_q5 {P : Polynomial ℤ} (hP : 1 < P.natDegree) {k : ℕ} (hk : 0
have hP' : P.comp P - X ≠ 0 := by
simpa [Nat.iterate] using Polynomial.iterate_comp_sub_X_ne hP zero_lt_two
replace ht := isRoot_of_mem_roots (Multiset.mem_toFinset.1 ht)
- rw [IsRoot.definition, eval_sub, iterate_comp_eval, eval_X, sub_eq_zero] at ht
- rw [Multiset.mem_toFinset, mem_roots hP', IsRoot.definition, eval_sub, eval_comp, eval_X,
+ rw [IsRoot.def, eval_sub, iterate_comp_eval, eval_X, sub_eq_zero] at ht
+ rw [Multiset.mem_toFinset, mem_roots hP', IsRoot.def, eval_sub, eval_comp, eval_X,
sub_eq_zero]
exact Polynomial.isPeriodicPt_eval_two ⟨k, hk, ht⟩
#align imo2006_q5 imo2006_q5
Data
(#11751)
Polynomial
and MvPolynomial
are algebraic objects, hence should be under Algebra
(or at least not under Data
)
@@ -3,7 +3,7 @@ Copyright (c) 2022 Violeta Hernández Palacios. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios
-/
-import Mathlib.Data.Polynomial.RingDivision
+import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.Dynamics.PeriodicPts
#align_import imo.imo2006_q5 from "leanprover-community/mathlib"@"308826471968962c6b59c7ff82a22757386603e3"
@@ -150,8 +150,9 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
-- Otherwise, take a, b with P(a) = b, P(b) = a, a ≠ b.
· rcases Finset.not_subset.1 H with ⟨a, ha, hab⟩
replace ha := isRoot_of_mem_roots (Multiset.mem_toFinset.1 ha)
- rw [IsRoot.def, eval_sub, eval_comp, eval_X, sub_eq_zero] at ha
- rw [Multiset.mem_toFinset, mem_roots hPX', IsRoot.def, eval_sub, eval_X, sub_eq_zero] at hab
+ rw [IsRoot.definition, eval_sub, eval_comp, eval_X, sub_eq_zero] at ha
+ rw [Multiset.mem_toFinset, mem_roots hPX', IsRoot.definition, eval_sub, eval_X, sub_eq_zero]
+ at hab
set b := P.eval a
-- More auxiliary lemmas on degrees.
have hPab : (P + (X : ℤ[X]) - a - b).natDegree = P.natDegree := by
@@ -175,9 +176,9 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
· -- Let t be a root of P(P(t)) - t, define u = P(t).
intro t ht
replace ht := isRoot_of_mem_roots (Multiset.mem_toFinset.1 ht)
- rw [IsRoot.def, eval_sub, eval_comp, eval_X, sub_eq_zero] at ht
- simp only [mem_roots hPab', sub_eq_iff_eq_add, Multiset.mem_toFinset, IsRoot.def, eval_sub,
- eval_add, eval_X, eval_C, eval_int_cast, Int.cast_id, zero_add]
+ rw [IsRoot.definition, eval_sub, eval_comp, eval_X, sub_eq_zero] at ht
+ simp only [mem_roots hPab', sub_eq_iff_eq_add, Multiset.mem_toFinset, IsRoot.definition,
+ eval_sub, eval_add, eval_X, eval_C, eval_int_cast, Int.cast_id, zero_add]
-- An auxiliary lemma proved earlier implies we only need to show |t - a| = |u - b| and
-- |t - b| = |u - a|. We prove this by establishing that each side of either equation divides
-- the other.
@@ -200,7 +201,8 @@ theorem imo2006_q5 {P : Polynomial ℤ} (hP : 1 < P.natDegree) {k : ℕ} (hk : 0
have hP' : P.comp P - X ≠ 0 := by
simpa [Nat.iterate] using Polynomial.iterate_comp_sub_X_ne hP zero_lt_two
replace ht := isRoot_of_mem_roots (Multiset.mem_toFinset.1 ht)
- rw [IsRoot.def, eval_sub, iterate_comp_eval, eval_X, sub_eq_zero] at ht
- rw [Multiset.mem_toFinset, mem_roots hP', IsRoot.def, eval_sub, eval_comp, eval_X, sub_eq_zero]
+ rw [IsRoot.definition, eval_sub, iterate_comp_eval, eval_X, sub_eq_zero] at ht
+ rw [Multiset.mem_toFinset, mem_roots hP', IsRoot.definition, eval_sub, eval_comp, eval_X,
+ sub_eq_zero]
exact Polynomial.isPeriodicPt_eval_two ⟨k, hk, ht⟩
#align imo2006_q5 imo2006_q5
have
, replace
and suffices
(#10640)
No changes to tactic file, it's just boring fixes throughout the library.
This follows on from #6964.
Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -169,8 +169,8 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
exact (zero_le_one.not_lt hP).elim
-- We claim that every root of P(P(t)) - t is a root of P(t) + t - a - b. This allows us to
-- conclude the problem.
- suffices H' : (P.comp P - X).roots.toFinset ⊆ (P + (X : ℤ[X]) - a - b).roots.toFinset
- · exact (Finset.card_le_card H').trans
+ suffices H' : (P.comp P - X).roots.toFinset ⊆ (P + (X : ℤ[X]) - a - b).roots.toFinset from
+ (Finset.card_le_card H').trans
((Multiset.toFinset_card_le _).trans <| (card_roots' _).trans_eq hPab)
· -- Let t be a root of P(P(t)) - t, define u = P(t).
intro t ht
Finset
lemma names (#8894)
Change a few lemma names that have historically bothered me.
Finset.card_le_of_subset
→ Finset.card_le_card
Multiset.card_le_of_le
→ Multiset.card_le_card
Multiset.card_lt_of_lt
→ Multiset.card_lt_card
Set.ncard_le_of_subset
→ Set.ncard_le_ncard
Finset.image_filter
→ Finset.filter_image
CompleteLattice.finset_sup_compact_of_compact
→ CompleteLattice.isCompactElement_finset_sup
@@ -145,7 +145,7 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
exact (zero_le_one.not_lt hP).elim
-- If every root of P(P(t)) - t is also a root of P(t) - t, then we're done.
by_cases H : (P.comp P - X).roots.toFinset ⊆ (P - X).roots.toFinset
- · exact (Finset.card_le_of_subset H).trans
+ · exact (Finset.card_le_card H).trans
((Multiset.toFinset_card_le _).trans ((card_roots' _).trans_eq hPX))
-- Otherwise, take a, b with P(a) = b, P(b) = a, a ≠ b.
· rcases Finset.not_subset.1 H with ⟨a, ha, hab⟩
@@ -170,7 +170,7 @@ theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
-- We claim that every root of P(P(t)) - t is a root of P(t) + t - a - b. This allows us to
-- conclude the problem.
suffices H' : (P.comp P - X).roots.toFinset ⊆ (P + (X : ℤ[X]) - a - b).roots.toFinset
- · exact (Finset.card_le_of_subset H').trans
+ · exact (Finset.card_le_card H').trans
((Multiset.toFinset_card_le _).trans <| (card_roots' _).trans_eq hPab)
· -- Let t be a root of P(P(t)) - t, define u = P(t).
intro t ht
@@ -196,7 +196,7 @@ open Imo2006Q5
/-- The general problem follows easily from the k = 2 case. -/
theorem imo2006_q5 {P : Polynomial ℤ} (hP : 1 < P.natDegree) {k : ℕ} (hk : 0 < k) :
(P.comp^[k] X - X).roots.toFinset.card ≤ P.natDegree := by
- refine' (Finset.card_le_of_subset fun t ht => _).trans (imo2006_q5' hP)
+ refine' (Finset.card_le_card fun t ht => _).trans (imo2006_q5' hP)
have hP' : P.comp P - X ≠ 0 := by
simpa [Nat.iterate] using Polynomial.iterate_comp_sub_X_ne hP zero_lt_two
replace ht := isRoot_of_mem_roots (Multiset.mem_toFinset.1 ht)
@@ -2,15 +2,12 @@
Copyright (c) 2022 Violeta Hernández Palacios. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios
-
-! This file was ported from Lean 3 source module imo.imo2006_q5
-! leanprover-community/mathlib commit 308826471968962c6b59c7ff82a22757386603e3
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Polynomial.RingDivision
import Mathlib.Dynamics.PeriodicPts
+#align_import imo.imo2006_q5 from "leanprover-community/mathlib"@"308826471968962c6b59c7ff82a22757386603e3"
+
/-!
# IMO 2006 Q5
@@ -71,7 +71,7 @@ theorem Polynomial.isPeriodicPt_eval_two {P : Polynomial ℤ} {t : ℤ}
(ht : t ∈ periodicPts fun x => P.eval x) : IsPeriodicPt (fun x => P.eval x) 2 t := by
-- The cycle [P(t) - t, P(P(t)) - P(t), ...]
let C : Cycle ℤ := (periodicOrbit (fun x => P.eval x) t).map fun x => P.eval x - x
- have HC : ∀ {n : ℕ}, ((fun x => P.eval x)^[n + 1]) t - ((fun x => P.eval x)^[n]) t ∈ C := by
+ have HC : ∀ {n : ℕ}, (fun x => P.eval x)^[n + 1] t - (fun x => P.eval x)^[n] t ∈ C := by
intro n
rw [Cycle.mem_map, Function.iterate_succ_apply']
exact ⟨_, iterate_mem_periodicOrbit ht n, rfl⟩
@@ -79,24 +79,24 @@ theorem Polynomial.isPeriodicPt_eval_two {P : Polynomial ℤ} {t : ℤ}
have Hdvd : C.Chain (· ∣ ·) := by
rw [Cycle.chain_map, periodicOrbit_chain' _ ht]
intro n
- convert sub_dvd_eval_sub (((fun x => P.eval x)^[n + 1]) t) (((fun x => P.eval x)^[n]) t) P <;>
+ convert sub_dvd_eval_sub ((fun x => P.eval x)^[n + 1] t) ((fun x => P.eval x)^[n] t) P <;>
rw [Function.iterate_succ_apply']
-- Any two entries in C have the same absolute value.
have Habs :
∀ m n : ℕ,
- (((fun x => P.eval x)^[m + 1]) t - ((fun x => P.eval x)^[m]) t).natAbs =
- (((fun x => P.eval x)^[n + 1]) t - ((fun x => P.eval x)^[n]) t).natAbs :=
+ ((fun x => P.eval x)^[m + 1] t - (fun x => P.eval x)^[m] t).natAbs =
+ ((fun x => P.eval x)^[n + 1] t - (fun x => P.eval x)^[n] t).natAbs :=
fun m n => Int.natAbs_eq_of_chain_dvd Hdvd HC HC
-- We case on whether the elements on C are pairwise equal.
by_cases HC' : C.Chain (· = ·)
· -- Any two entries in C are equal.
have Heq :
∀ m n : ℕ,
- ((fun x => P.eval x)^[m + 1]) t - ((fun x => P.eval x)^[m]) t =
- ((fun x => P.eval x)^[n + 1]) t - ((fun x => P.eval x)^[n]) t :=
+ (fun x => P.eval x)^[m + 1] t - (fun x => P.eval x)^[m] t =
+ (fun x => P.eval x)^[n + 1] t - (fun x => P.eval x)^[n] t :=
fun m n => Cycle.chain_iff_pairwise.1 HC' _ HC _ HC
-- The sign of P^n(t) - t is the same as P(t) - t for positive n. Proven by induction on n.
- have IH : ∀ n : ℕ, (((fun x => P.eval x)^[n + 1]) t - t).sign = (P.eval t - t).sign := by
+ have IH : ∀ n : ℕ, ((fun x => P.eval x)^[n + 1] t - t).sign = (P.eval t - t).sign := by
intro n
induction' n with n IH
· rfl
@@ -127,7 +127,7 @@ theorem Polynomial.isPeriodicPt_eval_two {P : Polynomial ℤ} {t : ℤ}
#align imo2006_q5.polynomial.is_periodic_pt_eval_two Imo2006Q5.Polynomial.isPeriodicPt_eval_two
theorem Polynomial.iterate_comp_sub_X_ne {P : Polynomial ℤ} (hP : 1 < P.natDegree) {k : ℕ}
- (hk : 0 < k) : (P.comp^[k]) X - X ≠ 0 := by
+ (hk : 0 < k) : P.comp^[k] X - X ≠ 0 := by
rw [sub_ne_zero]
apply_fun natDegree
simpa using (one_lt_pow hP hk.ne').ne'
@@ -198,7 +198,7 @@ open Imo2006Q5
/-- The general problem follows easily from the k = 2 case. -/
theorem imo2006_q5 {P : Polynomial ℤ} (hP : 1 < P.natDegree) {k : ℕ} (hk : 0 < k) :
- ((P.comp^[k]) X - X).roots.toFinset.card ≤ P.natDegree := by
+ (P.comp^[k] X - X).roots.toFinset.card ≤ P.natDegree := by
refine' (Finset.card_le_of_subset fun t ht => _).trans (imo2006_q5' hP)
have hP' : P.comp P - X ≠ 0 := by
simpa [Nat.iterate] using Polynomial.iterate_comp_sub_X_ne hP zero_lt_two
The unported dependencies are