Description
Search ordered distinct pairs and return the first shorter-prefix witness when one codeword starts with another; otherwise return prefixFree true and an empty witness.
A prefix-free code prevents any distinct codeword from beginning with another complete codeword. Kraft terms describe length budgets, while actual prefix relationships depend on the codewords themselves.
Search ordered distinct pairs and return the first shorter-prefix witness when one codeword starts with another; otherwise return prefixFree true and an empty witness.
When to use this tool
Use Prefix Code Termination Ambiguity Witness when you need one prefix relationship or code-length contribution.
How to use the tool and how it works
- Enter codewords. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read prefixFree, witness. Inspect prefixFree before interpreting the associated values.
Require unique codewords. Search ordered distinct pairs and return the first shorter-prefix witness when one codeword starts with another; otherwise return prefixFree true and an empty witness.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| codewords | Codewords | Required. Array of text; maximum UTF-16 length 8192; maximum items 256. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| prefixFree | Prefix Free | Required. Boolean. |
| witness | Witness | Required. Array of text; maximum UTF-16 length 8192; maximum items 256. |
{
"input": {
"codewords": [
"0",
"01",
"1"
]
},
"output": {
"prefixFree": false,
"witness": [
"0",
"01"
]
}
} Limitations and assumptions
- The alphabet is unrestricted and an empty codeword can prefix another; this checks prefix freedom rather than general unique decodability.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Validate the complete codebook and alphabet before making a decoding or feasibility claim.
References
Similar or alternative tools
- Information: Codebook Single Prefix Conflict Check
Test both prefix directions, equality, and prefixConflict when either direction holds.
- Information: Kraft Single Codeword Term
Return exp(-length × ln(radix)) for integer length 0-1000 and radix at least two.