A lock-in style gate is exact multiply-and-sum arithmetic. Exact arithmetic here means exact results for the stated model inputs; measured inputs still carry uncertainty and significant-figure limits.
highlighted = computed this step
A matching reference makes positive products
Signal and reference are both 1, -1, 1, -1, so products are all 1.
(1,−1,1,−1)⋅(1,−1,1,−1)=(1,1,1,1)
The correlation sum accepts the signal
The products add to correlation 4, so accepted bit is 1.