120 likes | 218 Views
Introduction to the Z Example One. Write Z specifications for the Exam Schedule Problem. The Exam Schedule system keeps track of all final exams. It allows you to add, delete, update, and search exams of all courses in the college. Every exam has a specific date.
E N D
Write Z specifications for the Exam Schedule Problem • The Exam Schedule system keeps track of all final exams. It allows you to add, delete, update, and search exams of all courses in the college. Every exam has a specific date.
The Z specification should include: • Given Sets • State Schema • Initial State • Operations
The Exam Schedule Z Specification 1. Given Sets [COURSE,DATE]
The Exam Schedule Z Specification • State definition • ExamSchedule • courses: P COURSE • exam: COURSE ⇸DATE • courses = dom exam
The Exam Schedule Z Specification 3. Initial State ExamScheduleInit ExamSchedule courses = Ø
The Exam Schedule Z Specification Operations Add exam Delete exam Find exam Change date
The Exam Schedule Z Specification Operations (AddExam) AddExam ExamSchedule course? : COURSE date?: DATE course? courses courses’= courses {course?} exam’ = exam {course?↦ date?}
The Exam Schedule Z Specification Operations (DeleteExam) DeleteExam ExamSchedule course? : COURSE course? courses courses’= courses\{course?}
The Exam Schedule Z Specification Operations (FindExam) FindExam ExamSchedule course? : COURSE date!: DATE course? courses date! = exam(course?) X
The Exam Schedule Z Specification Operations (ChangeDate) ChangeDate ExamSchedule course? : COURSE date?: DATE course? courses exam’ = exam {course? ↦date?}
The Exam Schedule Z Specification Operations (ChangeDate) ChangeDate ExamSchedule course? : COURSE date?: DATE course? courses exam’ = exam {course? ↦date?}