A cognitive analysis of students’ activity: an example in mathematics