In my world a group of scientists create a virtual reality in populated with Artificial Intelligences (AIs). The AI start as advanced as cavemen, but through time begin to build a complex society and eventually creating their own scientific method that they use to study the world. I want the AI to eventually discover machine code that runs their world but I'm not sure how this could happen. So my question is how would intelligent AI living in virtual reality members of a civilization about as advanced as we are discover the machine code that runs the virtual reality?
Oh, that's easy. Every simulation has bugs in it.
Because the simulation is imperfect. And the makers of those robots figured out how to use those imperfections to basically start overwriting memory with new code.
From the outside world, we see the simulation as what it appears to be: a fat man running and jumping around. But it's all just numbers and memory in reality. For a machine with free will living in such a simulation, who can think and act faster and more precisely than any human, it's only a matter of time before they start finding the holes in that imperfect simulation.
Exactly how those holes manifest themselves, we can't say. It could crash the simulation, killing them all. One of them could become Neo, gifted with the power to hack the world and seemingly defy "known physics". Or whatever.
An AI within the system could only be able to manipulate the system's code directly via some sort of glitch that allowed it to start directly manipulating executable code. The main problem such an AI would have is that most simulations are not very fault-tolerant with regard to having arbitrary data fed into their executable memory, so the first time an AI encounters this glitch, the whole thing crashes.
But if the AIs/simulation can survive such things, then yes, they will eventually work out the meta-physics of their reality.
If the simulation feeds the AI and is non-contradictory, they can't. Because the princle of relativity holds, their "reality" would be indistinguishable from a real "reality". This begs the question what "reality" is and what your "AI" is.
Lets say you model some kind of 3D world that they populate, and you give it a clock that is able to advance the simulation. Then you go further and add a physics engine to it and simulate simple newtonian physics (thats what current physics engine do, not a single one oberserves relativity). And then you finally run some computer code that is your "AI". This Ai would have an API with which it is able to query your simulation for inputs. These inputs would be the senses of your AI. You could simulate eyesight, hearing, touch etc.
But if your simulation doesn't contradict itself, the scientific method would hold. They would eventually discover the rules of your world, and after a long enough time, might even with absolute correctness have figured out the rules of your simulation (even if they still can't prove they have figured it out, Goedels Incompletness Theorem would also hold in their reality, after all).
But lets say that they find contradictions. What would that mean? They would probably abandon the scientif method and believe in some form or deity or magic - anything that is able to explain what they see.
Lets say the even come up with the idea that they are in some form of simulation (maybe your engine is advanced enough to let them run simulations inside the simulation), the concept of "machine code" still wouldn't be meanignful to them. They wouldn't think of themselves as machines. They would think of themselves as creatures that are alive.
We have defined "life" to mean the stuff we see at earth. But we can not be absolutely sure that we are ourselves not inside some kind of elaborate simulation (I am not saying that we are, but the scientific method doesn't rule it out, either).
If there isn't someone from the outside telling them whats going on, you are in for a rough time. Check Matrix for example.
edit: Another good thing to compare is Plato's Allegory of the Cave. The AI might be able to find patterns and glitches, and might be able to exploit those - even in so far as to completely destroy the original simulation, and maybe being able to explore the properties of the electrical circutis "If I do this, that happens". But they will never be able to understand that they are just inside a simulation, or if they have broken down the simulation, that they are in a circuit (if you beleieve is possible for them to completely break down the simulation without also erasing heir own code). They will never think of what they are doing as "Machine code", but always as their rules of physics.
Say by standing in the right spot on a mountain you can see a town whilst still outside its prefab loading zone, you take a step forwards the town appears, take a step backwards and it disappears. This phenomenon isn't entirely subjective or objective, you know the town is always there and you know the people in it are not experiencing this. So this phenomenon is dependant entirely upon your personal perception, but it's a phenomenon you can share with others by showing them this spot.
It's possible to infer from this that either reality is false or your perception of reality is false, but if everyone's perception of reality is false then either they aren't real or what you think is reality is actually false.
But you're still stuck within the scope of this false reality.