Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions data/problems/gaussian-wiretap-channel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
id: gaussian-wiretap-channel
title: Degraded Gaussian wiretap channel
status: solved
updated: '2026-09-14'
updated: '2026-11-05'
summary: A Gaussian receiver has a lower noise variance than the eavesdropper, yielding a closed-form
secrecy capacity.
tags:
Expand All @@ -22,7 +22,7 @@ tags:
model:
input: \(X\in\mathbb R\) with average power \(P\).
output: \(Y=X+N_1\) and \(Z=X+N_2\).
law: Gaussian noise variances satisfy \(\sigma_1^2<\sigma_2^2\).
law: Gaussian noise variances satisfy \(0<\sigma_1^2<\sigma_2^2\).
assumptions:
- The eavesdropper channel is degraded.
- For every message m and every private seed s, sum_t x_t(m,s)^2 <= n P. This constraint is not averaged
Expand Down
1 change: 1 addition & 0 deletions lean/CapacityAtlas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ import CapacityAtlas.Tests.GaussianMIMOBroadcast
import CapacityAtlas.Tests.GaussianMIMOBroadcastRegion
import CapacityAtlas.Tests.WirelessTransport
import CapacityAtlas.Tests.GaussianInterference
import CapacityAtlas.Tests.GaussianWiretap
46 changes: 46 additions & 0 deletions lean/CapacityAtlas/Tests/GaussianWiretap.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/-
Copyright 2026 The Capacity Atlas Authors
Licensed under the Apache License, Version 2.0 (the "License").
See https://www.apache.org/licenses/LICENSE-2.0
-/

import CapacityAtlasUtil.Metadata
import CapacityAtlasForMathlib.InformationTheory.GaussianWiretap

namespace CapacityAtlas.Tests

private def distinctSymbolWiretapCode : Gaussian.WiretapCode 1 where
messages := 2
messages_pos := by decide
seeds := 1
seeds_pos := by decide
encode := fun m _ _ ↦ (m.val : ℝ)
decode := {
apply := fun _ ↦ 0
measurable_fiber := fun m ↦ by
by_cases h : (0 : Fin 2) = m <;> simp [h] }

/-- Nonpositive variance gives a totalized density formula, outside its information domain. -/
@[capacity_test]
theorem gaussianWiretap_density_formula_nonpositive_noise {n : ℕ} (N : ℝ) (hN : N ≤ 0)
(c : Gaussian.WiretapCode (n + 1)) :
(∀ m z, Gaussian.wiretapConditionalDensity N c m z = 0) ∧
(∀ z, Gaussian.wiretapOutputDensity N c z = 0) ∧
Gaussian.wiretapLeakage N c = 0 := by
simp [Gaussian.wiretapConditionalDensity, Gaussian.wiretapOutputDensity,
Gaussian.wiretapLeakage, Real.toNNReal_of_nonpos hN]

/-- Distinct noiseless outputs coexist with the density formula's zero boundary value. -/
@[capacity_test]
theorem gaussianWiretap_zero_noise_density_boundary :
Function.Injective (fun m ↦ distinctSymbolWiretapCode.encode m ⟨0, by decide⟩ 0) ∧
Gaussian.wiretapLeakage 0 distinctSymbolWiretapCode = 0 := by
constructor
· intro m m' h
apply Fin.ext
change (m.val : ℝ) = (m'.val : ℝ) at h
exact_mod_cast h
· exact (gaussianWiretap_density_formula_nonpositive_noise 0 le_rfl
distinctSymbolWiretapCode).2.2

end CapacityAtlas.Tests
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,29 @@ noncomputable def wiretapError (N : ℝ) {n : ℕ} (c : WiretapCode n) : ℝ :=
(c.messages * c.seeds : ℝ)⁻¹ * ∑ m, ∑ seed,
((noise N n) {z | c.decode.apply (fun t ↦ c.encode m seed t + z t) ≠ m}).toReal

/-- Eavesdropper output-block density for a fixed message, averaged over encoder seeds. -/
/-- For `0 < N`, the eavesdropper output's Lebesgue density conditional on a fixed message,
averaged uniformly over encoder seeds. Values at `N ≤ 0` are only totalized formula values. -/
noncomputable def wiretapConditionalDensity (N : ℝ) {n : ℕ} (c : WiretapCode n)
(m : Fin c.messages) (z : Fin n → ℝ) : ℝ :=
(c.seeds : ℝ)⁻¹ * ∑ seed, ∏ t, gaussianPDFReal (c.encode m seed t) N.toNNReal (z t)

/-- Eavesdropper output-block density averaged uniformly over messages and encoder seeds. -/
/-- For `0 < N`, the eavesdropper output's Lebesgue density averaged uniformly over messages
and encoder seeds. Values at `N ≤ 0` are only totalized formula values. -/
noncomputable def wiretapOutputDensity (N : ℝ) {n : ℕ} (c : WiretapCode n)
(z : Fin n → ℝ) : ℝ :=
(c.messages : ℝ)⁻¹ * ∑ m, wiretapConditionalDensity N c m z

/-- Unnormalized I(M;Z^n) in bits. No division by blocklength. -/
/-- Density formula for unnormalized `I(M; Z^n)` in bits, valid for `0 < N`.
There is no division by blocklength. At `N ≤ 0` and positive blocklength, the densities
and this formula are zero; this value must not be used as noiseless mutual information. -/
noncomputable def wiretapLeakage (N : ℝ) {n : ℕ} (c : WiretapCode n) : ℝ :=
((c.messages : ℝ)⁻¹ * ∑ m,
∫ z : Fin n → ℝ, wiretapConditionalDensity N c m z *
Real.log (wiretapConditionalDensity N c m z / wiretapOutputDensity N c z)) / Real.log 2

/-- Operational secrecy capacity with vanishing decoding error and unnormalized message leakage. -/
/-- Operational secrecy capacity for `0 < N₁` and `0 < N₂`, with vanishing decoding error
and unnormalized message leakage. At `N₂ ≤ 0`, the density-based leakage criterion is
outside its intended domain. -/
noncomputable def wiretapCapacity (P N₁ N₂ : ℝ) : ℝ :=
Operational.capacity WiretapCode (fun _ c ↦ MessageSeedPowerAdmissible P c)
(fun _ c ↦ max (wiretapError N₁ c) (wiretapLeakage N₂ c))
Expand Down
Loading