instruction stringlengths 0 29.8k ⌀ |
|---|
|lambda-calculus| |
Choose a permutation $\pi$ uniformly at random, and let $P = \{ a_{i, \pi(i)} \mid i\in [n]\}$. The set $P$ contains exactly one element in each row and each column of given the matrix $A$.
Now consider any pair of entries in $A$ with the same value. If those two entries lie in the same row or the same column, the... |
null |
|logic|lambda-calculus| |
Most of us know the correspondence between [combinatory logic][1] and lambda calculus. But I've never seen (maybe I haven't looked deep enough) the equivalent of "typed combinators", corresponding to the simply typed lambda calculus. Does such thing exist? Where could one find information about it?
[1]: http://e... |
As Kaveh says in a comment, Kleene bestowed the name way back when he kicked off automata theory and formal languages. I believe the term was arbitrary, though it has been many years since I read his original paper.
Mathematicians have a habit of hijacking common nouns and adjectives for mathematical objects and pr... |
Is there a typed SKI calculus? |
The expressive completeness of the typed combinators compared to the simply typed lambda calculus has been [demonstrated](http://www.emis.de/journals/NSJOM/Papers/23_1/NSJOM_23_1_319_329.pdf). For each untyped combinator, one needs a whole family of typed combinators. For example, one has
* $\mathbf{I}_{\alpha\to\a... |
The expressive completeness of the typed combinators compared to the simply typed lambda calculus has been [demonstrated](http://www.emis.de/journals/NSJOM/Papers/23_1/NSJOM_23_1_319_329.pdf). For each untyped combinator, one needs a whole family of typed combinators. For example, one has
* $\mathbf{I}_{\alpha\to\a... |
null |
|combinatorics|probability-theory| |
Most of us know the correspondence between [combinatory logic][1] and [lambda calculus][2]. But I've never seen (maybe I haven't looked deep enough) the equivalent of "typed combinators", corresponding to the simply typed lambda calculus. Does such thing exist? Where could one find information about it?
[1]: htt... |
As Kaveh says in a comment, Kleene bestowed the name way back when he kicked off automata theory and formal languages. I believe the term was arbitrary, though it has been many years since I read his original paper.
Mathematicians have a habit of hijacking common nouns and adjectives for mathematical objects and pr... |
null |
|logic|lambda-calculus|type-theory| |
null |
It is always a good idea to find a recursive algorithm first and then turn it into a table.
1. $f(C,n)$
2. $~~$if(C = $\emptyset$) return 0;
3. $~~$else
4. $~~~~$opt = 0;
5. $~~~~$for each $c\in C$ do
6. $~~~~~~D=\{d\in C:d<c\}$
7. $~~~~~~E=\{e-c:e\in D,e>c\}$
8. $~~~~~~opt = min\{opt,f(D,c)+f(E,n-c)\... |
The basic idea is: Try out all cut positions as first choice, solve the respective parts recursively, add the cost and choose the minimum.
In formula:
$\qquad \displaystyle \operatorname{mino}(s, C) =
\begin{cases}
|s| &, |C| = 1 \\
|s| + \min_{c \in C} \left[ \begin{align}&\operatorname{mino}(s_{1... |
I have been working on the following problem from this [book][1].
>A certain string-processing language offers a primitive operation which splits a string into two
pieces. Since this operation involves copying the original string, it takes n units of time for a
string of length n, regardless of the location of the... |
dynamic programming exercise on cutting strings |
|algorithms| |
I try to find an approach to the following problem:
>Given the set of point $S$ and radius $r$, find the center point of circle, such that the circle contains the maximum points from the set. The running time should be $O(n^2)$.
At first it seemed to be something similar to smallest enclosing circle problem, tha... |
Maximum Enclosing Circle of a Given Radius |
|algorithms|computational-geometry| |
|algorithms|combinatorics|strings|dynamic-programming| |
If $AB=C$, then $A(Bx)=Cx$ for all vectors $x$.
Generate vectors randomly and check.
_Edit:_ This known as [Freivalds' algorithm][1]. Wikipedia has details.
[1]: http://en.wikipedia.org/wiki/Freivalds%27_algorithm |
I try to find an approach to the following problem:
>Given the set of point $S$ and radius $r$, find the center point of circle, such that the circle contains the maximum number of points from the set. The running time should be $O(n^2)$.
At first it seemed to be something similar to smallest enclosing circle pr... |
Your intuition that $\forall X.\, P(X)$ should be embeddable in $\exists X.\, P(X)$ is generally right. It only fails if the entire collection of types is empty, which is rarely the case.
However, the specific example you gave $\forall X.\, (X \times (X \to Bool))$ is not a good one. A value of this type should be... |
I think the difficult questions is knowing whether the circle you've selected is actually "maximal" within the set. The only way I can think to determine this is to try all the possible combinations of the points, and test the size of the circle which encloses them.
You can reduce the search space though by first di... |
Your intuition that $\forall X.\, P(X)$ should be embeddable in $\exists X.\, P(X)$ is generally right. It only fails if the entire collection of types is empty, which is rarely the case.
However, the specific example you gave $\forall X.\, (X \times (X \to Bool))$ is not a good one. A value of this type should be... |
Some frontmatter: I'm a recreational computer scientist and employed software engineer. So, pardon if this prompt seems somewhat out of left field -- I routinely play with mathematical simulcra and open problems when I have nothing better to do.
While playing with the [Riemann hypothesis][1], I determined that the [... |
Polytime and polyspace algorithm for determining the leading intersection of N discrete monotonic functions |
|algorithms|reference-request|discrete-mathematics| |
Polytime and polyspace algorithm for determining the leading intersection of n discrete monotonic functions |
Some frontmatter: I'm a recreational computer scientist and employed software engineer. So, pardon if this prompt seems somewhat out of left field -- I routinely play with mathematical simulcra and open problems when I have nothing better to do.
While playing with the [Riemann hypothesis][1], I determined that the [... |
If your $k$ is fixed and you are allowed to do pre-processing, then this is something you might be able to try <br />
1. Construct a graph such that the nodes are words and an edge exists between two nodes if the distance between those two words is 1. <br />
2. Get the adjacency matrix corresponding to that graph (sa... |
null |
Why is the language
$ L = \{ 0^n 1^n | n \geq 1 \} $, or $ \{ 01, 0011, 000111, \ldots \} $ not a regular language? It looks very much like a very simple language to me at least intuitively. |
Why is $L= \{ 0^n 1^n | n \geq 1 \}$ not regular language? |
|regular-languages| |
I don't know how to solve this problem in $O(n^2)$ time, but an $O(n^2\log n)$ algorithm does exist.
Let $C(s_i)$ be the circle whose center is $s_i$, the $i$-th point, with radius $r$. It's not hard to find that the point set $P = \{p_0, p_1, \ldots, p_m\}$ can be enclosed by a circle with radius $r$ iff the inters... |
|formal-languages|regular-languages| |
To expand on Artem's comment, note that if we have an $m$ state automaton, at each point we can remember at most $\lg m$ bits of information about the part of input we have read so far. Based on this finite amount of information about the the previous bits of the input, you should be able to end up in the right accepti... |
null |
null |
> **Possible Duplicate:**
> [How to prove that a language is not regular?](http://cs.stackexchange.com/questions/1031/how-to-prove-that-a-language-is-not-regular)
<!-- End of automatically inserted text -->
Why is the language
$ L = \{ 0^n 1^n | n \geq 1 \} $, or $ \{ 01, 0011, 000111, \ldots \} $ not a regula... |
{"OriginalQuestionIds":[1031],"Voters":[{"Id":31,"DisplayName":"Dave Clarke"},{"Id":82,"DisplayName":"jmad"},{"Id":98,"DisplayName":"Raphael"}]} |
Let $A[1...N]$ be an Array of size $N$ with maximum element $\max$.
I want to transform array $A$ such that after transformations all elements of $A$ contain $\max$, i.e. after transformation $A = [\max,\max,\max,\max,\dots,\max]$.
In one step, I can apply the following operation to any consecutive sub-array $A[x... |
|algorithms|arrays| |
Let $A[1...N]$ be an Array of size $N$ with maximum element $\max$.
I want to transform array $A$ such that after transformations all elements of $A$ contain $\max$, i.e. after transformation $A = [\max,\max,\max,\max,\dots,\max]$.
In one step, I can apply the following operation to any consecutive sub-array $A[x... |
> Let $f$ and $g$ be asymptotically nonnegative functions. Then, at least one relationship of $f(n) = O(g(n))$ and $g(n) = O(f(n))$ must always hold
Is it true or false? Please explain. |
|formal-languages|regular-languages|regular-expressions| |
|formal-languages|regular-languages|turing-machines| |
I want to turn one string into another with only single letter substitions. What is a good way to do this, passing through only valid words in between ([this](http://www.wuzzlesandpuzzles.com/wordchange/) website has some examples)?
Valid here means "a word in English" as this is the domain I consider.
My curren... |
|algorithms|algorithm-analysis|search-algorithms| |
Quicksort is for sorting, the algorithm you refer to is a selection algorithm known as [Quick Select][1].
* Since you can only pick as pivot a number that is in the list case #1 never happens.
* Worst case is that you continually pick a number that partitions the list into 2 lists: A list with just one element and ... |
A recent exam question went as follows:
> 1. $A$ is an infinite recursively enumerable set. Prove that $A$ has an infinite recursive subset.
> 2. Let $C$ be an infinite recursive subset of $A$. Must $C$ have a subset that is *not* recursively enumerable?
I answered 1. already. Regarding 2., I answered affirmativ... |
|computability|check-my-proof| |
I have just completed the first chapter of the [*Introduction to the Theory of Computation*](http://www-math.mit.edu/~sipser/book.html) by *Michael Sipser* which explains the basics of finite automata.
He defines a regular language as anything that can be described by a finite automata. But I could not find where h... |
null |
1. If there were an algorithm that factored in polynomial time by means of examining each possible factor of a complex number efficiently, could one not also use this algorithm to solve unbounded knapsack problems since two factors can be viewed as one value, say within the set for the knapsack problem, and the other ... |
Normally in algorithms we do not care about comparison, addition, or subtraction of numbers -- we assume they are $O(1)$. For example we assume this when we say that comparison based sorting is $O(n\log n)$, but when numbers are too big to fit into registers, we normally represent them as arrays so basic operations re... |
How can we assume comparison, addition, ... between numbers is $O(1)$ |
null |
The goal of cryptography is to approximate a process whereby
crypt(x)
conveys no information about x but there exists a function `decrypt` such that
decrypt(crypt(x)) == x
If decrypt and crypt were done in the same run of the same program, you could approximate this perfectly using hidden variables:... |
> If there were an algorithm that factored in polynomial time by means of examining each possible factor of a complex number efficiently
Starting from a self-contradicting statement like this, you can prove anything. Why is it self-contradicting?
Let $n$ be a natural number. The number of possible factors of $n$ ... |
The goal of cryptography is to approximate a process whereby
crypt(x)
conveys no information about x but there exists a function `decrypt` such that
decrypt(crypt(x)) == x
If decrypt and crypt were done in the same run of the same program, you could approximate this perfectly using hidden state:
... |
###Problem Definition###
The goal of cryptography is to approximate a process whereby
crypt(x)
conveys no information about x but there exists a function `decrypt` such that
decrypt(crypt(x)) == x
If decrypt and crypt were only done in the same run of the same program, you could implement this pe... |
|algorithms|proof-techniques|numerical-analysis| |
|logic|reference-request|lambda-calculus|type-theory| |
The expressive completeness of the typed combinators compared to the simply typed lambda calculus has been [demonstrated](http://www.emis.de/journals/NSJOM/Papers/23_1/NSJOM_23_1_319_329.pdf). For each untyped combinator, one needs a whole family of typed combinators. For example, one has
* $\mathbf{I}_{\alpha\to\a... |
###Problem Definition###
The goal of cryptography is to approximate a process whereby
crypt(x)
conveys no information about x but there exists a function `decrypt` such that
decrypt(crypt(x)) == x
If decrypt and crypt were only done in the same run of the same program, you could implement this pe... |
What does the complexity class $\oplus P^{\oplus P}$ mean? I know that $\oplus P$ is the complexity class which contains languages $A$ for which there is polynomial time nondeterministic Turing machine $M$ such that $x \in A$ iff the number of accepting states of the machine $M$ on the input $x$ is odd.
But what doe... |
complexity class $\oplus P^{\oplus P}$ |
|complexity-theory|nondeterminism| |
What does the complexity class $\oplus P^{\oplus P}$ mean? I know that $\oplus P$ is the complexity class which contains languages $A$ for which there is a polynomial time nondeterministic Turing machine $M$ such that $x \in A$ iff the number of accepting states of the machine $M$ on the input $x$ is odd.
But what d... |
If your $k$ is fixed and you are allowed to do pre-processing, then this is something you might be able to try
1. Construct a graph such that the nodes are words and an edge exists between two nodes if the distance between those two words is 1.
2. Get the adjacency matrix corresponding to that graph (say $M$)
... |
Since the fourier coefficients might in general be complex numbers $xi + y$ with $x$ or $y$ or both irrational, a standard finite precision computer of course will not output the exact fourier coefficients. However, if you want to claim that you cannot get a good approximation, you are wrong.
Look at [this answer][1... |
What is complexity class $\oplus P^{\oplus P}$ |
|complexity-theory|terminology| |
i am still fighting with the hashing algorithm and i am asking me how is the most effictevily way to count the number of different words in a text using a hash table?
My intuition says that applying the hashcode function to every word in the text, as result we will have words with different hash values in different ... |
Hashing - counting words in text |
|algorithms| |
I am still fighting with hashing and I am ask myself: what is the most efficient way to count the number of different words in a text using a hash table?
My intuition says that applying the hashcode function to every word in the text, as result we will have words with different hash values in different buckets and t... |
Counting different words in text using hashing |
|algorithms|strings|hash-tables| |
Hash table is very good if you have few words that are repeated many times. Even if your hash function is very good (ie the distribution of elements inside various buckets is close to the uniform distribution) the execution time of search in hash tables where the number of buckets is much smaller than the number of ele... |
If you really just want to count the number of distinct words in the document, you don't need to save each instance of the word to the hash table.
So, if you find a words that's already in the table, just don't add it there. This means you don't have to deal with chaining as often, which will speed things up.
But... |
Hash table is very good if you have few words that are repeated many times.
Let's suppose that your hash function is very good, that means that the distribution of elements inside various buckets is close to the uniform distribution. Even in that case, if the number of buckets is much smaller than the number of ele... |
$\oplus P^{\oplus P}$ denotes the class $\oplus P$ equipped with what's known as an 'oracle' for $\oplus P$- we say that it has been given the ability to determine whether or not a language $L$ is a member of $\oplus P$ in a single operation.
I see that another commenter (sdcwc) has linked to the proof of $\oplus P^... |
Hash table is very good if you have few words that are repeated many times.
Let's suppose that your hash function is very good, that means that the distribution of elements inside various buckets is close to the uniform distribution. Even in that case, if the number of buckets is much smaller than the number of ele... |
If the weights of the weighted 3-DIMENSIONAL-MATCHING problem are restricted to let's say, 1 and 2, is there a possibility to reduce this case to the unweighted 3-DIMENSIONAL-MATCHING problem?
(Because for the unweighted version, there is a (1.5+$\epsilon$)-approximation<sup>1</sup> algorithm, for the weighted version... |
This question has been prompted by [Efficient data structures for building a fast spell checker](http://cs.stackexchange.com/questions/1626/efficient-data-structures-for-building-a-fast-spell-checker).
Given two strings $u,v$, we say they are *$k$-close* if their [Damerau–Levenshtein distance](http://en.wikipedia.or... |
$\oplus P^{\oplus P}$ denotes the class $\oplus P$ equipped with what's known as an 'oracle' for $\oplus P$- we say that it has been given the ability to determine whether or not a language $L$ is a member of $\oplus P$ in a single operation.
I see that another commenter (sdcwc) has linked to the proof of $\oplus P^... |
null |
$\oplus P^{\oplus P}$ denotes the class $\oplus P$ equipped with what's known as an *oracle* for $\oplus P$ — we say that it has been given the ability to determine whether or not a language $L$ is a member of $\oplus P$ in a single operation.
I see that another commenter (sdcwc) has linked to the proof of $\oplus P... |
There is a question which i cannot solve. If you give a tip i will be very glad.
proove that following language is not context free.
L= {a^n,b^m | gcd(n,m)=1}
Solution comes by using pumping lemma but how?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.