Skip to content

Commit

Permalink
nonclassicality witness docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
bdoolittle committed Dec 5, 2023
1 parent 92e868d commit a4dbb9d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/src/LocalPolytope/facets.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CurrentModule = LocalPolytope
facets
```

## Obtaining Nonclassicality Witnesses through Linear Programming
## Linear Programming of Facets

```@docs
linear_nonclassicality_witness
Expand Down
34 changes: 30 additions & 4 deletions src/LocalPolytope/linear_nonclassicality_witnesses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,36 @@
verbose=false :: Bool
) :: Vector{Float64}
Implements a linear program that obtains a linear inequality that witnesses the nonclassciality of
the provided `test_behavior` (see https://arxiv.org/abs/1303.2849 Eq. 19). A complete set of
enumerated vertices are required as input. The optimized facet inequality is returned in vector
form with the classical bound being appended to the end.
Obtains a linear inequality ``(\\mathbf{G}^\\star, \\beta^\\star)`` bounding the convex hull of the
set of `vertices` (``\\mathcal{V}``) and is violated by the `test_behavior` ``(\\mathbf{P}\\notin \\text{Conv}(\\mathcal{V}))``.
This task is achieved using the linear program described by Brunner et al. in Eq. 19 of
[https://arxiv.org/abs/1303.2849](https://arxiv.org/abs/1303.2849). The linear program is
```math
\\begin{align}
\\min_{(\\mathbf{G}, \\beta)} \\quad & \\langle \\mathbf{G},\\mathbf{P}\\rangle - \\beta & \\notag\\\\
\\text{s.t.} \\quad & \\langle \\mathbf{G}, \\mathbf{V} \\rangle - \\beta \\leq 0 & \\quad \\forall \\;\\; \\mathbf{V} \\in \\mathcal{V} \\notag\\\\
& \\langle \\mathbf{G}, \\mathbf{P} \\rangle \\leq 1 & \\notag\\\\
\\end{align}
```
The solution to the linear program is a linear nonclassicality witness ``(\\mathbf{G}^\\star, \\beta^\\star)`` becuase the
constraint ``\\lange\\mathbf{G}^\\star, \\mathbf{V} \\rangle - \\beta^\\star \\leq 0`` ensures that no behavior in the polytope
``\\text{Conv}(\\mathcal{V})`` can violate the inequality. Provided that ``\\mathbf{P} \\notin \\text{Conv}(\\mathcal{V})``
technique the output linear inequality witnesses the nonclassicality of the `test_behavior`.
The optimized facet inequality ``(\\mathbf{G}^\\star, \\beta^\\star)`` is returned as a vector ``(G^\\star_{0,0}, \\dots, G^\\star_{Y,X}, -\\beta^\\star)``
where ``G^\\star_{y,x}`` are the elements of ``\\mathbf{G}^\\star``.
!!! note "Converting Output into Bell Game"
The linear programming software outputs numerical values that have numerical error. Moreover, the linear inequality is
scaled such that the classical bound is zero and the `test_behavior` score is one. In order to convert the output
inequality into a `BellGame`, care must be taken to obtain the correct scaling factor to ensure that elements are integers.
!!! note "Classical Test Behavior"
If the `test_behavior` ``\\mathbf{P}`` is classical, meaning it satisfies ``\\mathbf{P}\\in\\text{Conv}(\\mathcal{V})``,
then the optimized linear inequality is the zeros vector.
"""
function linear_nonclassicality_witness(
vertices :: Vector{Vector{T}} where T <: Real,
Expand Down

0 comments on commit a4dbb9d

Please sign in to comment.