instruction stringlengths 0 29.8k ⌀ |
|---|
The right quotient of two languages is defined as
$$L_1/L_2=\{ x \mid xy \in L_1 \text{ and } y \in L_2 \}.$$
**Example**:<br>
$L_1=\{ab,aab,baa\}$ and
$L_2=\{b\}.$
I read somewhere that $L_1/L_2=\{a,aa,\varepsilon\}$ but I cannot understand why $\varepsilon$ is contained in the quotient.
|
|formal-languages| |
In words, your definition says "The right quotient, written $L_1 / L_2$, is defined to be the set of all strings $x$ such that $xy$ is a string in $L_1$ for some string $y$ in $L_2$." According to this definition, the empty string is a member of the right quotient if and only if there is a common string in the two lang... |
I have two questions:
1) I have a language over the alphabet
Σ = { 0, 1}. for every w in Σ* w!=uu(reverse)
In other words w is not palindrome with even length. I proved that this language is NOT regular by proving that Complementary language is not regular. My question is how to prove it using pumping lemma with... |
Proof using pumping lemma |
|formal-languages|pumping-lemma| |
I have two questions:
1. I consider the following language
$$L_1= \{ w\in \{0,1\}^* \mid \not \exists u\in \{0,1\}^* \colon w= uu^R\}.$$
In other words $w$ is not palindrome with even length. I proved that this language is NOT regular by proving that its complement is not regular. My question is how to prove it u... |
Proofs using the regular pumping lemma |
|formal-languages|regular-languages|pumping-lemma| |
I have two questions:
1. I consider the following language
$$L_1= \{ w\in \{0,1\}^* \mid \not \exists u\in \{0,1\}^* \colon w= uu^R\}.$$
In other words $w$ is not palindrome with even length. I proved that this language is NOT regular by proving that its complement is not regular. My question is how to prove it u... |
Let's look at all the different criteria (reflexivity, symmetry or antisymmetry, and transitivity) for the first relations, $aR_1b\Leftrightarrow a=2b$ :
a) Is it reflexive, or antireflexive, or neither? For this we want to test $aR_1a$ — or in other words, whether $a=2a$. This _can_ hold if $a=0$, but other... |
The short answer is that for any finite language $p$ is greater than the length of every string in the language - i.e. finite languages are a trivial case as it's true that every string longer than $p$ can be pumped.
Beyond the question you asked, understanding what the pumping length is can help with stuff that you... |
The pumping lemma says that for any regular language $L$, there exists a constant $p$ such that any word $w$ in $L$ with length at least $p$ can be split into three substrings, $w = xyz$, where the middle portion $y$ must not be empty, such that the words $xz, xyz, xyyz, xyyyz, \ldots$ constructed by repeating $y$ an a... |
Pumping lemma for a finite language |
|formal-languages| |
|cellular-automata| |
Short answer: Let $p = 10^{100}$. There are no strings of length $p$ in your language, so the conditions of the pumping lemma are vacuously satisfied. |
I'm preparing for an exam, and on a sample one provided (without solutions), we have this question: Is the following solvable or non-solvable: Given a turing machine $T$, does it accept a word of even length? - Given a deterministic 1-tape turing machine $T$, does $T$ ever read the contents of the 10th cell?
Thanks!... |
Solvability of Turing Machines |
|turing-machines|undecidability| |
"Non-trivial properties" for Rice's theorem are properties of the _language_, not of the _machine_ itself - for instance, it's decidable how many states a TM has, which is certainly a non-trivial property! See http://cs.stackexchange.com/questions/2811/perplexed-by-rices-theorem for a bit of a clarification on this. ... |
null |
Not all non-regular languages fail the test of the pumping lemma. Wikipedia has an [annoyingly complex example][1] of a non-regular language which can be pumped. So even if a language is non-regular, we may not be able to prove this fact using the pumping lemma.
I believe that the first language you mentioned can be... |
Not all non-regular languages fail the test of the pumping lemma. Wikipedia has an [annoyingly complex example][1] of a non-regular language which can be pumped. So even if a language is non-regular, we may not be able to prove this fact using the pumping lemma.
I believe that the first language you mentioned can be... |
null |
Not all non-regular languages fail the test of the pumping lemma. Wikipedia has an [annoyingly complex example][1] of a non-regular language which can be pumped. So even if a language is non-regular, we may not be able to prove this fact using the pumping lemma.
But it turns out we can use the pumping lemma to prove... |
The fact that our graph is acyclic makes this problem much simpler.
[Topological sort][1] can give us an ordering of the vertices $v_1,v_2,\dots,v_n$ such that, if $i < j$, then there is no edge from $v_j$ back to $v_i$. We've listed the vertices such that all edges in go "forward" in our list.
Now we just go bac... |
This is the OP (didn't register on initial submission, so now I can't comment properly). Thank you so much for the feedback -- the original greedy algorithm solution got me going in the right direction. The total space I'm working on concerns 100s of individuals and 1000s of "books" -- if this is feasible with the inte... |
I believe it can. Consider the following thought experiment: we are attempting to predict if a person lived to be over 100. Knowing year of birth provides *some* predictive power (e.g., if they were born after 1912, we know with certainly they did not live to be 100). Year of death also provides some information (peopl... |
The closure property way, so no (explicit) automata. Regular languages are closed under morphisms, inverse morphisms and intersection (with regular languages).
Let $\Sigma_A$ and $\Sigma_B$ be the alphabets of $A$ and $B$. Let $h_X:\Sigma_X^* \to \{1\}^*$ be the morphism that maps every letter $a\in\Sigma_X$ to $1$.... |
The fact that our graph is acyclic makes this problem much simpler.
[Topological sort][1] can give us an ordering of the vertices $v_1,v_2,\dots,v_n$ such that, if $i < j$, then there is no edge from $v_j$ back to $v_i$. We've listed the vertices such that all edges in go "forward" in our list.
(edited to fix ana... |
I try to figure out linear speed-up of Turing machine.
*Prove that any problem that can be solved by a two-tape Turing machine that has time complexity t can be solved by another two-tape Turing machine having time complexity $t′$, where $t′(n) = O(n) + (t(n)/2)$.*
The idea seems to show that what the first machi... |
Speed-up of two-tape Turing machine |
|complexity-theory|turing-machines| |
I believe it can. Consider the following thought experiment: we are attempting to predict if a person lived to be over 100. Knowing year of birth provides *some* predictive power (e.g., if they were born after 1912, we know with certainty they did not live to be 100). Year of death also provides some information (peopl... |
The fact that our graph is acyclic makes this problem much simpler.
[Topological sort][1] can give us an ordering of the vertices $v_1,v_2,\dots,v_n$ such that, if $i < j$, then there is no edge from $v_j$ back to $v_i$. We've listed the vertices such that all edges in go "forward" in our list.
(edited to fix ana... |
The fact that our graph is acyclic makes this problem much simpler.
[Topological sort][1] can give us an ordering of the vertices $v_1,v_2,\dots,v_n$ such that, if $i < j$, then there is no edge from $v_j$ back to $v_i$. We've listed the vertices such that all edges in go "forward" in our list.
(edited to fix ana... |
null |
null |
I'm studying shortest paths in directed graphs currently. There are many efficient algorithms for finding the shortest path in a network, like dijkstra's or bellman-ford's. But what if the graph is dynamic? By saying dynamic I mean that we can insert or remove vertices during the execution of the program. I'm trying to... |
Retrieving the shortest path of a dynamic graph |
|graph-theory|efficiency|shortest-path| |
The single tape case is known as the [Linear speedup theorem][1]. It has a nice little trick by compressing the tape *and* using overlapping chunks of the tape. Try whether it also works in the two-tape case.
[1]: http://en.wikipedia.org/wiki/Linear_speedup_theorem |
After long thinking i think i answered 2.
we choose string (010)^N(101)^N , where N is pumping length.
No matter what y we will choose, xy^0z will have more 101 then 010.
the idea is that we can only add more 101 sub strings in first part of string or remove some 010 sub strings.
|
I'm studying shortest paths in directed graphs currently. There are many efficient algorithms for finding the shortest path in a network, like dijkstra's or bellman-ford's. But what if the graph is dynamic? By saying dynamic I mean that we can insert or remove vertices during the execution of the program. I'm trying to... |
In this question we only consider Turing machines that halt on all inputs. If $k \in \mathbb{N}$ then by $T_k$ we denote the Turing machine whose code is $k$.
Consider the following function
$$s(x,y) = \min\{k \mid |L(T_k) \cap \{x,y\}| = 1\}$$
In other words, $s(x,y)$ is the code of the smallest Turing machi... |
An interesting metric space related to Turing machines |
|computability|turing-machines| |
null |
null |
Hints and suggestions here.
To get intuition for the problem, I think it helps to think of $d(x,y)$ as a measure of how *distinguishable* two strings are. If two strings are far apart, then there is a low-index TM that distinguishes between them. If they're close together, there are many TMs that do not distinguish ... |
Hints and suggestions here.
To get intuition for the problem, I think it helps to think of $d(x,y)$ as a measure of how *distinguishable* two strings are. If two strings are far apart, then there is a low-index TM that distinguishes between them. If they're close together, there are many TMs that do not distinguish ... |
Hints and suggestions here.
To get intuition for the problem, I think it helps to think of $d(x,y)$ as a measure of how *distinguishable* two strings are. If two strings are far apart, then there is a low-index TM that distinguishes between them. If they're close together, there are many TMs that do not distinguish ... |
I am trying to count the exact/total number of iterations the following nested for-loops are executed:
s=0 for (i: 1 to n) for (j: 1 to i) for (k: j to i) s = s + 1
I know that the first two for-loops will have n(n+1)/2 iterations. My problem is with the third for-loop. Due to this third loop what factor am I... |
Triple nested for-loops |
|runtime-analysis|loops| |
I am trying to count the exact/total number of iterations the following nested for-loops are executed:
s=0
for (i: 1 to n)
for (j: 1 to i)
for (k: j to i)
s = s + 1
I know that the first two for-loops will have `n(n+1)/2` iterations. My problem is with the third for-loop. Due to this... |
null |
null |
I'm studying shortest paths in directed graphs currently. There are many efficient algorithms for finding the shortest path in a network, like dijkstra's or bellman-ford's. But what if the graph is dynamic? By saying dynamic I mean that we can insert or remove vertices during the execution of the program. I'm trying to... |
|algorithms|graph-theory|efficiency|shortest-path| |
null |
Hints and suggestions here.
To get intuition for the problem, I think it helps to think of $d(x,y)$ as a measure of how *distinguishable* two strings are. If two strings are far apart, then there is a low-index TM that distinguishes between them. If they're close together, there are many TMs that do not distinguish ... |
Hints and suggestions here.
To get intuition for the problem, I think it helps to think of $d(x,y)$ as a measure of how *distinguishable* two strings are. If two strings are far apart, then there is a low-index TM that distinguishes between them. If they're close together, there are many TMs that do not distinguish ... |
I have just read [mental poker][1], described in this [fascinating paper(PDF)][2] by cryptographic greats Adi Shamir, Ron Rivest, and Leonard Adleman.
Assuming I have a website, (TTP) how can I prove to the player that the hand dealt to him is fair? Most importantly how can I prove that I didn't bruteforce until an ... |
Mental poker: proving dealt hand is fair |
|board-games|computer-games| |
Instead of a general "formula", you should try to work out from first principles, atleast in the beginning. You can see that the number of executions are:
$$\sum\limits_{i=1}^{n} \sum\limits_{j=1}^{i} \sum\limits_{k=j}^{i} 1$$
We try solving them one step at a time. The innermost (right-most) summation can be sol... |
Hints and suggestions here.
To get intuition for the problem, I think it helps to think of $d(x,y)$ as a measure of how *distinguishable* two strings are. If two strings are far apart, then there is a low-index TM that distinguishes between them. If they're close together, there are many TMs that do not distinguish ... |
null |
If your question really is about hardness of finding either a true or false assignment to an arbitrary formula, this is always easy. Pick any assignment and it will always either satisfy the formula or not.
It is only the random instances of SAT that exhibit the phase transition you mention. There is also work that ... |
I read some research that analyzes the hardness of SAT solving in the average case.
In fact, for a 3CNF formula if you compute the ratio of clause to variables there is an interval (more or less between 4 and 5) in which solving the formula is hard. But it is easy (between 0 and 4) high probability of satisfiable assi... |
|probability-theory|cryptography|board-games| |
null |
The problem as you probably have noticed is a quite difficult problem. Checking the web will lead to some complex instances that probably you will not need. Here is a solution - as required (i.e. you dont need to recalculate everything from scratch).
for the case of adding an edge $(u,v)$ - then using your already ... |
![hexagon coordinates][1]
In my program, it draws them by offsetting every other row by half of the width, as pictured above. Each tile can be referenced by coordinates, also shown above.
![hexagon roads][2]
I want to know how many blue tiles are accessible from a certain starting tile and a series of "roads."... |
How do I structure hexagon edge data? |
|data-structures|graph-traversal| |
What are the types of things that need to be considered if I need to sort a large random array of 0s and 1s?
You can assume large array is in the order of million or billions.
I understand there are tons of sorting algorithms out there (quick, merge, radix,.etc.) and there are so many different data structur... |
If I have a large random array of 0s and 1s that I want to sort what kind of an algorithm and data structures should I consider? |
|sorting|big-data| |
For question one the string $0^{p}1^{2p}0^{p+p!}$ is a suitable counter-example. What ever the length of $y$ is, it must be a factor of $p!$, so we pump it enough and we get $p+p!$ zeroes at the start. |
Use counting sort: run through the array once and count the number of 0's. Then run through the array once more and write in it the counted number of 0's, followed by 1's. In any case, this is a purely academic exercise because nobody would ever need to do such a thing in real life. |
While Andrej Bauer points out that your problem can be solved very efficiently, 0-1 sorting has some interesting and nontrivial aspects. For example, a [sorting network][1] is valid [if and only if it can sort all sequences of 0s and 1s][2].
Intuitively, a sorting network is an sorting algorithm that does not chang... |
null |
I'm studying shortest paths in directed graphs currently. There are many efficient algorithms for finding the shortest path in a network, like dijkstra's or bellman-ford's. But what if the graph is dynamic? By saying dynamic I mean that we can insert or remove vertices during the execution of the program. I'm trying to... |
null |
null |
null |
My approach would be this:
ptr1 := start_of_array
ptr2 := end_of_array
while ptr2 > ptr1 :
while arr[ptr1] == 0 : //pass1
ptr1++
while arr[ptr2] == 1 : //pass2
ptr2--
if ptr2 > ptr1 :
swap ptr1, ptr2 //swap
This will work like this... |
Technical question: is there any open source program\code\library which can compute (minimal) conductance of a given graph, probably by some simulated annealing?
Think it is quite well-known problem, but i cannot find anything like i mentioned above, but maybe you guys know? I know that it is NP-hard task, but anywa... |
Graph conductance - program/code/library |
|graphs|programming-languages| |
Technical question: is there any open source program/code/library which can compute (minimal) conductance of a given graph, probably by some simulated annealing?
Think it is quite well-known problem, but i cannot find anything like i mentioned above, but maybe you guys know? I know that it is NP-hard task, but anywa... |
|graphs| |
null |
The problem you are asking for is a well-known algorithmic problems. It is actually still open, how hard this problem exactly is. Also you should know that there are different incarnations of this problem. In contrast what you are asking for, usually only the distances are returned, whereas you are asking for the the a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.