QuantumComputinglib learn · inspect · formalize
Checked on this commit 2,822 public declarations commit 07559c3d051f Build record

Block encoding · symbolic exact rational family

BE Case 2: cubic diagonal family, cold route

For every n, block encode the diagonal operator whose j-th entry is the cube of the grid point x_j=j/2^n.

Lean certifiedA symbolic exact family theorem replaces finite numerical acceptance with rational Householder certificates for every n.

Read this before the proof dashboard

See how a whole symbolic family of non-unitary diagonal matrices can receive an exact block-encoding proof.

Scientific algorithms often need functions of an index, coordinate, or eigenvalue. The target here multiplies basis state |j> by the cubic value (j/2^n)^3, which is generally not unitary and therefore cannot simply be declared a gate.

Diagonal function loaders are natural ingredients for matrix functions, coefficient operators, Hamiltonians, and QSVT-style pipelines. This case focuses on the block-encoding construction itself.

Read the circuit

What the wires and stages are doing

1
System label

The n system qubits hold j and are not overwritten.

2
Branch register

Three clean qubits provide coordinates for an exact rational unit vector.

3
Controlled reflection

For each j, a Householder transformation has the desired cubic value as its clean matrix entry.

4
Projection

Selecting the first branch coordinate returns the diagonal entry (j/2^n)^3.

The detailed circuit diagrams generated from the case record appear below this tutorial.

Statement → proof → optional Lean

The mathematical claims, in the order a human would prove them

Family theorem

Exact rational Householder block encoding for every n

\[D_n=\operatorname{diag}_{0\le j<2^n}\left(\frac{j}{2^n}\right)^3,\qquad \Pi U_n\Pi^\dagger=D_n\]

For arbitrary n, Lean constructs exact rational branch vectors, proves their normalization, proves the controlled Householder operator is orthogonal/unitary, and proves every clean diagonal entry equals the cubic target with alpha=1.

Proof story

  1. Fix one desired diagonal valueFor each j, let c=(j/2^n)^3, which lies in [0,1].
  2. Complete c to an exact rational unit vectorUse a four-square witness to express 1-c^2 as a sum of rational squares.
  3. Build a Householder reflectionA reflection constructed from that vector is rational and orthogonal.
  4. Control by jTake the direct sum of the appropriate reflection for every computational-basis label j.
  5. Project the clean coordinateThe first branch coordinate of the direct sum is exactly diag(c_j).
Show the Lean proof checkpoints

The mathematical explanation above is the reading layer. These compiled declarations are the proof authority.

Mathematical target

The equation being studied

\[D_n=\operatorname{diag}_{0\le j<2^n}\!\left(\frac{j}{2^n}\right)^3,\qquad \Pi U_n\Pi^\dagger=D_n.\]

For arbitrary n, Lean constructs exact rational branch vectors using the four-square theorem, forms a controlled direct sum of Householder matrices, proves rational orthogonality, and proves the clean block equals D_n with alpha=1.

D_n
the symbolic 2^n by 2^n cubic diagonal operator
Pi
the clean embedding selecting the first Householder branch coordinate
U_n
the controlled direct sum of exact rational Householder matrices

Circuit anatomy

How the candidate acts

These blocks show logical stages and register responsibilities. They do not pretend an unresolved logical oracle is already a primitive hardware gate.

Register ordern system qubits | three Householder branch qubits
01

Grid label

hold j in the system register

|j>
02

Exact completion

construct a rational unit vector with first entry (j/2^n)^3

four-square witness
03

Controlled Householder

apply the branch reflection selected by j

H(v_j)
04

Clean projection

read the first branch coordinate

D_n

Auditable evolution

Candidate and proof progression

The cold route evolves proof structure, not a sequence of comparable resource champions. The endpoint is a theorem for every n.

iteration0

Symbolic target

Contract fixed

The target is diag((j/2^n)^3), not one sampled n=2 matrix.

Symbolic target|0^3>U_n ?ket j
Grouped-register circuit. Open the source or workbench to adapt notation.
Lean rootQuantumBlockEncoding.CubicDiagonalOracle.cubicDiagonalRationalCompletion_exists Edit and preview this stage →
Copy this stage as quantikz
\begin{quantikz}[row sep=.4cm, column sep=.65cm]
\lstick{$\ket{0^3}$} & \gate[wires=2]{U_n\;?} & \meter{} \\
\lstick{$\ket j$}    &                       & \qw
\end{quantikz}
not ranked at this tier
iteration1

Rational branch completion

Lean certified

Four-square witnesses close exact normalization for every branch.

Rational branch completion|0^3>complete(x_j^3)|v_j>ket j
Grouped-register circuit. Open the source or workbench to adapt notation.
Lean rootQuantumBlockEncoding.CubicDiagonalOracle.cubicDiagonalRationalCompletion_exists Edit and preview this stage →
Copy this stage as quantikz
\begin{quantikz}[row sep=.4cm, column sep=.55cm]
\lstick{$\ket{0^3}$} & \gate{\mathrm{complete}(x_j^3)} & \rstick{$\ket{v_j}$} \qw \\
\lstick{$\ket j$}    & \ctrl{-1}                       & \qw
\end{quantikz}
not ranked at this tier
iteration2

Householder direct sum

Lean certified family

The final conjunction proves orthogonality, clean block, alpha, and logical resource record.

Householder direct sum|0^3>H(v_j)x_j^3ket0+|perp_j>ket j
Grouped-register circuit. Open the source or workbench to adapt notation.
Lean rootQuantumBlockEncoding.CubicDiagonalOracle.cubicDiagonalHouseholderExactBEContract_complete Edit and preview this stage →
Copy this stage as quantikz
\begin{quantikz}[row sep=.4cm, column sep=.55cm]
\lstick{$\ket{0^3}$} & \gate{H(v_j)} & \rstick{$x_j^3\ket0+\ket{\perp_j}$} \qw \\
\lstick{$\ket j$}    & \ctrl{-1}     & \qw
\end{quantikz}
1gates1depth3aux1oracles

Reader workbench

Edit, preview, then copy

Change symbols, language, proof steps, or the grouped-register circuit locally in your browser. The preview is explanatory; the linked Lean declaration remains the certificate.

Mathematical construction

Proof steps

One step per line. Natural language and inline mathematics are both accepted.

    Quantum circuit

    Complete packet

    Copy the reviewed construction and proof

    The packet below is generated from the reviewed case record. The exact primitive authority is the linked Lean source and executable artifact.

    Construction and circuit LaTeX
    % Requires: \usepackage{quantikz}
    \paragraph{Construction.}
    \[
    D_n=\operatorname{diag}_{0\le j<2^n}\!\left(\frac{j}{2^n}\right)^3,\qquad \Pi U_n\Pi^\dagger=D_n.
    \]
    
    % Symbolic target
    \begin{quantikz}[row sep=.4cm, column sep=.65cm]
    \lstick{$\ket{0^3}$} & \gate[wires=2]{U_n\;?} & \meter{} \\
    \lstick{$\ket j$}    &                       & \qw
    \end{quantikz}
    
    % Rational branch completion
    \begin{quantikz}[row sep=.4cm, column sep=.55cm]
    \lstick{$\ket{0^3}$} & \gate{\mathrm{complete}(x_j^3)} & \rstick{$\ket{v_j}$} \qw \\
    \lstick{$\ket j$}    & \ctrl{-1}                       & \qw
    \end{quantikz}
    
    % Householder direct sum
    \begin{quantikz}[row sep=.4cm, column sep=.55cm]
    \lstick{$\ket{0^3}$} & \gate{H(v_j)} & \rstick{$x_j^3\ket0+\ket{\perp_j}$} \qw \\
    \lstick{$\ket j$}    & \ctrl{-1}     & \qw
    \end{quantikz}
    English proof LaTeX
    \paragraph{Proof.}
    For arbitrary n, Lean constructs exact rational branch vectors using the four-square theorem, forms a controlled direct sum of Householder matrices, proves rational orthogonality, and proves the clean block equals D_n with alpha=1.
    \begin{enumerate}
      \item The target is diag((j/2^n)^3), not one sampled n=2 matrix.
      \item Four-square witnesses close exact normalization for every branch.
      \item The final conjunction proves orthogonality, clean block, alpha, and logical resource record.
    \end{enumerate}
    Each advertised certificate is the named Lean declaration linked on this page.
    Lean declaration retrieval block
    import QuantumBlockEncoding
    
    #check QuantumBlockEncoding.CubicDiagonalOracle.cubicDiagonalRationalCompletion_exists
    #check QuantumBlockEncoding.CubicDiagonalOracle.cubicDiagonalHouseholderExactBEContract_clean_eq_target
    #check QuantumBlockEncoding.CubicDiagonalOracle.cubicDiagonalHouseholderExactBEContract_complete
    Show the complete Lean certificate list

    Open this when you want to inspect every declaration linked to the case.

    Proof authority

    Named Lean certificates

    These declarations, compiled by the current Lean gate, support the mathematical and resource claims above.

    Optional executable checks and outputs

    Executable verification and exports

    Checking and artifact selection are independent. A user may screen with Qiskit, OpenQASM round-trip, both, or neither, then request a different set of output files.

    Backend / artifactRoleStatusEvidence
    Internal canonical evaluatorReference semantics for primitive canonical IRopenmetrics manifest
    Qiskit OperatorGate-by-gate numerical screeningartifact availabletools/export_hard_cubic_householder.py
    OpenQASM 3 round-tripStrict serialization, import, and semantic replaynot recordedQASM and report when generated
    Lean certificateExact proof authority at the page's stated semantic tierpassed3 named root(s)

    Instantiates the symbolic Lean construction for Qiskit/OpenQASM use. Finite numerical output is diagnostic only.

    Current runnable artifact
    tools/export_hard_cubic_householder.py
    Command
    python3 tools/export_hard_cubic_householder.py --task QBE-HARD-CUBIC-DIAGONAL-HIER-COLD-001
    Trust boundary. Fast executable checks may reject, rank, or queue a route for formalization. Floating-point tolerances do not replace the exact Lean roots above; an external exact certificate contributes only after a Lean checker verifies it.
    Source
    ASPBE BE Case 2 cold route
    Contributor
    ASPBE authors
    Current boundary
    The logical Householder resource is not a primitive {u,cx} decomposition or an optimality theorem.