introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.51 kB
import OAI.Computability.FourierTransform.RAM
import OAI.Computability.FourierCircuit.Core
namespace OAI
/-! Main proof targets. -/
namespace PowerSaving
noncomputable section
open RAM RAM.Ty Filter Asymptotics
/-- Positive-sign, canonical roots. Need only at positive order. -/
abbrev root := ExactFourier.zeta
abbrev Vec (n : β„•) := Fin n β†’ β„‚
abbrev dftMatrix := ExactFourier.fourierMatrix
def dft (n : β„•) (x : Vec n) : Vec n :=
fun j => βˆ‘ k, (root n) ^ (j.val*k.val) * x k
def conv (n : β„•) (x y : Vec n) : Vec (2*n-1) :=
fun k => βˆ‘ r : Fin n, βˆ‘ s : Fin n, if r.val+s.val=k.val then x r*y s else 0
/-- Exact exponent from the TeX (natural logarithms). -/
def paperM : ℝ := 1000000
def paperW : ℝ := ((2 : β„•) : ℝ) ^ (71:β„•)
def paperDelta : ℝ := 6871402692000000
def paperMultiplier := paperM - paperDelta / paperW
def theta : ℝ := Real.log paperMultiplier / Real.log paperM
def decimalExponent : ℝ := 1 - 1/(10^(13:β„•))
def paperTime (n : β„•) : ℝ :=
(n:ℝ) * (Real.log (n:ℝ)) ^ theta * (Real.log (Real.log (n:ℝ))) ^ (4-theta)
def decimalTime (n : β„•) : ℝ := (n:ℝ) * (Real.log (n:ℝ)) ^ decimalExponent
def nlogn (n : β„•) : ℝ := (n:ℝ) * Real.log (n:ℝ)
abbrev dftInKind := p w (p sc (a (c Paint.left)))
abbrev dftOutKind := a (c Paint.left)
abbrev convInKind := p w (p sc (p (a (c Paint.left)) (a (c Paint.right))))
abbrev convOutKind := a (c Paint.both)
/-- Include an integer and address bound polynomial in n. Constants inside this bound are
immaterial (a constant number of logarithmic sized words is allowed). W n is the work
allowance, including the order program, one root primitive and the transform program.
The order program takes only the length, so its result specifies the root explicitly. -/
def DFTProgram (order : Prog false w w) (solve : Prog false dftInKind dftOutKind)
(W : β„• β†’ β„•) : Prop :=
βˆƒ cBound : β„•, βˆ€ n : β„•, 0<n β†’
let cap := (n+2)^cBound
let d := run order n
W n + 10*(n+2) ≀ cap ∧ d.peak ≀ cap ∧ d.valid ∧
0 < d.val ∧ d.val < 1024*n^3 ∧ d.val ≀ cap ∧
βˆ€ x : Vec n,
let result := run solve (n, root d.val, (⟨n,x⟩ : Tape β„‚))
result.valid ∧ result.peak ≀ cap ∧ d.work+1+result.work ≀ W n ∧
result.val = (⟨n, dft n x⟩ : Tape β„‚)
/-- Convolution in the same model extended by pointwise field multiplication for two
inputs. We even require the bound on the supplied root from the proof of the corollary. -/
def ConvProgram (order : Prog false w w) (solve : Prog true convInKind convOutKind)
(W : β„• β†’ β„•) : Prop :=
βˆƒ cBound : β„•, βˆ€ n : β„•, 0<n β†’
let cap := (n+2)^cBound
let d := run order n
W n + 10*(n+2) ≀ cap ∧ d.peak ≀ cap ∧ d.valid ∧
0 < d.val ∧ d.val < 1024*(2*n-1)^3 ∧ d.val ≀ cap ∧
βˆ€ x y : Vec n,
let result := run solve (n, root d.val, (⟨n,x⟩ : Tape β„‚),(⟨n,y⟩ : Tape β„‚))
result.valid ∧ result.peak ≀ cap ∧ d.work+1+result.work ≀ W n ∧
result.val = (⟨2*n-1, conv n x y⟩ : Tape β„‚)
/-- Thm 1 (intro main) and decimal corollary estimates. -/
def TimeBounds (W : β„• β†’ β„•) : Prop :=
let W' := fun n : β„• => (W n : ℝ)
W' =O[atTop] paperTime ∧ W' =O[atTop] decimalTime ∧ W' =o[atTop] nlogn
def DFTGoal : Prop := βˆƒ order solve W, DFTProgram order solve W ∧ TimeBounds W
def ConvGoal : Prop := βˆƒ order solve W, ConvProgram order solve W ∧ TimeBounds W
end
end PowerSaving
end OAI