没有合适的资源?快使用搜索试试~ 我知道了~
首页Z语言:谓词演算为主要理论基础的规约语言
将事物的状态和行为用数学符号形式化表达的语言,为编写计算机程序和验证计算机程序的正确性提供依据,是软件工程中编码之前的规格说明语言。 Z语言是一种以一阶谓词演算为主要理论基础的规约语言,是一种功能性语言。形式化描述语言Z指的是著名数学家Zermelo,它是目前使用最广泛的一种形式化描述语言,在软件产业的一些大型项目中已经获得成功的应用,Z以带等词的一阶谓词逻辑ZF(Zermelo-Fraenkel,蔡梅罗-弗兰科尔)公理集合论为主要数学基础。在Z中有两种语言:数学语言和模式(Schema)语言。数学语言用来描述系统的各种特征:对象及其之间的关系。模式语言是一种半图形化的语言,它用来构造、组织形式化说明的描述、整理、封装信息块并对其命名以便可以重用这些信息块。通常,形式化说明的可读性都不太好,但由于Z采用半图形化的模式语言,能用一种比较直观、有条理的方式来表达形式化说明,这就改善了可读性。 Z语言是由牛津大学程序设计研究小组开发的一种形式语言,之后该小组与IBM的Hursley实验室合作,将Z语言用于IBM客户信息控制系统(Customer Information and Control System,CICS)的开发,使得最终的产品质量得到了全面的提高,所监测出的错误数量大大减少,并且整体开发费用降低了9%。在ISO指导下的国际标准化Z工作与2002年完成。
资源详情
资源评论
资源推荐

Z Notation
Final Committee Draft, CD 13568.2
August 24, 1999
Developed by members of the Z Standards Panel
BSI Panel IST/5/-/19/2 (Z Notation)
ISO Panel JTC1/SC22/WG19 (Rapporteur Group for Z)
Pro ject number JTC1.22.45
Pro ject editor: Ian Toyn
ian@cs.york.ac.uk
http://www.cs.york.ac.uk/~ian/zstan/
This draft expresses the consensus position of the members of the Z Standards Panel. It is published for review
by the wider community: comments should be submitted via national standards b odies. The Foreword includes
a comparison with the rst committee draft, which will be excluded from the future International Standard.
Copyright for this draft is retained by the authors, so that copyright in the future standard can b e assigned to
ISO.

Z Notation:1999(E)
Contents
Page
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Terms and denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4 Symbols and denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5 Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6 Zcharacters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7 Lexis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8 Concrete syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9 Characterisation rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10 Annotated syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
11 Prelude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
12 Syntactic transformation rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
13 Type inference rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
14 Instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
15 Semantic transformation rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
16 Semantic relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Annex A (normative) Mark-ups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Annex B (normative) Mathematical to olkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Annex C (informative) Organisation by concrete syntax pro duction . . . . . . . . . . . . . . . . . . . . . . 109
Annex D (informative) Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Annex E (informative) Conventions for state-based descriptions . . . . . . . . . . . . . . . . . . . . . . . . 165
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
ii
FCD typeset August 24, 1999

Z Notation:1999(E)
Figures
1 Phases of the denition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
B.1 Parent relation b etween sections of the mathematical toolkit . . . . . . . . . . . . . . . . . . . . . . . 92
D.1 Parse tree of birthday b ook example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
D.2 Annotated parse tree of part of axiomatic example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
D.3 Annotated parse tree of part of generic example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
D.4 Type constraints for chained relation example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Tables
1 Syntactic metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Use of parentheses in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Propositional connectives in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Quantiers in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5 Abbreviations in quantications in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6 Conditional expression and
let
in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
7 Propositions ab out sets in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
8 Set extensions and unions in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
9 Powerset in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
10 Operations on numbers in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
11 Decorations of names in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
12 Tuples and Cartesian products in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
13 Further comprehensions in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
14 Relations in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
15 Proposition ab out relations in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
16 Functions in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
17 Function use in metalanguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
18 Metavariables for phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
19 Metavariables for op erator words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
20 Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
21 Variables over environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
22 Type sequents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
23 Semantic universe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
24 Variables over semantic universe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
25 Semantic relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
26 Semantic idioms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
27 Operator precedences and asso ciativities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
FCD typeset August 24, 1999
iii

Foreword Z Notation:1999(E)
Foreword
The International Organization for Standardization (ISO) is a worldwide federation of national standards b odies
(ISO member bodies). The work of preparing International Standards is normally carried out through ISO
technical committees. Each member body interested in a sub ject for which a technical committee has been
established has the right to be represented on that committee. International organizations, governmental and
non-governmental, in liaison with ISO, also takepartinthework. ISO collab orates closely with the International
Electrotechnical Commission (IEC) on all matters of electrotechnical standardization.
Draft International Standards adopted by technical committees are circulated to the member bo dies for voting.
Publication as an International Standard requires approval by at least 75% of the member b odies casting a vote.
This do cumentwas prepared byISOPanel JTC1/SC22/WG19 (Rapporteur Group for Z) for pro ject JTC1.22.45.
Its structure is in accordance with ISO Directives Part 3. The membership of JTC1/SC22/WG19 (Rapp orteur
Group for Z) includes the members of BSI Panel IST/5/-/19/2 (Z Notation). Annexes A and B are normative
parts of this International Standard; the other annexes are for information only.
The normative clauses of this International Standard organise the language denition as a sequence of phases.
This sequence is illustrated in Figure 1 in 5.1, and the corresp onding clauses are detailed in 5.3. Informative
annex C duplicates some of the denition reorganised bysyntactic production, but there is much that does not
t into this organisation, as explained in its introduction.
The following comparison is included only for the b enet of reviewers; it will b e excluded from the International
Standard.
Comparison with rst Committee Draft (Version 1.2) and comments thereon
Manychanges since Version 1.2 are identied here, rst those with widespread eects through the document, and
then those with more lo calised eects. Attention is drawn to comments that relate to those changes. After that,
those comments that are still outstanding are enumerated, and nally the other comments are identied.
Widespread changes
a) The document has b een revised to comply with ISO directives (comment UK9).
b) Types have been separated from the semantics (comments UK4{6): elements and situations have gone, and
generic lifting has simplied to something that happens within the semantic relation for generic axiomatic
description paragraphs. Free variable and alphabet functions have b een subsumed by calculations on type
signatures. A new meta-op eration called
decor
assists in dening schema op erations (comment CA10).
c) More consistent metalanguage is now used | for syntactic metalanguage, ISO/IEC 14977:1996 is used
(comment CA2), and for semantic metalanguage, a Z-like syntax for ZF set theory is used, with the same
precedences as used in Z (comment JP1). Far fewer bracket shap es are used (comments CA18, US33).
d) Many Z notations were not fully dened but now are, e.g. sections (comments JP44, UK1), free types
(comment JP49, UK54), numbers (comment UK77), and schema operations (comments JP54, JP80, UK63,
US71, US72).
e) The organisation of the normative technical material by syntactic productions has been relegated to an
annex, with clauses now organising the normative technical material by phase of denition. This is b ecause
some parts of the denition cannot b e accommodated by the organisation bysyntactic pro duction (proposal
IT.50.8).
f) Schema has b een merged into Expression (prop osal IT.48.2 part c, comments CA36, UK34). The term text
or expression is no longer used, as the traditional term schema text now suces (comment JP4 part 2).
g) Onlyafewchanges have b een done to the Z notation itself:
iv
FCD typeset August 24, 1999

Z Notation:1999(E) Foreword
1) free type paragraphs can now dene mutually recursivefreetyp es;
2) schema piping is included;
3) let and
9
notations with == lo cal declarations are used in place of substitution
and
notations. If
the substitution notation were wanted, it could b e dened by the following syntactic transformations.
e
0
e
=
)
f
e
0
g
e
e
0
p
=
) 9 f
e
0
g
p
Lo calised changes
a) Acknowledgements of contributors and membership of the Z Standards Panel have b een omitted (proposal
IT.48.4). There does not seem to be anymention of acknowledgements in ISO directives. I expect myname
to disappear from the cover; it is there on this Working Draft so that you know who to send your comments
to.
b) The Foreword is where commentary on a particular draft appears, and so is necessarily dierent from Version
1.2. Two paragraphs of \b oilerplate text" provided by the L
A
T
E
X macros start the Foreword. They are similar
to (though not word-for-word the same as) text present in another standard, though there does not seem to
be an ISO directive requiring them (prop osal IT.48.1 part c).
c) An alternativeIntro duction is presented (prop osal IT.48.7).
d) A title page has b een added, as required by ISO directive 6.1.1 (prop osal IT.48.1 part a).
e) The Scop e clause has been rewritten in the style required by ISO directive 6.2.1 (proposal IT.48.1 part b).
f) The Conformance clause has b een extended. (Comments CA6, CA8 and UK12 noted the need for this.) It
has also been moved later in the document, according to ISO directive 5.1.3 (prop osal IT.48.3). Discussion
of the structure of this standard do cument has b een included here.
g) In Normative references, ISO directive 6.2.2 requires a paragraph of \boilerplate text" at the start, the
omission of which in 1.2 has been corrected (prop osal IT.48.1 part c). A reference to the ISO standard on
which Unicode is based has been added (US13).
h) The three clauses Semantic metalanguage, Semantic universe and Language description have b een replaced
bythetwo clauses Terms and denitions, and Symbols and denitions, those being the headings required
by ISO for the clauses that introduce the terminology and notation that is to be used in dening the Z
notation. The separation of types from the semantics (comments UK4{6) has led to substantial changes in
contenthere. Within Terms and denitions, a stylethatallows an o ccurrence of a term to be replaced by
its denition in suchaway that the sentence in which it appears remains grammatically correct has been
used, as required by ISO directive C.1.5.3 (proposal IT.48.1 part b). Within Symbols and denitions, more
explanation of the semantic metalanguage has b een included (comment US14).
i) Zcharacters are now dened in terms of Unico de (proposal IT.51.1). TheZcharacters clause and Mark-ups
annex have been separated from Lexis (proposal IT.48.2 part a), arising from progress that allows denition
of the widely-used L
A
T
E
X mark-up, whichwas not present in 1.2, and description of how formal and informal
parts are delimited (comment US11). The Z characters corresponding to schema outlines are explicitly
permitted to b e rendered in either of two dierent ways, corresponding to past practice. UP and DOWN
haveevolved (comment US146), and digit strokes are specied dierently. The syntax is specied in terms
of individual strokes, decoration b eing what is done toaschema by astroke (comment US40). There are
more characters in the SPECIAL class, to reduce the need for spaces between tokens (prop osal IT.48.13).
The turnstile
`
has b een replaced by
j
=?.
FCD typeset August 24, 1999
v
剩余181页未读,继续阅读















安全验证
文档复制为VIP权益,开通VIP直接复制

评论2