I was wondering whether the brute force algorithm for pattern matching would have a complex correctness argument?
I was thinking of something along the lines of… If the algorithm is executed fully, this proves its correctness, as each character in the pattern is matched individually to an index in the text string.
Would it be as simple as this?
In general the argument for correctness of a brute-force matching algorithm would be that in the course of its execution it considers every possible way that a string could match a pattern and nothing else; thus if it concludes that the string matches then there is a matching, and if it doesn’t then there isn’t.