File size: 2,780 Bytes
2f887db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import Mathlib
import OAI.Computability.MinUncut.Machines.UnboundedGraphMachine

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_outputs_base {c : Code} {v : List ℕ} {B n k : ℕ}
    {table : List Bool} {rest : List ℕ} (base : Heap)
    (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 ((initialState c v base).encode))
      (some (MinUncutGames.BinaryEncoding.nameBits n++table++MinUncutGames.BinaryEncoding.nameBits k))
      (unboundedGraphTime.eval (magnitude (B::(initialState c v base).encode))) := by
  apply Classical.choice
  obtain ⟨h,hr,hm⟩ := unboundedWords_run hc hl base
  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 [unboundedGraphTime,eval_add,eval_mul,eval_C,eval_ofNat]
  simp only [bitsize] at hb ⊢
  omega
end
end MinUncut.Costed.Arena

end

end OAI