Context-Free Grammars (CFG) and Context-Free Languages (CFL) - what are they?

Поделиться
HTML-код
  • Опубликовано: 20 ноя 2024

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

  • @EasyTheory
    @EasyTheory  3 года назад +25

    Thanks to my supporters Yuri, vinetor, Ali (RUclips) and Bruno, Timmy, Micah (Patreon) for making this video possible! If you want to contribute, links are in the video description.

  • @itsZybn
    @itsZybn 4 года назад +108

    Hey man, just wanted to say I really appreciate you taking the time to make a video like this. Your work does not go unnoticed!

    • @EasyTheory
      @EasyTheory  4 года назад +12

      Much thanks for watching

  • @unit220
    @unit220 3 года назад +36

    It's actually maddening that I've spent hours with my professors trying to wrap my head around concepts like this and you destroy almost all my doubts in just 18 minutes haha, thank you so much for all of your vids!

  • @fishfishfishfishfishfish
    @fishfishfishfishfishfish 4 года назад +26

    This video came just in time, I just finished my exam a few minutes ago. I don't think there's any way I would have passed without your videos!

    • @EasyTheory
      @EasyTheory  4 года назад +7

      You're very welcome, and good luck!

  • @al8905
    @al8905 5 месяцев назад +1

    speed running your videos for finals tomorrow, thanks for the knowledge

  • @jackmccarthy7644
    @jackmccarthy7644 3 года назад +14

    Exercise from video: Proving PAL isn't regular.
    We will prove this with the pumping lemma. First, assume PAL is regular, so it has a pumping constant p.
    Take the string w=(0^p)1(0^p). This is in PAL because it is a palindrome, and it has a length greater than p.
    Then, set w=xyz, where |y|>0 and |xy|0)
    z=(0^p-a-b)1(0^p)
    Then, by the pumping lemma, we know all x(y^i)z are in PAL. Take i=2:
    x(y^2)z = (0^a)(0^b)(0^b)(0^p-a-b)1(0^p) = (0^p+b)1(0^p)
    This can only be in PAL if it's a palindrome, which is only possible if the zero's on the left and right size of the 1 are equal. So we have:
    p+b=p --> b=0
    Which is a contradiction because we know the length of y is greater than 0.
    Therefore, PAL can not be regular.

  • @ClaudioBOsorio
    @ClaudioBOsorio 3 года назад +10

    Thanks for the video you are really saving lives here.
    My prof just gave us 2 powerpoint slides not even videos or lectures.
    I'd like to request videos solving problems from the book. The biggest challenge I'm finding is that lectures like yours can be very helpful but the problems are just way harder. Anything helps. Keep it up!

    • @EasyTheory
      @EasyTheory  3 года назад

      I have some already made. Will make more. Here's the playlist of the ones I've already done: ruclips.net/video/CvQDtQNqfAw/видео.html&ab_channel=EasyTheory

  • @yoavg2281
    @yoavg2281 3 года назад +2

    The best lesson's creator for this subject
    Please decrease the amount of adds this is so annoying!!!!!

  • @fredrik1164
    @fredrik1164 3 года назад +4

    Thank you so much for making detailed and informative videos like this, thanks to you I feel more confident for my exam tomorrow :)

  • @ahmedayman2047
    @ahmedayman2047 3 года назад +2

    that's great, you're making Autumata much more interesting.

  • @ashleylove6840
    @ashleylove6840 3 года назад +1

    The way you teach is so good!!!!

  • @ketcup269
    @ketcup269 Месяц назад

    Great example my prof went over this one in class but just wasnt getting it. Glad u used sipsor as well !! i saw ur recent video about whats the point as well and loved that view as i was one who thought the more negative way of things. hope ur doing well !

  • @mellowbun2022
    @mellowbun2022 4 года назад +2

    Thank you for taking the time to make this man! This is much better explained than my teacher haha

    • @EasyTheory
      @EasyTheory  4 года назад +1

      You're welcome! Make sure to send this to everyone you know ;)

  • @jacobhatfield764
    @jacobhatfield764 2 года назад

    CFG is basically the axiom of specification in set theory... well, not equivalently speaking, but the same concept applies. Every A and every conditional; exists B, which holds all membership A and A's conditions.

  • @adrianmreds
    @adrianmreds 3 года назад

    Bro you just saved my exam thanks!

  • @emmanuel-luka
    @emmanuel-luka 3 года назад +2

    Thanks for the video man, it's really helpful

  • @rachelsimaginarium
    @rachelsimaginarium 4 года назад +4

    This was so helpful! Thank you!!

  • @Gzzzzzz111
    @Gzzzzzz111 4 года назад +2

    Thank you for the video! It really helps out since my prof Obrenic sucks at teaching. :)

  • @SharminSultana-uq8go
    @SharminSultana-uq8go 6 месяцев назад

    2024- Still best series so far!

  • @isaacgiles6206
    @isaacgiles6206 2 года назад

    you're an actual hero.

  • @Squirroo
    @Squirroo 3 года назад +1

    You are amazing thank you so much!!!!!!! Very good explanation :)))

  • @rad_skelly4895
    @rad_skelly4895 3 года назад

    thanks for helping me understand this stuff, instant subscribe!

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

    Thanks for the video!

  • @animexed2679
    @animexed2679 3 года назад

    Amazing Explanation !
    Also can you tell me the name of the theme playing in your channel intro , it sounded really good !

  • @Marcalitus
    @Marcalitus 4 года назад +15

    Thank you so much, I know you might not think anyone is watching but I am thankful I clicked and it wasn't another Indian because they've been haunting my dreams.

    • @EasyTheory
      @EasyTheory  4 года назад +2

      Lmao thanks for your viewership! I do read all comments :)

    • @Marcalitus
      @Marcalitus 4 года назад +4

      @@EasyTheory shared your videos and playlist with all my class mates. Thank you so much for your time.

    • @EasyTheory
      @EasyTheory  4 года назад +4

      @@Marcalitus Much appreciated!

    • @Panthera-Uncia
      @Panthera-Uncia 8 месяцев назад

      Agreed. Much love to my fellow Americans.

  • @lorenzofransman1520
    @lorenzofransman1520 3 года назад

    Great video! Do you maybe have video on generation trees and Lukasiewicz notation? It's in the CFG chapter of Cohen's book

  • @bb-xj9ed
    @bb-xj9ed 3 года назад +3

    thank you for not having a thick indian accent

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

      looooool

  • @LinguiniSoup
    @LinguiniSoup 2 года назад

    holy crap THANK YOU

  • @nandiniverma5273
    @nandiniverma5273 2 года назад

    Nice explanation

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

    thank you so much for this

  • @Peter-bg1ku
    @Peter-bg1ku 3 года назад

    Amazing explanation. I bet you a five year old can easily understand CFG by watching this video :-) Thank you!

  • @guilherme8104
    @guilherme8104 2 года назад

    thaaanks a lot

  • @bryanromero1
    @bryanromero1 4 года назад +4

    Where were you when I took theory of computation :(

    • @EasyTheory
      @EasyTheory  4 года назад +9

      In your context-free dreams

  • @WolfsRainESP
    @WolfsRainESP 2 года назад

    After watching the video I came up with these doubts:
    Does the language of even-length palindromes form a context-free grammar?
    Does the language of words that have more a's than b's form a context-free grammar?
    Can every grammar be simplified to a regular grammar?

    • @biswayannandi6136
      @biswayannandi6136 2 года назад +1

      1. In case of language of even length palindrome strings over any 2 terminals, yes, its grammar is indeed a CFG. You can create a PDA for this which in turn proves that its a CFG.
      2. It is also a CFL as you can create its PDA
      3. As per Chomsky Hierarchy we know that a regular grammar is also a recursively enumurable grammar but thats not vice versa. So, you cannot simplify any grammar into a regular grammar. The languages differ.

  • @Christine-ne3dw
    @Christine-ne3dw 3 года назад

    Thank you, sir :)

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

    Tnx man😅

  • @samjudelson
    @samjudelson 3 года назад

    Thanks!

  • @ElenaSemanova
    @ElenaSemanova 3 года назад +2

    Very good video and damn, you're attractive, and so is your voice

  • @thougts7348
    @thougts7348 3 года назад

    Professor, at 4:20 you inserted a comma into the string!

  • @tongpoo8985
    @tongpoo8985 3 года назад +1

    Would this also work as a CFG for PAL?:
    S = 0A | 1B | 0 | 1 | E
    A = 0 | S0
    B = 1 | S1

  • @legend7890
    @legend7890 3 года назад +1

    Would this work for palindromes?
    S -> 0 | 1 | E | 0B0 | 1B1, B ->0B | 1B | E

  • @5beastman5
    @5beastman5 2 года назад

    goated

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

    Can you tell me what’s the name this application you use?

  • @MsCrycry
    @MsCrycry 3 года назад

    by any chance, a CFG cannot generate a regular language?? and what is the best way to prove if a CFG can or cannot generate regular language?

    • @EasyTheory
      @EasyTheory  3 года назад +1

      Every regular language is context-free, so a CFG can always be made for a regular language. Note that every regular language has a regular grammar, which already is a CFG.

    • @MsCrycry
      @MsCrycry 3 года назад

      @@EasyTheory Thank you for your help. Btw is S -> Aaa or S -> aa are also regular grammar?

    • @EasyTheory
      @EasyTheory  3 года назад

      @@MsCrycry not strictly speaking. The only allowed rule types are of the form A -> x, where A is a single variable, and x is empty string, a single terminal, a single variable, OR a single terminal then a single variable. So those rules are not in the allowed rule types.
      However, they describe a regular language, so there exists a regular grammar for it (just that it's not involving the rules you gave).

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

    ur so cool....

  • @savãnnah-oliver
    @savãnnah-oliver 3 года назад

    handsome and smart

  • @parkergent5294
    @parkergent5294 Месяц назад

    I have never hated a class or subject more than this

  • @climbersisyphus
    @climbersisyphus 7 месяцев назад +1

    5 minutes in and i have no idea what you're saying.

  • @david_m157
    @david_m157 3 года назад

    This is the worst class. You dont realize how lucky you are that you have hundreds of years of pedagogy behind math until you take theoretical computer science classes and see how makeshift the pedagogy is.

  • @yusufyusuf1998
    @yusufyusuf1998 4 месяца назад

    intro music is out of time