Improving Memory Through Logical Reasoning