Grover iterate
DefinitiongroverIterateOne step of Grover's algorithm: the diffusion operator applied after the oracle, G = (2|s><s| - I)(I - 2|w0><w0|).
import Mathlib
import Definitions.Def_oracle
import Definitions.Def_diffusion
namespace Grover
/-- One step of Grover's algorithm: the diffusion operator applied after the oracle,
`G = (2|s⟩⟨s| - I)(I - 2|w0⟩⟨w0|)`. -/
noncomputable def groverIterate {N : ℕ} (w0 : Fin N) :
EuclideanSpace ℂ (Fin N) →L[ℂ] EuclideanSpace ℂ (Fin N) :=
diffusion N ∘L oracle w0
end Grover
Read-back
What the Lean code literally says, in plain math · claude-sonnet-5
For an implicit natural number and an explicit index (again, the type of forces implicitly), groverIterate w0 is defined as the composition of the continuous linear maps diffusion N and oracle w0, applied in the order "first oracle w0, then diffusion N" (i.e. for , groverIterate w0 diffusion Noracle w0). Unwinding both definitions: writing oracle w0, so and for , the result is where uniformSuperposition N and . No further hypotheses on or beyond their types are imposed, and the same junk-value conventions for and division apply as in the two component definitions.
Confirmed by the mission captain (proposal self-audit).