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

Lean source module

QuantumBlockEncoding/CircuitSemantics.lean

41 explicit public declarations in source order.

Back to Library Explorer

def · line 16

QuantumBlockEncoding.qubitDim

Compiled Compiled

This definition gives the library's named construction or computation for “qubit dim”. A finite-dimensional basis size for an 'n'-qubit register.

def qubitDim (qubits : Nat) : Nat :=
  gridSize qubits

/--
Structured semantic obligation for the matrix layer.

This mirrors `GHL2025.ObligationRecord` without importing `GHL2025`, so the
semantics backend can stay below paper-specific files in the import graph.
-/

commit-pinned source · Verso Blueprint panel

structure · line 25

QuantumBlockEncoding.SemanticObligation

Compiled Partial route

This record groups the data and proof fields needed for “semantic obligation”. A proposition-valued field is a requirement until a constructor supplies it. Structured semantic obligation for the matrix layer.

structure SemanticObligation where
  description : String
  source : String
  proved : Bool := false
deriving Repr, DecidableEq

/--
One gate together with its matrix on the full `qubits`-qubit Hilbert space.
The matrix is supplied by a lower-level certificate for the gate family.
-/

commit-pinned source · Verso Blueprint panel

structure · line 35

QuantumBlockEncoding.GateMatrix

Compiled Partial route

This record groups the data and proof fields needed for “gate matrix”. A proposition-valued field is a requirement until a constructor supplies it. One gate together with its matrix on the full 'qubits'-qubit Hilbert space.

structure GateMatrix (α : Type u) (qubits : Nat) where
  gate : Gate
  matrix : Matrix (qubitDim qubits) (qubitDim qubits) α
  unitary : SemanticObligation

/-- Check that a list of gate matrices labels exactly the same circuit gates. -/

commit-pinned source · Verso Blueprint panel

def · line 41

QuantumBlockEncoding.gateMatricesMatchCircuit

Compiled Compiled

This definition gives the library's named construction or computation for “gate matrices match circuit”. Check that a list of gate matrices labels exactly the same circuit gates.

def gateMatricesMatchCircuit {α : Type u} {qubits : Nat} :
    Circuit → List (GateMatrix α qubits) → Bool
  | [], [] => true
  | gate :: circuitTail, gateMatrix :: matrixTail =>
      gateMatrix.gate == gate && gateMatricesMatchCircuit circuitTail matrixTail
  | _, _ => false

/--
Evaluate a list of full-space gate matrices to a circuit matrix.

The fold uses the usual right-action convention for a circuit list

commit-pinned source · Verso Blueprint panel

def · line 54

QuantumBlockEncoding.evalGateMatrices

Compiled Compiled

This definition gives the library's named construction or computation for “eval gate matrices”. Evaluate a list of full-space gate matrices to a circuit matrix.

def evalGateMatrices {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α] {qubits : Nat}
    (gates : List (GateMatrix α qubits)) :
    Matrix (qubitDim qubits) (qubitDim qubits) α :=
  gates.foldl (fun acc gateMatrix => Matrix.mul gateMatrix.matrix acc)
    (Matrix.identity (qubitDim qubits) α)

commit-pinned source · Verso Blueprint panel

theorem · line 71

QuantumBlockEncoding.Matrix.evalWith_foldl_add_mul

Compiled Compiled

Lean checks the proposition indexed as “eval with foldl add mul”; the hypotheses and conclusion in the code panel fix its exact scope. Evaluate one symbolic matrix-product entry as a concrete finite Rat fold.

theorem evalWith_foldl_add_mul
    (env : String → Rat) {rows mid cols : Nat}
    (A : Matrix rows mid Coeff) (B : Matrix mid cols Coeff)
    (i : Fin rows) (j : Fin cols) (ks : List (Fin mid)) (acc : Coeff) :
    Coeff.evalWith env
        (ks.foldl (fun acc k => acc + A i k * B k j) acc) =
      ks.foldl
        (fun acc k => acc + Coeff.evalWith env (A i k) *
          Coeff.evalWith env (B k j))
        (Coeff.evalWith env acc) := by

commit-pinned source · Verso Blueprint panel

theorem · line 92

QuantumBlockEncoding.Matrix.evalWith_mul_apply

Compiled Compiled

Lean checks the proposition indexed as “eval with mul apply”; the hypotheses and conclusion in the code panel fix its exact scope. Evaluate one entry of 'Matrix.mul' by evaluating each path contribution.

theorem evalWith_mul_apply
    (env : String → Rat) {rows mid cols : Nat}
    (A : Matrix rows mid Coeff) (B : Matrix mid cols Coeff)
    (i : Fin rows) (j : Fin cols) :
    Coeff.evalWith env (Matrix.mul A B i j) =
      (List.finRange mid).foldl
        (fun acc k => acc + Coeff.evalWith env (A i k) *
          Coeff.evalWith env (B k j))
        0 := by

commit-pinned source · Verso Blueprint panel

theorem · line 131

QuantumBlockEncoding.Matrix.evalWith_mul_eq_zero_of_all_paths_zero

Compiled Compiled

Lean checks the proposition indexed as “eval with mul eq zero of all paths zero”; the hypotheses and conclusion in the code panel fix its exact scope. Evaluate one matrix-product entry as zero when every evaluated path contribution is zero.

theorem evalWith_mul_eq_zero_of_all_paths_zero
    (env : String → Rat) {rows mid cols : Nat}
    (A : Matrix rows mid Coeff) (B : Matrix mid cols Coeff)
    (i : Fin rows) (j : Fin cols)
    (hzero : ∀ k : Fin mid,
      Coeff.evalWith env (A i k) * Coeff.evalWith env (B k j) = 0) :
    Coeff.evalWith env (Matrix.mul A B i j) = 0 := by

commit-pinned source · Verso Blueprint panel

theorem · line 304

QuantumBlockEncoding.Matrix.evalWith_mul_unique_path

Compiled Compiled

Lean checks the proposition indexed as “eval with mul unique path”; the hypotheses and conclusion in the code panel fix its exact scope. Evaluate one matrix-product entry when all evaluated paths except 'k0' vanish.

theorem evalWith_mul_unique_path
    (env : String → Rat) {rows mid cols : Nat}
    (A : Matrix rows mid Coeff) (B : Matrix mid cols Coeff)
    (i : Fin rows) (j : Fin cols) (k0 : Fin mid)
    (hzero : ∀ k : Fin mid, k ≠ k0 →
      Coeff.evalWith env (A i k) * Coeff.evalWith env (B k j) = 0) :
    Coeff.evalWith env (Matrix.mul A B i j) =
      Coeff.evalWith env (A i k0) * Coeff.evalWith env (B k0 j) := by

commit-pinned source · Verso Blueprint panel

theorem · line 328

QuantumBlockEncoding.Matrix.evalWith_mul_two_path

Compiled Compiled

Lean checks the proposition indexed as “eval with mul two path”; the hypotheses and conclusion in the code panel fix its exact scope. Evaluate one matrix-product entry when all evaluated paths except 'k0' and 'k1' vanish.

theorem evalWith_mul_two_path
    (env : String → Rat) {rows mid cols : Nat}
    (A : Matrix rows mid Coeff) (B : Matrix mid cols Coeff)
    (i : Fin rows) (j : Fin cols) (k0 k1 : Fin mid)
    (hk0_ne_k1 : k0 ≠ k1)
    (hzero : ∀ k : Fin mid, k ≠ k0 → k ≠ k1 →
      Coeff.evalWith env (A i k) * Coeff.evalWith env (B k j) = 0) :
    Coeff.evalWith env (Matrix.mul A B i j) =
      Coeff.evalWith env (A i k0) * Coeff.evalWith env (B k0 j) +
      Coeff.evalWith env (A i k1) * Coeff.evalWith env (B k1 j) := by

commit-pinned source · Verso Blueprint panel

theorem · line 355

QuantumBlockEncoding.Matrix.evalWith_mul_identity_right_apply

Compiled Compiled

Lean checks the proposition indexed as “eval with mul identity right apply”; the hypotheses and conclusion in the code panel fix its exact scope. Evaluating a symbolic matrix after multiplying on the right by the identity recovers the evaluated entry.

theorem evalWith_mul_identity_right_apply
    (env : String → Rat) {n : Nat}
    (A : Matrix n n Coeff) (i j : Fin n) :
    Coeff.evalWith env (Matrix.mul A (Matrix.identity n Coeff) i j) =
      Coeff.evalWith env (A i j) := by

commit-pinned source · Verso Blueprint panel

theorem · line 371

QuantumBlockEncoding.Matrix.cast_square_apply

Compiled Compiled

Lean checks the proposition indexed as “cast square apply”; the hypotheses and conclusion in the code panel fix its exact scope. Entry-level bridge for square matrix casts along a dimension equality.

theorem cast_square_apply {α : Type u} {m n : Nat} (h : m = n)
    (M : Matrix m m α) (i j : Fin n) :
    (((cast (by rw [h]) M) : Matrix n n α) i j) =
      M ⟨i.val, by subst h; exact i.isLt⟩
        ⟨j.val, by subst h; exact j.isLt⟩ := by

commit-pinned source · Verso Blueprint panel

theorem · line 389

QuantumBlockEncoding.evalWith_evalGateMatrices_single

Compiled Compiled

Lean checks the proposition indexed as “eval with eval gate matrices single”; the hypotheses and conclusion in the code panel fix its exact scope. Evaluation-level single-gate reduction for 'evalGateMatrices'.

theorem evalWith_evalGateMatrices_single
    (env : String → Rat) {qubits : Nat}
    (gateMatrix : GateMatrix Coeff qubits)
    (i j : Fin (qubitDim qubits)) :
    Coeff.evalWith env ((evalGateMatrices [gateMatrix]) i j) =
      Coeff.evalWith env (gateMatrix.matrix i j) := by

commit-pinned source · Verso Blueprint panel

structure · line 404

QuantumBlockEncoding.CircuitMatrixSemantics

Compiled Partial route

This record groups the data and proof fields needed for “circuit matrix semantics”. A proposition-valued field is a requirement until a constructor supplies it. Circuit-level matrix semantics assembled from gate-level matrices.

structure CircuitMatrixSemantics (α : Type u) [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α] (qubits : Nat) where
  circuit : Circuit
  gateMatrices : List (GateMatrix α qubits)
  gateListMatches : gateMatricesMatchCircuit circuit gateMatrices = true
  matrix : Matrix (qubitDim qubits) (qubitDim qubits) α
  matrix_eq_eval : Matrix.PointwiseEq matrix (evalGateMatrices gateMatrices)

commit-pinned source · Verso Blueprint panel

def · line 415

QuantumBlockEncoding.CircuitMatrixSemantics.ofGateMatrices

Compiled Compiled

This definition gives the library's named construction or computation for “of gate matrices”. Build circuit semantics directly from aligned gate matrices.

def ofGateMatrices {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α] {qubits : Nat}
    (circuit : Circuit) (gateMatrices : List (GateMatrix α qubits))
    (h : gateMatricesMatchCircuit circuit gateMatrices = true) :
    CircuitMatrixSemantics α qubits where
  circuit := circuit
  gateMatrices := gateMatrices
  gateListMatches := h
  matrix := evalGateMatrices gateMatrices
  matrix_eq_eval := by intro _ _; rfl

commit-pinned source · Verso Blueprint panel

structure · line 436

QuantumBlockEncoding.PreparedCircuitEntryTarget

Compiled Partial route

This record groups the data and proof fields needed for “prepared circuit entry target”. A proposition-valued field is a requirement until a constructor supplies it. Typed target for relating an active circuit-matrix entry to a prepared composition entry.

structure PreparedCircuitEntryTarget
    (α : Type u) (activeDim preparedDim : Nat) where
  activeMatrix : Matrix activeDim activeDim α
  preparedMatrix : Matrix preparedDim preparedDim α
  activeRow : Fin activeDim
  activeCol : Fin activeDim
  preparedRow : Fin preparedDim
  preparedCol : Fin preparedDim
  activeEntry : α
  activeEntry_eq : activeEntry = activeMatrix activeRow activeCol
  preparedEntry : α

commit-pinned source · Verso Blueprint panel

def · line 454

QuantumBlockEncoding.PreparedCircuitEntryTarget.entryEqualityStatement

Compiled Compiled

This definition gives the library's named construction or computation for “entry equality statement”. The prepared-composition equality required by the target.

def entryEqualityStatement {α : Type u} {activeDim preparedDim : Nat}
    (target : PreparedCircuitEntryTarget α activeDim preparedDim) : Prop :=
  target.activeEntry = target.preparedEntry

/-- The same equality stated directly on the backing matrices. -/

commit-pinned source · Verso Blueprint panel

def · line 459

QuantumBlockEncoding.PreparedCircuitEntryTarget.matrixEntryEqualityStatement

Compiled Compiled

This definition gives the library's named construction or computation for “matrix entry equality statement”. The same equality stated directly on the backing matrices.

def matrixEntryEqualityStatement {α : Type u} {activeDim preparedDim : Nat}
    (target : PreparedCircuitEntryTarget α activeDim preparedDim) : Prop :=
  target.activeMatrix target.activeRow target.activeCol =
    target.preparedMatrix target.preparedRow target.preparedCol

/--
The cached entry equality is equivalent to the backing matrix-entry equality.

Paper-specific targets can prove whichever side their local backend exposes
without changing the semantic obligation being tracked.
-/

commit-pinned source · Verso Blueprint panel

theorem · line 470

QuantumBlockEncoding.PreparedCircuitEntryTarget.entryEqualityStatement_iff_matrixEntryEqualityStatement

Compiled Compiled

Lean checks the proposition indexed as “entry equality statement iff matrix entry equality statement”; the hypotheses and conclusion in the code panel fix its exact scope. The cached entry equality is equivalent to the backing matrix-entry equality.

theorem entryEqualityStatement_iff_matrixEntryEqualityStatement
    {α : Type u} {activeDim preparedDim : Nat}
    (target : PreparedCircuitEntryTarget α activeDim preparedDim) :
    target.entryEqualityStatement ↔
      target.matrixEntryEqualityStatement := by

commit-pinned source · Verso Blueprint panel

structure · line 502

QuantumBlockEncoding.BlockExtractionTarget

Compiled Partial route

This record groups the data and proof fields needed for “block extraction target”. A proposition-valued field is a requirement until a constructor supplies it. A paper-level block-extraction target against a concrete circuit matrix.

structure BlockExtractionTarget (α : Type u) [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    (rows cols signalDim : Nat) where
  unitaryMatrix : Matrix (signalDim * rows) (signalDim * cols) α
  targetMatrix : Matrix rows cols α
  normalizer : α
  signalIndex : Fin signalDim
  blockMatrix : Matrix rows cols α
  blockProjection : SemanticObligation
  blockCorrect : SemanticObligation

commit-pinned source · Verso Blueprint panel

def · line 520

QuantumBlockEncoding.blockExtractionBranchContributionSum

Compiled Compiled

This definition gives the library's named construction or computation for “block extraction branch contribution sum”. Fold a finite family of branch contributions into one projected block entry.

def blockExtractionBranchContributionSum {α : Type u} [OfNat α 0]
    [HAdd α α α] {branchDim : Nat}
    (branchContribution : Fin branchDim → α) : α :=
  (List.finRange branchDim).foldl
    (fun acc branch => acc + branchContribution branch) 0

/--
Typed interface for decomposing one block-extracted matrix entry into finite
branch contributions.

The interface records the candidate contribution family and the exact

commit-pinned source · Verso Blueprint panel

structure · line 535

QuantumBlockEncoding.BlockExtractionBranchContributionTarget

Compiled Partial route

This record groups the data and proof fields needed for “block extraction branch contribution target”. A proposition-valued field is a requirement until a constructor supplies it. Typed interface for decomposing one block-extracted matrix entry into finite branch contributions.

structure BlockExtractionBranchContributionTarget
    (α : Type u) [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    (rows cols signalDim branchDim : Nat) where
  extractionTarget : BlockExtractionTarget α rows cols signalDim
  systemRow : Fin rows
  systemCol : Fin cols
  selectedBranch : Fin branchDim
  branchContribution : Fin branchDim → α
  selectedContribution : α
  selectedContribution_eq :

commit-pinned source · Verso Blueprint panel

def · line 559

QuantumBlockEncoding.BlockExtractionBranchContributionTarget.selectedBranchStatement

Compiled Compiled

This definition gives the library's named construction or computation for “selected branch statement”. The selected-branch identity exposed by the target.

def selectedBranchStatement {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    {rows cols signalDim branchDim : Nat}
    (target :
      BlockExtractionBranchContributionTarget α rows cols signalDim branchDim) :
    Prop :=
  target.selectedContribution =
    target.branchContribution target.selectedBranch

/-- The projection/summation theorem still required for the target. -/

commit-pinned source · Verso Blueprint panel

def · line 569

QuantumBlockEncoding.BlockExtractionBranchContributionTarget.projectionSummationStatement

Compiled Compiled

This definition gives the library's named construction or computation for “projection summation statement”. The projection/summation theorem still required for the target.

def projectionSummationStatement {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    {rows cols signalDim branchDim : Nat}
    (target :
      BlockExtractionBranchContributionTarget α rows cols signalDim branchDim) :
    Prop :=
  target.blockEntry = target.branchSum

/--
The backend expansion theorem needed to close `projectionSummationStatement`.

commit-pinned source · Verso Blueprint panel

def · line 586

QuantumBlockEncoding.BlockExtractionBranchContributionTarget.backendExpansionStatement

Compiled Compiled

This definition gives the library's named construction or computation for “backend expansion statement”. The backend expansion theorem needed to close 'projectionSummationStatement'.

def backendExpansionStatement {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    {rows cols signalDim branchDim : Nat}
    (target :
      BlockExtractionBranchContributionTarget α rows cols signalDim branchDim) :
    Prop :=
  target.extractionTarget.blockMatrix target.systemRow target.systemCol =
    blockExtractionBranchContributionSum target.branchContribution

commit-pinned source · Verso Blueprint panel

theorem · line 595

QuantumBlockEncoding.BlockExtractionBranchContributionTarget.selectedBranchStatement_of_eq

Compiled Compiled

Lean checks the proposition indexed as “selected branch statement of eq”; the hypotheses and conclusion in the code panel fix its exact scope.

theorem selectedBranchStatement_of_eq {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    {rows cols signalDim branchDim : Nat}
    (target :
      BlockExtractionBranchContributionTarget α rows cols signalDim branchDim) :
    target.selectedBranchStatement := by

commit-pinned source · Verso Blueprint panel

theorem · line 603

QuantumBlockEncoding.BlockExtractionBranchContributionTarget.projectionSummationStatement_iff_backendExpansionStatement

Compiled Compiled

Lean checks the proposition indexed as “projection summation statement iff backend expansion statement”; the hypotheses and conclusion in the code panel fix its exact scope.

theorem projectionSummationStatement_iff_backendExpansionStatement
    {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    {rows cols signalDim branchDim : Nat}
    (target :
      BlockExtractionBranchContributionTarget α rows cols signalDim branchDim) :
    target.projectionSummationStatement ↔
      target.backendExpansionStatement := by

commit-pinned source · Verso Blueprint panel

theorem · line 629

QuantumBlockEncoding.BlockExtractionBranchContributionTarget.projectionSummationStatement_of_backendExpansionStatement

Compiled Compiled

Lean checks the proposition indexed as “projection summation statement of backend expansion statement”; the hypotheses and conclusion in the code panel fix its exact scope.

theorem projectionSummationStatement_of_backendExpansionStatement
    {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    {rows cols signalDim branchDim : Nat}
    (target :
      BlockExtractionBranchContributionTarget α rows cols signalDim branchDim)
    (hexpansion : target.backendExpansionStatement) :
    target.projectionSummationStatement :=
  (projectionSummationStatement_iff_backendExpansionStatement target).2
    hexpansion

commit-pinned source · Verso Blueprint panel

theorem · line 640

QuantumBlockEncoding.BlockExtractionBranchContributionTarget.backendExpansionStatement_of_projectionSummationStatement

Compiled Compiled

Lean checks the proposition indexed as “backend expansion statement of projection summation statement”; the hypotheses and conclusion in the code panel fix its exact scope.

theorem backendExpansionStatement_of_projectionSummationStatement
    {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    {rows cols signalDim branchDim : Nat}
    (target :
      BlockExtractionBranchContributionTarget α rows cols signalDim branchDim)
    (hprojection : target.projectionSummationStatement) :
    target.backendExpansionStatement :=
  (projectionSummationStatement_iff_backendExpansionStatement target).1
    hprojection

commit-pinned source · Verso Blueprint panel

structure · line 661

QuantumBlockEncoding.CircuitBlockEncodingClaim

Compiled Partial route

This record groups the data and proof fields needed for “circuit block encoding claim”. A proposition-valued field is a requirement until a constructor supplies it. A circuit-level block encoding claim bundling a circuit matrix semantics with a block extraction target and a dimension compatibility proof.

structure CircuitBlockEncodingClaim (α : Type u) [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    (qubits : Nat) (dim signalDim : Nat) where
  semantics : CircuitMatrixSemantics α qubits
  target : BlockExtractionTarget α dim dim signalDim
  dimCompat : qubitDim qubits = signalDim * dim
  blockCorrect : SemanticObligation

/--
Typed contract for a finite-dimensional LCU/block-composition step.

commit-pinned source · Verso Blueprint panel

structure · line 676

QuantumBlockEncoding.FiniteBlockCompositionContract

Compiled Partial route

This record groups the data and proof fields needed for “finite block composition contract”. A proposition-valued field is a requirement until a constructor supplies it. Typed contract for a finite-dimensional LCU/block-composition step.

structure FiniteBlockCompositionContract (α : Type u) [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    (qubits dim signalDim : Nat) where
  sourceAnchor : String
  lcuSourceAnchor : String
  theoremAnchor : String
  claim : CircuitBlockEncodingClaim α qubits dim signalDim
  expectedTarget : BlockExtractionTarget α dim dim signalDim
  targetMatrix : Matrix dim dim α
  normalizer : α
  claimTargetMatches : claim.target = expectedTarget

commit-pinned source · Verso Blueprint panel

def · line 696

QuantumBlockEncoding.signalSystemBlockRowIndex

Compiled Compiled

This definition gives the library's named construction or computation for “signal system block row index”. Compound row index for a signal value and a system-row index.

def signalSystemBlockRowIndex (rows : Nat) (signalIdx systemIdx : Nat) : Nat :=
  signalIdx * rows + systemIdx

/-- Compound column index for a signal value and a system-column index. -/

commit-pinned source · Verso Blueprint panel

def · line 700

QuantumBlockEncoding.signalSystemBlockColIndex

Compiled Compiled

This definition gives the library's named construction or computation for “signal system block col index”. Compound column index for a signal value and a system-column index.

def signalSystemBlockColIndex (cols : Nat) (signalIdx systemIdx : Nat) : Nat :=
  signalIdx * cols + systemIdx

commit-pinned source · Verso Blueprint panel

theorem · line 703

QuantumBlockEncoding.signalSystemBlockRowIndex_zero

Compiled Compiled

Lean checks the proposition indexed as “signal system block row index zero”; the hypotheses and conclusion in the code panel fix its exact scope.

@[simp] theorem signalSystemBlockRowIndex_zero (rows systemIdx : Nat) :
    signalSystemBlockRowIndex rows 0 systemIdx = systemIdx := by

commit-pinned source · Verso Blueprint panel

theorem · line 707

QuantumBlockEncoding.signalSystemBlockColIndex_zero

Compiled Compiled

Lean checks the proposition indexed as “signal system block col index zero”; the hypotheses and conclusion in the code panel fix its exact scope.

@[simp] theorem signalSystemBlockColIndex_zero (cols systemIdx : Nat) :
    signalSystemBlockColIndex cols 0 systemIdx = systemIdx := by

commit-pinned source · Verso Blueprint panel

theorem · line 712

QuantumBlockEncoding.signalSystemBlockRowIndex_lt

Compiled Compiled

Lean checks the proposition indexed as “signal system block row index lt”; the hypotheses and conclusion in the code panel fix its exact scope. The row compound index stays inside a signal × row matrix.

theorem signalSystemBlockRowIndex_lt {signalDim rows : Nat}
    (signalIdx : Fin signalDim) (i : Fin rows) :
    signalSystemBlockRowIndex rows signalIdx.val i.val < signalDim * rows := by

commit-pinned source · Verso Blueprint panel

theorem · line 727

QuantumBlockEncoding.signalSystemBlockColIndex_lt

Compiled Compiled

Lean checks the proposition indexed as “signal system block col index lt”; the hypotheses and conclusion in the code panel fix its exact scope. The column compound index stays inside a signal × column matrix.

theorem signalSystemBlockColIndex_lt {signalDim cols : Nat}
    (signalIdx : Fin signalDim) (j : Fin cols) :
    signalSystemBlockColIndex cols signalIdx.val j.val < signalDim * cols := by

commit-pinned source · Verso Blueprint panel

def · line 753

QuantumBlockEncoding.signalSystemBlockProjection

Compiled Compiled

This definition gives the library's named construction or computation for “signal system block projection”. Block projection: extract the '(signalIdx, signalIdx)' block from a signal × system matrix.

def signalSystemBlockProjection {α : Type u} [OfNat α 0]
    (signalDim rows cols : Nat)
    (M : Matrix (signalDim * rows) (signalDim * cols) α)
    (signalIdx : Fin signalDim) :
    Matrix rows cols α :=
  fun i j =>
    M ⟨signalSystemBlockRowIndex rows signalIdx.val i.val,
        signalSystemBlockRowIndex_lt signalIdx i⟩
      ⟨signalSystemBlockColIndex cols signalIdx.val j.val,
        signalSystemBlockColIndex_lt signalIdx j⟩

commit-pinned source · Verso Blueprint panel

theorem · line 764

QuantumBlockEncoding.signalSystemBlockProjection_apply

Compiled Compiled

Lean checks the proposition indexed as “signal system block projection apply”; the hypotheses and conclusion in the code panel fix its exact scope.

@[simp] theorem signalSystemBlockProjection_apply {α : Type u} [OfNat α 0]
    {signalDim rows cols : Nat}
    (M : Matrix (signalDim * rows) (signalDim * cols) α)
    (signalIdx : Fin signalDim) (i : Fin rows) (j : Fin cols) :
    signalSystemBlockProjection signalDim rows cols M signalIdx i j =
      M ⟨signalSystemBlockRowIndex rows signalIdx.val i.val,
          signalSystemBlockRowIndex_lt signalIdx i⟩
        ⟨signalSystemBlockColIndex cols signalIdx.val j.val,
          signalSystemBlockColIndex_lt signalIdx j⟩ := rfl

/--

commit-pinned source · Verso Blueprint panel

def · line 778

QuantumBlockEncoding.totalCircuitQubits

Compiled Compiled

This definition gives the library's named construction or computation for “total circuit qubits”. Total qubits needed for a circuit operating on 'system' system qubits and 'signal' signal qubits.

def totalCircuitQubits (system signal : Nat) : Nat :=
  system + signal

/--
Build a BlockExtractionTarget from a CircuitMatrixSemantics by computing
the block projection. The circuit matrix is square with dimension
`signalDim * dim`, and we extract the `(signalIdx, signalIdx)` block.
-/

commit-pinned source · Verso Blueprint panel

def · line 786

QuantumBlockEncoding.CircuitMatrixSemantics.blockExtractionTarget

Compiled Compiled

This definition gives the library's named construction or computation for “block extraction target”. Build a BlockExtractionTarget from a CircuitMatrixSemantics by computing the block projection.

def CircuitMatrixSemantics.blockExtractionTarget
    {α : Type u} [OfNat α 0] [OfNat α 1]
    [HAdd α α α] [HMul α α α]
    {qubits : Nat}
    (sem : CircuitMatrixSemantics α qubits)
    (dim signalDim : Nat)
    (hDim : qubitDim qubits = signalDim * dim)
    (targetMatrix : Matrix dim dim α)
    (normalizer : α)
    (signalIdx : Fin signalDim) :
    BlockExtractionTarget α dim dim signalDim where

commit-pinned source · Verso Blueprint panel