Automata & Python - Computerphile

Поділитися
Вставка
  • Опубліковано 6 вер 2024

КОМЕНТАРІ • 153

  • @chaitanyabisht
    @chaitanyabisht Рік тому +24

    Theory of Computation was one of the most challenging but also the most fascinating courses I have ever done. It's like a theory on how computer "computes" and what computers can and cannot do.

  • @kyoujinko
    @kyoujinko Рік тому +89

    Yay a Professor Altenkirch video, by far my favourite.

  • @mehazc
    @mehazc Рік тому +42

    Studying formal language theory right now in undergrad to prepare for compiler theory. It's a fun subject

    • @jaydeep-p
      @jaydeep-p Рік тому +4

      It's not very fun considering that you have to learn something that you will probably never need to use in real life applications.

    • @jaroslavstava3704
      @jaroslavstava3704 Рік тому +10

      ​@@jaydeep-p RE's are used everywhere

    • @AshishJacobSamMCS
      @AshishJacobSamMCS Рік тому

      Fun is one way to put it

    • @cidercreekranch
      @cidercreekranch Рік тому +8

      @@jaydeep-p My Compilers and Assemblers class, along with Data Structures, were what I used the most in a 30 year career in IT. What I used the least, as in never, were Calculus, Differential Equations, Linear Algebra, and Complexity Theory.

    • @thebarnold7234
      @thebarnold7234 Рік тому +3

      @@jaydeep-p Depends what field you go into. If you want to write text parsers, theorise and plan regular expressions or even create programming languages/compilers then all of this is very useful

  • @refactorear
    @refactorear Рік тому +93

    The first time our computing professor showed this in C literally heaven's door opened for me lol It was magical and it has helped me so many times through the years, writing regular expression parsers at work, simplifying state machines, even in the Advent of Code competence I've solved several problems by building a state machine (like one for a "sokoban"-similar situation).
    8:13 Python indentation 🤦‍♂

    • @100c0c
      @100c0c Рік тому

      What specific type of programming do you do?

    • @refactorear
      @refactorear Рік тому +4

      @@100c0c Healthcare software, EMR. Back when I started in early 2000 I had to write regular expression parsers to parse different document formats by different companies to import data from other EMR, billing software, healthcare hardware, etc. With time everything standardized into HL7 version 2.x and now C-CDA so parsers are no longer necessary.

  •  Рік тому +29

    as a fellow German, I always kind of hoped, if I'd tried just hard enough maybe some day it wouldn't be so obvious, where I am from... guess I can take that off my list of things ever to achieve.

    • @dayvie9517
      @dayvie9517 Рік тому +5

      We will always be known as "ze Germans" from this point on 🤣

  • @damianshaw8456
    @damianshaw8456 Рік тому +20

    Python can use any Unicode symbols of a written language for variable names, that is to say in general symbols which represent "letters" (for some expanded definition of the term "letters"). Therefore if you use the actual Greek letters in Python, and not some mathematical specific versions of them, it is valid Python, e.g.:
    class Foo:
    def __init__(self, Δ):
    self.Δ = Δ

    • @pyMarek
      @pyMarek Рік тому +3

      A better solution is to use words rather than symbols. delta -- transitons, Sigma -- symbols, Q -- states, q0 -- start_state, F -- final_states

    • @MFM88832
      @MFM88832 Рік тому

      Wow had no idea, thanks!

  • @phizc
    @phizc Рік тому +4

    "b", "bbbb", etc. would also return true.
    I.e. it doesn't satisfy L={words where as come before bs}.
    It's more like L={words where 'a's don't come after 'b's}

    • @robertkelleher1850
      @robertkelleher1850 Рік тому

      Logically the same thing. The contrapositive is always true. Your restatement is logically equivalent. Saying "words where as come before bs" does not entail the presence or absence of as, just that if there are as they come before bs.

    • @phizc
      @phizc Рік тому

      @@robertkelleher1850 fine.. natural language is poor for logical statements. Main point was that there were no test cases for "b"s only.

  • @connorhillen
    @connorhillen Рік тому +25

    Learning Automata next? Love seeing some computational theory. Makes me want to dust off my undergrad books. I guess if I wanted an automata review I could knock on my office neighbors door since he worked with Thathachar in the 80's, but there's just something about that Computerphile charm that's kept me hooked from undergrad to faculty :) (well, maybe just Numberphile at the start)

  • @ElksuGuitar
    @ElksuGuitar Рік тому +174

    Wow I never knew the train driver from Matrix was real

    • @HR-in8yt
      @HR-in8yt Рік тому +12

      i looked after this comment xD

    • @NewtonMD
      @NewtonMD Рік тому +3

      You'll soon start to believe

    • @anubisai
      @anubisai Рік тому

      He's 100x smarter than your judgmental short sighted narcissistic comment posting pathetic self. 😂

    • @ashwinnair
      @ashwinnair Рік тому

      💀

    • @vertextechno6521
      @vertextechno6521 Рік тому +2

      Exactly i was thinking the same !! , he escaped the matrix apparently

  • @valovanonym
    @valovanonym Рік тому +21

    Currently working on a query language using NFAs. Funny to see this video pop up! Really enjoyable

    • @patrickoconnor-read2323
      @patrickoconnor-read2323 2 місяці тому

      Google is always listening, yr search and browsing history likely inform them of your info needs.

  • @luicecifer
    @luicecifer Місяць тому +1

    5:02 "So I've lost." And then looking at Shawn, as if he sees the mushroom cloud xD

  • @sabinbaral4132
    @sabinbaral4132 Рік тому +15

    Dammn we missed this man

    • @thebarnold7234
      @thebarnold7234 Рік тому +2

      Study computer science at the university of Nottingham! You'll see him a LOT during your second year

  • @bentationfunkiloglio
    @bentationfunkiloglio Рік тому +7

    I love finite state automata! Excellent video. Prof Altenkirch is brilliant and perfectly fits comp sci professor archetype.

    • @NewtonMD
      @NewtonMD Рік тому +1

      Perfectly?

    • @bentationfunkiloglio
      @bentationfunkiloglio Рік тому

      @@NewtonMD The archetype, a highly intelligent person with diverse interests and an individualistic, unconventional sense of self.

  • @thebarnold7234
    @thebarnold7234 Рік тому +7

    One of his students being taught the module hes literally describing. Very good content if you want to learn how compilers and programming languages work

  • @Redentor92
    @Redentor92 Рік тому +6

    Finally a computerphile video I can get my hands in!!
    Your implementation is nice from a pedagogical perspective. No complaints.
    But I would like to give a more mathematical perspective.
    Without initial and final states, automata are the same as "transformation semigroups" that are a generalisation,so to say,of permutation groups. So the only thing you need to encode are the letters as functions from Q to Q, the set of states.
    If you give to each state a natural number (beginning with 0) a function can be encoded in a list F, where F(i) is just the element in the position i of the list. A little word can allow you to compose functions F and G. And voilà! An automaton is just a list of same length lists.
    Do you want to recognise languages? No problem. Specify the index of q0 and the set of final states and after applying the word (composing the functions) you check if position q0 is in the final states set.
    Easy and fast. Sorry for
    1. The long answer just talking about something tangential to the video.
    2. If you knew this.
    3. If I didn't explain myself well enough.
    I hope to all computer scientists who are interested in automata and don't know about semigroups that they find a lot of answers on that wild untamed territory.

    • @miguelcoias6157
      @miguelcoias6157 Рік тому +1

      > So the only thing you need to encode are the letters as functions from Q to Q, the set of states.
      I'm fairly sure this is true and well known for deterministic Turing machines, and so for DFAs as well

    • @TzaraDuchamp
      @TzaraDuchamp Рік тому

      Can you update his code to do this? That could proof interesting.

  • @sandratoolan9598
    @sandratoolan9598 Рік тому +1

    nice intro to tokens at the beginning. I'll use that, thanks

  • @dHue_52
    @dHue_52 Рік тому +4

    How do these videos always get timed so we'll? I'm literally working on a class project doing exactly this. With the addition of providing a GUI representation for the FA.

  • @Veptis
    @Veptis 7 місяців тому

    I remember doing my Automatentheorie class online and it was somewhat troublesome. But across a few other classes, I got most fundamentals of formal languages.
    It does help to have seen most of this, now where I actually get to use lexers and tree parsers etc.
    I was close to writing a term paper on subsets of DFAs (or even PDA) for example those you can minimize, those with exactly one state, those in some normal form etc.
    But bailed on that eventually.

  • @bilbo_skywalker
    @bilbo_skywalker Рік тому +11

    is this Trainman from the matrix?

  • @robertbrummayer4908
    @robertbrummayer4908 Рік тому +17

    Instead of the while loop in the run function, it would be better to just loop over each symbol with a simple for loop. Then, w = w[1:] would not be needed anymore (does an unnecessary copy).

    • @haibrenner
      @haibrenner Рік тому +4

      True. Trimming the beginning of w at each iteration is just confusing. And besides occupying more space for the word copy, it also runs in quadratic time instead of linear time..!!
      Really strange choice of implementation....

    • @iabervon
      @iabervon Рік тому +8

      ​@@haibrenner IIRC, Python string slices share memory (which you can't tell because strings are immutable), so it's really just iterating starting locations through the string without copying anything. Still, it's harder to follow than "for s in w", which makes it obvious that the algorithm never looks ahead or back or jumps over anything.

    • @emuccino
      @emuccino Рік тому

      @@haibrenner I'm guessing he just didn't realize that strings are iterable like lists. It's a fairly unusual functionality for a programming language, no?

    • @haibrenner
      @haibrenner Рік тому +3

      @@emuccino
      String iteration is more abundant in programming languages than string slicing....
      Not so rare functionality

    • @dayvie9517
      @dayvie9517 Рік тому +2

      Probably doesn't matter due to compiler/interpreter optimizations. There's no better if you didn't profile it. Seems like a premature optimization. Also there is probably no copy, just a reference which may already exist. So not even the reference itself may be stored.

  • @fslurrehman
    @fslurrehman Рік тому +5

    But what's use of automata, especially in engineering problems?

    • @brunomucino4181
      @brunomucino4181 Рік тому +1

      For a nice example, search for the blogpost "Index 1,600,000,000 Keys with Automata and Rust"

    • @andrewkepert923
      @andrewkepert923 Рік тому +1

      In software engineering and computer science, anything that parses input is a finite state automaton. Most importantly, a compiler is a finite state machine for parsing code, turning it into machine code or byte-code. Or even a scientific calculator.
      In other types of engineering, the finite element models that are used to model aerodynamics and hydrodynamics (for anything that moves), static forces (for anything that doesn’t) or project management (for a surprising amount of the work engineers do) relies on software that was compiled, and often includes their own scripting languages that must be parsed.

  • @epotnwarlock
    @epotnwarlock Рік тому +4

    if q == 2, it's not in self.F, does that output False?

    • @martinmiglio
      @martinmiglio Рік тому +3

      2 is not a final state, it will return false

  • @k283
    @k283 Рік тому

    That's one really strange way to iterate over the string 😕Why constantly truncate the string and get its 0'th element? Much better and cleaner is:
    ....for letter in w:
    ........q = self.delta[(q, letter)]

  • @froozynoobfan
    @froozynoobfan Рік тому +4

    Type hinting would be nice e.g.
    def my_function(my_string:str) -> str:
    return my_string

  • @QuantumHistorian
    @QuantumHistorian Рік тому +10

    Wasn't expecting it to cut there. It's like we spent this time defining something, and then didn't do anything with it...

  • @jeremydavie4484
    @jeremydavie4484 Рік тому

    I learned about this in my last week of discrete structures of math class for computer science. I wish I had seen this video earlier

  • @SgtSupaman
    @SgtSupaman Рік тому +1

    I enjoyed learning this method much more with a mathematical approach instead of arbitrary languages. The easy one being whether or not a binary number was even. The initial state of 0 was the final state. The input sent to the matching state (so a 0 would send it to state 0, no matter which state it was in, and 1 sent it to state 1, no matter which state it was in).

    • @desktopevil
      @desktopevil Рік тому +1

      Completely agree, the logic is much more apparent

  • @nateshrager512
    @nateshrager512 Рік тому

    I like the implementation as a dictionary, makes it very easy to generate new state machines

  • @Dbeezt
    @Dbeezt Рік тому +7

    What’re the practical usages of a DFA beyond compiling - are there any?

    • @BillySkceuk
      @BillySkceuk Рік тому +10

      Implementing a regex engine

    • @JeffBilkins
      @JeffBilkins Рік тому +13

      State machines for all kinds of purposes, like parsers or describing processes and behaviours.

    • @mxie360
      @mxie360 Рік тому +12

      DFA, is an abstract way of solving a problem without using a full turing machine.
      For example, instead of needing a computer to run the logic of your toaster, you can design a toaster's logic that is similar to a DFA.
      Basically reducing the complexity.

    • @TimoNoko
      @TimoNoko Рік тому +2

      In olden golden times state machines was the only way to build large software systems safely. A "process" needs lots of memory and power and has many weird issues. They went to the moon on a state machine.

    • @davidwuhrer6704
      @davidwuhrer6704 Рік тому

      Regular expressions are equivalent to DFAa. Every time you write an RE, you are really building a DFA.
      Network protocols are DFAs.
      Traffic lights are DFAs. ATMs are DFAs.
      A lot of software applications can be defined as finite sets of states, meaning it would be easy to implement them as simple languages, but because that doesn't pull in thousands of NPM packages from GitHub, it is rarely done.

  • @andreysh9340
    @andreysh9340 Рік тому +6

    I think it's much clearer with these variable names. And there's a little less code with the dataclass:
    @dataclass
    class DFA:
    set_of_states: set
    set_of_symbols: set
    transition_map: dict
    initial_state: int
    set_of_final_states: set
    def run(self, symbols):
    current_state = self.initial_state
    while symbols != "":
    current_state = self.transition_map[
    (current_state, symbols[0])
    ]
    symbols = symbols[1:]
    return current_state in self.set_of_final_states

  • @kalamayilai6499
    @kalamayilai6499 11 місяців тому

    very much interested sir. superb explanation

  • @Aangeluz
    @Aangeluz 7 місяців тому

    I'm taking this class right now and I have my first test in two weeks. I'm scaring of failing. My professor is a very though grader. Any tips on how to prepare as best as I can?

  • @unclerojelio6320
    @unclerojelio6320 Рік тому +3

    I clicked on this video so hard I think I broke my mouse.

  • @kipsangjacob270
    @kipsangjacob270 Рік тому +2

    🎉 reminds me of my CS course unit over 8 years ago😊

  • @mmuuuuhh
    @mmuuuuhh Рік тому

    Why not defining the final state, as „own state“ in the graph? I.e., arrow to state 3; end.
    Also why not stop immediately when reaching state 2, the invalid state?

    • @NotAUtubeCeleb
      @NotAUtubeCeleb 9 місяців тому

      There is no seperate end state because states 0 and 1 could be ends or transitions. So moving in and out of a state3 would complicate the rules. In this specific case, you could just end when state 2 is reached but I suspect it's there to simplify the evaluation code.

  • @ashlandwithouttheshd
    @ashlandwithouttheshd Рік тому +2

    A word is a set of characters … if you’re dyslexic

  • @ab-mi9vf
    @ab-mi9vf Рік тому +1

    is this an automaton in the sense that it's a set of rules that determine the "evolution" of whether a word is or is not valid? i'm only used to seeing cellular automata like conway's game of life

    • @mehazc
      @mehazc Рік тому +1

      It determines acceptance of a subset of all the possible words that can be made up by a set of symbols (a language) and in this case proves that that language is "regular", which is one of the language classes in the Chomsky hierarchy, which you can look up a picture of.
      So this class of automata not only determines the "evolution" of validity for a given word but also provides a process to construct the set of all accepted words.

    • @mehazc
      @mehazc Рік тому +1

      Also note it is a one-to-many relationship so multiple automata can correspond to the same regular language, which you can visualize by just adding random empty states that have no functionality to your automata.

  • @deepjoshi356
    @deepjoshi356 Рік тому +2

    Write a code that accept all such video which contains implementation of automaton in python.

  • @rap-id-ralph
    @rap-id-ralph Рік тому +1

    Errrr what about ‘bbbb’?

    • @rap-id-ralph
      @rap-id-ralph Рік тому +1

      Not first to notice. Pass ;) lovely vid though. Makes me sad to not have finished university informatics.

  • @sujalgvs987
    @sujalgvs987 Рік тому

    3 weeks into my automata theory course and i understand nothing. This video was elixir for me.

  • @patton72010
    @patton72010 Рік тому +6

    Professor Thorsten Altenkirch looks like if Dave Grohl and Taylor Hawkins were 1 person and playing in a band called Foo(x) Pythons.

  • @nutsnproud6932
    @nutsnproud6932 Рік тому

    When I saw Automata I thought of the games for the Sinclair computers - including PIMania.

  • @CarstenGermer
    @CarstenGermer Рік тому

    Question, if the rule is "words where As come before Bs", how can epsilon (empty word) be ok? There's neither an A nor any B so it doesn't satisfy the rule. Not?

    • @benweieneth1103
      @benweieneth1103 Рік тому +4

      The true rule is "no 'a' after 'b'" (or alternatively "word doesn't contain 'ba'") The English description given in the video is indeed misleading.

    • @CarstenGermer
      @CarstenGermer Рік тому +1

      @@benweieneth1103 Thx for clearing that up ^-^

  • @user-dh3cc9sw3c
    @user-dh3cc9sw3c Рік тому +2

    На 8ой минуте на экране представлен перебор символов строки в цикле, почему он так реализован?

  • @SojournerDidimus
    @SojournerDidimus Рік тому +1

    A perfect opportunity to use list comprehension instead of a loop

    • @davidwuhrer6704
      @davidwuhrer6704 Рік тому

      You could even do this using the reduce function. (Fold in Haskell.)

  • @MarthinusBosman
    @MarthinusBosman Рік тому +1

    Did I learn anything? No. Did I like his accent? Yes

  • @zilog1
    @zilog1 Рік тому

    yo. wow. I think i know where to start to make my own language and complier now. obv i have a long way to go bot wow this is so cool.

  • @MecchaKakkoi
    @MecchaKakkoi Рік тому +1

    👍

  • @ChiamLavis
    @ChiamLavis Рік тому

    What is that paper called??

  • @fslurrehman
    @fslurrehman Рік тому +2

    You see if we do some math, we need to have some Greek letters.

  • @mad_vegan
    @mad_vegan Рік тому +5

    You can just use "for c in w" instead of a while loop. Also, you don't need to compare with an empty string - "while w:" does the same thing.

    • @Kready44
      @Kready44 Рік тому

      shouldn't you use while 'w is not None:'?

    • @mad_vegan
      @mad_vegan Рік тому

      @Greden No, because w is always a string. When you take the last character out, it becomes an empty string, not the object None.

    • @k283
      @k283 Рік тому

      @@mad_vegan > When you take the last character out, it becomes an empty string, not the object None
      It doesn't, though. If w is set to "hello world", then it will still be "hello world" after iteration is finished, it won't "become an empty string" somehow.
      Same goes for iterating variable c (in "for c in w" line): after the loop is finished, it will hold the value "d" in this case, not an empty string.
      Try this:
      ....for c in "hello world":
      ........pass
      ....print(c)
      You'll see "d" printed out after iteration.

    • @mad_vegan
      @mad_vegan Рік тому

      @K My comment was referring to the while loop, where you slice the string each loop. If you use the for loop, then you don't need (and shouldn't do) slicing.

    • @k283
      @k283 Рік тому

      @@mad_vegan Yeah, I commented about that too (it's one really strange way to iterate over the string - with a while loop and slicing). Just pointed out some minor detail in your comment.

  • @versacebroccoli7238
    @versacebroccoli7238 Рік тому

    What is the difference between a sequence and a set? Why was a set of chars an incorrect answer to what is a word?

    • @klericer
      @klericer Рік тому

      A set is unordered

    • @Computerphile
      @Computerphile  Рік тому

      My guess is that a set of characters like "o,d,g" could be sequenced into more than one word... -Sean

    • @beatmapgz
      @beatmapgz Рік тому +1

      The elements in a set have no particular order if an order relation is not defined, and sets usually don’t have duplicate elements (otherwise you are looking at “multi-sets” that usually have a specific purpose, for example in combinatorics). A set of symbols is called an alphabet and words are sequences of symbols taken from an alphabet: for example we could have the alphabet (set of symbols) {a,b,c} and a word (sequence of symbols) “cca” that would be different from “acc” even though the characters are the same (so you can see the intuitive difference between set and sequence). Hope it helps, and yeah I was bored :)

    • @versacebroccoli7238
      @versacebroccoli7238 Рік тому

      @@beatmapgz so when I use a list in Python it's actually a sequence (since order matters) and the set that sequence comes from is all possible values for all possible types in Python?

    • @klericer
      @klericer Рік тому

      @@versacebroccoli7238 Yes, a list in Python is a sequence. The list's "alphabet" is every object currently defined in your Python interpreter (a type is also an object). However, you can dynamically extend this alphabet, e.g., through creating new values from the primitive data types (int/float/str). Hence, your alphabet is uncountably infinite.

  • @XavierAway
    @XavierAway Рік тому

    Hey, it’s the train man!

  • @RealCyberCrime
    @RealCyberCrime Рік тому +4

    I’m thinking about making a similar video but about famous hacks in documentary format

  • @zbnmth
    @zbnmth Рік тому

    Thanks for the video. I'd have more explicitly stated the rules for the example dictionary; where -ALL- a's come before -ANY- b's. Otherwise, you could read it like so; where -SOME- a's come before b's, which renders aba a valid word.

  • @tamptus3479
    @tamptus3479 Рік тому

    why not Σ instead of sigma?

    • @tamptus3479
      @tamptus3479 Рік тому

      @@dayvie9517 In Python you can use Σ as an identifier😀

  • @dennis-fahedsaadeddin5283
    @dennis-fahedsaadeddin5283 Рік тому

    Hi, guys! Thanks a lot for the content you are producing. Can you, please, help us understand how Fast-Flux works? I saw the video explanation of this concept is scarce, it might be an interesting security topic. :)

  • @cdellio
    @cdellio Рік тому

    4:59

  • @dkierans
    @dkierans Рік тому

    Nice!

  • @GeoffDavis1974
    @GeoffDavis1974 Рік тому

    What no 'bb' ? 😢

  • @guilherme5094
    @guilherme5094 Рік тому

    👍Thanks.

  • @kiraieee
    @kiraieee Рік тому

    damn i like this channel videos but i hate the sound of that pen writing on this paper idk why but cant resist it

  • @bsassoli
    @bsassoli Рік тому

    Why have "sigma" in "init"? Is it ever used in the implementation?

  • @kinnoinen
    @kinnoinen Рік тому

    It’s like he’s trying to speak without moving his mouth

  • @soyitiel
    @soyitiel Рік тому

    Just started that chapter in the dragon book. Must be a sign

  • @lostsoul2184
    @lostsoul2184 Рік тому

    You should be in james bond movie

  • @dreiphi
    @dreiphi Рік тому

    Silly 😅 how calls an alphabet (αβ) Sigma Σ?

  • @Zahlenteufel1
    @Zahlenteufel1 Рік тому

    This probably makes it a lot less dry for people who dislike math.

  • @philosuit
    @philosuit Рік тому

    Hi

  • @AboveEmAllProduction
    @AboveEmAllProduction Рік тому +2

    Is this the train guy from matrix 3

  • @tophat593
    @tophat593 Рік тому +2

    6:00 Please tell this learned professor that PEP-8 is a thing; spaces after commas. Computer languages are a standard, only some of those standards are enforced by the compiler but we're still subject to them because they're a good thing.
    Also, come on, this is too simple to justify complicated words. Also also, to anyone that has had to write complicated regex expressions and refused to learn any more than they needed for the exact use case, I feel you.

    • @k283
      @k283 Рік тому +1

      Computer scientists typically don't pay attention to code beauty / readability, so they ignore PEP-8. It's okay though, their main focus is research, they work with *ideas*, not with the code, so code doesn't really concern them as long as it just works.

  • @maxid87
    @maxid87 Рік тому +1

    Can someone have more "Rick" vibes than Thorsten? :D

  • @AcornElectron
    @AcornElectron Рік тому

    Scary

  • @Piupiumacher
    @Piupiumacher Рік тому +2

    nice vid, but my inner pep-8 cries

    • @robertkelleher1850
      @robertkelleher1850 Рік тому

      Yes... learn Automata from this, but please don't learn Python from this.

  • @FTE99699
    @FTE99699 Рік тому

    love me some fellow Germans that are unconventional :)

  • @Xamarin491
    @Xamarin491 Рік тому

    Would "abb" fail? It seems like it should pass.

    • @sebastianselander161
      @sebastianselander161 Рік тому +2

      It would pass!

    • @thebarnold7234
      @thebarnold7234 Рік тому

      in the automata described, abb would pass. This is because it satisfies that all a's are before all b's. This works for "a" and {epsilon} too because a is still before all b's even if none exist and epsilon is empty thus there is no scenario where a's come after b's, thus it holds.

    • @azoic6
      @azoic6 Рік тому +1

      @@thebarnold7234 does b pass, as there's no as before it?

    • @SgtSupaman
      @SgtSupaman Рік тому

      @@azoic6 , yes, "b" will also pass. From the initial state, 'b' will pass to state 1, and that is a final state.

  • @Brick-Magic
    @Brick-Magic Рік тому

    I love computerphile but would appreciate if the videos would be more concise. Also the code is very verbose. I would appreciate something like
    def run(state, delta, final, word):
    while word:
    symbol, *word = word
    state = delta[(state, symbol)]
    return state in final
    delta = {(0,"a"):0, (1, "a"):2, (2,"a"):2, (0,"b"):1, (1, "b"):1, (2, "b"):2 }
    run(0, delta, (0,1), "aab")

  • @hurktang
    @hurktang Рік тому +2

    This video is a little underwhelming. Not gonna lie.

  • @Hitman-li1hg
    @Hitman-li1hg Рік тому

    Noice

  • @elimgarak3597
    @elimgarak3597 Рік тому +2

    Excellent video, I didn't think impenting an automaton would be so easy.
    MacOS tho ewwww

  • @schogaia
    @schogaia Рік тому

    I love this guy but the lack of pep8 drives me nuts.

  • @AndrewWilsonStooshie
    @AndrewWilsonStooshie Рік тому

    "I did something wrong ... Oh ... I set my indentation levels wrong"
    That's why I use javascript over python every time.

  • @nonoffensiveperson9877
    @nonoffensiveperson9877 Рік тому

    Only problem with this channel is the atrocious act of using a marker on paper.