No video

Non-Deterministic Automata - Computerphile

Non deterministic finite state automata described and then shown in Python by Professor Thorsten Altenkirch
Here is the code used in the video www.cs.nott.ac.uk/~psztxa/comp....
And here is my solution to the powerautomaton construction.
http:/wwW.cs.nott.ac.uk/~psztxa/computerphile/nf a-sol.py
#nfa #code #python #Thorsten #automata
/ computerphile
/ computer_phile
This video was filmed and edited by Sean Riley.
Computer Science at the University of Nottingham: bit.ly/nottscomputer
Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

Пікірлер: 115

  • @user-go5ri2yg5f
    @user-go5ri2yg5f Жыл бұрын

    13:48 That keyboard 💀

  • @faanross
    @faanross Жыл бұрын

    please tell me he was rocking birkenstocks + socks under the table.

  • @briancollins1149

    @briancollins1149

    Жыл бұрын

    even better. the continuous form printer paper.

  • @Leaving_Orbit

    @Leaving_Orbit

    Жыл бұрын

    Hahaha

  • @HerrLavett

    @HerrLavett

    Жыл бұрын

    Birkenstocks and socks are great

  • @briancollins1149

    @briancollins1149

    Жыл бұрын

    @@HerrLavett unless yer the sock

  • @dickheadrecs

    @dickheadrecs

    Жыл бұрын

    Thorsten is a real one 👡 🔧

  • @KraylusGames
    @KraylusGames Жыл бұрын

    Professor Thorsten Altenkirch is so good at explaining things and the passion he has for the subject matter really shows! As a side note: please add the name of the presenter to future videos (or at least put more than just a hashtag with their first name in the description). Cheers!

  • @Computerphile

    @Computerphile

    Жыл бұрын

    Fair point, a genuine mistake not to put his name in the description -Sean

  • @KraylusGames

    @KraylusGames

    Жыл бұрын

    @@Computerphile No worries, thanks!

  • @jackwest540
    @jackwest540 Жыл бұрын

    Most underrated topic in CS, loved the video!

  • @SimGunther
    @SimGunther Жыл бұрын

    There's some algorithms that can translate NFAs into DFAs, but using Arden's Theorem allows you to translate the NFA into a regex which supposedly is "more maintainable" depending on the NFA in question. That regex in question can be represented as a table driven DFA for max speed at the cost of auxiliary space which can be minimized with Hopcroft's algorithm. Of course, you could just create a DSL for NFAs and have a code generator which creates the DFA for you ;)

  • @tpog1

    @tpog1

    Жыл бұрын

    "That's BTO. They were Canada's answer to ELP. Their biggest hit was TCB. That was how we talked in the seventies. We didn't have a moment to spare." - Homer Simpson.

  • @Ceelvain

    @Ceelvain

    Жыл бұрын

    This equivalence between NFA and regex also shows that for every FSA there's an equivalent planar NFA. No matter how convoluted the original automaton is. Although, I doubt there's much use for this property. 😅

  • @avramcs

    @avramcs

    Жыл бұрын

    @@Ceelvain well that’s kind of obvious and trivial. Since DFAs and NFAs are equal in power and with DFAs working to provide a system for a regular language, it’s pretty obvious to see that any FSA can be translated to a DFA or NFA, since they literally couldn’t be anything else

  • @Ceelvain

    @Ceelvain

    Жыл бұрын

    @@avramcs the keyword was *planar*. As in planar graph.

  • @dickheadrecs
    @dickheadrecs Жыл бұрын

    this channel is so awesome. still going strong 💪 please never stop. it’s so nice having this little tidbits delivered to you in such a friendly conversational way

  • @janPeja
    @janPeja Жыл бұрын

    "I think I can hire you as some automaton..." 🤣 not sure if compliment or roast

  • @esra_erimez

    @esra_erimez

    Жыл бұрын

    How does this comment not have more likes???

  • @sewoh100
    @sewoh100 Жыл бұрын

    Im just now realizing "Computerphile" is a pun

  • @MrRyanroberson1

    @MrRyanroberson1

    Жыл бұрын

    especially with that diagram at 6:41

  • @LassWasLernen
    @LassWasLernen Жыл бұрын

    NFA‘s and DFA‘s can‘t be explained smoother than that. Mr. Altenkirch rocks! Grüße aus Deutschland :-)

  • @andrewjknott
    @andrewjknott Жыл бұрын

    To increase clarity of communication, do not reuse symbols. Instead of using numbers for both tokens of the language {0,1} and labels for the NFA&DFA states {0,1,2}, use letters {a,b,c} for one and numbers for the other.

  • @wChris_
    @wChris_ Жыл бұрын

    Great explanation of a topic i had to learn for (Theoretical) Computer Science!

  • @ivanskyttejrgensen7464
    @ivanskyttejrgensen7464 Жыл бұрын

    Nice explanation. I knew DFA, but hadn't considered NFA. It' a shame that FSAs are usually only taught in combination with pattern matching or network protocols. I've found them useful in a few other scenarios.

  • @user-yv1qs7sy9d
    @user-yv1qs7sy9d Жыл бұрын

    Also, this kind of NFAs is equivalent to the NFAs that can the transition relation is defined for the empty string, ε, which is also a very interesting case.

  • @DavidLindes
    @DavidLindes7 ай бұрын

    I don't know what it is -- if it's something about Thorsten's approach, or just timing with where my energy levels are, or what, but this video and the last one are I think the first Computerphile videos where I've actually gone through and written code (copying what's on the screen, but then writing some of my own... (though I admit I didn't finish minimize for DFAs. But I might get back to it?? Anyway, I did the DFA-from-NFA code, and I _believe_ it's correct! Fun!

  • @JNCressey
    @JNCressey Жыл бұрын

    8:07 The example walking through "111" only read two iterations Start: coin on 0 First "1": the coin on 0 goes to 0 and 1. Second "1": the coin on 0 goes to 0 and 1, and the coin on 1 goes to 2. Then you stopped before reading the third "1" of the input.

  • @ThorstenAltenkirch

    @ThorstenAltenkirch

    Жыл бұрын

    Oops, sorry.

  • @TheWombatGuru

    @TheWombatGuru

    Жыл бұрын

    @@ThorstenAltenkirch But it would still have worked right, in the next iteration the final coin would have vanished and the coin in position 1 would go to the final position!

  • @computersciencebyd-m-3323
    @computersciencebyd-m-3323 Жыл бұрын

    Automata theory may seem simple at first, but its power is phenomenal! The deeper you dive, the more mind-blowing it becomes. Get ready for a thrilling journey into the world of computation!

  • @garysturgess6757
    @garysturgess6757 Жыл бұрын

    I remember ages ago doing a unit on CourseRA (when it was all still free) that went over DFAs, NFAs, all the way up to Turing Machines. One of the most fun courses I ever did - this is great stuff.

  • @bmitch3020
    @bmitch3020 Жыл бұрын

    I was so confused until I looked up the definition of penultimate ("next to last" for anyone else that's confused).

  • @peterittzes

    @peterittzes

    Жыл бұрын

    Yep, "penultimate" means second-to-last, and for maximum pretentiousness you can also use "antepenultimate" for the one before that.

  • @redjr242

    @redjr242

    Жыл бұрын

    ​@@peterittzes Lol. I only heard these words used in the context of stressed syllables, e.g.: a stress and the ante-penult. Don't think I've heard it in other contexts though

  • @circuitgamer7759
    @circuitgamer7759 Жыл бұрын

    One of my first thoughts with this: If states were defined by locations in memory rather than tracking a number for the state or something like that, would DFAs be more processor efficient but less memory efficient, and NFAs be more memory efficient but less processor efficient (I'm mainly just checking if there are edge cases that I missed through an analogy)? DFAs would only have to check a few paths from any given state, but NFAs would have to check every path from every active state. At the same time, DFAs would have more individual states than NFAs. (to remove a bit of ambiguity with the way I phrased that, I'm specifically wondering if there's cases where those aspects are both reversed. There's definitely cases where they are the same, or maybe when one aspect is reversed, but I'm wondering about cases where both are reversed.)

  • @yeoldestuff

    @yeoldestuff

    Жыл бұрын

    That's precisely the case, if an NFA has n states, then the equivalent DFA would have 2^n states which means that the memory requirements of the DFA are exponentially higher

  • @MrRyanroberson1
    @MrRyanroberson1 Жыл бұрын

    13:38 i might suggest a more intelligent upper bound which is 2^(states - entry states) number of states since all entry states are always present in the NFA, which we see here because your 4 are the most possible states that you could reach from a 3-state with one entry point.

  • @mattwilkinson7079
    @mattwilkinson7079 Жыл бұрын

    Why did this have to come out AFTER my exam on formal language theory 😂

  • @griffinschreiber6867
    @griffinschreiber68675 ай бұрын

    This reminds me of when I tried to make a program to save/load data to/from a human-readable file. I realized that I was in essence just building a compiler for the file encoding format I had created -- even though it wasn't Turing complete.

  • @welcometothemadhouse
    @welcometothemadhouse Жыл бұрын

    I was interested in Automata theory and how machine learning was developed in part from automata theory. It is brilliant to see how such as abstract thing is (usually) so fundamental to our world now!

  • @xybersurfer
    @xybersurfer Жыл бұрын

    nice explanation

  • @wingedtoast7495
    @wingedtoast749511 ай бұрын

    if someone could explain to me why it's okay for a state to just disappear that'd be cool (unless it's just like implied it collapses back to state 0 for example idk my brain wants to rearrange it into a different thing)

  • @Paul-sk7px
    @Paul-sk7px Жыл бұрын

    Can I be the first to point out Prof Altenkirch's striking resemblance to the Trainman in Matrix Revolutions? I mean he could actually be him for all I know. It genuinely wouldn't surprise me.

  • @ramses_mars

    @ramses_mars

    Жыл бұрын

    Haha. That role was played by New Zealand actor Bruce Spence.

  • @aman-qr7wh

    @aman-qr7wh

    8 ай бұрын

    I WAS just thinking that.

  • @MrMcsoftware
    @MrMcsoftware Жыл бұрын

    Would you or a viewer please explain how you would use the DFA NFA converter (in terms of python programming)? I tried: N2=D0.NFA which didn't complain, but when I tried to use N2, it complains there's no run procedure. Python isn't my main language. It may be obvious to someone who programs python all the time 😀

  • @MrMcsoftware

    @MrMcsoftware

    Жыл бұрын

    I think I figured it out myself: N2=DFA.NFA(D0) and it needs to be after both classes. Is that right? It seems to work.

  • @ThorstenAltenkirch

    @ThorstenAltenkirch

    Жыл бұрын

    @@MrMcsoftware It should be enough to say N2=NFA(D0).

  • @MrMcsoftware

    @MrMcsoftware

    Жыл бұрын

    @@ThorstenAltenkirch If I leave off the "DFA." part, it complains about 4 missing parameters (it thinks NFA is referring to the class and not the method in DFA). Maybe you have a newer version of python that can figure that out.

  • @ThorstenAltenkirch

    @ThorstenAltenkirch

    Жыл бұрын

    @@MrMcsoftware Sorry, I got mixed up. I meant D0.NFA()

  • @MrMcsoftware

    @MrMcsoftware

    Жыл бұрын

    @@ThorstenAltenkirch That works. Thanks!

  • @mrlithium69
    @mrlithium69 Жыл бұрын

    he makes his number 1's look like upside down V's

  • @cryptotharg7400
    @cryptotharg7400 Жыл бұрын

    How can a computing system be non-deterministic, without taking in some random variables from the environment?

  • @mrlithium69

    @mrlithium69

    Жыл бұрын

    "magic" he said it 3 times

  • @SplendidKunoichi

    @SplendidKunoichi

    Жыл бұрын

    not doing what its supposed to do, no one actually knowing what its supposed to do, not halting, the usual the idea if you like is that it gets multiple tries to agree with a deterministic result then whats non-deterministic is how many it actually took

  • @DeathlyTired
    @DeathlyTired Жыл бұрын

    At first, I read the titIe as, "Non-Deterministic Stigmata". 'That's a departure for this channel', I thought

  • @AcornElectron
    @AcornElectron Жыл бұрын

    Rick Wakeman has really shifted paradigm.

  • @TomiTapio
    @TomiTapio Жыл бұрын

    Non deterministic video game AI? Character states like idle wandering, scared, fleeing, attack, defend, move towards allies. Input for state change is multivariable, and add a random dice roll chance for state change...

  • @unchaynd7266
    @unchaynd7266 Жыл бұрын

    Can't NFAs have null transitions too?

  • @habibie
    @habibie Жыл бұрын

    Old printer paper had me triggered 😳😎.

  • @Anomyos
    @Anomyos Жыл бұрын

    After I have seen some in-game working computers made in Minecraft it raised a few questions: What is the most effective virtual processor currently and if the virtual processor ever reaches over 100% efficiency over its physical counterparts on which it is running would not there be potentially a processor with infinite processing power? What would be the challenges in that system? I tried to google the answer, but I think either my current terminology on the subject is not advanced enough or there have not been any attempts even to try it because it seems so obliviously not possible for capable people. I wish I could least some lead to find an answer.

  • @kennythegamer1

    @kennythegamer1

    Жыл бұрын

    hmm, I'll ask anyway. What do you mean by "the virtual processor ever reaches over 100% efficiency over its physical counterparts on which it is running"?

  • @TorvicIsSanta

    @TorvicIsSanta

    10 ай бұрын

    @@kennythegamer1 I think they might mean if you simulated/emulated more processors than the hardware that the simulation is running on? Of course, if that is what they mean then the answer is that the simulation is dividing the additional workload between multiple clock cycled on a single thread

  • @superhussein
    @superhussein Жыл бұрын

    how can i become a non determisnistic automaton?

  • @EdwardTheLegend
    @EdwardTheLegend Жыл бұрын

    Ah yes love a good old exercise for the reader. 👍

  • @user-fp3eb8cc9u
    @user-fp3eb8cc9u3 ай бұрын

    Thanks, can you give me an example in c langage please!!

  • @mushengu
    @mushengu Жыл бұрын

    Return that to the file it was it opens a new symbol binary..

  • @ommadawnDK
    @ommadawnDK Жыл бұрын

    👍🏻👍🏻👍🏻 Could this have been done where the inputs and the states didn't use the same symbols?

  • @HomeofLawboy
    @HomeofLawboy Жыл бұрын

    At 8:27 it shouldn't have finished because the input wasn't fully consumed

  • @MatejDujava

    @MatejDujava

    Жыл бұрын

    There should be one more read, but the state "coins" would end up in same positions, (coin on 2 will disappear, coin move from 1 to 2, from 0 to 1, and "duplicate" on 0) this transition is shown at 11:55

  • @HomeofLawboy

    @HomeofLawboy

    Жыл бұрын

    @@MatejDujava yes

  • @dominiquefortin5345
    @dominiquefortin5345 Жыл бұрын

    I had never thought of using a breath first search to do NFAs.

  • @hri7566
    @hri7566 Жыл бұрын

    i can't help but point out the suggestive thumbnail

  • @cryptotharg7400
    @cryptotharg7400 Жыл бұрын

    This guy is probably going to take over the world, at some point.

  • @mrlithium69

    @mrlithium69

    Жыл бұрын

    I thought "im glad this is what he's doing instead of being evil"

  • @InShadowsLinger
    @InShadowsLinger Жыл бұрын

    I got the graph and everything up to the code where he lost me.

  • @prose_mozaic
    @prose_mozaic Жыл бұрын

    Would it at all be possible for me to intern under you? I truly would love to learn as much as I can on these subjects!!

  • @cakewolf44

    @cakewolf44

    Жыл бұрын

    no

  • @arandomperson8336
    @arandomperson8336 Жыл бұрын

    I think regular expressions is where I realized I wasn't cut out to be a programmer

  • @leroyladyzhensky210
    @leroyladyzhensky210 Жыл бұрын

    I think I pooped my pants around minute 12 or so

  • @siddharthsingh7281
    @siddharthsingh7281 Жыл бұрын

    What's penultimate

  • @peterittzes

    @peterittzes

    Жыл бұрын

    second-to-last

  • @EdwardTheLegend
    @EdwardTheLegend Жыл бұрын

    awesome🎉

  • @canelonism
    @canelonism Жыл бұрын

    love thorsten but his python formatting is making me anxious

  • @moistness482
    @moistness482 Жыл бұрын

    Why did he have to do that specific automaton 🥵

  • @canelonism

    @canelonism

    Жыл бұрын

    wdym?

  • @MrRyanroberson1

    @MrRyanroberson1

    Жыл бұрын

    yes i saw it too immediately, it's so spicy

  • @SRWeaverPoetry
    @SRWeaverPoetry Жыл бұрын

    Im a bit Rusty on computerphile.

  • @Brunoenribeiro
    @Brunoenribeiro Жыл бұрын

    I need to admit: this didn't make any sense to me on the first try 😅 I rewatched until it clicked. Strong monad vibes to me in this one!

  • @normanpinto
    @normanpinto Жыл бұрын

    Why is there a keyboard on his desk?

  • @user-yv1qs7sy9d

    @user-yv1qs7sy9d

    Жыл бұрын

    So he can type, of course! (Yes, I saw both types of keyboards)

  • @c1ph3rpunk

    @c1ph3rpunk

    Жыл бұрын

    I have a feeling he’s DJ’ing at an EDM club in Berlin over the weekend.

  • @jeffreyokun2355

    @jeffreyokun2355

    Жыл бұрын

    Good question, I would have assumed this guy simply draws the commands on a printer paper and feeds them into the computer...

  • @ScorpioneOrzion
    @ScorpioneOrzion Жыл бұрын

    and those sets of states can be just 2^n states, each representing a set of states.

  • @krox477
    @krox477 Жыл бұрын

    All DFAs are NFAs but not all NFAs are DFAs

  • @NickCarterPoops
    @NickCarterPoops Жыл бұрын

    OMG! Will this 132 column paper writing ever stop in this chnnel. The man had a laptop next to him! use the output! This is so backwards!!

  • @Haaknes
    @Haaknes Жыл бұрын

    Perhaps someone should wash their keyboard🙈

  • @kgm1000uk
    @kgm1000uk Жыл бұрын

    Its doable? Its feasible 😂

  • @sam-sn5pu
    @sam-sn5pu Жыл бұрын

    please invest in a tripod

  • @nobackupkiwi
    @nobackupkiwi Жыл бұрын

    Everything in the universe is deterministic.

  • @1ucasvb

    @1ucasvb

    Жыл бұрын

    "... probably"

  • @nobackupkiwi

    @nobackupkiwi

    Жыл бұрын

    @@1ucasvb it is

  • @1ucasvb

    @1ucasvb

    Жыл бұрын

    @@nobackupkiwi How do you know?

  • @nobackupkiwi

    @nobackupkiwi

    Жыл бұрын

    @@1ucasvb I know it, I'm just better.

  • @avi12
    @avi12 Жыл бұрын

    Am I the only one who only understands 20% of what he says?

  • @jeffreyokun2355

    @jeffreyokun2355

    Жыл бұрын

    Perhaps, because I could only understand 0.1%

  • @ivanskyttejrgensen7464

    @ivanskyttejrgensen7464

    Жыл бұрын

    Probably

  • @xybersurfer

    @xybersurfer

    Жыл бұрын

    i didn't care that much for the python code, but what wasn't clear?

  • @dipi71
    @dipi71 Жыл бұрын

    15:45 Please don't use italic together with coding fonts -- or use a proper code editor that can actually render italic text without clipping outside the glyphs' bounding boxes. It physically causes me pain to look at all those »self.« references. On the other hand, it's just some anemic Python code, and you're not even using dark mode. Oh well.

  • @Armando51roosters
    @Armando51roosters Жыл бұрын

    lambda