A look at an exact smallest grammar algorithm. How do we compute running time big-O?

Pervasive are smallest grammar approximation algorithms. But rarely if ever do they talk about what would be an exact algorithm for computing smallest grammars, regardless of its efficiency.

Here I attemp to exhibit an algorithm but of course I want to make it as efficient as possible. The idea is to construct a grammar starting at the leaf production rules and constructing from them the next stage, until there’s nothing left to construct.

Let $ s$ be a string over the singleton alphabet $ \Sigma = \{a\}$ .

For instance $ s = a^6$ .

A substring $ t \leqslant s$ is repeating in $ s$ if $ t \gamma t \leqslant s$ .

A substring $ t \leqslant s$ is irreducible if it contains no repeating substrings itself.

The repeating irreducibles of length $ \geq 2$ in $ s$ are $ I = \{ a^2, a^3 \}$ . These represent all possible terminal rules that could occur in a smallest grammar of $ s$ . A terminal rule is simply a rule with no variables occuring on the right of its arrow.

Now form and keep track of the rules $ R = \{A \to a^2, B \to a^3\}$ and put $ X := \{ A, B, a\}$ . Now compute all $ xy$ such that $ x, y \in X$ and the grammar $ G = \{ S \to xy\} \cup \text{Rules}(x) \cup \text{Rules}(y)$ is irreducible and $ \overline{G} \leqslant s$ , where $ \overline{G}$ is full grammar expansion to string $ \text{Rules}(\gamma)$ is defined recursively as follows:

$ $ \text{Rules}(a) = \{\} \ \text{Rules}(uv) = \text{Rules}(u) \cup \text{Rules}(v) \ \text{Rules}(U) = \{U \to \gamma_U\} \cup \text{Rules}(\gamma_U), \ $ $ where $ u,v$ are any nonempty strings, and $ U \to \gamma_U \in R$ .

Add each such $ xy$ to $ X$ . Now keep repeating the last step (augmenting $ X$ ) until it no longer changes size. So we have for $ s = a^6$ :

$ $ X_0 = \{ A, B, a\} \ X_1 = \{A^2, Aa, aA, aB, Ba, B^2 \} \ \vdots \ X_h = \dots $ $ Notice that we didn’t add in stuff such as $ AB$ since the resulting test grammar $ G$ would be reducible since $ a^2 \leqslant a^3$ . In other words we’re constructing only irreducible grammars!

What are methods to estimate the upper bound on $ |X_h|$ ? That would give an idea of the running time.


Forgot to mention, $ t$ is a substring of the grammar $ G$ , written $ t \leqslant G$ if for some rule $ M \to \gamma_M$ in $ G$ , $ t$ is a substring of $ \gamma_M$ .

A substring $ t \leqslant G$ is repeating if it is repeating in some $ \gamma_M$ for some $ M \to \gamma_M \in G$ , or if it is a substring of at least two rules in $ G$ .


Note that smallest grammar implies irreducible grammar, but not vise versa. So we’re constructing a larger class of grammars than “just the smallest” and then checking each.

How to compute Galois representations from etale cohomology groups of a generalized flag variety?

Let $ G$ be a connected reductive group over a number field $ K$ , $ P$ be a parabolic subgroup of $ G$ defined over $ K$ , $ X=G/P$ be the generalized flag variety which is a smooth projective variety over $ K$ and $ p$ be a prime number. For a positive integer $ i>0$ , consider the etale cohomology $ V=H^i(X_{K^{alg}},\mathbb Q_p)$ as a Galois representation of $ G_K$ .

How to compute such Galois representation? This may be done somewhere but I can’t find a reference. Firstly, the dimension may be computed by using Betti numbers and some combination datas from the Lie algebra (the odd dimension shall vanish).

Secondly, is the representation semi-simple? For the projective space it’s obviously true as the dimension is no bigger than $ 1$ . If that’s true, then must the direct summand be some $ \mathbb Q_p(-i/2)$ ? Some density theorem may reduce this to the finite field case.

In a short word, how to completely decide the Galois representation? As the flag variety has a stratification by affine spaces, this seems reachable.

Compute the following sum.

I want to compute the following sum $ $ S = \sum_{k=0}^{m} \left\lfloor \frac{k}{2}\right\rfloor.$ $ Here is what I tried: $ $ S = \sum_{k\geq 0, 2|k}^{m} \left\lfloor \frac{k}{2}\right\rfloor + \sum_{k\geq 0, 2\not |k}^{m} \left\lfloor \frac{k}{2}\right\rfloor.$ $ If $ m= 2t$ then $ $ S =\sum_{k\geq 0, 2|k}^{m} \left\lfloor \frac{k}{2}\right\rfloor + \sum_{k\geq 0, 2\not |k}^{m} \left\lfloor \frac{k}{2}\right\rfloor = \frac{t(t+1)}{2} + \frac{(t-1)t}{2} = t^2.$ $ If $ m= 2t+1$ then $ $ S = \sum_{k\geq 0, 2|k}^{m} \left\lfloor \frac{k}{2}\right\rfloor + \sum_{k\geq 0, 2\not |k}^{m} \left\lfloor \frac{k}{2}\right\rfloor = \frac{t(t+1)}{2} + \frac{t(t+1)}{2}= t(t+1).$ $

But I am not sure if this is correct. Perhaps someone could give an indication.

Compute volume of parallelepiped using triple vector

Question

Before anyone claims that I am not studying, my university recently changed their coursework that does not require linear algebra as a pre-requisite to multi-variable calculus.

My professor gave us these questions even though we have no experience with matrix, he did not even teach us about it and I had to study them online by myself.

I only got as far as I could and I only want one question help so I can work on the other similar questions by myself. I would not be here if I can’t find any other help.

Can I compute closest split pair of points where distance is strictly less than delta

I’ve been studying the closest pair algorithm lately and I found this to be an extremely good and intuitive resource: http://serverbob.3x.ro/IA/DDU0221.html. It is also explained in section 33.4, “Finding the closest pair of points” of introduction to algorithms, third edition by CLRS.

I understand why I’d need 7 comparisons for a non pairwise distinct set of points and only 5 otherwise (33.4-2). Both of them follow from the fact that I can fit only 4 points, at least Delta away from each other, on a Delta x Delta box.

What I’ve been wondering though, is if I could trim the number of comparisons down to 3 if I included only points strictly less than Delta away from the middle line, in the middle Delta x 2 Delta strip. The reasoning is that I already have a pair of points Delta away from each other from the recursive calls, I only need points less than Delta and I can only fit 2 points Delta away from each other AND less than Delta from the middle line on each side.

Have I missed something or can I really just compare the 3 following points of every point in a middle strip only containing points strictly less than Delta from the center?

Google Cloud Deleted Compute Engine and Datastore without any explanation

google cloud deleted our compute engine and datastore without out any explanation. While we are sleeping in turkey, they sent mail at 3.30 am click here to stop this process but hey we are sleeping !? is it joke ? we activated our billing already what happened ? why you deleted our compute engine and its snapshot and datastore and not deleted project it self ?

we are in serious trouble righnow, i send feedback to google but i realy dont know what will i can do !

we had thousands of members and google cloud destroyed us.

please advice something

Locked myself out of Google Compute engine

I ran into an issue when I mistakenly changed my quotum for Google Compute engine queries per 100 seconds per user to 0.

I thought 0 would mean ‘unlimited’ but apparently it’s really 0. Making this worse: The quota page itself falls under the Google Compute Engine query API so I can’t access that at all.

It feels like I just bricked my entire project but I hope there is a way around this.

I only have a bronze service account, so can’t really go to Google with this.

Compute the cohomology of $\mathrm{Hom} (\Omega^*(M),\Omega^*(M))$

Let $ M$ be a compact smooth manifold. And particularly I am interested in the case the torus $ M=T^n$ .

Consider the de Rham complex $ (\Omega^*(M), d)$ and the cochain complex $ $ C:=\mathrm{Hom} (\Omega^*(M),\Omega^*(M)) $ $ with the differential map $ \delta$ given by $ $ \delta(f)=d \circ f – f\circ d$ $

Question: what is the cohomology $ H^*(C,\delta)$ ? And, what should be the right tool to do the computation? Is this cohomology related to the usual de Rham cohomology $ H^*_{dR}(M)$ ?