Theory of the scanning tunneling microscope