finite automata – Using Myhill Nerode to prove a language is not regular

Let $L$ be your language and let $equiv$ be the equivalence relation defined by $x equiv y$ iff $x in Sigma^*$ and $y in Sigma^*$ have no distinguishing extension (a distinguishing extension is a word $z in Sigma^*$ such that exactly one of $xz$ and $yz$ belongs to $L$).

Given $i,j in mathbb{N}$ with $i < j$, $0^i$ and $0^j$ cannot belong the same equivalence class since $1^i$ is a distinguishing extension for them: $0^i 1^i in L$ but $0^j 1^i notin L$.

This shows that $L/equiv$ is not finite, and hence $L$ is not regular.

regex – Expressão regular para validar string e int em php

Preciso validar essa string.

$scop = "ES-1236"; chave de acesso valor fixo ES- dinamico 1236 sendo o dinamico apenas números inteiros.

para validar estou criando uma variavel com a busca
$lets = "ES-";

e a expressão para validar

if(preg_match("/{$lets}/i", $let)) {
echo true;
}

porém nesse formato ele está aceitando se passar somente ES- mas gostaria que ele obrigasse a ter um número inteiro após o ES-

plotting – What regular cartesian expression $y=f(x)$ has a graph of the “number 7-like” shape?

7-shaped graph

It seems to be a simple question but I’m stuck. I was trying to transform many fuctions that are partly resembling 7 like $ax^3+bx^2+cx+d$, sawtooth wave, Heavyside step, $|x|$, a lot of trigonometry function family expressions, elliptic curve but failed to do what I need exactly. Finally I have to get an upside-down trapezoid-like graph like such:
upside-down trapezoid
with a single regular cartesian expression $y=f(x)$. All I’ve come up with is an upside-down triange with poorly drown discontinuities.
crazy triangle
However it was made with an implicit formula 0 == ((UnitStep(-y)*(2 + y*(2/3)))/Abs(x)) - 1 and ContourPlot after all which’s not acceptable.

ContourPlot({0 == ((UnitStep(-y)*(2 + y*(2/3)))/Abs(x)) - 1}, {x, -5, 
  5}, {y, -5, 5}, Exclusions -> None, WorkingPrecision -> 16)

I know there is a way to do something similar with transformation of a circle on the complex plane but it’s too difficult for me and I expect to produce the plot with reals.

finite automata – prove that if a language is regular then so is the reverse of that language

Below is a problem from Dexter C Kozen’s Automata and Computability followed by my attempt at a solution. Please provide feedback on my proof. Are there any errors/leaps in logic?

$$$$
Problem Statement
$$$$
My attempt:

$T$ is regular if and only if there exists a NFA accepting $T$. Let $N=(Q,∑,Δ,S,F)$ such that $L(N)=T.$

I will show that there exists a NFA accepting $T$ if and only if there exist a NFA $N_{R}=(Q,∑,Δ_R,S_R,F_R)$ such that $L(N_R)=revT.$

Define: $Δ_R(q,a)={p in Q : q in Δ(p,a)}$, $S_R=F$, $F_R=S$

Lemma 1: if $A⊆Q, $ then $hat{Δ}_R(hat{Δ}(A,x),rev(x))=A$ for all $x in ∑^✱$.

Base Cases:

$$hat{Δ}_R(hat{Δ}(A,ε),ε)=hat{Δ}_R(A,ε)=A$$ by Kozen (6.1). So, equality holds for the empty string.

$$hat{Δ}_R(hat{Δ}(A,a),rev(a))=$$$$bigcup_{qinhat{Δ}(A,a) } {p in Q : q in Δ(p,a) }=$$

$${p in Q : Δ(p,a) ∩ hat{Δ}(A,a) not =∅ }=A$$
by Kozen (6.2), the fact that $rev(a)=a$, and the definition of $Δ_R$.

Inductive Step:

Assume $hat{Δ}_R(hat{Δ}(A,x),rev(x))=A$.

$$hat{Δ}_R(hat{Δ}(A,xa),rev(xa))=hat{Δ}_R(hat{Δ}(A,xa),arev(x))=$$

by definition of string reversal in problem statement.
$$hat{Δ}_R(bigcup_{qinhat{Δ}(A,x)}Δ(q,a), arev(x)) $$

by Kozen definition (6.2) page 33

$$bigcup_{qinhat{Δ}(A,x)}hat{Δ}_R(Δ(q,a), arev(x)) $$

by Kozen Lemma 6.2 page 34

$$bigcup_{qinhat{Δ}(A,x)}hat{Δ}_R(hat{Δ}_R(Δ(q,a), a),rev(x))= $$

by Kozen Lemma 6.1

$$hat{Δ}_R(hat{Δ}_R(hat{Δ}(A,xa), a),rev(x))= $$

by Kozen Lemma 6.2

$$hat{Δ}_R(hat{Δ}_R(hat{Δ}(hat{Δ}(A,x),a), rev(a)),rev(x))= $$

by Kozen Lemma 6.1 and by the fact that $rev(a)=a$

$$hat{Δ}_R(hat{Δ}(A,x),rev(x))= $$

by the base case for a single character

$$A$$ by assumption.

Lemma 2: $hat{Δ}(A ∩ B,x)= hat{Δ}(A,x) ∩ hat{Δ}(B,x)$

Base Case:

$hat{Δ}(A ∩ B,ε)=A ∩ B= hat{Δ}(A,ε) ∩ hat{Δ}(B,ε)$ by definition (6.1) kozen

Inductive step:

Assume $hat{Δ}(A ∩ B,x)= hat{Δ}(A,x) ∩ hat{Δ}(B,x)$

$$hat{Δ}(A ∩ B,xa)=bigcup_{qinhat{Δ}(A∩ B,x)}Δ(q,a)=$$
by definition (6.2) kozen
$$bigcup_{qin(hat{Δ}(A,x)∩ hat{Δ}( B,x))}Δ(q,a)=$$
by assumption
$$bigcup_{qinhat{Δ}(A,x)}Δ(q,a)∩bigcup_{qinhat{Δ}(A,x)}Δ(q,a)=hat{Δ}(A,xa)∩hat{Δ}(B,xa)$$
by definition (6.2) kozen and basic set theory

Now I will use lemma 1 and lemma 2 to show $x in L(N)$ IFF $rev(x) in L(N_R)$

$x in L(N)$ IFF $hat{Δ}(S,x)∩F not = ∅$ IFF

$hat{Δ_R}(hat{Δ}(S,x)∩F,rev(x)) not = hat{Δ_R}(∅,rev(x)) $ IFF

$hat{Δ_R}(hat{Δ}(S,x),rev(x)) ∩hat{Δ_R}(F,rev(x)) not = ∅ $, by lemma 6.2, IFF

$S ∩hat{Δ_R}(F,rev(x)) not = ∅ $, by lemma 6.1, IFF

$F_R ∩hat{Δ_R}(S_R,rev(x)) not = ∅$, by definition of $F_R,S_R$, IFF

$rev(x) in L(N_R)$ $∎$

finite automata – prove that if a language is regular then so is the reverse of that language

Below is a problem from Dexter C Kozen’s Automata and Computability followed by my attempt at a solution. Please provide feedback on my proof. Are there any errors/leaps in logic? If having access to the text would be helpful, then I am happy to post a link, assuming that doing so is permissible on this form.
$$$$
enter image description here

$$$$
My attempt:

$T$ is regular if and only if there exists a NFA accepting $T$. Let $N=(Q,∑,Δ,S,F)$ such that $L(N)=T.$

I will show that there exists a NFA accepting $T$ if and only if there exist a NFA $N_{R}=(Q,∑,Δ_R,S_R,F_R)$ such that $L(N_R)=revT.$

Define: $Δ_R(q,a)={p in Q : q in Δ(p,a)}$, $S_R=F$, $F_R=S$

Lemma 1: if $A⊆Q, $ then $hat{Δ}_R(hat{Δ}(A,x),rev(x))=A$ for all $x in ∑^✱$.

Base Cases:

$$hat{Δ}_R(hat{Δ}(A,ε),ε)=hat{Δ}_R(A,ε)=A$$ by Kozen (6.1). So, equality holds for the empty string.

$$hat{Δ}_R(hat{Δ}(A,a),rev(a))=$$$$bigcup_{qinhat{Δ}(A,a) } {p in Q : q in Δ(p,a) }=$$

$${p in Q : Δ(p,a) ∩ hat{Δ}(A,a) not =∅ }=A$$
by Kozen (6.2), the fact that $rev(a)=a$, and the definition of $Δ_R$.

Inductive Step:

Assume $hat{Δ}_R(hat{Δ}(A,x),rev(x))=A$.

$$hat{Δ}_R(hat{Δ}(A,xa),rev(xa))=hat{Δ}_R(hat{Δ}(A,xa),arev(x))=$$

by definition of string reversal in problem statement.
$$hat{Δ}_R(bigcup_{qinhat{Δ}(A,x)}Δ(q,a), arev(x)) $$

by Kozen definition (6.2) page 33

$$bigcup_{qinhat{Δ}(A,x)}hat{Δ}_R(Δ(q,a), arev(x)) $$

by Kozen Lemma 6.2 page 34

$$bigcup_{qinhat{Δ}(A,x)}hat{Δ}_R(hat{Δ}_R(Δ(q,a), a),rev(x))= $$

by Kozen Lemma 6.1

$$hat{Δ}_R(hat{Δ}_R(hat{Δ}(A,xa), a),rev(x))= $$

by Kozen Lemma 6.2

$$hat{Δ}_R(hat{Δ}_R(hat{Δ}(hat{Δ}(A,x),a), rev(a)),rev(x))= $$

by Kozen Lemma 6.1 and by the fact that $rev(a)=a$

$$hat{Δ}_R(hat{Δ}(A,x),rev(x))= $$

by the base case for a single character

$$A$$ by assumption.

Lemma 2: $hat{Δ}(A ∩ B,x)= hat{Δ}(A,x) ∩ hat{Δ}(B,x)$

Base Case:

$hat{Δ}(A ∩ B,ε)=A ∩ B= hat{Δ}(A,ε) ∩ hat{Δ}(B,ε)$ by definition (6.1) kozen

Inductive step:

Assume $hat{Δ}(A ∩ B,x)= hat{Δ}(A,x) ∩ hat{Δ}(B,x)$

$$hat{Δ}(A ∩ B,xa)=bigcup_{qinhat{Δ}(A∩ B,x)}Δ(q,a)=$$
by definition (6.2) kozen
$$bigcup_{qin(hat{Δ}(A,x)∩ hat{Δ}( B,x))}Δ(q,a)=$$
by assumption
$$bigcup_{qinhat{Δ}(A,x)}Δ(q,a)∩bigcup_{qinhat{Δ}(A,x)}Δ(q,a)=hat{Δ}(A,xa)∩hat{Δ}(B,xa)$$
by definition (6.2) kozen and basic set theory

Now I will use lemma 1 and lemma 2 to show $x in L(N)$ IFF $rev(x) in L(N_R)$

$x in L(N)$ IFF $hat{Δ}(S,x)∩F not = ∅$ IFF

$hat{Δ_R}(hat{Δ}(S,x)∩F,rev(x)) not = hat{Δ_R}(∅,rev(x)) $ IFF

$hat{Δ_R}(hat{Δ}(S,x),rev(x)) ∩hat{Δ_R}(F,rev(x)) not = ∅ $, by lemma 6.2, IFF

$S ∩hat{Δ_R}(F,rev(x)) not = ∅ $, by lemma 6.1, IFF

$F_R ∩hat{Δ_R}(S_R,rev(x))$, by definition of $F_R,S_R$, IFF

$rev(x) in L(N_R)$ $∎$

Expressão Regular Python no Javascript?

Separar os caracteres de uma string com hífen em Python funciona perfeitamente desse jeito

import re

regex = r"B(?=(.{1}))"

test_str = "Pêssego"

subst = "-"

result = re.sub(regex, subst, test_str, 0)

if result:
    print (result) // P-ê-s-s-e-g-o

Em javascript

const regex = /B(?=(.{1}))/g;
const str = `Pêssego`;
const subst = `-`;

const result = str.replace(regex, subst);

console.log(result); // Pês-s-e-g-o

Devo acrescentar algo? Tirar algo? Qual a diferença entre dos dois? Existe alguma outra forma de separar uma string com hifens em em tempo real em um campo de entrada?

differential geometry – Proof of smoothness of the Exponential map at a point of a complete regular surface in Euclidean space

Suppose S is a regular, connected surface in Euclidean space and $d_{s}$ is the intrinsic metric on S. When (S,d) is complete, we know that for each geodesic $gamma:Jrightarrow S$ (where J is any interval) there exists a unique geodesic $eta:mathbb{R}rightarrow S$ which is an extension of $gamma$.

If $p$ is any point of S, it is shown in do Carmo (page 284) that if a sufficiently small $win T_{p}S$ is chosen, the geodesic $gamma$ with initial state $gamma(0)=p, gamma'(0)=w$ is well defined at $t=1$. The symbol exp$_{p}(w)$ is made to denote the point $gamma(1)in S$. It is then shown (page 285) that exp$_{p}$ can be made into a smooth map on a sufficiently small neighbourhood of $0in T_{p}S$. This truth depends on the theorem of solutions of systems of ODE’s which says that the solution depends smoothly on initial conditions.

By what I wrote above, when S is complete, $p$ is any point and $w$ any tangent vector to S at $p$, the symbol exp$_{p}(w)$ is well defined, but how can we show smoothness of exp$_{p}$ on all of $T_{p}S$? Am I missing something elementary here? We know it is smooth around $0$, but the proof depended on covering $p$ with a chart and applying the theorem from analysis. It seems we cannot argue this way in the general case.

In do Carmo I did not see this technical question discussed, and neither in Tapp.