Week 10 Flashcards

(18 cards)

1
Q

What is Finite State Automata (FSA)?

A

What is Finite State Automata (FSA)?
Definition:

A model of computation that changes states based on inputs until reaching a final or acceptor state

Key Points:

Represents systems that react to sequences of inputs

Can be deterministic (DFA) or nondeterministic (NFA)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the uses of Finite Automata

A

Hardware: Circuit design, pattern matching.

Software: Lexical analyzers, language parsing, text search engines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the core concepts in Automata Theory?

A

Alphabet (Σ):

A finite, nonempty set of symbols.

Example: Σ = {a, b, c, …, z}.

Strings:

Finite sequences of symbols from Σ.

Example: “bccd” is a string over Σ = {a, b, …, z}.

Languages:

A subset of all possible strings over Σ (denoted as Σ*).

Example: L = {abc, def} where Σ = {a, …, z}.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the components of a Deterministic Finite Automaton (DFA)?

A

Finite set of states, Q

Alphabet, Σ

Transition function, δ(p,a)=q.

Start state, q0

Accepting states, F⊂Q

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a transition function in DFA?

A

Maps the current state p and input symbol a to a new state q

Notation:

δ(p,a)=q

Example:

If Q = {p,q,r} and Σ = {0,1}

δ(p,0)=q

δ(q,1)=r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Nondeterministic Finite Automata (NFA)?

A

NFAs can transition to multiple states for the same input.

NFAs can transition without any input (epsilon transitions).

Easier to construct but harder to implement directly.

Question: Are NFAs and DFAs equivalent?

Answer: Yes, every NFA has an equivalent DFA.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a transition table?

A

How is a DFA represented in a transition table?

Example table:

State Input: 0 Input: 1

→p q p
q r q
r* r r

Legend:

→: Start state.

∗: Accepting state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Can you describe an example DFA?

A

Question: How does a DFA recognize a string of interleaved ‘0’s and ‘1’s starting and ending with ‘1’?

States:

Q = {p,q,r}

q0 = p(start state)

F = {r} (accepting state)

Transition Function:

δ(p,1)=q

δ(q,0)=r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can you create a DFA for a specific language?

A

How would you create a DFA for strings where every ‘a’ is followed by a ‘b’ over Σ = {a,b}?

Answer:

Task for practice: Draw a transition table or diagram for this language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a Regular Expression?

A

A regular expression is an algebraic and declarative description of a deterministic or nondeterministic finite state automaton (DFA or NFA)

It is used to specify patterns in strings, defining languages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the main operations in Regular Expressions?

A

Closure(*)::

Denotes L*, the set of strings formed by concatenating zero or more strings from language L

Example: 0* means any number of 0’s (including none)

Concatenation:

Denoted LM, where L and M are languages

Forms strings by appending any string from L with any string from M

Example: if L = {a} and M = {b}, LM = {ab}

Union(+):

Denotes L + M, where a string can belong to L, M or both

Example: 0 + 1 matches either 0 or 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the precedence of operators in Regular Expressions?

A

Closure (*) has the highest precedence and applies to the smallest sequence of symbols to its left

Concatenation has the next highest precedence; expressions juxtaposed are grouped together

Union (+) has the lowest precedence; expressions are grouped by union in any order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the Closure Operator do?

A

Denoted L*

Represents all possible strings formed by concatenating zero or more strings from language L

Example: If L = {a} then L* = {ϵ,a,aa,aaa,…}

(ϵ is the empty string)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the Concatenation Operator do?

A

Denoted LM

Forms strings by appending any string from language L, with any string from language M

Example:

if L = {0} and M = {1}, then LM = {01}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the Union Operator do?

A

Denoted L + M

Represents the set of strings that are in L, M or both

Example:

If L = {a} and M = {b}, L + M = {a,b}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Can you provide examples of Regular Expressions?

A

0* + 1: Matches any number of 0’s or a single 1

101*: Matches 10 followed by any number of 1’s

10 + 01: Matches 10 or 01

0(10)*: Matches 0 followed by any number of 10’s

17
Q

How do Regular Expressions relate to Automata?

A

Regular expressions are an algebraic representation of patterns recognized by finite state automata (DFA or NFA)

Each regular expression corresponds to an automaton that accepts the language it defines

18
Q

What regular expression describes a DFA that recognizes strings starting and ending with 1?

A

Regular Expression 1(0 + 1)*1

Starts and ends with 1

Contains any combination of 0’s and 1’s in between