KeyrateGeneral
The Gaussian de Finetti lift to general attacks, and what it refuses
14/14 passed in 5ms
| Test | What it does | Result |
|---|---|---|
test_block_floor_rises | This link distils under a collective attack from about 4e6 symbols and under a general one only between 1.5e7 and 2e7. | ✅ pass |
test_certificate_recomputed | K^4 * eps_coll/50 recovers the general-attack target (Eq. (5) inverted) at targets 1e-6 to 1e-20. | ✅ pass |
test_cutoff_linear_in_block | K/(n*(d_A + d_B)) stays within 2% of 1 from n = 1e7 to 1e15. | ✅ pass |
test_dead_fibre_clamped | A block too short to bound the channel gives length exactly 0 while raw keeps the deficit: at n = 50 raw is minus the toll. | ✅ pass |
test_epsilon_pays_the_bill | n * cv_finite at eps_coll/3, less the toll, rebuilds raw exactly. | ✅ pass |
test_general_domain | cv_general refuses eps_target outside (0, 1), non-positive k_test, d_a and d_b, and a bad argument shared with cv_finite. | ✅ pass |
test_higher_threshold_costs | Raising d_A raises K, shrinks eps_coll and shortens the key. | ✅ pass |
test_homodyne_refused | hom = True raises NotImplementedError: Eq. (5) assumes U(n) covariance, the heterodyne no-switching protocol. | ✅ pass |
test_lift_costs_key | The general key length is 90.7% of the collective one at n = 1e9, 99.0% at 1e11 and 99.7% at 1e12. | ✅ pass |
test_more_test_modes_help | As k_test grows K falls and the key length rises, saturating by 1e8. | ✅ pass |
test_thin_sample_bound_insufficient | k_test = 51 clears 2 ln(8/eps_target) but not the bound near 220 at the settled eps ~1e-47 and is refused, while k_test = 1e3 runs. | ✅ pass |
test_thin_test_sample_refused | k_test at or below 2 ln(8/eps_target) = 50.2, where no finite cutoff exists, is refused naming that bound. | ✅ pass |
test_threshold_below_state_refused | d_a or d_b below the state's mean photon number, which understates K and lengthens the key, raises naming that value. | ✅ pass |
test_toll_is_not_the_cost | The toll ceil(2 log2 C(K+4, 4)) is 248 bits at n = 1e9 and 328 at 1e12, within a bit of 8 log2 K - 2 log2 24, and under 1e-5 of the key length. | ✅ pass |