EasyCrypt's alias #
stmt_alias{i} n x = e -- EC's `alias{i} n x = e`
Before EC's statement n of side i (from 1, the resets inlining leaves not counted), the
assignment x <- e to a fresh local x: it records e there, for the conditions after. The
judgment about the code with the assignment gives the one without
(prhlStmt_alias_left/_right): the code does not touch x (it commutes with every write to
x, shown as for stmt_swap), and the postcondition does not read x on that side (a goal
when simp cannot show it). x's type is e's.
theorem
GaudisCrypt.Stmt.ewp_alias
{α : Type}
(x : Lens α ProgramState)
(e : Getter α ProgramState)
{s₁ s₂ : Stmt}
(h₁ : ∀ (v : α), s₁.CommutesWith (x.set v))
(h₂ : ∀ (v : α), s₂.CommutesWith (x.set v))
(g : ProgramState → ENNReal)
(σ : ProgramState)
:
Running s₁; x <- e; s₂ and putting x back to its value at the start is running
s₁; s₂, when neither touches x.
theorem
GaudisCrypt.programDenotation_alias
{α : Type}
(x : Lens α ProgramState)
(e : Getter α ProgramState)
{s₁ s₂ : Stmt}
(h₁ : ∀ (v : α), s₁.CommutesWith (x.set v))
(h₂ : ∀ (v : α), s₂.CommutesWith (x.set v))
(σ : ProgramState)
(F : Unit × ProgramState → ENNReal)
:
((programDenotation
(GaudiProg[
stmt s₁;
x <- §e;
stmt s₂;
])
σ).expected
fun (r : Unit × ProgramState) => F (r.1, x.set (x.get σ) r.2)) = (programDenotation
(GaudiProg[
stmt s₁;
stmt s₂;
])
σ).expected
F
A statement's run is determined by its expectations, here put through a state map.
EC's alias{i} n x = e: see the module docstring.
Equations
- One or more equations did not get rendered due to their size.