Book contents
- Frontmatter
- Contents
- Preface
- I Why Z?
- II Introducing Z
- III Elements of Z
- 8 Elements
- 9 Structure
- 10 Logic
- 11 Synthesis
- 12 Schemas and schema calculus
- 13 Schema types and bindings
- 14 Generic definitions and free types
- 15 Formal reasoning
- Further reading
- 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
10 - Logic
Published online by Cambridge University Press: 06 July 2010
- Frontmatter
- Contents
- Preface
- I Why Z?
- II Introducing Z
- III Elements of Z
- 8 Elements
- 9 Structure
- 10 Logic
- 11 Synthesis
- 12 Schemas and schema calculus
- 13 Schema types and bindings
- 14 Generic definitions and free types
- 15 Formal reasoning
- Further reading
- 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
We have described a universe that is richly populated with individuals, sets, tuples, relations, functions, and sequences. We can extend our univetse indefinitely by using operators to build up ever more complex structures. But we need something more.
We need a way to classify the profusion of structures we can create. We need to divide the wheat from the chaff, the sheep from the goats, the bogus from the bona fide. We will make an essentially binary distinction between the answer we are looking for — the objects we wish to model — and everything else. Our tool for distinguishing the two is called logic. The concept of a purely binary classification may seem crude, but with logic we can express distinctions that are exceedingly fine.
Basic predicates
The textual unit of logic is the predicate. There are just a few kinds of basic predicates. All the others are built up from these.
The simplest predicates are true and false. We say true and false are the two logical constants or truth values. In fact, every predicate has one value or the other, true or false. There are many rules for simplifying predicates or otherwise inferring whether any predicate, no matter how complicated, is true or false.
The next basic predicate is equals, =. The predicate e1 = e2 is true when the two expressions e1 and e2 have the same value, and is false otherwise.
- Type
- Chapter
- Information
- The Way of ZPractical Programming with Formal Methods, pp. 96 - 111Publisher: Cambridge University PressPrint publication year: 1996