What does a Turing machine do when it reaches the end of it's input? - turing-machines

If a Turing Machine has an input tape of 01011, for example, what happens if you reach the end of that sequence without reaching any resolution within the Turing Machine?

The tape is infinite, the input does not only consist of 5 cells. To the left and right, the tape is blank (i.e. filled with 0, or possibly some other symbol if you have more than two). There is no "end of the sequence", the turing machine will continue running its program until it halts (which might be never).

Related

Why does a Turing machine take n^k steps for computing an input?

I was reading about Cook's Theorem for Turing machine. In its proof, it is said that the Turing would take at most n^k steps (where k is an integer and k > 0) to compute an input of length 'n'
This is probably assuming that the Turing machine does halt for the given input
It further says that we as there are at most n^k steps, we don't need an infinite tape. A tape with n^k elements is sufficient as the turning machine would not travel more than that
Why do we say the Turing Machine needs atmost n^k steps?

Is it a state machine when it works with memory?

In the state machines, it is said that it only holds information about the current state and based on the input, a next state is transitioned to.
What about a situation where there are additional conditions, such as:
State A (input X) ---> State B
State B
(input X) AND (SomeValue>=100) ---> State C
(input X) AND (SomeValue < 100) ---> State D
Is this still a state machine?
State machines can have no memory (like finite automata), memory whose access is restricted in some way (such as pushdown automata with stack access), or memory whose access is essentially unlimited (such as a Turing machine or Random Access Machine (RAM)). I think it's fair to call all of these things state machines since they change behavior based upon their internal states.
If the automaton is not writing memory, but only reading memory, and it has no ability to "go back" and read memory it had read before, then no matter what memory it's reading, it's equivalent to having no memory and simply responding to the normal inputs it receives. For instance, a Turing Machine that cannot write and can only read its tape from left to right is equivalent to a finite automaton; a pushdown automaton that cannot push symbols onto the stack is equivalent to a finite automaton; etc.
If the automaton can write the contents of memory and has an ability to eventually read those contents back - and if the amount of memory which can be so manipulated is not fixed - then it remains a state machine but is no longer equivalent to a finite automaton. Note that I say the amount of memory must not be fixed: if the amount of memory is fixed, then any machine using it is equivalent to a finite automaton with repeated states for every possible configuration of all memory. Even the computer you're on right now is no more powerful than a finite automaton: in fact, your computer is infinitely less powerful than a general finite automaton, since there are infinitely many regular languages that cannot possibly be accepted by any physically realizable computer.

Turing machine that accepts another turing machine if it makes a certain move

Is it possible to build a turing-machine that has another turing-machine and a string as input and accepts if the received machine would make a left or right (or anything) move for that string?
No. Creating such a machine requires solving the halting problem. To show this, assume your input is Turing machine T, and I pass it through another machine that modifies every halt instruction with turn left followed by halt. I then feed this new machine, T' into your candidate machine. In order for your machine to correctly detect whether T' will turn left, it must solve the halting problem.

Universal turing machine U should determine if M(x) stops

so we have a universal turing machine U, that should determine if a turing machine M with input x will stop. The solution should be presented in pseudo code.
can someone help me a bit out, who should i solve it ?
This sounds like the halting problem:
The halting problem can be stated as follows: "Given a description of an arbitrary computer program, decide whether the program finishes running or continues to run forever". This is equivalent to the problem of deciding, given a program and an input, whether the program will eventually halt when run with that input, or will run forever.
Alan Turing proved in 1936 that a general algorithm to solve the halting problem for all possible program-input pairs cannot exist. A key part of the proof was a mathematical definition of a computer and program, what became known as a Turing machine; the halting problem is undecidable over Turing machines.
So no, it's not possible.
If you want, you can probably run M on x for a while. If it stops, we know it stops. If it doesn't stop, we don't really know whether or not it stops.

Do machine language instructions include input numbers or do they require inputs from user or other device?

I have been reading about e.g. 32-bit microprocessor architectures. I have a simple question: if the maximum number of bits in a floating point number is 32 bits, then how does that number get into the microprocessor for processing? Can it be as part of a machine language instruction? Because if the answer is yes, wouldn't it have to constitute the entire machine language instruction (in other words, there would be no room left for control bits or opcodes or anything else, since all 32 bits would be used for the number itself). Is that how it is actually done, i.e. is there a machine language command that says "attention CPU: the next machine language command you will read is not actually a command; it is actually a number".
Or, alternatively, does all "data" that gets fed to a computer have to come in separately, not as part of the machine language instructions?
In particular, I would like to know how Intel microprocessors handle this issue.
My assembly is a bit rusty, but what I can remember is that there is specific registers for instructions, and specific registers for data. So you would literally move your next data item into the relevent registers, and then shove your desired instruction into the AX(?) register.
But, I caution - last time I wrote assembly was back in 2004....
all the data on the cpu moves via a central bus or other channels. Data is stored either in memory or the caches although there is not much room in the cache. Let's say you use the inc eax; command, the inc itself is a information that was fetched from the RAM. Thing is, there are intra-cpu commands like the one above, where the EAX gets incremented. Then there are commands that required outside data. For these commands, a part of the instruction is an address itself. In later Intel cpus, it's possible to add an operand in the instruction itself, by it's smaller. The address in the instruction is either a pointer to the data you need or a pointer to a pointer of the data you need.
Bottom line, a CPU looks for instructions. If the first thing it gets booted with is not an instruction, the cpu would still treat it as a number and that'll mess up everything.
example: let's say we have a 8 bit CPU, the first thing in the memory that gets loaded in the cpu should be an instruction, so let's say it gets 01001010, then the opcode is 01, (add or w.e), then the instruction would be to add w.e is at the address 001010 to the accumulator
Damn I suck at explaining this
Often, machine language instructions can consist of several words. So one word is the instruction next word or words are associated immediate data (a value to put to register, or memory address to operate on). This is how things work on CISC processors, like Intel x86 related architectures.
But you are onto something. In RISC architectures, it's common that each instruction is exactly one word. In this case, to load a 32 bit value, two instuctions are needed. In other words, there is a one-word instruction to load a value with less bits, and then another one-word instruction to load rest of the bits, when needed. Very often 2nd instruction is not needed, the "small" value might still have 24 bits, which is enough for most number values in program code..

Resources