Date: 2025-11-13 Status: Defect identified through cross-validation; resolved in Phase 2 summary
The lazy automaton implementation (src/transducer/transition.rs) reveals the correct transposition logic:
When index_of_match(cv, h, k) == Some(1) (match at position 1):
next.push(Position::new(i, e + 1)); // insertion
next.push(Position::new_special(i, e + 1)); // transposition start
next.push(Position::new(i + 1, e + 1)); // substitution
next.push(Position::new(i + 2, e + 1)); // direct transposition jump
Interpretation: When the current input character matches position 1 (the NEXT word position), we can:
When in transposition state (is_special == true):
if cv[h] { // Check position 0 - CURRENT position
next.push(Position::new(i + 2, e));
}
Interpretation: When in transposing state, check if the CURRENT input matches the CURRENT word position (cv[0]) to complete the transposition.
For UniversalAutomaton with Mitankin's notation:
My current implementation:
b[1] = 1 (match at next position) ← This part seems correct!b[1] = 1 (match at next position) ← This is WRONG!Based on lazy automaton:
b[1] = 1 (match at next position) ✓b[0] = 1 (match at CURRENT position) ✓But wait! In the Transposing state, we've already advanced the position by 1. So the "current" position in Transposing state might correspond to a different bit vector index.
I think the problem is that I'm misunderstanding what position the Transposing state represents.
When we enter Transposing state from position i#e:
So when checking the bit vector in Transposing state:
n + (offset from perspective of next input)The issue might be:
b[1] = 1, create position with offset+1, errors+1 ✓ (seems correct)b[0] = 1 at match_index = n+offsetBut in Transposing state with position (i+1)#(e+1):
n + (i - (i+1)) = n - 1Wait, that doesn't make sense either. The bit vector is always indexed from the current word window...
The debugging needs to show:
This is complex enough that it requires careful step-by-step analysis with concrete examples.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |