Counters in computer science
In computability theory, a counter is considered a type of memory. A counter stores a single natural number (initially zero) and can be arbitrarily many digits long. A counter is usually considered in conjunction with a finite state machine (FSM), which can perform the following operations on the counter:Check whether the counter is zeroIncrement the counter by oneDecrement the counter by one (if it's already zero, this leaves it unchanged).The following machines are listed in order of power, with each one being strictly more powerful than the one below it:Deterministic or Non-deterministic FSM plus two countersNon-deterministic FSM plus one stackNon-deterministic FSM plus one counterDeterministic FSM plus one counterDeterministic or Non-deterministic FSMFor the first and last, it doesn't matter whether the FSM is deterministic or non-deterministic (see determinism). They have equivalent power. The first two and the last one are levels of the Cho...
blog
counter | Topic | Counters in computer science
 
 
Discussion

In computability theory, a counter is considered a type of memory. A counter stores a single natural number (initially zero) and can be arbitrarily many digits long. A counter is usually considered in conjunction with a finite state machine (FSM), which can perform the following operations on the counter:

  • Check whether the counter is zero
  • Increment the counter by one
  • Decrement the counter by one (if it's already zero, this leaves it unchanged).

The following machines are listed in order of power, with each one being strictly more powerful than the one below it:

  1. Deterministic or Non-deterministic FSM plus two counters
  2. Non-deterministic FSM plus one stack
  3. Non-deterministic FSM plus one counter
  4. Deterministic FSM plus one counter
  5. Deterministic or Non-deterministic FSM

For the first and last, it doesn't matter whether the FSM is deterministic or non-deterministic (see determinism). They have equivalent power. The first two and the last one are levels of the Chomsky hierarchy.

The first machine, an FSM plus two counters, is equivalent in power to a Turing machine. See the article on register machines for a proof.

 
 
 
100%
 
 
 
 
Comments
Hi Guest, Log In or Sign Up  to comment.

  • Helen Helen commented | 14 months ago
     
    Halting problem.

    In computability theory, the halting problem is a decision problem which can be stated as follows: given a description of a program and a finite input, decide whether the program finishes running or will run forever, given that input.

    Alan Turing proved in 1936 that a general algorithm to solve the halting problem for all possible program-input pairs cannot exist. We say that the halting problem is undecidable over Turing machines. Copeland (2004) attributes the actual term halting problem to Martin Davis.

    Formal statement
    The halting problem is a decision problem about properties of computer programs on a fixed Turing-complete model of computation. The question is, given a program and an input to the program, whether the program will eventually halt when run with that input. In this abstract framework, there are no resource limitations of memory or time on the program's execution; it can take arbitrarily long, and use arbitrarily much storage space, before halting. The question is simply whether the given program will ever halt on a particular input.

    For example, in pseudocode, the program

    while True: continue
    does not halt; rather, it goes on forever in an infinite loop. On the other hand, the program

    print "Hello World!"
    halts very quickly.

    The halting problem is famous because it was one of the first problems proved undecidable, which means there is no computer program capable of correctly answering the question for all possible inputs.


    [edit] Representing the halting problem as a set
    Decision problems are conventionally represented by the set of objects that do have the property in question. The halting set

    K := { (i, x) | program i will eventually halt if run with input x}.
    represents the halting problem.

    This set is recursively enumerable, which means there is a computable function that lists all of the pairs (i,x) it contains. This computable function simulates all programs on all inputs in parallel, in a manner similar to a multithreaded computer program, and notices whenever one of the programs being simulated halts.

    There are many equivalent formulations of the halting problem; any set whose Turing degree is the same as that of the halting problem can be thought of as such a formulation. Examples of such sets include:

    { i | program i eventually halts when run with input 0 }
    { i | there is any input x such that program i eventually halts when run with input x }

    [edit] Importance and consequences
    The historical importance of the halting problem lies in the fact that it was one of the first problems to be proved undecidable. (Turing's proof went to press in May 1936, whereas Church's proof of the undecidability of a problem in the lambda calculus had already been published in April 1936.) Subsequently, many other such problems have been described; the typical method of proving a problem to be undecidable is with the technique of reduction. To do this, the computer scientist shows that if a solution to the new problem were found, it could be used to decide an undecidable problem (by transforming instances of the undecidable problem into instances of the new problem). Since we already know that no method can decide the old problem, no method can decide the new problem either.

    One such consequence of the halting problem's undecidability is that there cannot be a general algorithm that decides whether a given statement about natural numbers is true or not. The reason for this is that the proposition stating that a certain algorithm will halt given a certain input can be converted into an equivalent statement about natural numbers. If we had an algorithm that could solve every statement about natural numbers, it could certainly solve this one; but that would determine whether the original program halts, which is impossible, since the halting problem is undecidable.

    Yet another consequence of the undecidability of the halting problem is Rice's theorem which states that the truth of any non-trivial statement about the function that is defined by an algorithm is undecidable. So, for example, the decision problem "will this algorithm halt for the input 0" is already undecidable. Note that this theorem holds for the function defined by the algorithm and not the algorithm itself. It is, for example, quite possible to decide if an algorithm will halt within 100 steps, but this is not a statement about the function that is defined by the algorithm.

    Gregory Chaitin has defined a halting probability, represented by the symbol Ω, a type of real number that informally is said to represent the probability that a randomly produced program halts. These numbers have the same Turing degree as the halting problem. It is a normal and transcendental number which can be defined but cannot be completely computed. This means one can prove that there is no algorithm which produces the digits of Ω, although its first few digits can be calculated in simple cases.

    While Turing's proof shows ...
     
    Flag Copyright Report Abuse
     
     
     
  • Helen Helen commented | 14 months ago
     
    The first machine, an FSM plus two counters, is equivalent in power to a Turing machine. See the article on register machines for a proof.
    Voted!
     
    Flag Copyright Report Abuse