Rachel Husband / Getty Images

It is more than 120 years since H.G. Wells published The Time Machine, the novel that was to popularise the concept of time travel and lead to myriad stories on the theme.

But it is only now that we have finally developed a plotline for time travel that makes logical sense – and it has been penned by a machine.

The breakthrough involves the grandfather paradox – that favourite plaything of philosophers where somebody travels into the past and kills their own grandfather, preventing the existence of one of their parents, and therefore their own.

But the problem is, if the protagonist doesn’t exist, then how could they go back in time to set off the chain of events in the first place?

The paradox is often extended, in various guises, to regard any action that alters the past – such as Marty McFly avoiding the amorous attention of his mother, Lorraine, and ensuring she marries his father, George, in Back to the Future.

{%recommended 1561%}

Meanwhile, physicists such as Stephen Hawking use the impossibility of such causal chains (called, in physics-speak, “closed time-like curves”) to argue that travel into the past must be impossible.

There has, of course, always been the possible solution that invokes the “many worlds” interpretation of quantum mechanics. That says that when you travel back in time you end up in an alternate universe, so any damage you might wreak affects that universe only, not the one you were born in.

That solution works, but it requires the existence of many alternate universes and for your time machine to double as a universe hopper.

Resolving the paradox with just one universe has proved trickier.

Now, Doron Friedman, a computer scientist at the Interdisciplinary Center in Herzliya, Israel, has employed automated reasoning to tackle the problem, with his work published on the arXiv (meaning it is yet to go under peer-review).

Time travel plotlines can be brain-meltingly difficult to follow. But Friedman designed a program that can readily track the back and forth chain of events – and their logical consistency (or lack thereof).

He used a simplified version of the paradox, in which the protagonist goes back in time and kills his own father.

When Friedman ran this plotline through his program, it noticed the paradox by reporting a contradiction – namely that if the son travels back in time and kills his father, then how could the son have been conceived?

And when Friedman requested a resolution to the contradiction, the algorithm worked through thousands of possible scenarios to find those that were logically consistent – in other words, where the murderous son’s actions don’t rub him out of existence.

A poster for George Pal’s 1960 adventure film ‘The Time Machine’, based on the HG Wells classic book. Movie Poster Image Art/Getty Images

There were many possible solutions, apparently, but in the paper, Friedman describes two of them.

The first involves the son (let’s call him Marty) becoming his own grandfather. After going back in time and killing his young father (George), Marty then sires a child who later becomes his father, another George.

It’s a solution of sorts, yet it requires some radical causal gymnastics (besides the unsavoury entanglement of Marty and his own grandmother).

The computer’s second solution is more interesting. The snag is it only works if the father also has the ability to travel in time.

The story goes like this.

In 1954 Marty’s father George travels forward in time one year to 1955, when he impregnates Marty’s mother Lorraine before immediately returning back to 1954 – just as his future son, Marty, arrives and kills him.

Because George’s quick foray into the future allowed him to already conceive his son, the paradox disappears.

Granted, it’s complicated (with the family dynamics no more believable than the time-travel premise itself), but the algorithm is more than mere idle geekery.

Nor did Friedman design his program to function merely as a science fiction plot engine. His main purpose is to run virtual reality environments for applications in training, or even psychological rehabilitation.

“Unlike the physical world, the digital sphere allows you to ‘go back in time’, make a change, and observe the consequences,” he writes. Every word processor has an “undo” function to roll back errant prose. And if you make a mistake in a video game, you can return to a previous save-point and try again.

Travelling forward and backward in virtual reality could help people track the consequences of decisions while being trained for a new job. Or it could help a person in psychological therapy deal with the ramifications of a traumatic experience.

It’s probably less helpful for working out disputes between fathers and sons.