What is a topological space?

It is a mathematical device to define what a continuous function is, in a general setting.

1. A topological space is a set X together with a collection of subsets of X, called open, such that finite intersections of open sets are open, and arbitrary unions of open sets are open.

2. A function of topological spaces is continuous if inverse images of open sets are open.

What is the intuition behind (1) and (2)?

I claim that it is better to ask, instead, how mathematicians came up with (1) and (2).

1/

At the beginning, people considered continuous functions ℝ → ℝ.

One of the wrong intuitions, at that time, was that such a function is continuous if "you can draw it without lifting the pen".

A counter-example is Cantor's devil's staircase. This continuous function you can't draw, with or without lifting the pen.

https://en.wikipedia.org/wiki/Cantor_function

Mathematicians spoke of continuous functions for a long time before there was a precise definition of continuous function. This was a vague idea, which, nevertheless, was useful.

At some point the definition of continuity for a function f : ℝ → ℝ was elucidated.

∀ x ∈ ℝ , ∀ ε > o, ∃ δ > 0 , ∀ x' ∈ ℝ, ∣ x - x' | < δ → | f(x) - f(x') | < ε.

This definition allowed a lot of theorems to be proved rigorously. This is why it was useful.
A lot of theorems that were claimed, could now be proved.
2/

Cantor function - Wikipedia

This definition *does* have an intuition.

Suppose you want to calculate f(x₀), for example because you are an engineer and want to build a bridge, where x₀ is a physical quantity. Unfortunately, we can't measure x₀ exactly.

But you still want to know what y₀ = f (x₀) is, at least approximately.

But "approximately" doesn't mean anything. You want to know y₀, say, with two correct decimal digits. This will do to build a robust bridge.

Then the question is, how many correct digits of x₀ do you need to know, in order to get the desired two decimal digits of y₀?

More generally, we want the following to be the case. In order to know n digits of output of the function, it is enough to know m digits of the input, where m depends on the input and on n.

This is possible if and only if the function is continuous.

So one intuition about continuity is that "finite amounts of output depend on only finite amounts of input".

3/

@MartinEscardo

> In order to know n digits of output of the function, it is enough to know m digits of the input, where m depends on the input and on n.

if we demand that this dependency be computable (that from a desired output precision n I can compute the necessary input precision m), does this change the meaning of continuity?

@rntz @MartinEscardo Yes, it changes the notion of continuity. There are classically continuous functions that don't have any computable modulus of continuity (a function that tells you how much delta you need for a given epsilon).

(EDIT: This example is bad, see replies.) E.g. constant function that returns Chaitin's constant, because Chaitin's constant does not have a computable fast Cauchy sequence. (It has a computable Cauchy sequence that does not converge at a computable rate.)

@rntz @MartinEscardo This isn't a very good example though ... it kinda doesn't have anything to do with continuity. Maybe a better example would be a continuous function that uses digits of the input to construct Chaitin's constant gradually (via dovetailing).
@rntz Ok I think I've got an example: consider f : [0,1] -> [0,1] where f(x) is defined by looking at the decimal expansion of x (preferring .xxx50000... over .xxx4999...). f(x) is defined as the sum C_i for all i where the ith digit of x is a 5. We define C_i as the contribution to Chaitin's constant obtained during the ith step dovetailing all TMs. So usually C_i is 0, but sometimes it's a nonzero value. This f is continuous because C_i gets arbitrarily small (noncomputably) as i increases.
@rntz argh, no I think this still doesn't work because f is not continuous around .xxx5000... / .xxx4999...) if the corresponding C_i is nonzero. I wonder if there's a way to fix this🤔
@rntz me designing a step function: "as you can see this is clearly continuous"

@rntz ok, i was trying to be cute by using the halting probability to come up with an example, but it's very hard to do anything with TMs without introducing discontinuity.

but now I think i've come up with an example that actually works:

let f(x) be the definite integral from 0 to 1/x of the busy beaver function as a step function on the reals.
then f is continuous, but its modulus of continuity around f(1/n) gives us an upper bound on BB(n-1), so it's not computable.