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 #
Cslib.Probability.ApproxEq:x ≈[ε] y, the real numbersxandydiffer by at mostε.
Main results #
Cslib.Probability.ApproxEq.trans: errors add along a chain; theTransinstance used bycalc.Cslib.Probability.ApproxEq.symm,Cslib.Probability.ApproxEq.mono: symmetry, and enlarging the error.Cslib.Probability.ApproxEq.le_add,Cslib.Probability.ApproxEq.sub_le: the one-sided bounds.
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.
Closeness is symmetric.