Language & Computation Flashcards

TW3V19002 UU

1
Q

Formal automata

A

Models with step by step computation.

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

Formal grammars

A

Recipes to create patterns and sentences.

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

List the four language types from Chomsky’s hierarchy from simplest to most complicated:

A
  1. Regular
  2. Context-free
  3. Context-sensitive
  4. Recursively enumerable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

List the four automata from Chomsky’s hierachy from simplest to most complicated:

A
  1. Finite state
  2. Pushdown
  3. Linearly bounded
  4. Turing machine
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the language and automaton of the type 3 grammar in Chomsky’s hiearchy:

A

Type 3 grammar has a regular language and a finite state automaton.

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

Describe the language and automaton of the type 2 grammar in Chomsky’s hiearchy:

A

Type 2 grammar has a context-free language and a pushdown automaton.

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

Describe the language and automaton of the type 1 grammar in Chomsky’s hiearchy:

A

Type 1 grammar has a context-sensitive language and a linearly bounded automaton.

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

Describe the language and automaton of the type 0 grammar in Chomsky’s hiearchy:

A

Type 0 grammar has a recursively enumerable language and a turing machine.

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

What is the trade-off found in Chomsky’s hierarchy concerned with?

A

Expressivity and complexity.

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

Greater expressivity requires…

A

greater complexity.

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

What does a(n English) syllable consist of?

A

The onset, the nucleus and the coda.

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

Concatenation

A

One symbol after another that form a sequence.

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

In what three ways can you make combinations in the formal grammar RegEx?

A
  1. Concatenation
  2. Choice
  3. Repetition
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

FSA

A

finite state automaton

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

What is the problem for finite automata on palindroms?

A

The computational power is not enough, it does not have any memory.

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

How is the stack of a pushdown automaton organized?

A

First In, Last Out

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

FILO

A

first in, last out

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

PDA

A

Pushdown automaton

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

Which grammar types have polynomial complexity?

A

Type 3 and type 2.

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

FA

A

finite automaton

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

The program (in FA/FSA)

A

The finite set of instructions for changing from state to state while reading.

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

Deterministic FA

A

FAs where there is only one instruction for each combination of state and read symbol.

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

State diagram

A

A representation for an FA in which each state is a circle and the instructions are arrows.

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

Give the formal definition of a deterministic FA:

A

A deterministic FA M is a quintuple [K, Sigma, delta, q0, F] with
K = finite set of states,
Sigma = finite set (the alphabet),
Q0 E K = the initial state,
F [subset] K = set of final states,
delta = f: K x Sigma -> K (the transition function).

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

Give the formal definition of a situation in a deterministic FA:

A

Given a dFA M = [K, Sigma, d, q0, F], a situation of M is a triple (x,q,y) where q E k and x,y E Sigma^x.

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

Lemmatization

A

The task of determining that two words have the same root

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

Stemming

A

A simple form of lemmatization where suffixes are stripped from the end of the word.

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

Sentence segmentation

A

Breaking up a text into individual sentences using cues like periods or exclamation points.

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

Concatenation

A

Putting characters in sequence.

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

What is the hierachy in regex?

A
  1. Parentheses ()
  2. Counters *, +, ? and {}
  3. Sequences and anchors ^, $
  4. Disjunction |
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What is precision?

A

Minimise false positivies.

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

Recall

A

Minimize false negatives

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

Regex: find a pattern that contains either t or T.

A

/[tT]/

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

Regex: find a pattern that matches ‘tea’ or ‘Tea’.

A

/[tT]ea/

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

Regex: find any number in range 2, 3, 4, or 5.

A

/[2-5]/

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

Regex: find any letter in range c, d, e, f, g, h.

A

/[c-h]/

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

Regex: find any upper case letter.

A

/[A-Z]/

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

Regex: find any lowercase letter.

A

/[a-z]/

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

Regex: find any single digit.

A

/[0-9]/

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

Regex: find any single character, except f.

A

/[^f]/

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

Regex: find any single character, but neither a nor A.

A

/[^aA]/

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

Regex: find either f or ^.

A

/[f^]/

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

Regex: find the pattern c^f.

A

/c^f/

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

Regex: find ‘horse’ or ‘horses’.

A

/horses?/

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

Regex: what does ? mean?

A

The preceding character or nothing.

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

Regex; what does * mean?

A

Zero or unbounded amount of the previous character

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

/aa*/ (regex)

A

Any string of one a followed by zero or more a’s

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

What does . mean in regex?

A

It’s a wildcard, any single character.

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

How do you search for the start of a line with regex?

A

/^/

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

How do you search for the end of a line with regex?

A

$

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

How do you search for a word boundary in regex?

A

\b

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

How do you search for a non-word boundary in regex?

A

\B

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

How do you use the . as an actual dot in regex?

A

.

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

How do you show disjunction in regex?

A

|

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

How do you search for either ‘cat’ or ‘dog’ in regex?

A

/cat|dog/

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

When do you use parentheses in regex?

A

When you want the sequence to act as a single character to the operators around it.

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

How do you look for as little text as possible when using a Kleene star?

A

*?

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

How do you look for as little text as possible when using a Kleene plus in regex?

A

+?

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

How do you look for exactly x occurrences of the previous character?

A

/character{x}/

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

What is a shortcut in regex for any alphanumeric/underscore character?

A

\w

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

What is a shortcut in regex for any digit?

A

\d

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

Give the shortcut in regex for any non-digit:

A

\D

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

Give the shortcut in regex for any non-alphanumeric:

A

\W

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

Give the shortcut to look for a whitespace in regex:

A

\s

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

Give the shortcut in regex for a non-whitespace:

A

\S

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

How do you search for a - b occurrences of the previous char in regex?

A

/char{a-b}/

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

How do you look for at least n occurrences of the previous in regex?

A

/char{n,}/

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

How do you look for up to m occurrences of the previous in regex?

A

/char{,m}/

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

How do you search for the asterisk in regex?

A

*

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

How do you search for the question mark in regex?

A

\?

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

How do you find a newline in regex?

A

\n

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

How do you find a tab in regex?

A

\t

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

When do you use \1 in regex?

A

To refer to whatever string matched the first item in parentheses.

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

What do you use when you don’t want to capture the group between parentheses in regex?

A

(?:pattern)

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

Fragment

A

broken-off word

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

Lemma

A

Set of lexical forms having the same stem, pos and word sense.

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

Word form

A

The full inflected or derived form of the word.

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

Types (in corpora)

A

The number of distinct words in a corpus.

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

Tokens (in corpora)

A

Total number N of running words

80
Q

Heardan’s law =

A

Heap’s law

81
Q

Heap’s law

A

The relationship between the number of types |V| and number of tokens N.
|V| = k * N^beta

82
Q

What 3 things are commonly applied when normalizing text?

A
  1. Tokenizing words
  2. Normalizing word formats
  3. Segmenting sentences
83
Q

Named entity recognition

A

The task of detecting names, dates and organization.

84
Q

Clitic

A

Part of a word that can’t stand on its own, but has be attached to another word.

85
Q

What two parts do most tokenization schemes consist of?

A
  1. Token learner
  2. Token segmenter
86
Q

What does a token learner do in tokenization?

A

It takes the raw training corpus and induces vocabulary.

87
Q

What does a token segmenter do in tokenization?

A

It takes a raw test sentence and segments it into tokens in vocabulary (set of all individual characters). Chooses the 2 most frequent adjacent and adds the merged symbol to vocabulary, changes all occurrences in corpus to merged symbol. Continues until k new tokens have been created.

88
Q

Coreference task

A

Task of deciding whether two strings refer to the same entity.

89
Q

Alignment

A

Given two sequences, an alignment is a correspondence between substrings of the two sequences.

90
Q

Levenshtein distance

A

The simplest weighting factor in which each of the 3 operations has a cost of 1.

91
Q

By what 3 atomic shapes are regular expressions defined?

A
  1. a for any alphabet symbol a in Sigma (recognizes a)
  2. Epsilon (recognizes empty string)
  3. Empty set (recognizes no string)
92
Q

By what 3 operations are regular expressions defined?

A
  1. Choice (U symbol)
  2. Concatenation
  3. Repetition
93
Q

What does + mean in regex?

A

the previous character one or more times/

94
Q

How do you search for words with an even number of symbols in regex?

A

(..)*

95
Q

In what automaton is it allowed to move states without reading a symbol?

A

In non-deterministic FSAs

96
Q

When is a string accepted by a non-deterministic FSA?

A

Iff there is some path through the state diagram which begins in the initial state, reads the entire input and ends in the final state.

97
Q

NFA

A

non-deterministic finite automaton

98
Q

What allows for non-transitivity in NFAs?

A

The fact that delta is a relation and not a function.

99
Q

What is the relation between DFAs and NFAs?

A
  1. DFAs are a proper subclass of NFAs.
  2. NFAs accept exactly the same class of languages as DFAs.
100
Q

Is the empty set a regular language?

A

Yes.

101
Q

If A and B are regular languages, so are

A

The union of A and B
AB

102
Q

What is the use of the pumping lemma?

A

Showing that certain languages are not fal’s. May not prove useful in other cases even though the language in question is not a fal.

103
Q

Pumping lemma (theorem in their book) for FALs:

A

If L is an infinite fal over alphabet sigma, then there are strings x, y and z in sigma* such that y is not e and x*(y^n)z is in L for all n>=0.

104
Q

What are the two types of pronominal subject doubling?

A
  1. Clitic doubling
  2. Topic doubling
105
Q

Where does clitic doubling occur?

A

In subclauses and inverted main clauses.

106
Q

Where does topic doubling occur?

A

In subject-initial main clauses.

107
Q

Clitic doubled subject

A

A subject consisting of a clitic and a strong pronoun, taken as one merged DP.

108
Q

Topic doubled subject

A

A subject that involves a non-clitic pronoun doubled by a strong pronoun.

109
Q

Tripling

A

When a strong pronoun is both part of clitic doubling and topic doubling in one sentence.

110
Q

How do you make a DFA out of a NFA?

A
  1. The DFA set of states is the power set of the NFA states.
  2. Initital states = readable from q0 without any input.
  3. Final state = any set of states that contains a final state of the NFA.
  4. Transition function; what set can be reached from this state?
111
Q

What is the complexity of DFAs?

A

linear, does not depend on the size of the automaton.

112
Q

What is the distinguishing factor between regular languages and context-free languages?

A

self-embedding

113
Q

What are the two operations on a stack?

A
  1. Push
  2. Pop
114
Q

Push operation on stack

A

Add something to the top of the stack

115
Q

Pop operation on stack

A

Remove something from the top of the stack

116
Q

The PDA transition function delta is a function such that…

A

The input is a 3-tuple (current state, input symbol, stack symbol to access/pop).
The output is a set of 2-tuples (next state, stack symbol/string to write/push).

117
Q

Name the two main strategies of procesing context-free languages:

A
  1. Top-down
  2. Bottom-up
118
Q

How does top-down processing of CFLs work?

A

CFG: build a tree from root to leaves
PDA: read in epsilon and push symbols unto the stack, then read input symbols and pop symbols from the stack.

119
Q

How does bottom-up processing work for CFLs?

A

CFG: build a tree from leaves to root.
PDA: Read input symbols and push symbols onto the stack, then read in epsilon and pop symbols from stack.

120
Q

What two examples were mentioned in lecture that are impossible to capture with CFGs/PDAs?

A
  1. a^n b^n c^n
  2. w^2
121
Q

Can all regular languages be modelled with a PDA?

A

Yes

122
Q

Are all context-free languages regular?

A

No

123
Q

Can all context-free languages be modelled with an FSA?

A

No

124
Q

When does a PDA accept a string?

A
  1. The entire input has been read
  2. The PDA is in a final state
  3. The stack is empty
125
Q

When is a PDA non-deterministic?

A

If there is more than one move available to the automaton in certain situations.

126
Q

Can deterministic PDAs have no move available for a situation?

A

Yes, it is only required that in no situation there is more than one move.

127
Q

Do non-deterministic PDAs accept exactly the languages generated by context-free grammars?

A

Yes.

128
Q

Are natural languages context-free?

A

No, because cross-serial dependency.

129
Q

PaQu (abbreviation)

A

Parse and Query application

130
Q

What is the Parse and Query application (PaQu)?

A

A web application for searching in Dutch treebanks and for analysing search results.

131
Q

Treebank

A

A text corpus in which each sentence has been assigned a syntactic structure.

132
Q

What part of natural language is a regular language mostly used for?

A

Phonology and most morphology.

133
Q

What part of natural language is a finite dictionary mostly used for?

A

Lexicon

134
Q

What part of natural language is a context-free grammar mostly used for?

A

Some syntax.

135
Q

What part of natural language is a contxt-sensitive grammar mostly used for?

A

Syntax

136
Q

What formal grammar can you use the best if you want to describe syntax?

A

Context-free or context-sensitive.

137
Q

What formal grammar can you use best if you want to describe phonology or morphology?

A

Regular language

138
Q

When is a context-free grammar G ambiguous?

A

If at least one word has multiple left-most derivations or multiple trees.

139
Q

When is a language L ambiguous?

A

If all grammars that generate L are ambiguous.

140
Q

If every grammar you can possibly create for the language creates two or more trees for some word,…

A

you have an ambiguous language.

141
Q

Can regular languages be represented with CFGs?

A

Yes

142
Q

A grammar is regular if and only if in every rule A -> u, …

A

u has no more than one nonterminal symbol,
AND
this nonterminal symbol is always at the beginning or always at the end of u.

143
Q

A CFG is self-embedding if…

A

there is a nonterminal A that can be rewritten to itself with non-empty strings before and after:
A -> uAv with u and v are both non-empty

144
Q

What distinguishes regular languages from context-free languages?

A

Self-embedding:
every self-embedding language is non-regular and every non-regular CFL is self-embedding.

145
Q

What are the two main strategies of processing (parsing) CFLs?

A
  1. Top-down (root to leaves)
  2. Bottom-up (leaves to root)
146
Q

Why is it impossible to get a^nb^nc^n pattern with CFG?

A

This pattern requires a memory beyond FILO.

147
Q

What does P(w|h) denote?

A

The probability that word w will occur given word h.

148
Q

Markov assumption

A

The assumption that the probability of a word depends only on the previous word.

149
Q

MLE (abbreviation)

A

Maximum likelihood estimation

150
Q

Relative frequency

A

The observed frequency of a particular sequence divided by the observed frequency of a prefix.

151
Q

Extrinsic evaluation

A

Evaluation where the language model is embedded in an application and it is measured how the application improves.

152
Q

Intrinsic evaluation

A

Evaluation where the quality of a language model is measured independently of any application, using a test and training set.

153
Q

Perplexity

A

A probability-based metric for accuracy.

154
Q

What is the usual division between training, development and test sets?

A

80% training, 10% devset and 10% testing.

155
Q

PPL (abbreviation)

A

Perplexity

156
Q

Minimizing perplexity is equivalent to…

A

maximizing the test set probability according to the language model.

157
Q

What is the branching factor of a language?

A

The number of possible next words that can folow any word.

158
Q

What is a requirement for comparing the perplexity of two language models?

A

The models need to be using identical vocabularies.

159
Q

For what 2 reasons are zero probabilities a problem?

A
  1. Problem of sparsity: there are always some valid sequences missing from corpus.
  2. Can’t compute perplexity, then we would need to divide by 0.
160
Q

OOV (abbreviation)

A

out of vocabulary

161
Q

OOV rate

A

The percentage of OOV words that appear in the test set.

162
Q

Laplace smoothing

A

A type of smoothing where all n-gram counts are raised by 1,

163
Q

What smoothing methods require discounting to create a probability distribution?

A

Back off and interpolation.

164
Q

How are regular languages defined?

A

Through FSAs and regular expressions.

165
Q

All strictly local languages are…

A

regular.

166
Q

Strictly local language

A

A regular language where all dependencies fit into a finite (max n ) sliding window of analysis.

167
Q

How do you ensure that dependence of a symbol on other symbols is at a distance =< n in a strictly local FSA?

A

Have exactly one state for every sequence of up to n-1 symbols + a sink state. Every state is only reachable through one particular sequence of symbols.

168
Q

Formal grammar (non-mathematical definition)

A

A deductive system of axioms and rules of inference, which generates the sentences of a language as its theorems.

169
Q

What two types of alphabets do formal grammars use?

A

A terminal alphabet and a non-terminal alphabet.

170
Q

What is the relation between the two alphabets used by a formal grammar?

A

They are disjoint (the terminal and the non-terminal alphabet).

171
Q

What is a constraint on the left side of a rule in a formal grammar?

A

The string on the left side of a rule cannot consist entirely of terminal symbols.

172
Q

What is the form of each rule in a type 1 formal grammar?

A

alpha A beta -> alpha psi beta

With alpha, psi, beta = arbitrary strings over the union of terminal and non-terminal symbols and A= non-terminal symbol.

173
Q

What is the form of each rule in a type 2 formal grammar?

A

A -> psi

With alpha, psi, beta = arbitrary strings over the union of terminal and non-terminal symbols and A= non-terminal symbol.

174
Q

What is the form of each rule in a type 3 formal grammar?

A

A -> x B or A -> x

With alpha, psi, beta = arbitrary strings over the union of terminal and non-terminal symbols and A= non-terminal symbol.

175
Q

The type 3 languages are properly included in…

A

The type 2 languages.

176
Q

Type 2 languages not containing the empty string are properly included in…

A

the type 1 languages

177
Q

The type 1 languages are properly included in…

A

the type 0 languages.

178
Q

How can we prove that English is not a natural language?

A

By using the pumping theorem and the fact that regular languages are closed under intersection.

179
Q

FAL (abbreviation)

A

Finite automaton language

180
Q

What do we do if we can’t model a natural language with a regular language?

A

We go up one level of complexity: to context-free languages (CFL).

181
Q

Under what operations are regular languages closed?

A
  1. Boolean operations
  2. Union
  3. Intersection
  4. Complement
  5. Difference
182
Q

What operations on strings in a regular language yield another regular language?

A
  1. Concatenation
  2. Repetition
  3. Choice
183
Q

How do you model the expression ‘all X are Y’ using regex?
Given alphabet {0,1} with
1= X that is Y and
0= X that is not Y.

A

/1*/
there are only 1s, Xs that are Y

184
Q

How do you model the expression ‘Some X is Y’ using regex over an alphabet {0,1} with 1= X that is Y and 0= X that is not Y?

A

/.1./
There is at least one 1 among all Xs.

185
Q

How do you model the expression ‘No X is Y’ using regex over alphabet {0,1} with 1= X that is Y and 0= X that is not Y?

A

/0*/
There are only 0s, Xs that are not Y.

186
Q

How do you model the expression ‘Not all X are Y’ using regex over the alphabet {0,1} with 1=X that is Y and 0= X that is not Y?

A

/.0./
There is at least one 0 ampng all Xs.

187
Q

Why are we unable to model the expression ‘There are as many 1s as 0s’ with regex?

A

You need to remember how many 0s and 1s you’ve seen in order to check this, so it requires some form of memory.

188
Q

Why can’t we model the pattern a^nb^n using regex?

A

It requires some type of memory: we need to have seen as many a’s as b’s at the end of reading the string.

189
Q

What does this pattern consist of: (ww)^R

A

R = reverse, so if ww = ab then the pattern will be abba.

190
Q

What four elements does a context-free grammar (CFG) consist of?

A
  1. Alphabet N of nonterminal symbols.
  2. Alphabet Sigma of terminal symbols.
  3. Set of rules P, pairs of a nonterminal symbol and string of terminal/nonterminal symbols.
  4. Start symbol S, element in N.
191
Q

How do we define a language of a context-free grammar (CFG)?

A

The set of all strings of terminal symbols that can be derived from the start symbol, S, in zero or more steps.

192
Q

When do we speak of leftmost derivation of S -> w?

A

If only the leftmost auciliary symbol is rewritten at every step.

193
Q

Every leftmost derivation corresponds to exactly one…

A

tree diagram

194
Q

When is a context-free grammar (CFG) self-embedding?

A

If there is a nonterminal A that can be rewritten to itself with non-empty strings before and after.

195
Q

When is a language self-embedding?

A

If all grammars that describe this language are self-embedding.

196
Q

What type of grammar allows a nonterminal X to be rewritten to aXb, so can match an ‘a’ to a ‘b’ at an arbitrary distance?

A

A context-free grammar (CFG)