We assume that we have a finite set of agents with approximate knowledge about a certain function, and from this collection of approximations we want to recover the actual value of the function.
More precisely, suppose that there is a finite set $S$, a function $f:S \rightarrow \{ 0,1 \}$, and a finite set $A$ of agents such that for every $a \in A$ and every $s \in S$, $a$ has some opinion about the value of $f(s)$. We assume that for every agent $a \in A$, there is a probability $p_a>\frac{1}{2}$ such that for every $s \in S$ the probability that $a$'s opinion about the value of $f(s)$ is correct is $p_a$. Furthermore, we assume that $S$ and $A$ are both significantly large finite sets, and that $p_a$ is never equal to $1$, but that it is close to $1$ for a significant number of agents. So we have some agents with good knowledge of $f$, but we don't know in advance which of the agents are the ones with good knowledge.
Now the intuitive idea is that we can identify the agents with good knowledge of $f$ by realising that they agree about most values of $f$, since those with bad knowledge of $f$ vary in a random rather than in a systematic way from the actual value of $f$, and hence are not likely to contain a subset of agents that agrees on most values of $f$. Once we have identified the agents with good knowledge of $f$, we can recover $f$ with high confidence (certainly much higher than any of the agents individually can have) by identifying the values that most of the agents with good knowledge of $f$ agree on.
How can this intuitive solution be made mathematically precise with methods from probability theory and/or statistics? Is there some known algorithm for recovering $f$ from the input data? Or is it necessary to specify more precisely the distribution of $p_a$s in $(\frac{1}{2},1)$ in order to specify a solution?