Try A = {ww | w∈ {0,1} * is not regular using the pumping motto.

# Tag: regular

## Regular expression for bitcoin gold network

#### Stack Exchange Network

The Stack Exchange network consists of 175 question and answer communities, including Stack Overflow, the largest and most trusted online community for developers to learn, share their insights, and develop their careers.

Visit Stack Exchange

## [ Politics ] Open-ended question: Are you a regular, semi-regular, or non-Rush Limbaugh listener?

I have been a regular listener for the past year and a half because I have a radio in my office. Before that, I could only listen to it on days off from work.

## algorithms – McNaughton-Yamada Algotihm (1960) Regular expression to DFA without going through NFA

I have a homework problem here. It asks me to use the McNaughton-Yamada algorithm to first convert a regular expression to a DFA, and then minimize it using a partition argument. I can do the latter. My problem is that I cannot access any real reference in the algorithm. Your original document is behind an IEEE payment wall that my university does not have access to.

The algorithm went something like this:

1. For each symbol in the expression, give them a subscript from left to right that increases by one for each instance of that symbol. For example, the expression aa * would receive a_1 a_2 ^ *.

- We proceed to build a diagram based on the possible lengths of the words.

If done properly, this produces a DFA. I think labeling in (1) is to help label states.

Feel free to set your own example if you decide to give an answer. I will not provide any problems here because there is no guarantee that it is not really my homework exercise.

## algorithms – Arden rule, DFA and NFA to regular expressions

You can use it in any way. In both cases, it constructs an assignment of the states of the automaton to regular expressions, $ (-): Q a RE $.

Leave $ (s, l, t) $ denote a transition from $ s $ with tag $ l $ to the objective state $ t $.

Also, leave $ oplus_ {i leq n} r_i = r_1 + ldots + r_n $.

## 1st case: by incoming edges.

- Add an end state, $ F $, and a $ varepsilon $-transition of each final state prior to $ F $.
- For each state $ X $ with $ n $ incoming edges $ (X, l_i, t_i) _ {i leq n} $make an equation $ (X) = oplus_ {i leq n} (l_i (t_i)) $.
- Usage rule: $ X = s + rX Longrightarrow X = r ^ * s $ in the equations
- The final regular expression is $ (F) $.

## 2nd case: by protruding edges.

- Add a new initial state, $ S $, and a $ varepsilon $-Transition from $ S $ to the previous initial state.
- For each state $ X $ with $ n $ protruding edges $ (s_i, l_i, X) _ {i leq n} $make an equation $ (X) = oplus_ {i leq n} ((s_i) l_i) $.
- Usage rule: $ X = s + Xr Longrightarrow X = sr ^ * $ in the equations
- The final regular expression is $ (S) $.

Both methods also work for NFAs. None of the above transformations depends on determinism.

Regarding your final thoughts, when you count the protruding edges, if you add the $ varepsilon $-transition in the final states, then $ (F) = emptyset $, why $ F $ (the new end state) has no protruding edges, and this does not contribute to the equations. What you want to add is a new initial state, so you can calculate $ (S) $. For your DFA example, $ (S) = varepsilon (A) $. Similarly, adding a new initial state is useless when transforming by leading edges. In this case, $ (S) = emptyset $ and what you want is $ (F) $which for your example would be $ (F) = (A) varepsilon + (D) varepsilon $.

## mini cart – Add regular price with special price in minicart and in order summary (checkout page) – Magento 2.2.9

I try to have a regular price next to the special price on the minicart and payment page. I added it on the cart page thanks to this topic:

Magento 2: How to display the special price and the regular price on the cart page?

But my tests to add it in the minicart and on the checkout page are still not good for now. Could you help me?

For the minicart, I tried to modify sidebar.html in Magento_Wee with this code but it didn't work:

```
getProduct()->getFinalPrice();
$normalPrice = $item->getProduct()->getPrice();
if ($block->displayPriceWithWeeeDetails()): ?>
formatPrice($block->getUnitDisplayPriceExclTax()); ?>
formatPrice($normalPrice); ?>
```

## Mutative Algebra ac.com – Intersection of Prime Numbers in a Regular Local Ring

Suppose $ R $ is a regular local ring of dimension at least 3, and suppose $ P_1, P_2 $ they are prime of dimension 1. Is there necessarily a dimension 2 prime $ Q $ contained in both?

In other words, is each pair of "little curves" contained in a "small surface"?

If this is false, will it be kept if the ring is complete?

## automaton: does it demonstrate that the following language is regular?

The answer depends on whether $ L_1 $ it's a finished language $ {a, b } $ or above $ {a, b, c } $.

**$ L_1 $ it's a finished language $ {a, b } $**

In this case, the easiest way to proceed is through closing operations. First show (building a DFA) that the following language is regular:

$$

L_2 = {wcv mid | w | _a + 2 | v | _b equiv 3 bmod 5, w, v in {a, b } ^ * }.

$$

Your language is $ L = L_1cL_1 cap L_2 $.

**$ L_1 $ it's a finished language $ {a, b, c } $**

In this case we have to be more careful. Given a DFA (or an NFA) for $ L_1 $, we build one for $ L $ that in three stages:

- Simulate $ L_1 $ and track the amount of $ to $s module 5. Whenever you are in a state of acceptance of $ L_1 $, add a non-deterministic move to stage 2.
- Read $ c $.
- Simulate $ L_1 $ (starting from its initial state again) and track the number of $ b $s module 5. A state is accepting if it is accepting $ L_1 $ and the restriction $ | w | _a + 2 | v | _b $ are satisfied where $ w $ is the word read in the first stage, and $ v $ is the word read in the third stage.

I will let you fill in the details.

## regular expressions – regular expressions of three repeated numbers

First, "it has no occurrence of 123."

So the string can start with any number of 2s and 3s.

Then it has 0, 1 or more components that start with 1, followed by any number of 2s and 3s that are not 23. Therefore, 1 is followed by nothing, a single 2, 22 and any number of 2s and 3s, or 3 and any number of 2s and 3s.

Each of these components could contain three or four 2 in a row. Four consecutive 2s are not allowed, three consecutive 2s can only happen once. So for each of those components, add elements to not allow three 2s in a row, or to allow three but not four 2s in a row. And then the language is any number of components without three 2, optionally followed by a component with three 2 and any number of components without three 2.

It is a bit complicated, but not bad.

So make regular expressions for "lead_2" = "any number of 2s and 3s, but not three 2s in a row", "lead_3" = "any number of 2s and 3s, with 222 once but not twice, and not 2222" , "follow_2" = "1, followed by lead_2 that doesn't start with 23", "follow_3" = "1, followed by lead_3 that doesn't start with 23", and the whole language is

```
lead_2 (follow_2)* or
lead_2 (follow_2)* follow_3 (follow_2)* or
lead_3 (follow_2)*
```

## javascript: What is the correct algorithm to match regular expressions in a sequence?

This is a difficult problem. Regular expression engines are fundamentally based on being able to *retract*That is, try something else with information that they have already consumed. And the problem is not limited to possessive quantifiers, but to most constructions: even `(A|B)`

requires recoil.

If there is any way to limit the possible duration of your matches then it is almost certainly your best option to apply a normal match on overlapping size chunks `2 * L`

You have to change the way your regex engine works.

However, if you have to change it, it would involve parsing the regular expression or monitoring the progress of the engine to test when the previous entry can no longer be part of *none* match, that is, when top-level backtracking has exhausted its alternatives. At that time, you can discard characters and thus limit the amount of memory required for the entire operation. But keep in mind that that would be a *fascinating* project, that is, almost certainly out of budget if you are just trying to perform a random work task.