l3lab/ntp-mathlib huggingface dataset:
theorem OrderIso.map_inf [SemilatticeInf α] [SemilatticeInf β] (f : α ≃o β) (x y : α) :
    f (x ⊓ y) = f x ⊓ f y := by
  refine' (f.toOrderEmbedding.map_inf_le x y).antisymm _
  apply f.symm.le_iff_le.1
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝¹ : SemilatticeInf α
inst✝ : SemilatticeInf β
f : α ≃o β
x y : α
⊢ (symm f) ((toOrderEmbedding f) x ⊓ (toOrderEmbedding f) y) ≤ (symm f) ((toOrderEmbedding f) (x ⊓ y))

Next tactic:
simpa using f.symm.toOrderEmbedding.map_inf_le (f x) (f y)
/-- Note that this goal could also be stated `(Disjoint on f) a b` -/
theorem Disjoint.map_orderIso [SemilatticeInf α] [OrderBot α] [SemilatticeInf β] [OrderBot β]
    {a b : α} (f : α ≃o β) (ha : Disjoint a b) : Disjoint (f a) (f b) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : SemilatticeInf α
inst✝² : OrderBot α
inst✝¹ : SemilatticeInf β
inst✝ : OrderBot β
a b : α
f : α ≃o β
ha : Disjoint a b
⊢ Disjoint (f a) (f b)

Next tactic:
rw [disjoint_iff_inf_le, ← f.map_inf, ← f.map_bot]
/-- Note that this goal could also be stated `(Disjoint on f) a b` -/
theorem Disjoint.map_orderIso [SemilatticeInf α] [OrderBot α] [SemilatticeInf β] [OrderBot β]
    {a b : α} (f : α ≃o β) (ha : Disjoint a b) : Disjoint (f a) (f b) := by
  rw [disjoint_iff_inf_le, ← f.map_inf, ← f.map_bot]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : SemilatticeInf α
inst✝² : OrderBot α
inst✝¹ : SemilatticeInf β
inst✝ : OrderBot β
a b : α
f : α ≃o β
ha : Disjoint a b
⊢ f (a ⊓ b) ≤ f ⊥

Next tactic:
exact f.monotone ha.le_bot
/-- Note that this goal could also be stated `(Codisjoint on f) a b` -/
theorem Codisjoint.map_orderIso [SemilatticeSup α] [OrderTop α] [SemilatticeSup β] [OrderTop β]
    {a b : α} (f : α ≃o β) (ha : Codisjoint a b) : Codisjoint (f a) (f b) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : SemilatticeSup α
inst✝² : OrderTop α
inst✝¹ : SemilatticeSup β
inst✝ : OrderTop β
a b : α
f : α ≃o β
ha : Codisjoint a b
⊢ Codisjoint (f a) (f b)

Next tactic:
rw [codisjoint_iff_le_sup, ← f.map_sup, ← f.map_top]
/-- Note that this goal could also be stated `(Codisjoint on f) a b` -/
theorem Codisjoint.map_orderIso [SemilatticeSup α] [OrderTop α] [SemilatticeSup β] [OrderTop β]
    {a b : α} (f : α ≃o β) (ha : Codisjoint a b) : Codisjoint (f a) (f b) := by
  rw [codisjoint_iff_le_sup, ← f.map_sup, ← f.map_top]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : SemilatticeSup α
inst✝² : OrderTop α
inst✝¹ : SemilatticeSup β
inst✝ : OrderTop β
a b : α
f : α ≃o β
ha : Codisjoint a b
⊢ f ⊤ ≤ f (a ⊔ b)

Next tactic:
exact f.monotone ha.top_le
theorem OrderIso.complementedLattice [ComplementedLattice α] : ComplementedLattice β :=
  ⟨fun x => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁴ : Lattice α
inst✝³ : Lattice β
inst✝² : BoundedOrder α
inst✝¹ : BoundedOrder β
f : α ≃o β
inst✝ : ComplementedLattice α
x : β
⊢ ∃ b, IsCompl x b

Next tactic:
obtain ⟨y, hy⟩ := exists_isCompl (f.symm x)
theorem OrderIso.complementedLattice [ComplementedLattice α] : ComplementedLattice β :=
  ⟨fun x => by
    obtain ⟨y, hy⟩ := exists_isCompl (f.symm x)
    

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁴ : Lattice α
inst✝³ : Lattice β
inst✝² : BoundedOrder α
inst✝¹ : BoundedOrder β
f : α ≃o β
inst✝ : ComplementedLattice α
x : β
y : α
hy : IsCompl ((symm f) x) y
⊢ ∃ b, IsCompl x b

Next tactic:
rw [← f.symm_apply_apply y] at hy
theorem OrderIso.complementedLattice [ComplementedLattice α] : ComplementedLattice β :=
  ⟨fun x => by
    obtain ⟨y, hy⟩ := exists_isCompl (f.symm x)
    rw [← f.symm_apply_apply y] at hy
    

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁴ : Lattice α
inst✝³ : Lattice β
inst✝² : BoundedOrder α
inst✝¹ : BoundedOrder β
f : α ≃o β
inst✝ : ComplementedLattice α
x : β
y : α
hy : IsCompl ((symm f) x) ((symm f) (f y))
⊢ ∃ b, IsCompl x b

Next tactic:
exact ⟨f y, f.symm.isCompl_iff.2 hy⟩
theorem OrderIso.complementedLattice_iff : ComplementedLattice α ↔ ComplementedLattice β :=
  ⟨by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Lattice α
inst✝² : Lattice β
inst✝¹ : BoundedOrder α
inst✝ : BoundedOrder β
f : α ≃o β
⊢ ComplementedLattice α → ComplementedLattice β

Next tactic:
intro
theorem OrderIso.complementedLattice_iff : ComplementedLattice α ↔ ComplementedLattice β :=
  ⟨by intro; 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Lattice α
inst✝² : Lattice β
inst✝¹ : BoundedOrder α
inst✝ : BoundedOrder β
f : α ≃o β
a✝ : ComplementedLattice α
⊢ ComplementedLattice β

Next tactic:
exact f.complementedLattice
theorem OrderIso.complementedLattice_iff : ComplementedLattice α ↔ ComplementedLattice β :=
  ⟨by intro; exact f.complementedLattice,
   by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Lattice α
inst✝² : Lattice β
inst✝¹ : BoundedOrder α
inst✝ : BoundedOrder β
f : α ≃o β
⊢ ComplementedLattice β → ComplementedLattice α

Next tactic:
intro
theorem OrderIso.complementedLattice_iff : ComplementedLattice α ↔ ComplementedLattice β :=
  ⟨by intro; exact f.complementedLattice,
   by intro; 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : Lattice α
inst✝² : Lattice β
inst✝¹ : BoundedOrder α
inst✝ : BoundedOrder β
f : α ≃o β
a✝ : ComplementedLattice β
⊢ ComplementedLattice α

Next tactic:
exact f.symm.complementedLattice
lemma schnirelmannDensity_nonneg : 0 ≤ schnirelmannDensity A :=
  Real.iInf_nonneg (fun _ => by 

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
x✝ : { n // 0 < n }
⊢ 0 ≤ ↑(card (filter (fun x => x ∈ A) (Ioc 0 ↑x✝))) / ↑↑x✝

Next tactic:
positivity
lemma schnirelmannDensity_le_div {n : ℕ} (hn : n ≠ 0) :
    schnirelmannDensity A ≤ ((Ioc 0 n).filter (· ∈ A)).card / n :=
  ciInf_le ⟨0, fun _ ⟨_, hx⟩ => hx ▸ by 

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
n : ℕ
hn : n ≠ 0
x✝¹ : ℝ
x✝ : x✝¹ ∈ Set.range fun n => ↑(card (filter (fun x => x ∈ A) (Ioc 0 ↑n))) / ↑↑n
w✝ : { n // 0 < n }
hx : (fun n => ↑(card (filter (fun x => x ∈ A) (Ioc 0 ↑n))) / ↑↑n) w✝ = x✝¹
⊢ 0 ≤ (fun n => ↑(card (filter (fun x => x ∈ A) (Ioc 0 ↑n))) / ↑↑n) w✝

Next tactic:
positivity
/--
For any natural `n`, the Schnirelmann density multiplied by `n` is bounded by `|A ∩ {1, ..., n}|`.
Note this property fails for the natural density.
-/
lemma schnirelmannDensity_mul_le_card_filter {n : ℕ} :
    schnirelmannDensity A * n ≤ ((Ioc 0 n).filter (· ∈ A)).card := by
  

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
n : ℕ
⊢ schnirelmannDensity A * ↑n ≤ ↑(card (filter (fun x => x ∈ A) (Ioc 0 n)))

Next tactic:
rcases eq_or_ne n 0 with rfl | hn
/--
For any natural `n`, the Schnirelmann density multiplied by `n` is bounded by `|A ∩ {1, ..., n}|`.
Note this property fails for the natural density.
-/
lemma schnirelmannDensity_mul_le_card_filter {n : ℕ} :
    schnirelmannDensity A * n ≤ ((Ioc 0 n).filter (· ∈ A)).card := by
  rcases eq_or_ne n 0 with rfl | hn
  · 

Proof state:
case inl
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ schnirelmannDensity A * ↑0 ≤ ↑(card (filter (fun x => x ∈ A) (Ioc 0 0)))

Next tactic:
simp
/--
For any natural `n`, the Schnirelmann density multiplied by `n` is bounded by `|A ∩ {1, ..., n}|`.
Note this property fails for the natural density.
-/
lemma schnirelmannDensity_mul_le_card_filter {n : ℕ} :
    schnirelmannDensity A * n ≤ ((Ioc 0 n).filter (· ∈ A)).card := by
  rcases eq_or_ne n 0 with rfl | hn
  · simp
  

Proof state:
case inr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
n : ℕ
hn : n ≠ 0
⊢ schnirelmannDensity A * ↑n ≤ ↑(card (filter (fun x => x ∈ A) (Ioc 0 n)))

Next tactic:
exact (le_div_iff (by positivity)).1 (schnirelmannDensity_le_div hn)
/--
For any natural `n`, the Schnirelmann density multiplied by `n` is bounded by `|A ∩ {1, ..., n}|`.
Note this property fails for the natural density.
-/
lemma schnirelmannDensity_mul_le_card_filter {n : ℕ} :
    schnirelmannDensity A * n ≤ ((Ioc 0 n).filter (· ∈ A)).card := by
  rcases eq_or_ne n 0 with rfl | hn
  · simp
  exact (le_div_iff (by 

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
n : ℕ
hn : n ≠ 0
⊢ 0 < ↑n

Next tactic:
positivity
lemma schnirelmannDensity_le_one : schnirelmannDensity A ≤ 1 :=
  schnirelmannDensity_le_of_le 1 one_ne_zero <|
    by 

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ ↑(card (filter (fun x => x ∈ A) (Ioc 0 1))) / ↑1 ≤ 1

Next tactic:
rw [Nat.cast_one, div_one, Nat.cast_le_one]
lemma schnirelmannDensity_le_one : schnirelmannDensity A ≤ 1 :=
  schnirelmannDensity_le_of_le 1 one_ne_zero <|
    by rw [Nat.cast_one, div_one, Nat.cast_le_one]; 

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ card (filter (fun x => x ∈ A) (Ioc 0 1)) ≤ 1

Next tactic:
exact card_filter_le _ _
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
⊢ schnirelmannDensity A ≤ 1 - (↑k)⁻¹

Next tactic:
rcases k.eq_zero_or_pos with rfl | hk'
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · 

Proof state:
case inl
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
hk : 0 ∉ A
⊢ schnirelmannDensity A ≤ 1 - (↑0)⁻¹

Next tactic:
simpa using schnirelmannDensity_le_one
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  

Proof state:
case inr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
⊢ schnirelmannDensity A ≤ 1 - (↑k)⁻¹

Next tactic:
apply schnirelmannDensity_le_of_le k hk'.ne'
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  apply schnirelmannDensity_le_of_le k hk'.ne'
  

Proof state:
case inr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
⊢ ↑(card (filter (fun x => x ∈ A) (Ioc 0 k))) / ↑k ≤ 1 - (↑k)⁻¹

Next tactic:
rw [← one_div, one_sub_div (Nat.cast_pos.2 hk').ne']
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  apply schnirelmannDensity_le_of_le k hk'.ne'
  rw [← one_div, one_sub_div (Nat.cast_pos.2 hk').ne']
  

Proof state:
case inr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
⊢ ↑(card (filter (fun x => x ∈ A) (Ioc 0 k))) / ↑k ≤ (↑k - 1) / ↑k

Next tactic:
apply div_le_div_of_le (Nat.cast_nonneg _)
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  apply schnirelmannDensity_le_of_le k hk'.ne'
  rw [← one_div, one_sub_div (Nat.cast_pos.2 hk').ne']
  apply div_le_div_of_le (Nat.cast_nonneg _)
  

Proof state:
case inr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
⊢ ↑(card (filter (fun x => x ∈ A) (Ioc 0 k))) ≤ ↑k - 1

Next tactic:
rw [← Nat.cast_pred hk', Nat.cast_le]
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  apply schnirelmannDensity_le_of_le k hk'.ne'
  rw [← one_div, one_sub_div (Nat.cast_pos.2 hk').ne']
  apply div_le_div_of_le (Nat.cast_nonneg _)
  rw [← Nat.cast_pred hk', Nat.cast_le]
  

Proof state:
case inr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
⊢ card (filter (fun x => x ∈ A) (Ioc 0 k)) ≤ k - 1

Next tactic:
suffices : (Ioc 0 k).filter (· ∈ A) ⊆ Ioo 0 k
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  apply schnirelmannDensity_le_of_le k hk'.ne'
  rw [← one_div, one_sub_div (Nat.cast_pos.2 hk').ne']
  apply div_le_div_of_le (Nat.cast_nonneg _)
  rw [← Nat.cast_pred hk', Nat.cast_le]
  suffices : (Ioc 0 k).filter (· ∈ A) ⊆ Ioo 0 k; 

Proof state:
case inr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
this : filter (fun x => x ∈ A) (Ioc 0 k) ⊆ Ioo 0 k
⊢ card (filter (fun x => x ∈ A) (Ioc 0 k)) ≤ k - 1
case this
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
⊢ filter (fun x => x ∈ A) (Ioc 0 k) ⊆ Ioo 0 k

Next tactic:
exact (card_le_of_subset this).trans_eq (by simp)
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  apply schnirelmannDensity_le_of_le k hk'.ne'
  rw [← one_div, one_sub_div (Nat.cast_pos.2 hk').ne']
  apply div_le_div_of_le (Nat.cast_nonneg _)
  rw [← Nat.cast_pred hk', Nat.cast_le]
  suffices : (Ioc 0 k).filter (· ∈ A) ⊆ Ioo 0 k; exact (card_le_of_subset this).trans_eq (by 

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
this : filter (fun x => x ∈ A) (Ioc 0 k) ⊆ Ioo 0 k
⊢ card (Ioo 0 k) = k - 1

Next tactic:
simp
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  apply schnirelmannDensity_le_of_le k hk'.ne'
  rw [← one_div, one_sub_div (Nat.cast_pos.2 hk').ne']
  apply div_le_div_of_le (Nat.cast_nonneg _)
  rw [← Nat.cast_pred hk', Nat.cast_le]
  suffices : (Ioc 0 k).filter (· ∈ A) ⊆ Ioo 0 k; exact (card_le_of_subset this).trans_eq (by simp)
  

Proof state:
case this
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
⊢ filter (fun x => x ∈ A) (Ioc 0 k) ⊆ Ioo 0 k

Next tactic:
rw [← Ioo_insert_right hk', filter_insert, if_neg hk]
/--
If `k` is omitted from the set, its Schnirelmann density is upper bounded by `1 - k⁻¹`.
-/
lemma schnirelmannDensity_le_of_not_mem {k : ℕ} (hk : k ∉ A) :
    schnirelmannDensity A ≤ 1 - (k⁻¹ : ℝ) := by
  rcases k.eq_zero_or_pos with rfl | hk'
  · simpa using schnirelmannDensity_le_one
  apply schnirelmannDensity_le_of_le k hk'.ne'
  rw [← one_div, one_sub_div (Nat.cast_pos.2 hk').ne']
  apply div_le_div_of_le (Nat.cast_nonneg _)
  rw [← Nat.cast_pred hk', Nat.cast_le]
  suffices : (Ioc 0 k).filter (· ∈ A) ⊆ Ioo 0 k; exact (card_le_of_subset this).trans_eq (by simp)
  rw [← Ioo_insert_right hk', filter_insert, if_neg hk]
  

Proof state:
case this
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
k : ℕ
hk : k ∉ A
hk' : k > 0
⊢ filter (fun x => x ∈ A) (Ioo 0 k) ⊆ Ioo 0 k

Next tactic:
exact filter_subset _ _
/-- The Schnirelmann density of a set not containing `1` is `0`. -/
lemma schnirelmannDensity_eq_zero_of_one_not_mem (h : 1 ∉ A) : schnirelmannDensity A = 0 :=
  ((schnirelmannDensity_le_of_not_mem h).trans (by 

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : 1 ∉ A
⊢ 1 - (↑1)⁻¹ ≤ 0

Next tactic:
simp
/-- The Schnirelmann density is increasing with the set. -/
lemma schnirelmannDensity_le_of_subset {B : Set ℕ} [DecidablePred (· ∈ B)] (h : A ⊆ B) :
    schnirelmannDensity A ≤ schnirelmannDensity B :=
  ciInf_mono ⟨0, fun _ ⟨_, hx⟩ => hx ▸ by 

Proof state:
A : Set ℕ
inst✝¹ : DecidablePred fun x => x ∈ A
B : Set ℕ
inst✝ : DecidablePred fun x => x ∈ B
h : A ⊆ B
x✝¹ : ℝ
x✝ : x✝¹ ∈ Set.range fun n => ↑(card (filter (fun x => x ∈ A) (Ioc 0 ↑n))) / ↑↑n
w✝ : { n // 0 < n }
hx : (fun n => ↑(card (filter (fun x => x ∈ A) (Ioc 0 ↑n))) / ↑↑n) w✝ = x✝¹
⊢ 0 ≤ (fun n => ↑(card (filter (fun x => x ∈ A) (Ioc 0 ↑n))) / ↑↑n) w✝

Next tactic:
positivity
/-- The Schnirelmann density is increasing with the set. -/
lemma schnirelmannDensity_le_of_subset {B : Set ℕ} [DecidablePred (· ∈ B)] (h : A ⊆ B) :
    schnirelmannDensity A ≤ schnirelmannDensity B :=
  ciInf_mono ⟨0, fun _ ⟨_, hx⟩ => hx ▸ by positivity⟩ fun _ => div_le_div_of_le (by 

Proof state:
A : Set ℕ
inst✝¹ : DecidablePred fun x => x ∈ A
B : Set ℕ
inst✝ : DecidablePred fun x => x ∈ B
h : A ⊆ B
x✝ : { n // 0 < n }
⊢ 0 ≤ ↑↑x✝

Next tactic:
positivity
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A

Next tactic:
rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  

Proof state:
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ 1 ≤ schnirelmannDensity A ↔ {0}ᶜ ⊆ A

Next tactic:
constructor
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · 

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

Next tactic:
rw [← not_imp_not, not_le]
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · rw [← not_imp_not, not_le]
    

Proof state:
case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ ¬{0}ᶜ ⊆ A → schnirelmannDensity A < 1

Next tactic:
simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · rw [← not_imp_not, not_le]
    simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
    

Proof state:
case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
⊢ ∀ x ∈ {0}ᶜ, x ∉ A → schnirelmannDensity A < 1

Next tactic:
intro x hx hx'
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · rw [← not_imp_not, not_le]
    simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
    intro x hx hx'
    

Proof state:
case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
x : ℕ
hx : x ∈ {0}ᶜ
hx' : x ∉ A
⊢ schnirelmannDensity A < 1

Next tactic:
apply (schnirelmannDensity_le_of_not_mem hx').trans_lt
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · rw [← not_imp_not, not_le]
    simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
    intro x hx hx'
    apply (schnirelmannDensity_le_of_not_mem hx').trans_lt
    

Proof state:
case mp
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
x : ℕ
hx : x ∈ {0}ᶜ
hx' : x ∉ A
⊢ 1 - (↑x)⁻¹ < 1

Next tactic:
simpa only [one_div, sub_lt_self_iff, inv_pos, Nat.cast_pos, pos_iff_ne_zero] using hx
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · rw [← not_imp_not, not_le]
    simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
    intro x hx hx'
    apply (schnirelmannDensity_le_of_not_mem hx').trans_lt
    simpa only [one_div, sub_lt_self_iff, inv_pos, Nat.cast_pos, pos_iff_ne_zero] using hx
  · 

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

Next tactic:
intro h
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · rw [← not_imp_not, not_le]
    simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
    intro x hx hx'
    apply (schnirelmannDensity_le_of_not_mem hx').trans_lt
    simpa only [one_div, sub_lt_self_iff, inv_pos, Nat.cast_pos, pos_iff_ne_zero] using hx
  · intro h
    

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

Next tactic:
refine le_ciInf fun ⟨n, hn⟩ => ?_
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · rw [← not_imp_not, not_le]
    simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
    intro x hx hx'
    apply (schnirelmannDensity_le_of_not_mem hx').trans_lt
    simpa only [one_div, sub_lt_self_iff, inv_pos, Nat.cast_pos, pos_iff_ne_zero] using hx
  · intro h
    refine le_ciInf fun ⟨n, hn⟩ => ?_
    

Proof state:
case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
x✝ : { n // 0 < n }
n : ℕ
hn : 0 < n
⊢ 1 ≤ ↑(card (filter (fun x => x ∈ A) (Ioc 0 ↑{ val := n, property := hn }))) / ↑↑{ val := n, property := hn }

Next tactic:
rw [one_le_div (Nat.cast_pos.2 hn), Nat.cast_le, filter_true_of_mem, Nat.card_Ioc, Nat.sub_zero]
/-- The Schnirelmann density of `A` is `1` if and only if `A` contains all the positive naturals. -/
lemma schnirelmannDensity_eq_one_iff : schnirelmannDensity A = 1 ↔ {0}ᶜ ⊆ A := by
  rw [le_antisymm_iff, and_iff_right schnirelmannDensity_le_one]
  constructor
  · rw [← not_imp_not, not_le]
    simp only [Set.not_subset, forall_exists_index, true_and, and_imp, Set.mem_singleton_iff]
    intro x hx hx'
    apply (schnirelmannDensity_le_of_not_mem hx').trans_lt
    simpa only [one_div, sub_lt_self_iff, inv_pos, Nat.cast_pos, pos_iff_ne_zero] using hx
  · intro h
    refine le_ciInf fun ⟨n, hn⟩ => ?_
    rw [one_le_div (Nat.cast_pos.2 hn), Nat.cast_le, filter_true_of_mem, Nat.card_Ioc, Nat.sub_zero]
    

Proof state:
case mpr
A : Set ℕ
inst✝ : DecidablePred fun x => x ∈ A
h : {0}ᶜ ⊆ A
x✝ : { n // 0 < n }
n : ℕ
hn : 0 < n
⊢ ∀ x ∈ Ioc 0 ↑{ val := n, property := hn }, x ∈ A

Next tactic:
rintro x hx