* According to the Reading 13 of MIT 6.005 course
In order to finish Lab 2, in which the ps 2 gives instructions about rep invariant and abstract function, I read the reading material released by MIT 6.005.
1. Some Terminology
The space of representation value: actual implementation
The space of abstract value: values that the type is designed to support, mainly about imagination stuffs
2. Example
As the figure given above, the map between R and A maps the elements in R to A
Apparently, we can easily find out that:
1). Every abstract value is mapped by some rep value
2). Some abstract value are mapped to by more than one rep value
3). Not all rep values are mapped
So it is a surjection but maybe not an injection
Rep Invariant: maps the rep values to booleans
RI: R->boolean
Abstraction Function: maps rep values to the abstract values they represent
AF:R->A
3. Explanation
1). The abstraction function and the rep invariants are not determined by the choice of rep and abstract value spaces
2). The abstract value space alone doesn't determine AF/RI
For the same abstract type, there can be several representations
3). The choice of both spaces doesn't determine AF and RI
Same rep space but different rep invariant. We can set different rules to restrict the values of the rep space such as no duplication and nondecreasing.