puncture :: PhaseVector -> (PhaseVector, PhaseVector)
puncture v =
  let v' = AMV.toVector v
      u' = V.uniq v'
      gen i
        | i >= V.length v' = Nothing
        | v' V.! (i-1) == v' V.! i = Just (v' V.! i, i+1)
        | otherwise = gen $ i+1
  in (fromVector u', fromVector $ V.unfoldr gen 1)

unfold :: (b -> (a,b)) -> b -> [a]
unfold f b = let (a,b') = f b in a : unfold f b'

-- | probability assigned to \( w \), given by \( \theta = s/N - w/T
-- \), by the \( T \)-dimensional inverse-QFT of the given punctured