File size: 1,748 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
import Mathlib

namespace OAI

section
namespace ExactFourier

/-- One charged scalar gate, referencing only available values. -/
inductive Gate (w : β„•) where
  | add (i j : Fin w)
  | sub (i j : Fin w)
  | scale (c : β„‚) (i : Fin w)

def Gate.eval {w : β„•} (v : Fin w β†’ β„‚) : Gate w β†’ β„‚
  | .add i j => v i + v j
  | .sub i j => v i - v j
  | .scale c i => c * v i

/-- A topologically ordered scalar DAG; available values are never consumed. -/
inductive Program (n : β„•) : β„• β†’ Type where
  | nil : Program n 0
  | step {k : β„•} (p : Program n k) (g : Gate (n + 1 + k)) : Program n (k + 1)

def Program.eval {n : β„•} : {k : β„•} β†’ Program n k β†’ (Fin n β†’ β„‚) β†’
    (Fin (n + 1 + k) β†’ β„‚)
  | 0, .nil, x => Fin.snoc x 0
  | _ + 1, .step p g, x =>
      let v := p.eval x
      Fin.snoc v (g.eval v)

/-- Outputs name available values, so permutations and arbitrary fanout are uncharged. -/
structure Circuit (n : β„•) where
  size : β„•
  program : Program n size
  outputs : Fin n β†’ Fin (n + 1 + size)

def Circuit.eval {n : β„•} (C : Circuit n) (x : Fin n β†’ β„‚) : Fin n β†’ β„‚ :=
  fun i => C.program.eval x (C.outputs i)

noncomputable def zeta (n : β„•) : β„‚ := Complex.exp (2 * Real.pi * Complex.I / (n : β„‚))
noncomputable def fourierMatrix (n : β„•) : Matrix (Fin n) (Fin n) β„‚ :=
  fun j k => zeta n ^ (j.val * k.val)

def Circuit.Computes {n : β„•} (C : Circuit n) (A : Matrix (Fin n) (Fin n) β„‚) : Prop :=
  βˆ€ x, C.eval x = A.mulVec x

def MainStatement : Prop :=
  βˆ€ c : ℝ, 0 < c β†’ βˆ€ Nβ‚€ : β„•, 2 ≀ Nβ‚€ β†’ βˆƒ n : β„•, Nβ‚€ ≀ n ∧
    βˆƒ C : Circuit n, C.Computes (fourierMatrix n) ∧
      (C.size : ℝ) < c * (n : ℝ) * Real.logb 2 (n : ℝ)

end ExactFourier
end

end OAI