Trusted cost annotations #
This module connects Lean-QuantumAlg theorem endpoints to a small trusted cost
interface. A value of Timed α returns an object of type α and carries a
trusted natural-number cost annotation.
The cost annotation is intentionally not derived from the Lean evaluator or from
matrix dimensions. Correctness is proved on .ret, while .time records the
selected model. In the current quantum algorithm bridge, one unit means one
oracle query for the single-query Walsh-Hadamard algorithms, and one
good/bad-plane iterate for amplitude amplification and Grover.
This is an operator-level bridge over the existing pure-state and gate semantics. Fuller quantum program logics, such as density-operator or Hoare-style semantics for quantum while programs, are future extensions rather than prerequisites for this TimeM layer.
A computation result paired with a natural-number cost.
- ret : α
The trusted return value.
- time : ℕ
The trusted cost annotation.
Instances For
Attach a trusted cost to a return value.
Equations
- QuantumAlg.Timed.trusted cost ret = { ret := ret, time := cost }
Instances For
A trusted resource profile for registered theorem endpoints.
The fields are intentionally lightweight counters. They record the resource model claimed beside a correctness theorem, not a derivation from Lean evaluation.
- oracleQueries : ℕ
Number of oracle queries.
- hadamardGates : ℕ
Number of Hadamard gates.
- elementaryGates : ℕ
Number of non-oracle elementary gates.
- classicalOps : ℕ
Number of trusted classical operations.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The empty resource profile.
Equations
- QuantumAlg.ResourceProfile.zero = { oracleQueries := 0, hadamardGates := 0, elementaryGates := 0, classicalOps := 0 }
Instances For
Sequential composition adds every resource counter.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tensor/parallel circuit composition uses the same additive counters.
Equations
- left.tensor right = left.sequential right
Instances For
Exact counter claim used by supporting public theorem statements.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Exact fixed-circuit gate-count claim.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A return value paired with a trusted resource profile.
- ret : α
The returned value.
- resources : ResourceProfile
Trusted resource accounting attached to the value.
Instances For
Attach a trusted resource profile to a return value.
Equations
- QuantumAlg.Profiled.trusted resources ret = { ret := ret, resources := resources }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Exact communication-resource claim for protocol supporting theorems.
Equations
- profile.HasExactCounts classicalBits transmittedQubits bellPairs = (profile.classicalBits = classicalBits ∧ profile.transmittedQubits = transmittedQubits ∧ profile.bellPairs = bellPairs)