cfahlgren1/math / lean /OAI /Computability /MinUncut /Machines /UnboundedGraphMachine.lean
cfahlgren1's picture
download
raw
3.34 kB
import Mathlib
import OAI.Computability.MinUncut.Machines.GraphRenderMachine
import OAI.Computability.MinUncut.Estimates.CountedWordParser
namespace OAI
section
namespace MinUncut.Costed.Arena
open _root_.Turing _root_.OAI.Turing _root_.Turing.PartrecToTM2 _root_.OAI.Turing.PartrecToTM2 Turing.ToPartrec Polynomial
open MinUncutGames.Foundations.Complexity
noncomputable section
def unboundedGraphMachine : FinTM2 :=
MachineSequential.machine (codeMachine unboundedWordsCode) GraphCodec.machine id .cons
lemma unboundedGraphMachine_finiteAlphabet (k : unboundedGraphMachine.K) :
Finite (unboundedGraphMachine.Γ k) :=
sequential_finiteAlphabet _ _ _ _ (codeMachine_finiteAlphabet _) GraphCodec.finiteAlphabet k
def unboundedGraphTime : Polynomial ℕ := C 10*unboundedWordsBound+10
def unboundedGraphPacked (c : Code) (v : List ℕ) : List ℕ := (initialState c v []).encode
def unboundedGraphMachine_outputs {c : Code} {v : List ℕ} {B n k : ℕ}
{table : List Bool} {rest : List ℕ}
(hc : Runs c v (n::(table.map Bool.toNat++2::k::rest)) B)
(hl : (n::(table.map Bool.toNat++2::k::rest)).length≤B) :
TM2OutputsInTime unboundedGraphMachine (trList (unboundedGraphPacked c v))
(some (MinUncutGames.BinaryEncoding.nameBits n++table++MinUncutGames.BinaryEncoding.nameBits k))
(unboundedGraphTime.eval (magnitude (B::unboundedGraphPacked c v))) := by
apply Classical.choice
obtain ⟨h,hr,hm⟩ := unboundedWords_run hc hl []
let junk := rest++(n::(table.map Bool.toNat++2::k::rest)).reverse++2::words h
have he' : (n::(table.map Bool.toNat++2::k::rest))++
(n::(table.map Bool.toNat++2::k::rest)).reverse++2::words h=
n::(table.map Bool.toNat++2::k::junk) := by
simp only [List.cons_append,List.append_assoc,junk]
rw [he'] at hr hm
obtain ⟨t,ht,hr⟩ := hr
have h1 := hr.finiteMachine
have h2 := GraphCodec.outputsInTime n k table junk
have h2' : TM2OutputsInTime GraphCodec.machine
((trList (n::(table.map Bool.toNat++2::k::junk))).map id)
(some (MinUncutGames.BinaryEncoding.nameBits n++table++MinUncutGames.BinaryEncoding.nameBits k))
(2*bitsize (n::(table.map Bool.toNat++2::k::junk))+
(MinUncutGames.BinaryEncoding.nameBits n++table++MinUncutGames.BinaryEncoding.nameBits k).length+2) := by
have input_eq : @List.map (GraphCodec.machine.Γ GraphCodec.machine.k₀)
(GraphCodec.machine.Γ GraphCodec.machine.k₀) id
(trList (n::(table.map Bool.toNat++2::k::junk))) =
trList (n::(table.map Bool.toNat++2::k::junk)) := List.map_id _
simpa only [input_eq] using h2
have hh := MachineSequential.execute (codeMachine unboundedWordsCode) GraphCodec.machine id Γ'.cons
_ _ _ _ _ h1 h2'
have hb := bitsize_le_magnitude (n::(table.map Bool.toNat++2::k::junk))
have ho := GraphRegisters.codec_length_le n k table junk
refine ⟨⟨hh.toEvalsTo,hh.steps_le_m.trans ?_⟩⟩
change t+1+2*((trList (n::(table.map Bool.toNat++2::k::junk))).length+1)+
(2*bitsize (n::(table.map Bool.toNat++2::k::junk))+
(MinUncutGames.BinaryEncoding.nameBits n++table++MinUncutGames.BinaryEncoding.nameBits k).length+2)≤_
simp only [unboundedGraphPacked,unboundedGraphTime,eval_add,eval_mul,eval_C,eval_ofNat]
simp only [bitsize] at hb ⊢
omega
end
end MinUncut.Costed.Arena
end
end OAI

Xet Storage Details

Size:
3.34 kB
·
Xet hash:
6964dc92c4b89e0ea42c94dee93a6f410c7d1c95a638154564d0afa8c90808f3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.