Download data/lean/OAI/Computability/MinUncut/Machines/FiberGraphMachine.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.01 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/MinUncut/Machines/FiberGraphMachine.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/MinUncut/Machines/FiberGraphMachine.lean
-
curl -L -o FiberGraphMachine.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/MinUncut/Machines/FiberGraphMachine.lean
4.01 kB
| import Mathlib | |
| import OAI.Computability.MinUncut.Graphs.UnboundedGraphBase | |
| namespace OAI | |
| section | |
| noncomputable section | |
| namespace MinUncut.Costed.Arena | |
| open _root_.Turing _root_.OAI.Turing Turing.ToPartrec _root_.Turing.PartrecToTM2 _root_.OAI.Turing.PartrecToTM2 Polynomial | |
| open MinUncutGames.Foundations.Complexity MinUncutGames.BinaryEncoding | |
| def initializedGraphMachine (c : Code) : FinTM2 := | |
| MachineSequential.machine (codeMachine c) unboundedGraphMachine id .cons | |
| lemma initializedGraphMachine_finite (c : Code) (k : (initializedGraphMachine c).K) : | |
| Finite ((initializedGraphMachine c).Ξ k) := | |
| sequential_finiteAlphabet _ _ _ _ (codeMachine_finiteAlphabet _) unboundedGraphMachine_finiteAlphabet k | |
| lemma magnitude_words (xs : List β) : magnitude xs=(encodeWords xs).length := by | |
| induction xs with | |
| | nil => rfl | |
| | cons a xs ih=> simp only [magnitude_cons,encodeWords,List.length_append,encodeWord_length,ih] | |
| lemma exists_graph_initializer {f : β β List β β List β} (P : βK,PolyProgram (f K)) | |
| (he : Computable (fun K=>(P K).code)) : | |
| βc : Code,βK,βp : Polynomial β,βxs n table k junk, | |
| f K xs=n::((table : List Bool).map Bool.toNat++2::k::junk) β | |
| Nonempty (TM2OutputsInTime (initializedGraphMachine c) | |
| (trList (K::(encodeWords xs).map FrameDecode.symbol)) | |
| (some (nameBits n++table++nameBits k)) (p.eval (encodeWords xs).length)) := by | |
| obtain β¨c,hcβ©:=Init.exists_initializer he | |
| refine β¨c,fun K=>?_β© | |
| obtain β¨p,hpβ©:=hc K | |
| let q:Polynomial β:=p.comp (C (K+1)+C 3*X) | |
| let r:Polynomial β:=q+1+C 2*(q+1)+unboundedGraphTime.comp ((P K).bound+1+q) | |
| refine β¨r,fun xs n table k junk ho=>?_β© | |
| let v:=(encodeWords xs).map FrameDecode.symbol | |
| let b:=Init.base (P K).code xs K v | |
| let w:=(initialState (P K).code xs b).encode | |
| have hs:magnitude (K::v)β€(C (K+1)+C 3*X : Polynomial β).eval (encodeWords xs).length:=by | |
| have hh:=FrameDecode.magnitude_symbols (encodeWords xs) | |
| simp only [magnitude_cons,eval_add,eval_C,eval_mul,eval_X] | |
| dsimp only [v] | |
| omega | |
| have hpbound:=evalNat_mono p hs | |
| have hir: Runs c (K::v) w (q.eval (encodeWords xs).length):= | |
| (hp xs).1.mono (by simpa only [q,eval_comp] using hpbound) | |
| have his: magnitude wβ€q.eval (encodeWords xs).length:= | |
| (hp xs).2.trans (by simpa only [q,eval_comp] using hpbound) | |
| have hg:Runs (P K).code xs (n::(table.map Bool.toNat++2::k::junk)) | |
| ((P K).bound.eval (encodeWords xs).length):=by | |
| have hh:=(P K).run xs | |
| rw [ho,magnitude_words] at hh | |
| exact hh | |
| have hl:(n::(table.map Bool.toNat++2::k::junk)).lengthβ€(P K).bound.eval (encodeWords xs).length:=by | |
| have hh:=(magnitude_length (f K xs)).trans ((P K).size xs) | |
| simpa only [ho,magnitude_words] using hh | |
| let h2:=unboundedGraphMachine_outputs_base b hg hl | |
| obtain β¨t,ht,hrβ©:=hir | |
| let h1:=hr.finiteMachine | |
| let h2':TM2OutputsInTime unboundedGraphMachine ((trList w).map id) | |
| (some (nameBits n++table++nameBits k)) | |
| (unboundedGraphTime.eval (magnitude ((P K).bound.eval (encodeWords xs).length::w))) := by | |
| have input_eq : @List.map (unboundedGraphMachine.Ξ unboundedGraphMachine.kβ) | |
| (unboundedGraphMachine.Ξ unboundedGraphMachine.kβ) id (trList w) = trList w := | |
| List.map_id _ | |
| simpa only [input_eq] using h2 | |
| have hh:=MachineSequential.execute (codeMachine c) unboundedGraphMachine id Ξ'.cons | |
| _ _ _ _ _ h1 h2' | |
| have hwb: (trList w).lengthβ€q.eval (encodeWords xs).length:= (bitsize_le_magnitude w).trans his | |
| have hm:magnitude ((P K).bound.eval (encodeWords xs).length::w)β€ | |
| (((P K).bound+1+q).eval (encodeWords xs).length):=by | |
| simp only [magnitude_cons,eval_add,eval_one] | |
| omega | |
| have hb:=evalNat_mono unboundedGraphTime hm | |
| simp only [eval_add,eval_one] at hb | |
| exact β¨β¨hh.toEvalsTo,hh.steps_le_m.trans (by | |
| simp only [r,eval_add,eval_one,eval_mul,eval_C,eval_comp] | |
| change t+1+2*((trList w).length+1)+_β€_ | |
| omega)β©β© | |
| end MinUncut.Costed.Arena | |
| end | |
| end | |
| end OAI | |