A quantitative theory of the functions of the hippocampal CA3 network in memory