|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
:expressions predicate for one 2D halfspace a·x + b·y ≤ c.
More...
Public Types | |
| using | Domain = dedekind::linear_algebra::Vec2V<T> |
| using | cardinality_type = dedekind::sets::ℵ_0 |
Public Member Functions | |
| constexpr bool | operator() (const Domain &p) const |
:expressions predicate for one 2D halfspace a·x + b·y ≤ c.
The §5 LP exhibit reads in the textbook frame F : ℚ×ℚ, U : F→ℚ, G ⊆ F, opt = argmax(G, U), with G being a genuine :expressions::Set<Vec2V<T>, Boole, P> instance — the same DSL §3 builds out of bound-scout comprehensions, applied to the 2D LP carrier:
constexpr auto G = halfspace_set(H1{}) & halfspace_set(H2{})
& halfspace_set(H3{}) & halfspace_set(H4{});
constexpr LinearFunctional<Rat, Rat{3L}, Rat{2L}> U{};
constexpr auto opt = argmax(G, U); // Vec2<Rat, Rat{2L}, Rat{2L}>
static_assert(G.contains(opt)); // opt ∈ G via the Set DSL
The integration with :expressions rides on the existing structured_and customization point (the same one :order:halfspace uses to collapse one-dimensional halfspace meets to singletons / intervals / empty). :expressions::operator& discovers our structured_and overloads via ADL on the predicate types and produces a structurally-typed Set:
Set<Vec2V<T>, Boole,
Polytope2DPredicate<T, H1, H2, H3, H4>>
carrying the halfspace pack inside the predicate's template parameter list — exactly what argmax extracts to call the kernel. Closes FIXME(#365) in the 2D-halfspace case: the meet is no longer a lambda fall-through, it's a structural reduction the DSL recognises.
Carries (a, b, c) as NTTPs (structural) and exposes a stateless operator() — the predicate Set DSL participants are built from. ADL through this type's namespace (:optimization) lets the structured_and overloads below intercept halfspace meets inside :expressions::operator& .