Equivalence relation

In mathematics, an equivalence relation is a binary relation between two elements of a set which groups them together as being “equivalent” in some defined way. An equivalence relation between a and b is often denoted as “a ~ b” or “a ≡ b”. By definition, equivalence relations have the properties of reflexivity, symmetry, and transitivity. In other words, for all elements a, b, and c of the set X, the following must hold for any equivalence relation defined by the symbol “~”:

* Reflexivity: a ~ a
* Symmetry: if a ~ b then b ~ a
* Transitivity: if a ~ b and b ~ c then a ~ c.

On design of parameter configuration.

Parameter configuration

Background
Many crypto components that provide the similar service have completely different configuration schemes.
Although the core service and their interfaces are the similar which can be replaced easily, but there are no unified way to configure them.
For example, AES algorithm support 3 different key lengths, but DES support only one. The recent ECC algorithms actually is not a single algorithm, it is several family of algorithms, each family has a special set of configuration parameters.
We must provide a convenient mechanism to allow user to configure the parameter of each component through a unified way. And this mechanism will allow developers trace the configuration of each component and serialize the configuration data.
This section is about the user scenario of parameter configuration.

User scenario: Setting the configuration of a component to get it ready to provide the service.
1.User has created an object of a component.
2.User know the parameter structure to configure the component from user manual.
3.User create the configuration parameter tree through a parameter tree configuration component.
4.User pass the parameter tree of configuration to the component’s configuration interface which is unified for each component.
5.The component now get in the ready state, ready to provide the major service which it is supposed to.
6.User serialize the state of the components include the configuration. The component will encode the configuration data with given coding rule, but the logical structure will be kept.

Serialization

Background
Because of the polymorphism of the components, the serialization must provide a way to address the proper creator of a component during serializing. This creator is not the constructor of a class, but a static creator which can create an object instance of a component from nothing.

User scenario: Serialization
1.User configure a component, and use it.
2.User use the serializer to save the component, the target shall be a data sink [see stream interface].
–when user saving a polymorphism object, whose component is unknown, the tag of the component will be automatically saved first by the object itself, which is assigned by the container of the component. Then the object will be saved.
–when user saving a known-class object, the tag will not be saved. The object will be saved directly.
3.User use the serializer to load the component, the origin shall be a data source [see stream interface].
–when user loading a polymorphism object, whose component is unknown, the tag of the component will be automatically loaded first. The tag will be used to address the corresponding component creator, which was registered when the component was added to the container.
–when user loading a known-class object, the tag will not be loaded.

To do: list the functions of an component container and a object container.

For each component, the following information shall be registered:

tag, creator

1
2
3
4
template<typename T>
T *creator() {
    return Alloc::alloc<T>();
}

Note, different container may have different tag type.

For codec:
there is no special codec function for any type, but some component is widely used, for example the NatureNumber, OctetString, NullString… such components should be registered into the top level container, and will be widely used in many other components. Those makes such component seems special, like some core-language-type, but actually that is not essential.

For each component, which may be encoded to ASN.1 and BER/CER/DER/PER/XER, shall support both such codec method and our own method. When we serialize a component, the tag of the codec component will be also set and pass to the object, thus the object can choose the corresponding codec function.

1
2
3
4
5
6
7
8
9
10
AsnXer asnXer;
Ner ner;

//the object will be encoded/decoded through ASN+XER codec
asnXer.encode(object, stream);
asnXer.decode(object, stream);

//the object will be encoded/decoded through NER codec
ner.encode(object, stream);
ner.decode(object, stream);

关于哲学中其大无外的宇宙及其本质

首先,我们要区分物理学和哲学的宇宙的含义,以免引起混淆。

物理学家最近一个多世纪所提到的大爆炸宇宙并不是“其大无外”的,物理学家经常会自由地使用“我们的宇宙”和“另一个宇宙”这样的词汇,就说明了这一点。注意,这绝对不是说物理学家对这个宇宙的定义就有什么不好的,只不过这种定义和我们现在要讨论的问题无关。

但是什么是哲学意义上“其大无外”的宇宙呢?不严格的说,至少应该指一个对于信息交换完全封闭的区域。可以这样递归地定义一个其大无外的宇宙:

1.我自身作为一个对象,属于这个宇宙。
2.任何一个对象,如果与属于这个宇宙的对象之间存在信息交换,那么该对象也属于这个宇宙。

这个递归定义是由“信息交换”关系所构造的一个数学意义上的闭包,并不一定要求空间的尺寸上无限。我们从现在开始放弃“其大无外”这个说法,改用宇宙闭包,来进行讨论。

在这样的递归定义下,该“宇宙闭包”中,“造物主”是没有实际意义的。因为如果造物主跟我们的“宇宙”之间存在信息交换,那么就破坏了我们这个物理宇宙的封闭性,按照前面的定义,这个造物主就被自然加入到这个“宇宙闭包”之内。

对于这样一个宇宙闭包,无论是否由一个外部的造物主所创造,我们都无从知道。因此询问该“宇宙闭包”是否由造物主创造是没有意义的,因为不可能得到任何与此相关的信息。

许多人喜欢问一些“本质”的问题。例如什么是宇宙的本质,什么是质量的本质、什么是电荷的本质、什么是引力的本质……

但当你把物理学家所看到的东西告诉他们的时候,他们却认为你答非所问。因为你没有把这些东西的“本质”告诉他们。

为什么这些人会有这样的问题呢?我认为这个和人的生活经验有关。你在生活中,看到任何一个人造产品,例如手表、电脑、汽车……其中每一样你都可以询问其原理。而且,毫无疑问,这些东西的本质都是可以问的。你可以问这些东西的制造者,原则上你总是有办法弄清楚他们的本质。但这个想法用到宇宙上,就行不通了。

你本身是属于这个宇宙闭包的对象,你如果想要知道这个宇宙闭包的本质,你需要问这个宇宙闭包的创造者(如果有的话)。而这个创造者,如果不属于这个宇宙闭包,那么无法告诉你这个宇宙的本质是什么(请看前面宇宙闭包的递归定义)。如果这个创造者跳出来告诉你这个宇宙的本质是什么,那么这个创造者就不再权威,因为他本身不再位于宇宙闭包之外,此时他自身对他所处的这个宇宙的本质的回答,就不再有效。

如果你要了解一个东西的“本质”,你必须身在其外,并且询问另一个身在其外的创造者。但是对于宇宙,你做不到。

你有没有可能掌握到宇宙的本质呢?说不定可能,但你对此却永远无从判断。

------------------
科学家创建各种关于这个宇宙的模型,所谓模型就是一些基本概念以及基本概念之间的关系。模型中任何一个概念在原则上都可以通过可操作性的步骤进行观察或测量。科学家可能会得到这个宇宙的终极模型,但是在逻辑上永远也无法知道这一点。

数学公理系统,其本身包括一些基本概念和关系,貌似不加定义,其实不然,实际上公理系统本身就是对这些基本概念的定义。但是与通常意义上的定义不同,每一条公理事相当于一个多元关系,描述了若干概念之间的关系。若干公理每一条都描述了若干概念之间的关系。事实上,后来的派生概念定义,也都是公理,因为这些定义由于包括了新概念,因此不能直接从原来的公理中导出。只不过派生的概念定义,往往是一条或者几条定义围绕着一个特定的派生概念,不像原有的基本公理,若干条规定同时围绕着若干个概念。

Axioms of nature number

—-Definition of natural number
(00) 0 is a natural number
(01) If a is a natural number, then a’ is a natural number
(02) The only natural numbers are given by (00) and (01)

—-Definition of equality relationship
(03) Every natural number is equal to itself (equality is reflexive)
(04) For all natural numbers a and b, a=b if and only if b=a (equality is symmetric)
(05) For all natural numbers a, b, and c, if a=b and b=c then a=c (equality is transitive)

—-Definition of equality of natural number
(06) If a = b and b is a natural number then a is a natural number(close for natural number)
(07) For any natural numbers a and b, if and only if a=b then a’=b’
(08) For any natural number a, !(a’=0)

—-Definition of addition
(09) For any natural numbers a and b,a+b’=(a+b)’
(10) For any natural numbers a, a+0 =a

—-Definition of multiplication
(11) For any natural numbers a and b, a×b’=a×b+a
(12) For any natural numbers a, a×0 =0