Scarlet Serenade

Types and Programming Languages | Mathematical Preliminaries

Definition: The domain of a relation on sets and , written , is the set of elements such that for some

Definition: The codomain or range of , written is the set of elements such that for some .

Definition: A relation on sets and is called a partial function from to if, whenever and , we have .

- in addition, if then is called a total function.

Definition: A partial function from to is said to be defined on an argument if and undefined otherwise.

- we write to mean is undefined on
- we write to mean is defined on
We will also need to define functions that may fail on some inputs. It is important to distinguish failure (which is a legitimate, observable result) from divergence. (怎么没解释什么是 divergence 啊...

Definition: Suppose is a binary relation on a set and is a predicate on . We say that is preserved by if whenever we have and we also have

Definition: A binary relation on a set

- reflexive if relates every element of to itself - that is,
- transitive and together implies
- s ymmetric if implies
- antisymmetric and together implies

Definition: A reflexive, transitive, and symmetric relation on a set is called an equivalence on .

Definition: A reflexive and transitive relation on a set is called a preorder on .

- preorders are usually written using symbols like . We write ( is strictly less than ) to mean .

Definition: A preorder (on a set ) that is also antisymmetric is called a partial order on .

Definition: A partial order is called a total order if it also has the property that, for each and in , either or .

Definition: Suppose R is a binary relation on a set .

- The reflexive closure of is the smallest reflexive relation that contains R.
- The transitive closure of is the smallest transitive relation that contains R.
- The reflexive and transitive closure of is the smallest reflexive and transitive relation that contains R.

Definition: Suppose we have a set with a preorder . We say that is well founded if it contains no infinite decreasing chains.

- For example, the usual order on the natural numbers, with is well founded, but the same order on the integers, is not. (好像意思虽然序列的长度不是有界的,但是自然数下的这个关系,从任何元素开始,最小只能小到 ,而整数上的可以无限小下去?