Theorem: schnirelmannDensity_eq_one_iff
File: Mathlib/Combinatorics/Schnirelmann.lean

tactic: rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
state_before: A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A
state_after: A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ 1 ≤ schnirelmannDensity A ↔ {0}ᶜ ⊆ A

tactic: constructor
state_before: A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ 1 ≤ schnirelmannDensity A ↔ {0}ᶜ ⊆ A
state_after: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ 1 ≤ schnirelmannDensity A → {0}ᶜ ⊆ A

case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ {0}ᶜ ⊆ A → 1 ≤ schnirelmannDensity A

tactic: rw [← not_imp_not, not_le]
state_before: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ 1 ≤ schnirelmannDensity A → {0}ᶜ ⊆ A
state_after: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ ¬{0}ᶜ ⊆ A → schnirelmannDensity A < 1

tactic: simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
state_before: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ ¬{0}ᶜ ⊆ A → schnirelmannDensity A < 1
state_after: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ ∀ x ∈ {0}ᶜ, x ∉ A → schnirelmannDensity A < 1

tactic: intro x hx hx'
state_before: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ ∀ x ∈ {0}ᶜ, x ∉ A → schnirelmannDensity A < 1
state_after: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
x : ℕ
hx : x ∈ {0}ᶜ
hx' : x ∉ A
⊢ schnirelmannDensity A < 1

tactic: apply (schnirelmannDensity_le_of_not_mem hx').trans_lt
state_before: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
x : ℕ
hx : x ∈ {0}ᶜ
hx' : x ∉ A
⊢ schnirelmannDensity A < 1
state_after: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
x : ℕ
hx : x ∈ {0}ᶜ
hx' : x ∉ A
⊢ 1 - (↑x)⁻¹ < 1

tactic: simpa only [one_div, sub_lt_self_iff, inv_pos, Nat.cast_pos, pos_iff_ne_zero] using hx
state_before: case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
x : ℕ
hx : x ∈ {0}ᶜ
hx' : x ∉ A
⊢ 1 - (↑x)⁻¹ < 1
state_after: no goals

tactic: intro h
state_before: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ {0}ᶜ ⊆ A → 1 ≤ schnirelmannDensity A
state_after: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
⊢ 1 ≤ schnirelmannDensity A

tactic: refine le_ciInf fun ⟨n, hn⟩ => ?_
state_before: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
⊢ 1 ≤ schnirelmannDensity A
state_after: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
x✝ : { n // 0 < n }
n : ℕ
hn : 0 < n
⊢ 1 ≤ ↑(filter (fun x => x ∈ A) (Ioc 0 ↑⟨n, hn⟩)).card / ↑↑⟨n, hn⟩

tactic: rw [one_le_div (Nat.cast_pos.2 hn), Nat.cast_le, filter_true_of_mem, Nat.card_Ioc, Nat.sub_zero]
state_before: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
x✝ : { n // 0 < n }
n : ℕ
hn : 0 < n
⊢ 1 ≤ ↑(filter (fun x => x ∈ A) (Ioc 0 ↑⟨n, hn⟩)).card / ↑↑⟨n, hn⟩
state_after: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
x✝ : { n // 0 < n }
n : ℕ
hn : 0 < n
⊢ ∀ x ∈ Ioc 0 ↑⟨n, hn⟩, x ∈ A

tactic: rintro x hx
state_before: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
x✝ : { n // 0 < n }
n : ℕ
hn : 0 < n
⊢ ∀ x ∈ Ioc 0 ↑⟨n, hn⟩, x ∈ A
state_after: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
x✝ : { n // 0 < n }
n : ℕ
hn : 0 < n
x : ℕ
hx : x ∈ Ioc 0 ↑⟨n, hn⟩
⊢ x ∈ A

tactic: exact h (mem_Ioc.1 hx).1.ne'
state_before: case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
x✝ : { n // 0 < n }
n : ℕ
hn : 0 < n
x : ℕ
hx : x ∈ Ioc 0 ↑⟨n, hn⟩
⊢ x ∈ A
state_after: no goals