Coercing Computations to Larger Oracle Sets #
This file defines an append operation on OracleSpec
to combine different sets of oracles.
We use Sum
to combine the indexing sets, so this operation is "ordered"
in the sense that the two oracle sets correspond to Sum.inl
and Sum.inr
.
Note that this operation is never associative, as Sum
is not associative
We also define a number of coercions involving append.
These instances allow an OracleSpec
of the form spec₁ ++ₒ ... ++ₒ spec₂
to coerce to one of the form spec'₁ ++ₒ ... ++ₒ spec'₂
, assuming that
the set of oracles in the first is a sub-sequence of the oracles in the second.
We also include associativity instances, so parenthisization of the sequence is irrelevant.
Note that this requires the ordering of oracles in each to match,
and so we generally adopt a standard ordering of OracleSpec
for computations
in order to make this apply as often as possible. We specifically adopt the following convention:
{coin_oracle} ++ₒ {unif_spec} ++ₒ {random oracle} ++ₒ {adversary oracles} ++ₒ ...
,
where any of the individual parts may be ommited. The adversary oracles are for
things like a signing oracle in unforgeability experiments of a signature scheme.
TODO!: This is still not as powerful as what could be done in Lean3 ** Maybe just manually add a ton of these, simp should mostly help that**
The typelcasses are applied in an order defined by specific priorities:
- Try applying the associativity instance to remove parenthesization.
- If both the subspec and superspec are an append, try to independently coerce both sides.
- Try to coerce the subspec to the left side of the superspec append.
- Try to coerce the subspec to the right side of the superspec append.
- Try appending a single oracle to the left side of the subspec.
- Try appending a single oracle to the right side of the subspec.
- Try coercing the subspec to itself. This ordering is chosen to both give a generally applicable instance tree, and avoid an infinite typeclass search whether or not an instance exists.
Add additional oracles to the right side of the existing ones.
Equations
- spec₁.subSpec_append_left spec₂ = OracleSpec.SubSpec.mk
Add additional oracles to the left side of the exiting ones
Equations
- spec₁.subSpec_append_right spec₂ = OracleSpec.SubSpec.mk
Equations
- spec₁.subSpec_left_append_left_append_of_subSpec spec₂ spec₃ = OracleSpec.SubSpec.mk
Equations
- spec₁.subSpec_right_append_right_append_of_subSpec spec₂ spec₃ = OracleSpec.SubSpec.mk
Equations
- spec₁.subSpec_assoc spec₂ spec₃ = OracleSpec.SubSpec.mk