|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
ℚ — rationals as numerator/denominator pairs. More...
#include <bit>#include <compare>#include <concepts>#include <cstdint>#include <functional>#include <limits>#include <numeric>#include <stdexcept>#include <type_traits>#include <utility>import dedekind.sets;import dedekind.order;import dedekind.morphologies;import dedekind.category;import dedekind.numbers:integer;import dedekind.algebra;
Namespaces | |
| namespace | dedekind::numbers |
| namespace | dedekind::category |
Concepts | |
| concept | dedekind::numbers::RejectsNonFinite |
The rejection contract a saturating backing must offer ℚ's tripwire: is_finite(i), found by ADL, says whether i is a point of ℤ or a sentinel (±ℵ_0 / NaZ). Rational rejects a non-finite value wherever one can arise (construction, comparison); a saturating carrier without this hook would clamp silently and is not admitted as a backing (see FractionBacking). | |
| concept | dedekind::numbers::IsRational |
Q is the rational field Rational<Z> — the canonical exact, dense, strongly-ordered coefficient carrier. Used to gate the real carriers (Cut, QuadraticReal): over \(\mathbb{Q}\) a nonsquare integer D has \(\sqrt D\notin\mathbb{Q}\) (a theorem), so those carriers are genuine (canonical representation, sound conjugate/norm) — which fails for a coefficient field that already contains \(\sqrt D\) (e.g. the degenerate QuadraticReal<2, QuadraticReal<2>>). | |
| concept | dedekind::category::FractionBacking |
An integer backing over which fraction arithmetic obeys ℚ's laws under Op: it does not wrap, so a wrapped intermediate cross-product cannot silently break a law. Either it is exact, or it saturates and offers the is_finite hook (RejectsNonFinite) through which ℚ's tripwire rejects the saturated value instead of clamping. | |
Typedefs | |
| using | dedekind::numbers::machine_integer = int |
| template<IsInteger I = default_integer> | |
| using | dedekind::numbers::RationalPolynomial = dedekind::algebra::Polynomial<Rational<I>> |
The polynomial ring over the rationals in one variable, ℚ[x]: algebra::Polynomial over the quotient field of the integer carrier I. | |
Variables | |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_kleene_associative_v< dedekind::numbers::Rational< I >, dedekind::numbers::PartialAddRational< I > > |
| Kleene traits for rational arithmetic. | |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_kleene_commutative_v< dedekind::numbers::Rational< I >, dedekind::numbers::PartialAddRational< I > > |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr dedekind::numbers::Rational< I > | dedekind::category::partial_unit_v< dedekind::numbers::Rational< I >, dedekind::numbers::PartialAddRational< I > > |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_kleene_associative_v< dedekind::numbers::Rational< I >, dedekind::numbers::PartialMulRational< I > > |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_kleene_commutative_v< dedekind::numbers::Rational< I >, dedekind::numbers::PartialMulRational< I > > |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr dedekind::numbers::Rational< I > | dedekind::category::partial_unit_v< dedekind::numbers::Rational< I >, dedekind::numbers::PartialMulRational< I > > |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_kleene_associative_v< dedekind::numbers::Rational< I >, dedekind::numbers::PartialEmbedIntegerToRational< I > > = true |
| Kleene traits for integer→rational embedding (exact). | |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_reflexive_v< dedekind::numbers::Rational< I >, std::less_equal<> > = true |
| Ordering traits: Rational is a total order (ℚ ≤ is a chain). | |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_transitive_v< dedekind::numbers::Rational< I >, std::less_equal<> > = true |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_antisymmetric_v< dedekind::numbers::Rational< I >, std::less_equal<> > |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_connex_v< dedekind::numbers::Rational< I >, std::less_equal<> > = true |
| template<typename I> | |
| constexpr bool | dedekind::category::is_associative_v< dedekind::numbers::Rational< I >, std::plus< dedekind::numbers::Rational< I > > > |
| template<typename I> | |
| constexpr bool | dedekind::category::is_associative_v< dedekind::numbers::Rational< I >, std::multiplies< dedekind::numbers::Rational< I > > > = true |
| template<typename I> | |
| constexpr bool | dedekind::category::is_commutative_v< dedekind::numbers::Rational< I >, std::plus< dedekind::numbers::Rational< I > > > |
| template<typename I> | |
| constexpr bool | dedekind::category::is_commutative_v< dedekind::numbers::Rational< I >, std::multiplies< dedekind::numbers::Rational< I > > > = true |
| template<typename I> | |
| constexpr bool | dedekind::category::is_distributive_v< dedekind::numbers::Rational< I >, std::multiplies< dedekind::numbers::Rational< I > >, std::plus< dedekind::numbers::Rational< I > > > = true |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_invertible_v< dedekind::numbers::Rational< I >, std::plus< dedekind::numbers::Rational< I > > > |
| template<dedekind::morphologies::IsInteger I> | |
| constexpr bool | dedekind::category::is_invertible_v< dedekind::numbers::Rational< I >, std::multiplies< dedekind::numbers::Rational< I > > > = true |
| constexpr 𝔸< Rational< default_integer >, Boole, ℵ_0 > | dedekind::numbers::ℚ |
| The canonical rational-number universe ℚ = 𝔸<Rational<default_integer>> (post-#559). | |
| constexpr auto | dedekind::numbers::embed_ℤ_ℚ_ |
Restored variant-layer subalgebra embedding ℤ ↪ ℚ: SignedCardinality → Rational<default_integer>, \(n\mapsto
n/1\). | |
| template<> | |
| constexpr bool | dedekind::category::is_monic_arrow_v< std::decay_t< decltype(dedekind::numbers::embed_ℤ_ℚ_)> > |
| ℤ ↪ ℚ is monic: \(n/1 = m/1 \iff n = m\). | |
| template<> | |
| constexpr bool | dedekind::category::is_monotone_v< std::decay_t< decltype(dedekind::numbers::embed_ℤ_ℚ_)>, std::less_equal<> > |
| ℤ ↪ ℚ preserves order — the monotonicity the strength-reduction pullback rests on. | |
| template<IsInteger I = default_integer> | |
| constexpr auto | dedekind::numbers::embed_𝕃_ℚ |
Exact dyadic embedding of the finite doubles into ℚ: 𝕃<double> → Rational. | |
| template<> | |
| constexpr bool | dedekind::category::is_monic_arrow_v< std::decay_t< decltype(dedekind::numbers::embed_𝕃_ℚ<>)> > |
The finite doubles embed injectively into ℚ: distinct finite doubles have distinct dyadic values (-0.0 and +0.0 are one element of 𝕃). | |
ℚ — rationals as numerator/denominator pairs.
@partition :rational