Theorem: PosNum.minFac_to_nat
File: Mathlib/Data/Num/Prime.lean

tactic: cases' n with n
state_before: n : PosNum
⊢ ↑n.minFac = (↑n).minFac
state_after: case one

⊢ ↑one.minFac = (↑one).minFac

case bit1
n : PosNum
⊢ ↑n.bit1.minFac = (↑n.bit1).minFac

case bit0
a✝ : PosNum
⊢ ↑a✝.bit0.minFac = (↑a✝.bit0).minFac

tactic: rfl
state_before: case one

⊢ ↑one.minFac = (↑one).minFac
state_after: no goals

tactic: rw [minFac, Nat.minFac_eq, if_neg]
state_before: case bit1
n : PosNum
⊢ ↑n.bit1.minFac = (↑n.bit1).minFac
state_after: case bit1
n : PosNum
⊢ ↑(match n.bit1 with
      | one => 1
      | a.bit0 => 2
      | n.bit1 => n.bit1.minFacAux (↑n) 1) =
    (↑n.bit1).minFacAux 3

case bit1.hnc
n : PosNum
⊢ ¬2 ∣ ↑n.bit1

tactic: swap
state_before: case bit1
n : PosNum
⊢ ↑(match n.bit1 with
      | one => 1
      | a.bit0 => 2
      | n.bit1 => n.bit1.minFacAux (↑n) 1) =
    (↑n.bit1).minFacAux 3

case bit1.hnc
n : PosNum
⊢ ¬2 ∣ ↑n.bit1
state_after: case bit1.hnc
n : PosNum
⊢ ¬2 ∣ ↑n.bit1

case bit1
n : PosNum
⊢ ↑(match n.bit1 with
      | one => 1
      | a.bit0 => 2
      | n.bit1 => n.bit1.minFacAux (↑n) 1) =
    (↑n.bit1).minFacAux 3

tactic: rw [minFacAux_to_nat]
state_before: case bit1
n : PosNum
⊢ ↑(match n.bit1 with
      | one => 1
      | a.bit0 => 2
      | n.bit1 => n.bit1.minFacAux (↑n) 1) =
    (↑n.bit1).minFacAux 3
state_after: case bit1
n : PosNum
⊢ (↑n.bit1).minFacAux ↑(bit1 1) = (↑n.bit1).minFacAux 3

case bit1
n : PosNum
⊢ (↑n.bit1).sqrt < ↑n + ↑(bit1 1)

tactic: simp only [cast_one, cast_bit1]
state_before: case bit1
n : PosNum
⊢ (↑n.bit1).sqrt < ↑n + ↑(bit1 1)
state_after: case bit1
n : PosNum
⊢ (_root_.bit1 ↑n).sqrt < ↑n + _root_.bit1 1

tactic: unfold _root_.bit1 _root_.bit0
state_before: case bit1
n : PosNum
⊢ (_root_.bit1 ↑n).sqrt < ↑n + _root_.bit1 1
state_after: case bit1
n : PosNum
⊢ (↑n + ↑n + 1).sqrt < ↑n + (1 + 1 + 1)

tactic: rw [Nat.sqrt_lt]
state_before: case bit1
n : PosNum
⊢ (↑n + ↑n + 1).sqrt < ↑n + (1 + 1 + 1)
state_after: case bit1
n : PosNum
⊢ ↑n + ↑n + 1 < (↑n + (1 + 1 + 1)) * (↑n + (1 + 1 + 1))

tactic: calc
  (n : ℕ) + (n : ℕ) + 1 ≤ (n : ℕ) + (n : ℕ) + (n : ℕ) := by simp
  _ = (n : ℕ) * (1 + 1 + 1) := by simp only [mul_add, mul_one]
  _ < _ := by
    set_option simprocs false in simp [mul_lt_mul]
state_before: case bit1
n : PosNum
⊢ ↑n + ↑n + 1 < (↑n + (1 + 1 + 1)) * (↑n + (1 + 1 + 1))
state_after: no goals

tactic: simp
state_before: case bit1.hnc
n : PosNum
⊢ ¬2 ∣ ↑n.bit1
state_after: no goals

tactic: rfl
state_before: case bit1
n : PosNum
⊢ (↑n.bit1).minFacAux ↑(bit1 1) = (↑n.bit1).minFacAux 3
state_after: no goals

tactic: simp
state_before: n : PosNum
⊢ ↑n + ↑n + 1 ≤ ↑n + ↑n + ↑n
state_after: no goals

tactic: simp only [mul_add, mul_one]
state_before: n : PosNum
⊢ ↑n + ↑n + ↑n = ↑n * (1 + 1 + 1)
state_after: no goals

tactic: set_option simprocs false in simp [mul_lt_mul]
state_before: n : PosNum
⊢ ↑n * (1 + 1 + 1) < (↑n + (1 + 1 + 1)) * (↑n + (1 + 1 + 1))
state_after: no goals

tactic: simp [mul_lt_mul]
state_before: n : PosNum
⊢ ↑n * (1 + 1 + 1) < (↑n + (1 + 1 + 1)) * (↑n + (1 + 1 + 1))
state_after: no goals

tactic: rw [minFac, Nat.minFac_eq, if_pos]
state_before: case bit0
a✝ : PosNum
⊢ ↑a✝.bit0.minFac = (↑a✝.bit0).minFac
state_after: case bit0
a✝ : PosNum
⊢ ↑(match a✝.bit0 with
      | one => 1
      | a.bit0 => 2
      | n.bit1 => n.bit1.minFacAux (↑n) 1) =
    2

case bit0.hc
a✝ : PosNum
⊢ 2 ∣ ↑a✝.bit0

tactic: simp
state_before: case bit0.hc
a✝ : PosNum
⊢ 2 ∣ ↑a✝.bit0
state_after: no goals

tactic: rfl
state_before: case bit0
a✝ : PosNum
⊢ ↑(match a✝.bit0 with
      | one => 1
      | a.bit0 => 2
      | n.bit1 => n.bit1.minFacAux (↑n) 1) =
    2
state_after: no goals