Teaching Formal Methods in Computer Science Undergraduates A. SOTIRIADOU and P. KEFALAS Department of Computer Science CITY Liberal Studies, Affiliated Institution of the University of Sheffield 13 Tsimiski Street, 546 24 Thessaloniki, GREECE {sotiriadou, kefalas}@city.academic.gr URL: http://www.city.academic.gr/ Abstract : - Formal Methods refer to a variety of mathematical modeling techniques, which are used both to model the behaviour of a computer system and to verify that the system satisfy design, safety and functional properties. The incorporation of a Formal Methods course in the undergraduate Computer Science curriculum is strongly suggested by scientific societies such as ACM, IEEE and BCS. In this paper, we record out experience of teaching the 2 nd year Computer Science students Formal Specification, using the Z notation as a paradigm. We present a methodology for teaching formal specification as well as criteria for setting and assessing students work. We argue that students, through a rigorous mathematical approach to system specification, acquire knowledge, skills and abilities that are useful in all courses of the curriculum as well as in their professional lives as Computer Scientists. Keywords: - Computer Science Curriculum, Teaching and Learning, Formal Methods, Formal Specification. 1 Introduction Software reliability is a desirable property, especially in safety critical systems. To this end, the promotion of formal methods in the software development process is a promising approach [1,2]. Therefore, the introduction of formal methods into the education of the future computer scientists is vital for the success of formal methods [1, 3, 4, 5]. Scientific societies such as the Association for Computer Machinery (ACM), the Institute of Electronic and Electrical Engineering (IEEE- Computer Society) [6], and the British Computer Society (BCS) [7] list formal methods as one of the concepts that an undergraduate programme in Computer Science (CS) should incorporate. In this paper, we record our experience on the twofold role that a Formal Methods course plays in the CS undergraduate curriculum. We believe that such a course is of extreme importance to an undergraduate CS student, and do not only contribute to the student’s knowledge but most importantly to the appreciation of formal specification and also to the skills acquired through the corresponding learning process. In the next sections, we present the goals of the specific course in formal methods. We then provide a justification for adapting the notation used, i.e. the Z specification language. A description of the teaching method and the teaching material follow. Finally, we discuss ways of assessing student performance and the opinions of the students for the particular course. 2 Aims of the course Formal methods refer to the variety of mathematical modelling techniques that are used to specify and model the behaviour of a computer system and to verify that the system design and implementation satisfy system functional and safety properties. These specifications and verifications may be done using a variety of techniques and with various degrees of rigor. Formal specification is the use of notations derived mostly from formal logic in order to describe assumptions about the world that a system will model, requirements that the system should achieve and a design to achieve those requirements. Many CS departments of traditional Universities have incorporated formal methods in their curricula. Most of those courses cover aspects of both formal specification and formal verification, following a breadth-first approach. Our approach, however, in designing the specific formal methods course incorporates solely the formal specification component, which is taught in depth. There are a number of reasons for suggesting the latter. First, for many CS students it is already difficult to conceive that mathematics and mathematical modelling play an essential role in Computer Science. Secondly, during their first year of studies students have completed among others, courses in Structural and Object Oriented Programming, Programming Methodology and Systems Analysis and Design. Our experience shows that by the beginning of the second year of their studies they