If and only if – this is a concept that is commonly confused by students.
Assume that we have a detector (a circuit that does something when it detects some behavior) that looks at the four most recent symbols sent to its input. Further on, assume that the detector should give 0 as output IF we get a sequence that is exactly …0100. What does that mean exactly?
Well, there is only one thing implied in this statement, namely that it should give output 0 when the condition that last input is …0100 is fulfilled. One can translate it into some programming language as:
function circuit(input): if input == 0100 output = 0
Assume that we call our function with
circuit(0000)
What output do we get? It could be any output! As long as
circuit(0100)
gives output 0, we are fine!
Now, what about ONLY IF, i.e. only if 0100 we get output 0? Well, in order to satisfy this condition, no input other than 0100 CAN give output 0. It does not say that 0100 has to give output 0, though. In the same manner, we can translate the circuit into programming language as:
function circuit(input): if input != 0100 output = 1
Ok, so what does then If AND only if mean? This is when BOTH cases occur at the same time:
function circuit(input): if input == 0100 output = 0 if input != 0100 output = 1
(Here is a more set-theoretical graphical representation of the function mapping from the domain last four symbols to the pentagonian codomain)