Post · 1 min read· p. 33

Notation for test-case reducers

A thing I’ve been noticing recently is that it’s really useful to have compact notation for describing things. Usually this is equivalent to primivitives + some combinators.

One thing that I think it would be useful to have such a notation for is (greedy) test-case reduction passes. They combine pretty well, and it makes it useful to discuss various things.

For example, if you have reducers AA, BB, you can define the reducer ABAB which runs AA, then runs BB on its result. You can also define the reducer A+A^+ which runs AA to a fixed point.

Another interesting combinator is //. (A / B) runs AA, then runs BB if AA didn’t do anything..

There are a bunch of really basic algebraic relations that hold, like composition and // are associative, and (A+)+=A+(A^+)^+ = A^+, but not a huge amount beyond that.

A bunch of interesting questions about test-case reduction can be compactly expressed in this notation though. For example, suppose you want to reduce to something that is a fixed point of both AA and BB. You could do (AB)+(AB)^+, but you could also do (A+B+)+(A^+B^+)^+, and it’s quite natural to do this in some contexts. My suspicion, which I’ve yet to verify, is that it’s almost never the right thing to do.

You can kinda regard the quadratic mode failure of greedy search as an instance of this problem: If δi\delta_i is the operation that deletes the element at position ii, the correct pass to run for greedy deletion is (δ0+…δn+)+(\delta_0^+ \ldots \delta_n^+)^+, but if you start again at the beginning every time you succeed you are running ((\delta_0 / \ldots / \delta_n)^+).