Theorem: Nat.Squarefree.ext_iff
File: Mathlib/Data/Nat/Squarefree.lean

tactic: refine ⟨by rintro rfl; simp, fun h => eq_of_factorization_eq hn.ne_zero hm.ne_zero fun p => ?_⟩
state_before: s : Finset ℕ
m✝ n✝ p n m : ℕ
hn : Squarefree n
hm : Squarefree m
⊢ n = m ↔ ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
state_after: s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
⊢ n.factorization p = m.factorization p

tactic: by_cases hp : p.Prime
state_before: s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
⊢ n.factorization p = m.factorization p
state_after: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
⊢ n.factorization p = m.factorization p

case neg
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : ¬Prime p
⊢ n.factorization p = m.factorization p

tactic: rw [factorization_eq_zero_of_non_prime _ hp, factorization_eq_zero_of_non_prime _ hp]
state_before: case neg
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : ¬Prime p
⊢ n.factorization p = m.factorization p
state_after: no goals

tactic: rintro rfl
state_before: s : Finset ℕ
m✝ n✝ p n m : ℕ
hn : Squarefree n
hm : Squarefree m
⊢ n = m → ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
state_after: s : Finset ℕ
m n✝ p n : ℕ
hn hm : Squarefree n
⊢ ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ n)

tactic: simp
state_before: s : Finset ℕ
m n✝ p n : ℕ
hn hm : Squarefree n
⊢ ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ n)
state_after: no goals

tactic: have h₁ := h _ hp
state_before: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
⊢ n.factorization p = m.factorization p
state_after: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : p ∣ n ↔ p ∣ m
⊢ n.factorization p = m.factorization p

tactic: rw [← not_iff_not, hp.dvd_iff_one_le_factorization hn.ne_zero, not_le, lt_one_iff,
  hp.dvd_iff_one_le_factorization hm.ne_zero, not_le, lt_one_iff] at h₁
state_before: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : p ∣ n ↔ p ∣ m
⊢ n.factorization p = m.factorization p
state_after: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
⊢ n.factorization p = m.factorization p

tactic: have h₂ := hn.natFactorization_le_one p
state_before: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
⊢ n.factorization p = m.factorization p
state_after: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₂ : n.factorization p ≤ 1
⊢ n.factorization p = m.factorization p

tactic: have h₃ := hm.natFactorization_le_one p
state_before: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₂ : n.factorization p ≤ 1
⊢ n.factorization p = m.factorization p
state_after: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₂ : n.factorization p ≤ 1
h₃ : m.factorization p ≤ 1
⊢ n.factorization p = m.factorization p

tactic: rw [Nat.le_add_one_iff, Nat.le_zero] at h₂ h₃
state_before: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₂ : n.factorization p ≤ 1
h₃ : m.factorization p ≤ 1
⊢ n.factorization p = m.factorization p
state_after: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₂ : n.factorization p = 0 ∨ n.factorization p = 0 + 1
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
⊢ n.factorization p = m.factorization p

tactic: cases' h₂ with h₂ h₂
state_before: case pos
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₂ : n.factorization p = 0 ∨ n.factorization p = 0 + 1
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
⊢ n.factorization p = m.factorization p
state_after: case pos.inl
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
h₂ : n.factorization p = 0
⊢ n.factorization p = m.factorization p

case pos.inr
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
h₂ : n.factorization p = 0 + 1
⊢ n.factorization p = m.factorization p

tactic: rwa [h₂, eq_comm, ← h₁]
state_before: case pos.inl
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
h₂ : n.factorization p = 0
⊢ n.factorization p = m.factorization p
state_after: no goals

tactic: rw [h₂, h₃.resolve_left]
state_before: case pos.inr
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
h₂ : n.factorization p = 0 + 1
⊢ n.factorization p = m.factorization p
state_after: case pos.inr
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
h₂ : n.factorization p = 0 + 1
⊢ ¬m.factorization p = 0

tactic: rw [← h₁, h₂]
state_before: case pos.inr
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
h₂ : n.factorization p = 0 + 1
⊢ ¬m.factorization p = 0
state_after: case pos.inr
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
h₂ : n.factorization p = 0 + 1
⊢ ¬0 + 1 = 0

tactic: simp only [Nat.one_ne_zero, not_false_iff]
state_before: case pos.inr
s : Finset ℕ
m✝ n✝ p✝ n m : ℕ
hn : Squarefree n
hm : Squarefree m
h : ∀ (p : ℕ), Prime p → (p ∣ n ↔ p ∣ m)
p : ℕ
hp : Prime p
h₁ : n.factorization p = 0 ↔ m.factorization p = 0
h₃ : m.factorization p = 0 ∨ m.factorization p = 0 + 1
h₂ : n.factorization p = 0 + 1
⊢ ¬0 + 1 = 0
state_after: no goals