Skip to content

Commit cf85b04

Browse files
committed
feat(Topology): use OrderHomClass for CompactExhaustion (#6461)
Also rename `is_compact'` field to `isCompact'`.
1 parent a71e958 commit cf85b04

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Mathlib/Topology/SubsetProperties.lean

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ structure CompactExhaustion (X : Type*) [TopologicalSpace X] where
14431443
/-- The sequence of compact sets that form a compact exhaustion. -/
14441444
toFun : ℕ → Set X
14451445
/-- The sets in the compact exhaustion are in fact compact. -/
1446-
is_compact' : ∀ n, IsCompact (toFun n)
1446+
isCompact' : ∀ n, IsCompact (toFun n)
14471447
/-- The sets in the compact exhaustion form a sequence:
14481448
each set is contained in the interior of the next. -/
14491449
subset_interior_succ' : ∀ n, toFun n ⊆ interior (toFun (n + 1))
@@ -1453,29 +1453,33 @@ structure CompactExhaustion (X : Type*) [TopologicalSpace X] where
14531453

14541454
namespace CompactExhaustion
14551455

1456-
-- porting note: todo: use `FunLike`?
1457-
instance : CoeFun (CompactExhaustion α) fun _ => ℕ → Set α :=
1458-
⟨toFun⟩
1456+
instance : @RelHomClass (CompactExhaustion α) ℕ (Set α) LE.le HasSubset.Subset where
1457+
coe := toFun
1458+
coe_injective' | ⟨_, _, _, _⟩, ⟨_, _, _, _⟩, rfl => rfl
1459+
map_rel f _ _ h := monotone_nat_of_le_succ
1460+
(fun n ↦ (f.subset_interior_succ' n).trans interior_subset) h
14591461

14601462
variable (K : CompactExhaustion α)
14611463

1464+
@[simp]
1465+
theorem toFun_eq_coe : K.toFun = K := rfl
1466+
14621467
protected theorem isCompact (n : ℕ) : IsCompact (K n) :=
1463-
K.is_compact' n
1468+
K.isCompact' n
14641469
#align compact_exhaustion.is_compact CompactExhaustion.isCompact
14651470

14661471
theorem subset_interior_succ (n : ℕ) : K n ⊆ interior (K (n + 1)) :=
14671472
K.subset_interior_succ' n
14681473
#align compact_exhaustion.subset_interior_succ CompactExhaustion.subset_interior_succ
14691474

1470-
theorem subset_succ (n : ℕ) : K n ⊆ K (n + 1) :=
1471-
Subset.trans (K.subset_interior_succ n) interior_subset
1472-
#align compact_exhaustion.subset_succ CompactExhaustion.subset_succ
1473-
14741475
@[mono]
14751476
protected theorem subset ⦃m n : ℕ⦄ (h : m ≤ n) : K m ⊆ K n :=
1476-
show K m ≤ K n from monotone_nat_of_le_succ K.subset_succ h
1477+
OrderHomClass.mono K h
14771478
#align compact_exhaustion.subset CompactExhaustion.subset
14781479

1480+
theorem subset_succ (n : ℕ) : K n ⊆ K (n + 1) := K.subset n.le_succ
1481+
#align compact_exhaustion.subset_succ CompactExhaustion.subset_succ
1482+
14791483
theorem subset_interior ⦃m n : ℕ⦄ (h : m < n) : K m ⊆ interior (K n) :=
14801484
Subset.trans (K.subset_interior_succ m) <| interior_mono <| K.subset h
14811485
#align compact_exhaustion.subset_interior CompactExhaustion.subset_interior
@@ -1504,7 +1508,7 @@ theorem mem_iff_find_le {x : α} {n : ℕ} : x ∈ K n ↔ K.find x ≤ n :=
15041508
/-- Prepend the empty set to a compact exhaustion `K n`. -/
15051509
def shiftr : CompactExhaustion α where
15061510
toFun n := Nat.casesOn n ∅ K
1507-
is_compact' n := Nat.casesOn n isCompact_empty K.isCompact
1511+
isCompact' n := Nat.casesOn n isCompact_empty K.isCompact
15081512
subset_interior_succ' n := Nat.casesOn n (empty_subset _) K.subset_interior_succ
15091513
iUnion_eq' := iUnion_eq_univ_iff.2 fun x => ⟨K.find x + 1, K.mem_find x⟩
15101514
#align compact_exhaustion.shiftr CompactExhaustion.shiftr

0 commit comments

Comments
 (0)