Having the following Bayesian Network:
A -> B, A -> C, B -> D, B -> F, C -> F, C -> G
$$\begin{array}{l} A&\to&B&\to& D\\\downarrow &&\downarrow \\ C&\to&F\\\downarrow\\G \end{array}$$
With the following probabilities:
$$P(+a)=...$$ $$P(+a|+b)=..., P(+a|¬b)=...$$ $$P(+b|+a)=..., P(+b|¬a)=...$$ $$P(+d|+b)=..., P(+d|¬b)=...$$ $$P(+f|+b,+c)=..., P(+f|¬b,+c)=..., P(+f|¬b,¬c)=...$$ $$P(+g|+c)=..., P(+g|¬c)=...$$
I have to compute this $P(+d, +f, \neg g)$, that I think is:
$$P(+d, +f, \neg g) = P(+a, +d, +f, \neg g) + P(\neg a, +d, +f, \neg g).$$
My question is: how can I compute each addend?
I think is: $$P(+a, +d, +f, \neg g) = P(+a)·P(+d|+b)·P(+f|+b,+c)·P(\neg g,+c)$$
But I'm using $b$ and $c$ that there aren't in $P(+a, +d, +f, \neg g)$.
NOTE: This question is related to this one: Calculate probability using brute-force method.
You need to marginalize all the variables from the joint distribution: $$p(a,d,f,g) = \sum_{b,c}p(a,b,c,d,f,g) = \sum_{b,c} p(a)p(b|a)p(d|b)p(f|b,c)p(g|c).$$
You plug in $+d$, $+f$, and $\neg g$ and you sum for all combinations of $\pm b$ and $\pm c$. When you plug in $+ a$ you get $p(+a,+d,+f,\neg g)$. When you plug in $\neg a$, you get $p(\neg a, +d,+f,\neg g)$. Finally, you sum these two together and you get the required marginal: $$p(+d,+f,\neg g) =\sum_{a,b,c}p(a)p(b|a)p(c|a)p(+d|b)p(+f|b,c)p(\neg g|c).$$ The sum now runs over all combinations of $\pm a$, $\pm b$, and $\pm c$. Hope this helps!