The program invariant is maintained, as any context incompatible with b isn't affected by this operation. Any context that is compatible with b, the product of the values of t1 and t2 on that context is the same as the value of t1 ⊗tt2 on that context. The completeness part of the invariant isn't affected by multiplying.

## 4.2 Summing Out A Variable That Appears In The Table

Suppose we are eliminating Y, and have a confactor:
-b, t such that table t involves Y, and no other confactor that is compatible with b contains Y, we can replace this confactor with
-b,-
Y
t Note that after this operation Y is summed out in context b. Correctness: To see why this is correct, consider a context c on the remaining variables (c doesn't give a value for Y). If c isn't compatible with b, it isn't affected by this operation. If it is compatible with b, by elementary probability theory:

$\epsilon_{\mathrm{t}}\tau_{\mathrm{l}}\epsilon_{\mathrm{t}}$
P(c) =-
i P(c ∧ Y=vi)
By the program invariant, and because there are no other confactors containing Y that are compatible with c, P(c ∧ Y=vi) = pip, for some product p of contributions of confactors that don't involve Y.

Exactly the same confactors will be used for the different values of Y. Thus we have P(c) = p(i pi),
and so we have maintained the first part of the program invariant. The second part of the program invariant is trivially maintained.

## 4.3 Summing Out A Variable In The Body Of Confactors

Suppose we are eliminating Y, with domain {v1, . . . , vk }, and have confactors:
-b ∧ Y=v1, T1
. . .

-b ∧ Y=vk , Tk such that there are no other confactors that contain Y whose context is compatible with b. We can replace these confactors with the confactor:
-b, T1 ⊕t. . . ⊕t Tk Where ⊕tis the additive analogue of ⊗t. That is, it follows definition 3, but using addition of the values instead of multiplication.

Note that after this operation Y is summed out in context b.

Correctness: To see why this is correct, consider a context c on the remaining variables (c doesn't give a value for Y). If c isn't compatible with b, it isn't affected by this operation. If it is compatible with b, by elementary probability theory:

$$P(c)=\sum_{i}P(c\wedge Y{=}v_{i})$$
