Next: Inductively defined domains and
Up: Unit 11
Previous: Summary
Very often, data that are manipulated by a program belong to an
inductively defined domain. A domain of this type has the property that
the set of its elements can be characterized as follows:
- one or more elements (a finite number) belong to the domain;
- one or more rules allow us to obtain from one or more elements of the
domain a new element of the domain.
The fact that the set of elements of the domain is characterized as
specified above means that no other element besides those mentioned explicitly
and those specified by the rules belongs to the domain.
Example: Natural numbers:
- 0 is a natural number;
- if n is a natural number, then the successor of n is a natural
number;
- nothing else is a natural number.
Example: Strings:
- the empty string
""
is a string;
- if s is a string, then, by adding to s a character in the first
position, we obtain a string;
- nothing else is a string.
Example: Text files:
- the empty file is a text file;
- if f is a text file, then, by placing at the beginning of f a new
line, we obtain a text file;
- nothing else if a text file.
Other inductively defined domains commonly used in computer science are
lists and trees.
Next: Inductively defined domains and
Up: Unit 11
Previous: Summary