In his book Quantum Computer Science, Mermin says that, although we'll need lots of "workspace" qubits in addition to those in the input and output registers, we can essentially ignore these in our analysis so long as we start and end with them in some fixed state, since they'll then be unentangled with the registers which contain any information we actually care about. He then goes into some detail to show that this is possible, i.e. that we can use the workspace bits, yet leave them in a fixed state. In fact, his method is intended to leave them in the initial state.
Here's his diagram of the approach:
The top bits are the workspace, the middle ones the input and the bottom ones the output. We apply some unitary (hence invertible) operator V to do the actual job of calculating the function using only the input and workspace bits. Then we copy the result to the output (using a series of cNOT gates). And finally we undo the effect of V by applying its inverse, which, Mermin says, leaves both the input and workspace in their original states.
I'm a complete novice in all this, but it looks wrong. After the copy, all three sets of bits are entangled and, it seems to me, we'd have to undo the copy as well as V to be sure that the input and workspace are restored to their original states.
Just to give the simplest example, suppose workspace, input and output all consist of just one bit. And suppose that V actually just applies a Hadamard to the input, so that the inverse is another Hadamard. Applying a Hadamard to the input, a cNOT with input as control and output as target and then another Hadamard to the input does not return the input to its original state.
So, in general, applying $V^\dagger$ does not look like any guarantee that the workspace will end up in its original state.
If I'm wrong--as I assume given my inexperience--what's my error? Or, in the unlikely event that I'm right, what can be done to make sure that the workspace state is restored and hence that we can, in fact, ignore it.
Here's a specific case in which, as far as I can tell, things don't work out. As above, input, output and workspace are each just one bit.