2. Languages Flashcards

1
Q

Alphabet

A

any non-empty finite set Σ

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

Symbols

A

members of the alphabet

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

String

A

finite sequence of symbols

ε = empty string

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

Examples of strings over the alphabet {0,1}

A

over this alphabet = strings in this alphabet

ε, 0, 11001111000101…

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

String Length

A

NOT set cerdinality
|w| = the number of alphabet symbols in the string w
|ε| = 0, |ababb| = 5

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

The set of all strings over Σ

A

Σ*
contains all strings that can be created by symbols from this alphabet
{a}* = {ε, a, aa, aaa, aaaa,…}

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

w,x ∈ Σ*

wx =

A

Concatenation of w and x
ORDER MATTERS
w = ab, x = aabb then xw = aabbab and wx = abaabb

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

For all strings w, wε = εw = ?

A

w, you’re adding nothing

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

w^k

w = string, k = not negative

A
w^k = concatenation of w, k times
w^0 = ε
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

w^R

A

reverse of w

(aabbb)^R = bbbaa

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

when is w a substring of x?

A

when there exists y, z ∈ Σ* (possibly empty) such that x = ywz (y = substring, w = substring, z = substring)

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

when is w a suffix of x?

A

(second half) if there exists y ∈ Σ* (element of all possible strings) such that x = yw

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

when is w a prefix of x?

A

(first half) if there exists y ∈ Σ* (element of all possible strings) such that x =wy

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

Language

A

set of strings made up of symbols from a given alphabet

language OVER Σ = subset of Σ* (alphabet of all possible strings)

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

{a,b}* =

A

all the possible strings you can create with a and b

{ε, a, b, aa, bb, ba, ab, aab,…}

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

Length of string vs cardinality

A

{w ∈ {a,b}* | |w| = 8} describing / defining this language as length of string must be 8
vs
|{ε}| = 1 size of the set

17
Q

Operations on Languages (reminder)
L1 - L2 =
L’ =
|L1|

A

all strings in L1 that are NOT in L2

L' = Σ* - L
|L1| = cardinality
18
Q

Concatenation on Languages
A, C ⊆ Σ*
A = {ab, a} B = {a, ba, aaaa}
𝐴◦𝐵=

A

A and C are subsets of all possible alphabets
𝐴◦𝐵= {ab, a} {a, ba, aaaa} =
aba, abba, abaaaa, aa, aba, aaaaa
ORDER MATTERS, can’t put symbols of B before A

19
Q

Concatenation on Languages

A^k

A

concatenation of k A’s = set of strings formed from concatenating elements of A, k times
A^0 = Ø

20
Q

Kleene Star Operation

A* =

A

A^0 –> A^infinity

ε empty string will always be an element of A*

21
Q

4 Ways to Specify Languages

A
  1. list finite strings
  2. Language operations
    L = {aa, ab}* ⋃ {b}
  3. Description
    L = {w ∈ {a,b}* |w starts with b}
  4. Recursion