Book contents
- Frontmatter
- Contents
- Preface
- I Why Z?
- II Introducing Z
- III Elements of Z
- IV Studies in Z
- V Programming with Z
- Further reading
- A Glossary of Z notation
- B Omitted features
- C Operator precedence
- D The Z mathematical tool-kit
- E Selected Laws
- F Solutions to selected exercises
- G Other formal notations
- Bibliography
- Index
F - Solutions to selected exercises
Published online by Cambridge University Press: 06 July 2010
- Frontmatter
- Contents
- Preface
- I Why Z?
- II Introducing Z
- III Elements of Z
- IV Studies in Z
- V Programming with Z
- Further reading
- A Glossary of Z notation
- B Omitted features
- C Operator precedence
- D The Z mathematical tool-kit
- E Selected Laws
- F Solutions to selected exercises
- G Other formal notations
- Bibliography
- Index
Summary
From Chapter 6
The state machine model did not specify the initial state. The only reasonable choice is the PATIENTS state.
From Chapter 10
beam = on ↔ door = closed means the beam is on when the door is closed and the beam is off when the door is open. This is a bad requirement because the beam will turn on the moment the door is closed.
beam = on ∧ door = closed means the beam is always on and the door is always closed. Obviously useless.
beam = on ∨ door = open means the beam is on or the door is open, or both. This is a bad requirement because it allows the beam to be on when the door is open.
beam = off ∨ door = closed means the beam is off or the door is closed, or both. This is a good requirement, and means exactly the same thing as beam = on ⇒ door = closed, according to the law p ⇒ q ⇔ ¬ p ∨ q.
x ∈ dom f ⇒ f x = y is true when x ∈ dom f is false, otherwise it has the same truth value as f x = y.
From Chapter 11
Represent each triangle as a tuple whose components are the lengths of its three sides. These tuples are called Pythagorean triples because their components are related by the Pythagorean theorem; (3, 4, 5) is a Pythagorean triple because 32 + 42 = 52.
- Type
- Chapter
- Information
- The Way of ZPractical Programming with Formal Methods, pp. 322 - 325Publisher: Cambridge University PressPrint publication year: 1996