The logical foundations of scientific theories