Pair-encoding validator — definitions #
This file defines a finite-state scanner for the image of the library's
self-delimiting binary pair codec. Unlike pairSplitCoreTM, the validator
has total semantics: it writes 1 exactly when unpair? succeeds and writes
0 on every malformed encoding.
The language of strings on which the canonical pair decoder succeeds.
Instances For
Finite control for recognizing the doubled prefix and 01 separator of a
pair encoding. Once the separator has been seen, every remaining bit belongs
to the unrestricted right component.
- next : PairValidateState
Expect the first copy of the next doubled bit.
- afterZero : PairValidateState
The first copy was
0;0continues the prefix and1is the separator. - afterOne : PairValidateState
The first copy was
1; only a second1is valid. - suffix : PairValidateState
The separator has been seen; the remaining suffix is unrestricted.
- invalid : PairValidateState
A mismatched doubled bit was seen.
Instances For
Equations
- One or more equations did not get rendered due to their size.
One automaton step for the pair-encoding validator.
Equations
- Complexity.TM.pairValidateStep Complexity.TM.PairValidateState.next false = Complexity.TM.PairValidateState.afterZero
- Complexity.TM.pairValidateStep Complexity.TM.PairValidateState.next true = Complexity.TM.PairValidateState.afterOne
- Complexity.TM.pairValidateStep Complexity.TM.PairValidateState.afterZero false = Complexity.TM.PairValidateState.next
- Complexity.TM.pairValidateStep Complexity.TM.PairValidateState.afterZero true = Complexity.TM.PairValidateState.suffix
- Complexity.TM.pairValidateStep Complexity.TM.PairValidateState.afterOne false = Complexity.TM.PairValidateState.invalid
- Complexity.TM.pairValidateStep Complexity.TM.PairValidateState.afterOne true = Complexity.TM.PairValidateState.next
- Complexity.TM.pairValidateStep Complexity.TM.PairValidateState.suffix x✝ = Complexity.TM.PairValidateState.suffix
- Complexity.TM.pairValidateStep Complexity.TM.PairValidateState.invalid x✝ = Complexity.TM.PairValidateState.invalid
Instances For
The scanner accepts exactly after it has seen the pair separator.
Equations
Instances For
A total, zero-work-tape validator for the image of pair.
The generic scanner consumes the whole input, folds pairValidateStep in
finite control, and writes the final Boolean verdict to output cell 1.
Equations
- One or more equations did not get rendered due to their size.