homework
string | exercise_number
string | content
string | full_id
string |
|---|---|---|---|
hw1
|
1
|
Prove
$$\frac{1}{2\ln 2} + \frac{1}{3\ln 3} + \ldots + \frac{1}{n\ln n} = \ln\ln n + O(1)$$
and
$$\frac{1}{1^{1.1}} + \frac{1}{2^{1.1}} + \ldots \frac{1}{n^{1.1}} = O(1).$$
|
hw1_ex1
|
hw1
|
2
|
Order the following functions by asymptotic growth. Place $f$ before $g$ if $f(n) = O(g(n))$.
* $n^n$
* $\sqrt{n}$
* $\log\log n$
* $0.001n^7$
* $5000n$
* $e^n$
* $2^{\log^2 n}$
* $10^{10^{10}}$
* $n!$
* $2^{2^n}$
|
hw1_ex2
|
hw1
|
3
|
Let $\Sigma = \{0, 1\}$. Let language
$$L = \{w \in \{0, 1\}^* : w \text{ has an unequal number of 0's and 1's}\}.$$
Prove $L^* = \Sigma^*$.
|
hw1_ex3
|
hw10
|
1
|
Use first-order Peano arithmetic formulas to express "$m = 2^n$".
|
hw10_ex1
|
hw10
|
2
|
Prove P is closed under Kleene star. In other words, if a language $L$ belongs to P, then so does $L^*$.
|
hw10_ex2
|
hw10
|
3
|
Let
$$L_1 = \{(\alpha, x) : \text{TM } M_\alpha \text{ accepts input } x\},$$
and
$$L_2 = \{\alpha : \text{TM } M_\alpha \text{ halts on the empty input}\}.$$
Prove that $L_1 \leq_T L_2$.
|
hw10_ex3
|
hw11
|
1
|
Define the problem QUADEQ as follows: given m quadratic equations in n variables over the finite field GF(2),
$$p_1(x_1, x_2, \ldots, x_n) = 0,$$
$$p_2(x_1, x_2, \ldots, x_n) = 0,$$
$$\vdots$$
$$p_m(x_1, x_2, \ldots, x_n) = 0,$$
determine whether there exists at least one solution. Prove that QUADEQ ∈ NP.
|
hw11_ex1
|
hw11
|
2
|
Prove if L is NP-hard and L ∈ P, then P = NP.
|
hw11_ex2
|
hw11
|
3
|
Prove that $L_1 \leq_P L_2$ and $L_2 \in$ NP, then $L_1 \in$ NP.
|
hw11_ex3
|
hw13
|
1
|
Construct a function $T(n)$ that satisfies $n \leq T(n) \leq n^2$ and is not time-constructible.
|
hw13_ex1
|
hw13
|
2
|
Define the *low-degree clique* (LDC) problem as follows: Given a graph $G = (V, E)$ and an integer $k$, determine whether $G$ contains a clique of size at least $k$ consisting solely of vertices whose degree does not exceed the median vertex degree of $G$. Prove that LDC is NP-complete.
|
hw13_ex2
|
hw13
|
3
|
Let
$$\text{DOUBLE-SAT} = \{\langle \varphi \rangle \mid \text{formula } \varphi \text{ has at least two satisfying assignments}\}.$$
Prove that DOUBLE-SAT is NP-complete.
|
hw13_ex3
|
hw2
|
1
|
Design a finite automaton that accepts the following language
$$L = \left\{ w \in \{0, 1\}^* \mid w = w_1w_2 \cdots w_n \text{ such that } \sum_{i=1}^{n} w_i 2^{n-i} \equiv 0 \pmod{5} \right\}.$$
In other words, the language $L$ is the set of all binary strings that represent multiples of 5, written with the most significant bit first (MSB). Draw the state diagram of the finite automaton.
|
hw2_ex1
|
hw2
|
2
|
Design a finite automaton that recognizes the following language
$$L = \{w \in \{0, 1\}^* : w \text{ does not contain substring } 10\}.$$
Draw its state diagram.
|
hw2_ex2
|
hw2
|
3
|
Use the definition of big-O notation to prove the following:
1) If $f_1 = O(g_1)$ and $f_2 = O(g_2)$, then $f_1f_2 = O(g_1g_2)$.
2) If $f_1 = O(g)$ and $f_2 = O(g)$, then $f_1 + f_2 = O(g)$.
|
hw2_ex3
|
hw3
|
1
|
Define a *backward-read DFA* as a deterministic finite automaton that processes its input string from right to left. Prove that a language is regular if and only if it can be accepted by some backward-read DFA.
|
hw3_ex1
|
hw3
|
2
|
Give a regular expression for language
$$L = \{w \in \{0, 1\}^* : \text{ the number of 1's in } w \text{ is even, and the number of 0's is even}\}.$$
|
hw3_ex2
|
hw3
|
3
|
Construct NFAs corresponding to the following regular expressions:
* $0^+ \cup (01)^*$;
* $(0 \cup 1^+)0^*1^+$.
|
hw3_ex3
|
hw5
|
1
|
The input is two binary numbers, $x$ and $y$ (with the most significant bit on the left), separated by a symbol #, for example, 100#100⊔. (Assume there are no leading zeros unless the number is zero.) Accept if $x$ and $y$ are equal.
Draw the state diagram of the corresponding Turing machine and submit its source code on eLearning.
|
hw5_ex1
|
hw5
|
2
|
Let language
$$L = \{0^n : n \text{ is a Fibonacci number}\}.$$
Design a Turing machine that decides L. Draw the state diagram of the corresponding Turing machine and submit its source code on eLearning.
|
hw5_ex2
|
hw5
|
3
|
In the definition of the Turing machine, the head can move left or right. A Turing machine whose head can move left, right, or stay in place is called a *Turing machine with a stationary move*, or more formally:
$$\delta : Q \times \Gamma \to Q \times \Gamma \times \{L, R, S\}.$$
Prove that if a language $L$ can be decided by a Turing machine with stationary moves, then $L$ can also be decided by a standard Turing machine.
|
hw5_ex3
|
hw6
|
1
|
Define a *two-dimensional* Turing machine to be a TM where each of its tapes is an infinite grid (and the machine can move not only Left and Right but also Up and Down).
Show that if language L can be decided in time T(n) by a two-dimensional TM then L ∈ DTIME(T(n)<sup>2</sup>).
|
hw6_ex1
|
hw6
|
2
|
Define a *one-tape two-head Turing machine* as a Turing machine equipped with a single tape but two independent heads operating on it. Each head can read, write, and move simultaneously and independently of the other. Both heads may read the same tape cell at the same time. Conflicts are resolved as follows:
* If both heads attempt to write to the same cell simultaneously, the first head goes first, and the second head overwrites any previous content.
* If the first head tries to write while the second head tries to read the same cell, the first head goes first, and the second head reads the updated content.
* If the first head tries to read while the second head tries to write the same cell, the first head goes first, reading the old content, and then the second head updates the content.
Show that if language L can be decided in time T(n) by a one-tape two-head Turing machine, then L ∈ DTIME(T(n)<sup>2</sup>).
|
hw6_ex2
|
hw6
|
3
|
Prove the number of multitape Turing machines is countable.
|
hw6_ex3
|
hw9
|
1
|
Prove that the Post Correspondence Problem is decidable over the unary alphabet Σ = {1}.
|
hw9_ex1
|
hw9
|
2
|
Prove that the Post Correspondence Problem is undecidable over the binary alphabet Σ = {0, 1}, assuming that the PCP is undecidable over an arbitrary finite alphabet.
|
hw9_ex2
|
hw9
|
3
|
Express the *Twin Prime Conjecture* in first-order Peano Arithmetic using only the symbols 0, S, +, ×, = and quantifiers ∀, ∃.
(a) Define a formula Prime(x) expressing that x is a prime number.
(b) Define a formula TwinPrime(p) expressing that p is the smaller number of a twin prime pair.
(c) Write a single first-order PA formula that states: *for every number x, there exists a larger twin prime p > x*.
|
hw9_ex3
|
LyTOC Benchmark Dataset
A curated collection of Theory of Computation and Algorithms homework exercises, extracted from academic PDFs using OCR and structured for machine learning evaluation.
🔗 Links:
Dataset Description
Dataset Summary
The LyTOC (Logic and Theory of Computation) Benchmark contains 27 carefully extracted exercises from 9 homework assignments covering fundamental topics in theoretical computer science. Each exercise is preserved with its original LaTeX mathematical notation, making it suitable for evaluating language models on formal reasoning tasks.
Key Features:
- 27 exercises across 9 homework assignments
- Topics: automata theory, complexity theory, Turing machines, formal languages, algorithm analysis
- LaTeX mathematical notation preserved
- Structured with exercise numbers
- Clean extraction with OCR post-processing
Supported Tasks
- Question Answering: Answer theoretical computer science questions
- Mathematical Reasoning: Solve problems involving formal proofs and mathematical notation
- Text Generation: Generate solutions to computational theory problems
- Educational Assessment: Evaluate understanding of CS theory concepts
Languages
- English (en)
Dataset Structure
Data Instances
Each instance represents a single exercise:
{
"homework": "hw1",
"exercise_number": "3",
"content": "Let $\\Sigma = \\{0, 1\\}$. Let language\n\n$$L = \\{w \\in \\{0, 1\\}^* : w \\text{ has an unequal number of 0's and 1's}\\}.$$\n\nProve $L^* = \\Sigma^*$.",
"full_id": "hw1_ex3"
}
Data Fields
homework(string): Homework identifier (e.g., "hw1", "hw2", "hw13")exercise_number(string): Exercise number within the homework (e.g., "1", "2", "3")content(string): Full exercise text including LaTeX mathematical notationfull_id(string): Unique identifier for the exercise (e.g., "hw1_ex3", "hw2_ex3_1")
Data Splits
The dataset consists of a single split containing all 27 exercises.
Dataset Statistics
- Total Exercises: 27
- Homeworks: 9 (hw1, hw2, hw3, hw5, hw6, hw9, hw10, hw11, hw13)
- Average Content Length: ~200-500 characters per exercise
Topic Distribution
The exercises cover the following topics:
- Asymptotic Analysis: Big-O notation, growth rates
- Finite Automata: DFA, NFA, regular expressions
- Formal Languages: Regular languages, context-free languages
- Turing Machines: Decidability, computability
- Complexity Theory: P, NP, NP-completeness, reductions
- Algorithm Design: Time complexity, space complexity
Dataset Creation
Source Data
The dataset was created from homework assignments in a Theory of Computation and Algorithms course.
Data Collection
- Source: Academic homework PDFs (9 files)
- Extraction Method: SimpleTex OCR API
- Processing: Automated regex-based exercise splitting
- Quality Control: Manual verification of extraction accuracy
Data Processing Pipeline
- PDF to Image: Convert each PDF page to high-resolution images
- OCR Processing: Extract text using SimpleTex OCR API
- Punctuation Normalization: Convert Chinese punctuation to English equivalents
- Exercise Splitting: Use regex patterns to identify exercise boundaries
- Metadata Generation: Create unique identifiers and structure data
Annotations
The dataset does not include solutions or annotations. It contains only problem statements as extracted from the source materials.
Considerations for Using the Data
Recommended Uses
- Evaluating language models on formal reasoning tasks
- Training models for mathematical problem understanding
- Benchmarking CS theory knowledge in AI systems
- Educational tool development for computer science
Limitations
- No Solutions: The dataset contains only problem statements, not solutions
- OCR Artifacts: Some mathematical notation may have minor OCR errors
- Limited Scope: Covers specific topics in theory of computation and algorithms
- No Visual Content: Diagrams and figures from PDFs are not included
- Language: English only
Ethical Considerations
This dataset is intended for educational and research purposes. Users should:
- Respect academic integrity when using for educational purposes
- Not use for automated homework completion systems
- Cite appropriately when using in research
Additional Information
Licensing Information
This dataset is released under the MIT License.
Citation Information
If you use this dataset in your research, please cite:
@misc{lytoc-benchmark-2025,
title={LyTOC Benchmark: Theory of Computation and Algorithms Exercise Dataset},
author={LyTOC Contributors},
year={2025},
howpublished={\\url{https://huggingface.co/datasets/lytoc-benchmark}}
}
Dataset Curators
Dataset created using:
- SimpleTex OCR API for PDF extraction
- Custom Python scripts for data processing
- Claude Code for automation and quality assurance
Contact
For questions or issues regarding this dataset, please open an issue on the dataset repository.
Usage Example
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("Zecyel/LyTOC")
# Access an exercise
exercise = dataset['train'][0]
print(f"Exercise ID: {exercise['full_id']}")
print(f"Content: {exercise['content']}")
# Filter by homework
hw1_exercises = [ex for ex in dataset['train'] if ex['homework'] == 'hw1']
print(f"Homework 1 has {len(hw1_exercises)} exercises")
Version History
- v1.0.0 (2025-12-30): Initial release with 27 exercises from 9 homework assignments
- Downloads last month
- -