12

This may be a silly question. It seem clear that an FSA, since it is finite, can only count the number of symbols in its input string up to a number bounded by the number of its states. But now suppose we equip the FSA with output (e.g. printing) capabilities. It would then be very easy to construct a machine capable of printing one symbol for each symbol that it reads. Would that count as counting? If not, why not?

To put it in terms of FSTs instead: I take it that it is not possible to construct an FST capable of mapping a string of an arbitrary length to a binary representation (i.e. a number in the base-2 numeral system) of its length. But it IS of course trivial to construct an FST capable of mapping a string of arbitrary length to a string of says zeroes (or ones) of the same length. But that could count as counting, could it not, beacuse what the FST is doing is building a representation of the length of its input. A somewhat odd representation, but still a representation, is it not?

Raphael
  • 73,212
  • 30
  • 182
  • 400
Torbjörn
  • 131
  • 1
  • 5

4 Answers4

9

This question is a bit vague, so here is a vague answer: Translating unary to unary is not exactly counting, since the machine doesn't actually "know" what the size of the input was "in the end".

You realize this, of course, which is why you question the fact that it is indeed counting.

Translating from unary to binary, however, seems like a way-more advanced operation, because it does not only involve counting, it also involves arithmetic.

So perhaps the more precise notion to look at, instead of counting, is comparing. That is, given two numbers (in unary) $1^n$ and $1^m$, determine if $n=m$.

The ability to do this comparison is what gives rise to the famous non-regular language $\{a^nb^n: n\ge 0\}$. And the inability of an NFA to count is what makes this language non-regular.

Interestingly, this language is a CFL. And indeed, the corresponding automata model - PDAs, do have the ability to do a limited comparison.

When you talk about comparing, transducers no longer give you any additional power, so the question is resolved in that sense.

An additional note: completely informally, the ability to compare two numbers can often be used to simulate a 2-counter machine Minsky Machine, which are equivalent to TMs.

Shaull
  • 17,814
  • 1
  • 41
  • 67
4

No. Finite state automata do not count. They may do things that look like it, but they cannot count. They can even do a little (hard-wired) computations (like determining whether a binary number is divisible by three) but that is not counting.

A little story. You are on a big rectangular square in a famous city. The locals tell you the square is actually square. If you can count you check whether the horizontal and vertical numbers of tiles match by counting tiles along the sides of the square. If you cannot count you can still verify the claim: start at a corner and walk diagonally. If you exactly reach the opposite corner you have a square.

In your example the fsa tests whether a string has an equal number of $a$'s and $b$'s by tallying these numbers to two different output tapes. Another device has to be doing the final comparison, unless you have a trick to handle the letters $a$ and $b$ in pairs and cros off one against the other. Like in the square.

Now a more formal model to compare with. According to the Chomsky–Schützenberger Theorem every context-free language $L$ is an inverse of a finite state transduction $T$ of the Dyck language $D_2$ on two pairs of brackets $L = T^{-1}(D_2)$ (it is not stated like that on wikipedia, but you have to believe me). Now the finite state transducer $T$ can "accept" its context-free language $L$ as follows (for each language its own transducer). On input $T$ transforms the string into the (guessed) series of pops and pushes of the pda for $L$, then test whether the result is pushdown behaviour, i.e., the result is a string in $D_2$. (Technical details omitted, but this is as claimed by the Ch-Sch Theorem: one has $w\in T^{-1}(D_2)$ iff $T(w) \in D_2$)

My point here is that some "computation" is done by the transducer but much power is hidden in the test with $D_2$. Likewise your example, where two letters are sorted on two tapes.

Hendrik Jan
  • 31,459
  • 1
  • 54
  • 109
1

@Shaull: Thanks for your answer! I'm new to StackExchange and don't know how to comment on an answer, so I choose to write an answer instead, in the hope that I may be forgiven.

Hmm, it seems to me that a shepard counting his sheep by writing a mark on a slip of paper for each sheep that he sees, or a prisoner counting the days he's been in jail by writing marks on the wall, are counting. Why wouldn't n marks on a slip of paper or on a wall count as a representation of the number n? Isn't that what is called a tally representation? AFAICS it is in no obvious way inferior to (say) a binary representation, except that it uses more space.

I suppose that for you then, "know" means that it has an internal representation of the count in the end. Then, of course, it is obvious that an FSA of FST cannot compute the length of an arbitrary string. But if we don't require knowledge in that sense, but demand only that the FSA or FST should be able to tell the result to an external observer, then it seems to me that presenting the count in a tally format should be ok.

Furthermore, if an FSA is equipped with both incremental input and output, then it should in principle be able to use its external environment as a read/write memory, and thus be as powerful as a Turing machine. Right?

Thanks for bringing up the case of comparing. Now, it appears to be the case that if we lift the requirement of an internal representation, and we only require that the machine is able to present the result to en external observer, then we could easily build an FSM that could produce a kind of graphical presentation of the outcome. Suppose the FSM, upon readins "aaaaaabbbbbb" wrote

000000
000000

then, since the bars are of the same length, the FSM has accepted the string "aaaaaabbbbbb". Two bars of the same length means "yes", different lengths means "no".

I guess I'm bending the rules, but that's what I want since I'm interested in the more or less implicit assumptions that are being made in the field of mathematical linguistics.

Shaull
  • 17,814
  • 1
  • 41
  • 67
Torbjörn
  • 131
  • 1
  • 5
1

FSMs can "count" within a finite range/number of steps signified by state transitions. however, they cannot count past a finite number of steps.

there is a sense in which an FSA-like machine can count. a closely related machine is called a Finite State Transducer. the transducer can indeed count in the sense of "piped" input and output. a single transducer can take an input sequence (say in binary) and "transduce" it to an output sequence that is incremented. then one "chains" the (identical) count-by-1 transducers, each one incrementing its input by 1 and outputting it. its also like a rudimentary "streaming algorithm".

vzn
  • 11,162
  • 1
  • 28
  • 52