Diagnostic work in mathematics