-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsamplers.v
More file actions
executable file
·32 lines (23 loc) · 1.07 KB
/
samplers.v
File metadata and controls
executable file
·32 lines (23 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Set Implicit Arguments.
Unset Strict Implicit.
Require Import mathcomp.ssreflect.ssreflect.
From mathcomp Require Import all_ssreflect.
Require Import List. Import ListNotations.
Require Import QArith Reals Rpower Ranalysis Fourier.
Require Extraction.
Require Import OUVerT.chernoff OUVerT.learning OUVerT.bigops OUVerT.dist OUVerT.dyadic OUVerT.numerics.
Require Import MLCert.monads.
Class BasicSamplers (T : Type) : Type :=
mkBasicSamplers {
init_sampler_state : T;
bernoulli_sampler : forall (r:Type) (p:D), StateT (M:=@Cont r) T bool;
bernoulli_sampler_ok :
forall (s:T) (p:D) (f:bool -> R),
bernoulli_sampler p s (fun bs' => let: (b,s') := bs' in f b) =
big_sum (enum bool_finType) (fun b => Bernoulli.t (Qreals.Q2R (D_to_Q p)) b * f b);
uniform_sampler : forall (r:Type) (m:nat), StateT (M:=@Cont r) T 'I_m;
uniform_sampler_ok :
forall (s:T) (m:nat) (f:'I_m -> R),
@uniform_sampler _ m s (fun rs' => let: (r,s') := rs' in f r) =
big_sum (enum 'I_m) (fun x => (1 / mR m) * f x)
}.