Documentation

VCVio.OracleComp.OracleSpec

Specifications of Available Oracles #

This file defines a type OracleSpec to represent a set of available oracles. The available oracles are all indexed by some (potentially infinite) indexing set ι, and for each index i a pair of types domain i and range i.

We also define a number of basic oracle constructions:

def OracleSpec (ι : Type u) :
Type (max u (v + 1))

A structure to represents a specification of oracles available to a computation. The available oracles are all indexed by some (potentially infinite) indexing set ι. Represented as a map from indices i to the domain and codomain of the corresponding oracle.

Equations
    Instances For
      Equations
        @[reducible, inline]
        def OracleSpec.domain {ι : Type u} (spec : OracleSpec ι) (i : ι) :

        Type of the domain for calls to the oracle corresponding to i.

        Equations
          Instances For
            @[reducible, inline]
            def OracleSpec.range {ι : Type u} (spec : OracleSpec ι) (i : ι) :

            Type of the range for calls to the oracle corresponding to i.

            Equations
              Instances For
                class OracleSpec.DecidableEq {ι : Type u} (spec : OracleSpec ι) :
                Type (max u u_1)

                Typeclass to capture decidable equality of the oracle input and outputs. Needed for things like finSupport to be well defined.

                Instances
                  instance OracleSpec.domain_decidableEq {ι : Type u} {spec : OracleSpec ι} {i : ι} [h : spec.DecidableEq] :
                  Equations
                    instance OracleSpec.range_decidableEq {ι : Type u} {spec : OracleSpec ι} {i : ι} [h : spec.DecidableEq] :
                    Equations
                      class OracleSpec.FiniteRange {ι : Type u} (spec : OracleSpec ι) :
                      Type (max u u_1)

                      Typeclass for specs where each oracle has a finite and non-empty output type. Needed for things like evalDist and probOutput.

                      Instances
                        instance OracleSpec.range_inhabited {ι : Type u} {spec : OracleSpec ι} {i : ι} [h : spec.FiniteRange] :
                        Inhabited (spec.range i)
                        Equations
                          instance OracleSpec.range_fintype {ι : Type u} {spec : OracleSpec ι} {i : ι} [h : spec.FiniteRange] :
                          Fintype (spec.range i)
                          Equations
                            def OracleSpec.append {ι₁ : Type u} {ι₂ : Type u'} (spec₁ : OracleSpec ι₁) (spec₂ : OracleSpec ι₂) :
                            OracleSpec (ι₁ ι₂)

                            spec₁ ++ spec₂ combines the two sets of oracles disjointly using Sum for the indexing set. inl i is a query to oracle i of spec, and inr i for oracle i of spec'.

                            Equations
                              Instances For
                                instance OracleSpec.instDecidableEqSumAppend {ι₁ : Type u} {ι₂ : Type u'} (spec₁ : OracleSpec ι₁) (spec₂ : OracleSpec ι₂) [h₁ : spec₁.DecidableEq] [h₂ : spec₂.DecidableEq] :
                                (spec₁ ++ₒ spec₂).DecidableEq
                                Equations
                                  instance OracleSpec.instFiniteRangeSumAppend {ι₁ : Type u} {ι₂ : Type u'} (spec₁ : OracleSpec ι₁) (spec₂ : OracleSpec ι₂) [h₁ : spec₁.FiniteRange] [h₂ : spec₂.FiniteRange] :
                                  (spec₁ ++ₒ spec₂).FiniteRange
                                  Equations
                                    @[reducible, inline]
                                    def OracleSpec.rename {ι : Type u} {τ : Type u'} (spec : OracleSpec ι) (f : τι) :

                                    Reduce the indexing set by pulling back along some map f.

                                    Equations
                                      Instances For
                                        @[reducible, inline]

                                        Access to no oracles, represented by an empty indexing set. We take the domain and range to be PUnit (rather than e.g. empty.elim i), which often gives better behavior for proofs even though the oracle is never called.

                                        Equations
                                          Instances For
                                            Equations
                                              Instances For
                                                @[reducible, inline]

                                                T →ₒ U represents a single oracle, with domain T and range U. Uses the singleton type PUnit as the indexing set.

                                                Equations
                                                  Instances For
                                                    @[reducible, inline]

                                                    A coin flipping oracle produces a random Bool with no meaningful input.

                                                    Equations
                                                      Instances For
                                                        Equations
                                                          Instances For
                                                            @[reducible, inline]

                                                            Access to oracles for uniformly selecting from Fin (n + 1) for arbitrary n : ℕ. By adding 1 to the index we avoid selection from the empty type Fin 0 ≃ empty.

                                                            Equations
                                                              Instances For
                                                                Equations
                                                                  Instances For