EasyCrypt's WhileSamplingFixedTest (theories/distributions/Dexcepted.ec) #
Sampling from dt i \ test i (the distribution dt i conditioned on failing test i) and
rejection sampling: SampleE samples the conditioned distribution, SampleWi resamples from
dt i while the test holds. The theory's types and operators (type input, t,
op dt : input -> t distr, op test : input -> t -> bool) are the class Params.
Only what ported developments use is here: the modules SampleE, SampleWi, and the lemmas
pr_sampleE, pr_sampleWi, sampleE_sampleWi. The proofs are not EasyCrypt's (which go
through its theories TwoStepSampling and WhileSampling): pr_sampleWi is the loop rule
while I V k ε with the two-step identity dexcepted_indirect for the body. Names are
EasyCrypt's.
A sampling followed by a statement w, from a judgment about w whose bound is a
function of the state: the bound is its expected value over the sampling.
An event that never holds has probability 0.
One round of rejection sampling: the expected value, over a draw from d, of "the
probability of P under d \ X if the draw is in X, else whether the draw is in P", is
the probability of P under d \ X (EC's TwoStepSampling, dexcepted_indirect).
proc init of module SampleE as a module: Module.proc SampleE.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SampleE.init.apply_simp says exactly that.
Equations
Instances For
The module declared by module SampleE: the record of its procedures SampleE.init, SampleE.sample.
The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no SampleE.apply_simp to apply it with.
Equations
Instances For
The body of proc init of module SampleE, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see SampleE.init.procedure.apply_simp) rather than run. Use SampleE.init for this procedure as a module.
Equations
- GaudisCrypt.EC.WhileSamplingFixedTest.SampleE.init.procedure = proc () : Unit { skip; return () }
Instances For
proc sample of module SampleE as a module: Module.proc SampleE.sample.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SampleE.sample.apply_simp says exactly that.
Equations
Instances For
@[simp]: SampleE.sample = Module.proc SampleE.sample.procedure — true by definition, proc sample using no module parameter and so having no holes to fill.
The body of proc sample of module SampleE, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see SampleE.sample.procedure.apply_simp) rather than run. Use SampleE.sample for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of SampleE.sample.procedure with a tuple holeArgs of procedures: the body of proc sample as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [SampleE.sample.procedure.apply_simp]).
@[simp]: SampleE.init = Module.proc SampleE.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
Instantiating the holes of SampleE.init.procedure with a tuple holeArgs of procedures: the body of proc init as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [SampleE.init.procedure.apply_simp]).
The module declared by module SampleWi: the record of its procedures SampleWi.init, SampleWi.sample.
The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no SampleWi.apply_simp to apply it with.
Equations
Instances For
The body of proc sample of module SampleWi, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see SampleWi.sample.procedure.apply_simp) rather than run. Use SampleWi.sample for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: SampleWi.init = Module.proc SampleWi.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.
Instantiating the holes of SampleWi.init.procedure with a tuple holeArgs of procedures: the body of proc init as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [SampleWi.init.procedure.apply_simp]).
proc init of module SampleWi as a module: Module.proc SampleWi.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SampleWi.init.apply_simp says exactly that.
Equations
Instances For
proc sample of module SampleWi as a module: Module.proc SampleWi.sample.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SampleWi.sample.apply_simp says exactly that.
Equations
Instances For
Instantiating the holes of SampleWi.sample.procedure with a tuple holeArgs of procedures: the body of proc sample as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.
Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [SampleWi.sample.procedure.apply_simp]).
@[simp]: SampleWi.sample = Module.proc SampleWi.sample.procedure — true by definition, proc sample using no module parameter and so having no holes to fill.
The body of proc init of module SampleWi, as a procedure of its own: it calls no module parameter, so it has no holes.
A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see SampleWi.init.procedure.apply_simp) rather than run. Use SampleWi.init for this procedure as a module.
Equations
- GaudisCrypt.EC.WhileSamplingFixedTest.SampleWi.init.procedure = proc () : Unit { skip; return () }
Instances For
When dt x gives no mass to the values that fail the test, its support passes it.
equiv sampleE_sampleWi: sampling dt i \ test i, and resampling from dt i while the
test holds (from a value that satisfies it), return the same result.