Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 8ff2783

Browse files
feat(counterexamples/cyclotomic_105): add coeff_cyclotomic_105 (#7648)
We show that `coeff (cyclotomic 105 ℤ) 7 = -2`, proving that not all coefficients of cyclotomic polynomials are `0`, `-1` or `1`.
1 parent 16733c8 commit 8ff2783

File tree

2 files changed

+126
-0
lines changed

2 files changed

+126
-0
lines changed

counterexamples/cyclotomic_105.lean

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/-
2+
Copyright (c) 2021 Riccardo Brasca. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Riccardo Brasca
5+
-/
6+
7+
import ring_theory.polynomial.cyclotomic
8+
9+
/-!
10+
# Not all coefficients of cyclotomic polynomials are -1, 0, or 1
11+
12+
We show that not all coefficients of cyclotomic polynomials are equal to `0`, `-1` or `1`, in the
13+
theorem `not_forall_coeff_cyclotomic_neg_one_zero_one`. We prove this with the counterexample
14+
`coeff_cyclotomic_105 : coeff (cyclotomic 105 ℤ) 7 = -2`.
15+
-/
16+
17+
section computation
18+
19+
lemma prime_3 : nat.prime 3 := by norm_num
20+
21+
lemma prime_5 : nat.prime 5 := by norm_num
22+
23+
lemma prime_7 : nat.prime 7 := by norm_num
24+
25+
lemma proper_divisors_15 : nat.proper_divisors 15 = {1, 3, 5} := rfl
26+
27+
lemma proper_divisors_21 : nat.proper_divisors 21 = {1, 3, 7} := rfl
28+
29+
lemma proper_divisors_35 : nat.proper_divisors 35 = {1, 5, 7} := rfl
30+
31+
lemma proper_divisors_105 : nat.proper_divisors 105 = {1, 3, 5, 7, 15, 21, 35} := rfl
32+
33+
end computation
34+
35+
open polynomial
36+
37+
lemma cyclotomic_3 : cyclotomic 3 ℤ = 1 + X + X ^ 2 :=
38+
begin
39+
refine ((eq_cyclotomic_iff (show 0 < 3, by norm_num) _).2 _).symm,
40+
rw nat.prime.proper_divisors prime_3,
41+
simp only [finset.prod_singleton, cyclotomic_one],
42+
ring
43+
end
44+
45+
lemma cyclotomic_5 : cyclotomic 5 ℤ = 1 + X + X ^ 2 + X ^ 3 + X ^ 4 :=
46+
begin
47+
refine ((eq_cyclotomic_iff (nat.prime.pos prime_5) _).2 _).symm,
48+
rw nat.prime.proper_divisors prime_5,
49+
simp only [finset.prod_singleton, cyclotomic_one],
50+
ring
51+
end
52+
53+
lemma cyclotomic_7 : cyclotomic 7 ℤ = 1 + X + X ^ 2 + X ^ 3 + X ^ 4 + X ^ 5 + X ^ 6 :=
54+
begin
55+
refine ((eq_cyclotomic_iff (nat.prime.pos prime_7) _).2 _).symm,
56+
rw nat.prime.proper_divisors prime_7,
57+
simp only [finset.prod_singleton, cyclotomic_one],
58+
ring
59+
end
60+
61+
lemma cyclotomic_15 : cyclotomic 15 ℤ = 1 - X + X ^ 3 - X ^ 4 + X ^ 5 - X ^ 7 + X ^ 8 :=
62+
begin
63+
refine ((eq_cyclotomic_iff (show 0 < 15, by norm_num) _).2 _).symm,
64+
rw [proper_divisors_15, finset.prod_insert _, finset.prod_insert _, finset.prod_singleton,
65+
cyclotomic_one, cyclotomic_3, cyclotomic_5],
66+
ring,
67+
repeat { norm_num }
68+
end
69+
70+
lemma cyclotomic_21 : cyclotomic 21 ℤ =
71+
1 - X + X ^ 3 - X ^ 4 + X ^ 6 - X ^ 8 + X ^ 9 - X ^ 11 + X ^ 12 :=
72+
begin
73+
refine ((eq_cyclotomic_iff (show 0 < 21, by norm_num) _).2 _).symm,
74+
rw [proper_divisors_21, finset.prod_insert _, finset.prod_insert _, finset.prod_singleton,
75+
cyclotomic_one, cyclotomic_3, cyclotomic_7],
76+
ring,
77+
repeat { norm_num }
78+
end
79+
80+
lemma cyclotomic_35 : cyclotomic 35 ℤ =
81+
1 - X + X ^ 5 - X ^ 6 + X ^ 7 - X ^ 8 + X ^ 10 - X ^ 11 + X ^ 12 - X ^ 13 + X ^ 14 - X ^ 16 +
82+
X ^ 17 - X ^ 18 + X ^ 19 - X ^ 23 + X ^ 24 :=
83+
begin
84+
refine ((eq_cyclotomic_iff (show 0 < 35, by norm_num) _).2 _).symm,
85+
rw [proper_divisors_35, finset.prod_insert _, finset.prod_insert _, finset.prod_singleton,
86+
cyclotomic_one, cyclotomic_5, cyclotomic_7],
87+
ring,
88+
repeat { norm_num }
89+
end
90+
91+
lemma cyclotomic_105 : cyclotomic 105 ℤ =
92+
1 + X + X ^ 2 - X ^ 5 - X ^ 6 - 2 * X ^ 7 - X ^ 8 - X ^ 9 + X ^ 12 + X ^ 13 + X ^ 14 + X ^ 15
93+
+ X ^ 16 + X ^ 17 - X ^ 20 - X ^ 22 - X ^ 24 - X ^ 26 - X ^ 28 + X ^ 31 + X ^ 32 + X ^ 33 +
94+
X ^ 34 + X ^ 35 + X ^ 36 - X ^ 39 - X ^ 40 - 2 * X ^ 41 - X ^ 42 - X ^ 43 + X ^ 46 + X ^ 47 +
95+
X ^ 48 :=
96+
begin
97+
refine ((eq_cyclotomic_iff (show 0 < 105, by norm_num) _).2 _).symm,
98+
rw proper_divisors_105,
99+
repeat {rw finset.prod_insert _},
100+
rw [finset.prod_singleton, cyclotomic_one, cyclotomic_3, cyclotomic_5, cyclotomic_7,
101+
cyclotomic_15, cyclotomic_21, cyclotomic_35],
102+
ring,
103+
repeat { norm_num }
104+
end
105+
106+
lemma coeff_cyclotomic_105 : coeff (cyclotomic 105 ℤ) 7 = -2 :=
107+
begin
108+
simp [cyclotomic_105, coeff_X_pow, coeff_one, coeff_X_of_ne_one, coeff_bit0_mul, coeff_bit1_mul]
109+
end
110+
111+
lemma not_forall_coeff_cyclotomic_neg_one_zero_one :
112+
¬∀ n i, coeff (cyclotomic n ℤ) i ∈ ({-1, 0, 1} : set ℤ) :=
113+
begin
114+
intro h,
115+
replace h := h 105 7,
116+
rw coeff_cyclotomic_105 at h,
117+
norm_num at h
118+
end

src/data/polynomial/coeff.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ begin
167167
{ rw [not_not] at hi, rwa mul_zero } },
168168
end
169169

170+
lemma coeff_bit0_mul (P Q : polynomial R) (n : ℕ) :
171+
coeff (bit0 P * Q) n = 2 * coeff (P * Q) n :=
172+
by simp [bit0, add_mul]
173+
174+
lemma coeff_bit1_mul (P Q : polynomial R) (n : ℕ) :
175+
coeff (bit1 P * Q) n = 2 * coeff (P * Q) n + coeff Q n :=
176+
by simp [bit1, add_mul, coeff_bit0_mul]
177+
170178
end coeff
171179

172180
section cast

0 commit comments

Comments
 (0)