$L_n = {x in Sigma^{*} | exists w, y, z in Sigma^*, x = ywz, w^r = w, |w| = n }$. x is palindrome of length...











up vote
1
down vote

favorite












$L_n = {x in Sigma^{*} | exists w, y, z in Sigma^*, x = ywz, w^r = w, |w| = n }$



Informally x is palindrome of length n



where $Sigma = {0,1}$





I'm having a hard time understanding this could someone please explain.



For $n = 1$



$L_1 = (0+1)^*(0+1)^*$ (Why? What does this mean?)



$L_1^c = sigma$ (What would the compliment mean)



For $n = 2$



$L_2 = (0+1)^*(00+11)(0+1)^*$



$L_2^c = (10)^*(epsilon + 1) + (01)^*(epsilon + 0)$



So my attempt on $n = 3$ (the above two were given)



$L_3 = (0+1)^* (000 + 111 + 101 + 010) (0+1)^*$



$L_3^c = (100)^*(epsilon + 1) + (011)^*(epsilon + 0)$



I get how regexes work I just don't understand how $L_1$ is the regex for palindrome of length one. Not sure what the compliment means. Same for $L_2$










share|cite|improve this question




















  • 1




    $L_n$ is not the set of all palindromes of length $n$; it it the set of all words that contain a palindrome of length $n$.
    – Magdiragdag
    Nov 10 at 22:53










  • So I assume it only preserves the middle value? The compliments would preserve y, z?
    – Tree Garen
    Nov 10 at 22:54

















up vote
1
down vote

favorite












$L_n = {x in Sigma^{*} | exists w, y, z in Sigma^*, x = ywz, w^r = w, |w| = n }$



Informally x is palindrome of length n



where $Sigma = {0,1}$





I'm having a hard time understanding this could someone please explain.



For $n = 1$



$L_1 = (0+1)^*(0+1)^*$ (Why? What does this mean?)



$L_1^c = sigma$ (What would the compliment mean)



For $n = 2$



$L_2 = (0+1)^*(00+11)(0+1)^*$



$L_2^c = (10)^*(epsilon + 1) + (01)^*(epsilon + 0)$



So my attempt on $n = 3$ (the above two were given)



$L_3 = (0+1)^* (000 + 111 + 101 + 010) (0+1)^*$



$L_3^c = (100)^*(epsilon + 1) + (011)^*(epsilon + 0)$



I get how regexes work I just don't understand how $L_1$ is the regex for palindrome of length one. Not sure what the compliment means. Same for $L_2$










share|cite|improve this question




















  • 1




    $L_n$ is not the set of all palindromes of length $n$; it it the set of all words that contain a palindrome of length $n$.
    – Magdiragdag
    Nov 10 at 22:53










  • So I assume it only preserves the middle value? The compliments would preserve y, z?
    – Tree Garen
    Nov 10 at 22:54















up vote
1
down vote

favorite









up vote
1
down vote

favorite











$L_n = {x in Sigma^{*} | exists w, y, z in Sigma^*, x = ywz, w^r = w, |w| = n }$



Informally x is palindrome of length n



where $Sigma = {0,1}$





I'm having a hard time understanding this could someone please explain.



For $n = 1$



$L_1 = (0+1)^*(0+1)^*$ (Why? What does this mean?)



$L_1^c = sigma$ (What would the compliment mean)



For $n = 2$



$L_2 = (0+1)^*(00+11)(0+1)^*$



$L_2^c = (10)^*(epsilon + 1) + (01)^*(epsilon + 0)$



So my attempt on $n = 3$ (the above two were given)



$L_3 = (0+1)^* (000 + 111 + 101 + 010) (0+1)^*$



$L_3^c = (100)^*(epsilon + 1) + (011)^*(epsilon + 0)$



I get how regexes work I just don't understand how $L_1$ is the regex for palindrome of length one. Not sure what the compliment means. Same for $L_2$










share|cite|improve this question















$L_n = {x in Sigma^{*} | exists w, y, z in Sigma^*, x = ywz, w^r = w, |w| = n }$



Informally x is palindrome of length n



where $Sigma = {0,1}$





I'm having a hard time understanding this could someone please explain.



For $n = 1$



$L_1 = (0+1)^*(0+1)^*$ (Why? What does this mean?)



$L_1^c = sigma$ (What would the compliment mean)



For $n = 2$



$L_2 = (0+1)^*(00+11)(0+1)^*$



$L_2^c = (10)^*(epsilon + 1) + (01)^*(epsilon + 0)$



So my attempt on $n = 3$ (the above two were given)



$L_3 = (0+1)^* (000 + 111 + 101 + 010) (0+1)^*$



$L_3^c = (100)^*(epsilon + 1) + (011)^*(epsilon + 0)$



I get how regexes work I just don't understand how $L_1$ is the regex for palindrome of length one. Not sure what the compliment means. Same for $L_2$







regular-language






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 10 at 22:59

























asked Nov 10 at 22:45









Tree Garen

34319




34319








  • 1




    $L_n$ is not the set of all palindromes of length $n$; it it the set of all words that contain a palindrome of length $n$.
    – Magdiragdag
    Nov 10 at 22:53










  • So I assume it only preserves the middle value? The compliments would preserve y, z?
    – Tree Garen
    Nov 10 at 22:54
















  • 1




    $L_n$ is not the set of all palindromes of length $n$; it it the set of all words that contain a palindrome of length $n$.
    – Magdiragdag
    Nov 10 at 22:53










  • So I assume it only preserves the middle value? The compliments would preserve y, z?
    – Tree Garen
    Nov 10 at 22:54










1




1




$L_n$ is not the set of all palindromes of length $n$; it it the set of all words that contain a palindrome of length $n$.
– Magdiragdag
Nov 10 at 22:53




$L_n$ is not the set of all palindromes of length $n$; it it the set of all words that contain a palindrome of length $n$.
– Magdiragdag
Nov 10 at 22:53












So I assume it only preserves the middle value? The compliments would preserve y, z?
– Tree Garen
Nov 10 at 22:54






So I assume it only preserves the middle value? The compliments would preserve y, z?
– Tree Garen
Nov 10 at 22:54












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










$L_n$ is the set of strings in $Sigma^*$ that have a palindrome of length $n$ as a substring. The complement of a language $L^C$ on an alphabet $Sigma$ is the set of strings in $Sigma^*$ that are not in $L$.



For $L_1$, every string of length $1$ is a palindrome, namely $1$ and $0$. Any nonempty string is in $L_1$, so $$
L_1=L((0+1)(0+1)^*)
$$

since any nonempty string is either a $1$ or $0$ followed by some number of $1$'s and $0$'s. The complement of the language is just the empty string (which we denote $epsilon$). $$
L_1^C={epsilon}
$$

For $L_2$, the palindromes of length $2$ are $11$ and $00$, so the language is any string with either $11$ or $00$ preceded and followed by some number of $1$'s and $0$'s. $$
L_2=L((0+1)^*(00+11)(0+1)^*)
$$

The complement of $L_2$ is the set of strings that don't contain $11$ or $00$, so these are just strings of alternating $1$'s and $0$'s. These could begin or end with $0$ or $1$, but the string must alternate characters. $$
L_2^C=L((01)^*(0+epsilon) + (10)^*(1+epsilon))
$$

For $L_3$, the palindromes of length $3$ are $000$, $010$, $101$, and $111$, so$$
L_3=L((0+1)^*(000+010+101+111)(0+1)^*)
$$

The complement of $L_3$, the strings that do not contain $000$, $010$, $101$, or $111$, is more difficult. Consider such a string that begin with $00$. The next character must be $1$ since if it was $0$, the string would contain $000$. Now, the next character for string $001$ must be $1$ since if it was $0$, the string would contain $010$. We can continue this argument to get $00110011...$ for arbitrarily long strings. From this, we can see that if the string has at least $4$ characters, it can be represented as some number of repetitions of $0011$, $0110$, $1100$, or $1001$ followed by a prefix of that string. Otherwise, if it has less than $4$ characters, it is a substring of one of these. $$
L_3^C=((0011)^*(epsilon+0+00+001)+(0110)^*(epsilon+0+01+011) \
+(1100)^*(epsilon+1+11+110)+(1001)^*(epsilon+1+10+100))
$$






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%2f2993228%2fl-n-x-in-sigma-exists-w-y-z-in-sigma-x-ywz-wr-w-w%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










    $L_n$ is the set of strings in $Sigma^*$ that have a palindrome of length $n$ as a substring. The complement of a language $L^C$ on an alphabet $Sigma$ is the set of strings in $Sigma^*$ that are not in $L$.



    For $L_1$, every string of length $1$ is a palindrome, namely $1$ and $0$. Any nonempty string is in $L_1$, so $$
    L_1=L((0+1)(0+1)^*)
    $$

    since any nonempty string is either a $1$ or $0$ followed by some number of $1$'s and $0$'s. The complement of the language is just the empty string (which we denote $epsilon$). $$
    L_1^C={epsilon}
    $$

    For $L_2$, the palindromes of length $2$ are $11$ and $00$, so the language is any string with either $11$ or $00$ preceded and followed by some number of $1$'s and $0$'s. $$
    L_2=L((0+1)^*(00+11)(0+1)^*)
    $$

    The complement of $L_2$ is the set of strings that don't contain $11$ or $00$, so these are just strings of alternating $1$'s and $0$'s. These could begin or end with $0$ or $1$, but the string must alternate characters. $$
    L_2^C=L((01)^*(0+epsilon) + (10)^*(1+epsilon))
    $$

    For $L_3$, the palindromes of length $3$ are $000$, $010$, $101$, and $111$, so$$
    L_3=L((0+1)^*(000+010+101+111)(0+1)^*)
    $$

    The complement of $L_3$, the strings that do not contain $000$, $010$, $101$, or $111$, is more difficult. Consider such a string that begin with $00$. The next character must be $1$ since if it was $0$, the string would contain $000$. Now, the next character for string $001$ must be $1$ since if it was $0$, the string would contain $010$. We can continue this argument to get $00110011...$ for arbitrarily long strings. From this, we can see that if the string has at least $4$ characters, it can be represented as some number of repetitions of $0011$, $0110$, $1100$, or $1001$ followed by a prefix of that string. Otherwise, if it has less than $4$ characters, it is a substring of one of these. $$
    L_3^C=((0011)^*(epsilon+0+00+001)+(0110)^*(epsilon+0+01+011) \
    +(1100)^*(epsilon+1+11+110)+(1001)^*(epsilon+1+10+100))
    $$






    share|cite|improve this answer

























      up vote
      0
      down vote



      accepted










      $L_n$ is the set of strings in $Sigma^*$ that have a palindrome of length $n$ as a substring. The complement of a language $L^C$ on an alphabet $Sigma$ is the set of strings in $Sigma^*$ that are not in $L$.



      For $L_1$, every string of length $1$ is a palindrome, namely $1$ and $0$. Any nonempty string is in $L_1$, so $$
      L_1=L((0+1)(0+1)^*)
      $$

      since any nonempty string is either a $1$ or $0$ followed by some number of $1$'s and $0$'s. The complement of the language is just the empty string (which we denote $epsilon$). $$
      L_1^C={epsilon}
      $$

      For $L_2$, the palindromes of length $2$ are $11$ and $00$, so the language is any string with either $11$ or $00$ preceded and followed by some number of $1$'s and $0$'s. $$
      L_2=L((0+1)^*(00+11)(0+1)^*)
      $$

      The complement of $L_2$ is the set of strings that don't contain $11$ or $00$, so these are just strings of alternating $1$'s and $0$'s. These could begin or end with $0$ or $1$, but the string must alternate characters. $$
      L_2^C=L((01)^*(0+epsilon) + (10)^*(1+epsilon))
      $$

      For $L_3$, the palindromes of length $3$ are $000$, $010$, $101$, and $111$, so$$
      L_3=L((0+1)^*(000+010+101+111)(0+1)^*)
      $$

      The complement of $L_3$, the strings that do not contain $000$, $010$, $101$, or $111$, is more difficult. Consider such a string that begin with $00$. The next character must be $1$ since if it was $0$, the string would contain $000$. Now, the next character for string $001$ must be $1$ since if it was $0$, the string would contain $010$. We can continue this argument to get $00110011...$ for arbitrarily long strings. From this, we can see that if the string has at least $4$ characters, it can be represented as some number of repetitions of $0011$, $0110$, $1100$, or $1001$ followed by a prefix of that string. Otherwise, if it has less than $4$ characters, it is a substring of one of these. $$
      L_3^C=((0011)^*(epsilon+0+00+001)+(0110)^*(epsilon+0+01+011) \
      +(1100)^*(epsilon+1+11+110)+(1001)^*(epsilon+1+10+100))
      $$






      share|cite|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        $L_n$ is the set of strings in $Sigma^*$ that have a palindrome of length $n$ as a substring. The complement of a language $L^C$ on an alphabet $Sigma$ is the set of strings in $Sigma^*$ that are not in $L$.



        For $L_1$, every string of length $1$ is a palindrome, namely $1$ and $0$. Any nonempty string is in $L_1$, so $$
        L_1=L((0+1)(0+1)^*)
        $$

        since any nonempty string is either a $1$ or $0$ followed by some number of $1$'s and $0$'s. The complement of the language is just the empty string (which we denote $epsilon$). $$
        L_1^C={epsilon}
        $$

        For $L_2$, the palindromes of length $2$ are $11$ and $00$, so the language is any string with either $11$ or $00$ preceded and followed by some number of $1$'s and $0$'s. $$
        L_2=L((0+1)^*(00+11)(0+1)^*)
        $$

        The complement of $L_2$ is the set of strings that don't contain $11$ or $00$, so these are just strings of alternating $1$'s and $0$'s. These could begin or end with $0$ or $1$, but the string must alternate characters. $$
        L_2^C=L((01)^*(0+epsilon) + (10)^*(1+epsilon))
        $$

        For $L_3$, the palindromes of length $3$ are $000$, $010$, $101$, and $111$, so$$
        L_3=L((0+1)^*(000+010+101+111)(0+1)^*)
        $$

        The complement of $L_3$, the strings that do not contain $000$, $010$, $101$, or $111$, is more difficult. Consider such a string that begin with $00$. The next character must be $1$ since if it was $0$, the string would contain $000$. Now, the next character for string $001$ must be $1$ since if it was $0$, the string would contain $010$. We can continue this argument to get $00110011...$ for arbitrarily long strings. From this, we can see that if the string has at least $4$ characters, it can be represented as some number of repetitions of $0011$, $0110$, $1100$, or $1001$ followed by a prefix of that string. Otherwise, if it has less than $4$ characters, it is a substring of one of these. $$
        L_3^C=((0011)^*(epsilon+0+00+001)+(0110)^*(epsilon+0+01+011) \
        +(1100)^*(epsilon+1+11+110)+(1001)^*(epsilon+1+10+100))
        $$






        share|cite|improve this answer












        $L_n$ is the set of strings in $Sigma^*$ that have a palindrome of length $n$ as a substring. The complement of a language $L^C$ on an alphabet $Sigma$ is the set of strings in $Sigma^*$ that are not in $L$.



        For $L_1$, every string of length $1$ is a palindrome, namely $1$ and $0$. Any nonempty string is in $L_1$, so $$
        L_1=L((0+1)(0+1)^*)
        $$

        since any nonempty string is either a $1$ or $0$ followed by some number of $1$'s and $0$'s. The complement of the language is just the empty string (which we denote $epsilon$). $$
        L_1^C={epsilon}
        $$

        For $L_2$, the palindromes of length $2$ are $11$ and $00$, so the language is any string with either $11$ or $00$ preceded and followed by some number of $1$'s and $0$'s. $$
        L_2=L((0+1)^*(00+11)(0+1)^*)
        $$

        The complement of $L_2$ is the set of strings that don't contain $11$ or $00$, so these are just strings of alternating $1$'s and $0$'s. These could begin or end with $0$ or $1$, but the string must alternate characters. $$
        L_2^C=L((01)^*(0+epsilon) + (10)^*(1+epsilon))
        $$

        For $L_3$, the palindromes of length $3$ are $000$, $010$, $101$, and $111$, so$$
        L_3=L((0+1)^*(000+010+101+111)(0+1)^*)
        $$

        The complement of $L_3$, the strings that do not contain $000$, $010$, $101$, or $111$, is more difficult. Consider such a string that begin with $00$. The next character must be $1$ since if it was $0$, the string would contain $000$. Now, the next character for string $001$ must be $1$ since if it was $0$, the string would contain $010$. We can continue this argument to get $00110011...$ for arbitrarily long strings. From this, we can see that if the string has at least $4$ characters, it can be represented as some number of repetitions of $0011$, $0110$, $1100$, or $1001$ followed by a prefix of that string. Otherwise, if it has less than $4$ characters, it is a substring of one of these. $$
        L_3^C=((0011)^*(epsilon+0+00+001)+(0110)^*(epsilon+0+01+011) \
        +(1100)^*(epsilon+1+11+110)+(1001)^*(epsilon+1+10+100))
        $$







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered 2 days ago









        Joey Kilpatrick

        67118




        67118






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2993228%2fl-n-x-in-sigma-exists-w-y-z-in-sigma-x-ywz-wr-w-w%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

            Plaza Victoria

            In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

            How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...