# The Law of Total Covariance on a Gaussian Process

Suppose that we have a Gaussian process with zero mean and covariance function $k$, $$f(x) \sim \mathcal{GP}(0, K(x,x')) \tag{1}$$

It is usually assumed that there are a collection of training inputs $X = [\mathbf{x}_0, \ldots, \mathbf{x}_N]$, and training outputs $\mathbf{f} = [f_0, \ldots, f_N]$, such that, $$\mathbf{f} \sim \mathcal{N}(0, K(X,X)) \tag{2}$$ see for example Gaussian Processes for Machine Learning by Rasmussen and Williams.

My question how to, instead, deal with connected sets of known training points, i.e., $X = [X_0, \ldots, X_N] \subset \mathbb{R}^N$, with $X_i \cap X_j = \emptyset$, with constant training outputs, i.e. $f(x_i) = \kappa_i$ for every $x_i \in X_i$.

Rather than viewing the sets themselves as random variables, with a specified covariance functions, I need to extend the idea of a Gaussian process defined by points over entire sets.

The law of total covariance gives that, $$\operatorname{Cov}(\kappa_i, \kappa_j) = \int_{X_i \times X_j} K(x_i, x_j)p(x_i, x_j) d(x_i,x_j)$$ for random variables $\kappa_i$. This gives a covariance between the outputs, using a covariance function which is defined in terms of points.

Is there a way of using the process notation, such as in (1) or (2), to deal with this idea properly?