Probability of composition of two random algorithms working on sets

20 Views Asked by At

Suppose we have a random algorithm $A$ that builds a set $\mathcal{S}^n$ of $n$ elements from a domain $\mathcal{H}$, and, in particular, the probability of a particular $\hat{h} \in \mathcal{H}$ to be put in a generic $\mathcal{S}^n$ is

$Pr(\hat{h} \in \mathcal{S}^n) = 1- (1-p^k(1-p)^{m-k})^n$

Then, we have another algorithm $B$ that picks an item from $\mathcal{S}^n$ with a certain probability that is a function of $\mathcal{S}^n$, let's say $G(\mathcal{S}^n)$. I suppose that this probability should be considered as conditioned on the fact that the particular element is in $\mathcal{S}^n$, right?

As a final outcome, I want to compute the probability of $B$ outputting a generic $\hat{h}$. So that, I would call it:

$Pr(B(\mathcal{S}^n) = \hat{h} \;|\; \hat{h} \in \mathcal{S}^n) = G(\mathcal{S}^n)$

Or maybe is it better

$Pr(B(\mathcal{S}^n) = \hat{h} \;|\; \hat{h} \in \mathcal{S}^n, \mathcal{S}^n)$ ?

If I'm not wrong, it would be ok to write:

$Pr(B(\mathcal{S}^n) = \hat{h}) = Pr(B(\mathcal{S}^n) = \hat{h} \;|\; \hat{h} \in \mathcal{S}^n) Pr(\hat{h} \in \mathcal{S}^n)$

or should I write:

$Pr(B(\mathcal{S}^n) = \hat{h}) = \sum_{\mathcal{S}^n_k} Pr(B(\mathcal{S}^n_k) = \hat{h} \;|\; \hat{h} \in \mathcal{S}^n_k) Pr(\mathcal{S}^n_k)$

over all the possible $\mathcal{S}^n_k$ and assuming that

$Pr(B(\mathcal{S}^n_k) = \hat{h} \;|\; \hat{h} \notin \mathcal{S}^n_k) = 0$ ?

In this case, I suppoose that $Pr(\mathcal{S}^n_k)$ should be the product of the probabilities of each element to be put in a generic random set. I'm stuck with these ideas.

Another possible idea is the following:

$Pr(B(\mathcal{S}^n) = \hat{h} \;|\; \hat{h} \in \mathcal{S}^n, \mathcal{S}^n) = \frac{Pr(B(\mathcal{S}^n) = \hat{h},\; \hat{h} \in \mathcal{S}^n \;|\; \mathcal{S}^n) Pr(\mathcal{S}^n)}{Pr(\hat{h} \in \mathcal{S}^n \;|\; \mathcal{S}^n) Pr(\mathcal{S}^n)}$

Any hint?