Logic of Matrix Multiplication