Download Specware 4.2 Language Manual

Transcript
Chapter 2. Metaslang
The value of a quantification ex1 (V ) E in which V is a local-variable-list and E is
an expression, is determined as follows. Let M be the match (V ) -> E. If M has
return value true for precisely one value x in its domain, the value of the
quantification is true; otherwise it is false.
Note that a quantifier must be followed by an opening parenthesis ( . So fa x (x = x),
for example, is ungrammatical.
2.6.6. Unique-solutions
unique-solution ::= the ( local-variable-list ) expression
Sample unique-solution:
the(x : S) f(x) = y
Restriction, Each local-variable of the local-variable-list must be a different
simple-name.
Restriction. The type of the expression must be Boolean.
Restriction. A unique-solution the (V ) E may only be used in a context where the
value of ex1 (V ) E is true.
Unique-solutions are non-constructive, even when the domain type is finitely
enumerable. The type of a unique-solution is the type of its local-variable-list.
The value of a unique-solution the (V ) E, in which V is a local-variable-list and E
is an expression, is determined as follows. Let M be the match (V ) -> E. The value
of the unique-solution is then the unique value x in the domain of M such that the
match (V ) -> E has return value true for x.
2.6.7. Annotated-expressions
annotated-expression ::= tight-expression type-annotation
Restriction. In an annotated-expression E : T, the expression E must have type T.
Sample annotated-expression:
[] : List Arg
Positive : Sign
58