Vous êtes sur la page 1sur 3

\begin{zed} ...

Basic type definition


[NAME , DATE ]
Z Reference Card Abbreviation definition
[NAME, DATE]

DOC == seq CHAR DOC == \seq CHAR


Mike Spivey Constraint
n disks < 5 n\_disks < 5
Schema definition
Point =
b [ x, y : ] Point \defs [~x, y: \num~]
Free type definition

Ans ::= ok  | error Ans ::= ok \ldata\num\rdata | error
... \end{zed}
Specifications
Schema box
Logic and schema calculus
\begin{schema}{Name}[Params]
Name[Params] Declarations true, false true, false Logical constants
Declarations \where ¬P \lnot P Negation
Predicates Predicates P∧Q P \land Q Conjunction
\end{schema} P∨Q P \lor Q Disjunction
P⇒Q P \implies Q Implication
P⇔Q P \iff Q Equivalence
Axiomatic description \begin{axdef} ∀x : T | P • Q \forall ... Universal quantifier
Declarations ∃x : T | P • Q \exists ... Existential quantifier
Declarations \where ∃1 x : T | P • Q \exists_1 ... Unique quantifier
Predicates
Predicates \end{axdef}
Special schema operators
S [y1 /x1 , y2 /x2 ] S[y_1/x_1, y_2/x_2] Renaming
Generic definition \begin{gendef}[Params] S \ (x1 , x2 ) S \hide (x_1, x_2) Hiding
[Params] Declarations S1  S2 S1 \project S2 Projection
Declarations \where pre Op \pre Op Pre-condition
Predicates Predicates Op1  Op2 Op1 \semi Op2 Sequential composition
\end{gendef} Op1 >> Op2 Op1 \pipe Op2 Piping

c J. M. Spivey 1992
Copyright 2
Basic expressions Relations

x =y x = y Equality X Y  X \rel Y Binary relations


x 6= y x \neq y Inequality x 7→ y x \mapsto y Maplet
if P then E1 \IF P \THEN E_1 Conditional dom R \dom R Domain
else E2 \ELSE E_2 Expression ran R \ran R Range
θS \theta S Theta-expression id X \id X Identity relation
E .x E.x Selection Q R Q \comp R Composition
(µ x : T | P • E ) (\mu x: T | P @ E) Mu-expression Q ◦R Q \circ R Backwards composition
(let x ==E 1 • E 2) (\LET x == E1 @ E2) Let-expression S R  S \dres R Domain restriction
R S  R \rres S Range restriction
S R  S \ndres R Domain anti-restriction
Sets R S  R \nrres S Range anti-restriction
R∼ R \inv Relational inverse
R S
 R \limg S\rimg Relational image
x ∈S x \in S Membership Q ⊕R Q \oplus R Overriding
x∈/S x \notin S Non-membership Rk R^{k} Iteration
{x1 , . . . , xn } \{x_1, ..., x_n\} Set display R+ R \plus Transitive closure
{x : T | P • E } \{~x: T | P @ E~\} Set comprehension R∗ R \star Reflexive–trans. closure
\emptyset Empty set
S ⊆T S \subseteq T Subset relation
S ⊂T S \subset T Proper subset relation


S \power S Power set Functions


1S Non-empty subsets


\power_1 S
S ×T S \cross T Cartesian product f (x ) f(x) Function application
(x , y, z ) (x, y, z) Tuple (λ x : T | P • E ) (\lambda ...) Lambda-expression
first p first~p First of pair X Y
X \pfun Y Partial functions
second p second~p Second of pair X Y X \fun Y Total functions
S ∪T S \cup T Set union X Y X \pinj Y Partial injections
S ∩T S \cap T Set intersection X Y X \inj Y Total injections
S
S\ T S \setminus T Set difference X Y  X \psurj Y Partial surjections
TA \bigcup A Generalized union X Y  X \surj Y Total surjections
A \bigcap A Generalized intersection X Y  X \bij Y Bijections
X Finite sets X Y Finite partial functions


\finset X  X \ffun Y
1X Non-empty finite sets X Y Finite partial injections


\finset_1 X  X \finj Y

3 4
Numbers and arithmetic Bags
\nat Natural numbers bag X

\bag X Bags
\num Integers x1 , . . . , xn 
\lbag ... \rbag Bag display
+ − ∗ div mod + - * \div \mod Arithmetic operations count B x count~B~x Count of an element
<≤≥> < \leq \geq > Arithmetic comparisons B ]x B \bcount x Infix count operator
1 \nat_1 Strictly positive integers n ⊗B n \otimes B Bag scaling
succ succ Successor function x B  x \inbag B Bag membership
m ..n m \upto n Number range B vC B \subbageq C Sub-bag relation
#S \# S Size of a set B ]C B \uplus C Bag union
min S min~S Minimum of a set B C  B \uminus C Bag difference
max S max~S Maximum of a set items s items~s Items in a sequence

Sequences f uzz flags


seq X \seq X Finite sequences Usage: fuzz [ -aqstv] [ -p prelude] [ file . . . ]
seq1 X \seq_1 X Non-empty sequences
-a Don’t use type abbreviations
iseq X \iseq X Injective sequences
-p predude Use prelude in place of the standard one
hx1 , . . . , xn i \langle ... \rangle Sequence display
-q Assume implicit quantifiers for undeclared variables
s t s \cat t Concatenation
-d Dependency analysis


rev s rev~s Reverse


-s Syntax check only
head s head~s Head of sequence
-t Report types of global definitions
last s last~s Last element of sequence
-v Echo formal text as it is parsed
tail s tail~s Tail of sequence
front s front~s All but last element
U s  U \extract S Extraction
s  V s \filter V Filtering
squash f squash~f Compaction
s prefix t s \prefix t Prefix relation
s suffix t s \suffix t Suffix relation
s in t s \inseq t Segment relation
 /ss \dcat ss Distributed concat.
disjoint SS \disjoint SS Disjointness
SS partition T SS \partition T Partition relation

5 6

Vous aimerez peut-être aussi