RU beehive logo promo banner for Computing & Info Sciences
CS 420
2024fall
ibarland

Definitions
sets; FSMs

READING:

Chapter 5

  1. Come up with: Example 5.3, every "a" region in w is even-length
  2. Come up with: Example 5.4, odd-parity
  3. Look at Example 5.1, vending-machine
  4. Look at Example 5.2 (p.58pdf=43book).

Defining Finite State Machines

A FSM = ⟨K, Σ, δ, s, A⟩. In math:

In Java:
typedef State String; // okay, this isn't legal Java, but fine: we're representing States by Strings (their name); using `int` is common too. (Really: we should have `class FSM<StateType>`.)

class FSM {
    Set<State> K;
    CharSet Σ;
    State s;      // @pre: K.contains(s)
    Map< Pair<State,Character>, State> δ; // @pre States are all in K; Characters are all in Σ.
               // We could also use java.function.BiFunction
               // Or we could use a Set<ThreeTuple<State,Character,State>>, so long as that set (relation) represents a function.
    Set<State> A; // @pre: K.containsAll(A)
    }
The math people sure have more succinct notation, to convey the same info!

Example: All equivalent:



1 Recall how we can view functions as a relation with a restriction: In this case: For every k1 ∈ K, σ ∈ Σ there is one, and only one k2 such that (k1, σ, k2) ∈ δ.      

logo for creative commons by-attribution license
This page licensed CC-BY 4.0 Ian Barland
Page last generated
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.