Theorem: Nat.sqrt_isSqrt
File: Mathlib/Data/Nat/Defs.lean

tactic: simp [IsSqrt, sqrt]
state_before: a b c d m n✝ k : ℕ
p q : ℕ → Prop
n : ℕ
⊢ Nat.IsSqrt 0 (sqrt 0)
state_after: no goals

tactic: simp [IsSqrt, sqrt]
state_before: a b c d m n✝ k : ℕ
p q : ℕ → Prop
n : ℕ
⊢ Nat.IsSqrt 1 (sqrt 1)
state_after: no goals

tactic: have h : ¬ (n + 2) ≤ 1 := by simp
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
⊢ Nat.IsSqrt (n + 2) (n + 2).sqrt
state_after: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ Nat.IsSqrt (n + 2) (n + 2).sqrt

tactic: simp only [IsSqrt, sqrt, h, ite_false]
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ Nat.IsSqrt (n + 2) (n + 2).sqrt
state_after: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ sqrt.iter (n + 2) ((n + 2) / 2) * sqrt.iter (n + 2) ((n + 2) / 2) ≤ n + 2 ∧
    n + 2 < (sqrt.iter (n + 2) ((n + 2) / 2) + 1) * (sqrt.iter (n + 2) ((n + 2) / 2) + 1)

tactic: refine ⟨sqrt.iter_sq_le _ _, sqrt.lt_iter_succ_sq _ _ ?_⟩
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ sqrt.iter (n + 2) ((n + 2) / 2) * sqrt.iter (n + 2) ((n + 2) / 2) ≤ n + 2 ∧
    n + 2 < (sqrt.iter (n + 2) ((n + 2) / 2) + 1) * (sqrt.iter (n + 2) ((n + 2) / 2) + 1)
state_after: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n + 2 < ((n + 2) / 2 + 1) * ((n + 2) / 2 + 1)

tactic: simp only [Nat.mul_add, Nat.add_mul, Nat.one_mul, Nat.mul_one, ← Nat.add_assoc]
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n + 2 < ((n + 2) / 2 + 1) * ((n + 2) / 2 + 1)
state_after: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n + 2 < (n + 2) / 2 * ((n + 2) / 2) + (n + 2) / 2 + (n + 2) / 2 + 1

tactic: rw [Nat.lt_add_one_iff, Nat.add_assoc, ← Nat.mul_two]
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n + 2 < (n + 2) / 2 * ((n + 2) / 2) + (n + 2) / 2 + (n + 2) / 2 + 1
state_after: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n + 2 ≤ (n + 2) / 2 * ((n + 2) / 2) + (n + 2) / 2 * 2

tactic: refine le_trans (Nat.le_of_eq (div_add_mod' (n + 2) 2).symm) ?_
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n + 2 ≤ (n + 2) / 2 * ((n + 2) / 2) + (n + 2) / 2 * 2
state_after: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ (n + 2) / 2 * 2 + (n + 2) % 2 ≤ (n + 2) / 2 * ((n + 2) / 2) + (n + 2) / 2 * 2

tactic: rw [Nat.add_comm, Nat.add_le_add_iff_right, add_mod_right]
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ (n + 2) / 2 * 2 + (n + 2) % 2 ≤ (n + 2) / 2 * ((n + 2) / 2) + (n + 2) / 2 * 2
state_after: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n % 2 ≤ (n + 2) / 2 * ((n + 2) / 2)

tactic: simp only [Nat.zero_lt_two, add_div_right, succ_mul_succ]
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n % 2 ≤ (n + 2) / 2 * ((n + 2) / 2)
state_after: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n % 2 ≤ n / 2 * (n / 2) + n / 2 + n / 2 + 1

tactic: refine le_trans (b := 1) ?_ ?_
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n % 2 ≤ n / 2 * (n / 2) + n / 2 + n / 2 + 1
state_after: case refine_1
a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n % 2 ≤ 1

case refine_2
a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ 1 ≤ n / 2 * (n / 2) + n / 2 + n / 2 + 1

tactic: simp
state_before: a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
⊢ ¬n + 2 ≤ 1
state_after: no goals

tactic: exact (lt_succ.1 <| mod_lt n Nat.zero_lt_two)
state_before: case refine_1
a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ n % 2 ≤ 1
state_after: no goals

tactic: exact Nat.le_add_left _ _
state_before: case refine_2
a b c d m n✝¹ k : ℕ
p q : ℕ → Prop
n✝ n : ℕ
h : ¬n + 2 ≤ 1
⊢ 1 ≤ n / 2 * (n / 2) + n / 2 + n / 2 + 1
state_after: no goals