Exact Fourier circuits: tensor cost algebra #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/FourierCircuit/TensorCostAlgebra.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
theorem
Complexity.ExactFourier.CircuitCost.tensor_assoc
{α β γ : Type}
[Fintype α]
[Fintype β]
[Fintype γ]
(M : Matrix α α ℂ)
(N : Matrix β β ℂ)
(P : Matrix γ γ ℂ)
:
cost (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) M N) P) = cost (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) M (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) N P))
theorem
Complexity.ExactFourier.CircuitCost.tensor_sum
{α β γ : Type}
[Fintype α]
[Fintype β]
[Fintype γ]
(M : Matrix α α ℂ)
(N : Matrix β β ℂ)
(P : Matrix γ γ ℂ)
:
cost (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) (Matrix.fromBlocks M 0 0 N) P) ≤ cost (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) M P) + cost (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) N P)
theorem
Complexity.ExactFourier.CircuitCost.tensor_one_le
{α β : Type}
[Fintype α]
[Fintype β]
[DecidableEq β]
(M : Matrix α α ℂ)
:
theorem
Complexity.ExactFourier.CircuitCost.tensor_exchange
{α β γ : Type}
[Fintype α]
[Fintype β]
[Fintype γ]
(M : Matrix α α ℂ)
(N : Matrix β β ℂ)
(P : Matrix γ γ ℂ)
:
cost (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) M N) P) = cost (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) (Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) M P) N)
theorem
Complexity.ExactFourier.TensorAxis.power_fun_reindex
{α : Type}
(M : Matrix α α ℂ)
(k : ℕ)
:
(Matrix.reindex (funCoordinates k) (funCoordinates k)) (power M k) = fun (x y : Fin k → α) => ∏ i : Fin k, M (x i) (y i)
Grouping changes coordinate indexing only, not the scalar operation.
Equations
- One or more equations did not get rendered due to their size.
- Complexity.ExactFourier.TensorAxis.appendCoordinates k 0 = (Equiv.prodPUnit (Complexity.ExactFourier.TensorAxis.Space α (k + 0))).symm
Instances For
theorem
Complexity.ExactFourier.TensorAxis.power_append
{α : Type}
(M : Matrix α α ℂ)
(k l : ℕ)
:
(Matrix.reindex (appendCoordinates k l) (appendCoordinates k l)) (power M (k + l)) = Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) (power M k) (power M l)
theorem
Complexity.ExactFourier.TensorAxis.power_reindex
{α β : Type}
(e : α ≃ β)
(M : Matrix α α ℂ)
(k : ℕ)
:
∃ (f : Space α k ≃ Space β k), (Matrix.reindex f f) (power M k) = power ((Matrix.reindex e e) M) k
Finite dimension-weighted sector average; no random choices enter a circuit.
Equations
- Complexity.ExactFourier.Amplification.avg p f 0 x✝ = f x✝
- Complexity.ExactFourier.Amplification.avg p f j.succ x✝ = p * Complexity.ExactFourier.Amplification.avg p f j (x✝ + 1) + (1 - p) * Complexity.ExactFourier.Amplification.avg p f j x✝
Instances For
The recursive cost bound obtained by splitting off identity sectors.
Equations
- Complexity.ExactFourier.Amplification.sectorCost l s 0 x✝ = l x✝
- Complexity.ExactFourier.Amplification.sectorCost l s j.succ x✝ = Complexity.ExactFourier.Amplification.sectorCost l s j (x✝ + 1) + s * Complexity.ExactFourier.Amplification.sectorCost l s j x✝
Instances For
theorem
Complexity.ExactFourier.Amplification.cost_sectors
{α δ : Type}
[Fintype α]
[Fintype δ]
[DecidableEq δ]
(A : Matrix α α ℂ)
(j r : ℕ)
:
CircuitCost.cost
(Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) (TensorAxis.power (Matrix.fromBlocks A 0 0 1) j)
(TensorAxis.power A r)) ≤ sectorCost (fun (k : ℕ) => CircuitCost.cost (TensorAxis.power A k)) (Fintype.card δ) j r
theorem
Complexity.ExactFourier.Amplification.cost_call_power
{α δ : Type}
[Fintype α]
[Fintype δ]
(A : Matrix α α ℂ)
(e : α ↪ δ)
(j : ℕ)
:
CircuitCost.cost (TensorAxis.power (Embedded.matrix e A) j) ≤ sectorCost (fun (k : ℕ) => CircuitCost.cost (TensorAxis.power A k)) (Fintype.card (Embedded.complement e)) j 0
theorem
Complexity.ExactFourier.TensorAxis.power_monomial
{α : Type}
[DecidableEq α]
(A : Matrix α α ℂ)
(hA : MonomialMatrix A)
(j : ℕ)
:
MonomialMatrix (power A j)
theorem
Complexity.ExactFourier.TensorAxis.source_power_reindex
{q : ℕ}
(A : Matrix (Fin q) (Fin q) ℂ)
(b : ℕ)
:
(Matrix.reindex ((funCoordinates b).trans (tensorCoordinates q b).symm)
((funCoordinates b).trans (tensorCoordinates q b).symm))
(power A b) = tensorPower A b
theorem
Complexity.ExactFourier.Amplification.cost_group
{α : Type}
[Fintype α]
(A : Matrix α α ℂ)
(b j : ℕ)
:
CircuitCost.cost (TensorAxis.power A (b * j)) = CircuitCost.cost (TensorAxis.power (TensorAxis.power A b) j)
theorem
Complexity.ExactFourier.Amplification.cost_reindexed_power
{α β : Type}
[Fintype α]
[Fintype β]
(e : α ≃ β)
(A : Matrix α α ℂ)
(j : ℕ)
:
CircuitCost.cost (TensorAxis.power ((Matrix.reindex e e) A) j) = CircuitCost.cost (TensorAxis.power A j)
theorem
Complexity.ExactFourier.Amplification.cost_word_power
{q Q : ℕ}
(A : Matrix (Fin q) (Fin q) ℂ)
(W : List (WordStep A Q))
(j : ℕ)
:
CircuitCost.cost (TensorAxis.power (wordMatrix W) j) ≤ W.length * Q ^ j + wordCalls W * sectorCost (fun (k : ℕ) => CircuitCost.cost (TensorAxis.power A k)) (Q - q) j 0
theorem
Complexity.ExactFourier.Amplification.normalized_word
{q b : ℕ}
(hq : 0 < q)
(A : Matrix (Fin q) (Fin q) ℂ)
(hb : 1 ≤ b)
(W : List (WordStep A (q ^ b)))
(hW : wordMatrix W = tensorPower A b)
(j : ℕ)
:
theorem
Complexity.ExactFourier.Amplification.normalized_recurrence
{q b : ℕ}
(hq : 0 < q)
(A : Matrix (Fin q) (Fin q) ℂ)
(hb : 1 ≤ b)
(W : List (WordStep A (q ^ b)))
(hW : wordMatrix W = tensorPower A b)
(k : ℕ)
: