**Edit: I got rid of my old definitions. Everything should be clear now**

Since no one has answered my question on MSE, I’m hoping to get an answer here. I apologize if you dislike my writing. I am an undergraduate student and I don’t know whether this is a research question.

## Definition

Consider a continuous $f:A\to[0,1]$ where $A\subseteq[0,1]$.

**Edit: I did not use @Mathworker21's answer because I assumed it would not give the result I am looking for.** Now I realize this is not the case. Here is his definition.

We can assume $A \subseteq [a,b]$, since that's where everything is happening. For ease, I'll have $[a,b] = [0,1]$. Based on the above discussion, I'll just have $P$ be defined on all of $[0,1]$ and continuous. Let $E_1 = [0,1], E_2 = [0,\frac{1}{2}], E_3 = [\frac{1}{2},1], E_4 = [0,\frac{1}{4}], E_5 = [\frac{1}{4},\frac{1}{2}], E_6 = [\frac{1}{2},\frac{3}{4}]$, $E_7 = [\frac{3}{4},1], E_8 = [0,\frac{1}{8}]$, etc.

If $A$ is finite, it's obvious how to define the average of $P$ (just do $\frac{1}{|A|}\sum_{x \in A} P(x)$). So, assume $A$ is infinite. Consider the sets $A\cap E_1, A\cap E_2, \dots$. Let $x_1$ be a point in the first nonempty one of these sets. Let $x_2$ be a point in the second nonempty of these sets, etc. Look at the measures $\delta_{x_1}, \frac{\delta_{x_1}+\delta_{x_2}}{2}, \dots, \frac{\delta_{x_1}+\dots+\delta_{x_N}}{N},\dots$. Since $[0,1]$ is a compact metric space, there is some probability measure $\mu$ on $[0,1]$ that is a weak* limit of some subsequence of these measures, i.e. there is some $(N_k)_k$ with $\frac{1}{N_k}\sum_{j=1}^{N_k} f(x_j) \to \int_0^1 f d\mu$ for each $f \in C([0,1])$.

We then define the average of $P$ over $A$ to be $\int_0^1 Pd\mu$.

For concreteness, suppose that $$f=\operatorname{id}$$ and $$A=\left\{\frac{1}{2^x}+\frac{1}{2^y}+\frac{1}{2^z}:x,y,z\in\mathbb{Z}^{+}\right\}\cap[0,1]$$

My guess is, in this case, the average will converge to $0$. How do we prove whether I am right or wrong? Could we create a better definition that is easier to compute or gives an exact value?

## Possible evidence that the average is zero

Here is a number line plot of all elements of set $A$

```
generateA[n_Integer] :=
Select[Union@
Flatten[Table[
1/2^x + 1/2^y + 1/2^z, {x, 1, n}, {y, x, n}, {z, y, n}]],
0 <= # <= 1 &]
NumberLinePlot[generateA[50], PlotStyle -> PointSize[0.003]]
```

It appears the points become "denser" near $0$. If the 'densest point' carries the most weight in the average, it is possible that the average should be $f(0)=0$.

Also by analysis, if we take the function inside $A$ and set $x$ as constant $a$ and $y$ as constant $b$, taking $z\to\infty$ we get

$$\left\{\frac{1}{2^a}+\frac{1}{2^b}:a,b\in\mathbb{Z}^{+}\right\}$$

This represents all the limit points. Since the limit points are "infinitely denser" than finite points, they should have infinitely greater weight for the average.

If we set $b\to\infty$ we get

$$\left\{\frac{1}{2^a}:a\in\mathbb{Z}^{+}\right\}$$

These represent second-order limit points "closely approximated" by first-order limit and finite points. The second-order limit points should have infinitely more weight than the lower order limit points.

As $a\to\infty$, we get $0$, the third order limit point and the densest point in the set. Third-order limit points should have infinitely more weight than second order, first order, and finite limit point.

From our analysis, it's possible, the average is $f(0)=0$.

Finally, consider the following code (from Wolfram Mathematica). This replicates $L(f,P)$ and $U(f,P)$ which I mentioned earlier:

```
partition[a_List, s_] := Module[{f, r}, f[{}, x_] := {x};
f[l_List, x_] := If[x - l[[1]] < s, Append[l, x], Sow[l]; {x}];
r = Reap[Fold[f, {}, a]];
Append[r[[2, 1]], r[[1]]]]
partition[{0, 1, 2, 7, 10, 11, 12}, 5]
(*{{0,1,2},{7,10,11},{12}}*)
calculate[p_, a_, s_] :=
Module[{parts = partition[a, s], n, inf, sup}, n = Length[parts];
inf = Total[Min[p /@ #] & /@ parts];
sup = Total[Max[p /@ #] & /@ parts];
{inf/n, sup/n}]
calculate[Identity, generateA[500], N[10^(-170)]] // N
```

I get:

```
{0.00598798, 0.00598798}
```

But it took a long time to compute. In fact, the person who gave me this answer doesn't think the sum converges to $0$ when $f=\operatorname{id}$? How do we prove otherwise?

~~Deleted Definition~~

Let $\require{enclose} \enclose{horizontalstrike}{A \subseteq [0,1]}$, and let $\require{enclose} \enclose{horizontalstrike}{P}$ be a partition of $\require{enclose} \enclose{horizontalstrike}{[0,1]}$ such that it is a finite set of sub-intervals $\require{enclose} \enclose{horizontalstrike}{X}$ with disjoint interiors and each subinterval has the same length. Define $\require{enclose} \enclose{horizontalstrike}{P' = \{ X\in P: X\cap A \neq \emptyset\}}$. Define $\require{enclose} \enclose{horizontalstrike}{n' = |P'|}$ (the cardinality of a finite set, or in this case, the number of sub-intervals whose intersection with $\require{enclose} \enclose{horizontalstrike}{A}$ is non-empty).

Calculate/define the following:

$$\require{enclose} \enclose{horizontalstrike}{L_{f,P} = \frac{1}{n^{\prime}} \sum_{X \in P^{\prime}} \bigg(\inf_{t \in X}f(t) \bigg)}$$

$$\require{enclose} \enclose{horizontalstrike}{U_{f,P} = \frac{1}{n^{\prime}} \sum_{X \in P^{\prime}} \bigg(\sup_{t \in X}f(t) \bigg)}$$

Define the limits under refinements of $P$ like so: $$\require{enclose} \enclose{horizontalstrike}{L_f = \lim_{\|P\| \to 0}(L_{f,P})}$$ $$\require{enclose} \enclose{horizontalstrike}{U_f = \lim_{\|P\| \to 0}(U_{f,P})}$$

Where $\require{enclose} \enclose{horizontalstrike}{\|P\|=\sup_{X\in P}\|X\|}$.

$\require{enclose} \enclose{horizontalstrike}{L_f}$ is the 'lower average' of $\require{enclose} \enclose{horizontalstrike}{f}$ on $\require{enclose} \enclose{horizontalstrike}{[0,1]}$ (with respect to partition $\require{enclose} \enclose{horizontalstrike}{P}$). Likewise, $\require{enclose} \enclose{horizontalstrike}{U_f}$ is the 'upper average' of $\require{enclose} \enclose{horizontalstrike}{f}$ on $\require{enclose} \enclose{horizontalstrike}{[0,1]}$ with respect to partition $\require{enclose} \enclose{horizontalstrike}{P}$.

If these lower and upper averages limits converge to the same value (id est: are equal), we are given "my definition of average" of $f$. If they do not converge, then the average is undefined. Notice I define "upper" and "lower" averages to show when an average can not exist.

~~Note I describe $\require{enclose} \enclose{horizontalstrike}{L(f, P)}$ and $\require{enclose} \enclose{horizontalstrike}{U(f, P)}$ as "Riemman-like" because original Riemman-sums have upper and lower sums. However, this doesn't mean they are the same. Here we discard empty sub-interval with no points. This means my average could be anywhere between $\require{enclose} \enclose{horizontalstrike}{f(0)}$ and $\require{enclose} \enclose{horizontalstrike}{f(1)}$ depending on $\require{enclose} \enclose{horizontalstrike}{A}$, and possibly initial $\require{enclose} \enclose{horizontalstrike}{P}$.~~