File size: 3,952 Bytes
4a56cd6 | 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | import OAI.Computability.SpaceSimulation.OneTape.Caps
import OAI.Computability.SpaceSimulation.OneTape.Growth
namespace OAI
/-!
One-tape simulation in two-fifths-power space, following OpenAI's
βSimulating One-Tape Time in Two-Fifths-Power Spaceβ. The capped and
unknown-time bounds include all intermediate work storage and keep the
accessor and simulator fixed independently of the input and time cap.
-/
namespace Fifths
namespace Single
open Entry Cost
variable {X : Type} (M : Single X)
/-- Ordinary capped access condition. Log is binary (Cost.Log n =
log base two of (n+2)). Real constants. -/
def Access (A : M.Sym) (p q : β) (x : List X) (T : β) : Prop :=
β (h : M.Tag) (l : β€), Inside T l β
β s : β, (s:β) β€ p * (Log T)^q β§
A.Within (binaryIn x (M.arg T h l)) (M.sensor x h l) s
/-- Widen all promised runs of the accessor to a pointwise
integer bound. Parameter is integer so tight floors immaterial. -/
theorem accessed (A : M.Sym) (p q : β) (hp : 1 β€ p) :
β d c : β, β (x : List X) (T : β), M.Access A p q x T β
M.Gives A x T (c*(bound d T + 1)) := by
obtain β¨d,c,hβ© := absorbs p q hp
refine β¨d,c,?_β©
intro x T e g u a
obtain β¨s,g,lβ© := e g u a
exact l.mono (by exact_mod_cast g.trans (h T))
/-- With binary cap as a separate read-only argument. Single
simulator for all promised input/cap pairs. Real pointwise space
bound (in particular a soft-O bound). `exponent` = 2/5. -/
theorem capped [Fintype X] (A : M.Sym) (p q : β) (hp : 1 β€ p) (_hq : 1 β€ q) :
β (N : TM X Unit M.Outcome) (e : β) (c : β), 0 < c β§
β (x : List X) (T : β), 2 β€ T β M.Access A p q x T β
β b : β, N.Within (binaryIn x (fun _ => T)) (M.outcome x T) b β§
(b:β) β€ c*(T:β)^exponent*(Log T)^e := by
classical
obtain β¨d,c,Hβ© := M.accessed A p q hp
let I := {i : List X Γ β // 2 β€ i.2 β§ M.Access A p q i.1 i.2}
let x := fun i : I => i.val.1
let T := fun i : I => i.val.2
let S := fun i : I => bound d (T i)
let f := fun i : I => M.outcome (x i) (T i)
let e : M.Outcome βͺ β := β¨Entry.code,Entry.code_inj _β©
have l : Comp x S T (fun i => e (f i)) :=
M.cappedRegister A d (Comp.refl (capFits d T)) (Scaled.refl S)
β¨c,fun i => H (x i) (T i) i.property.2β©
obtain β¨N,u,wβ© := Comp.withBinary (M.finish M.beginState) e l
refine β¨N,d+2,((u:β)+1)*2*factor d,?_,?_β©
Β· have := fpos d; positivity
intro x t g h
exact β¨_,w (β¨(x,t),g,hβ© : I),scaledReal d u gβ©
/-- Simulator with no cap input, an actual time t being used only
to state the bound. If already halted at t, reports that outcome;
under the promises, halts within the stated space. -/
theorem unknown [Fintype X] (A : M.Sym) (p q : β) (hp : 1 β€ p) (_hq : 1 β€ q) :
β (N : TM X Empty M.Outcome) (e : β) (c : β), 0 < c β§
β (x : List X), (β T, 2 β€ T β M.Access A p q x T) β
β (t : β), (M.outcome x t).2 = true β
β b, N.Within (files x) (M.outcome x t) b β§
(b:β) β€ c*((t:β)+2)^exponent*(Log t)^e := by
classical
obtain β¨d,c,Hβ© := M.accessed A p q hp
let I := {i : List X Γ β //
(β T, 2 β€ T β M.Access A p q i.1 T) β§ (M.outcome i.1 i.2).2 = true}
let x := fun i : I => i.val.1
let t := fun i : I => i.val.2
let S := fun i : I => bound d (t i + 2)
let f := fun i : I => M.outcome (x i) (t i)
let e : M.Outcome βͺ β := β¨Entry.code,Entry.code_inj _β©
have l : Comp x S (fun _ => 0) (fun i => e (f i)) :=
M.noCapRegister A d c (fun i : I => i.property.2)
(fun (i : I) T p => H (x i) T (i.property.1 T p))
obtain β¨N,u,wβ© := Comp.withoutBinary (M.finish M.beginState) e l
refine β¨N,d+2,((u:β)+1)*2*factor d*2^(d+2),?_,?_β©
Β· have := fpos d; positivity
intro x h t q
exact β¨_,w (β¨(x,t),h,qβ© : I),scaledShift d u tβ©
end Single
end Fifths
end OAI
|