Rodin Handbook![]() This work is sponsored by the Deploy Project ![]() This work is sponsored by the ADVANCE Project ![]() This work is licensed under a Creative Commons Attribution 3.0 Unported License |
2.8.2 A Context with ColoursStart by creating a context called ctx1, as described in Section 2.6. We model the colours of the traffic light as a so-called “enumerated set” (3.3.4): We explicitly specify all elements (the three colours) of a new user-defined data type. We define the constants:
We introduce the new data type as a set:
And last, we need to provide typing of the constants. We do this by creating a partition (3.3.4.7):
This completes the context. |