Monadic list search with an oracle program #
Running an oracle test List.findM? on a list evaluates against a deterministic oracle as
List.find? (Cslib.OracleComp.evalPure_findM?), satisfies a cost bound xs.length * n when each
test costs at most n (Cslib.OracleComp.IsCostBounded.findM?), and preserves query predicates
(Cslib.OracleComp.QueriesSatisfy.findM?). For steps returning an Option via
List.findSomeM?, Cslib.OracleComp.evalPure_findSomeM? and
Cslib.OracleComp.IsCostBounded.findSomeM? give the corresponding deterministic evaluation and
xs.length * n cost bound. These are the search counterparts of
Cslib.OracleComp.IsCostBounded.mapM and Cslib.OracleComp.QueriesSatisfy.mapM in
CslibFrontier.Languages.Probabilistic.Traverse.SupportWith.
Main results #
Cslib.OracleComp.evalPure_findM?: deterministic evaluation reducesfindM?toList.find?.Cslib.OracleComp.evalPure_findSomeM?: deterministic evaluation reducesfindSomeM?toList.findSome?.Cslib.OracleComp.IsCostBounded.findSomeM?: afindSomeM?search overxswhose steps each cost at mostncosts at mostxs.length * n.Cslib.OracleComp.IsCostBounded.findM?: a search overxswhose tests each cost at mostncosts at mostxs.length * n.Cslib.OracleComp.QueriesSatisfy.findM?: a search makes only calls that its tests make.
Against a deterministic oracle, findSomeM? is findSome? on the steps' values: the search
returns the first some value produced.
Against a deterministic oracle, findM? is find? on the tests' values: the search returns
the first element whose test evaluates to true.
A findSomeM? search whose steps each cost at most n costs at most xs.length * n on
every path. The bound can be attained when no step returns some; it does not use that the
search stops at the first kept result.
A search whose tests each cost at most n costs at most xs.length * n on every path. The
bound can be attained when no test accepts; it does not use that the search stops at the first
accepted element.
A search whose tests' calls all satisfy p makes only calls satisfying p.