category stringclasses 6
values | language stringclasses 1
value | filename stringlengths 6 41 | relative_path stringlengths 13 60 | code stringlengths 468 13.6k | system_prompt stringclasses 1
value | system_prompt_with_examples stringclasses 1
value | user_query stringlengths 745 13.9k |
|---|---|---|---|---|---|---|---|
cs_set | python | binary_search.py | cs_set/binary_search.py | """Binary search over a sorted list of integers.
Edge cases:
- Empty list returns None.
- Non-integer elements or unsorted lists are invalid and raise ValueError.
"""
from typing import List, Optional, Callable
def pre(arr: List[int], target: int) -> bool:
return (
isinstance(arr, list)
and all(i... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Binary search over a sorted list of inte... |
cs_set | python | bubble_sort.py | cs_set/bubble_sort.py | """Bubble sort for a list of integers.
Edge cases:
- Empty list returns empty list.
- Non-integer elements are invalid and raise ValueError.
"""
from typing import List, Callable
def pre(arr: List[int]) -> bool:
return isinstance(arr, list) and all(isinstance(x, int) for x in arr)
def bubble_sort(arr: List[int]... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Bubble sort for a list of integers.
Edg... |
cs_set | python | counting_sort.py | cs_set/counting_sort.py | """Counting sort for a list of integers (supports negatives via shift).
Edge cases:
- Empty list returns empty list.
- Non-integer elements are invalid and raise ValueError.
"""
from typing import List, Callable
def pre(arr: List[int]) -> bool:
return isinstance(arr, list) and all(isinstance(x, int) for x in arr... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Counting sort for a list of integers (su... |
cs_set | python | edit_distance.py | cs_set/edit_distance.py | """Levenshtein edit distance between two sequences (str or list).
Edge cases:
- Empty sequences handled.
- Non-sequence inputs are invalid and raise ValueError.
"""
from typing import List, Union, Callable
def pre(s1: Union[str, List], s2: Union[str, List]) -> bool:
return (isinstance(s1, (str, list)) and isinsta... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Levenshtein edit distance between two se... |
cs_set | python | heap_sort.py | cs_set/heap_sort.py | """Heap sort for a list of integers.
Edge cases:
- Empty or single-element list returns copy.
- Non-integer elements are invalid and raise ValueError.
"""
from typing import List, Callable
def pre(arr: List[int]) -> bool:
return isinstance(arr, list) and all(isinstance(x, int) for x in arr)
def heap_sort(arr: Li... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Heap sort for a list of integers.
Edge ... |
cs_set | python | insertion_sort.py | cs_set/insertion_sort.py | """Insertion sort for a list of integers.
Edge cases:
- Empty list returns empty list.
- Non-integer elements are invalid and raise ValueError.
"""
from typing import List, Callable
def pre(arr: List[int]) -> bool:
return isinstance(arr, list) and all(isinstance(x, int) for x in arr)
def insertion_sort(arr: List... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Insertion sort for a list of integers.
... |
cs_set | python | lcs.py | cs_set/lcs.py | """Longest common subsequence (LCS) for strings or lists.
Edge cases:
- Empty inputs handled.
- Non-sequence inputs are invalid and raise ValueError.
"""
from typing import List, Union, Callable
def pre(s1: Union[str, List], s2: Union[str, List]) -> bool:
return (isinstance(s1, (str, list)) and isinstance(s2, (st... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Longest common subsequence (LCS) for str... |
cs_set | python | merge_sort.py | cs_set/merge_sort.py | """Merge sort for a list of integers.
Edge cases:
- Empty or single-element list returns copy.
- Non-integer elements are invalid and raise ValueError.
"""
from typing import List, Callable
def pre(arr: List[int]) -> bool:
return isinstance(arr, list) and all(isinstance(x, int) for x in arr)
def merge_sort(arr: ... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Merge sort for a list of integers.
Edge... |
cs_set | python | quick_sort.py | cs_set/quick_sort.py | """Quick sort for a list of integers.
Edge cases:
- Empty or single-element list returns copy.
- Non-integer elements are invalid and raise ValueError.
"""
from typing import List, Callable
def pre(arr: List[int]) -> bool:
return isinstance(arr, list) and all(isinstance(x, int) for x in arr)
def quick_sort(arr: ... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Quick sort for a list of integers.
Edge... |
cs_set | python | selection_sort.py | cs_set/selection_sort.py | """Selection sort for a list of integers.
Edge cases:
- Empty list returns empty list.
- Non-integer elements are invalid and raise ValueError.
"""
from typing import List, Callable
def pre(arr: List[int]) -> bool:
return isinstance(arr, list) and all(isinstance(x, int) for x in arr)
def selection_sort(arr: List... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Selection sort for a list of integers.
... |
easy_set | python | 10_MyEvenSumParity.py | easy_set/10_MyEvenSumParity.py | """Return the parity (0 or 1) of the sum of all elements in a list of even integers.
Edge cases:
- Sum of even numbers is always even (parity 0).
- Empty list sums to 0 (parity 0).
- The function raises ValueError if input contains non-even integers.
"""
from typing import List
def pre(xs: List[int]) -> bool:
""... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | You are a programmer who specializes in writing LEAN and Coq code.
Your task is to translate a Python program into a Lean 4 program.
You should translate the Python program into 4 blocks of code:
1. Docstring block: A docstring block at the top of the LEAN program that describes the function.
2. Function block: The f... | The translated Lean 4 code should be a faithful representation of the Python code.
It should be correct and compiles.
If a theorem keeps giving error, you can use := sorry to skip it.
Please wrap your lean code in ```lean and ```
Analyze and translate the Python file below:
"""Return the parity (0 or 1) of the sum of... |
End of preview. Expand in Data Studio
This dataset contains the Python version of Veribench dataset.
The full version will be available upon the release of the paper.
- Downloads last month
- 4