Documentation

Complexitylib.Circuits.ExactFourier.Internal.RectStableAlgebra

Exact Fourier circuits: rect stable algebra #

Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a. Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/FourierCircuit/RectStableAlgebra.lean

Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.

def Complexity.ExactFourier.Layered.splitRowsLeft {α β γ σ : Type} :
(α ⊕ γ) ⊕ β ⊕ σ ≃ ((α ⊕ β) ⊕ γ) ⊕ σ

Regroup four coordinate blocks to put the two data blocks first.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    def Complexity.ExactFourier.Layered.splitRowsRight {α β γ σ : Type} :
    (β ⊕ γ) ⊕ α ⊕ σ ≃ ((α ⊕ β) ⊕ γ) ⊕ σ

    Regroup four coordinate blocks and restore the common order of the data blocks.

    Equations
    Instances For
      theorem Complexity.ExactFourier.Layered.stable_reindex {α β σ α' β' σ' : Type} [Fintype α] [Fintype β] [Fintype σ] [Fintype α'] [Fintype β'] [Fintype σ'] [DecidableEq α] [DecidableEq β] [DecidableEq σ] [DecidableEq α'] [DecidableEq β'] [DecidableEq σ'] {G : Matrix α β ℂ} {d : ℕ} (h : Layered (Matrix.fromBlocks (rectangularShear G) 0 0 1) d) (e : α ≃ α') (f : β ≃ β') (g : σ ≃ σ') :
      theorem Complexity.ExactFourier.Layered.stable_rows_nat {a b e s d f : ℕ} (M : ℕ → ℕ → ℂ) (hG : Layered (Matrix.fromBlocks (rectangularShear fun (i : Fin a) (j : Fin e) => M ↑i ↑j) 0 0 1) d) (hH : Layered (Matrix.fromBlocks (rectangularShear fun (i : Fin b) (j : Fin e) => M (a + ↑i) ↑j) 0 0 1) f) :
      Layered (Matrix.fromBlocks (rectangularShear fun (i : Fin (a + b)) (j : Fin e) => M ↑i ↑j) 0 0 1) (d + f)
      def Complexity.ExactFourier.SumLayered {α : Type} [Fintype α] [DecidableEq α] (M : Matrix α α ℂ) (d c : ℕ) :

      A sum of at most c matrices, each realizable in d parallel layers.

      Equations
      Instances For
        theorem Complexity.ExactFourier.SumLayered.single {α : Type} [Fintype α] [DecidableEq α] {M : Matrix α α ℂ} {d : ℕ} (h : Layered M d) :
        theorem Complexity.ExactFourier.SumLayered.weaken {α : Type} [Fintype α] [DecidableEq α] {M : Matrix α α ℂ} {d e c f : ℕ} (h : SumLayered M d c) (hde : d ≤ e) (hcf : c ≤ f) :
        theorem Complexity.ExactFourier.SumLayered.add {α : Type} [Fintype α] [DecidableEq α] {M N : Matrix α α ℂ} {d c e : ℕ} (hM : SumLayered M d c) (hN : SumLayered N d e) :
        SumLayered (M + N) d (c + e)
        theorem Complexity.ExactFourier.SumLayered.mul {α : Type} [Fintype α] [DecidableEq α] {M N : Matrix α α ℂ} {d e c f : ℕ} (hM : SumLayered M d c) (hN : SumLayered N e f) :
        SumLayered (M * N) (d + e) (c * f)
        theorem Complexity.ExactFourier.SumLayered.submatrix_stable {α β γ : Type} [Fintype α] [Fintype β] [Fintype γ] [DecidableEq α] [DecidableEq β] [DecidableEq γ] {M : Matrix γ γ ℂ} {d c : ℕ} (hM : SumLayered M d c) (e : α ↪ γ) (f : β ↪ γ) :
        Layered (Matrix.fromBlocks (rectangularShear (M.submatrix ⇑e ⇑f)) 0 0 1) (c * (4 * d + 4))
        noncomputable def Complexity.ExactFourier.RadixTwo.convolutionMatrix (k : ℕ) (f : Polynomial ℂ) :
        Matrix (Fin (2 ^ k)) (Fin (2 ^ k)) ℂ

        Cyclic convolution expressed as inverse Fourier, diagonal scaling, and Fourier factors.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem Complexity.ExactFourier.RadixTwo.convolution_mulVec (k : ℕ) (f : Polynomial ℂ) (x : Fin (2 ^ k) → ℂ) (hx : (f * (Polynomial.ofFn (2 ^ k)) x).natDegree < 2 ^ k) :
          (convolutionMatrix k f).mulVec x = fun (i : Fin (2 ^ k)) => (f * (Polynomial.ofFn (2 ^ k)) x).coeff ↑i
          theorem Complexity.ExactFourier.RadixTwo.convolution_entry (k : ℕ) (f : Polynomial ℂ) (i j : Fin (2 ^ k)) (hj : f.natDegree + ↑j < 2 ^ k) :
          convolutionMatrix k f i j = if ↑j ≤ ↑i then f.coeff (↑i - ↑j) else 0

          Embed an initial finite interval into a larger one without changing index values.

          Equations
          Instances For
            @[simp]
            theorem Complexity.ExactFourier.initialEmbedding_val {a n : ℕ} (h : a ≤ n) (i : Fin a) :
            ↑((initialEmbedding h) i) = ↑i
            theorem Complexity.ExactFourier.sum_initial {a n : ℕ} (h : a ≤ n) (f : Fin n → ℂ) :
            (∑ i : Fin n, if ↑i < a then f i else 0) = ∑ i : Fin a, f ((initialEmbedding h) i)
            theorem Complexity.ExactFourier.compress_product {a b e n : ℕ} (ha : a ≤ n) (hb : b ≤ n) (he : e ≤ n) (M N : Matrix (Fin n) (Fin n) ℂ) :
            ((M * Matrix.diagonal fun (i : Fin n) => if ↑i < e then 1 else 0) * N).submatrix ⇑(initialEmbedding ha) ⇑(initialEmbedding hb) = M.submatrix ⇑(initialEmbedding ha) ⇑(initialEmbedding he) * N.submatrix ⇑(initialEmbedding he) ⇑(initialEmbedding hb)