'$L$ almost' is regular











up vote
1
down vote

favorite
1












Given a regular language $L$, I have to prove that '$L$ almost' is regular where '$L$ almost' is all the words which differ from the words of $L$ by one char.
for example, if $L = {aab,aaa}$, so $bab$ belongs to '$L$ almost' because it differs from $aab$ only by the first letter.
I have found this problem's solution and I simply can not understand the transition function.
If someone can explain it or maybe suggest a different one, that would be fantastic.
The most difficult part is the part of $t$,$t'$ so if you can be explicit when it comes to this part I would appreciate that.
Explanation of the picture (it's in Hebrew):
$L$ is regular so there is a DFA $M$ which defines it. They are creating an NFA based on the DFA by making two copies of the DFA, and moving from one to the other.
Any help understanding the transition function will do.
Thank a lot in advance!



Solution










share|cite|improve this question









New contributor




Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    1
    down vote

    favorite
    1












    Given a regular language $L$, I have to prove that '$L$ almost' is regular where '$L$ almost' is all the words which differ from the words of $L$ by one char.
    for example, if $L = {aab,aaa}$, so $bab$ belongs to '$L$ almost' because it differs from $aab$ only by the first letter.
    I have found this problem's solution and I simply can not understand the transition function.
    If someone can explain it or maybe suggest a different one, that would be fantastic.
    The most difficult part is the part of $t$,$t'$ so if you can be explicit when it comes to this part I would appreciate that.
    Explanation of the picture (it's in Hebrew):
    $L$ is regular so there is a DFA $M$ which defines it. They are creating an NFA based on the DFA by making two copies of the DFA, and moving from one to the other.
    Any help understanding the transition function will do.
    Thank a lot in advance!



    Solution










    share|cite|improve this question









    New contributor




    Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      Given a regular language $L$, I have to prove that '$L$ almost' is regular where '$L$ almost' is all the words which differ from the words of $L$ by one char.
      for example, if $L = {aab,aaa}$, so $bab$ belongs to '$L$ almost' because it differs from $aab$ only by the first letter.
      I have found this problem's solution and I simply can not understand the transition function.
      If someone can explain it or maybe suggest a different one, that would be fantastic.
      The most difficult part is the part of $t$,$t'$ so if you can be explicit when it comes to this part I would appreciate that.
      Explanation of the picture (it's in Hebrew):
      $L$ is regular so there is a DFA $M$ which defines it. They are creating an NFA based on the DFA by making two copies of the DFA, and moving from one to the other.
      Any help understanding the transition function will do.
      Thank a lot in advance!



      Solution










      share|cite|improve this question









      New contributor




      Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Given a regular language $L$, I have to prove that '$L$ almost' is regular where '$L$ almost' is all the words which differ from the words of $L$ by one char.
      for example, if $L = {aab,aaa}$, so $bab$ belongs to '$L$ almost' because it differs from $aab$ only by the first letter.
      I have found this problem's solution and I simply can not understand the transition function.
      If someone can explain it or maybe suggest a different one, that would be fantastic.
      The most difficult part is the part of $t$,$t'$ so if you can be explicit when it comes to this part I would appreciate that.
      Explanation of the picture (it's in Hebrew):
      $L$ is regular so there is a DFA $M$ which defines it. They are creating an NFA based on the DFA by making two copies of the DFA, and moving from one to the other.
      Any help understanding the transition function will do.
      Thank a lot in advance!



      Solution







      computer-science formal-languages automata regular-language






      share|cite|improve this question









      New contributor




      Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|cite|improve this question









      New contributor




      Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|cite|improve this question




      share|cite|improve this question








      edited yesterday









      Joey Kilpatrick

      1,070121




      1,070121






      New contributor




      Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 15 at 15:34









      Avishai Yaniv

      63




      63




      New contributor




      Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Avishai Yaniv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          If $L$ is regular, then consider a DFA on $L$. Make two copies of it $D_1$ and $D_2$ and consider the DFA $D_1cup D_2$ letting the start state of $D_1$ be the start state of $D_1cup D_2$. Let $a_{(D_1)}$ and $b_{(D_1)}$ be states in $D_1$ and let $a_{(D_2)}$ and $b_{(D_2)}$ be the corresponding states in $D_2$. For all $a_{(D_1)}$,$b_{(D_1)}$,$a_{(D_2)}$ and $b_{(D_2)}$, if $sigmain Sigma$ and $a_{(D_1)}$ transitions to $b_{(D_1)}$ on $sigma$ in $D_1$, then we will add the transition $a_{(D_1)}$ to $b_{(D_2)}$ on any character except $sigma$ (i.e. $Sigma - sigma$) to $D_1cup D_2$. Remove the accept states from $D_1$ in $D_1cup D_2$. This NFA accepts exactly "$L$ almost".



          The idea is that for any word in $L$, we want to make one "error" (the one letter off from the word in $L$). In our NFA, if a word is in $L$, then it will transition entirely within $D_1$ in $D_1cup D_2$. However, an "error" will then transition to the corresponding next state in $D_2$. This means that a word is in a state of $D_2$ in $D_1cup D_2$ only if it has an "error". We want to accept only the words that have one "error", so we remove the accept states from $D_1$ (since a word will only end in $D_1$ if it is in $L$).






          share|cite|improve this answer





















            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "69"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });






            Avishai Yaniv is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2999838%2fl-almost-is-regular%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            If $L$ is regular, then consider a DFA on $L$. Make two copies of it $D_1$ and $D_2$ and consider the DFA $D_1cup D_2$ letting the start state of $D_1$ be the start state of $D_1cup D_2$. Let $a_{(D_1)}$ and $b_{(D_1)}$ be states in $D_1$ and let $a_{(D_2)}$ and $b_{(D_2)}$ be the corresponding states in $D_2$. For all $a_{(D_1)}$,$b_{(D_1)}$,$a_{(D_2)}$ and $b_{(D_2)}$, if $sigmain Sigma$ and $a_{(D_1)}$ transitions to $b_{(D_1)}$ on $sigma$ in $D_1$, then we will add the transition $a_{(D_1)}$ to $b_{(D_2)}$ on any character except $sigma$ (i.e. $Sigma - sigma$) to $D_1cup D_2$. Remove the accept states from $D_1$ in $D_1cup D_2$. This NFA accepts exactly "$L$ almost".



            The idea is that for any word in $L$, we want to make one "error" (the one letter off from the word in $L$). In our NFA, if a word is in $L$, then it will transition entirely within $D_1$ in $D_1cup D_2$. However, an "error" will then transition to the corresponding next state in $D_2$. This means that a word is in a state of $D_2$ in $D_1cup D_2$ only if it has an "error". We want to accept only the words that have one "error", so we remove the accept states from $D_1$ (since a word will only end in $D_1$ if it is in $L$).






            share|cite|improve this answer

























              up vote
              0
              down vote













              If $L$ is regular, then consider a DFA on $L$. Make two copies of it $D_1$ and $D_2$ and consider the DFA $D_1cup D_2$ letting the start state of $D_1$ be the start state of $D_1cup D_2$. Let $a_{(D_1)}$ and $b_{(D_1)}$ be states in $D_1$ and let $a_{(D_2)}$ and $b_{(D_2)}$ be the corresponding states in $D_2$. For all $a_{(D_1)}$,$b_{(D_1)}$,$a_{(D_2)}$ and $b_{(D_2)}$, if $sigmain Sigma$ and $a_{(D_1)}$ transitions to $b_{(D_1)}$ on $sigma$ in $D_1$, then we will add the transition $a_{(D_1)}$ to $b_{(D_2)}$ on any character except $sigma$ (i.e. $Sigma - sigma$) to $D_1cup D_2$. Remove the accept states from $D_1$ in $D_1cup D_2$. This NFA accepts exactly "$L$ almost".



              The idea is that for any word in $L$, we want to make one "error" (the one letter off from the word in $L$). In our NFA, if a word is in $L$, then it will transition entirely within $D_1$ in $D_1cup D_2$. However, an "error" will then transition to the corresponding next state in $D_2$. This means that a word is in a state of $D_2$ in $D_1cup D_2$ only if it has an "error". We want to accept only the words that have one "error", so we remove the accept states from $D_1$ (since a word will only end in $D_1$ if it is in $L$).






              share|cite|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                If $L$ is regular, then consider a DFA on $L$. Make two copies of it $D_1$ and $D_2$ and consider the DFA $D_1cup D_2$ letting the start state of $D_1$ be the start state of $D_1cup D_2$. Let $a_{(D_1)}$ and $b_{(D_1)}$ be states in $D_1$ and let $a_{(D_2)}$ and $b_{(D_2)}$ be the corresponding states in $D_2$. For all $a_{(D_1)}$,$b_{(D_1)}$,$a_{(D_2)}$ and $b_{(D_2)}$, if $sigmain Sigma$ and $a_{(D_1)}$ transitions to $b_{(D_1)}$ on $sigma$ in $D_1$, then we will add the transition $a_{(D_1)}$ to $b_{(D_2)}$ on any character except $sigma$ (i.e. $Sigma - sigma$) to $D_1cup D_2$. Remove the accept states from $D_1$ in $D_1cup D_2$. This NFA accepts exactly "$L$ almost".



                The idea is that for any word in $L$, we want to make one "error" (the one letter off from the word in $L$). In our NFA, if a word is in $L$, then it will transition entirely within $D_1$ in $D_1cup D_2$. However, an "error" will then transition to the corresponding next state in $D_2$. This means that a word is in a state of $D_2$ in $D_1cup D_2$ only if it has an "error". We want to accept only the words that have one "error", so we remove the accept states from $D_1$ (since a word will only end in $D_1$ if it is in $L$).






                share|cite|improve this answer












                If $L$ is regular, then consider a DFA on $L$. Make two copies of it $D_1$ and $D_2$ and consider the DFA $D_1cup D_2$ letting the start state of $D_1$ be the start state of $D_1cup D_2$. Let $a_{(D_1)}$ and $b_{(D_1)}$ be states in $D_1$ and let $a_{(D_2)}$ and $b_{(D_2)}$ be the corresponding states in $D_2$. For all $a_{(D_1)}$,$b_{(D_1)}$,$a_{(D_2)}$ and $b_{(D_2)}$, if $sigmain Sigma$ and $a_{(D_1)}$ transitions to $b_{(D_1)}$ on $sigma$ in $D_1$, then we will add the transition $a_{(D_1)}$ to $b_{(D_2)}$ on any character except $sigma$ (i.e. $Sigma - sigma$) to $D_1cup D_2$. Remove the accept states from $D_1$ in $D_1cup D_2$. This NFA accepts exactly "$L$ almost".



                The idea is that for any word in $L$, we want to make one "error" (the one letter off from the word in $L$). In our NFA, if a word is in $L$, then it will transition entirely within $D_1$ in $D_1cup D_2$. However, an "error" will then transition to the corresponding next state in $D_2$. This means that a word is in a state of $D_2$ in $D_1cup D_2$ only if it has an "error". We want to accept only the words that have one "error", so we remove the accept states from $D_1$ (since a word will only end in $D_1$ if it is in $L$).







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Nov 15 at 16:13









                Joey Kilpatrick

                1,070121




                1,070121






















                    Avishai Yaniv is a new contributor. Be nice, and check out our Code of Conduct.










                     

                    draft saved


                    draft discarded


















                    Avishai Yaniv is a new contributor. Be nice, and check out our Code of Conduct.













                    Avishai Yaniv is a new contributor. Be nice, and check out our Code of Conduct.












                    Avishai Yaniv is a new contributor. Be nice, and check out our Code of Conduct.















                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2999838%2fl-almost-is-regular%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                    SQL update select statement

                    'app-layout' is not a known element: how to share Component with different Modules