Verifying execution of code in trustless environment
This is the problem of securely outsourcing computation.  There's lots of work on this problem in the cryptographic literature; if you do a search at [Crypto.SE] and [Security.SE], you should find some references.  Many of the schemes are probabilistic: if you the remote computer cheats, you have some chance of detecting that fact.  I know of two general approaches: one based on cryptographic commitments, and another based on SNARKs. You should be able to turn up papers on  how SNARKs work.