General stuff #
@[reducible]
def
GaudisCrypt.recursion
{a : Type u_2}
{b : a → Type u_1}
[(x : a) → OmegaCompletePartialOrder (b x)]
[(x : a) → OrderBot (b x)]
(F : ((x : a) → b x) →𝒄 (x : a) → b x)
(x : a)
:
b x
Equations
Instances For
Stateful programs #
Equations
Instances For
noncomputable def
GaudisCrypt.SubProbability.toProgramDenotation
{a s : Type}
(p : SubProbability a)
:
Equations
Instances For
noncomputable def
GaudisCrypt.PMF.toProgramDenotation
{st α : Type}
(p : PMF α)
:
ProgramDenotation st α
Instances For
noncomputable def
GaudisCrypt.ProgramDenotation.uniform
{α s : Type}
[h : Fintype α]
:
[Nonempty α] → ProgramDenotation s α
Equations
Instances For
noncomputable def
GaudisCrypt.SubProbability.uniformOfFinset
{α : Type}
(fs : Finset α)
(hs : fs.Nonempty)
:
Uniform subprobability over a nonempty finset.
Equations
Instances For
noncomputable def
GaudisCrypt.ProgramDenotation.uniformOfFinset
{s α : Type}
(fs : Finset α)
(hs : fs.Nonempty)
:
Uniform sampling over a nonempty finset (used e.g. for "sample without replacement" — uniform over the complement of the values seen so far).
Equations
Instances For
def
GaudisCrypt.ProgramDenotation.finalProb1
{s a : Type}
(prog : ProgramDenotation s a)
(st : s)
(x : a)
:
Equations
- prog.finalProb1 st x = prog.finalProb st {x}
Instances For
@[implicit_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[implicit_reducible]
@[implicit_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[implicit_reducible]
theorem
GaudisCrypt.ProgramDenotation.bind_mono
{i : Type u_1}
{s a b : Type}
[Preorder i]
(f : i → ProgramDenotation s a)
(g : i → a → ProgramDenotation s b)
(hf : Monotone f)
(hg : Monotone g)
:
theorem
GaudisCrypt.ProgramDenotation.bind_ωScottContinuous
{a : Type u_1}
{s b c : Type}
[OmegaCompletePartialOrder a]
(f : a → ProgramDenotation s b)
(g : a → b → ProgramDenotation s c)
(hg : OmegaCompletePartialOrder.ωScottContinuous g)
(hf : OmegaCompletePartialOrder.ωScottContinuous f)
:
OmegaCompletePartialOrder.ωScottContinuous fun (x : a) => f x >>= g x
noncomputable def
GaudisCrypt.while_iteration
{s : Type}
(cond : ProgramDenotation s Bool)
(body : ProgramDenotation s Unit)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
noncomputable def
GaudisCrypt.while_loop
{s : Type}
(cond : ProgramDenotation s Bool)
(body : ProgramDenotation s Unit)
:
Equations
- GaudisCrypt.while_loop cond body = GaudisCrypt.recursion (GaudisCrypt.while_iteration cond body) ()
Instances For
theorem
GaudisCrypt.while_unroll
{s : Type}
(cond : ProgramDenotation s Bool)
(body : ProgramDenotation s Unit)
:
Instances For
ProgramDenotation.get/ProgramDenotation.set accept anything that forgets to a
Getter/Setter
— a Getter/Setter itself, or a full Lens/Variable. The value/state
types are outParams recovered from the argument, which sidesteps the Lean
4.30 coercion that no longer fires when the value type is a metavariable.
- toG : T → Getter a s
Instances
@[implicit_reducible]
Equations
- GaudisCrypt.instAsGetterGetter = { toG := id }
@[implicit_reducible]
Equations
@[implicit_reducible]
Equations
- GaudisCrypt.instAsSetterSetter = { toS := id }
@[implicit_reducible]
Equations
noncomputable def
GaudisCrypt.ProgramDenotation.set
{T a s : Type}
[AsSetter T a s]
(v : T)
(x : a)
:
Equations
- GaudisCrypt.ProgramDenotation.set v x = do let st ← StateT.get have st' : s := (GaudisCrypt.AsSetter.toS v).set x st StateT.set st'
Instances For
Equations
- GaudisCrypt.ProgramDenotation.get v = do let s_1 ← StateT.get pure ((GaudisCrypt.AsGetter.toG v).get s_1)
Instances For
Equations
Instances For
noncomputable def
GaudisCrypt.ProgramDenotation.zoom
{s t a : Type}
(lens : Lens s t)
(p : ProgramDenotation s a)
:
Equations
Instances For
Monad laws for ProgramDenotation s #
theorem
GaudisCrypt.ProgramDenotation.bind_assoc
{s a b c : Type}
(p : ProgramDenotation s a)
(f : a → ProgramDenotation s b)
(g : b → ProgramDenotation s c)
:
theorem
GaudisCrypt.ProgramDenotation.pure_bind
{s a b : Type}
(x : a)
(f : a → ProgramDenotation s b)
:
theorem
GaudisCrypt.ProgramDenotation.zoom_bind
{s t a b : Type}
(lens : Lens s t)
(p : ProgramDenotation s a)
(k : a → ProgramDenotation s b)
: