Reverse engineering with P-stable abstractions