This may be as simple as a pointer to some place in the docs I've missed, but how/where is the output of a contract's computation checked, or assured against a malicious miner with an intentionally corrupted VM implementation?
Trivial example: My contract takes two inputs, A and B, and returns their sum. A disreputable miner wants to collect txn fees and the ethereum for the gas for this contract without doing the work, and hacks his VM implementation to always return "4" to the caller. Any one who tests with "2+2" will think the function works.
Assume the miner succeeded in mining the block with a request for my contract, and returned "4" (so as to not waste their own compute power, and pocket the gas cost). Block hashes for transaction accepted and ether transferred are all correct and checkable, the source and opcodes of the contract are all checkable and correct. But how is the output of the computation checked for correctness?
I feel like I'm missing something obvious. What stops a miner from short circuiting the requested work (whatever it is), claiming to have finished the job, while only returning something syntactically correct, but semantically dubious or wrong?