Skip to content

Commit 9ab6a77

Browse files
committed
chore(Logic): remove bare open Classical (#15836)
1 parent f191832 commit 9ab6a77

File tree

5 files changed

+12
-22
lines changed

5 files changed

+12
-22
lines changed

Mathlib/Logic/Denumerable.lean

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,19 @@ open Function Encodable
184184

185185
/-! ### Subsets of `ℕ` -/
186186

187-
188187
variable {s : Set ℕ} [Infinite s]
189188

190189
section Classical
191190

192-
open scoped Classical
193-
194-
theorem exists_succ (x : s) : ∃ n, (x : ℕ) + n + 1 ∈ s :=
195-
_root_.by_contradiction fun h =>
196-
have : ∀ (a : ℕ) (_ : a ∈ s), a < x + 1 := fun a ha =>
197-
lt_of_not_ge fun hax => h ⟨a - (x + 1), by rwa [add_right_comm, Nat.add_sub_cancel' hax]⟩
198-
Fintype.false
199-
⟨(((Multiset.range (succ x)).filter (· ∈ s)).pmap
200-
(fun (y : ℕ) (hy : y ∈ s) => Subtype.mk y hy)
201-
(by simp [-Multiset.range_succ])).toFinset,
202-
by simpa [Subtype.ext_iff_val, Multiset.mem_filter, -Multiset.range_succ] ⟩
191+
theorem exists_succ (x : s) : ∃ n, (x : ℕ) + n + 1 ∈ s := by
192+
by_contra h
193+
have : ∀ (a : ℕ) (_ : a ∈ s), a < x + 1 := fun a ha =>
194+
lt_of_not_ge fun hax => h ⟨a - (x + 1), by rwa [add_right_comm, Nat.add_sub_cancel' hax]⟩
195+
classical
196+
exact Fintype.false
197+
⟨(((Multiset.range (succ x)).filter (· ∈ s)).pmap
198+
(fun (y : ℕ) (hy : y ∈ s) => Subtype.mk y hy) (by simp [-Multiset.range_succ])).toFinset,
199+
by simpa [Subtype.ext_iff_val, Multiset.mem_filter, -Multiset.range_succ] ⟩
203200

204201
end Classical
205202

Mathlib/Logic/Nontrivial/Basic.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@ import Mathlib.Tactic.Attr.Register
1616
Results about `Nontrivial`.
1717
-/
1818

19-
2019
variable {α : Type*} {β : Type*}
2120

22-
open scoped Classical
23-
2421
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.
2522
theorem nontrivial_of_lt [Preorder α] (x y : α) (h : x < y) : Nontrivial α :=
2623
⟨⟨x, y, ne_of_lt h⟩⟩
@@ -36,6 +33,7 @@ theorem Subtype.nontrivial_iff_exists_ne (p : α → Prop) (x : Subtype p) :
3633
Nontrivial (Subtype p) ↔ ∃ (y : α) (_ : p y), y ≠ x := by
3734
simp only [_root_.nontrivial_iff_exists_ne x, Subtype.exists, Ne, Subtype.ext_iff]
3835

36+
open Classical in
3937
/-- An inhabited type is either nontrivial, or has a unique element. -/
4038
noncomputable def nontrivialPSumUnique (α : Type*) [Inhabited α] :
4139
Nontrivial α ⊕' Unique α :=
@@ -76,6 +74,7 @@ namespace Pi
7674

7775
variable {I : Type*} {f : I → Type*}
7876

77+
open Classical in
7978
/-- A pi type is nontrivial if it's nonempty everywhere and nontrivial somewhere. -/
8079
theorem nontrivial_at (i' : I) [inst : ∀ i, Nonempty (f i)] [Nontrivial (f i')] :
8180
Nontrivial (∀ i : I, f i) := by

Mathlib/Logic/Nontrivial/Defs.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ We introduce a typeclass `Nontrivial` formalizing this property.
1919
Basic results about nontrivial types are in `Mathlib.Logic.Nontrivial.Basic`.
2020
-/
2121

22-
2322
variable {α : Type*} {β : Type*}
2423

25-
open scoped Classical
26-
2724
/-- Predicate typeclass for expressing that a type is not reduced to a single element. In rings,
2825
this is equivalent to `0 ≠ 1`. In vector spaces, this is equivalent to positive dimension. -/
2926
class Nontrivial (α : Type*) : Prop where
@@ -44,6 +41,7 @@ protected theorem Decidable.exists_ne [Nontrivial α] [DecidableEq α] (x : α)
4441
exact ⟨y', h.symm⟩
4542
· exact ⟨y, Ne.symm hx⟩
4643

44+
open Classical in
4745
theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x := Decidable.exists_ne x
4846

4947
-- `x` and `y` are explicit here, as they are often needed to guide typechecking of `h`.

Mathlib/Logic/Small/Basic.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ universe u w v v'
1616

1717
section
1818

19-
open scoped Classical
20-
2119
instance small_subtype (α : Type v) [Small.{w} α] (P : α → Prop) : Small.{w} { x // P x } :=
2220
small_map (equivShrink α).subtypeEquivOfSubtype'
2321

Mathlib/Logic/Small/Defs.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ theorem small_type : Small.{max (u + 1) v} (Type u) :=
8888

8989
section
9090

91-
open scoped Classical
92-
9391
theorem small_congr {α : Type*} {β : Type*} (e : α ≃ β) : Small.{w} α ↔ Small.{w} β :=
9492
fun h => @small_map _ _ h e.symm, fun h => @small_map _ _ h e⟩
9593

0 commit comments

Comments
 (0)