Name Expression Precondition Semantics Postcondition
Function call f(x, y) The ordered pair (x,y) is in the domain of f Returns true if x precedes y, and false otherwise The result is either true or false
Invariants
Irreflexivity f(x, x) must be false.
Antisymmetry f(x, y) implies !f(y, x)
Transitivity f(x, y) and f(y, z) imply f(x, z) .
Transitivity of equivalence Equivalence (as defined above) is transitive: if x is equivalent to y and y is equivalent to z, then x is equivalent to z. (This implies that equivalence does in fact satisfy the mathematical definition of an equivalence relation.) [1]
Models

• less<int>

• less<double>

• greater<int>

• greater<double>

Notes

[1] The first three axioms, irreflexivity, antisymmetry, and transitivity, are the definition of a partial ordering; transitivity of equivalence is required by the definition of a strict weak ordering. A total ordering is one that satisfies an even stronger condition: equivalence must be the same as equality.

See also

LessThan Comparable, less, Binary Predicate, function objects

MonoidOperation

Category: functors

Component type: concept

Description

A Monoid Operation is a special sort of Binary Function. A Binary Function must satisfy three conditions in order to be a Monoid Operation. First, its first argument type and second argument type must be the same, and its result type must be the same as its argument type. Second, there must be an identity element. Third, the operation must be associative. Examples of Monoid Operations are addition and multiplication. [1]

Refinement of

Binary Function

Associated types
Argument type The type of the Monoid Operation's first argument and second argument, and also the type returned when the Monoid Operation is returned.
Notation

F A type that is a model of MonoidOperation

T F's argument type.

f Object of type F

x, y, z Objects of type T

Definitions

A type F that is a model of binary function is associative if F's first argument type, second argument type, and result type are the same, and if, for every object f of type F and for every objects x, y, and z of F's argument type, f(x, f(y, z)) is the same as f(f(x, y), z). [2]

Valid Expressions

In addition to the expressions described in the Binary Function requirements, the following expressions must be valid.

Name Expression Return type
Function call f(x, y)
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату