Documentation

Complexitylib.Models.TuringMachine.Repetition.Internal.Schedule

Outer schedule and boundary assertions for fixed-time repetition #

This internal module splits the full wrapper choice string into the two setup choices and per-trial simulation and administrative slices. It also packages the completed-vote invariant and states the exact trial-boundary assertion used by the outer correctness induction.

The actual outer induction is deliberately separate: this file supplies its index algebra, choice slices, vote bookkeeping, and target predicate.

Main results #

Exact full-seed slices #

Global position of setup choice a.

Equations
Instances For

    Global position of offset s in trial stride j.

    Equations
    Instances For

      Embed a simulation offset into the beginning of a trial stride.

      Equations
      Instances For

        Embed an administrative offset after the T simulation choices.

        Equations
        Instances For
          def Complexity.NTM.repeatSetupChoices {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) :
          Fin 2Bool

          The two leading setup choices of a full repetition seed.

          Equations
          Instances For

            All choices in trial stride j.

            Equations
            Instances For
              def Complexity.NTM.repeatSimulationChoices {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) (j : Fin k) :
              Fin TBool

              The T source-simulation choices in trial j.

              Equations
              Instances For
                def Complexity.NTM.repeatAdminChoices {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) (j : Fin k) :
                Fin (T + 2)Bool

                The T + 2 rewind-and-finish choices in trial j.

                Equations
                Instances For
                  @[simp]
                  theorem Complexity.NTM.repeatSetupChoiceIdx_val (k T : ) (a : Fin 2) :
                  (repeatSetupChoiceIdx k T a) = a

                  Setup indices retain their local numeric value.

                  @[simp]

                  A stride index has the advertised row-major global position.

                  Trial/offset coordinates inject into the full schedule.

                  Setup and stride positions are disjoint.

                  The generic stride embedding agrees with the machine simulation index.

                  No simulation choice is an administrative choice, even across trials.

                  @[simp]
                  theorem Complexity.NTM.repeatSimulationChoices_eq_block {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) (j : Fin k) :
                  repeatSimulationChoices choices j = (blocksEquiv k T) (repeatRandomSeed k T choices) j

                  A trial's simulation slice is exactly its block of the compact random seed.

                  @[simp]
                  theorem Complexity.NTM.repeatSimulationChoices_apply {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) (j : Fin k) (t : Fin T) :
                  repeatSimulationChoices choices j t = choices (repeatChoiceIdx T j t)

                  Pointwise form of the simulation slice.

                  @[simp]
                  theorem Complexity.NTM.repeatAdminChoices_apply {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) (j : Fin k) (a : Fin (T + 2)) :

                  Pointwise form of the administrative slice.

                  Trace prefixes at trial boundaries #

                  def Complexity.NTM.repeatPrefixIdx (T : ) {m k : } (hm : m k) :

                  Include a shorter trial-boundary prefix in the full repetition schedule.

                  Equations
                  Instances For
                    def Complexity.NTM.repeatPrefixChoices {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) (m : ) (hm : m k) :

                    Restrict a full choice string to the boundary after m trials.

                    Equations
                    Instances For
                      @[simp]
                      theorem Complexity.NTM.repeatPrefixChoices_apply {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) (m : ) (hm : m k) (i : Fin (repeatAtTimeSteps m T)) :
                      repeatPrefixChoices choices m hm i = choices (repeatPrefixIdx T hm i)

                      Pointwise form of prefix restriction.

                      theorem Complexity.NTM.repeatPrefixChoices_self {k T : } (choices : Fin (repeatAtTimeSteps k T)Bool) :
                      repeatPrefixChoices choices k = choices

                      Restricting at the final boundary returns the full choice string.

                      def Complexity.NTM.repeatBoundaryCfg {n k T : } (tm : NTM n) (x : List Bool) (choices : Fin (repeatAtTimeSteps k T)Bool) (m : ) (hm : m k) :
                      Cfg (k * (n + 1)) (tm.RepeatQ k T)

                      Wrapper configuration after the exact prefix ending at trial boundary m.

                      Equations
                      Instances For

                        Completed-vote and outer-boundary assertions #

                        def Complexity.NTM.RepeatCompletedVotes {n k T : } (tm : NTM n) (x : List Bool) (seed : Fin (k * T)Bool) (votes : Fin kBool) (m : ) :

                        Vote vector agrees with source trials below boundary m and is false above it.

                        Equations
                        Instances For
                          theorem Complexity.NTM.RepeatCompletedVotes.zero {n k T : } (tm : NTM n) (x : List Bool) (seed : Fin (k * T)Bool) :
                          tm.RepeatCompletedVotes x seed (fun (x : Fin k) => false) 0

                          No trials completed means every stored vote is false.

                          theorem Complexity.NTM.RepeatCompletedVotes.update {n k T : } (tm : NTM n) (x : List Bool) (seed : Fin (k * T)Bool) (votes : Fin kBool) (j : Fin k) (h : tm.RepeatCompletedVotes x seed votes j) :
                          tm.RepeatCompletedVotes x seed (Function.update votes j (tm.repeatVotes x k T seed j)) (j + 1)

                          Recording trial j advances the completed-vote boundary.

                          theorem Complexity.NTM.RepeatCompletedVotes.eq_expected {n k T : } (tm : NTM n) (x : List Bool) (seed : Fin (k * T)Bool) (votes : Fin kBool) (h : tm.RepeatCompletedVotes x seed votes k) :
                          votes = tm.repeatVotes x k T seed

                          At the final boundary the stored vector is the complete source vote vector.

                          def Complexity.NTM.repeatTrialStartState {n k T : } (tm : NTM n) (j : Fin k) (votes : Fin kBool) :
                          tm.RepeatQ k T

                          Control state at the start of trial j, including the zero-time branch.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            def Complexity.NTM.RepeatBoundary {n k T : } (tm : NTM n) (x : List Bool) (seed : Fin (k * T)Bool) (m : ) (C : Cfg (k * (n + 1)) (tm.RepeatQ k T)) :

                            Target assertion after m completed trials. Before the final boundary the wrapper is at the exact next-trial start with the expected vote prefix and fresh frame; at m = k it has halted with the majority verdict.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              def Complexity.NTM.RepeatOuterClaim {n k T : } (tm : NTM n) (x : List Bool) (choices : Fin (repeatAtTimeSteps k T)Bool) :

                              Fully formulated outer-induction claim over every exact schedule prefix.

                              Equations
                              Instances For
                                theorem Complexity.NTM.RepeatOuterClaim.next {n k T : } {tm : NTM n} {x : List Bool} {choices : Fin (repeatAtTimeSteps k T)Bool} (h : tm.RepeatOuterClaim x choices) (m : ) (hm : m < k) :
                                have j := m, hm; ∃ (votes : Fin kBool), tm.RepeatCompletedVotes x (repeatRandomSeed k T choices) votes m (tm.repeatBoundaryCfg x choices m ).state = tm.repeatTrialStartState j votes tm.repeatProjectCfg j tm.qstart (tm.repeatBoundaryCfg x choices m ) = tm.initCfg x RepeatFrame x j (tm.repeatBoundaryCfg x choices m ) RepeatOtherParked j (tm.repeatBoundaryCfg x choices m )

                                Extract the next-trial assertion from the outer claim before the last boundary.

                                theorem Complexity.NTM.RepeatOuterClaim.final {n k T : } {tm : NTM n} {x : List Bool} {choices : Fin (repeatAtTimeSteps k T)Bool} (h : tm.RepeatOuterClaim x choices) :
                                have C := tm.repeatBoundaryCfg x choices k ; C.state = RepeatQ.halt C.output.head = 1 C.output.cells 1 = Γ.ofBool (majority (tm.repeatVotes x k T (repeatRandomSeed k T choices)))

                                Extract the final halted majority assertion from the outer claim.