instruction stringlengths 0 29.8k ⌀ |
|---|
I am starting a personal bibliographic research on type-checking algorithms and want some tips. What are the most commonly used type-checking algorithms, strategies and general techniques?
I am particularly interested in complex type-checking algorithms that were implemented in widely known strongly static typed lan... |
I wonder whether the massively parallel computation units provided in graphic cards nowadays (one that is programmable in [OpenCl][1] for example) are good enough to simulate 1d cellular automatons (or maybe 2d cellular automatons?) efficiently.
Choose whatever finite grid would fit inside the memory of the chip, ca... |
Today's massive parallel processing units to run cellular automata? |
|computer-architecture|parallel-computing|cellular-automata| |
{"Voters":[{"Id":68,"DisplayName":"Stéphane Gimenez"},{"Id":95,"DisplayName":"Victor"},{"Id":15,"DisplayName":"rgrig"},{"Id":31,"DisplayName":"Dave Clarke"},{"Id":39,"DisplayName":"Gilles"}]} |
I wonder whether the massively parallel computation units provided in graphic cards nowadays (one that is programmable in [OpenCl][1] for example) are good enough to simulate 1d cellular automata (or maybe 2d cellular automata?) efficiently.
Choose whatever finite grid would fit inside the memory of the chip, can we... |
There's been a lot of hype about JIT compilers for languages like Java, Ruby, and Python. How are JIT compilers different from C/C++ compilers, and why are the compilers written for Java, Ruby or Python called JIT compilers, while C/C++ compilers are just called compilers? |
How is a JIT compiler different from an ordinary compiler? |
|compilers| |
A _perfect hash function_ can be defined as an injective function from a set $S$ to a subset of the integers $\{0, 1, 2, ..., n\}$. If a perfect hash function exists for your data and storage needs, you can easily get $O(1)$ behavior. For instance, you can get $O(1)$ performance from a hash table for the following task... |
I don't see a reason to implement `.` and `..` on either level rather than the other. However, if you target embedded systems any layer you can *save* may be dollars earned, so it might make sense to try and implement everything as low as possible.
As for the general need of `.` and `..`, how would you express relat... |
The halting problem cannot be solved in the general case. It is possible to come up with defined rules that restrict allowed inputs and can the halting problem be solved for that special case?
For example, it seems likely that a language that does not allow loops for instance, would be very easy to tell if the progr... |
Is it possible to solve the halting problem if you have a constrained or a predictable input? |
|computability|undecidability| |
A basic tool are [Attribute Grammars](https://en.wikipedia.org/wiki/Attribute_grammar). You will maybe not be able to do every wicked thing you can imagine with them, but they are a good starting point.
Essentially, you can walk over a program's abstract syntax tree top-down and/or bottom-up and pass information aro... |
JIT is short for just-in-time compiler, and name is misson: during runtime, it determines worthwhile code optimisations and applies them. It does not replace usual compilers but are part of interpreters. Note that languages like Java that use intermediate code have *both*: a normal compiler for source to intermediate c... |
I am curious in determining an approach to tackling a "suggested friends" algorithm.
[Facebook](http://facebook.com) has a feature in which it will send recommended individuals to which you can be acquainted. These users normally (excluding the edge cases in [which a user specifically recommends a friend](http://www... |
How to determine likely connections in a social network? |
|algorithms| |
JIT compilers compiles the code on the fly, right before their execution or even when they are already executing. This way, the VM where the code is running can check for patterns is the code execution to allow optimizations that would be possible only with run-time information. Further, if the VM decide that the compi... |
I am curious in determining an approach to tackling a "suggested friends" algorithm.
[Facebook](http://facebook.com) has a feature in which it will recommended individuals to you which it thinks you may be acquainted with. These users normally (excluding the edge cases in [which a user specifically recommends a frie... |
|algorithms|machine-learning|social-graphs| |
See [Terminator][1] and [AProVe][2]. They tend to rely on heuristics, and I'm not sure if they clearly describe the class of programs for which they work. Still, they are regarded as state-of-the art, so they should be good starting points for you.
[1]: http://research.microsoft.com/en-us/um/cambridge/projects/... |
Not a formally rigid answer, but here it goes:
The problem in determining if it halts or loops forever. Looping on finite collections one element at a time or between an interval of numbers is ok.
Recursion is probably not ok, unless if you set an artifical rule to make it finite, like allowing a maximum stack de... |
We learned about the class of context-free languages $\mathrm{CFL}$. It is characterised by both [context-free grammars](https://en.wikipedia.org/wiki/Context-free_grammar) and [pushdown automata](https://en.wikipedia.org/wiki/Pushdown_automata) so it is easy to show that a given language is context-free.
How do I s... |
How to prove that a language is not context-free? |
|formal-languages|context-free|proof-techniques| |
We learned about the concept of enumerations of functions. In practice, they correspond to programming languages.
In a passing remark, the professor mentioned that the class of all total functions (i.e. the functions that always terminate for every input) is *not* enumerable. That would mean that we can not devise a... |
Why are the total functions not enumerable? |
|computability|recursion-theory| |
|algorithms|machine-learning|social-networks| |
You need to provide a definition of your script language, and what do you mean by "expect" from the script writers.
If the language is allowing only linear assignments and linear conditionals, then this halting is decidable in polynomial time (more or less ${\cal O}(n^\omega)$) by Tiwari's paper in my comment.
Th... |
Yes, it can be possible. One common way of solving such problems is considering an extra (monotone) *uncomputable* parameter depending of the code as a part of input. The complexity of the problem having that parameter can be severely reduced.
We cannot compute the parameter, but if you know that the input instance... |
Not a formally rigid answer, but here it goes:
The problem in determining if it halts or loops forever. Looping on finite collections one element at a time or between an interval of numbers is ok. EDIT: Obviously, this will only work if the iterated collection or interval are prohibited to change (e.g., by immutabil... |
In our computer systems lecture we were introduced to the MIPS processor. It was (re)developed over the course of the term and has in fact been quite easy to understand. It uses a [RISC](https://en.wikipedia.org/wiki/Reduced_instruction_set_computing) design, that is its elementary commands are regularly encoded and th... |
Why would anyone want CISC? |
|computer-architecture| |
|computability|undecidability|software-engineering|formal-methods| |
|formal-languages|context-free|proof-techniques|grammars| |
When implementing a dictionary ('I want to look up customer data by their customer IDs'), the typical data structures used are hash tables and binary search trees. I know for instance that the C++ STL library implements dictionaries (they call them maps) using (balanced) binary search trees, and the .NET framework uses... |
Hash tables versus binary trees |
|algorithms|data-structures|binary-trees|hash-tables| |
When reporting algorithmic complexity of an algorithm, one assumes the underlying computations are performed on some abstract machine (e.g. RAM) that approximates a modern CPU. Such models allow us to report time and space complexity of algorithms. Now, with the spread out of [GPGPUs](http://en.wikipedia.org/wiki/GPGPU... |
Is there an abstract machine that can capture power consumption? |
|time-complexity|computer-architecture| |
The intuitive answer is that if you don't have unbounded loops and you don't have recursion and you don't have goto, your programs terminate. This isn't quite true, there are other ways to sneak non-termination in, but it's good enough for most practical cases. Of course the converse is wrong, there are languages with ... |
|time-complexity|computer-architecture|power-consumption| |
It is often said that hash table lookup operates in constant time: you compute the hash value, which gives you an index for an array lookup. Yet this ignores collisions; in the worst case, every item happens to land in the same bucket and the lookup time becomes linear ($\Theta(n)$).
Under what assumptions can hash ... |
It is arguable that most languages created to describe everyday problems are context-sensitives. In the other hand, it is possible and not hard to find some languages that are not recursive or even not recursively-enumerable.
Between these two types are the recursive non-context-sensitive languages. Wikipedia gives ... |
Decidable non-context-sensitive languages |
|formal-languages|formal-grammars| |
Because of diagonalization. If $(f_e: e \in \mathbb{N})$ was a computable enumeration of all total computable functions from $\mathbb{N}$ to $\mathbb{N}$, such that every $f_e$ was total, then $g(i) = f_i(i)+ 1$ would also be a total computable function, but it would not be in the enumeration. That would contradict the... |
Just to be clear, we need to distinguish mathematical functions (I will call them *functions* and there is often uncountably many of them so they are not at all enumerable) and functions you can write: I will call them *programs* or also *computable functions*.
A subset $S$ of a countable set $E$ is called [computab... |
To my knowledge the pumping lemma is *by far* the simplest and most-used technique. If you find [it][1] hard, try the [regular version][2] first, it's not that bad. There are some other means for languages that are far from context free. For example undecidable languages are trivially not context free.
That said, I ... |
Just like $\{a^nb^n:n\geq 0\}$ is context-free but not regular, the language $L=\{a^nb^nc^n:n\geq 0\}$ is decidable but not context-free. However, $L$ can be solved using logarithmic space (you just need a counter for each of the symbols $a$, $b$ and $c$), so it is not EXSPACE-hard. |
A whole treatise could be written on this topic; I'm just going to cover some salient points, and I'll keep the discussion of other data structures to a minimum (there are many variants indeed). Throughout this answer, $n$ is the number of keys in the dictionary.
The short answer is that **hash tables are faster in ... |
It is arguable that most languages created to describe everyday problems are context-sensitives. In the other hand, it is possible and not hard to find some languages that are not recursive or even not recursively-enumerable.
Between these two types are the recursive non-context-sensitive languages. Wikipedia gives ... |
Just like $\{a^nb^n:n\geq 0\}$ is context-free but not regular, the language $L=\{a^nb^nc^n:n\geq 0\}$ is decidable but not context-free. However, $L$ can be solved using logarithmic space (you just need a counter for each of the symbols $a$, $b$ and $c$), so it is not EXSPACE-hard.
Also, the language $\{(r_1,r_2):L... |
Apart from the "traditional" [pumping lemma](http://en.wikipedia.org/wiki/Pumping_lemma_for_context-free_languages), you have the more powerful [Ogden's lemma](http://en.wikipedia.org/wiki/Ogden%27s_lemma), and also [Parikh's theorem](http://en.wikipedia.org/wiki/Parikh's_theorem) which allows you to show a language $L... |
[CSL is the same as $\mathsf{NSpace}(n)$][1] (non-deterministic linear space). Any language which is outside $\mathsf{NSpace}(n)$ is not CSL.
To get a feeling of the situation, remember that $SAT \in \mathsf{NSpace}(n)$.
[1]: http://qwiki.stanford.edu/index.php/Complexity_Zoo:C#csl |
There isn't an established model yet, but this is an area of active research right now. One of the experts on the algorithms side of things is Kirk Pruhs. [His papers][1] have more information, and you can also [browse this presentation][2].
[1]: http://www.informatik.uni-trier.de/~ley/db/indices/a-tree/p/Pruhs... |
|formal-languages|complexity-theory|formal-grammars| |
Apart from the "traditional" [pumping lemma](http://en.wikipedia.org/wiki/Pumping_lemma_for_context-free_languages), you have the more powerful [Ogden's lemma](http://en.wikipedia.org/wiki/Ogden%27s_lemma), and also [Parikh's theorem](http://en.wikipedia.org/wiki/Parikh's_theorem) which allows you to show a language $L... |
I am curious in determining an approach to tackling a "suggested friends" algorithm.
[Facebook](http://facebook.com) has a feature in which it will recommended individuals to you which it thinks you may be acquainted with. These users normally (excluding the edge cases in [which a user specifically recommends a frie... |
There is no general method since the set non-context-free-languages is not semi-decidable (a.k.a. r.e.). If there was a general method, we could use it to semi-decide this set.
The situation is even worse, since given two CFL's it is not possible to decide whether their intersection is also a CFL.
Reference: H... |
|computability| |
**Models for energy consumption**
Speed scaling is one of the most used model (recently) when considering energy consumption.
It consists in modifying the supply voltage. By lowering supply voltage, or processor clock frequency, it is possible to
achieve important reductions in power consumption;
faster speeds a... |
There is a general historical trend.
In the olden days, memories were small, and so programs were perforce small. Also, compilers were not very smart, and many programs were written in assembler, so it was considered a good thing to be able to write a program using few instructions. Instruction pipelines were simple... |
**Models for energy consumption**
Speed scaling is one of the most used model (recently) when considering energy consumption.
It consists in modifying the supply voltage. By lowering supply voltage, or processor clock frequency, it is possible to
achieve important reductions in power consumption;
faster speeds a... |
|complexity-theory|computer-architecture|power-consumption|machine-models| |
|complexity-theory|computer-architecture|power-consumption|machine-models| |
[CSL is the same as $\mathsf{NSpace}(n)$][1] (non-deterministic linear space). Any language which is outside $\mathsf{NSpace}(n)$ is not CSL.
To get a feeling of the situation, remember that $SAT \in \mathsf{NSpace}(n)$ and even TQBF.
> What others problems exists that are decidable but yet non-context-sensitive?... |
[CSL is the same as $\mathsf{NSpace}(n)$][1] (non-deterministic linear space). Any language which is outside $\mathsf{NSpace}(n)$ is not CSL.
To get a feeling of the situation, remember that $SAT \in \mathsf{NSpace}(n)$ and even TQBF.
> What others problems exists that are decidable but yet non-context-sensitive?... |
At the midterm there was a variant of the following question:
> For a decidable $L$ define $$\text{Pref}(L) = \{ x \mid \exists y \text{ s.t. } xy \in L\}$$
> Show that $\text{Pref}(L)$ is not necessarily decidable.
But if I choose $L=\Sigma^*$ then I think $\text{Pref}(L)$ is also $\Sigma^*$, thus decidable. A... |
decidability of prefix language |
|computability|undecidability| |
Let $\cal{S}=\{S_i\}_{1\leq i\leq n}$ be a partial $(m,k)$-design and $f: \{0,1\}^m \to \{0,1\}$ be a Boolean function. The Nisan-Wigderson generator $G_f: \{0,1\}^l \to \{0,1\}^n$ is defined as follows:
$$G_f(x) = (f(x|_{S_1}) , \ldots, f(x|_{S_n}) )$$
To compute the $i$th bit of $G_f$ we take the bits of $x$ wi... |
Proving the security of Nisan-Wigderson pseudo-random number generator |
|crypto| |
Note that using an existential quantifier in front of a decidable language we can obtain any r.e. language, i.e. every r.e. language is expressible as
$$\exists y \ V(\langle x,y \rangle)$$
where $V$ is a decidable language. These include undecidable r.e. languages like
$$A_{TM} = \\{ \langle e, x\rangle\ \mid ... |
Note that using an existential quantifier in front of a decidable language we can obtain any r.e. language, i.e. every r.e. language is expressible as
$$ \{ x\in \Sigma^* \mid \exists y \in \Sigma^* \ \langle x,y \rangle \in V \} $$
where $V$ is a decidable language. These include undecidable r.e. languages lik... |
|crypto|psuedo-random| |
|computability|undecidability| |
*Originally: http://math.stackexchange.com/questions/74453/how-is-the-loop-invarient-obtained-in-this-square-root-bound-finding-algorithm but unanswered*
Consider the following algorithm.
u := 0
v := n+1;
while ( (u + 1) is not equal to v) do
x := (u + v) / 2;
if ( x * x <= n)
... |
How is the loop invarient obtained in this square root bound finding algorithm? |
|algorithms| |
How do I prove that the [Toffoli gate](https://en.wikipedia.org/wiki/Toffoli_gate) is universal? |
Universality of the Toffoli gate |
|quantum-computing|circuits| |
|algorithms| |
*Originally http://math.stackexchange.com/questions/22614/help-understand-texthandle-in-parsing-problem but unaswered there*
The BNF is defined as followed:
S -> aAb | bBA
A -> ab | aAB
B -> bB | b
The sentence is:
aaAbBb
And this is the parse tree:
![enter image description here][1]
... |
Understanding $\text{handle}$ in parsing problem |
|formal-languages| |
*Originally http://math.stackexchange.com/questions/22614/help-understand-texthandle-in-parsing-problem but unaswered there*
The BNF is defined as followed:
S -> aAb | bBA
A -> ab | aAB
B -> bB | b
The sentence is:
aaAbBb
And this is the parse tree:
![enter image description here][1]
... |
|crypto|pseudo-random| |
<pre>Re-posting from cstheory as suggested </pre>
I'm a graduate student taking a course in theory of computation and I'm having serious trouble producing content once I'm asked to. I'm able to follow the textbook ( Introduction to the Theory of Computation by Michael Sipser ) and lectures; however when asked to pro... |
Problems with course: Theory of Computation |
|computability|soft-question| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.