sipser-tasks-v1 / train.jsonl
eltociear's picture
Upload train.jsonl with huggingface_hub
c56d8fd verified
Raw
History Blame Contribute Delete
49.1 kB
{"task_id": "sp-000", "category": "dfa", "prompt": "For DFA M, report 1 if the string is accepted and 0 if it is rejected, for the strings 'ab', 'aab', 'baa', 'bbbb' and '' (the empty string), in that order. Return one row of five values.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[0, 1, 1, 0, 0]]}"}
{"task_id": "sp-001", "category": "dfa", "prompt": "How many strings of length exactly n does DFA M accept, for n = 3, n = 5 and n = 8? Return one row of the three integers.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[3, 19, 201]]}"}
{"task_id": "sp-002", "category": "dfa", "prompt": "In SHORTLEX order (shorter first, ties alphabetically), give the first three strings that DFA M accepts. Return one row of the three strings.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"aa\", \"aaa\", \"aab\"]]}"}
{"task_id": "sp-003", "category": "dfa", "prompt": "Give the state DFA M is in after reading each of 'a', 'ab', 'aba' and 'abaa', starting from q0. Return one row of the four state names.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"q1\", \"q0\", \"q1\", \"q2\"]]}"}
{"task_id": "sp-004", "category": "dfa", "prompt": "Minimise DFA M by partition refinement. How many states does the minimal DFA have, and how many of M's three states are unreachable from q0? Return one row [minimal_states, unreachable].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[3, 0]]}"}
{"task_id": "sp-005", "category": "dfa", "prompt": "Consider the COMPLEMENT of DFA M — the same machine with accepting and non-accepting states swapped. How many strings of length exactly 3, 5 and 8 does it accept? Return one row of the three integers.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[5, 13, 55]]}"}
{"task_id": "sp-006", "category": "nfa", "prompt": "For NFA N, report 1 if accepted and 0 if rejected, for 'ab', 'ba', 'aab', 'bbb' and 'aba', in that order. Return one row of five values.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[1, 0, 1, 0, 1]]}"}
{"task_id": "sp-007", "category": "nfa", "prompt": "Run the subset construction on NFA N. Give (a) the number of subsets a naive construction would consider, which is 2 to the power of N's state count, (b) the number REACHABLE from the start subset, and (c) the number of states after minimising the reachable machine. Return one row of the three integers.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[8, 4, 3]]}"}
{"task_id": "sp-008", "category": "nfa", "prompt": "Give the set of NFA N states reachable after reading 'a', then after 'aa', then after 'ab', each as the state names in alphabetical order joined by a comma with no spaces (an empty set is the string 'none'). Return one row of three strings.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"p0,p1\", \"p0,p1\", \"p0,p2\"]]}"}
{"task_id": "sp-009", "category": "nfa", "prompt": "How many strings of length exactly n does NFA N accept, for n = 2, n = 4 and n = 6? Return one row of the three integers.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[1, 11, 57]]}"}
{"task_id": "sp-010", "category": "nfa", "prompt": "Do DFA M and NFA N accept the same language? Compare them on every string of length 0 through 8 and give the number of strings on which they DISAGREE, followed by the shortest such string in shortlex order (or 'none' if there is no disagreement). Return one row [count, witness].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[153, \"aa\"]]}"}
{"task_id": "sp-011", "category": "regex", "prompt": "How many strings of length exactly 4 over {a,b} contain 'aa' as a substring, and how many contain 'ab'? Return one row [with_aa, with_ab].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[8, 11]]}"}
{"task_id": "sp-012", "category": "regex", "prompt": "Do the patterns '^.*aa.*$' and '^.*ab.*$' describe the same language over {a,b}? Compare on every string of length 0 through 8 and give the number of disagreements and the shortest witness in shortlex order (or 'none'). Return one row [count, witness].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[153, \"aa\"]]}"}
{"task_id": "sp-013", "category": "regex", "prompt": "Does the pattern '^.*aa.*$' describe exactly the language of DFA M? Compare on every string of length 0 through 8 and give the number of disagreements, then the number of strings in that range that BOTH accept. Return one row [disagreements, both_accept].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[0, 369]]}"}
{"task_id": "sp-014", "category": "regex", "prompt": "Over {a,b}, how many strings of length exactly 5 match '^(ab)*$', '^a*b*$' and '^.*aba.*$'? Return one row of the three integers.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[0, 6, 11]]}"}
{"task_id": "sp-015", "category": "regex", "prompt": "In shortlex order over {a,b}, give the first four strings matching '^a*b*$' that are NOT matched by '^(ab)*$'. Return one row of the four strings (the empty string is written as the two characters '\"\"' if it occurs — it does not here).", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"a\", \"b\", \"aa\", \"bb\"]]}"}
{"task_id": "sp-016", "category": "cfg", "prompt": "Using CYK on grammar G, report 1 if the string is generated and 0 if not, for 'ab', 'ba', 'aab', 'bab' and 'abb', in that order. Return one row of five values.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[1, 0, 0, 1, 1]]}"}
{"task_id": "sp-017", "category": "cfg", "prompt": "How many strings of length exactly n does grammar G generate, for n = 2, n = 3 and n = 4? Return one row of the three integers.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[2, 4, 8]]}"}
{"task_id": "sp-018", "category": "cfg", "prompt": "In shortlex order, give the first three strings that grammar G generates. Return one row of the three strings.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"ab\", \"bb\", \"aaa\"]]}"}
{"task_id": "sp-019", "category": "cfg", "prompt": "Grammar G is AMBIGUOUS. How many distinct parse trees does it give to 'bbabb', to 'aaaab' and to 'ba'? Return one row of the three integers.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[3, 2, 0]]}"}
{"task_id": "sp-020", "category": "cfg", "prompt": "For the CYK table on the string 'bbabb', give the number of variables in the cell spanning the whole string, and the number of non-empty cells in the whole table. Return one row [top_cell_size, non_empty_cells].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[3, 14]]}"}
{"task_id": "sp-021", "category": "cfg", "prompt": "Is the language of grammar G the same as the language of DFA M? Compare on every string of length 1 through 6 and give the number of disagreements and the shortest witness in shortlex order (or 'none'). Return one row [count, witness].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[63, \"aa\"]]}"}
{"task_id": "sp-022", "category": "tm", "prompt": "Run Turing machine T on the input '1011'. Give the final tape content with any trailing blanks removed, the number of steps taken, and the final head position as a 0-based index. Return one row [tape, steps, head].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"0100\", 5, 4]]}"}
{"task_id": "sp-023", "category": "tm", "prompt": "Run T on '0000' and on '1111'. Give each final tape with trailing blanks removed, then the number of steps for each. Return one row [tape1, tape2, steps1, steps2].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"1111\", \"0000\", 5, 5]]}"}
{"task_id": "sp-024", "category": "tm", "prompt": "How many steps does T take on inputs of length 0, 1, 4 and 10? Return one row of the four integers.", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[1, 2, 5, 11]]}"}
{"task_id": "sp-025", "category": "tm", "prompt": "Run T on '1011' and then run T again on its OWN output. Give the tape after the second run with trailing blanks removed, and 1 if it equals the original input or 0 if it does not. Return one row [tape, equals_original].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"1011\", 1]]}"}
{"task_id": "sp-026", "category": "tm", "prompt": "Give the state and the symbol under the head after exactly 2 steps of T on the input '101', and after exactly 3 steps. Return one row [state2, symbol2, state3, symbol3].", "api_description": "The tasks refer to these fixed machines. The alphabet is {a, b} unless stated.\n\nDFA M (states q0, q1, q2; start q0; accepting {q2}):\n q0 -a-> q1 q0 -b-> q0\n q1 -a-> q2 q1 -b-> q0\n q2 -a-> q2 q2 -b-> q2\n\nNFA N (states p0, p1, p2; start p0; accepting {p2}; no epsilon transitions):\n p0 -a-> {p0, p1} p0 -b-> {p0}\n p1 -a-> {} p1 -b-> {p2}\n p2 -a-> {p2} p2 -b-> {p2}\n\nCFG G in Chomsky normal form, start symbol S:\n S -> AB | CC\n A -> BC | a\n B -> AA | b\n C -> AB | b\n\nTURING MACHINE T over {0, 1} with blank '_', start state t0, halting state HALT:\n t0,0 -> t0, write 1, move R\n t0,1 -> t0, write 0, move R\n t0,_ -> HALT, write _, stay\n The head starts on the leftmost input symbol. A \"step\" is one transition taken.\n\nSTATE COUNTS — say which you mean, because there are three different right answers: the number\nof subsets the subset construction could produce (2 to the power of the NFA's states), the\nnumber REACHABLE from the start subset, and the number left after minimising. Every task below\nnames the one it wants.\n\nAvailable imports: itertools, re. Nothing else is needed.\n\nStrings are ordered SHORTLEX throughout: shorter strings first, and strings of the same length\nin alphabetical order — so \"\", \"a\", \"b\", \"aa\", \"ab\", \"ba\", \"bb\", \"aaa\", ...\n\nPut the requested values in `result` as a list of rows of plain values. Every value is an\ninteger or a string; there are no floats in this environment.\n", "expected_output": "{\"rows\": [[\"t0\", \"1\", \"t0\", \"_\"]]}"}