introduction to the z example two. 2 write z specifications for the birthday book problem the...
TRANSCRIPT
Introduction to the ZExample Two
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
The Z specification should include:
Given Sets State Schema Initial State Operations
4
The Birthday Book Z Specification
1. Given Sets [NAME,DATE]
5
The Birthday Book Z Specification
2. State definition
BirthDayBook
known: ℙ NAME
Birthday: NAME ⇸ DATE
known = dom birthday
Notation: D ⇸ R
⇸ ↦ Ξ ∀ × → Δ ≠ ∧ ∨ ∉ ∈ ∅ ∃ ℤ ℕ ℙ ℝ ≙
Birthday Function: Example
known = {Ahmed, Zaid, Qais} birthday = {Ahmed ↦ 17-Ram, Zaid ↦ 27-Sha, Qais ↦ 10-Raj}
The notation x ↦ y
7
The Birthday Book Z Specification
3. Initial State BirthDayInit
BirthdayBook
known = Ø
8
The Birthday Book Z Specification
Operations
1. Add birthday2. Find birthday3. Remind
9
The Birthday Book Z Specification
4. Operations (AddBirthday) AddBirthday BirthdayBook
name? : NAMEdate?: DATE
name? knownknown’= known {name?}birthday’ = birthday {name? ↦ date?}
10
The Birthday Book Z Specification
4. Operations (FindBirthday) FindBirthday BirthdayBook
name? : NAMEdate!: DATE
name? known
date! = birthday(name?)
X
11
The Birthday Book Z Specification
4. Operations (Remind) Remind BirthdayBook
cards! : ℙ NAMEtoday?: DATE
cards!= {n: known | birthday (n) = today!}
X