Automata Re-Exam, Finite Automata & Regular Expressions, Chapter 2: Finite Automata

¡Supera tus tareas y exámenes ahora con Quizwiz!

Associativity of union

((R | S) | T) ≡ (R | (S | T))

Associativity of concatenation

((RS)T) ≡ (R(ST))

String

a finite sequence of symbols taken from ∑.

Q

a finite set of states.

a finite set of symbols, called the alphabet of the automaton.

q₀

the initial state from where any input is processed (q₀ ∈ Q).

Right distributive law

(M + N) L = LM + LN

Commutativity of union.

(R | S) ≡ (S | R)

Left distributivity of concatenation over union

(R(S | T)) ≡ ((RS | RT))

Context Free Grammar

A 4-tuple with finite set of grammar rules. Includes a set of non-terminal symbols, a set of terminal symbols, a set of rules, and the start symbol

Nondeterministic Finite Automata (NFA)

A 5 tuple similar to a DFA, allows e-transitions, concurrent moves (two possible transitions) and missing moves

Deterministic Finite Automata (DFA)

A 5-tuple represented by the set of states, the input alphabet, transition function, the start state and the set of accepting states

What is decidability?

A language is called Decidable or Recursive if there is a Turing machine which accepts and halts on every input string w. If a language L is decidable, then its complement L' is also decidable.

DFA

A language model that allows exactly one transition from each state for each symbol.

NFA

A language model that allows exactly zero or more transition from each state for each symbol.

What is subset construction?

A method to convert NFAs to DFAs. 1. Create a state table. 2. Add start state from NFA. 3. Find out the combination of states for each possible input symbol. 4. Repeat step 3 until you have run out of possible DFA states

dead-end state

A state in which there is no path to any accepting state.

rejecting state

A state that is not accepting.

CFG Ambiguity

A string with 2 or more left-most derivations

What is reducibility?

A way of converting one problem to another problem, so that the solution to the second problem can be used to solve the first problem

When is a language accepted or decided?

Accepted: if it enters into a final state for any input string Decided: if it accepts it and enters into a rejecting state for any input not in the language. A language is recursive if it is decided by a Turing machine

How can pumping lemma be used to determine if a language isn't regular?

At first, we have to assume that L is regular. So, the pumping lemma should hold for L. Use the pumping lemma to obtain a contradiction − Select w such that |w| ≥ c, Select y such that |y| ≥ 1, Select x such that |xy| ≤ c. Assign the remaining string to z. Select k such that the resulting string is not in L.

When does a PDA accept a string?

Final State Acceptance: after reading the entire string, the PDA is in a final state. The stack values are irrelevant as long as we end up in a final state. Empty Stack Acceptance: after reading the entire string, the PDA has emptied its stack.

Pumping Lemma for Regular Grammars

For every regular language L, There exists a constant n For every string w in L such that |w| >= n, There exists a way to break up w into three strings w = xyz such that |y| > 0 , |xy| <= n and For every k>=0 , the string xykz is also in L.

Type 2 Grammar

Generates context-free languages. The productions must be in the form A → γ, where A ∈ N (Non terminal) and γ ∈ (T∪N)* (String of terminals and non-terminals). These languages generated by these grammars are be recognized by a non-deterministic pushdown automaton.

Type 3 Grammar

Generates regular languages. The productions must be in the form X → a or X → aY, where X, Y ∈ N (Non terminal) and a ∈ T (Terminal). The rule S → ε is allowed if S does not appear on the right side of any rule.

one

If a dead-state is required, only ___ is needed.

When is a problem NP-complete?

If the problem is in the NP class and every problem in NP can be reduced to it in polynomial time

How can I convert a CFG into CNF?

If the start symbol S occurs on some right side, create a new start symbol S' and a new production S' → S. Remove Null productions. (For each production A → a, construct all productions A → x where x is obtained from 'a' by removing one or multiple nullable non-terminals) Remove unit productions. (To remove A → B, add production A → x to the grammar rule whenever B → x occurs in the grammar) Replace each production A → B1...Bn where n > 2 with A → B1C where C → B2 ...Bn. Repeat this step for all productions having two or more symbols in the right side. If the right side of any production is in the form A → aB where a is a terminal and A, B are non-terminal, then the production is replaced by A → XB and X → a. Repeat this step for every production which is in the form A → aB.

How can you turn an NFA to a DFA?

If there are e-transitions, You need to use subset construction.

What is a Grammar?

It is a 4 tuple where there is a set of non-terminal symbols, a set of terminal symbols, a start symbol, and production rules for the non-terminal and terminal symbols

Left distributive law

L (M + N) = LM + LN

Union ( | )

L(R | S) = L(R) ∪ L(S). Identity: R ε = ε R = R Annihilator: ∅ L = L ∅ = ∅

(LR)*L =

L(RL)*

Concatenation

L(RS) Identity: R + ∅ = ∅ + R = R

Types of derivations of strings

Leftmost derivation − A leftmost derivation is obtained by applying production to the leftmost variable in each step. The leftmost derivation for the string "a+a*a" may be − X → X+X → a+X → a+ X*X → a+a*X → a+a*a Rightmost derivation − A rightmost derivation is obtained by applying production to the rightmost variable in each step. The rightmost derivation for the above string "a+a*a" may be − X → X*X → X*a → X+X*a →X+a*a → a+a*a

What is a Turing Machine (TM)?

a mathematical model which consists of an infinite length tape divided into cells on which input is given. It consists of a head which reads the input tape. A state register stores the state of the Turing machine. After reading an input symbol, it is replaced with another symbol, its internal state is changed, and it moves from one cell to the right or left. If the TM reaches the final state, the input string is accepted, otherwise rejected.

F

a set of final state/states of Q (F ⊆ Q).

Pattern

a set of objects with some recognizable property

Language

a subset of ∑* for some alphabet ∑. It can be finite or infinite.

How does a transition on a PDA look?

a, b -> c: where a is the input symbol, b is the stack top symbol, and c is the symbol being pushed on the stack

What is a derivation tree?

an ordered rooted tree that graphically represents the semantic information of a string derived from a context-free grammar. Root vertex − Must be labeled by the start symbol. Vertex − Labeled by a non-terminal symbol. Leaves − Labeled by a terminal symbol or ε.

Alphabet

any finite set of symbols.

How can a TM be formally described?

as a 7-tuple (Q, X, ∑, δ, q0, B, F) where − Q is a finite set of states, X is the tape alphabet, ∑ is the input alphabet, δ is a transition function, q0 is the initial state, B is the blank symbol, F is the set of final states

How do you design a TM?

assume that the input string is terminated by a blank symbol, B, at each end of the string. Let q0 be the initial start state. At each state determine what happens when the TM reads in each potential input symbol until B is reached

What is a multi-tape Turing Machine?

can be formally described as a 6-tuple (Q, X, B, δ, q0, F) where − Q is a finite set of states, X is the tape alphabet, B is the blank symbol, δ is a relation on states and symbols, where there is k number of tapes, q0 is the initial state, F is the set of final states

Pushdown Automata

can be formally described as a 7-tuple (Q, ∑, S, δ, q0, I, F) − Q is the finite number of states, ∑ is input alphabet, S is stack symbols, δ is the transition function, q0 is the initial state (q0 ∈ Q), I is the initial stack top symbol (I ∈ S), F is a set of accepting states (F ∈ Q)

Type 1 Grammar

generate context-sensitive languages. The productions must be in the form α A β → α γ β, where A ∈ N (Non-terminal) and α, β, γ ∈ (T ∪ N)* (Strings of terminals and non-terminals). The strings α and β may be empty, but γ must be non-empty. The languages generated by these grammars are recognized by a linear bounded automaton.

Type 0 Grammar

generate recursively enumerable languages. The productions have no restrictions. They are any phase structure grammar including all formal grammars. They generate the languages that are recognized by a Turing machine.

Chomsky Normal Form

the Productions are in the following forms − A → a A → BC S → ε where A, B, and C are non-terminals and a is terminal.

Length of a String

the number of symbols present in a string. (Denoted by |S|).

δ

the transition function.

Undecidable Languages

there is no Turing Machine which accepts the language and makes a decision for every input string w. Examples: The halting problem of Turing machine, The mortality problem

Idempotent law

R | R ≡ R

(a + b)*

= (a*b*)* = (a* + b*)* = (a + b*)* = a*(ba*)*

A U B

Union - All elements in A or B

Right distributivity of concatenation over union

((S | T)R) ≡ ((SR | TR))

How is a pushdown automaton different than a finite automaton.

Basically a "Finite state machine" + "a stack" A pushdown automaton has three components − an input tape, a control unit, and a stack with infinite size. The stack head scans the top symbol of the stack. A PDA may or may not read an input symbol, but it has to read the top of the stack in every transition

How do you verify if a problem is in NP?

By demonstrating that a candidate solution can be verified in polynomial time

Regular Expressions

Can be the empty string, empty set/language, individual input symbols, X + Y = L(X) ∪ L(Y), X. Y = L(X). L(Y), R* = (L(R))*. Ex: (a + b)*abb = Set of strings of a's and b's ending with the string abb, So L = {abb, aabb, babb, aaabb, ababb, ...}

What problems belong in the NP class?

Complex problems that can be verified in polynomial time. contains problems we would love to solve but are unable to do so exactly. It means that it is possible to "guess" the solution (by some nondeterministic algorithm) and then check it

How can I convert a CFG into a PDA?

Convert the productions of the CFG into GNF. The PDA will have only one state {q}. The start symbol of CFG will be the start symbol in the PDA. All non-terminals of the CFG will be the stack symbols of the PDA and all the terminals of the CFG will be the input symbols of the PDA. For each production in the form A → aX where a is terminal and A, X are combination of terminal and non-terminals, make a transition δ (q, a, A).

How do you create a DFA?

Decide what the machine needs to remember to decide if a string is in the language. At each state determine what happens when each available input symbol is read.

A - B

Difference - Elements in A but not B

DFA & NFA Equivalence

Every DFA is an NFA. Every NFA has an equivalent DFA by Construction

How can I use pumping lemma for CFGs?

Let L be context free. Then, L must satisfy pumping lemma. At first, choose a number n of the pumping lemma. Break z into uvwxy, where |vwx| ≤ n and vx ≠ ε. If L is a context-free language, there is a pumping length p such that any string w ∈ L of length ≥ p can be written as w = uvxyz, where vy ≠ ε, |vxy| ≤ p, and for all i ≥ 0, uvixyiz ∈ L

reflexive, transitive

List two properties of the empty closure.

L+

One or more iterations of L

What problems belong in the P class?

Problems that can be decided by an algorithm whose running time is bounded by a polynomial. contains all of the problems we solve using computers.

How can I turn a DFA into a Regular Expression?

Start by adding a new start and final state that point to the original. Then one state at a time, remove it and replace with an equivalent regular expression. Repeat this until only the new start and final state are left.

How can you construct a grammar that generates a language?

Start by creating a list of accepted strings, look for the patterns and create production rules that fit those patterns.

Kleene Star

The set ∑* is the infinite set of all possible strings of all possible lengths over ∑ including λ. ≡ R*R* ≡ (R*)* ≡ ε + RR* ≡ ε + R*R

Kleene Closure/Plus

The set ∑+ is the infinite set of all possible strings of all possible lengths over ∑ excluding λ. ≡ RR* ≡ R*R ≡ (RR* | ε)

True

The start state of the equivalent language models DFA M and NFA N is the same. (True/False)

subsets

The states of DFA M are _______ of the states of NFA N.

What are the different approaches to drawing a derivation tree?

Top-down approach: Starts with the starting symbol S. Goes down to tree leaves using productions Bottom-up approach: Starts from tree leaves. Proceeds upward to the root which is the starting symbol S

equivalent

Two language models are ________ if the set of languages they accept are equal.

When are context free languages closed?

Union, Concatenation, Kleene Star operation

How do you create an NFA?

What should you let the machine guess? Then begin developing the transition function based on the language criteria

L*

Zero or more iterations of L

DFA, NFA

___ is an ___. (DFA/NFA)

a Regular Expression denoting an empty set of strings. (L (∅) = { })

ε

a Regular Expression that indicates the language containing an empty string. (L (ε) = {ε}) ≡ ∅* ≡ ε*

x

a Regular Expression where L={x} = {x}


Conjuntos de estudio relacionados

Topic 3.1 2 & 3 Economics Key terms and Assessment Questions

View Set

Vocabulary Workshop-Level D Unit 5

View Set

NCLEX Study questions for Chapter 22

View Set

Chapter 9: Long-Run Economic Growth

View Set

JCM 103 Final Exam (Quiz Questions)

View Set

Nursing Lifespan of Older Adults

View Set