MathFin
Map / Risk · Value at risk and expected shortfall / MathFin.Risk.DiscreteVaR

Value-at-risk and expected shortfall at a finite law

MathFin.Risk.DiscreteVaRMSC 91G70JEL G32 source

For a loss L : ι → ℝ on a finite state space with probability vector q : Convexity.StdSimplex ℝ ι (weights q.weights i ≥ 0 summing to 1), value-at-risk is VaR_α = inf {x | α ≤ ∑_{L i ≤ x} q i} (finiteVaR) and expected shortfall is the quantile average ES_α = (1 − α)⁻¹ ∫_α^1 VaR_u du (finiteES). For α ∈ (0, 1) these are valueAtRisk and expectedShortfall of Risk/ValueAtRisk.lean at the law ∑ i, q i • δ_i (finiteVaR_eq_valueAtRisk, finiteES_eq_expectedShortfall), written as Finset sums so that concrete laws evaluate by case analysis on the loss level. The probability vector is bundled, so no lemma threads nonnegativity and total mass; the two half-bonds' joint law is the product StdSimplex.prod of the single bond's law with itself.

The file works the two-bond example. A single $100 bond defaulting with probability 1/25 has VaR₀.₉₅ = 0: the loss is 0 with probability 24/25 ≥ 0.95. The same exposure split into two $50 bonds defaulting independently has VaR₀.₉₅ = 50, so VaR penalizes the diversified position. At the single bond, expected shortfall is 80 while the conditional tail mean E[L | L ≥ VaR₀.₉₅] is the unconditional mean 4.

These are worked instances of general results in the library. In Risk/VaRSuperadditivity.lean, valueAtRisk_sum_bernoulli_of_card_two is the two-loan example for independent (iIndepFun), identically distributed unit losses sharing one default probability p: on (1 − p)² < α ≤ 1 − p each loan has VaR 0 and the portfolio VaR 1. The exact superadditivity window, for α ∈ (0, 1) and any number of independent, identically distributed Bernoulli losses (same shared p), is valueAtRisk_sum_bernoulli_superadditive_iff. For an integrable loss and α ∈ (0, 1), the dual representation of ES over bounded densities is isGreatest_integral_mul_expectedShortfall (Risk/ExpectedShortfall.lean).

Main definitions

  • finiteVaR: value-at-risk at a finite law, inf {x | α ≤ ∑_{L i ≤ x} qᵢ}, for a loss L and a bundled probability vector q.
  • finiteES: expected shortfall at a finite law, (1 − α)⁻¹ ∫_α^1 finiteVaR q L u du.
  • Measure.ofWeights univ q.weights: the law ∑ᵢ qᵢ • δᵢ of a probability vector (Probability/Laws/FiniteWeights), a probability measure.
  • condTailMean: the q-weighted mean of L over the tail event {i | finiteVaR q L α ≤ L i}, divided by the tail mass.
  • oneQ, oneL, jointQ, halfL₁, halfL₂: the data of the worked example, a single $100 bond defaulting with probability 1/25 against two independent $50 bonds.

Main results

  • finiteVaR_eq_valueAtRisk, finiteES_eq_expectedShortfall: for α ∈ (0, 1), the finite forms agree with the general definitions at the law ∑ i, q i • δ_i.
  • finiteVaR_eq_value_min: for α ∈ (0, 1], VaR at a finite law is attained at a loss value.
  • finiteVaR_le_of_forall_le: a uniform cap on every outcome's loss caps VaR the same way.
  • finiteVaR_const_mul: positive homogeneity, finiteVaR q (fun i ↦ c * L i) α = c * finiteVaR q L α for c ≥ 0, inherited from valueAtRisk_const_mul through the bridge.
  • finiteVaR_two_point: for α ∈ (0, 1], VaR of a loss that is 0 with mass a and c > 0 with mass 1 - a.
  • uniformWeights: the equal-1/n-weights StdSimplex on n observations.
  • finiteVaR_one_bond, finiteVaR_two_halves: VaR₀.₉₅ is 0 for the single bond and 50 for the split position.
  • finiteVaR_subadditivity_fails: on the joint space of the two half-bonds, the halves' VaR₀.₉₅ sum to less than the total's (which is 50 by finiteVaR_two_halves). valueAtRisk_ofWeights_subadditivity_fails states the same failure for the library's valueAtRisk at the law ∑ p, jointQ p • δ_p.
  • finiteVaR_counterexample_window: for the two half-bonds and α ∈ (0, 1], subadditivity fails exactly for (24/25)² < α ≤ 24/25.
  • finiteES_one_bond: ES₀.₉₅ = 80 for the single bond.
  • condTailMean_one_bond: at the single bond the tail event {L ≥ VaR₀.₉₅} is the whole space, so the conditional tail mean is E[L] = 4.
  • isGreatest_finiteES_one_bond: for the single bond, ES₀.₉₅ is the greatest E[Z·L] over densities 0 ≤ Z ≤ (1 − 19/20)⁻¹ with E[Z] = 1.

References

Tags

value at risk, expected shortfall, finite loss distribution, VaR subadditivity failure, bond portfolio example, conditional tail mean, MSC 91G70, JEL G32

Import neighbourhood

Above: what it imports. Below: what imports it.

Corpus entries

mf-discrete-es-vs-tail-mean · risk_measures.json · full statement
Expected Shortfall Versus the Conditional Tail Mean at an Atom

Let L be the loss of a bond that loses 100 with probability 1/25 and 0 otherwise. At level 0.95 the library's expected shortfall of the law of L, ES₀.₉₅ = 20 ∫_{0.95}^{1} VaR_u du, is 80, while the conditional tail mean E[L | L ≥ VaR₀.₉₅] is 4: VaR₀.₉₅ = 0 sits on the atom at 0, so the tail event {L ≥ 0} is the whole space and the conditional tail mean is the unconditional mean.

Declarations 33

defMathFin.DiscreteVaR.finiteVaRsource
{ι : Type u_1} → [Fintype ι] → Convexity.StdSimplex ℝ ι → (ι → ℝ) → ℝ → ℝ

VaR at a finite law: the infimum of the loss levels x at which the q-mass of {i | L i ≤ x} reaches α. For α ∈ (0, 1] the set is nonempty and bounded below, which is the only range used in this file. Outside that range the set can be empty or all of ℝ, where sInf returns the junk value 0.

defMathFin.DiscreteVaR.finiteESsource
{ι : Type u_1} → [Fintype ι] → Convexity.StdSimplex ℝ ι → (ι → ℝ) → ℝ → ℝ

ES at a finite law: the quantile average, (1 - α)⁻¹ times the oriented interval integral ∫ u in α..1 of the quantile function u ↦ finiteVaR q L u. For α ∈ (0, 1) this is the quantile average over [α, 1], and the bridge finiteES_eq_expectedShortfall covers exactly that range, the only one used in this file. Elsewhere it is junk: for α ≤ 0 the integrand on [α, 0] is finiteVaR's junk value 0; at α = 1 the factor (1 - α)⁻¹ is Lean's 0⁻¹ = 0, so finiteES q L 1 = 0 for every loss; for α > 1 the integral runs backwards and the prefactor is negative.

theoremMathFin.DiscreteVaR.instIsProbabilityMeasureOfWeightsUnivCoeFinsuppRealWeights @[instance]source
∀ {ι : Type u_1} [Fintype ι] [MeasurableSpace ι] {q : Convexity.StdSimplex ℝ ι}, IsProbabilityMeasure (Measure.ofWeights Finset.univ ⇑q.weights)

The law Measure.ofWeights univ q.weights = ∑ i, q i • δ_i of a probability vector is a probability measure.

theoremMathFin.DiscreteVaR.ofWeights_real_lesource
∀ {ι : Type u_1} [Fintype ι] [MeasurableSpace ι] {q : Convexity.StdSimplex ℝ ι} [MeasurableSingletonClass ι] (L : ι → ℝ) (x : ℝ), (Measure.ofWeights Finset.univ ⇑q.weights).real {i | L i ≤ x} = ∑ i with L i ≤ x, q.weights i

Under Measure.ofWeights univ q.weights the mass of {L ≤ x} is the sum in finiteVaR.

theoremMathFin.DiscreteVaR.finiteVaR_eq_valueAtRisksource
∀ {ι : Type u_1} [Fintype ι] [MeasurableSpace ι] {q : Convexity.StdSimplex ℝ ι} [MeasurableSingletonClass ι] {L : ι → ℝ} {α : ℝ}, α ∈ Set.Ioo 0 1 → finiteVaR q L α = valueAtRisk L (Measure.ofWeights Finset.univ ⇑q.weights) α

For α ∈ (0, 1), finiteVaR is valueAtRisk at the law ∑ i, q i • δ_i.

theoremMathFin.DiscreteVaR.finiteES_eq_expectedShortfallsource
∀ {ι : Type u_1} [Fintype ι] [MeasurableSpace ι] {q : Convexity.StdSimplex ℝ ι} [MeasurableSingletonClass ι] {L : ι → ℝ} {α : ℝ}, α ∈ Set.Ioo 0 1 → finiteES q L α = expectedShortfall L (Measure.ofWeights Finset.univ ⇑q.weights) α

For α ∈ (0, 1), finiteES is expectedShortfall at the law ∑ i, q i • δ_i.

theoremMathFin.DiscreteVaR.finiteVaR_eq_of_mem_of_forall_ltsource
∀ {ι : Type u_1} [Fintype ι] {q : Convexity.StdSimplex ℝ ι} {L : ι → ℝ} {α v₀ : ℝ}, α ≤ ∑ i with L i ≤ v₀, q.weights i → (∀ x < v₀, ∑ i with L i ≤ x, q.weights i < α) → finiteVaR q L α = v₀

The evaluation principle: if the q-mass of {L ≤ v₀} reaches α and the mass of {L ≤ x} stays below α for every x < v₀, then finiteVaR q L α = v₀. Pure order arithmetic, with no hypothesis on α.

theoremMathFin.DiscreteVaR.nonempty_values_mass_gesource
∀ {ι : Type u_1} [Fintype ι] {q : Convexity.StdSimplex ℝ ι} {L : ι → ℝ} {α : ℝ}, α ≤ 1 → {v ∈ Finset.image L Finset.univ | α ≤ ∑ i with L i ≤ v, q.weights i}.Nonempty

For α ≤ 1, the loss values v at which the mass of {L ≤ v} is at least α form a nonempty finite set: at the largest loss value that mass is the full mass 1 ≥ α.

theoremMathFin.DiscreteVaR.finiteVaR_eq_value_minsource
∀ {ι : Type u_1} [Fintype ι] {q : Convexity.StdSimplex ℝ ι} {L : ι → ℝ} {α : ℝ}, 0 < α → ∀ (hα1 : α ≤ 1), finiteVaR q L α = {v ∈ Finset.image L Finset.univ | α ≤ ∑ i with L i ≤ v, q.weights i}.min' ⋯

Attainment. For α ∈ (0, 1], the infimum over ℝ is the minimum over the loss values v ∈ Finset.image L univ at which the q-mass of {L ≤ v} is at least α, so VaR is attained at a loss value.

theoremMathFin.DiscreteVaR.finiteVaR_le_of_forall_lesource
∀ {ι : Type u_1} [Fintype ι] {q : Convexity.StdSimplex ℝ ι} {L : ι → ℝ} {α : ℝ}, 0 < α → α ≤ 1 → ∀ {c : ℝ}, (∀ (i : ι), L i ≤ c) → finiteVaR q L α ≤ c

Upper bound from a uniform cap. If every outcome's loss is at most c, VaR at any level α ∈ (0, 1] is at most c too: VaR is attained at a loss value (finiteVaR_eq_value_min), and every loss value is itself at most c.

theoremMathFin.DiscreteVaR.finiteVaR_const_mulsource
∀ {ι : Type u_1} [Fintype ι] {q : Convexity.StdSimplex ℝ ι} {L : ι → ℝ} {α : ℝ} [MeasurableSpace ι] [MeasurableSingletonClass ι], α ∈ Set.Ioo 0 1 → ∀ {c : ℝ}, 0 ≤ c → finiteVaR q (fun i => c * L i) α = c * finiteVaR q L α

Positive homogeneity of finiteVaR: scaling every outcome's loss by a nonnegative constant c scales VaR by the same constant, inherited from valueAtRisk_const_mul (Risk/ValueAtRisk.lean) through the bridge finiteVaR_eq_valueAtRisk.

theoremMathFin.DiscreteVaR.finiteVaR_two_pointsource
∀ {ι : Type u_1} [Fintype ι] {q : Convexity.StdSimplex ℝ ι} {L : ι → ℝ} {α a b c : ℝ}, a + b = 1 → 0 < c → (∀ (x : ℝ), ∑ i with L i ≤ x, q.weights i = (if 0 ≤ x then a else 0) + if c ≤ x then b else 0) → 0 < α → α ≤ 1 → finiteVaR q L α = if α ≤ a then 0 else c

Two-point laws. If the mass of {L ≤ x} is 0 for x < 0, a for 0 ≤ x < c and a + b = 1 for x ≥ c, with c > 0, then at every level α ∈ (0, 1] the VaR is 0 for α ≤ a and c above.

defMathFin.DiscreteVaR.uniformWeightssource
(n : ℕ) → [NeZero n] → Convexity.StdSimplex ℝ (Fin n)

Equal weights on n observations: the 1/n probability historical simulation (and any other equally-likely-scenario construction) assigns to each of n ≥ 1 observations — Convexity.StdSimplex.barycenter (Mathlib.Geometry.Convex.ConvexSpace.Barycenter) specialized to Fin n. weights_barycenter_apply gives the closed form weights i = (n : ℝ)⁻¹ for every i.

defMathFin.DiscreteVaR.oneQsource
Convexity.StdSimplex ℝ Bool

Probability vector of the single $100 bond: default (true) with probability 1/25, survival (false) with probability 24/25.

theoremMathFin.DiscreteVaR.oneQ_true @[simp]source
oneQ.weights true = 1 / 25
theoremMathFin.DiscreteVaR.oneQ_false @[simp]source
oneQ.weights false = 24 / 25
defMathFin.DiscreteVaR.oneLsource
Bool → ℝ

Loss of the single $100 bond: 100 on default, 0 on survival.

theoremMathFin.DiscreteVaR.finiteVaR_one_bond_windowsource
∀ (α : ℝ), 0 < α → α ≤ 1 → finiteVaR oneQ oneL α = if α ≤ 24 / 25 then 0 else 100

The single-bond VaR as a function of the level α ∈ (0, 1]: 0 for α ≤ 24/25, 100 above. This is the quantile function integrated in finiteES_one_bond.

theoremMathFin.DiscreteVaR.finiteVaR_one_bondsource
finiteVaR oneQ oneL (19 / 20) = 0

The single $100 bond defaulting w.p. 1/25 has VaR₀.₉₅ = 0: the loss is 0 with probability 24/25 ≥ 19/20.

defMathFin.DiscreteVaR.jointQsource
Convexity.StdSimplex ℝ (Bool × Bool)

Joint law of the two independent $50 half-bonds (true = default): the product of the marginals 1/25 / 24/25.

defMathFin.DiscreteVaR.halfL₁source
Bool × Bool → ℝ

Loss of the first half-bond: 50 if it defaults, else 0.

defMathFin.DiscreteVaR.halfL₂source
Bool × Bool → ℝ

Loss of the second half-bond: 50 if it defaults, else 0.

theoremMathFin.DiscreteVaR.finiteVaR_half₁_windowsource
∀ (α : ℝ), 0 < α → α ≤ 1 → finiteVaR jointQ halfL₁ α = if α ≤ 24 / 25 then 0 else 50

The first half-bond's VaR as a function of the level α ∈ (0, 1].

theoremMathFin.DiscreteVaR.finiteVaR_half₂_windowsource
∀ (α : ℝ), 0 < α → α ≤ 1 → finiteVaR jointQ halfL₂ α = if α ≤ 24 / 25 then 0 else 50

The second half-bond's VaR as a function of the level α ∈ (0, 1].

theoremMathFin.DiscreteVaR.finiteVaR_joint_windowsource
∀ (α : ℝ), 0 < α → α ≤ 1 → finiteVaR jointQ (halfL₁ + halfL₂) α = if α ≤ 9216 / 10000 then 0 else if α ≤ 9984 / 10000 then 50 else 100

The total VaR of the two half-bonds as a function of the level α ∈ (0, 1]: 0 up to the mass 9216/10000 of no default, 50 up to the mass 9984/10000 of at most one default, 100 above.

theoremMathFin.DiscreteVaR.finiteVaR_two_halvessource
finiteVaR jointQ (halfL₁ + halfL₂) (19 / 20) = 50

The same exposure split into two independent $50 bonds has VaR₀.₉₅ = 50: P(L = 0) = 0.9216 < 0.95 but P(L ≤ 50) = 0.9984 ≥ 0.95.

theoremMathFin.DiscreteVaR.finiteVaR_counterexample_windowsource
∀ (α : ℝ), 0 < α → α ≤ 1 → (finiteVaR jointQ halfL₁ α + finiteVaR jointQ halfL₂ α < finiteVaR jointQ (halfL₁ + halfL₂) α ↔ 9216 / 10000 < α ∧ α ≤ 24 / 25)

The failure window. For the level α ∈ (0, 1], subadditivity fails exactly for 9216/10000 < α ≤ 24/25, where 9216/10000 = (24/25)². The right endpoint is included because the definition uses α ≤ P(L ≤ x): at α = 24/25 each half keeps VaR 0 while the total has VaR 50. At α = 9216/10000 the total VaR is still 0, so the left endpoint is excluded.

theoremMathFin.DiscreteVaR.finiteVaR_subadditivity_failssource
finiteVaR jointQ halfL₁ (19 / 20) + finiteVaR jointQ halfL₂ (19 / 20) < finiteVaR jointQ (halfL₁ + halfL₂) (19 / 20)

Subadditivity fails at the 95% level on one probability space: the two $50 half-bonds' VaR₀.₉₅ sum to less than the VaR₀.₉₅ of their total. The values are 0 for each half (finiteVaR_half₁_window, finiteVaR_half₂_window) and 50 for the total (finiteVaR_two_halves).

theoremMathFin.DiscreteVaR.valueAtRisk_ofWeights_subadditivity_failssource
valueAtRisk halfL₁ (Measure.ofWeights Finset.univ ⇑jointQ.weights) (19 / 20) + valueAtRisk halfL₂ (Measure.ofWeights Finset.univ ⇑jointQ.weights) (19 / 20) < valueAtRisk (halfL₁ + halfL₂) (Measure.ofWeights Finset.univ ⇑jointQ.weights) (19 / 20)

Subadditivity of valueAtRisk fails: the same failure for the library's valueAtRisk at the law ∑ p, jointQ p • δ_p of the two half-bonds, through the bridge finiteVaR_eq_valueAtRisk.

theoremMathFin.DiscreteVaR.finiteES_one_bondsource
finiteES oneQ oneL (19 / 20) = 80

ES₀.₉₅ = 80 for the single bond: the quantile function is 0 on [19/20, 24/25] and 100 on (24/25, 1], so the average is (1/(1/20)) · 100 · (1 - 24/25) = 80.

defMathFin.DiscreteVaR.condTailMeansource
{ι : Type u_1} → [Fintype ι] → Convexity.StdSimplex ℝ ι → (ι → ℝ) → ℝ → ℝ

E[L | L ≥ VaR_α] at a finite law: the q-weighted mean of L over the tail event {i | finiteVaR q L α ≤ L i}. For α ∈ (0, 1] the tail mass is positive (not stated as a lemma here), so this is a genuine conditional mean; outside that range the tail mass can be 0 and the quotient returns the junk value 0.

theoremMathFin.DiscreteVaR.condTailMean_one_bondsource
condTailMean oneQ oneL (19 / 20) = 4

At the single bond the tail event {L ≥ VaR₀.₉₅} = {L ≥ 0} is the whole state space, so the conditional tail mean is the unconditional expectation E[L] = 4, while ES₀.₉₅ = 80 (finiteES_one_bond).

theoremMathFin.DiscreteVaR.isGreatest_finiteES_one_bondsource
IsGreatest ((fun Z => ∑ b, oneQ.weights b * Z b * oneL b) '' {Z | (∀ (b : Bool), 0 ≤ Z b ∧ Z b ≤ (1 - 19 / 20)⁻¹) ∧ ∑ b, oneQ.weights b * Z b = 1}) (finiteES oneQ oneL (19 / 20))

For the single bond, ES₀.₉₅ is the greatest value of E[Z·L] over densities Z with 0 ≤ Z ≤ (1 - 19/20)⁻¹ = 20 and E[Z] = 1; both equal 80 (finiteES_one_bond). This is the two-state analogue of isGreatest_integral_mul_expectedShortfall. The objective is E[Z·L] = 4·Z(default), so the maximum puts Z(default) at the cap 20, and E[Z] = 1 then gives Z(survival) = 5/24.