A Logical Theory of Analogy via Common Abstraction