M2 | Languages, Encoding, Theorems, and Proofs

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/93

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

94 Terms

1
New cards

An alphabet, often denoted by Σ, is…

A finite set

2
New cards

Which of the following is a string over the alphabet Σ = {a, b, c, ..., z}?

ε

3
New cards

True or False:

A string is a finite sequence of symbols drawn from an alphabet.

True – Strings are made up of symbols from a defined alphabet.

4
New cards

Which of the following is NOT a valid string? Assuming that an alphabet is:

Σ = {a, b, c, ..., z}

1a2b

5
New cards

True or False:

If Σ = {a, b, c, d}, does the string “abcdedcba” belong to that alphabet?

False – The string contains letters outside the alphabet.

6
New cards

True or False:

If Σ = {0, 1}, does the string “010101011” belong to that alphabet?

True – The string only uses symbols 0 and 1.

7
New cards

True or False:

If Σ = {0, 1}, does the string “000000” belong to that alphabet?

True – Only symbols from Σ appear in the string.

8
New cards

What does Σ* (sigma star) represent?

The set of all possible strings over an alphabet including ε

9
New cards

If Σ = {a, b}, which of the following belongs to Σ*?

aa

10
New cards

True or False:

Σ+ (sigma plus) represents the set of all possible strings over an alphabet excluding ε.

True – Σ+ contains all strings of length ≥ 1.

11
New cards

If Σ = {a, b}, which of the following does not belong to Σ+?

ε

12
New cards

How is the length of a string written?

|w|

13
New cards

What is the length of the string “0101110”?

7

14
New cards

What is the length of the empty string ε?

0

15
New cards
16
New cards

If w is a string over an alphabet Σ that has length n, and we write w = w1w2…wn where each wi ∈ Σ, what does w ∉ Σ mean?

w is not a string over the alphabet Σ

17
New cards

What is the reversal of a string w?

The string obtained by writing w in the opposite order

18
New cards

If w = w1w2…wn, how is the reversed string written?

wnwn−1…w1

19
New cards

What does concatenation of strings x and y produce?

The string xy, obtained by appending y to the end of x

20
New cards

If x has length m and y has length n, what is the length of xy after concatenation?

m + n

21
New cards

When is a string S a substring of a string T?

If S occurs contiguously as part of T

22
New cards

True or False:

If S = “aaa” and T = “aabbaa”, S a substring of T

False

23
New cards

If S = “abb” and T = “aabbaa”, is S a substring of T?

Yes

24
New cards

What makes S a proper substring of T?

S is a substring of T and S ≠ T

25
New cards

When is a string S a prefix of T?

If S precedes T

26
New cards

What makes S a proper prefix of T?

S is a prefix of T and S ≠ T

27
New cards

When is a string S a suffix of T?

If S comes after T

28
New cards

True or False:

The empty string ε is a prefix or suffix of every string.

True - because ε occurs at the start or end of any string

29
New cards

What is a language in formal language theory?

A finite or infinite set of strings over an alphabet

30
New cards

If Σ = {a, b}, which of the following is a possible language over Σ?

{ε, a, b, aa, ab, ba, bb, aaa, ...}

31
New cards

True or False:

∅, {ε}, {a, b} can all be languages over Σ

True – This is true because all these are sets of strings over Σ

32
New cards

Which of the following is not a valid language over Σ = {a, b}?

{c, a, aa, aaa, aaaa, aaaaa, ...}

33
New cards

True or False:

Languages are sets, so union, intersection, and set difference can produce new languages.

True - because all these operations on sets result in sets of strings, which are languages

34
New cards

If L1 = {a, b} and L2 = {b, c}, what is L1 ∪ L2?

{a, b, c}

35
New cards

If L1 = {a, b} and L2 = {b, c}, what is L1 ∩ L2?

{b}

36
New cards

Let Σ = {a, b}. Which of the following strings belongs to L1 = {strings with b’s and an even number of a’s}?

b

37
New cards

Which of the following describes L1 ∪ L2?

Let L1 = {strings with b’s and an even number of a’s}
Let L2 = {strings with no b’s}

All strings that contain b's and an even number of a’s plus strings of just a's

38
New cards

True or False:

Let L1 = {strings with b’s and an even number of a’s}
Let L2 = {strings with no b’s}

L1 ∩ L2 = {ε, aa, aaaa, aaaaaa, ...}

True

39
New cards

Which of the following describes L2 − L1?

Let L1 = {strings with b’s and an even number of a’s}
Let L2 = {strings with no b’s}

{a, aaa, aaaaa, aaaaaaa, ...}

40
New cards

True or False:

Let L1 = {strings with b’s and an even number of a’s}
Let L2 = {strings with no b’s}

¬(L2 − L1) = {strings with at least one b} ∪ {strings with an even number of a's}

True

41
New cards

Which of the following correctly describes the concatenation L1 L2?

Let L1 = {cat, dog, mouse, bird}

Let L2 = {bone, food}

{catbone, catfood, dogbone, dogfood, mousebone, mousefood, birdbone, birdfood}

42
New cards

True or False:

Concatenation of two languages L1 and L2 always produces strings that are members of L1 or L2.

True

43
New cards

If L1 = {cat, dog} and L2 = {bone, food}, which string is in L1L2?

catbone

44
New cards

True or False:

L1L2 = L2L1

False

45
New cards

What is included in the Kleene star L* if
L = {dog, cat, fish}?

dogcatfish

46
New cards

True or False:

L* always contains the empty string ε.

True - L* includes all concatenations, including zero concatenations.

47
New cards

Which of the following is in L+ if
L = {dog, cat, fish}?

dog

48
New cards

True or False:

L+ always contains the empty string ε.

False - L+ contains concatenations of one or more elements from L, so ε is never included.

49
New cards

Given an alphabet Σ, the number of different languages L over Σ is given by:

|Σ|

50
New cards

True or False:

If Σ = ∅, then Σ* = {ε}
where Σ* is the largest language
over the alphabet Σ

True - even the empty alphabet produces the empty string.

51
New cards

The set P(Σ*) denotes:

The set of all subsets of Σ*

52
New cards

True or False:

If Σ = {a, b}, then |P(Σ*)| is finite.

False - Σ* is infinite, so its power set is also infinite.

53
New cards

If Σ ≠ ∅, the set of languages over Σ is:

Uncountably infinite

54
New cards

True or False:

If Σ ≠ ∅, then Σ* is uncountably infinite.

False - Σ* is countably infinite; only its power set is uncountably infinite

55
New cards

P(Σ*) is uncountably infinite because:

Cantor’s theorem states that the power set of a countably infinite set is uncountably infinite

56
New cards

True or False:

If Σ = {0,1}, then there exists a bijection between P(Σ*) and the real numbers ℝ.

True

57
New cards

True or False:

Defining a language for a decision problem only requires including the inputs for which the answer is “no.”

False - it should include exactly the inputs for which the answer is “yes”

58
New cards

True or False:

Every decision problem can be represented as a language over some alphabet.

True

59
New cards

If L = {aaa}, is x = aaa in L?

Yes

60
New cards

If L = {aaa}, is y = aba in L?

No

61
New cards

True or False:

If both x and y are in L, then we can conclude x = y.

True - membership in L ensures both strings are identical

62
New cards

True or False:

Encoding strings into a language L is a method used to solve decision problems.

True

63
New cards

For problems that are not already decision problems, what must we do first?

Reformulate the problem as a decision problem

64
New cards

True or False:

Encoding a problem as a language recognition task allows us to check solutions using string membership.

True

65
New cards

Example: Given a list of integers, sort it

In the example of sorting a list, how is the problem encoded?

By examining a pair of lists and checking if the second is the sorted version of the first

66
New cards

True or False:

The encoding of a non-decision problem as a language recognition task always produces multiple languages.

False

67
New cards

Which of the following strings belongs to the language
L = { w1#w2 | w2 is a sorted version of w1 }?

1, 5, 3, 9, 6#1, 3, 5, 6, 9

68
New cards

True or False:

In L, w2 can contain elements not present in w1.

False

69
New cards

How is the problem of executing a database query encoded for language recognition?

By transforming the query and expected reply into a string in a language

70
New cards

True or False:

Evaluating a reply in a language allows us to check correctness of the query result.

True

71
New cards

Which of the following strings belongs to the language
L = { d#q#a | a is the correct result of applying q to d }?

(name, age, phone), (John, 23, 567-1234), (Mary, 24, 234-9876)#(SELECT name FROM . WHERE age = 23)#(John)

72
New cards

True or False:

Let L = { d#q#a | d is an encoding of a database, q is a
string representing a query, and a is the correct result
of applying q to d}

In L, the query string q must exactly match the database encoding d to be valid.

False

73
New cards

What does the language L = { d#q#a } represent in terms of database queries?

Encodings of databases, queries, and correct results

74
New cards

True or False:

Let L = { d#q#a | d is an encoding of a database, q is a
string representing a query, and a is the correct result
of applying q to d}

Any string in L automatically guarantees that the query result a is correct for d and q.

True

75
New cards

Is a mathematical statement proved true

Theorems

76
New cards

Statements that are proven primarily to help prove another, more important statement are called…

Lemmas

77
New cards

Statements that can be easily concluded from a proven theorem are called…

Corollaries

78
New cards
<p>What theorem is this?</p>

What theorem is this?

Corollaries

79
New cards

A proof in mathematics is…

A convincing logical argument that a statement is true

80
New cards

To prove that (A∪B)′ = A′∩B′, we start by showing that…

Every element of one set is also an element of the other and vice versa

81
New cards

If x∈A′∩B′, which of the following is true?

x∉A and x∉B

82
New cards

Mathematical proofs often contain multiple subproofs because:

Each subproof can have a different type of argument

83
New cards

True or False:

A proof in the theory of computation usually contains just one type of argument.

True

84
New cards

The reason for describing different types of arguments in proofs is:

Certain types occur frequently in computation theory

85
New cards

A proof may include several types of arguments because:

Each type handles a different case or subproblem

86
New cards

A theorem that claims a certain type of object exists can be proven by:

Showing how to construct the object

87
New cards

True or False:

A proof by construction demonstrates existence by providing a method to create the object.

True

88
New cards

The reasoning that assumes a statement is false and derives an obviously false consequence is called:

Proof by contradiction

89
New cards

Jack sees Jill, who has just come in from outdoors. On observing that she is completely dry, he knows that it is not raining

In the Jack and Jill example, why does Jack conclude that it is not raining?

Because assuming it is raining leads to a contradiction (Jill would be wet, but she is dry)

90
New cards

True or False:

Proof by contradiction can only be used in mathematics, not in everyday reasoning.

False

91
New cards

Proof by induction is used to:

Show that all elements of an infinite set have a specified property

92
New cards

True or False:

Proof by induction can be applied to verify that a program works correctly for all possible inputs.

True

93
New cards

An example application of proof by induction is:

Showing that an arithmetic expression computes correctly for every assignment to its variables

94
New cards

True or False:

Proof by induction is only applicable to numerical expressions, not programs or logical statements.

False