Langlib

Langlib.Automata.LinearBounded.CertifiedRowSystem.Complement.Definition

Complementing certified row systems #

This module implements the inductive-counting construction used to complement the reachability language of a finite CertifiedRowSystem.

The source system is first determinized by CertifiedRowSystem.determinize. Its certificate alphabet is then Unit, and its verifier state after an aligned row scan is the exact set of every source-verifier state reachable by a certificate prefix. Thus an edge and the absence of an edge are both synchronous finite-state checks.

The complement protocol stores a constant number of tracks in each row cell. Vertex and fuel tracks use the source row alphabet; count tracks use radix Fintype.card A + 1, so a nonempty width-n row can represent every count up to (Fintype.card A) ^ n. All tracks are least-significant-cell first and are scanned using RowNumeral.

The semantic finite graph #

@[reducible, inline]

A fixed-width source row, represented without a length proof in every operation.

Equations
Instances For

    Convert a fixed-width row to the list representation used by a certified row system.

    Equations
    Instances For
      def CertifiedRowSystem.Complement.rowEdge {I : Type u_1} {A : Type u_2} {C : Type u_3} {Q : Type u_4} {F : Type u_5} (S : CertifiedRowSystem I A C Q F) {n : } (old new : FixedRow A n) :

      The finite directed graph on width-n rows induced by the source row relation.

      Equations
      Instances For
        def CertifiedRowSystem.Complement.rowFinal {I : Type u_1} {A : Type u_2} {C : Type u_3} {Q : Type u_4} {F : Type u_5} (S : CertifiedRowSystem I A C Q F) {n : } (row : FixedRow A n) :

        The source final predicate on a fixed-width row.

        Equations
        Instances For
          def CertifiedRowSystem.Complement.inputRow {I : Type u_1} {A : Type u_2} {C : Type u_3} {Q : Type u_4} {F : Type u_5} (S : CertifiedRowSystem I A C Q F) {n : } (input : FixedRow I n) :

          The fixed-width source row obtained from an input row.

          Equations
          Instances For
            theorem CertifiedRowSystem.Complement.no_final_iff_abstract_counting_certificate {I : Type u_1} {A : Type u_2} {C : Type u_3} {Q : Type u_4} {F : Type u_5} [Fintype A] [DecidableEq A] (S : CertifiedRowSystem I A C Q F) {n : } (input : FixedRow I n) :

            The abstract counting certificate characterizes absence of a reachable final row in the finite graph of width-n source rows. This theorem is the semantic target of the streaming certified-row protocol below.

            Streaming protocol storage #

            Canonical numbering of an arbitrary nonempty finite source alphabet.

            Equations
            Instances For
              @[reducible, inline]

              Counter digits have one more value than the source alphabet. Consequently a width-n > 0 counter can store the number of all width-n source rows.

              Equations
              Instances For

                The count radix is genuinely larger than one whenever the source alphabet is nonempty.

                Control phases of the streaming inductive-counting protocol.

                chooseInner performs the canonical scan over possible old-reachable vertices. A positive choice enters path, which guesses a source path bounded by depth. Once every inner vertex has been considered, finishOuter classifies the current outer vertex and updates the next count. finishRound advances the depth enumeration. The last two phases perform the all-nonfinal scan justified by the final exact count.

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

                    Source-alphabet tracks grouped to keep finite-instance synthesis shallow.

                    • source : A
                    • depth : A
                    • outer : A
                    • inner : A
                    • path : A
                    • fuel : A
                    Instances For
                      def CertifiedRowSystem.Complement.instDecidableEqVertexTracks.decEq {A✝ : Type u_6} {inst✝ : Fintype A✝} [DecidableEq A✝] (x✝ x✝¹ : VertexTracks A✝) :
                      Decidable (x✝ = x✝¹)
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Larger-radix counter tracks.

                        Instances For
                          def CertifiedRowSystem.Complement.instDecidableEqCounterTracks.decEq {A✝ : Type u_6} {inst✝ : Fintype A✝} [DecidableEq A✝] (x✝ x✝¹ : CounterTracks A✝) :
                          Decidable (x✝ = x✝¹)
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            One physical cell of the complement protocol.

                            source is immutable. depth, outer, inner, path, and fuel are source-radix row numerals. oldCount, newCount, and seenCount use the strictly larger count radix. The phase and Boolean flag are replicated; the verifier enforces uniformity on every scan.

                            Instances For
                              def CertifiedRowSystem.Complement.instDecidableEqProtocolCell.decEq {A✝ : Type u_6} {inst✝ : Fintype A✝} [DecidableEq A✝] (x✝ x✝¹ : ProtocolCell A✝) :
                              Decidable (x✝ = x✝¹)
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[reducible, inline]

                                A protocol row has one cell per source/input cell.

                                Equations
                                Instances For

                                  The phase is replicated across the complete row.

                                  Equations
                                  Instances For

                                    Extract the immutable source track.

                                    Equations
                                    Instances For

                                      Extract the current counting depth.

                                      Equations
                                      Instances For

                                        Extract the exact count from the preceding round.

                                        Equations
                                        Instances For

                                          Extract the accumulating next-round count.

                                          Equations
                                          Instances For

                                            Extract the number of old-reachable vertices selected in the current canonical scan.

                                            Equations
                                            Instances For

                                              Extract the outer vertex being classified.

                                              Equations
                                              Instances For

                                                Extract the old vertex currently considered by the inner scan.

                                                Equations
                                                Instances For

                                                  Extract the current row of a guessed source path.

                                                  Equations
                                                  Instances For

                                                    Extract the length of the guessed path.

                                                    Equations
                                                    Instances For

                                                      All replicated found flags have the specified value.

                                                      Equations
                                                      Instances For
                                                        structure CertifiedRowSystem.Complement.WellFormedRow {A : Type u_6} [Fintype A] (width : ) (row : ProtocolRow A) :

                                                        Shape invariant shared by every protocol phase.

                                                        Instances For
                                                          noncomputable def CertifiedRowSystem.Complement.inputProtocolCell {I : Type u_6} {A : Type u_7} [Fintype A] [Nonempty A] (sourceCell : IA) (input : I) :

                                                          The input image stores the source row and initializes every work track to zero. The first protocol transition changes oldCount from the all-zero input image to the LSD-first numeral one; doing this in a transition lets the finite verifier identify the first cell.

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

                                                            Predicate describing the canonical initialized row after the boot transition.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              noncomputable def CertifiedRowSystem.Complement.initializedProtocolCell {A : Type u_6} [Fintype A] [Nonempty A] (first : Bool) (source : A) :

                                                              One initialized protocol cell. The first cell stores the least-significant digit one of the initial reachable count; every later count digit is zero.

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

                                                                Canonical initialized protocol row for a nonempty source row.

                                                                Equations
                                                                Instances For

                                                                  The canonical initialized row satisfies every initialization invariant.

                                                                  A transition label is repeated in the certificate row. The finite verifier rejects if different cells request different actions.

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