Entanglement via PPT criterion

ClearAll["Global`*"]

Helper functions

(* Warning: This partial transpose function only works for bipartite systems. Mathematica doesn't have a bult-in. *)
PartialTranspose[mat_]:=Flatten[Transpose[Partition[mat,{2,2}]],{{1,3},{2,4}}]
IsPPT[mat_]:=Min[Eigenvalues[PartialTranspose[mat]]]≥0
ToDensityMatrix[ket_]:=Outer[Times,ket,ket]

State generation functions

BasisVector[d_,n_]:=ReplacePart[ConstantArray[0,d],(n+1)->1]
SinCosState[θ_]:=((Sin[θ])^2) BasisVector[4,0]+((Cos[θ])^2) BasisVector[4,3]
NoisySinCosState[α_,θ_]:=α ToDensityMatrix[SinCosState[θ]]+(1-α)WhiteNoise[4]
WhiteNoise[d_:4]:=IdentityMatrix[d]/d
GHZ[ld_Integer:2]:=ArrayReshape[IdentityMatrix[ld],(ld^2)]/Sqrt[2]
IsotropicState[α_,ld_:Integer:2]:=α ToDensityMatrix[GHZ[ld]]+(1-α)WhiteNoise[(ld^2)]

Under what value of α does an isotropic state become separable?

(* By default, it minimizes the first argument, given the constraints on the second, and the opt. var. in the third *)

SemidefiniteOptimization[-α,PartialTranspose@IsotropicState[α,2](Underscript[\[VectorGreaterEqual], (SemidefiniteConeList[4])])0,α]

Entanglement vs. separability for ((Cos(θ))^2)|00⟩+((Sin(θ))^2)|11⟩

(* List of equally spaced points in the [0, π/2] interval *)
θs=Subdivide[0,Pi/2,100];
(* Find the required noise to turn the state separable, for each value of θ *)
θαpairs=Table[{θ,α/.SemidefiniteOptimization[-α,PartialTranspose@NoisySinCosState[α,θ](Underscript[\[VectorGreaterEqual], (SemidefiniteConeList[4])])0,α]},{θ,θs}];
ListLinePlot[θαpairs,Filling->Top,AxesLabel->{θ,α},PlotLabels->"Entangled states"]

Comments on these examples

I aimed at the simplest possible example to introduce the main ideas in semidefinite programming. As a matter of fact, this problem does not even require optimization: we could simply do a bisection on the α ∈ [0,1] interval and test for PPT on each step, until we find the SEP/ENT threshold. However, PPT conditions frequently appear as constraints in more complicated problems, so this SDP is a building block for those.