Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
RigRegistration< T, Zero, One, Add, Mult > Struct Template Reference

Base class for SpeciesTraits<T> of carriers forming a \emph{rig} (semiring) under (Add, Mult) with identities Zero (additive) and One (multiplicative). More...

Inheritance diagram for RigRegistration< T, Zero, One, Add, Mult >:

Public Types

using Domain = T
using dedekind_registration_tag = void

Static Public Attributes

template<typename Op>
static constexpr bool is_associative_v
template<typename Op>
static constexpr bool is_commutative_v = std::same_as<Op, Add>
template<typename Op>
static constexpr bool is_periodic_v
template<typename Op>
static constexpr T unit_v = std::same_as<Op, Add> ? T(Zero) : T(One)
template<typename MultOp, typename AddOp>
static constexpr bool is_distributive_v

Detailed Description

template<typename T, auto Zero, auto One, typename Add = std::plus<T>, typename Mult = std::multiplies<T>>
struct RigRegistration< T, Zero, One, Add, Mult >

Base class for SpeciesTraits<T> of carriers forming a \emph{rig} (semiring) under (Add, Mult) with identities Zero (additive) and One (multiplicative).

A rig has an additive commutative monoid, a multiplicative monoid, and distributivity of Mult over Add. Unlike a ring, it does \emph{not} require an additive inverse. Examples: \(\mathbb{N}\) under (+, *), tropical semirings.

Exposes member templates:

  • is_associative_v<Op> = Op is Add or Mult
  • is_commutative_v<Op> = Op is Add (Mult is not required to commute in a rig; CommutativeRingRegistration extends this)
  • is_periodic_v<Op> = Op is Add or Mult (carries IsTotal for periodic wrapping carriers; idempotent carriers choose a different totality witness)
  • unit_v<Op> = Zero when Op is Add, One when Op is Mult
  • is_distributive_v<MultOp, AddOp> = MultOp is Mult and AddOp is Add

RigRegistration does \emph{not} expose is_invertible_v — a rig has no additive inverse claim.

Member Data Documentation

◆ is_associative_v

template<typename T, auto Zero, auto One, typename Add = std::plus<T>, typename Mult = std::multiplies<T>>
template<typename Op>
bool RigRegistration< T, Zero, One, Add, Mult >::is_associative_v
staticconstexpr
Initial value:
=
std::same_as<Op, Add> || std::same_as<Op, Mult>

◆ is_distributive_v

template<typename T, auto Zero, auto One, typename Add = std::plus<T>, typename Mult = std::multiplies<T>>
template<typename MultOp, typename AddOp>
bool RigRegistration< T, Zero, One, Add, Mult >::is_distributive_v
staticconstexpr
Initial value:
=
std::same_as<MultOp, Mult> && std::same_as<AddOp, Add>

◆ is_periodic_v

template<typename T, auto Zero, auto One, typename Add = std::plus<T>, typename Mult = std::multiplies<T>>
template<typename Op>
bool RigRegistration< T, Zero, One, Add, Mult >::is_periodic_v
staticconstexpr
Initial value:
=
std::same_as<Op, Add> || std::same_as<Op, Mult>

The documentation for this struct was generated from the following file: