File: Mathlib/Data/Nat/Factorization/Root.lean

full_name: Nat.floorRoot
code: /-- Flooring root of a natural number. This divides the valuation of every prime number rounding
down.

Eg if `n = 2`, `a = 2^3 * 3^2 * 5`, then `floorRoot n a = 2 * 3`.

In order theory terms, this is the upper or right adjoint of the map `a ↦ a ^ n : ℕ → ℕ` where `ℕ`
is ordered by divisibility.

To ensure that the adjunction (`Nat.pow_dvd_iff_dvd_floorRoot`) holds in as many cases as possible,
we special-case the following values:
* `floorRoot 0 a = 0`
* `floorRoot n 0 = 0`
-/
def floorRoot (n a : ℕ) : ℕ 
goal: ℕ

full_name: Nat.floorRoot_def
code: /-- The RHS is a noncomputable version of `Nat.floorRoot` with better order theoretical
properties. -/
lemma floorRoot_def :
    floorRoot n a = if n = 0 ∨ a = 0 then 0 else (a.factorization ⌊/⌋ n).prod (· ^ ·) 
goal: n.floorRoot a = if n = 0 ∨ a = 0 then 0 else (a.factorization ⌊/⌋ n).prod fun x x_1 => x ^ x_1

full_name: Nat.floorRoot_zero_left
code: @[simp] lemma floorRoot_zero_left (a : ℕ) : floorRoot 0 a = 0 
goal: Nat.floorRoot 0 a = 0

full_name: Nat.floorRoot_zero_right
code: @[simp] lemma floorRoot_zero_right (n : ℕ) : floorRoot n 0 = 0 
goal: n.floorRoot 0 = 0

full_name: Nat.floorRoot_one_left
code: @[simp] lemma floorRoot_one_left (a : ℕ) : floorRoot 1 a = a 
goal: Nat.floorRoot 1 a = a

full_name: Nat.floorRoot_one_right
code: @[simp] lemma floorRoot_one_right (hn : n ≠ 0) : floorRoot n 1 = 1 
goal: n.floorRoot 1 = 1

full_name: Nat.floorRoot_pow_self
code: @[simp] lemma floorRoot_pow_self (hn : n ≠ 0) (a : ℕ) : floorRoot n (a ^ n) = a 
goal: n.floorRoot (a ^ n) = a

full_name: Nat.floorRoot_ne_zero
code: lemma floorRoot_ne_zero : floorRoot n a ≠ 0 ↔ n ≠ 0 ∧ a ≠ 0 
goal: n.floorRoot a ≠ 0 ↔ n ≠ 0 ∧ a ≠ 0

full_name: Nat.floorRoot_eq_zero
code: @[simp] lemma floorRoot_eq_zero : floorRoot n a = 0 ↔ n = 0 ∨ a = 0 
goal: n.floorRoot a = 0 ↔ n = 0 ∨ a = 0

full_name: Nat.factorization_floorRoot
code: @[simp] lemma factorization_floorRoot (n a : ℕ) :
    (floorRoot n a).factorization = a.factorization ⌊/⌋ n 
goal: (n.floorRoot a).factorization = a.factorization ⌊/⌋ n

full_name: Nat.pow_dvd_iff_dvd_floorRoot
code: /-- Galois connection between `a ↦ a ^ n : ℕ → ℕ` and `floorRoot n : ℕ → ℕ` where `ℕ` is ordered
by divisibility. -/
lemma pow_dvd_iff_dvd_floorRoot : a ^ n ∣ b ↔ a ∣ floorRoot n b 
goal: a ^ n ∣ b ↔ a ∣ n.floorRoot b

full_name: Nat.floorRoot_pow_dvd
code: lemma floorRoot_pow_dvd : floorRoot n a ^ n ∣ a 
goal: n.floorRoot a ^ n ∣ a

full_name: Nat.ceilRoot
code: /-- Ceiling root of a natural number. This divides the valuation of every prime number rounding up.

Eg if `n = 3`, `a = 2^4 * 3^2 * 5`, then `ceilRoot n a = 2^2 * 3 * 5`.

In order theory terms, this is the lower or left adjoint of the map `a ↦ a ^ n : ℕ → ℕ` where `ℕ`
is ordered by divisibility.

To ensure that the adjunction (`Nat.dvd_pow_iff_ceilRoot_dvd`) holds in as many cases as possible,
we special-case the following values:
* `ceilRoot 0 a = 0` (this one is not strictly necessary)
* `ceilRoot n 0 = 0`
-/
def ceilRoot (n a : ℕ) : ℕ 
goal: ℕ

full_name: Nat.ceilRoot_def
code: /-- The RHS is a noncomputable version of `Nat.ceilRoot` with better order theoretical
properties. -/
lemma ceilRoot_def :
    ceilRoot n a = if n = 0 ∨ a = 0 then 0 else (a.factorization ⌈/⌉ n).prod (· ^ ·) 
goal: n.ceilRoot a = if n = 0 ∨ a = 0 then 0 else (a.factorization ⌈/⌉ n).prod fun x x_1 => x ^ x_1

full_name: Nat.ceilRoot_zero_left
code: @[simp] lemma ceilRoot_zero_left (a : ℕ) : ceilRoot 0 a = 0 
goal: Nat.ceilRoot 0 a = 0

full_name: Nat.ceilRoot_zero_right
code: @[simp] lemma ceilRoot_zero_right (n : ℕ) : ceilRoot n 0 = 0 
goal: n.ceilRoot 0 = 0

full_name: Nat.ceilRoot_one_left
code: @[simp] lemma ceilRoot_one_left (a : ℕ) : ceilRoot 1 a = a 
goal: Nat.ceilRoot 1 a = a

full_name: Nat.ceilRoot_one_right
code: @[simp] lemma ceilRoot_one_right (hn : n ≠ 0) : ceilRoot n 1 = 1 
goal: n.ceilRoot 1 = 1

full_name: Nat.ceilRoot_pow_self
code: @[simp] lemma ceilRoot_pow_self (hn : n ≠ 0) (a : ℕ) : ceilRoot n (a ^ n) = a 
goal: n.ceilRoot (a ^ n) = a

full_name: Nat.ceilRoot_ne_zero
code: lemma ceilRoot_ne_zero : ceilRoot n a ≠ 0 ↔ n ≠ 0 ∧ a ≠ 0 
goal: n.ceilRoot a ≠ 0 ↔ n ≠ 0 ∧ a ≠ 0

full_name: Nat.ceilRoot_eq_zero
code: @[simp] lemma ceilRoot_eq_zero : ceilRoot n a = 0 ↔ n = 0 ∨ a = 0 
goal: n.ceilRoot a = 0 ↔ n = 0 ∨ a = 0

full_name: Nat.factorization_ceilRoot
code: @[simp] lemma factorization_ceilRoot (n a : ℕ) :
    (ceilRoot n a).factorization = a.factorization ⌈/⌉ n 
goal: (n.ceilRoot a).factorization = a.factorization ⌈/⌉ n

full_name: Nat.dvd_pow_iff_ceilRoot_dvd
code: /-- Galois connection between `ceilRoot n : ℕ → ℕ` and `a ↦ a ^ n : ℕ → ℕ` where `ℕ` is ordered
by divisibility.

Note that this cannot possibly hold for `n = 0`, regardless of the value of `ceilRoot 0 a`, because
the statement reduces to `a = 1 ↔ ceilRoot 0 a ∣ b`, which is false for eg `a = 0`,
`b = ceilRoot 0 a`. -/
lemma dvd_pow_iff_ceilRoot_dvd (hn : n ≠ 0) : a ∣ b ^ n ↔ ceilRoot n a ∣ b 
goal: a ∣ b ^ n ↔ n.ceilRoot a ∣ b

full_name: Nat.dvd_ceilRoot_pow
code: lemma dvd_ceilRoot_pow (hn : n ≠ 0) : a ∣ ceilRoot n a ^ n 
goal: a ∣ n.ceilRoot a ^ n