cfahlgren1's picture
download
raw
3.58 kB
import OAI.Computability.DepthThree.TapeConvolutionPrepare
namespace OAI
namespace DepthThreeLowerBound
namespace TapeConvolve
open TapeMultiProgram TapeRouting TapeUnary TapeArithmetic TapeRegister
abbrev WorkState := TapeConvolutionPrepare.State ⊕ TapeConvolutionRows.State
abbrev State := WorkState ⊕ TapeErase.State
def work : TapeMultiProgram WorkState :=
joinCode TapeConvolutionPrepare.program TapeConvolutionRows.program
(fun _ => TapeConvolutionRows.start)
def program : TapeMultiProgram State :=
joinCode work (TapeErase.code indexA) (fun _ => TapeErase.State.start)
def start : State := .inl (.inl TapeConvolutionPrepare.start)
def done : State := .inr TapeErase.State.done
def cost (r : ℕ) : ℕ := r * (r * (24 * r + 43) + 4 * r + 23) + 32 * r + 32
theorem runs_convolve (σ : TapeStore) (a b : List Bool) (r : ℕ)
(hA : σ hashBits = a) (hB : σ accumBits = b)
(hlenA : a.length = r) (hlenB : b.length = r)
(hCount : σ ringDegree = List.replicate r true)
(hL0 : σ loop0 = []) (hL1 : σ loop1 = [])
(hI : σ indexA = []) (hJ : σ indexB = [])
(hK : σ indexC = []) (hS : σ scratchA = []) (hOut : σ productBits = []) :
RunsIn program.step (cfg start (storeTapes σ))
(cfg done (storeTapes (Function.update σ productBits (convolveBitLists a b))))
(cost r) := by
have hp := TapeConvolutionPrepare.runs_prepare σ r hCount hL0 hL1 hI hOut
have hr := TapeConvolutionRows.runs_rows σ a b 0 r (List.replicate (r + r) false)
hA hB hJ (by simpa only [hlenB] using hCount) hL1 hK hS (by omega) (by simp [hlenA, hlenB])
have hout : convolutionUpdateRows a b (List.range' 0 r) (List.replicate (r + r) false) =
convolveBitLists a b := by
rw [← convolveByUpdates_eq]
simp only [convolveByUpdates, hlenA, hlenB, List.range_eq_range']
have hr' : RunsIn TapeConvolutionRows.program.step
(cfg TapeConvolutionRows.start
(storeTapes (TapeConvolutionRows.frame σ r 0 (List.replicate (r + r) false))))
(cfg TapeConvolutionRows.done
(storeTapes (TapeConvolutionRows.frame σ 0 r (convolveBitLists a b))))
(r * (r * (8 * r + 16 * r + 43) + 4 * r + 23) + 3) := by
simpa only [Nat.zero_add, hout, hlenA, hlenB] using hr
have hw := join_runs TapeConvolutionPrepare.program TapeConvolutionRows.program
(fun _ => TapeConvolutionRows.start) hp rfl hr'
let ρ := TapeConvolutionRows.frame σ 0 r (convolveBitLists a b)
have he := TapeStoreRuns.erase indexA ρ
have hall := join_runs work (TapeErase.code indexA) (fun _ => TapeErase.State.start) hw rfl he
have hframe : Function.update ρ indexA [] = Function.update σ productBits (convolveBitLists a b) := by
funext k
by_cases hi : k = indexA
· subst k
simp [hI, indexA, productBits]
· by_cases hl : k = loop0
· subst k
simp [ρ, Function.update, hL0, indexA, loop0, productBits]
· by_cases hp : k = productBits
· subst k
simp [ρ, Function.update, indexA, productBits]
· simp [ρ, TapeConvolutionRows.frame, Function.update, hi, hl, hp]
have hlen : (ρ indexA).length = r := by simp [ρ]
have hlinear : 8 * r + 16 * r + 43 = 24 * r + 43 := by omega
have htime : (30 * r + 22 + 1 +
(r * (r * (8 * r + 16 * r + 43) + 4 * r + 23) + 3)) + 1 + (2 * r + 5) = cost r := by
rw [hlinear]
unfold cost
omega
simpa only [program, start, done, hframe, hlen, htime] using hall
@[simp] theorem program_done (h : TapeHeads) : program done h = none := rfl
end TapeConvolve
end DepthThreeLowerBound
end OAI

Xet Storage Details

Size:
3.58 kB
·
Xet hash:
5bfb3c74a7efd8869d690bc9fa79a7466e6de3629878df08af9ba05d585a0326

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