The 2 most common PIN verification algorithms are Visa PVV and IBM 3624. The Visa PVV algorithm is not reversible – you can’t derive a PIN from the PVV. The IBM 3624 algorithm calculates a “natural PIN”. If you want to select a different PIN it’s done as an offset from the natural PIN.
In all cases the calculations are done in a hardware security module, not the main host computer.
The reverse PIN could be identified for IBM DES in the HSM – weak PINs are identified that way. It’s not practical for Visa PVV. In any case, it has to be done in the HSM.
To further complicate it, many UK banks have “tweaks” to the standard algorithms or use something completely different.
It’s not referenced in the Visa, MasterCard or Link documentation.
It’s theoretically possible (at least for IBM 3624) but no one does it.
If you’re being robbed at knife point give them your cards, PIN, whatever. Cash can be replaced.