Skip to content

Main content

Prefix Code Termination Ambiguity Witness Tool

Return the first ordered proper-prefix witness among distinct supplied codewords.

Loading tool…

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

  1. Enter codewords. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
codewordsCodewordsRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
Output fieldInterpretationReturned shape
prefixFreePrefix FreeRequired. Boolean.
witnessWitnessRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
json
{
  "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

  1. Calculation and input contract: information/prefix-code-termination-ambiguity-witness — tool.io

Similar or alternative tools