|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
\(\mathbb{Q}(\sqrt D)\) — a genuine, decidable quadratic real field. More...
#include <compare>#include <concepts>#include <functional>#include <stdexcept>#include <type_traits>import dedekind.numbers:rational;import dedekind.sets;import dedekind.order;import dedekind.category;import dedekind.algebra;
Namespaces | |
| namespace | dedekind::numbers |
| namespace | dedekind::category |
Functions | |
| consteval bool | dedekind::numbers::detail_quadratic::is_perfect_square (long n) |
Is n a perfect square? Guards QuadraticReal against a square radicand (where \(\sqrt D\) is rational, the a/b representation is not unique, and the "extension" degenerates to \(\mathbb{Q}\)). | |
Variables | |
| template<long D, typename Q> | |
| constexpr bool | dedekind::category::is_reflexive_v< dedekind::numbers::QuadraticReal< D, Q >, std::less_equal<> > |
| template<long D, typename Q> | |
| constexpr bool | dedekind::category::is_transitive_v< dedekind::numbers::QuadraticReal< D, Q >, std::less_equal<> > |
| template<long D, typename Q> | |
| constexpr bool | dedekind::category::is_antisymmetric_v< dedekind::numbers::QuadraticReal< D, Q >, std::less_equal<> > = true |
| template<long D, typename Q> | |
| constexpr bool | dedekind::category::is_connex_v< dedekind::numbers::QuadraticReal< D, Q >, std::less_equal<> > |
| template<long D, typename Q> | |
| constexpr bool | dedekind::category::is_distributive_v< dedekind::numbers::QuadraticReal< D, Q >, std::multiplies< dedekind::numbers::QuadraticReal< D, Q > >, std::plus< dedekind::numbers::QuadraticReal< D, Q > > > = true |
| template<long D, typename Q> | |
| constexpr bool | dedekind::category::is_invertible_v< dedekind::numbers::QuadraticReal< D, Q >, std::plus< dedekind::numbers::QuadraticReal< D, Q > > > = true |
| template<long D, typename Q> | |
| constexpr bool | dedekind::category::is_invertible_v< dedekind::numbers::QuadraticReal< D, Q >, std::multiplies< dedekind::numbers::QuadraticReal< D, Q > > > |
\(\mathbb{Q}(\sqrt D)\) — a genuine, decidable quadratic real field.
@partition :quadratic
Cut<Q> (see :cut) reifies the order of the reals decidably but stops at the leaf: it cannot add two irrationals (the sum of two cuts is a Minkowski sum whose membership is \(\exists\)-over- \(\mathbb{Q}\), and the order of general sums forces the undecidable equality of reals). QuadraticReal steps just far enough to keep everything decidable: it fixes one radical extension \(\mathbb{Q}(\sqrt D)\) ( \(D\) a non-square positive integer) and represents a real as \(a+b\sqrt
D,\ a,b\in\mathbb{Q}\). On this carrier the field operations \(+,-,\times,\div\) close exactly (conjugation gives the inverse: \(1/(a+b\sqrt D)=(a-b\sqrt D)/(a^2-b^2D)\)), and the order stays total and decidable (compare \(a+b\sqrt D\) to 0 by comparing \(a^2\) to \(b^2D\)). So the field laws are witnessed by computation — \((1+\sqrt2)(1-\sqrt2)=-1\) is a static_assert — not postulated on an uninhabited carrier. It models \(\mathbb{Q}(\sqrt
D)\subset\mathbb{R}\), one extension, not all of \(\mathbb{R}\): the honest price of decidability.