|
|
| ||||||
| 11.6 Type expressions | ||||||||
Except for Unit the RSL type literals are translated into the corresponding PVS types as shown below.
The only possible problem is that in PVS int is a subtype of real, while the corresponding RSL types are different. This means we must be careful with division and exponentiation, to make sure they give integers with integer arguments.
A type name translates to a type name.
A product type expression translates to a PVS tuple type.
Both finite and infinite set type expressions translate to the PVS type set. It would be possible to use finite_set for finite sets, but in practice this generates a TCC for every function returning such a value, which is tedious to prove. Only the card operator actually requires a set to be finite, so it is better to prove finiteness only when it is required.
A finite list type expression translates to the PVS type list.
Infinite lists are not accepted.
Finite and infinite maps are translated into a PVS type map defined in the RSL prelude.
The translation of a map is as a function from the domain type to a DATATYPE:
Maprange[rng: TYPE]: DATATYPE
BEGIN
nil: nil?
mk_rng(rng_part: rng): nonnil?
END Maprange
The result type nil when a map is applied indicates the argument is not in the domain. The RSL map application expression m(d) translates to rng_part(m(d)), which will generate the appropriate TCC nonnil?(m(d)) expressing that d is in the range of m.
The map type does not include nondeterministic maps: these are not accepted.
A function type expression translates to PVS function type.
PVS functions are total. We partly deal with partiality in RSL functions: preconditions generate subtypes as described earlier for the translation of functions (section 11.3.4), but nondeterminism is not accepted.
Access descriptors are not accepted.
A subtype expression translates to a PVS subtype.
A bracketed type expression translates as a PVS tuple type with one member.
| 11.6 Type expressions | ||||||||
|
|
| ||||||