> “let’s construct source that can be used interchangeably with the original”.
You lose a lot more than whitespace, you lose semantics, metadata, and lots of other information that makes it so
Obviously byte coded languages are a bit easier, and you may get lucky and experts help a lot, and perhaps LLMS can help a little.
Both Rice's theorem and the system identification problem from the cybernetics days relate to why it is so hard.
> Given a system in the form of a black box (BB) allowing finite input-output interactions, deduce a complete specification of the system’s machine table (i.e., algorithm or internal dynamics).
AND
> Given a complete specification of a machine table (i.e., algorithm or internal dynamics), recognize any BB having that description.
Decompilation doesn't give you the equivalent of the original source code, it gives you new source code that appears to be functionally similar to it, and many people who has been forced to use decompilation to recover from lost source code or consultant time-bombs have run into the problems that admittently seem pretty counter intuitive.
Remember that Rice-Shapiro and Kreisel-Lacombe-Shoenfield-Tseitin extend Rice to partial and total functions in finite time.
Telling if a program is equivalent to a fixed other program, even for total functions is still undecidable as they are 'non-trivial' properties.
Most of the time you can make it work, but it isn't a case of:
> “let’s construct source that can be used interchangeably with the original”