Vulnerability of guessing a predicate of the secret

qif.measure.pred_vuln

The vulnerability of the adversary guessing whether the secret satisfies a predicate \(P\), given as a \(0/1\) array P over the secrets. This is \(g\)-vulnerability for the two-block gain function, whose two actions are “\(x \in P\)” and “\(x \notin P\)” (see g-vulnerability); for instance \(V(\pi) = \max(\pi(P), \pi(\overline P))\).

Functions

G_pred(P: ndarray, type: TypeLike = def_type) → ndarray

The gain matrix of the two-block gain function: row \(0\) is the action “\(x \in P\)” (gain \(1\) if the secret satisfies \(P\)), row \(1\) is “\(x \notin P\)”.

prior(P: ndarray, pi: ndarray) → FloatOrRat

The prior vulnerability \(\max(\pi(P), \pi(\overline P))\).

posterior(P: ndarray, pi: ndarray, C: ndarray) → FloatOrRat

The posterior vulnerability.

add_leakage(P: ndarray, pi: ndarray, C: ndarray) → FloatOrRat

The additive leakage.

mult_leakage(P: ndarray, pi: ndarray, C: ndarray) → FloatOrRat

The multiplicative leakage.

mult_capacity(P: ndarray, C: ndarray, method: str = 'direct') → Tuple[FloatOrRat, ndarray]

The multiplicative capacity: the maximum of mult_leakage() over all priors. Returns (capacity, pi), where pi is a prior achieving it.

The capacity is \(1 + \frac12 \max_{x \in P, x' \notin P} \lVert C_{x,-} - C_{x',-}\rVert_1\), achieved by the uniform prior on \(x, x'\). Only method="direct" is available.

binary_channel(P: ndarray, pi: ndarray, C: ndarray) → Tuple[ndarray, ndarray]

Reduces the problem to a binary secret “\(P\)” / “\(\overline P\)”. Returns (pi_bin, C_bin), where pi_bin \(= (\pi(P), \pi(\overline P))\) and the two rows of C_bin are the average of the rows of C on \(P\) and on \(\overline P\) (weighted by pi). The vulnerability of \(P\) under (pi, C) equals the Bayes vulnerability under (pi_bin, C_bin).