Running a Computation Multiple Times #
This file defines a function replicate oa n that runs the computation oa a total of n times,
returning the result as a list of length n.
Note that while the executions are independent, they may no longer be after calling simulate.
def
OracleComp.replicate
{ι : Type u_1}
{spec : OracleSpec ι}
{α : Type v}
(n : ℕ)
(oa : OracleComp spec α)
:
OracleComp spec (List α)
Run the computation oa repeatedly n times to get a list of n results.
Equations
Instances For
def
OracleComp.replicateTR
{ι : Type u_1}
{spec : OracleSpec ι}
{α : Type v}
(n : ℕ)
(oa : OracleComp spec α)
:
OracleComp spec (List α)
Equations
Instances For
@[simp]
theorem
OracleComp.replicate_zero
{ι : Type u_2}
{spec : OracleSpec ι}
{α : Type v}
(oa : OracleComp spec α)
:
@[simp]
theorem
OracleComp.replicateTR_zero
{ι : Type u_2}
{spec : OracleSpec ι}
{α : Type v}
(oa : OracleComp spec α)
:
@[simp]
theorem
OracleComp.replicate_succ_bind
{ι : Type u_2}
{spec : OracleSpec ι}
{α : Type v}
(oa : OracleComp spec α)
(n : ℕ)
:
Bind-style unfolding of replicate, convenient for program-logic proofs.
theorem
OracleComp.replicate_succ
{ι : Type u_2}
{spec : OracleSpec ι}
{α : Type v}
(oa : OracleComp spec α)
(n : ℕ)
:
@[simp]
theorem
OracleComp.replicate_pure
{ι : Type u_2}
{spec : OracleSpec ι}
{α : Type v}
(n : ℕ)
(x : α)
:
@[simp]
theorem
OracleComp.probOutput_replicate
{ι : Type u_1}
{spec : OracleSpec ι}
{α : Type v}
(oa : OracleComp spec α)
(n : ℕ)
[spec.Fintype]
[spec.Inhabited]
(xs : List α)
:
The probability of getting a list from replicate is the product of the chances of
getting each of the individual elements.
@[simp]
theorem
OracleComp.support_replicate
{ι : Type u_1}
{spec : OracleSpec ι}
{α : Type v}
(oa : OracleComp spec α)
(n : ℕ)
[spec.Fintype]
[spec.Inhabited]
:
Possible outputs of replicate n oa are lists of length n where
each element in the list is a possible output of oa.
@[simp]
theorem
OracleComp.mem_finSupport_replicate
{ι : Type u_1}
{spec : OracleSpec ι}
{α : Type v}
(oa : OracleComp spec α)
(n : ℕ)
[spec.Fintype]
[spec.Inhabited]
[spec.DecidableEq]
[DecidableEq α]
(xs : List α)
: