Documentation

GaudisCrypt.Lib.EC.DListCall

A call of LoopSnoc.sample is a sampling of dlist #

EasyCrypt's Sample_LoopSnoc_eq (DList.ec's Program theory), at the level of statements: the call x <@ LoopSnoc.sample(n) has the runs of the sampling x <$ dlist d n (LoopSnoc.call_denotation). prhlStmt_seq_dlist_left is EasyCrypt's transitivity{1} { x <@ LoopSnoc.sample(n); } (true ==> ={x}) (…) on a leading sampling: it replaces it by the call, whose loop can then be inlined and related to another loop. Kept apart from DList.lean so that its importers need not be rebuilt.

theorem GaudisCrypt.EC.DList.Program.LoopSnoc.call_denotation (t : Type) [Inhabited t] (d : SubProbability t) (x : Setter (List t) ProgramState) (n : Getter ℤ ProgramState) (e : Getter (SubProbability (List t)) ProgramState) (he : ∀ (σ : ProgramState), e.get σ = dlist d (n.get σ)) (σ : ProgramState) :
programDenotation (GaudiProg[ x <- call (sample t d).procedure (§n); ]) σ = programDenotation (GaudiProg[ x <$ §e; ]) σ

The call x <@ LoopSnoc.sample(n) runs as the sampling x <$ dlist d n.

theorem GaudisCrypt.EC.prhlStmt_seq_dlist_left {t : Type} [Inhabited t] {d : SubProbability t} {A B : ProgramState → ProgramState → Prop} {b c₂ : Stmt} (x : Setter (List t) ProgramState) (n : Getter ℤ ProgramState) {e : Getter (SubProbability (List t)) ProgramState} (he : ∀ (σ : ProgramState), e.get σ = dlist d (n.get σ)) (h : prhlStmt A (GaudiProg[ x <- call (DList.Program.LoopSnoc.sample t d).procedure (§n); stmt b; ]) c₂ B) :
prhlStmt A (GaudiProg[ x <$ §e; stmt b; ]) c₂ B

EC's transitivity{1} { x <@ LoopSnoc.sample(n); } (true ==> ={x}) (…): a leading sampling of dlist d n on the left is replaced by the call of LoopSnoc.sample(n) (Sample_LoopSnoc_eq).

theorem GaudisCrypt.EC.prhlStmt_dlist_left {t : Type} [Inhabited t] {d : SubProbability t} {A B : ProgramState → ProgramState → Prop} {c₂ : Stmt} (x : Setter (List t) ProgramState) (n : Getter ℤ ProgramState) {e : Getter (SubProbability (List t)) ProgramState} (he : ∀ (σ : ProgramState), e.get σ = dlist d (n.get σ)) (h : prhlStmt A (GaudiProg[ x <- call (DList.Program.LoopSnoc.sample t d).procedure (§n); ]) c₂ B) :
prhlStmt A (GaudiProg[ x <$ §e; ]) c₂ B

prhlStmt_seq_dlist_left for a left statement that is the sampling alone.