MathFin
Map / Probability · Laws / MathFin.Probability.Laws.Quantile

The quantile function of a law on `ℝ`

MathFin.Probability.Laws.QuantileMSC 62G30MSC 60E05MSC 91G70 source

The quantile function of a probability measure μ on ℝ is the generalized inverse of its CDF F = cdf μ:

quantile μ p = inf {x | p ≤ F x}, p ∈ (0, 1).

Mathlib has the CDF (ProbabilityTheory.cdf) but no inverse. This file supplies it, together with the facts that make it the right object.

  • The Galois connection. For p ∈ (0, 1), quantile μ p ≤ x ↔ p ≤ F x (quantile_le_iff). Everything below is read off this one equivalence. It needs neither continuity nor strict monotonicity of F, so atoms and flat stretches of F are handled without case analysis. Its contrapositive x < quantile μ p ↔ F x < p (lt_quantile_iff) is the threshold form that the bisection method (Probability/Analysis/Bisection.lean) converges under.
  • The quantile transform. Under the uniform law on (0, 1), quantile μ has law μ (hasLaw_quantile). So every law on ℝ is the image of the uniform law under a monotone map, and expectations are integrals over (0, 1): ∫ f dμ = ∫₀¹ f (quantile μ p) dp (integral_eq_setIntegral_quantile).
  • The probability integral transform. If F is continuous, F ∘ quantile μ is the identity on (0, 1) (cdf_quantile), so F(X) is uniform whenever X has law μ (hasLaw_cdf).
  • Equivariance. Quantiles commute with monotone lower-semicontinuous maps, in particular with continuous increasing ones: quantile (μ.map h) p = h (quantile μ p) (quantile_map).

In risk management quantile μ α is the value-at-risk at level α of a loss with law μ (Risk/ValueAtRisk.lean).

Main definitions

  • quantile: the generalized inverse quantile μ p = inf {x | p ≤ cdf μ x} of the CDF of a law μ on ℝ, meaningful for p ∈ (0, 1).

Main results

  • quantile_le_iff, lt_quantile_iff: the Galois connection with the CDF.
  • le_cdf_quantile: p ≤ F (quantile μ p), from right-continuity of F.
  • monotoneOn_quantile, aemeasurable_quantile: monotone, hence measurable, on (0, 1).
  • quantile_dirac: a point mass is its own quantile.
  • quantile_eq_iff: a quantile is characterized by the CDF on both sides of it.
  • quantile_expMeasure: the exponential quantile −log(1 − p)/r.
  • uniformIoo_Iic: the uniform law on (0, 1) gives (-∞, c] mass c.
  • hasLaw_quantile: the quantile transform.
  • integral_eq_setIntegral_quantile: expectations as integrals of the quantile function.
  • continuous_cdf: a law without atoms has a continuous CDF.
  • cdf_quantile, hasLaw_cdf: the probability integral transform.
  • quantile_cdf: quantile μ (F x) = x when F is strictly increasing.
  • quantile_map: equivariance under monotone lower-semicontinuous maps.

References

  • A. J. McNeil, R. Frey and P. Embrechts, Quantitative Risk Management: Concepts, Techniques and Tools [McNeilFreyEmbrechts], Appendix A.1.2; Proposition 7.2; Proposition 7.2 / Appendix A.1.2; Proposition A.3
  • QRM Exercise Book [QRMExerciseBook], Ex. 2.21; Ex. 2.6; Ex. 7.2

Tags

generalized inverse CDF, quantile function, probability integral transform, quantile transform, value-at-risk, Galois connection, MSC 62G30, MSC 60E05, MSC 91G70

Import neighbourhood

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

Corpus entries

qrm-quantile-transform · quantitative_risk_management.json · full statement
Quantile Transform

For every probability measure μ on ℝ, its quantile function (the generalized inverse p ↦ inf{x | p ≤ F(x)} of the CDF) has law μ under the uniform law on (0, 1).

qrm-quantile-galois · quantitative_risk_management.json · full statement
Quantile–CDF Galois Connection

For p ∈ (0, 1) and any measure μ on ℝ, quantile μ p ≤ x ↔ p ≤ F_μ(x): the generalized inverse of the CDF is its lower adjoint, with no continuity or strict-monotonicity assumption.

qrm-probability-integral-transform · quantitative_risk_management.json · full statement
Probability Integral Transform

If X has law μ and the CDF F of μ is continuous, then F(X) is uniformly distributed on (0, 1).

qrm-quantile-equivariance · quantitative_risk_management.json · full statement
Quantiles Commute with Monotone Maps

For a probability measure μ, a monotone lower-semicontinuous h (e.g. continuous increasing) and p ∈ (0, 1): the p-quantile of the image law μ∘h⁻¹ is h(quantile μ p).

Declarations 23

defMathFin.quantilesource
Measure ℝ → ℝ → ℝ

The quantile function of a law μ on ℝ: the generalized inverse of its CDF, quantile μ p = inf {x | p ≤ cdf μ x}. Its values are meaningful for p ∈ (0, 1), where the set is nonempty and bounded below.

theoremMathFin.isProbabilityMeasure_volume_restrict_Ioo_zero_one @[instance]source
IsProbabilityMeasure (volume.restrict (Set.Ioo 0 1))

The uniform law on (0, 1) is a probability measure.

theoremMathFin.nonempty_setOf_le_cdfsource
∀ {μ : Measure ℝ} {p : ℝ}, p < 1 → {x | p ≤ ↑(cdf μ) x}.Nonempty

For p < 1 some x has p ≤ F x, because F → 1 at +∞.

used by 1: le_cdf_quantile
theoremMathFin.bddBelow_setOf_le_cdfsource
∀ {μ : Measure ℝ} {p : ℝ}, 0 < p → BddBelow {x | p ≤ ↑(cdf μ) x}

For 0 < p the set {x | p ≤ F x} is bounded below, because F → 0 at -∞.

used by 1: quantile_le_iff
theoremMathFin.le_cdf_quantilesource
∀ {μ : Measure ℝ} {p : ℝ}, p ∈ Set.Ioo 0 1 → p ≤ ↑(cdf μ) (quantile μ p)

Right-continuity of F keeps the infimum inside the set: p ≤ F (quantile μ p).

theoremMathFin.quantile_le_iffsource
∀ {μ : Measure ℝ} {p x : ℝ}, p ∈ Set.Ioo 0 1 → (quantile μ p ≤ x ↔ p ≤ ↑(cdf μ) x)

The Galois connection between the quantile function and the CDF: for p ∈ (0, 1), quantile μ p ≤ x ↔ p ≤ F x.

theoremMathFin.lt_quantile_iffsource
∀ {μ : Measure ℝ} {p x : ℝ}, p ∈ Set.Ioo 0 1 → (x < quantile μ p ↔ ↑(cdf μ) x < p)

The Galois connection read contrapositively: x < quantile μ p ↔ F x < p. The quantile is the threshold of the CDF against p.

theoremMathFin.monotoneOn_quantilesource
∀ {μ : Measure ℝ}, MonotoneOn (quantile μ) (Set.Ioo 0 1)

The quantile function is monotone on (0, 1).

theoremMathFin.aemeasurable_quantilesource
∀ {μ : Measure ℝ}, AEMeasurable (quantile μ) (volume.restrict (Set.Ioo 0 1))

Monotone on (0, 1), hence measurable for the uniform law there.

theoremMathFin.quantile_diracsource
∀ {p : ℝ} (a : ℝ), p ∈ Set.Ioo 0 1 → quantile (Measure.dirac a) p = a

A point mass sits at its own quantile at every level.

theoremMathFin.quantile_eq_iffsource
∀ {μ : Measure ℝ} {p : ℝ}, p ∈ Set.Ioo 0 1 → ∀ {a : ℝ}, quantile μ p = a ↔ p ≤ ↑(cdf μ) a ∧ ∀ x < a, ↑(cdf μ) x < p

A level's quantile is pinned down by the CDF: quantile μ p = a exactly when p ≤ F(a) and F(x) < p for every x < a.

theoremMathFin.quantile_expMeasuresource
∀ {p r : ℝ}, 0 < r → p ∈ Set.Ioo 0 1 → quantile (expMeasure r) p = -Real.log (1 - p) / r

The quantile of the exponential law with rate r: quantile (Exp r) p = −log(1 − p)/r.

theoremMathFin.uniformIoo_Iicsource
∀ {c : ℝ}, 0 ≤ c → c ≤ 1 → (volume.restrict (Set.Ioo 0 1)) (Set.Iic c) = ENNReal.ofReal c

The uniform law on (0, 1) gives (-∞, c] mass c for c ∈ [0, 1].

theoremMathFin.hasLaw_quantilesource
∀ (μ : Measure ℝ) [IsProbabilityMeasure μ], HasLaw (quantile μ) μ (volume.restrict (Set.Ioo 0 1))

The quantile transform. Under the uniform law on (0, 1), the quantile function of a probability measure μ has law μ: every law on ℝ is the image of the uniform law under its own quantile function.

theoremMathFin.integral_eq_setIntegral_quantilesource
∀ {μ : Measure ℝ} [IsProbabilityMeasure μ] {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : ℝ → E}, AEStronglyMeasurable f μ → ∫ (x : ℝ), f x ∂μ = ∫ (p : ℝ) in Set.Ioo 0 1, f (quantile μ p)

Expectations as integrals of the quantile function: ∫ f dμ = ∫₀¹ f (quantile μ p) dp.

theoremMathFin.integrableOn_comp_quantile_iffsource
∀ {μ : Measure ℝ} [IsProbabilityMeasure μ] {E : Type u_1} [NormedAddCommGroup E] {f : ℝ → E}, AEStronglyMeasurable f μ → (IntegrableOn (fun p => f (quantile μ p)) (Set.Ioo 0 1) volume ↔ Integrable f μ)

Integrability transfers along the quantile transform.

theoremMathFin.continuous_cdfsource
∀ {μ : Measure ℝ} [IsProbabilityMeasure μ] [NullSingletonClass μ], Continuous ↑(cdf μ)

A law without atoms has a continuous CDF: the jump of F at x is the mass of {x}.

theoremMathFin.cdf_quantilesource
∀ {μ : Measure ℝ} {p : ℝ}, Continuous ↑(cdf μ) → p ∈ Set.Ioo 0 1 → ↑(cdf μ) (quantile μ p) = p

If F is continuous, F ∘ quantile μ is the identity on (0, 1).

theoremMathFin.hasLaw_cdfsource
∀ {μ : Measure ℝ} {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {P : Measure Ω} {X : Ω → ℝ} [IsProbabilityMeasure μ], HasLaw X μ P → Continuous ↑(cdf μ) → HasLaw (fun ω => ↑(cdf μ) (X ω)) (volume.restrict (Set.Ioo 0 1)) P

The probability integral transform: if X has law μ and F is continuous, then F(X) is uniform on (0, 1).

theoremMathFin.quantile_cdfsource
∀ {μ : Measure ℝ} {x : ℝ}, StrictMono ↑(cdf μ) → ↑(cdf μ) x ∈ Set.Ioo 0 1 → quantile μ (↑(cdf μ) x) = x

If F is strictly increasing, quantile μ ∘ F is the identity where F ∈ (0, 1).

used by 1: PhiInv_Phi
theoremMathFin.quantile_mapsource
∀ {μ : Measure ℝ} {p : ℝ} [IsProbabilityMeasure μ] {h : ℝ → ℝ}, Monotone h → LowerSemicontinuous h → p ∈ Set.Ioo 0 1 → quantile (Measure.map h μ) p = h (quantile μ p)

Quantiles commute with monotone lower-semicontinuous maps: quantile (μ.map h) p = h (quantile μ p). Lower semicontinuity makes {h ≤ y} closed, which is what keeps the lower sets of h ∘ quantile and of the image quantile aligned; continuous increasing maps are the main instance (quantile_map_of_strictMono).

theoremMathFin.quantile_map_of_strictMonosource
∀ {μ : Measure ℝ} {p : ℝ} [IsProbabilityMeasure μ] {h : ℝ → ℝ}, StrictMono h → Continuous h → p ∈ Set.Ioo 0 1 → quantile (Measure.map h μ) p = h (quantile μ p)

Quantiles commute with continuous strictly increasing maps (MFE Exercise 2.21).

theoremMathFin.quantile_map_affinesource
∀ {μ : Measure ℝ} {p : ℝ} [IsProbabilityMeasure μ] {a b : ℝ}, 0 < a → p ∈ Set.Ioo 0 1 → quantile (Measure.map (fun x => a * x + b) μ) p = a * quantile μ p + b

Quantiles are affine-equivariant: quantile (μ.map (a · + b)) p = a · quantile μ p + b for a > 0.