2 Write Z specifications for the Birthday Book Problem The Birthday Book system keeps track of peoples birthdays It allows you to add and search for birthdays Also it issues reminders 3 ID: 756356
Download Presentation The PPT/PDF document "Introduction to the Z Example Two" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Introduction to the ZExample Two
Slide2
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.Slide3
3
The Z specification should include:
Given Sets
State Schema
Initial State
OperationsSlide4
4
The Birthday Book Z Specification
1. Given Sets
[NAME,DATE]Slide5
5
The Birthday Book Z Specification
State definition
BirthDayBook
known:
ℙ
NAME
Birthday:
NAME
⇸
DATE
known = dom birthdayNotation: D ⇸ R⇸ ↦ Ξ ∀ × → Δ ≠ ∧ ∨ ∉ ∈ ∅ ∃ ℤ ℕ ℙ ℝ ≙ Slide6
Birthday Function: Exampleknown = {Ahmed,
Zaid
,
Qais
}
birthday = {Ahmed
↦ 17-Ram,
Zaid
↦ 27-Sha,
Qais
↦ 10-Raj}The notation x ↦ ySlide7
7
The Birthday Book Z Specification
3. Initial State
BirthDayInit
BirthdayBook
known = Ø
Slide8
8
The Birthday Book Z Specification
Operations
Add birthday
Find birthday
RemindSlide9
9
The Birthday Book Z Specification
Operations (
AddBirthday
)
AddBirthday
BirthdayBook
name?
:
NAME date?: DATE name? known known’= known {name?} birthday’ = birthday
{name? ↦ date?}
Slide10
10
The Birthday Book Z Specification
Operations (
FindBirthday
)
FindBirthday
BirthdayBook
name
? :
NAME date!: DATE name? known date! = birthday(name?)
XSlide11
11
The Birthday Book Z Specification
Operations
(Remind)
Remind
BirthdayBook
cards!
:
ℙ
NAME today?: DATE cards!= {n: known | birthday (n) = today!}
X