How many cores does a Mid 2012 Macbook Air have?
Your computer has 2 cores, but 4 logical processors. What you are seeing is Intel's hyper-threading technology. This technology puts multiple logical processors on a single core, so that each core can run multiple threads at once.

The difference between this and multiple cores is that hyper-threading only duplicates the parts of the processor which control the current state, not the actual execution unit, but multiple cores duplicate everything. This means that your computer will run like it has four cores only if the threads on each core are using different parts of the execution unit, but if the exact same thing was running on both threads in a single core, it wouldn't be any faster than a two-core system without hyper-threading.