Let's say I have some giant program P
which I know has a bug in it: when I run it with argument A
it prints the ugly error message E
. In shell notation, this happens:
$ ./P A
E
$
Now I don't have any idea what causes the bug, but it appears to be deterministic. My approach to finding the bug is to "isolate" it. I "reduce" the program P
to the "smallest" version that still generates the error E
given the argument A
. By "reduce", I mean I will chop out parts of the program and manually inline functions, testing at every stage that P A --> E
and not a success response or some other error message. Once I can't reduce it any more, I have a small program that probably gets to the core of the issue.
This process is fairly mechanical: it doesn't require much "insight" on my part. It feels like it could be done automatically: there could be some program X
which, given P
, A
, and E
, spits out the smallest program P'
such that P
reduces to P'
and P' A --> E
.
So, does this strategy have a name, and has it been automated in any sense for any programming language?