Home | Libraries | People | FAQ | More |

“Beauty is the ultimate defense against complexity” -- David Gelernter

In the **icl** we follow the notion, that the
semantics of a * concept*
or

Commutativity<T,+>: T a, b; a + b == b + a;

This can of course be coded as a proper c++ class template which has been done
for the validation of the **icl**. For sake of
simplicity we will use pseudocode here.

The laws that describe the semantics of the **icl's**
class templates were validated using the Law based Test Automaton * LaBatea*, a tool that generates instances
for the law's variables and then tests it's validity. Since the

On all set and map containers of the icl, there is an ```
operator
<
```

that implements a strict
weak ordering.

The semantics of `operator <`

is the same as for an stl's SortedAssociativeContainer,
specifically stl::set
and stl::map:

Irreflexivity<T,< > : T a; !(a<a) Asymmetry<T,< > : T a,b; a<b implies !(b<a) Transitivity<T,< > : T a,b,c; a<b && b<c implies a<c

`Operator <`

depends on the icl::container's template parameter `Compare`

that implements a *strict weak ordering* for the container's
`domain_type`

. For a given
`Compare`

ordering, `operator <`

implements a lexicographical comparison on icl::containers, that uses the
`Compare`

order to establish
a unique sequence of values in the container.

The induced equivalence of ```
operator
<
```

is lexicographical equality which
is implemented as `operator ==`

.

//equivalence induced by strict weak ordering < !(a<b) && !(b<a) implies a == b;

Again this follows the semantics of the **stl**.
Lexicographical equality is stronger than the equality of elements. Two containers
that contain the same elements can be lexicographically unequal, if their
elements are differently sorted. Lexicographical comparison belongs to the
* segmental* aspect. Of
all the different sequences that are valid for unordered sets and maps, one
such sequence is selected by the

`Compare`

order of elements. Based on this selection a unique iteration is possible.
On the fundamental aspect only membership of elements matters, not their
sequence. So there are functions `contained_in`

and `element_equal`

that implement
the subset relation and the equality on elements. Yet, `contained_in`

and `is_element_equal`

functions
are not really working on the level of elements. They also work on the basis
of the containers templates `Compare`

parameter. In practical terms we need to distinguish between lexicographical
equality `operator ==`

and equality of elements `is_element_equal`

,
if we work with interval splitting interval containers:

split_interval_set<time> w1, w2; //Pseudocode w1 = {[Mon .. Sun)}; //split_interval_set containing a week w2 = {[Mon .. Fri)[Sat .. Sun)}; //Same week split in work and week end parts. w1 == w2; //false: Different segmentation is_element_equal(w1,w2); //true: Same elements contained

For a constant `Compare`

order
on key elements, member function `contained_in`

that is defined for all icl::containers implements a partial
order on icl::containers.

with <= for contained_in, =e= for is_element_equal: Reflexivity<T,<= > : T a; a <= a Antisymmetry<T,<=,=e=> : T a,b; a <= b && b <= a implies a =e= b Transitivity<T,<= > : T a,b,c; a <= b && b <= c implies a <= c

The induced equivalence is the equality of elements that is implemented via
function `is_element_equal`

.

//equivalence induced by the partial ordering contained_in on icl::container a,b a.contained_in(b) && b.contained_in(a) implies is_element_equal(a, b);