Inference of Abstraction for a Unified Account of Reasoning and Learning