In 2014, Michigan Technological University physicists Robert Nemiroff1 and Teresa Wilson thought up a novel way to detect time travelers: Search the Internet.

time travel

They searched for mentions of "Comet ISON2" — a sun-grazing comet3 discovered in September 2012 by Vitali Nevksi and Artyom Novichonok — and for "Pope Francis4", whose papacy began in March 2013 and who is the first to choose this name in honor of Saint Francis of Assisi5. Both of these subjects are historically momentous enough that they might be known even to people in the far future. If those people travel into our past, then they might mention them inadvertently in, say, 2011, before we could plausibly have done so ourselves.

In their research article they reported:

Given the current prevalence of the Internet, its numerous portals around the globe, and
its numerous uses in communication, this search might be considered the most sensitive and comprehensive search yet for time travel from the future. […] Technically, what was searched for here was not physical time travelers themselves, but rather informational traces left by them.

They also note that their failure to detect travelers doesn't mean they're not there:

Although the negative results reported here may indicate that time travelers from the future are not among us and cannot communicate with us over the modern day Internet, they are by no means proof. There are many reasons for this. First, it may be physically impossible for time travelers to leave any lasting remnants of their stay in the past, including even non-corporeal informational remnants on the Internet. Next, it may be physically impossible for us to find such information as that would violate some yet-unknown law of physics, possibly similar to the Chronology Protection Conjecture6. Furthermore, time travelers may not want to be found, and may be good at covering their tracks. Additionally, time travelers just may not have left the specific event tags that we were searching for. Finally, our searches were not comprehensive, so that even if time travelers left the exact event tags searched for here, we might have missed them due to human error, oversight, incompleteness of Internet catalogs and searches, or inaccurate content time tags.

Assignment

We have searched the Internet looking for traces that have been left behind by time travelers. Each search has resulted in a series of relevant web pages. For each web page, the following information has been registered in a text file:

A text file containing the results obtained for the search term "president Trump" could then for example look like this:

@2017-10-12
Donald J. Trump is the 45th President of the United States. He believes the
United States has incredible potential and will go on to exceed anything that it
has achieved in the past. His campaign slogan was Make America Great Again, and
that is exactly what he intends to do. Donald J. Trump is the very definition of
the ...
@2017-10-13
Dec 29, 2017 - President Trump gave an impromptu half-hour interview with the
New York Times on Dec. 28. We combed through the transcript and here's a quick
roundup of the false, misleading or dubious claims that he made, at a rate of
one every 75 seconds. (Some of the interview was off the record, so it's
possible the rate of false ...
@2017-12-20
President Donald Trump on Wednesday hailed congressional Republicans' ambitious
$1.5 trillion rewrite of the tax code as a win for middle-class Americans.
Interested in Taxes? Add Taxes as an interest to stay up to date on the latest
Taxes news, video, and analysis from ABC News. Taxes. Add Interest. He took a
victory ...

The goal of this assignment is to search for the first mention of a search term in a file containing results of an Internet search. The search term can consist of multiple words. To determine whether a search term occurs in a text fragment, we first convert the search term and the text fragment into lists of words, where the words are formed by the longest possible sequence of letters and digits. By letters we mean all characters for which the string method isalpha returns the value True. In this way, the text fragment

Donald Trump is the 45th President of the United States.

results in the following list of words

word list

There are two factors that play a role in determining whether the list of words of a search term appear in the list of words of a text fragment. When comparing words we can or cannot distinguish between uppercase and lowercase letters. In the latter case, we say the search is case insensitive.

We can say that a search term occurs in a text fragment if all words of the search term appear in the list of words of the text fragment, regardless of their order. We can also impose that a search term only occurs in a text fragment if the list of words of the search term are also consecutive words in the text fragment. In the latter case, we say that we search for consecutive words, where the words must not be consecutive in the first case.

consecutive words

Your task:

Example

In the following interactive session we assume the text file president_trump.txt7 to be located in the current directory.

>>> sentence = 'Donald Trump is the 45th President of the United States.'
>>> words(sentence)
['Donald', 'Trump', 'is', 'the', '45th', 'President', 'of', 'the', 'United', 'States']
>>> words(sentence, ignoreCase=True)
['donald', 'trump', 'is', 'the', '45th', 'president', 'of', 'the', 'united', 'states']

>>> searchTerm1 = 'donald trump'
>>> contains(sentence, searchTerm1)
False
>>> contains(sentence, searchTerm1, ignoreCase=True)
True
>>> contains(sentence, searchTerm1, ignoreCase=True, consecutive=True)
True

>>> searchTerm2 = 'president Trump'
>>> contains(sentence, searchTerm2)
False
>>> contains(sentence, searchTerm2, ignoreCase=True)
True
>>> contains(sentence, searchTerm2, ignoreCase=True, consecutive=True)
False

>>> filename = 'president_trump.txt'
>>> origin(filename, searchTerm1)
>>> origin(filename, searchTerm1, consecutive=True)
>>> origin(filename, searchTerm1, ignoreCase=True)
datetime.date(2017, 10, 12)
>>> origin(filename, searchTerm1, ignoreCase=True, consecutive=True)
datetime.date(2017, 10, 14)

>>> origin(filename, searchTerm2)
datetime.date(2017, 12, 27)
>>> origin(filename, searchTerm2, consecutive=True)
>>> origin(filename, searchTerm2, ignoreCase=True)
datetime.date(2017, 10, 12)
>>> origin(filename, searchTerm2, ignoreCase=True, consecutive=True)
datetime.date(2017, 10, 13)

Epilogue

Is James L. Brook — writer of some of the Simpsons episodes — a time traveler? The 25th season of the Simpsons was released in the year 2000, 16 years before Donald J. Trump was elected as the 45th President of the United States. This seasons features the episode "Bart to the Future8" in which Bart imagines his coming years, where Lisa Simpson took over as

America's first straight female president

from an outgoing President Trump. In the episode she tells her team in the Oval Office

As you know, we've inherited quite a budget crunch from President Trump.

She asks how bad things have got, to be told the country is broke, as the previous regime invested in the nation's children but "created a generation of ultra-strong super-criminals".

Fifteen years later, after Trump did in fact announce his candidacy, a new Simpsons short — "Trumptastic Voyage" — poked fun at the wannabe world leader (and his hair).

Epilogue

On June 28, 2009, Stephen Hawking9 hosted a party for time travelers, but he sent out the invitations only afterward. No one turned up. He offered this as experimental evidence that time travel is not possible. In his press statement he said:

I sat there a long time, but no one came.

Resources