Documentation

LeanPool.GKPCarry.BadCarryLanguage

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.

Instances For
    @[implicit_reducible]
    Equations
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Run the automaton from an arbitrary state.

      Equations
      Instances For

        Run the automaton from its initial state.

        Equations
        Instances For

          Boolean membership in the deficient-carry language.

          Equations
          Instances For
            theorem GKPCarry.badCarryLanguage_true_iff_carryCount_lt_two {digits : List } (hdigits : digitdigits, digit < 3) :

            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
            Instances For

              The unique digit 2 is the most significant digit.

              Equations
              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
                  Instances For
                    theorem GKPCarry.badCarryAllZeroOrOne_cons {digit : } {digits : List } :
                    badCarryAllZeroOrOne (digit :: digits) digit < 2 badCarryAllZeroOrOne digits
                    theorem GKPCarry.badCarryAllZeroOrOne_cons_of_lt {digit : } {digits : List } (hdigit : digit < 2) :
                    theorem GKPCarry.badCarryExactlyOneTopTwo_cons_of_lt {digit : } {digits : List } (hdigit : digit < 2) :
                    theorem GKPCarry.badCarryLanguageShape_cons_of_lt {digit : } {digits : List } (hdigit : digit < 2) :
                    theorem GKPCarry.badCarryLanguageShape_two_cons_iff {digits : List } :
                    badCarryLanguageShape (2 :: digits) digits = [] ∃ (highs : List ), badCarryAllZeroOrOne highs digits = 0 :: highs
                    theorem GKPCarry.badCarryLanguageShape_cons_of_invalid {digit : } {digits : List } (hsmall : ¬digit < 2) (htwo : digit 2) :

                    Exact classification of the deficient-carry language into three explicit little-endian digit shapes.