instruction stringlengths 0 29.8k ⌀ |
|---|
|databases| |
Consider the following sketch of a parsing strategy at your own risk.
Instead of reading the input only from one end, we read from both sides and look for matching rules. We can do this in recursive descent style; in a call to $A()$, find (unique) prefix $w$ and suffix $v$ to the input such that there is a rule $A \... |
Most research does not actually publish the type checking algorithms for full blown programming languages. You will find some formalisations of a large part of the type systems for full programming languages, such as the work done by [Drossopoulou and Eisenbach for Java][1] or [Nipkov et al's work on C++][2]. More ofte... |
Any problem that requires only examining a finite amount of data is decidable, because there is an algorithm that consists of enumerating all the potential solutions. It may be ridiculously slow, but that's not relevant: if there is an algorithm, it's decidable.
The problem you state assumes a finite graph, which st... |
What factors make a problem decidable? |
I am starting a personal bibliographic research on type-checking algorithms and want some tips. What are the most commonly used type-checking algorithms and strategies?
I am particularly interested in complex type-checking algorithms that were implemented in widely known strongly static typed languages such as C++, ... |
Someone I know is planning on implementing a text editor in the near future, which prompted me to think about what kind of data structures are fast for a text editor. The most used structures are apparently [ropes][1] or [gap buffers][2].
[Van Emde Boas trees][3] are just about the fastest priority queues around, if... |
Is there an equivalent of van Emde Boas trees for ropes? |
|data-structures| |
Consider decision problems stated in some “reasonable” formal language. Let's say formulae in higher-order Peano arithmetic with one free variable as a frame of reference, but I'm equally interested in other models of computation: Diophantine equations, word problems from rewriting rules using Turing machines, etc. An ... |
Ratio of decidable problems |
|undecidability| |
> Which of the following statements is correct?
>
>
> 1. sufficient and necessary conditions about regularity of a language exist but not discovered yet.
> 2. There's no sufficient and necessary condition about regularity of a
> language.
>
> 3. Pumping lemma is a necessary condition for non-regula... |
A sufficient and necessary condition about regularity of a language |
|automata|regular-languages| |
The condition 'there exists a regular expression that generates exactly $L$' is a necessary and sufficient condition for the regularity of a language $L$, by grace of being its definition.
This condition doesn't exactly make it easy to prove non-regularity of a language though. I'm not aware of any conditions that a... |
It is sufficient (and necessary) to show the existence of a DFA, NFA or regular expression to prove that a language is regular, which refutes (1) and (2). To show that a language is not regular it is needed to show that a DFA, NFA or regular expression does not exists.
The pumping lemma is a useful tool to show by c... |
From Wikipedia:
1NF: The table faithfully represents a relation and has no repeating groups.
2NF: Non-prime attributes are non functionally dependent on a proper subset of a candidate key.
3NF: Non-prime attributes are non-transitively dependent on every candidate key in the table.
BCNF: Every non-trivial f... |
By the Myhill-Nerode theorem, a language is regular iff there are finitely many equivalence classes of the indistinguishability relation $I_{L}$. Two strings $x$ and $y$ are said to be indistinguishable, written $x I_{L} y$, iff:
1. For all strings $z_{x}$ such that $xz_{x} \in L$, also $yz_{x} \in L$.
2. For all s... |
It is sufficient (and necessary) to show the existence of a DFA, NFA or regular expression to prove that a language is regular, which refutes (1) and (2). To show that a language is not regular it is needed to show that a DFA, NFA or regular expression does not exists.
The pumping lemma is a useful tool to show by c... |
I want to know if the following problem is decidable and how to find out. Every problem I see I can say "yes" or "no" to it, so are most problems and algorithms decidable except a few (which is provided [here][1])?
> Input: A directed and finite graph $G$, with $v$ and $u$ as vertices
Question: Does a path in $G... |
> Which of the following statements is correct?
>
>
> 1. sufficient and necessary conditions about regularity of a language exist but not discovered yet.
> 2. There's no sufficient and necessary condition about regularity of a
> language.
>
> 3. Pumping lemma is a necessary condition for non-regula... |
There is this wonderful connection between formal language theory and formal power series proofed by Chomsky and Schützenberger [\[CS63\]][1]. In the form found in [SS78] Chap. II, Theorem 5.1
Let $L$ be a regular language and $\mathbb{K}$ a semiring. Then $\mathrm{char}(L)$ is $\mathbb{K}$-rational.
So if you lo... |
By the Myhill-Nerode theorem, a language is regular iff there are finitely many equivalence classes of the indistinguishability relation $I_{L}$. Two strings $x$ and $y$ are said to be indistinguishable, written $x I_{L} y$, iff:
1. For all strings $z_{x}$ such that $xz_{x} \in L$, also $yz_{x} \in L$.
2. For all s... |
> Which of the following statements is correct?
>
>
> 1. sufficient and necessary conditions about regularity of a language exist but not discovered yet.
> 2. There's no sufficient and necessary condition about regularity of a
> language.
>
> 3. Pumping lemma is a necessary condition for non-regula... |
Here are some necessary and sufficient conditions for a language to be regular.
**Theorem.** Let $L\subseteq\Sigma^*$. The following conditions are equivalent:
* $L$ is generated by a regular expression.
* $L$ is recognized by a nondeterministic finite automaton ([Kleene][1]).
* $L$ is recognized by a nondeterm... |
Here are some necessary and sufficient conditions for a language to be regular.
**Theorem.** Let $L\subseteq\Sigma^*$. The following conditions are equivalent:
* $L$ is generated by a regular expression.
* $L$ is recognized by a nondeterministic finite automaton ([Kleene][1]).
* $L$ is recognized by a nondeterm... |
Here are some necessary and sufficient conditions for a language to be regular.
**Theorem.** Let $L\subseteq\Sigma^*$. The following conditions are equivalent:
* $L$ is generated by a regular expression (i.e., the definition of regular language).
* $L$ is recognized by a nondeterministic finite automaton ([Kleen... |
In computer networking and high-performance cluster computer design, network topology refers to the design of the way in which nodes are connected by links to form a communication network. Common network topologies include the mesh, torus, ring, star, tree, etc. These topologies can be studied analytically to determine... |
We know from [this paper][1] that the minimum number of clues to solve a valid sudoku puzzle is 17. Can all valid sudoku puzzles be specified in 17 clues? If not, what is the minimum number of clues that can completely specify every valid puzzle?
[1]: http://arxiv.org/abs/1201.0749 |
Minimum number of clues to fully specify any sudoku? |
|sudoku| |
In computer networking and high-performance cluster computer design, network topology refers to the design of the way in which nodes are connected by links to form a communication network. Common network topologies include the mesh, torus, ring, star, tree, etc. These topologies can be studied analytically to determine... |
Here are some necessary and sufficient conditions for a language to be regular.
**Theorem.** Let $L\subseteq\Sigma^*$. The following conditions are equivalent:
* $L$ is generated by a regular expression (i.e., the definition of regular language).
* $L$ is recognized by a nondeterministic finite automaton ([Kleen... |
We know from [this paper][1] that there does not exist a puzzle that can be solved starting with 16 or fewer clues, but it implies that there does exist a puzzle that can be solved from 17 clues. Can all valid sudoku puzzles be specified in 17 clues? If not, what is the minimum number of clues that can completely speci... |
Given a language $L$, define the length set of $L$ as the set of lengths of words in $L$:
$$\mathrm{LS}(L) = \{|u| \mid u \in L \}$$
Which sets of integers can be the length set of a regular language?
|
What are the possible sets of word lengths in a regular language? |
|regular-languages|finite-automata| |
How to determine if a database schema violates one of the less known normal forms? |
|database-theory|databases| |
I want to generate a completely random [Sudoku](http://en.wikipedia.org/wiki/Sudoku).
Define a Sudoku grid as a $9\times9$ grid of integers between $1$ and $9$ where some elements can be omitted. A grid is a valid puzzle if there is a **unique** way to complete it to match the Sudoku constraints (each line, column a... |
|algorithms|randomness|sudoku| |
Specifying any arbitrary 9x9 grid requires giving the position and value of each square. A naïve encoding for this might give 81 (x, y, value) triplets, requiring 4 bits for each x, y, and value (1-9 = 9 values = 4 bits) for a total of 81x4x3 = 972 bits. By numbering each square, one can reduce the positional informati... |
Efficient encoding of sudoku puzzles |
|sudoku|information-theory| |
Suppose that a certain parallel application uses a master-slave design to process a large number of workloads. Each workload takes some number of cycles to complete; the number of cycles any given workload will take is given by a known random variable $X$. Assume that there are $n$ such workloads and $m$ equivalent sla... |
Any finite subset $\{\ell_1,\ldots,\ell_n\}\subset\mathbb{N}$ can be the lenght-set of a regular language $L$, since you can take a unary alphabet $\{0\}$ and define $L$ as $\{0^{\ell_1},\ldots,0^{\ell_n}\}$.
Now, for the infinite sets, I'll give a short analysis, though the final answer might not be explicit or muc... |
Any finite subset $\{\ell_1,\ldots,\ell_n\}\subset\mathbb{N}$ can be the lenght-set of a regular language $L$, since you can take a unary alphabet $\{0\}$ and define $L$ as $\{0^{\ell_1},\ldots,0^{\ell_n}\}$ (this includes the empty language and $\\{\varepsilon\\}$).
Now for the infinite sets. I'll give a short anal... |
Specifying any arbitrary 9x9 grid requires giving the position and value of each square. A naïve encoding for this might give 81 (x, y, value) triplets, requiring 4 bits for each x, y, and value (1-9 = 9 values = 4 bits) for a total of 81x4x3 = 972 bits. By numbering each square, one can reduce the positional informati... |
According to the pumping lemma for regular languages, there exists an $n$ such that a string $x$ of length at least equal to $n$ can be written in the following form: $$x = uvw$$ Where the following three conditions hold: $$|uv| < n$$ $$|v| > 0$$ $$uv^{k}w \in L$$
This gives us one test for sets: a set cannot be the... |
According to the pumping lemma for regular languages, there exists an $n$ such that a string $x$ of length at least equal to $n$ can be written in the following form: $$x = uvw$$ Where the following three conditions hold: $$|uv| < n$$ $$|v| > 0$$ $$uv^{k}w \in L$$
This gives us one test for sets: a set cannot be the... |
Consider unlabeled, rooted binary trees. We can *compress* such trees: whenever there are pointers to subtrees $T$ and $T'$ with $T = T'$ (interpreting $=$ as structural equality), we store (w.l.o.g.) $T$ and replace all pointers to $T'$ with pointers to $T$.
Give an algorithm that takes a tree in the above sense as... |
Efficiently compressing unlabeled trees |
|algorithms|trees|binary-trees| |
According to the pumping lemma for regular languages, there exists an $n$ such that a string $x$ of length at least equal to $n$ can be written in the following form: $$x = uvw$$ Where the following three conditions hold: $$|uv| < n$$ $$|v| > 0$$ $$uv^{k}w \in L$$
This gives us one test for sets: a set cannot be the... |
Any finite subset $\{\ell_1,\ldots,\ell_n\}\subset\mathbb{N}$ can be the lenght-set of a regular language $L$, since you can take a unary alphabet $\{0\}$ and define $L$ as $\{0^{\ell_1},\ldots,0^{\ell_n}\}$ (this includes the empty language and $\\{\varepsilon\\}$).
Now for the infinite sets. I'll give a short anal... |
It is sufficient (and necessary) to show the existence of a DFA, NFA or regular expression to prove that a language is regular, which refutes (1) and (2). To show that a language is not regular it is needed to show that a DFA, NFA or regular expression does not exists.
The pumping lemma is a useful tool to show (pos... |
Any finite subset $\{\ell_1,\ldots,\ell_n\}\subset\mathbb{N}$ can be the lenght-set of a regular language $L$, since you can take a unary alphabet $\{0\}$ and define $L$ as $\{0^{\ell_1},\ldots,0^{\ell_n}\}$ (this includes the empty language and $\\{\varepsilon\\}$).
Now for the infinite sets. I'll give a short anal... |
Any finite subset $\{\ell_1,\ldots,\ell_n\}\subset\mathbb{N}$ can be the lenght-set of a regular language $L$, since you can take a unary alphabet $\{0\}$ and define $L$ as $\{0^{\ell_1},\ldots,0^{\ell_n}\}$ (this includes the empty language and $\\{\varepsilon\\}$).
Now for the infinite sets. I'll give a short anal... |
Here are some necessary and sufficient conditions for a language to be regular.
**Theorem.** Let $L\subseteq\Sigma^*$. The following conditions are equivalent:
* $L$ is generated by a regular expression (i.e., the definition of regular language).
* $L$ is recognized by a nondeterministic finite automaton ([Kleen... |
According to the pumping lemma for regular languages, there exists an $n$ such that a string $x$ of length at least equal to $n$ can be written in the following form: $$x = uvw$$ Where the following three conditions hold: $$|uv| < n$$ $$|v| > 0$$ $$uv^{k}w \in L$$
This gives us one test for sets: a set cannot be the... |
Here are some necessary and sufficient conditions for a language to be regular.
**Theorem.** Let $L\subseteq\Sigma^*$. The following conditions are equivalent:
* $L$ is generated by a regular expression (i.e., the definition of regular language).
* $L$ is recognized by a nondeterministic finite automaton ([Kleen... |
> Which of the following statements is correct?
>
>
> 1. sufficient and necessary conditions about regularity of a language exist but not discovered yet.
> 2. There's no sufficient and necessary condition about regularity of a
> language.
>
> 3. Pumping lemma is a necessary condition for non-regula... |
Specifying any arbitrary 9x9 grid requires giving the position and value of each square. A naïve encoding for this might give 81 (x, y, value) triplets, requiring 4 bits for each x, y, and value (1-9 = 9 values = 4 bits) for a total of 81x4x3 = 972 bits. By numbering each square, one can reduce the positional informati... |
$O(n \log n)$ begs for a $T(n) = 2T(n/2) + cn$ divide and conquer solution.
Recursively compress nodes and compute the number of descendants in each subtree after compression. Here's some python-esque pseudo code.
def Comp(T):
if T == null:
return 0
leftCount = Comp(T.left)
rig... |
Edit:
I read the question as T and T′ were children of the same parent. I took the definition of compression to be recursive as well, meaning you could compress two previously compressed subtrees. If that's not the actual question, then my answer may not work.
$O(n \log n)$ begs for a $T(n) = 2T(n/2) + cn$ divide... |
Any finite subset $\{\ell_1,\ldots,\ell_n\}\subset\mathbb{N}$ can be the lenght-set of a regular language $L$, since you can take a unary alphabet $\{0\}$ and define $L$ as $\{0^{\ell_1},\ldots,0^{\ell_n}\}$ (this includes the empty language and $\\{\varepsilon\\}$).
Now for the infinite sets. I'll give a short anal... |
The algorithm you refer to is called the Powerset Construction, and was first published by Michael Rabin and Dana Scott in 1959.
To answer your question as stated in the title, there is no *maximal* DFA for a regular language, since you can always take a DFA and add as many states as you want with transitions betwee... |
|automata|computability|regular-languages| |
|formal-languages|automata|computability|regular-languages| |
|sudoku|information-theory|combinatorics| |
|algorithms|data-structures|trees|binary-trees| |
Yes, you can perform this compression in $O(n \log n)$ time, but it is not easy :) We first make some observations and then present the algorithm. We assume the tree is initially not compressed - this is not really needed but makes analysis easier.
Firstly, we characterize 'structural equality' inductively. Let $T$ ... |
First, an observation which is not crucial but convenient: the set $\mathscr{S}$ of sets of integers that are $LS(L)$ for some regular language $L$ on a non-empty alphabet $\mathscr{A}$ does not depend on the choice of alphabet. To see that, consider a finite automaton that recognizes $L$; the lengths of the words that... |
Compressing a non-mutable data structure so that it does not duplicate any structurally equal subterm is known as [**hash consing**](http://en.wikipedia.org/wiki/Hash_consing). This is an important technique in memory management in functional programming. Hash consing is a sort of systematic memoization for data struct... |
As pictures are not allowed in comments:
![enter image description here][1]
top left: an input tree
top right: the subtrees rooted in nodes 5 and 7 are isomorphic too.
lower left and right: the compressed trees are not uniquely defined.
Note that in this case the size of the tree has gone down from $7+5|... |
Is there any "natural" language which is undecidable?
by "Natural" I mean a language defined directly by properties of strings, and not via machines and their equivalent. In other words, if the language looks like
$$ L = \{ \langle M \rangle \mid .... \}$$
where $M$ is a TM, DFA (or regular-exp), PDA (or grammar),... |
a "natural" undecidable language |
|formal-languages|automata|undecidability| |
Since you wanted "strings", I mention the classic one: [Post Correspondence Problem][1].
[1]: http://en.wikipedia.org/wiki/Post_correspondence_problem |
There are [many examples][1] but here are a few:
- The set of true sentences in the language of [arithmetic][2] is undecidable.
- The set of provable sentences in set theory (ZFC) is undecidable.
- The set of Diophantine equations which have solutions is undecidable.
[1]: http://en.wikipedia.org/wiki/Li... |
|formal-languages|automata|computability|undecidability| |
Is there any "natural" language which is undecidable?
by "Natural" I mean a language defined directly by properties of strings, and not via machines and their equivalent. In other words, if the language looks like
$$ L = \{ \langle M \rangle \mid .... \}$$
where $M$ is a TM, DFA (or regular-exp), PDA (or grammar),... |
I can think of an encoding improving a little your 149-bit encoding of a minimal $9\times 9$ puzzle. This is **without** a database or any register of other solutions or partial boards. Here it goes:
First, you use $4$ bits to encode a number $m$ with a minimal number of appearances in the board. The next $4$ bits e... |
Consider unlabeled, rooted binary trees. We can *compress* such trees: whenever there are pointers to subtrees $T$ and $T'$ with $T = T'$ (interpreting $=$ as structural equality), we store (w.l.o.g.) $T$ and replace all pointers to $T'$ with pointers to $T$. See [uli's answer](http://cs.stackexchange.com/a/177/98) for... |
Here are some necessary and sufficient conditions for a language to be regular.
**Theorem.** Let $L\subseteq\Sigma^*$. The following conditions are equivalent:
* $L$ is generated by a regular expression (i.e., the definition of regular language).
* $L$ is recognized by a nondeterministic finite automaton ([Kleen... |
Yes, you can perform this compression in $O(n \log n)$ time, but it is not easy :) We first make some observations and then present the algorithm. We assume the tree is initially not compressed - this is not really needed but makes analysis easier.
Firstly, we characterize 'structural equality' inductively. Let $T$ ... |
> Is there a more efficient encoding, preferably without a database of each valid sudoku setup?
Yes. I can think of an encoding improving your 149-bit encoding of a minimal $9\times 9$ puzzle in 6 or 9 bits, depending on a condition. This is **without** a database or any register of other solutions or partial boards... |
I've not gone much deep into CS. So, please forgive me if the questions is not good or out of scope of this site.
I've seen in many sites and books, the big-O notations like O(n) which tell the time taken use that algorithm. I've read a few articles about it, but still not able to understand how do you calculate it ... |
Computing the time of algorithms? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.