John is a scientist who invented a time machine. The time machine does not allow John to move into the past; only the future and then back to the time he originally traveled. He also cannot interact with others in the future or change any events while he is in the future. He is essentially invisible; only capable of witnessing events rather than participating. One day, he decides to jump 5 days into the future. He sees that there is a shooting at the local bakery where his grandmother, Barbra, works. Barbra is shot and killed in the shooting. After John sees this, he travels back to the present and decides to go to the bakery and stop the event from happening. He decides to bring a gun so that he can take down the assailant. He walks into the store and waits for the robber to emerge. All of a sudden, his grandma, Barbra, enters the bakery rather quickly. He is startled and mistakes his grandmother for the shooter and shoots her.

Would this have still happened had John not looked into the future?
How did the time machine know that this would happen?

If John had not looked into the future, he would not have witnessed the shooting at the bakery, and therefore would not have had the intention to go back in time and prevent it from happening. Therefore, the event would not have occurred in the same way.

In this scenario, the time machine did not have knowledge of the future events. The time machine only allows John to observe the future but not to interact or change events. The shooting at the bakery and John's mistaken identity were a result of his own actions and decisions based on the information he obtained from the future. It was ultimately John's mistake in assuming his grandmother was the shooter that caused him to shoot her.