Theorem: Nat.factorization_gcd
File: Mathlib/Data/Nat/Factorization/Basic.lean

Proof steps:
state_before: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
state_after: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
tactic: let dfac := a.factorization ⊓ b.factorization
state_before: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
state_after: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
tactic: have dfac_prime : ∀ p : ℕ, p ∈ dfac.support → Prime p := by
    intro p hp
    have : p ∈ a.primeFactorsList ∧ p ∈ b.primeFactorsList := by simpa [dfac] using hp
    exact prime_of_mem_primeFactorsList this.1
state_before: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
state_after: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
tactic: have h1 : d.factorization = dfac := prod_pow_factorization_eq_self dfac_prime
state_before: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
state_after: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
hd_pos : d ≠ 0
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
tactic: have hd_pos : d ≠ 0 := (factorizationEquiv.invFun ⟨dfac, dfac_prime⟩).2.ne'
state_before: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
hd_pos : d ≠ 0
⊢ (a.gcd b).factorization = a.factorization ⊓ b.factorization
state_after: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
hd_pos : d ≠ 0
⊢ d = a.gcd b
tactic: suffices d = gcd a b by rwa [← this]
state_before: a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
hd_pos : d ≠ 0
⊢ d = a.gcd b
state_after: case hda
a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
hd_pos : d ≠ 0
⊢ d ∣ a

case hdb
a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
hd_pos : d ≠ 0
⊢ d ∣ b

case hd
a✝ b✝ m n p a b : ℕ
ha_pos : a ≠ 0
hb_pos : b ≠ 0
dfac : ℕ →₀ ℕ := a.factorization ⊓ b.factorization
d : ℕ := dfac.prod fun x x_1 => x ^ x_1
dfac_prime : ∀ p ∈ dfac.support, Prime p
h1 : d.factorization = dfac
hd_pos : d ≠ 0
⊢ ∀ (e : ℕ), e ∣ a → e ∣ b → e ∣ d
tactic: apply gcd_greatest