The Metaphysical Basis of Logic