# Proving Regularity of Languages that are 1/k of an already known regular language

There is this question in Kozen, that states if a language is regular then the first half would also be regular. Also I found a material on the internet that extends the thinking saying a language that is two-thirds of already known regular language is regular. I'm tempted to think that it should also hold true for any general $k>0$ that $m/k$th ($1 \leqslant m \leqslant k-1$) portion of a regular language would also be regular. I need a mathematical proof ( or a constructive proof having mathematical verifications done on it ) for the above statement.
EDIT: For the "first half Language" which is much better formalised by David in the comments, I tried a similar argument as the answer in the link given by Hendrik. The product automaton notion was intuitively clear. But I was stuck with the transition listings for the 2nd state in the pair of states so formed by constructing the product automaton. I was flummoxed as to how I could be able to get the exact state for the corresponding word 'w' which would be the "first half" of a word accepted by the original regular language.

• What do you mean by "the first half" of a language $L$? The set of strings $\{w\mid ww'\in L \text{ for some }w'{ with }|w'|=|w|\}$? Also, what is a proof that is not mathematical? Sep 8, 2014 at 23:12
• The "first half" automaton-construction for regular languages was given in a question at this site. The method used there is easily expandable to 1/k. Let us know when you have specific questions. Sep 9, 2014 at 1:08
• yes, sir I just looked through the site and found those questions... I'll come back to this question in case I need more mathematical rigor to answer that question... @David.. Yes, sir I meant that, I'm sorry for not explaining things clearly. Please pardon my naiveté. Sep 9, 2014 at 3:57
• @Hendrik ...I read up the answer provided in the link given. I am a bit confused with the last sentence where they do away with the assumption. Is it saying that say if Q={q_1,q_2..q_n} then my new automaton would have states like (q_1,q_2) n times? Each time q_2 transiting to one of q_i (1<=i<=n) Sep 9, 2014 at 4:31
• What have you tried and where did you get stuck? Also, please edit the question to include a mathematical definition of your operator -- how can you expect a proof without a definition?
– Raphael
Sep 9, 2014 at 10:16

Let $L$ be a regular language and let $(p, q) \in \mathbb{N}^2$. Then the following language is regular: $$L_{p,q} = \{ u \in A^* \mid \text{there exist x and y in A^* such that |x| = p|u|, |y| = q|u| and xuy \in L} \}$$ Furthermore, for any subset $S$ of $\mathbb{N}^2$, the language $$L_S = \bigcup_{(p,q,r) \in S} L_{p,q}$$ is also regular. I would like to insist that it works for any any subset $S$, including non recursively enumerable subsets of $\mathbb{N}^2$, which might look a little bit suspicious at first glance...

You can try to prove these results by using automata, but it is much easier to use the fact that a language is regular iff it is recognized by a finite monoid.

Let $L$ be a regular language of $A^*$. It is recognized by a finite monoid $M$, that is, there is a surjective monoid morphism $f:A^* \to M$ and a subset $P$ of $M$ such that $f^{-1}(P) = L$. Now $\mathcal{P}(M)$, the powerset of $M$, is also a finite monoid under the multiplication defined, for $X, Y \in \mathcal{P}(M)$, by $XY = \{ xy \mid x \in X, y \in Y\}$.

Let now $h: A^* \to \mathcal{P}(M) \times M$ be the monoid morphism defined, for each letter $a \in A$, by $h(a) = (f(A), f(a))$. Then for each word $u$, $h(u) = (f(A^{|u|}), f(u))$. I claim that $L_{p,q} = h^{-1}(Q)$ where $$Q = \bigl\{(R,m) \in \mathcal{P}(M) \times M \mid R^pmR^q \cap P \not= \emptyset \bigr\}.$$ and similarly $L_S = h^{-1}(T)$ where $$T = \Bigl\{(R,m) \in \mathcal{P}(M) \times M \mid \Bigl(\bigcup_{(p,q) \in S}R^pmR^q\Bigr) \cap P \not= \emptyset \Bigr\}.$$ Thus $L_{p,q}$ and $L_S$ are recognized by the finite monoid $\mathcal{P}(M) \times M$ and hence are regular.

Proof of the claim. \begin{align*} h^{-1}(Q) &= \{u \in A^* \mid (f(A^{|u|}), f(u)) \in Q \} \\ &= \{u \in A^* \mid f(A^{p|u|}f(u)f(A^{q|u|}) \cap P \not= \emptyset \} \\ &= \{u \in A^* \mid f(A^{p|u|}uA^{q|u|}) \cap P \not= \emptyset \} \\ &= \{u \in A^* \mid A^{p|u|}uA^{q|u|} \cap f^{-1}(P) \not= \emptyset \} \\ &= \{u \in A^* \mid A^{p|u|}uA^{q|u|} \cap L \not= \emptyset \} \\ &= L_{p,q} \end{align*}

• Could you suggest to me a book which I can go through to develop the Mathematical structures for proving such things related to Automata. I do not have a background on Abstract Algebra. I wish to be able to give proofs like the one you have given here. Thank you, for answering my question. Though truly speaking I didn't get much of what you wrote here :P I wish to work on this and get better :) Sep 9, 2014 at 16:42

Suppose we are given a regular language $L$ and integers $p, q$, and are interested in the language $M$ of all $x$ such that $axb\in L$ for some $|a|=p|x|,|b|=q|x|$.

Our starting point is an automaton for $L$. The automaton for $M$ starts by guessing two states $s, t$ of the $L$ automaton. These are supposed to be the states just before and just after reading $x$. The new automaton keeps track of the states, corresponding to the $a, x, b$ part of the purported word. They start at $s_0,s, t$, where $s_0$ is the initial state of the $L$ automaton. When reading a character, we update the $x$ state in the expected way. We also update the other states by guessing $p, q$ characters, accordingly. We are in an accepting state of the tracked states are $s, t, f$ for some accepting state $f$ of the $L$ automaton.

Each choice of $p, q$ controls in which possible ways we can advance the $a, b$ states. There are only a finite number of possibilities here (basically since the $L$ automaton is finite), and so we can handle arbitrary many allowed choices for the pair $p,q$, like shown in the other answer.

• Thanks a lot Sir, for this answer. Perhaps my biggest problem here is the inability to completely grasp the notion of non-determinism used to guess states s,t of L. Understanding the part after the choices are made is complete. I perhaps need to get more acquainted to the utilities of guessing. Sep 9, 2014 at 15:45
{"ft_lang_label":"__label__en","ft_lang_prob":0.89767313,"math_prob":0.9921534,"size":7073,"snap":"2022-05-2022-21","text_gpt3_token_len":2122,"char_repetition_ratio":0.11628236,"word_repetition_ratio":0.1825525,"special_character_ratio":0.3035487,"punctuation_ratio":0.10519218,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9998628,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-17T11:42:29Z\",\"WARC-Record-ID\":\"<urn:uuid:5acf3134-ab1a-4e3b-91b1-3ce61ed30dae>\",\"Content-Length\":\"246424\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8bda086d-6531-447f-9a61-1008766eaf5b>\",\"WARC-Concurrent-To\":\"<urn:uuid:8a785918-deae-4a2b-87ad-55a95f015145>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://cs.stackexchange.com/questions/29767/proving-regularity-of-languages-that-are-1-k-of-an-already-known-regular-languag\",\"WARC-Payload-Digest\":\"sha1:A5OOPQ2NPEILRFZZBUM5XLGUBJLLGJQI\",\"WARC-Block-Digest\":\"sha1:PHG3CGKPMDBCZOFU6BHTT4RYBHMK75AP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662517245.1_warc_CC-MAIN-20220517095022-20220517125022-00534.warc.gz\"}"}