instruction stringlengths 0 29.8k ⌀ |
|---|
Prove $a^nb^m; n>m \geq 0$ is not regular by the pumping lemma |
I want to prove this language $L=\{a^nb^{n^2+n}:n\in\Bbb N\}$ to be nonregular by the pumping lemma. This is my attempt, is this a correct way of doing it?
Let's suppose $L$ is regular. Let $s = a^kb^{k^2+k}$ such that $k \geq 0$ as a pumping length. So we have $s \in L$ and $|s| \geq k$.
Then, by the pumping le... |
Prove $a^nb^{n^2+n}$ is not regular by the pumping lemma |
If you consider a grammar $(N, \Sigma, P, S)$ you could actually give a regular expression for the production rules $P$, which pretty much determines the whole grammar:
$$r = S \to (\bar{N} + \bar{\Sigma})^\ast (| (\bar{N} + \bar{\Sigma})^\ast)^\ast (, \bar{N} \to (\bar{N} + \bar{\Sigma})^\ast (| (\bar{N} + \bar{\Sigm... |
null |
If you consider a grammar $(N, \Sigma, P, S)$ you could actually give a regular expression for the production rules $P$, which pretty much determines the whole grammar:
$$r = S \to (\bar{N} + \bar{\Sigma})^\ast (| (\bar{N} + \bar{\Sigma})^\ast)^\ast (, \bar{N} \to (\bar{N} + \bar{\Sigma})^\ast (| (\bar{N} + \bar{\Sigm... |
You have to _prove or disprove_.
L* _always_ contains the empty string and is therefore not empty. "L* is empty" is a false statement. Anything follows from a false statement. So yes, if L* is empty (which it cannot be) then L is infinite. L is also finite. And empty. And anything else, and all at the same time.
... |
I proved this language $L = a^nb^nc^m; n,m \geq 0$ is not regular the following way:
Let $L \cap a^*b^* = a^nb^n$
We know that $a^nb^n$ is not regular, and $a^*b^*$ is regular. Thus, if $L$ is regular, then $a^nb^n$ is too, but since the latter is not, $L$ is not. Is that safe to have as a proof? |
prove $a^nb^nc^m; n,m \geq 0$ by the pumping lemma |
|regular-languages|pumping-lemma| |
What you wrote is a proof. If this is course work someone might claim it didn't use the pumping lemma - zero points for a perfectly fine proof.
There is a general version of the pumping lemma. Instead of having a string w and splitting it into w = xyz you can have a string uwv and split it into uxyzv with the same ... |
The general pumping lemma tells us that any language L' which is a set of substrings of strings in L must fulfil the pumping lemma for L to be regular (L' need not be regular but must fulfil the pumping lemma). Every string $a^n b^n$ is a substring of a string in L, the language L' = $a^n b^n$ has often been proved irr... |
Consider the language definition:
$L = \{<M>| M$ is a DFA and $M$ accepts some string of the form $ww^{r}$ for some $w\in \Sigma^{*}$\}$
The language $L$ is :
A) Regular
B) Context-free but not regular
C) Recursive but not context-free
D) Recursive enumerable but not recursive
**Solution provided:*... |
What machines are required to solve the emptiness of regular and context-free langauges? |
|formal-languages|undecidability| |
The general pumping lemma tells us that any language L' which is a set of substrings of strings in L must fulfil the pumping lemma for L to be regular (L' need not be regular but must fulfil the pumping lemma). Every string $a^n b^n$ is a substring of a string in L, the language L' = $a^n b^n$ has often been proved irr... |
Let's assume that $L_1 = a^nb^{2n}$ and $L_2 = a^na^{2n}$, knowing that $L_1$ is not regular, and $L_2$ is. We also know that regular languages are closed under intersection and union. What can we say about $L_3 = L_1^\complement$ and $L_4 = L_2^ \complement$?
It seems correct to say $L_4$ is regular, because $L_2$ ... |
regular languages under intersection and union, a bit of confusion to clarify |
|regular-languages|pumping-lemma| |
Let's assume that $L_1 = a^nb^{2n}$ and $L_2 = a^na^{2n}$, knowing that $L_1$ is not regular, and $L_2$ is. We also know that regular languages are closed under intersection and union, and complement. What can we say about $L_3 = L_1^\complement$ and $L_4 = L_2^ \complement$?
It seems correct to say $L_4$ is regular... |
Since $L_3$ is the complement of $L_1$, $L_1$ is likewise the complement of $L_3$. If $L_3$ was regular, what would that imply regarding the regularity of $L_1$?
For $L_5$ and $L_6$, consider for example the case where the two languages are each others' complements. Can you determine what languages result from the u... |
$K\cdot K^r \neq \{\; ww^w\mid w\in K\;\}$. |
I want to prove this language $a^nb^m; 0 \leq n< 3m+2$ to be not regular by the pumping lemma. This is my attempt, is this a correct way of doing it?
Let's suppose $L$ is regular. Let $s = a^{3k+1}b^{k}$ such that $k \geq 0$ as a pumping length. So we have $s \in L$ and $|s| \geq k$.
Then, by the pumping lemma, ... |
prove $a^nb^m; n<3m + 2$ is not regular by the pumping lemma |
|regular-languages|pumping-lemma| |
prove $a^nb^nc^m; n,m \geq 0$ |
Note that a string in $K\cap K^r$ is not necessarily a palindrome. |
null |
The question of the relationship between Kolmogorov complexity and data compression is rather difficult.
However, at the heuristic level, the complexity of an object and the rate of its compression by known algorithms *are related*.
I used the built-in function Compress[] of Mathematica to estimate the compression ... |
Kolmogorov complexity and data compression revisited |
|complexity-theory|data-compression|heuristics| |
GAP is a computer algebra system (CAS) that Wikipedia tells me is written in C, a procedural programming language. Does this mean we can say GAP's language is procedural? Or is this characterization a misunderstanding of what a CAS is, and what programming paradigms are? |
Does it make sense to call GAP a "procedural" language? |
|functional-programming|programming-paradigms| |
For most programming languages (or what I know), the runtime is mostly/partially written in C/C++, mostly because of the requirement of high performance and the need to interact with hardware. This fact has nothing to do with whether they are procedural languages or functional languages.
However, I would say the [GA... |
I solved this by saving, in addition to the map[y][x] -> color multidimensional array, a defaultdict(lambda : defaultdict(dict)) map, which maps from color -> [True, False] -> (Coordinates -> True).
dict[color][True] contains all coordinates which lie on a border (to either unclaimed or other color values), and so h... |
Yes, I would say the [GAP as a programming language](https://docs.gap-system.org/doc/ref/chap4.html#X7FE7C0C17E1ED118) is a procedural language.
However, for most programming languages including functional languages (or what I know), the runtime is mostly/partially written in C/C++, mostly because of the requirement... |
I am afraid you put the cart before the horse sort of.
The dummy variables are used to represent the situations when "some searches may be for values not in $K$". At the time when we design/create/modify a binary search tree, no such "dummy variables" are included. Once we have a binary search tree, for the sake of ... |
null |
I am looking for an efficient way to perform nearest neighbor searches within a specified radius in a two-dimensional plane. According to Wikipedia, space-partitioning data structures, such as :
- k-d trees,
- r-trees,
- octrees,
- quadtrees,
- cover trees,
- metric trees,
- locality-sensitive hashing,
- ... |
Finding the best algorithm for nearest neighbor search in a 2D plane with moving points |
|algorithms|optimization|nearest-neighbour| |
https://www.cs.utexas.edu/users/novak/algebra.pdf
Here is a link to a university article on a similar equation |
The solution of
$$ax+b=cx+d$$ is $$x=\frac{d-b}{a-c}.$$
Unless you want to handle other types of equations (but you don't explain), this is the general case. |
null |
> Consider the following approximation algorithm for the problem of finding a maximum clique in a given graph $G$. Repeat the following step until the resulting graph is a clique. Delete from $G$ a vertex that is not connected to every other vertex in $G$ and also delete all its incident edges. Show that this greedy ap... |
The performance ratio of the approximation algorithm of maximum clique |
|proof-techniques|approximation|clique| |
How to prove the performance ratio of the approximation algorithm of maximum clique |
How to prove the performance ratio of the approximation algorithm of maximum clique is unbounded |
> Consider the following approximation algorithm for the problem of finding a maximum clique in a given graph $G$. Repeat the following step until the resulting graph is a clique. Delete from $G$ a vertex that is not connected to every other vertex in $G$ and also delete all its incident edges. Show that this greedy ap... |
null |
I am afraid you put the cart before the horse sort of. It is not a question about which statement is true. Both statement do not make much sense since those dummy variables/leaves for them are not part of the binary search tree.
The dummy variables are used to represent the situations when "some searches may be for ... |
I have an algorithm that recursively connects together pairs of nodes into new nodes. It looks like the Huffman code algorithm, except that a node can be re-used after it has been part of a merge. The result is a graph where each node has two parents, but can have any amount of children.
Is there a term for such a g... |
I am not familiar with any standard name for graphs with this property. There are many more properties that one could imagine than names.
I would suggest that you use standard graph visualization software. You should be able to find many options, with a bit more searching. See, e.g., https://en.wikipedia.org/wiki... |
There are two quite general classes of languages that don’t fulfil the pumping lemma: (1) a^n where n is an element of an infinite set with arbitrary large gaps between set elements. (2) a^n b^n for n >= 0.
And the generalised pumping lemma says: If L is regular then any set of substrings of elements of L fulfils th... |
I expect that nearly every data structure offers a way to update a particular value stored in the data structure.
For instance, with an quadtree, if the position of a point changes slightly, you can look its prior position in the data structure, check whether the new position lies within the same cell, and if not, t... |
There is no one answer for the shape of the curve. It depends on the data you are trying to compress.
- For the string 00000..., with a sufficiently good compression algorithm, we can expect the compression function to behave asymptotically like $f(x) \approx c/n$ for large enough $n$, when compressing the $n$-leng... |
I have two sets of 2-dimensional coordinates on an integer grid, $A$ and $B$
$A = \{(x_{A1},y_{A1}), (x_{A2}, y_{A2}), (x_{A3}, y_{A3}), \dots\}$
$B = \{(x_{B1},y_{B1}), (x_{B2}, y_{B2}), (x_{B3}, y_{B3}), \dots\}$
I need to find all coordinates in $B$ that are in the [Von Neumann neighborhood](https://en.wiki... |
Given two sets of coordinates, find out neighboring ones |
|algorithms|graphs|search-algorithms|sets|image-processing| |
Consider the language definition:
$L = \{<M>| M$ is a DFA and $M$ accepts some string of the form $ww^{r}$ for some $w\in \Sigma^{*}\}$
The language $L$ is :
A) Regular
B) Context-free but not regular
C) Recursive but not context-free
D) Recursive enumerable but not recursive
**Solution provided:**... |
null |
Store $B$ in a hashtable.
For each element of $A$, check whether it is in the hashtable. Also, for each element of $A$, for each of its four neighbors, check whether that neighbor is in the hashtable.
The expected running time will be approximately $O(|A|+|B|)$. |
Store $B$ in a hashtable.
For each element of $A$, check whether it is in the hashtable. Also, for each element of $A$, for each of its four neighbors, check whether that neighbor is in the hashtable.
The expected running time will be approximately $O(|A|+|B|)$.
----
If you want a further constant-factor s... |
I'd like to focus on this part of the question because it is not answered, yet:
> GAP is ... is written in C ...
> Does this mean we can say GAP's language is procedural?
**No**
The sentence "[some language] is written in C" means that the interpreter or compiler is written in C. The sentence does not say a... |
null |
If the coordinates keep reasonable values and if you can afford marking the points in an image, start with an empty image, mark all $A$ pixels (takes $\#A$ pixel sets) and test all neighborhoods of the $B$ pixels (takes $4\times\#B$ pixel tests).
If you need to do this repeatedly, rather than clearing the image eve... |
It is rather straight-forward to show that the language here is decidable.
The "solution provided"-attempt is not sound: Just because we can reduce the problem at hand to deciding non-emptyness of a PDA doesn't mean that we have to able to able to handle arbitrary PDAs here - after all, we are looking just at very s... |
If the coordinates keep reasonable values and if you can afford marking the points in an image, start with an empty image, mark all $B$ pixels (takes $\#B$ pixel sets) and test all neighborhoods of the $A$ pixels (takes $4\times\#A$ pixel tests).
If you need to do this repeatedly, rather than clearing the image eve... |
If the coordinates keep reasonable values and if you can afford marking the points in an image, start with an empty image, mark all $B$ pixels (takes $\#B$ pixel sets) and test all neighborhoods of the $A$ pixels (takes $4\times\#A$ pixel tests).
If you need to do this repeatedly, rather than clearing the image eve... |
As of recently I've been trying to get better at algorithms and I've stumbled onto one that I can't seem to solve.
The idea behind the algorithm is to try to find as many different ways as possible to store each object of size K in an array of N*N given certain restraints.
So take this grid right here
.X.X... |
How do I keep track of different ways I can structure a 2D array |
|algorithms|graphs|backtracking| |
There are Two types of writes either to update exist track or to write a new track.
For the new tracks not meant for Cache hit miss the cache hit miss is for updating existing tracks, So if the Track is existing in the Cache and the updated happened in the Cache That's mean a successful Write Hit.
If the Track doesn'... |
As of recently I've been trying to get better at algorithms and I've stumbled onto one that I can't seem to solve.
The idea behind the algorithm is to try to find as many different ways as possible to store each object of size K in an array of N*N given certain restraints.
So take this grid right here
.X.X... |
null |
Consider the set of all valid Turing Machines descriptions $T_{All}$, and the set of functions that denote the real (not asymptotic) running time of Turing Machines in $T_{All}$, lets call it $R_{All}$.
Since there are infinite functions, not all of which might represent the running time of a valid Turing Machine, h... |
Describing the set of Running Time of all Turing Machines |
|complexity-theory|time-complexity|algorithm-analysis| |
null |
Is this a one-time comparison, or might there be a single *A* and multiple *B*s?
If the test is to be run on multiple *B*s, one could put more effort into analyzing *A* and greatly reduce the multiple look-up times.
For instance:
- First build a boolean table (array or hash) that is True for each member of *A*... |
Note that a string in $K\cap K^r$ is not necessarily a palindrome.
Hence your argument can not work as a shortcut.
However, the complexity is *not* because of the $ww^r$ in the definition. Given $M$ one mey construct a finite state automaton $M'$ such that $M'$ accepts $w$ iff $M$ accepts $ww^R$, see
[How to show... |
I am having a problem understanding the part that I showed in the picture.
This is the background of the lemma
[![enter image description here][1]][1]
then comes the lemma
[![enter image description here][2]][2]
In the lemma, I understand points 1 to 3 but for point number 4 I have no idea. I don't und... |
Bin Packing tight analysis lower bound? |
|approximation|packing| |
I am having a problem understanding the part that I showed in the picture.
This is the background of the lemma:
> To prove the lower bounds, we use the classical lower bound construction from [5, 9]. We
have an input instance L with three regions of items. In the first region, there are items of
size close to 1... |
All common CPU's do use the 2's complement representation. Because they need to handle negative values and because the sign/mantissa representation is less convenient. |
As I have mentioned in my comment, your problem is indeed related to the counting the number of inversions, which can be shown to have a [lower-bound of $\Omega(n \log n)$ if you are to only allowed to compare elements](https://cstheory.stackexchange.com/questions/30704/lower-bounds-for-inversion-counting-in-comparison... |
Yes, [GAP as a programming language](https://docs.gap-system.org/doc/ref/chap4.html#X7FE7C0C17E1ED118) is a procedural language.
"The simplest test to apply is that a language is procedural if it has assignable (mutable) variables", Michael Kay pointed out. <!-- https://cs.stackexchange.com/questions/156352/does-i... |
Yes, [GAP as a programming language](https://docs.gap-system.org/doc/ref/chap4.html#X7FE7C0C17E1ED118) is a procedural language.
"The simplest test to apply is that a language is procedural if it has assignable (mutable) variables", Michael Kay pointed out. <!-- https://cs.stackexchange.com/questions/156352/does-i... |
As I have mentioned in my comment, your problem is indeed related to the counting the number of inversions, which can be shown to have a [lower-bound of $\Omega(n \log n)$ if you are to only allowed to compare elements](https://cstheory.stackexchange.com/questions/30704/lower-bounds-for-inversion-counting-in-comparison... |
As I have mentioned in my comment, your problem is indeed related to the counting the number of inversions, which can be shown to have a [lower-bound of $\Omega(n \log n)$ if you are to only allowed to compare elements](https://cstheory.stackexchange.com/questions/30704/lower-bounds-for-inversion-counting-in-comparison... |
Short answer: No.
These are called the [time constructible functions](https://en.wikipedia.org/wiki/Constructible_function). The definition is basically what you would expect it to be: a function $f(n)$ is fully time constructive if there is a Turing machine that, on input $1^n$, stops after exactly $f(n)$ steps. ... |
The most natural solution is probably exactly to use [recursive backtracking](https://en.wikipedia.org/wiki/Backtracking). Since you haven't told us what difficulty you had in applying that, it's not clear how to help you.
The statespace is the set of all partially-filled out grids. Given a state (a partially fill... |
null |
This is an example of an [exact cover problem][1]. It is NP-complete in general.
There are many algorithms that can solve exact cover problems reasonably efficiently on moderate-sized examples, but [Knuth's Algorithm X][2] is probably your best bet.
[1]: https://en.wikipedia.org/wiki/Exact_cover
[2]: https:/... |
null |
I have two sets of 2-dimensional coordinates on an integer grid, $A$ and $B$
$A = \{(x_{A1},y_{A1}), (x_{A2}, y_{A2}), (x_{A3}, y_{A3}), \dots\}$
$B = \{(x_{B1},y_{B1}), (x_{B2}, y_{B2}), (x_{B3}, y_{B3}), \dots\}$
I need to find all coordinates in $B$ that are directly above, below, or to the left or right of... |
null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.