Documentation

GaudisCrypt.Logic.PHoareSeq

pHL's seq with five bounds (EasyCrypt's seq n : E p₁ p₂ p₃ p₄ I) #

For an upper bound on c₁; c₂, EC's

seq n : E p₁ p₂ p₃ p₄ I

splits at the n-th statement over the intermediate event E: c₁ reaches E with probability at most p₁ and ¬E with at most p₃; from E (and the invariant I, which c₁ establishes) c₂ reaches the postcondition with at most p₂, from ¬E with at most p₄; and p₁ p₂ + p₃ p₄ ≤ r.

phoareStmt_seq_le is the rule; phoare_seq n : E p₁ p₂ p₃ p₄ I applies it, splitting after the first n statements (EC's count), with E and I written like the judgment's conditions (§x). The goals, in EC's order: I (a Hoare triple about c₁), c₁'s bounds for E, c₂'s from E ∧ I, c₁'s for ¬E, c₂'s from ¬E ∧ I, the arithmetic. A bound 1 on an event (EC's 1%r) is closed on the spot.

seq n : P on a lossless goal #

For phoare[ c₁; c₂ : A ==> 1 ] = 1 (islossless), EC's seq n : P asks that c₁ reaches P with probability 1 and that c₂ is lossless from P (phoareStmt_seq_eq_one): phoare_seq_lossless n : (P), goals first, second. With P = True (EC's seq n : true) the first goal is the losslessness of c₁.

theorem GaudisCrypt.phoareStmt_seq_le {A : ProgramState → Prop} {s₁ s₂ : Stmt} (E I : ProgramState → Prop) {Q : ProgramState → ENNReal} (p₁ p₂ p₃ p₄ : ENNReal) {r : ProgramState → ENNReal} (hI : hoareStmt A s₁ I) (h₁ : phoareStmt A s₁ (fun (τ : ProgramState) => indicatorE (E τ)) LE.le fun (x : ProgramState) => p₁) (h₂ : phoareStmt (fun (τ : ProgramState) => E τ ∧ I τ) s₂ Q LE.le fun (x : ProgramState) => p₂) (h₃ : phoareStmt A s₁ (fun (τ : ProgramState) => indicatorE ¬E τ) LE.le fun (x : ProgramState) => p₃) (h₄ : phoareStmt (fun (τ : ProgramState) => ¬E τ ∧ I τ) s₂ Q LE.le fun (x : ProgramState) => p₄) (hr : ∀ (σ : ProgramState), A σ → p₁ * p₂ + p₃ * p₄ ≤ r σ) :
phoareStmt A (GaudiProg[ stmt s₁; stmt s₂; ]) Q LE.le r

pHL's seq with five bounds, for an upper bound.

theorem GaudisCrypt.phoareStmt_indicator_le_one (A : ProgramState → Prop) (s : Stmt) (E : ProgramState → Prop) :
phoareStmt A s (fun (τ : ProgramState) => indicatorE (E τ)) LE.le fun (x : ProgramState) => 1

An event has probability at most 1 (EC's bound 1%r).

theorem GaudisCrypt.phoareStmt_seq_eq_one {A : ProgramState → Prop} {s₁ s₂ : Stmt} (P : ProgramState → Prop) (h₁ : phoareStmt A s₁ (fun (τ : ProgramState) => indicatorE (P τ)) Eq fun (x : ProgramState) => 1) (h₂ : phoareStmt P s₂ (fun (x : ProgramState) => 1) Eq fun (x : ProgramState) => 1) :
phoareStmt A (GaudiProg[ stmt s₁; stmt s₂; ]) (fun (x : ProgramState) => 1) Eq fun (x : ProgramState) => 1

pHL's seq n : P for a lossless goal (phoare[ c₁; c₂ : A ==> 1 ] = 1): c₁ reaches P with probability 1, and from P the rest is lossless.

Split x₁; …; xₙ after its first m statements (EC's count): HoareSplit.splitSeq with the last n - m in the second block, under the lets of the local variables.

EC's seq n : E p₁ p₂ p₃ p₄ I for an upper bound (see the module docstring).

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    EC's pHL seq n : P on a lossless goal phoare[ … ==> 1 ] = 1: split after the first n statements (EC's count). Goals: the first n statements reach P with probability 1 (first; for P = True, lossless), the rest is lossless from P (second).

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For