SmithLogo

CSC 250

Theory of Computation

Smith Computer Science



Lecture Notes 11: Perspectives on REs and FAs; and Properties of Regular Languages


Outline

This class we'll discuss:




Some Perspective

Why are we asking you all of these questions about regularity of languages, etc.?

REs and FAs are really simple computational machines.

What does this have to do with getting your Java code to compile, or using dynamic programming, or ...

Turns out that there are some surprisingly algorithmic things we can do when we start asking questions about these simple machines.

Let’s take a look at some questions we might ask.



Properties and Questions!

Why are these questions important?

(Wait; then Click)

It's not about simply building a machine that might do something,
It's about knowing, before expending unnecessary effort if:
  1. we are reinventing the wheel.
  2. we are building something that never terminates
  3. we are building something that works but is extremely inefficient
  4. etc




In Real Life

  1. Do we have a way of answering these questions about our own programs?
  2. In a way, all programs do symbol processing
  3. In a way all of them are like little Machines
  4. If we can represent processes as FAs or REs, we can answer the questions shown above


Activity 4 [5 minutes]:


How would you check, for an RE or an FA, to see if your input satisfies one of the following properties?

  1. Acceptance:
    (Wait; then Click)

    If we go through the transition table (using a lookup table), do we get to an accepting state?

  2. NonExistance
    (Wait; then Click)

    If count the number of states \(N_Q\) in the "Machine", we need only check all words with length \(\mid w \mid \leq N_Q\)

  3. Totality
    (Wait; then Click)

    Check there is no path from \(q_0\) to any non-accepting state.

  4. Nonempty Intersection
    (How would you do this?)
  5. Subset
    (How would you do this?)
  6. Equivalence
    (How would you do this?)
  7. Optimality
    (How would you do this?)




Intro: Context-Free Grammar



CFGs!!!

EQ, HALF, PAL

CFGs!!!



CFGs!!!

Finite automata and regular expressions are limited

They both only match patterns that can be described by reaching L to R

Some patterns are more interesting…

CFGs!!!



CFGs!!!

Seems like PAL lives really close to Regular: there’s a structure to the words that’s ALMOST regular… but the pattern is in the middle.

CFGs!!!

S ->g N_phrase V_phrase

CFGs!!!

N -> article noun

V -> conjugated verb

CFGs!!!



CFGs!!!



CFGs!!!



CFGs!!!



CFGs!!!



CFGs!!!



CFGs!!!



CFGs!!!



CFGs!!!




Next class: Context-Free Grammars




Homework


[Due for everyone]
Problem Set 03: Due 10/18 at 5 PM

[Optional]
TODO