Function API

Documention generated automatically with @audotdocs.

Docs for package

RobustBlindVerification.ClusterStateType

ClusterState

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

# Declare cluster state
cluster_state = ClusterState()
source
RobustBlindVerification.DampingType
mutable struct Damping <: NoiseModels

A struct representing a damping noise model for a single qubit.

Fields

  • backend: The backend used for simulation.
  • type: The type of noise model (SingleQubit).
  • prob: The probability of damping, can be a single value or a vector.
source
RobustBlindVerification.DensityMatrixMixtureParametersType
mutable struct DensityMatrixMixtureParameters <: NoiseParameters

The DensityMatrixMixtureParameters struct represents the parameters for a density matrix mixture noise model. It is a mutable struct that holds two density matrices, ρ₁ and ρ₂.

Fields

  • ρ₁::Union{DensityMatrix,Qureg}: The first density matrix.
  • ρ₂::Union{DensityMatrix,Qureg}: The second density matrix.
source
RobustBlindVerification.DephasingType
struct Dephasing <: NoiseModels

Dephasing noise model that represents noise caused by dephasing errors.

Fields

  • backend: The backend used for simulation.
  • type: The type of qubits affected by the noise. Can be SingleQubit or TwoQubits.
  • prob: The probability of dephasing error. Can be a single value or a vector of probabilities.
source
RobustBlindVerification.DepolarisingType
mutable struct Depolarising <: NoiseModels

A struct representing a depolarizing noise model.

Fields

  • backend: The backend used for the noise model.
  • type: The type of qubits affected by the noise model.
  • prob: The probability of depolarization, can be a single value or a vector.
source
RobustBlindVerification.InputQubitsType
InputQubits

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

# Declare input qubits
input_qubits = InputQubits()
source
RobustBlindVerification.KrausType
struct Kraus <: NoiseModels

A struct representing a noise model using Kraus operators.

Fields

  • backend: The backend used for the noise model.
  • type: The type of noise model, which can be SingleQubit, TwoQubits, or MultipleQubits.
source
RobustBlindVerification.KrausMapNoiseParametersType
struct KrausMapNoiseParameters <: NoiseParameters

The KrausMapNoiseParameters struct represents the noise parameters for a Kraus map noise model.

Fields:

  • trace: Union{TracePreserving,NotTracePreserving} - Specifies whether the noise is trace preserving or not.
  • ρ: Union{DensityMatrix,Qureg} - The density matrix or quantum register representing the initial state.
  • q: Union{Nothing,Vector{Int64},Int64,Vector{Int32},Int32} - The indices of the qubits affected by the noise.
  • mat: Matrix{ComplexF64} - The matrix representation of the Kraus operators.
  • num_ops: Union{Int32,Int64} - The number of Kraus operators.
  • num_qubits: Union{Nothing,Int64} - The number of qubits in the system.
source
RobustBlindVerification.MBQCAnglesType
MBQCAngles(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) 
source
RobustBlindVerification.MBQCColouringSetType
MBQCColouringSet

A structure representing a colouring set in the Measurement-Based Quantum Computing (MBQC) model. It contains two fields: computation_round and test_round.

Fields

  • computation_round: Represents the computation round in the MBQC model.
  • test_round: Represents the test round in the MBQC model.

Examples

mbqc_colouring_set = MBQCColouringSet(computation_round, test_round)
source
RobustBlindVerification.MBQCFlowType
MBQCFlow(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

# 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)
source
RobustBlindVerification.MBQCGraphType
MBQCGraph(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)
source
RobustBlindVerification.MBQCInputType
MBQCInput(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)
source
RobustBlindVerification.MBQCMeasurementOutcomesType
MBQCMeasurementOutcomes(outcomes)

Struct representing measurement outcomes in MBQC.

Parameter

  • outcomes: An array or container representing the measurement outcomes.

Example

# Define measurement outcomes
outcomes = [0, 1, 1, 0]

# Create an MBQCMeasurementOutcomes
measurement_outcomes = MBQCMeasurementOutcomes(outcomes)
source
RobustBlindVerification.MBQCOutputType
MBQCOutput(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)
source
RobustBlindVerification.MBQCResourceStateType
MBQCResourceState(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

# 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)
source
RobustBlindVerification.MaliciousServerType
MaliciousServer

A type representing a server that is malicious. This type is used to model a server that behaves in a way that is not consistent with the protocol. This type is used to model malicious behaviour in the client-server model.

Examples

MaliciousServer()
source
RobustBlindVerification.MixtureDensityMatricesType
mutable struct MixtureDensityMatrices <: NoiseModels

A mutable struct representing a mixture of density matrices noise model.

Fields

  • backend: The backend used for the noise model.
  • type: The type of density matrices.
  • prob: The probability distribution of the mixture.
source
RobustBlindVerification.NoInputQubitsType
NoInputQubits

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

# Declare absence of input qubits
no_input_qubits = NoInputQubits()
source
RobustBlindVerification.NoiseModelType
mutable struct NoiseModel <: NoiseModels

A mutable struct representing a noise model.

Fields

  • model: The noise model.
  • params: The parameters of the noise model.
source
RobustBlindVerification.NoiseModelParamsType
mutable struct NoiseModelParams <: NoiseParameters

Noise model parameters for representing noise in a system.

Fields

  • prob::Union{Float64,Float64,Vector{Float64},Vector{Float64}}: The probability of noise occurring.
source
RobustBlindVerification.NoisyClientType
    NoisyClient(noise_model::Union{Vector{NoiseModel}, NoiseModel})

For MBQC only. A structure representing a client that operates under some noise model. May be buggy.

Fields

  • noise_model::Union{Vector{NoiseModel}, NoiseModel}: The noise model under which the client operates. This can be a single NoiseModel or a vector of NoiseModels.

Examples

noise_model = NoiseModel()
client = NoisyClient(noise_model)
source
RobustBlindVerification.NoisyServerType
mutable struct NoisyServer

A struct representing a noisy server.

Fields

  • noise_model: The noise model used by the server. It can be either a single NoiseModels object or a vector of NoiseModels objects.
source
RobustBlindVerification.PauliType
mutable struct Pauli <: NoiseModels

The Pauli struct represents a noise model for a single qubit. It contains the following fields:

  • backend: The backend used for simulation.
  • type: The type of noise model (SingleQubit).
  • prob: The probability of each Pauli error. It can be a single value, a vector of values, or a matrix of values.
source
RobustBlindVerification.QubitNoiseParametersType
mutable struct QubitNoiseParameters <: NoiseParameters

Qubit noise parameters for a quantum system.

Fields

  • ρ::Union{DensityMatrix,Qureg}: The density matrix or quantum register representing the state of the qubits.
  • q::Union{Nothing,Vector{Int64},Int64,Vector{Int32},Int32}: The indices of the qubits affected by the noise.
source
RobustBlindVerification.MetaGraphMethod
MetaGraph(::Client, resource::MBQCResourceState)

This function creates a MetaGraph from a given MBQCResourceState. It extracts the graph from the resource state and wraps it in a MetaGraph.

Arguments

  • client::Client: The client object.
  • resource::MBQCResourceState: The MBQC resource state containing the graph.

Examples

julia client = Client() resource = MBQCResourceState(graph) MetaGraph(client, resource)`

source
RobustBlindVerification.add_bit_flip!Method
mixBitFlip(ρ::Array{Complex{Float64},2},q::Int64,p::Float64)

Mixes a bit flip noise model to a density matrix.

Arguments

  • ρ::QuEST density matrix: The density matrix to apply the noise to
  • q::Int64: The qubit to apply the noise to
  • p::Float64: The probability of the noise
source
RobustBlindVerification.add_correction_vertices!Method
add_correction_vertices!(::Client, mg, resource::MBQCResourceState)

This function adds correction vertices to the meta graph for a client in the MBQC model. It iterates over each vertex in the resource, gets the correction vertices for each, and sets these as properties in the meta graph.

Arguments

  • ::Client: The Client object.
  • mg: The MetaGraph to which the properties will be added.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.

Returns

  • The updated MetaGraph.

Examples

client = Client()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
add_correction_vertices!(client, mg, resource)
source
RobustBlindVerification.add_damping!Method
mixDamping(ρ::Array{Complex{Float64},2},q::Int64,p::Float64)

Mixes a damping noise model to a density matrix.

Arguments

  • ρ::QuEST density matrix: The density matrix to apply the noise to
  • q::Int64: The qubit to apply the noise to
  • p::Float64: The probability of the noise

Examples

```julia numqubits = 1 q = 1 p = 0.3 quantumenv = createQuESTEnv() ρ = createDensityQureg(numqubits, quantumenv) add_damping!(Quest(),SingleQubit(),ρ,q,p)

source
RobustBlindVerification.add_dephasing!Method
add_dephasing!(::Quest,::SingleQubit,ρ,q,p)

Adds a dephasing noise model to a density matrix.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::SingleQubit: Indicates that the noise is applied to a single qubit.
  • ρ::QuEST density matrix: The density matrix to apply the noise to.
  • q::Int64: The qubit to apply the noise to.
  • p::Float64: The probability of the noise.

Examples

num_qubits = 1
q = 1
p = 0.3
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
add_dephasing!(Quest(),SingleQubit(),ρ,q,p) 
source
RobustBlindVerification.add_dephasing!Method
add_dephasing!(::Quest,::TwoQubits,ρ,q,p)

Adds a dephasing noise model to a density matrix for two qubits.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::TwoQubits: Indicates that the noise is applied to two qubits.
  • ρ::QuEST density matrix: The density matrix to apply the noise to.
  • q::Tuple{Int64, Int64}: The qubits to apply the noise to.
  • p::Float64: The probability of the noise.

Examples

num_qubits = 2
q = (1, 2)
p = 0.3
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
add_dephasing!(Quest(),TwoQubits(),ρ,q,p)
source
RobustBlindVerification.add_depolarising!Method
add_depolarising!(::Quest,::SingleQubit,ρ,q,p)

Adds a depolarising noise model to a density matrix for a single qubit.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::SingleQubit: Indicates that the noise is applied to a single qubit.
  • ρ::QuEST density matrix: The density matrix to apply the noise to.
  • q::Int64: The qubit to apply the noise to.
  • p::Float64: The probability of the noise.

Examples

num_qubits = 1
q = 1
p = 0.3
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
add_depolarising!(Quest(),SingleQubit(),ρ,q,p)
source
RobustBlindVerification.add_depolarising!Method
add_depolarising!(::Quest,::TwoQubits,ρ,q,p)

Adds a depolarising noise model to a density matrix for two qubits.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::TwoQubits: Indicates that the noise is applied to two qubits.
  • ρ::QuEST density matrix: The density matrix to apply the noise to.
  • q::Tuple{Int64, Int64}: The qubits to apply the noise to.
  • p::Float64: The probability of the noise.

Examples

num_qubits = 2
q = (1, 2)
p = 0.3
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
add_depolarising!(Quest(),TwoQubits(),ρ,q,p)
source
RobustBlindVerification.add_flow_vertex!Method
add_flow_vertex!(::Client, mg, resource::MBQCResourceState, flow_type::Union{ForwardFlow,BackwardFlow})

This function adds a flow vertex to the meta graph for a client in the MBQC model. It first converts the flow type to a symbol, then iterates over each vertex in the resource. For each vertex, it gets the verified flow output and sets this as a property in the meta graph.

Arguments

  • ::Client: The Client object.
  • mg: The MetaGraph to which the properties will be added.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.
  • flow_type::Union{ForwardFlow,BackwardFlow}: The flow type to be added.

Returns

  • The updated MetaGraph.

Examples

client = Client()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
flow_type = ForwardFlow()
add_flow_vertex!(client, mg, resource, flow_type)
source
RobustBlindVerification.add_flow_vertex!Method
add_flow_vertex!(::Client, mg, resource::MBQCResourceState)

This function adds both forward and backward flow vertices to the meta graph for a client in the MBQC model. It calls the add_flow_vertex! function twice, once with ForwardFlow and once with BackwardFlow.

Arguments

  • ::Client: The Client object.
  • mg: The MetaGraph to which the properties will be added.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.

Returns

  • The updated MetaGraph.

Examples

client = Client()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
add_flow_vertex!(client, mg, resource)
source
RobustBlindVerification.add_noise!Method
add_noise!(client::Client, noise_model::NoiseModel)

This function adds noise to a quantum system according to the specified noise model. It calls the add_noise! function with a new client and the given noise model as arguments.

Arguments

  • client::Client: The client for which the noise is being added.
  • noise_model::NoiseModel: The noise model to be used.

Examples

client = Client()
noise_model = NoiseModel()
add_noise!(client, noise_model)
source
RobustBlindVerification.add_noise!Method
add_noise!(client::Client, model::Union{Damping,Dephasing,Depolarising,Pauli}, params::QubitNoiseParameters)

This function adds noise to a quantum system. The noise model can be one of Damping, Dephasing, Depolarising, or Pauli. The function throws an error if the noise type is not SingleQubit. It then iterates over the range of qubits represented in the backend and adds noise to each qubit according to the specified model and parameters.

Arguments

  • client::Client: The client for which the noise is being added.
  • model::Union{Damping,Dephasing,Depolarising,Pauli}: The noise model to be used.
  • params::QubitNoiseParameters: The parameters for the noise model.

Examples

client = Client()
model = Damping()
params = QubitNoiseParameters(SingleQubit(), backend)
add_noise!(client, model, params)
source
RobustBlindVerification.add_noise!Method
add_noise!(model::Kraus, params::KrausMapNoiseParameters)

Add noise to a quantum model using a specified noise function.

Arguments

  • model::Kraus: The quantum model to which noise will be added.
  • params::KrausMapNoiseParameters: The parameters specifying the noise model.

```

source
RobustBlindVerification.add_noise!Method
add_noise!(model::MixtureDensityMatrices, params::DensityMatrixMixtureParameters)

Add noise to the given model using the specified params.

Arguments

  • model::MixtureDensityMatrices: The mixture density matrices model.
  • params::DensityMatrixMixtureParameters: The parameters for the density matrix mixture.
source
RobustBlindVerification.add_noise!Method
add_noise!(::NoNoise, params::NoNoiseParameters)

Add noise to the given parameters.

Arguments

  • ::NoNoise: A type representing no noise.
  • params::NoNoiseParameters: The parameters to add noise to.

Returns

  • params.ρ: The noise parameter.
source
RobustBlindVerification.add_noise!Method
add_noise!(server::NoisyServer, server_qureg)

Adds noise to a quantum register (server_qureg) based on the noise model(s) defined in a NoisyServer. The function supports both single and multiple noise models. For each noise model, it retrieves the parameters using get_noise_model_params and applies the noise to each qubit in the quantum register.

Arguments

  • server::NoisyServer: A NoisyServer instance that contains the noise model(s) to be applied.
  • server_qureg: The quantum register to which the noise will be applied.

Examples

server = NoisyServer(noise_model)
server_qureg = QuantumRegister(3)
add_noise!(server, server_qureg)
source
RobustBlindVerification.add_noise!Method
add_noise!(model::Union{Damping,Dephasing,Depolarising,Pauli}, params::QubitNoiseParameters)

Add noise to a quantum model based on the given noise parameters.

Arguments

  • model::Union{Damping,Dephasing,Depolarising,Pauli}: The quantum model to add noise to.
  • params::QubitNoiseParameters: The noise parameters specifying the type and strength of the noise.
source
RobustBlindVerification.add_output_qubits!Method
add_output_qubits!(::Client, mg, resource::MBQCResourceState)

This function adds output qubits to the meta graph for a client in the MBQC model. It retrieves the output indices from the resource graph and sets the :output_inds property of the meta graph to these indices.

Arguments

  • ::Client: The Client object.
  • mg: The MetaGraph to which the property will be added.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.

Returns

  • The updated MetaGraph.

Examples

client = Client()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
add_output_qubits!(client, mg, resource)
source
RobustBlindVerification.add_pauli_noise!Method
add_pauli_noise!(::Quest,::SingleQubit,ρ,q,p)

Adds a Pauli noise model to a density matrix for a single qubit.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::SingleQubit: Indicates that the noise is applied to a single qubit.
  • ρ::QuEST density matrix: The density matrix to apply the noise to.
  • q::Int64: The qubit to apply the noise to.
  • p::Tuple{Float64, Float64, Float64}: The probabilities of the X, Y, and Z Pauli errors.

Examples

num_qubits = 1
q = 1
p = (0.1, 0.2, 0.3)
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
add_pauli_noise!(Quest(),SingleQubit(),ρ,q,p)
source
RobustBlindVerification.add_round_type!Method
add_round_type!(::Client, mg, round_type)

This function adds a round type to the meta graph for a client in the MBQC model. It sets the :round_type property of the meta graph to the specified round type.

Arguments

  • ::Client: The Client object.
  • mg: The MetaGraph to which the property will be added.
  • round_type: The round type to be added to the meta graph.

Returns

  • The updated MetaGraph.

Examples

client = Client()
mg = MetaGraphs.MetaGraph(graph)
round_type = "round1"
add_round_type!(client, mg, round_type)
source
RobustBlindVerification.apply_kraus_map!Method
apply_kraus_map!(::Quest,::MultipleQubits,::NotTracePreserving,ρ,q,complex_mat,num_ops)

Applies a non-trace preserving Kraus map to a density matrix for multiple qubits.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::MultipleQubits: Indicates that the operation is applied to multiple qubits.
  • ::NotTracePreserving: Indicates that the operation is not trace preserving.
  • ρ::QuEST density matrix: The density matrix to apply the operation to.
  • q::Tuple{Int64, Int64}: The least significant qubit and the number of qubits.
  • complex_mat::Array{ComplexF64, 3}: The array of Kraus operators.
  • num_ops::Int64: The number of Kraus operators.

Examples

num_qubits = 3
leas_sig_qubit = 1
num_ops = 8
complex_mat = Array{ComplexF64, 3}(undef, 2, 2, num_ops)
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
apply_kraus_map!(Quest(),MultipleQubits(),NotTracePreserving(),ρ,(leas_sig_qubit,num_qubits),complex_mat,num_ops)
source
RobustBlindVerification.apply_kraus_map!Method
apply_kraus_map!(::Quest,::MultipleQubits,::TracePreserving,ρ,leas_sig_qubit,num_qubits,complex_mat,num_ops)

Applies a Kraus map to a density matrix for multiple qubits.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::MultipleQubits: Indicates that the operation is applied to multiple qubits.
  • ::TracePreserving: Indicates that the operation is trace preserving.
  • ρ::QuEST density matrix: The density matrix to apply the operation to.
  • leas_sig_qubit::Int64: The least significant qubit.
  • num_qubits::Int64: The number of qubits.
  • complex_mat::Array{ComplexF64, 3}: The array of Kraus operators.
  • num_ops::Int64: The number of Kraus operators.

Examples

num_qubits = 3
leas_sig_qubit = 1
num_ops = 8
complex_mat = Array{ComplexF64, 3}(undef, 2, 2, num_ops)
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
apply_kraus_map!(Quest(),MultipleQubits(),TracePreserving(),ρ,leas_sig_qubit,num_qubits,complex_mat,num_ops)
source
RobustBlindVerification.apply_kraus_map!Method
apply_kraus_map!(::Quest,::SingleQubit,::NotTracePreserving,ρ,q,complex_mat,num_ops)

Applies a non-trace preserving Kraus map to a density matrix for a single qubit.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::SingleQubit: Indicates that the operation is applied to a single qubit.
  • ::NotTracePreserving: Indicates that the operation is not trace preserving.
  • ρ::QuEST density matrix: The density matrix to apply the operation to.
  • q::Int64: The qubit to apply the operation to.
  • complex_mat::Array{ComplexF64, 3}: The array of Kraus operators.
  • num_ops::Int64: The number of Kraus operators.

Examples

num_qubits = 1
q = 1
num_ops = 2
complex_mat = Array{ComplexF64, 3}(undef, 2, 2, num_ops)
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
apply_kraus_map!(Quest(),SingleQubit(),NotTracePreserving(),ρ,q,complex_mat,num_ops)
source
RobustBlindVerification.apply_kraus_map!Method
apply_kraus_map!(::Quest,::SingleQubit,::TracePreserving,ρ,q,complex_mat,num_ops)

Applies a Kraus map to a density matrix for a single qubit.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::SingleQubit: Indicates that the operation is applied to a single qubit.
  • ::TracePreserving: Indicates that the operation is trace preserving.
  • ρ::QuEST density matrix: The density matrix to apply the operation to.
  • q::Int64: The qubit to apply the operation to.
  • complex_mat::Array{ComplexF64, 3}: The array of Kraus operators.
  • num_ops::Int64: The number of Kraus operators.

Examples

num_qubits = 1
q = 1
num_ops = 2
complex_mat = Array{ComplexF64, 3}(undef, 2, 2, num_ops)
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
apply_kraus_map!(Quest(),SingleQubit(),TracePreserving(),ρ,q,complex_mat,num_ops)
source
RobustBlindVerification.apply_kraus_map!Method
apply_kraus_map!(::Quest,::TwoQubits,::NotTracePreserving,ρ,q,complex_mat,num_ops)

Applies a non-trace preserving Kraus map to a density matrix for two qubits.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::TwoQubits: Indicates that the operation is applied to two qubits.
  • ::NotTracePreserving: Indicates that the operation is not trace preserving.
  • ρ::QuEST density matrix: The density matrix to apply the operation to.
  • q::Tuple{Int64, Int64}: The qubits to apply the operation to.
  • complex_mat::Array{ComplexF64, 4}: The array of Kraus operators.
  • num_ops::Int64: The number of Kraus operators.

Examples

num_qubits = 2
q = (1, 2)
num_ops = 4
complex_mat = Array{ComplexF64, 4}(undef, 2, 2, 2, num_ops)
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
apply_kraus_map!(Quest(),TwoQubits(),NotTracePreserving(),ρ,q,complex_mat,num_ops)
source
RobustBlindVerification.apply_kraus_map!Method
apply_kraus_map!(::Quest,::TwoQubits,::TracePreserving,ρ,q,complex_mat,num_ops)

Applies a Kraus map to a density matrix for two qubits.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::TwoQubits: Indicates that the operation is applied to two qubits.
  • ::TracePreserving: Indicates that the operation is trace preserving.
  • ρ::QuEST density matrix: The density matrix to apply the operation to.
  • q::Tuple{Int64, Int64}: The qubits to apply the operation to.
  • complex_mat::Array{ComplexF64, 4}: The array of Kraus operators.
  • num_ops::Int64: The number of Kraus operators.

Examples

num_qubits = 2
q = (1, 2)
num_ops = 4
complex_mat = Array{ComplexF64, 4}(undef, 2, 2, 2, num_ops)
quantum_env = createQuESTEnv()
ρ = createDensityQureg(num_qubits, quantum_env)
apply_kraus_map!(Quest(),TwoQubits(),TracePreserving(),ρ,q,complex_mat,num_ops)
source
RobustBlindVerification.assert_commentMethod
assert_comment(condition, message)

Asserts that a given condition is true. If the condition is false, the function throws an AssertionError with the provided message.

Arguments

  • condition: The condition to be checked.
  • message: The message to be displayed if the assertion fails.

Examples

assert_comment(1 == 1, "Numbers are not equal") # Does not throw an error
assert_comment(1 == 2, "Numbers are not equal") # Throws an AssertionError
source
RobustBlindVerification.assert_flowMethod
assert_flow(::BackwardFlow, resource::MBQCResourceState, vertex::Int64)

Asserts the properties of a backward flow in a MBQC resource state.

Arguments:

  • ::BackwardFlow: The backward flow type.
  • resource::MBQCResourceState: The MBQC resource state.
  • vertex::Int64: The vertex to be checked.

The function checks the following properties of the backward flow:

  1. The flow of the given vertex is in the vertex set of the resource state.
  2. The given vertex is in the neighborhood of the flow of the given vertex.
  3. The given vertex is less than or equal to all vertices in the neighborhood of the flow of the given vertex.

Throws an error with an appropriate message if any of the properties are violated.

Examples

assert_flow(BackwardFlow(), resource, vertex) # Asserts the properties of the backward flow
source
RobustBlindVerification.assert_flowMethod
assert_flow(flow_type, resource, vertex)

Check the validity of a flow in a resource graph.

Arguments:

  • flow_type: The type of flow to be checked.
  • resource: The resource state representing the graph.
  • vertex: The vertex to be checked.

This function performs several assertions to verify the flow:

  • Checks if the flow of the given vertex is in the vertex set of the graph.
  • Checks if the given vertex is in the neighborhood of the flow of the vertex.
  • Checks if the given vertex is less than or equal to the flow of the vertex.
  • Checks if all vertices in the neighborhood of the flow of the vertex are greater than or equal to the vertex.

Examples

assert_flow(ForwardFlow(), resource, vertex) # Checks the validity of the forward flow
source
RobustBlindVerification.c_iteratorMethod
c_iterator(N)

Create a C based index 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

# Create a circular iterator
N = 5
iterator = c_iterator(N)
source
RobustBlindVerification.c_shift_indexMethod
c_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

# Compute the shifted index
n = 3
shifted_index = c_shift_index(n)
source
RobustBlindVerification.clone_graphMethod
clone_graph(::Server,client_graph)

Creates a clone of a graph in the context of a server.

Arguments

  • ::Server: Indicates that this function is used in the context of a server.
  • client_graph: The graph to be cloned.

Examples

clone_graph(Server(),client_graph)
source
RobustBlindVerification.clone_qureqMethod
clone_qureq(::Server,client_qureg,env)

Creates a clone of a quantum register in the context of a server.

Arguments

  • ::Server: Indicates that this function is used in the context of a server.
  • client_qureg: The quantum register to be cloned.
  • env: The QuEST environment in which the quantum register is cloned.

Examples

clone_qureq(Server(),client_qureg,env)
source
RobustBlindVerification.compute_angle_δᵥMethod

Computation of δᵥ

This function computes the value of δᵥ based on the given parameters.

Case

  1. Round ≡ Computation ∩ Qubit ∈ Input set → δᵥ = ϕᵥ + (θᵥ + xᵥπ) + rᵥπ

Arguments:

  • ::ComputationRound: The computation round.
  • ::InputQubits: The input qubits.
  • ϕ: The value of ϕ.
  • Sx: The value of Sx.
  • Sz: The value of Sz.
  • θᵥ: The value of θᵥ.
  • rᵥ: The value of rᵥ.
  • xᵥ: The value of xᵥ.

Returns:

  • δᵥ: The computed value of δᵥ.

Examples

julia> compute_angle_δᵥ(ComputationRound(),InputQubits(),0,0,[0,0,0],0,0,0)
0
source
RobustBlindVerification.compute_angle_δᵥMethod
compute_angle_δᵥ(::ComputationRound,::NoInputQubits,ϕ,Sx,Sz,θᵥ,rᵥ)

Compute the angle δᵥ based on the given parameters.

Computation of δᵥ Case

  1. Round ≡ Computation ∩ Qubit ∉ Input set → δᵥ = ϕᵥ′ + θᵥ + rᵥπ

Arguments

  • ::ComputationRound: The computation round.
  • ::NoInputQubits: The number of input qubits.
  • ϕ: The value of ϕ.
  • Sx: The value of Sx.
  • Sz: The value of Sz.
  • θᵥ: The value of θᵥ.
  • rᵥ: The value of rᵥ.

Returns

  • δᵥ: The computed angle δᵥ.

Example

julia> compute_angle_δᵥ(ComputationRound(),NoInputQubits(),0,0,[0,0,0],0,0)
0
source
RobustBlindVerification.compute_angle_δᵥMethod
compute_angle_δᵥ(mbqc, qubits, ϕ, Sx, Sz)

Compute the angle δᵥ for the given MBQC, qubits, ϕ, Sx, and Sz.

Arguments

  • mbqc: The MBQC object.
  • qubits: The qubits object, either NoInputQubits or InputQubits.
  • ϕ: The angle ϕ.
  • Sx: The Sx value.
  • Sz: The Sz value.

Returns

  • The updated angle δᵥ.

Example

julia> compute_angle_δᵥ(MBQC(), NoInputQubits(), 0, 0, [0, 0, 0])
0
source
RobustBlindVerification.compute_angle_δᵥMethod

Computation of δᵥ

This function computes the angle δᵥ based on the given parameters.

Arguments:

  • ::TestRound: The test round object.
  • ::DummyQubit: The dummy qubit object.
  • θᵥ: The input angle.

Returns:

  • δᵥ: The computed angle δᵥ.

Case:

  1. Round ≡ Test ∩ Qubit ≡ Dummy → δᵥ = {kπ/r | k ∼ U(0..7)}

Examples

julia> compute_angle_δᵥ(TestRound(),DummyQubit(),0)
0
source
RobustBlindVerification.compute_angle_δᵥMethod
compute_angle_δᵥ(::TestRound, ::TrapQubit, θᵥ, rᵥ)

Compute the angle δᵥ for the case where the round is a test round and the qubit is a trap qubit.

Computation of δᵥ Case

  1. Round ≡ Test ∩ Qubit ≡ Trap → δᵥ = θᵥ + rᵥπ

Arguments

  • ::TestRound: The type representing a test round.
  • ::TrapQubit: The type representing a trap qubit.
  • θᵥ: The angle θᵥ.
  • rᵥ: The coefficient rᵥ.

Returns

The computed angle δᵥ.

Example

julia> compute_angle_δᵥ(TestRound(), TrapQubit(), 0, 0)
0
source
RobustBlindVerification.compute_backward_flowMethod
compute_backward_flow(graph, forward_flow, vertex)

This function computes the backward flow of a given vertex in a graph. It first finds the neighbors of the vertex and checks if the vertex is in the forward flow of any of its neighbors. If it is not, the function returns 0. If it is, the function finds the index of the vertex in the forward flow of its neighbors. If the vertex is not in the flow of the neighbors, an error is thrown. If there is more than one past vertex found, an error is thrown. Otherwise, the function returns the first past vertex.

Arguments

  • graph: The graph.
  • forward_flow: The forward flow function.
  • vertex: The vertex for which to compute the backward flow.

Returns

  • The first past vertex if it exists, 0 otherwise.

Examples

graph = Graph(5)
forward_flow = (n -> n + 1)
vertex = 3
backward_flow_vertex = compute_backward_flow(graph, forward_flow, vertex)
source
RobustBlindVerification.compute_trap_round_fail_thresholdMethod
compute_trap_round_fail_threshold(total_rounds, computational_rounds, number_different_test_rounds, inherent_bounded_error::InherentBoundedError)

Computes the threshold for trap round failures. The function first calculates the number of test rounds by subtracting the number of computational rounds from the total rounds. It then uses this number, the number of different test rounds, and the inherent bounded error to calculate the threshold, which is then floored to the nearest integer.

Arguments

  • total_rounds: The total number of rounds.
  • computational_rounds: The number of computational rounds.
  • number_different_test_rounds: The number of different test rounds.
  • inherent_bounded_error::InherentBoundedError: An instance of InherentBoundedError representing the inherent bounded error.

Returns

  • Int: The floored threshold for trap round failures.

Examples

total_rounds = 10
computational_rounds = 5
number_different_test_rounds = 3
inherent_bounded_error = InherentBoundedError(0.33)
threshold = compute_trap_round_fail_threshold(total_rounds, computational_rounds, number_different_test_rounds, inherent_bounded_error)
source
RobustBlindVerification.convert_flow_type_symbolMethod
convert_flow_type_symbol(::Client, flow_type::Union{ForwardFlow,BackwardFlow})

This function converts a flow type (either ForwardFlow or BackwardFlow) into a symbol. The conversion process involves converting the flow type to a string, removing parentheses, adding an underscore before "Flow", converting to lowercase, and finally converting to a symbol.

Arguments

  • ::Client: The Client object.
  • flow_type::Union{ForwardFlow,BackwardFlow}: The flow type to be converted.

Returns

  • A Symbol representing the flow type.

Examples

client = Client()
flow_type = ForwardFlow()
flow_sym = convert_flow_type_symbol(client, flow_type)
source
RobustBlindVerification.create_graph_resourceMethod
create_graph_resource(p::NamedTuple)::MBQCResourceState

Creates an MBQCResourceState from a NamedTuple p. The NamedTuple should contain the following keys: input_indices, input_values, output_indices, computation_colours, test_colours, graph, forward_flow, backward_flow, and secret_angles.

Arguments

  • p: A NamedTuple containing the necessary parameters to create an MBQCResourceState.

Examples

params = (input_indices = ..., input_values = ..., output_indices = ..., computation_colours = ..., test_colours = ..., graph = ..., forward_flow = ..., backward_flow = ..., secret_angles = ...)
resource = create_graph_resource(params)
source
RobustBlindVerification.create_plus_phase_density_matMethod
create_plus_phase_density_mat(θ)

Create a density matrix for the plus phase state with a given phase angle θ.

Arguments

  • θ: Phase angle in radians.

Returns

  • Density matrix representing the plus phase state with the given phase angle.
source
RobustBlindVerification.create_quantum_envMethod
create_quantum_env(client::Client)

Create a new quantum environment using the QuEST environment creation function.

Arguments

  • client::Client: The client for which the quantum environment is being created.

Returns

  • A new quantum environment.

Examples

client = Client()
env = create_quantum_env(client)
source
RobustBlindVerification.create_quantum_envMethod
create_quantum_env(::Server)

Creates a new QuEST environment in the context of a server.

Arguments

  • ::Server: Indicates that this function is used in the context of a server.

Examples

create_quantum_env(Server())
source
RobustBlindVerification.create_quantum_stateMethod
create_quantum_state(client::Client, density_matrix::DensityMatrix, quantum_env, num_qubits)

Create a quantum state using a density matrix representation.

Arguments

  • client::Client: The client object representing the quantum computing service.
  • density_matrix::DensityMatrix: The density matrix object representing the quantum state.
  • quantum_env: The quantum environment object.
  • num_qubits: The number of qubits to be used in the quantum state.

Returns

  • The quantum state represented as a density matrix.

Examples

client = Client()
env = create_quantum_env(client)
state = create_quantum_state(client, DensityMatrix(), env, 2)
source
RobustBlindVerification.create_quantum_stateMethod
create_quantum_state(client::Client, state::StateVector, quantum_env, num_qubits)

Create a new quantum state as a state vector using the QuEST function createQureg.

Arguments

  • client::Client: The client for which the quantum state is being created.
  • state::StateVector: Indicates that the quantum state should be created as a state vector.
  • quantum_env: The quantum environment in which the quantum state is being created.
  • num_qubits: The number of qubits in the quantum state.

Returns

  • A new quantum state as a state vector.

Examples

client = Client()
env = create_quantum_env(client)
state = create_quantum_state(client, StateVector(), env, 2)
source
RobustBlindVerification.create_quantum_stateMethod
create_quantum_state(::Server,::DensityMatrix,quantum_env,num_qubits)

Creates a new quantum state in the context of a server.

Arguments

  • ::Server: Indicates that this function is used in the context of a server.
  • ::DensityMatrix: Indicates that the quantum state is a density matrix.
  • quantum_env: The QuEST environment in which the quantum state is created.
  • num_qubits: The number of qubits in the quantum state.

Examples

create_quantum_state(Server(),DensityMatrix(),quantum_env,num_qubits)
source
RobustBlindVerification.create_quantum_stateMethod
create_quantum_state(::Server,::StateVector,quantum_env,num_qubits)

Creates a new quantum state in the context of a server.

Arguments

  • ::Server: Indicates that this function is used in the context of a server.
  • ::StateVector: Indicates that the quantum state is a state vector.
  • quantum_env: The QuEST environment in which the quantum state is created.
  • num_qubits: The number of qubits in the quantum state.

Examples

create_quantum_state(Server(),StateVector(),quantum_env,num_qubits)
source
RobustBlindVerification.create_resourceMethod
create_resource(::MaliciousServer, client_graph, client_qureg, malicious_angles::Union{Float64,Vector{Float64}})

Creates a resource dictionary for a malicious server, including a cloned graph, a quantum environment, a quantum register, and a set of malicious angles.

Arguments

  • ::MaliciousServer: Indicates that this function is used in the context of a malicious server.
  • client_graph::Graph: The client's graph to be cloned.
  • client_qureg::QuEST object: The client's quantum register to be cloned.
  • malicious_angles::Union{Float64,Vector{Float64}}: The angles to be used for malicious behavior.

Examples

client_graph = create_graph(Client(), 3)
client_qureg = create_qureg(Client(), 3)
malicious_angles = [π/4, π/2, 3π/4]
create_resource(MaliciousServer(), client_graph, client_qureg, malicious_angles)
source
RobustBlindVerification.create_resourceMethod
create_resource(server::NoisyServer, client_graph, client_qureg)

Creates a resource for a NoisyServer by cloning the client's graph and quantum register, adding noise to the server's quantum register, and entangling the server's graph. Returns a dictionary containing the server's quantum environment, quantum state, and graph.

Arguments

  • server::NoisyServer: A NoisyServer instance to which the resource will be created.
  • client_graph: The client's graph to be cloned.
  • client_qureg: The client's quantum register to be cloned.

Returns

  • Dict: A dictionary containing the server's quantum environment ("env"), quantum state ("quantum_state"), and graph ("graph").

Examples

server = NoisyServer(noise_model)
client_graph = create_graph(Client(), 3)
client_qureg = QuantumRegister(3)
resource = create_resource(server, client_graph, client_qureg)
source
RobustBlindVerification.create_resourceMethod
create_resource(::Server,client_graph,client_qureg)

Creates a resource in the context of a server.

Arguments

  • ::Server: Indicates that this function is used in the context of a server.
  • client_graph: The graph to be copied/cloned.
  • client_qureg: The quantum register to be copied/cloned.

Examples

create_resource(Server(),client_graph,client_qureg)
source
RobustBlindVerification.create_ubqc_resourceMethod
create_ubqc_resource(para)

Creates a UBQC (Universal Blind Quantum Computation) resource using the provided parameters. The function initializes the test and computation colours, computes the backward flow, and creates a dictionary with the parameters. It then calls the create_graph_resource function with the created dictionary as an argument.

Arguments

  • para: A dictionary containing the parameters for the UBQC resource. It should include the following keys: :input, :output, :graph, :secret_angles, and :forward_flow.

Returns

  • The result of the create_graph_resource function.

Examples

para = (args)::NamedTuple # function specific args
ubqc_resource = create_ubqc_resource(para)
source
RobustBlindVerification.draw_bitMethod
draw_bit()

Draw a random bit, either 0 or 1. This function uses the rand function to randomly select from the array [0,1].

Returns

  • A random bit, either 0 or 1.

Examples

draw_bit() # Outputs: 0 or 1
source
RobustBlindVerification.draw_dᵥMethod
draw_dᵥ()

Draw a random bit, either 0 or 1, for a dummy. This function uses the draw_bit function to select the bit.

Returns

  • A random bit, either 0 or 1, for a dummy.

Examples

julia draw_dᵥ() # Outputs: 0 or 1`

source
RobustBlindVerification.draw_random_roundsMethod
draw_random_rounds(total_rounds, computation_rounds)

Generates a random sequence of computation and test rounds. The function first calculates the number of test rounds by subtracting the number of computation rounds from the total rounds. It then creates arrays of ComputationRound and TestRound instances, and returns a shuffled concatenation of these arrays.

Arguments

  • total_rounds: The total number of rounds.
  • computation_rounds: The number of computation rounds.

Returns

  • Array: A shuffled array of ComputationRound and TestRound instances.

Examples

total_rounds = 10
computation_rounds = 5
rounds = draw_random_rounds(total_rounds, computation_rounds)
source
RobustBlindVerification.draw_rᵥMethod
draw_rᵥ()

Draw a random bit, either 0 or 1, for a trap. This function uses the draw_bit function to select the bit.

Returns

  • A random bit, either 0 or 1, for a trap.

Examples

draw_rᵥ() # Outputs: 0 or 1
source
RobustBlindVerification.draw_θᵥMethod
draw_θᵥ()

Draw a random angle θ that is a multiple of kπ/4, where k is an integer between 0 and 7, inclusive. This function uses the rand_k_0_7 function to select k, and then calculates θ.

Returns

  • A random angle θ that is a multiple of kπ/4.

Examples

draw_θᵥ() # Outputs: A multiple of π/4 between 0 and 7π/4
source
RobustBlindVerification.entangle_graph!Method
entangle_graph!(::Client, mg)

This function entangles the quantum state of a meta graph for a client in the MBQC model. It first retrieves the quantum state from the meta graph and creates a graph from the meta graph. Then, for each edge in the graph, it applies a controlled phase flip operation on the source and destination vertices.

Arguments

  • ::Client: The Client object.
  • mg: The MetaGraph to which the properties will be added.

Examples

client = Client()
mg = MetaGraphs.MetaGraph(graph)
entangle_graph!(client, mg)
source
RobustBlindVerification.entangle_graph!Method
entangle_graph!(::Server,qureg,graph)

Entangles a quantum register with a graph in the context of a server.

Arguments

  • ::Server: Indicates that this function is used in the context of a server.
  • qureg: The quantum register to be entangled.
  • graph: The graph with which the quantum register is entangled.

Examples

entangle_graph!(Server(),qureg,graph)
source
RobustBlindVerification.generate_property_graph!Method
generate_property_graph!(::Client, round_type, resource::MBQCResourceState, state_type::Union{StateVector,DensityMatrix})

This function generates a property graph for a client in the MBQC model based on the round type. It first creates a meta graph from the resource and adds the round type to it. Then, it adds output qubits, sets the vertex type and IO qubits type, initializes the qubits, adds flow vertices and correction vertices, initializes measurement outcomes, and initializes the quantum state of the meta graph. This function is run at the beginning of every round.

Arguments

  • ::Client: The Client object.
  • round_type: The round type.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.
  • state_type::Union{StateVector,DensityMatrix}: The type of quantum state to create.

Returns

  • The updated MetaGraph.

Examples

client = Client()
resource = MBQCResourceState(graph)
round_type = "round1"
state_type = StateVector()
generate_property_graph!(client, round_type, resource, state_type)
source
RobustBlindVerification.generate_property_graph!Method
generate_property_graph!(::Client, round_type::MBQC, resource::MBQCResourceState, state_type::Union{StateVector,DensityMatrix})

This function generates a property graph for a client in the MBQC model based on the round type. It first creates a meta graph from the resource and adds the round type to it. Then, it adds output qubits, sets the vertex type and IO qubits type, initializes the qubits, adds flow vertices and correction vertices, initializes measurement outcomes, initializes the quantum state of the meta graph, and entangles the graph. This function is run at the beginning of every round.

Arguments

  • ::Client: The Client object.
  • round_type::MBQC: The round type.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.
  • state_type::Union{StateVector,DensityMatrix}: The type of quantum state to create.

Returns

  • The updated MetaGraph.

Examples

client = Client()
resource = MBQCResourceState(graph)
round_type = MBQC()
state_type = StateVector()
generate_property_graph!(client, round_type, resource, state_type)
source
RobustBlindVerification.generate_random_greedy_colorMethod
generate_random_greedy_color(g, reps)

This function generates a random greedy coloring of a graph. It uses the random_greedy_color function from the Graphs package.

Arguments

  • g: The graph to be colored.
  • reps: The number of repetitions for the random greedy coloring algorithm.

Examples

g = Graphs.grid_graph((5,5))
reps = 10
generate_random_greedy_color(g, reps)
source
RobustBlindVerification.get_angleMethod
get_angle(resource::MBQCResourceState, AngleType, vertex)

Returns the angle of a specific vertex from a given MBQCResourceState and AngleType.

Arguments

  • resource: An MBQCResourceState from which to extract the angle.
  • AngleType: The type of angle to be extracted.
  • vertex: The vertex for which to extract the angle.

Examples

angle = get_angle(resource, SecretAngles(), vertex) # Returns the angle of the specified vertex
source
RobustBlindVerification.get_anglesMethod
get_angles(resource::MBQCResourceState, ::SecretAngles)

Returns the secret angles from a given MBQCResourceState.

Arguments

  • resource: An MBQCResourceState from which to extract the secret angles.

Examples

angles = get_angles(resource, SecretAngles()) # Returns the secret angles of the resource
source
RobustBlindVerification.get_correction_verticesMethod
get_correction_vertices(resource::MBQCResourceState, vertex::Int64)

Returns the corrections for a given vertex in the MBQC resource state.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.
  • vertex::Int64: The vertex for which to get the corrections.

Returns

  • corrections: A tuple containing the X and Z corrections.

Example

corrections = get_correction_vertices(resource, vertex) # Returns the corrections needed for the given vertex
source
RobustBlindVerification.get_corrections_multi_neighbourhood_mulit_vertex_graphMethod
get_corrections_multi_neighbourhood_mulit_vertex_graph(resource::MBQCResourceState, vertex::Int64)

This function calculates the corrections needed for a multi-neighbourhood multi-vertex graph in the context of MBQC (Measurement-Based Quantum Computation).

Arguments

  • resource::MBQCResourceState: The MBQC resource state.
  • vertex::Int64: The vertex for which the corrections are calculated.

Returns

  • corrections: A tuple containing the X and Z corrections.

Example

corrections = get_corrections_multi_neighbourhood_mulit_vertex_graph(resource, vertex) # Returns the corrections needed for the given vertex
source
RobustBlindVerification.get_corrections_one_neighbourhood_mulit_vertex_graphMethod
get_corrections_one_neighbourhood_mulit_vertex_graph(resource::MBQCResourceState, vertex::Int64)

This function calculates the corrections needed for a vertex in a multi-vertex graph with one neighbourhood. It takes the resource state resource and the vertex vertex as input.

Arguments

  • resource::MBQCResourceState: The resource state of the graph.
  • vertex::Int64: The vertex for which corrections are calculated.

Returns

  • corrections::NamedTuple: A named tuple containing the X and Z corrections for the vertex.

Example

corrections = get_corrections_one_neighbourhood_mulit_vertex_graph(resource, vertex) # Returns the corrections needed for the given vertex
source
RobustBlindVerification.get_corrections_one_neighbourhood_two_vertex_graphMethod
get_corrections_one_neighbourhood_two_vertex_graph(resource::MBQCResourceState, vertex::Int64)

This function calculates the corrections needed for a two-vertex graph in a one-neighbourhood MBQC resource state.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.
  • vertex::Int64: The vertex in the graph.

Returns

  • corrections: A tuple (X=x_correction_vertex, Z=z_correction_vertices) representing the corrections needed.

Errors

  • Throws an error if the vertex is not in the graph.
  • Throws an error if the size of the graph is not 2.
  • Throws an error if the size of the vertex neighbour set is not 1.
  • Throws an error if neither the forward flow nor the backward flow of the vertex is in the graph.

Examples

corrections = get_corrections_one_neighbourhood_two_vertex_graph(resource, vertex) # Returns the corrections needed for the given vertex
source
RobustBlindVerification.get_edge_iteratorMethod
get_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

# 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)
source
RobustBlindVerification.get_flowMethod
get_flow(flow_type::BackwardFlow, resource::MBQCResourceState)

Get the backward flow of a given resource.

Arguments

  • flow_type::BackwardFlow: The type of flow to retrieve.
  • resource::MBQCResourceState: The resource state to retrieve the flow from.

Returns

The backward flow of the resource.

Examples

```julia

source
RobustBlindVerification.get_flowMethod
get_flow(flow_type, resource)

Get the flow of a given resource.

Arguments

  • flow_type: The type of flow (e.g., ForwardFlow, BackwardFlow).
  • resource: The resource state.

Returns

The flow of the resource.

Examples

```julia

source
RobustBlindVerification.get_graphMethod
get_graph(resource::MBQCResourceState)

Get the graph associated with the given MBQCResourceState.

Arguments

  • resource::MBQCResourceState: The resource state object.

Returns

  • The graph associated with the resource state.

Examples

graph = get_graph(resource) # Returns the graph associated with the resource
source
RobustBlindVerification.get_input_indicesMethod
get_input_indices(resource::MBQCResourceState)

Returns the input indices from a given MBQCResourceState.

Arguments

  • resource: An MBQCResourceState from which to extract the input indices.

Examples

indices = get_input_indices(resource) # Returns the input indices of the resource
source
RobustBlindVerification.get_input_sizeMethod
get_input_size(resource::MBQCResourceState)::Int64

Get the size of the input for the given MBQCResourceState.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.

Returns

  • Int64: The size of the input.

Examples

size = get_input_size(resource) # Returns the size of the input
source
RobustBlindVerification.get_input_valueMethod
get_input_value(resource::MBQCResourceState, iter)

Returns the input value at the iter-th index from a given MBQCResourceState. If iter is greater than the length of the input indices, the function returns nothing.

Arguments

  • resource: An MBQCResourceState from which to extract the input value.
  • iter: The index at which to extract the input value.

Examples

value = get_input_value(resource, 1) # Returns the input value at the first index of the resource
source
RobustBlindVerification.get_input_valuesMethod
get_input_values(resource::MBQCResourceState)

Returns the input values from a given MBQCResourceState.

Arguments

  • resource: An MBQCResourceState from which to extract the input values.

Examples

values = get_input_values(resource) # Returns the input values of the resource
source
RobustBlindVerification.get_measurement_outcome_iteratorMethod
get_measurement_outcome_iterator(resource::MBQCResourceState)

Returns an iterator that generates indices for measuring the vertices of a MBQC resource state.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.

Returns

An iterator that generates indices for measuring the vertices of the resource state.

Example

iterator = get_measurement_outcome_iterator(resource) # Returns an iterator that generates indices for measuring the vertices of the resource
source
RobustBlindVerification.get_minimum_vertex_index_flowMethod
get_minimum_vertex_index_flow(resource::MBQCResourceState)

Get the minimum vertex index flow for a given MBQCResourceState.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.

Returns

  • Int64: The minimum vertex index flow.

Example

min_vertex = get_minimum_vertex_index_flow(resource) # Returns the minimum vertex index flow
source
RobustBlindVerification.get_mode_outputMethod
get_mode_output(::Client, ::ComputationRound, rounds_as_graphs::Vector)

Collects the outputs of computation rounds from a list of client's meta graphs and returns the mode of the outputs. The function iterates over the meta graphs, skips those with a round type of TestRound, gets the output of the computation round, and stores it in a list. The function then calculates and returns the mode of the outputs.

Arguments

  • ::Client: A Client instance.
  • ::ComputationRound: A ComputationRound instance.
  • rounds_as_graphs::Vector: A list of client's meta graphs.

Returns

  • mode(outputs): The mode of the outputs.

Examples

rounds_as_graphs = [create_meta_graph(Client()) for _ in 1:5]
mode_output = get_mode_output(Client(), ComputationRound(), rounds_as_graphs)
source
RobustBlindVerification.get_noise_modelMethod
get_noise_model(::Dephasing)

Get the noise model for dephasing errors.

Arguments

  • ::Dephasing: A dephasing error model.

Returns

  • add_dephasing!: A function that adds dephasing errors to a quantum circuit.
source
RobustBlindVerification.get_noise_modelMethod
get_noise_model(::Depolarising)

Get the noise model for the Depolarising channel.

Arguments

  • ::Depolarising: The Depolarising channel.

Returns

  • add_depolarising!: The function to add depolarising noise to a quantum circuit.
source
RobustBlindVerification.get_noise_modelMethod
get_noise_model(::MixtureDensityMatrices)

Get the noise model for a mixture of density matrices.

Arguments

  • ::MixtureDensityMatrices: The mixture of density matrices.

Returns

  • The noise model.
source
RobustBlindVerification.get_noise_modelMethod
get_noise_model(p::Pauli)

Get the noise model for a given Pauli operator.

Arguments

  • p::Pauli: The Pauli operator.

Returns

  • add_pauli_noise!: The function to add Pauli noise to a quantum circuit.
source
RobustBlindVerification.get_noise_model_paramsMethod
get_noise_model_params(model::Union{Damping,Dephasing,Depolarising,Pauli}, server_qureg::Union{DensityMatrix,Qureg})

Get the noise model parameters for a given noise model and server quantum register.

Arguments

  • model::Union{Damping,Dephasing,Depolarising,Pauli}: The noise model to retrieve parameters for.
  • server_qureg::Union{DensityMatrix,Qureg}: The server quantum register.

Returns

  • The noise parameters for the given noise model and server quantum register.

```

source
RobustBlindVerification.get_noise_paramMethod
get_noise_param(::Kraus)

Get the noise parameters for a given Kraus operator.

Arguments

  • ::Kraus: The Kraus operator.

Returns

  • KrausMapNoiseParameters: The noise parameters for the Kraus operator.
source
RobustBlindVerification.get_noise_paramMethod
get_noise_param(::MixtureDensityMatrices)

Get the noise parameter for a MixtureDensityMatrices object.

Arguments

  • ::MixtureDensityMatrices: The input MixtureDensityMatrices object.

Returns

  • MixtureDensityMatrices: The noise parameter.
source
RobustBlindVerification.get_noise_paramMethod
get_noise_param(noise_type)

Get the noise parameters for the specified noise type.

Arguments

  • noise_type: The type of noise (Damping, Dephasing, Depolarising, Pauli).

Returns

  • QubitNoiseParameters: The noise parameters for the specified noise type.
source
RobustBlindVerification.get_number_verticesMethod
get_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

# 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)
source
RobustBlindVerification.get_outputMethod
get_output(::Client, ::Union{MBQC,ComputationRound}, mg)

Retrieves the output of a computation from a client's meta graph. The function gets the output indices from the meta graph, iterates over them, gets the outcome for each index, and stores the outcomes in a list. The list of outcomes is returned.

Arguments

  • ::Client: A Client instance.
  • ::Union{MBQC,ComputationRound}: An instance of MBQC or ComputationRound.
  • mg: The client's meta graph.

Returns

  • Array: An array of outcomes.

Examples

mg = create_meta_graph(Client())
outcomes = get_output(Client(), ComputationRound(), mg)
source
RobustBlindVerification.get_output_sizeMethod
get_output_size(resource::MBQCResourceState)::Int64

Get the size of the output for a given MBQCResourceState.

Arguments

  • resource::MBQCResourceState: The resource state for which to get the output size.

Returns

  • Int64: The size of the output.

Examples

size = get_output_size(resource) # Returns the size of the output
source
RobustBlindVerification.get_random_coloringMethod
get_random_coloring(c::Vector{Vector{Int64}})

This function selects a random coloring from a vector of colorings.

Arguments

  • c::Vector{Vector{Int64}}: The vector of colorings.

Examples

julia c = [[1, 2, 1], [2, 1, 2], [1, 2, 2]] get_random_coloring(c)`

source
RobustBlindVerification.get_size_measurement_vectorMethod
get_size_measurement_vector(resource::MBQCResourceState)::Int64

Get the size of the measurement vector for a given MBQCResourceState.

Arguments

  • resource::MBQCResourceState: The resource state for which to calculate the measurement vector size.

Returns

  • Int64: The size of the measurement vector.

Examples

size = get_size_measurement_vector(resource) # Returns the size of the measurement vector
source
RobustBlindVerification.get_stop_start_verticesMethod
get_stop_start_vertices(resource::MBQCResourceState)

Get the start and stop vertices for a given MBQCResourceState.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.

Returns

  • Tuple{Int64, Int64}: A tuple containing the start and stop vertices.

Example

start, stop = get_stop_start_vertices(resource) # Returns the start and stop vertices
source
RobustBlindVerification.get_ubqc_outputMethod
get_ubqc_output(::Client, ::ComputationRound, mg::MetaGraphs.MetaGraph)

Gets the output of a computation round from a client's meta graph. The function checks if the round type of the meta graph is TestRound, and if so, it throws an error. Otherwise, it gets and returns the output of the computation round.

Arguments

  • ::Client: A Client instance.
  • ::ComputationRound: A ComputationRound instance.
  • mg::MetaGraphs.MetaGraph: A client's meta graph.

Returns

  • The output of the computation round.

Errors

  • Throws an error if the round type of the meta graph is TestRound.

Examples

ubqc_output = get_ubqc_output(Client(), ComputationRound(), mg)
source
RobustBlindVerification.get_updated_ϕ!Method
get_updated_ϕ!(RountType, QubitType, QubitIOType, client_meta_graph, qubit)

Updates the ϕ value of a given qubit in the client_meta_graph using the update_ϕ! function and then retrieves the updated ϕ value.

Arguments

  • RountType: The type of the computation round.
  • QubitType: The type of the computation qubit.
  • QubitIOType: The type of the input qubits.
  • client_meta_graph: The graph to be updated.
  • qubit: The qubit in the graph for which the ϕ value is to be updated and retrieved.

Returns

  • The updated ϕ value of the specified qubit.

Examples

updated_ϕ = get_updated_ϕ!(ComputationRound, ComputationQubit, NoInputQubits, client_meta_graph, qubit) # Updates the ϕ value of the specified qubit in the graph and retrieves it
source
RobustBlindVerification.get_updated_ϕ!Method
get_updated_ϕ!(::Client, mg, qubit)

In the context of a client, updates the ϕ value of a given qubit in the mg graph using the get_updated_ϕ! function and then retrieves the updated ϕ value. The round type, vertex type, and vertex IO type are determined from the properties of the graph and the qubit.

Arguments

  • ::Client: Indicates that this function is used in the context of a client.
  • mg: The graph to be updated.
  • qubit: The qubit in the graph for which the ϕ value is to be updated and retrieved.

Returns

  • The updated ϕ value of the specified qubit.

Examples

updated_ϕ = get_updated_ϕ!(Client(), mg, qubit) # Updates the ϕ value of the specified qubit in the graph and retrieves it
source
RobustBlindVerification.get_updated_ϕ!Method
get_updated_ϕ!(::MaliciousServer, server_resource, qubit, ϕ::Float64)

Updates the phase angle for a given qubit in a malicious server context.

Arguments

  • ::MaliciousServer: Indicates that this function is used in the context of a malicious server.
  • server_resource::Dict: A dictionary containing server resources.
  • qubit::Int64: The qubit for which the phase angle is to be updated.
  • ϕ::Float64: The current phase angle.

Returns

  • Float64: The updated phase angle.
source
RobustBlindVerification.get_vector_graph_colorsMethod
get_vector_graph_colors(graph; reps=100)

Generates a vector of graph colors. It first generates a random greedy color for the graph (repeated reps times), then separates each color.

Arguments

  • graph: The graph to be colored.
  • reps: The number of repetitions for generating the random greedy color (default is 100).

Examples

get_vector_graph_colors(graph) # Returns a vector of graph colors
source
RobustBlindVerification.get_verified_flowMethod
get_verified_flow(T, resource::MBQCResourceState)

Create a function that returns the verified flow output for a given vertex.

Arguments

  • T: The flow graph.
  • resource: The MBQC resource state.

Returns

A function f that takes a vertex as input and returns the verified flow output.

Example

T = ForwardFlow()
resource = MBQCResourceState(...)
f = get_verified_flow(T, resource) # Returns a function that takes a vertex as input and returns the verified flow output
source
RobustBlindVerification.get_verified_flow_outputMethod
get_verified_flow_output(T, resource, vertex)

Get the verified flow output for a given vertex in a MBQC resource state.

Arguments

  • T: The type of flow, which must be either ForwardFlow or BackwardFlow.
  • resource: The MBQC resource state.
  • vertex: The vertex for which to get the verified flow output.

Returns

  • If the flow output is a valid vertex in the neighborhood of the given vertex, it returns the verified flow output.
  • If the flow output is Nothing, it returns nothing.
  • If the flow type is neither ForwardFlow nor BackwardFlow, it throws an error.

Examples

T = ForwardFlow()
resource = MBQCResourceState(...)
vertex = 1
output = get_verified_flow_output(T, resource, vertex) # Returns the verified flow output for the given vertex
source
RobustBlindVerification.get_vertex_iteratorMethod
get_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

# 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)
source
RobustBlindVerification.get_vertex_neighboursMethod

getvertexneighbours(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

# 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)
source
RobustBlindVerification.init_measurement_outcomes!Method
init_measurement_outcomes!(::Client, mg, resource::MBQCResourceState)

This function initializes the measurement outcomes in the meta graph for a client in the MBQC model. It iterates over each vertex in the resource and sets the :outcome property of each vertex in the meta graph to Int64.

Arguments

  • ::Client: The Client object.
  • mg: The MetaGraph to which the properties will be added.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.

Returns

  • The updated MetaGraph.

Examples

client = Client()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
init_measurement_outcomes!(client, mg, resource)
source
RobustBlindVerification.init_outcomes_vectorMethod
init_outcomes_vector(resource::MBQCResourceState)

Initialize the outcomes vector for a given MBQC resource state.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.

Returns

  • outcomes_vec::Vector: The initialized outcomes vector.

Example

outcomes_vec = init_outcomes_vector(resource) # Returns the initialized outcomes vector
source
RobustBlindVerification.init_plus_phase_state!Method
init_plus_phase_state!(nophase::NoPhase, qureg, qᵢ)

This function initializes a quantum state to a superposition state (|+⟩ state) without adding any phase. It applies a Hadamard gate to the qubit, putting it into a superposition state.

Arguments

  • nophase::NoPhase: The NoPhase object indicating that no phase is to be added.
  • qureg: The quantum register containing the qubit.
  • qᵢ: The index of the qubit in the quantum register.

Examples

nophase = NoPhase()
qureg = createQureg(1, env)
qᵢ = 1
init_plus_phase_state!(nophase, qureg, qᵢ)
source
RobustBlindVerification.init_plus_phase_state!Method
init_plus_phase_state!(phase::Phase, qureg, qᵢ, φᵢ)

This function initializes a quantum state to a superposition state (|+⟩ state) with a specified phase. It first applies a Hadamard gate to the qubit, putting it into a superposition state. Then it applies a Z rotation to the qubit, adding the specified phase.

Arguments

  • phase::Phase: The phase object.
  • qureg: The quantum register containing the qubit.
  • qᵢ: The index of the qubit in the quantum register.
  • φᵢ: The phase to be added to the qubit.

Examples

phase = Phase()
qureg = createQureg(1, env)
qᵢ = 1
φᵢ = π/2
init_plus_phase_state!(phase, qureg, qᵢ, φᵢ)
source
RobustBlindVerification.init_qubitMethod
init_qubit(::DummyQubit)::Int64

This function is used to initialize the qubit in the meta graph. The state is not given, but the bit for the initial state of the dummy qubit is returned.

Arguments

  • dummy::DummyQubit: The DummyQubit object.

Returns

  • An Int64 representing the bit for the initial state of the dummy qubit.

Examples

julia dummy = DummyQubit() bit = init_qubit(dummy)`

source
RobustBlindVerification.init_qubitMethod
init_qubit(::TrapQubit)::Float64

This function is used to initialize the qubit in the meta graph. The state is not given, but the angle for the plus phase state for a trap qubit is returned.

Arguments

  • trap::TrapQubit: The TrapQubit object.

Returns

  • A Float64 representing the angle for the plus phase state for a trap qubit.

Examples

trap = TrapQubit()
angle = init_qubit(trap)
source
RobustBlindVerification.init_qubit_meta_graph!Method
init_qubit_meta_graph!(::Client, resource, mg)

This function initializes the qubit meta graph for a client in the MBQC model. It retrieves the round type from the meta graph and then calls the appropriate init_qubit_meta_graph! function based on the round type.

Arguments

  • ::Client: The Client object.
  • resource: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the properties will be added.

Examples

client = Client()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
set_prop!(mg, :round_type, ComputationRound())
init_qubit_meta_graph!(client, resource, mg)
source
RobustBlindVerification.init_qubit_meta_graph!Method
init_qubit_meta_graph!(::Client, ::ComputationRound, resource::MBQCResourceState, mg)

This function initializes the qubit meta graph for a client in the MBQC model during a computation round. It sets the secret angle and initial qubit properties for each vertex in the meta graph.

Arguments

  • ::Client: The Client object.
  • ::ComputationRound: The ComputationRound object.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the properties will be added.

Examples

client = Client()
round = ComputationRound()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
init_qubit_meta_graph!(client, round, resource, mg)
source
RobustBlindVerification.init_qubit_meta_graph!Method
init_qubit_meta_graph!(::Client, mbqc::MBQC, resource::MBQCResourceState, mg)

This function initializes the qubit meta graph for a client in the MBQC model. It sets the secret angle and initial qubit properties for each vertex in the meta graph.

Arguments

  • client::Client: The Client object.
  • mbqc::MBQC: The MBQC object.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the properties will be added.

Examples

client = Client()
mbqc = MBQC()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
init_qubit_meta_graph!(client, mbqc, resource, mg)
source
RobustBlindVerification.init_qubit_meta_graph!Method
init_qubit_meta_graph!(::Client, ::TestRound, resource::MBQCResourceState, mg)

This function initializes the qubit meta graph for a client in the MBQC model during a test round. It sets the initial qubit property for each vertex in the meta graph based on the vertex type.

Arguments

  • ::Client: The Client object.
  • ::TestRound: The TestRound object.
  • resource::MBQCResourceState: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the properties will be added.

Examples

client = Client()
round = TestRound()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
init_qubit_meta_graph!(client, round, resource, mg)
source
RobustBlindVerification.initialise_quantum_state_meta_graph!Method
initialise_quantum_state_meta_graph!(::Client, state_type::Union{StateVector,DensityMatrix}, mg)

This function initializes the quantum state of a meta graph for a client in the MBQC model. It first creates a quantum environment and a quantum state of the specified type. Then, for each vertex in the meta graph, it gets the vertex type, vertex IO type, and initial qubit value, and uses these to initialize the qubit in the quantum state. Finally, it sets the quantum state as a property of the meta graph.

Arguments

  • ::Client: The Client object.
  • state_type::Union{StateVector,DensityMatrix}: The type of quantum state to create.
  • mg: The MetaGraph to which the properties will be added.

Returns

  • The updated MetaGraph.

Examples

client = Client()
mg = MetaGraphs.MetaGraph(graph)
state_type = StateVector()
initialise_quantum_state_meta_graph!(client, state_type, mg)
source
RobustBlindVerification.initialise_quantum_state_meta_graph!Method
initialise_quantum_state_meta_graph!(mbqc::MBQC, client::Client, state_type::Union{StateVector,DensityMatrix}, mg)

This function initializes the quantum state of a meta graph for a client in the MBQC model. It first creates a quantum environment and a quantum state of the specified type. Then, for each vertex in the meta graph, it gets the vertex type and vertex IO type, and uses these to initialize the qubit in the quantum state. Finally, it sets the quantum state as a property of the meta graph.

Arguments

  • ::MBQC: The MBQC object.
  • ::Client: The Client object.
  • state_type::Union{StateVector,DensityMatrix}: The type of quantum state to create.
  • mg: The MetaGraph to which the properties will be added.

Returns

  • The updated MetaGraph.

Examples

mbqc = MBQC()
client = Client()
mg = MetaGraphs.MetaGraph(graph)
state_type = StateVector()
initialise_quantum_state_meta_graph!(mbqc, client, state_type, mg)
source
RobustBlindVerification.initialise_qubitMethod
initialise_qubit(dummy::DummyQubit, noinput::NoInputQubits, quantum_state, qubit_index, qubit_input_value::Int)

This function initialises a qubit in a quantum state. If the input value for the qubit is zero, it does nothing. If the input value is one, it applies a Pauli-X gate to the qubit. If the input value is neither zero nor one, it throws a DummyQubitZeroOneInitialisationError.

Arguments

  • dummy::DummyQubit: The DummyQubit object.
  • noinput::NoInputQubits: The NoInputQubits object.
  • quantum_state: The quantum state containing the qubit.
  • qubit_index: The index of the qubit in the quantum state.
  • qubit_input_value::Int: The input value for the qubit.

Examples

dummy = DummyQubit()
noinput = NoInputQubits()
quantum_state = createQureg(1, env)
qubit_index = 1
qubit_input_value = 0
initialise_qubit(dummy, noinput, quantum_state, qubit_index, qubit_input_value)
source
RobustBlindVerification.initialise_qubitMethod
initialise_qubit(mbqc::MBQC, qubit::Union{ComputationQubit,TrapQubit}, input::Union{InputQubits,InputQubits,NoInputQubits}, quantum_state, qubit_index)

This function initialises a qubit in a quantum state to a superposition state without adding any phase. It applies a Hadamard gate to the qubit, putting it into a superposition state.

Arguments

  • mbqc::MBQC: The MBQC object.
  • qubit::Union{ComputationQubit,TrapQubit}: The type of the qubit.
  • input::Union{InputQubits,InputQubits,NoInputQubits}: The input object.
  • quantum_state: The quantum state containing the qubit.
  • qubit_index: The index of the qubit in the quantum state.

Examples

mbqc = MBQC()
qubit = ComputationQubit()
input = InputQubits()
quantum_state = createQureg(1, env)
qubit_index = 1
initialise_qubit(mbqc, qubit, input, quantum_state, qubit_index)
source
RobustBlindVerification.initialise_qubitMethod
initialise_qubit(qubit::Union{ComputationQubit,TrapQubit}, input::Union{InputQubits,InputQubits,NoInputQubits}, quantum_state, qubit_index, qubit_input_value::Float64)

This function initialises a qubit in a quantum state with a phase determined by the input value. If the input value is a float, it initialises the qubit to a superposition state with the input value as the phase. If the input value is not a float, it throws a QubitFloatPhaseInitialisationError.

Arguments

  • qubit::Union{ComputationQubit,TrapQubit}: The type of the qubit.
  • input::Union{InputQubits,InputQubits,NoInputQubits}: The input object.
  • quantum_state: The quantum state containing the qubit.
  • qubit_index: The index of the qubit in the quantum state.
  • qubit_input_value::Float64: The input value for the qubit, which determines the phase.

Examples

qubit = ComputationQubit()
input = InputQubits()
quantum_state = createQureg(1, env)
qubit_index = 1
qubit_input_value = 0.5
initialise_qubit(qubit, input, quantum_state, qubit_index, qubit_input_value)
source
RobustBlindVerification.is_round_OKMethod
is_round_OK(trap_results)

Checks if a round is successful by examining the trap results. The function filters out the trap results that are equal to 0 (indicating a failure), and checks if the length of the failed traps is less than 1. If there is at least one failed trap, the function returns false, indicating that the round is not OK.

Arguments

  • trap_results: An array of trap results.

Returns

  • Bool: true if the round is OK (no failed traps), false otherwise.

Examples

trap_results = [1, 0, 1]
round_OK = is_round_OK(trap_results)
source
RobustBlindVerification.is_vertex_in_graphMethod
is_vertex_in_graph(resource::MBQCResourceState, vertex::Int64)

Check if a vertex is present in a graph.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.
  • vertex::Int64: The vertex to check.

Returns

  • Bool: true if the vertex is present in the graph, false otherwise.

Example

is_vertex_in_graph(resource, vertex) # Returns true if the vertex is present in the graph, false otherwise
source
RobustBlindVerification.is_vertex_in_graphMethod
is_vertex_in_graph(resource::MBQCResourceState, novertex::Nothing)

Check if a vertex is present in the graph.

Arguments

  • resource::MBQCResourceState: The MBQC resource state.
  • novertex::Nothing: The vertex to check.

Returns

  • true if the vertex is present in the graph, false otherwise.

Example

is_vertex_in_graph(resource, novertex) # Returns true if the vertex is present in the graph, false otherwise
source
RobustBlindVerification.measure_along_ϕ_basis!Method
measure_along_ϕ_basis!(client::Client, ψ, v::Union{Int32,Int64}, ϕ::Float64)

This function measures a quantum state along a specific basis. It first applies a Z rotation to the state, then applies a Hadamard gate, and finally performs a measurement. The basis is determined by the angle ϕ.

Arguments

  • client::Client: The Client object.
  • ψ: The quantum state to be measured.
  • v::Union{Int32,Int64}: The vertex on which the operations are applied.
  • ϕ::Float64: The angle determining the basis for measurement.

Returns

  • The result of the measurement.

Examples

client = Client()
ψ = QuantumState()
v = 1
ϕ = π/4
measure_along_ϕ_basis!(client, ψ, v, ϕ)
source
RobustBlindVerification.measure_along_ϕ_basis!Method
measure_along_ϕ_basis!(::MaliciousServer, ψ, v::Union{Int32,Int64}, ϕ::Float64)

Performs a measurement on a qubit along a specified phase basis in a malicious server context.

Arguments

  • ::MaliciousServer: Indicates that this function is used in the context of a malicious server.
  • ψ::QuEST object: The quantum state to be measured.
  • v::Union{Int32,Int64}: The qubit to be measured.
  • ϕ::Float64: The phase angle defining the basis for measurement.

Examples

ψ = createQureg(1, createQuESTEnv())
v = 1
ϕ = π/4
measure_along_ϕ_basis!(MaliciousServer(), ψ, v, ϕ)
source
RobustBlindVerification.measure_along_ϕ_basis!Method
measure_along_ϕ_basis!(::Server,ψ,v,ϕ)

Measures a qubit in the context of a server.

Arguments

  • ::Server: Indicates that this function is used in the context of a server.
  • ψ: The quantum register in which the qubit is measured.
  • v: The index of the qubit to be measured.
  • ϕ: The angle of the measurement.

Examples

measure_along_ϕ_basis!(Server(),ψ,v,ϕ)
source
RobustBlindVerification.mix_two_density_matrices!Method
mix_two_density_matrices!(::Quest,::DensityMatrices,ρ₁,ρ₂,p)

Mixes two density matrices with a given probability.

Arguments

  • ::Quest: Indicates that this function is used in the context of a Quest environment.
  • ::DensityMatrices: Indicates that the operation is applied to density matrices.
  • ρ₁::QuEST density matrix: The first density matrix.
  • ρ₂::QuEST density matrix: The second density matrix.
  • p::Float64: The probability of mixing.

Examples

num_qubits = 2
quantum_env = createQuESTEnv()
ρ₁ = createDensityQureg(num_qubits, quantum_env)
ρ₂ = createDensityQureg(num_qubits, quantum_env)
p = 0.5
mix_two_density_matrices!(Quest(),DensityMatrices(),ρ₁,ρ₂,p)
source
RobustBlindVerification.ok_abort_yMethod
ok_abort_y()

Generates a tuple of an array of two float values and an array of two string values "Abort" and "Ok".

Returns

  • A tuple of two arrays. The first array contains the float values [0.0, 1.0]. The second array contains the string values ["Abort", "Ok"].

Examples

values = ok_abort_y()
source
RobustBlindVerification.phaseMethod
phase(θ)

Constructs a phase gate with the given angle θ.

Arguments

  • θ: The angle of the phase gate.

Returns

A 2x2 complex matrix representing the phase gate.

Examples

phase(π/2)
source
RobustBlindVerification.plot_verification_resultsMethod
plot_verification_results(::MaliciousServer, ::Terse, xdata, ydata, label)

Generates a scatter plot of verification results for a MaliciousServer in a Terse mode. The function creates a figure and an axis, plots the data, adds a legend, and returns the figure.

Arguments

  • ::MaliciousServer: An instance of MaliciousServer.
  • ::Terse: An instance of Terse.
  • xdata: An array of x-data for the plot.
  • ydata: An array of y-data for the plot.
  • label: A string to be used as the label in the legend.

Returns

  • A Figure object containing the generated plot.
source
RobustBlindVerification.plot_verification_resultsMethod
plot_verification_results(::MaliciousServer, ::Verbose, xdata, ydata, label)

Generates a bar plot of verification results for a MaliciousServer in a Verbose mode. The function normalizes the y-data, creates a figure and an axis, plots the data, adds a legend, and returns the figure.

Arguments

  • ::MaliciousServer: An instance of MaliciousServer.
  • ::Verbose: An instance of Verbose.
  • xdata: An array of x-data for the plot.
  • ydata: An array of y-data for the plot.
  • label: A string to be used as the label in the legend.

Returns

  • A Figure object containing the generated plot.
source
RobustBlindVerification.produce_initialised_graphMethod
produce_initialised_graph(::Client, mg)

This function produces an initialised graph from a meta graph for a client in the MBQC model. It simply creates a new graph from the meta graph.

Arguments

  • ::Client: The Client object.
  • mg: The MetaGraph to be converted into a graph.

Returns

  • A new Graph created from the MetaGraph.

Examples

client = Client()
mg = MetaGraphs.MetaGraph(graph)
produce_initialised_graph(client, mg)
source
RobustBlindVerification.produce_initialised_quregMethod
produce_initialised_qureg(client::Client, mg)

This function retrieves the quantum state from a meta graph for a client in the MBQC model. It uses the get_prop function to get the :quantum_state property from the meta graph.

Arguments

  • client::Client: The Client object.
  • mg: The MetaGraph from which the quantum state will be retrieved.

Returns

  • The quantum state of the MetaGraph.

Examples

client = Client()
mg = MetaGraphs.MetaGraph(graph)
produce_initialised_qureg(client, mg)
source
RobustBlindVerification.rand_k_0_7Method
rand_k_0_7()

Draw a random integer between 0 and 7, inclusive. This function uses the rand function to randomly select from the range 0:7.

Returns

  • A random integer between 0 and 7, inclusive.

Examples

rand_k_0_7() # Outputs: An integer between 0 and 7
source
RobustBlindVerification.run_computationMethod
run_computation(client_meta_graph, num_qubits_from_server, server_quantum_state)

Runs a computation by creating a new Client instance for each qubit from the server. The function iterates over the number of qubits from the server, updates the client's ϕ, measures along the ϕ basis on the client, updates the measurement on the client, and stores the measurement outcome on the client. The updated client meta graph is returned.

Arguments

  • client_meta_graph: The client's meta graph.
  • num_qubits_from_server: The number of qubits from the server.
  • server_quantum_state: The quantum state of the server.

Returns

  • client_meta_graph: The updated client meta graph.

Examples

client_meta_graph = create_graph(Client(), 3)
num_qubits_from_server = 3
server_quantum_state = create_quantum_state(Client(), num_qubits_from_server)
updated_client_meta_graph = run_computation(client_meta_graph, num_qubits_from_server, server_quantum_state)
source
RobustBlindVerification.run_computationMethod
run_computation(::Client, ::MaliciousServer, server_resource, client_meta_graph, num_qubits_from_server, server_quantum_state)

Runs a quantum computation in the context of a client interacting with a malicious server. The computation involves updating phase angles, measuring along a specific basis, and storing the measurement outcomes.

Arguments

  • ::Client: Indicates that this function is used in the context of a client.
  • ::MaliciousServer: Indicates that this function is used in the context of a malicious server.
  • server_resource::Dict: A dictionary containing server resources.
  • client_meta_graph::Graph: The client's meta graph.
  • num_qubits_from_server::Int64: The number of qubits received from the server.
  • server_quantum_state::QuEST object: The server's quantum state.

Examples

server_resource = Dict("env" => create_quantum_env(Server()), "quantum_state" => create_qureg(Server(), 3), "graph" => create_graph(Server(), 3), "angles" => [π/4, π/2, 3π/4])
client_meta_graph = create_graph(Client(), 3)
num_qubits_from_server = 3
server_quantum_state = create_qureg(Server(), 3)
run_computation(Client(), MaliciousServer(), server_resource, client_meta_graph, num_qubits_from_server, server_quantum_state)
source
RobustBlindVerification.run_computationMethod
run_computation(client::Client, server::Union{Server,NoisyServer}, client_meta_graph, num_qubits_from_server, server_quantum_state)

Runs a computation on a server from a client's perspective. The function iterates over the number of qubits from the server, updates the client's ϕ, measures along the ϕ basis on the server, updates the measurement on the client, and stores the measurement outcome on the client. The updated client meta graph is returned.

Arguments

  • client::Client: A Client instance.
  • server::Union{Server,NoisyServer}: A Server or NoisyServer instance.
  • client_meta_graph: The client's meta graph.
  • num_qubits_from_server: The number of qubits from the server.
  • server_quantum_state: The quantum state of the server.

Returns

  • client_meta_graph: The updated client meta graph.

Examples

client = Client()
server = NoisyServer(noise_model)
client_meta_graph = create_graph(client, 3)
num_qubits_from_server = 3
server_quantum_state = create_quantum_state(server, num_qubits_from_server)
updated_client_meta_graph = run_computation(client, server, client_meta_graph, num_qubits_from_server, server_quantum_state)
source
RobustBlindVerification.run_mbqcMethod
run_mbqc(para)

Runs a Measurement-Based Quantum Computation (MBQC) using the provided parameters. The function creates a UBQC resource, generates a client meta graph, extracts the quantum state from the client meta graph, runs the computation, and gets the output.

Arguments

  • para: A dictionary containing the parameters for the MBQC. It should include the key :state_type.

Returns

  • The output of the MBQC, obtained by calling get_output.

Examples

para = (args)::NamedTuple # function specific args
mbqc_output = run_mbqc(para)
source
RobustBlindVerification.run_ubqcMethod
run_ubqc(para)

Runs a Universal Blind Quantum Computation (UBQC) using the provided parameters. The function creates a UBQC resource, generates a client meta graph, extracts the graph and quantum register (qureg) from the client, creates server resources, runs the computation, and gets the UBQC output.

Arguments

  • para: A dictionary containing the parameters for the UBQC. It should include the key :state_type.

Returns

  • The output of the UBQC, obtained by calling get_ubqc_output.

Examples

para = (args)::NamedTuple # function specific args
ubqc_output = run_ubqc(para)
source
RobustBlindVerification.run_verificationMethod
run_verification(::Client, ::MaliciousServer, round_types, client_resource, state_type, malicious_angles)

Runs a verification process in the context of a client interacting with a malicious server. The process involves generating a property graph, initializing a graph and a quantum register, creating server resources, running a computation, and initializing a blank quantum state.

Arguments

  • ::Client: Indicates that this function is used in the context of a client.
  • ::MaliciousServer: Indicates that this function is used in the context of a malicious server.
  • round_types::Array: An array of round types.
  • client_resource::Dict: A dictionary containing client resources.
  • state_type::Symbol: The type of the quantum state.
  • malicious_angles::Union{Float64,Vector{Float64}}: The angles to be used for malicious behavior.

Examples

round_types = [:round1, :round2, :round3]
client_resource = Dict("env" => create_quantum_env(Client()), "quantum_state" => create_qureg(Client(), 3), "graph" => create_graph(Client(), 3))
state_type = :state1
malicious_angles = [π/4, π/2, 3π/4]
run_verification(Client(), MaliciousServer(), round_types, client_resource, state_type, malicious_angles)
source
RobustBlindVerification.run_verificationMethod
run_verification(client::Client, server::NoisyServer, round_types, client_resource, state_type)

Runs a verification process between a client and a noisy server. For each round type, it generates a property graph for the client, extracts the graph and quantum register from the client, creates resources for the server, runs the computation, initializes a blank quantum state for the server, and stores the client's meta graph. Returns a list of all client meta graphs.

Arguments

  • client::Client: A Client instance participating in the verification process.
  • server::NoisyServer: A NoisyServer instance participating in the verification process.
  • round_types: The types of rounds to be run in the verification process.
  • client_resource: The resources available to the client.
  • state_type: The type of state used in the verification process.

Returns

  • Array: An array of client meta graphs for each round type.

Examples

client = Client()
server = NoisyServer(noise_model)
round_types = [ComputationRound(), TestRound()]
client_resource = create_resource(client, client_graph, client_qureg)
state_type = :state1
round_graphs = run_verification(client, server, round_types, client_resource, state_type)
source
RobustBlindVerification.run_verificationMethod
run_verification(::Client, ::Server, round_types, client_resource, state_type)

Runs a verification process between a client and a server. For each round type, the function generates a client meta graph, extracts the graph and quantum register (qureg) from the client, creates server resources, runs a computation, initializes a blank quantum state on the server, and stores the client meta graph in a list. The list of client meta graphs is returned.

Arguments

  • ::Client: A Client instance.
  • ::Server: A Server instance.
  • round_types: The types of rounds to run.
  • client_resource: The client's resources.
  • state_type: The type of state.

Returns

  • Array: An array of client meta graphs.

Examples

round_types = ["round1", "round2"]
client_resource = create_resource(Client())
state_type = "state_type_example"
round_graphs = run_verification(Client(), Server(), round_types, client_resource, state_type)
source
RobustBlindVerification.run_verification_simulatorMethod
run_verification_simulator(::MaliciousServer, ::Terse, para, malicious_angles)

Runs a verification simulator in the context of a malicious server. The simulator involves defining colouring, computing backward flow, creating a graph resource, drawing random rounds, running verification, verifying rounds, and getting mode output.

Arguments

  • ::MaliciousServer: Indicates that this function is used in the context of a malicious server.
  • ::Terse: Indicates that this function is used in a terse mode.
  • para::Dict: A dictionary containing parameters for the simulation.
  • malicious_angles::Union{Float64,Vector{Float64}}: The angles to be used for malicious behavior.

Examples

para = Dict("input" => Dict("indices" => [1, 2, 3], "values" => [0.5, 0.5, 0.5]), "output" => [4, 5, 6], "graph" => create_graph(Client(), 3), "secret_angles" => [π/4, π/2, 3π/4], "forward_flow" => [0.1, 0.2, 0.3], "total_rounds" => 10, "computation_rounds" => 5, "state_type" => :state1)
malicious_angles = [π/4, π/2, 3π/4]
run_verification_simulator(MaliciousServer(), Terse(), para, malicious_angles)
source
RobustBlindVerification.run_verification_simulatorMethod
run_verification_simulator(::MaliciousServer, ::Verbose, para, malicious_angles)

Runs a verification simulator in the context of a malicious server. The simulator involves defining colouring, computing backward flow, creating a graph resource, drawing random rounds, running verification, verifying rounds in both terse and verbose modes, and getting mode output.

Arguments

  • ::MaliciousServer: Indicates that this function is used in the context of a malicious server.
  • ::Verbose: Indicates that this function is used in a verbose mode.
  • para::Dict: A dictionary containing parameters for the simulation.
  • malicious_angles::Union{Float64,Vector{Float64}}: The angles to be used for malicious behavior.

Examples

para = Dict("input" => Dict("indices" => [1, 2, 3], "values" => [0.5, 0.5, 0.5]), "output" => [4, 5, 6], "graph" => create_graph(Client(), 3), "secret_angles" => [π/4, π/2, 3π/4], "forward_flow" => [0.1, 0.2, 0.3], "total_rounds" => 10, "computation_rounds" => 5, "state_type" => :state1)
malicious_angles = [π/4, π/2, 3π/4]
run_verification_simulator(MaliciousServer(), Verbose(), para, malicious_angles)
source
RobustBlindVerification.run_verification_simulatorMethod
run_verification_simulator(server::NoisyServer, ::Terse, para)

Runs a verification simulator on a NoisyServer. It defines colorings for computation and test rounds, computes the threshold for test rounds, creates a client resource, draws random rounds, runs the verification, verifies the rounds, and gets the mode outcome. Returns a tuple containing the results of the test verification, computation verification, and mode outcome.

Arguments

  • server::NoisyServer: A NoisyServer instance on which the verification simulator will be run.
  • ::Terse: A verbosity level for the verification process.
  • para: A dictionary containing parameters for the verification process.

Returns

  • Tuple: A tuple containing the results of the test verification (test_verification), computation verification (computation_verification), and mode outcome (mode_outcome).

Examples

server = NoisyServer(noise_model)
para = Dict(:graph => create_graph(Client(), 3), :input => Dict(:indices => [1, 2], :values => [0, 1]), :output => [3], :secret_angles => [0.5, 0.5], :forward_flow => [0.5, 0.5], :total_rounds => 10, :computation_rounds => 5, :state_type => :state1)
results = run_verification_simulator(server, Terse(), para)
source
RobustBlindVerification.run_verification_simulatorMethod
run_verification_simulator(server::NoisyServer, ::Verbose, para)

Runs a verification simulator on a NoisyServer with verbose output. It defines colorings for computation and test rounds, computes the threshold for test rounds, creates a client resource, draws random rounds, runs the verification, verifies the rounds in both terse and verbose modes, and gets the mode outcome. Returns a tuple containing the results of the test verification, computation verification, verbose test verification, verbose computation verification, and mode outcome.

Arguments

  • server::NoisyServer: A NoisyServer instance on which the verification simulator will be run.
  • ::Verbose: A verbosity level for the verification process.
  • para: A dictionary containing parameters for the verification process.

Returns

  • Tuple: A tuple containing the results of the test verification (test_verification), verbose test verification (test_verification_verb), computation verification (computation_verification), verbose computation verification (computation_verification_verb), and mode outcome (mode_outcome).

Examples

server = NoisyServer(noise_model)
para = Dict(:graph => create_graph(Client(), 3), :input => Dict(:indices => [1, 2], :values => [0, 1]), :output => [3], :secret_angles => [0.5, 0.5], :forward_flow => [0.5, 0.5], :total_rounds => 10, :computation_rounds => 5, :state_type => :state1)
results = run_verification_simulator(server, Verbose(), para)
source
RobustBlindVerification.run_verification_simulatorMethod
run_verification_simulator(::TrustworthyServer, ::Terse, para)

Runs a verification simulator for a TrustworthyServer in a Terse mode. The function defines colouring, computes the backward flow, creates a client resource, draws random rounds, runs the verification, verifies the rounds, gets the mode output, and returns the verification results and mode outcome.

Arguments

  • ::TrustworthyServer: An instance of TrustworthyServer.
  • ::Terse: An instance of Terse.
  • para: A dictionary containing the parameters for the verification simulator. It should include the keys :graph, :input, :output, :secret_angles, :forward_flow, :total_rounds, and :computation_rounds.

Returns

  • A tuple containing the test verification result, the computation verification result, and the mode outcome.

Examples

para = (args)::NamedTuple # function specific args
result = run_verification_simulator(TrustworthyServer(), Terse(), para)
source
RobustBlindVerification.run_verification_simulatorMethod
run_mbqc(para)

Runs a Measurement-Based Quantum Computation (MBQC) using the provided parameters. The function creates a UBQC resource, generates a client meta graph, extracts the quantum state from the client meta graph, runs the computation, and gets the output.

Arguments

  • para: A NamedTuple containing the parameters for the MBQC.

Returns

  • The output of the MBQC, obtained by calling get_output.

Examples

para = (args)::NamedTuple # function specific args
mbqc_output = run_mbqc(para)
source
RobustBlindVerification.separate_each_colorMethod
separate_each_color(g::Graphs.Coloring{Int64})

This function extracts from a Graphs.Coloring{Int64} and returns a Vector{Vector{Int64}}. Once a coloring is selected, a vector of integers will result where:

  • 1 represents a Dummy vertex
  • 2 represents a Trap

Arguments

  • g::Graphs.Coloring{Int64}: The graph coloring object.

Examples

julia g = Graphs.grid_graph((5,5)) coloring = Graphs.greedy_color(g) separate_each_color(coloring)`

source
RobustBlindVerification.set_io_qubits_type!Method
set_io_qubits_type!(::Client, resource, mg)

This function sets the input/output qubits type property in a MetaGraph based on the round type property of the MetaGraph.

Arguments

  • client::Client: The Client object.
  • resource: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the vertex io type property will be added.

Examples

client = Client()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
set_prop!(mg, :round_type, ComputationRound())
set_io_qubits_type!(client, resource, mg)
source
RobustBlindVerification.set_io_qubits_type!Method
set_io_qubits_type!(::ComputationRound, resource, mg)

In Computation round, there are sometimes input values for qubits. When this happens, this function will allocate space for them in the property graph. It assigns the InputQubits type to the vertices that are in the input indices and NoInputQubits to the rest.

Arguments

  • round::ComputationRound: The ComputationRound object.
  • resource: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the vertex io type property will be added.

Examples

round = ComputationRound()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
set_io_qubits_type!(round, resource, mg)
source
RobustBlindVerification.set_io_qubits_type!Method
set_io_qubits_type!(::MBQC, resource, mg)

This function sets the input/output qubits type property in a MetaGraph for MBQC with no blind. It assigns the InputQubits type to the vertices that are in the input indices and NoInputQubits to the rest.

Arguments

  • client::MBQC: The MBQC client object.
  • resource: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the vertex io type property will be added.

Examples

client = MBQC()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
set_io_qubits_type!(client, resource, mg)
source
RobustBlindVerification.set_io_qubits_type!Method
set_io_qubits_type!(::TestRound, resource, mg)

In Test rounds there is no classical input, but this holder function allows for unilateral call, regardless of round. It assigns the NoInputQubits type to all the vertices.

Arguments

  • round::TestRound: The TestRound object.
  • resource: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the vertex io type property will be added.

Examples

round = TestRound()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
set_io_qubits_type!(round, resource, mg)
source
RobustBlindVerification.set_vertex_type!Method
set_vertex_type!(::Client, resource, mg)

This function sets the vertex type property in a MetaGraph based on the round type property of the MetaGraph. It must be implemented after the round type is implemented.

Arguments

  • client::Client: The Client object.
  • resource: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the vertex type property will be added.

Examples

client = Client()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
set_prop!(mg, :round_type, ComputationRound())
set_vertex_type!(client, resource, mg)
source
RobustBlindVerification.set_vertex_type!Method
set_vertex_type!(::TestRound, resource, mg)

This function sets the vertex type property in a MetaGraph based on a random color pattern from the test round in the resource graph. It assigns the DummyQubit and TrapQubit types to the vertices according to the color pattern.

Arguments

  • test_round::TestRound: The TestRound object.
  • resource: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the vertex type property will be added.

Examples

test_round = TestRound()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
set_vertex_type!(test_round, resource, mg)
source
RobustBlindVerification.set_vertex_type!Method
set_vertex_type!(::Union{MBQC,ComputationRound}, resource, mg)

This function sets the vertex type property in a MetaGraph based on the color pattern of the computation round in the resource graph. It assigns the ComputationQubit type to the vertices according to the color pattern.

Arguments

  • mbqc::Union{MBQC,ComputationRound}: The MBQC or ComputationRound object.
  • resource: The resource containing the graph and its coloring.
  • mg: The MetaGraph to which the vertex type property will be added.

Examples

mbqc = MBQC()
resource = MBQCResourceState(graph)
mg = MetaGraphs.MetaGraph(resource.graph.graph)
set_vertex_type!(mbqc, resource, mg)
source
RobustBlindVerification.store_measurement_outcome!Method
store_measurement_outcome!(client::Client, client_meta_graph, qubit, outcome)

This function stores the measurement outcome of a specific qubit in the client's meta graph. It uses the set_p function to set the property in the meta graph.

Arguments

  • client::Client: The Client object.
  • client_meta_graph: The MetaGraph where the measurement outcome will be stored.
  • qubit: The qubit whose measurement outcome is being stored.
  • outcome: The measurement outcome to be stored.

Returns

  • Nothing. The function modifies the clientmetagraph in-place.

Examples

client = Client()
client_meta_graph = MetaGraphs.MetaGraph(graph)
qubit = 1
outcome = 0
store_measurement_outcome!(client, client_meta_graph, qubit, outcome)
source
RobustBlindVerification.throw_errorMethod
throw_error(::DimensionMismatchDensityMatrices)

Throws an error when density matrices do not have the same dimensions.

Examples

throw_error(DimensionMismatchDensityMatrices()) # Throws an error with the message "Density matrices do not have the same dimensions"
source
RobustBlindVerification.throw_errorMethod
throw_error(::DummyQubitZeroOneInitialisationError)

Throws an error message when the input qubit value is not an integer 0 or 1.

Examples

throw_error(DummyQubitZeroOneInitialisationError()) # Throws an error with a specific message
source
RobustBlindVerification.throw_errorMethod
throw_error(::ExceededNumKrausOperators)

Throws an error when more Kraus operators were presented than allowed.

Examples

throw_error(ExceededNumKrausOperators()) # Throws an error with the message "More Kraus operators were presented than allowed. Check again."
source
RobustBlindVerification.throw_errorMethod
throw_error(::OnlySingleQubitNoiseInUseError)

Throws an error when two qubit or multiple qubit noise is not tested.

Examples

throw_error(OnlySingleQubitNoiseInUseError()) # Throws an error with the message "Two qubit or multiple qubit noise is not tested and will not be allowed to run, untill"
source
RobustBlindVerification.throw_errorMethod
throw_error(::ProbabilityExceedsFifteenSixteensError)

Throws an error when a probability greater than 15/16 is encountered, typically in relation to noise model limitations.

Examples

throw_error(ProbabilityExceedsFifteenSixteensError()) # Throws an error with the message "Probability is greater than 15/16 (hint: error thrown in relation to noise model limitations)"
source
RobustBlindVerification.throw_errorMethod
throw_error(::ProbabilityExceedsNoErrorExceeded)

Throws an error when a probability is greater than no error from 1.

Examples

throw_error(ProbabilityExceedsNoErrorExceeded()) # Throws an error with the message "Probability is greater than no error from 1."
source
RobustBlindVerification.throw_errorMethod
throw_error(::ProbabilityExceedsOneError)

Throws an error when a probability greater than 1 is encountered.

Examples

throw_error(ProbabilityExceedsOneError()) # Throws an error with the message "Probability is greater than 1 (hint: not a probability and threw an error)"
source
RobustBlindVerification.throw_errorMethod
throw_error(::ProbabilityExceedsOneHalfError)

Throws an error when a probability greater than 1/2 is encountered, typically in relation to noise model limitations.

Examples

throw_error(ProbabilityExceedsOneHalfError()) # Throws an error with the message "Probability is greater than 1/2 (hint: error thrown in relation to noise model limitations)"
source
RobustBlindVerification.throw_errorMethod
throw_error(::ProbabilityExceedsThreeQuartersError)

Throws an error when a probability greater than 3/4 is encountered, typically in relation to noise model limitations.

Examples

throw_error(ProbabilityExceedsThreeQuartersError()) # Throws an error with the message "Probability is greater than 3/4 (hint: error thrown in relation to noise model limitations)"
source
RobustBlindVerification.throw_errorMethod
throw_error(::ProbabilityLessThanZeroError)

Throws an error when a probability less than zero is encountered.

Examples

throw_error(ProbabilityLessThanZeroError()) # Throws an error with the message "Probability is less than 0 (hint: not a probability and threw an error)"
source
RobustBlindVerification.throw_errorMethod
throw_error(::QubitFloatPhaseInitialisationError)

Throws an error message when the input qubit value is not a Float64 for a plus state with a phase.

Examples

throw_error(QubitFloatPhaseInitialisationError()) # Throws an error with a specific message
source
RobustBlindVerification.throw_warningMethod
throw_warning(::FunctionNotMeantToBeUsed)

Throws a warning message when a function that is not meant to be used anymore is called.

Examples

throw_warning(FunctionNotMeantToBeUsed()) # Throws a warning with a specific message
source
RobustBlindVerification.throw_warningMethod
throw_warning(::UntestedKrausFunction)

Throws a warning when a Kraus operator is not tested, specifically transalting a pointer index from Julia to C, use at peril till function goes away.

Examples

throw_warning(UntestedKrausFunction()) # Throws a warning with the message "Kraus operator is not tested, specifically transalting a pointer index from Julia to C, use at peril till function goes away"
source
RobustBlindVerification.two_pi_xMethod
two_pi_x()

Generates a tuple of two arrays representing the radian values and their string representations from 0 to 2π with a step of π/4.

Returns

  • A tuple of two arrays. The first array contains the radian values from 0 to 2π with a step of π/4. The second array contains the string representations of these radian values.

Examples

radians, labels = two_pi_x()
source
RobustBlindVerification.update_measurementMethod
update_measurement(client::Client, q, mg, outcome)

This function retrieves the round type from the measurement graph and then calls the update_measurement function with the client, round type, qubit, measurement graph, and outcome as arguments.

Arguments

  • client::Client: The client for which the measurement is being updated.
  • q: The qubit for which the measurement is being updated.
  • mg: The measurement graph associated with the computation round.
  • outcome: The outcome of the measurement.

Returns

  • The result of calling update_measurement with the client, round type, qubit, measurement graph, and outcome.

Examples

client = Client()
q = 1
mg = MeasurementGraph()
outcome = 0
update_measurement(client, q, mg, outcome)
source
RobustBlindVerification.update_measurementMethod
update_measurement(client::Client, round::ComputationRound, q, mg, outcome)

Update the measurement for a given computation round and qubit. The function retrieves the one-time pad integer associated with the qubit and computes the absolute difference between the outcome and the one-time pad integer.

Arguments

  • client::Client: The client for which the measurement is being updated.
  • round::ComputationRound: The computation round for which the measurement is being updated.
  • q: The qubit for which the measurement is being updated.
  • mg: The measurement graph associated with the computation round.
  • outcome: The outcome of the measurement.

Returns

  • The absolute difference between the outcome and the one-time pad integer.

Examples

client = Client()
round = ComputationRound()
q = 1
mg = MeasurementGraph()
outcome = 0
update_measurement(client, round, q, mg, outcome)
source
RobustBlindVerification.update_measurementMethod
update_measurement(client::Client, round::Union{MBQC, TestRound}, q, mg, outcome)

This function is used in the context of Measurement-Based Quantum Computing (MBQC) or during a test round. It takes an outcome and simply returns it without making any modifications.

Arguments

  • client::Client: The client for which the measurement is being updated.
  • round::Union{MBQC, TestRound}: Specifies whether the computation round is a part of MBQC or a test round.
  • q: The qubit for which the measurement is being updated.
  • mg: The measurement graph associated with the computation round.
  • outcome: The outcome of the measurement.

Returns

  • The same outcome that was passed as an argument.

Examples

client = Client()
round = MBQC()
q = 1
mg = MeasurementGraph()
outcome = 0
update_measurement(client, round, q, mg, outcome)
source
RobustBlindVerification.update_ϕ!Method
update_ϕ!(::ComputationRound, ::ComputationQubit, ::InputQubits, meta_graph, vertex)

Updates the ϕ value of a given vertex in the meta_graph during a computation round with a computation qubit and input qubits. The new ϕ value is computed based on several properties of the vertex including its initial qubit, secret angle, classical input, X correction, and Z correction.

Arguments

  • ::ComputationRound: Indicates that this function is used during a computation round.
  • ::ComputationQubit: Indicates that a computation qubit is used.
  • ::InputQubits: Indicates that there are input qubits.
  • meta_graph: The graph to be updated.
  • vertex: The vertex in the graph for which the ϕ value is to be updated.

Returns

  • The updated meta_graph.

Examples

updated_graph = update_ϕ!(ComputationRound(), ComputationQubit(), InputQubits(), meta_graph, vertex) # Updates the ϕ value of the specified vertex in the graph
source
RobustBlindVerification.update_ϕ!Method
update_ϕ!(::ComputationRound, ::ComputationQubit, ::NoInputQubits, meta_graph, vertex)

Updates the ϕ value of a given vertex in the meta_graph during a computation round with a computation qubit and no input qubits. The new ϕ value is computed based on several properties of the vertex including its initial qubit, secret angle, X correction, and Z correction.

Arguments

  • ::ComputationRound: Indicates that this function is used during a computation round.
  • ::ComputationQubit: Indicates that a computation qubit is used.
  • ::NoInputQubits: Indicates that there are no input qubits.
  • meta_graph: The graph to be updated.
  • vertex: The vertex in the graph for which the ϕ value is to be updated.

Returns

  • The updated meta_graph.

Examples

updated_graph = update_ϕ!(ComputationRound(), ComputationQubit(), NoInputQubits(), meta_graph, vertex) # Updates the ϕ value of the specified vertex in the graph
source
RobustBlindVerification.update_ϕ!Method
update_ϕ!(::MBQC, ::ComputationQubit, qT::Union{NoInputQubits,InputQubits}, meta_graph, vertex)

Updates the ϕ value of a given vertex in the meta_graph during a computation round in a Measurement-Based Quantum Computing (MBQC) model with a computation qubit and either no input qubits or input qubits. The new ϕ value is computed based on several properties of the vertex including its secret angle, X correction, and Z correction.

Arguments

  • ::MBQC: Indicates that this function is used in the MBQC model.
  • ::ComputationQubit: Indicates that a computation qubit is used.
  • qT::Union{NoInputQubits,InputQubits}: Indicates that either no input qubits or input qubits are used.
  • meta_graph: The graph to be updated.
  • vertex: The vertex in the graph for which the ϕ value is to be updated.

Returns

  • The updated meta_graph.

Examples

updated_graph = update_ϕ!(MBQC(), ComputationQubit(), NoInputQubits(), meta_graph, vertex) # Updates the ϕ value of the specified vertex in the graph
updated_graph = update_ϕ!(MBQC(), ComputationQubit(), InputQubits(), meta_graph, vertex) # Updates the ϕ value of the specified vertex in the graph
source
RobustBlindVerification.update_ϕ!Method
update_ϕ!(::TestRound, ::DummyQubit, ::NoInputQubits, meta_graph, vertex)

Updates the ϕ value of a given vertex in the meta_graph during a test round with a dummy qubit and no input qubits. The new ϕ value is computed based on a randomly drawn θᵥ value.

Arguments

  • ::TestRound: Indicates that this function is used during a test round.
  • ::DummyQubit: Indicates that a dummy qubit is used.
  • ::NoInputQubits: Indicates that there are no input qubits.
  • meta_graph: The graph to be updated.
  • vertex: The vertex in the graph for which the ϕ value is to be updated.

Returns

  • The updated meta_graph.

Examples

updated_graph = update_ϕ!(TestRound(), DummyQubit(), NoInputQubits(), meta_graph, vertex) # Updates the ϕ value of the specified vertex in the graph
source
RobustBlindVerification.update_ϕ!Method
update_ϕ!(::TestRound, ::TrapQubit, ::NoInputQubits, meta_graph, vertex)

Updates the ϕ value of a given vertex in the meta_graph during a test round with a trap qubit and no input qubits. The new ϕ value is computed based on the initial qubit θᵥ and a randomly drawn rᵥ value.

Arguments

  • ::TestRound: Indicates that this function is used during a test round.
  • ::TrapQubit: Indicates that a trap qubit is used.
  • ::NoInputQubits: Indicates that there are no input qubits.
  • meta_graph: The graph to be updated.
  • vertex: The vertex in the graph for which the ϕ value is to be updated.

Returns

  • The updated meta_graph.

Examples

updated_graph = update_ϕ!(TestRound(), TrapQubit(), NoInputQubits(), meta_graph, vertex) # Updates the ϕ value of the specified vertex in the graph
source
RobustBlindVerification.verify_roundMethod
verify_round(::Client, ::TestRound, mg)

Verifies a round of computation from a client's meta graph. The function iterates over the vertices of the meta graph, checks if the vertex type is a TrapQubit, gets the neighbors and properties of the vertex, calculates the verification result, and stores the result in a list. If all results are TrapPass, the function returns 1 (indicating the round is good); otherwise, it returns 0 (indicating the round is bad).

Arguments

  • ::Client: A Client instance.
  • ::TestRound: A TestRound instance.
  • mg: The client's meta graph.

Returns

  • Int: 1 if the round is good, 0 if the round is bad.

Examples

mg = create_meta_graph(Client())
round_verification = verify_round(Client(), TestRound(), mg)
source
RobustBlindVerification.verify_roundsMethod
verify_rounds(::Client, ::ComputationRound, ::Terse, rounds_as_graphs)

Verifies multiple rounds of computation from a list of client's meta graphs. The function counts the number of computation rounds, collects the outputs of the computation rounds, calculates the mode of the outputs, and counts the number of outputs that match the mode. If the number of outputs that match the mode is greater than half the number of computation rounds, the function returns Ok(), otherwise it returns Abort().

Arguments

  • ::Client: A Client instance.
  • ::ComputationRound: A ComputationRound instance.
  • ::Terse: A Terse instance.
  • rounds_as_graphs: A list of client's meta graphs.

Returns

  • Ok or Abort: Ok() if the number of outputs that match the mode is greater than half the number of computation rounds, Abort() otherwise.

Examples

rounds_as_graphs = [create_meta_graph(Client()) for _ in 1:5]
round_verification = verify_rounds(Client(), ComputationRound(), Terse(), rounds_as_graphs)
source
RobustBlindVerification.verify_roundsMethod
verify_rounds(::Client, ::ComputationRound, ::Verbose, rounds_as_graphs)

Verifies multiple rounds of computation from a list of client's meta graphs. The function counts the number of computation rounds, collects the outputs of the computation rounds, calculates the mode of the outputs, and counts the number of outputs that match the mode. The function then returns a tuple with the number of failed and passed rounds.

Arguments

  • ::Client: A Client instance.
  • ::ComputationRound: A ComputationRound instance.
  • ::Verbose: A Verbose instance.
  • rounds_as_graphs: A list of client's meta graphs.

Returns

  • Tuple: A tuple with the number of failed and passed rounds.

Examples

rounds_as_graphs = [create_meta_graph(Client()) for _ in 1:5]
round_verification = verify_rounds(Client(), ComputationRound(), Verbose(), rounds_as_graphs)
source
RobustBlindVerification.verify_roundsMethod
verify_rounds(::Client, ::TestRound, ::Terse, rounds_as_graphs, pass_threshold)

Verifies multiple rounds of computation from a list of client's meta graphs. The function iterates over the meta graphs, skips those with a round type of ComputationRound, verifies the round, and stores the outcome in a list. The function then counts the number of failed rounds. If the number of failed rounds is greater than the pass threshold, the function returns Abort(), otherwise it returns Ok().

Arguments

  • ::Client: A Client instance.
  • ::TestRound: A TestRound instance.
  • ::Terse: A Terse instance.
  • rounds_as_graphs: A list of client's meta graphs.
  • pass_threshold: The threshold for a round to be considered as passed.

Returns

  • Abort or Ok: Abort() if the number of failed rounds is greater than the pass threshold, Ok() otherwise.

Examples

rounds_as_graphs = [create_meta_graph(Client()) for _ in 1:5]
pass_threshold = 3
round_verification = verify_rounds(Client(), TestRound(), Terse(), rounds_as_graphs, pass_threshold)
source
RobustBlindVerification.verify_roundsMethod
verify_rounds(::Client, ::TestRound, ::Verbose, rounds_as_graphs, pass_threshold)

Verifies multiple rounds of computation from a list of client's meta graphs. The function iterates over the meta graphs, skips those with a round type of ComputationRound, verifies the round, and stores the outcome in a list. The function then counts the number of failed rounds and returns a tuple with the number of failed and passed rounds.

Arguments

  • ::Client: A Client instance.
  • ::TestRound: A TestRound instance.
  • ::Verbose: A Verbose instance.
  • rounds_as_graphs: A list of client's meta graphs.
  • pass_threshold: The threshold for a round to be considered as passed.

Returns

  • Tuple: A tuple with the number of failed and passed rounds.

Examples

rounds_as_graphs = [create_meta_graph(Client()) for _ in 1:5]
pass_threshold = 3
round_verification = verify_rounds(Client(), TestRound(), Verbose(), rounds_as_graphs, pass_threshold)
source

Documentation content assisted with AI from GitHup Copilot.