Google has built a "Matrix-style" digital simulation of the entire Californian road system in which it is testing its self-driving cars – and is lobbying the state's regulators to certify them based on virtual rather than real driving.

The extensive simulation – reminiscent of the virtual cities created for human captives in sci-fi blockbuster The Matrix – exists entirely inside computers at the company's Mountain View location, and the cars have so far virtually "driven" more than 4 million miles inside it, facing challenges just like those in the real world, such as lane-weaving motorists, wobbly cyclists and unpredictable pedestrians.

The ambition of the simulation illustrates how serious the tech company is at developing self-driving cars, an innovation that has been independently estimated as worth billions of pounds if widely implemented.

California's regulations stipulate autonomous vehicles must be tested under "controlled conditions" that mimic real-world driving as closely as possible. Usually, that has meant a private test track or temporarily closed public road.

But Ron Medford, Google's safety director for the self-driving car programme, has been arguing that the computer simulation should be accepted instead. In a letter in early 2014 to California state officials, which the Guardian has obtained under freedom of information legislation, Medford wrote: "Computer simulations are actually more valuable, as they allow manufacturers to test their software under far more conditions and stresses than could possibly be achieved on a test track."

He added: "Google wants to ensure that [the regulation] is interpreted to allow manufacturers to satisfy this requirement through computer-generated simulations."

Keanu Reeves in The Matrix. Photograph: PR

The company has also lobbied officials to change the wording of the rule to explicitly allow digital models. That, however, has been turned down. "The driving simulator is a relatively new tool – we didn't have anything like it a few years ago," Google spokeswoman Katelin Jabbari told the Guardian. "It's now a critical part of how we test and refine our software."

Google's real self-driving cars use a combination of onboard computers, stored maps, laser guidance and object recognition to determine appropriate speeds and actions to take. They operate over a limited area of about 2,000 miles of road that Google has mapped in minute detail in California – a fraction of the total of 172,000 miles of public roads in the state. But they have driven over that range many times: the cars have notched up a total of 700,000 miles over those 2,000 miles.

Using that data, Google has encoded how various situations unfold and how other road users are likely to behave.

"We've developed models of what a car approaching a four-way stop at high speed is likely to do, and what the various probabilities are that it will stop normally, screech to a stop or run the stop sign," said Jabbari.

This allows Google engineers to assess new software for its robot cars in realistic virtual environments, testing how tweaks to their behaviour might play out in reality. For example, a new emergency braking system was driven 10,000 miles in the simulator to check how often it kicked in and how it performed. And 50 virtual self-driving cars were dropped into a digital version of Google's hometown of Mountain View to see how they interacted with each other, computer-generated pedestrians and simulated drivers.

"In a few hours, we can test thousands upon thousands of scenarios which in terms of driving all over again might take decades." A key improvement from the digital simulator is helping the computer running the car figure out situations that human drivers typically navigate with social signals, like lane changes, merges and four-way stops. "It's not just about the physics of avoiding a crash," says Jabbari. "It's also about the emotional expectation of passengers and other drivers."

If a truck cuts off a Google car, say, the software delivers sharper braking than is absolutely necessary, because it feels safer to passengers.

"Google is trying to leap several steps ahead and start from fully autonomous vehicles," says Chris Schwarz, a senior research engineer at the US National Advanced Driving Simulator (NADS) in Iowa. "They have to deal with not only the built environment but also dynamic objects in the scene. Many other manufacturers are taking a more incremental approach."

The NADS, home to the world's most advanced ground vehicle simulator, focuses on human drivers using semi-autonomous technologies like lane assist and crash avoidance, and has simulated 3.5m miles of driving. "Google is trying to solve a much bigger problem. It takes Google to do it on the scale that Google is trying to do it," says Schwartz.

Because much of Google's virtual testing focused on rare and potentially hazardous scenarios, the company argues that the test equates to many lifetimes of human driving. "These are not straight and empty roads but four million interesting miles that actually teach us something and challenge the car," said Jabbari.

However, even Google's record-breaking simulation has its limitations. Running real-world incidents over and over again in digital code helps Google fine-tune its responses, but "if you change your behaviour, there's always the possibility that the cars in the intersection might change in reaction to you," Schwarz pointed out. "You can't get that from just doing replays."

The other problem is that Google's motoring "Matrix" is based mainly on the infrastructure and inhabitants of California. Rain is infrequent in much of the drought-stricken state, and snow or ice are virtually unheard of in the southern part of the state, where the 2,000 miles of physically mapped roads lie. Driving culture and norms also vary considerably in America, and even more so around the world. "Google will need to collect a lot more infrastructure and digital data about other parts of the country and internationally," says Schwarz.

Even in California itself, officials are sceptical. However, California's Department of Motor Vehicles has so far refused to modify its rules, confirming that physical testing on private tracks was required before autonomous vehicles could take to public roads.Google says that its intent was not to skirt safety but to add an additional layer. "It's safer to test in simulation to make sure you haven't broken anything before you go out on a real road. We think that simulation and the track and real road driving should be used for self-driving car testing in the future," says Jabbari.Meanwhile, Google continues to improve and scale up its simulation efforts. And perhaps the next state to embrace autonomous vehicles will be happier doing its test driving inside the Matrix.

• The subheading on this article was amended on 26 August 2014 to better reflect the article.