Documentation

GaudisCrypt.Logic.LoopCommute

Programs commuting with a state update, through loops #

ProgramDenotation.CommutesU p u: running p from u st is running it from st and applying u to the final state. It is preserved by ⊥, pure, bind and the suprema of chains, and so by while_loop (the Kleene argument of ProgramDenotation.EquivInLens.while_loop). This is what stmt_swap and stmt_alias need of a loop (Stmt.CommutesWith.while, Logic/StmtSwap.lean): a loop whose guard u leaves alone and whose body commutes with u commutes with u.

def GaudisCrypt.ProgramDenotation.CommutesU {s : Type u} {α : Type v} (p : ProgramDenotation s α) (u : s → s) :

p commutes with the state update u.

Equations
Instances For
    theorem GaudisCrypt.ProgramDenotation.CommutesU.bot {s : Type u} {u : s → s} {α : Type v} :
    theorem GaudisCrypt.ProgramDenotation.CommutesU.pure {s : Type u} {u : s → s} {α : Type v} (a : α) :
    theorem GaudisCrypt.ProgramDenotation.CommutesU.bind {s : Type u} {u : s → s} {α β : Type v} {p : ProgramDenotation s α} {q : α → ProgramDenotation s β} (hp : p.CommutesU u) (hq : ∀ (a : α), (q a).CommutesU u) :
    (p >>= q).CommutesU u
    theorem GaudisCrypt.ProgramDenotation.CommutesU.get {s : Type u} {u : s → s} {α : Type v} (c : Getter α s) (hc : ∀ (st : s), c.get (u st) = c.get st) :
    theorem GaudisCrypt.ProgramDenotation.CommutesU.while_loop {s : Type u} {u : s → s} {cond : ProgramDenotation s Bool} {body : ProgramDenotation s Unit} (hc : cond.CommutesU u) (hb : body.CommutesU u) :

    A loop commutes with u when its guard and its body do.