Documentation

CslibFrontier.Probability.ApproxEq

Closeness of real numbers up to an error #

x ≈[ε] y says that the real numbers x and y differ by at most ε: |x - y| ≤ ε. It is the relation of a game-hopping argument [BS23]: each hop changes the probability of an event by at most its loss, and the losses add along a chain. The relation has a Trans instance that adds the errors, and Eq steps compose with it, so a sequence of games reads as a calc block:

calc Pr[G₀] = Pr[G₁] := by rw [h₀₁]
  _ ≈[ε₁] Pr[G₂] := h₁₂
  _ ≈[ε₂] Pr[G₃] := h₂₃

which proves Pr[G₀] ≈[ε₁ + ε₂] Pr[G₃]. The definition is exposed, so a proof of |x - y| ≤ ε is a proof of x ≈[ε] y.

The notation is scoped: open Cslib.Probability enables it, as does open Probability inside the namespace Cslib.

Main definitions #

Main results #

References #

x ≈[ε] y: the real numbers x and y differ by at most ε, that is, |x - y| ≤ ε.

Instances For

    x ≈[ε] y: the real numbers x and y differ by at most ε, that is, |x - y| ≤ ε.

    A real number is 0-close to itself.

    theorem Cslib.Probability.ApproxEq.symm {ε x y : ℝ} (h : ApproxEq ε x y) :
    ApproxEq ε y x

    Closeness is symmetric.

    theorem Cslib.Probability.ApproxEq.trans {ε δ x y z : ℝ} (h₁ : ApproxEq ε x y) (h₂ : ApproxEq δ y z) :
    ApproxEq (ε + δ) x z

    Game hopping: errors add along a chain.

    @[instance_reducible]
    theorem Cslib.Probability.ApproxEq.mono {ε δ x y : ℝ} (h : ApproxEq ε x y) (hle : ε ≤ δ) :
    ApproxEq δ x y

    Enlarging the error preserves closeness.

    theorem Cslib.Probability.ApproxEq.le_add {ε x y : ℝ} (h : ApproxEq ε x y) :
    x ≤ y + ε

    The upper one-sided bound: x ≤ y + ε.

    theorem Cslib.Probability.ApproxEq.sub_le {ε x y : ℝ} (h : ApproxEq ε x y) :
    y - ε ≤ x

    The lower one-sided bound: y - ε ≤ x.