Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::algebra::IsArithmeticRing Concept Referenceexport

The seal: a carrier that is a ring AND whose ring structure agrees with the standard C++ arithmetic operators. More...

Concept definition

template<typename T>
Pure syntactic shape: T closes strictly under +, -, * (binary and unary -). Textbook closure — result...
Definition ring.cppm:65
The universal-algebra (A, F) pattern at the closure tier.
Definition universal.cppm:151
The seal: a carrier that is a ring AND whose ring structure agrees with the standard C++ arithmetic o...
Definition ring.cppm:207
The Perfect Species (Rig ∩ Rng).
Definition total.cppm:791

Detailed Description

The seal: a carrier that is a ring AND whose ring structure agrees with the standard C++ arithmetic operators.

Where the concepts meet. IsArithmeticRing<T> requires both:

  • category::IsRing<T, std::plus<T>, std::multiplies<T>> — the strict categorical proof, with the canonical Add/Mult functors;
  • HasRingOperators<T> — the literal C++ operators +, -, *, unary - close strictly on T.

That is, IsArithmeticRing<T> certifies that the ring structure is reachable through the natural C++ syntax: writing a + b in source code computes the ring's addition, and the result genuinely stays in T. No promotion, no functor indirection, no operator disagreement.

Canonical inhabitants: unsigned int (modular wrap), other wide unsigned integral types whose width is at least sizeof(int) (no integer-promotion path: unsigned long, unsigned long long, std::size_t), Polynomial<unsigned int> (the polynomial ring lifts coefficientwise). int is not a canonical inhabitant: signed-overflow UB defeats the IsPeriodic axiom on which the strict IsRing chain depends, even though the literal operators close on the carrier (see witness comment below).

Carriers that satisfy category::IsRing but not IsArithmeticRing include bool under (std::bit_xor, std::bit_and) (the Boolean ring \(\mathbb{F}_2\)): the strict ring claim holds via the functors, but bool's literal + returns int via integer promotion — the ring structure does not align with the standard operators on this carrier. The math-wins-over-C++ stance the project adopts (per README.md) makes this non-alignment a real distinction the type system surfaces.

Use IsArithmeticRing where the callsite wants to write the ring operations in plain C++ syntax and trust the result stays in the carrier; use category::IsRing<T, ...> where the callsite is willing to accept any type-level ring proof, including ones expressed through functor-parametric Add/Mult.

Introduced under #393 as the user-requested "where the concepts meet" point.