Maybe apply some simple formal criterion, like if function is implemented in under 100kloc, then it's trivial and invalidates the patent.
Languages differ in expressive power in ways that effectively mean that 200kLoC in one language is trivial to implement in a few thousand lines in another. Even within one language, two implementations of the same effective feature can be devised with similarly large differences in line count, if one prioritizes brevity over efficiency.
A simple criterion like this would be laughably useless and abused to absurd degrees.