A frog, whose behavior is mostly genetically determined, simply has to leap into the air with its mouth open when it detects a small blurry dot passing by. It does not need to know about flies, nor does it need to worry about eating. If a fly ends up in its mouth after the leap, a different reflex can be triggered, and the frog eats. The frog does not need to relate one event with the other. Because the environment is set up the way it is, small blurry dots are usually flies, and the leap usually leads to a mouthful of food, which triggers the response to eat. The frog's instincts don't need to be more specific, as long as certain expectations about the environment remain true.
Comments