Why is English not a regular language?

Surely any language with a finite longest word can be made regular by having an automaton with paths to 26 states for all letters then having each of those states go to another 26 states etc with states going to a looping non final state whenever there are no possible words to be made beginning the the letters you have already gone through. Then make every state that ends on a word final.

How to find a context-free grammar from a difficult language?

Some Languages are trivial to find their respective context-free grammar. Like for example $ L= \{a^nb^n: n \geqslant 0\}$ . However some are really difficult to solve. I would like to have some advice on how I can tackle them.

For example I have the following language that I have been trying to solve for a while :enter image description here

I tried to divide the problem into three cases as follow:

case i: na $ \le$ nb

case ii: nb $ \le$ na $ <$ 2nb

case iii: na $ \ge$ 2nb

The first case was easy to solve however I am stuck in case ii. At this point I don’t even know if the procedure that I chose is the correct one.

Prove, that $A^+\subseteq A^*$ where $A$ is a formal language

Prove, that $ A^+\subseteq A^*$ , where $ A$ is a formal language.

The definition of $ A^+$ is $ \bigcup_{i\in\mathbb{N}\setminus \{0\}}A^i$ , which would be $ A^1 \cup A^2 \cup \dots \cup A^i$ . Likewise, $ A^*$ is $ \bigcup_{i\in\mathbb{N}}A^i$ and therefore $ A^0 \cup A^1 \cup \dots \cup A^i$ .

Suppose, $ x\in A^+$ . By definition $ x\in A^+ \land x\in A^*$ for all $ x\neq A^0$ , which is the set of the empty word. We can conclude, that $ A^1\cup A^2\cup \dots \cup A^i \subseteq A^0\cup A^1\cup \dots \cup A^i$ and $ \bigcup_{i\in\mathbb{N}\setminus \{0\}}A^i \subseteq \bigcup_{i\in\mathbb{N}}A^i$ , that’s why $ A^+\subseteq A^*$ .

Is this “proof” ok?

Difference between ⫾ (U+2AFE) and ⫿ (U+2AFF) in the context of Dijkstra’s Guarded Command Language?

Continuing https://tex.stackexchange.com/questions/435986/how-to-draw-the-box-of-dijkstras-guarded-command-language, what is the difference in the intended usage of ⫾ (Dijkstra choice, U+2AFE) and ⫿ (n-ary Dijkstra choice, U+2AFF) in the context of the Guarded Command Language (GCL) of Dijkstra? In other words, when do you use ⫾ and when ⫿ for typesetting GCL programs? Moreover, can you confirm or reject Barbara’s answer?

Related: http://latex.org/forum/viewtopic.php?t=32939

If R is a regular language, is R³ = R o R o R also regular?

My understanding of a regular language is that for a language to be formal, it must be able to be represented by a DFA or NFA. To prove a language is not regular you can use the pumping lemma to get a contradiction.

I am trying to figure out whether R³ or R o R o R is regular if R is also regular.

My understanding of the definition of R o R is that it is kind of a transitive mapping of R?

And I think if R o R is regular then R o R o R is also regular, so I need to prove R o R is regular which really means that I am trying to prove that regular languages are transitive?

I am not sure how I would go about doing this as I am a little confused how regular languages and transitivity relate – as I have only worked with relations for transitivity.

Pushdown Automata – constructing a PDA to recognise a language with at least as many as as bs

I am trying to construct a 3-state PDA to recognise (I need to create a transition diagram for this question)

W = {w ∈ {a, b}^* | w contains at least as many as as bs} 

My thought process so far has been this:

 1. Start off in q0 (q0 being an accept state)  2. add a $   to the start of the stack (so you can see when the stack is empty), then transition to q1 (not an accept state).  3. If you receive an a:   - if there is an a at the top of the stack, push the a on.   - if there is a b at the top of the stack, pop the b.   - if there is nothing on the top of the stack, push the a on.  4. If you receive a b:   - if there is an a at the top of the stack, pop the a.   - if there is a b at the top of the stack, push the b on.   - if there is nothing on the top of the stack push the b on.  5. Once there is no more input:   - if there is a $   at the top of the stack, transition to q3 (q3 being an accept state) - this means there was an equal number of as and bs   - if there is an a at the top of the stack, transition to q3 (q3 being an accept state) - this means there was more as than bs   if there is a b at the top of the stack, it means there was more bs than as, and thus we stay in q2, which is not an accept state. 

(Sorry if this is hard to understand, I am not sure how to link those transition diagrams of the PDA’s I’ve seen in some posts, if someone can tell me how to create one and link it in the post, I can update the post to be more understandable if needed)

I have a few questions:

  1. Is this approach correct?
  2. Is the it correct to assume the machine is smart enough to know that if there isn’t a b at the top of the stack, and I receive an a, it will push that a onto the stack (something like (q1, a, ε) -> (q1, a) to cover both cases where there is an a on the top of the stack and also the case where the stack has nothing in it))
  3. Do I need to push a $ at the start from q0 to q1 in the transition diagram (I’ve seen this to be the case for all PDAs on my lecture slide – which makes me think is it necessary to include if all machines need to do this – why is it not just implied?)
  4. I am ok to have 2 different scenarios to go to q2 right? Or would I be better doing something in q1, where if I have reached the end of my input queue, keep popping off as on the top of the stack until I reach the $ , then transition to q2?

Sorry if anything is unclear – I am not super familiar with PDAs and the way to describe things – please let me know if I need to clarify anything.

Did I prove the language is not regular?

I am trying to prove the following language that is not regular. enter image description here

I used Pumping Lemma proof and my proof goes as follows:

Assume that L is regular and let p be the constant of Pumping-Lemma.

This is where I am not sure if I picked the right “w”.

There exists w = $ a^pbc^p$ (where n=p and m=1). Clearly w is inside the language and its length is larger than p.

we now have $ y=a^j$ where j is between 1 and p. w = xyz, m $ \ge$ |xy| and |y| $ \ge$ 1. $ wi = xy^iz$

Pumping down we get (i=0): w = a(p-k)bcp and since our condition for L to be regular is $ k=n^m$ we get by substituting. => $ p = p-k$ which is not true (contradiction). Thus L is not regular.

Context-free grammar how to have same number of variables within a language

I am trying to get a CFG for the language:

the set A of odd-length strings in {a,b}^* whose first, middle and last symbols are all the same 

(some example of correct answers would be: a, aaa, ababa, aababba, some incorrect answers include: ɛ, aaaa, abbaa)

This is what I’ve done so far:

S=a|b|aTaTa|bTbTb T=aT|bT|ɛ 

However the problem is, I need T to be a string of any combination of ‘a’s and ‘b’s but of the same length, but I’m not sure how to express this. As you can see above, I can get strings made up of any combination, but they won’t be the same length when passed to S. Any help is appreciated!