instruction
stringlengths
0
29.8k
⌀
Time to construct a GNBA for LTL formula
My question isn't actually what exactly the title suggests; I know the answer is the Catalan number. But more specifically, is there a recurrence relation that gives the number of expression containing $n$ pairs of matching brackets such that no more than $l$ open brackets are not closed at any given point. For inst...
What is the number of expressions containing n pairs of matching brackets?
|combinatorics|recursion|
I have a problem with the proof for constructing a GNBA ([generalized nondeterministic Büchi automaton](https://en.wikipedia.org/wiki/Generalized_B%C3%BCchi_automaton)) for a [LTL formula](https://en.wikipedia.org/wiki/Linear_temporal_logic): **Theorem:** For any LTL formula $\varphi$ there exists a GNBA $G_{\varph...
I have a problem with the proof for constructing a GNBA ([generalized nondeterministic Büchi automaton](https://en.wikipedia.org/wiki/Generalized_B%C3%BCchi_automaton)) for a [LTL formula](https://en.wikipedia.org/wiki/Linear_temporal_logic): **Theorem:** For any LTL formula $\varphi$ there exists a GNBA $G_{\varph...
In general, logical formulae can be thought of as trees; inner nodes are operators and leaves are atomic propositions. Therefore, every formula consists of as many direct subformulae (that is on the first level) as its top-most operator's arity. For example, $\qquad \varphi \land \psi$ has two direct subformulae ...
I know the answer *without* nesting limit the Catalan number. My question is, specifically, is there a recurrence relation that gives the number of expression containing $n$ pairs of matching brackets such that no more than $l$ open brackets are not closed at any given point? For instance, for $n=3$ and $l=2$ the an...
What is the number of expressions containing n pairs of matching brackets with nesting limit?
|formal-languages|combinatorics|recurrence-relation|word-combinatorics|
I know the answer *without* nesting limit is the Catalan number. My question is, specifically, is there a recurrence relation that gives the number of expression containing $n$ pairs of matching brackets such that no more than $l$ open brackets are not closed at any given point? For instance, for $n=3$ and $l=2$ the...
Okay. I think I may have figured it out myself. I invite everyone to check my answer to see if it makes sense. So the first bracket must be a left bracket and there must be some right bracket later on that corresponds to this first bracket. Inside these two brackets there is a valid bracket expression $A$ with depth at...
The question comes down to: how many ways are there to distribute $n$ nodes into subtrees? This is related to [integer partitions](https://en.wikipedia.org/wiki/Integer_partitions); in fact, this recurrence describes the desired quantity: $\qquad \displaystyle \begin{align} a(1,1) &= 1 \\ a(n,1) &= 0 \qquad\qq...
So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility. For example, say you have the following allocation (where 'O' stands for occupied block and 'E' stands for empty block): ----...
How does worst-fit memory allocation react when encountering contiguous empty memory blocks?
|algorithms|operating-systems|memory-allocation|
Let $L_1$ be regular, $L_1 \cap L_2$ regular, $L_2$ not regular. Show that $L_1 \cup L_2$ is not regular or give a counterexample. I tried this: Look at $L_1 \backslash \{L_2 \cap L_1\}$. This one is regular. I can construct a finite automata for this ($L_1$ is regular, $L_2 \cap L_1$ is regular, so remove all the p...
Proof that union of a regular and a not regular language is not regular
|regular-languages|automata|finite-automata|
|regular-languages|automata|finite-automata|
We can prove this by contradiction. Lets define $\bar{L_1} = \Sigma^* \backslash L_1$. Then we can reformulate $L_2$: $L_2 = ((L_1 \cup L_2) \backslash L_1) \cup (L_1 \cap L_2) = ((L_1 \cup L_2) \cap \bar{L_1}) \cup (L_1 \cap L_2)$ We know: - Regular Languages are closed under union, intersection and comple...
So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility. For example, say you have the following blocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to a...
My setup is something like this: I have a sequence of sets of integers $C_i (1\leq i\leq n)$, with $|C_i|$ relatively small - on the order of four or five items for all $i$. I want to choose a sequence $x_i (1\leq i\leq n)$ with each $x_i\in C_i$ such that the total variation (either $\ell_1$ or $\ell_2$, i.e. $\sum_{...
Algorithm for minimizing the total variation of a sequence of discrete choices?
|algorithms|complexity-theory|optimization|
Minimizing the total variation of a sequence of discrete choices
|algorithms|graphs|parallel-computing|scheduling|
null
null
|formal-languages|compilers|
Probably i've an answer for this problem, but i'm not sill sure that it works. It is not important to "find" the two path, the only important thing is to "know" if they exist or not. I don't think that this is an NP complete problem. So, take the adjacency matrix $\textbf A$. We can easily suppose that it is fill...
Here's a linear-time dynamic program. Fix $m = O(1)$ and assume $\forall i \in \{1, \ldots, n\}$ that $C_i = \{C_{i1}, \ldots, C_{im}\}$. Let $\text{Cost}(i, j)$ be the minimum cost of a length-$i$ prefix ending with $C_{ij}$. $$\forall j \in \{1, \ldots, m\},\quad\text{Cost}(1, j) = 0\\ \forall i \in \{2, \ldots, n\...
I have a very simple counter example. Take $$L_2 = \Sigma^{*}$$ (where $\Sigma$ is the alphabet you are working over). Every language is a subset of $L_2$, in particular the non-regular languages are (strict) subsets of $L_2$, yet $L_2$ is regular. A finite automaton accepting $L_2$ has only one state and this state...
We can prove this by contradiction. Lets define $\overline{L_1} = \Sigma^* \setminus L_1$. Then we can reformulate $L_2$: $L_2 = ((L_1 \cup L_2) \setminus L_1) \cup (L_1 \cap L_2) = ((L_1 \cup L_2) \cap \overline{L_1}) \cup (L_1 \cap L_2)$ We know: - Regular Languages are closed under union, intersection an...
>Let $L_1$ be regular, $L_1 \cap L_2$ regular, $L_2$ not regular. Show that $L_1 \cup L_2$ is not regular or give a counterexample. I tried this: Look at $L_1 \backslash \{L_2 \cap L_1\}$. This one is regular. I can construct a finite automata for this ($L_1$ is regular, $L_2 \cap L_1$ is regular, so remove all the ...
|formal-languages|compilers|parsers|
Here is a dynamic program. Assume that $C_i = \{C_{i_1}, \ldots, C_{i_m}\}$ for all $i \in [n]$ for the sake of clarity; the following can be adapted to work if the $C_i$ have different cardinalities. Let $\operatorname{Cost}(i, j)$ be the minimum cost of a sequence over the first $i$ sets, ending with $C_{i_j}$. The f...
So I have a problem understanding how the [worst-fit protocol for memory allocation](http://courses.cs.vt.edu/csonline/OS/Lessons/MemoryAllocation/index.html) reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility. For example, say you have the following blocks (wher...
null
Okay, finally got you the complexity you were looking for, and what's best, I found it in the literature: ##Worst-Case Complexity **Delete**: $\bf\mathcal{O}(1)$ **Delete-min**: $\bf\mathcal{O}(1)$ **Find-min**: $\bf\mathcal{O}(1)$ **Insert**: $\bf\mathcal{O}(log\ n)$ ##Reference > **IF MELD** is allow...
null
I have a set of strings $S$ and I am using the edit-distance ([Levenshtein][1]) to measure the distance between all pairs. Is there an algorithm for finding the string $x$ which minimizes the sum of the distances to all strings in $S$, that is $\arg_x \min \sum_{s \in S} \text{edit-distance}(x,s)$ It seems lik...
Find string that minimizes the sum of the edit distances to all other strings in set
|algorithms|
It seems that this can be solved by simply computing a shortest path in a directed acyclic graph. Construct an $n$-staged graph $G = (\bigcup_{i=1}^n V_i, E)$ where each $v \in V_i$ corresponds to a unique element $x \in C_i$. Add directed edges between vertices in each adjacent stage, with the cost being either the...
It seems that this can be solved by simply computing a shortest path in a directed acyclic graph. Construct an $n$-staged graph $G = (\bigcup_{i=1}^n V_i, E)$ where each $v \in V_i$ corresponds to a unique element $x \in C_i$. For each $u \in V_i, v \in V_{i+1}$, add a directed edge $(u, v)$ the cost being either th...
COnsider the Kripke structure: -->(p,!q)-->(!p,!q)-->(!p,q) \-/ \_/ where p,!q means "p and not q" and \\_/ is a "self loop", we number states s1,s2,s3 from left. Now consider the three LTL properties: M |= GFp -> GFq false M |= GFp false M |= GFq false the oddity is this...
kripke model and LTL vs CTL formulae interpretation (2nd example)
|logic|
null
Consider the [Kripke structure](http://en.wikipedia.org/wiki/Kripke_structure): $$ \begin{array}{ccccccc} \to & (p, \neg q) & \to & (\neg p, \neg q) & \to & (\neg p, q) \\ & \circlearrowright & & \circlearrowright & & \circlearrowright & \\ \end{array} $$ -->(p,!q)-->(!p,!q)-->(!p,q) \-/ ...
Why is GFp -> GFq false in LTL, even though GFp and GFq are false?
|logic|modal-logic|linear-temporal-logic|
It seems that this can be solved by simply computing a shortest path in a directed acyclic graph. The reasoning is that your objective function minimizes the total distance between selected "neighbors" in your sets $\mathcal{C} = \{C_1, \dotsc, C_n\}$. Construct an $n$-staged graph $G = (\bigcup_{i=1}^n V_i, E)$ whe...
[Linear temporal logic](http://en.wikipedia.org/wiki/Linear_temporal_logic) (also called linear-time temporarl logic), usually called LTL, is a temporal logic that can encode assertions about the future of traces a linear model of time. In addition to the propositional calculus ($\phi \wedge \psi$, $\phi \vee \psi$, $\...
LTL (linear temporal logic or linear-time temporal logic) is a temporal logic that can encode assertions about the future of traces.
The problem is known as "[median string problem][1]" and it is NP-complete; some results can be found [searching with Google][2]; in particular "[2-Approximation Algorithms for Median and Centre String Problems][3]". If $x$ must be one of the points in $S$ then the problem becomes solvable in polynomial time. [1...
null
Here is a well-known problem. Given an array $A[1\dots n]$ of positive integers, output the smallest positive integer not in the array. The problem can be solved in $O(n)$ space and time: read the array, keep track in $O(n)$ space whether $1,2,\dots,n+1$ occured, scan for smallest element. I noticed you can tr...
null
This happens because of the way LTL formulae are evaluated over Kripke structures: Recall that LTL is first of all a logic of traces; when we say that a Kripke structure $S$ satisfies $\varphi$, we mean that all its traces do, i.e. we have an implicit universal quantification. The consequence is that, for an LTL fo...
Suppose we are given a list of $n$ points, whose $x$ and $y$ coordinates are all non-negative. Suppose also that there are no duplicate points. We can only go from point $(x_i, y_i)$ to point $(x_j, y_j)$ if $x_i \le x_j$ and $y_i \le y_j$. The question is: given these $n$ points, what is the maximum number of points t...
Maximum number of points that two paths can reach
|dynamic-programming|recurrence-relation|
Consider the [Kripke structure](http://en.wikipedia.org/wiki/Kripke_structure): $$ \begin{array}{ccccccc} \to & (p, \neg q) & \to & (\neg p, \neg q) & \to & (\neg p, q) \\ & \circlearrowright & & \circlearrowright & & \circlearrowright & \\ \end{array} $$ where $(p, \neg q)$ means “$p$ and not $q$” and $\c...
[It looks pretty damned complicated to me][1]. >Thus, in the formula above, the calculation of P is just the XOR of each stripe. This is because addition in any characteristic two finite field reduces to the XOR operation. The computation of Q is the XOR of a shifted version of each stripe. (P being the first par...
I'm trying to understand how the 2nd parity bit or byte is set in RAID 6. I'm reading a paper by H. Peter Anvin, and it goes into Galois field algebra, which is somewhat new to me. It's at http://kernel.org/pub/linux/kernel/people/hpa/raid6.pdf. Anyway, a rep from HP was trying to explain RAID 6 to me and she though...
Is the 2nd parity bit in RAID 6 a simple calculation?
|untagged|
|storage|error-correcting-codes|
The computation for $Q$ is _definitely_ more difficult than the XOR computation needed for $P$ though it is in one sense the same kind of calculation: a polynomial evaluation. Stripped of the detailed computational techniques described in the link, the idea is to regard the $n$ data bytes/drives $D_0$, $D_1, \ldo...
I created a simple regular expression lexer and parser to take a regular expression and generate its parse tree. Creating a non-deterministic finite state automaton from this parse tree is relatively simple for basic regular expressions. However I can't seem to wrap my head around how to simulate backreferences, lookah...
How to simulate backreferences, lookaheads, and lookbehinds in finite state automata?
|finite-automata|
So I have a problem understanding how the [worst-fit protocol for memory allocation](http://courses.cs.vt.edu/csonline/OS/Lessons/MemoryAllocation/index.html) reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility. For example, say you have the following blocks (wher...
null
null
|algorithms|reference-request|strings|string-metrics|
Extending upon [Klaus' answer](http://cs.stackexchange.com/a/2552/98), here are counter-examples: 1. $s_1^\omega = (p,\lnot q)^\omega$ is a trace -- so $\mathrm{G}\, \mathrm{F}\, q$ is not valid. 2. $s_1s_2^\omega = (p,\lnot q)(\lnot p,\lnot q)^\omega$ is a trace -- so $\mathrm{G}\, \mathrm{F}\, p$ is not valid. ...
I'm trying to understand how the 2nd parity bit or byte is set in RAID 6. I'm reading a [paper by H. Peter Anvin](http://kernel.org/pub/linux/kernel/people/hpa/raid6.pdf), and it goes into Galois field algebra, which is somewhat new to me. Anyway, a rep from HP was trying to explain RAID 6 to me and she thought it was ...
|operating-systems|storage|error-correcting-codes|
The computation for $Q$ is _definitely_ more difficult than the XOR computation needed for $P$ though it is in one sense the same kind of calculation: a polynomial evaluation. Stripped of the detailed computational techniques described in the link, the idea is to regard the $n$ data bytes/drives $D_0$, $D_1, \ldo...
I created a simple regular expression lexer and parser to take a regular expression and generate its parse tree. Creating a non-deterministic finite state automaton from this parse tree is relatively simple for basic regular expressions. However I can't seem to wrap my head around how to simulate backreferences, lookah...
|automata|finite-automata|regular-expressions|
At least for backreferences, this is not possible. For example, the regex `(.*)\1` represents a language that is not regular. What that means is that it's impossible to create a finite automaton (deterministic or not) that would recognize this language. If you want to prove this formally, you can use [the pumping lemma...
First of all, backreferences can *not* be simulated by finite automata as they allow you to describe non-regular languages. For example, `([ab]^*)\1` matches $\{ww \mid w \in \{a,b\}^*\}$, which is not even context-free. Look-ahead and look-behind are nothing special in the world of finite automata as we only match ...
|computational-geometry|dynamic-programming|recurrence-relation|
|logic|automata|formal-methods|model-checking|linear-temporal-logic|
Extending upon [Klaus' answer](http://cs.stackexchange.com/a/2552/98), here are counter-examples: 1. $s_1^\omega = (p,\lnot q)^\omega$ is a trace -- so $\mathrm{G}\, \mathrm{F}\, q$ is not valid. 2. $s_1s_2^\omega = (p,\lnot q)(\lnot p,\lnot q)^\omega$ is a trace -- so $\mathrm{G}\, \mathrm{F}\, p$ is not valid. ...
null
Suppose we are given a list of $n$ points, whose $x$ and $y$ coordinates are all non-negative. Suppose also that there are no duplicate points. We can only go from point $(x_i, y_i)$ to point $(x_j, y_j)$ if $x_i \le x_j$ and $y_i \le y_j$. The question is: given these $n$ points, what is the maximum number of points t...
The problem, restated and generalized: given a finite set $S$ equipped with a [partial order](http://en.wikipedia.org/wiki/Partial_order) $\le$, find chains $C_1, C_2 \subseteq S$ maximizing $\lvert C_1 \cup C_2 \rvert$. The question is about the case where $S \subseteq \mathbb R_+^2$ and $(x, y) \le (z, w) \Longleftri...
Let $P = p_1\dots p_n$ to sorted list of points. --- Following your recurrence for one path, the first thing to note is that you have to keep track of which points have been visited by the paths; otherwise you can not count correctly. The second thing is that you have now *four* possibilities for every point: nei...
The problem, restated and generalized: given a finite set $S$ equipped with a [partial order](http://en.wikipedia.org/wiki/Partial_order) $\le$, find chains $C_1, C_2 \subseteq S$ maximizing $\lvert C_1 \cup C_2 \rvert$. The question is about the case where $S \subseteq \mathbb R_+^2$ and $(x, y) \le (z, w) \Longleftri...
null
Consider graph $G$, we want to know if there are two different paths from A to B of the same length. What to do? Simple: code two paths in one. Define graph $G'$ with vertices $V \times V \times \{0,1\}$. You make a step in $G'$ by making two independent steps in $G$. The additional bit tells you whether the two paths ...