/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import Mathlib.Algebra.Squarefree.Basic@[expose] public sectionvariable {M M₀ : Type*} {r m : M} {k : }section Monoidvariable [Monoid M]def Powerfree (k : ) (m : M) : Prop := x : M, x ^ k m IsUnit xtheorem Powerfree.of_le {a b : } (hab : a b) (hm : Powerfree a m) : Powerfree b m := fun x hx => hm (dvd_of_mul_right_dvd (pow_mul_pow_sub x hab hx))theorem Powerfree.of_dvd (hrm : r m) (hm : Powerfree k m) : Powerfree k r := fun _ hx => hm (hx.trans hrm)theorem powerfree_congr (hrm : Associated r m) : Powerfree k r Powerfree k m := fun h => h.of_dvd hrm.dvd', fun h => h.of_dvd hrm.dvd@[simp] theorem powerfree_neg [HasDistribNeg M] : Powerfree k (-m) Powerfree k m := powerfree_congr (Associated.refl m).neg_left@[simp] theorem powerfree_two {m : M} : Powerfree 2 m Squarefree m where mp h x hx := h (sq x hx) mpr h x hx := h x (sq x hx)end Monoidsection CommMonoidvariable [CommMonoid M]theorem IsUnit.powerfree (h : IsUnit m) (hk : k 0) : Powerfree k m := fun _ hx => (isUnit_pow_iff hk).1 (isUnit_of_dvd_unit hx h)@[simp] theorem powerfree_one (hk : k 0) : Powerfree k (1 : M) := isUnit_one.powerfree hkM:Type u_1m:Mk:inst✝:CommMonoid Mh:Irreducible my:Mz:Mn:ih:2 n m = y ^ n * z IsUnit yhk:2 n + 1hz:m = y ^ n * (y * z)IsUnit y M:Type u_1m:Mk:inst✝:CommMonoid Mh:Irreducible my:Mz:Mn:ih:2 n m = y ^ n * z IsUnit yhk:2 n + 1hz:m = y ^ n * (y * z)hu:IsUnit (y ^ n)IsUnit yM:Type u_1m:Mk:inst✝:CommMonoid Mh:Irreducible my:Mz:Mn:ih:2 n m = y ^ n * z IsUnit yhk:2 n + 1hz:m = y ^ n * (y * z)hu:IsUnit (y * z)IsUnit y M:Type u_1m:Mk:inst✝:CommMonoid Mh:Irreducible my:Mz:Mn:ih:2 n m = y ^ n * z IsUnit yhk:2 n + 1hz:m = y ^ n * (y * z)hu:IsUnit (y ^ n)IsUnit y exact (isUnit_pow_iff (M:Type u_1m:Mk:inst✝:CommMonoid Mh:Irreducible my:Mz:Mn:ih:2 n m = y ^ n * z IsUnit yhk:2 n + 1hz:m = y ^ n * (y * z)hu:IsUnit (y ^ n)n 0 All goals completed! 🐙)).1 hu M:Type u_1m:Mk:inst✝:CommMonoid Mh:Irreducible my:Mz:Mn:ih:2 n m = y ^ n * z IsUnit yhk:2 n + 1hz:m = y ^ n * (y * z)hu:IsUnit (y * z)IsUnit y All goals completed! 🐙end CommMonoidM₀:Type u_2inst✝¹:MonoidWithZero M₀inst✝:Nontrivial M₀k: x, ¬(x ^ k 0 IsUnit x) exact 0, M₀:Type u_2inst✝¹:MonoidWithZero M₀inst✝:Nontrivial M₀k:¬(0 ^ k 0 IsUnit 0) All goals completed! 🐙theorem Prime.powerfree [CommMonoidWithZero M₀] [IsCancelMulZero M₀] {m : M₀} (h : Prime m) (hk : 2 k) : Powerfree k m := h.irreducible.powerfree hk