import Mathlib/-! A finite certificate for a primitive 46-term reciprocal relation.After clearing denominators the modulus of each of seven disjoint prime-powerlayers restricts the integer contribution from that layer. Once denominator 1is absent, the positive uncovered weights can contribute only 0, 12, 21 or 33after their common scale is removed. All opposing contributions belong to anadditively closed set containing none of 12, 21 and 33. At zero each grouphas selected no terms. Complementing the choice handles denominator 1.The final theorem uses the same fixed signs on every proper subset.-/namespace Erdos319Witnessset_option maxHeartbeats 6000000set_option maxRecDepth 16384def bit (b : Bool) : ℤ := if b then 1 else 0private def good (t : ℤ) : Prop := 34 ≤ t ∨ t ∈ ([0,10,14,15,17,20,24,25,27,28,29,30,31,32] : List ℤ)private instance (t : ℤ) : Decidable (good t) := inferInstanceAs (Decidable (_ ∨ _))private theorem good_nonneg {t : ℤ} (h : good t) : 0 ≤ t := bysimp [good] at h; omegaprivate theorem good_add {a b : ℤ} (ha : good a) (hb : good b) : good (a+b) := byhave ha0 := good_nonneg hahave hb0 := good_nonneg hbby_cases aL : 34 ≤ a· exact Or.inl (by omega)by_cases bL : 34 ≤ b· exact Or.inl (by omega)have finite : ∀ u v : Fin 34, good (u.val : ℤ) → good (v.val : ℤ) → good ((u.val : ℤ)+v.val) := by decide +kernellet u : Fin 34 := ⟨a.toNat,by omega⟩let v : Fin 34 := ⟨b.toNat,by omega⟩have hu : (u.val : ℤ) = a := Int.toNat_of_nonneg ha0have hv : (v.val : ℤ) = b := Int.toNat_of_nonneg hb0have step := finite u vrw [hu,hv] at stepexact step ha hbprivate def valid (cost count : ℤ) : Prop := good cost ∧ (cost=0 → count=0)private instance (a b : ℤ) : Decidable (valid a b) := inferInstanceAs (Decidable (_ ∧ _))private theorem valid_add {u v i j : ℤ} (h : valid u i) (k : valid v j) : valid (u+v) (i+j) := byrefine ⟨good_add h.1 k.1, ?_⟩have hu := good_nonneg h.1; have hv := good_nonneg k.1intro zhave hi := h.2 (by omega); have hj := k.2 (by omega); omegaprivate theorem block0 : ∀ (b19 b38 b57 b76 : Bool),let t := (-183783600 : ℤ) * bit b19 + (-91891800 : ℤ) * bit b38 + (-61261200 : ℤ) * bit b57 + (45945900 : ℤ) * bit b76t % 19 = 0 → valid ((-t)/4157010) (bit b19 + bit b38 + bit b57 + bit b76) ∧ t = (-4157010) * ((-t)/4157010) := by decide +kernelprivate theorem block1 : ∀ (b17 b34 b51 b68 : Bool),let t := (-205405200 : ℤ) * bit b17 + (-102702600 : ℤ) * bit b34 + (68468400 : ℤ) * bit b51 + (-51351300 : ℤ) * bit b68t % 17 = 0 → valid ((-t)/4157010) (bit b17 + bit b34 + bit b51 + bit b68) ∧ t = (-4157010) * ((-t)/4157010) := by decide +kernelprivate theorem block2 : ∀ (b13 b26 b52 b65 b78 : Bool),let t := (-268606800 : ℤ) * bit b13 + (134303400 : ℤ) * bit b26 + (67151700 : ℤ) * bit b52 + (53721360 : ℤ) * bit b65 + (-44767800 : ℤ) * bit b78t % 13 = 0 → valid ((-t)/4157010) (bit b13 + bit b26 + bit b52 + bit b65 + bit b78) ∧ t = (-4157010) * ((-t)/4157010) := by decide +kernelprivate theorem block3 : ∀ (b22 b33 b44 b55 b66 b77 : Bool),let t := (-158722200 : ℤ) * bit b22 + (-105814800 : ℤ) * bit b33 + (79361100 : ℤ) * bit b44 + (-63488880 : ℤ) * bit b55 + (52907400 : ℤ) * bit b66 + (-45349200 : ℤ) * bit b77t % 11 = 0 → valid ((-t)/4157010) (bit b22 + bit b33 + bit b44 + bit b55 + bit b66 + bit b77) ∧ t = (-4157010) * ((-t)/4157010) := by decide +kernelprivate theorem block4 : ∀ (b25 b50 b75 : Bool),let t := (-139675536 : ℤ) * bit b25 + (69837768 : ℤ) * bit b50 + (-46558512 : ℤ) * bit b75t % 5 = 0 → valid ((-t)/4157010) (bit b25 + bit b50 + bit b75) ∧ t = (-4157010) * ((-t)/4157010) := by decide +kernelprivate theorem block5 : ∀ (b9 b18 b27 b36 b45 b54 b63 b72 : Bool),let t := (-387987600 : ℤ) * bit b9 + (-193993800 : ℤ) * bit b18 + (-129329200 : ℤ) * bit b27 + (-96996900 : ℤ) * bit b36 + (-77597520 : ℤ) * bit b45 + (-64664600 : ℤ) * bit b54 + (55426800 : ℤ) * bit b63 + (-48498450 : ℤ) * bit b72t % 9 = 0 → valid ((-t)/4157010) (bit b9 + bit b18 + bit b27 + bit b36 + bit b45 + bit b54 + bit b63 + bit b72) ∧ t = (-4157010) * ((-t)/4157010) := by decide +kernelprivate theorem block6 : ∀ (b48 b80 : Bool),let t := (-72747675 : ℤ) * bit b48 + (-43648605 : ℤ) * bit b80t % 2 = 0 → valid ((-t)/4157010) (bit b48 + bit b80) ∧ t = (-4157010) * ((-t)/4157010) := by decide +kernelprivate theorem single12 : ∀ b : Bool, valid (70 * bit b) (bit b) := by decide +kernelprivate theorem single14 : ∀ b : Bool, valid (60 * bit b) (bit b) := by decide +kernelprivate theorem single20 : ∀ b : Bool, valid (42 * bit b) (bit b) := by decide +kernelprivate theorem single21 : ∀ b : Bool, valid (40 * bit b) (bit b) := by decide +kernelprivate theorem single24 : ∀ b : Bool, valid (35 * bit b) (bit b) := by decide +kernelprivate theorem single28 : ∀ b : Bool, valid (30 * bit b) (bit b) := by decide +kernelprivate theorem single30 : ∀ b : Bool, valid (28 * bit b) (bit b) := by decide +kernelprivate theorem single35 : ∀ b : Bool, valid (24 * bit b) (bit b) := by decide +kernelprivate theorem single42 : ∀ b : Bool, valid (20 * bit b) (bit b) := by decide +kernelprivate theorem single56 : ∀ b : Bool, valid (15 * bit b) (bit b) := by decide +kernelprivate theorem single60 : ∀ b : Bool, valid (14 * bit b) (bit b) := by decide +kerneldef linear (x : ℕ → Bool) : ℤ :=(3491888400 : ℤ) * bit (x 1) + (-387987600 : ℤ) * bit (x 9) + (-290990700 : ℤ) * bit (x 12) + (-268606800 : ℤ) * bit (x 13) + (-249420600 : ℤ) * bit (x 14) + (-205405200 : ℤ) * bit (x 17) + (-193993800 : ℤ) * bit (x 18) + (-183783600 : ℤ) * bit (x 19) + (-174594420 : ℤ) * bit (x 20) + (-166280400 : ℤ) * bit (x 21) + (-158722200 : ℤ) * bit (x 22) + (-145495350 : ℤ) * bit (x 24) + (-139675536 : ℤ) * bit (x 25) + (134303400 : ℤ) * bit (x 26) + (-129329200 : ℤ) * bit (x 27) + (-124710300 : ℤ) * bit (x 28) + (-116396280 : ℤ) * bit (x 30) + (-105814800 : ℤ) * bit (x 33) + (-102702600 : ℤ) * bit (x 34) + (-99768240 : ℤ) * bit (x 35) + (-96996900 : ℤ) * bit (x 36) + (-91891800 : ℤ) * bit (x 38) + (87297210 : ℤ) * bit (x 40) + (-83140200 : ℤ) * bit (x 42) + (79361100 : ℤ) * bit (x 44) + (-77597520 : ℤ) * bit (x 45) + (-72747675 : ℤ) * bit (x 48) + (69837768 : ℤ) * bit (x 50) + (68468400 : ℤ) * bit (x 51) + (67151700 : ℤ) * bit (x 52) + (-64664600 : ℤ) * bit (x 54) + (-63488880 : ℤ) * bit (x 55) + (-62355150 : ℤ) * bit (x 56) + (-61261200 : ℤ) * bit (x 57) + (-58198140 : ℤ) * bit (x 60) + (55426800 : ℤ) * bit (x 63) + (53721360 : ℤ) * bit (x 65) + (52907400 : ℤ) * bit (x 66) + (-51351300 : ℤ) * bit (x 68) + (49884120 : ℤ) * bit (x 70) + (-48498450 : ℤ) * bit (x 72) + (-46558512 : ℤ) * bit (x 75) + (45945900 : ℤ) * bit (x 76) + (-45349200 : ℤ) * bit (x 77) + (-44767800 : ℤ) * bit (x 78) + (-43648605 : ℤ) * bit (x 80)def chosen (x : ℕ → Bool) : ℤ :=bit (x 1) + bit (x 9) + bit (x 12) + bit (x 13) + bit (x 14) + bit (x 17) + bit (x 18) + bit (x 19) + bit (x 20) + bit (x 21) + bit (x 22) + bit (x 24) + bit (x 25) + bit (x 26) + bit (x 27) + bit (x 28) + bit (x 30) + bit (x 33) + bit (x 34) + bit (x 35) + bit (x 36) + bit (x 38) + bit (x 40) + bit (x 42) + bit (x 44) + bit (x 45) + bit (x 48) + bit (x 50) + bit (x 51) + bit (x 52) + bit (x 54) + bit (x 55) + bit (x 56) + bit (x 57) + bit (x 60) + bit (x 63) + bit (x 65) + bit (x 66) + bit (x 68) + bit (x 70) + bit (x 72) + bit (x 75) + bit (x 76) + bit (x 77) + bit (x 78) + bit (x 80)private theorem zero_without_anchor (x : ℕ → Bool) (anchor : x 1 = false) (z : linear x = 0) : chosen x = 0 := byunfold linear at zlet t0 : ℤ := (-183783600 : ℤ) * bit (x 19) + (-91891800 : ℤ) * bit (x 38) + (-61261200 : ℤ) * bit (x 57) + (45945900 : ℤ) * bit (x 76)have zero0 : t0 = 19 * (-((183783600:ℤ) * bit (x 1) + (-20420400:ℤ) * bit (x 9) + (-15315300:ℤ) * bit (x 12) + (-14137200:ℤ) * bit (x 13) + (-13127400:ℤ) * bit (x 14) + (-10810800:ℤ) * bit (x 17) + (-10210200:ℤ) * bit (x 18) + (-9189180:ℤ) * bit (x 20) + (-8751600:ℤ) * bit (x 21) + (-8353800:ℤ) * bit (x 22) + (-7657650:ℤ) * bit (x 24) + (-7351344:ℤ) * bit (x 25) + (7068600:ℤ) * bit (x 26) + (-6806800:ℤ) * bit (x 27) + (-6563700:ℤ) * bit (x 28) + (-6126120:ℤ) * bit (x 30) + (-5569200:ℤ) * bit (x 33) + (-5405400:ℤ) * bit (x 34) + (-5250960:ℤ) * bit (x 35) + (-5105100:ℤ) * bit (x 36) + (4594590:ℤ) * bit (x 40) + (-4375800:ℤ) * bit (x 42) + (4176900:ℤ) * bit (x 44) + (-4084080:ℤ) * bit (x 45) + (-3828825:ℤ) * bit (x 48) + (3675672:ℤ) * bit (x 50) + (3603600:ℤ) * bit (x 51) + (3534300:ℤ) * bit (x 52) + (-3403400:ℤ) * bit (x 54) + (-3341520:ℤ) * bit (x 55) + (-3281850:ℤ) * bit (x 56) + (-3063060:ℤ) * bit (x 60) + (2917200:ℤ) * bit (x 63) + (2827440:ℤ) * bit (x 65) + (2784600:ℤ) * bit (x 66) + (-2702700:ℤ) * bit (x 68) + (2625480:ℤ) * bit (x 70) + (-2552550:ℤ) * bit (x 72) + (-2450448:ℤ) * bit (x 75) + (-2386800:ℤ) * bit (x 77) + (-2356200:ℤ) * bit (x 78) + (-2297295:ℤ) * bit (x 80))) := bydsimp [t0]; linear_combination zhave mod0 : t0 % 19 = 0 := by rw [zero0,Int.mul_emod_right]obtain ⟨v0,r0⟩ := block0 (x 19) (x 38) (x 57) (x 76) mod0change valid ((-t0)/4157010) (bit (x 19) + bit (x 38) + bit (x 57) + bit (x 76)) at v0change t0 = (-4157010) * ((-t0)/4157010) at r0let t1 : ℤ := (-205405200 : ℤ) * bit (x 17) + (-102702600 : ℤ) * bit (x 34) + (68468400 : ℤ) * bit (x 51) + (-51351300 : ℤ) * bit (x 68)have zero1 : t1 = 17 * (-((205405200:ℤ) * bit (x 1) + (-22822800:ℤ) * bit (x 9) + (-17117100:ℤ) * bit (x 12) + (-15800400:ℤ) * bit (x 13) + (-14671800:ℤ) * bit (x 14) + (-11411400:ℤ) * bit (x 18) + (-10810800:ℤ) * bit (x 19) + (-10270260:ℤ) * bit (x 20) + (-9781200:ℤ) * bit (x 21) + (-9336600:ℤ) * bit (x 22) + (-8558550:ℤ) * bit (x 24) + (-8216208:ℤ) * bit (x 25) + (7900200:ℤ) * bit (x 26) + (-7607600:ℤ) * bit (x 27) + (-7335900:ℤ) * bit (x 28) + (-6846840:ℤ) * bit (x 30) + (-6224400:ℤ) * bit (x 33) + (-5868720:ℤ) * bit (x 35) + (-5705700:ℤ) * bit (x 36) + (-5405400:ℤ) * bit (x 38) + (5135130:ℤ) * bit (x 40) + (-4890600:ℤ) * bit (x 42) + (4668300:ℤ) * bit (x 44) + (-4564560:ℤ) * bit (x 45) + (-4279275:ℤ) * bit (x 48) + (4108104:ℤ) * bit (x 50) + (3950100:ℤ) * bit (x 52) + (-3803800:ℤ) * bit (x 54) + (-3734640:ℤ) * bit (x 55) + (-3667950:ℤ) * bit (x 56) + (-3603600:ℤ) * bit (x 57) + (-3423420:ℤ) * bit (x 60) + (3260400:ℤ) * bit (x 63) + (3160080:ℤ) * bit (x 65) + (3112200:ℤ) * bit (x 66) + (2934360:ℤ) * bit (x 70) + (-2852850:ℤ) * bit (x 72) + (-2738736:ℤ) * bit (x 75) + (2702700:ℤ) * bit (x 76) + (-2667600:ℤ) * bit (x 77) + (-2633400:ℤ) * bit (x 78) + (-2567565:ℤ) * bit (x 80))) := bydsimp [t1]; linear_combination zhave mod1 : t1 % 17 = 0 := by rw [zero1,Int.mul_emod_right]obtain ⟨v1,r1⟩ := block1 (x 17) (x 34) (x 51) (x 68) mod1change valid ((-t1)/4157010) (bit (x 17) + bit (x 34) + bit (x 51) + bit (x 68)) at v1change t1 = (-4157010) * ((-t1)/4157010) at r1let t2 : ℤ := (-268606800 : ℤ) * bit (x 13) + (134303400 : ℤ) * bit (x 26) + (67151700 : ℤ) * bit (x 52) + (53721360 : ℤ) * bit (x 65) + (-44767800 : ℤ) * bit (x 78)have zero2 : t2 = 13 * (-((268606800:ℤ) * bit (x 1) + (-29845200:ℤ) * bit (x 9) + (-22383900:ℤ) * bit (x 12) + (-19186200:ℤ) * bit (x 14) + (-15800400:ℤ) * bit (x 17) + (-14922600:ℤ) * bit (x 18) + (-14137200:ℤ) * bit (x 19) + (-13430340:ℤ) * bit (x 20) + (-12790800:ℤ) * bit (x 21) + (-12209400:ℤ) * bit (x 22) + (-11191950:ℤ) * bit (x 24) + (-10744272:ℤ) * bit (x 25) + (-9948400:ℤ) * bit (x 27) + (-9593100:ℤ) * bit (x 28) + (-8953560:ℤ) * bit (x 30) + (-8139600:ℤ) * bit (x 33) + (-7900200:ℤ) * bit (x 34) + (-7674480:ℤ) * bit (x 35) + (-7461300:ℤ) * bit (x 36) + (-7068600:ℤ) * bit (x 38) + (6715170:ℤ) * bit (x 40) + (-6395400:ℤ) * bit (x 42) + (6104700:ℤ) * bit (x 44) + (-5969040:ℤ) * bit (x 45) + (-5595975:ℤ) * bit (x 48) + (5372136:ℤ) * bit (x 50) + (5266800:ℤ) * bit (x 51) + (-4974200:ℤ) * bit (x 54) + (-4883760:ℤ) * bit (x 55) + (-4796550:ℤ) * bit (x 56) + (-4712400:ℤ) * bit (x 57) + (-4476780:ℤ) * bit (x 60) + (4263600:ℤ) * bit (x 63) + (4069800:ℤ) * bit (x 66) + (-3950100:ℤ) * bit (x 68) + (3837240:ℤ) * bit (x 70) + (-3730650:ℤ) * bit (x 72) + (-3581424:ℤ) * bit (x 75) + (3534300:ℤ) * bit (x 76) + (-3488400:ℤ) * bit (x 77) + (-3357585:ℤ) * bit (x 80))) := bydsimp [t2]; linear_combination zhave mod2 : t2 % 13 = 0 := by rw [zero2,Int.mul_emod_right]obtain ⟨v2,r2⟩ := block2 (x 13) (x 26) (x 52) (x 65) (x 78) mod2change valid ((-t2)/4157010) (bit (x 13) + bit (x 26) + bit (x 52) + bit (x 65) + bit (x 78)) at v2change t2 = (-4157010) * ((-t2)/4157010) at r2let t3 : ℤ := (-158722200 : ℤ) * bit (x 22) + (-105814800 : ℤ) * bit (x 33) + (79361100 : ℤ) * bit (x 44) + (-63488880 : ℤ) * bit (x 55) + (52907400 : ℤ) * bit (x 66) + (-45349200 : ℤ) * bit (x 77)have zero3 : t3 = 11 * (-((317444400:ℤ) * bit (x 1) + (-35271600:ℤ) * bit (x 9) + (-26453700:ℤ) * bit (x 12) + (-24418800:ℤ) * bit (x 13) + (-22674600:ℤ) * bit (x 14) + (-18673200:ℤ) * bit (x 17) + (-17635800:ℤ) * bit (x 18) + (-16707600:ℤ) * bit (x 19) + (-15872220:ℤ) * bit (x 20) + (-15116400:ℤ) * bit (x 21) + (-13226850:ℤ) * bit (x 24) + (-12697776:ℤ) * bit (x 25) + (12209400:ℤ) * bit (x 26) + (-11757200:ℤ) * bit (x 27) + (-11337300:ℤ) * bit (x 28) + (-10581480:ℤ) * bit (x 30) + (-9336600:ℤ) * bit (x 34) + (-9069840:ℤ) * bit (x 35) + (-8817900:ℤ) * bit (x 36) + (-8353800:ℤ) * bit (x 38) + (7936110:ℤ) * bit (x 40) + (-7558200:ℤ) * bit (x 42) + (-7054320:ℤ) * bit (x 45) + (-6613425:ℤ) * bit (x 48) + (6348888:ℤ) * bit (x 50) + (6224400:ℤ) * bit (x 51) + (6104700:ℤ) * bit (x 52) + (-5878600:ℤ) * bit (x 54) + (-5668650:ℤ) * bit (x 56) + (-5569200:ℤ) * bit (x 57) + (-5290740:ℤ) * bit (x 60) + (5038800:ℤ) * bit (x 63) + (4883760:ℤ) * bit (x 65) + (-4668300:ℤ) * bit (x 68) + (4534920:ℤ) * bit (x 70) + (-4408950:ℤ) * bit (x 72) + (-4232592:ℤ) * bit (x 75) + (4176900:ℤ) * bit (x 76) + (-4069800:ℤ) * bit (x 78) + (-3968055:ℤ) * bit (x 80))) := bydsimp [t3]; linear_combination zhave mod3 : t3 % 11 = 0 := by rw [zero3,Int.mul_emod_right]obtain ⟨v3,r3⟩ := block3 (x 22) (x 33) (x 44) (x 55) (x 66) (x 77) mod3change valid ((-t3)/4157010) (bit (x 22) + bit (x 33) + bit (x 44) + bit (x 55) + bit (x 66) + bit (x 77)) at v3change t3 = (-4157010) * ((-t3)/4157010) at r3let t4 : ℤ := (-139675536 : ℤ) * bit (x 25) + (69837768 : ℤ) * bit (x 50) + (-46558512 : ℤ) * bit (x 75)have zero4 : t4 = 5 * (-((698377680:ℤ) * bit (x 1) + (-77597520:ℤ) * bit (x 9) + (-58198140:ℤ) * bit (x 12) + (-53721360:ℤ) * bit (x 13) + (-49884120:ℤ) * bit (x 14) + (-41081040:ℤ) * bit (x 17) + (-38798760:ℤ) * bit (x 18) + (-36756720:ℤ) * bit (x 19) + (-34918884:ℤ) * bit (x 20) + (-33256080:ℤ) * bit (x 21) + (-31744440:ℤ) * bit (x 22) + (-29099070:ℤ) * bit (x 24) + (26860680:ℤ) * bit (x 26) + (-25865840:ℤ) * bit (x 27) + (-24942060:ℤ) * bit (x 28) + (-23279256:ℤ) * bit (x 30) + (-21162960:ℤ) * bit (x 33) + (-20540520:ℤ) * bit (x 34) + (-19953648:ℤ) * bit (x 35) + (-19399380:ℤ) * bit (x 36) + (-18378360:ℤ) * bit (x 38) + (17459442:ℤ) * bit (x 40) + (-16628040:ℤ) * bit (x 42) + (15872220:ℤ) * bit (x 44) + (-15519504:ℤ) * bit (x 45) + (-14549535:ℤ) * bit (x 48) + (13693680:ℤ) * bit (x 51) + (13430340:ℤ) * bit (x 52) + (-12932920:ℤ) * bit (x 54) + (-12697776:ℤ) * bit (x 55) + (-12471030:ℤ) * bit (x 56) + (-12252240:ℤ) * bit (x 57) + (-11639628:ℤ) * bit (x 60) + (11085360:ℤ) * bit (x 63) + (10744272:ℤ) * bit (x 65) + (10581480:ℤ) * bit (x 66) + (-10270260:ℤ) * bit (x 68) + (9976824:ℤ) * bit (x 70) + (-9699690:ℤ) * bit (x 72) + (9189180:ℤ) * bit (x 76) + (-9069840:ℤ) * bit (x 77) + (-8953560:ℤ) * bit (x 78) + (-8729721:ℤ) * bit (x 80))) := bydsimp [t4]; linear_combination zhave mod4 : t4 % 5 = 0 := by rw [zero4,Int.mul_emod_right]obtain ⟨v4,r4⟩ := block4 (x 25) (x 50) (x 75) mod4change valid ((-t4)/4157010) (bit (x 25) + bit (x 50) + bit (x 75)) at v4change t4 = (-4157010) * ((-t4)/4157010) at r4let t5 : ℤ := (-387987600 : ℤ) * bit (x 9) + (-193993800 : ℤ) * bit (x 18) + (-129329200 : ℤ) * bit (x 27) + (-96996900 : ℤ) * bit (x 36) + (-77597520 : ℤ) * bit (x 45) + (-64664600 : ℤ) * bit (x 54) + (55426800 : ℤ) * bit (x 63) + (-48498450 : ℤ) * bit (x 72)have zero5 : t5 = 9 * (-((387987600:ℤ) * bit (x 1) + (-32332300:ℤ) * bit (x 12) + (-29845200:ℤ) * bit (x 13) + (-27713400:ℤ) * bit (x 14) + (-22822800:ℤ) * bit (x 17) + (-20420400:ℤ) * bit (x 19) + (-19399380:ℤ) * bit (x 20) + (-18475600:ℤ) * bit (x 21) + (-17635800:ℤ) * bit (x 22) + (-16166150:ℤ) * bit (x 24) + (-15519504:ℤ) * bit (x 25) + (14922600:ℤ) * bit (x 26) + (-13856700:ℤ) * bit (x 28) + (-12932920:ℤ) * bit (x 30) + (-11757200:ℤ) * bit (x 33) + (-11411400:ℤ) * bit (x 34) + (-11085360:ℤ) * bit (x 35) + (-10210200:ℤ) * bit (x 38) + (9699690:ℤ) * bit (x 40) + (-9237800:ℤ) * bit (x 42) + (8817900:ℤ) * bit (x 44) + (-8083075:ℤ) * bit (x 48) + (7759752:ℤ) * bit (x 50) + (7607600:ℤ) * bit (x 51) + (7461300:ℤ) * bit (x 52) + (-7054320:ℤ) * bit (x 55) + (-6928350:ℤ) * bit (x 56) + (-6806800:ℤ) * bit (x 57) + (-6466460:ℤ) * bit (x 60) + (5969040:ℤ) * bit (x 65) + (5878600:ℤ) * bit (x 66) + (-5705700:ℤ) * bit (x 68) + (5542680:ℤ) * bit (x 70) + (-5173168:ℤ) * bit (x 75) + (5105100:ℤ) * bit (x 76) + (-5038800:ℤ) * bit (x 77) + (-4974200:ℤ) * bit (x 78) + (-4849845:ℤ) * bit (x 80))) := bydsimp [t5]; linear_combination zhave mod5 : t5 % 9 = 0 := by rw [zero5,Int.mul_emod_right]obtain ⟨v5,r5⟩ := block5 (x 9) (x 18) (x 27) (x 36) (x 45) (x 54) (x 63) (x 72) mod5change valid ((-t5)/4157010) (bit (x 9) + bit (x 18) + bit (x 27) + bit (x 36) + bit (x 45) + bit (x 54) + bit (x 63) + bit (x 72)) at v5change t5 = (-4157010) * ((-t5)/4157010) at r5let t6 : ℤ := (-72747675 : ℤ) * bit (x 48) + (-43648605 : ℤ) * bit (x 80)have zero6 : t6 = 2 * (-((1745944200:ℤ) * bit (x 1) + (-193993800:ℤ) * bit (x 9) + (-145495350:ℤ) * bit (x 12) + (-134303400:ℤ) * bit (x 13) + (-124710300:ℤ) * bit (x 14) + (-102702600:ℤ) * bit (x 17) + (-96996900:ℤ) * bit (x 18) + (-91891800:ℤ) * bit (x 19) + (-87297210:ℤ) * bit (x 20) + (-83140200:ℤ) * bit (x 21) + (-79361100:ℤ) * bit (x 22) + (-72747675:ℤ) * bit (x 24) + (-69837768:ℤ) * bit (x 25) + (67151700:ℤ) * bit (x 26) + (-64664600:ℤ) * bit (x 27) + (-62355150:ℤ) * bit (x 28) + (-58198140:ℤ) * bit (x 30) + (-52907400:ℤ) * bit (x 33) + (-51351300:ℤ) * bit (x 34) + (-49884120:ℤ) * bit (x 35) + (-48498450:ℤ) * bit (x 36) + (-45945900:ℤ) * bit (x 38) + (43648605:ℤ) * bit (x 40) + (-41570100:ℤ) * bit (x 42) + (39680550:ℤ) * bit (x 44) + (-38798760:ℤ) * bit (x 45) + (34918884:ℤ) * bit (x 50) + (34234200:ℤ) * bit (x 51) + (33575850:ℤ) * bit (x 52) + (-32332300:ℤ) * bit (x 54) + (-31744440:ℤ) * bit (x 55) + (-31177575:ℤ) * bit (x 56) + (-30630600:ℤ) * bit (x 57) + (-29099070:ℤ) * bit (x 60) + (27713400:ℤ) * bit (x 63) + (26860680:ℤ) * bit (x 65) + (26453700:ℤ) * bit (x 66) + (-25675650:ℤ) * bit (x 68) + (24942060:ℤ) * bit (x 70) + (-24249225:ℤ) * bit (x 72) + (-23279256:ℤ) * bit (x 75) + (22972950:ℤ) * bit (x 76) + (-22674600:ℤ) * bit (x 77) + (-22383900:ℤ) * bit (x 78))) := bydsimp [t6]; linear_combination zhave mod6 : t6 % 2 = 0 := by rw [zero6,Int.mul_emod_right]obtain ⟨v6,r6⟩ := block6 (x 48) (x 80) mod6change valid ((-t6)/4157010) (bit (x 48) + bit (x 80)) at v6change t6 = (-4157010) * ((-t6)/4157010) at r6have combined := (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add (valid_add v0 v1) v2) v3) v4) v5) v6) (single12 (x 12))) (single14 (x 14))) (single20 (x 20))) (single21 (x 21))) (single24 (x 24))) (single28 (x 28))) (single30 (x 30))) (single35 (x 35))) (single42 (x 42))) (single56 (x 56))) (single60 (x 60)))let cost : ℤ := ((-t0)/4157010) + ((-t1)/4157010) + ((-t2)/4157010) + ((-t3)/4157010) + ((-t4)/4157010) + ((-t5)/4157010) + ((-t6)/4157010) + (70 * bit (x 12)) + (60 * bit (x 14)) + (42 * bit (x 20)) + (40 * bit (x 21)) + (35 * bit (x 24)) + (30 * bit (x 28)) + (28 * bit (x 30)) + (24 * bit (x 35)) + (20 * bit (x 42)) + (15 * bit (x 56)) + (14 * bit (x 60))let amount : ℤ := bit (x 19) + bit (x 38) + bit (x 57) + bit (x 76) + bit (x 17) + bit (x 34) + bit (x 51) + bit (x 68) + bit (x 13) + bit (x 26) + bit (x 52) + bit (x 65) + bit (x 78) + bit (x 22) + bit (x 33) + bit (x 44) + bit (x 55) + bit (x 66) + bit (x 77) + bit (x 25) + bit (x 50) + bit (x 75) + bit (x 9) + bit (x 18) + bit (x 27) + bit (x 36) + bit (x 45) + bit (x 54) + bit (x 63) + bit (x 72) + bit (x 48) + bit (x 80) + bit (x 12) + bit (x 14) + bit (x 20) + bit (x 21) + bit (x 24) + bit (x 28) + bit (x 30) + bit (x 35) + bit (x 42) + bit (x 56) + bit (x 60)have layout : valid cost amount := bydsimp only [cost,amount]simpa only [add_assoc] using combinedhave combine_linear : t0 + t1 + t2 + t3 + t4 + t5 + t6 + (3491888400 : ℤ) * bit (x 1) + (-290990700 : ℤ) * bit (x 12) + (-249420600 : ℤ) * bit (x 14) + (-174594420 : ℤ) * bit (x 20) + (-166280400 : ℤ) * bit (x 21) + (-145495350 : ℤ) * bit (x 24) + (-124710300 : ℤ) * bit (x 28) + (-116396280 : ℤ) * bit (x 30) + (-99768240 : ℤ) * bit (x 35) + (87297210 : ℤ) * bit (x 40) + (-83140200 : ℤ) * bit (x 42) + (-62355150 : ℤ) * bit (x 56) + (-58198140 : ℤ) * bit (x 60) + (49884120 : ℤ) * bit (x 70) = 0 := bydsimp only [t0,t1,t2,t3,t4,t5,t6]; linear_combination zhave small : cost = 21 * bit (x 40) + 12 * bit (x 70) := byrw [r0,r1,r2,r3,r4,r5,r6] at combine_linearrw [anchor] at combine_lineardsimp only [cost]have hb : bit false = 0 := rflrw [hb] at combine_linearlinarith only [combine_linear]have edge : ∀ b c : Bool, good (21 * bit b + 12 * bit c) → bit b = 0 ∧ bit c = 0 := by decide +kernelobtain ⟨e40,e70⟩ := edge (x 40) (x 70) (small ▸ layout.1)have cz : cost = 0 := by rw [small,e40,e70]; norm_numhave az := layout.2 czdsimp only [amount] at azunfold chosenrw [anchor,e40,e70]change _ = _have hz : bit false = 0 := rflrw [hz]linear_combination aztheorem zero_count (x : ℕ → Bool) (z : linear x = 0) : chosen x = 0 ∨ chosen x = 46 := bycases h : x 1· exact Or.inl (zero_without_anchor x h z)· rightlet y : ℕ → Bool := fun n => !(x n)have flip (b : Bool) : bit (!b) = 1 - bit b := by cases b <;> decidehave y1 : y 1 = false := by simp [y,h]have yz : linear y = 0 := byunfold linear at z ⊢simp only [y,flip]linear_combination -zhave hy := zero_without_anchor y y1 yzunfold chosen at hy ⊢simp only [y,flip] at hylinear_combination -hyopen Finsetprivate def indices : List ℕ := [1, 9, 12, 13, 14, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 30, 33, 34, 35, 36, 38, 40, 42, 44, 45, 48, 50, 51, 52, 54, 55, 56, 57, 60, 63, 65, 66, 68, 70, 72, 75, 76, 77, 78, 80]def support : Finset ℕ := indices.toFinsetprivate def positive : List ℕ := [1, 26, 40, 44, 50, 51, 52, 63, 65, 66, 70, 76]def sign (n : ℕ) : ℤˣ := if n ∈ positive then 1 else -1private def weight (n : ℕ) : ℤ := if n ∈ positive then (3491888400:ℤ)/n else -((3491888400:ℤ)/n)private def mask (B : Finset ℕ) (n : ℕ) : Bool := decide (n ∈ B)private theorem list_sum {G : Type*} [AddCommMonoid G] (f : ℕ → G) (l : List ℕ) (h : l.Nodup) :∑ n ∈ l.toFinset, f n = (l.map f).sum := byinduction l with| nil => simp| cons a t ih =>obtain ⟨ha,ht⟩ := List.nodup_cons.mp hsimp only [List.toFinset_cons, Finset.sum_insert (by simpa using ha : a ∉ t.toFinset),List.map_cons, List.sum_cons, ih ht]private theorem expand_support {G : Type*} [AddCommMonoid G] (f : ℕ → G) :∑ n ∈ support, f n = f 1 + f 9 + f 12 + f 13 + f 14 + f 17 + f 18 + f 19 + f 20 + f 21 + f 22 + f 24 + f 25 + f 26 + f 27 + f 28 + f 30 + f 33 + f 34 + f 35 + f 36 + f 38 + f 40 + f 42 + f 44 + f 45 + f 48 + f 50 + f 51 + f 52 + f 54 + f 55 + f 56 + f 57 + f 60 + f 63 + f 65 + f 66 + f 68 + f 70 + f 72 + f 75 + f 76 + f 77 + f 78 + f 80 := byrw [support,list_sum f indices (by decide +kernel)]simp only [indices,List.map_cons,List.map_nil,List.sum_cons,List.sum_nil,add_zero,add_assoc]private theorem restrict_sum {G : Type*} [AddCommMonoid G] (B : Finset ℕ) (h : B ⊆ support) (f : ℕ → G) :(∑ n ∈ support, if n ∈ B then f n else 0) = ∑ n ∈ B, f n := byrw [← Finset.sum_filter]have he : support.filter (fun n => n ∈ B) = B := byext n; simp only [Finset.mem_filter]; exact ⟨And.right, fun hn => ⟨h hn,hn⟩⟩rw [he]private theorem weight1 : weight 1 = 3491888400 := by decide +kernelprivate theorem weight9 : weight 9 = -387987600 := by decide +kernelprivate theorem weight12 : weight 12 = -290990700 := by decide +kernelprivate theorem weight13 : weight 13 = -268606800 := by decide +kernelprivate theorem weight14 : weight 14 = -249420600 := by decide +kernelprivate theorem weight17 : weight 17 = -205405200 := by decide +kernelprivate theorem weight18 : weight 18 = -193993800 := by decide +kernelprivate theorem weight19 : weight 19 = -183783600 := by decide +kernelprivate theorem weight20 : weight 20 = -174594420 := by decide +kernelprivate theorem weight21 : weight 21 = -166280400 := by decide +kernelprivate theorem weight22 : weight 22 = -158722200 := by decide +kernelprivate theorem weight24 : weight 24 = -145495350 := by decide +kernelprivate theorem weight25 : weight 25 = -139675536 := by decide +kernelprivate theorem weight26 : weight 26 = 134303400 := by decide +kernelprivate theorem weight27 : weight 27 = -129329200 := by decide +kernelprivate theorem weight28 : weight 28 = -124710300 := by decide +kernelprivate theorem weight30 : weight 30 = -116396280 := by decide +kernelprivate theorem weight33 : weight 33 = -105814800 := by decide +kernelprivate theorem weight34 : weight 34 = -102702600 := by decide +kernelprivate theorem weight35 : weight 35 = -99768240 := by decide +kernelprivate theorem weight36 : weight 36 = -96996900 := by decide +kernelprivate theorem weight38 : weight 38 = -91891800 := by decide +kernelprivate theorem weight40 : weight 40 = 87297210 := by decide +kernelprivate theorem weight42 : weight 42 = -83140200 := by decide +kernelprivate theorem weight44 : weight 44 = 79361100 := by decide +kernelprivate theorem weight45 : weight 45 = -77597520 := by decide +kernelprivate theorem weight48 : weight 48 = -72747675 := by decide +kernelprivate theorem weight50 : weight 50 = 69837768 := by decide +kernelprivate theorem weight51 : weight 51 = 68468400 := by decide +kernelprivate theorem weight52 : weight 52 = 67151700 := by decide +kernelprivate theorem weight54 : weight 54 = -64664600 := by decide +kernelprivate theorem weight55 : weight 55 = -63488880 := by decide +kernelprivate theorem weight56 : weight 56 = -62355150 := by decide +kernelprivate theorem weight57 : weight 57 = -61261200 := by decide +kernelprivate theorem weight60 : weight 60 = -58198140 := by decide +kernelprivate theorem weight63 : weight 63 = 55426800 := by decide +kernelprivate theorem weight65 : weight 65 = 53721360 := by decide +kernelprivate theorem weight66 : weight 66 = 52907400 := by decide +kernelprivate theorem weight68 : weight 68 = -51351300 := by decide +kernelprivate theorem weight70 : weight 70 = 49884120 := by decide +kernelprivate theorem weight72 : weight 72 = -48498450 := by decide +kernelprivate theorem weight75 : weight 75 = -46558512 := by decide +kernelprivate theorem weight76 : weight 76 = 45945900 := by decide +kernelprivate theorem weight77 : weight 77 = -45349200 := by decide +kernelprivate theorem weight78 : weight 78 = -44767800 := by decide +kernelprivate theorem weight80 : weight 80 = -43648605 := by decide +kernelprivate theorem mask_linear (B : Finset ℕ) (h : B ⊆ support) : linear (mask B) = ∑ n ∈ B, weight n := bycalclinear (mask B) = ∑ n ∈ support, weight n * bit (mask B n) := byrw [expand_support]simp only [linear,weight1,weight9,weight12,weight13,weight14,weight17,weight18,weight19,weight20,weight21,weight22,weight24,weight25,weight26,weight27,weight28,weight30,weight33,weight34,weight35,weight36,weight38,weight40,weight42,weight44,weight45,weight48,weight50,weight51,weight52,weight54,weight55,weight56,weight57,weight60,weight63,weight65,weight66,weight68,weight70,weight72,weight75,weight76,weight77,weight78,weight80]_ = ∑ n ∈ support, if n ∈ B then weight n else 0 := byapply Finset.sum_congr rfl; intro n _by_cases hj : n ∈ B <;> simp [mask,bit,hj]_ = _ := restrict_sum B h weightprivate theorem mask_chosen (B : Finset ℕ) (h : B ⊆ support) : chosen (mask B) = (B.card : ℤ) := bycalcchosen (mask B) = ∑ n ∈ support, bit (mask B n) := by rw [expand_support]; rfl_ = ∑ n ∈ support, if n ∈ B then (1:ℤ) else 0 := byapply Finset.sum_congr rfl; intro n _; by_cases hj : n ∈ B <;> simp [mask,bit,hj]_ = ∑ _n ∈ B, (1:ℤ) := restrict_sum B h (fun _ => 1)_ = (B.card : ℤ) := by simpprivate theorem weight_on : ∀ n ∈ support, ((weight n : ℤ):ℚ) = 3491888400 * ((sign n : ℚ)/n) := by decide +kerneltheorem primitive80 : support ⊆ Finset.Icc 1 80 ∧ support.card = 46 ∧(∑ n ∈ support, (sign n : ℚ) / n) = 0 ∧∀ B ⊂ support, B.Nonempty → (∑ n ∈ B, (sign n : ℚ)/n) ≠ 0 := byhave hcard : support.card = 46 := by decide +kernelrefine ⟨by decide +kernel,hcard,by decide +kernel,?_⟩intro B hB hn zhave sub := (Finset.ssubset_iff_subset_ne.mp hB).1have wz : ((linear (mask B):ℤ):ℚ) = 0 := byrw [mask_linear B sub, Int.cast_sum]calc∑ n ∈ B, ((weight n : ℤ):ℚ) = ∑ n ∈ B, 3491888400 * ((sign n:ℚ)/n) := Finset.sum_congr rfl (fun n hn => weight_on n (sub hn))_ = 0 := by rw [← Finset.mul_sum,z,mul_zero]have iz : linear (mask B) = 0 := by exact_mod_cast wzhave hi := zero_count (mask B) izrw [mask_chosen B sub] at hihave lo : 0 < B.card := Finset.card_pos.mpr hnhave high := Finset.card_lt_card hBomegatheorem exists_primitive_of_ge80 {N : ℕ} (hN : 80 ≤ N) :∃ A : Finset ℕ, A ⊆ Finset.Icc 1 N ∧ A.card = 46 ∧∃ δ : ℕ → ℤˣ, (∑ n ∈ A, (δ n : ℚ)/n) = 0 ∧∀ B ⊂ A, B.Nonempty → (∑ n ∈ B, (δ n : ℚ)/n) ≠ 0 := byobtain ⟨inc,card,total,proper⟩ := primitive80refine ⟨support,?_,card,sign,total,proper⟩intro n hnhave bounds := Finset.mem_Icc.mp (inc hn)exact Finset.mem_Icc.mpr ⟨bounds.1,bounds.2.trans hN⟩#print axioms exists_primitive_of_ge80#print axioms zero_count#print axioms primitive80end Erdos319Witness