|
||||
File indexing completed on 2025-01-18 09:37:58
0001 /*! 0002 @file 0003 Forward declares `boost::hana::Group`. 0004 0005 Copyright Louis Dionne 2013-2022 0006 Distributed under the Boost Software License, Version 1.0. 0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 0008 */ 0009 0010 #ifndef BOOST_HANA_FWD_CONCEPT_GROUP_HPP 0011 #define BOOST_HANA_FWD_CONCEPT_GROUP_HPP 0012 0013 #include <boost/hana/config.hpp> 0014 0015 0016 namespace boost { namespace hana { 0017 //! @ingroup group-concepts 0018 //! @defgroup group-Group Group 0019 //! The `Group` concept represents `Monoid`s where all objects have 0020 //! an inverse w.r.t. the `Monoid`'s binary operation. 0021 //! 0022 //! A [Group][1] is an algebraic structure built on top of a `Monoid` 0023 //! which adds the ability to invert the action of the `Monoid`'s binary 0024 //! operation on any element of the set. Specifically, a `Group` is a 0025 //! `Monoid` `(S, +)` such that every element `s` in `S` has an inverse 0026 //! (say `s'`) which is such that 0027 //! @code 0028 //! s + s' == s' + s == identity of the Monoid 0029 //! @endcode 0030 //! 0031 //! There are many examples of `Group`s, one of which would be the 0032 //! additive `Monoid` on integers, where the inverse of any integer 0033 //! `n` is the integer `-n`. The method names used here refer to 0034 //! exactly this model. 0035 //! 0036 //! 0037 //! Minimal complete definitions 0038 //! ---------------------------- 0039 //! 1. `minus`\n 0040 //! When `minus` is specified, the `negate` method is defaulted by setting 0041 //! @code 0042 //! negate(x) = minus(zero<G>(), x) 0043 //! @endcode 0044 //! 0045 //! 2. `negate`\n 0046 //! When `negate` is specified, the `minus` method is defaulted by setting 0047 //! @code 0048 //! minus(x, y) = plus(x, negate(y)) 0049 //! @endcode 0050 //! 0051 //! 0052 //! Laws 0053 //! ---- 0054 //! For all objects `x` of a `Group` `G`, the following laws must be 0055 //! satisfied: 0056 //! @code 0057 //! plus(x, negate(x)) == zero<G>() // right inverse 0058 //! plus(negate(x), x) == zero<G>() // left inverse 0059 //! @endcode 0060 //! 0061 //! 0062 //! Refined concept 0063 //! --------------- 0064 //! `Monoid` 0065 //! 0066 //! 0067 //! Concrete models 0068 //! --------------- 0069 //! `hana::integral_constant` 0070 //! 0071 //! 0072 //! Free model for non-boolean arithmetic data types 0073 //! ------------------------------------------------ 0074 //! A data type `T` is arithmetic if `std::is_arithmetic<T>::%value` is 0075 //! true. For a non-boolean arithmetic data type `T`, a model of `Group` 0076 //! is automatically defined by setting 0077 //! @code 0078 //! minus(x, y) = (x - y) 0079 //! negate(x) = -x 0080 //! @endcode 0081 //! 0082 //! @note 0083 //! The rationale for not providing a Group model for `bool` is the same 0084 //! as for not providing a `Monoid` model. 0085 //! 0086 //! 0087 //! Structure-preserving functions 0088 //! ------------------------------ 0089 //! Let `A` and `B` be two `Group`s. A function `f : A -> B` is said to 0090 //! be a [Group morphism][2] if it preserves the group structure between 0091 //! `A` and `B`. Rigorously, for all objects `x, y` of data type `A`, 0092 //! @code 0093 //! f(plus(x, y)) == plus(f(x), f(y)) 0094 //! @endcode 0095 //! Because of the `Group` structure, it is easy to prove that the 0096 //! following will then also be satisfied: 0097 //! @code 0098 //! f(negate(x)) == negate(f(x)) 0099 //! f(zero<A>()) == zero<B>() 0100 //! @endcode 0101 //! Functions with these properties interact nicely with `Group`s, which 0102 //! is why they are given such a special treatment. 0103 //! 0104 //! 0105 //! [1]: http://en.wikipedia.org/wiki/Group_(mathematics) 0106 //! [2]: http://en.wikipedia.org/wiki/Group_homomorphism 0107 template <typename G> 0108 struct Group; 0109 }} // end namespace boost::hana 0110 0111 #endif // !BOOST_HANA_FWD_CONCEPT_GROUP_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |