Point-Set Topology
Open sets define closeness without distances, giving continuity, compactness, and convergence a home that covers every space ML uses.
Why Does This Exist?
Calculus defines continuity with distances (-), but ML spaces outgrow that: function spaces, distributions with weak convergence, and infinite-dimensional feature maps have closeness without a single natural metric. Point-set topology rebuilds the basics from open sets alone, recovering continuity, compactness, and convergence at the right generality. The payoffs are concrete: extreme-value guarantees (a continuous loss attains its minimum on a compact set), uniform convergence on compacts, and a shared vocabulary for the homology and manifold pages that follow.
The one idea you need first
An open set contains none of its boundary: around every point sits a small ball still inside. Open intervals are open; closed includes its endpoints. Topology declares which sets count as open, then defines everything else from that list.
Think of It Like This
City limits without a ruler
A city defines neighborhoods by walking time, not meters: two houses are "close" when a short stroll connects them, even across a river with a bridge but not across a highway without one. No ruler appears, yet "downtown," "edge," and "approaching the boundary" all make sense.
Open sets are those walking-time neighborhoods. Continuity means connected strolls map to connected strolls. Compactness means the whole city is explorable with finitely many neighborhood maps. Distances would be more precise and less general: the walking definition works for old towns, grids, and hillsides alike.
How It Actually Works
A topology on is a collection of subsets containing , , closed under arbitrary unions and finite intersections. Members are the open sets. A map is continuous when preimages of open sets are open: for all . Compactness: every open cover has a finite subcover. In , Heine-Borel says compact equals closed plus bounded: is compact, and are not.
Worked example
Claim: attains a minimum on but need not on . Check: is closed and bounded, hence compact; continuous, so the extreme-value theorem applies: minimum at . On , the infimum is still but no point attains it ( is missing): take , values with no minimizer inside. One endpoint's membership decides existence. This is why constrained optimization states compact feasible sets explicitly.
A second check: preimage test on with open. Preimage is a union of two opens, hence open: continuity confirmed without any .
Code
def attains_minimum(xs: list[float]) -> tuple[float, float]: vals = [(x * x, x) for x in xs] # f(x) = x^2 on the sampled set return min(vals) # (value, position)
closed = [i / 100 for i in range(0, 201)] # [0, 2]: 0 includedopenish = [i / 100 for i in range(1, 201)] # (0, 2]: 0 missingprint(attains_minimum(closed)) # -> (0.0, 0.0)print(attains_minimum(openish)) # -> (0.0001, 0.01)The closed set attains ; the punctured one bottoms at with the infimum unreachable.
Watch Out For
Assuming closed plus bounded travels beyond finite dimensions
Heine-Borel fails in infinite dimensions: the closed unit ball in function space is not compact, so existence proofs that cite it collapse. Symptoms: minimizing sequences with no convergent subsequence in kernel methods. Switch to weak compactness or add regularization that restores it.
Confusing continuity with uniform continuity on non-compacts
On , is continuous but arbitrarily steep near : no single works everywhere. Optimization steps tuned at explode near the boundary. Compactness upgrades continuity to uniform continuity; without it, localize the analysis.
The Quick Version
- Topology builds closeness from open sets, covering spaces metrics cannot reach.
- Continuous means preimages of opens are open; test with pulling back to .
- Compact in means closed plus bounded; only compacts guarantee attained minima.
- attains on but merely approaches it on .
- Infinite dimensions break Heine-Borel; weak topologies repair it.
- State compactness explicitly in every existence claim.