|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
A real of \(\mathbb{Q}(\sqrt D)\): \(a+b\sqrt D\). More...
Public Types | |
| using | Domain = QuadraticReal |
| using | ScalarCarrier = Q |
Public Member Functions | |
| constexpr | QuadraticReal ()=default |
| \(0\). | |
| constexpr | QuadraticReal (Q a) |
| A rational is a real of the field: \(a+0\sqrt D\). | |
|
template<typename V> requires (!std::same_as<V, Q> && std::convertible_to<V, Q>) | |
| constexpr | QuadraticReal (V v) |
Single-step lift V → Q → field (e.g. an int). | |
| constexpr Q | rational_part () const |
| constexpr Q | radical_part () const |
| constexpr QuadraticReal | infimum () const |
Extrema of the singleton \(\{*this\}\) (inf = sup = the value). Supplies HasExtrema, the structural prerequisite for IsDedekindComplete. | |
| constexpr QuadraticReal | supremum () const |
Static Public Member Functions | |
| static constexpr QuadraticReal | root () |
| The generator \(\sqrt D\) ( \(0+1\sqrt D\)). | |
| static constexpr QuadraticReal | of (Q a, Q b) |
| \(a+b\sqrt D\) from its parts. | |
Friends | |
| constexpr std::strong_ordering | operator<=> (const QuadraticReal &x, const QuadraticReal &y) |
Total, decidable order: sign of \((a-a')+(b-b')\sqrt D\) by comparing squares. This is what keeps \(\mathbb{Q}(\sqrt D)\) a genuine IsTotallyOrdered field rather than a Ternary residue. | |
| constexpr bool | operator== (const QuadraticReal &x, const QuadraticReal &y) |
Field operations (closed, exact) @{ | |
| constexpr QuadraticReal | operator- () const |
| constexpr QuadraticReal | inverse () const |
| \(1/(a+b\sqrt D)\) via the conjugate; the norm \(a^2-b^2D\) is nonzero for every nonzero element ( \(\sqrt D\) irrational). | |
| constexpr QuadraticReal | operator+ (const QuadraticReal &x, const QuadraticReal &y) |
| constexpr QuadraticReal | operator- (const QuadraticReal &x, const QuadraticReal &y) |
| constexpr QuadraticReal | operator* (const QuadraticReal &x, const QuadraticReal &y) |
| constexpr QuadraticReal | operator/ (const QuadraticReal &x, const QuadraticReal &y) |
A real of \(\mathbb{Q}(\sqrt D)\): \(a+b\sqrt D\).
| D | the (non-square, positive) radicand, carried in the type so \(\mathbb{Q}(\sqrt2)\) and \(\mathbb{Q}(\sqrt3)\) are distinct fields. |
| Q | the rational coefficient carrier. |