## How to prove a language is regular?

Another method, not covered by the answers above, is finite automaton transformation. As a simple example, let us show that the regular languages are closed under the shuffle operation, defined as follows:
\$\$
L_1 mathop{S} L_2 = { x_1y_1 ldots x_n y_n in Sigma^* : x_1 ldots x_n in L_1, y_1 ldots y_n in L_2 }
\$\$
You can show closure under shuffle using closure properties, but you can also show it directly using DFAs. Suppose that \$A_i = langle Sigma, Q_i, F_i, delta_i, q_{0i} rangle\$ is a DFA that accepts \$L_i\$ (for \$i=1,2\$). We construct a new DFA \$langle Sigma, Q, F, delta, q_0 rangle\$ as follows:

• The set of states is \$Q_1 times Q_2 times {1,2}\$, where the third component remembers whether the next symbol is an \$x_i\$ (when 1) or a \$y_i\$ (when 2).
• The initial state is \$q_0 = langle q_{01}, q_{02}, 1 rangle\$.
• The accepting states are \$F = F_1 times F_2 times {1}\$.
• The transition function is defined by \$delta(langle q_1, q_2, 1 rangle, sigma) = langle delta_1(q_1,sigma), q_2, 2 rangle\$ and \$delta(langle q_1, q_2, 2 rangle, sigma) = langle q_1, delta_2(q_2,sigma), 1 rangle\$.

A more sophisticated version of this method involves guessing. As an example, let us show that regular languages are closed under reversal, that is,
\$\$ L^R = { w^R : w in Sigma^* }. \$\$
(Here \$(w_1ldots w_n)^R = w_n ldots w_1\$.) This is one of the standard closure operations, and closure under reversal easily follows from manipulation of regular expressions (which may be regarded as the counterpart of finite automaton transformation to regular expressions) – just reverse the regular expression. But you can also prove closure using NFAs. Suppose that \$L\$ is accepted by a DFA \$langle Sigma, Q, F, delta, q_0 rangle\$. We construct an NFA \$langle Sigma, Q’, F’, delta’, q’_0 rangle\$, where

• The set of states is \$Q’ = Q cup {q’_0}\$.
• The initial state is \$q’_0\$.
• The unique accepting state is \$q_0\$.
• The transition function is defined as follows: \$delta'(q’_0,epsilon) = F\$, and for any state \$q in Q\$ and \$sigma in Sigma\$, \$delta(q’, sigma) = { q : delta(q,sigma) = q’ }\$.

(We can get rid of \$q’_0\$ if we allow multiple initial states.) The guessing component here is the final state of the word after reversal.

Guessing often involves also verifying. One simple example is closure under rotation:
\$\$ R(L) = { yx in Sigma^* : xy in L }. \$\$
Suppose that \$L\$ is accepted by the DFA \$langle Sigma, Q, F, delta, q_0 rangle\$. We construct an NFA \$langle Sigma, Q’, F’, delta’, q’_0 rangle\$, which operates as follows. The NFA first guesses \$q=delta(q_0,x)\$. It then verifies that \$delta(q,y) in F\$ and that \$delta(q_0,x) = q\$, moving from \$y\$ to \$x\$ non-deterministically. This can be formalized as follows:

• The states are \$Q’ = {q’_0} cup Q times Q times {1,2}\$. Apart from the initial state \$q’_0\$, the states are \$langle q,q_{curr}, s rangle\$, where \$q\$ is the state that we guessed, \$q_{curr}\$ is the current state, and \$s\$ specifies whether we are at the \$y\$ part of the input (when 1) or at the \$x\$ part of the input (when 2).
• The final states are \$F’ = {langle q,q,2 rangle : q in Q}\$: we accept when \$delta(q_0,x)=q\$.
• The transitions \$delta'(q’_0,epsilon) = {langle q,q,1 rangle : q in Q}\$ implement guessing \$q\$.
• The transitions \$delta'(langle q,q_{curr},s rangle, sigma) = langle q,delta(q_{curr},sigma),s rangle\$ (for every \$q,q_{curr} in Q\$ and \$s in {1,2}\$) simulate the original DFA.
• The transitions \$delta'(langle q,q_f,1 rangle, epsilon) = langle q,q_0,2 rangle\$, for every \$q in Q\$ and \$q_f in F\$, implement moving from the \$y\$ part to the \$x\$ part. This is only allowed if we’ve reached a final state on the \$y\$ part.

Another variant of the technique incorporates bounded counters. As an example, let us consider change edit distance closure:
\$\$ E_k(L) = { x in Sigma^* : text{ there exists \$y in L\$ whose edit distance from \$x\$ is at most \$k\$} }. \$\$
Given a DFA \$langle Sigma, Q, F, delta, q_0 rangle\$ for \$L\$, e construct an NFA \$langle Sigma, Q’, F’, delta’, q’_0 rangle\$ for \$E_k(L)\$ as follows:

• The set of states is \$Q’ = Q times {0,ldots,k}\$, where the second item counts the number of changes done so far.
• The initial state is \$q’_0 = langle q_0,0 rangle\$.
• The accepting states are \$F’ = F times {0,ldots,k}\$.
• For every \$q,sigma,i\$ we have transitions \$langle delta(q,sigma), i rangle in delta'(langle q,i rangle, sigma)\$.
• Insertions are handled by transitions \$langle q,i+1 rangle in delta'(langle q,i rangle, sigma)\$ for all \$q,sigma,i\$ such that \$i < k\$.
• Deletions are handled by transitions \$langle delta(q,sigma), i+1 rangle in delta'(langle q,i rangle, epsilon)\$ for all \$q,sigma,i\$ such that \$i < k\$.
• Substitutions are similarly handles by transitions \$langle delta(q,sigma), i+1 rangle in delta'(langle q,i rangle, tau)\$ for all \$q,sigma,tau,i\$ such that \$i < k\$.

## algebra precalculus – Prove that the square root of distinct prime numbers is irrational

Prove that if $$p_1,…,p_k$$ are distinct prime numbers, then $$sqrt{p_1p_2…p_k}$$ is irrational.

I do not usually prove theorems, so any hint is appreciated. I have taken a look at this and tried to repeat that argument over and over, but I messed up. Perhaps there is an easier to do it. Thanks in advance.

## linear algebra – Easiest way to prove the Rouché–Capelli theorem

Rouché–Capelli theorem (Kronecker–Capelli theorem/Rouché–Fontené theorem/Rouché–Frobenius theorem/Frobenius theorem) states that for the non-homogeneous system Ax = b,

$$(i)$$ $$Ax = b$$ has a unique solution if and only if $$rank(A) = rank(A|b) = n$$

$$(Ii)$$ $$Ax = b$$ is inconsistent (i.e., no solution exists) if and only if $$rank(A) < rank(A|b)$$

$$(iii)$$ $$Ax = b$$ has infinitely many solutions if and only if $$rank(A) = rank(A|b) < n$$

How do I derive these conditions ?

My Understanding

$$(i)$$ $$Ax=b$$ has a unique solution

$$A^{-1}$$ exists $$implies boxed{x=A^{-1}b} implies |A|neq 0 implies rank(A)=n$$

If solution exists, then $$vec{A}_1x_1+vec{A}_2x_2+….+vec{A}_nx_n=bimplies b$$ is a linear combination of the column vectors

$$implies rank(A|b)=rank(A)=n$$

$$(ii)$$ $$Ax=b$$ is inconsistent (i.e., no solution exists)

$$boxed{|A|x=(adj A)bimplies |A|=0 quad&quad adj A.bneq 0}$$

Is there a way to prove the last two conditions of the Rouché–Capelli theorem ?

## formal languages – Prove that every regular subset of \$a^nb^n\$ is finite

This is a simple application of the pumping lemma. Suppose that $$L’$$ is an infinite subset of $$L$$. Given $$p$$, since $$L’$$ is infinite, there exists some $$n geq p$$ such that $$w = a^nb^n in L’$$. Let $$w = xyz$$ be a decomposition of $$w$$ such that $$|xy| leq p$$ and $$y neq epsilon$$. Then $$y = a^t$$ for some $$t neq 0$$, and so $$xy^0z = a^{n-t}b^n notin L’$$. Therefore $$L’$$ is not regular.

One might be tempted to think that this argument generalizes to every $$L$$ whose non-regularity can be proved using the pumping lemma. However, this is incorrect, as the example of $$L cup c^*$$ shows.

This raises the following intriguing question:

For which infinite languages $$L$$ is it the case that all regular subsets of $$L$$ are finite?

## proof assistants – Prove simple theorems in Haskell in automated way

I would like to prove in Haskell, whether in vanilla Haskell or using some libraries / tools, some simple theorems such as:

``````and (n*(n+1)/2 == sum (0..n) | n <- (0..))
``````

Is there a simple enough (ie. fully automated) way to prove such theorems involving integers in Haskell? I am not really interested in the proof itself, or a counterexample, but merely a yes/no answer.

There’s this publication which doesn’t seem practically usable; other than that most of everything else seems to be rather complex, ie. involving a completely separate language and not concerning Haskell.

## inequality – Prove that \$21(a^2+b^2+c^2)ge 20 +9(a^3+b^3+c^3)\$

Let $$a,b,c$$ be the length of sides of triangle such that $$a+b+c=2$$. Prove that
$$21(a^2+b^2+c^2)ge 20 +9(a^3+b^3+c^3)$$

It was in my exam. It can be solved easy by BW but it takes alot of time to expand. I tried to use Schur, AM-GM but all failed.Help me solve it without bw.

## statistics – Prove that \$frac{Y-E(Y)}{sqrt{Var(Y)}}\$ converges in distribution to \$Zsim N(0,1)\$ as \$nto infty\$

Let $$X_i sim Ber(0.5)$$ and $$X_i$$‘s independent. Let $$Y$$ be a random
variable with the same distribution as $$sum_{i=1}^n iX_i$$.
Prove that $$frac{Y-E(Y)}{sqrt{Var(Y)}}$$ converges in distribution to $$Zsim N(0,1)$$ as $$nto infty$$.

In the previous question I calculated
$$E(Y) = frac{n(n+1)}{4}$$ and $$Var(Y) = frac{n(n+1)(2n+1)}{24}$$
I’ve been staring at this for a while now. I’ve tried showing it converges in probability, which would imply it converges in distribution. I also tried to do it with the MGF, which is $$M_Y(t) = prod_{j=1}^n 0.5(1+e^{jt})$$.

But neither approaches worked.

I would like to solve this myself so I would appreciate a hint on which technique to use over a full answer. Thank you in advance!

## How to prove that the language L={w1#w2#. . .#wk: k ≥ 2, each wi ∈ {0,1}^* , and wi = wj for some i !=j} is not context free using the pumping lemma?

I am having trouble choosing the string to use for the proof. I know that I have to choose a string such that at least two substrings separated by the # are equal to each other but am unsure of how to approach this. If someone could please help me with this, I would appreciate it.

## discrete mathematics – prove that our new graph will be still connected

imagine we have simple graph G that is connected and its minimum degree is n-1/2 . assume m = minimum degree of G . prove that if we remove less than m edges , our new graph will be still connected .

actually i tried to prove it with induction but i could not . can you help me prove that in this way or another way.

## inequalities – How Prove this inequality

I come across the following problem in my study.

let $$a_{1} be postive integers,Prove that
$$sum_{i=1}^{n}binom{a_{i}}{i}gedfrac{binom{2n+1}{n}}{2^{2n+1}}sum_{i=1}^{n}2^{a_{i}}$$

Has anyone seen this inequality before, or can you give a counterexample?