Aligning the free-energy principle with Peirce’s logic of science and economy of research