K — Dendritic Structural Encoding (KDSE) is UHWare's compact, delimiterless breadth-first encoding of finite full q-ary dendritic structures.
KDSE records the branch-or-terminal decisions of a finite rooted dendrite in a binary payload. A branch creates exactly q child positions; a terminal creates none. The payload is structural: KDSE defines the encoded object, while a separate operator may use that object to perform a computation.
1. Structural object and notation
Let q ≥ 2 be the structural arity. Every branch node has exactly q ordered children, and every other node is terminal. The root is at depth zero. Each explicit node carries one binary branch indicator:
| Symbol | Meaning |
|---|---|
1 | The node is a branch and creates exactly q child positions. |
0 | The node is a terminal and creates no child positions. |
| q | The branching arity; it is independent of the binary structural alphabet. |
The binary alphabet distinguishes branch from terminal even when q is greater than two. The physical storage radix and container width are separate engineering choices. The mathematical family is therefore independent of whether a payload is packed into binary, a byte, a word, or another storage format.
2. Minimal breadth-first encoding
Explicit node indicators are concatenated level by level in breadth-first order. Let wℓ be the number of explicit positions at level ℓ, and let bℓ be the number of branch indicators in that level. The first level contains the root:
Once a level has been read, its branch count determines the exact width of the next level. Internal level boundaries therefore require no delimiter. This is the precise sense in which KDSE is delimiterless.
The deepest level of a finite full tree contains only terminals. KDSE minimal form omits that deterministic final all-terminal level. Branches in the last encoded level therefore have q implicit terminal children. The isolated terminal root is the single-symbol payload 0.
| Payload | Derived levels | Reconstructed meaning |
|---|---|---|
0 | 0 | Isolated terminal root. |
1 | 1 | Root branch with q implicit terminal children. |
101 | 1 | 01 | One terminal at depth 1; the other explicit child branches, with its final children implicit. |
10101 | 1 | 01 | 01 | Terminals at depths 1, 2, and 3 in the binary case. |
The vertical bars above are explanatory only. They are reconstructed from branch counts and are not stored in the payload.
2.1 Minimal-form length
Every level after the root has width divisible by q. Consequently, every minimal-form payload length satisfies:
Binary minimal-form lengths are therefore odd. For a binary payload budget of seven symbols, the possible lengths are 1, 3, 5, and 7.
2.2 Boundary of a value
Minimal form removes internal structural delimiters; it does not provide framing for a stream of multiple variable-length values. A concatenated stream still needs an outer container, length field, framing convention, or an untrimmed fixed-width representation.
3. Decoding and validity
A decoder begins with expected width w0 = 1. At each level it reads exactly the expected number of symbols, counts the branches, and computes the next width from the recurrence above. A binary minimal-form payload is valid when:
- Every symbol is
0or1. - Each complete derived level is present.
- The payload ends exactly on a level boundary.
- No data follows a level with zero branches.
- Except for the isolated payload
0, the final encoded level contains at least one branch; an explicit final all-terminal level is superfluous and invalid in minimal form.
If the final encoded level contains bD branches, the reconstructed tree contains L + qbD nodes: the explicit payload nodes plus the implicit terminal children of those final branches.
4. Ordered canonical form
A minimal-form payload preserves child position. When sibling position is not an independent semantic attribute, exchanging sibling subtrees can produce multiple payloads for the same unordered rooted topology. Ordered KDSE selects one canonical representative: the valid serialization with the lowest numerical value.
Ordered form is a canonical subtype, not a restriction on structural validity. A valid structural KDSE may represent any finite full topology, including an unbalanced, lopsided, or deep topology. Canonicalization removes sibling-permutation synonyms where the application treats those permutations as equivalent.
5. Container formats: KDSE-8 and KDSE-16
KDSE-8 and KDSE-16 name current binary physical container classes. They are not limits on the underlying KDSE mathematical construction and they do not describe branching arity.
| Container | Structural arity | Payload budget | Physical width | Meaning |
|---|---|---|---|---|
| KDSE-8 | q = 2 | 7 symbols | 8 bits | One container bit is outside the core payload field. |
| KDSE-16 | q = 2 | 15 symbols | 16 bits | The same container convention at twice the physical width. |
Within a fixed-width container, leading padding is not parsed as part of the minimal payload. The actual payload length is recovered from the natural-width value after container padding is removed. The reserved or padding bits belong to the container format; KDSE assigns them no intrinsic structural meaning.
6. Values and structural attributes
Values may accompany a KDSE structure, but they are independent of the branch/terminal payload. When values are supplied, they are listed in the same breadth-first order as the reconstructed nodes, including the implicit final leaves.
The structure determines intrinsic attributes such as level widths, branch counts, terminal-depth profiles, leaf path words, subtree sizes, balance measures, symmetry counts, and canonical forms. Different Ordered values can share the same terminal-depth profile; a projection that uses only that profile intentionally discards other topology information.
7. Operators and the IJM example
A KDSE value can be supplied to any operator that accepts its structure or a structural projection. In general, an operator combines K with an input and parameters:
The threshold-and-loss operator is one worked example. Under equal q-way splitting, uniform multiplicative retention, and a common terminal threshold T, all terminals at an occupied depth d activate together. If cd is the number of reconstructed terminals at that depth, the grouped instantaneous jump magnitude is:
Branch transfer and depth determine where an event occurs; terminal multiplicity and the threshold determine the grouped jump magnitude. This identity is a result of that operator and its assumptions, not a condition for a KDSE payload to be valid.
8. Conformance summary
An implementation claiming conformance to the structural core should agree on:
- binary branch indicators with
1for branch and0for terminal; - fixed-arity full-tree reconstruction;
- breadth-first level order and the recurrence wℓ+1 = qbℓ;
- minimal-form omission of the deterministic final all-terminal level;
- rejection of unreachable, incomplete, nonbinary, or explicitly over-terminated payloads; and
- the distinction between structural validity, Ordered canonicalization, physical containers, and operator evaluation.
The current public reference release provides ISO C11 and Python implementations of the KDSE-8 and KDSE-16 container forms. The structural definition above is language-independent.