I am self studying Munkres' Topology and was struck on this exercise question of section 13. I don't have any help from teacher or friends. So, I am asking for any explanation here.
The question is
Show that if $A$ is a basis for a topology on $X$, then the topology generated by $A$ equals the intersection of all topologies on $X$ that contain $A$. Prove the same if $A$ is a subbasis.
The intuition is clear to me but I don't know how to write a proper proof. Can you please tell me for both parts.
Suppose $\mathcal{B}$ is a base for a topology $\mathcal{T}$.
We want to show $$\mathcal{T} = \bigcap \{ \mathcal{T}': \mathcal{T}' \text{ is a topology on } X; \mathcal{B} \subseteq \mathcal{T}'\}$$
So let $O$ be in $\mathcal{T}$, and we want to show it is in the intersection, so let $\mathcal{T}'$ be any topology that contains $\mathcal{B}$ as a subset. Then $O$ in $\mathcal{T}$ means that $O = \bigcup \mathcal{B'}$ where $\mathcal{B}' \subseteq \mathcal{B}$, because the topology generated by a base is the set of unions of subfamilies of that base (!). But so $$\mathcal{B}' \subseteq \mathcal{B} \subseteq \mathcal{T}'$$ and as $\mathcal{T}'$ is closed under unions (being a topology), $O \in \mathcal{T}'$.
As $\mathcal{T}'$ was an arbitary topology that makes up the intersection we have that $O$ is in the right hand intersection of topologies. This shows one inclusion.
One minor modification is needed for the subbase case: if $\mathcal{S}$ is a subbase for that same topology $\mathcal{T}$, then we can define a base $\mathcal{B}$ from it by taking all intersections of finite subfamilies of $\mathcal{S}$ and $\mathcal{T}$ is then also the topology generated by $\mathcal{B}$, and any topology $\mathcal{T}'$ that contains $\mathcal{S}$ will also contain $\mathcal{B}$, as all topologies are closed under finite intersections, so the subbase case reduces to the base case.
The other, reverse inclusion is trivial, in both cases. $\mathcal{T}$ (the set of unions of base subfamilies) is itself one of the topologies that contains $\mathcal{B}$ (as each member $B \in \mathcal{B}$ is trivially the union of $\{B\} \subseteq \mathcal{B}$ and by previous results we know the set of unions is a topology) and so trivially, if $O$ is in the intersection it is in $\mathcal{T}$ in particular.
So we have equality of topologies. In all pedantic detail...