Let $L_4$ be the language over alphabet ${0, 1}$ defined by $L_3 = {x : #_1(x) = 2 cdot #_{10}(x)}$ design...











up vote
1
down vote

favorite












Let $L_4$ be the language over alphabet ${0, 1}$ defined by
$L_4 = {x : #_1(x) = 2 cdot #_{10}(x)}$



Here is a design for a PDA that accepts $L_4$. See diagram below, where we use e to donote $epsilon$



-For a string $x$, we use k to stand for the quantity $#_1(x) - 2 cdot#_{10}(x)$



-If $k = 0$, then the stack should be empty



-If $k neq 0$, then the stack should have a $Y$ at the bottom and $|k| - 1$ Xs on top.



-$q_0, q_1$ are for $x$ where $k = 0$. $q_0$ is for $x$ that does not end with 1. $q_1$ is for $x$ that ends with $1.$



-$q_2, q_3, q_4$ are for $x$ where $k > 0$. $q_2$ is for $x$ that ends with $1.$ $q_3$ is an extra state to sllow for popping 2 items off the stack. $q_4$ is for x that ends with $0$.



$q_5, q_6, q_7$ are for x where $k < 0$. $q_5$ is for x that ends with $0$. $q_6$ is an extra state to allow for pushing 2 items on the stack. $q_7$ is for x that ends with $1$.



Complete the PDA by adding appropiate transitions. To help you get started initial state is indicated some transitions are given, and accepting states are indicated by double parentheses.enter image description here



My attempt:



enter image description here



Not sure how to really go about this. I tried to satisfy very easy cases like the empty string is already accepted. 101 is accepted. But keep ending up stuck because I need to have k-1 x's










share|cite|improve this question




























    up vote
    1
    down vote

    favorite












    Let $L_4$ be the language over alphabet ${0, 1}$ defined by
    $L_4 = {x : #_1(x) = 2 cdot #_{10}(x)}$



    Here is a design for a PDA that accepts $L_4$. See diagram below, where we use e to donote $epsilon$



    -For a string $x$, we use k to stand for the quantity $#_1(x) - 2 cdot#_{10}(x)$



    -If $k = 0$, then the stack should be empty



    -If $k neq 0$, then the stack should have a $Y$ at the bottom and $|k| - 1$ Xs on top.



    -$q_0, q_1$ are for $x$ where $k = 0$. $q_0$ is for $x$ that does not end with 1. $q_1$ is for $x$ that ends with $1.$



    -$q_2, q_3, q_4$ are for $x$ where $k > 0$. $q_2$ is for $x$ that ends with $1.$ $q_3$ is an extra state to sllow for popping 2 items off the stack. $q_4$ is for x that ends with $0$.



    $q_5, q_6, q_7$ are for x where $k < 0$. $q_5$ is for x that ends with $0$. $q_6$ is an extra state to allow for pushing 2 items on the stack. $q_7$ is for x that ends with $1$.



    Complete the PDA by adding appropiate transitions. To help you get started initial state is indicated some transitions are given, and accepting states are indicated by double parentheses.enter image description here



    My attempt:



    enter image description here



    Not sure how to really go about this. I tried to satisfy very easy cases like the empty string is already accepted. 101 is accepted. But keep ending up stuck because I need to have k-1 x's










    share|cite|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Let $L_4$ be the language over alphabet ${0, 1}$ defined by
      $L_4 = {x : #_1(x) = 2 cdot #_{10}(x)}$



      Here is a design for a PDA that accepts $L_4$. See diagram below, where we use e to donote $epsilon$



      -For a string $x$, we use k to stand for the quantity $#_1(x) - 2 cdot#_{10}(x)$



      -If $k = 0$, then the stack should be empty



      -If $k neq 0$, then the stack should have a $Y$ at the bottom and $|k| - 1$ Xs on top.



      -$q_0, q_1$ are for $x$ where $k = 0$. $q_0$ is for $x$ that does not end with 1. $q_1$ is for $x$ that ends with $1.$



      -$q_2, q_3, q_4$ are for $x$ where $k > 0$. $q_2$ is for $x$ that ends with $1.$ $q_3$ is an extra state to sllow for popping 2 items off the stack. $q_4$ is for x that ends with $0$.



      $q_5, q_6, q_7$ are for x where $k < 0$. $q_5$ is for x that ends with $0$. $q_6$ is an extra state to allow for pushing 2 items on the stack. $q_7$ is for x that ends with $1$.



      Complete the PDA by adding appropiate transitions. To help you get started initial state is indicated some transitions are given, and accepting states are indicated by double parentheses.enter image description here



      My attempt:



      enter image description here



      Not sure how to really go about this. I tried to satisfy very easy cases like the empty string is already accepted. 101 is accepted. But keep ending up stuck because I need to have k-1 x's










      share|cite|improve this question















      Let $L_4$ be the language over alphabet ${0, 1}$ defined by
      $L_4 = {x : #_1(x) = 2 cdot #_{10}(x)}$



      Here is a design for a PDA that accepts $L_4$. See diagram below, where we use e to donote $epsilon$



      -For a string $x$, we use k to stand for the quantity $#_1(x) - 2 cdot#_{10}(x)$



      -If $k = 0$, then the stack should be empty



      -If $k neq 0$, then the stack should have a $Y$ at the bottom and $|k| - 1$ Xs on top.



      -$q_0, q_1$ are for $x$ where $k = 0$. $q_0$ is for $x$ that does not end with 1. $q_1$ is for $x$ that ends with $1.$



      -$q_2, q_3, q_4$ are for $x$ where $k > 0$. $q_2$ is for $x$ that ends with $1.$ $q_3$ is an extra state to sllow for popping 2 items off the stack. $q_4$ is for x that ends with $0$.



      $q_5, q_6, q_7$ are for x where $k < 0$. $q_5$ is for x that ends with $0$. $q_6$ is an extra state to allow for pushing 2 items on the stack. $q_7$ is for x that ends with $1$.



      Complete the PDA by adding appropiate transitions. To help you get started initial state is indicated some transitions are given, and accepting states are indicated by double parentheses.enter image description here



      My attempt:



      enter image description here



      Not sure how to really go about this. I tried to satisfy very easy cases like the empty string is already accepted. 101 is accepted. But keep ending up stuck because I need to have k-1 x's







      formal-languages automata






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Nov 15 at 22:52









      Joey Kilpatrick

      1,083121




      1,083121










      asked Nov 13 at 6:45









      Tree Garen

      34519




      34519






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          From the transitions and information given, we can deduce the following:




          • A string only ends in $q_0$ if it is in $L_4$ and ends in a $0$.

          • A string only ends in $q_2$ if $k>0$ and it ends in $1$.

          • No string ends in $q_3$.

          • A string only ends in $q_4$ if $k>0$ and it ends in $0$.

          • A string only ends in $q_1$ if it is in $L_4$ and ends in a $1$.

          • A string only ends in $q_5$ if $k<0$ and it ends in $0$.

          • No string ends in $q_6$.

          • A string only ends in $q_7$ if $k<0$ and it ends in $1$.

          • Every transition to $q_0$, $q_3$, $q_4$, $q_5$, or $q_6$ transitions on a $0$ or $epsilon$.

          • Every transition to $q_1$, $q_2$, or $q_7$ transitions on a $1$ or $epsilon$.


          Given any string in $Sigma^*$ (even ones not in $L_4$) we can figure out which state it should end in based off of the above information. Also, if a word $sin Sigma^*$ can be written as $s=usigma$ where $uin Sigma^*$ is a subword and $sigmainSigma$ is a character, then if $u$ ends in state $q_i$ and $s$ ends in $q_j$, then there must be a transition from $q_i$ to $q_j$ on $sigma$. From this information we can begin to fill in transitions by testing small strings and their substrings. Here is my solution.
          enter image description here



          Let me know if you need clarification.






          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
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2996400%2flet-l-4-be-the-language-over-alphabet-0-1-defined-by-l-3-x-1%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



            accepted










            From the transitions and information given, we can deduce the following:




            • A string only ends in $q_0$ if it is in $L_4$ and ends in a $0$.

            • A string only ends in $q_2$ if $k>0$ and it ends in $1$.

            • No string ends in $q_3$.

            • A string only ends in $q_4$ if $k>0$ and it ends in $0$.

            • A string only ends in $q_1$ if it is in $L_4$ and ends in a $1$.

            • A string only ends in $q_5$ if $k<0$ and it ends in $0$.

            • No string ends in $q_6$.

            • A string only ends in $q_7$ if $k<0$ and it ends in $1$.

            • Every transition to $q_0$, $q_3$, $q_4$, $q_5$, or $q_6$ transitions on a $0$ or $epsilon$.

            • Every transition to $q_1$, $q_2$, or $q_7$ transitions on a $1$ or $epsilon$.


            Given any string in $Sigma^*$ (even ones not in $L_4$) we can figure out which state it should end in based off of the above information. Also, if a word $sin Sigma^*$ can be written as $s=usigma$ where $uin Sigma^*$ is a subword and $sigmainSigma$ is a character, then if $u$ ends in state $q_i$ and $s$ ends in $q_j$, then there must be a transition from $q_i$ to $q_j$ on $sigma$. From this information we can begin to fill in transitions by testing small strings and their substrings. Here is my solution.
            enter image description here



            Let me know if you need clarification.






            share|cite|improve this answer

























              up vote
              0
              down vote



              accepted










              From the transitions and information given, we can deduce the following:




              • A string only ends in $q_0$ if it is in $L_4$ and ends in a $0$.

              • A string only ends in $q_2$ if $k>0$ and it ends in $1$.

              • No string ends in $q_3$.

              • A string only ends in $q_4$ if $k>0$ and it ends in $0$.

              • A string only ends in $q_1$ if it is in $L_4$ and ends in a $1$.

              • A string only ends in $q_5$ if $k<0$ and it ends in $0$.

              • No string ends in $q_6$.

              • A string only ends in $q_7$ if $k<0$ and it ends in $1$.

              • Every transition to $q_0$, $q_3$, $q_4$, $q_5$, or $q_6$ transitions on a $0$ or $epsilon$.

              • Every transition to $q_1$, $q_2$, or $q_7$ transitions on a $1$ or $epsilon$.


              Given any string in $Sigma^*$ (even ones not in $L_4$) we can figure out which state it should end in based off of the above information. Also, if a word $sin Sigma^*$ can be written as $s=usigma$ where $uin Sigma^*$ is a subword and $sigmainSigma$ is a character, then if $u$ ends in state $q_i$ and $s$ ends in $q_j$, then there must be a transition from $q_i$ to $q_j$ on $sigma$. From this information we can begin to fill in transitions by testing small strings and their substrings. Here is my solution.
              enter image description here



              Let me know if you need clarification.






              share|cite|improve this answer























                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                From the transitions and information given, we can deduce the following:




                • A string only ends in $q_0$ if it is in $L_4$ and ends in a $0$.

                • A string only ends in $q_2$ if $k>0$ and it ends in $1$.

                • No string ends in $q_3$.

                • A string only ends in $q_4$ if $k>0$ and it ends in $0$.

                • A string only ends in $q_1$ if it is in $L_4$ and ends in a $1$.

                • A string only ends in $q_5$ if $k<0$ and it ends in $0$.

                • No string ends in $q_6$.

                • A string only ends in $q_7$ if $k<0$ and it ends in $1$.

                • Every transition to $q_0$, $q_3$, $q_4$, $q_5$, or $q_6$ transitions on a $0$ or $epsilon$.

                • Every transition to $q_1$, $q_2$, or $q_7$ transitions on a $1$ or $epsilon$.


                Given any string in $Sigma^*$ (even ones not in $L_4$) we can figure out which state it should end in based off of the above information. Also, if a word $sin Sigma^*$ can be written as $s=usigma$ where $uin Sigma^*$ is a subword and $sigmainSigma$ is a character, then if $u$ ends in state $q_i$ and $s$ ends in $q_j$, then there must be a transition from $q_i$ to $q_j$ on $sigma$. From this information we can begin to fill in transitions by testing small strings and their substrings. Here is my solution.
                enter image description here



                Let me know if you need clarification.






                share|cite|improve this answer












                From the transitions and information given, we can deduce the following:




                • A string only ends in $q_0$ if it is in $L_4$ and ends in a $0$.

                • A string only ends in $q_2$ if $k>0$ and it ends in $1$.

                • No string ends in $q_3$.

                • A string only ends in $q_4$ if $k>0$ and it ends in $0$.

                • A string only ends in $q_1$ if it is in $L_4$ and ends in a $1$.

                • A string only ends in $q_5$ if $k<0$ and it ends in $0$.

                • No string ends in $q_6$.

                • A string only ends in $q_7$ if $k<0$ and it ends in $1$.

                • Every transition to $q_0$, $q_3$, $q_4$, $q_5$, or $q_6$ transitions on a $0$ or $epsilon$.

                • Every transition to $q_1$, $q_2$, or $q_7$ transitions on a $1$ or $epsilon$.


                Given any string in $Sigma^*$ (even ones not in $L_4$) we can figure out which state it should end in based off of the above information. Also, if a word $sin Sigma^*$ can be written as $s=usigma$ where $uin Sigma^*$ is a subword and $sigmainSigma$ is a character, then if $u$ ends in state $q_i$ and $s$ ends in $q_j$, then there must be a transition from $q_i$ to $q_j$ on $sigma$. From this information we can begin to fill in transitions by testing small strings and their substrings. Here is my solution.
                enter image description here



                Let me know if you need clarification.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Nov 15 at 23:05









                Joey Kilpatrick

                1,083121




                1,083121






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2996400%2flet-l-4-be-the-language-over-alphabet-0-1-defined-by-l-3-x-1%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

                    Quarter-circle Tiles

                    build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

                    Mont Emei