Documentation

VCVio.OracleComp.DistSemantics.EvalDist

Denotational Semantics for Output Distributions #

This file gives definitions for the output distribution or computations with uniform oracles. Given a computation oa : OracleComp spec α we define a distribution evalDist oa : PMF α expressing the probability of getting an output x : α if the oracles in spec were to respond uniformly to all queries.

We also define functions probOutput oa x and probEvent oa p for the probabilities of a specific output of of a specific predicate holding on the output respectively. We introduce notation [= x | oa] and [p | oa] for these defintions as well. λ α ↦ (α → β) The behavior of more complex oracles should first be implemented using OracleComp.simulate before applying these constructions.

These definitons are compatible with OracleComp.support and OracleComp.finSupport in the sense that values are in the support iff they have non-zero probability under evalDist.

We give many simp lemmas involving tsum a lower priority, as otherwise the simplifier will always choose them over versions involving sum (as they require DecidableEq or Fintype)

noncomputable def OracleComp.evalDistWhen {ι : Type u} {spec : OracleSpec ι} {α : Type w} (oa : OracleComp spec α) (query_dist : {α : Type w} → spec.OracleQuery αOptionT PMF α) :
Equations
Instances For
    noncomputable def OracleComp.evalDist {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :

    Associate a probability mass function to a computation, where the probability is the odds of getting a given output assuming all oracles responded uniformly at random. Implemented by simulating queries in the PMF monad.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[simp]
      theorem OracleComp.evalDist_pure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (x : α) :
      @[simp]
      theorem OracleComp.evalDist_liftM {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Nonempty α] [Fintype α] (q : spec.OracleQuery α) :
      @[simp]
      theorem OracleComp.evalDist_query {ι : Type u} {spec : OracleSpec ι} [spec.FiniteRange] (i : ι) (t : spec.domain i) :
      @[simp]
      theorem OracleComp.evalDist_failure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] :
      @[simp]
      theorem OracleComp.evalDist_bind {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) :
      theorem OracleComp.evalDist_query_bind {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (i : ι) (t : spec.domain i) (ou : spec.range iOracleComp spec α) :
      @[simp]
      theorem OracleComp.evalDist_map {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) :
      (f <$> oa).evalDist = f <$> oa.evalDist
      @[simp]
      theorem OracleComp.evalDist_seq {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (og : OracleComp spec (αβ)) :
      (og <*> oa).evalDist = og.evalDist <*> oa.evalDist
      @[simp]
      theorem OracleComp.evalDist_eqRec {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (h : α = β) (oa : OracleComp spec α) :
      (h oa).evalDist = h oa.evalDist
      @[simp]
      theorem OracleComp.evalDist_ite {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (p : Prop) [Decidable p] (oa oa' : OracleComp spec α) :
      noncomputable def OracleComp.probOutput {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :

      [= x | oa] is the probability of getting the given output x from the computation oa, assuming all oracles respond uniformly at random.

      Equations
      Instances For
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem OracleComp.probOutput_def {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
          [=x|oa] = oa.evalDist.run (some x)
          theorem OracleComp.evalDist_apply_some {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
          oa.evalDist.run (some x) = [=x|oa]
          @[simp]
          theorem OracleComp.evalDist_comp_some {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
          oa.evalDist.run some = fun (x : α) => [=x|oa]
          noncomputable def OracleComp.probFailure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :

          [⊥ | oa] is the probability of the computation oa failing.

          Equations
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem OracleComp.probFailure_def {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
              theorem OracleComp.evalDist_apply_none {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
              noncomputable def OracleComp.probEvent {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :

              [p | oa] is the probability of getting a result that satisfies a predicate p after running the computation oa, assuming all oracles respond uniformly at random.

              Equations
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem OracleComp.probEvent_def {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  theorem OracleComp.probEvent_eq_tsum_indicator {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  [p|oa] = ∑' (x : α), {x : α | p x}.indicator (fun (x : α) => [=x|oa]) x
                  theorem OracleComp.probEvent_eq_tsum_ite {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [DecidablePred p] :
                  [p|oa] = ∑' (x : α), if p x then [=x|oa] else 0

                  More explicit form of probEvent_eq_tsum_indicator when the predicate p is decidable.

                  @[simp]
                  theorem OracleComp.probFailure_add_tsum_probOutput {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  [⊥|oa] + ∑' (x : α), [=x|oa] = 1
                  @[simp]
                  theorem OracleComp.tsum_probOutput_add_probFailure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  ∑' (x : α), [=x|oa] + [⊥|oa] = 1
                  @[simp]
                  theorem OracleComp.probOutput_le_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {x : α} :
                  [=x|oa] 1
                  @[simp]
                  theorem OracleComp.probFailure_le_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} :
                  @[simp]
                  theorem OracleComp.tsum_probOutput_le_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} :
                  ∑' (x : α), [=x|oa] 1
                  @[simp]
                  theorem OracleComp.tsum_probOutput_ne_top {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} :
                  ∑' (x : α), [=x|oa]
                  @[simp]
                  theorem OracleComp.probEvent_le_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p : αProp} :
                  [p|oa] 1
                  @[simp]
                  theorem OracleComp.probOutput_ne_top {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {x : α} :
                  @[simp]
                  theorem OracleComp.probOutput_lt_top {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {x : α} :
                  @[simp]
                  theorem OracleComp.not_one_lt_probOutput {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {x : α} :
                  ¬1 < [=x|oa]
                  @[simp]
                  theorem OracleComp.probEvent_ne_top {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p : αProp} :
                  @[simp]
                  theorem OracleComp.probEvent_lt_top {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p : αProp} :
                  [p|oa] <
                  @[simp]
                  theorem OracleComp.not_one_lt_probEvent {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p : αProp} :
                  ¬1 < [p|oa]
                  @[simp]
                  theorem OracleComp.probFailure_ne_top {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} :
                  @[simp]
                  theorem OracleComp.probFailure_lt_top {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} :
                  @[simp]
                  theorem OracleComp.not_one_lt_probFailure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} :
                  @[simp]
                  theorem OracleComp.one_le_probOutput_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {x : α} :
                  1 [=x|oa] [=x|oa] = 1
                  @[simp]
                  theorem OracleComp.one_le_probEvent_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p : αProp} :
                  1 [p|oa] [p|oa] = 1
                  @[simp]
                  theorem OracleComp.one_le_probFailure_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} :
                  theorem OracleComp.tsum_probOutput_eq_sub {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  ∑' (x : α), [=x|oa] = 1 - [⊥|oa]
                  theorem OracleComp.sum_probOutput_eq_sub {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Fintype α] (oa : OracleComp spec α) :
                  x : α, [=x|oa] = 1 - [⊥|oa]
                  theorem OracleComp.probFailure_eq_sub_tsum {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  [⊥|oa] = 1 - ∑' (x : α), [=x|oa]
                  theorem OracleComp.probFailure_eq_sub_sum {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Fintype α] (oa : OracleComp spec α) :
                  [⊥|oa] = 1 - x : α, [=x|oa]
                  theorem OracleComp.tsum_probOutput_eq_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (h : [⊥|oa] = 0) :
                  ∑' (x : α), [=x|oa] = 1
                  theorem OracleComp.sum_probOutput_eq_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Fintype α] (oa : OracleComp spec α) (h : [⊥|oa] = 0) :
                  x : α, [=x|oa] = 1
                  @[simp]
                  theorem OracleComp.mem_support_evalDist_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :

                  An output has non-zero probability iff it is in the support of the computation.

                  theorem OracleComp.mem_support_of_mem_support_evalDist {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :

                  Alias of the forward direction of OracleComp.mem_support_evalDist_iff.


                  An output has non-zero probability iff it is in the support of the computation.

                  theorem OracleComp.mem_support_evalDist {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :

                  Alias of the reverse direction of OracleComp.mem_support_evalDist_iff.


                  An output has non-zero probability iff it is in the support of the computation.

                  @[simp]
                  theorem OracleComp.mem_support_evalDist_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [spec.DecidableEq] [DecidableEq α] (oa : OracleComp spec α) (x : α) :

                  An output has non-zero probability iff it is in the finSupport of the computation.

                  theorem OracleComp.mem_finSupport_of_mem_support_evalDist {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [spec.DecidableEq] [DecidableEq α] (oa : OracleComp spec α) (x : α) :

                  Alias of the forward direction of OracleComp.mem_support_evalDist_iff'.


                  An output has non-zero probability iff it is in the finSupport of the computation.

                  theorem OracleComp.mem_support_evalDist' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [spec.DecidableEq] [DecidableEq α] (oa : OracleComp spec α) (x : α) :

                  Alias of the reverse direction of OracleComp.mem_support_evalDist_iff'.


                  An output has non-zero probability iff it is in the finSupport of the computation.

                  @[simp]
                  theorem OracleComp.evalDist_apply_eq_zero_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : Option α) :
                  oa.evalDist.run x = 0 Option.rec ([⊥|oa] = 0) (fun (x : α) => xoa.support) x
                  @[simp]
                  theorem OracleComp.evalDist_apply_eq_zero_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) [spec.DecidableEq] [DecidableEq α] (x : Option α) :
                  oa.evalDist.run x = 0 Option.rec ([⊥|oa] = 0) (fun (x : α) => xoa.finSupport) x
                  theorem OracleComp.support_evalDist {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :

                  The support of evalDist oa is exactly support oa.

                  @[simp]
                  theorem OracleComp.probOutput_eq_zero_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  [=x|oa] = 0 xoa.support
                  theorem OracleComp.probOutput_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  xoa.support[=x|oa] = 0

                  Alias of the reverse direction of OracleComp.probOutput_eq_zero_iff.

                  theorem OracleComp.not_mem_support_of_probOutput_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  [=x|oa] = 0xoa.support

                  Alias of the forward direction of OracleComp.probOutput_eq_zero_iff.

                  @[simp]
                  theorem OracleComp.zero_eq_probOutput_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  0 = [=x|oa] xoa.support
                  theorem OracleComp.zero_eq_probOutput {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  xoa.support0 = [=x|oa]

                  Alias of the reverse direction of OracleComp.zero_eq_probOutput_iff.

                  @[simp]
                  theorem OracleComp.probOutput_eq_zero_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  [=x|oa] = 0 xoa.finSupport
                  theorem OracleComp.not_mem_fin_support_of_probOutput_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  [=x|oa] = 0xoa.support

                  Alias of the forward direction of OracleComp.probOutput_eq_zero_iff.

                  theorem OracleComp.probOutput_eq_zero' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  xoa.support[=x|oa] = 0

                  Alias of the reverse direction of OracleComp.probOutput_eq_zero_iff.

                  @[simp]
                  theorem OracleComp.zero_eq_probOutput_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  0 = [=x|oa] xoa.finSupport
                  theorem OracleComp.zero_eq_probOutput' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  xoa.finSupport0 = [=x|oa]

                  Alias of the reverse direction of OracleComp.zero_eq_probOutput_iff'.

                  theorem OracleComp.probOutput_ne_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) (h : x oa.support) :
                  [=x|oa] 0
                  theorem OracleComp.probOutput_ne_zero' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [DecidableEq α] (h : x oa.finSupport) :
                  [=x|oa] 0
                  @[simp]
                  theorem OracleComp.probEvent_eq_zero_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  [p|oa] = 0 xoa.support, ¬p x
                  theorem OracleComp.not_of_mem_support_of_probEvent_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  [p|oa] = 0xoa.support, ¬p x

                  Alias of the forward direction of OracleComp.probEvent_eq_zero_iff.

                  theorem OracleComp.probEvent_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  (∀ xoa.support, ¬p x)[p|oa] = 0

                  Alias of the reverse direction of OracleComp.probEvent_eq_zero_iff.

                  @[simp]
                  theorem OracleComp.zero_eq_probEvent_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  0 = [p|oa] xoa.support, ¬p x
                  theorem OracleComp.zero_eq_probEvent {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  (∀ xoa.support, ¬p x)0 = [p|oa]

                  Alias of the reverse direction of OracleComp.zero_eq_probEvent_iff.

                  @[simp]
                  theorem OracleComp.probEvent_eq_zero_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  [p|oa] = 0 xoa.finSupport, ¬p x
                  theorem OracleComp.not_of_mem_finSupport_of_probEvent_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  [p|oa] = 0xoa.finSupport, ¬p x

                  Alias of the forward direction of OracleComp.probEvent_eq_zero_iff'.

                  theorem OracleComp.probEvent_eq_zero' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  (∀ xoa.finSupport, ¬p x)[p|oa] = 0

                  Alias of the reverse direction of OracleComp.probEvent_eq_zero_iff'.

                  @[simp]
                  theorem OracleComp.zero_eq_probEvent_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  0 = [p|oa] xoa.finSupport, ¬p x
                  theorem OracleComp.zero_eq_probEvent' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  (∀ xoa.finSupport, ¬p x)0 = [p|oa]

                  Alias of the reverse direction of OracleComp.zero_eq_probEvent_iff'.

                  @[simp]
                  theorem OracleComp.probOutput_pos_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  0 < [=x|oa] x oa.support
                  theorem OracleComp.probOutput_pos {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  x oa.support0 < [=x|oa]

                  Alias of the reverse direction of OracleComp.probOutput_pos_iff.

                  theorem OracleComp.mem_support_of_probOutput_pos {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  0 < [=x|oa]x oa.support

                  Alias of the forward direction of OracleComp.probOutput_pos_iff.

                  @[simp]
                  theorem OracleComp.probOutput_pos_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  0 < [=x|oa] x oa.finSupport
                  theorem OracleComp.probOutput_pos' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  x oa.finSupport0 < [=x|oa]

                  Alias of the reverse direction of OracleComp.probOutput_pos_iff'.

                  theorem OracleComp.mem_finSupport_of_probOutput_pos {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  0 < [=x|oa]x oa.finSupport

                  Alias of the forward direction of OracleComp.probOutput_pos_iff'.

                  @[simp]
                  theorem OracleComp.probEvent_pos_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  0 < [p|oa] xoa.support, p x
                  theorem OracleComp.probEvent_pos {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  (∃ xoa.support, p x)0 < [p|oa]

                  Alias of the reverse direction of OracleComp.probEvent_pos_iff.

                  theorem OracleComp.exists_mem_support_of_probEvent_pos {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  0 < [p|oa]xoa.support, p x

                  Alias of the forward direction of OracleComp.probEvent_pos_iff.

                  @[simp]
                  theorem OracleComp.probEvent_pos_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  0 < [p|oa] xoa.finSupport, p x
                  theorem OracleComp.probEvent_pos' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  (∃ xoa.finSupport, p x)0 < [p|oa]

                  Alias of the reverse direction of OracleComp.probEvent_pos_iff'.

                  theorem OracleComp.exists_mem_finSupport_of_probEvent_pos {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  0 < [p|oa]xoa.finSupport, p x

                  Alias of the forward direction of OracleComp.probEvent_pos_iff'.

                  @[simp]
                  theorem OracleComp.probOutput_eq_one_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  [=x|oa] = 1 [⊥|oa] = 0 oa.support = {x}
                  theorem OracleComp.probOutput_eq_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  [⊥|oa] = 0 oa.support = {x}[=x|oa] = 1

                  Alias of the reverse direction of OracleComp.probOutput_eq_one_iff.

                  @[simp]
                  theorem OracleComp.one_eq_probOutput_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  1 = [=x|oa] [⊥|oa] = 0 oa.support = {x}
                  theorem OracleComp.one_eq_probOutput {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  [⊥|oa] = 0 oa.support = {x}1 = [=x|oa]

                  Alias of the reverse direction of OracleComp.one_eq_probOutput_iff.

                  @[simp]
                  theorem OracleComp.probOutput_eq_one_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  [=x|oa] = 1 [⊥|oa] = 0 oa.finSupport = {x}
                  theorem OracleComp.probOutput_eq_one' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  [⊥|oa] = 0 oa.finSupport = {x}[=x|oa] = 1

                  Alias of the reverse direction of OracleComp.probOutput_eq_one_iff'.

                  @[simp]
                  theorem OracleComp.one_eq_probOutput_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  1 = [=x|oa] [⊥|oa] = 0 oa.finSupport = {x}
                  theorem OracleComp.one_eq_probOutput' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  [⊥|oa] = 0 oa.finSupport = {x}1 = [=x|oa]

                  Alias of the reverse direction of OracleComp.one_eq_probOutput_iff'.

                  @[simp]
                  theorem OracleComp.probEvent_eq_one_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  [p|oa] = 1 [⊥|oa] = 0 xoa.support, p x
                  theorem OracleComp.probEvent_eq_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  ([⊥|oa] = 0 xoa.support, p x) → [p|oa] = 1

                  Alias of the reverse direction of OracleComp.probEvent_eq_one_iff.

                  @[simp]
                  theorem OracleComp.one_eq_probEvent_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  1 = [p|oa] [⊥|oa] = 0 xoa.support, p x
                  theorem OracleComp.one_eq_probEvent {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  ([⊥|oa] = 0 xoa.support, p x) → [p|oa] = 1

                  Alias of the reverse direction of OracleComp.probEvent_eq_one_iff.

                  @[simp]
                  theorem OracleComp.probEvent_eq_one_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  [p|oa] = 1 [⊥|oa] = 0 xoa.finSupport, p x
                  theorem OracleComp.probEvent_eq_one' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  ([⊥|oa] = 0 xoa.finSupport, p x) → [p|oa] = 1

                  Alias of the reverse direction of OracleComp.probEvent_eq_one_iff'.

                  @[simp]
                  theorem OracleComp.one_eq_probEvent_iff' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  1 = [p|oa] [⊥|oa] = 0 xoa.finSupport, p x
                  theorem OracleComp.one_eq_probEvent' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidableEq α] :
                  ([⊥|oa] = 0 xoa.finSupport, p x) → 1 = [p|oa]

                  Alias of the reverse direction of OracleComp.one_eq_probEvent_iff'.

                  theorem OracleComp.mem_support_iff_probOutput_ne_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  x oa.support [=x|oa] 0
                  theorem OracleComp.mem_finSupport_iff_probOutput_ne_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) [spec.DecidableEq] [DecidableEq α] :
                  theorem OracleComp.mem_support_iff_probOutput_pos {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  x oa.support 0 < [=x|oa]
                  theorem OracleComp.not_mem_support_iff_probOutput_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  xoa.support [=x|oa] = 0
                  theorem OracleComp.probEvent_mono {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p q : αProp} (h : xoa.support, p xq x) :
                  [p|oa] [q|oa]

                  If p implies q on the support of a computation then it is more likely to happen.

                  theorem OracleComp.probEvent_mono' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p q : αProp} [spec.DecidableEq] [DecidableEq α] (h : xoa.finSupport, p xq x) :
                  [p|oa] [q|oa]

                  If p implies q on the finSupport of a computation then it is more likely to happen.

                  theorem OracleComp.probEvent_congr {ι : Type u} {spec : OracleSpec ι} {ι' : Type v} {spec' : OracleSpec ι'} {α : Type w} [spec.FiniteRange] [spec'.FiniteRange] {p q : αProp} {oa : OracleComp spec α} {oa' : OracleComp spec' α} (h1 : ∀ (x : α), p x q x) (h2 : oa.evalDist = oa'.evalDist) :
                  [p|oa] = [q|oa']
                  theorem OracleComp.probEvent_ext {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p q : αProp} (h : xoa.support, p x q x) :
                  [p|oa] = [q|oa]
                  theorem OracleComp.probEvent_ext' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {p q : αProp} [spec.DecidableEq] [DecidableEq α] (h : xoa.finSupport, p x q x) :
                  [p|oa] = [q|oa]
                  @[simp]
                  theorem OracleComp.function_support_probOutput {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} :
                  (Function.support fun (x : α) => [=x|oa]) = oa.support
                  theorem OracleComp.mem_support_iff_of_evalDist_eq {ι : Type u} {spec : OracleSpec ι} {ι' : Type v} {spec' : OracleSpec ι'} {α : Type w} [spec.FiniteRange] [spec'.FiniteRange] {oa : OracleComp spec α} {oa' : OracleComp spec' α} (h : oa.evalDist = oa'.evalDist) (x : α) :
                  theorem OracleComp.mem_finSupport_iff_of_evalDist_eq {ι : Type u} {spec : OracleSpec ι} {ι' : Type v} {spec' : OracleSpec ι'} {α : Type w} [spec.FiniteRange] [spec'.FiniteRange] [spec.DecidableEq] [spec'.DecidableEq] [DecidableEq α] {oa : OracleComp spec α} {oa' : OracleComp spec' α} (h : oa.evalDist = oa'.evalDist) (x : α) :
                  @[simp]
                  theorem OracleComp.probEvent_eq_eq_probOutput {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  [fun (x_1 : α) => x_1 = x|oa] = [=x|oa]
                  @[simp]
                  theorem OracleComp.probEvent_eq_eq_probOutput' {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (x : α) :
                  [fun (x_1 : α) => x = x_1|oa] = [=x|oa]
                  theorem OracleComp.probEvent_eq_tsum_subtype {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  [p|oa] = ∑' (x : {x : α | p x}), [=x|oa]

                  The probability of an event written as a sum over the set {x | p x} viewed as a subtype. This notably doesn't require decidability of the predicate p unlike many other lemmas.

                  theorem OracleComp.probEvent_eq_tsum_subtype_mem_support {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) :
                  [p|oa] = ∑' (x : {x : α | x oa.support p x}), [=x|oa]

                  Version probEvent_eq_tsum_subtype that preemptively filters out elements that aren't in the support, since they will have no mass contribution anyways. This can make some proofs simpler by handling things on the level of subtypes.

                  theorem OracleComp.probEvent_eq_tsum_subtype_support_ite {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [DecidablePred p] :
                  [p|oa] = ∑' (x : oa.support), if p x then [=x|oa] else 0
                  theorem OracleComp.probEvent_eq_sum_fintype_indicator {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Fintype α] (oa : OracleComp spec α) (p : αProp) :
                  [p|oa] = x : α, {x : α | p x}.indicator (fun (x : α) => [=x|oa]) x
                  theorem OracleComp.probEvent_eq_sum_fintype_ite {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [DecidablePred p] [Fintype α] :
                  [p|oa] = x : α, if p x then [=x|oa] else 0
                  theorem OracleComp.probEvent_eq_sum_filter_univ {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [DecidablePred p] [Fintype α] :
                  [p|oa] = xFinset.filter p Finset.univ, [=x|oa]
                  theorem OracleComp.probEvent_eq_sum_filter_finSupport {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidablePred p] [DecidableEq α] :
                  [p|oa] = xFinset.filter p oa.finSupport, [=x|oa]
                  theorem OracleComp.probEvent_eq_sum_finSupport_ite {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : αProp) [spec.DecidableEq] [DecidablePred p] [DecidableEq α] :
                  [p|oa] = xoa.finSupport, if p x then [=x|oa] else 0
                  theorem OracleComp.probOutput_congr {ι : Type u} {spec : OracleSpec ι} {ι' : Type v} {spec' : OracleSpec ι'} {α : Type w} [spec.FiniteRange] [spec'.FiniteRange] {x y : α} {oa : OracleComp spec α} {oa' : OracleComp spec' α} (h1 : x = y) (h2 : oa.evalDist = oa'.evalDist) :
                  [=x|oa] = [=y|oa']
                  theorem OracleComp.probEvent_congr' {ι : Type u} {spec : OracleSpec ι} {ι' : Type v} {spec' : OracleSpec ι'} {α : Type w} [spec.FiniteRange] [spec'.FiniteRange] {p q : αProp} {oa : OracleComp spec α} {oa' : OracleComp spec' α} (h1 : xoa.support, x oa'.support → (p x q x)) (h2 : oa.evalDist = oa'.evalDist) :
                  [p|oa] = [q|oa']
                  @[simp]
                  theorem OracleComp.probEvent_const {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (p : Prop) [Decidable p] :
                  [fun (x : α) => p|oa] = if p then 1 - [⊥|oa] else 0
                  theorem OracleComp.probEvent_true {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  [fun (x : α) => true = true|oa] = 1 - [⊥|oa]
                  theorem OracleComp.probEvent_false {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  [fun (x : α) => false = true|oa] = 0
                  theorem OracleComp.probFailure_eq_sub_probEvent {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  [⊥|oa] = 1 - [fun (x : α) => true = true|oa]
                  theorem OracleComp.evalDist_ext_probEvent {ι : Type u} {spec : OracleSpec ι} {ι' : Type v} {spec' : OracleSpec ι'} {α : Type w} [spec.FiniteRange] [spec'.FiniteRange] {oa : OracleComp spec α} {oa' : OracleComp spec' α} (h : ∀ (x : α), [=x|oa] = [=x|oa']) :
                  @[simp]
                  theorem OracleComp.probOutput_pure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (x : α) [DecidableEq α] (y : α) :
                  [=y|pure x] = if y = x then 1 else 0
                  @[simp]
                  theorem OracleComp.probFailure_pure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (x : α) :
                  theorem OracleComp.probOutput_pure_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {x y : α} (h : y x) :
                  [=y|pure x] = 0
                  theorem OracleComp.probOutput_pure_eq_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {x y : α} (h : y = x) :
                  [=y|pure x] = 1
                  @[simp]
                  theorem OracleComp.probOutput_pure_self {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (x : α) :
                  [=x|pure x] = 1
                  @[simp]
                  theorem OracleComp.probOutput_pure_subsingleton {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Subsingleton α] (x y : α) :
                  [=x|pure y] = 1
                  @[simp]
                  theorem OracleComp.probEvent_pure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (x : α) (p : αProp) [DecidablePred p] :
                  [p|pure x] = if p x then 1 else 0
                  theorem OracleComp.probEvent_pure_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {p : αProp} {x : α} (h : ¬p x) :
                  [p|pure x] = 0
                  theorem OracleComp.probEvent_pure_eq_one {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {p : αProp} {x : α} (h : p x) :
                  [p|pure x] = 1
                  theorem OracleComp.probOutput_bind_eq_tsum {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) (y : β) :
                  [=y|oa >>= ob] = ∑' (x : α), [=x|oa] * [=y|ob x]
                  theorem OracleComp.probFailure_bind_eq_tsum {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) :
                  [⊥|oa >>= ob] = [⊥|oa] + ∑' (x : α), [=x|oa] * [⊥|ob x]
                  theorem OracleComp.probEvent_bind_eq_tsum {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) (q : βProp) :
                  [q|oa >>= ob] = ∑' (x : α), [=x|oa] * [q|ob x]
                  theorem OracleComp.probOutput_bind_eq_tsum_subtype {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) (y : β) :
                  [=y|oa >>= ob] = ∑' (x : oa.support), [=x|oa] * [=y|ob x]

                  Version of probOutput_bind_eq_tsum that sums only over the subtype given by the support of the first computation. This can be useful to avoid looking at edge cases that can't actually happen in practice after the first computation. A common example is if the first computation does some error handling to avoids returning malformed outputs.

                  theorem OracleComp.probEvent_bind_eq_tsum_subtype {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) (q : βProp) :
                  [q|oa >>= ob] = ∑' (x : oa.support), [=x|oa] * [q|ob x]
                  theorem OracleComp.probOutput_bind_eq_sum_fintype {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) [Fintype α] (y : β) :
                  [=y|oa >>= ob] = x : α, [=x|oa] * [=y|ob x]
                  theorem OracleComp.probFailure_bind_eq_sum_fintype {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) [Fintype α] :
                  [⊥|oa >>= ob] = [⊥|oa] + x : α, [=x|oa] * [⊥|ob x]
                  theorem OracleComp.probEvent_bind_eq_sum_fintype {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) [Fintype α] (q : βProp) :
                  [q|oa >>= ob] = x : α, [=x|oa] * [q|ob x]
                  theorem OracleComp.probOutput_bind_eq_sum_finSupport {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) [spec.DecidableEq] [DecidableEq α] (y : β) :
                  [=y|oa >>= ob] = xoa.finSupport, [=x|oa] * [=y|ob x]
                  theorem OracleComp.probEvent_bind_eq_sum_finSupport {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) [spec.DecidableEq] [DecidableEq α] (q : βProp) :
                  [q|oa >>= ob] = xoa.finSupport, [=x|oa] * [q|ob x]
                  theorem OracleComp.probOutput_bind_of_const {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) (y : β) (r : ENNReal) (h : ∀ (x : α), [=y|ob x] = r) :
                  [=y|oa >>= ob] = (1 - [⊥|oa]) * r
                  theorem OracleComp.probFailure_bind_of_const {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) [Nonempty α] (r : ENNReal) (h : ∀ (x : α), [⊥|ob x] = r) :
                  [⊥|oa >>= ob] = [⊥|oa] + r - [⊥|oa] * r
                  theorem OracleComp.probFailure_bind_eq_sub_mul {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {ob : αOracleComp spec β} (r : ENNReal) (h : ∀ (x : α), [⊥|ob x] = r) :
                  [⊥|oa >>= ob] = 1 - (1 - [⊥|oa]) * (1 - r)
                  theorem OracleComp.probFailure_bind_le_of_forall {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {s : ENNReal} (h' : [⊥|oa] = s) (ob : αOracleComp spec β) {r : ENNReal} (hr : xoa.support, [⊥|ob x] r) :
                  [⊥|oa >>= ob] s + (1 - s) * r
                  theorem OracleComp.probFailure_bind_le_of_forall' {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {s : ENNReal} (h' : [⊥|oa] = s) (ob : αOracleComp spec β) {r : ENNReal} (hr : xoa.support, [⊥|ob x] r) :
                  [⊥|oa >>= ob] s + r

                  Version of probFailure_bind_le_of_forall with the 1 - s factor ommited for convenience.

                  theorem OracleComp.probFailure_bind_le_of_le_of_neverFails {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] {oa : OracleComp spec α} (h' : oa.neverFails) {ob : αOracleComp spec β} {r : ENNReal} (hr : xoa.support, [⊥|ob x] r) :
                  [⊥|oa >>= ob] r

                  Version of probFailure_bind_le_of_forall when oa never fails.

                  theorem OracleComp.probFailure_bind_of_neverFails {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] {oa : OracleComp spec α} (h : oa.neverFails) (ob : αOracleComp spec β) :
                  [⊥|oa >>= ob] = ∑' (x : α), [=x|oa] * [⊥|ob x]
                  theorem OracleComp.mul_le_probEvent_bind {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] {oa : OracleComp spec α} {ob : αOracleComp spec β} {p : αProp} {q : βProp} {r r' : ENNReal} (h : r [p|oa]) (h' : xoa.support, p xr' [q|ob x]) :
                  r * r' [q|oa >>= ob]
                  @[simp]
                  theorem OracleComp.probOutput_liftM {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Fintype α] (q : spec.OracleQuery α) (u : α) :
                  theorem OracleComp.probOutput_query {ι : Type u} {spec : OracleSpec ι} [spec.FiniteRange] (i : ι) (t : spec.domain i) (u : spec.range i) :
                  @[simp]
                  theorem OracleComp.probFailure_liftM {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (q : spec.OracleQuery α) :
                  theorem OracleComp.probFailure_query {ι : Type u} {spec : OracleSpec ι} [spec.FiniteRange] (i : ι) (t : spec.domain i) :
                  @[simp]
                  theorem OracleComp.probEvent_liftM_eq_mul_inv {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Fintype α] (q : spec.OracleQuery α) (p : αProp) [DecidablePred p] :
                  theorem OracleComp.probEvent_query_eq_mul_inv {ι : Type u} {spec : OracleSpec ι} [spec.FiniteRange] (i : ι) (t : spec.domain i) (p : spec.range iProp) [DecidablePred p] :
                  theorem OracleComp.probEvent_liftM_eq_inv_mul {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Fintype α] (q : spec.OracleQuery α) (p : αProp) [DecidablePred p] :
                  theorem OracleComp.probEvent_query_eq_inv_mul {ι : Type u} {spec : OracleSpec ι} [spec.FiniteRange] (i : ι) (t : spec.domain i) [spec.DecidableEq] (p : spec.range iProp) [DecidablePred p] :
                  theorem OracleComp.probEvent_liftM_eq_div {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] [Fintype α] (q : spec.OracleQuery α) (p : αProp) [DecidablePred p] :
                  theorem OracleComp.probEvent_query_eq_div {ι : Type u} {spec : OracleSpec ι} [spec.FiniteRange] (i : ι) (t : spec.domain i) [spec.DecidableEq] (p : spec.range iProp) [DecidablePred p] :
                  @[simp]
                  theorem OracleComp.probOutput_failure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (x : α) :
                  @[simp]
                  theorem OracleComp.probFailure_failure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] :
                  @[simp]
                  theorem OracleComp.probEvent_failure {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (p : αProp) :
                  theorem OracleComp.probOutput_map_eq_tsum_subtype {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) (y : β) :
                  [=y|f <$> oa] = ∑' (x : {x : α | x oa.support y = f x}), [=x|oa]

                  Write the probability of an output after mapping the result of a computation as a sum over all outputs such that they map to the correct final output, using subtypes. This lemma notably doesn't require decidable equality on the final type, unlike most lemmas about probability when mapping a computation.

                  theorem OracleComp.probOutput_map_eq_tsum {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) (y : β) :
                  [=y|f <$> oa] = ∑' (x : α), [=x|oa] * [=y|pure (f x)]
                  theorem OracleComp.probOutput_map_eq_tsum_subtype_ite {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) [DecidableEq β] (y : β) :
                  [=y|f <$> oa] = ∑' (x : oa.support), if y = f x then [=x|oa] else 0
                  theorem OracleComp.probOutput_map_eq_tsum_ite {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) [DecidableEq β] (y : β) :
                  [=y|f <$> oa] = ∑' (x : α), if y = f x then [=x|oa] else 0
                  theorem OracleComp.probOutput_map_eq_sum_fintype_ite {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) [Fintype α] [DecidableEq β] (y : β) :
                  [=y|f <$> oa] = x : α, if y = f x then [=x|oa] else 0
                  theorem OracleComp.probOutput_map_eq_sum_finSupport_ite {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) [spec.DecidableEq] [DecidableEq α] [DecidableEq β] (y : β) :
                  [=y|f <$> oa] = xoa.finSupport, if y = f x then [=x|oa] else 0
                  theorem OracleComp.probOutput_map_eq_sum_filter_finSupport {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) [spec.DecidableEq] [DecidableEq α] [DecidableEq β] (y : β) :
                  [=y|f <$> oa] = x{xoa.finSupport | y = f x}, [=x|oa]
                  @[simp]
                  theorem OracleComp.probFailure_map {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) :
                  @[simp]
                  theorem OracleComp.probEvent_map {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) (q : βProp) :
                  [q|f <$> oa] = [q f|oa]
                  theorem OracleComp.probEvent_comp {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) (q : βProp) :
                  [q f|oa] = [q|f <$> oa]
                  theorem OracleComp.probOutput_map_eq_probOutput_inverse {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (f : αβ) (g : βα) (hl : Function.LeftInverse f g) (hr : Function.RightInverse f g) (y : β) :
                  [=y|f <$> oa] = [=g y|oa]
                  @[simp]
                  theorem OracleComp.probFailure_eq_zero_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  @[simp]
                  theorem OracleComp.probFailure_pos_iff {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (oa : OracleComp spec α) :
                  theorem OracleComp.noFailure_of_probFailure_eq_zero {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} (h : [⊥|oa] = 0) :
                  theorem OracleComp.not_noFailure_of_probFailure_pos {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] {oa : OracleComp spec α} (h : 0 < [⊥|oa]) :
                  theorem OracleComp.probOutput_eqRec {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (h : α = β) (y : β) :
                  [=y|h oa] = [= y|oa]
                  @[simp]
                  theorem OracleComp.probFailure_eqRec {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (h : α = β) :
                  theorem OracleComp.probEvent_eqRec {ι : Type u} {spec : OracleSpec ι} {α β : Type w} [spec.FiniteRange] (oa : OracleComp spec α) (h : α = β) (q : βProp) :
                  [q|h oa] = [fun (x : α) => q (h x)|oa]
                  @[simp]
                  theorem OracleComp.probOutput_ite {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (p : Prop) [Decidable p] (oa oa' : OracleComp spec α) (x : α) :
                  [=x|if p then oa else oa'] = if p then [=x|oa] else [=x|oa']
                  @[simp]
                  theorem OracleComp.probFailure_ite {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (p : Prop) [Decidable p] (oa oa' : OracleComp spec α) :
                  @[simp]
                  theorem OracleComp.probEvent_ite {ι : Type u} {spec : OracleSpec ι} {α : Type w} [spec.FiniteRange] (p : Prop) [Decidable p] (oa oa' : OracleComp spec α) (q : αProp) :
                  [q|if p then oa else oa'] = if p then [q|oa] else [q|oa']
                  @[simp]
                  theorem OracleComp.probOutput_uniformFin (n : ) (x : Fin (n + 1)) :
                  [=x|$[0..n]] = (n + 1)⁻¹
                  @[simp]
                  def OracleComp.HoareTriple {ι : Type u} {spec : OracleSpec ι} [spec.FiniteRange] {α β : Type v} (P : αProp) (comp : αOracleComp spec β) (Q : βProp) (r : ENNReal) :

                  If pre-condition P holds fox x then comp x satisfies post-contdition Q with probability at least r

                  Equations
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def OracleComp.HoareTriple.bind {ι : Type u} {spec : OracleSpec ι} [spec.FiniteRange] {α β γ : Type v} {P : αProp} {comp₁ : αOracleComp spec β} {Q : βProp} {comp₂ : αβOracleComp spec γ} {R : γProp} {r r' : ENNReal} (h1 : P comp₁ Q r) (h2 : ∀ (x : α), Q comp₂ x R r') :
                      P fun (x : α) => comp₁ x >>= comp₂ x R r * r'
                      Equations
                      • =
                      Instances For