Download lean/OAI/Computability/FourierCircuit/Core.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/FourierCircuit/Core.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Computability/FourierCircuit/Core.lean
-
curl -L -o Core.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/FourierCircuit/Core.lean
1.75 kB
| 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 | |