Download lean/OAI/Computability/UniqueGames/PCP/MachineRawInitialTable.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 3.75 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/UniqueGames/PCP/MachineRawInitialTable.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Computability/UniqueGames/PCP/MachineRawInitialTable.lean
-
curl -L -o MachineRawInitialTable.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/UniqueGames/PCP/MachineRawInitialTable.lean
3.75 kB
| import OAI.Computability.UniqueGames.Machines.MachineLemmas | |
| import OAI.Computability.UniqueGames.PCP.RawInitialMachineLoop | |
| namespace OAI | |
| section | |
| /-! The actual finite machine computing the initial graph's full serialized | |
| table. The runtime bound counts every parse, row, cleanup and output reversal. -/ | |
| namespace UniqueGamesTheorem.Foundations.PCP.MachineRawInitialTable | |
| open Turing Target Complexity RawInitialMachineModel RawInitialMachineLoopData | |
| open RawInitialMachineBudget RawInitialMachineLoop | |
| private theorem trace_trans {α : Type*} (f : α → α) {a b : Nat} {x y z : α} | |
| (first : f^[a] x = y) (second : f^[b] y = z) : f^[a + b] x = z := by | |
| rw [Nat.add_comm, Function.iterate_add_apply, first, second] | |
| def prefixBits (F : Formula) : List Bool := | |
| encodeWords ([F.variables + F.clauses.length + 1, 6 * F.clauses.length + 1] ++ | |
| clauseOutput F.variables 0 F.clauses) | |
| theorem outputBits (F : Formula) : | |
| GraphTables.tableBits (RawInitialTables.table F) = prefixBits F ++ | |
| encodeWords (RawInitialRows.dummyWords F.variables F.clauses.length) := by | |
| change encodeWords (GraphTables.tableWords (RawInitialTables.table F)) = _ | |
| rw [tableWords_decomposition, encodeWords_append] | |
| rfl | |
| theorem machineTrace (F : Formula) : | |
| (MachineComposition.advance (TM2.step program))^[fullBudget F] | |
| (some (initList machine (formulaBits F))) = | |
| some (haltList machine (GraphTables.tableBits (RawInitialTables.table F))) := by | |
| have startup := RawInitialMachineStart.formulaStartTrace F | |
| rw [startTapes_eq] at startup | |
| have loop := loopTrace 0 F.clauses | |
| (encodeWords [F.variables + F.clauses.length + 1, 6 * F.clauses.length + 1]).reverse | |
| initialState | |
| have hprefix : (encodeWords (clauseOutput F.variables 0 F.clauses)).reverse ++ | |
| (encodeWords [F.variables + F.clauses.length + 1, 6 * F.clauses.length + 1]).reverse = | |
| (prefixBits F).reverse := by | |
| simp only [prefixBits, encodeWords_append, List.reverse_append] | |
| rw [hprefix, Nat.zero_add] at loop | |
| have finish := RawInitialMachineFinish.finishTrace F.variables F.clauses.length | |
| (prefixBits F).reverse (finalSigns initialState.1 F.clauses, none) | |
| rw [List.reverse_reverse, ← outputBits F] at finish | |
| have total := trace_trans _ (trace_trans _ startup loop) finish | |
| have time : (3 * F.variables + 5 * F.clauses.length + 13 + loopTime 0 F.clauses) + | |
| (3 * F.variables + 5 * F.clauses.length + 17 + | |
| (encodeWords (RawInitialRows.dummyWords F.variables F.clauses.length)).length + | |
| (prefixBits F).reverse.length) = fullBudget F := by | |
| rw [fullBudget, outputBits, List.length_append, List.length_reverse] | |
| omega | |
| simpa only [time] using total | |
| def outputsInTime (F : Formula) : | |
| TM2OutputsInTime machine (formulaBits F) | |
| (some (GraphTables.tableBits (RawInitialTables.table F))) | |
| (timePolynomial.eval (formulaBits F).length) where | |
| steps := fullBudget F | |
| evals_in_steps := machineTrace F | |
| steps_le_m := fullBudget_le F | |
| noncomputable def computableInPolyTime : | |
| TM2ComputableInPolyTime formulaEncoding.encode GraphTables.encoding.encode | |
| RawInitialTables.table where | |
| tm := machine | |
| inputAlphabet := Equiv.refl Bool | |
| outputAlphabet := Equiv.refl Bool | |
| time := timePolynomial | |
| outputsFun F := by | |
| change TM2OutputsInTime machine ((formulaBits F).map id) | |
| (some ((GraphTables.tableBits (RawInitialTables.table F)).map id)) | |
| (timePolynomial.eval (formulaBits F).length) | |
| have hi := @List.map_id (machine.Γ machine.k₀) (formulaBits F) | |
| have ho := @List.map_id (machine.Γ machine.k₁) | |
| (GraphTables.tableBits (RawInitialTables.table F)) | |
| rw [hi, ho] | |
| exact outputsInTime F | |
| end UniqueGamesTheorem.Foundations.PCP.MachineRawInitialTable | |
| end | |
| end OAI | |