cfahlgren1's picture
download
raw
2.01 kB
import Mathlib
namespace OAI
/-!
Scalar circuits for exact discrete Fourier transforms.
No bounds on predetermined complex coefficients, reuse, storage, or conditioning.
-/
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
/-- The precise quantified formulation of source theorem `thm:main`. -/
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 : ℝ)
theorem main_theorem : MainStatement := by
sorry
end ExactFourier
end OAI

Xet Storage Details

Size:
2.01 kB
·
Xet hash:
b6999d73294c9305313516eea2228ce4dab2c25ddaf93b6f9a396779e6ceffda

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