regular language Flashcards

(34 cards)

1
Q

What is a Finite State Machine?

A

A computational model that can be in one of a finite number of states at any given time. FSMs can have an output (Mealy machines) or no output.

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

What are the key components of a Finite State Machine?

A

States (represented as circles), Transitions (represented as arrows), Start state (indicated by an arrow pointing to it), Accept/stop states (represented by double circles), Inputs (labels on arrows), Outputs (if applicable, separated from inputs with a |)

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

What is a valid stop state in an FSM?

A

A state represented by a double circle that indicates acceptance of the input string.

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

What does the Mealy machine refer to in FSMs?

A

A type of FSM with output where the output values are determined by the current state and the current input.

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

How can you represent an FSM in diagram form?

A

Using state transition diagrams where states are circles, transitions are arrows, inputs label the arrows, and double circles represent accept states.

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

How can you represent an FSM in tabular form?

A

Using state transition tables that show the current state, input, next state, and output (if applicable).

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

What is a set?

A

An unordered collection of values in which each value occurs at most once.

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

What is set comprehension notation?

A

A notation that defines a set by stating the properties that its members must satisfy, e.g., A = {x | x ∈ ℕ ∧ x ≥ 1}

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

What does the empty set represent and what are its symbols?

A

The empty set is the set with no elements. It is represented by {} or Ø.

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

What is the difference between finite and infinite sets?

A

Finite sets contain a countable number of elements up to a particular number, while infinite sets contain an unlimited number of elements.

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

What is a countably infinite set?

A

A set that can be counted off by the natural numbers. Examples include the set of integers and the set of natural numbers.

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

What is the cardinality of a finite set?

A

The number of elements in the set.

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

What is the Cartesian product of sets?

A

The Cartesian product of two sets X and Y, written X × Y, is the set of all ordered pairs (a, b) where a is a member of X and b is a member of Y.

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

What is a subset?

A

Set A is a subset of Set B (written A ⊆ B) if all elements of A are also elements of B.

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

What is a proper subset?

A

Set A is a proper subset of set B (written A ⊂ B) if A is a subset of B, but A ≠ B (i.e., B contains at least one element not in A).

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

What is a countable set?

A

A set with the same cardinality (number of elements) as some subset of natural numbers.

17
Q

What is set membership?

A

The relationship between an element and a set that contains it. If x is an element of set A, we write x ∈ A. If not, we write x ∉ A.

18
Q

What is the union of sets?

A

The union of sets A and B (written A ∪ B) is the set containing all elements that are in A or B or both.

19
Q

What is the intersection of sets?

A

The intersection of sets A and B (written A ∩ B) is the set containing only the elements that are in both A and B.

20
Q

What is the difference of sets?

A

The difference of sets A and B (written A \ B or A - B) is defined as the set containing elements that are in A but not in B: A \ B = {x : x ∈ A and x ∉ B}.

21
Q

What is a regular expression?

A

A way of describing a set using shorthand notation. Regular expressions allow particular types of languages to be described.

22
Q

What does the * metacharacter represent in regular expressions?

A

0 or more repetitions of the preceding element.

23
Q

What does the + metacharacter represent in regular expressions?

A

1 or more repetitions of the preceding element.

24
Q

What does the ? metacharacter represent in regular expressions?

A

0 or 1 repetition of the preceding element (i.e., the element is optional).

25
What does the | metacharacter represent in regular expressions?
Alternation or 'or' - it matches either the expression before or after the symbol.
26
What do parentheses () do in regular expressions?
They group regular expressions together, allowing operations to be applied to the entire group.
27
What is an example of a regular expression and what set does it describe?
a(a|b)* describes the set of strings {a, aa, ab, aaa, aab, aba, ...} - strings starting with 'a' followed by any number of 'a's or 'b's.
28
What is a regular language?
A language is called regular if it can be represented by a regular expression. Equivalently, a regular language is any language that can be accepted by a Finite State Machine.
29
What is the relationship between regular expressions and FSMs?
Regular expressions and FSMs are equivalent ways of defining a regular language. Every regular expression can be converted to an FSM and vice versa.
30
What does the compact representation {0ⁿ1ⁿ | n ≥ 1} mean?
It represents the set of strings with an equal number of 0s followed by 1s, e.g., {01, 0011, 000111, ...}
31
How do you convert a given FSM to a regular expression?
1. Identify the start state and accept states 2. Trace all possible paths from start to accept states 3. For each path, write down the sequence of inputs 4. Combine these sequences using regular expression operators
32
How do you convert a regular expression to an FSM?
1. Break down the regular expression into its components 2. Create states for each component 3. Add transitions between states according to the operations in the expression 4. Mark the final state(s) as accept states
33
What is the difference between a countably infinite set and a non-countable set?
A countably infinite set can be put in one-to-one correspondence with the natural numbers. Non-countable sets (like the real numbers) contain a larger infinity and cannot be paired with natural numbers.
34
What does x ∈ ℕ mean?
x is a member of the set ℕ consisting of the natural numbers {0, 1, 2, 3, 4, ...}