Turing Machine Alternative (Counter Machines) - Computerphile

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • Computing with counters. How "counter machines" are as powerful as turing machines, albeit slightly more convoluted! Dr Christopher Hampson, Senior Lecturer in Computer Science Education at KCL explains.
    EXTRA BITS: • EXTRA BITS - More on C...
    / computerphile
    / computer_phile
    This video was filmed and edited by Sean Riley.
    Computer Science at the University of Nottingham: bit.ly/nottsco...
    Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

Комментарии • 232

  • @remingtonantonamalanthan1685
    @remingtonantonamalanthan1685 Год назад +79

    Chris was the single best lecturer that I've ever had (and probably will ever have). Broke down problems in a way that everyone could understand. Glad to see that his streak of amazing teaching continues!
    Looking forward to more videos with him!

    • @zainio
      @zainio Год назад +4

      He supervised my disseration! Was great :)

    • @elitea6070
      @elitea6070 Год назад +6

      He was also my lecturer, always explained the hardest concept in the easiest ways and always made the lectures engaging and fun!

    • @alexrubio40
      @alexrubio40 Год назад +4

      He turned my hate towards discrete maths into curiosity

  • @enas_trelos
    @enas_trelos 10 месяцев назад +6

    Best lecturer I had at KCL. Always a pleasure listening to him!

  • @dembro27
    @dembro27 Год назад +15

    Using the right candy as counters, this seems like a delicious alternative, though more prone to data loss.

  • @cadekachelmeier7251
    @cadekachelmeier7251 Год назад +147

    The other half of this would be to show that every counter machine can turn into a turing machine. That's left as an exercise for the reader.

    • @rmsgrey
      @rmsgrey Год назад +21

      That's only required if you want to show that Turing machines are at least as powerful as counter machines. The video does show that counter machines are (at least) as powerful as Turing machines.
      And all you actually need to show is that any computational model which Turing machines have already been shown to be able to simulate can simulate counter machines - for example, an idealised PC (one with unlimited word size and memory). And it's pretty obvious that an idealised PC can do everything that's required in order to simulate a counter machine - you need to store a finite number of values (the bags) and then each step is either adding 1 to a specified value and going to a specified next step, or attempting to subtract 1 from a specified value, either detecting it's already 0 and going to a specified next step, or actually subtracting 1 and going to a specified next step.
      In general, if you can describe a machine well enough for someone else to be able to create and run it without any ambiguity, that's already strong evidence that a Turing machine (or equivalent machine) can simulate it.

    • @s.patrickmarino7289
      @s.patrickmarino7289 Год назад +5

      I think he already demonstrated everything you need for Turing completeness.

    • @menachemsalomon
      @menachemsalomon Год назад

      @@rmsgrey If a counting machine can be simulated by a Turing machine, and a Turing machine can be simulated by a counting machine, then is there a way to determine which is simpler, or if both are functionally equivalent, or if, as the title of the video suggests, they are equally valid alternatives?

    • @rmsgrey
      @rmsgrey Год назад +1

      @@menachemsalomon It depends what you're looking for to count as simplicity.
      In terms of what each can calculate, the two are equivalent.
      In terms of describing the machine type, a counting machine is simpler - each node either: halts; increments a specific bag and then goes to a specific next node; or attempts to decrement a specific bag and goes to one of two specific next nodes depending on whether there was anything in the bag to remove. Meanwhile for a Turing machine, each state needs to have an entry for each possible symbol, specifying which symbol to write, which direction to move, and which state to enter.
      In terms of using them to perform computations, or to prove things about them, in general, which is simpler to use is going to depend on the specific task.

    • @rmsgrey
      @rmsgrey 11 месяцев назад +4

      @@jack8n Counter machines can have an infinite number of counters, but only a finite (but arbitrarily large) number of bins - a bin can only be accessed when it's directly named by a specific state of the machine, and a machine is only allowed a finite number of states, so it can only ever make use of a finite number of different bins - at most, as many as there are states.
      On the other hand, the video demonstrates how a counter machine can simulate a binary Turing machine with just 4 bins.

  • @wholenutsanddonuts5741
    @wholenutsanddonuts5741 Год назад +85

    Turing was amazing. Thanks for this counter example!

    • @cadekachelmeier7251
      @cadekachelmeier7251 Год назад +14

      Sounds like you need to go to Church.

    • @keepyoursins
      @keepyoursins Год назад +2

      ​@@cadekachelmeier7251what?

    • @lovealien43
      @lovealien43 Год назад +1

      It is an example using counters not an example that counters some logical statement.

    • @cadekachelmeier7251
      @cadekachelmeier7251 Год назад +11

      @@keepyoursins It's just adding to the silly pun. Turing machines were developed at the same time as Lambda Calculus, developed by Alonzo Church. The Church-Turing thesis says that they're equivalent.

    • @davidioanhedges
      @davidioanhedges Год назад

      It can emulate a Turning machine, so it is a Turing machine ... it's not a counter example, it's another type of computing system that has been shown to be Turing compatible

  • @George4943
    @George4943 Год назад +2

    If we're looking for simplicity in hardware and want to implement logic gates the single gate, NAND, is enough. All the 2-input 1-output logic gates can be built by composing NAND gates. So all the Turing machine (or counter machine) logic can be done with NAND.
    If looking or simplicity in software one logic will do. The "While ( is true) DO END" is sufficient. All the if, if-then, do while, do until, case, and so on can be constructed from this one logic.

    • @George4943
      @George4943 Год назад

      The logic for the human condition:
      While (Alive) If not content do something else.

  • @stardustsong1680
    @stardustsong1680 Год назад +78

    It's so weird to call it "Counter Machine" but we can't actually "count" the number of elements inside every container. I'd rather call it "Stack machine" because its behaviour is similar to a stack ("push" and "pop").

    • @IngieKerr
      @IngieKerr Год назад +25

      I agree, it's not very counter intuitive. And that in itself makes nonsense of my previous sentence. We seem to have a halting problem just with its name. :)

    • @cadekachelmeier7251
      @cadekachelmeier7251 Год назад +11

      A stack machine sounds more like a name for a Pushdown Automaton. These don't really have the LIFO property of a stack.

    • @akashhiremath20
      @akashhiremath20 Год назад +1

      Stack can hold different types of things, not just a number. This is much stricter than stack since there can only be numbers. Since it is just a number, push and pop does not really apply here. So it does not really have LIFO property like @cadekachelmeier7251 said

    • @MartinMaat
      @MartinMaat Год назад +2

      A stack holds multiple items, this is just one item of which the value is incremented or decremented with each operation. And that is indeed counting (up or down).

    • @mryup6100
      @mryup6100 Год назад

      ​@@IngieKerrhaha nice one!

  • @r-prime
    @r-prime Год назад +7

    I just realised this is literally easier Brainfuck with no i/o:
    + : add a counter
    -: remove a counter
    [: check if counter is 0
    ]: a computer friendly way to close the loop in the phase diagram
    >

  • @tediustimmy
    @tediustimmy Год назад +7

    I'm another person who immediately thought brainf*ck. The counter machine has some capabilities that bf doesn't have, like 'break'. An interesting tidbit is the isomorphism between bf and a language Corrado Bohm invented in the 1960s while simplifying Turing machines. This language shows up in Bohm and Jacopini's proof of the Structured Programming Theorem.

  • @stickfigure31
    @stickfigure31 10 месяцев назад +3

    How he describesld a counter machine works kind of reminds me of when I built an 8bit binary adder with a 1bit carry out with Redstone NOR gates in my survival world. It was so tiring and resource intensive I didn't want to added hardware bitshit or bitwise operators, so I looked up the Arithmetic algorithms and converted the multiplies/divides to repeated add instructions before working on a clock, program counter, and memory.
    I never got around to connecting the components up, but I think with the 10hz limit of redstone bitwise not would be slow since the algorithm was (X*-1)-1 either required adding 255 (-1 in 2s complement) X number of times the easiest to program (this took X+1 number of add instructions) or faster if you knew it was an even or odd number you'd perform a series of left bitshift by doing X = X + X and interwoven between those bitshifts you add either 1 if it was an odd number or 2 if it was even either way once you got -X you'd add -1 or 255 to get X's bitwise not (worst case for this was 14 add instructions to get -X not including any method to determine odd or even before hand the best I could figure was copying the value you want to bitwise not and bitsifting it 7 times to left and seeing if the output was zero for even or 127 for which took another 7 add instructions plus memory instructions, then it took a final add instruction of -1 or 255 for at least 22 instructions).

  • @ekandrot
    @ekandrot Год назад +21

    For double, why not double on the write rather than the read? It would be almost half the number of overall operations.

  • @codahighland
    @codahighland Год назад +44

    It should be noted that by "outperform" he means "compute a result that a TM can't" -- not "run faster" because TMs are notoriously inefficient.

    • @davidioanhedges
      @davidioanhedges Год назад +2

      If it can compute a result that a Turing Machine can't .... that also includes every computer on earth ... and that's not likely ...

    • @oleonardohn
      @oleonardohn Год назад +10

      TMs are Turing-complete by definition, so it means they can compute anything that is computable.

    • @dragonrider7225
      @dragonrider7225 Год назад +9

      ⁠​⁠​⁠​⁠​⁠​⁠@@oleonardohn
      You seem to have reversed the definitions of "computable" and "Turing machine". A Turing machine is just a particular kind of state machine that operates locally on a mutable string of arbitrary size. The term "computable" is defined to mean "can be computed by a Turing machine", not "can be computed". In practice, these two definitions seem to be equivalent because -- despite decades of trying -- nobody has ever devised a state machine that cannot be simulated (however slowly) by some Turing machine, but to the best of my knowledge, nobody has actually proven that no such machine could exist.

    • @oleonardohn
      @oleonardohn Год назад

      @@dragonrider7225 We can also go with the definition that something is computable if and only if there is an algorithm that describes it. Despite being equivalent to the definition you provided, it also implies that supercomputation would require at least an infinite amount of steps.

    • @MrDoboz
      @MrDoboz 11 месяцев назад

      @@oleonardohn okay than, please compute while(true){}; for me then. I mean, it's certainly an algorythm that describes something, just not a very useful or interesting one.

  •  Год назад +32

    I think it's irritating that both the pieces and the containers are called counters.

    • @SteveAgland
      @SteveAgland Год назад +16

      I tried to count the number of times he said "counter" but suffered an integer overflow.

    •  Год назад +1

      Haha, you could also try to count the occurences of “so”😄@@SteveAgland

    • @richardbloemenkamp8532
      @richardbloemenkamp8532 Год назад +1

      I sounds like a British thing. I suspect Americans would use less-ambiguous word.

    • @RobinWootton
      @RobinWootton 9 месяцев назад +1

      Buttons, lentils, shells, matches, drafts, ,bottle tops, raisins...
      Bags, cells, boxes, pots, containers, stacks, variables...

  • @mellertid
    @mellertid Год назад +8

    So both the containers and the value units are "counters"?

  • @themcchuck8400
    @themcchuck8400 Год назад +9

    This has been implemented for 30 years as the esoteric language "Brainf*ck".

    • @samberg3864
      @samberg3864 2 месяца назад

      I was about to comment that this reminds me of brainfuck

  • @issaryazbin1695
    @issaryazbin1695 Год назад +7

    In the video, it was stated that the tape of a Turing machine is infinite. If so, how would a counter machine be able to hold decimal representations of the binary numbers to the left and right of the current location?

    • @matthieud.1131
      @matthieud.1131 11 месяцев назад +5

      The formal definition of a Turing machine states that its initial state (the initial content of its tape) is a finite sequence of symbols. Hence, while the tape is defined as "infinitely extendable left and right" and the content of the tape can grow arbitrarily large, the tape cannot hold an infinite sequence of symbols, since generating such a sequence from a finite initial sequence would require an infinite number of steps. There will always be a finite sequence of symbols left and right of the head.

  • @Jaylooker
    @Jaylooker Год назад +4

    This counter machine has the same analogy for the axiom of choice with bags and marbles like the the axiom of choice. In a way this counter machine assumes the axiom the choice by being able to collect any element from each set to form a new set even if temporarily.

    • @cube2fox
      @cube2fox 9 месяцев назад

      The axiom of choice is only needed for infinite sets though.

  • @s.patrickmarino7289
    @s.patrickmarino7289 Год назад +23

    This looks functionally a bit like the destructive read of core memory in very early computers.

  • @SteveGouldinSpain
    @SteveGouldinSpain Год назад +11

    It's like using the Tower of Hanoi to compute!

  • @jacobzimmerman3492
    @jacobzimmerman3492 Год назад +2

    When I was learning computational theory, the way I distinguished regular from context free, and context free from other decidable languages was always by thinking of how many things could be counted (and uncounted). An NFA or CFL can count and uncount one thing, meaning a^k b^k is a CFL because you count k a's then uncount k a's, a^k b^k c^k needs to count k a's then uncount k a's, and also count k c's, therefore not a CFL.

  • @U014B
    @U014B Год назад +5

    23:30 It can slide to the left, and it can slide to the right, but can it do three hops this time?

  • @necrominer3518
    @necrominer3518 Год назад +9

    I believe the example of copy from c2 into c4 has a slight error. At the beginning of the procedure there is no garuntee that c4 is empty so we must begin by emptying that counter using reset(c4).

    • @wybird666
      @wybird666 Год назад +6

      It was implied that the counter is reset before use. This is true in a computer - one needs to reset or write a fixed number to the register(s)/memory before use.

    • @lovealien43
      @lovealien43 Год назад +4

      These models assume that all counters / registers are initialized to 0.

    • @necrominer3518
      @necrominer3518 Год назад +1

      @wybird666 thanks for the clarification, I must have missed that

  • @F.E.Terman
    @F.E.Terman Год назад +2

    When I saw the title I thought that it was a machine to 'counter' the Turing machine.
    Turns out that that is about the only meaning of 'counter' _not_ used in the video.

  • @joaquins90
    @joaquins90 Год назад +4

    You could check if it's 0, if it's not it is 1, as de actual register can only contain a 1 or a 0 in a touring machine, I don't get the extra step of subtracting one and adding it again...

    • @codahighland
      @codahighland Год назад +7

      It's a quirk of the formalism that wasn't well explained. There isn't actually an "empty?" operation. Instead, every operation must either add or remove a count, and for a remove operation you can go to a different state depending on if it succeeded or failed.

    • @l0zerth
      @l0zerth Год назад

      Because a Counter Machine has no way of simply reading data, it must see a zero or move the bit somewhere, otherwise it would be lost.
      Remember, this is only a theoretical concept, not meant to be used in the real world, and would be worse than useless if you ever tried.

    • @joaquins90
      @joaquins90 Год назад +1

      @@l0zerth I am familiar with this kind of theoretical computation, just took the rules from what was said in the video. If you could check for 0, you can check for something, but not knowing how much it is(if checking for 0 fails, or it's false).
      As I understand now that's not the case, it's only after changing the value that it could be done, or something like that, not just checking by itself.
      Of course it's ridiculous to implement, to then try to do with millions of states what a SIMD can do in one execution...

    • @l0zerth
      @l0zerth Год назад

      @@joaquins90 I've heard of counter machines before, and gone through a similar primer to this, many years ago, so I only vaguely remember the rules and properties, of which this only introduces the most basic.
      A Turing Machine can directly store a discreet value, which can be non-destructively read at any time, as the data is on magnetic tape in the fundamental concept.
      Counter Machines store "actual" tokens in discreet batches and performs operations on them, and has to count them every time, with the desired or questioned answer being the exit of the operation. Those tokens have to be moved or they are lost, just like counting the glass drops if you can't see them, which a CM cannot, as the data would be stored in more of a modern solid state concept.

  • @williamwells3026
    @williamwells3026 Год назад +2

    This reminds me of "The Little Man Computer". I came across it last year. It was a paper computer concept used to explain how computers work.

  • @KipIngram
    @KipIngram 5 месяцев назад

    I find the Turing machine argument compelling because it makes the point that universal computation is possible. But... once you've got such a proof of concept, you don't really need another one. Once you've established "possibility," then the goal becomes "efficiency," and this certainly doesn't seem to buy you much there. It's so easy to just "clear" a counter, and so easy to just add and subtract, etc.

  • @OlliWilkman
    @OlliWilkman Год назад +6

    I wonder if there's any use for a probabilistic version of this, where you do indeed have different colours of counters, and you pull out a random counter from each bag and can make choices based on the colour of the counter too.

    • @MrDoboz
      @MrDoboz 11 месяцев назад

      why would you do that

    • @OlliWilkman
      @OlliWilkman 11 месяцев назад

      @@MrDobozwhy, for the glory of Satan of course!

    • @MrDoboz
      @MrDoboz 11 месяцев назад

      @@OlliWilkman probably

  • @forthrightgambitia1032
    @forthrightgambitia1032 11 месяцев назад +1

    The main complication that really isn't explained is you need a counters to keep track of which state the turning machine is in and then move left/right and add depending on what is there. You could just have a routine that keeps on taking off counters from a stack c4 and shunts of at say count 1 etc depending if it is empty, that then does a move left/right and add or remove from c2 and then sets the next state by adding x counters back to c4 and looping again.

  • @R.B.
    @R.B. Год назад +2

    I'm not sure I understand read. If it is a state machine, you read a 0, and you know it is 0. Answers is 0. If you are reading a 1, subtract 1, add to the temp, check if 0... is that part of a loop? If it isn't 0, how do you handle that bad state? If after moving to temp you move temp back to the head, you now branch how? The state of zero or one isn't really maintained as far as I can tell, so there isn't a branching which isn't part of the read subroutine.

  • @Lebensgott
    @Lebensgott Год назад +2

    one thin i didnt understand is, why cant you just check if a counter is in it instead of taking one out, checking if it is empty and then adding it back, especially if there is only one or zero

    • @richardbloemenkamp8532
      @richardbloemenkamp8532 Год назад

      You can, but you need an extra elementary instruction. There is no fundamental difference. These machines are meant to be simple, efficiency is not a criterion. Anyway he showed that you do not need this type of 'how many are in the bag' instructions because the elementary instructions and one temporary bag are enough for an algorithm to perform that function.

    • @l0zerth
      @l0zerth Год назад

      In order to save that counter element, you have to move it somewhere else, thus the temp counter "bag", just like if you're cutting and pasting, the days had to be stored in RAM during the process.

  • @mekkler
    @mekkler Год назад +16

    This is sounding more and more like Brain#@(

    • @user-qp5rh9iv7n
      @user-qp5rh9iv7n Год назад +3

      i think it's literally some brain#@(< dialect

  • @nsofi
    @nsofi Год назад +5

    A turing machine also has a set of states it is in (start state, end states and as many others as needed) as well as a transition function that moves the machine between the states and the head. This aspect was completely ignored in the video and its pretty big. Obviously it does not change the fact that a counter machine is equivalent to a turing machine but it would have been nice to see how the reduction really works. A followup video?

    • @mostm8589
      @mostm8589 Год назад +2

      Yeah the video kinda sweeps that completely under the rug, which is weird because without the controller state machine the Turing Machine would just be a big dumb infinite hard disk with absolutely no logic at all.
      It appears that the video implies the Counter Machine also has a finite state machine, since the lecturer starts drawing one when he explains the various procedures. You translate each state of the Turing Machine into a set of states in the Counter Machine that transforms the Counter Machine's set of counters in the same way the original state transformed the Turing Machine's tape.

    • @CD4017BE
      @CD4017BE Год назад +1

      The Turing machine states directly map to counting machine states. The counting machine would just have a few additional intermediate states for each Turing machine state transition in order to perform the necessary operations.
      You would basically take the state graph of the Turing machine, translate each state transition operation as shown in the video and then use the end states of one translated operation as starting states for the next ones.

  • @kurasame92
    @kurasame92 11 месяцев назад +1

    There is one thing I didn't understand, so the Turing Machine has usually a well defined set of n states, that decides on reading a cell and if it should change the value, what state change to, and where to move. How does the counter machine do that? I see that you can map 1:1 the actions of a turing machine to a counter machine, but how do you translate the states of the turing machine into the states of the counter machines?

    • @MrDoboz
      @MrDoboz 11 месяцев назад

      I guess you can have extra bins representing each state and you can read the current state by checking which one is empty, change state by adding 1 to the current state and clearing another bin, now that's the active state, and there you have it.
      also if you really don't like wasting an infinite bin for every state, you cold multiplex a few bins, to have let's say 16 different states with just 4 extra bins, although that would make changing states a little bit more difficult.
      the state bins tho really don't need to be infinite, they can be just binary flags as you would use them like so anyways

  • @pierreabbat6157
    @pierreabbat6157 Год назад +2

    This way of emulating a Turing machine does not preserve polynomiality of algorithms. Is there a way to use counter machines that does?

  • @Norman_Fleming
    @Norman_Fleming Год назад +2

    Interesting concept, buy please, check BEFORE subtracting.

  • @tocsa120ls
    @tocsa120ls Год назад +1

    ...so how many fellows at the Computing Dept are regulars at the local garden store (with all these pebbles around)? ;)

  • @patternwhisperer4048
    @patternwhisperer4048 Год назад +5

    As someone else asked already, isn't a counter machine just a turing machine with a different encoding?

    • @cadekachelmeier7251
      @cadekachelmeier7251 Год назад +6

      Yes. And they're both Lambda Calculus with a different encoding. And the Game of Life with different encoding. And Rule 110 with different encoding.

    • @lovealien43
      @lovealien43 Год назад

      You have no tapes and moving tape heads. Both models can be mapped by enumerations between natural numbers and words of finite length over some alphabet, which you probably mean by encoding.

    • @bandito_801
      @bandito_801 Год назад +2

      isn't everything?

    • @IngieKerr
      @IngieKerr Год назад

      A lot of such research is not to find anything vitally novel or "better", but to find models that might identify those in the wild which we didn't know were already Turing complete, and therefore programmable or hackable.

    • @rmsgrey
      @rmsgrey Год назад

      My personal favourite "machine" of this type is the railway layout using a single train, two types of points, and track capable of connecting them, which is Turing complete.
      The points have a root and two branches. Entering from either branch always leaves by the root. For lazy points, that also sets the point so entering from the root will leave by that branch (in the initial state they will be preset to one or other direction). Sprung points always send the train to the same branch when entered from the root.

  • @marsovac
    @marsovac Год назад +4

    The problem with this machine is that most operations on a computer are counting and comparing operations. Here this is the slowest operation of them all :D

    • @lovealien43
      @lovealien43 Год назад +4

      The point is to have a model as simpel as possible while being defined with mathematical rigour so one is able to apply mathematical reasoning to it.
      Here you have only three operations: addition by 1, (arithmetical) substraction by 1 (you can not go below 0) and test for 0 with two different jumps depending on the result.

    • @l0zerth
      @l0zerth Год назад +1

      ​@@lovealien43so it's a mathematician's language: theoretically bulletproof, beautiful in its simplicity, and absolutely and completely useless in reality.

    • @32gigs96
      @32gigs96 5 месяцев назад

      @@l0zerthit’s not useless it’s for studying the nature of computation itself. Which is very useful.

  • @shubus
    @shubus Год назад +1

    Always glad to see the fan-fold come out of the closed--then I know we'll be getting into something really interesting.

  • @tulliusexmisc2191
    @tulliusexmisc2191 Год назад +2

    3:58 and again 4:20 and 5:12, why does the reset operation start with subtraction, and not check whether the counter is empty first?
    The same question applies to most of the other algorithms presented, too.

    • @andytroo
      @andytroo Год назад

      agreed - in binary if !empty, you know it is a 1 ....

    • @dabalroman
      @dabalroman Год назад

      It's just a representation that you also see on state machines. You do not have a clear comparison step, you just follow the path that's possible. In this case you always check the "if" part, then do the "else", so decrement/increment.

    • @christophermcclellan8730
      @christophermcclellan8730 11 месяцев назад

      All of the state machines he wrote down are while…do loops. The first step was always to check if it was empty.

  • @bvanb2011
    @bvanb2011 Год назад +8

    The thought in my mind while watching this was that this works okay on an 8 bit tape, but the tape of a Turing machine is infinite in extent, so C1 and C3 would have to be able to hold an infinite number of counters in order to completely implement a Turing machine...

    • @hanifarroisimukhlis5989
      @hanifarroisimukhlis5989 Год назад +1

      To have it filled with 1's all the way to the right will took infinite time.

    • @lovealien43
      @lovealien43 Год назад +5

      The equivalent of the potentially infinite tape is indeed a potentially infinite set of counters / registers.
      For a computation to succeed you must finish in finite many steps and this means you can only traverse a finite part of a tape and change or test only a finite many counters / registers.

    • @cadekachelmeier7251
      @cadekachelmeier7251 Год назад +12

      If you're going to simulate an infinite thing, you're going to need another infinite thing, to be fair.

    • @rmsgrey
      @rmsgrey Год назад +5

      @@lovealien43 Actually, with this implementation of a general Turing machine, you only need 4 "bags", three of which require unlimited capacity.

    • @mostm8589
      @mostm8589 Год назад +3

      Yes, the definition of the machine appears to be saying that the counter can count arbitrarily to any integer.
      You can't escape infinity in any Turing Complete model of computation, it has to manifest one way or the other.

  • @KusacUK
    @KusacUK Год назад +2

    Doesn’t this only work if you’re using a finite tape for the TM though? With an infinite tape you wouldn’t be able to reverse the digits to the right of the read head to know how many counters to put in C3…

    • @vyrp
      @vyrp 11 месяцев назад

      The tape starts with all zeros.
      This means that after a finite amount of steps there are finitely many ones, and finitely far away.
      Another way to put it: let's say a Turing machine writes a 1 then goes forever to the left. In the first step to the left, a counter will move from C2 to C3. Then after each subsequent step to the left, C3 will be doubled.

    • @MrDoboz
      @MrDoboz 11 месяцев назад

      the infinite tape is the reason you have to "flip" the right side. you read from left to right, and write it down from right to left. but if you don't get it, just fold the tape over where the read head is and see how it changes the machine. spoiler, it doesn't

  • @davidioanhedges
    @davidioanhedges Год назад +2

    If a counter machine can emulate a Turing machine then it is Turing compatible ... and is universal
    ....this video shows, in depth, it is ...
    The advantage of a counter machine is in at least some cases it is more efficient

    • @richardbloemenkamp8532
      @richardbloemenkamp8532 Год назад +1

      It is pretty easy to make a Turing machine behave like a Counter machine (especially a Counter machine with given finite number of counters). There is a little catch that your counters need to be able to count to infinity on the infinite Turing tape. This can be arranged, for example, by interlacing the bits of the various counters.
      Efficiency play no role in these examples. If you want efficiency you first have to define a measure of efficiency which will greatly vary depending on potential hardware and the type of problems to solve.

    • @davidioanhedges
      @davidioanhedges Год назад

      @@richardbloemenkamp8532 I agree efficiency makes no theoretical difference ...
      and efficiency depends on what you are measuring ...
      Which is why I said that in some cases a counter machine is more efficient than a turning machine... Turning machines are notoriously inefficient, and counter machines are often more so ..
      But both are inefficient for real world problems

    • @MrDoboz
      @MrDoboz 11 месяцев назад

      @@davidioanhedges yeah neither can make me sleep in time. if anything, they keep me awake lol

  • @thomasvnl
    @thomasvnl Год назад +10

    Isn't the counter example just a really elaborate implementation example of the Turing machine itself? In that regards, does this prove anything other than that the Turing Machine is great?

    • @cadekachelmeier7251
      @cadekachelmeier7251 Год назад +5

      Turing machines are just an elaborate form of Lambda Calculus.

    • @lovealien43
      @lovealien43 Год назад +3

      These counter machines (I know them as register machines) implement machine functions from the natural numbers to the natural numbers, while Turing machines map words to words. Because you can map natural numbers to (finite length) words they can be compared and turn out to have the same computation power.

    • @christophermcclellan8730
      @christophermcclellan8730 11 месяцев назад

      Well, no, but it is Turing Complete, which means it is precisely equivalent to a Turing Machine, but as Turing & Church proved that Lambda Calculus is equivalent to a Turing Machine. They’re all capable of computing the same things (i.e. anything computable), but that doesn’t make them the same thing.

  • @arturaugustyniak212
    @arturaugustyniak212 Год назад +1

    If i understood correctly, if number of counters is inf, it’s basically “2d” tape from Turing machine

    • @bnightm
      @bnightm Год назад +3

      Nah. They only need 3 counters for this to work (ignoring the temporary one used for some operations). They represent the entire length of the tape in one direction as a number of beads in one counter (the 1's and 0's on the tape are interpreted as a binary number with as many digits as the tape has squares in that direction) and the entire length of the tape in the other direction is similarly stored as a number of beads in another counter. The "middle" counter is only used to contain the value of the square in the middle of the tape. And then they halve or double the contents of the counters to mimic moving the tape left or right, plus some extra steps to maintain the middle counter.

    • @richardbloemenkamp8532
      @richardbloemenkamp8532 Год назад

      On a Turing tape you can also interlace the bits of the numbers in the multiple bags. This is a bit like a 2D-array being stored in a linear address space by using a stride length. If you grow the number of bags you may need to re-layout your bags but that is doable. So there is no need for a fixed maximum number of bags.

  • @homeopathicfossil-fuels4789
    @homeopathicfossil-fuels4789 7 месяцев назад

    Its much easier to implement the rules of kalah with a counter machine than with a turing machine, it already gets a point for that.

  • @KibbleWhite
    @KibbleWhite Год назад +1

    How many people wanted to mark that last empty counter as "P0" ?

  • @rodrijopo
    @rodrijopo Год назад +2

    This looks very similar to a Petri net

  • @AdamJorgensen
    @AdamJorgensen Год назад +3

    Time to make a bag building boardgame out of this XD

  • @zxuiji
    @zxuiji Год назад +2

    So in simpler terms, a counter machine just uses a series of queues

  • @brine1986
    @brine1986 Год назад +1

    Counter #4 was not used in mapping. Could opposite transformation work? 🤔

  • @zxuiji
    @zxuiji Год назад

    2:10, 1st thought is semaphores, very much looks like them to me

  • @STOpandthink
    @STOpandthink Год назад +1

    ...but what's the advantage of Counter Machines??

    • @IngieKerr
      @IngieKerr Год назад

      XKCD: 2556
      Usually with such computational models, it's about the ability to _recognise_ some arbitrary system S as being Turing complete.
      i.e. if you have a model such as the above, and then you realise some emergent system has the capability of being such a Counter-machine, then that system is likely programmable, then you can extrapolate that this system S might be able to operate as a malware.
      Or you might be able to play Doom on it. :)
      Imagine, say, a situation by which some exploratory user of a device, could by entering an erroring value, increases some counter somewhere - and if that counter overflows then _something_ happens somewhere else. Maybe there's a few of these situations due to some developer oversight of overflow or something.... then by a series of "cunning moves" some user _might_ if the conditions were right, find a counter machine, and then, somehow program this counter machine to perform an operation....
      So I'd say the moral is to look for machines everywhere... and then ponder about who might be able to program them, for bad reasons, or perhaps for good :)

    • @hanifarroisimukhlis5989
      @hanifarroisimukhlis5989 Год назад

      Sometimes it's easier to prove things in counter machine. Same way we have thousands of programming language, each is turing complete yet tacking the same problem differently.

    • @l0zerth
      @l0zerth Год назад

      It's purely a theoretical thought experiment, only useful for analyzing other thought experiments.
      This would be worse than useless in reality.

  • @fvizeus
    @fvizeus Год назад +1

    I used to use those counters to play Magic the Gathering

  • @JamesSjaalman
    @JamesSjaalman 11 месяцев назад

    Mirroring the bit pattern on the right will get nasty if the tape is infinite. (which means: there is no End-of-Tape)

  • @millwrightrick1
    @millwrightrick1 Год назад +2

    To me it seems that a counter machine is a programming language for a Turing machine.

    • @unvergebeneid
      @unvergebeneid Год назад +2

      Or the other way around. That just wasn't shown.

  • @e.a.p
    @e.a.p Год назад +1

    Reminds me of Church numerals.

  • @zlac
    @zlac Год назад

    How do you store the program though? Is there a some kind of list like a list of instructions and a program counter and stuff? How do you loop and jump and stuff?

  • @wybird666
    @wybird666 Год назад +1

    Very interesting. Is there a practical use or computational advantage of this concept? Conventional computers are essentially Turin machines, except each position on the tape is a 64-bit binary number (in the case of a modern PC), so there is almost a 1:1 mapping between the ticker-tape concept and a PC.

    • @MrJoerT
      @MrJoerT Год назад +5

      Please don't use the P word around theoretical computer scientists.

    • @lovealien43
      @lovealien43 Год назад +2

      Turing machines work with words (finite length strings of symbols), counter / register machines work with natural numbers. Your PC memory has addresses (this is equivalent to the number of a counter / register) and contains a finite number (the content of a counter / register is potentially infinite) in each cell. You can work with strings on your PC because there is a map between natural numbers and symbols at work, e.g ASCII encoding.

    • @l0zerth
      @l0zerth Год назад

      As far as I can tell, it's time of the the most useless things in all of computing.

  • @amrhegazy5756
    @amrhegazy5756 Год назад +1

    Is there something similar to Turing completness in counter machines?

    • @antonf.9278
      @antonf.9278 Год назад

      Yes, it's called turing completeness.
      Almost the entire video you just watched was about counter and Turing machines being equally powerful.

    • @amrhegazy5756
      @amrhegazy5756 Год назад

      @@antonf.9278 Thank you!!

  • @hhhsp951
    @hhhsp951 8 месяцев назад +1

    This feels like the middle connection between a regular turing machine and brainf*ck

  • @cogwheel42
    @cogwheel42 Год назад +2

    This is basically Brainf*** but without the explicit pointer movement.

    • @richardbloemenkamp8532
      @richardbloemenkamp8532 Год назад

      Everybody likes brainf*ck. They should teach it in schools. It is also pretty doable to make hardware that can run a bf program stored in memory.

  • @RobinSylveoff
    @RobinSylveoff Год назад +1

    I thought double can be copy, then adding the copies

    • @BenAlternate-zf9nr
      @BenAlternate-zf9nr Год назад

      That would have the same effect, but the implementation in the video only requires one additional register. Using copy requires two.

  • @yshwgth
    @yshwgth Год назад +2

    That's very similar to the Brainfuck programming language.

  • @nerd3d
    @nerd3d Год назад

    This reminds me of a great Zachtronics game: TIS-100

  • @benjfactor
    @benjfactor Год назад +3

    This seems to replicate a finite turning machine. I’m having a hard time imagining how this would look like for an infinite turning tape. It seems like the counter wouldn’t be able to replicate that.

    • @ionarevamp
      @ionarevamp Год назад

      How so? There is no imposed limit on the number of pebbles. There is an imposed limit of counters per program, but for each turing program there is an imposed limit of cards/instructions as well. Theoretically the counter system can scale infinitely

    • @l0zerth
      @l0zerth Год назад

      ​@@ionarevampvery simple, when you move forward, you halve C3. If you don't have a finite value for C3, you can't really halve it.
      In order for the math to make any sense or even be possible, counter machines can only be used on finite "tapes".

    • @ionarevamp
      @ionarevamp Год назад

      @@l0zerth I'm still not sure I really understand... Can you give me an example program which is computable via turing machine but not counters?
      Edit: Also, there is no case where any counter n (Cn) can have an infinite value. Literally impossible. A turing machine can't store or compute infinite values; we can only ever see a snapshot point of a potentially infinite algorithm or function.

    • @l0zerth
      @l0zerth Год назад

      @@ionarevamp in the proper Turing Machine, the tape is, in fact, infinite.
      Also, the values in each counter are, by definition, functionally random. The only way to know how many counter tokens there are in each counter slot is to count them one by one, each slot as you go.

  • @Originalimoc
    @Originalimoc Год назад +1

    So the counter I built in Minecraft is actually turing complete haha

  • @vaibhavsingh1194
    @vaibhavsingh1194 8 месяцев назад

    its a sort of "Jugaad" for turing machine in our local language.

  • @ReifAndreas
    @ReifAndreas 11 месяцев назад

    Core question is: Which one is more simple?

  • @hunterhalloran8474
    @hunterhalloran8474 Год назад +1

    Did I just watch an academic program a BrainFu*k analog with glass pieces?

  • @mickgamehome
    @mickgamehome Год назад +1

    I think he made a Turing Machine emulator using a Counter Machine, and its performance is probably bad.

    • @l0zerth
      @l0zerth Год назад

      That was literally the whole point of the video, and no probably about it, Counter Machines are a purely theoretical thing that would be worse than useless in reality.

  • @k98killer
    @k98killer 11 месяцев назад +1

    4 minutes in, and I'm pretty sure he's describing brainfuck.

  • @Amonimus
    @Amonimus Год назад +2

    I'd think a Counter Machine is just Turing Machine that allows more than 0 and 1.

    • @rautermann
      @rautermann Год назад +1

      Just what I am thinking all the time. Alternatively like using a tape that's not just infinite in length but also in width. TM is still more elegant, using just a single dimension.
      I really don't feel the counting machine is as profound as is portrayed here.

    • @squashedoranges7949
      @squashedoranges7949 Год назад +5

      Turing Machines are not exclusive to 1s and 0s. Turing Machines can have any arbitrary alphabet.

  • @2wr633
    @2wr633 Год назад

    this is basically just assembly

  • @johnsenchak1428
    @johnsenchak1428 Год назад

    This sounds like a instruction set inside a CPU

  • @gizmo_3
    @gizmo_3 Год назад

    It's the world's most simple emulator.

  • @alikhansmt
    @alikhansmt Год назад

    I dont know if its just me but I hate the sound that the marker makes on paper.
    (Love the videos otherwise)

  • @uplink-on-yt
    @uplink-on-yt 11 месяцев назад

    That's just a Turig machine with extra steps.

  • @IanKjos
    @IanKjos Год назад

    Sounds a bit like a SUBLEQ machine.

  • @michaelpoggers2407
    @michaelpoggers2407 Год назад +1

    that's just brainfck lol! just named states instead of [ square bracket loops ]

  • @iugoeswest
    @iugoeswest Год назад

    Thanks

  • @lukasgabriel_
    @lukasgabriel_ Год назад

    Mike Pound's Twin???

  • @ROBOTRIX_eu
    @ROBOTRIX_eu Год назад

  • @damicapra94
    @damicapra94 Год назад

    Why tho?

  • @billr3053
    @billr3053 Год назад

    Churing machine, OK.

  • @l0zerth
    @l0zerth Год назад

    So, this is basically useless in any real application. Cool.

  • @AboveEmAllProduction
    @AboveEmAllProduction Год назад

    I think a calculator is faster

  • @romandobra3151
    @romandobra3151 Год назад

    But whyyyy

  • @Heinz-bx8sd
    @Heinz-bx8sd Год назад

    I didn't understand a single thing, but I also wasn't paying attention

  • @quibster
    @quibster Год назад +5

    Is this crackpot stuff? Is this lad a theorist?
    How can the Counter system be as powerful as a Turing system when this Counter system is not Turing complete?
    This system requires more operations and explicit loops to do the same thing? Surely this system falls off massively in performance compared to a Turing system?
    1 is only computable in the sense that it can be subtracted from and you have to temporarily transition the bit in order to do that? Does this serve any other purpose than, existing as a known way of testing algorithms that is separate from a Turing system?
    Is the counter system useful?

    • @unvergebeneid
      @unvergebeneid Год назад +19

      Nobody uses a Turing machine as a model to build an actual computer. These are all theoretical models of computation. There is really no need for your hostility.

    • @cadekachelmeier7251
      @cadekachelmeier7251 Год назад +9

      Saying that 2 systems are equivalent isn't usually about efficiency. It's just about the problems that they're theoretically able to solve. Mathematicians do it for all sorts of things. It's theory, so it might not have many direct applications.
      One thing I can think of though is just possibly being an easier way to show a system is Turning Complete. Maybe it's easier to show that it's equivalent to this counter machine in some cases. And maybe that could be useful in showing that we can't be sure if it will ever finish.

    • @lovealien43
      @lovealien43 Год назад +5

      Both models of computation are equivalent. The counter machines (register machines) are a nicer fit for recursion theory in my humble opinion.

    • @quibster
      @quibster Год назад +1

      ​@@unvergebeneid While they are theoretical constructs, they are not considered theoretical until proven correct, in the same way that scientific hypotheses are tested and validated through empirical experimentation.
      I don't think it's hostile to ask if someone is a crackpot, people usually admit if they are.
      If the counter machine is useful, it is useful only in explaining the commonalities and foundations of the theory itself.

    • @costa_marco
      @costa_marco Год назад

      @@unvergebeneid Do not feed... :D

  • @sinistar3198
    @sinistar3198 Год назад

    Java developers when they realize what this guy is describing. . .

  • @mrlithium69
    @mrlithium69 Год назад +2

    The first 10 minutes explain how to count, reset, add, subtract, and copy tiddlywinks. we know. you could teach this to 3rd graders. the schematics for simple math is not helping anybody.
    luckily I don't have ADHD or I would fail his class

  • @DukeofEarl1961
    @DukeofEarl1961 Год назад +1

    When was it that society decided that nearly every sentence in English needed to start with a "So"? I wanted to watch this interesting topic, but was getting more and more irritated with the "So"s as time went on....

    • @georgiiivanov6512
      @georgiiivanov6512 Год назад +16

      Have you counted them?

    • @snfn7847
      @snfn7847 Год назад +1

      He ran out of glass beads

    • @IngieKerr
      @IngieKerr Год назад +1

      Society didn't, but scientific theory _which this is_ has long used this style as it's about leading on in a theory of connected ideas.
      So, getting upset with that is like getting upset with too many = signs on a maths blackboard.

    • @rmsgrey
      @rmsgrey Год назад +1

      @@IngieKerr As someone who has to mark maths homework, it is possible to have too many equals signs (some students treat them as though they mean "so" rather than "is equal to")

    • @IngieKerr
      @IngieKerr Год назад

      @@rmsgrey Hehe. No, I get that.
      I wasn't meaning to assert that "So" is identical to "=" in its function, just that it will likely be as common in scientific fields, and that unless it's _incorrectly_ used [as per your example perhaps] - then it's a perfectly correct linguistic token, as the video isn't an English Literature stylistic writing guide :)

  • @nobiggeridiot
    @nobiggeridiot Год назад +1

    enjoyed the vid, but couldn't stop clenching every time Chris' sleeve came close to the marker tip.

  • @infectedrainbow
    @infectedrainbow Год назад +4

    Faux velvet jacket over a t-shirt?!?

  • @tr48092
    @tr48092 Год назад +5

    Are there any advantages to counter machines vs turing machines?

    • @squashedoranges7949
      @squashedoranges7949 Год назад +2

      No, as they are both computationally equivalent. Meaning that any counter machine has a corresponding Turing machine and vice versa.

    • @inanefool8781
      @inanefool8781 Год назад +1

      No, like a Turing machine, these are abstract, theoretical computation machines.

    • @tr48092
      @tr48092 Год назад

      @@squashedoranges7949 if there are no ad advantages for a counting machine, why would you ever use one? A turing machine seems simpler. Secondly, the video only discussed a counting machine which is equivalent to a single symbol turing machine (1 and empty). How would you make a counting machine that is equivalent to a turing machine that has a larger alphabet?

    • @mostm8589
      @mostm8589 Год назад

      I suppose they
      1- Validate the Church-Turing hypotheses, since they are yet another model of computation that appears superficially different yet turns out to be exactly the same as Turing Machines
      2- Presumably make some proofs of Turing-Completness easier, if the thing you're proving is closer to them than Turing Machines
      3- Presumably makes certain algorithms easier to express
      2 and 3 are hypothetical because that's the first time I had heard of the machines, somebody posting examples would be interesting.

    • @Oler-yx7xj
      @Oler-yx7xj Год назад +1

      I guess, you could use them for some proof, where they would be simpler to use. Also it's good to just remember that there isn't anything special about Turing machines