Rep Invariant and Abstraction Function
* 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.
Rep Invariant and Abstraction Function的更多相关文章
- SC || Chapter 3
┉┉∞ ∞┉┉┉┉∞ ∞┉┉┉∞ ∞┉┉ 基本数据类型 && 对象数据类型 基本数据类型(int char long) 在栈中分配内存,不可变 对象数据类型(String BigInt ...
- 【软件构造】第三章第三节 抽象数据型(ADT)
第三章第三节 抽象数据型(ADT) 3-1节研究了“数据类型”及其特性 ; 3-2节研究了方法和操作的“规约”及其特性:在本节中,我们将数据和操作复合起来,构成ADT,学习ADT的核心特征,以及如何设 ...
- HIT Software Construction Lab 2
2019年春季学期 计算机学院<软件构造>课程 Lab 2实验报告 姓名 刘帅 学号 班号 1703008 电子邮件 1609192321@qq.com 手机号码 目录 1 实验目标概 ...
- 哈工大软件构造Lab2(2022)
(防扒小助手) 本人CSDN博客: https://blog.csdn.net/m0_61753302https://blog.csdn.net/m0_61753302本人博客园博客(同步CSDN): ...
- 软件构造Lab2实验总结
本次实验训练抽象数据类型(ADT)的设计.规约.测试,并使用面向对象编程(OOP)技术实现ADT.具体来说内容如下: 针对给定的应用问题,从问题描述中识别所需的ADT: 设计ADT规约(pre-con ...
- JS中的进制转换以及作用
js的进制转换, 分为2进制,8进制,10进制,16进制之间的相互转换, 我们直接利用 对象.toString()即可实现: //10进制转为16进制 ().toString() // =>&q ...
- mobx源码解读1
mobx是redux的代替品,其本身就是一个很好的MVVM框架.因此花点力气研究一下它. 网上下最新的2.75 function Todo() { this.id = Math.random() mo ...
- JS简单加密
//简单的jS加密解密//code为对应的字符串,h为(2,8,10,16)就是要转成的几进制function en(code, h) { var monyer = new Array();var i ...
- 文件上传之伪Ajax方式上传
From: <由 Windows Internet Explorer 8 保存> Subject: =?gb2312?B?zsS8/snPtKvWrs6xQWpheLe9yr3Jz7SrI ...
随机推荐
- Types in Javascript(jQuery)
String: 空字符串等于Boolean的false; htmlString: 包括起始tag和结束tag的字符串,代表html代码: Number:双精度64位,跟string一样属于immuta ...
- VHDL_LIB之DFF
1 D-Flip-Flop with async reset or set library IEEE; use ieee.std_logic_1164.all; entity FFD is gener ...
- input type=”file“ change事件只执行一次的问题
js解决办法 HTML:<input id="file",type="file" onchange="upload()" /> ...
- linux内核内存分配(一、基本概念)
内存分配是Linux比较复杂也是比较重要的部分,这个和ssd驱动很类似:物理地址和虚拟地址的映射关系.下面总结下最近看到的有关内存分配的内容和自己的理解: 1.一致内存访问和非一致内存访问 上图来自& ...
- GDI 线段绘制示例程序
#include <windows.h> #include <strsafe.h> #include <stack> typedef struct tagLINE ...
- javascript的带操作符的赋值运算
看犀牛书发现的问题 下面两个表达式 表达式一 data[i++] *= 2; 表达式二 data[i++] = data[i++] * 2; var data = [7,8,9]; var i = ...
- Project Euler 41 Pandigital prime( 米勒测试 + 生成全排列 )
题意:如果一个n位数恰好使用了1至n每个数字各一次,我们就称其为全数字的.例如,2143就是一个4位全数字数,同时它恰好也是一个素数. 最大的全数字的素数是多少? 思路: 最大全排列素数可以从 n = ...
- react 简单在页面中输出一段文字
之前用脚手架创建了一个react项目,将react自带的src文件夹删除后创建一个空的src文件夹 在src文件夹中创建一个index.jsx文件作为JS入口文件并创建一个hello组件 现在我们进入 ...
- C# List源码分析(二)
常用操作的复杂度分析 Contains 该方法是一个O(n)的方法,是根据顺序依次遍历整个列表的,观看源码,跟JAVA还是有不少分别的,在上一篇中就有发现,因为C#对Primitive类型是有处理的, ...
- Java生成随机数的三种方式
package cn.zytao.taosir.random; import java.util.Random; public class RandomDemo { private static In ...