Topologies for $2^\mathbb{N}$ Let $X = 2^\mathbb{N}$ and $Y = \mathbb{R}^+$ (i.e. the non-negative numbers). Is there a topology in which functions similar to $f : X \to Y$,
$$ f(A) = \begin{cases}
\frac{1}{|A|}, & |A| < \infty \\ \\ 
\ \ 0, & |A| \not<\infty
\end{cases}$$ 
or $$g(A) = f(A \cap \{2k \mid k \in \mathbb{N}\})$$
would be continuous, but 
$$ h(A) = \begin{cases}
\frac{1}{|A|}, & |A| < \infty \\ \\ 
\ \ 1, & |A| \not<\infty
\end{cases}$$
would not? (For $Y$ take the standard topology on $\mathbb{R}$.)
Is it possible for $X$ to be compact with such topology?
The context is proving that some functions defined on $X$ attain
the minimum/maximum value and I am wondering if it could be done via topology.
The functions I am talking about are similar to $$F(A) = \sum_k [\text{if }B_k \subseteq A\text{ then }b_k\text{ else }0]$$
where $(B_k)$ is some countable family of finite sets, and we know that $F$ is bounded, i.e. there exists $M$ such that $|F(A)| < M$ for every $A$. I will appreciate comments on other approaches too.
Thanks in advance!

Presumably you'll want to define $f$ differently in the case $A = \phi$, but that shouldn't be much of an issue.
If any topology will work, then the smallest topology such that $f$  is continuous in particular will work. This is given by defining $U \subset 2^\mathbb{N}$ to be open iff $U = f^{-1}(V)$ for $V$ open in $Y$. A basis for this topology is $\{\{A : |A|=n \} : n \in \mathbb{N} \} \cup \{ \{A : |A| > n \} : n \in \mathbb{N} \}$.
In this topology, $f$ is indeed continuous, while $h$ is not since ${1}$ is open in the image of $h$ and $h^{-1}(1) = \{A : |A| =1$ or $|A| = \infty \}$ is not open. You can check for yourself that this topology is compact. 
I haven't thought about the optimization part, but hopefully this gives you somewhere to start on that.
