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

tactic: dsimp only [minSqFac]
state_before: s : Finset ℕ
m n✝ p n : ℕ
⊢ n.MinSqFacProp n.minSqFac
state_after: s : Finset ℕ
m n✝ p n : ℕ
⊢ n.MinSqFacProp (if 2 ∣ n then if 2 ∣ n / 2 then some 2 else (n / 2).minSqFacAux 3 else n.minSqFacAux 3)

tactic: split_ifs with d2 d4
state_before: s : Finset ℕ
m n✝ p n : ℕ
⊢ n.MinSqFacProp (if 2 ∣ n then if 2 ∣ n / 2 then some 2 else (n / 2).minSqFacAux 3 else n.minSqFacAux 3)
state_after: case pos
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : 2 ∣ n / 2
⊢ n.MinSqFacProp (some 2)

case neg
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
⊢ n.MinSqFacProp ((n / 2).minSqFacAux 3)

case neg
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
⊢ n.MinSqFacProp (n.minSqFacAux 3)

tactic: exact ⟨prime_two, (dvd_div_iff_mul_dvd d2).1 d4, fun p pp _ => pp.two_le⟩
state_before: case pos
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : 2 ∣ n / 2
⊢ n.MinSqFacProp (some 2)
state_after: no goals

tactic: rcases Nat.eq_zero_or_pos n with n0 | n0
state_before: case neg
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
⊢ n.MinSqFacProp ((n / 2).minSqFacAux 3)
state_after: case neg.inl
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n = 0
⊢ n.MinSqFacProp ((n / 2).minSqFacAux 3)

case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
⊢ n.MinSqFacProp ((n / 2).minSqFacAux 3)

tactic: refine minSqFacProp_div _ prime_two d2 (mt (dvd_div_iff_mul_dvd d2).2 d4) ?_
state_before: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
⊢ n.MinSqFacProp ((n / 2).minSqFacAux 3)
state_after: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
⊢ (n / 2).MinSqFacProp ((n / 2).minSqFacAux 3)

tactic: refine minSqFacAux_has_prop 3 (Nat.div_pos (le_of_dvd n0 d2) (by decide)) 0 rfl ?_
state_before: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
⊢ (n / 2).MinSqFacProp ((n / 2).minSqFacAux 3)
state_after: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
⊢ ∀ (m : ℕ), Prime m → m ∣ n / 2 → 3 ≤ m

tactic: refine fun p pp dp => succ_le_of_lt (lt_of_le_of_ne pp.two_le ?_)
state_before: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
⊢ ∀ (m : ℕ), Prime m → m ∣ n / 2 → 3 ≤ m
state_after: case neg.inr
s : Finset ℕ
m n✝ p✝ n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
p : ℕ
pp : Prime p
dp : p ∣ n / 2
⊢ 2 ≠ p

tactic: rintro rfl
state_before: case neg.inr
s : Finset ℕ
m n✝ p✝ n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
p : ℕ
pp : Prime p
dp : p ∣ n / 2
⊢ 2 ≠ p
state_after: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
pp : Prime 2
dp : 2 ∣ n / 2
⊢ False

tactic: contradiction
state_before: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
pp : Prime 2
dp : 2 ∣ n / 2
⊢ False
state_after: no goals

tactic: subst n0
state_before: case neg.inl
s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n = 0
⊢ n.MinSqFacProp ((n / 2).minSqFacAux 3)
state_after: case neg.inl
s : Finset ℕ
m n p : ℕ
d2 : 2 ∣ 0
d4 : ¬2 ∣ 0 / 2
⊢ MinSqFacProp 0 ((0 / 2).minSqFacAux 3)

tactic: cases d4 (by decide)
state_before: case neg.inl
s : Finset ℕ
m n p : ℕ
d2 : 2 ∣ 0
d4 : ¬2 ∣ 0 / 2
⊢ MinSqFacProp 0 ((0 / 2).minSqFacAux 3)
state_after: no goals

tactic: decide
state_before: s : Finset ℕ
m n p : ℕ
d2 : 2 ∣ 0
d4 : ¬2 ∣ 0 / 2
⊢ 2 ∣ 0 / 2
state_after: no goals

tactic: decide
state_before: s : Finset ℕ
m n✝ p n : ℕ
d2 : 2 ∣ n
d4 : ¬2 ∣ n / 2
n0 : n > 0
⊢ 0 < 2
state_after: no goals

tactic: rcases Nat.eq_zero_or_pos n with n0 | n0
state_before: case neg
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
⊢ n.MinSqFacProp (n.minSqFacAux 3)
state_after: case neg.inl
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
n0 : n = 0
⊢ n.MinSqFacProp (n.minSqFacAux 3)

case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
n0 : n > 0
⊢ n.MinSqFacProp (n.minSqFacAux 3)

tactic: refine minSqFacAux_has_prop _ n0 0 rfl ?_
state_before: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
n0 : n > 0
⊢ n.MinSqFacProp (n.minSqFacAux 3)
state_after: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
n0 : n > 0
⊢ ∀ (m : ℕ), Prime m → m ∣ n → 3 ≤ m

tactic: refine fun p pp dp => succ_le_of_lt (lt_of_le_of_ne pp.two_le ?_)
state_before: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
n0 : n > 0
⊢ ∀ (m : ℕ), Prime m → m ∣ n → 3 ≤ m
state_after: case neg.inr
s : Finset ℕ
m n✝ p✝ n : ℕ
d2 : ¬2 ∣ n
n0 : n > 0
p : ℕ
pp : Prime p
dp : p ∣ n
⊢ 2 ≠ p

tactic: rintro rfl
state_before: case neg.inr
s : Finset ℕ
m n✝ p✝ n : ℕ
d2 : ¬2 ∣ n
n0 : n > 0
p : ℕ
pp : Prime p
dp : p ∣ n
⊢ 2 ≠ p
state_after: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
n0 : n > 0
pp : Prime 2
dp : 2 ∣ n
⊢ False

tactic: contradiction
state_before: case neg.inr
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
n0 : n > 0
pp : Prime 2
dp : 2 ∣ n
⊢ False
state_after: no goals

tactic: subst n0
state_before: case neg.inl
s : Finset ℕ
m n✝ p n : ℕ
d2 : ¬2 ∣ n
n0 : n = 0
⊢ n.MinSqFacProp (n.minSqFacAux 3)
state_after: case neg.inl
s : Finset ℕ
m n p : ℕ
d2 : ¬2 ∣ 0
⊢ MinSqFacProp 0 (minSqFacAux 0 3)

tactic: cases d2 (by decide)
state_before: case neg.inl
s : Finset ℕ
m n p : ℕ
d2 : ¬2 ∣ 0
⊢ MinSqFacProp 0 (minSqFacAux 0 3)
state_after: no goals

tactic: decide
state_before: s : Finset ℕ
m n p : ℕ
d2 : ¬2 ∣ 0
⊢ 2 ∣ 0
state_after: no goals