Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ValueError
Message:      Value is too big!
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1835, in _prepare_split_single
                  for key, table in generator:
                                    ^^^^^^^^^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 621, in wrapped
                  for item in generator(*args, **kwargs):
                              ~~~~~~~~~^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 281, in _generate_tables
                  examples = [ujson_loads(line) for line in batch.splitlines()]
                              ~~~~~~~~~~~^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/utils/json.py", line 20, in ujson_loads
                  return pd.io.json.ujson_loads(*args, **kwargs)
                         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
              ValueError: Value is too big!
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1379, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 956, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1702, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1887, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

problem_id
string
split
string
problem
dict
test_cases
list
spec
string
impl
string
lean
dict
meta
dict
01-matrix
train
{ "description": "Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell.\nThe distance between two cells sharing a common edge is 1.", "constraints": [ "m == mat.length", "n == mat[i].length", "1 <= m, n <= 10^4", "1 <= m * n <= 10^4", "mat[i][j] is either 0 or 1."...
[ { "kind": "valid", "input": { "mat": [ [ 0, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 0 ] ] }, "output": [ [ 0, 0, 0 ], [...
import Mathlib /-! # 01 Matrix Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell. The distance between two cells sharing a common edge is 1. ## Constraints - m == mat.length - n == mat[i].length - 1 <= m, n <= 10^4 - 1 <= m * n <= 10^4 - mat[i][j] is either 0 or 1. - There is at l...
import Mathlib /-! # 01 Matrix Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell. The distance between two cells sharing a common edge is 1. ## Constraints - m == mat.length - n == mat[i].length - 1 <= m, n <= 10^4 - 1 <= m * n <= 10^4 - mat[i][j] is either 0 or 1. - There is at l...
{ "statement": "import Mathlib\n\n/-!\n# 01 Matrix\n\nGiven an m x n binary matrix mat, return the distance of the nearest 0 for each cell.\nThe distance between two cells sharing a common edge is 1.\n\n## Constraints\n\n- m == mat.length\n- n == mat[i].length\n- 1 <= m, n <= 10^4\n- 1 <= m * n <= 10^4\n- mat[i][j] i...
{ "title": "01 Matrix", "difficulty": "medium", "leetcode_id": 542 }
1-bit-and-2-bit-characters
train
{ "description": "We have two special characters:\n\nThe first character can be represented by one bit 0.\nThe second character can be represented by two bits (10 or 11).\n\nGiven a binary array bits that ends with 0, return true if the last character must be a one-bit character.", "constraints": [ "1 <= bits.l...
[ { "kind": "valid", "input": { "bits": [ 1, 0, 0 ] }, "output": true, "rationale": null }, { "kind": "valid", "input": { "bits": [ 1, 1, 1, 0 ] }, "output": false, "rationale": null }, { ...
import Mathlib /-! # 1 Bit And 2 Bit Characters We have two special characters: The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). Given a binary array bits that ends with 0, return true if the last character must be a one-bit character. ## Constrai...
import Mathlib /-! # 1 Bit And 2 Bit Characters We have two special characters: The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). Given a binary array bits that ends with 0, return true if the last character must be a one-bit character. ## Constrai...
{ "statement": "import Mathlib\n\n/-!\n# 1 Bit And 2 Bit Characters\n\nWe have two special characters:\n\nThe first character can be represented by one bit 0.\nThe second character can be represented by two bits (10 or 11).\n\nGiven a binary array bits that ends with 0, return true if the last character must be a one...
{ "title": "1 Bit And 2 Bit Characters", "difficulty": "easy", "leetcode_id": 717 }
132-pattern
train
{ "description": "Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j].\nReturn true if there is a 132 pattern in nums, otherwise, return false.", "constraints": [ "n == nums.length", "1 <= n <= 2...
[ { "kind": "valid", "input": { "nums": [ 1, 2, 3, 4 ] }, "output": false, "rationale": null }, { "kind": "valid", "input": { "nums": [ 3, 1, 4, 2 ] }, "output": true, "rationale": null ...
import Mathlib /-! # 132 Pattern Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j]. Return true if there is a 132 pattern in nums, otherwise, return false. ## Constraints - n == nums.length - 1 <= n <=...
import Mathlib /-! # 132 Pattern Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j]. Return true if there is a 132 pattern in nums, otherwise, return false. ## Constraints - n == nums.length - 1 <= n <=...
{ "statement": "import Mathlib\n\n/-!\n# 132 Pattern\n\nGiven an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j].\nReturn true if there is a 132 pattern in nums, otherwise, return false.\n\n## Constraints\n\n- ...
{ "title": "132 Pattern", "difficulty": "medium", "leetcode_id": 456 }
2-keys-keyboard
train
{ "description": "There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step:\n\nCopy All: You can copy all the characters present on the screen (a partial copy is not allowed).\nPaste: You can paste the characters which are copied last time.\n\nGiv...
[ { "kind": "valid", "input": { "n": 3 }, "output": 3, "rationale": null }, { "kind": "valid", "input": { "n": 1 }, "output": 0, "rationale": null }, { "kind": "valid", "input": { "n": 5 }, "output": 5, "rationale": null }, { ...
import Mathlib /-! # 2 Keys Keyboard There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step: Copy All: You can copy all the characters present on the screen (a partial copy is not allowed). Paste: You can paste the characters which are copied l...
import Mathlib /-! # 2 Keys Keyboard There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step: Copy All: You can copy all the characters present on the screen (a partial copy is not allowed). Paste: You can paste the characters which are copied l...
{ "statement": "import Mathlib\n\n/-!\n# 2 Keys Keyboard\n\nThere is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step:\n\nCopy All: You can copy all the characters present on the screen (a partial copy is not allowed).\nPaste: You can paste the cha...
{ "title": "2 Keys Keyboard", "difficulty": "medium", "leetcode_id": 650 }
24-game
train
{"description":"You are given an integer array cards of length 4. You have four cards, each containi(...TRUNCATED)
[{"kind":"valid","input":{"cards":[4,1,8,7]},"output":true,"rationale":null},{"kind":"valid","input"(...TRUNCATED)
"import Mathlib\n\n/-!\n# 24 Game\n\nYou are given an integer array cards of length 4. You have four(...TRUNCATED)
"import Mathlib\n\n/-!\n# 24 Game\n\nYou are given an integer array cards of length 4. You have four(...TRUNCATED)
{"statement":"import Mathlib\n\n/-!\n# 24 Game\n\nYou are given an integer array cards of length 4. (...TRUNCATED)
{ "title": "24 Game", "difficulty": "hard", "leetcode_id": 679 }
3sum
train
{"description":"Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] suc(...TRUNCATED)
[{"kind":"valid","input":{"nums":[-1,0,1,2,-1,-4]},"output":[[-1,-1,2],[-1,0,1]],"rationale":null},{(...TRUNCATED)
"import Mathlib\n\n/-!\n# 3Sum\n\nGiven an integer array nums, return all the triplets [nums[i], num(...TRUNCATED)
"import Mathlib\n\n/-!\n# 3Sum\n\nGiven an integer array nums, return all the triplets [nums[i], num(...TRUNCATED)
{"statement":"import Mathlib\n\n/-!\n# 3Sum\n\nGiven an integer array nums, return all the triplets (...TRUNCATED)
{ "title": "3Sum", "difficulty": "medium", "leetcode_id": 15 }
3sum-closest
train
{"description":"Given an integer array nums of length n and an integer target, find three integers i(...TRUNCATED)
[{"kind":"valid","input":{"nums":[-1,2,1,-4],"target":1},"output":2,"rationale":null},{"kind":"valid(...TRUNCATED)
"import Mathlib\n\n/-!\n# 3Sum Closest\n\nGiven an integer array nums of length n and an integer tar(...TRUNCATED)
"import Mathlib\n\n/-!\n# 3Sum Closest\n\nGiven an integer array nums of length n and an integer tar(...TRUNCATED)
{"statement":"import Mathlib\n\n/-!\n# 3Sum Closest\n\nGiven an integer array nums of length n and a(...TRUNCATED)
{ "title": "3Sum Closest", "difficulty": "medium", "leetcode_id": 16 }
3sum-smaller
train
{"description":"Given an array of n integers nums and an integer target, find the number of index tr(...TRUNCATED)
[{"kind":"valid","input":{"nums":[-2,0,1,3],"target":2},"output":2,"rationale":null},{"kind":"valid"(...TRUNCATED)
"import Mathlib\n\n/-!\n# 3Sum Smaller\n\nGiven an array of n integers nums and an integer target, f(...TRUNCATED)
"import Mathlib\n\n/-!\n# 3Sum Smaller\n\nGiven an array of n integers nums and an integer target, f(...TRUNCATED)
{"statement":"import Mathlib\n\n/-!\n# 3Sum Smaller\n\nGiven an array of n integers nums and an inte(...TRUNCATED)
{ "title": "3Sum Smaller", "difficulty": "medium", "leetcode_id": 259 }
4-keys-keyboard
train
{"description":"Imagine you have a special keyboard with the following keys:\n\nA: Print one 'A' on (...TRUNCATED)
[{"kind":"valid","input":{"n":3},"output":3,"rationale":null},{"kind":"valid","input":{"n":2},"outpu(...TRUNCATED)
"import Mathlib\n\n/-!\n# 4 Keys Keyboard\n\nImagine you have a special keyboard with the following (...TRUNCATED)
"import Mathlib\n\n/-!\n# 4 Keys Keyboard\n\nImagine you have a special keyboard with the following (...TRUNCATED)
{"statement":"import Mathlib\n\n/-!\n# 4 Keys Keyboard\n\nImagine you have a special keyboard with t(...TRUNCATED)
{ "title": "4 Keys Keyboard", "difficulty": "medium", "leetcode_id": 651 }
4sum
train
{"description":"Given an array nums of n integers, return an array of all the unique quadruplets [nu(...TRUNCATED)
[{"kind":"valid","input":{"nums":[1,0,-1,0,-2,2],"target":0},"output":[[-2,-1,1,2],[-2,0,0,2],[-1,0,(...TRUNCATED)
"import Mathlib\n\n/-!\n# 4Sum\n\nGiven an array nums of n integers, return an array of all the uniq(...TRUNCATED)
"import Mathlib\n\n/-!\n# 4Sum\n\nGiven an array nums of n integers, return an array of all the uniq(...TRUNCATED)
{"statement":"import Mathlib\n\n/-!\n# 4Sum\n\nGiven an array nums of n integers, return an array of(...TRUNCATED)
{ "title": "4Sum", "difficulty": "medium", "leetcode_id": 18 }
End of preview.

AuXSpec

AuXSpec: Learning to Autoformalize Program Specifications via Executable Postconditions

Haocheng Wang1,2,*,†, Weixuan Yuan3,*, Florian Hübler2, Yinya Huang2, Zhijiang Guo1, Sorrachai Yingchareonthawornchai2, Rasmus Kyng3,‡

1 The Hong Kong University of Science and Technology (Guangzhou)   2 ETH Zurich   3 Department of Computer Science, ETH Zurich

* Equal contribution.   † Work done while visiting ETH Zurich.   ‡ Corresponding author.

Collection | License | Citation

1. Introduction

AuXSpec is a Lean framework that pairs each declarative postcondition with an executable postcondition, so that test cases evaluate a declarative specification by execution. This dataset releases the 3,037 LeetCode problems synthesized by the AuXSpec pipeline, each with a Lean 4 specification, a reference implementation and a proved postcondition equivalence theorem. The 300 problems of the test split form AuXSpec-Test, the in-domain benchmark of the paper, and also carry a proved correctness theorem for the reference implementation.

Each problem comes as one Lean file with these parts:

  • Precondition (V): isValidInput, a Boolean predicate that accepts exactly the inputs satisfying the stated constraints.
  • Postcondition (P_spec): <name>_spec, a declarative proposition that characterizes the correct output.
  • Executable postcondition (P_check): <name>_check, a Boolean function that decides the postcondition on valid inputs.
  • Equivalence theorem: <name>_check_iff_spec, which states that on valid inputs the executable postcondition is equivalent to the postcondition.
  • Implementation: a total algorithm, and the correctness theorem <impl>_correct, which states that on valid inputs the implementation satisfies the postcondition.
  • Unit tests: #guard lines that the Lean kernel evaluates, in four layers. L1 and L1b check that the precondition accepts the valid inputs and rejects the invalid ones, L2 and L2b check that the executable postcondition accepts the correct outputs and rejects the wrong ones, L3 checks the implementation on the valid inputs, and L4 checks that the executable postcondition accepts the outputs of the implementation.

2. Dataset Summary

Split Problems Easy / Medium / Hard Equivalence theorem proved Correctness theorem proved
train 2,737 642 / 1,433 / 662 2,737 –
test (AuXSpec-Test) 300 72 / 155 / 73 298 300
  • The problems were synthesized by the AuXSpec pipeline, in which every stage is admitted by the Lean compiler, the test cases and a set of LLM judges. The train problems are part of the SFT data of the AuXSpec models.
  • The test problems were held out from both SFT and RL. Every reference specification, implementation and test case was checked by hand against the problem statement.
  • For two test problems, closest-binary-search-tree-value and soup-servings, the hand check replaced Float by Rat in the specification, and the equivalence theorem of the revised statement is left as sorry.
  • Every file of every field compiles under Lean 4.32.0 with Mathlib. In lean.proved, #print axioms of each proved theorem lists no sorryAx.

3. Data Fields

Field Content
problem_id LeetCode problem slug
split train or test
problem The problem as given: description, constraints, examples and signature (parameter names and types)
test_cases The 9 test cases of the problem: 3 valid inputs with their outputs (valid), 3 invalid inputs (invalid_input) and 3 wrong outputs (wrong_output); each invalid input and wrong output carries the reason it was constructed (rationale)
spec The SpecGen answer: a complete Lean file with the precondition, the postcondition, the executable postcondition, the equivalence theorem left as sorry, and the guards of layers L1, L1b, L2 and L2b
impl The CodeGen answer: a complete Lean file with the specification definitions the implementation calls, the implementation and the guards of layer L3
lean.statement The full Lean file with both theorems left as sorry
lean.proved The same file with the proofs filled in, including the helper lemmas the proofs need
meta title, difficulty (easy, medium or hard) and leetcode_id

lean.statement and lean.proved differ only in the proofs, so a diff of the two shows exactly what the proofs add.

4. Usage

from datasets import load_dataset

ds = load_dataset("AI4TCS/AuXSpec")
row = ds["test"][0]
print(row["problem"]["description"])
print(row["lean"]["proved"])

Each Lean file begins with import Mathlib and compiles in a Lean 4.32.0 project with Mathlib, for example with lake env lean <file>.lean.

5. Limitations

  • The equivalence theorem relates the two postconditions to each other. Whether the postcondition is faithful to the natural-language problem rests on the test cases, the LLM judges and, for the test split, the hand check.
  • The correctness theorem is proved only for the test split.

6. License

This dataset is released under the Apache 2.0 License.

7. Citation

@misc{auxspec2026,
  title  = {AuXSpec: Learning to Autoformalize Program Specifications via Executable Postconditions},
  author = {Haocheng Wang and Weixuan Yuan and Florian H{\"u}bler and Yinya Huang and Zhijiang Guo and Sorrachai Yingchareonthawornchai and Rasmus Kyng},
  year   = {2026},
  note   = {Preprint}
}
Downloads last month
2