EasyCrypt's byequiv and byphoare, on probabilities #
A goal about probabilities, as Pr[ M (a) @ &m : E ] writes them (Syntax/PrSyntax.lean: the
real (Procedure.Pr p a m E : ℝ)), is turned into a judgment:
byequiv—Pr[ p₁ … ] = Pr[ p₂ … ](or≤, or EC's up to badPr[ p₁ : E₁ ] ≤ Pr[ p₂ : E₂ ] + Pr[ p₂ : F₂ ],QgivingE₂ ∨ F₂) fromequiv[ p₁ ~ p₂ : P ==> Q ], with the precondition holding of the two runs' arguments and memories andQrelating the events (E₁ ↔ E₂, for≤E₁ → E₂). Without a term, the judgment is the new goal with EC's defaults:Pis={arg, glob}(the arguments and the globals agree) when both sides run on the same arguments from the same memory, elsearg{i} = aᵢ ∧ glob{i} = mᵢ;Qrelates the events. With a termh(a judgment), the side conditions are the goals.byphoare—Pr[ p … ] ≤ x(or=,≥) fromphoare[ p : P ==> E ] ≤ r(=,≥), the boundrread at the run's arguments and memory againstENNReal.ofReal x(EC's bounds are reals). Without a term, the judgment is the new goal, with the preconditionarg = a ∧ glob = mand the boundENNReal.ofReal x.
The side conditions left are tried by rfl/trivial/simp_all; 0 ≤ x (a bound below a
probability is non-negative) by positivity.
byphoare for ≤.
byphoare for ≥.
byphoare for =.
byequiv for =, on real probabilities.
byequiv for ≤, on real probabilities.
byequiv up to a bad event (EC's byequiv … => //# on Pr[p₁ : E₁] <= Pr[p₂ : E₂] + Pr[p₂ : F₂]): the judgment gives E₂ ∨ F₂ from E₁, then the union bound.
NNReal.toReal (Procedure.Pr p a m E): (sig, p, a, m, E).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Try to close the side goals a rule leaves (each left as it is on failure).
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's byequiv, see the module docstring.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A lossless procedure's probability of an event that always holds is 1 (EC's
byphoare Hl with Hl : islossless p on Pr[ p @ &m : true ] = 1%r).
EC's byphoare, see the module docstring.
Equations
- One or more equations did not get rendered due to their size.
Instances For
EC's byequiv (_ : P ==> Q): byequiv with the judgment equiv[ p₁ ~ p₂ : P ==> Q ]
(P, Q relational conditions on the two procedures, res their results) as the new goal; the
side conditions (P of the two runs, Q implying the events) as goals when not closed.
Equations
- One or more equations did not get rendered due to their size.