|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
The Morphisms of Influence (Actions and Representations). More...
#include <algorithm>#include <concepts>#include <cstddef>#include <functional>#include <ranges>#include <type_traits>#include <utility>import dedekind.category:species;
Classes | |
| struct | dedekind::category::is_linear_action< M, S, AddM, AddS, MultS, Act > |
The semimodule laws of an action Act : S x M -> M, declared: 1 m = m, 0 m = 0, (s + t) m = s m + t m, (s t) m = s (t m) and s (m + n) = s m + s n. A certificate, false where none is declared: a carrier with the right signatures is not thereby a semimodule. For scalars of type size_t, the integers modulo 2^64, the laws make n m the n-fold sum of m for every n. More... | |
| struct | dedekind::category::is_linear_action< S, S, Add, Add, Mult, Mult > |
| A commutative semiring over itself, by its own multiplication: the semimodule laws are the semiring's (Golan, Semirings and their Applications, 1999, ch. 14), among them the unsigned integers, the ring of integers modulo a power of two. More... | |
| struct | dedekind::category::is_linear_action< S, S, Add, Add, std::multiplies< S >, std::multiplies<> > |
The same, acted on by the transparent std::multiplies<>. More... | |
| struct | dedekind::category::counting_action< T, Op > |
The counts' action on a monoid (T, Op), \((n, x) \mapsto
x^n\), the n copies of x, where its laws give it in one step: derived, never declared, and absent where no law gives it, so that the binary method of :total squares instead. More... | |
| struct | dedekind::category::counting_action< T, Op > |
| By the semimodule laws over the counts, \(1 \cdot x = x\) and \((s + t) \cdot x = s \cdot x + t \cdot x\), \(x^n\) is \(n \cdot
x\), one action. More... | |
| struct | dedekind::category::ZeroAction< A, B, Op > |
| The 'Absorption' logic. More... | |
| struct | dedekind::category::acting_monoid< H > |
A fold along the walk, fold(r, v, h), and its specialisation by the action law (the Jlt paper's Listing 4). acting_monoid<H> names the monoid an action h acts by on the right, a declared certificate of \(h(h(v, a), b) = h(v, a \cdot b)\) and \(h(v, 1) = v\), the product in the walk's order; keyed by the action's type without cv-qualification, as a fold deduces it. A fold walks a right action; a left action, scalar first as IsLeftAction, is a right action of the opposite monoid and registers Opposite<Op> (:involution), the bridge between the two textbook conventions. On n copies of one value the fold is v acted on by their product, and concat computes the product in one step or by squaring: two declared laws, two overloads, composed by resolution. More... | |
| struct | dedekind::category::acting_monoid< std::plus< std::size_t > > |
A monoid acts on itself: (std::size_t, +) by +. More... | |
Namespaces | |
| namespace | dedekind::category |
Concepts | |
| concept | dedekind::category::IsLeftAction |
The shape of a left action (S ⟳ M), \(S \times M \to M\), scalar first, as a module's: its laws are the certificate a concept above it reads (is_linear_action for a semimodule). A left action of a monoid \(M\) is a right action (IsRightAction) of its opposite, Opposite<Op> (:involution), and over a commutative monoid the two coincide. | |
| concept | dedekind::category::detail_action::MultipliesInPlace |
A carrier whose product stays in it: no integer narrower than int, whose product promotes to a signed int that may overflow. | |
| concept | dedekind::category::IsSemimodule |
A commutative monoid M on which the semiring S acts linearly. | |
| concept | dedekind::category::HasCountingAction |
The counts act on (T, Op) in one step, by a law: the semimodule laws or idempotence. | |
| concept | dedekind::category::IsRightAction |
H is a right action \(M \times S \to M\) of the monoid (S, Op) that acting_monoid<H> names: M is a right S-set (Mac Lane and Moerdijk), an S-act (Kilp, Knauer and Mikhalev, Monoids, Acts and Categories). A left action is a right action of the opposite, Opposite<Op>. | |
Typedefs | |
| using | dedekind::category::ZeroZ = decltype(zero<int, int, std::plus<int>>()) |
Functions | |
| template<std::ranges::input_range R, typename T = std::ranges::range_value_t<R>, typename Op = std::plus<T>> requires IsMonoid<T, Op> && IsCopies<R> && HasCountingAction<T, Op> | |
| constexpr T | dedekind::category::concat (R r, Op op={}) |
concat on n copies of one value where the counts act in one step: \(x^n\) by the counting action, \(n \cdot x\) over a semimodule, x under an idempotent operation. The same signature as the binary method of :total and a stronger constraint, so resolution prefers it. | |
| template<std::ranges::input_range R, std::semiregular M, typename H> requires std::invocable<const H&, M, std::ranges::range_value_t<R>> | |
| constexpr M | dedekind::category::fold (R r, M v, H h) |
The fold along the walk: the standard's fold_left. | |
| template<std::ranges::input_range R, std::semiregular M, typename H> requires IsCopies<R> && IsRightAction<H, M, std::ranges::range_value_t<R>> | |
| constexpr M | dedekind::category::fold (R r, M v, H h) |
The fold under a monoid action of a sequence whose product has a fast form: v acted on once, by the product in the walk's order. The action law \(h(h(v, a), b) = h(v, a \cdot b)\) licenses this on any sequence, but it pays only where the product is cheaper than the actions one by one: elsewhere a product each costs more than an action each, a matrix by a matrix against a vector by a matrix. The fast form today is copies, whose product concat computes by squaring; periodic sequences are the natural next one. The same signature as the plain fold and a stronger constraint, so resolution prefers it. | |
Variables | |
| template<typename M, typename S, typename AddM, typename AddS, typename MultS, typename Act> | |
| constexpr bool | dedekind::category::is_linear_action_v |
Value form of is_linear_action. | |
| constexpr std::size_t | dedekind::category::detail_fold_witness::ten = 10 |
The Morphisms of Influence (Actions and Representations).
@partition :action
While Level 0 (:morphism) defines mapping between species, Level 1 defines the "Action" of a Species S upon a Species M (S ⟳ M). In the Dedekind structuralist view, an Action is the reification of Scalar multiplication, leading naturally to the concepts of Modules, Vector Spaces, and eventually, the Linear Algebra of the Continuum.
A signature is no law: the semimodule laws of an action are a declared certificate, is_linear_action, false where none is declared (#1099).