Download presentation
Presentation is loading. Please wait.
Published byNatalie Owen Modified over 9 years ago
1
Introduction to the Z Example Two
2
2 Write Z specifications for the Birthday Book Problem The Birthday Book system keeps track of people’s birthdays. It allows you to add and search for birthdays. Also, it issues reminders.
3
3 The Z specification should include: Given Sets State Schema Initial State Operations
4
4 The Birthday Book Z Specification 1. Given Sets [NAME,DATE]
5
5 The Birthday Book Z Specification 2. State definition BirthDayBook known: ℙ NAME Birthday: NAME DATE known = dom birthday Notation: D R ↦ Ξ ∀ × → Δ ≠ ∧ ∨ ∉ ∈ ∅ ∃ ℤ ℕ ℙ ℝ ≙
6
Birthday Function: Example known = {Ahmed, Zaid, Qais} birthday = {Ahmed ↦ 17-Ram, Zaid ↦ 27-Sha, Qais ↦ 10-Raj} The notation x ↦ y
7
7 The Birthday Book Z Specification 3. Initial State BirthDayInit BirthdayBook known = Ø
8
8 The Birthday Book Z Specification Operations 1. Add birthday 2. Find birthday 3. Remind
9
9 The Birthday Book Z Specification 4. Operations (AddBirthday) AddBirthday BirthdayBook name? : NAME date?: DATE name? known known’= known {name?} birthday’ = birthday {name? ↦ date?}
10
10 The Birthday Book Z Specification 4. Operations (FindBirthday) FindBirthday BirthdayBook name? : NAME date!: DATE name? known date! = birthday(name?)
11
11 The Birthday Book Z Specification 4. Operations (Remind) Remind BirthdayBook cards! : ℙ NAME today?: DATE cards!= {n: known | birthday (n) = today!}
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.