다음 질문에 붙어 있습니다.
"정규 언어는 유한 오토마타에 의해 정확하게 수용된 언어입니다.이 사실을 감안할 때, 언어 이 유한 오토 마톤에 의해 수용되면 도 일부 유한에 의해 수용되고 은 모든 단어로 구성됩니다 의 역으로. "L R L R L
다음 질문에 붙어 있습니다.
"정규 언어는 유한 오토마타에 의해 정확하게 수용된 언어입니다.이 사실을 감안할 때, 언어 이 유한 오토 마톤에 의해 수용되면 도 일부 유한에 의해 수용되고 은 모든 단어로 구성됩니다 의 역으로. "L R L R L
답변:
따라서 정규 언어 주어지면 , 우리는 (본질적으로 정의에 따라) 유한 오토마타에 의해 받아 들여진다는 것을 알고 있습니다. L 의 문자열입니다 . 심지어 상황을 단순화하기 위해 받아 들일 수있는 상태가 하나 뿐이라고 주장 할 수도 있습니다. 리버스 언어를 받아들이려면 전환 방향을 바꾸고 시작 상태를 수락 상태로 변경하고 수락 상태를 시작 상태로 변경하면됩니다. 그런 다음 원래와 비교하여 "뒤로"기계가 있으며 언어 L R을 받아들 입니다.
당신은 당신이 항상 문자열 받아들이는 유한 자동 장치 구축 할 수 있음을 보여 주어야 에 문자열을 받아들이는 유한 자동 장치 주어진 . 이를 수행하는 절차는 다음과 같습니다.
이 모든 것을 공식화하자. 우리는 정리를 시작하여 시작합니다.
정리. 경우 정규 언어이며, 다음 그렇습니다 .
하자 = ( Q A는 , Σ A는 , δ , q를 , F ) NFA하고하자 L = L ( ) . ε -NFA R은 아래에 정의 된 언어 받아 L의 R을 .
증명. 첫째, 우리는 다음과 같은 성명을 증명 : 에서 경로 에 에 표지 경우에만, 에서 경로 에 대한 에 R이 표지 승 R (의 반대 w 에 대해) Q , P ∈ Q . 증명은 w 길이에 대한 유도입니다 .
시키는 및 일부 및 치환 위해 X의 R의 보증이 Q ∈ δ * R ( S , w R ) ∀ S ∈ F . F A (3. A R 정의 에서 q s 에서 모든 상태 까지 ϵ 로 표시된 경로가 있기 때문에 ) and a path from every state in to the state labeled with , then there is a path labeled with from to . This proves the theorem.
Notice that this proves that as well.
Please edit if there are any formatting errors or any flaws in my proof....
To add to the automata-based transformations described above, you can also prove that regular languages are closed under reversal by showing how to convert a regular expression for into a regular expression for . To do so, we'll define a function on regular expressions that accepts as input a regular expression for some language , then produces a regular expression for the language . This is defined inductively on the structure of regular expressions:
You can formally prove this construction correct as an exercise.
Hope this helps!
rev()
notation. :) I also put down REV(R1&R2) = REV(R1)&REV(R2)
; I have a regex implementation which has intersection. Yes; I'm thinking of adding an operator for reversal perhaps R\r
(reverse preceding regex element).
REV(~R)
is the reverse of the set of all strings outside of R. Is that the same as ~REV(R)
: the set of all strings outside of the reverse of the set denoted by R? This is not clear at all because any palindromes in R
are also in REV(R)
.
Using regular expressions, prove that if is a regular language then the \emph{reversal} of , , is also regular. In particular, given a regular expression that describes , show by induction how to convert it into a regular expression that describes . Your proof should not make recourse to NFAs.
We will assume that we are given a regular expression that describes . Let us first look at the concatination operator (), and then we can move onto more advanced operators. So our cases of concatenation deal with the length of what is being concatenated. So first we will break all concatenations from to . When dealing with these break the components up as much as possible: , but you cannot break associative order between different comprehensions of course.
When
When , we have the empty string which is already reversed thus the mechanism does not change
When is just a letter, as in , the reversal is just that letter,
When , we have a single constituent so we just reverse that constituent and thus
When where k is odd, we have a regular expression which can be written as . The reversal of these even length strings is simple. Merely switch the 0 index with the k index. Then Switch the 1 index with k-1 index. Continue till the each element was switched once. Thus the last element is now the first in the reg ex, and the first is the last. The second to last is the second and the second is the second to last. Thus we have a reversed reg ex which will accept the reversed string (first letter is the last etc.) And of course we reverse each constituent. Thus we would get
When where k is even, we have a regular expression generally which can be written as . The reversal of these even length strings is simple. Merely switch the 0 index with the k index. Then Switch the 1 index with k-1 index. Continue till the each element was switched once, but the k/2 element (an integer because k is even). Thus the last element is now the first in the reg ex, and the first is the last. The second to last is the second and the second is the second to last. Thus we have a reversed reg ex which will accept the reversed string (first letter is the last etc.). And that middle letter. And of course we reverse each constituent. Thus we would get
Okay the hard part is done. Let us look to the operator. This is merely a union of sets. So given two strings, , the reverse of is only . The union will not change. And this makes sense. This will only add strings to a set. It does not matter which order they are added to the set, all that matters is that they are.
The kleene star operator is the same. It is merely adding strings to a set, not telling us how we should construt the string persay. So to reverse a kleene star of a string , is only . Reversal can just move through them.
Thus to reverse this we simply follow the rules. To reverse the outer union we simply reverse its two components. To reverse this: kleene star, we simply reverse what is inside it . Then to reverse a concatenation, we index and then switch greatest with least. So we start with and get . To reverse that single letter, we reach our base case and get . This process outlined above describes an inductive description of this change.