Regular expressions for some languages [duplicate]

This question already has an answer here:

  • How to find a regular expression for a particular language?

    2 answers

  1. String set $ {0,1 } $ having at least two occurrences of substring 00.
  2. $ {a ^ n b ^ m: n ≥ 4, m ≥ 3 } $.
  3. Set of strings on the alphabet $ {a, b, c } $ containing at least one $ a $ and an $ b $.

Show that $ {1 ^ n0 ^ m | space n neq 2 ^ m } $ n is not regular using the pumping lemma

Let $ p $ be the pumping length, and consider the chain $ u = 1 ^ {2 ^ {p! + p}} $, $ w = 0 ^ p $, $ v = epsilon $. Note $ uwv in L $. According to the pumping lemma, there is a value $ q in {1, ldots, p } $ such as $ 1 ^ {2 ^ {p! + P}} 0 ^ {p-q + iq} in L $ for each $ i geq 0 $. To choose $ i = 1 + p! / q $we get a contradiction.

ssl – Regular update of certificate Let's Encrypt

Let's Encrypt certificates expire after 90 days. There are tools for automatic updating (replace the expiring certificate with a new one that is valid within 90 days). Is there a way to make this change 100% smooth, without broken links, without SSL handshake, bad certificate message, etc.?

How to find a regular expression for a particular language?

From time to time, you can just look at the language, get a preview and write a regular expression like this. However, more generally, we need a systematic procedure. Fortunately, the domain of formal languages ​​provides a more systematic approach that will help you structure your approach to this problem. An effective approach is often the following:

Step 1. Find a non-deterministic finite state machine for the language.

2nd step. Convert the NFA into a regular expression.

Step 3 Check if your regular expression is correct.

In more detail, here's how to do each of these two steps:

Step 1. To find an NFA for your language, you may consider this as a programming problem, in which you have to write a program running in a very limited programming language, in which you are only allowed to have one program. number of fixed and finite states. Try writing a program that reads in one string one letter at a time and decides whether or not the input string belongs to the language. using only a fixed amount of memory (for example, $ c $ memory cells, where $ c $ is a constant that does not depend on the input string, not even the length of the input string). This program then naturally corresponds to an NFA, where NFA has a state by possible value of the memory of the program.

Sometimes it can also be useful to use NFA shutdown properties. For example, if the language specified by $ L $ is $ L = L_1 cup L_2 $, then just create an NFA for $ L_1 $ and a NFA for $ L_2 $; then the closing properties for standard languages ​​allow you to derive an NFA for $ L $. For more techniques to build an NFA, take a look at our reference question How to prove that a language is regular? for more approaches.

2nd step. To convert NFA to a regular expression, apply the algorithm described in How to Convert Finite Automata to Regular Expressions ?.

Step 3 To check if your regular expression seems to be correct, you can try it on some examples of strings to see if it seems to give the correct answer. Try both examples that are in the language and many who are not.


This is just an approach. There are other approaches, including writing a regular grammar and converting it to a regular expression, or writing a system of linear expressions in normal languages ​​and converting to a regular expression using the lemma from Arden or others. To have an overview of these methods, take a look at How to prove that a language is regular?, How to convert finite automata into regular expressions? And to Known algorithms to switch from a DFA to a regular expression.

You can also see other examples of this type of problem on this site, for example by looking at issues labeled regular expressions.

fa.functional analysis – Is every pair of closed linear subspaces boundedly regular?

In the context of the development of the spectral theory, J. Neumann showed that for every pair of closed linear subspaces $ M, N $ of a Hilbert space the iterations $ (P_M P_N) ^ nx $where $ $ P_M and $ $ P_N is the orthogonal projection onto $ M $ and $ N $, respectively, converge to the projection onto the intersection $ M cap N $ of $ M $ and $ N $.

In their paper On the convergence of Neumann's alternating projection algorithm for two sets H. H. Bauschke and J. M. Borwein intruded the concept of regularities of tuples of closed and convex sets. The peer $ (M, N) $ is called boundedly regular if for every bounded set $ S $ and for every $ Varepsilon> 0 $ there is a $ delta> $ 0 such that $ max {d (x, M), d (x, N) } < delta $ Implies $ d (x, M cap N) < varepsilon $ for $ x in S $.

This condition is shown in the convergence of von Neumann's alternating projection method. In this paper they mention a pair of closed linear subspaces (with non-closed sum) for which they do not know whether it is boundely regular.

Is the answer to the question of whether or not it is strictly bounded?

Making the regular profit in Forex trading is not so easy. – Discussions and help

Making the regular profit in Forex trading is not so easy. If the investor does not have enough knowledge about the trading market, he may fall and lose his assets. For this, they must learn the appropriate knowledge, establish a market analysis report, manage the risks and select the profitable project. But it's impossible without the help of a broker. I start my Forex trading course with the help of AAFX Trading Broker because they are regulated and provide information and make sure to make regular profits from the Forex Trading sector.

Regular Language – Linear Grammar, Derive a Word

Assuming that a grammar is given, how would you show the steps to derive a word? For example if I had the grammer:

S -> aA
A -> bA
A -> aB
B -> cB
B -> A

And I wanted to build the word abbbacca. How could I show my derivation in stages? Would it be:

S => A => A => A => A => B => B => B

or something that looks more like:

aA => abA => abbA => abbbA => abbbaB => abbbacB => abbbaccB => abbbacca

How to prove that a language is regular?

Another method, not covered by the answers above, is finite transformation of automaton. As a simple example, let us show that ordinary languages ​​are closed under the mix 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 display a shutdown under shuffle using closing properties, but you can also view it directly with the help of DFA. 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 build 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 following symbol is a $ x_i $ (when 1) or a $ y_i $ (when 2).
  • The initial state is $ q_0 = langle q_ {01}, q_ {02}, 1 rangle $.
  • 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. For example, let's show that ordinary languages ​​are closed under overthrow, C is,
$$ L ^ R = {w ^ R: w in Sigma ^ * }. $$
(Here $ (w_1 ldots w_n) ^ R = w_n ldots w_1 $.) This is one of the standard close operations, and the invert closure is easily derived from the manipulation of regular expressions (which can be considered as the counterpart of the finite automaton transformation into regular expressions) – just invert the regular expression. But you can also prove the closure using NFAs. Suppose that $ L $ is accepted by a DFA $ langle Sigma, Q, F, delta, q_0 rangle $. We build a $ langle Sigma NFA, Q, F, delta, q $ _0 $ row, where

  • The set of states is $ Q = Q cup {q $ _0 }.
  • The initial state is $ q $ _0.
  • The state of single acceptance is $ q_0 $.
  • The transition function is defined as follows: $ delta (q <_, 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 its inversion.


Guessing often involves also checking. A simple example is the closing under rotation:
$$ R (L) = {yx in Sigma ^ *: xy in L }. $$
Suppose $ L $ is accepted by the DFA $ langle Sigma, Q, F, delta, q_0 rangle $. We build a $ langle Sigma NFA, Q, F, delta, q $ _0 $ row, which works as follows. NFA begins by guessing $ q = delta (q_0, x) $. It then checks that $ delta (q, y) in F $ and that $ delta (q_0, x) = q $, passing from $ y $ to $ x $ in a non-deterministic way. This can be formalized as follows:

  • The states are $ Q = {q \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ' In addition to the initial state $ q $ _0, the states are $ langle q, q_ {curr}, s rangle $, where $ q $ is the state we have guessed, $ q_ {curr} $ is the current state, and $ s $ specifies whether we are at the $ y $ portion of the input (when 1) or the $ x $ portion 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 rank: q in Q } $ implement guess $ q $.
  • The transitions $ delta # ( langle q, q_ {curr}, s rangle, sigma) = langle q, delta (q_ {curr}, sigma), s rangle $ (for each $ 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 each $ q in Q $ and $ q_f in F $ , implement moving the $ y $ part to the $ x $ part. This is only allowed if we have reached a final state on the $ y $ part.

Another variant of the technique incorporates bounded counters. For example, consider the change change the closing distance:
$$ E_k (L) = {x in Sigma ^ *: text {there is $ y in L $ whose edit distance of $ x $ is at most $ k $} }. $$
Let DFA $ langle Sigma, Q, F, delta, q_0 rank $ for $ L $, and build a NFA $ langle Sigma, Q, F, delta & # 39 ;, q '_0 rangle $ for $ E_k (L) $ as follows:

  • The set of states is $ Q = Q times {0, ldots, k } $, where the second element counts the number of changes made up to now.
  • The initial state is $ q '_0 = langle q_0,0 rangle $.
  • Accepting states are $ F = F times {0, ldots, k } $.
  • For each $ q, sigma, i $, we have transitions $ langle delta (q, sigma), i rank in delta ( langle q, i rangle, sigma) $.
  • Insertions are handled by the 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 the transitions $ langle delta (q, sigma), i + 1 row in delta ( langle q, i row, epsilon) $ for all $ q, sigma, i $ such that $ i <k $.
  • The substitutions are similarly manipulated by the 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 $.

magento2 – Remove the regular price from the Magento 2 product page

I'm trying to remove the "regular price" from the product page of a child luma theme that I've created. My client only wants the special price to be displayed.

Removing the usual price entries from final_price.phtml and configure_price.phtml in my child's theme makes no difference.

/app/design/frontend/customtheme/child-luma/Magento_Catalog/templates/product/price/configured_price.phtml
/app/design/frontend/customtheme/child-luma/Magento_Catalog/templates/product/price/final_price.phtml

How can I delete the regular price?

From a given regular expression r, can we minimize a regular expression such that L (r) = L (r?)?

Please help me to find the solution