Esempio n. 1
0
def generate(data):
    data["params"]["hints"] = []

    data["params"]["language_description"] = \
        "Every binary string except 000."

    server_base.generate(data)
Esempio n. 2
0
def generate(data):
    data["params"]["hints"] = []

    data["params"]["language_description"] = \
        "All binary strings in which the number of 0s is 2 mod 3."
    
    server_base.generate(data)
Esempio n. 3
0
def generate(data):
    data["params"]["hints"] = []

    data["params"]["language_description"] = \
        "All binary strings in which every run of 0s has odd length."

    server_base.generate(data)
Esempio n. 4
0
def generate(data):
    data["params"]["hints"] = []

    data["params"]["language_description"] = \
        "All binary strings not containing the substring 000."
    
    server_base.generate(data)
Esempio n. 5
0
def generate(data):
    data["params"]["hints"] = []

    data["params"]["language_description"] = \
        "All binary strings containing at least three 0s."

    server_base.generate(data)
Esempio n. 6
0
def generate(data):
    data["params"]["hints"] = []

    data["params"]["language_description"] = \
        "All binary strings in which 1 does not appear after a substring 000."

    server_base.generate(data)
Esempio n. 7
0
def generate(data):
    data["params"]["hints"] = [
        "The 'or' can be achieved by taking the union of two regular expressions."
    ]

    data["params"]["language_description"] = \
        "All binary strings containing 010 or containing at least three 1s."

    server_base.generate(data)
Esempio n. 8
0
def generate(data):
    data["params"]["hints"] = [
        "Try constructing the string one symbol at a time. "
        "What are the possible values of the first symbol? "
        "The first two symbols? The first three symbols? And so on..."
    ]

    data["params"]["language_description"] = \
        "All binary strings such that every prefix $x$ satisfies $|\#_0(x) - 2\cdot\#_1(x)| \le 2$."
    
    server_base.generate(data)
Esempio n. 9
0
def generate(data):
    data["params"]["hints"] = [
        "Consider the blocks of 1s that appear in the string. "
        "Unless a block is at the beginning or end of the string, then a certain restriction "
        "applies to the length of the block. What is this restriction?"
    ]

    data["params"]["language_description"] = \
        "All binary strings not containing the substring 010."
    
    server_base.generate(data)
Esempio n. 10
0
def generate(data):
    data["params"]["hints"] = [
        "Do casework on where the first 1 appears relative to the first two 0s.",

        "There should be three cases. "
        "The final answer should be the union of three regular expressions, one for each case.",
    ]

    data["params"]["language_description"] = \
        "All binary strings containing at least two 0s and at least one 1."
    
    server_base.generate(data)
Esempio n. 11
0
def generate(data):
    data["params"]["hints"] = [
        "For what values of $n$ does the substring $000$ appear in $0^n$ an odd number of times?",
        "Consider the maximal blocks of 0s that appear in a string. For example, in $10001101110000100000$, "
        "the maximal blocks of 0s are $$1(000)11(0)111(0000)1(00000).$$"
        "Then, consider the number of occurrences of $000$ contributed by each block.",
        "Some of these blocks contribute an odd number of occurrences of $000$. We want those "
        "types of blocks to appear an even number of times."
    ]

    data["params"]["language_description"] = \
        "All binary strings in which the substring $000$ appears an even number of times."

    server_base.generate(data)
Esempio n. 12
0
def generate(data):
    data["params"]["hints"] = [
        "Any string in the language can be expressed as $x010y$. "
        "Perform casework on the value of $\#_0(x) \\bmod 3$.",
        "The value of $\#_0(x) \\bmod 3$ uniquely determines the value of $\#_0(y) \\bmod 3$.",
        "The final answer should be the union of three regular expressions, one for each case.",
        "Let $L_i = \{x \mid \#_0(x) \equiv i \\pmod 3\}$. Write regular expressions for "
        "$L_0$, $L_1$, and $L_2$, and use those as subexpressions to compose the final answer."
    ]

    data["params"]["language_description"] = \
        "All binary strings containing 010 where the total number of 0s is divisible by 3."

    server_base.generate(data)
Esempio n. 13
0
def generate(data):
    data["params"]["hints"] = [
        "There must be two more 1s in addition to the 1 that appears in 010. "
        "Do casework on where those two 1s appear relative to the 010 substring.",

        "There should be three cases. "
        "The final answer should be the union of three regular expressions, one for each case.",

        "The two 1s can both appear before 010, both after, or one before and one after."
    ]

    data["params"]["language_description"] = \
        "All binary strings containing 010 and containing at least three 1s."
    
    server_base.generate(data)
Esempio n. 14
0
def generate(data):
    data["params"]["hints"] = [
        "Consider the graph of $y = \#_0(x) - \#_1(x)$ vs. the length of $x$. "
        "This graph goes up or down by 1 every time we append another symbol to $x$. "
        "Furthermore, the graph must stay between the horizontal lines $y=-2$ and $y=2$. "
        "Now, imagine we cut the graph into pieces every time it touches $y=0$. "
        "Then, each of those pieces must either be completely above the y-axis, or "
        "completely below the y-axis. Furthermore, each of those pieces, except for the last piece, "
        "must be balanced.",

        "Write a regular expression for all balanced strings where the graph of $y = \#_0(x) - \#_1(x)$ "
        "stays completely above the y-axis (except for the two endpoints, which touch the y-axis). "
        "Write another one for where the graph stays completely below the y-axis. Then, write two more "
        "for the same thing, except without the balanced restriction (i.e. it doesn't have to end "
        "on the y-axis).",
    ]

    data["params"]["language_description"] = \
        "All binary strings such that every prefix $x$ satisfies $|\#_0(x) - \#_1(x)| \le 2$."
    
    server_base.generate(data)