Robust Blind Verification
Package documentation
Docs for package
RobustBlindVerification.c_iterator
— Methodc_iterator(N)
Create a circular iterator that generates numbers from 0 to `N-1`.
# Arguments
- `N`: The upper limit for the circular iterator.
# Returns
A circular iterator that generates numbers from 0 to `N-1`.
# Examples
```julia
# Create a circular iterator
N = 5
iterator = c_iterator(N)
```
RobustBlindVerification.c_shift_index
— Methodc_shift_index(n::Int)
Compute the shifted index `n-1` for circular indexing.
# Arguments
- `n::Int`: The input index.
# Returns
The shifted index `n-1` for circular indexing.
# Examples
```julia
# Compute the shifted index
n = 3
shifted_index = c_shift_index(n)
```
RobustBlindVerification.compute_angle_δᵥ
— MethodComputation of δᵥ Case
- Round ≡ Computation ∩ Qubit ∈ Input set → δᵥ = ϕᵥ + (θᵥ + xᵥπ) + rᵥπ
RobustBlindVerification.compute_angle_δᵥ
— MethodComputation of δᵥ Case
- Round ≡ Computation ∩ Qubit ∉ Input set → δᵥ = ϕᵥ′ + θᵥ + rᵥπ
RobustBlindVerification.compute_angle_δᵥ
— MethodMBQC compute updated angle
RobustBlindVerification.compute_angle_δᵥ
— MethodComputation of δᵥ Case
- Round ≡ Test ∩ Qubit ≡ Dummy → δᵥ = {kπ/r | k ∼ U(0..7)}
RobustBlindVerification.compute_angle_δᵥ
— MethodComputation of δᵥ Case
- Round ≡ Test ∩ Qubit ≡ Trap → δᵥ = θᵥ + rᵥπ
RobustBlindVerification.draw_bit
— MethodDraw random bit 0 or 1
RobustBlindVerification.draw_dᵥ
— MethodDraw random bit 0 or 1 for dummy
RobustBlindVerification.draw_rᵥ
— MethodDraw random bit 0 or 1 for trap
RobustBlindVerification.draw_θᵥ
— MethodFor draw θ a multiple of kπ/4, k ∈ 0..7
RobustBlindVerification.generate_random_greedy_color
— MethodUse Graphs.randomgreedycolor(g, reps) -> Graphs.Coloring{Int64} Uses a greedy approximation to get a colouring of a graph
RobustBlindVerification.get_edge_iterator
— Methodget_edge_iterator(resource::MBQCResourceState)
Retrieve an iterator over the edges in an MBQC resource state.
# Arguments
- `resource::MBQCResourceState`: An MBQC resource state containing the graph representation of the resource.
# Returns
An iterator over the edges of the resource state's graph.
# Examples
```julia
# Create an MBQC resource state
graph = MBQCGraph(...)
flow = MBQCFlow(...)
angles = MBQCAngles(...)
resource = MBQCResourceState(graph, flow, angles)
# Get the edge iterator
edge_iterator = get_edge_iterator(resource)
```
RobustBlindVerification.get_number_vertices
— Methodget_number_qubits(resource::MBQCResourceState)
Retrieve the number of qubits in an MBQC resource state.
# Arguments
- `resource::MBQCResourceState`: An MBQC resource state containing the graph representation of the resource.
# Returns
The number of qubits in the resource state.
# Examples
```julia
# Create an MBQC resource state
graph = MBQCGraph(...)
flow = MBQCFlow(...)
angles = MBQCAngles(...)
resource = MBQCResourceState(graph, flow, angles)
# Get the number of qubits
num_qubits = get_number_qubits(resource)
```
RobustBlindVerification.get_random_coloring
— MethodExtracts from Vector{Vector{Int64}} -> Vector{Int64} Draw uniform one colouring arangments
RobustBlindVerification.get_vertex_iterator
— Methodget_vertex_iterator(resource::MBQCResourceState)
Retrieve an iterator over the vertices in an MBQC resource state.
# Arguments
- `resource::MBQCResourceState`: An MBQC resource state containing the graph representation of the resource.
# Returns
An iterator over the vertices of the resource state's graph.
# Examples
```julia
# Create an MBQC resource state
graph = MBQCGraph(...)
flow = MBQCFlow(...)
angles = MBQCAngles(...)
resource = MBQCResourceState(graph, flow, angles)
# Get the vertex iterator
vertex_iterator = get_vertex_iterator(resource)
```
RobustBlindVerification.get_vertex_neighbours
— Methodget_vertex_neighbours(resource::MBQCResourceState, vertex)
Retrieve the neighbors of a given vertex in an MBQC resource state.
# Arguments
- `resource::MBQCResourceState`: An MBQC resource state containing the graph representation of the resource.
- `vertex`: The vertex for which to retrieve the neighbors.
# Returns
An array of vertices representing the neighbors of the specified vertex.
# Examples
```julia
# Create an MBQC resource state
graph = MBQCGraph(...)
flow = MBQCFlow(...)
angles = MBQCAngles(...)
resource = MBQCResourceState(graph, flow, angles)
# Get the neighbors of a vertex
vertex = 1
neighbors = get_vertex_neighbours(resource, vertex)
```
RobustBlindVerification.init_plus_phase_state!
— MethodplusState(qureg, qᵢ)
Applies a Hadamard gate (|+⟩) to the specified qubit.
# Arguments
- `qureg`: State vector or density matrix.
- `qᵢ`: Qubit index to which the Hadamard gate is applied. Index must be 1-based, as `c_shift_index` is called.
RobustBlindVerification.init_plus_phase_state!
— Methodinitplusphase_state!(qureg,qᵢ,φᵢ)
Applies a Hadamard gate (|+⟩) then a phase rotation gate (|+_ϕ⟩)
- ψ: State vector or density matrix
- qᵢ: Qubit to be applied gates to, index must be 1 based as c_shift_index is called.
- φᵢ: Angle for phase shift
RobustBlindVerification.init_qubit
— MethodFor use to initialise the qubit in the meta graph
The state is not given, but the bit for the initial
state of the dummy
RobustBlindVerification.init_qubit
— MethodFor use to initialise the qubit in the meta graph
The state is not given, but the angle for the plus
phase state for a trap qubit
RobustBlindVerification.rand_k_0_7
— MethodDraw random interger between 0 and 7
RobustBlindVerification.separate_each_color
— MethodExtracts from a Graphs.Coloring{Int64} -> Vector{Vector{Int64}} Once a coloring is selected a vector of integers will result 1 -> Dummy vertex 2 -> Trap
RobustBlindVerification.set_io_qubits_type!
— MethodIn Computation round, there are sometimes input values for qubits,
when this happens, this function will allocate space for them in the property graph
RobustBlindVerification.set_io_qubits_type!
— MethodFor MBQC, with no blind
RobustBlindVerification.set_io_qubits_type!
— MethodIn Test rounds there is no classical input, but this holder function alows for
unilateral call, regardless of round.
RobustBlindVerification.set_vertex_type!
— MethodMust be implemented after the round type is implemented
RobustBlindVerification.ClusterState
— TypeClusterState
A struct representing the cluster state in the MBQC framework.
# Description
`ClusterState` is a marker struct used to represent the cluster state in an MBQC computation. It can be used in combination with other data structures or algorithms specific to the cluster state model.
# Example
```julia
# Declare cluster state
cluster_state = ClusterState()
```
RobustBlindVerification.InputQubits
— TypeInputQubits
A struct representing input qubits in the MBQC framework.
# Description
`InputQubits` is a marker struct used to indicate the presence of input qubits in an MBQC computation. It is typically used in combination with other data structures or algorithms to handle input qubits in the computation.
# Example
```julia
# Declare input qubits
input_qubits = InputQubits()
```
RobustBlindVerification.MBQCAngles
— TypeMBQCAngles(angles)
- Struct representing the angles associated to the graph. The number of angles will be the same as the vertices in the graph.
# Parameters
- `angles`: A listed set of values, as long as the angles are indexable in the same ways that the vertices are.
# Example
```
julia> angles = [π,π/4,5π/4,7π/4]
julia> mbqc_angles = MBQCAngles(angles)
```
RobustBlindVerification.MBQCFlow
— TypeMBQCFlow(forward_flow, backward_flow)
Struct representing flow in MBQC.
# Definition of Flow
- `forward_flow`, `f`: Oᶜ → Iᶜ is a mapping `v ↦ f(v)` with an inverse `f⁻¹(v) ↦ v`, with partial order "≤". The partial order is said to map the present to the future or the present to the past.
- (a) `v ∼ f(v)`, where "∼" defines the neighbourhood `N(f(v))` and `v` has set membership.
- (b) `v ≤ f(v)`
- (c) `w ∼ f(v)`, then ∀ `v`, `v ≤ w`
## Example
- One dimensional lattice, the "path graph", where a vertex is represented as "()" and an edge is represented as "---".
- Let `i` be the index of each vertex so that `i = {1, 2, 3, 4}` and
- `p := (1)---(2)---(3)---(4)`
- `f(i) := i + 1`
- `f⁻¹(i) := i - 1`
- `f([1, 2, 3]) = [2, 3, 4]`, since 4 has no future, there is no 4 + 1 answer.
- `f⁻¹([2, 3, 4]) = [1, 2, 3]`, since 1 has no past, there is no 1 - 1 answer.
# Parameters
- `forward_flow`: A mapping to take an input vertex and return the output vertex such that the definitions of flow hold. The forward flow function can be any container that takes a vertex index as input and outputs a new vertex index.
- `backward_flow`: A mapping to take an output vertex and return the input vertex. The backward flow function maps the inverse of the forward flow.
# Example
```julia
# Define forward and backward flow functions
forward_flow(io) = io[2]
backward_flow(io) = io[1]
# Create an MBQCFlow
mbqc_flow = MBQCFlow(forward_flow, backward_flow)
```
RobustBlindVerification.MBQCGraph
— TypeMBQCGraph(graph,input,output)
- Struct representing the graph used in the MBQC. Container holds the graph as well as the input and output sets.
# Parameters
- `graph`: Any graph suitable for MBQC
- `input`: has type MBQCInput
- `output`: had type MBQCOutput
# Example
```
julia> using Graphs # use using Pkg; Pkg.add("Graphs") is not installede
julia> graph = Graphs.grid([1,4]) # 1D cluster graph (path graph) on 4 vertices
julia> indices,values = (1),(0)
julia> input = MBQCInput(indices,values)
julia> indices = (4)
julia> output = MBQCOutput(indices)
julia> mbqc_graph = MBQCGraph(graph,input,output)
```
RobustBlindVerification.MBQCInput
— TypeMBQCInput(indices,values)
- Struct representing an input set into the graph, can be empty
# Parameters
- `indices`: has type Tuple on normally integers (whole numbers 1 to N) and correspond to vertices in a graph.
- `values`: has type Tuple, can be any type
# Example
```
julia> indices = (1,2,3,4)
julia> values = (0,1,1,0) #Computational basis outcomes
julia> mbqc_input = MBQCInput(indices,values)
```
RobustBlindVerification.MBQCMeasurementOutcomes
— TypeMBQCMeasurementOutcomes(outcomes)
Struct representing measurement outcomes in MBQC.
# Parameter
- `outcomes`: An array or container representing the measurement outcomes.
## Example
```julia
# Define measurement outcomes
outcomes = [0, 1, 1, 0]
# Create an MBQCMeasurementOutcomes
measurement_outcomes = MBQCMeasurementOutcomes(outcomes)
```
RobustBlindVerification.MBQCOutput
— TypeMBQCOutput(indices)
- Struct representing an output set into the graph, can be empty.
# Parameters
- `indices`: has type Tuple on normally integers (whole numbers 1 to N) and correspond to the vertices in a graph.
# Example
```
julia> indices = (10,11,12)
julia> mbqc_output = MBQCOutput(indices)
```
RobustBlindVerification.MBQCResourceState
— TypeMBQCResourceState(graph, flow, angles)
Struct representing a resource state in MBQC.
# Parameters
- `graph`: An instance of `MBQCGraph` representing the underlying graph structure.
- `flow`: An instance of `MBQCFlow` representing the flow in the resource state.
- `angles`: An instance of `MBQCAngles` representing the angles associated with each vertex.
## Example
```julia
# Create an MBQCGraph
graph = MBQCGraph([1, 2, 3], [(1, 2), (2, 3)])
# Create an MBQCFlow
flow = MBQCFlow((1, 2) => 2, (2, 3) => 3)
# Create an MBQCAngles
angles = MBQCAngles([π/2, π/4, π/3])
# Create an MBQCResourceState
resource_state = MBQCResourceState(graph, flow, angles)
```
RobustBlindVerification.NoInputQubits
— TypeNoInputQubits
A struct representing the absence of input qubits in the MBQC framework.
# Description
`NoInputQubits` is a marker struct used to indicate the absence of input qubits in an MBQC computation. It can be used as a flag or placeholder to handle scenarios where there are no input qubits in the computation.
# Example
```julia
# Declare absence of input qubits
no_input_qubits = NoInputQubits()
```