Chapter 1

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

How do you informally explain how to convert a DFA into a Regular Expression?

- If the language is regular, a regular expression describes it. - Because the lang is Regular, it can be recognized/represented by a DFA - First convert the DFA into a GNFA - Then convert the GNFA into a RegEx

How do you informally explain how to convert a GNFA into a Regular Expression?

- Repeatedly construct a new GNFA by deleting any middle state (and repair the machine) until you get a 2-state GNFA. **Commonly done by Unioning the labels of deleted arrows with another arrow's label - The label of that GNFA's single transition will be the RegEx.

GNFA's must have a special form that meets which conditions?

- The start state has transition arrows going to every other state but no arrows coming in from any other state. - There is only a single accept state, and it has arrows coming in from every other state but no arrows going to any other state. Furthermore, the accept state is not the same as the start state. - Except for the start and accept states, one arrow goes from every state to every other state and also from each state to itself.

How do you informally explain how to convert an NFA into a DFA?

- Write the Transition Table of the NFA - Note "dead" states - Write the Transition Table of the DFA and add new states for the Dead States - Draw the DFA using the Transition Table and Dead States

M accepts string "w" if a sequence of states (r0, r1, . . . , rn) in Q exists with which three conditions?

1. r0 = q0 2. δ(ri, wi+1) = ri+1, for i = 0, . . . , n−1 3. rn ∈ F - Condition 1 says that the machine starts in the start state. - Condition 2 says that the machine goes from state to state according to the transition function. - Condition 3 says that the machine accepts its input if it ends up in an accept state.

If "k" is the number of states of an NFA, how many subsets of states does it have?

2^k

Define: A Non-Regular Language

A Language that CANNOT be represented by a Finite Automata. i.e.) There does not exist an FA that Recognizes that Language

Formally prove that a GNFA still recognizes the same language after it's derived from a bigger GNFA.

A generalized nondeterministic finite automaton is a 5-tuple, (Q,Σ, δ, qstart, qaccept), where 1.) Q = the finite set of states, 2.) Σ = the input alphabet, 3.) δ : (Q - {q_acc}) x (Q - {q_start}) → R 4. q_start is the start state, and 5. q_acc is the accept state. δ : (Q−{q_acc}) x (Q−{q_start}) → R **The symbol R is the collection of all regular expressions over the alphabet Σ. If δ(qi, qj) = R, the arrow from state qi to state qj has the regular expression R as its label.

Define: Formally define the Regular Operation "Union" of two sets

A ∪ B = {x| x ∈ A or x ∈ B}.

Define: Formally and Informally define the Regular Operation "Concatenation" of two sets

A ◦ B = {xy | x ∈ A and y ∈ B}. = A x B Maps every string from A to every string from B to create a set of all combinations of the two where the strings from A are placed before the string of B.

All Regular Languages are closed under which Regular Operations?

All 3 of them: - Union - Concatenation - Star

Which, if any, languages are closed under Concatenation?

All Regular Languages.

Which, if any, languages are closed under Star?

All Regular Languages.

Which, if any, languages are closed under Union?

All Regular Languages.

Define: Formally and Informally define the Regular Operation "Star" of a set

A∗ = {x1x2 . . . xk | k ≥ 0 and each xi ∈ A}. Attaches any number of strings in A together to get a string in the new language. Because "any number" includes 0 as a possibility, the empty string ε is always a member of A∗, no matter what A is.

What is the formal definition of an FA? Hint: (5-tuple)

FA = (Q,Σ, δ, q0, F), where 1. Q = FINITE set of states of the FA, 2. Σ = FINITE set of allowed input symbols (Alphabet), 3. δ: Q × Σ→Q is the Transition Function 4. q0 = start state. q0 ∈ Q (element) 5. F = set of accept states. F ⊆ Q (subset)

There exists DFA's that cannot be converted into NFA's

False

Every NFA is** a DFA.

False, but all NFA's can be converted into DFA's

T/F: The Accept state of a GNFA can also be its Start state.

False.

T/F: The accept states of GNFA's may have 1 or more incoming transition arrows.

False. They are not allowed to have ANY incoming transition arrows. *** Also, from the accept state, there MUST be one outgoing transition arrow to every other state

Represent RegEx (A*) as an NFA.

Four States. (q0 -> q1) via ε, (q0->q3) via ε, (q1->q2) via A, (q2->q3) via ε, (q3->q1) via ε,

Define: "Closed Under" an operation

If two languages, A and B, are closed under an operation, then A(operation)B = C, where C is a language of the same type

Define: A Regular Language

It's a language that is "Recognized" by any FA

What 3 conditions need to exist for you to be able to say "M recognizes language A"

M "Recognizes" language A if A = {w|M accepts w}. Where... 1. r0 = q0 2. δ(ri, wi+1) = ri+1, for i = 0, . . . , n−1 3. rn ∈ F - Condition 1 says that the machine starts in the start state. - Condition 2 says that the machine goes from state to state according to the transition function. - Condition 3 says that the machine accepts its input if it ends up in an accept state.

How do you prove that an NFA accepts a string, "w"?

N accepts "w" if we can write w as w = y1y2 · · · ym, where each yi is a member of Σε and a sequence of states r0, r1, . . . , rm exists in Q with three conditions: 1. r0 = q0, 2. ri+1 ∈ δ(r, yi+1), for i = 0, . . .,m − 1, and 3. rm ∈ F. - Condition 1: says that the machine starts out in the start state. - Condition 2: says that state ri+1 is one of the allowable next states when N is in state ri and reading yi+1. Observe that δ(ri, yi+1) is the set of allowable next states and so we say that ri+1 is a member of that set. - Condition 3: says that the machine accepts its input if the last state is an accept state.

What is the formal definition of an NFA? Hint: (5-tuple)

NFA = (Q,Σ, δ, q0, F), where 1. Q = a finite set of states, 2. Σ = a finite alphabet, 3. δ : Q × Σε→P(Q) is the transition function, 4. q0 = is the start state, (q0 ∈ Q) 5. F = is the set of accept states, (F ⊆ Q) ***P(Q) is the powerset of Q

Are you allowed to convert a Regular Expression directly into an DFA? If not, explain.

No. You need to first convert it into an NFA and then convert that NFA into a DFA.

Define: P(Q)

P(Q) = the Powerset of Q = the collection of all subsets of Q

If two Regular languages, A1 and A2, create language A by Union, A = (A1)U(A2), how do you prove that the resulting language is Regular? List the thought process

Proof By Construction: - If the two languages are regular then they are Recognized by an FA. If that, then those two languages can be represented by an FA. If that, then the resulting language can be represented with another FA. Thus, proving that it's Regular. - We do this by Simulating the two machines simultaneously so that the resulting machine accepts when EITHER of the two machines accept. - Need to remember the two machines' states at each symbol of input as a pair of states. Need to consider every combination (cart prod) of states. - Q = Cartesian Product of Q1 and Q2: {(r1, r2)| r1 ∈ Q1 and r2 ∈ Q2}. (# = k1 x k2) - Σ = (Σ1)U(Σ2), Union of both alphabets - δ = the transition function, is defined as follows. - For each (r1, r2) ∈ Q and each a ∈ Σ, let δ((r1, r2), a) = (δ1(r1, a), δ2(r2, a)) - q0 = their pair, (q1, q2) - F = the set of state-pairs where at least 1 is an Accept State: F = {(r1, r2) | r1 ∈ F1 or r2 ∈ F2} OR F = (F1 ×Q2) ∪ (Q1 ×F2). ***** To Prove this Construction: A formal correctness proof for a (more complicated) construction of this type usually proceeds by "Induction." See Thm. 1.54

In descending order, what is the order of operations for the class of Regular Operations?

Star, then Concatenation, then Union

What is the name of and symbols of the language recognized by an FA that accepts no strings?

The "Empty" Language. Denoted as "Ø"

Represent RegEx (AB) as an NFA.

Three states. (q0 -> q1) via A, (q1 -> q2) via B

DFA's and NFA's Recognize the same (class of) languages.

True

Every DFA can be converted into an NFA.

True

Every DFA is** an NFA.

True

FA's can have multiple accept states

True

FA's may have 0 accept states

True

FA's must have exactly 1 start state

True

FA's must have exactly one transition exiting every state for each possible input symbol

True

Finite Automata are good models for computers with extremely limited memory.

True

T/F: (R ∪ ∅) = R always, but (R ∪ ε) might not equal R.

True

T/F: Any FA can be converted into a Regular Expression if that FA recognizes the language the RegEx describes. And Vice Versa.

True

T/F: Any Regular Expression can be converted into an FA that recognizes the language the RegEx describes. And Vice Versa.

True

The start state of an FA can also an accept state.

True

There exists NFA's that cannot be converted into DFA's

True

Every NFA can be converted into a DFA.

True, but not every NFA is considered BE a DFA. But every DFA is considered to be an NFA

NFA's can have multiple accept states.

True.

T/F: Every Regular Language can be represented as a Regular Expression.

True.

T/F: GNFA's must have both a start and accept state.

True.

T/F: Aside from the Accept and Start states, every state must have an outgoing transition arrow to every other state INCLUDING itself.

True. Accept and Start states cannot point to themselves.

A machine ALWAYS recognizes only one language.

True. Even if the machine accepts no strings, it will still "Recognize" one language: The "Empty" language, Ø

Represent RegEx (A|B) as an NFA.

Two states. (q0 -> q1) via "A" or "B"

Prove that an NFA can be converted into a DFA. List your thought process.

What do you need to keep track of as the input string is processed? - If k = # states of the NFA, it has 2^k subsets of states. Each subset = one of the possibilities that the DFA must remember, so the DFA simulating the NFA will have 2^k states. - Now we need to figure out which will be the start state and accept states of the DFA, and what will be its transition function. **Let N = (Q,Σ, δ, q0, F) be the NFA recognizing some language A. - We construct a DFA: M = (Q′,Σ, δ′, q0′, F′) recognizing A. 1.) Q′ = P(Q). - Every state of the DFA is a set of states of the NFA. 2.) For R ∈ Q′ and a ∈ Σ, let ... δ′(R, a) = {q ∈ Q| q ∈ δ(r, a) for some r ∈ R}. - If R is a state of NFA "M", it is also a set of states of DFA "N". - When the DFA reads a symbol "a" in state R, it shows where "a" takes each state in R. - Because each state may go to a set of states, we take the union of all these sets. - Another way to write this expression is... δ′(R, a) = U_(r∈R) δ(r, a) ***U_(r∈R) δ(r, a) = the union of the sets δ(r, a) for each possible stage r in R. 3.) q0′ = {q0}. DFA "M" starts in the state corresponding to the collection containing just the start state of NFA "N". 4.) F′ = {R ∈ Q′| set R contains an accept state of N}. The DFA accepts if one of the possible states that the NFA could be in at this point is an accept state.

Define: Nondeterministic

When the machine is in a given state and reads the next input symbol, we know what the next state will be—it is determined. We call this deterministic computation. In a nondeterministic machine, several choices may exist for the next state at any point.

Are you allowed to convert a Regular Expression directly into an NFA? If not, explain.

Yes

An FA named M = (a, b, c, d, e). Formally define all variables.

a = Q, the set of all states (finite set) b = Σ, the Alphabet (finite set) c = δ, the Transition Function (Q × Σ→Q) d = q0, the start state (q0 ∈ Q) e = F, the set of all accept states. (F ⊆ Q) can be {} = Ø = empty set

What is the "value" of a regular expression?

the "value" is a language

Explain the broad components of a Transition Function

δ(current_state, input_symbol) = next_state Ex.) δ(x, 1) = y Means that if you're in state x and the input symbol is 1 then you will transition to state y.

If the start state of an FA is also an accept state, what input symbol will make the FA halt and accept immediately?

"ε", the Empty String

What does "∅" symbolize? How is this different from "ε"?

"∅" represents the language that does not contain any strings, the Empty Set, {}. "ε" represents the language containing one string, the Empty String, "".

If two Regular languages, A and B, create language A by Concatenation, C = (A)*(B), how do you prove that the resulting language is Regular? List the thought process

*Use Nondeterminism to explain the proof of this*

Informally explain how to convert a DFA into a GNFA.

- Add a new start state with an "ε" arrow to the old start state and a new accept state with "ε" arrows from the old accept states. - Replace any transitions with multiple labels with one label representing the Union of them all. - Finally, add arrows labeled "∅" between states that have no arrows.

Difference between DFA's and NFA's

- Different Transition Functions: - DFA's must have ONLY 1 exit transition for every input symbol. Symbols in NFA's can have 0+ transitions. - DFA's symbols on its transitions only are all in the alphabet. NFA's can have "ε" symbols at any transition. - DFA's d(state, symbol) = next state NFA's d(state, symbol OR ep) = {poss states} - NFA's "Split" into copies of itself at every decision and run simultaneously. Copy "dies" if there's no exit transition for the next input symbol. - NFA accepts if ANY of thee copies are in an accept state at the end of the input.

What are the differences between a GNFA and an NFA?

- GNFA's transition labels can have any RegEx as its transition labels - NFA's transition labels MUST be within the Alphabet or "ε" - GNFA's reads blocks of input symbols (RegEx's) - NFA's can only read one symbol at a time


संबंधित स्टडी सेट्स

Prep U for Brunner and Suddarth's Textbook of Medical Surgical Nursing, 13th Edition Chapter 40: Assessment of Musculoskeletal Function

View Set

nutrition chapter 9 - water and minerals

View Set

Managerial Accounting Ch 8 connect

View Set

csci 260 midterm <pt 1: revision>

View Set

327 Chapter 28: Patients with Urinary Disorders Q's

View Set

Chapter 9 Explaining Transport Layer Protocol

View Set

Mastering Biology Pollinators II: Chapter 13

View Set