# How does syndrome extraction in bit-flip codes using stabilizers work?

I'm trying to understand how syndrome extraction in bit-flip code works. I've been reading Quantum Error Correction: An Introductory Guide, and I was wondering how the syndrome extraction part in this circuit works:

For example, if the state before the syndrome extraction part is $$|++⟩|100⟩$$, then $$Z_2⊗Z_1$$ is applied and the state is still $$|++⟩|100⟩$$ and then $$Z_3⊗Z_2$$ is applied, which turns the state to $$-|++⟩|100⟩$$, then Hadamard gates are applied and I think the state should be $$-|00⟩|100⟩$$, which means first qubit from left is $$0$$, but it's $$1$$. I used Quirk and it's also $$1$$ there:

How does it work? Why is the controlled qubit affected?

The state is not $$-\vert ++\rangle\vert 100\rangle$$ after the second set of gates. That would be true if you applied $$Z$$ gates but you are applying controlled $$Z$$ gates.
Let's just look at the controlled $$Z_3$$ gate since that's where the bit flip error is and ignore the remaining registers. This picks up a minus sign if both the control and the target qubit are $$\vert 1\rangle$$. Omitting normalization constants of $$\frac{1}{\sqrt{2}}$$, you get
$$\vert +\rangle\vert 1\rangle = \vert 0\rangle\vert 1\rangle + \vert 1\rangle\vert 1\rangle\xrightarrow{CZ} \vert 0\rangle\vert 1\rangle - \vert 1\rangle\vert 1\rangle = \vert - \rangle\vert 1\rangle.$$
The next Hadamard on the ancilla converts $$\vert -\rangle \xrightarrow{H} \vert 1\rangle$$ and gives you the measurement outcome you see.