Source: https://guthlabs.ai/docs/instruments/levenshtein-edit-distance-calculator/mechanism/

instrument mechanism / verified-clean

# Levenshtein / Edit Distance Calculator mechanism

The inspectable method record for Levenshtein / Edit Distance Calculator, kept separate from implementation and qualification.

Status: **VERIFIED_CLEAN**Lifecycle: **verified-clean**

## Model scope

The core recurrence is correct for standard unit-cost Levenshtein distance, but the specification is incomplete. NEEDS_REVIEW is required until the boundary conditions, cost function, text-unit definition, normalization policy, and alignment-selection behavior are explicitly fixed.

- The recurrence is the standard Levenshtein recurrence, but the required boundary conditions are missing: d[0][j]=j and d[i][0]=i, with d[0][0]=0.

- The cost term is undefined; standard Levenshtein distance requires cost=0 when the compared units are equal and cost=1 otherwise.

- The string-unit model is unspecified: characters could mean Unicode code points, UTF-16 code units, grapheme clusters, or another tokenization.

- An aligned diff is not necessarily unique when multiple minimum-cost alignments exist; no tie-breaking or canonical-alignment rule is specified.

## Units and conventions

- The test vectors assume strings are segmented into Unicode code points, not UTF-16 code units or grapheme clusters.

- Insertion, deletion, and substitution each have unit cost 1; matching units have cost 0.

- A gap is represented by '-' in the aligned diff display.

- No Unicode normalization is applied unless explicitly specified; composed and decomposed forms may therefore produce different distances.

## Inspectable vector

One of 4 source-bound review vectors:

````
{
  "inputs": {
    "string_a": "kitten",
    "string_b": "sitting"
  },
  "expected_outputs": {
    "edit_distance": 3,
    "aligned_diff": "kitten-\nsitting"
  },
  "working": "Use the alignment kitten- / sitting. Positions are: k→s substitution = 1; i→i match = 0; t→t match = 0; t→t match = 0; e→i substitution = 1; n→n match = 0; -→g insertion = 1. Total = 1+0+0+0+1+0+1 = 3."
}
````

## Failure boundary

**BREAK_CLAIMED** · SELF_FLAGGED

The extreme-length vector exposes an unstated scalability hazard: a million-character pair requires 1000002000001 DP cells, so an implementation without input-size or memory limits can exhaust resources instead of returning a usable result.

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/levenshtein-edit-distance-calculator/>)[03**Implementation**](<https://guthlabs.ai/docs/instruments/levenshtein-edit-distance-calculator/implementation/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/levenshtein-edit-distance-calculator/qualification/>)

## Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

- `VERIFIED_LEDGER.json`

- `evidence-tranche5/tranche5-results.json`

- `BOUNDARY_HAZARD_CATALOG.json`
