The regular language of deficient ternary carries #
A four-state deterministic automaton recognizes the ternary words whose doubling creates fewer than two carries. Its language is classified as three explicit digit patterns. This turns the remaining GKP power-of-two condition into an exact regular-language avoidance statement.
State of the deficient-carry automaton while scanning little-endian ternary digits.
- zeroCarry : BadCarryState
- oneCarryOut : BadCarryState
- oneCarryNoCarry : BadCarryState
- good : BadCarryState
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
One transition of the deficient-carry automaton.
Equations
- One or more equations did not get rendered due to their size.
- GKPCarry.badCarryStateStep GKPCarry.BadCarryState.good x✝ = GKPCarry.BadCarryState.good
- GKPCarry.badCarryStateStep GKPCarry.BadCarryState.oneCarryOut x✝ = if x✝ = 0 then GKPCarry.BadCarryState.oneCarryNoCarry else GKPCarry.BadCarryState.good
- GKPCarry.badCarryStateStep GKPCarry.BadCarryState.oneCarryNoCarry x✝ = if x✝ < 2 then GKPCarry.BadCarryState.oneCarryNoCarry else GKPCarry.BadCarryState.good
Instances For
Run the automaton from an arbitrary state.
Equations
- GKPCarry.badCarryStateAux [] x✝ = x✝
- GKPCarry.badCarryStateAux (digit :: digits) x✝ = GKPCarry.badCarryStateAux digits (GKPCarry.badCarryStateStep x✝ digit)
Instances For
Run the automaton from its initial state.
Equations
Instances For
Boolean membership in the deficient-carry language.
Equations
- GKPCarry.badCarryLanguage digits = decide (GKPCarry.badCarryState digits ≠ GKPCarry.BadCarryState.good)
Instances For
Incoming arithmetic carry represented by an automaton state.
Equations
Instances For
Additional carries required to reach the accepting state.
Equations
Instances For
Automaton correctness: on valid ternary words, membership is equivalent to creating fewer than two carries under doubling.
Concrete classification of the language #
Every digit in the word is 0 or 1.
Equations
- GKPCarry.badCarryAllZeroOrOne digits = ∀ digit ∈ digits, digit < 2
Instances For
The unique digit 2 is the most significant digit.
Equations
- GKPCarry.badCarryExactlyOneTopTwo digits = ∃ (lows : List ℕ), GKPCarry.badCarryAllZeroOrOne lows ∧ digits = lows ++ [2]
Instances For
The unique digit 2 is followed by a higher 0, with all other digits
equal to 0 or 1.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The union of the three concrete deficient-carry shapes.
Equations
- GKPCarry.badCarryLanguageShape digits = (GKPCarry.badCarryAllZeroOrOne digits ∨ GKPCarry.badCarryExactlyOneTopTwo digits ∨ GKPCarry.badCarryExactlyOneTwoFollowedByZero digits)
Instances For
Exact classification of the deficient-carry language into three explicit little-endian digit shapes.