Clausius' discovery of the first two laws of thermodynamics: a paradigm of reasoning from inconsistencies