|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
Periodic arrows on the counts and the counts they license: an arrow f is periodic with period p when \(f(k + p) = f(k)\), a law declared at a generator and inferred at a composite, so that a count along a chain of any length is (n div p) periods and a remainder (the Jlt paper's tensor exhibit, #1104).
More...
#include <algorithm>#include <array>#include <bit>#include <bitset>#include <concepts>#include <cstddef>#include <cstdint>#include <cstdlib>#include <functional>#include <iterator>#include <limits>#include <numeric>#include <optional>#include <ranges>#include <span>#include <string_view>#include <tuple>#include <type_traits>#include <utility>#include <vector>import dedekind.category:functor;
Classes | |
| struct | dedekind::category::unit_period< F > |
The trait behind HasUnitPeriod: a sequence whose period is 1 by its type, not only by its value, so that the sum along it needs no fold. A struct, as is_adjoint, so that a downstream partition registers a family by one partial specialisation. More... | |
| struct | dedekind::category::unit_period< ConstantMorphism< N, B > > |
| struct | dedekind::category::unit_period< Compose< F, G > > |
| struct | dedekind::category::Congruent< N > |
The residue class \(\{k \mid k \equiv r \pmod m\}\) as a predicate on the counts, periodic with period m: the quotient onto Modular<m>'s carrier, then the test for r. More... | |
| struct | dedekind::category::detail_periodic::Double< N > |
One step of fast doubling, \((F(j), F(j+1))\) modulo m to \((F(2j), F(2j+1))\) or \((F(2j+1), F(2j+2))\) by bit i of k: \(F(2j) = F(j)(2F(j+1) - F(j))\), \(F(2j+1) = F(j)^2 + F(j+1)^2\). More... | |
| struct | dedekind::category::detail_periodic::Pisano< N > |
One step of the search for the Pisano period: the pair \((F(j), F(j+1))\) modulo m, and the least j at which it is \((0, 1)\) again, once found. More... | |
| struct | dedekind::category::FibonacciMod< N > |
The Fibonacci numbers modulo m, \(k \mapsto F(k) \bmod m\), by fast doubling, \(\log k\) steps; the modulus is at most the square root of the word's order, so that the products stay in the word, and a wider one is refused where the arrow is read. More... | |
| struct | dedekind::category::Opaque< F > |
An arrow with its laws hidden: called as f, with no period, so that a count along it is the plain fold. What a test runs beside the law to check it. More... | |
| struct | dedekind::category::detail_periodic::Iverson< N > |
The Iverson bracket, bool to the counts, a semiring map. More... | |
| struct | dedekind::category::detail_periodic::CheckedPlus< N > |
| The checked sum of two exact counts: none if either is none or their sum leaves the word. More... | |
| struct | dedekind::category::Shift< N > |
A translation of the counts, \(k \mapsto k + j\): after it, a periodic arrow keeps its period, on an extent narrowed by j. More... | |
| struct | dedekind::category::builds_lattice_nodes< P > |
Periodic predicates opt in: their | and & are the lattice's nodes (:lattice), periodic with the least common multiple of their periods. More... | |
| struct | dedekind::category::detail_periodic::CountStep< N > |
| The window's step: how many are true. More... | |
| struct | dedekind::category::detail_periodic::AnyStep |
| The window's step: whether any is true. More... | |
| struct | dedekind::category::detail_periodic::WindowStep< F, Step > |
One step of a window at k: the step applied to f(k + j). More... | |
| struct | dedekind::category::Rolling< F, Step, Acc > |
A window over a periodic predicate, SQL's window function over ROWS BETWEEN CURRENT ROW AND w - 1 FOLLOWING: \(k \mapsto\) the step folded over \(f(k), \ldots, f(k + w - 1)\). A finite combination of translations, so periodic with the same period. More... | |
| struct | dedekind::category::detail_periodic::box_node< T > |
An entry of an outer product: the legs' predicates in parallel, then their meet, Tensor followed by Merge. More... | |
| struct | dedekind::category::detail_periodic::box_node< Compose< Tensor< A, B >, Both > > |
| struct | dedekind::category::detail_periodic::box_legs< T > |
| How many legs an entry has. More... | |
| struct | dedekind::category::detail_periodic::box_legs< Compose< Tensor< A, B >, Both > > |
| struct | dedekind::category::Box< T, K, N > |
The outer product of predicates along chains, \(T(i_1, \ldots,
i_K) = f_1(i_1) \wedge \cdots \wedge f_K(i_K)\) over the box of all indices, a rank-one tensor never built: its entry is the legs' Tensor followed by the merge, and the box's sides are the chains' lengths. In the pictures of tensor networks (Bridgeman and Chubb, "Hand-waving and
Interpretive Dance: An Introductory Course on Tensor Networks", J. Phys. A 50, 2017), each count contracts a leg's index against a covector: all ones for the box, a residue class for a section. More... | |
| struct | dedekind::category::detail_periodic::Residue< T, N > |
| One residue's count on a leg, appended to its histogram. More... | |
| struct | dedekind::category::detail_periodic::CyclicTerm< N > |
One term of a cyclic convolution: the residues i and j of two histograms add to their sum modulo m. More... | |
| struct | dedekind::category::detail_periodic::CyclicRow< N > |
One row of a cyclic convolution: residue i of the first histogram against every residue of the second. More... | |
| struct | dedekind::category::detail_periodic::Convolve< N > |
| The cyclic convolution of the histogram so far with one more leg's, in the counts' semiring, the ring of polynomials modulo \(x^m - 1\). More... | |
| struct | dedekind::category::AtMost< T, K > |
| Words over an alphabet as a tensor, not as a sequence: the tensor power \(\Sigma^n\) of a filtered alphabet, its symmetric sections, and the free monoid on it truncated below a length, each counted as a product of factors that never overflow where the total does. Periodicity above is invariance under a translation of the counts; a symmetry here is invariance under a permutation of the positions of a word. More... | |
| struct | dedekind::category::Factor< N > |
| A factor of a count, \(b^e\): a base raised to an exponent. More... | |
| struct | dedekind::category::detail_periodic::factor_word< T > |
| The count word of a factor. More... | |
| struct | dedekind::category::detail_periodic::factor_word< Factor< N > > |
| struct | dedekind::category::detail_periodic::With |
| One more value into a bounded list, as a fold's step. More... | |
| struct | dedekind::category::Cycles< N > |
| The cycles of a permutation of positions of one length, and how many there are: one term of its cycle type. More... | |
| struct | dedekind::category::detail_periodic::SetByte |
| One letter into a packed set of bytes. More... | |
| struct | dedekind::category::detail_periodic::ByteOf |
A letter as the byte it is: ordered as bytes, not as char, which may be signed. (#1141). More... | |
| struct | dedekind::category::detail_periodic::MapByte |
| One letter and its image into a table on the bytes. More... | |
| struct | dedekind::category::Letters |
A subobject of the bytes given by its letters, \(\chi : \Sigma
\to \Omega\) as a packed word of 256 bits: the predicate a filtered alphabet is built from, letters("ACGT"). More... | |
| struct | dedekind::category::detail_periodic::ToByte |
| A character as a byte. More... | |
| struct | dedekind::category::Bytes< N > |
| A text written in the source: its bytes, held by value, and a view, so a query over it owns them and nothing dangles, a temporary's included. Its copy is constant-time in the sense a view asks, the length being in the type. More... | |
| struct | dedekind::category::Ranked |
A byte's rank in an alphabet: how many of its letters lie below it, the order isomorphism of the letters, in the bytes' order, onto \([0, |\Sigma|)\); a byte outside it is a hole. A Kleisli arrow into Maybe, as where is: a text of bytes read through it is the alphabet's letters, holes where it has none. More... | |
| struct | dedekind::category::detail_periodic::KeepInSlice |
| One more byte, kept where the slice and the predicate both do. More... | |
| struct | dedekind::category::detail_periodic::FixByte |
| One byte into the identity table. More... | |
| struct | dedekind::category::detail_periodic::ReflectedAt |
| One byte's image under the reflection: the letter at the reflected rank, the byte itself off the alphabet. (#1141: the chain's enumeration, once alphabets range over other carriers.). More... | |
| struct | dedekind::category::detail_periodic::IsLetterAt |
| Whether a position of the bytes is a letter. More... | |
| struct | dedekind::category::detail_periodic::ByteAt |
| A position of the bytes as its byte. More... | |
| struct | dedekind::category::Reflection |
| struct | dedekind::category::is_involutive< Reflection, std::byte > |
The duality is an involution: \(({\sim} + n)\) is one on the ranks (is_involutive above), and a conjugate of an involution by a bijection is one. More... | |
| struct | dedekind::category::SplitMix |
A random number as an arrow out of the counts, a sequence on a chain: the hash of a position and a seed (SplitMix64, Steele, Lea and Flood 2014). constexpr, with no state: any position is at hand, a sequence of any length is never stored, and two seeds are two streams. So a law can be asked of random inputs in a static_assert, and a million events cost nothing to spin up. For exercising code: no cryptography, and no claim on sampling. More... | |
| struct | dedekind::category::RandomLetter |
| A random letter by position: the hash, read as a rank in an alphabet. More... | |
| struct | dedekind::category::LetterMap |
An arrow on the bytes given by a table, each letter of from to the letter at the same place of to, every other byte fixed: letter_map("ACGT", "TGCA") is the complement of a base, an involution. More... | |
| struct | dedekind::category::Power< C, F, N > |
The tensor power \(\Sigma^n\): the words of length n over the letters of a chain that a predicate keeps, a box of n legs, each the filtered alphabet, never built. More... | |
| struct | dedekind::category::PowerMap< T > |
An arrow on the letters applied to every letter of a word, of any length: the list functor's action on arrows, \(\tau^{\times n}\) at each length \(n\) at once, beside power on the alphabet, Listing 4's power one level up. It commutes with every permutation of the positions, which is naturality read on words. More... | |
| struct | dedekind::category::Rotation< N > |
The rotation of the positions of a word by shift, \(i \mapsto
i + d \bmod n\), the symmetry of a power \(u^j\): on a word, the letter at i moves to i + d, as std::rotl moves a bit. A family of arrows, one per word type, as Reverse is. More... | |
| struct | dedekind::category::is_involutive< Compose< NegationArrow< Chain< N > >, Shift< N > >, N > |
The chain's reflection, then a translation, is a point reflection, \(x \mapsto c - x\), an involution for every c, the counts being unsigned: \(c - (c - x) \equiv x\) modulo the word. The reversal of n positions on indices is the one with \(c = n - 1\): \(n - 1 - i \equiv {\sim} i + n\), so ~Identity<N>{} >> shift(n). An involution, so an isomorphism, its own inverse (:involution). More... | |
| struct | dedekind::category::detail_periodic::ReversalAgrees |
The reversal on indices agrees with position at i. More... | |
| struct | dedekind::category::detail_periodic::AgreesWithReverse |
| struct | dedekind::category::commutes< PowerMap< T >, Morphism< W, W, Reverse > > |
The naturality of the permutations of positions: rev and rotate(d) are natural transformations of the power functor \((-)^n\) to itself, so each square \(\sigma \circ \tau^{\times n} =
\tau^{\times n} \circ \sigma\) commutes, for every tau at once. The certificate is declared here, once per permutation; :natural's IsNaturalTransformation checks its square only at the identities, by type, and does not yet read it. So the reverse complement is one map, written in either order, and an involution where tau is one (is_involution, :posetal). More... | |
| struct | dedekind::category::commutes< PowerMap< T >, Morphism< W, W, Rotation< N > > > |
| struct | dedekind::category::is_involutive< PowerMap< T >, std::vector< C > > |
A map on every letter is an involution where the map on one is, certified at the type where tau's is; a LetterMap's law is of its table, so is_involution decides it on the value. More... | |
| struct | dedekind::category::detail_periodic::ReturnsTwice< T > |
| Whether an arrow on the bytes, taken twice, returns one more byte. More... | |
| struct | dedekind::category::detail_periodic::FallsAlong< T > |
| One more letter of the alphabet against the one before it: the map's images must not rise along the chain of the letters. More... | |
| struct | dedekind::category::detail_periodic::DualIsTheMask |
| struct | dedekind::category::LetterMaps |
The letter maps on the bytes as a category: one arrow type, LetterMap, the identity its identity table. More... | |
| struct | dedekind::category::LetterMapsOnWords |
The letter maps on every letter of a word as a category: the image of LetterMaps under the list functor. More... | |
| struct | dedekind::category::PowerFunctor |
The list functor on the letter maps, a word for a letter, of every length, and power(tau) for an arrow tau: the power functor \((-)^n\) at each length at once. It has no state, so it is one functor, and rev and rotate(d) are natural transformations of it to itself, by the certificates above. More... | |
| struct | dedekind::category::is_functorial< PowerFunctor > |
| The power functor's laws: \(\mathrm{id}^{\times n} = \mathrm{id}\) and \((\sigma \gg \tau)^{\times n} = \sigma^{\times n} \gg
\tau^{\times n}\), letterwise by construction, witnessed on a word. More... | |
| struct | dedekind::category::OnWords< S > |
| A transformation of the power functor with one component, a map on the words, the same at every letter. More... | |
| struct | dedekind::category::detail_periodic::RotateByLetter |
| A family of rotations that depends on the letter: each component commutes with every map on the letters, yet a map that changes the letter meets different rotations at the two ends of the square, so it is no natural transformation, and is refused. More... | |
| struct | dedekind::category::Symmetric< P, S, T > |
The section of a tensor power fixed by a permutation sigma of the positions and an arrow tau on the letters, \(x_{\sigma(i)} =
\tau(x_i)\): the legs merged along each cycle of sigma, the spider's Merge through tau, the words de Bruijn's power group element \((\sigma, \tau)\) fixes. More... | |
| struct | dedekind::category::Symmetric< P, S, T >::Holds< V > |
One position of a word against the condition: the letter at i is the power's, and its image under tau is at sigma(i). More... | |
| struct | dedekind::category::Powers< C, F, N > |
words(Σ), the tensor powers by length, \(n \mapsto \Sigma^n\): an arrow out of the counts into the tensors, the free monoid graded by length. Its density is 1 at every length. Each power is the exponential \(\Sigma^{[n]}\), the functions from the chain of n to the letters (IsExponential, :cartesian), and the family is a strong monoidal functor \((\mathbb{N}, +) \to (\text{tensors}, \otimes)\), \(\Sigma^{m+n} \cong \Sigma^m \otimes \Sigma^n\): the box law is its monoidality (no monoidal-functor concept states it yet, #1134). More... | |
| struct | dedekind::category::FixedBy< P, S, T > |
fixed_by(g), a tensor power to its section fixed by g, a permutation of the positions after a letter map on every letter: an arrow between tensors. By Pólya each cycle of g fills with the letters it fixes, at most \(|\Sigma|^{\ell}\) for a cycle of length \(\ell\), so the section's density is at most 1. The section is the equalizer \(\mathrm{Eq}(\mathrm{id}, g)\) (IsEqualizer, :pullback), equally the limit of the action of \(\langle g \rangle\) on the power, a functor out of its delooping (ActionFunctor, Delooping, :functor): its invariants, Pólya their count. More... | |
| struct | dedekind::category::detail_periodic::FixedByStage< S, T > |
fixed_by(g) before it meets the powers it applies to. More... | |
| struct | dedekind::category::Length< N > |
len(n): the fibre of the length over n, the predicate a graded family of words is met with. oligos & len(n) is the words of length n, \(\Sigma^n\) as the fibre of \(\Sigma^*
\to \mathbb{N}\) over n, Trsk's filter on the graded set; it is the family applied at n, so the count law of the fibre is the power's, \(|\Sigma|^n\). The meets commute: oligos & len(n) & fixed_by(g) and oligos & fixed_by(g) & len(n) are one section. More... | |
| struct | dedekind::category::ReflectedReverse |
~rev: the reversal, then the reflection of the alphabet on every letter, the reverse complement. ~f is :posetal's: f then the reflection of its codomain's chain, which on the ranks of ACGT is \(x \mapsto 3 - x\), bitwise NOT on two bits. A word carries no alphabet, so ~rev is a family indexed by the alphabet, with a component at each, power(refl(Σ)) >> rev at Σ, taken where fixed_by(~rev) meets a power over Σ, as the exhibit's oligos & len(6) & fixed_by(~rev). Each component is an involution, two commuting involutions (commutes and is_involutive above). (#1141: an alphabet over another carrier has its component from its rank, as refl does.) More... | |
| struct | dedekind::category::detail_periodic::FixedByReflectedReverse |
fixed_by(~rev) before it meets the powers it applies to. More... | |
| struct | dedekind::category::length_coherent< S > |
A permutation family coherent across lengths: from n to n + 2 its cycle type gains cycles and changes none. The reversal's is: the longer chain's antitone bijection restricted to the middle is the shorter's, with one more pair outside (antitone_cycle_type). A rotation's follows \(\gcd(n, d)\) and is not. Coherence is naturality: the family is a natural transformation of the powers over the chains and their middle inclusions \(n
\hookrightarrow n + 2\) (IsNaturalTransformation, :natural), as it is natural over the letter maps already (power(τ) commutes with it). Sufficient, not necessary: rotate(1) is not coherent, yet its sections' density \(|\Sigma| / |\Sigma|^n\) falls. A struct trait, for a family to register by one specialisation. More... | |
| struct | dedekind::category::length_coherent< Reverse > |
| struct | dedekind::category::density_falls_on_even_lengths< Fam > |
A family of sets of words whose density does not grow along the even lengths. Derived, not registered per family: the powers have density 1; fixing a permutation keeps it at most 1, cycle by cycle; a length-coherent permutation adds cycles from n to n + 2, each at most 1, so the density along the even lengths does not grow (the restriction sites: \(k^j / |\Sigma|^{2j}\) of length \(2j\), k the letters \(\tau^2\) fixes). More... | |
| struct | dedekind::category::density_falls_on_even_lengths< Compose< Powers< C, F, N >, FixedBy< Power< C, F, N >, S, T > > > |
| struct | dedekind::category::Outer< A, B > |
| An outer product of two counted tensors, its count the product of theirs. More... | |
| struct | dedekind::category::FreeMonoid< C, F, N > |
| The free monoid on a filtered alphabet, truncated below a length: \(\Sigma^{<L} = \coprod_{n < L} \Sigma^n\), the coproduct of the tensor powers, concatenation of words its operation. More... | |
| struct | dedekind::category::detail_periodic::CheckedFactor< N > |
| One factor into the product, checked. More... | |
| struct | dedekind::category::detail_periodic::IsEmptyFactor< N > |
| Whether a factor is empty, \(0^e\) with \(e > 0\). More... | |
| struct | dedekind::category::detail_periodic::CheckedLength< C, F, N > |
| One length's count into the sum, checked. More... | |
| struct | dedekind::category::detail_periodic::TimesPower< N > |
One factor into the product: \(b^e\) is e copies of b under *, which concat on copies computes by squaring, Listing 4's overload at the monoid \((\mathbb{N}/2^w, \times)\); the factors are then the plain fold, one multiplication each. More... | |
| struct | dedekind::category::CeilLog2< N > |
| \(\lceil \log_2 \rceil\), the bits a positive count's predecessor occupies: a lax monoid homomorphism \((\mathbb{N}_{>0},
\times) \to (\mathbb{N}, +)\), \(\lceil \log_2 ab \rceil \le \lceil
\log_2 a \rceil + \lceil \log_2 b \rceil\), carrying the power action, \(\lceil \log_2 b^e \rceil \le e \lceil \log_2 b \rceil\). The inequality is the soundness of reading a count's width off its factors. More... | |
| struct | dedekind::category::detail_periodic::PlusLogPower< N > |
One factor into the width: its power's image under CeilLog2, \(e \lceil \log_2 b \rceil\), added saturating, the \((\mathbb{N}, +)\) side of TimesPower's fold. More... | |
| struct | dedekind::category::Pow2< N > |
| \(k \mapsto 2^k\) on the counts, refused past the word: the window of the bit words. More... | |
| struct | dedekind::category::detail_periodic::bit_word< W > |
The bit word of width W: a machine word where one has the width, std::bitset otherwise. More... | |
| struct | dedekind::category::detail_periodic::bit_word< 8 > |
| struct | dedekind::category::detail_periodic::bit_word< 16 > |
| struct | dedekind::category::detail_periodic::bit_word< 32 > |
| struct | dedekind::category::detail_periodic::bit_word< 64 > |
| struct | dedekind::category::Pack< W > |
A pattern, given by its count, in the bit word of width W, the padding above it zero: the switch of representation, from the counts to the word whose API has the rotations and masks. A section of unpack on the counts below \(2^W\). More... | |
| struct | dedekind::category::Unpack< W > |
A machine word read back as the count of its pattern: the retraction of pack, \(\mathit{unpack} \circ \mathit{pack} =
\mathrm{id}\) on the counts below \(2^W\). Up to a machine word, since a count is one. More... | |
| struct | dedekind::category::IsSquare< W > |
A pattern of even width length, packed into the bit word of width W, that is a square \(u u\): fixed by the rotation by half its width, within its width, the padding apart. For a width \(2^k\) these are exactly the proper powers, the patterns that are not primitive (Lothaire, Combinatorics on Words, §1.3): every proper divisor of \(2^k\) divides \(2^{k-1}\). More... | |
| struct | dedekind::category::detail_periodic::Iterate< T, N > |
A letter after tau taken steps times. More... | |
| struct | dedekind::category::detail_periodic::KeptAfter< F, T, N > |
Whether the letter tau takes steps times to is kept. More... | |
| struct | dedekind::category::detail_periodic::ReturnsAfter< T, N > |
Whether tau taken steps times returns the letter. More... | |
| struct | dedekind::category::detail_periodic::SetBit< W > |
| One letter's bit into the packed characteristic function. More... | |
| struct | dedekind::category::detail_periodic::CycleCount< C, F, T, N > |
The letters that fill a merged cycle of length legs through tau, counted in the bit word of width W: the spider's merge on the truth values is \(\wedge\), so packed it is &, one mask per step around the cycle and one for the letters tau returns, and one popcount. More... | |
| struct | dedekind::category::detail_periodic::CycleCount< C, F, T, N >::AndStep< W > |
| One more step's mask into the meet. More... | |
| struct | dedekind::category::detail_periodic::CycleFactor< C, F, T, N > |
| One merged leg's factor: the letters that fill a cycle, by popcount in the narrowest word that holds the alphabet, raised to the number of such cycles. More... | |
| struct | dedekind::category::Window< N > |
The window of a word from position offset, length letters long: its projection onto those positions, \(\pi_I\) for \(I =
\{\mathit{offset}, \ldots, \mathit{offset} + \mathit{length} - 1\}\), a factor of the word in the sense of combinatorics on words. Total: a window past the word's end is cut at it, so it is shorter. More... | |
| struct | dedekind::category::Cylinder< P, S, N > |
The words of a tensor power whose window lies in a set of words: the cylinder set \(\pi_I^{-1}(S)\), the legs the window reads constrained by S and every other leg free. More... | |
| struct | dedekind::category::detail_periodic::CylinderFactorsAt< P, S, N > |
The sequence of a cylinder's factors along the offsets of its window. A power is the same at every position, so every window that fits has the same factors (R2: the offset drops out): period 1, on the offsets where the window fits. The summands of occurrences are this sequence read by CountOf or ExactCountOf. More... | |
| struct | dedekind::category::unit_period< detail_periodic::CylinderFactorsAt< P, S, N > > |
| The cylinder's factors along the offsets are constant by their type, R2's translation invariance: the sum of their counts is one count times the offsets. More... | |
| struct | dedekind::category::detail_periodic::CountOf< L, N > |
A reading of a factored count, modulo the word: an arrow from the factor lists, with no period of its own; after a periodic sequence, the composite is periodic (period of a Compose). More... | |
| struct | dedekind::category::detail_periodic::ExactCountOf< L, N > |
A reading of a factored count, exactly: as CountOf. More... | |
Namespaces | |
| namespace | dedekind::category |
Concepts | |
| concept | dedekind::category::HasPeriod |
A sequence on finite chains with a declared period, read by period(f): \(f(k + p) = f(k)\) for every k. Periodicity is a sequence's, an arrow out of the counts, not an arrow's in general. | |
| concept | dedekind::category::HasUnitPeriod |
| A sequence constant on its extent by its type: a constant arrow out of the counts, a sequence after one, and the cylinder's factors along the offsets (R2). | |
| concept | dedekind::category::detail_periodic::IsPeriodicPredicate |
| A periodic predicate on the counts. | |
| concept | dedekind::category::detail_periodic::IsFactorsOf |
A list of factors, a count factorised, in the counts N. | |
| concept | dedekind::category::detail_periodic::IsBoundedList |
Bounded by its type: a forward range with a static capacity. | |
| concept | dedekind::category::detail_periodic::IsBoundedFactorsOf |
| A list of factors bounded by its type: the factors of a shape. | |
| concept | dedekind::category::HasCycleType |
| A permutation of positions with a known cycle type. | |
| concept | dedekind::category::HasFactors |
| A tensor whose count is a product of factors, as many as its type bounds: a shape, so an outer product of two is one too. | |
Typedefs | |
| using | dedekind::category::detail_periodic::Both = Merge<bool, std::logical_and<bool>> |
| The meet of a pair of truth values: the spider's merge on 𝔹. | |
| template<typename L> | |
| using | dedekind::category::detail_periodic::word_of_t |
| The count word of a list of factors. | |
| using | dedekind::category::Alphabet |
The byte alphabet's type, as abc builds it: the letters under their predicate, a filtered chain of the bytes. Listing 5's Alphabet bases. (#1141: the first carrier of the alphabet concept.). | |
| using | dedekind::category::Words = Powers<std::byte, Letters, std::size_t> |
The words over the byte alphabet, by length: words(Σ)'s type, Listing 5's Words oligos. | |
| template<std::size_t Bits> | |
| using | dedekind::category::narrowest_count_word |
The narrowest count word on the ladder holding Bits: the stage of the filtered colimit a count of that many bits factors through. The rungs are the words whose products stay in them (IsCountWord): 32 and 64 bits; past the top there is none, and the count stays in its factors, compared and multiplied exactly there. | |
| template<std::size_t W> | |
| using | dedekind::category::BitWord = typename detail_periodic::bit_word<W>::type |
The bit word of width W, chosen by the width: the machine word for 8, 16, 32 and 64 bits, std::bitset otherwise. | |
Functions | |
| template<HasPeriod F, IsArrow G> | |
| constexpr Dom< F > | dedekind::category::period (const Compose< F, G > &c) |
| Inferred, not declared: an arrow after a periodic one is periodic with the same period, whatever the second arrow is. | |
| template<HasPeriod F> | |
| constexpr Dom< F > | dedekind::category::extent (const F &) |
Where a period's law holds: \(f(k + p) = f(k)\) for every k with k + p below the extent. A generator's law holds on the whole word; a shift narrows it, since the word does not wrap for the law. | |
| template<HasPeriod F, IsArrow G> | |
| constexpr Dom< F > | dedekind::category::extent (const Compose< F, G > &c) |
| template<IsCountWord N, typename B> | |
| constexpr N | dedekind::category::period (const ConstantMorphism< N, B > &) |
| A constant sequence, a constant arrow out of the counts: period 1, on the whole word. A constant arrow from anything else is no sequence and has no period. | |
| constexpr void | dedekind::category::detail_periodic::refuse_zero_modulus () |
| Refuses a modulus of 0, which has no residues: not a constant expression at compile time, the end of the program at run time. | |
| constexpr void | dedekind::category::detail_periodic::refuse_beyond_extent () |
| Refuses a count past the extent of the law it would use. | |
| constexpr void | dedekind::category::detail_periodic::refuse_unrepresentable_period () |
| Refuses a period the word cannot hold. | |
| constexpr void | dedekind::category::detail_periodic::refuse_beyond_word () |
| Refuses a power of two the word cannot hold. | |
| constexpr void | dedekind::category::detail_periodic::refuse_wide_modulus () |
| Refuses a modulus past the square root of the word's order, whose residues' products would leave the word. | |
| template<IsCountWord N> | |
| constexpr N | dedekind::category::detail_periodic::checked_lcm (N a, N b) |
The least common multiple of two periods, refused where the word cannot hold it, which std::lcm leaves undefined. | |
| template<IsCountWord N> | |
| constexpr N | dedekind::category::period (const Congruent< N > &c) |
| template<IsCountWord N = std::size_t> | |
| constexpr Congruent< N > | dedekind::category::congruent (std::type_identity_t< N > m, std::type_identity_t< N > r) |
The residue class of r modulo m. | |
| template<IsCountWord N> | |
| constexpr N | dedekind::category::detail_periodic::fibonacci_modulus (N m) |
A modulus for the Fibonacci numbers in the word N: positive and at most \(2^{w/2}\) for a word of w bits, so that a product of two residues, below \(m^2\), and the Pisano bound \(6m\) stay in the word; refused otherwise. | |
| template<IsCountWord N> | |
| constexpr N | dedekind::category::period (const FibonacciMod< N > &f) |
The Pisano period \(\pi(m)\), the period of the Fibonacci numbers modulo m, a theorem: it exists and is at most \(6m\), so a search of that length finds it. | |
| template<IsCountWord N = std::size_t> | |
| constexpr FibonacciMod< N > | dedekind::category::fibonacci_mod (std::type_identity_t< N > m) |
The Fibonacci numbers modulo m. | |
| template<IsArrow F> | |
| constexpr Opaque< F > | dedekind::category::opaque (F f) |
| template<IsCountWord N = std::size_t, std::ranges::input_range R> requires std::convertible_to<std::ranges::range_value_t<R>, bool> | |
| constexpr N | dedekind::category::count (R r) |
| The count of a range of truth values: the plain fold. | |
| template<IsCountWord N, IsArrow F> | |
| constexpr N | dedekind::category::detail_periodic::count_below (N m, const F &f) |
The plain count of f(0), ..., f(m - 1). | |
| template<IsCountWord N, HasPeriod F> requires std::same_as<Dom<F>, N> && std::convertible_to<Cod<F>, bool> | |
| constexpr N | dedekind::category::count (const FiniteChainSequence< N, F > &v) |
The count along the chain of n under a periodic predicate: (n div p) periods and a remainder, by periodicity; the chain's order does not matter, since the counts commute. More specialised than the plain fold, so resolution prefers it. | |
| template<IsCountWord N, HasPeriod F> requires std::same_as<Dom<F>, N> && std::convertible_to<Cod<F>, bool> | |
| constexpr N | dedekind::category::count (const unfold_view< std::optional< N >, detail_chain::SliceStep< N, F > > &v) |
The count along a chain restricted by value to [lo, hi) under a periodic predicate: the law's count below hi less the law's count below lo, two calls whatever the bounds. | |
| template<std::ranges::input_range R> requires IsCountWord<std::ranges::range_value_t<R>> | |
| constexpr std::ranges::range_value_t< R > | dedekind::category::sum (R r) |
| The sum of a range of counts: the plain fold. | |
| template<IsCountWord N, IsArrow F> | |
| constexpr N | dedekind::category::detail_periodic::sum_below (N m, const F &f) |
The plain sum of f(0), ..., f(m - 1). | |
| template<IsCountWord N, HasPeriod F> requires std::same_as<Dom<F>, N> && std::same_as<Cod<F>, N> | |
| constexpr N | dedekind::category::sum (const FiniteChainSequence< N, F > &v) |
The sum along the chain of n under a periodic arrow into the counts: (n div p) copies of one period's sum, one multiplication by the semimodule law, and a remainder. | |
| template<IsCountWord N, HasUnitPeriod F> requires std::same_as<Dom<F>, N> && std::same_as<Cod<F>, N> | |
| constexpr N | dedekind::category::sum (const FiniteChainSequence< N, F > &v) |
The sum along the chain of n under a sequence of period 1 by its type, a constant one on its extent: n copies of f(0), one multiplication by the semimodule law, and no fold at all, not even over a period of one or a remainder of none. The action of \(\mathbb{N}\) on the counts collapsing a constant, as Listing 4's concat on copies does. More specialised than the periodic sum, so resolution prefers it. | |
| template<IsCountWord N> | |
| constexpr std::optional< N > | dedekind::category::detail_periodic::checked_times (N k, std::optional< N > x) |
| The checked product of a count and an exact count. | |
| template<std::ranges::input_range R> requires detail_periodic::is_exact_count_v<std::ranges::range_value_t<R>> | |
| constexpr std::ranges::range_value_t< R > | dedekind::category::exact_sum (R r) |
The exact sum of a range of exact counts: the plain fold, never wrapped, the discipline of exact_count. | |
| template<IsCountWord N, IsArrow F> | |
| constexpr std::optional< N > | dedekind::category::detail_periodic::exact_sum_below (N m, const F &f) |
The plain exact sum of f(0), ..., f(m - 1). | |
| template<IsCountWord N, HasPeriod F> requires std::same_as<Dom<F>, N> && std::same_as<Cod<F>, std::optional<N>> | |
| constexpr std::optional< N > | dedekind::category::exact_sum (const FiniteChainSequence< N, F > &v) |
The exact sum along the chain of n under a periodic arrow into the exact counts: sum's law, checked. | |
| template<IsCountWord N, HasUnitPeriod F> requires std::same_as<Dom<F>, N> && std::same_as<Cod<F>, std::optional<N>> | |
| constexpr std::optional< N > | dedekind::category::exact_sum (const FiniteChainSequence< N, F > &v) |
The exact sum along a constant sequence: sum's collapse, checked. | |
| template<IsCountWord N = std::size_t> | |
| constexpr Shift< N > | dedekind::category::shift (std::type_identity_t< N > j) |
| template<IsCountWord N, HasPeriod G> | |
| constexpr N | dedekind::category::period (const Compose< Shift< N >, G > &c) |
| template<IsCountWord N, HasPeriod G> | |
| constexpr N | dedekind::category::extent (const Compose< Shift< N >, G > &c) |
| template<HasPeriod P, HasPeriod Q> | |
| constexpr Dom< P > | dedekind::category::period (const Join< P, Q > &j) |
| template<HasPeriod P, HasPeriod Q> | |
| constexpr Dom< P > | dedekind::category::period (const Meet< P, Q > &m) |
| template<HasPeriod P, HasPeriod Q> | |
| constexpr Dom< P > | dedekind::category::extent (const Join< P, Q > &j) |
| template<HasPeriod P, HasPeriod Q> | |
| constexpr Dom< P > | dedekind::category::extent (const Meet< P, Q > &m) |
| template<HasPeriod P> | |
| constexpr Dom< P > | dedekind::category::period (const Not< P > &n) |
| template<HasPeriod P> | |
| constexpr Dom< P > | dedekind::category::extent (const Not< P > &n) |
| template<detail_periodic::IsPeriodicPredicate F, std::semiregular Step, std::semiregular Acc> | |
| constexpr Dom< F > | dedekind::category::period (const Rolling< F, Step, Acc > &r) |
| template<detail_periodic::IsPeriodicPredicate F, std::semiregular Step, std::semiregular Acc> | |
| constexpr Dom< F > | dedekind::category::extent (const Rolling< F, Step, Acc > &r) |
| template<detail_periodic::IsPeriodicPredicate F> | |
| constexpr Rolling< F, detail_periodic::CountStep< Dom< F > >, Dom< F > > | dedekind::category::rolling_count (F f, std::type_identity_t< Dom< F > > w) |
How many of w consecutive values are true, SQL's COUNT OVER a window. | |
| template<detail_periodic::IsPeriodicPredicate F> | |
| constexpr Rolling< F, detail_periodic::AnyStep, bool > | dedekind::category::rolling_any (F f, std::type_identity_t< Dom< F > > w) |
Whether any of w consecutive values is true. | |
| template<IsCountWord N, IsArrow F, IsArrow G> requires std::same_as<Cod<F>, bool> && std::same_as<Cod<G>, bool> | |
| constexpr auto | dedekind::category::operator* (const FiniteChainSequence< N, F > &a, const FiniteChainSequence< N, G > &b) |
| template<IsArrow T, std::size_t K, IsCountWord N, IsArrow G> requires std::same_as<Cod<G>, bool> | |
| constexpr auto | dedekind::category::operator* (const Box< T, K, N > &x, const FiniteChainSequence< N, G > &b) |
| template<IsCountWord N, std::size_t A, std::size_t B> | |
| constexpr std::array< N, A+B > | dedekind::category::detail_periodic::join_arrays (const std::array< N, A > &a, const std::array< N, B > &b) |
| Two arrays, one after the other. | |
| template<IsArrow T, std::size_t K, IsCountWord N> | |
| constexpr std::array< N, box_legs< T >::value > | dedekind::category::detail_periodic::counts_of (const T &t, const std::array< N, K > &sides, std::size_t at) |
Each leg's count, the legs read left to right from at. | |
| template<IsArrow T, std::size_t K, IsCountWord N> | |
| constexpr std::vector< std::vector< N > > | dedekind::category::detail_periodic::residues_of (const T &t, const std::array< N, K > &sides, std::size_t at, N m) |
Each leg's histogram over the residues modulo m, the legs read left to right from at. | |
| template<IsArrow T, std::size_t K, IsCountWord N> | |
| constexpr std::array< N, K > | dedekind::category::count_factors (const Box< T, K, N > &b) |
| Each leg's count over its chain, the factors of the box's count. | |
| template<IsArrow T, std::size_t K, IsCountWord N> | |
| constexpr N | dedekind::category::count (const Box< T, K, N > &b) |
The count over the box, SQL's COUNT(*) over a cross join: by distributivity the product of the legs' counts, contracting the rank-one tensor against the all-ones covector on each leg. Exact beyond the word only as its factors (count_factors); this is its residue. | |
| template<IsArrow T, std::size_t K, IsCountWord N> | |
| constexpr N | dedekind::category::count_section (const Box< T, K, N > &b, std::type_identity_t< N > m, std::type_identity_t< N > r) |
The count over the section \(i_1 + \cdots + i_K \equiv r
\pmod m\) of the box, SQL's GROUP BY a computed key: the cyclic convolution of the legs' histograms over the residues, m numbers a leg, in the counts' semiring. | |
| template<IsBoundedList A, IsBoundedList B> requires std::same_as<std::ranges::range_value_t<const A>, std::ranges::range_value_t<const B>> | |
| constexpr auto | dedekind::category::detail_periodic::joined (const A &a, const B &b) |
| constexpr void | dedekind::category::detail_periodic::refuse_no_alphabet () |
| Refuses an alphabet without letters, or one holding the last byte, which no byte slice ends past. (#1141). | |
| constexpr Letters | dedekind::category::letters (std::string_view alphabet) |
| constexpr auto | dedekind::category::abc (std::string_view a) |
The alphabet of its letters alone: the least slice of the bytes that holds them, under the predicate that keeps them, slice(lo, hi) >> letters(a) with lo the least letter and hi one past the greatest. | |
| template<std::size_t M> requires (M >= 1) | |
| constexpr Bytes< M - 1 > | dedekind::category::bytes (const char(&s)[M]) |
| constexpr Ranked | dedekind::category::rank (const Letters &on) |
| constexpr Letters | dedekind::category::letters_of (const Alphabet &alphabet) |
| constexpr Ranked | dedekind::category::rank (const Alphabet &alphabet) |
| constexpr std::array< std::byte, 256 > | dedekind::category::detail_periodic::identity_table () |
| The identity table on the bytes. | |
| constexpr Reflection | dedekind::category::refl (const Letters &on) |
| constexpr Reflection | dedekind::category::refl (const Alphabet &alphabet) |
| constexpr RandomLetter | dedekind::category::random_letter (const Alphabet &alphabet, std::uint64_t seed=0) |
| constexpr auto | dedekind::category::random_text (const Alphabet &alphabet, std::size_t length, std::uint64_t seed=0) |
| template<std::size_t N> | |
| constexpr std::array< std::byte, N > | dedekind::category::random_word (const Alphabet &alphabet, std::uint64_t seed=0) |
| A random word held as a value, for a law's input where a stage wants contiguous letters. | |
| constexpr void | dedekind::category::detail_periodic::refuse_unequal_letters () |
| Refuses a letter map whose letters and images differ in number. | |
| constexpr LetterMap | dedekind::category::letter_map (std::string_view from, std::string_view to) |
| template<IsCountWord N = std::size_t, HasNNOStep C, IsArrow F> requires std::totally_ordered<C> && std::same_as<Dom<F>, C> && std::convertible_to<Cod<F>, bool> | |
| constexpr Power< C, F, N > | dedekind::category::power (const unfold_view< std::optional< C >, detail_chain::SliceStep< C, F > > &leg, std::type_identity_t< N > n) |
| template<IsArrow T> requires std::same_as<Dom<T>, Cod<T>> | |
| constexpr PowerMap< T > | dedekind::category::power (const T &tau) |
| template<IsCountWord N = std::size_t> | |
| constexpr Rotation< N > | dedekind::category::rotate (std::type_identity_t< N > d) |
| template<IsCountWord N> | |
| constexpr AtMost< Cycles< N >, 2 > | dedekind::category::antitone_cycle_type (N m) |
The cycle type of a finite chain's antitone bijection. A finite chain is rigid: its one antitone bijection is its reversal, the least element to the greatest and so inward, so \(\lfloor m/2 \rfloor\) pairs and, where m is odd, the middle fixed (#1133). | |
| template<IsCountWord N> | |
| constexpr AtMost< Cycles< N >, 2 > | dedekind::category::cycle_type (Reverse, N n) |
The cycle type of the reversal of n positions: the antitone bijection of their chain. | |
| template<IsCountWord N> | |
| constexpr AtMost< Cycles< N >, 1 > | dedekind::category::cycle_type (const Rotation< N > &r, N n) |
The cycle type of a rotation of n positions by d: \(g =
\gcd(n, d)\) cycles of length \(n / g\), the identity where d is a multiple of n. | |
| template<IsCountWord N> | |
| constexpr N | dedekind::category::position (Reverse, N n, N i) |
A permutation of positions on indices: where it sends the position i of a word of length n, the reversal to \(n - 1 - i\). | |
| template<IsCountWord N> | |
| constexpr N | dedekind::category::position (const Rotation< N > &r, N n, N i) |
| template<IsArrow T> requires std::same_as<Dom<T>, std::byte> && std::same_as<Cod<T>, std::byte> | |
| constexpr bool | dedekind::category::is_antitone (const T &t, const Letters &on) |
Whether a letter map reverses the order of an alphabet, decided on its table: the letters as bytes are a chain, and on a chain consecutive letters suffice. A law of the value, not of the type: the Watson–Crick pairing reverses A < C < G < T because of how the one-letter codes are chosen. Where it does and the map is a bijection, its cycle type is antitone_cycle_type's. | |
| constexpr bool | dedekind::category::is_involution (const LetterMap &t) |
| Whether a letter map is an involution, decided on its table: a law of the value, the 256 bytes taken twice, as a law of a finite structure is decided. | |
| template<IsArrow T> requires std::same_as<Dom<T>, Cod<T>> | |
| constexpr bool | dedekind::category::is_involution (const PowerMap< T > &p) |
| A map on every letter is an involution where the map on one is. | |
| constexpr std::vector< std::byte > | dedekind::category::detail_periodic::gattac () |
| template<HasNNOStep C, typename F> requires std::totally_ordered<C> && std::predicate<const F&, const C&> | |
| constexpr bool | dedekind::category::detail_periodic::is_letter (const Slice< C > &letters, const F &member, const C &x) |
| A letter of the alphabet: within the slice, and kept by its predicate. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S> requires HasCycleType<S, N> | |
| constexpr Symmetric< Power< C, F, N >, S, Identity< C > > | dedekind::category::symmetric (const Power< C, F, N > &p, S sigma) |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S> requires HasCycleType<S, N> | |
| constexpr Symmetric< Power< C, F, N >, S, Identity< C > > | dedekind::category::symmetric (const Power< C, F, N > &p, const Morphism< std::vector< C >, std::vector< C >, S > &sigma) |
| template<HasNNOStep C, IsArrow F, IsCountWord N, IsArrow T, typename S> requires std::same_as<Dom<T>, C> && HasCycleType<S, N> | |
| constexpr Symmetric< Power< C, F, N >, S, T > | dedekind::category::symmetric (const Power< C, F, N > &p, const Compose< PowerMap< T >, Morphism< std::vector< C >, std::vector< C >, S > > &g) |
| template<HasNNOStep C, IsArrow F, IsCountWord N, IsArrow T, typename S> requires std::same_as<Dom<T>, C> && HasCycleType<S, N> | |
| constexpr Symmetric< Power< C, F, N >, S, T > | dedekind::category::symmetric (const Power< C, F, N > &p, const Compose< Morphism< std::vector< C >, std::vector< C >, S >, PowerMap< T > > &g) |
| template<IsCountWord N = std::size_t, HasNNOStep C, IsArrow F> requires std::totally_ordered<C> && std::same_as<Dom<F>, C> && std::convertible_to<Cod<F>, bool> | |
| constexpr Powers< C, F, N > | dedekind::category::words (const unfold_view< std::optional< C >, detail_chain::SliceStep< C, F > > &leg) |
| template<IsArrow T, typename C, typename S> | |
| constexpr detail_periodic::FixedByStage< S, T > | dedekind::category::fixed_by (const Compose< PowerMap< T >, Morphism< std::vector< C >, std::vector< C >, S > > &g) |
| template<IsArrow T, typename C, typename S> | |
| constexpr detail_periodic::FixedByStage< S, T > | dedekind::category::fixed_by (const Compose< Morphism< std::vector< C >, std::vector< C >, S >, PowerMap< T > > &g) |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S, IsArrow T> requires std::same_as<Dom<T>, C> && HasCycleType<S, N> | |
| constexpr auto | dedekind::category::operator>> (const Powers< C, F, N > &ps, const detail_periodic::FixedByStage< S, T > &st) |
The powers, then the sections each fixes: a family of sets of words by length, words(Σ) >> fixed_by(g). | |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S, IsArrow T> requires std::same_as<Dom<T>, C> && HasCycleType<S, N> | |
| constexpr auto | dedekind::category::operator& (const Powers< C, F, N > &ps, const detail_periodic::FixedByStage< S, T > &st) |
words(Σ) & fixed_by(g): the words g fixes, by length, the same family spelled as Trsk spells a set under a predicate. | |
| template<IsCountWord N = std::size_t> | |
| constexpr Length< N > | dedekind::category::len (std::type_identity_t< N > n) |
| template<IsArrow Fam, IsCountWord N> requires is_graded_v<Fam> && std::same_as<Dom<Fam>, N> | |
| constexpr Cod< Fam > | dedekind::category::operator& (const Fam &fam, Length< N > l) |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S, IsArrow T> requires std::same_as<Dom<T>, C> && HasCycleType<S, N> | |
| constexpr Symmetric< Power< C, F, N >, S, T > | dedekind::category::operator& (const Power< C, F, N > &p, const detail_periodic::FixedByStage< S, T > &st) |
power(Σ, n) & fixed_by(g): the power met with what g fixes, symmetric(power, g) spelled as Trsk spells a set under a predicate. The equalizer of g and the identity, a subobject of the power, and one the laws count: from g's cycle type, no word built. | |
| constexpr ReflectedReverse | dedekind::category::operator~ (Reverse) |
| constexpr Letters | dedekind::category::detail_periodic::letters_in (const Slice< std::byte > &bytes, const Letters &on) |
| constexpr auto | dedekind::category::detail_periodic::reverse_complement (const Letters &on) |
| constexpr detail_periodic::FixedByReflectedReverse | dedekind::category::fixed_by (ReflectedReverse) |
| template<IsCountWord N> | |
| constexpr Symmetric< Power< std::byte, Letters, N >, Reverse, Reflection > | dedekind::category::operator& (const Power< std::byte, Letters, N > &p, detail_periodic::FixedByReflectedReverse) |
power & fixed_by(~rev): the words the reverse complement fixes, the complement the power's own, refl of its letters. | |
| template<IsCountWord N> | |
| constexpr auto | dedekind::category::operator& (const Powers< std::byte, Letters, N > &ps, detail_periodic::FixedByReflectedReverse) |
words(Σ) & fixed_by(~rev): the same, by length. | |
| template<HasFactors A, HasFactors B> requires std::same_as< detail_periodic::word_of_t<decltype(count_factors(std::declval<A>()))>, detail_periodic::word_of_t<decltype(count_factors(std::declval<B>()))>> | |
| constexpr Outer< A, B > | dedekind::category::operator* (const A &a, const B &b) |
| template<HasFactors A, HasFactors B> requires std::same_as< detail_periodic::word_of_t<decltype(count_factors(std::declval<A>()))>, detail_periodic::word_of_t<decltype(count_factors(std::declval<B>()))>> | |
| constexpr auto | dedekind::category::count_factors (const Outer< A, B > &o) |
| template<IsCountWord N = std::size_t, HasNNOStep C, IsArrow F> requires std::totally_ordered<C> && std::same_as<Dom<F>, C> && std::convertible_to<Cod<F>, bool> | |
| constexpr FreeMonoid< C, F, N > | dedekind::category::free_monoid (const unfold_view< std::optional< C >, detail_chain::SliceStep< C, F > > &leg, std::type_identity_t< N > below) |
| template<IsCountWord N> | |
| constexpr std::optional< N > | dedekind::category::detail_periodic::checked_power (N b, N e) |
\(b^e\), or none where the word cannot hold it: by squaring, as concat on copies, so its cost is the bits of e; \(0^e\) and \(1^e\) at once. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N> | |
| constexpr N | dedekind::category::detail_periodic::letters_kept (const Slice< C > &letters, const F &member) |
| How many letters an alphabet keeps, its one-letter words. | |
| template<typename L, IsCountWord N = detail_periodic::word_of_t<L>> requires detail_periodic::IsFactorsOf<L, N> | |
| constexpr N | dedekind::category::count (const L &fs) |
The count of a factored tensor, modulo the word: a monoid concat under * over the factors, each a concat on copies of a popcount, by squaring. Agrees with exact_count wherever the word holds the count. | |
| template<typename L, IsCountWord N = detail_periodic::word_of_t<L>> requires detail_periodic::IsFactorsOf<L, N> | |
| constexpr std::optional< N > | dedekind::category::exact_count (const L &fs) |
The count of a factored tensor, exactly, or none where the word cannot hold it: never wrapped, the discipline of checked_lcm. | |
| template<typename L, IsCountWord N = detail_periodic::word_of_t<L>> requires detail_periodic::IsFactorsOf<L, N> | |
| constexpr std::size_t | dedekind::category::bits_needed (const L &fs) |
The bits a count needs at most, read off its factors without multiplying them: \(\prod b_i^{e_i} \le 2^S\) with \(S = \sum e_i
\lceil \log_2 b_i \rceil\), so at most \(S + 1\) bits, S + 1 exactly where the product is \(2^S\); none for an empty factor; saturating. The same fold as count, in the other monoid: count folds \(b^e\) by \(\times\), this folds its image under CeilLog2 by \(+\), and the lax homomorphism between them is the bound. An abstract interpretation (Cousot and Cousot): the abstraction of a Galois connection between sets of values and their widths (IsGaloisConnection), sound by the adjunction. \(\mathbb{N}\) is the filtered colimit of the words \(\mathbb{N}_{<2^8} \hookrightarrow
\mathbb{N}_{<2^{16}} \hookrightarrow \cdots\) (:filtered), and a finite count is compact, so it factors through a finite stage: this says which, before the count is computed (#1134). | |
| template<HasNNOStep C, IsArrow F, IsCountWord N> | |
| constexpr std::optional< N > | dedekind::category::exact_count (const FreeMonoid< C, F, N > &m) |
| template<std::unsigned_integral B> | |
| constexpr B | dedekind::category::detail_periodic::low_bits (std::size_t n) |
The low n bits of a machine word: the pattern, its padding zero. | |
| template<std::size_t W> | |
| constexpr std::bitset< W > | dedekind::category::detail_periodic::low_bits_of (std::size_t n) |
The low n bits of a std::bitset. | |
|
template<std::unsigned_integral B> requires (std::numeric_limits<B>::digits <= 64) | |
| constexpr B | dedekind::category::detail_periodic::rotated (B x, std::size_t n, std::size_t d) |
A pattern of n bits in a machine word, rotated by d within them, the padding kept zero. | |
| template<std::size_t W> | |
| constexpr std::bitset< W > | dedekind::category::detail_periodic::rotated (const std::bitset< W > &x, std::size_t n, std::size_t d) |
A pattern of n bits in a std::bitset, rotated by d within them, the padding kept zero. | |
| constexpr auto | dedekind::category::bit_patterns (std::size_t n) |
The bit patterns of width n as a chain: the counts below \(2^n\), which binary numeration makes the words of \(\mathbb{B}^n\), bit i the letter at position i. No pattern is built: an arrow along the chain reads it. Refused past the word, where the patterns are no sequence a std::size_t can index. Counting by the laws never builds a pattern at any width; a pattern is packed only where an operation reads it, at any width known at compile time, and at run time up to max_packed_width (wider, in blocks, is #1109). | |
| template<typename F> requires std::invocable<const F&, std::integral_constant<std::size_t, 8>> | |
| constexpr auto | dedekind::category::with_width (std::size_t n, const F &f) |
A width known only at run time, dispatched to the narrowest precompiled bit word that holds it: 8, 16, 32 or 64 bits, a machine word, or 128, 256 or 512, a std::bitset. f is called with the width as a type, so it can name BitWord of it. Refused past max_packed_width. | |
| template<std::unsigned_integral B> | |
| constexpr B | dedekind::category::detail_periodic::with_bit (B x, std::size_t i, bool b) |
A machine word with bit i set to b. | |
| template<std::size_t W> | |
| constexpr std::bitset< W > | dedekind::category::detail_periodic::with_bit (std::bitset< W > x, std::size_t i, bool b) |
A std::bitset with bit i set to b. | |
|
template<std::size_t W, HasNNOStep C, IsArrow G> requires std::same_as<Dom<G>, C> | |
| constexpr BitWord< W > | dedekind::category::detail_periodic::packed_chi (const Slice< C > &letters, const G &g) |
The characteristic function of a predicate over a chain of letters, packed into the bit word of width W, bit i the i-th letter: a subobject of the alphabet as a word. | |
| template<std::unsigned_integral B> requires (!std::same_as<B, bool>) | |
| constexpr std::size_t | dedekind::category::popcount (B x) |
| The number of bits set in a machine word: the hardware's count, one instruction where the target has it. | |
| template<std::size_t W> | |
| constexpr std::size_t | dedekind::category::popcount (const std::bitset< W > &x) |
The number of bits set in a std::bitset. | |
| template<HasNNOStep C, IsCountWord N> | |
| constexpr N | dedekind::category::detail_periodic::letters_in (const Slice< C > &letters) |
| How many letters a chain has. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N> | |
| constexpr AtMost< Factor< N >, 1 > | dedekind::category::count_factors (const Power< C, F, N > &p) |
| The factors of a tensor power's count: the filtered alphabet's count, its packed characteristic function's popcount, raised to the length, by the box law. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S, IsArrow T> requires HasCycleType<S, N> | |
| constexpr auto | dedekind::category::count_factors (const Symmetric< Power< C, F, N >, S, T > &s) |
The factors of a symmetric section's count: one merged leg per cycle of sigma, so the box law after the merges, the count Pólya's theorem gives for the words a permutation fixes. | |
| template<IsCountWord N = std::size_t> | |
| constexpr Window< N > | dedekind::category::window (std::type_identity_t< N > offset, std::type_identity_t< N > length) |
| template<HasNNOStep C, IsArrow F, IsCountWord N> | |
| constexpr Power< C, F, N > | dedekind::category::detail_periodic::power_of (const Power< C, F, N > &p) |
| The tensor power a set of words of one length is a subset of: the power itself, or the power a symmetric section fixes words of. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S, IsArrow T> | |
| constexpr Power< C, F, N > | dedekind::category::detail_periodic::power_of (const Symmetric< Power< C, F, N >, S, T > &s) |
|
template<HasNNOStep C, IsArrow F, IsCountWord N> requires std::equality_comparable<F> | |
| constexpr bool | dedekind::category::detail_periodic::same_legs (const Power< C, F, N > &p, const Power< C, F, N > &q) |
| Whether two tensor powers have the same legs: the same letters under the same predicate, whatever their lengths. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S> requires requires(const S& s) { { detail_periodic::power_of(s) } -> std::same_as<Power<C, F, N>>; } && std::equality_comparable<F> | |
| constexpr Cylinder< Power< C, F, N >, S, N > | dedekind::category::cylinder (const Power< C, F, N > &p, Window< N > w, S s) |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S> requires requires(const S& s) { requires detail_periodic::IsBoundedFactorsOf<decltype(count_factors(s)), N>; } | |
| constexpr auto | dedekind::category::pushed_down (const Cylinder< Power< C, F, N >, S, N > &c) |
| The plan of a cylinder, its selection pushed down. A cylinder in Tarski's sense, a predicate on a product in which only some legs constrain: the window's legs must lie in the set, the others are free. So the predicate moves onto the window's factor, \(\sigma_\varphi(W \times F) = \sigma_\varphi(W) \times F\), and the cylinder is the set times the power on the free legs, an outer product, whatever the window's offset. Defined where the window fits. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S> requires requires(const S& s) { requires detail_periodic::IsBoundedFactorsOf<decltype(count_factors(s)), N>; } | |
| constexpr auto | dedekind::category::count_factors (const Cylinder< Power< C, F, N >, S, N > &c) |
The factors of a cylinder's count, aggregate pushdown (eager aggregation: Yan and Larson, VLDB 1995), derived rather than stated: the selection pushed down (pushed_down), then the box law of the outer product, the set's count times \(|\Sigma|^{N - n}\) for the free legs. Empty where no word's window can lie in the set: a window past the end, or a set of words of another length. | |
| template<typename P, typename S, IsCountWord N> | |
| constexpr N | dedekind::category::detail_periodic::period (const CylinderFactorsAt< P, S, N > &) |
| template<typename P, typename S, IsCountWord N> | |
| constexpr N | dedekind::category::detail_periodic::extent (const CylinderFactorsAt< P, S, N > &f) |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S> requires requires(const S& s) { { detail_periodic::power_of(s) } -> std::same_as<Power<C, F, N>>; requires detail_periodic::IsBoundedFactorsOf<decltype(count_factors(s)), N>; } && std::equality_comparable<F> | |
| constexpr N | dedekind::category::occurrences (const Power< C, F, N > &p, const S &s) |
How often a set of words occurs in the words of a tensor power, counted with their positions: the pairs (word, offset) whose window lies in s, the sum over the offsets of the cylinders' counts, modulo the word. Each summand is pushed down (R2), so none depends on its offset: the summand has period 1, and the periodic sum takes one of them, times the number of offsets. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N, typename S> requires requires(const S& s) { { detail_periodic::power_of(s) } -> std::same_as<Power<C, F, N>>; requires detail_periodic::IsBoundedFactorsOf<decltype(count_factors(s)), N>; } && std::equality_comparable<F> | |
| constexpr std::optional< N > | dedekind::category::exact_occurrences (const Power< C, F, N > &p, const S &s) |
The occurrences exactly, or none where the word cannot hold them: never wrapped, the discipline of exact_count. | |
Variables | |
| constexpr Congruent | dedekind::category::is_even {2, 0} |
The even counts, the residue class of 0 modulo 2. Its reading on ℕ as a sequence, a path into the truth values, is dedekind::sequences::is_even (sequences:samples). | |
| template<typename T> | |
| constexpr bool | dedekind::category::detail_periodic::is_exact_count_v = false |
Whether T is an exact count: a count word, or none. | |
| template<IsCountWord N> | |
| constexpr bool | dedekind::category::detail_periodic::is_exact_count_v< std::optional< N > > = true |
| constexpr LetterMap | dedekind::category::detail_periodic::swap_at = letter_map("AT", "TA") |
| constexpr LetterMap | dedekind::category::detail_periodic::swap_cg = letter_map("CG", "GC") |
| template<typename Fam> | |
| constexpr bool | dedekind::category::is_graded_v = false |
A graded family of sets of words, indexed by the length: words(Σ), or it followed by stages. | |
| template<HasNNOStep C, IsArrow F, IsCountWord N> | |
| constexpr bool | dedekind::category::is_graded_v< Powers< C, F, N > > = true |
| template<typename Fam, typename G> | |
| constexpr bool | dedekind::category::is_graded_v< Compose< Fam, G > > = is_graded_v<Fam> |
| constexpr Pow2 | dedekind::category::pow2 {} |
\(k \mapsto 2^k\) on std::size_t. | |
| template<std::size_t W> | |
| constexpr Pack< W > | dedekind::category::pack {} |
A pattern packed into the bit word of width W. | |
| template<std::size_t W> | |
| constexpr Unpack< W > | dedekind::category::unpack {} |
| A machine word read back as a count. | |
| constexpr std::size_t | dedekind::category::max_packed_width = 512 |
The widest bit word the library precompiles: 512 bits, the widest common vector register, a std::bitset at every width above 64. | |
Periodic arrows on the counts and the counts they license: an arrow f is periodic with period p when \(f(k + p) = f(k)\), a law declared at a generator and inferred at a composite, so that a count along a chain of any length is (n div p) periods and a remainder (the Jlt paper's tensor exhibit, #1104).
@partition :periodic
Three readings of one idea, kept apart by name. :total's is_periodic<T, Op> (IsPeriodic) says an operation wraps, (T, Op) cyclic, of order cyclic_order; morphologies' Modular<N> is the cyclic carrier \(\mathbb{Z}/N\mathbb{Z}\); and here a sequence repeats, \(f(k + p) = f(k)\), which is to say f factors through the quotient \(\mathbb{N} \to \mathbb{Z}/p\mathbb{Z}\), \(f = g \circ (k \mapsto k \bmod p)\): congruent(m, r) is that quotient followed by equals(r). What periodicity needs is a translation, not an order: f has period p when it is invariant under the action of p, \(f(k + p) = f(k)\), the counts acting on themselves by + (:action's acting_monoid<std::plus<std::size_t>>; the affine reading of a space acted on by its vectors is geometry:affine's). The order enters with the extent, the bound below which the law holds, and with the counts by consecutive periods. A law holds on the whole word because the counts themselves wrap only at the word's cyclic_order; a shift narrows it (extent).
The counts are any IsCountWord, std::size_t by default. The period is a value the arrow carries, read by period(f), and HasPeriod<F> says only that F carries one: a period that is a type would leave nothing for a caller to choose, and the Python bindings choose it. opaque(f) hides the law, so that the plain fold runs where a test checks the law against it.
| using dedekind::category::detail_periodic::word_of_t |
The count word of a list of factors.
|
constexpr |
The least common multiple of two periods, refused where the word cannot hold it, which std::lcm leaves undefined.
| a |
param b the periods, positive.
|
constexpr |
The plain count of f(0), ..., f(m - 1).
| m | how many. |
| f | the predicate. |
|
constexpr |
| f | the factors at an offset. |
N − n + 1, where the law holds.
|
constexpr |
A modulus for the Fibonacci numbers in the word N: positive and at most \(2^{w/2}\) for a word of w bits, so that a product of two residues, below \(m^2\), and the Pisano bound \(6m\) stay in the word; refused otherwise.
| m | the modulus. |
m.
|
constexpr |
A letter of the alphabet: within the slice, and kept by its predicate.
| letters | the chain. |
| member | the predicate. |
| x | a value. |
|
constexpr |
| a |
param b two bounded lists of one value type.
a then b, bounded by the sum of the bounds.
|
constexpr |
| bytes | a slice of the bytes. |
| on | a predicate. |
|
constexpr |
|
constexpr |
| on | the alphabet's letters. |
~rev there, power(refl(Σ)) >> rev.
|
constexpr |
The plain sum of f(0), ..., f(m - 1).
| m | how many. |
| f | the arrow. |