OAI/Computability/MaxCut/Machines/MachineCanonicalOutput.lean
26 declarations, 0 contain sorry, 0 declared as axioms
Canonical output for finite Boolean machines
A raw machine may halt with retained metadata and a changed finite state.
This wrapper redirects its halt to a fixed list of actual tape drains, then
executes one state-reset instruction. The output tape is preserved and the
result is literally haltList. Its cost follows from the raw execution and
the maximum number of pushes in a raw statement.
The cleanup list is fixed with the program, not selected from the input. It may contain repetitions and may be empty when output is the only tape.
- structure
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.Programline 24Source documentation
The homogeneous parts of a finite machine, without dependent alphabet casts.
structure Program (K Λ σ : Type) where …
- def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.extendedLabelline 35 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.extendedCfgline 39 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.extendedStmtline 45Source documentation
Add one finite scratch register while preserving each raw transition.
def extendedStmt (labels : Λ → Λ') (haltTarget : Option Λ') : TM2.Stmt (fun _ : K => Bool) Λ σ → TM2.Stmt (fun _ : K => Bool) Λ' (σ × Option Bool) | .push k f next => .push k (fun state => f state.1) (extendedStmt labels haltTarget next) | .peek k f next => .peek k (fun state symbol => (f state.1 symbol, state.2)) (extendedStmt labels haltTarget next) | .pop k f next => .pop k (fun state symbol => (f state.1 symbol, state.2)) (extendedStmt labels haltTarget next) | .load f next => .load (fun state => (f state.1, state.2)) (extendedStmt labels haltTarget next) | .branch test yes no => .branch (fun state => test state.1) … - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.stepAux_extendedline 63 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.sourceMachineline 87 - abbrev
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.Labelline 98 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.cleanupLabelline 100 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.resetLabelline 103 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.cleanupEntryline 105 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.completedProgramline 108 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.completedMachineline 116Source documentation
A fixed finite program over the same Boolean tapes as the raw machine.
def completedMachine (P : Program K Λ σ) (chosen : List K) : FinTM2 where …
Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.Program
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.finiteAlphabetline 127 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.embeddedCfgline 132 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.step_simulationline 136 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.embedded_initline 152 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.finalTapes_eqline 157 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.haltList_eqline 168 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.cleanupExecutionline 174Source documentation
The cleanup path consists of actual drains and one physical state reset.
def cleanupExecution (P : Program K Λ σ) (chosen : List K) (complete : ∀ k, k ∈ chosen ↔ k ≠ P.output) (state : σ) (register : Option Bool) (base : K → List Bool) : StateTransition.EvalsToInTime (completedMachine P chosen).step ⟨cleanupEntry chosen, (state, register), base⟩ (some (haltList (completedMachine P chosen) (base P.output))) (MachineDrainMany.steps chosen base + 1) := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.Program, OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.completedMachine, OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.cleanupEntry, OAI.MaxCutGames.Foundations.Complexity.MachineDrainMany.steps
- def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.outputsInTimeline 206Source documentation
No assumption about cleanup execution or clean raw work tapes is required.
def outputsInTime (P : Program K Λ σ) (chosen : List K) (complete : ∀ k, k ∈ chosen ↔ k ≠ P.output) (input output : List Bool) (state : σ) (base : K → List Bool) (budget : Nat) (raw : StateTransition.EvalsToInTime (sourceMachine P).step (initList (sourceMachine P) input) (some ⟨none, state, base⟩) budget) (correctOutput : base P.output = output) : TM2OutputsInTime (completedMachine P chosen) input (some output) (budget + chosen.length * (input.length + budget * Runtime.programPushBound (sourceMachine P) + 1) + 1) := by …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.Program, OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.sourceMachine, OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.completedMachine, OAI.MaxCutGames.Foundations.Complexity.Runtime.programPushBound
- def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.completedTimeline 231 - theorem
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.completedTime_evalline 236 - structure
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.TerminalRunline 244Source documentation
An actual raw terminal execution, with arbitrary remaining state and tapes.
structure TerminalRun (P : Program K Λ σ) (input output : List Bool) (budget : Nat) where …
Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.Program
- def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.computableInPolyTimeline 252Source documentation
A polynomial raw run becomes a full canonical-output computation certificate.
noncomputable def computableInPolyTime {α β : Type} (P : Program K Λ σ) (chosen : List K) (complete : ∀ k, k ∈ chosen ↔ k ≠ P.output) (encodeIn : α → List Bool) (encodeOut : β → List Bool) (f : α → β) (rawTime : Polynomial Nat) (run : ∀ a, TerminalRun P (encodeIn a) (encodeOut (f a)) (rawTime.eval (encodeIn a).length)) : TM2ComputableInPolyTime encodeIn encodeOut f where …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.Program, OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.TerminalRun
- theorem
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.computableInPolyTime_finite_alphabetline 275 - def
OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.computableInPolyTimeOfEnumerationline 287Source documentation
An explicit finite enumeration supplies the fixed cleanup list.
noncomputable def computableInPolyTimeOfEnumeration {α β : Type} {N : Nat} (P : Program K Λ σ) (enumeration : Fin N ≃ K) (encodeIn : α → List Bool) (encodeOut : β → List Bool) (f : α → β) (rawTime : Polynomial Nat) (run : ∀ a, TerminalRun P (encodeIn a) (encodeOut (f a)) (rawTime.eval (encodeIn a).length)) : TM2ComputableInPolyTime encodeIn encodeOut f := …Mentions: OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.Program, OAI.MaxCutGames.Foundations.Complexity.MachineCanonicalOutput.TerminalRun