Theorem: Nat.ArithmeticFunction.prod_eq_iff_prod_pow_moebius_eq_of_nonzero
File: Mathlib/NumberTheory/ArithmeticFunction.lean

tactic: refine'
    Iff.trans
      (Iff.trans (forall_congr' fun n => _)
        (@prod_eq_iff_prod_pow_moebius_eq Rˣ _
          (fun n => if h : 0 < n then Units.mk0 (f n) (hf n h) else 1) fun n =>
          if h : 0 < n then Units.mk0 (g n) (hg n h) else 1))
      (forall_congr' fun n => _) <;>
  refine' imp_congr_right fun hn => _
state_before: R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
⊢ (∀ (n : ℕ), 0 < n → ∏ i in divisors n, f i = g n) ↔
    ∀ (n : ℕ), 0 < n → ∏ x in divisorsAntidiagonal n, g x.snd ^ ↑μ x.fst = f n

tactic: dsimp
state_before: case refine'_1
R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
n : ℕ
hn : 0 < n
⊢ ∏ i in divisors n, f i = g n ↔
    (∏ i in divisors n, if h : 0 < i then Units.mk0 (f i) (_ : f i ≠ 0) else 1) =
      if h : 0 < n then Units.mk0 (g n) (_ : g n ≠ 0) else 1

tactic: rw [dif_pos hn, ← Units.eq_iff, ← Units.coeHom_apply, map_prod, Units.val_mk0,
  prod_congr rfl _]
state_before: case refine'_1
R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
n : ℕ
hn : 0 < n
⊢ ∏ i in divisors n, f i = g n ↔
    (∏ i in divisors n, if h : 0 < i then Units.mk0 (f i) (_ : f i ≠ 0) else 1) =
      if h : 0 < n then Units.mk0 (g n) (_ : g n ≠ 0) else 1

tactic: intro x hx
state_before: R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
n : ℕ
hn : 0 < n
⊢ ∀ (x : ℕ), x ∈ divisors n → f x = ↑(Units.coeHom R) (if h : 0 < x then Units.mk0 (f x) (_ : f x ≠ 0) else 1)

tactic: rw [dif_pos (Nat.pos_of_mem_divisors hx), Units.coeHom_apply, Units.val_mk0]
state_before: R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
n : ℕ
hn : 0 < n
x : ℕ
hx : x ∈ divisors n
⊢ f x = ↑(Units.coeHom R) (if h : 0 < x then Units.mk0 (f x) (_ : f x ≠ 0) else 1)

tactic: dsimp
state_before: case refine'_2
R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
n : ℕ
hn : 0 < n
⊢ (∏ x in divisorsAntidiagonal n, (if h : 0 < x.snd then Units.mk0 (g x.snd) (_ : g x.snd ≠ 0) else 1) ^ ↑μ x.fst =
      if h : 0 < n then Units.mk0 (f n) (_ : f n ≠ 0) else 1) ↔
    ∏ x in divisorsAntidiagonal n, g x.snd ^ ↑μ x.fst = f n

tactic: rw [dif_pos hn, ← Units.eq_iff, ← Units.coeHom_apply, map_prod, Units.val_mk0,
  prod_congr rfl _]
state_before: case refine'_2
R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
n : ℕ
hn : 0 < n
⊢ (∏ x in divisorsAntidiagonal n, (if h : 0 < x.snd then Units.mk0 (g x.snd) (_ : g x.snd ≠ 0) else 1) ^ ↑μ x.fst =
      if h : 0 < n then Units.mk0 (f n) (_ : f n ≠ 0) else 1) ↔
    ∏ x in divisorsAntidiagonal n, g x.snd ^ ↑μ x.fst = f n

tactic: intro x hx
state_before: R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
n : ℕ
hn : 0 < n
⊢ ∀ (x : ℕ × ℕ),
    x ∈ divisorsAntidiagonal n →
      ↑(Units.coeHom R) ((if h : 0 < x.snd then Units.mk0 (g x.snd) (_ : g x.snd ≠ 0) else 1) ^ ↑μ x.fst) =
        g x.snd ^ ↑μ x.fst

tactic: rw [dif_pos (Nat.pos_of_mem_divisors (Nat.snd_mem_divisors_of_mem_antidiagonal hx)),
  Units.coeHom_apply, Units.val_zpow_eq_zpow_val, Units.val_mk0]
state_before: R : Type u_1
inst✝ : CommGroupWithZero R
f g : ℕ → R
hf : ∀ (n : ℕ), 0 < n → f n ≠ 0
hg : ∀ (n : ℕ), 0 < n → g n ≠ 0
n : ℕ
hn : 0 < n
x : ℕ × ℕ
hx : x ∈ divisorsAntidiagonal n
⊢ ↑(Units.coeHom R) ((if h : 0 < x.snd then Units.mk0 (g x.snd) (_ : g x.snd ≠ 0) else 1) ^ ↑μ x.fst) =
    g x.snd ^ ↑μ x.fst