Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
total.cppm File Reference

Total-order layer (stronger than :poset). More...

#include <compare>
#include <concepts>
#include <functional>
import dedekind.order:poset;
import dedekind.category;
Include dependency graph for total.cppm:

Concepts

concept  dedekind::order::IsStrictWeakOrder
 The standard C++ 'Compare' requirement (e.g., for std::sort).
concept  dedekind::order::IsTotallyOrdered
 A refinement where every pair is comparable (The Chain).
concept  dedekind::order::IsLinearOrder
 Synonym for Total Order.
concept  dedekind::order::HasTotalOrderOperators
 Pure syntactic shape: T supports the spaceship operator <=> alongside the four partial-order operators (the latter return L::Ω).
concept  dedekind::order::HasTotalOrderOperatorsWith
 Heterogeneous shape: T and U can be compared via <=> in both directions, alongside the four partial-order operators (the latter return L::Ω).

Detailed Description

Total-order layer (stronger than :poset).

@partition :total

total__Scope

Concepts that genuinely require comparability of every pair (the chain axiom): IsTotallyOrdered, IsLinearOrder, IsStrictWeakOrder, the spaceship-aware shape concept HasTotalOrderOperators, and the heterogeneous variant HasTotalOrderOperatorsWith<T, U>. All of these compose IsPartiallyOrdered / HasPartialOrderOperators from :poset; the split lets generic code that needs only the partial-order content not pull in the strictly-stronger total-order machinery (cf. :category:total which already houses the strict total-axiomatic content for algebra; this partition is its order sibling). Per #410.

total__Heterogeneous_Comparison_Surface

HasTotalOrderOperatorsWith<T, U> — and its partial-order sibling in :poset — fill the seam between the homogeneous <=>-shape (which only describes T <=> T) and the real-world need to compare a variant carrier (e.g. SignedCardinality) with an integer NTTP literal (e.g. from -21). Names the cross-type shape that the halfspace machinery silently relies on. Per #415 / cross-issue note on PR #422.

Wikipedia: Total order, Strict weak ordering, Three-way comparison

Note
"אִם אֵין אֲנִי לִי, מִי לִי? וּכְשֶׁאֲנִי לְעַצְמִי, מָה אֲנִי? וְאִם לֹא עַכְשָׁו, אֵימָתָי?" — Hillel the Elder, Pirkei Avot 1:14. [Trans: "If I am not for myself, who will be for me? And being only for myself, what am I? And if not now, when?"]