An Investigation of the Laws of Thought, on Which are Founded the Mathematical Theories of Logic and Probabilities