Exact Fourier circuits: circuit extensions #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/FourierCircuit/CircuitExtensions.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
Select or duplicate arbitrary existing inputs; these are wire names, not gates.
Equations
- C.withInputs f = C.comp (Complexity.ExactFourier.LinearDAG.wires fun (i : Fin n) => (f i).castSucc)
Instances For
One butterfly for each of m pairs: charge m scalar multiplications, m additions, and m subtractions, retaining the scaled terms for both output signs.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A scalar circuit whose finite input and output coordinates have named types.
- circuit : LinearDAG (Fintype.card ι) (Fintype.card κ)
The underlying scalar circuit after enumerating the coordinate types.
Instances For
Evaluate the underlying circuit and restore the named output coordinates.
Equations
- C.eval x j = C.circuit.eval (x ∘ ⇑(Fintype.equivFin ι).symm) ((Fintype.equivFin κ) j)
Instances For
Relabel or duplicate the input coordinates without adding gates.
Equations
- C.inputs f = { circuit := C.circuit.withInputs fun (i : Fin (Fintype.card ι)) => (Fintype.equivFin τ) (f ((Fintype.equivFin ι).symm i)) }
Instances For
Select, reorder, or duplicate output coordinates without adding gates.
Equations
- C.outputs f = { circuit := C.circuit.withOutputs fun (i : Fin (Fintype.card τ)) => (Fintype.equivFin κ) (f ((Fintype.equivFin τ).symm i)) }
Instances For
Run two typed circuits on a shared input and retain both output vectors.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stack a finite list of circuits that share their input and output types.
Equations
- One or more equations did not get rendered due to their size.
- Complexity.ExactFourier.TypedDAG.stackFin 0 x_2 = Complexity.ExactFourier.TypedDAG.wires fun (x : Fin 0 × κ) => none
Instances For
Scale every output of a circuit by one fixed complex scalar.
Equations
- Complexity.ExactFourier.TypedDAG.scalar c C = (Complexity.ExactFourier.TypedDAG.scale fun (x : κ) => c).comp C
Instances For
The identity circuit, using only direct input wires.
Instances For
A circuit for a tensor power, obtained by repeatedly tensoring matrix circuits.
Equations
Instances For
Distinct complex interpolation nodes given by the natural numbers below m.
Equations
Instances For
Coefficients of the Lagrange basis at the chosen interpolation nodes.
Equations
Instances For
Stack the first t coefficient matrices as successive output blocks.
Equations
- Complexity.ExactFourier.PolynomialDAG.coefficients A t i j = (A i.2 j).coeff ↑i.1
Instances For
Evaluate each entry of a polynomial matrix at the same complex number.
Equations
Instances For
Extend coefficient vectors with zero wires, or truncate them to the requested length.