  We present how basic logic gates including NAND, NOR and XOR gates can be
implemented counterfactually. The two inputs (Bob and Charlie) and the output
(Alice) of the proposed counterfactual logic gate are not within the same
station but rather separated in three different locations. We show that there
is no need to pre-arrange entanglement for the gate, and more importantly,
there is no real physical particles traveling among Alice, Bob and Charlie
during the information processing. Bob and Charlie only need to independently
control the blocking and unblocking of the transmission channels that connect
them to Alice. In this way, they can completely determine the state of a real
photon at Alice's end, thereby leading to implement a counterfactual logic
gate. The functionality of a particular counterfactual logic gate is determined
only by an appropriate design of Alice's optical device. Furthermore, by
utilizing the proposed counterfactual logic gates, we demonstrate how to
counterfactually prepare the Greenberger-Horne-Zeilinger state and W state with
three remote quantum objects, which are in superposition states of blocking and
unblocking the transmission channel.
