File: Mathlib/Data/Nat/Prime/Defs.lean

full_name: Nat.Prime
code: /-- `Nat.Prime p` means that `p` is a prime number, that is, a natural number
  at least 2 whose only divisors are `p` and `1`. -/
@[pp_nodot]
def Prime (p : ℕ) 
goal: Prop

full_name: Nat.irreducible_iff_nat_prime
code: theorem irreducible_iff_nat_prime (a : ℕ) : Irreducible a ↔ Nat.Prime a 
goal: Irreducible a ↔ Nat.Prime a

full_name: Nat.not_prime_zero
code: @[aesop safe destruct] theorem not_prime_zero : ¬Prime 0
  
goal: ¬Nat.Prime 0

full_name: Nat.not_prime_one
code: @[aesop safe destruct] theorem not_prime_one : ¬Prime 1
  
goal: ¬Nat.Prime 1

full_name: Nat.Prime.ne_zero
code: theorem Prime.ne_zero {n : ℕ} (h : Prime n) : n ≠ 0 
goal: n ≠ 0

full_name: Nat.Prime.pos
code: theorem Prime.pos {p : ℕ} (pp : Prime p) : 0 < p 
goal: 0 < p

full_name: Nat.Prime.two_le
code: theorem Prime.two_le : ∀ {p : ℕ}, Prime p → 2 ≤ p
  
goal: Nat.Prime p → 2 ≤ p

full_name: Nat.Prime.one_lt
code: theorem Prime.one_lt {p : ℕ} : Prime p → 1 < p 
goal: Nat.Prime p → 1 < p

full_name: Nat.Prime.one_le
code: lemma Prime.one_le {p : ℕ} (hp : p.Prime) : 1 ≤ p 
goal: 1 ≤ p

full_name: Nat.Prime.one_lt'
code: instance Prime.one_lt' (p : ℕ) [hp : Fact p.Prime] : Fact (1 < p) 
goal: Fact (1 < p)

full_name: Nat.Prime.ne_one
code: theorem Prime.ne_one {p : ℕ} (hp : p.Prime) : p ≠ 1 
goal: p ≠ 1

full_name: Nat.Prime.eq_one_or_self_of_dvd
code: theorem Prime.eq_one_or_self_of_dvd {p : ℕ} (pp : p.Prime) (m : ℕ) (hm : m ∣ p) :
    m = 1 ∨ m = p 
goal: m = 1 ∨ m = p

full_name: Nat.prime_def_lt''
code: theorem prime_def_lt'' {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, m ∣ p → m = 1 ∨ m = p 
goal: Nat.Prime p ↔ 2 ≤ p ∧ ∀ (m : ℕ), m ∣ p → m = 1 ∨ m = p

full_name: Nat.prime_def_lt
code: theorem prime_def_lt {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m < p, m ∣ p → m = 1 
goal: Nat.Prime p ↔ 2 ≤ p ∧ ∀ (m : ℕ), m < p → m ∣ p → m = 1

full_name: Nat.prime_def_lt'
code: theorem prime_def_lt' {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, 2 ≤ m → m < p → ¬m ∣ p 
goal: Nat.Prime p ↔ 2 ≤ p ∧ ∀ (m : ℕ), 2 ≤ m → m < p → ¬m ∣ p

full_name: Nat.prime_def_le_sqrt
code: theorem prime_def_le_sqrt {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, 2 ≤ m → m ≤ sqrt p → ¬m ∣ p 
goal: Nat.Prime p ↔ 2 ≤ p ∧ ∀ (m : ℕ), 2 ≤ m → m ≤ p.sqrt → ¬m ∣ p

full_name: Nat.prime_of_coprime
code: theorem prime_of_coprime (n : ℕ) (h1 : 1 < n) (h : ∀ m < n, m ≠ 0 → n.Coprime m) : Prime n 
goal: Nat.Prime n

full_name: Nat.decidablePrime1
code: /-- This instance is slower than the instance `decidablePrime` defined below,
  but has the advantage that it works in the kernel for small values.

  If you need to prove that a particular number is prime, in any case
  you should not use `by decide`, but rather `by norm_num`, which is
  much faster.
  -/
@[local instance]
def decidablePrime1 (p : ℕ) : Decidable (Prime p) 
goal: Decidable (Nat.Prime p)

full_name: Nat.prime_two
code: theorem prime_two : Prime 2 
goal: Nat.Prime 2

full_name: Nat.prime_three
code: theorem prime_three : Prime 3 
goal: Nat.Prime 3

full_name: Nat.prime_five
code: theorem prime_five : Prime 5 
goal: Nat.Prime 5

full_name: Nat.dvd_prime
code: theorem dvd_prime {p m : ℕ} (pp : Prime p) : m ∣ p ↔ m = 1 ∨ m = p 
goal: m ∣ p ↔ m = 1 ∨ m = p

full_name: Nat.dvd_prime_two_le
code: theorem dvd_prime_two_le {p m : ℕ} (pp : Prime p) (H : 2 ≤ m) : m ∣ p ↔ m = p 
goal: m ∣ p ↔ m = p

full_name: Nat.prime_dvd_prime_iff_eq
code: theorem prime_dvd_prime_iff_eq {p q : ℕ} (pp : p.Prime) (qp : q.Prime) : p ∣ q ↔ p = q 
goal: p ∣ q ↔ p = q

full_name: Nat.Prime.not_dvd_one
code: theorem Prime.not_dvd_one {p : ℕ} (pp : Prime p) : ¬p ∣ 1 
goal: ¬p ∣ 1

full_name: Nat.prime_mul_iff
code: theorem prime_mul_iff {a b : ℕ} : Nat.Prime (a * b) ↔ a.Prime ∧ b = 1 ∨ b.Prime ∧ a = 1 
goal: Nat.Prime (a * b) ↔ Nat.Prime a ∧ b = 1 ∨ Nat.Prime b ∧ a = 1

full_name: Nat.not_prime_mul
code: theorem not_prime_mul {a b : ℕ} (a1 : a ≠ 1) (b1 : b ≠ 1) : ¬Prime (a * b) 
goal: ¬Nat.Prime (a * b)

full_name: Nat.not_prime_mul'
code: theorem not_prime_mul' {a b n : ℕ} (h : a * b = n) (h₁ : a ≠ 1) (h₂ : b ≠ 1) : ¬Prime n 
goal: ¬Nat.Prime n

full_name: Nat.Prime.dvd_iff_eq
code: theorem Prime.dvd_iff_eq {p a : ℕ} (hp : p.Prime) (a1 : a ≠ 1) : a ∣ p ↔ p = a 
goal: a ∣ p ↔ p = a

full_name: Nat.Prime.eq_two_or_odd
code: theorem Prime.eq_two_or_odd {p : ℕ} (hp : Prime p) : p = 2 ∨ p % 2 = 1 
goal: p = 2 ∨ p % 2 = 1

full_name: Nat.Prime.eq_two_or_odd'
code: theorem Prime.eq_two_or_odd' {p : ℕ} (hp : Prime p) : p = 2 ∨ Odd p 
goal: p = 2 ∨ Odd p

full_name: Nat.minFac_lemma
code: theorem minFac_lemma (n k : ℕ) (h : ¬n < k * k) : sqrt n - k < sqrt n + 2 - k 
goal: n.sqrt - k < n.sqrt + 2 - k

full_name: Nat.minFacAux
code: /--
If `n < k * k`, then `minFacAux n k = n`, if `k | n`, then `minFacAux n k = k`.
Otherwise, `minFacAux n k = minFacAux n (k+2)` using well-founded recursion.
If `n` is odd and `1 < n`, then `minFacAux n 3` is the smallest prime factor of `n`.

By default this well-founded recursion would be irreducible.
This prevents use `decide` to resolve `Nat.prime n` for small values of `n`,
so we mark this as `@[semireducible]`.

In future, we may want to remove this annotation and instead use `norm_num` instead of `decide`
in these situations.
-/
@[semireducible] def minFacAux (n : ℕ) : ℕ → ℕ
  
goal: ℕ → ℕ

full_name: Nat.minFac
code: /-- Returns the smallest prime factor of `n ≠ 1`. -/
def minFac (n : ℕ) : ℕ 
goal: ℕ

full_name: Nat.minFac_zero
code: @[simp]
theorem minFac_zero : minFac 0 = 2 
goal: Nat.minFac 0 = 2

full_name: Nat.minFac_one
code: @[simp]
theorem minFac_one : minFac 1 = 1 
goal: Nat.minFac 1 = 1

full_name: Nat.minFac_two
code: @[simp]
theorem minFac_two : minFac 2 = 2 
goal: Nat.minFac 2 = 2

full_name: Nat.minFac_eq
code: theorem minFac_eq (n : ℕ) : minFac n = if 2 ∣ n then 2 else minFacAux n 3 
goal: n.minFac = if 2 ∣ n then 2 else n.minFacAux 3

full_name: _private.Mathlib.Data.Nat.Prime.Defs.0.Nat.minFacProp
code: private def minFacProp (n k : ℕ) 
goal: Prop

full_name: Nat.minFacAux_has_prop
code: theorem minFacAux_has_prop {n : ℕ} (n2 : 2 ≤ n) :
    ∀ k i, k = 2 * i + 3 → (∀ m, 2 ≤ m → m ∣ n → k ≤ m) → minFacProp n (minFacAux n k)
  
goal: k = 2 * i + 3 → (∀ (m : ℕ), 2 ≤ m → m ∣ n → k ≤ m) → Nat.minFacProp n (n.minFacAux k)

full_name: Nat.minFac_has_prop
code: theorem minFac_has_prop {n : ℕ} (n1 : n ≠ 1) : minFacProp n (minFac n) 
goal: Nat.minFacProp n n.minFac

full_name: Nat.minFac_dvd
code: theorem minFac_dvd (n : ℕ) : minFac n ∣ n 
goal: n.minFac ∣ n

full_name: Nat.minFac_prime
code: theorem minFac_prime {n : ℕ} (n1 : n ≠ 1) : Prime (minFac n) 
goal: Nat.Prime n.minFac

full_name: Nat.minFac_le_of_dvd
code: theorem minFac_le_of_dvd {n : ℕ} : ∀ {m : ℕ}, 2 ≤ m → m ∣ n → minFac n ≤ m 
goal: 2 ≤ m → m ∣ n → n.minFac ≤ m

full_name: Nat.minFac_pos
code: theorem minFac_pos (n : ℕ) : 0 < minFac n 
goal: 0 < n.minFac

full_name: Nat.minFac_le
code: theorem minFac_le {n : ℕ} (H : 0 < n) : minFac n ≤ n 
goal: n.minFac ≤ n

full_name: Nat.le_minFac
code: theorem le_minFac {m n : ℕ} : n = 1 ∨ m ≤ minFac n ↔ ∀ p, Prime p → p ∣ n → m ≤ p 
goal: n = 1 ∨ m ≤ n.minFac ↔ ∀ (p : ℕ), Nat.Prime p → p ∣ n → m ≤ p

full_name: Nat.le_minFac'
code: theorem le_minFac' {m n : ℕ} : n = 1 ∨ m ≤ minFac n ↔ ∀ p, 2 ≤ p → p ∣ n → m ≤ p 
goal: n = 1 ∨ m ≤ n.minFac ↔ ∀ (p : ℕ), 2 ≤ p → p ∣ n → m ≤ p

full_name: Nat.prime_def_minFac
code: theorem prime_def_minFac {p : ℕ} : Prime p ↔ 2 ≤ p ∧ minFac p = p 
goal: Nat.Prime p ↔ 2 ≤ p ∧ p.minFac = p

full_name: Nat.Prime.minFac_eq
code: @[simp]
theorem Prime.minFac_eq {p : ℕ} (hp : Prime p) : minFac p = p 
goal: p.minFac = p

full_name: Nat.decidablePrime
code: /-- This instance is faster in the virtual machine than `decidablePrime1`,
but slower in the kernel.

If you need to prove that a particular number is prime, in any case
you should not use `by decide`, but rather `by norm_num`, which is
much faster.
-/
instance decidablePrime (p : ℕ) : Decidable (Prime p) 
goal: Decidable (Nat.Prime p)

full_name: Nat.not_prime_iff_minFac_lt
code: theorem not_prime_iff_minFac_lt {n : ℕ} (n2 : 2 ≤ n) : ¬Prime n ↔ minFac n < n 
goal: ¬Nat.Prime n ↔ n.minFac < n

full_name: Nat.minFac_le_div
code: theorem minFac_le_div {n : ℕ} (pos : 0 < n) (np : ¬Prime n) : minFac n ≤ n / minFac n 
goal: n.minFac ≤ n / n.minFac

full_name: Nat.minFac_sq_le_self
code: /-- The square of the smallest prime factor of a composite number `n` is at most `n`.
-/
theorem minFac_sq_le_self {n : ℕ} (w : 0 < n) (h : ¬Prime n) : minFac n ^ 2 ≤ n 
goal: n.minFac ^ 2 ≤ n

full_name: Nat.minFac_eq_one_iff
code: @[simp]
theorem minFac_eq_one_iff {n : ℕ} : minFac n = 1 ↔ n = 1 
goal: n.minFac = 1 ↔ n = 1

full_name: Nat.minFac_eq_two_iff
code: @[simp]
theorem minFac_eq_two_iff (n : ℕ) : minFac n = 2 ↔ 2 ∣ n 
goal: n.minFac = 2 ↔ 2 ∣ n

full_name: Nat.factors_lemma
code: theorem factors_lemma {k} : (k + 2) / minFac (k + 2) < k + 2 
goal: (k + 2) / (k + 2).minFac < k + 2

full_name: Nat.exists_prime_and_dvd
code: theorem exists_prime_and_dvd {n : ℕ} (hn : n ≠ 1) : ∃ p, Prime p ∧ p ∣ n 
goal: ∃ p, Nat.Prime p ∧ p ∣ n

full_name: Nat.coprime_of_dvd
code: theorem coprime_of_dvd {m n : ℕ} (H : ∀ k, Prime k → k ∣ m → ¬k ∣ n) : Coprime m n 
goal: m.Coprime n

full_name: Nat.Prime.coprime_iff_not_dvd
code: theorem Prime.coprime_iff_not_dvd {p n : ℕ} (pp : Prime p) : Coprime p n ↔ ¬p ∣ n 
goal: p.Coprime n ↔ ¬p ∣ n

full_name: Nat.Prime.dvd_mul
code: theorem Prime.dvd_mul {p m n : ℕ} (pp : Prime p) : p ∣ m * n ↔ p ∣ m ∨ p ∣ n 
goal: p ∣ m * n ↔ p ∣ m ∨ p ∣ n

full_name: Nat.prime_iff
code: theorem prime_iff {p : ℕ} : p.Prime ↔ _root_.Prime p 
goal: Nat.Prime p ↔ Prime p

full_name: Nat.irreducible_iff_prime
code: theorem irreducible_iff_prime {p : ℕ} : Irreducible p ↔ _root_.Prime p 
goal: Irreducible p ↔ Prime p

full_name: Nat.Primes
code: /-- The type of prime numbers -/
def Primes 
goal: Type

full_name: Nat.Primes.instRepr
code: instance : Repr Nat.Primes 
goal: Repr Nat.Primes

full_name: Nat.Primes.inhabitedPrimes
code: instance inhabitedPrimes : Inhabited Primes 
goal: Inhabited Nat.Primes

full_name: Nat.Primes.coeNat
code: instance coeNat : Coe Nat.Primes ℕ 
goal: Coe Nat.Primes ℕ

full_name: Nat.Primes.coe_nat_injective
code: theorem coe_nat_injective : Function.Injective (fun (a : Nat.Primes) ↦ (a : ℕ)) 
goal: Function.Injective fun a => ↑a

full_name: Nat.Primes.coe_nat_inj
code: theorem coe_nat_inj (p q : Nat.Primes) : (p : ℕ) = (q : ℕ) ↔ p = q 
goal: ↑p = ↑q ↔ p = q

full_name: Nat.monoid.primePow
code: instance monoid.primePow {α : Type*} [Monoid α] : Pow α Primes 
goal: Pow α Nat.Primes

full_name: Nat.fact_prime_two
code: instance fact_prime_two : Fact (Prime 2) 
goal: Fact (Nat.Prime 2)

full_name: Nat.fact_prime_three
code: instance fact_prime_three : Fact (Prime 3) 
goal: Fact (Nat.Prime 3)