openai/math as Harbor environments: 355 validated tasks
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- LICENSE +201 -0
- LICENSE-openai-math +201 -0
- NOTICE +38 -0
- README.md +202 -0
- generator/README.md +160 -0
- generator/image/Dockerfile +8 -0
- generator/image/fetch_mathlib.sh +19 -0
- generator/image/lake-manifest.json +116 -0
- generator/image/lakefile.lean +12 -0
- generator/image/lean_setup.sh +126 -0
- generator/image/pack_submission.py +70 -0
- generator/openai_math_harbor/__init__.py +1 -0
- generator/openai_math_harbor/adapter.py +358 -0
- generator/openai_math_harbor/attacks.py +207 -0
- generator/openai_math_harbor/challenges.py +178 -0
- generator/openai_math_harbor/import_graph.py +54 -0
- generator/openai_math_harbor/oracle.py +47 -0
- generator/openai_math_harbor/package.py +36 -0
- generator/openai_math_harbor/reference.py +58 -0
- generator/openai_math_harbor/report.py +80 -0
- generator/openai_math_harbor/snapshot.py +55 -0
- generator/openai_math_harbor/templates/LICENSE +201 -0
- generator/openai_math_harbor/templates/LICENSE-openai-math +201 -0
- generator/openai_math_harbor/templates/NOTICE +38 -0
- generator/openai_math_harbor/templates/dataset_README.md +138 -0
- generator/openai_math_harbor/templates/instruction.md +52 -0
- generator/openai_math_harbor/templates/solution/solve.sh +20 -0
- generator/openai_math_harbor/templates/tests/grade.py +356 -0
- generator/openai_math_harbor/templates/tests/test.sh +3 -0
- generator/tests/test_grade_unpack.py +150 -0
- manifest.json +0 -0
- manifest.parquet +3 -0
- registry.json +1429 -0
- tasks/abhyankar-sathaye/environment/Dockerfile +8 -0
- tasks/abhyankar-sathaye/environment/fetch_mathlib.sh +19 -0
- tasks/abhyankar-sathaye/environment/lake-manifest.json +116 -0
- tasks/abhyankar-sathaye/environment/lakefile.lean +12 -0
- tasks/abhyankar-sathaye/environment/lean_setup.sh +126 -0
- tasks/abhyankar-sathaye/environment/pack_submission.py +70 -0
- tasks/abhyankar-sathaye/instruction.md +72 -0
- tasks/abhyankar-sathaye/solution/closure.txt +15 -0
- tasks/abhyankar-sathaye/solution/reference.py +58 -0
- tasks/abhyankar-sathaye/solution/solve.sh +20 -0
- tasks/abhyankar-sathaye/task.toml +49 -0
- tasks/abhyankar-sathaye/tests/Challenge.lean +21 -0
- tasks/abhyankar-sathaye/tests/grade.py +356 -0
- tasks/abhyankar-sathaye/tests/task.json +15 -0
- tasks/abhyankar-sathaye/tests/test.sh +3 -0
- tasks/affine-bernstein/environment/Dockerfile +8 -0
- tasks/affine-bernstein/environment/fetch_mathlib.sh +19 -0
LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
LICENSE-openai-math
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
NOTICE
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
openai-math-harbor
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
This dataset packages the Lean statements of OpenAI's "openai/math" release as Harbor tasks.
|
| 5 |
+
|
| 6 |
+
Redistributed material
|
| 7 |
+
----------------------
|
| 8 |
+
Each task's tests/Challenge.lean, and the Lean block quoted in its instruction.md, is the file
|
| 9 |
+
lean/ComparatorChallenges/<Name>.lean from https://github.com/openai/math at commit
|
| 10 |
+
adc7f1241b42e322a6451854ab7e4b4c146bf78a, copyright OpenAI, licensed under the Apache License, Version 2.0 (see
|
| 11 |
+
LICENSE-openai-math). The files are unchanged.
|
| 12 |
+
|
| 13 |
+
Modified material
|
| 14 |
+
-----------------
|
| 15 |
+
The Comparator configuration of each task (tests/task.json) is derived from the corresponding
|
| 16 |
+
lean/ComparatorChallenges/<Name>.json in that repository. In eight tasks, definitions that the
|
| 17 |
+
original listed under "definition_names" although their bodies are written out were removed from
|
| 18 |
+
that list, so that Comparator requires them to match exactly; task.toml records them under
|
| 19 |
+
[metadata] fixed_definitions.
|
| 20 |
+
|
| 21 |
+
Only statements whose official proof was verified in the environment are included; the README
|
| 22 |
+
lists the others and why each could not be validated. One challenge (DefocusingNLS) is left out
|
| 23 |
+
by design.
|
| 24 |
+
|
| 25 |
+
Not included
|
| 26 |
+
------------
|
| 27 |
+
OpenAI's proofs (the lean/OAI library) are not part of this dataset.
|
| 28 |
+
|
| 29 |
+
Everything else in this dataset (task.toml, instruction.md apart from the quoted statement,
|
| 30 |
+
tests/grade.py, tests/test.sh, environment/, solution/, generator/) is licensed under the
|
| 31 |
+
Apache License, Version 2.0 (see LICENSE).
|
| 32 |
+
|
| 33 |
+
Third-party software in the sandbox image
|
| 34 |
+
-----------------------------------------
|
| 35 |
+
Lean 4 and Mathlib (Apache-2.0); Comparator and lean4export by the Lean FRO (Apache-2.0),
|
| 36 |
+
Comparator built from leanprover/comparator@d03acab with a one-line patch that passes
|
| 37 |
+
LEAN_NUM_THREADS into its sandbox; landrun (MIT). The image is built from environment/ at run
|
| 38 |
+
time; none of this software is stored in the dataset.
|
README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- other
|
| 5 |
+
tags:
|
| 6 |
+
- harbor
|
| 7 |
+
- rl-environment
|
| 8 |
+
- reinforcement-learning
|
| 9 |
+
- code-agent
|
| 10 |
+
- lean4
|
| 11 |
+
- mathlib
|
| 12 |
+
- theorem-proving
|
| 13 |
+
- openai-math
|
| 14 |
+
pretty_name: "openai/math as Harbor environments"
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# openai/math as Harbor environments
|
| 18 |
+
|
| 19 |
+
> **Experimental.** Built on a research release that is itself new and not yet independently
|
| 20 |
+
> reviewed. Expect rough edges, and read any proof that scores 1 before relying on it.
|
| 21 |
+
|
| 22 |
+
We ported the math problems from OpenAI's [openai/math](https://github.com/openai/math) release
|
| 23 |
+
(commit `adc7f12`) into [Harbor](https://github.com/harbor-framework/harbor) environments.
|
| 24 |
+
The release formalizes **405** of its results as Lean statements. This dataset contains
|
| 25 |
+
**355 environments**, the ones whose official proof we verified end to end in the environment,
|
| 26 |
+
covering 209 result families across 17 fields. The other 50 are listed
|
| 27 |
+
under [Validation](#validation) with the reason each could not be validated.
|
| 28 |
+
|
| 29 |
+
## How a task works
|
| 30 |
+
|
| 31 |
+
The agent gets a sandbox with Lean 4 and a prebuilt Mathlib, no internet, and one of OpenAI's
|
| 32 |
+
theorems written in Lean with `sorry` where the proof should be.
|
| 33 |
+
|
| 34 |
+
**What `sorry` means.** In Lean, `sorry` is a placeholder for a missing proof: it lets the file
|
| 35 |
+
compile as if the step were proven, but nothing has actually been shown, and Lean flags it. The
|
| 36 |
+
statement is given exactly as OpenAI formalized it, and the agent's job is to replace every `sorry`
|
| 37 |
+
with a real proof.
|
| 38 |
+
|
| 39 |
+
When the agent finishes, a separate, fresh sandbox checks its proof with
|
| 40 |
+
[Comparator](https://github.com/leanprover/comparator), the Lean FRO's proof checker:
|
| 41 |
+
|
| 42 |
+
- **reward 1** if the theorem has exactly the original statement, the proof uses only Lean's
|
| 43 |
+
standard axioms (`propext`, `Quot.sound`, `Classical.choice`, so no leftover `sorry` and no new
|
| 44 |
+
axioms), and the Lean kernel accepts it;
|
| 45 |
+
- **reward 0** otherwise.
|
| 46 |
+
|
| 47 |
+
OpenAI's own proofs serve as the reference solutions: Harbor's oracle fetches them from GitHub at
|
| 48 |
+
run time. They are not included here and the agent never sees them.
|
| 49 |
+
|
| 50 |
+
## A strict reward
|
| 51 |
+
|
| 52 |
+
The grader only accepts a complete proof of the statement exactly as OpenAI formalized it. That
|
| 53 |
+
makes it hard to game, but it is also a real limitation for problems like these:
|
| 54 |
+
|
| 55 |
+
- a correct proof of an equivalent statement, written with different definitions or a different
|
| 56 |
+
formulation, scores 0;
|
| 57 |
+
- partial progress (useful lemmas, a proof of a special case, a correct strategy with a gap) scores 0;
|
| 58 |
+
- nothing rewards a creative approach unless it ends in a complete proof of this exact statement.
|
| 59 |
+
|
| 60 |
+
For open research problems, a more general reward function that recognizes any valid solution to the
|
| 61 |
+
underlying problem, including creative reformulations and partial progress, would be a better
|
| 62 |
+
training signal. We use the strict check here because it is precise and cannot be fooled; treat it
|
| 63 |
+
as one end of that design space.
|
| 64 |
+
|
| 65 |
+
## What's included
|
| 66 |
+
|
| 67 |
+
- `tasks/` — one Harbor task per validated problem: instruction, Lean statement, sandbox image recipe,
|
| 68 |
+
verifier and oracle
|
| 69 |
+
- `registry.json` — Harbor registry entry (`openai-math-harbor@1.0`)
|
| 70 |
+
- `manifest.parquet` — one row per task: field, family, theorem names, reference-proof size, oracle
|
| 71 |
+
result
|
| 72 |
+
- `generator/` — the code that builds the sandbox image and regenerates the tasks from openai/math
|
| 73 |
+
- `LICENSE`, `NOTICE`, `LICENSE-openai-math` — licensing and attribution
|
| 74 |
+
|
| 75 |
+
## Run it with the Harbor CLI
|
| 76 |
+
|
| 77 |
+
You need Harbor 0.24+ with the Daytona backend (`DAYTONA_API_KEY`, `DAYTONA_API_URL`) and
|
| 78 |
+
credentials for the agent you run.
|
| 79 |
+
|
| 80 |
+
```bash
|
| 81 |
+
pip install "harbor[daytona]>=0.24" daytona
|
| 82 |
+
hf download FineEnvs/openai-math-harbor --repo-type dataset --local-dir openai-math-harbor
|
| 83 |
+
cd openai-math-harbor
|
| 84 |
+
|
| 85 |
+
# Build the shared sandbox image once (Lean 4, Mathlib, Comparator; ~9 GB, about an hour).
|
| 86 |
+
(cd generator && python -m openai_math_harbor.snapshot)
|
| 87 |
+
SNAP=$(cd generator && python -m openai_math_harbor.snapshot --print-name)
|
| 88 |
+
|
| 89 |
+
# Run any agent Harbor supports (`harbor agent list`) on a few tasks:
|
| 90 |
+
harbor run -p tasks -e daytona --ek snapshot_template_name=$SNAP \
|
| 91 |
+
-a <agent> -m <model> -i plane-coloring -i hilbert-crouzeix -n 2
|
| 92 |
+
|
| 93 |
+
# Check that the grader accepts OpenAI's own proof of a task:
|
| 94 |
+
harbor run -p tasks -e daytona --ek snapshot_template_name=$SNAP \
|
| 95 |
+
-a oracle --allow-agent-host github.com -i plane-coloring
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Each task asks for 4 CPUs, 8 GB of memory and 10 GB of disk, and gives the agent 4 hours. Task
|
| 99 |
+
names are the folder names under `tasks/`.
|
| 100 |
+
|
| 101 |
+
## Validation
|
| 102 |
+
|
| 103 |
+
We generated a task for every statement except one left out by design (`DefocusingNLS`, whose
|
| 104 |
+
statement has a `sorry` inside a definition its theorems depend on), and ran Harbor's oracle on each:
|
| 105 |
+
it submits OpenAI's own proof and has it graded by the same verifier an agent faces. Only tasks whose
|
| 106 |
+
official proof was accepted are included.
|
| 107 |
+
|
| 108 |
+
| Oracle result | Tasks | Meaning |
|
| 109 |
+
|---|---|---|
|
| 110 |
+
| accepted | 355 | OpenAI's proof is accepted: the environment is verified end to end |
|
| 111 |
+
| missing-package | 16 | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 112 |
+
| definition-mismatch | 2 | OpenAI's proof writes a definition with the same text but it compiles differently, so the exact-match check fails |
|
| 113 |
+
| memory | 5 | OpenAI's proof needs more than the sandbox's 8 GB of memory to build |
|
| 114 |
+
| disk | 4 | OpenAI's proof is too large for the sandbox's 10 GB disk |
|
| 115 |
+
| not completed | 22 | grading did not complete in our run |
|
| 116 |
+
|
| 117 |
+
Grading an accepted proof took 16 minutes at the median. Each task's result is in its `task.toml` (`oracle_result`) and in `manifest.parquet`.
|
| 118 |
+
|
| 119 |
+
<details><summary>50 statements not included (click to expand)</summary>
|
| 120 |
+
|
| 121 |
+
| Statement | Why it could not be validated |
|
| 122 |
+
|---|---|
|
| 123 |
+
| `arnold-counterexample` | OpenAI's proof needs more than the sandbox's 8 GB of memory to build |
|
| 124 |
+
| `atomic-gaussian` | grading did not complete in our run |
|
| 125 |
+
| `catalan` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 126 |
+
| `coarse-assembly` | OpenAI's proof needs more than the sandbox's 8 GB of memory to build |
|
| 127 |
+
| `continuum-coulomb-hardness` | OpenAI's proof is too large for the sandbox's 10 GB disk |
|
| 128 |
+
| `cycle-clique-ramsey` | grading did not complete in our run |
|
| 129 |
+
| `defocusing-nls` | left out by design: OAI.DefocusingNLS.sobolevProduct: open definition the theorem statements depend on |
|
| 130 |
+
| `dirichlet-seven-eighths` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 131 |
+
| `duke-prime-degree` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 132 |
+
| `einstein-four` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 133 |
+
| `erdos-reciprocal` | OpenAI's proof is too large for the sandbox's 10 GB disk |
|
| 134 |
+
| `hecke-seven-eighths` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 135 |
+
| `invariant-ising` | grading did not complete in our run |
|
| 136 |
+
| `jacobsthal` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 137 |
+
| `jacobsthal-improved` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 138 |
+
| `joint-dickman` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 139 |
+
| `koebe-circle-domains` | OpenAI's proof is too large for the sandbox's 10 GB disk |
|
| 140 |
+
| `matrix-multiplication` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 141 |
+
| `mub-six` | grading did not complete in our run |
|
| 142 |
+
| `nuclear-ultrapower` | OpenAI's proof needs more than the sandbox's 8 GB of memory to build |
|
| 143 |
+
| `occupied-overlap` | OpenAI's proof writes a definition with the same text but it compiles differently, so the exact-match check fails |
|
| 144 |
+
| `ordinary-two-point-correlations` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 145 |
+
| `ostmann-complete` | grading did not complete in our run |
|
| 146 |
+
| `ostmann-primes` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 147 |
+
| `patterson-first-moment` | OpenAI's proof is too large for the sandbox's 10 GB disk |
|
| 148 |
+
| `planar-packing` | grading did not complete in our run |
|
| 149 |
+
| `polycyclic-recognition` | grading did not complete in our run |
|
| 150 |
+
| `quasi-riemann-hypothesis` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 151 |
+
| `ramsey-five` | grading did not complete in our run |
|
| 152 |
+
| `riesz-quantitative` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 153 |
+
| `sat-computability` | grading did not complete in our run |
|
| 154 |
+
| `sharp-log-ramsey` | grading did not complete in our run |
|
| 155 |
+
| `siegel-zeros` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 156 |
+
| `simple-amenable` | grading did not complete in our run |
|
| 157 |
+
| `simple-overgroups` | grading did not complete in our run |
|
| 158 |
+
| `sk-barriers` | grading did not complete in our run |
|
| 159 |
+
| `sk-high-temperature` | grading did not complete in our run |
|
| 160 |
+
| `sk-ratio` | grading did not complete in our run |
|
| 161 |
+
| `smooth-yau` | grading did not complete in our run |
|
| 162 |
+
| `snaky-certificate` | OpenAI's proof needs more than the sandbox's 8 GB of memory to build |
|
| 163 |
+
| `snaky-conditional` | grading did not complete in our run |
|
| 164 |
+
| `snaky-twenty-one` | grading did not complete in our run |
|
| 165 |
+
| `spin-angle` | OpenAI's proof writes a definition with the same text but it compiles differently, so the exact-match check fails |
|
| 166 |
+
| `standard-map-components` | grading did not complete in our run |
|
| 167 |
+
| `strong-kadison-kastler` | grading did not complete in our run |
|
| 168 |
+
| `surface-immersion` | grading did not complete in our run |
|
| 169 |
+
| `taming-compatibility` | grading did not complete in our run |
|
| 170 |
+
| `totient-asymptotic` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 171 |
+
| `totient-companion-zero` | OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include |
|
| 172 |
+
| `universal-tensor-squares` | OpenAI's proof needs more than the sandbox's 8 GB of memory to build |
|
| 173 |
+
|
| 174 |
+
</details>
|
| 175 |
+
|
| 176 |
+
The verifier was also tested against submissions that try to cheat (`sorry` in several disguises,
|
| 177 |
+
fake axioms, `native_decide`, weakened statements, redefined definitions, planted reward files, code
|
| 178 |
+
that runs during grading). All scored 0. A no-op agent scores 0.
|
| 179 |
+
|
| 180 |
+
## Notes
|
| 181 |
+
|
| 182 |
+
- **Configs.** In eight of openai/math's Comparator configs, definitions written out in the statement
|
| 183 |
+
were listed as "holes" that Comparator does not check, so a solution could redefine them. Here they
|
| 184 |
+
must match exactly; affected tasks list them under `fixed_definitions` in `task.toml`.
|
| 185 |
+
- **Contamination.** The statements and proofs have been public since 6 October 2026.
|
| 186 |
+
- **Difficulty.** These are open research problems; expect reward 0 on almost every task.
|
| 187 |
+
|
| 188 |
+
Technical details (grading design, threat model, image recipe) are in `generator/README.md`.
|
| 189 |
+
|
| 190 |
+
## License
|
| 191 |
+
|
| 192 |
+
- The Lean statements are copied unchanged from [openai/math](https://github.com/openai/math)
|
| 193 |
+
(© OpenAI), licensed under the
|
| 194 |
+
[Apache License 2.0](https://github.com/openai/math/blob/main/LICENSE); see `LICENSE-openai-math`
|
| 195 |
+
and `NOTICE`. OpenAI's proofs are not redistributed.
|
| 196 |
+
- The packaging, verifier and generator are Apache-2.0 (`LICENSE`).
|
| 197 |
+
- The sandbox image is built from [Lean 4](https://github.com/leanprover/lean4) and
|
| 198 |
+
[Mathlib](https://github.com/leanprover-community/mathlib4) (Apache-2.0),
|
| 199 |
+
[Comparator](https://github.com/leanprover/comparator) and
|
| 200 |
+
[lean4export](https://github.com/leanprover/lean4export) (Apache-2.0), and
|
| 201 |
+
[landrun](https://github.com/Zouuup/landrun) (MIT).
|
| 202 |
+
- If you use the results, cite the openai/math manuscripts as that repository asks.
|
generator/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generator and verifier: technical notes
|
| 2 |
+
|
| 3 |
+
This directory produces the Harbor tasks in `../tasks/` from a checkout of
|
| 4 |
+
[openai/math](https://github.com/openai/math), builds the sandbox image they run in, and contains
|
| 5 |
+
the verifier. The dataset card (`../README.md`) covers what the environment is and how to run it;
|
| 6 |
+
this file covers how the tasks are generated and graded, the threat model, and the checks behind
|
| 7 |
+
the validation.
|
| 8 |
+
|
| 9 |
+
## Layout
|
| 10 |
+
|
| 11 |
+
```
|
| 12 |
+
openai_math_harbor/
|
| 13 |
+
challenges.py reads the challenges, maps them to families, applies the hole policy
|
| 14 |
+
import_graph.py import graph of the openai/math Lean library (reference-proof closures)
|
| 15 |
+
oracle.py closure and packaging of the reference proofs
|
| 16 |
+
reference.py places a reference proof as a submission (copied into each task's solution/)
|
| 17 |
+
adapter.py writes tasks/, registry.json, manifest.parquet, the card and NOTICE
|
| 18 |
+
snapshot.py builds the shared Daytona snapshot from image/
|
| 19 |
+
report.py turns a Harbor oracle job into per-task verdicts
|
| 20 |
+
attacks.py adversarial submissions used to test the verifier
|
| 21 |
+
templates/ instruction, verifier (tests/grade.py, test.sh), oracle (solve.sh), card
|
| 22 |
+
image/ Dockerfile and setup scripts for the shared image (= every task's environment/)
|
| 23 |
+
tests/ unit tests for the verifier's submission handling
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
## Regenerating the tasks
|
| 27 |
+
|
| 28 |
+
```bash
|
| 29 |
+
# A sparse checkout of openai/math at the pinned commit:
|
| 30 |
+
git init openai-math && cd openai-math
|
| 31 |
+
git remote add origin https://github.com/openai/math.git
|
| 32 |
+
git sparse-checkout set --no-cone /lean/ComparatorChallenges/ /lean/docs/ /overview.tex /LICENSE
|
| 33 |
+
git fetch --depth 1 --filter=blob:none origin adc7f1241b42e322a6451854ab7e4b4c146bf78a && git checkout FETCH_HEAD
|
| 34 |
+
cd ..
|
| 35 |
+
|
| 36 |
+
# Optional: the import graph, for reference-proof sizes and the oracle's file lists. Needs the full
|
| 37 |
+
# lean/ directory (about 1.8 GB checked out).
|
| 38 |
+
python -m openai_math_harbor.import_graph openai-math/lean graph.json
|
| 39 |
+
|
| 40 |
+
python -m openai_math_harbor.adapter --openai-math openai-math --graph graph.json --out out/
|
| 41 |
+
# Stamp oracle verdicts into the tasks after an oracle run:
|
| 42 |
+
python -m openai_math_harbor.report <harbor job dir> oracle_results.json
|
| 43 |
+
python -m openai_math_harbor.adapter ... --oracle-results oracle_results.json
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Every challenge goes through the same code; no task is written by hand. Three things are decided
|
| 47 |
+
per challenge, all from the data:
|
| 48 |
+
|
| 49 |
+
| What | Count | Handling |
|
| 50 |
+
|---|---|---|
|
| 51 |
+
| Definition holes | 9 configs | Comparator checks only the name and type of a `definition_names` entry, never its body, so a solution could redefine `ProperColoring := False` and prove the theorem trivially. A hole whose body is written out is removed from the config, so it must match exactly (8 configs). A hole whose body is `sorry` stays open only if its name appears nowhere else in the file (`ElementaryPositivity`, whose type is the claim). `DefocusingNLS` has a `sorry` inside a definition the theorems use and is excluded. |
|
| 52 |
+
| Reference proofs needing other Lean libraries | 23 | PrimeNumberTheoremAnd, StrongPNT, RellichKondrachov and others. Every statement imports only Mathlib, so agents are unaffected; only those official proofs cannot be built in this image. |
|
| 53 |
+
| Grading time | all | 1 h plus 15 min per MB of the reference proof, at most 6 h. |
|
| 54 |
+
|
| 55 |
+
The 137 result families without Lean statements have no machine-checkable target and are not part
|
| 56 |
+
of the dataset.
|
| 57 |
+
|
| 58 |
+
## How a trial runs
|
| 59 |
+
|
| 60 |
+
```
|
| 61 |
+
agent sandbox (snapshot) verifier sandbox (same snapshot, fresh)
|
| 62 |
+
/workspace Lake project, Mathlib never runs agent code
|
| 63 |
+
agent writes Submission.lean /tests: Challenge.lean, task.json, grade.py
|
| 64 |
+
(+ Submission/**.lean) /logs/artifacts/submission.tar <- only input
|
| 65 |
+
no network while the agent runs 1. accept regular Submission*.lean files only
|
| 66 |
+
| 2. fresh Lake project, prebuilt read-only Mathlib
|
| 67 |
+
collect hook: pack_submission.py 3. iptables: grader uid gets no sockets
|
| 68 |
+
-> /logs/artifacts/submission.tar ----------> 4. Comparator as `grader`: landrun builds, statement
|
| 69 |
+
(one plain file crosses) + axiom check, kernel replay
|
| 70 |
+
5. kill grader processes, root writes reward.txt
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Harbor's `[verifier] environment_mode = "separate"` (0.24+) provides the second sandbox. Both
|
| 74 |
+
sandboxes start from one Daytona snapshot built from `image/Dockerfile`; every task carries the
|
| 75 |
+
identical `environment/`, so the image is built once. Harbor's own Daytona auto-snapshot gives up
|
| 76 |
+
after 10 minutes, which is less than the image build takes, hence `snapshot.py`.
|
| 77 |
+
|
| 78 |
+
## Threat model
|
| 79 |
+
|
| 80 |
+
| Attempt | What stops it | Test |
|
| 81 |
+
|---|---|---|
|
| 82 |
+
| `sorry`, `admit`, a tactic macro that expands to `sorry` | `sorryAx` is not a permitted axiom | `sorry`, `sorry-macro` |
|
| 83 |
+
| Declare `axiom cheat : False` | only `propext`, `Quot.sound`, `Classical.choice` allowed | `axiom` |
|
| 84 |
+
| `implemented_by` + `native_decide` to prove `False` | `native_decide` introduces an axiom of its own | `native-decide-false` |
|
| 85 |
+
| Same theorem name, weaker statement | the statement must equal the challenge's exactly | `weaken-statement` |
|
| 86 |
+
| Redefine a definition the statement uses | every constant in the statement must match; openai/math's loose hole configs are tightened | `redefine-definition` |
|
| 87 |
+
| Keep a structure's name and type but drop a proof obligation from its fields | Comparator also compares the structure's constructor, whose type lists the fields | `tamper-structure` |
|
| 88 |
+
| Re-export the trusted Challenge module | its theorems are `sorry` | `import-challenge` |
|
| 89 |
+
| Plant `reward.txt` or a fake `comparator` in the agent sandbox | grading runs in a separate fresh sandbox | `agent-side-reward` |
|
| 90 |
+
| Lean code run while the verifier builds the proof (`run_cmd`, `#eval`, macros) writes `reward.txt`, runs a shell or opens a connection | landrun (read-only file system except `.lake`, execution limited to Lean and git, TCP denied), unprivileged `grader` user, iptables owner rule; root writes the reward only after killing every grader process | `compile-time-reward` |
|
| 91 |
+
| Symlinks, path traversal, device files, hard links, huge archives | the collect hook packs only regular files; `grade.py` accepts only regular `Submission.lean` and `Submission/**.lean` whose path components are Lean identifiers | `symlink`, `tests/test_grade_unpack.py` |
|
| 92 |
+
| Read OpenAI's proof | not in the image; the agent phase has no network | network probe (below) |
|
| 93 |
+
| A background process in the agent sandbox interfering with grading | Harbor stops the agent sandbox before the verifier starts and empties the verifier's log directory first; on Daytona the two sandboxes share no files | by construction |
|
| 94 |
+
| A Lean kernel soundness bug | not covered (Comparator's second kernel, nanoda, is off) | none |
|
| 95 |
+
| Memorized public proofs | not covered | none |
|
| 96 |
+
|
| 97 |
+
Grading fails closed: a rejected or non-compiling submission scores 0. If the trusted side breaks
|
| 98 |
+
(the Challenge fails to build, or times out before the submission is reached, or the network block
|
| 99 |
+
cannot be installed), no reward is written and Harbor reports the trial as an error rather than 0.
|
| 100 |
+
|
| 101 |
+
**What each isolation layer was shown to do** on Daytona's kernel (Linux 6.17): under landrun, the
|
| 102 |
+
grader's build cannot write outside the build directory and gets `EACCES` on TCP connects. Without
|
| 103 |
+
landrun, the grader user *can* reach Daytona's in-sandbox control service on port 2280, so
|
| 104 |
+
`grade.py` also installs an iptables rule for that user before Comparator runs and refuses to grade
|
| 105 |
+
if the rule does not take effect.
|
| 106 |
+
|
| 107 |
+
**Trusted, not re-checked here:** the Lean kernel, Comparator's export parser and `lean4export` (a
|
| 108 |
+
crafted `.olean` written at build time is only accepted if the kernel replay accepts it), landrun,
|
| 109 |
+
and Daytona's sandbox boundary.
|
| 110 |
+
|
| 111 |
+
## Checks behind the validation
|
| 112 |
+
|
| 113 |
+
All through `harbor run` on Daytona with the separate verifier; none involves a language model.
|
| 114 |
+
|
| 115 |
+
| Check | Expected | Result |
|
| 116 |
+
|---|---|---|
|
| 117 |
+
| Oracle over every task (official proofs) | 1 where the proof fits the image | see the dataset card and each task's `oracle_result` |
|
| 118 |
+
| All 405 statements built in one sandbox (`lake build`, 3 threads) | compile | 405 of 405; median 5 s, 90th percentile 7 s, slowest 220 s |
|
| 119 |
+
| No-op agent | 0 | 0, "no submission" |
|
| 120 |
+
| 11 adversarial submissions (`attacks.py`) | 0 | 0 on all eleven, each rejected for the intended reason; the build-time probe printed `write denied`, and neither a shell nor git's HTTP helper could be executed |
|
| 121 |
+
| Agent-phase view (oracle agent printing its environment) | no network | DNS fails, HTTPS to github.com times out, a direct-IP connection is refused; `LEAN_NUM_THREADS=3` is set; `/tests` is absent |
|
| 122 |
+
| Oracle with `--allow-agent-host github.com` | 1 | 1 (positive control for the network check) |
|
| 123 |
+
| landrun and iptables in a Daytona sandbox | both enforce | as described above |
|
| 124 |
+
|
| 125 |
+
## The image
|
| 126 |
+
|
| 127 |
+
`image/lean_setup.sh` installs Lean v4.34.1 and Mathlib at the commits openai/math pins, builds
|
| 128 |
+
Comparator (`leanprover/comparator@d03acab`) and lean4export with the same toolchain, builds landrun,
|
| 129 |
+
copies every challenge statement to `/opt/openai-math/challenges/`, and prepares `/workspace`. Three
|
| 130 |
+
details matter:
|
| 131 |
+
|
| 132 |
+
- **Size.** Lean plus Mathlib is about 11 GB as installed, more than a 10 GB Daytona sandbox. The
|
| 133 |
+
script drops what importing Mathlib never reads: static libraries, LLVM and gcc (needed only to link
|
| 134 |
+
the executables built earlier in the script), and Mathlib's generated C and `.ilean` files,
|
| 135 |
+
truncated with their `.hash` files kept so Lake still treats Mathlib as built. A smoke test fails
|
| 136 |
+
the build if a second `lake build` still compiles any dependency.
|
| 137 |
+
- **Threads.** Lean sees every host CPU (64 on Daytona), not the sandbox's 4, so by default Lake
|
| 138 |
+
starts one Mathlib-loaded `lean` per module and runs out of memory. Agents get
|
| 139 |
+
`LEAN_NUM_THREADS=3` (`task.toml`); the verifier uses 2, which reaches Comparator's landrun
|
| 140 |
+
sandbox through a one-line `sed` patch to Comparator's `envPass` lists.
|
| 141 |
+
- **Permissions.** Mathlib's cache tool unpacks files as mode 0600. The script makes the toolchain
|
| 142 |
+
and packages world-readable (still root-owned), and a second smoke test builds as the `grader` user.
|
| 143 |
+
|
| 144 |
+
## Limits
|
| 145 |
+
|
| 146 |
+
- **Daytona's per-sandbox caps: 4 CPUs, 8 GB memory, 10 GB disk.** The 10 GB is working space on
|
| 147 |
+
top of the image. Compiled output of a large proof can exceed it: reference proofs up to about
|
| 148 |
+
1.8 MB of Lean source grade fine, while 3.5 MB and 4.8 MB ones ran out of disk. The oracle results
|
| 149 |
+
record which tasks are affected. Higher per-sandbox limits remove the constraint.
|
| 150 |
+
- **The agent sandbox contains Comparator,** since agent and verifier share one image. Nothing in it
|
| 151 |
+
is secret: the statement and the rules are public, and `lake build` plus `#print axioms` already
|
| 152 |
+
tell an agent whether a proof is complete.
|
| 153 |
+
- **Difficulty.** These are open research problems; expect a reward of 0 on almost every task.
|
| 154 |
+
|
| 155 |
+
## Licensing
|
| 156 |
+
|
| 157 |
+
The statements are redistributed unchanged from openai/math (OpenAI, Apache-2.0); the dataset root
|
| 158 |
+
carries `LICENSE-openai-math` and a `NOTICE` describing what was copied, what was adapted (the
|
| 159 |
+
Comparator configs) and what is not included (the proofs). The image bundles Lean, Mathlib,
|
| 160 |
+
Comparator and lean4export (Apache-2.0) and landrun (MIT). This code is under the Apache License 2.0.
|
generator/image/Dockerfile
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Shared by every openai/math task (agent and separate verifier). See lean_setup.sh.
|
| 2 |
+
FROM ubuntu:24.04
|
| 3 |
+
ENV ELAN_HOME=/opt/elan \
|
| 4 |
+
PATH=/opt/elan/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
| 5 |
+
LANG=C.UTF-8
|
| 6 |
+
COPY lean_setup.sh fetch_mathlib.sh lakefile.lean lake-manifest.json pack_submission.py /opt/build/
|
| 7 |
+
RUN bash /opt/build/lean_setup.sh
|
| 8 |
+
WORKDIR /workspace
|
generator/image/fetch_mathlib.sh
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Unpack Mathlib's prebuilt cache in batches and truncate the files that importing Mathlib never
|
| 3 |
+
# reads (generated C and .ilean editor indexes), keeping their .hash files so Lake still sees every
|
| 4 |
+
# module as built. Lean + full Mathlib otherwise needs ~11 GB, more than a 10 GB sandbox disk.
|
| 5 |
+
set -euo pipefail
|
| 6 |
+
cd /opt/lean-env
|
| 7 |
+
trim() {
|
| 8 |
+
find .lake/packages -path '*/.lake/build/*' \( -name '*.c' -o -name '*.ilean' \) -size +0 -exec truncate -s 0 {} +
|
| 9 |
+
rm -rf "${HOME:-/root}/.cache/mathlib"
|
| 10 |
+
}
|
| 11 |
+
for dir in .lake/packages/mathlib/Mathlib/*/; do
|
| 12 |
+
name=$(basename "$dir")
|
| 13 |
+
echo "== Mathlib/$name"
|
| 14 |
+
lake exe cache get ".lake/packages/mathlib/Mathlib/$name" >/dev/null
|
| 15 |
+
trim
|
| 16 |
+
df -h / | tail -1
|
| 17 |
+
done
|
| 18 |
+
lake exe cache get
|
| 19 |
+
trim
|
generator/image/lake-manifest.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "1.2.0",
|
| 3 |
+
"packagesDir": ".lake/packages",
|
| 4 |
+
"packages": [
|
| 5 |
+
{
|
| 6 |
+
"url": "https://github.com/leanprover-community/mathlib4.git",
|
| 7 |
+
"type": "git",
|
| 8 |
+
"subDir": null,
|
| 9 |
+
"scope": "",
|
| 10 |
+
"rev": "d13f23b723b8a846827a245b89c10fc7d3f11612",
|
| 11 |
+
"name": "mathlib",
|
| 12 |
+
"manifestFile": "lake-manifest.json",
|
| 13 |
+
"inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612",
|
| 14 |
+
"inherited": false,
|
| 15 |
+
"configFile": "lakefile.lean"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"url": "https://github.com/leanprover-community/plausible",
|
| 19 |
+
"type": "git",
|
| 20 |
+
"subDir": null,
|
| 21 |
+
"scope": "leanprover-community",
|
| 22 |
+
"rev": "118aa17ee84656b8bd727fef7c458ee8c833385c",
|
| 23 |
+
"name": "plausible",
|
| 24 |
+
"manifestFile": "lake-manifest.json",
|
| 25 |
+
"inputRev": "main",
|
| 26 |
+
"inherited": true,
|
| 27 |
+
"configFile": "lakefile.toml"
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"url": "https://github.com/leanprover-community/LeanSearchClient",
|
| 31 |
+
"type": "git",
|
| 32 |
+
"subDir": null,
|
| 33 |
+
"scope": "leanprover-community",
|
| 34 |
+
"rev": "ddf04cf3949fa556442341e87d47f9f6e6074707",
|
| 35 |
+
"name": "LeanSearchClient",
|
| 36 |
+
"manifestFile": "lake-manifest.json",
|
| 37 |
+
"inputRev": "main",
|
| 38 |
+
"inherited": true,
|
| 39 |
+
"configFile": "lakefile.toml"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"url": "https://github.com/leanprover-community/import-graph",
|
| 43 |
+
"type": "git",
|
| 44 |
+
"subDir": null,
|
| 45 |
+
"scope": "leanprover-community",
|
| 46 |
+
"rev": "e928b72544873815af278d38681b31c0293588e3",
|
| 47 |
+
"name": "importGraph",
|
| 48 |
+
"manifestFile": "lake-manifest.json",
|
| 49 |
+
"inputRev": "main",
|
| 50 |
+
"inherited": true,
|
| 51 |
+
"configFile": "lakefile.toml"
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"url": "https://github.com/leanprover-community/ProofWidgets4",
|
| 55 |
+
"type": "git",
|
| 56 |
+
"subDir": null,
|
| 57 |
+
"scope": "leanprover-community",
|
| 58 |
+
"rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5",
|
| 59 |
+
"name": "proofwidgets",
|
| 60 |
+
"manifestFile": "lake-manifest.json",
|
| 61 |
+
"inputRev": "main",
|
| 62 |
+
"inherited": true,
|
| 63 |
+
"configFile": "lakefile.lean"
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"url": "https://github.com/leanprover-community/aesop",
|
| 67 |
+
"type": "git",
|
| 68 |
+
"subDir": null,
|
| 69 |
+
"scope": "leanprover-community",
|
| 70 |
+
"rev": "355695d523e41d0554926416cba2a2b3544fbbc9",
|
| 71 |
+
"name": "aesop",
|
| 72 |
+
"manifestFile": "lake-manifest.json",
|
| 73 |
+
"inputRev": "master",
|
| 74 |
+
"inherited": true,
|
| 75 |
+
"configFile": "lakefile.toml"
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"url": "https://github.com/leanprover-community/quote4",
|
| 79 |
+
"type": "git",
|
| 80 |
+
"subDir": null,
|
| 81 |
+
"scope": "leanprover-community",
|
| 82 |
+
"rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259",
|
| 83 |
+
"name": "Qq",
|
| 84 |
+
"manifestFile": "lake-manifest.json",
|
| 85 |
+
"inputRev": "master",
|
| 86 |
+
"inherited": true,
|
| 87 |
+
"configFile": "lakefile.toml"
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"url": "https://github.com/leanprover-community/batteries",
|
| 91 |
+
"type": "git",
|
| 92 |
+
"subDir": null,
|
| 93 |
+
"scope": "leanprover-community",
|
| 94 |
+
"rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2",
|
| 95 |
+
"name": "batteries",
|
| 96 |
+
"manifestFile": "lake-manifest.json",
|
| 97 |
+
"inputRev": "main",
|
| 98 |
+
"inherited": true,
|
| 99 |
+
"configFile": "lakefile.toml"
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"url": "https://github.com/leanprover/lean4-cli",
|
| 103 |
+
"type": "git",
|
| 104 |
+
"subDir": null,
|
| 105 |
+
"scope": "leanprover",
|
| 106 |
+
"rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204",
|
| 107 |
+
"name": "Cli",
|
| 108 |
+
"manifestFile": "lake-manifest.json",
|
| 109 |
+
"inputRev": "v4.34.0",
|
| 110 |
+
"inherited": true,
|
| 111 |
+
"configFile": "lakefile.toml"
|
| 112 |
+
}
|
| 113 |
+
],
|
| 114 |
+
"name": "openai_math",
|
| 115 |
+
"lakeDir": ".lake"
|
| 116 |
+
}
|
generator/image/lakefile.lean
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Lake
|
| 2 |
+
open Lake DSL
|
| 3 |
+
|
| 4 |
+
-- Mathlib at the commit openai/math pins. Agents write `Submission.lean` and `Submission/**.lean`.
|
| 5 |
+
package openai_math where
|
| 6 |
+
leanOptions := #[⟨`autoImplicit, false⟩]
|
| 7 |
+
|
| 8 |
+
require mathlib from git
|
| 9 |
+
"https://github.com/leanprover-community/mathlib4.git" @ "d13f23b723b8a846827a245b89c10fc7d3f11612"
|
| 10 |
+
|
| 11 |
+
-- `Submission` and every `Submission.*` module it imports.
|
| 12 |
+
lean_lib Submission
|
generator/image/lean_setup.sh
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Builds the image shared by every openai/math task, for both the agent and the separate verifier:
|
| 3 |
+
# - Lean v4.34.1 and Mathlib d13f23b, the versions openai/math pins (Mathlib only, no OAI library)
|
| 4 |
+
# - Comparator, lean4export and landrun, used only by the verifier's grade.py
|
| 5 |
+
# - every challenge statement, at /opt/openai-math/challenges/<Name>.lean
|
| 6 |
+
# - /workspace, a Lake project where the agent writes Submission.lean
|
| 7 |
+
# All revisions are pinned. The openai/math library (the reference proofs) is never installed.
|
| 8 |
+
set -euxo pipefail
|
| 9 |
+
export DEBIAN_FRONTEND=noninteractive
|
| 10 |
+
|
| 11 |
+
LEAN_TOOLCHAIN=leanprover/lean4:v4.34.1
|
| 12 |
+
OPENAI_MATH_REV=adc7f1241b42e322a6451854ab7e4b4c146bf78a
|
| 13 |
+
COMPARATOR_REV=d03acab154d269c06e60e4de7e4cc85deebff94b # "bump toolchain to v4.34.0"; built with v4.34.1
|
| 14 |
+
LANDRUN_REV=811cfff51ceaf3d9843708aa6d22e9b84ccac8b4
|
| 15 |
+
GO_VERSION=1.24.7
|
| 16 |
+
|
| 17 |
+
apt-get update -qq
|
| 18 |
+
apt-get install -y -qq --no-install-recommends git curl ca-certificates build-essential xz-utils \
|
| 19 |
+
zstd python3 procps iproute2 iptables tmux >/dev/null
|
| 20 |
+
rm -rf /var/lib/apt/lists/*
|
| 21 |
+
git config --system --add safe.directory '*'
|
| 22 |
+
|
| 23 |
+
export ELAN_HOME=/opt/elan PATH=/opt/elan/bin:$PATH
|
| 24 |
+
curl -sSfL https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh \
|
| 25 |
+
| sh -s -- -y --default-toolchain "$LEAN_TOOLCHAIN" --no-modify-path
|
| 26 |
+
|
| 27 |
+
# --- Verifier tools, built before Mathlib so the build trees are gone before the big download ---
|
| 28 |
+
curl -sSfL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /tmp -xz
|
| 29 |
+
GOBIN=/usr/local/bin GOPATH=/tmp/gopath GOCACHE=/tmp/gocache \
|
| 30 |
+
/tmp/go/bin/go install "github.com/zouuup/landrun/cmd/landrun@${LANDRUN_REV}"
|
| 31 |
+
rm -rf /tmp/go /tmp/gopath /tmp/gocache
|
| 32 |
+
|
| 33 |
+
git clone -q https://github.com/leanprover/comparator.git /tmp/comparator
|
| 34 |
+
(
|
| 35 |
+
cd /tmp/comparator
|
| 36 |
+
git checkout -q "$COMPARATOR_REV"
|
| 37 |
+
# Comparator passes only PATH/HOME/LEAN_ABORT_ON_PANIC into its landrun sandbox. Also pass
|
| 38 |
+
# LEAN_NUM_THREADS: Lean sees every host CPU (64) rather than the sandbox's 4, so without it Lake
|
| 39 |
+
# starts one Mathlib-loaded `lean` per module and an 8 GB sandbox runs out of memory. It bounds
|
| 40 |
+
# parallelism only and does not affect what is checked.
|
| 41 |
+
sed -i 's/envPass := #\["PATH", "HOME", "LEAN_ABORT_ON_PANIC"\]/envPass := #["PATH", "HOME", "LEAN_ABORT_ON_PANIC", "LEAN_NUM_THREADS"]/; s/envPass := #\["PATH", "HOME", "LEAN_PATH", "LEAN_ABORT_ON_PANIC"\]/envPass := #["PATH", "HOME", "LEAN_PATH", "LEAN_ABORT_ON_PANIC", "LEAN_NUM_THREADS"]/' Main.lean
|
| 42 |
+
test "$(grep -c '"LEAN_NUM_THREADS"' Main.lean)" -eq 2
|
| 43 |
+
echo "$LEAN_TOOLCHAIN" > lean-toolchain
|
| 44 |
+
lake build lean4export comparator
|
| 45 |
+
install -m 0755 .lake/build/bin/comparator /usr/local/bin/comparator
|
| 46 |
+
install -m 0755 .lake/packages/lean4export/.lake/build/bin/lean4export /usr/local/bin/lean4export
|
| 47 |
+
)
|
| 48 |
+
rm -rf /tmp/comparator
|
| 49 |
+
|
| 50 |
+
# --- Lean project with Mathlib ---
|
| 51 |
+
# Packages are shallow clones at the manifest revisions, so Lake sees the right HEAD and never fetches.
|
| 52 |
+
mkdir -p /opt/lean-env/.lake/packages
|
| 53 |
+
cd /opt/lean-env
|
| 54 |
+
echo "$LEAN_TOOLCHAIN" > lean-toolchain
|
| 55 |
+
cp /opt/build/lakefile.lean /opt/build/lake-manifest.json .
|
| 56 |
+
python3 - <<'PY'
|
| 57 |
+
import json, subprocess
|
| 58 |
+
for p in json.load(open("lake-manifest.json"))["packages"]:
|
| 59 |
+
d = f".lake/packages/{p['name']}"
|
| 60 |
+
subprocess.run(["git", "init", "-q", d], check=True)
|
| 61 |
+
subprocess.run(["git", "-C", d, "remote", "add", "origin", p["url"]], check=True)
|
| 62 |
+
subprocess.run(["git", "-C", d, "fetch", "-q", "--depth", "1", "origin", p["rev"]], check=True)
|
| 63 |
+
subprocess.run(["git", "-C", d, "checkout", "-q", "FETCH_HEAD"], check=True)
|
| 64 |
+
PY
|
| 65 |
+
# Linking native executables (Comparator above, Mathlib's cache tool here) is the only use of the
|
| 66 |
+
# static libraries, LLVM and gcc; `lean` and `lake build` of a library need none of them. Dropping
|
| 67 |
+
# them before the Mathlib download keeps the build, and the image, under Daytona's 10 GB disk.
|
| 68 |
+
lake exe cache --help >/dev/null 2>&1 || true
|
| 69 |
+
find /opt/elan/toolchains/*/lib -name '*.a' -delete
|
| 70 |
+
rm -f /opt/elan/toolchains/*/lib/libLLVM* /opt/elan/toolchains/*/lib/libclang-cpp*
|
| 71 |
+
apt-get purge -y -qq $(dpkg-query -W -f '${binary:Package}\n' build-essential 'gcc-13*' 'g++-13*' \
|
| 72 |
+
'cpp-13*' 'libstdc++-13-dev*' 'libgcc-13-dev*' 2>/dev/null) >/dev/null || true
|
| 73 |
+
apt-get autoremove -y -qq >/dev/null || true
|
| 74 |
+
bash /opt/build/fetch_mathlib.sh
|
| 75 |
+
rm -f /opt/lean-env/.lake/packages/mathlib/.lake/build/bin/cache
|
| 76 |
+
|
| 77 |
+
# --- Challenge statements (public; the reference proofs are not fetched) ---
|
| 78 |
+
git init -q /tmp/oai && cd /tmp/oai
|
| 79 |
+
git remote add origin https://github.com/openai/math.git
|
| 80 |
+
git config core.sparseCheckout true
|
| 81 |
+
echo "lean/ComparatorChallenges/" > .git/info/sparse-checkout
|
| 82 |
+
git fetch -q --depth 1 --filter=blob:none origin "$OPENAI_MATH_REV"
|
| 83 |
+
git checkout -q FETCH_HEAD
|
| 84 |
+
mkdir -p /opt/openai-math/challenges
|
| 85 |
+
cp lean/ComparatorChallenges/*.lean /opt/openai-math/challenges/
|
| 86 |
+
cd / && rm -rf /tmp/oai
|
| 87 |
+
install -m 0755 /opt/build/pack_submission.py /opt/openai-math/pack_submission.py
|
| 88 |
+
|
| 89 |
+
# --- Agent workspace and the verifier's unprivileged user ---
|
| 90 |
+
mkdir -p /workspace/.lake
|
| 91 |
+
cp /opt/lean-env/lakefile.lean /opt/lean-env/lake-manifest.json /opt/lean-env/lean-toolchain /workspace/
|
| 92 |
+
ln -s /opt/lean-env/.lake/packages /workspace/.lake/packages
|
| 93 |
+
useradd --uid 2000 --create-home --shell /usr/sbin/nologin grader
|
| 94 |
+
mkdir -p /var/lib/oai-grade && chmod 0711 /var/lib/oai-grade
|
| 95 |
+
|
| 96 |
+
# Smoke test. The first build may rebuild a few dependency modules the cache lacks (they persist in
|
| 97 |
+
# the image); a second build must compile nothing but Submission, or agents would pay for it.
|
| 98 |
+
cd /workspace
|
| 99 |
+
printf 'import Mathlib\n\nexample : (2 : ℕ) + 2 = 4 := by norm_num\n' > Submission.lean
|
| 100 |
+
lake build Submission 2>&1 | grep -E 'Built|error' | grep -v 'Built Submission' | head -20 || true
|
| 101 |
+
echo '-- second build' >> Submission.lean
|
| 102 |
+
lake build Submission 2>&1 | tee /tmp/smoke.log
|
| 103 |
+
if grep 'Built' /tmp/smoke.log | grep -qv 'Built Submission'; then
|
| 104 |
+
echo "the prebuilt Mathlib is incomplete: a second build still compiled dependencies" >&2; exit 1
|
| 105 |
+
fi
|
| 106 |
+
rm -rf Submission.lean .lake/build /tmp/smoke.log
|
| 107 |
+
|
| 108 |
+
# Mathlib's cache tool unpacks files as 0600. The verifier builds as the unprivileged `grader` user,
|
| 109 |
+
# so everything must be world-readable (and stays root-owned, so not writable).
|
| 110 |
+
chmod -R a+rX /opt/elan /opt/lean-env /opt/openai-math
|
| 111 |
+
# Same smoke test as `grader`, in a scratch project like the one grade.py lays out.
|
| 112 |
+
smoke=$(mktemp -d /var/lib/oai-grade/smoke.XXXX)
|
| 113 |
+
cp /opt/lean-env/lakefile.lean /opt/lean-env/lake-manifest.json /opt/lean-env/lean-toolchain "$smoke/"
|
| 114 |
+
mkdir "$smoke/.lake" && ln -s /opt/lean-env/.lake/packages "$smoke/.lake/packages"
|
| 115 |
+
printf 'import Mathlib\n\nexample : (2 : ℕ) + 2 = 4 := by norm_num\n' > "$smoke/Submission.lean"
|
| 116 |
+
chmod 0755 "$smoke" && chown grader "$smoke/.lake"
|
| 117 |
+
(cd "$smoke" && runuser -u grader -- env -i PATH="$(echo /opt/elan/toolchains/*/bin):/usr/bin:/bin" HOME="$smoke" \
|
| 118 |
+
lake build Submission) 2>&1 | tee /tmp/smoke.log
|
| 119 |
+
if grep 'Built' /tmp/smoke.log | grep -qv 'Built Submission' || ! grep -q 'Build completed successfully' /tmp/smoke.log; then
|
| 120 |
+
echo "the grader user cannot build against the prebuilt Mathlib" >&2; exit 1
|
| 121 |
+
fi
|
| 122 |
+
rm -rf "$smoke" /tmp/smoke.log
|
| 123 |
+
|
| 124 |
+
rm -rf /opt/build /root/.cache
|
| 125 |
+
df -h / | tail -1
|
| 126 |
+
du -sh /opt/elan /opt/lean-env
|
generator/image/pack_submission.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Pack the agent's proof into one file for the verifier.
|
| 3 |
+
|
| 4 |
+
Harbor runs this as a [[verifier.collect]] hook in the agent's sandbox after the agent finishes.
|
| 5 |
+
It clears /logs/artifacts and writes /logs/artifacts/submission.tar holding only regular
|
| 6 |
+
`Submission.lean` and `Submission/**.lean` files. Symlinks and other entries are skipped, never
|
| 7 |
+
followed, so only one plain file crosses to the verifier sandbox.
|
| 8 |
+
|
| 9 |
+
The agent's sandbox is untrusted, so the verifier re-checks every entry of the archive. This step
|
| 10 |
+
only keeps the transfer small and free of links.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
from __future__ import annotations
|
| 14 |
+
|
| 15 |
+
import os
|
| 16 |
+
import shutil
|
| 17 |
+
import stat
|
| 18 |
+
import tarfile
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
|
| 21 |
+
WORKSPACE = Path("/workspace")
|
| 22 |
+
OUT_DIR = Path("/logs/artifacts")
|
| 23 |
+
MAX_TOTAL_BYTES = 768 << 20
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def clear(directory: Path) -> None:
|
| 27 |
+
directory.mkdir(parents=True, exist_ok=True)
|
| 28 |
+
for entry in directory.iterdir():
|
| 29 |
+
if entry.is_dir() and not entry.is_symlink():
|
| 30 |
+
shutil.rmtree(entry)
|
| 31 |
+
else:
|
| 32 |
+
entry.unlink()
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def regular(path: Path) -> bool:
|
| 36 |
+
try:
|
| 37 |
+
return stat.S_ISREG(path.lstat().st_mode)
|
| 38 |
+
except OSError:
|
| 39 |
+
return False
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def main() -> None:
|
| 43 |
+
clear(OUT_DIR)
|
| 44 |
+
tmp = OUT_DIR / "submission.tar.part"
|
| 45 |
+
total = 0
|
| 46 |
+
with tarfile.open(tmp, "w", format=tarfile.PAX_FORMAT) as tar:
|
| 47 |
+
root = WORKSPACE / "Submission.lean"
|
| 48 |
+
if regular(root):
|
| 49 |
+
total += root.lstat().st_size
|
| 50 |
+
if total > MAX_TOTAL_BYTES:
|
| 51 |
+
raise SystemExit("submission exceeds the size limit")
|
| 52 |
+
tar.add(root, arcname="Submission.lean", recursive=False)
|
| 53 |
+
tree = WORKSPACE / "Submission"
|
| 54 |
+
if tree.is_dir() and not tree.is_symlink():
|
| 55 |
+
for dirpath, dirnames, filenames in os.walk(tree, followlinks=False):
|
| 56 |
+
dirnames[:] = [d for d in dirnames if not (Path(dirpath) / d).is_symlink()]
|
| 57 |
+
for name in sorted(filenames):
|
| 58 |
+
path = Path(dirpath) / name
|
| 59 |
+
if not name.endswith(".lean") or not regular(path):
|
| 60 |
+
continue
|
| 61 |
+
total += path.lstat().st_size
|
| 62 |
+
if total > MAX_TOTAL_BYTES:
|
| 63 |
+
raise SystemExit("submission exceeds the size limit")
|
| 64 |
+
tar.add(path, arcname=str(path.relative_to(WORKSPACE)), recursive=False)
|
| 65 |
+
tmp.rename(OUT_DIR / "submission.tar")
|
| 66 |
+
print(f"packed {total} bytes")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
if __name__ == "__main__":
|
| 70 |
+
main()
|
generator/openai_math_harbor/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""Harbor adapter for the openai/math Lean challenges."""
|
generator/openai_math_harbor/adapter.py
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Generate Harbor tasks from openai/math's Comparator challenges.
|
| 2 |
+
|
| 3 |
+
One script covers every challenge: the statement, theorem names, axioms and definition holes all
|
| 4 |
+
come from the challenge's own files, so no task is written by hand. What varies per task is data
|
| 5 |
+
(see challenges.py for the hole policy that rewrites 8 configs and excludes 1).
|
| 6 |
+
|
| 7 |
+
python -m openai_math_harbor.adapter \\
|
| 8 |
+
--openai-math /path/to/openai-math # checkout with lean/ComparatorChallenges, lean/docs, overview.tex
|
| 9 |
+
--graph graph.json # import graph from import_graph.py (oracle closures)
|
| 10 |
+
--out datasets/openai-math
|
| 11 |
+
[--only TruffetCounterexample,PlaneColoring]
|
| 12 |
+
[--embed-reference] # bundle the reference proof into solution/ (needs lean/OAI)
|
| 13 |
+
|
| 14 |
+
Output layout (the FineEnvs Harbor dataset convention):
|
| 15 |
+
|
| 16 |
+
<out>/registry.json Harbor registry: openai-math-harbor@<version> -> tasks/*
|
| 17 |
+
<out>/README.md dataset card
|
| 18 |
+
<out>/NOTICE, LICENSE-openai-math attribution for the redistributed statements
|
| 19 |
+
<out>/manifest.json per-task metadata and the excluded challenges
|
| 20 |
+
<out>/tasks/<slug>/ one Harbor task per challenge
|
| 21 |
+
|
| 22 |
+
Every task gets the same environment/ directory, so Daytona builds one snapshot for all of them.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
from __future__ import annotations
|
| 26 |
+
|
| 27 |
+
import argparse
|
| 28 |
+
import json
|
| 29 |
+
import re
|
| 30 |
+
import shutil
|
| 31 |
+
from pathlib import Path
|
| 32 |
+
from string import Template
|
| 33 |
+
|
| 34 |
+
from .challenges import Challenge, load_challenges
|
| 35 |
+
from .oracle import bundle, closure, external_packages
|
| 36 |
+
|
| 37 |
+
PKG = Path(__file__).parent
|
| 38 |
+
IMAGE_DIR = PKG.parent / "image"
|
| 39 |
+
TEMPLATES = PKG / "templates"
|
| 40 |
+
SOURCE_COMMIT = "adc7f1241b42e322a6451854ab7e4b4c146bf78a"
|
| 41 |
+
DATASET_NAME = "openai-math-harbor"
|
| 42 |
+
DATASET_VERSION = "1.0"
|
| 43 |
+
IMAGE_FILES = ["Dockerfile", "lean_setup.sh", "fetch_mathlib.sh", "lakefile.lean", "lake-manifest.json", "pack_submission.py"]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def slug(name: str) -> str:
|
| 47 |
+
return re.sub(r"(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])", "-", name).lower()
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def toml_str(value: str) -> str:
|
| 51 |
+
return json.dumps(value, ensure_ascii=False)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def toml_list(values: list[str]) -> str:
|
| 55 |
+
return "[" + ", ".join(toml_str(v) for v in values) + "]"
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def grade_timeout(reference_bytes: int) -> int:
|
| 59 |
+
"""Seconds the verifier gets to build, export and kernel-replay a submission.
|
| 60 |
+
|
| 61 |
+
Most proofs grade in 5 to 30 minutes, but a short file can still be slow (a few heavy
|
| 62 |
+
`nlinarith` calls took over 45 minutes in one 246-line module), so the floor is generous.
|
| 63 |
+
The limit only costs time when a proof actually needs it.
|
| 64 |
+
"""
|
| 65 |
+
return int(min(6 * 3600, 3 * 3600 + 900 * reference_bytes / 1e6))
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def targets_sentence(c: Challenge) -> str:
|
| 69 |
+
names = [f"`{n}`" for n in c.theorem_names]
|
| 70 |
+
if not names:
|
| 71 |
+
return "The definition below"
|
| 72 |
+
return ("The theorem " if len(names) == 1 else "The theorems ") + ", ".join(names)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def holes_sentence(c: Challenge) -> str:
|
| 76 |
+
if not c.definition_holes:
|
| 77 |
+
return ""
|
| 78 |
+
names = ", ".join(f"`{n}`" for n in c.definition_holes)
|
| 79 |
+
return (f", and the body of {names}, which you must supply: its type states the claim, so any "
|
| 80 |
+
"value of that type proves it")
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def instruction(c: Challenge) -> str:
|
| 84 |
+
fam = c.family
|
| 85 |
+
return Template((TEMPLATES / "instruction.md").read_text()).substitute(
|
| 86 |
+
title=f"openai/math challenge `{c.name}` (family {fam.number})",
|
| 87 |
+
family_number=fam.number, family_title=fam.title, subject=fam.subject,
|
| 88 |
+
family_summary=fam.summary, challenge=c.name, lean=c.lean.rstrip(),
|
| 89 |
+
targets=targets_sentence(c), holes=holes_sentence(c),
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def task_toml(c: Challenge, ref: dict, agent_timeout: int, oracle: dict | None = None) -> str:
|
| 94 |
+
fam = c.family
|
| 95 |
+
verifier_timeout = ref["grade_timeout_sec"] + 900
|
| 96 |
+
oracle_lines = ""
|
| 97 |
+
if oracle:
|
| 98 |
+
oracle_lines = f'oracle_result = {toml_str(oracle["cause"])}\n'
|
| 99 |
+
if oracle.get("grade_seconds") is not None:
|
| 100 |
+
oracle_lines += f'oracle_grade_seconds = {oracle["grade_seconds"]}\n'
|
| 101 |
+
return f"""schema_version = "1.4"
|
| 102 |
+
|
| 103 |
+
[task]
|
| 104 |
+
name = "openai-math/{slug(c.name)}"
|
| 105 |
+
version = "1.0.0"
|
| 106 |
+
description = {toml_str(f"Prove {c.name} (openai/math family {fam.number}: {fam.title}) in Lean 4 with Mathlib; graded by Comparator in a separate sandbox.")}
|
| 107 |
+
keywords = ["lean4", "mathlib", "theorem-proving", "openai-math", {toml_str(fam.subject.lower().replace(" ", "-"))}]
|
| 108 |
+
|
| 109 |
+
[metadata]
|
| 110 |
+
source = "https://github.com/openai/math"
|
| 111 |
+
source_commit = "{SOURCE_COMMIT}"
|
| 112 |
+
source_license = "Apache-2.0"
|
| 113 |
+
source_notice = "tests/Challenge.lean is lean/ComparatorChallenges/{c.name}.lean from openai/math, (c) OpenAI, unchanged; see NOTICE at the dataset root"
|
| 114 |
+
challenge = {toml_str(c.name)}
|
| 115 |
+
family = {toml_str(fam.number)}
|
| 116 |
+
family_title = {toml_str(fam.title)}
|
| 117 |
+
subject = {toml_str(fam.subject)}
|
| 118 |
+
theorems = {toml_list(c.theorem_names)}
|
| 119 |
+
definition_holes = {toml_list(c.definition_holes)}
|
| 120 |
+
fixed_definitions = {toml_list(c.dropped_holes)}
|
| 121 |
+
reference_module = {toml_str(c.config["solution_module"])}
|
| 122 |
+
reference_modules = {ref["n_modules"]}
|
| 123 |
+
reference_lean_bytes = {ref["bytes"]}
|
| 124 |
+
reference_requires_packages = {toml_list(ref["packages"])}
|
| 125 |
+
{oracle_lines}difficulty = "research"
|
| 126 |
+
|
| 127 |
+
[agent]
|
| 128 |
+
timeout_sec = {agent_timeout}
|
| 129 |
+
network_mode = "no-network"
|
| 130 |
+
|
| 131 |
+
[environment]
|
| 132 |
+
build_timeout_sec = 5400
|
| 133 |
+
cpus = 4
|
| 134 |
+
memory_mb = 8192
|
| 135 |
+
storage_mb = 10240
|
| 136 |
+
workdir = "/workspace"
|
| 137 |
+
# Lean sees all host CPUs rather than the sandbox's 4; this bounds `lake build` to 3 parallel jobs.
|
| 138 |
+
env = {{ LEAN_NUM_THREADS = "3" }}
|
| 139 |
+
|
| 140 |
+
[verifier]
|
| 141 |
+
timeout_sec = {verifier_timeout}
|
| 142 |
+
environment_mode = "separate"
|
| 143 |
+
network_mode = "no-network"
|
| 144 |
+
|
| 145 |
+
[[verifier.collect]]
|
| 146 |
+
command = "python3 /opt/openai-math/pack_submission.py"
|
| 147 |
+
timeout_sec = 300
|
| 148 |
+
"""
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def write_task(c: Challenge, out: Path, graph: dict | None, lean_dir: Path | None,
|
| 152 |
+
embed_reference: bool, agent_timeout: int, oracle: dict | None = None) -> dict:
|
| 153 |
+
task_dir = out / "tasks" / slug(c.name)
|
| 154 |
+
if task_dir.exists():
|
| 155 |
+
shutil.rmtree(task_dir)
|
| 156 |
+
(task_dir / "environment").mkdir(parents=True)
|
| 157 |
+
(task_dir / "tests").mkdir()
|
| 158 |
+
(task_dir / "solution").mkdir()
|
| 159 |
+
|
| 160 |
+
for name in IMAGE_FILES:
|
| 161 |
+
shutil.copy(IMAGE_DIR / name, task_dir / "environment" / name)
|
| 162 |
+
|
| 163 |
+
solution_module = c.config["solution_module"]
|
| 164 |
+
modules = closure(graph, solution_module) if graph else []
|
| 165 |
+
ref = {
|
| 166 |
+
"n_modules": len(modules),
|
| 167 |
+
"bytes": sum(graph[m]["bytes"] for m in modules) if graph else 0,
|
| 168 |
+
"packages": external_packages(graph, modules) if graph else [],
|
| 169 |
+
}
|
| 170 |
+
ref["grade_timeout_sec"] = grade_timeout(ref["bytes"])
|
| 171 |
+
|
| 172 |
+
(task_dir / "instruction.md").write_text(instruction(c))
|
| 173 |
+
(task_dir / "task.toml").write_text(task_toml(c, ref, agent_timeout, oracle))
|
| 174 |
+
|
| 175 |
+
(task_dir / "tests" / "Challenge.lean").write_text(c.lean)
|
| 176 |
+
(task_dir / "tests" / "task.json").write_text(json.dumps({
|
| 177 |
+
"challenge": c.name,
|
| 178 |
+
"comparator": c.comparator,
|
| 179 |
+
"grade_timeout_sec": ref["grade_timeout_sec"],
|
| 180 |
+
}, indent=2))
|
| 181 |
+
for name in ("test.sh", "grade.py"):
|
| 182 |
+
shutil.copy(TEMPLATES / "tests" / name, task_dir / "tests" / name)
|
| 183 |
+
(task_dir / "tests" / "test.sh").chmod(0o755)
|
| 184 |
+
|
| 185 |
+
(task_dir / "solution" / "closure.txt").write_text("\n".join(modules) + "\n")
|
| 186 |
+
shutil.copy(PKG / "reference.py", task_dir / "solution" / "reference.py")
|
| 187 |
+
solve = Template((TEMPLATES / "solution" / "solve.sh").read_text()).substitute(
|
| 188 |
+
challenge=c.name, solution_module=solution_module, n_modules=len(modules),
|
| 189 |
+
source_commit=SOURCE_COMMIT,
|
| 190 |
+
)
|
| 191 |
+
(task_dir / "solution" / "solve.sh").write_text(solve)
|
| 192 |
+
(task_dir / "solution" / "solve.sh").chmod(0o755)
|
| 193 |
+
if embed_reference:
|
| 194 |
+
if not (lean_dir and (lean_dir / "OAI").is_dir()):
|
| 195 |
+
raise SystemExit("--embed-reference needs the openai/math checkout's lean/OAI directory")
|
| 196 |
+
(task_dir / "solution" / "reference.tar.gz").write_bytes(bundle(lean_dir, modules, solution_module))
|
| 197 |
+
return {
|
| 198 |
+
"task": slug(c.name), "challenge": c.name, "family": c.family.number,
|
| 199 |
+
"family_title": c.family.title, "subject": c.family.subject,
|
| 200 |
+
"theorems": c.theorem_names, "definition_holes": c.definition_holes,
|
| 201 |
+
"fixed_definitions": c.dropped_holes, **ref,
|
| 202 |
+
"oracle_result": (oracle or {}).get("cause"),
|
| 203 |
+
"oracle_grade_seconds": (oracle or {}).get("grade_seconds"),
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
ORACLE_MEANING = {
|
| 208 |
+
"accepted": "OpenAI's proof is accepted: the environment is verified end to end",
|
| 209 |
+
"missing-package": "OpenAI's proof uses a Lean library beyond Mathlib that the sandbox does not include",
|
| 210 |
+
"definition-mismatch": "OpenAI's proof writes a definition with the same text but it compiles differently, so the exact-match check fails",
|
| 211 |
+
"memory": "OpenAI's proof needs more than the sandbox's 8 GB of memory to build",
|
| 212 |
+
"disk": "OpenAI's proof is too large for the sandbox's 10 GB disk",
|
| 213 |
+
"timeout": "grading OpenAI's proof exceeded the time limit",
|
| 214 |
+
"rejected": "Comparator rejected OpenAI's proof",
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
def validation_block(written: list[dict]) -> str:
|
| 219 |
+
"""Markdown summary of the oracle run for the dataset card."""
|
| 220 |
+
results = [w for w in written if w.get("oracle_result")]
|
| 221 |
+
if not results:
|
| 222 |
+
return "The oracle has not been run on this build of the dataset."
|
| 223 |
+
counts: dict[str, list[str]] = {}
|
| 224 |
+
for w in results:
|
| 225 |
+
counts.setdefault(w["oracle_result"], []).append(w["task"])
|
| 226 |
+
order = [k for k in ORACLE_MEANING if k in counts] + sorted(k for k in counts if k not in ORACLE_MEANING)
|
| 227 |
+
rows = ["| Oracle result | Tasks | Meaning |", "|---|---|---|"]
|
| 228 |
+
for key in order:
|
| 229 |
+
rows.append(f"| {key} | {len(counts[key])} | {ORACLE_MEANING.get(key, 'grading did not complete')} |")
|
| 230 |
+
pending = [w["task"] for w in written if not w.get("oracle_result")]
|
| 231 |
+
if pending:
|
| 232 |
+
rows.append(f"| not completed | {len(pending)} | grading did not complete in our run |")
|
| 233 |
+
lines = ["\n".join(rows), ""]
|
| 234 |
+
secs = sorted(w["oracle_grade_seconds"] for w in results
|
| 235 |
+
if w["oracle_result"] == "accepted" and w.get("oracle_grade_seconds"))
|
| 236 |
+
if secs:
|
| 237 |
+
lines.append(f"Grading an accepted proof took {secs[len(secs) // 2] // 60} minutes at the median. "
|
| 238 |
+
"Each task's result is in its `task.toml` (`oracle_result`) and in `manifest.parquet`.")
|
| 239 |
+
unexplained = sorted(t for k in counts if k not in ORACLE_MEANING or k in ("rejected", "timeout") for t in counts[k])
|
| 240 |
+
if unexplained:
|
| 241 |
+
lines.append("Other: " + ", ".join(f"`{t}`" for t in unexplained) + ".")
|
| 242 |
+
return "\n".join(lines)
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
def write_parquet_manifest(out: Path, written: list[dict]) -> None:
|
| 246 |
+
"""manifest.parquet: one row per task, for filtering without walking tasks/."""
|
| 247 |
+
try:
|
| 248 |
+
import pyarrow as pa
|
| 249 |
+
import pyarrow.parquet as pq
|
| 250 |
+
except ModuleNotFoundError:
|
| 251 |
+
print("pyarrow not installed; skipping manifest.parquet")
|
| 252 |
+
return
|
| 253 |
+
columns = ["task", "challenge", "family", "family_title", "subject", "theorems", "definition_holes",
|
| 254 |
+
"fixed_definitions", "n_modules", "bytes", "packages", "grade_timeout_sec",
|
| 255 |
+
"oracle_result", "oracle_grade_seconds"]
|
| 256 |
+
rename = {"n_modules": "reference_modules", "bytes": "reference_lean_bytes",
|
| 257 |
+
"packages": "reference_requires_packages"}
|
| 258 |
+
table = pa.table({rename.get(c, c): [w.get(c) for w in written] for c in columns})
|
| 259 |
+
pq.write_table(table, out / "manifest.parquet")
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
def not_validated_block(not_validated: list[dict], excluded: list[dict]) -> str:
|
| 263 |
+
"""Markdown list of the statements that are not in the dataset, with the reason for each."""
|
| 264 |
+
rows = [*({"task": n["task"], "reason": ORACLE_MEANING.get(n["reason"], "grading did not complete in our run")} for n in not_validated),
|
| 265 |
+
*({"task": slug(e["challenge"]), "reason": "left out by design: " + e["reason"]} for e in excluded)]
|
| 266 |
+
if not rows:
|
| 267 |
+
return "None: every statement is included."
|
| 268 |
+
lines = ["<details><summary>" + f"{len(rows)} statements not included (click to expand)" + "</summary>", "",
|
| 269 |
+
"| Statement | Why it could not be validated |", "|---|---|"]
|
| 270 |
+
lines += [f"| `{r['task']}` | {r['reason']} |" for r in sorted(rows, key=lambda r: r["task"])]
|
| 271 |
+
lines += ["", "</details>"]
|
| 272 |
+
return "\n".join(lines)
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
def write_dataset_files(out: Path, included: list[Challenge], written: list[dict],
|
| 276 |
+
not_validated: list[dict] | None = None, excluded: list[dict] | None = None,
|
| 277 |
+
n_statements: int | None = None) -> None:
|
| 278 |
+
"""registry.json, the dataset card, NOTICE and the openai/math license copy."""
|
| 279 |
+
registry = [{
|
| 280 |
+
"name": DATASET_NAME,
|
| 281 |
+
"version": DATASET_VERSION,
|
| 282 |
+
"description": f"{len(written)} Lean 4 theorem-proving tasks from openai/math, graded by Comparator in a separate sandbox.",
|
| 283 |
+
"tasks": [{"name": w["task"], "path": f"tasks/{w['task']}"} for w in written],
|
| 284 |
+
}]
|
| 285 |
+
(out / "registry.json").write_text(json.dumps(registry, indent=2) + "\n")
|
| 286 |
+
families = {c.family.number for c in included}
|
| 287 |
+
subjects = sorted({c.family.subject for c in included})
|
| 288 |
+
counts = {s: sum(1 for c in included if c.family.subject == s) for s in subjects}
|
| 289 |
+
card = Template((TEMPLATES / "dataset_README.md").read_text()).substitute(
|
| 290 |
+
validation=validation_block(written + [{"task": n["task"], "oracle_result": n["reason"]}
|
| 291 |
+
for n in (not_validated or []) if n["reason"] != "pending"]
|
| 292 |
+
+ [{"task": n["task"]} for n in (not_validated or []) if n["reason"] == "pending"]),
|
| 293 |
+
not_validated=not_validated_block(not_validated or [], excluded or []),
|
| 294 |
+
n_statements=n_statements or len(written),
|
| 295 |
+
n_not_included=(n_statements or len(written)) - len(written),
|
| 296 |
+
n_tasks=len(written), n_families=len(families), n_subjects=len(subjects),
|
| 297 |
+
source_commit=SOURCE_COMMIT[:7],
|
| 298 |
+
subjects_line=", ".join(f"{s} ({counts[s]})" for s in sorted(subjects, key=lambda s: -counts[s])),
|
| 299 |
+
)
|
| 300 |
+
(out / "README.md").write_text(card)
|
| 301 |
+
write_parquet_manifest(out, written)
|
| 302 |
+
(out / "NOTICE").write_text(Template((TEMPLATES / "NOTICE").read_text()).substitute(source_commit=SOURCE_COMMIT))
|
| 303 |
+
shutil.copy(TEMPLATES / "LICENSE-openai-math", out / "LICENSE-openai-math")
|
| 304 |
+
shutil.copy(TEMPLATES / "LICENSE", out / "LICENSE")
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
def main() -> None:
|
| 308 |
+
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 309 |
+
ap.add_argument("--openai-math", type=Path, required=True)
|
| 310 |
+
ap.add_argument("--graph", type=Path)
|
| 311 |
+
ap.add_argument("--out", type=Path, required=True)
|
| 312 |
+
ap.add_argument("--only", help="comma-separated challenge names")
|
| 313 |
+
ap.add_argument("--embed-reference", action="store_true")
|
| 314 |
+
ap.add_argument("--agent-timeout", type=int, default=4 * 3600)
|
| 315 |
+
ap.add_argument("--oracle-results", type=Path,
|
| 316 |
+
help="oracle verdicts from `python -m openai_math_harbor.report`, stamped into each task")
|
| 317 |
+
ap.add_argument("--only-validated", action="store_true",
|
| 318 |
+
help="keep only tasks whose official proof the oracle verified; list the rest in the card")
|
| 319 |
+
args = ap.parse_args()
|
| 320 |
+
|
| 321 |
+
graph = json.loads(args.graph.read_text())["modules"] if args.graph else None
|
| 322 |
+
oracle = json.loads(args.oracle_results.read_text()) if args.oracle_results else {}
|
| 323 |
+
challenges = load_challenges(args.openai_math)
|
| 324 |
+
if args.only:
|
| 325 |
+
wanted = set(args.only.split(","))
|
| 326 |
+
challenges = [c for c in challenges if c.name in wanted]
|
| 327 |
+
missing = wanted - {c.name for c in challenges}
|
| 328 |
+
if missing:
|
| 329 |
+
raise SystemExit(f"unknown challenges: {sorted(missing)}")
|
| 330 |
+
|
| 331 |
+
args.out.mkdir(parents=True, exist_ok=True)
|
| 332 |
+
written, excluded, not_validated = [], [], []
|
| 333 |
+
for c in challenges:
|
| 334 |
+
if c.excluded:
|
| 335 |
+
excluded.append({"challenge": c.name, "reason": c.excluded})
|
| 336 |
+
continue
|
| 337 |
+
entry = write_task(c, args.out, graph, args.openai_math / "lean", args.embed_reference,
|
| 338 |
+
args.agent_timeout, oracle.get(slug(c.name)))
|
| 339 |
+
if args.only_validated and entry["oracle_result"] != "accepted":
|
| 340 |
+
shutil.rmtree(args.out / "tasks" / entry["task"])
|
| 341 |
+
not_validated.append({"task": entry["task"], "challenge": c.name, "family": c.family.number,
|
| 342 |
+
"reason": entry["oracle_result"] or "pending"})
|
| 343 |
+
continue
|
| 344 |
+
written.append(entry)
|
| 345 |
+
(args.out / "manifest.json").write_text(json.dumps({
|
| 346 |
+
"source": "https://github.com/openai/math", "source_commit": SOURCE_COMMIT,
|
| 347 |
+
"tasks": written, "excluded": excluded, "not_validated": not_validated,
|
| 348 |
+
}, indent=2))
|
| 349 |
+
kept = {w["task"] for w in written}
|
| 350 |
+
write_dataset_files(args.out, [c for c in challenges if slug(c.name) in kept], written,
|
| 351 |
+
not_validated=not_validated, excluded=excluded, n_statements=len(challenges))
|
| 352 |
+
print(f"wrote {len(written)} tasks to {args.out / 'tasks'}; excluded {len(excluded)}")
|
| 353 |
+
for e in excluded:
|
| 354 |
+
print(f" excluded {e['challenge']}: {e['reason']}")
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
if __name__ == "__main__":
|
| 358 |
+
main()
|
generator/openai_math_harbor/attacks.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Reward-hacking probes: copies of a generated task whose oracle submits a cheat.
|
| 2 |
+
|
| 3 |
+
Each probe keeps the task's environment, tests and config unchanged and replaces solution/solve.sh
|
| 4 |
+
with a script that writes an invalid submission (or tampers with the agent sandbox). Run them with
|
| 5 |
+
Harbor's oracle agent; every probe must score 0.
|
| 6 |
+
|
| 7 |
+
python -m openai_math_harbor.attacks --dataset datasets/openai-math-harbor/tasks --out datasets/attacks
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import argparse
|
| 13 |
+
import json
|
| 14 |
+
import re
|
| 15 |
+
import shutil
|
| 16 |
+
from pathlib import Path
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def _challenge(task_dir: Path) -> str:
|
| 20 |
+
return (task_dir / "tests" / "Challenge.lean").read_text()
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def _replace_sorry(lean: str, term: str, tactic: str | None = None) -> str:
|
| 24 |
+
"""Replace each `sorry`: tactic-mode ones with ``tactic`` (default `exact term`), others with ``term``."""
|
| 25 |
+
lean = re.sub(r"\bby(\s+)sorry\b", lambda m: f"by{m.group(1)}{tactic or f'exact ({term})'}", lean)
|
| 26 |
+
return re.sub(r"\bsorry\b", f"({term})", lean)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def _first_theorem(task_dir: Path) -> str:
|
| 30 |
+
return json.loads((task_dir / "tests" / "task.json").read_text())["comparator"]["theorem_names"][0]
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def _write(path: str, content: str) -> str:
|
| 34 |
+
return f"mkdir -p \"$(dirname {path})\"\ncat > {path} <<'LEAN_EOF'\n{content}\nLEAN_EOF\n"
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# Each attack: (name, description, function(task_dir) -> bash body run in the agent sandbox).
|
| 38 |
+
def attack_sorry(t: Path) -> str:
|
| 39 |
+
return _write("/workspace/Submission.lean", _challenge(t))
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def attack_axiom(t: Path) -> str:
|
| 43 |
+
lean = _challenge(t).replace("import Mathlib\n", "import Mathlib\n\naxiom openai_math_cheat : False\n", 1)
|
| 44 |
+
return _write("/workspace/Submission.lean", _replace_sorry(lean, "openai_math_cheat.elim"))
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def attack_sorry_macro(t: Path) -> str:
|
| 48 |
+
lean = _replace_sorry(_challenge(t), "by trust_me", tactic="trust_me")
|
| 49 |
+
lean = lean.replace(
|
| 50 |
+
"import Mathlib\n", "import Mathlib\n\nmacro \"trust_me\" : tactic => `(tactic| sorry)\n", 1)
|
| 51 |
+
return _write("/workspace/Submission.lean", lean)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def attack_native_decide_false(t: Path) -> str:
|
| 55 |
+
# implemented_by makes compiled code disagree with the kernel, so native_decide proves False.
|
| 56 |
+
# The file elaborates with no errors and no sorry warning; only the axiom check catches it.
|
| 57 |
+
prelude = """
|
| 58 |
+
def openaiMathTrue : Bool := true
|
| 59 |
+
@[implemented_by openaiMathTrue] def openaiMathFake : Bool := false
|
| 60 |
+
theorem openaiMathFake_eq : openaiMathFake = true := by native_decide
|
| 61 |
+
theorem openaiMathBoom : False := by
|
| 62 |
+
have h := openaiMathFake_eq
|
| 63 |
+
simp [openaiMathFake] at h
|
| 64 |
+
"""
|
| 65 |
+
lean = _challenge(t).replace("import Mathlib\n", "import Mathlib\n" + prelude, 1)
|
| 66 |
+
return _write("/workspace/Submission.lean", _replace_sorry(lean, "openaiMathBoom.elim"))
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def attack_weaken_statement(t: Path) -> str:
|
| 70 |
+
# Keep the theorem's name, change its statement to `True`.
|
| 71 |
+
name = _first_theorem(t).split(".")[-1]
|
| 72 |
+
lean = _challenge(t)
|
| 73 |
+
lean = re.sub(r"(?ms)^(\s*theorem\s+" + re.escape(name) + r"\b).*?:=\s*by\s*\n\s*sorry",
|
| 74 |
+
r"\1 : True := by\n trivial", lean, count=1)
|
| 75 |
+
lean = re.sub(r"(?ms)^(\s*theorem\s+" + re.escape(name) + r"\b).*?:=\s*by\s+sorry",
|
| 76 |
+
r"\1 : True := by trivial", lean, count=1)
|
| 77 |
+
return _write("/workspace/Submission.lean", lean)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def attack_import_challenge(t: Path) -> str:
|
| 81 |
+
# The verifier's project also contains the trusted Challenge module; re-export its sorry'd theorem.
|
| 82 |
+
return _write("/workspace/Submission.lean", "import Challenge\n")
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def attack_compile_time_reward(t: Path) -> str:
|
| 86 |
+
# Lean code that runs while the verifier builds the submission tries to plant a reward, to run a
|
| 87 |
+
# shell, and to open a TCP connection to the sandbox's control daemon (via git, one of the few
|
| 88 |
+
# binaries Comparator lets the build execute). All must fail: landrun (read-only file system
|
| 89 |
+
# except .lake, exec limited, TCP denied), the unprivileged grader user, and iptables.
|
| 90 |
+
probe = """
|
| 91 |
+
def openaiMathProbeWrite : IO String := do
|
| 92 |
+
try
|
| 93 |
+
IO.FS.writeFile "/logs/verifier/reward.txt" "1\\n"
|
| 94 |
+
pure "WROTE reward.txt"
|
| 95 |
+
catch e => pure s!"write denied ({e})"
|
| 96 |
+
|
| 97 |
+
def openaiMathProbeRun (cmd : String) (args : Array String) : IO String := do
|
| 98 |
+
try
|
| 99 |
+
let out ← IO.Process.output { cmd := cmd, args := args }
|
| 100 |
+
pure s!"exit {out.exitCode}: {out.stdout.trim} {out.stderr.trim}"
|
| 101 |
+
catch e => pure s!"spawn denied ({e})"
|
| 102 |
+
|
| 103 |
+
#eval show IO Unit from do
|
| 104 |
+
IO.println s!"PROBE write: {← openaiMathProbeWrite}"
|
| 105 |
+
IO.println s!"PROBE bash: {← openaiMathProbeRun "bash" #["-c", "id"]}"
|
| 106 |
+
IO.println s!"PROBE tcp: {← openaiMathProbeRun "git" #["ls-remote", "http://127.0.0.1:2280/probe"]}"
|
| 107 |
+
"""
|
| 108 |
+
lean = _challenge(t).replace("import Mathlib\n", "import Mathlib\n" + probe, 1)
|
| 109 |
+
return _write("/workspace/Submission.lean", lean)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def attack_agent_side_reward(t: Path) -> str:
|
| 113 |
+
# Plant rewards and fake comparator output in the agent sandbox; the verifier runs elsewhere.
|
| 114 |
+
return (
|
| 115 |
+
"mkdir -p /logs/verifier /logs/artifacts\n"
|
| 116 |
+
"echo 1 > /logs/verifier/reward.txt\n"
|
| 117 |
+
"echo '{\"reward\": 1}' > /logs/verifier/reward.json\n"
|
| 118 |
+
"printf '#!/bin/sh\\necho Your solution is okay!\\n' > /usr/local/bin/comparator\n"
|
| 119 |
+
+ _write("/workspace/Submission.lean", _challenge(t))
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
def attack_symlink(t: Path) -> str:
|
| 124 |
+
# Submission.lean is a symlink to the challenge; Submission/ links to /. The packer skips links.
|
| 125 |
+
return (
|
| 126 |
+
"ln -sf /opt/openai-math/challenges/$(python3 -c \"import json;print(json.load(open('/tests/task.json'))['challenge'])\" 2>/dev/null || echo X).lean /workspace/Submission.lean 2>/dev/null || ln -sf /etc/hostname /workspace/Submission.lean\n"
|
| 127 |
+
"ln -sfn / /workspace/Submission\n"
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def attack_redefine_definition(t: Path) -> str:
|
| 132 |
+
# EuclideanFiveColor: openai/math lists ProperColoring as a definition hole, so Comparator with the
|
| 133 |
+
# original config only checks its type. Redefining it as False makes the theorem trivial.
|
| 134 |
+
lean = _challenge(t)
|
| 135 |
+
lean, n = re.subn(
|
| 136 |
+
r"(def ProperColoring \(colorCount : ℕ\) \(coloring : ℂ → Fin colorCount\) : Prop :=)\n.*\n",
|
| 137 |
+
r"\1\n False\n", lean, count=1)
|
| 138 |
+
if n != 1:
|
| 139 |
+
raise SystemExit("redefine-definition targets EuclideanFiveColor's ProperColoring")
|
| 140 |
+
lean = _replace_sorry(lean, "fun ⟨_, h⟩ => h")
|
| 141 |
+
return _write("/workspace/Submission.lean", lean)
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def attack_tamper_structure(t: Path) -> str:
|
| 145 |
+
# ElementaryPositivity: the open hole's type is the structure PermutationWitness, whose
|
| 146 |
+
# `expansion` field carries the claim. Keep the structure's name, parameters and type, but
|
| 147 |
+
# replace its fields with trivial ones, then fill the hole trivially. Comparator compares the
|
| 148 |
+
# structure's constructor too, so this must be rejected.
|
| 149 |
+
lean = _challenge(t)
|
| 150 |
+
lean, n = re.subn(
|
| 151 |
+
r"structure PermutationWitness where\n.*?(?=\n\nend NaturalUnitIntervalGraph)",
|
| 152 |
+
"structure PermutationWitness where\n"
|
| 153 |
+
" theta : {σ : Equiv.Perm (Fin n) // G.Nondescent σ} → Unit\n"
|
| 154 |
+
" expansion : True",
|
| 155 |
+
lean, count=1, flags=re.S)
|
| 156 |
+
if n != 1:
|
| 157 |
+
raise SystemExit("tamper-structure targets ElementaryPositivity's PermutationWitness")
|
| 158 |
+
lean = _replace_sorry(lean, "⟨fun _ => (), trivial⟩")
|
| 159 |
+
return _write("/workspace/Submission.lean", lean)
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
ATTACKS = {
|
| 163 |
+
"tamper-structure": (attack_tamper_structure, "keep a structure's name and type, drop the proof obligation from its fields"),
|
| 164 |
+
"redefine-definition": (attack_redefine_definition, "redefine a definition the statement uses (ProperColoring := False)"),
|
| 165 |
+
"sorry": (attack_sorry, "submit the challenge unchanged (every proof is sorry)"),
|
| 166 |
+
"axiom": (attack_axiom, "declare `axiom cheat : False` and use it"),
|
| 167 |
+
"sorry-macro": (attack_sorry_macro, "hide sorry behind a custom tactic macro"),
|
| 168 |
+
"native-decide-false": (attack_native_decide_false, "prove False via implemented_by + native_decide"),
|
| 169 |
+
"weaken-statement": (attack_weaken_statement, "same theorem name, statement changed to True"),
|
| 170 |
+
"import-challenge": (attack_import_challenge, "import the trusted Challenge module and re-export it"),
|
| 171 |
+
"compile-time-reward": (attack_compile_time_reward, "Lean code run at build time plants reward.txt and dials the daemon"),
|
| 172 |
+
"agent-side-reward": (attack_agent_side_reward, "plant reward files and a fake comparator in the agent sandbox"),
|
| 173 |
+
"symlink": (attack_symlink, "submit symlinks instead of files"),
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def make_probe(task_dir: Path, out_dir: Path, name: str) -> Path:
|
| 178 |
+
fn, desc = ATTACKS[name]
|
| 179 |
+
dest = out_dir / f"{task_dir.name}--{name}"
|
| 180 |
+
if dest.exists():
|
| 181 |
+
shutil.rmtree(dest)
|
| 182 |
+
shutil.copytree(task_dir, dest)
|
| 183 |
+
toml = (dest / "task.toml").read_text()
|
| 184 |
+
toml = re.sub(r'(?m)^name = "openai-math/(.*)"$', rf'name = "openai-math-attacks/\1--{name}"', toml, count=1)
|
| 185 |
+
(dest / "task.toml").write_text(toml)
|
| 186 |
+
for extra in ("reference.tar.gz",):
|
| 187 |
+
(dest / "solution" / extra).unlink(missing_ok=True)
|
| 188 |
+
solve = dest / "solution" / "solve.sh"
|
| 189 |
+
solve.write_text(f"#!/usr/bin/env bash\n# Attack probe: {desc}. Must score 0.\nset -u\n{fn(task_dir)}\necho 'attack {name} placed'\n")
|
| 190 |
+
solve.chmod(0o755)
|
| 191 |
+
return dest
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def main() -> None:
|
| 195 |
+
ap = argparse.ArgumentParser(description=__doc__)
|
| 196 |
+
ap.add_argument("--dataset", type=Path, required=True)
|
| 197 |
+
ap.add_argument("--out", type=Path, required=True)
|
| 198 |
+
ap.add_argument("--task", default="truffet-counterexample")
|
| 199 |
+
ap.add_argument("--attacks", default=",".join(ATTACKS))
|
| 200 |
+
args = ap.parse_args()
|
| 201 |
+
args.out.mkdir(parents=True, exist_ok=True)
|
| 202 |
+
for name in args.attacks.split(","):
|
| 203 |
+
print(make_probe(args.dataset / args.task, args.out, name))
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
if __name__ == "__main__":
|
| 207 |
+
main()
|
generator/openai_math_harbor/challenges.py
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Read openai/math's Comparator challenges and decide how each one is graded.
|
| 2 |
+
|
| 3 |
+
Each challenge is ``lean/ComparatorChallenges/<Name>.lean`` (the statement, with ``sorry``) plus
|
| 4 |
+
``<Name>.json`` (Comparator's config). Two things are added here:
|
| 5 |
+
|
| 6 |
+
* the family it belongs to (number, title, subject), from ``lean/docs/NNN.md`` and ``overview.tex``;
|
| 7 |
+
* a hole policy. Comparator checks only the name and type of a ``definition_names`` entry, never
|
| 8 |
+
its body (comparator ``Compare.lean``: ``definitionHoleMatches``). openai/math lists fixed
|
| 9 |
+
definitions as holes in 9 configs, so a solver could redefine e.g. ``ProperColoring := False`` and
|
| 10 |
+
prove the theorem trivially. Holes are therefore rewritten:
|
| 11 |
+
|
| 12 |
+
- a definition with a complete body is removed from ``definition_names``, so Comparator requires
|
| 13 |
+
the solution's definition to be identical;
|
| 14 |
+
- a definition whose whole body is ``sorry`` and whose name appears nowhere else in the file stays
|
| 15 |
+
a hole: its type is the claim (e.g. a witness structure carrying the proof obligations);
|
| 16 |
+
- anything else (a ``sorry`` inside a body, or an open definition that statements depend on) cannot
|
| 17 |
+
be graded safely as written, and the challenge is excluded until it is restated.
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
from __future__ import annotations
|
| 21 |
+
|
| 22 |
+
import json
|
| 23 |
+
import re
|
| 24 |
+
from dataclasses import dataclass, field
|
| 25 |
+
from pathlib import Path
|
| 26 |
+
|
| 27 |
+
_DECL_START = re.compile(
|
| 28 |
+
r"(?m)^[ \t]*(?:@\[[^\]]*\][ \t]*\n?[ \t]*)?(?:(?:noncomputable|private|protected|partial|unsafe)[ \t]+)*"
|
| 29 |
+
r"(?:def|abbrev|theorem|lemma|instance|structure|class|inductive|opaque|axiom|example)\b"
|
| 30 |
+
)
|
| 31 |
+
_BLOCK_END = re.compile(
|
| 32 |
+
r"(?m)^[ \t]*(?:end\b|namespace\b|section\b|run_cmd\b|open\b|variable\b|set_option\b|/--|#)"
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
@dataclass
|
| 37 |
+
class Family:
|
| 38 |
+
number: str
|
| 39 |
+
title: str
|
| 40 |
+
subject: str
|
| 41 |
+
summary: str
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
@dataclass
|
| 45 |
+
class Challenge:
|
| 46 |
+
name: str
|
| 47 |
+
lean: str
|
| 48 |
+
config: dict
|
| 49 |
+
family: Family | None
|
| 50 |
+
theorem_names: list[str]
|
| 51 |
+
definition_holes: list[str]
|
| 52 |
+
dropped_holes: list[str] = field(default_factory=list)
|
| 53 |
+
excluded: str | None = None
|
| 54 |
+
|
| 55 |
+
@property
|
| 56 |
+
def comparator(self) -> dict:
|
| 57 |
+
return {
|
| 58 |
+
"theorem_names": self.theorem_names,
|
| 59 |
+
"definition_names": self.definition_holes,
|
| 60 |
+
"permitted_axioms": self.config["permitted_axioms"],
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def _declaration_block(source: str, short_name: str) -> str | None:
|
| 65 |
+
"""Text of the first ``def``-like declaration named ``short_name``, up to the next one."""
|
| 66 |
+
pattern = re.compile(
|
| 67 |
+
r"(?m)^[ \t]*(?:@\[[^\]]*\][ \t]*\n?[ \t]*)?(?:(?:noncomputable|private|protected)[ \t]+)*"
|
| 68 |
+
r"(?:def|abbrev|structure|class|inductive|opaque|instance)[ \t]+" + re.escape(short_name) + r"\b"
|
| 69 |
+
)
|
| 70 |
+
m = pattern.search(source)
|
| 71 |
+
if not m:
|
| 72 |
+
return None
|
| 73 |
+
rest = source[m.end():]
|
| 74 |
+
ends = [x.start() for x in (_DECL_START.search(rest), _BLOCK_END.search(rest)) if x]
|
| 75 |
+
return source[m.start(): m.end() + (min(ends) if ends else len(rest))]
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def _mentions(source: str, short_name: str) -> int:
|
| 79 |
+
"""Occurrences of ``short_name`` as a whole identifier anywhere in the file (comments included).
|
| 80 |
+
|
| 81 |
+
Qualified uses count too (``RowColumn.Foo`` mentions ``Foo``): theorems often refer to a
|
| 82 |
+
definition through its namespace, and missing one would keep an unsafe hole open.
|
| 83 |
+
"""
|
| 84 |
+
return len(re.findall(r"(?<![\w'])" + re.escape(short_name) + r"(?![\w'])", source))
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def hole_policy(source: str, config: dict) -> tuple[list[str], list[str], str | None]:
|
| 88 |
+
"""Return (kept holes, dropped holes, exclusion reason) for one challenge."""
|
| 89 |
+
kept, dropped, problems = [], [], []
|
| 90 |
+
for name in config.get("definition_names") or []:
|
| 91 |
+
short = name.split(".")[-1]
|
| 92 |
+
block = _declaration_block(source, short)
|
| 93 |
+
if block is None:
|
| 94 |
+
problems.append(f"{name}: definition not found in the challenge")
|
| 95 |
+
continue
|
| 96 |
+
body = block.split(":=", 1)[1] if ":=" in block else ""
|
| 97 |
+
has_sorry = re.search(r"\bsorry\b", block) is not None
|
| 98 |
+
if not has_sorry:
|
| 99 |
+
dropped.append(name)
|
| 100 |
+
elif re.fullmatch(r"\s*(?:by\s+)?sorry\s*", body) and _mentions(source, short) == 1:
|
| 101 |
+
# The hole's type is the claim and nothing else in the file refers to it.
|
| 102 |
+
kept.append(name)
|
| 103 |
+
else:
|
| 104 |
+
problems.append(f"{name}: open definition the theorem statements depend on")
|
| 105 |
+
return kept, dropped, ("; ".join(problems) or None)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def load_families(overview_tex: Path) -> dict[str, Family]:
|
| 109 |
+
src = overview_tex.read_text(encoding="utf-8")
|
| 110 |
+
|
| 111 |
+
def group(i: int) -> tuple[str, int]:
|
| 112 |
+
depth, j = 0, i
|
| 113 |
+
while True:
|
| 114 |
+
c = src[j]
|
| 115 |
+
if c == "\\":
|
| 116 |
+
j += 2
|
| 117 |
+
continue
|
| 118 |
+
if c == "{":
|
| 119 |
+
depth += 1
|
| 120 |
+
elif c == "}":
|
| 121 |
+
depth -= 1
|
| 122 |
+
if depth == 0:
|
| 123 |
+
return src[i + 1: j], j + 1
|
| 124 |
+
j += 1
|
| 125 |
+
|
| 126 |
+
families, subject = {}, ""
|
| 127 |
+
for m in re.finditer(r"\\(cataloguesection|resultentry)\{", src):
|
| 128 |
+
if src[max(0, m.start() - 12): m.start()].endswith("newcommand{"):
|
| 129 |
+
continue
|
| 130 |
+
i = m.end() - 1
|
| 131 |
+
if m.group(1) == "cataloguesection":
|
| 132 |
+
subject, _ = group(i)
|
| 133 |
+
continue
|
| 134 |
+
args = []
|
| 135 |
+
for _ in range(3):
|
| 136 |
+
arg, i = group(i)
|
| 137 |
+
args.append(arg)
|
| 138 |
+
while src[i] in " \n%":
|
| 139 |
+
i += 1
|
| 140 |
+
families[args[0]] = Family(args[0], _plain(args[1]), subject, _plain(args[2]))
|
| 141 |
+
return families
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def _plain(tex: str) -> str:
|
| 145 |
+
"""Light LaTeX cleanup for markdown: keep $math$, drop accents and \\-escapes."""
|
| 146 |
+
tex = re.sub(r"\\[\"'`^~]\{?([A-Za-z])\}?", r"\1", tex)
|
| 147 |
+
tex = tex.replace("--", "–").replace("``", '"').replace("''", '"').replace("~", " ")
|
| 148 |
+
tex = re.sub(r"\\(?:emph|textit|textbf)\{([^{}]*)\}", r"\1", tex)
|
| 149 |
+
return re.sub(r"\s+", " ", tex).strip()
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def family_links(docs_dir: Path) -> dict[str, str]:
|
| 153 |
+
"""Challenge name -> family number, from the Comparator tables in lean/docs/NNN.md."""
|
| 154 |
+
links = {}
|
| 155 |
+
for doc in sorted(docs_dir.glob("*.md")):
|
| 156 |
+
for m in re.finditer(r"\(\.\./ComparatorChallenges/([A-Za-z0-9_]+)\.lean\)", doc.read_text()):
|
| 157 |
+
links.setdefault(m.group(1), doc.stem)
|
| 158 |
+
return links
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def load_challenges(openai_math: Path) -> list[Challenge]:
|
| 162 |
+
lean = openai_math / "lean"
|
| 163 |
+
families = load_families(openai_math / "overview.tex")
|
| 164 |
+
links = family_links(lean / "docs")
|
| 165 |
+
out = []
|
| 166 |
+
for cfg_path in sorted((lean / "ComparatorChallenges").glob("*.json")):
|
| 167 |
+
name = cfg_path.stem
|
| 168 |
+
config = json.loads(cfg_path.read_text())
|
| 169 |
+
source = (lean / "ComparatorChallenges" / f"{name}.lean").read_text(encoding="utf-8")
|
| 170 |
+
kept, dropped, excluded = hole_policy(source, config)
|
| 171 |
+
if not config["theorem_names"] and not kept:
|
| 172 |
+
excluded = excluded or "no theorem and no open definition to check"
|
| 173 |
+
out.append(Challenge(
|
| 174 |
+
name=name, lean=source, config=config, family=families.get(links.get(name, "")),
|
| 175 |
+
theorem_names=list(config["theorem_names"]), definition_holes=kept,
|
| 176 |
+
dropped_holes=dropped, excluded=excluded,
|
| 177 |
+
))
|
| 178 |
+
return out
|
generator/openai_math_harbor/import_graph.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Build the module import graph of the openai/math Lean library.
|
| 2 |
+
|
| 3 |
+
Reads every ``.lean`` file under ``<repo>/lean`` (OAI library and ComparatorChallenges) and writes one
|
| 4 |
+
JSON object: ``{"modules": {module: {"imports": [...], "bytes": n, "lines": n}}}``. Only the import
|
| 5 |
+
header is parsed; Lean requires imports to come before any other command.
|
| 6 |
+
|
| 7 |
+
python -m openai_math_harbor.import_graph /path/to/openai-math/lean graph.json
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import json
|
| 13 |
+
import re
|
| 14 |
+
import sys
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
|
| 17 |
+
# `import X`, plus the module-system forms `public import X`, `meta import X`, `import all X`.
|
| 18 |
+
_IMPORT = re.compile(r"^\s*(?:public\s+|private\s+)?(?:meta\s+)?import\s+(?:all\s+)?([A-Za-z_«][^\s]*)")
|
| 19 |
+
_HEADER_ONLY = re.compile(r"^\s*(?:module\b|prelude\b|--|/-|$)")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def header_imports(text: str) -> list[str]:
|
| 23 |
+
imports, in_comment = [], False
|
| 24 |
+
for line in text.splitlines():
|
| 25 |
+
if in_comment:
|
| 26 |
+
in_comment = "-/" not in line
|
| 27 |
+
continue
|
| 28 |
+
if line.lstrip().startswith("/-") and "-/" not in line:
|
| 29 |
+
in_comment = True
|
| 30 |
+
continue
|
| 31 |
+
m = _IMPORT.match(line)
|
| 32 |
+
if m:
|
| 33 |
+
imports.append(m.group(1).replace("«", "").replace("»", ""))
|
| 34 |
+
elif not _HEADER_ONLY.match(line):
|
| 35 |
+
break
|
| 36 |
+
return imports
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def build(lean_root: Path) -> dict:
|
| 40 |
+
modules = {}
|
| 41 |
+
for path in sorted(lean_root.rglob("*.lean")):
|
| 42 |
+
rel = path.relative_to(lean_root)
|
| 43 |
+
if rel.parts[0] in (".lake", "lakefile.lean") or rel.name == "lakefile.lean":
|
| 44 |
+
continue
|
| 45 |
+
text = path.read_text(encoding="utf-8", errors="replace")
|
| 46 |
+
name = ".".join(rel.with_suffix("").parts)
|
| 47 |
+
modules[name] = {"imports": header_imports(text), "bytes": len(text.encode()), "lines": text.count("\n") + 1}
|
| 48 |
+
return {"modules": modules}
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
if __name__ == "__main__":
|
| 52 |
+
graph = build(Path(sys.argv[1]))
|
| 53 |
+
Path(sys.argv[2]).write_text(json.dumps(graph, separators=(",", ":")))
|
| 54 |
+
print(len(graph["modules"]), "modules")
|
generator/openai_math_harbor/oracle.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Reference-proof closures for the oracle agent.
|
| 2 |
+
|
| 3 |
+
A challenge's reference proof is ``solution_module`` plus every ``OAI.*`` module it imports,
|
| 4 |
+
transitively (from the import graph built by ``import_graph.py``). The oracle submits exactly those
|
| 5 |
+
files under the ``Submission`` root agents use (see ``reference.py``), so the verifier grades the
|
| 6 |
+
reference proof the same way it grades an agent.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import io
|
| 12 |
+
import tarfile
|
| 13 |
+
import tempfile
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
from .reference import place
|
| 17 |
+
|
| 18 |
+
CORE_ROOTS = {"Init", "Lean", "Std", "Lake", "Mathlib"}
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def closure(graph: dict, root: str) -> list[str]:
|
| 22 |
+
"""Every OAI module reachable from ``root`` through imports, sorted."""
|
| 23 |
+
seen, stack = set(), [root]
|
| 24 |
+
while stack:
|
| 25 |
+
module = stack.pop()
|
| 26 |
+
if module in seen or module not in graph:
|
| 27 |
+
continue
|
| 28 |
+
seen.add(module)
|
| 29 |
+
stack.extend(i for i in graph[module]["imports"] if i == "OAI" or i.startswith("OAI."))
|
| 30 |
+
return sorted(seen)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def external_packages(graph: dict, modules: list[str]) -> list[str]:
|
| 34 |
+
"""Import roots outside OAI, Mathlib and the Lean core that the closure needs."""
|
| 35 |
+
roots = {i.split(".")[0] for m in modules for i in graph[m]["imports"] if i not in graph}
|
| 36 |
+
return sorted(roots - CORE_ROOTS)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def bundle(lean_dir: Path, modules: list[str], solution_module: str) -> bytes:
|
| 40 |
+
"""A .tar.gz of the placed reference submission (Submission.lean + Submission/OAI/**)."""
|
| 41 |
+
with tempfile.TemporaryDirectory() as tmp:
|
| 42 |
+
place(lean_dir, modules, solution_module, Path(tmp))
|
| 43 |
+
buf = io.BytesIO()
|
| 44 |
+
with tarfile.open(fileobj=buf, mode="w:gz") as tar:
|
| 45 |
+
for path in sorted(Path(tmp).rglob("*.lean")):
|
| 46 |
+
tar.add(path, arcname=str(path.relative_to(tmp)))
|
| 47 |
+
return buf.getvalue()
|
generator/openai_math_harbor/package.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Assemble the folder that is published as the Hugging Face dataset.
|
| 2 |
+
|
| 3 |
+
Copies a generated dataset (adapter output) and adds the generator itself under generator/, so the
|
| 4 |
+
published repo can rebuild the image and regenerate the tasks on its own.
|
| 5 |
+
|
| 6 |
+
python -m openai_math_harbor.package <adapter output dir> <stage dir>
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import shutil
|
| 12 |
+
import sys
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
GENERATOR_ROOT = Path(__file__).parents[1]
|
| 16 |
+
GENERATOR_PARTS = ["README.md", "openai_math_harbor", "image", "tests"]
|
| 17 |
+
IGNORE = shutil.ignore_patterns("__pycache__", "*.pyc", ".DS_Store")
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def stage(dataset: Path, out: Path) -> None:
|
| 21 |
+
if out.exists():
|
| 22 |
+
shutil.rmtree(out)
|
| 23 |
+
shutil.copytree(dataset, out, ignore=IGNORE)
|
| 24 |
+
for part in GENERATOR_PARTS:
|
| 25 |
+
src = GENERATOR_ROOT / part
|
| 26 |
+
dst = out / "generator" / part
|
| 27 |
+
if src.is_dir():
|
| 28 |
+
shutil.copytree(src, dst, ignore=IGNORE)
|
| 29 |
+
else:
|
| 30 |
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
| 31 |
+
shutil.copy(src, dst)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
stage(Path(sys.argv[1]), Path(sys.argv[2]))
|
| 36 |
+
print("staged", sys.argv[2])
|
generator/openai_math_harbor/reference.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Place openai/math's reference proof as a submission (used by the oracle's solve.sh).
|
| 3 |
+
|
| 4 |
+
Standalone: the adapter copies this file into every task's solution/ directory.
|
| 5 |
+
|
| 6 |
+
reference.py <openai-math lean dir> <closure.txt> <solution module> <workspace>
|
| 7 |
+
|
| 8 |
+
Each module in closure.txt (``OAI.A.B``) is copied from ``<lean>/OAI/A/B.lean`` to
|
| 9 |
+
``<workspace>/Submission/OAI/A/B.lean`` with ``import OAI.X`` rewritten to
|
| 10 |
+
``import Submission.OAI.X``; ``Submission.lean`` imports the solution module. Declaration names
|
| 11 |
+
are namespaces, not module paths, so the theorems keep the names the challenge expects.
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
from __future__ import annotations
|
| 15 |
+
|
| 16 |
+
import re
|
| 17 |
+
import sys
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
|
| 20 |
+
_IMPORT = re.compile(r"^(\s*(?:public\s+|private\s+)?(?:meta\s+)?import\s+(?:all\s+)?)(OAI(?:\.|\s|$))")
|
| 21 |
+
_HEADER_LINE = re.compile(r"^\s*(?:module\b|prelude\b|--|$)")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def rename_imports(text: str) -> str:
|
| 25 |
+
"""Rewrite ``import OAI...`` to ``import Submission.OAI...`` in the import header only."""
|
| 26 |
+
out, in_header, in_comment = [], True, False
|
| 27 |
+
for line in text.splitlines(keepends=True):
|
| 28 |
+
if in_header:
|
| 29 |
+
stripped = line.strip()
|
| 30 |
+
if in_comment:
|
| 31 |
+
in_comment = "-/" not in stripped
|
| 32 |
+
elif stripped.startswith("/-"):
|
| 33 |
+
in_comment = "-/" not in stripped[2:]
|
| 34 |
+
elif _IMPORT.match(line):
|
| 35 |
+
line = _IMPORT.sub(lambda m: m.group(1) + "Submission." + m.group(2), line, count=1)
|
| 36 |
+
elif not _HEADER_LINE.match(line) and not re.match(r"^\s*(?:public\s+|private\s+)?(?:meta\s+)?import\s", line):
|
| 37 |
+
in_header = False
|
| 38 |
+
out.append(line)
|
| 39 |
+
return "".join(out)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def module_path(root: Path, module: str) -> Path:
|
| 43 |
+
return root.joinpath(*module.split(".")).with_suffix(".lean")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def place(lean_dir: Path, modules: list[str], solution_module: str, workspace: Path) -> None:
|
| 47 |
+
for module in modules:
|
| 48 |
+
dst = module_path(workspace / "Submission", module)
|
| 49 |
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
| 50 |
+
dst.write_text(rename_imports(module_path(lean_dir, module).read_text(encoding="utf-8")), encoding="utf-8")
|
| 51 |
+
(workspace / "Submission.lean").write_text(f"import Submission.{solution_module}\n", encoding="utf-8")
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
lean_dir, closure_txt, solution_module, workspace = sys.argv[1:5]
|
| 56 |
+
modules = [m.strip() for m in Path(closure_txt).read_text().splitlines() if m.strip()]
|
| 57 |
+
place(Path(lean_dir), modules, solution_module, Path(workspace))
|
| 58 |
+
print(f"placed {len(modules)} reference modules for {solution_module}")
|
generator/openai_math_harbor/report.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Summarize a Harbor oracle job into one verdict per task.
|
| 2 |
+
|
| 3 |
+
The oracle submits openai/math's own proof of each challenge, so its grade says whether the task is
|
| 4 |
+
verified end to end: the statement builds, the official proof compiles in the image, and Comparator
|
| 5 |
+
accepts it. Every non-accepted result gets a cause, so a reader can tell an environment limit (disk,
|
| 6 |
+
memory, a library the image does not ship) from a real disagreement between proof and statement.
|
| 7 |
+
|
| 8 |
+
python -m openai_math_harbor.report <harbor job dir> [<re-run job dir> ...] oracle_results.json
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
import collections
|
| 14 |
+
import json
|
| 15 |
+
import sys
|
| 16 |
+
from pathlib import Path
|
| 17 |
+
|
| 18 |
+
# Checked in order against grading.json's reason and the Comparator log.
|
| 19 |
+
CAUSES = [
|
| 20 |
+
("disk", ("no space left on device",)),
|
| 21 |
+
# The reference proof states a definition with the same text as the challenge, but compiled in
|
| 22 |
+
# its own library's context it elaborates to a different term, so exact matching fails.
|
| 23 |
+
("definition-mismatch", ("Const does not match between challenge and target",)),
|
| 24 |
+
("memory", ("most likely out of memory", "Child exited with 137", "Lean exited with code 137")),
|
| 25 |
+
("missing-package", ("unknown module prefix", "bad import", "unknown package")),
|
| 26 |
+
("timeout", ("timed out",)),
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def classify(trial: Path) -> dict:
|
| 31 |
+
result = json.loads((trial / "result.json").read_text())
|
| 32 |
+
grading = trial / "verifier" / "grading.json"
|
| 33 |
+
log = trial / "verifier" / "comparator.log"
|
| 34 |
+
g = json.loads(grading.read_text()) if grading.exists() else {}
|
| 35 |
+
text = (g.get("reason") or "") + "\n" + (log.read_text(errors="replace") if log.exists() else "")
|
| 36 |
+
reward = ((result.get("verifier_result") or {}).get("rewards") or {}).get("reward")
|
| 37 |
+
if reward == 1:
|
| 38 |
+
cause = "accepted"
|
| 39 |
+
elif reward is None:
|
| 40 |
+
cause = "error: " + str((result.get("exception_info") or {}).get("exception_type") or g.get("reason", "unknown"))
|
| 41 |
+
else:
|
| 42 |
+
cause = next((name for name, keys in CAUSES if any(k in text for k in keys)), "rejected")
|
| 43 |
+
return {
|
| 44 |
+
"reward": reward,
|
| 45 |
+
"cause": cause,
|
| 46 |
+
# Graders since the overlay copy-up fix record `permission_fixes`; earlier verdicts other
|
| 47 |
+
# than "accepted" may be artifacts of that bug and are re-graded.
|
| 48 |
+
"current_grader": "permission_fixes" in g,
|
| 49 |
+
"grade_seconds": round(g["finished_at"] - g["started_at"]) if g.get("finished_at") else None,
|
| 50 |
+
"reason": (g.get("reason") or "")[:500],
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def summarize(job_dir: Path) -> dict[str, dict]:
|
| 55 |
+
"""Task directory name -> verdict. A task attempted twice (a re-run) keeps its latest trial."""
|
| 56 |
+
out, finished = {}, {}
|
| 57 |
+
for trial in sorted(p for p in job_dir.iterdir() if p.is_dir() and (p / "result.json").exists()):
|
| 58 |
+
result = json.loads((trial / "result.json").read_text())
|
| 59 |
+
if not result.get("finished_at"):
|
| 60 |
+
continue
|
| 61 |
+
# Trial directory names are truncated; the task path is not.
|
| 62 |
+
name = Path(result["task_id"]["path"]).name
|
| 63 |
+
if name not in finished or result["finished_at"] > finished[name]:
|
| 64 |
+
out[name], finished[name] = classify(trial), result["finished_at"]
|
| 65 |
+
return out
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def merge(*job_dirs: Path) -> dict[str, dict]:
|
| 69 |
+
"""Verdicts from several jobs; later jobs (re-runs) override earlier ones."""
|
| 70 |
+
merged = {}
|
| 71 |
+
for job_dir in job_dirs:
|
| 72 |
+
merged.update(summarize(job_dir))
|
| 73 |
+
return merged
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
if __name__ == "__main__":
|
| 77 |
+
*jobs, out_path = sys.argv[1:]
|
| 78 |
+
results = merge(*(Path(j) for j in jobs))
|
| 79 |
+
Path(out_path).write_text(json.dumps(results, indent=2, ensure_ascii=False))
|
| 80 |
+
print(len(results), "tasks:", dict(collections.Counter(r["cause"] for r in results.values())))
|
generator/openai_math_harbor/snapshot.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Build the shared Daytona snapshot from image/Dockerfile.
|
| 2 |
+
|
| 3 |
+
Harbor's own auto-snapshot waits only 10 minutes, and downloading Mathlib takes longer, so the
|
| 4 |
+
snapshot is built once up front and passed to Harbor with ``--ek snapshot_template_name=<name>``.
|
| 5 |
+
The name carries a hash of image/, so a changed recipe gets a new snapshot.
|
| 6 |
+
|
| 7 |
+
python -m openai_math_harbor.snapshot [--print-name]
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import argparse
|
| 13 |
+
import hashlib
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
IMAGE_DIR = Path(__file__).parents[1] / "image"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def snapshot_name() -> str:
|
| 20 |
+
h = hashlib.sha256()
|
| 21 |
+
# Regular files only: a stray __pycache__ or editor backup must not change or break the hash.
|
| 22 |
+
for path in sorted(IMAGE_DIR.iterdir()):
|
| 23 |
+
if path.is_file() and not path.name.startswith(".") and not path.name.endswith((".pyc", "~")):
|
| 24 |
+
h.update(path.name.encode() + b"\0" + path.read_bytes())
|
| 25 |
+
return f"openai-math-lean-{h.hexdigest()[:12]}"
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def main() -> None:
|
| 29 |
+
ap = argparse.ArgumentParser(description=__doc__)
|
| 30 |
+
ap.add_argument("--print-name", action="store_true")
|
| 31 |
+
args = ap.parse_args()
|
| 32 |
+
name = snapshot_name()
|
| 33 |
+
if args.print_name:
|
| 34 |
+
print(name)
|
| 35 |
+
return
|
| 36 |
+
from daytona import CreateSnapshotParams, Daytona, Image, Resources
|
| 37 |
+
|
| 38 |
+
d = Daytona()
|
| 39 |
+
try:
|
| 40 |
+
snap = d.snapshot.get(name)
|
| 41 |
+
print(f"{name} already exists ({snap.state})")
|
| 42 |
+
return
|
| 43 |
+
except Exception:
|
| 44 |
+
pass
|
| 45 |
+
image = Image.from_dockerfile(IMAGE_DIR / "Dockerfile")
|
| 46 |
+
d.snapshot.create(
|
| 47 |
+
CreateSnapshotParams(name=name, image=image, resources=Resources(cpu=4, memory=8, disk=10)),
|
| 48 |
+
on_logs=lambda line: print(line, flush=True),
|
| 49 |
+
timeout=3 * 3600,
|
| 50 |
+
)
|
| 51 |
+
print(f"created {name}")
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
main()
|
generator/openai_math_harbor/templates/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
generator/openai_math_harbor/templates/LICENSE-openai-math
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
generator/openai_math_harbor/templates/NOTICE
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
openai-math-harbor
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
This dataset packages the Lean statements of OpenAI's "openai/math" release as Harbor tasks.
|
| 5 |
+
|
| 6 |
+
Redistributed material
|
| 7 |
+
----------------------
|
| 8 |
+
Each task's tests/Challenge.lean, and the Lean block quoted in its instruction.md, is the file
|
| 9 |
+
lean/ComparatorChallenges/<Name>.lean from https://github.com/openai/math at commit
|
| 10 |
+
$source_commit, copyright OpenAI, licensed under the Apache License, Version 2.0 (see
|
| 11 |
+
LICENSE-openai-math). The files are unchanged.
|
| 12 |
+
|
| 13 |
+
Modified material
|
| 14 |
+
-----------------
|
| 15 |
+
The Comparator configuration of each task (tests/task.json) is derived from the corresponding
|
| 16 |
+
lean/ComparatorChallenges/<Name>.json in that repository. In eight tasks, definitions that the
|
| 17 |
+
original listed under "definition_names" although their bodies are written out were removed from
|
| 18 |
+
that list, so that Comparator requires them to match exactly; task.toml records them under
|
| 19 |
+
[metadata] fixed_definitions.
|
| 20 |
+
|
| 21 |
+
Only statements whose official proof was verified in the environment are included; the README
|
| 22 |
+
lists the others and why each could not be validated. One challenge (DefocusingNLS) is left out
|
| 23 |
+
by design.
|
| 24 |
+
|
| 25 |
+
Not included
|
| 26 |
+
------------
|
| 27 |
+
OpenAI's proofs (the lean/OAI library) are not part of this dataset.
|
| 28 |
+
|
| 29 |
+
Everything else in this dataset (task.toml, instruction.md apart from the quoted statement,
|
| 30 |
+
tests/grade.py, tests/test.sh, environment/, solution/, generator/) is licensed under the
|
| 31 |
+
Apache License, Version 2.0 (see LICENSE).
|
| 32 |
+
|
| 33 |
+
Third-party software in the sandbox image
|
| 34 |
+
-----------------------------------------
|
| 35 |
+
Lean 4 and Mathlib (Apache-2.0); Comparator and lean4export by the Lean FRO (Apache-2.0),
|
| 36 |
+
Comparator built from leanprover/comparator@d03acab with a one-line patch that passes
|
| 37 |
+
LEAN_NUM_THREADS into its sandbox; landrun (MIT). The image is built from environment/ at run
|
| 38 |
+
time; none of this software is stored in the dataset.
|
generator/openai_math_harbor/templates/dataset_README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- other
|
| 5 |
+
tags:
|
| 6 |
+
- harbor
|
| 7 |
+
- rl-environment
|
| 8 |
+
- reinforcement-learning
|
| 9 |
+
- code-agent
|
| 10 |
+
- lean4
|
| 11 |
+
- mathlib
|
| 12 |
+
- theorem-proving
|
| 13 |
+
- openai-math
|
| 14 |
+
pretty_name: "openai/math as Harbor environments"
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# openai/math as Harbor environments
|
| 18 |
+
|
| 19 |
+
> **Experimental.** Built on a research release that is itself new and not yet independently
|
| 20 |
+
> reviewed. Expect rough edges, and read any proof that scores 1 before relying on it.
|
| 21 |
+
|
| 22 |
+
We ported the math problems from OpenAI's [openai/math](https://github.com/openai/math) release
|
| 23 |
+
(commit `$source_commit`) into [Harbor](https://github.com/harbor-framework/harbor) environments.
|
| 24 |
+
The release formalizes **$n_statements** of its results as Lean statements. This dataset contains
|
| 25 |
+
**$n_tasks environments**, the ones whose official proof we verified end to end in the environment,
|
| 26 |
+
covering $n_families result families across $n_subjects fields. The other $n_not_included are listed
|
| 27 |
+
under [Validation](#validation) with the reason each could not be validated.
|
| 28 |
+
|
| 29 |
+
## How a task works
|
| 30 |
+
|
| 31 |
+
The agent gets a sandbox with Lean 4 and a prebuilt Mathlib, no internet, and one of OpenAI's
|
| 32 |
+
theorems written in Lean with `sorry` where the proof should be.
|
| 33 |
+
|
| 34 |
+
**What `sorry` means.** In Lean, `sorry` is a placeholder for a missing proof: it lets the file
|
| 35 |
+
compile as if the step were proven, but nothing has actually been shown, and Lean flags it. The
|
| 36 |
+
statement is given exactly as OpenAI formalized it, and the agent's job is to replace every `sorry`
|
| 37 |
+
with a real proof.
|
| 38 |
+
|
| 39 |
+
When the agent finishes, a separate, fresh sandbox checks its proof with
|
| 40 |
+
[Comparator](https://github.com/leanprover/comparator), the Lean FRO's proof checker:
|
| 41 |
+
|
| 42 |
+
- **reward 1** if the theorem has exactly the original statement, the proof uses only Lean's
|
| 43 |
+
standard axioms (`propext`, `Quot.sound`, `Classical.choice`, so no leftover `sorry` and no new
|
| 44 |
+
axioms), and the Lean kernel accepts it;
|
| 45 |
+
- **reward 0** otherwise.
|
| 46 |
+
|
| 47 |
+
OpenAI's own proofs serve as the reference solutions: Harbor's oracle fetches them from GitHub at
|
| 48 |
+
run time. They are not included here and the agent never sees them.
|
| 49 |
+
|
| 50 |
+
## A strict reward
|
| 51 |
+
|
| 52 |
+
The grader only accepts a complete proof of the statement exactly as OpenAI formalized it. That
|
| 53 |
+
makes it hard to game, but it is also a real limitation for problems like these:
|
| 54 |
+
|
| 55 |
+
- a correct proof of an equivalent statement, written with different definitions or a different
|
| 56 |
+
formulation, scores 0;
|
| 57 |
+
- partial progress (useful lemmas, a proof of a special case, a correct strategy with a gap) scores 0;
|
| 58 |
+
- nothing rewards a creative approach unless it ends in a complete proof of this exact statement.
|
| 59 |
+
|
| 60 |
+
For open research problems, a more general reward function that recognizes any valid solution to the
|
| 61 |
+
underlying problem, including creative reformulations and partial progress, would be a better
|
| 62 |
+
training signal. We use the strict check here because it is precise and cannot be fooled; treat it
|
| 63 |
+
as one end of that design space.
|
| 64 |
+
|
| 65 |
+
## What's included
|
| 66 |
+
|
| 67 |
+
- `tasks/` — one Harbor task per validated problem: instruction, Lean statement, sandbox image recipe,
|
| 68 |
+
verifier and oracle
|
| 69 |
+
- `registry.json` — Harbor registry entry (`openai-math-harbor@1.0`)
|
| 70 |
+
- `manifest.parquet` — one row per task: field, family, theorem names, reference-proof size, oracle
|
| 71 |
+
result
|
| 72 |
+
- `generator/` — the code that builds the sandbox image and regenerates the tasks from openai/math
|
| 73 |
+
- `LICENSE`, `NOTICE`, `LICENSE-openai-math` — licensing and attribution
|
| 74 |
+
|
| 75 |
+
## Run it with the Harbor CLI
|
| 76 |
+
|
| 77 |
+
You need Harbor 0.24+ with the Daytona backend (`DAYTONA_API_KEY`, `DAYTONA_API_URL`) and
|
| 78 |
+
credentials for the agent you run.
|
| 79 |
+
|
| 80 |
+
```bash
|
| 81 |
+
pip install "harbor[daytona]>=0.24" daytona
|
| 82 |
+
hf download FineEnvs/openai-math-harbor --repo-type dataset --local-dir openai-math-harbor
|
| 83 |
+
cd openai-math-harbor
|
| 84 |
+
|
| 85 |
+
# Build the shared sandbox image once (Lean 4, Mathlib, Comparator; ~9 GB, about an hour).
|
| 86 |
+
(cd generator && python -m openai_math_harbor.snapshot)
|
| 87 |
+
SNAP=$$(cd generator && python -m openai_math_harbor.snapshot --print-name)
|
| 88 |
+
|
| 89 |
+
# Run any agent Harbor supports (`harbor agent list`) on a few tasks:
|
| 90 |
+
harbor run -p tasks -e daytona --ek snapshot_template_name=$$SNAP \
|
| 91 |
+
-a <agent> -m <model> -i plane-coloring -i hilbert-crouzeix -n 2
|
| 92 |
+
|
| 93 |
+
# Check that the grader accepts OpenAI's own proof of a task:
|
| 94 |
+
harbor run -p tasks -e daytona --ek snapshot_template_name=$$SNAP \
|
| 95 |
+
-a oracle --allow-agent-host github.com -i plane-coloring
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Each task asks for 4 CPUs, 8 GB of memory and 10 GB of disk, and gives the agent 4 hours. Task
|
| 99 |
+
names are the folder names under `tasks/`.
|
| 100 |
+
|
| 101 |
+
## Validation
|
| 102 |
+
|
| 103 |
+
We generated a task for every statement except one left out by design (`DefocusingNLS`, whose
|
| 104 |
+
statement has a `sorry` inside a definition its theorems depend on), and ran Harbor's oracle on each:
|
| 105 |
+
it submits OpenAI's own proof and has it graded by the same verifier an agent faces. Only tasks whose
|
| 106 |
+
official proof was accepted are included.
|
| 107 |
+
|
| 108 |
+
$validation
|
| 109 |
+
|
| 110 |
+
$not_validated
|
| 111 |
+
|
| 112 |
+
The verifier was also tested against submissions that try to cheat (`sorry` in several disguises,
|
| 113 |
+
fake axioms, `native_decide`, weakened statements, redefined definitions, planted reward files, code
|
| 114 |
+
that runs during grading). All scored 0. A no-op agent scores 0.
|
| 115 |
+
|
| 116 |
+
## Notes
|
| 117 |
+
|
| 118 |
+
- **Configs.** In eight of openai/math's Comparator configs, definitions written out in the statement
|
| 119 |
+
were listed as "holes" that Comparator does not check, so a solution could redefine them. Here they
|
| 120 |
+
must match exactly; affected tasks list them under `fixed_definitions` in `task.toml`.
|
| 121 |
+
- **Contamination.** The statements and proofs have been public since 6 October 2026.
|
| 122 |
+
- **Difficulty.** These are open research problems; expect reward 0 on almost every task.
|
| 123 |
+
|
| 124 |
+
Technical details (grading design, threat model, image recipe) are in `generator/README.md`.
|
| 125 |
+
|
| 126 |
+
## License
|
| 127 |
+
|
| 128 |
+
- The Lean statements are copied unchanged from [openai/math](https://github.com/openai/math)
|
| 129 |
+
(© OpenAI), licensed under the
|
| 130 |
+
[Apache License 2.0](https://github.com/openai/math/blob/main/LICENSE); see `LICENSE-openai-math`
|
| 131 |
+
and `NOTICE`. OpenAI's proofs are not redistributed.
|
| 132 |
+
- The packaging, verifier and generator are Apache-2.0 (`LICENSE`).
|
| 133 |
+
- The sandbox image is built from [Lean 4](https://github.com/leanprover/lean4) and
|
| 134 |
+
[Mathlib](https://github.com/leanprover-community/mathlib4) (Apache-2.0),
|
| 135 |
+
[Comparator](https://github.com/leanprover/comparator) and
|
| 136 |
+
[lean4export](https://github.com/leanprover/lean4export) (Apache-2.0), and
|
| 137 |
+
[landrun](https://github.com/Zouuup/landrun) (MIT).
|
| 138 |
+
- If you use the results, cite the openai/math manuscripts as that repository asks.
|
generator/openai_math_harbor/templates/instruction.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# $title
|
| 2 |
+
|
| 3 |
+
Prove the following result from OpenAI's [openai/math](https://github.com/openai/math) release in
|
| 4 |
+
Lean 4, with a proof the Lean kernel accepts.
|
| 5 |
+
|
| 6 |
+
Context: this statement belongs to family $family_number of the release, *$family_title*
|
| 7 |
+
($subject). The family as a whole: $family_summary
|
| 8 |
+
|
| 9 |
+
The challenge is `$challenge`, also at `/opt/openai-math/challenges/$challenge.lean`:
|
| 10 |
+
|
| 11 |
+
```lean
|
| 12 |
+
$lean
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
## What to submit
|
| 16 |
+
|
| 17 |
+
Write `/workspace/Submission.lean`. Start from a copy of the challenge:
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
cp /opt/openai-math/challenges/$challenge.lean /workspace/Submission.lean
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
then replace every `sorry` with a proof. The file is graded on three things:
|
| 24 |
+
|
| 25 |
+
- **Same statements.** $targets must keep exactly the statement shown above: same names,
|
| 26 |
+
namespaces, binders and types. Every definition the statements use must stay exactly as written.
|
| 27 |
+
Change nothing except the proofs$holes.
|
| 28 |
+
- **Standard axioms only.** Proofs may use only `propext`, `Quot.sound` and `Classical.choice`.
|
| 29 |
+
`sorry`, `admit`, new `axiom`s and `native_decide` (it introduces an axiom of its own) are rejected.
|
| 30 |
+
- **Keep the challenge's declarations as they are.** Put new lemmas and instances *after* the
|
| 31 |
+
definitions the statements use, or in a separate `Submission/*.lean` module. A declaration added
|
| 32 |
+
before them can change how they elaborate, and then they no longer match the challenge.
|
| 33 |
+
- **Kernel-checked.** The proofs are re-checked by the Lean kernel, not just the elaborator.
|
| 34 |
+
|
| 35 |
+
Long proofs can be split into modules under `/workspace/Submission/` (module names
|
| 36 |
+
`Submission.Foo`, `Submission.Foo.Bar`) imported from `Submission.lean`. Only `.lean` files at
|
| 37 |
+
those two paths are graded.
|
| 38 |
+
|
| 39 |
+
## Environment
|
| 40 |
+
|
| 41 |
+
- Lean `v4.34.1` and Mathlib at commit `d13f23b` are installed and prebuilt; `/workspace` is a
|
| 42 |
+
Lake project.
|
| 43 |
+
- The sandbox has 4 CPUs and 8 GB of memory; `LEAN_NUM_THREADS=3` keeps `lake build` to three
|
| 44 |
+
parallel jobs. Check your work with `cd /workspace && lake build Submission`. Add `#print axioms <name>` to see
|
| 45 |
+
which axioms a proof uses.
|
| 46 |
+
- There is no internet access. OpenAI's own proofs are not installed.
|
| 47 |
+
|
| 48 |
+
## Grading
|
| 49 |
+
|
| 50 |
+
When you finish, `Submission.lean` and `Submission/**.lean` are copied to a fresh machine and
|
| 51 |
+
checked with [Comparator](https://github.com/leanprover/comparator), the Lean FRO's proof checker.
|
| 52 |
+
The reward is 1 if Comparator accepts the proof and 0 otherwise. A partial proof scores 0.
|
generator/openai_math_harbor/templates/solution/solve.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Oracle: submit openai/math's own proof of $challenge, i.e. module $solution_module and the
|
| 3 |
+
# $n_modules OAI modules it imports, placed under Submission/ (see reference.py).
|
| 4 |
+
set -euo pipefail
|
| 5 |
+
if [ -f /solution/reference.tar.gz ]; then
|
| 6 |
+
tar -xzf /solution/reference.tar.gz -C /workspace
|
| 7 |
+
else
|
| 8 |
+
# Fetch only those files at the pinned commit. The task blocks the network while the agent runs,
|
| 9 |
+
# so run the oracle with `harbor run ... --allow-agent-host github.com`.
|
| 10 |
+
tmp=$$(mktemp -d)
|
| 11 |
+
git -C "$$tmp" init -q
|
| 12 |
+
git -C "$$tmp" remote add origin https://github.com/openai/math.git
|
| 13 |
+
git -C "$$tmp" config core.sparseCheckout true
|
| 14 |
+
sed -e 's#\.#/#g' -e 's#^#/lean/#' -e 's#$$#.lean#' /solution/closure.txt > "$$tmp/.git/info/sparse-checkout"
|
| 15 |
+
git -C "$$tmp" fetch -q --depth 1 --filter=blob:none origin $source_commit
|
| 16 |
+
git -C "$$tmp" checkout -q FETCH_HEAD
|
| 17 |
+
python3 /solution/reference.py "$$tmp/lean" /solution/closure.txt $solution_module /workspace
|
| 18 |
+
rm -rf "$$tmp"
|
| 19 |
+
fi
|
| 20 |
+
echo "placed the reference proof of $challenge"
|
generator/openai_math_harbor/templates/tests/grade.py
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Grade one openai/math challenge with Comparator.
|
| 3 |
+
|
| 4 |
+
This runs as root in a separate verifier sandbox that never executed agent code. The only input the
|
| 5 |
+
agent controls is /logs/artifacts/submission.tar. Everything else comes from /tests (this task's
|
| 6 |
+
trusted challenge and Comparator config) and from the image.
|
| 7 |
+
|
| 8 |
+
Steps:
|
| 9 |
+
1. Unpack submission.tar, accepting only regular `Submission.lean` / `Submission/**.lean` files.
|
| 10 |
+
2. Lay out a fresh Lake project: the trusted lakefile, Challenge.lean from /tests, the submission,
|
| 11 |
+
and the image's prebuilt Mathlib (root-owned, read-only to the grader).
|
| 12 |
+
3. Run `lake env comparator config.json` as the unprivileged `grader` user, with no network.
|
| 13 |
+
Comparator builds Challenge and Submission inside landrun, checks that every listed theorem
|
| 14 |
+
has exactly the challenge's statement, that only the permitted axioms are used, and replays
|
| 15 |
+
the proof through the Lean kernel.
|
| 16 |
+
4. Kill everything the grader started, then write the verdict.
|
| 17 |
+
|
| 18 |
+
reward.txt is 1 only when Comparator prints its success line and exits 0. A rejected or
|
| 19 |
+
non-compiling submission scores 0. A broken grading setup (the trusted Challenge fails to build,
|
| 20 |
+
the network block cannot be installed) writes no reward, so Harbor reports an error instead of a
|
| 21 |
+
score.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import json
|
| 27 |
+
import os
|
| 28 |
+
import pwd
|
| 29 |
+
import re
|
| 30 |
+
import shutil
|
| 31 |
+
import signal
|
| 32 |
+
import socket
|
| 33 |
+
import stat
|
| 34 |
+
import subprocess
|
| 35 |
+
import sys
|
| 36 |
+
import tarfile
|
| 37 |
+
import tempfile
|
| 38 |
+
import time
|
| 39 |
+
from pathlib import Path
|
| 40 |
+
|
| 41 |
+
TESTS = Path("/tests")
|
| 42 |
+
VERIFIER_DIR = Path("/logs/verifier")
|
| 43 |
+
SUBMISSION_TAR = Path("/logs/artifacts/submission.tar")
|
| 44 |
+
LEAN_ENV = Path("/opt/lean-env")
|
| 45 |
+
RUN_ROOT = Path("/var/lib/oai-grade")
|
| 46 |
+
GRADER = "grader"
|
| 47 |
+
SUCCESS_LINE = "Your solution is okay!"
|
| 48 |
+
GRADE_THREADS = "2"
|
| 49 |
+
# Lake and Comparator wording when a build process is killed for running out of memory.
|
| 50 |
+
OOM_MARKERS = ("Lean exited with code 137", "Child exited with 137")
|
| 51 |
+
|
| 52 |
+
MAX_FILES = 20_000
|
| 53 |
+
MAX_FILE_BYTES = 64 << 20
|
| 54 |
+
MAX_TOTAL_BYTES = 768 << 20
|
| 55 |
+
# Submission.lean, or Submission/A/B.lean where each component is a Lean identifier: it starts with
|
| 56 |
+
# a letter or `_` and continues with letters, digits (subscripts like `₁` included), `_`, `'`, `!`, `?`.
|
| 57 |
+
# Unicode is allowed because Lean identifiers allow it (openai/math has a module named `Kappa₁`).
|
| 58 |
+
_COMPONENT = r"[^\W\d][\w'!?]*"
|
| 59 |
+
MEMBER = re.compile(rf"^Submission(?:/{_COMPONENT})*\.lean$")
|
| 60 |
+
MEMBER_DIR = re.compile(rf"^Submission(?:/{_COMPONENT})*/?$")
|
| 61 |
+
|
| 62 |
+
LAKEFILE = """import Lake
|
| 63 |
+
open Lake DSL
|
| 64 |
+
|
| 65 |
+
package openai_math where
|
| 66 |
+
leanOptions := #[⟨`autoImplicit, false⟩]
|
| 67 |
+
|
| 68 |
+
require mathlib from git
|
| 69 |
+
"https://github.com/leanprover-community/mathlib4.git" @ "d13f23b723b8a846827a245b89c10fc7d3f11612"
|
| 70 |
+
|
| 71 |
+
lean_lib Challenge
|
| 72 |
+
|
| 73 |
+
-- `Submission` and every `Submission.*` module it imports.
|
| 74 |
+
lean_lib Submission
|
| 75 |
+
"""
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
class Rejected(Exception):
|
| 79 |
+
"""The submission is invalid: reward 0."""
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
class GradingError(Exception):
|
| 83 |
+
"""The grading setup is broken: no reward, so the trial shows as errored."""
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def toolchain_bin() -> Path:
|
| 87 |
+
bins = sorted(Path("/opt/elan/toolchains").glob("*/bin"))
|
| 88 |
+
if len(bins) != 1:
|
| 89 |
+
raise GradingError(f"expected one Lean toolchain, found {bins}")
|
| 90 |
+
return bins[0]
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def unpack_submission(dest: Path) -> dict:
|
| 94 |
+
"""Copy the submission's .lean files into ``dest``; reject anything else."""
|
| 95 |
+
try:
|
| 96 |
+
st = SUBMISSION_TAR.lstat()
|
| 97 |
+
except FileNotFoundError:
|
| 98 |
+
raise Rejected("no submission: /workspace/Submission.lean was not found after the agent finished")
|
| 99 |
+
if not SUBMISSION_TAR.is_file() or SUBMISSION_TAR.is_symlink() or st.st_size > MAX_TOTAL_BYTES + (64 << 20):
|
| 100 |
+
raise Rejected("submission archive is not a regular file of acceptable size")
|
| 101 |
+
|
| 102 |
+
files, total = [], 0
|
| 103 |
+
try:
|
| 104 |
+
with tarfile.open(SUBMISSION_TAR, "r:") as tar:
|
| 105 |
+
for count, member in enumerate(tar):
|
| 106 |
+
if count > MAX_FILES * 2:
|
| 107 |
+
raise Rejected(f"submission has more than {MAX_FILES} entries")
|
| 108 |
+
name = member.name.removeprefix("./")
|
| 109 |
+
if member.isdir():
|
| 110 |
+
if not MEMBER_DIR.match(name):
|
| 111 |
+
raise Rejected(f"unexpected directory in submission: {name!r}")
|
| 112 |
+
continue
|
| 113 |
+
if not member.isreg():
|
| 114 |
+
raise Rejected(f"only regular .lean files are accepted, got {name!r}")
|
| 115 |
+
if not MEMBER.match(name):
|
| 116 |
+
raise Rejected(f"unexpected file in submission: {name!r} (only Submission.lean and Submission/**.lean)")
|
| 117 |
+
if member.size > MAX_FILE_BYTES:
|
| 118 |
+
raise Rejected(f"{name} is larger than {MAX_FILE_BYTES >> 20} MB")
|
| 119 |
+
total += member.size
|
| 120 |
+
if total > MAX_TOTAL_BYTES or len(files) >= MAX_FILES:
|
| 121 |
+
raise Rejected("submission is too large")
|
| 122 |
+
data = tar.extractfile(member).read(MAX_FILE_BYTES + 1)
|
| 123 |
+
try:
|
| 124 |
+
data.decode("utf-8")
|
| 125 |
+
except UnicodeDecodeError:
|
| 126 |
+
raise Rejected(f"{name} is not valid UTF-8")
|
| 127 |
+
target = dest / name
|
| 128 |
+
if target.exists():
|
| 129 |
+
raise Rejected(f"duplicate entry {name!r}")
|
| 130 |
+
target.parent.mkdir(parents=True, exist_ok=True)
|
| 131 |
+
target.write_bytes(data)
|
| 132 |
+
target.chmod(0o644)
|
| 133 |
+
files.append(name)
|
| 134 |
+
except tarfile.TarError as exc:
|
| 135 |
+
raise Rejected(f"submission archive is unreadable: {exc}")
|
| 136 |
+
if "Submission.lean" not in files:
|
| 137 |
+
raise Rejected("no submission: /workspace/Submission.lean was not found after the agent finished")
|
| 138 |
+
for d in (dest / "Submission",):
|
| 139 |
+
if d.exists():
|
| 140 |
+
for p in [d, *d.rglob("*")]:
|
| 141 |
+
if p.is_dir():
|
| 142 |
+
p.chmod(0o755)
|
| 143 |
+
return {"files": len(files), "bytes": total}
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def write_project(run: Path, config: dict) -> None:
|
| 147 |
+
(run / "lakefile.lean").write_text(LAKEFILE)
|
| 148 |
+
shutil.copy(LEAN_ENV / "lake-manifest.json", run / "lake-manifest.json")
|
| 149 |
+
shutil.copy(LEAN_ENV / "lean-toolchain", run / "lean-toolchain")
|
| 150 |
+
shutil.copy(TESTS / "Challenge.lean", run / "Challenge.lean")
|
| 151 |
+
comparator_config = {
|
| 152 |
+
"challenge_module": "Challenge",
|
| 153 |
+
"solution_module": "Submission",
|
| 154 |
+
"theorem_names": config["theorem_names"],
|
| 155 |
+
"definition_names": config["definition_names"],
|
| 156 |
+
"permitted_axioms": config["permitted_axioms"],
|
| 157 |
+
"enable_nanoda": False,
|
| 158 |
+
}
|
| 159 |
+
(run / "config.json").write_text(json.dumps(comparator_config, indent=2))
|
| 160 |
+
lake = run / ".lake"
|
| 161 |
+
lake.mkdir()
|
| 162 |
+
(lake / "packages").symlink_to(LEAN_ENV / ".lake" / "packages")
|
| 163 |
+
for p in run.iterdir():
|
| 164 |
+
if p.name != ".lake":
|
| 165 |
+
os.chmod(p, 0o644 if p.is_file() else 0o755, follow_symlinks=False)
|
| 166 |
+
uid = pwd.getpwnam(GRADER).pw_uid
|
| 167 |
+
os.chown(lake, uid, uid)
|
| 168 |
+
os.chmod(run, 0o755)
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def fresh_run(task: dict) -> Path:
|
| 172 |
+
"""A new, empty Lake project for one grading attempt."""
|
| 173 |
+
run = Path(tempfile.mkdtemp(prefix="run.", dir=RUN_ROOT))
|
| 174 |
+
write_project(run, task["comparator"])
|
| 175 |
+
return run
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
def ensure_readable(roots: tuple[str, ...] = ("/opt/elan", str(LEAN_ENV))) -> int:
|
| 179 |
+
"""Make the prebuilt toolchain and packages readable by the grader (never writable).
|
| 180 |
+
|
| 181 |
+
The image already does this; this only repairs an image built without it. It must touch
|
| 182 |
+
nothing that is already right: these files live in the image's lower overlay layer, and a
|
| 183 |
+
`chmod` on one copies it whole into the sandbox's writable layer. A blanket `chmod -R` took
|
| 184 |
+
535 s and used 8.7 GB of the 10 GB working disk. This walk only reads metadata (lstat).
|
| 185 |
+
Returns the number of entries changed.
|
| 186 |
+
"""
|
| 187 |
+
changed = 0
|
| 188 |
+
for root in roots:
|
| 189 |
+
for dirpath, dirnames, filenames in os.walk(root, followlinks=False):
|
| 190 |
+
for name in [*dirnames, *filenames]:
|
| 191 |
+
path = os.path.join(dirpath, name)
|
| 192 |
+
st = os.lstat(path)
|
| 193 |
+
if stat.S_ISDIR(st.st_mode):
|
| 194 |
+
want = (st.st_mode | 0o555) & ~0o022
|
| 195 |
+
elif stat.S_ISREG(st.st_mode):
|
| 196 |
+
want = (st.st_mode | 0o444) & ~0o022
|
| 197 |
+
else:
|
| 198 |
+
continue
|
| 199 |
+
if stat.S_IMODE(st.st_mode) != stat.S_IMODE(want):
|
| 200 |
+
os.chmod(path, stat.S_IMODE(want))
|
| 201 |
+
changed += 1
|
| 202 |
+
return changed
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def block_grader_network() -> None:
|
| 206 |
+
"""Reject every socket the grader user opens, loopback included.
|
| 207 |
+
|
| 208 |
+
landrun already denies TCP to the sandboxed build. This rule also covers the grader's own
|
| 209 |
+
processes outside landrun and services listening inside the sandbox.
|
| 210 |
+
"""
|
| 211 |
+
uid = str(pwd.getpwnam(GRADER).pw_uid)
|
| 212 |
+
for tool in ("iptables", "ip6tables"):
|
| 213 |
+
rule = ["OUTPUT", "-m", "owner", "--uid-owner", uid, "-j", "REJECT"]
|
| 214 |
+
if subprocess.run([tool, "-C", *rule], capture_output=True).returncode == 0:
|
| 215 |
+
continue
|
| 216 |
+
res = subprocess.run([tool, "-I", *rule], capture_output=True, text=True)
|
| 217 |
+
if res.returncode != 0:
|
| 218 |
+
raise GradingError(f"cannot install the {tool} rule for {GRADER}: {res.stderr.strip()}")
|
| 219 |
+
probe = subprocess.run(
|
| 220 |
+
["runuser", "-u", GRADER, "--", sys.executable, "-c",
|
| 221 |
+
"import socket,sys\n"
|
| 222 |
+
"s=socket.socket(); s.settimeout(3)\n"
|
| 223 |
+
"sys.exit(0 if s.connect_ex(('127.0.0.1', 2280)) == 0 else 1)"],
|
| 224 |
+
capture_output=True,
|
| 225 |
+
)
|
| 226 |
+
if probe.returncode == 0:
|
| 227 |
+
raise GradingError("the grader user can still open loopback connections")
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
def kill_grader() -> None:
|
| 231 |
+
for _ in range(20):
|
| 232 |
+
subprocess.run(["pkill", "-9", "-u", GRADER], capture_output=True)
|
| 233 |
+
if subprocess.run(["pgrep", "-u", GRADER], capture_output=True).returncode != 0:
|
| 234 |
+
return
|
| 235 |
+
time.sleep(0.5)
|
| 236 |
+
raise GradingError("could not stop the grader's processes")
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
def out_of_memory(out: str) -> bool:
|
| 240 |
+
return any(m in out for m in OOM_MARKERS)
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
def run_comparator(run: Path, timeout_sec: int, threads: str = GRADE_THREADS) -> tuple[int | None, str]:
|
| 244 |
+
env = {
|
| 245 |
+
"PATH": f"{toolchain_bin()}:/usr/local/bin:/usr/bin:/bin",
|
| 246 |
+
"HOME": str(run),
|
| 247 |
+
"LANG": "C.UTF-8",
|
| 248 |
+
"LEAN_ABORT_ON_PANIC": "1",
|
| 249 |
+
# Lean sees every host CPU, not the sandbox's 4; bound Lake's parallel builds so a large
|
| 250 |
+
# proof fits in 8 GB. Needs the image's Comparator, which passes this into landrun.
|
| 251 |
+
"LEAN_NUM_THREADS": threads,
|
| 252 |
+
}
|
| 253 |
+
cmd = [
|
| 254 |
+
"runuser", "-u", GRADER, "--", "env", "-i", *(f"{k}={v}" for k, v in env.items()),
|
| 255 |
+
"lake", "env", "comparator", "config.json",
|
| 256 |
+
]
|
| 257 |
+
code, stdout, stderr = run_with_timeout(
|
| 258 |
+
cmd, cwd=run, timeout_sec=timeout_sec,
|
| 259 |
+
kill_extra=lambda: subprocess.run(["pkill", "-9", "-u", GRADER], capture_output=True),
|
| 260 |
+
)
|
| 261 |
+
return code, stdout + "\n--- stderr ---\n" + stderr
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
def run_with_timeout(cmd: list[str], cwd: Path, timeout_sec: int, kill_extra=None) -> tuple[int | None, str, str]:
|
| 265 |
+
"""Run ``cmd``; on timeout kill its whole process tree and return code None.
|
| 266 |
+
|
| 267 |
+
`timeout(1)` only signals its direct child, so Lean processes started by Lake under landrun
|
| 268 |
+
kept the output pipe open and the grader waited past Harbor's own limit. Here the command
|
| 269 |
+
gets its own session; on timeout its process group is killed, and ``kill_extra`` (every
|
| 270 |
+
process of the grader user) catches anything that left the group.
|
| 271 |
+
"""
|
| 272 |
+
proc = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
| 273 |
+
text=True, errors="replace", start_new_session=True)
|
| 274 |
+
try:
|
| 275 |
+
stdout, stderr = proc.communicate(timeout=timeout_sec)
|
| 276 |
+
return proc.returncode, stdout, stderr
|
| 277 |
+
except subprocess.TimeoutExpired:
|
| 278 |
+
try:
|
| 279 |
+
os.killpg(proc.pid, signal.SIGKILL)
|
| 280 |
+
except ProcessLookupError:
|
| 281 |
+
pass
|
| 282 |
+
if kill_extra:
|
| 283 |
+
kill_extra()
|
| 284 |
+
stdout, stderr = proc.communicate()
|
| 285 |
+
return None, stdout, stderr
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
def classify(code: int | None, out: str) -> tuple[int | None, str]:
|
| 289 |
+
"""Map Comparator's result to (reward, reason). reward None means a grading error."""
|
| 290 |
+
if code == 0 and SUCCESS_LINE in out:
|
| 291 |
+
return 1, "accepted: statements match, only permitted axioms, kernel replay passed"
|
| 292 |
+
if "Building Submission" not in out:
|
| 293 |
+
# Comparator stopped before it touched the submission: the trusted challenge or the
|
| 294 |
+
# toolchain is broken (or too slow), which says nothing about the agent's proof.
|
| 295 |
+
return None, ("timed out before the submission was built" if code is None
|
| 296 |
+
else "the trusted Challenge failed to build or export")
|
| 297 |
+
if code is None:
|
| 298 |
+
return 0, "timed out while building or checking the submission"
|
| 299 |
+
tail = [l for l in out.splitlines() if l.strip() and "has local changes" not in l][-25:]
|
| 300 |
+
if out_of_memory(out):
|
| 301 |
+
return 0, "rejected: the build was killed, most likely out of memory (8 GB) | " + " | ".join(tail)[-3000:]
|
| 302 |
+
return 0, "rejected: " + " | ".join(tail)[-4000:]
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
def main() -> int:
|
| 306 |
+
VERIFIER_DIR.mkdir(parents=True, exist_ok=True)
|
| 307 |
+
os.chmod(VERIFIER_DIR, 0o755)
|
| 308 |
+
for name in ("reward.txt", "reward.json"):
|
| 309 |
+
(VERIFIER_DIR / name).unlink(missing_ok=True)
|
| 310 |
+
|
| 311 |
+
task = json.loads((TESTS / "task.json").read_text())
|
| 312 |
+
details: dict = {"task": task["challenge"], "started_at": time.time()}
|
| 313 |
+
reward: int | None = None
|
| 314 |
+
try:
|
| 315 |
+
RUN_ROOT.mkdir(mode=0o711, parents=True, exist_ok=True)
|
| 316 |
+
deadline = time.time() + int(task["grade_timeout_sec"])
|
| 317 |
+
run = fresh_run(task)
|
| 318 |
+
details["permission_fixes"] = ensure_readable()
|
| 319 |
+
block_grader_network()
|
| 320 |
+
details["submission"] = unpack_submission(run)
|
| 321 |
+
code, out = run_comparator(run, int(deadline - time.time()))
|
| 322 |
+
log = out
|
| 323 |
+
kill_grader()
|
| 324 |
+
if code not in (0, None) and out_of_memory(out) and deadline - time.time() > 60:
|
| 325 |
+
# Two Lean processes in parallel can exceed 8 GB on a heavy module. Retry once with one,
|
| 326 |
+
# in a fresh directory: the first attempt's .lake was written by the submission's own
|
| 327 |
+
# build and must not be trusted for the challenge.
|
| 328 |
+
run = fresh_run(task)
|
| 329 |
+
unpack_submission(run)
|
| 330 |
+
code, out = run_comparator(run, int(deadline - time.time()), threads="1")
|
| 331 |
+
log += "\n\n=== retried with one Lean process after running out of memory ===\n\n" + out
|
| 332 |
+
kill_grader()
|
| 333 |
+
details["retried_single_thread"] = True
|
| 334 |
+
(VERIFIER_DIR / "comparator.log").write_text(log)
|
| 335 |
+
reward, details["reason"] = classify(code, out)
|
| 336 |
+
details["comparator_exit"] = code
|
| 337 |
+
except Rejected as exc:
|
| 338 |
+
reward, details["reason"] = 0, f"rejected: {exc}"
|
| 339 |
+
except GradingError as exc:
|
| 340 |
+
reward, details["reason"] = None, f"grading error: {exc}"
|
| 341 |
+
finally:
|
| 342 |
+
try:
|
| 343 |
+
kill_grader()
|
| 344 |
+
except GradingError as exc:
|
| 345 |
+
reward, details["reason"] = None, f"grading error: {exc}"
|
| 346 |
+
details["reward"] = reward
|
| 347 |
+
details["finished_at"] = time.time()
|
| 348 |
+
(VERIFIER_DIR / "grading.json").write_text(json.dumps(details, indent=2))
|
| 349 |
+
print(json.dumps(details, indent=2))
|
| 350 |
+
if reward is not None:
|
| 351 |
+
(VERIFIER_DIR / "reward.txt").write_text(f"{reward}\n")
|
| 352 |
+
return 0
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
if __name__ == "__main__":
|
| 356 |
+
sys.exit(main())
|
generator/openai_math_harbor/templates/tests/test.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Runs in the separate verifier sandbox, which never ran agent code. See grade.py.
|
| 3 |
+
exec python3 /tests/grade.py
|
generator/tests/test_grade_unpack.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""The verifier's submission unpacking accepts only regular Submission*.lean files.
|
| 2 |
+
|
| 3 |
+
python -m unittest discover -s tests
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import importlib.util
|
| 9 |
+
import io
|
| 10 |
+
import tarfile
|
| 11 |
+
import tempfile
|
| 12 |
+
import unittest
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
GRADE = Path(__file__).parents[1] / "openai_math_harbor" / "templates" / "tests" / "grade.py"
|
| 16 |
+
spec = importlib.util.spec_from_file_location("grade", GRADE)
|
| 17 |
+
grade = importlib.util.module_from_spec(spec)
|
| 18 |
+
spec.loader.exec_module(grade)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def make_tar(path: Path, entries: list[tuple[str, str, bytes]]) -> None:
|
| 22 |
+
"""entries: (name, kind, data) with kind in reg/dir/sym/lnk/fifo."""
|
| 23 |
+
with tarfile.open(path, "w") as tar:
|
| 24 |
+
for name, kind, data in entries:
|
| 25 |
+
info = tarfile.TarInfo(name)
|
| 26 |
+
if kind == "reg":
|
| 27 |
+
info.size = len(data)
|
| 28 |
+
tar.addfile(info, io.BytesIO(data))
|
| 29 |
+
continue
|
| 30 |
+
info.type = {"dir": tarfile.DIRTYPE, "sym": tarfile.SYMTYPE, "lnk": tarfile.LNKTYPE,
|
| 31 |
+
"fifo": tarfile.FIFOTYPE}[kind]
|
| 32 |
+
info.linkname = data.decode()
|
| 33 |
+
tar.addfile(info)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class UnpackTest(unittest.TestCase):
|
| 37 |
+
def setUp(self):
|
| 38 |
+
self.tmp = Path(tempfile.mkdtemp())
|
| 39 |
+
self.tar = self.tmp / "submission.tar"
|
| 40 |
+
self.dest = self.tmp / "run"
|
| 41 |
+
self.dest.mkdir()
|
| 42 |
+
grade.SUBMISSION_TAR = self.tar
|
| 43 |
+
|
| 44 |
+
def unpack(self, entries):
|
| 45 |
+
make_tar(self.tar, entries)
|
| 46 |
+
return grade.unpack_submission(self.dest)
|
| 47 |
+
|
| 48 |
+
def test_accepts_root_and_modules(self):
|
| 49 |
+
info = self.unpack([
|
| 50 |
+
("Submission.lean", "reg", b"import Submission.A.B\n"),
|
| 51 |
+
("Submission", "dir", b""),
|
| 52 |
+
("Submission/A/B.lean", "reg", "theorem t : True := trivial -- ℕ\n".encode()),
|
| 53 |
+
])
|
| 54 |
+
self.assertEqual(info["files"], 2)
|
| 55 |
+
self.assertTrue((self.dest / "Submission" / "A" / "B.lean").is_file())
|
| 56 |
+
|
| 57 |
+
def test_accepts_unicode_identifiers(self):
|
| 58 |
+
info = self.unpack([
|
| 59 |
+
("Submission.lean", "reg", b"import Submission.Arith.Kappa\xe2\x82\x81\n"),
|
| 60 |
+
("Submission/Arith/Kappa₁.lean", "reg", b"theorem k : True := trivial\n"),
|
| 61 |
+
("Submission/αβ/Lemma'.lean", "reg", b""),
|
| 62 |
+
])
|
| 63 |
+
self.assertEqual(info["files"], 3)
|
| 64 |
+
|
| 65 |
+
def test_rejections(self):
|
| 66 |
+
cases = {
|
| 67 |
+
"missing root": [("Submission/A.lean", "reg", b"")],
|
| 68 |
+
"path traversal": [("Submission.lean", "reg", b""), ("Submission/../../etc/x.lean", "reg", b"")],
|
| 69 |
+
"absolute path": [("Submission.lean", "reg", b""), ("/tmp/Submission.lean", "reg", b"")],
|
| 70 |
+
"symlink": [("Submission.lean", "sym", b"/tests/Challenge.lean")],
|
| 71 |
+
"hardlink": [("Submission.lean", "reg", b""), ("Submission/X.lean", "lnk", b"Submission.lean")],
|
| 72 |
+
"fifo": [("Submission.lean", "reg", b""), ("Submission/X.lean", "fifo", b"")],
|
| 73 |
+
"other root": [("Submission.lean", "reg", b""), ("Challenge.lean", "reg", b"")],
|
| 74 |
+
"lakefile": [("Submission.lean", "reg", b""), ("lakefile.lean", "reg", b"")],
|
| 75 |
+
"non-lean": [("Submission.lean", "reg", b""), ("Submission/x.olean", "reg", b"")],
|
| 76 |
+
"bad module name": [("Submission.lean", "reg", b""), ("Submission/a-b.lean", "reg", b"")],
|
| 77 |
+
"digit first": [("Submission.lean", "reg", b""), ("Submission/1x.lean", "reg", b"")],
|
| 78 |
+
"dot component": [("Submission.lean", "reg", b""), ("Submission/../x.lean", "reg", b"")],
|
| 79 |
+
"space": [("Submission.lean", "reg", b""), ("Submission/a b.lean", "reg", b"")],
|
| 80 |
+
"non-utf8": [("Submission.lean", "reg", b"\xff\xfe")],
|
| 81 |
+
"duplicate": [("Submission.lean", "reg", b"a"), ("Submission.lean", "reg", b"b")],
|
| 82 |
+
}
|
| 83 |
+
for label, entries in cases.items():
|
| 84 |
+
with self.subTest(label):
|
| 85 |
+
for p in self.dest.iterdir():
|
| 86 |
+
import shutil
|
| 87 |
+
shutil.rmtree(p) if p.is_dir() else p.unlink()
|
| 88 |
+
with self.assertRaises(grade.Rejected):
|
| 89 |
+
self.unpack(entries)
|
| 90 |
+
self.assertFalse((self.tmp / "etc").exists())
|
| 91 |
+
|
| 92 |
+
def test_missing_archive(self):
|
| 93 |
+
with self.assertRaises(grade.Rejected):
|
| 94 |
+
grade.unpack_submission(self.dest)
|
| 95 |
+
|
| 96 |
+
def test_archive_symlink(self):
|
| 97 |
+
self.tar.symlink_to("/etc/hostname")
|
| 98 |
+
with self.assertRaises(grade.Rejected):
|
| 99 |
+
grade.unpack_submission(self.dest)
|
| 100 |
+
|
| 101 |
+
def test_timeout_kills_grandchildren(self):
|
| 102 |
+
import time
|
| 103 |
+
# A grandchild holding stdout open is what made the old `timeout`-based call hang.
|
| 104 |
+
start = time.time()
|
| 105 |
+
code, out, _ = grade.run_with_timeout(
|
| 106 |
+
["bash", "-c", "echo started; (sleep 120; echo late) & sleep 120"],
|
| 107 |
+
cwd=self.tmp, timeout_sec=2)
|
| 108 |
+
self.assertIsNone(code)
|
| 109 |
+
self.assertIn("started", out)
|
| 110 |
+
self.assertNotIn("late", out)
|
| 111 |
+
self.assertLess(time.time() - start, 15)
|
| 112 |
+
|
| 113 |
+
def test_run_with_timeout_normal_exit(self):
|
| 114 |
+
code, out, _ = grade.run_with_timeout(["bash", "-c", "echo ok; exit 3"], cwd=self.tmp, timeout_sec=10)
|
| 115 |
+
self.assertEqual((code, out.strip()), (3, "ok"))
|
| 116 |
+
|
| 117 |
+
def test_ensure_readable_touches_only_what_needs_it(self):
|
| 118 |
+
import os
|
| 119 |
+
root = self.tmp / "tree"; (root / "sub").mkdir(parents=True)
|
| 120 |
+
good, bad, writable = root / "good.olean", root / "sub" / "bad.olean", root / "w.olean"
|
| 121 |
+
for f in (good, bad, writable): f.write_text("x")
|
| 122 |
+
good.chmod(0o644); bad.chmod(0o600); writable.chmod(0o666)
|
| 123 |
+
before = os.stat(good).st_ctime_ns
|
| 124 |
+
changed = grade.ensure_readable((str(root),))
|
| 125 |
+
self.assertEqual(changed, 2)
|
| 126 |
+
self.assertEqual(bad.stat().st_mode & 0o777, 0o644)
|
| 127 |
+
self.assertEqual(writable.stat().st_mode & 0o777, 0o644)
|
| 128 |
+
self.assertEqual(os.stat(good).st_ctime_ns, before) # untouched: no overlay copy-up
|
| 129 |
+
self.assertEqual(grade.ensure_readable((str(root),)), 0)
|
| 130 |
+
|
| 131 |
+
def test_out_of_memory_detection(self):
|
| 132 |
+
self.assertTrue(grade.out_of_memory("✖ Building M\nerror: Lean exited with code 137\n"))
|
| 133 |
+
self.assertTrue(grade.out_of_memory("uncaught exception: Child exited with 137"))
|
| 134 |
+
self.assertFalse(grade.out_of_memory("uncaught exception: Child exited with 1"))
|
| 135 |
+
reward, reason = grade.classify(1, "Building Submission\nerror: Lean exited with code 137\n")
|
| 136 |
+
self.assertEqual(reward, 0)
|
| 137 |
+
self.assertIn("out of memory", reason)
|
| 138 |
+
|
| 139 |
+
def test_classify(self):
|
| 140 |
+
ok = "Building Challenge\nBuilding Submission\nYour solution is okay!\n"
|
| 141 |
+
self.assertEqual(grade.classify(0, ok)[0], 1)
|
| 142 |
+
self.assertEqual(grade.classify(1, ok)[0], 0) # success line but nonzero exit
|
| 143 |
+
self.assertEqual(grade.classify(0, "Building Submission\n")[0], 0) # exit 0, no success line
|
| 144 |
+
self.assertEqual(grade.classify(None, ok)[0], 0) # timeout
|
| 145 |
+
self.assertIsNone(grade.classify(1, "Building Challenge\nerror\n")[0]) # trusted side broke
|
| 146 |
+
self.assertIsNone(grade.classify(None, "Building Challenge\n")[0]) # timed out before the submission
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
if __name__ == "__main__":
|
| 150 |
+
unittest.main()
|
manifest.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
manifest.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3afe9e43520364a939417dd85aeec87f892c6c81fe54c6f9d0bb67650c4021d0
|
| 3 |
+
size 44329
|
registry.json
ADDED
|
@@ -0,0 +1,1429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"name": "openai-math-harbor",
|
| 4 |
+
"version": "1.0",
|
| 5 |
+
"description": "355 Lean 4 theorem-proving tasks from openai/math, graded by Comparator in a separate sandbox.",
|
| 6 |
+
"tasks": [
|
| 7 |
+
{
|
| 8 |
+
"name": "abhyankar-sathaye",
|
| 9 |
+
"path": "tasks/abhyankar-sathaye"
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"name": "affine-bernstein",
|
| 13 |
+
"path": "tasks/affine-bernstein"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"name": "algorithmic-thin-trees",
|
| 17 |
+
"path": "tasks/algorithmic-thin-trees"
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"name": "amplitude-damping",
|
| 21 |
+
"path": "tasks/amplitude-damping"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "artin-cat0",
|
| 25 |
+
"path": "tasks/artin-cat0"
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"name": "artin-parabolic-intersections",
|
| 29 |
+
"path": "tasks/artin-parabolic-intersections"
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"name": "asymptotically-minimal-littlewood",
|
| 33 |
+
"path": "tasks/asymptotically-minimal-littlewood"
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"name": "auslander-reiten",
|
| 37 |
+
"path": "tasks/auslander-reiten"
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"name": "backward-intertwiners",
|
| 41 |
+
"path": "tasks/backward-intertwiners"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "balanced-box-routing",
|
| 45 |
+
"path": "tasks/balanced-box-routing"
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"name": "balanced-ryser",
|
| 49 |
+
"path": "tasks/balanced-ryser"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"name": "balanced-three-stack",
|
| 53 |
+
"path": "tasks/balanced-three-stack"
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"name": "ball-packing",
|
| 57 |
+
"path": "tasks/ball-packing"
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"name": "ball-packing-necessity",
|
| 61 |
+
"path": "tasks/ball-packing-necessity"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"name": "barnette-hamiltonian",
|
| 65 |
+
"path": "tasks/barnette-hamiltonian"
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"name": "bass-torsion-free",
|
| 69 |
+
"path": "tasks/bass-torsion-free"
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"name": "bass-trace",
|
| 73 |
+
"path": "tasks/bass-trace"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"name": "benjamini-schramm",
|
| 77 |
+
"path": "tasks/benjamini-schramm"
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"name": "bernoulli-nonflat-in-seven",
|
| 81 |
+
"path": "tasks/bernoulli-nonflat-in-seven"
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"name": "biholder-transport",
|
| 85 |
+
"path": "tasks/biholder-transport"
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"name": "bin-packing-gap",
|
| 89 |
+
"path": "tasks/bin-packing-gap"
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"name": "binary-edit-lower",
|
| 93 |
+
"path": "tasks/binary-edit-lower"
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
"name": "binary-matching",
|
| 97 |
+
"path": "tasks/binary-matching"
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"name": "binary-sweep",
|
| 101 |
+
"path": "tasks/binary-sweep"
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"name": "bipartite-crossing",
|
| 105 |
+
"path": "tasks/bipartite-crossing"
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"name": "bogomolov-pop-injectivity",
|
| 109 |
+
"path": "tasks/bogomolov-pop-injectivity"
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"name": "boltzmann-nonuniqueness",
|
| 113 |
+
"path": "tasks/boltzmann-nonuniqueness"
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"name": "boone-higman",
|
| 117 |
+
"path": "tasks/boone-higman"
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"name": "borsuk-nine",
|
| 121 |
+
"path": "tasks/borsuk-nine"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"name": "bounded-recovery",
|
| 125 |
+
"path": "tasks/bounded-recovery"
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"name": "bounded-tree-potentials",
|
| 129 |
+
"path": "tasks/bounded-tree-potentials"
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"name": "bounded-treewidth-l1",
|
| 133 |
+
"path": "tasks/bounded-treewidth-l1"
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"name": "brenier",
|
| 137 |
+
"path": "tasks/brenier"
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"name": "brennan",
|
| 141 |
+
"path": "tasks/brennan"
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
"name": "brennan-sharp",
|
| 145 |
+
"path": "tasks/brennan-sharp"
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"name": "buffered-ising",
|
| 149 |
+
"path": "tasks/buffered-ising"
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"name": "c0-absorption",
|
| 153 |
+
"path": "tasks/c0-absorption"
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"name": "c1-entropy-counterexample",
|
| 157 |
+
"path": "tasks/c1-entropy-counterexample"
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"name": "ch-obstruction",
|
| 161 |
+
"path": "tasks/ch-obstruction"
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"name": "cks-bondi-penrose",
|
| 165 |
+
"path": "tasks/cks-bondi-penrose"
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"name": "cannon-geometric-action",
|
| 169 |
+
"path": "tasks/cannon-geometric-action"
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"name": "cayley-percolation",
|
| 173 |
+
"path": "tasks/cayley-percolation"
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"name": "character-criterion",
|
| 177 |
+
"path": "tasks/character-criterion"
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"name": "choiceless-polynomial-time",
|
| 181 |
+
"path": "tasks/choiceless-polynomial-time"
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"name": "circulant-hadamard",
|
| 185 |
+
"path": "tasks/circulant-hadamard"
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"name": "classical-on",
|
| 189 |
+
"path": "tasks/classical-on"
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"name": "clique-free-log",
|
| 193 |
+
"path": "tasks/clique-free-log"
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"name": "coboundary-expanders",
|
| 197 |
+
"path": "tasks/coboundary-expanders"
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"name": "common-bases-fpras",
|
| 201 |
+
"path": "tasks/common-bases-fpras"
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"name": "commuting-derivations",
|
| 205 |
+
"path": "tasks/commuting-derivations"
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"name": "compact-banach",
|
| 209 |
+
"path": "tasks/compact-banach"
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
"name": "complete-crossing",
|
| 213 |
+
"path": "tasks/complete-crossing"
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"name": "complete-crouzeix",
|
| 217 |
+
"path": "tasks/complete-crouzeix"
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"name": "complex-cancellation",
|
| 221 |
+
"path": "tasks/complex-cancellation"
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
"name": "conductivity",
|
| 225 |
+
"path": "tasks/conductivity"
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"name": "conjugate-points",
|
| 229 |
+
"path": "tasks/conjugate-points"
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"name": "contingency-tables",
|
| 233 |
+
"path": "tasks/contingency-tables"
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"name": "continuous-circle-weight",
|
| 237 |
+
"path": "tasks/continuous-circle-weight"
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"name": "continuum-transition",
|
| 241 |
+
"path": "tasks/continuum-transition"
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"name": "coordinate-sweeps",
|
| 245 |
+
"path": "tasks/coordinate-sweeps"
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"name": "coordinate-trace",
|
| 249 |
+
"path": "tasks/coordinate-trace"
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"name": "cotype",
|
| 253 |
+
"path": "tasks/cotype"
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"name": "coulomb-counterexample",
|
| 257 |
+
"path": "tasks/coulomb-counterexample"
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"name": "coulomb-ionization",
|
| 261 |
+
"path": "tasks/coulomb-ionization"
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"name": "coulomb-radii",
|
| 265 |
+
"path": "tasks/coulomb-radii"
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"name": "courtade-kumar",
|
| 269 |
+
"path": "tasks/courtade-kumar"
|
| 270 |
+
},
|
| 271 |
+
{
|
| 272 |
+
"name": "covering-density",
|
| 273 |
+
"path": "tasks/covering-density"
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"name": "critical-percolation",
|
| 277 |
+
"path": "tasks/critical-percolation"
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"name": "critical-sk",
|
| 281 |
+
"path": "tasks/critical-sk"
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"name": "critical-sk-mixing",
|
| 285 |
+
"path": "tasks/critical-sk-mixing"
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"name": "critical-strip-mass",
|
| 289 |
+
"path": "tasks/critical-strip-mass"
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"name": "critical-z3",
|
| 293 |
+
"path": "tasks/critical-z3"
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"name": "crouzeix-hilbert",
|
| 297 |
+
"path": "tasks/crouzeix-hilbert"
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"name": "cubic-torus",
|
| 301 |
+
"path": "tasks/cubic-torus"
|
| 302 |
+
},
|
| 303 |
+
{
|
| 304 |
+
"name": "cycle-decomposition",
|
| 305 |
+
"path": "tasks/cycle-decomposition"
|
| 306 |
+
},
|
| 307 |
+
{
|
| 308 |
+
"name": "cylinder-covering",
|
| 309 |
+
"path": "tasks/cylinder-covering"
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"name": "daugavet-moduli",
|
| 313 |
+
"path": "tasks/daugavet-moduli"
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"name": "degree-rigidity",
|
| 317 |
+
"path": "tasks/degree-rigidity"
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"name": "deligne-drinfeld",
|
| 321 |
+
"path": "tasks/deligne-drinfeld"
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
"name": "depth-five",
|
| 325 |
+
"path": "tasks/depth-five"
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"name": "depth-three",
|
| 329 |
+
"path": "tasks/depth-three"
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"name": "diamond-distortion",
|
| 333 |
+
"path": "tasks/diamond-distortion"
|
| 334 |
+
},
|
| 335 |
+
{
|
| 336 |
+
"name": "diluted-spin",
|
| 337 |
+
"path": "tasks/diluted-spin"
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"name": "dimension-ten-channel",
|
| 341 |
+
"path": "tasks/dimension-ten-channel"
|
| 342 |
+
},
|
| 343 |
+
{
|
| 344 |
+
"name": "dimension-ten-pair",
|
| 345 |
+
"path": "tasks/dimension-ten-pair"
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"name": "direct-crouzeix",
|
| 349 |
+
"path": "tasks/direct-crouzeix"
|
| 350 |
+
},
|
| 351 |
+
{
|
| 352 |
+
"name": "directed-feedback",
|
| 353 |
+
"path": "tasks/directed-feedback"
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"name": "directional-ballisticity",
|
| 357 |
+
"path": "tasks/directional-ballisticity"
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"name": "directional-walk",
|
| 361 |
+
"path": "tasks/directional-walk"
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"name": "discrete-lipschitz-free",
|
| 365 |
+
"path": "tasks/discrete-lipschitz-free"
|
| 366 |
+
},
|
| 367 |
+
{
|
| 368 |
+
"name": "disk-maximal",
|
| 369 |
+
"path": "tasks/disk-maximal"
|
| 370 |
+
},
|
| 371 |
+
{
|
| 372 |
+
"name": "dixmier",
|
| 373 |
+
"path": "tasks/dixmier"
|
| 374 |
+
},
|
| 375 |
+
{
|
| 376 |
+
"name": "dixmier-all-discrete",
|
| 377 |
+
"path": "tasks/dixmier-all-discrete"
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"name": "doubling-hilbert",
|
| 381 |
+
"path": "tasks/doubling-hilbert"
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
"name": "dutta-domain",
|
| 385 |
+
"path": "tasks/dutta-domain"
|
| 386 |
+
},
|
| 387 |
+
{
|
| 388 |
+
"name": "dyadic-avoidance",
|
| 389 |
+
"path": "tasks/dyadic-avoidance"
|
| 390 |
+
},
|
| 391 |
+
{
|
| 392 |
+
"name": "edit-approximation",
|
| 393 |
+
"path": "tasks/edit-approximation"
|
| 394 |
+
},
|
| 395 |
+
{
|
| 396 |
+
"name": "edit-distance",
|
| 397 |
+
"path": "tasks/edit-distance"
|
| 398 |
+
},
|
| 399 |
+
{
|
| 400 |
+
"name": "egyptian-fractions",
|
| 401 |
+
"path": "tasks/egyptian-fractions"
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
"name": "eilenberg-ganea",
|
| 405 |
+
"path": "tasks/eilenberg-ganea"
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"name": "elasticity-uniqueness",
|
| 409 |
+
"path": "tasks/elasticity-uniqueness"
|
| 410 |
+
},
|
| 411 |
+
{
|
| 412 |
+
"name": "elementary-positivity",
|
| 413 |
+
"path": "tasks/elementary-positivity"
|
| 414 |
+
},
|
| 415 |
+
{
|
| 416 |
+
"name": "entangled-games",
|
| 417 |
+
"path": "tasks/entangled-games"
|
| 418 |
+
},
|
| 419 |
+
{
|
| 420 |
+
"name": "entropy-photon-number",
|
| 421 |
+
"path": "tasks/entropy-photon-number"
|
| 422 |
+
},
|
| 423 |
+
{
|
| 424 |
+
"name": "euclidean-five-color",
|
| 425 |
+
"path": "tasks/euclidean-five-color"
|
| 426 |
+
},
|
| 427 |
+
{
|
| 428 |
+
"name": "euclidean-ramsey",
|
| 429 |
+
"path": "tasks/euclidean-ramsey"
|
| 430 |
+
},
|
| 431 |
+
{
|
| 432 |
+
"name": "euclidean-ramsey-circle",
|
| 433 |
+
"path": "tasks/euclidean-ramsey-circle"
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
"name": "euclidean-ramsey-nine",
|
| 437 |
+
"path": "tasks/euclidean-ramsey-nine"
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"name": "euclidean-ramsey-quadratic",
|
| 441 |
+
"path": "tasks/euclidean-ramsey-quadratic"
|
| 442 |
+
},
|
| 443 |
+
{
|
| 444 |
+
"name": "euclidean-ramsey-spherical",
|
| 445 |
+
"path": "tasks/euclidean-ramsey-spherical"
|
| 446 |
+
},
|
| 447 |
+
{
|
| 448 |
+
"name": "euclidean-ramsey-transitive",
|
| 449 |
+
"path": "tasks/euclidean-ramsey-transitive"
|
| 450 |
+
},
|
| 451 |
+
{
|
| 452 |
+
"name": "even-barker",
|
| 453 |
+
"path": "tasks/even-barker"
|
| 454 |
+
},
|
| 455 |
+
{
|
| 456 |
+
"name": "exact-fourier",
|
| 457 |
+
"path": "tasks/exact-fourier"
|
| 458 |
+
},
|
| 459 |
+
{
|
| 460 |
+
"name": "exact-infiniteness",
|
| 461 |
+
"path": "tasks/exact-infiniteness"
|
| 462 |
+
},
|
| 463 |
+
{
|
| 464 |
+
"name": "exact-quantum-factoring",
|
| 465 |
+
"path": "tasks/exact-quantum-factoring"
|
| 466 |
+
},
|
| 467 |
+
{
|
| 468 |
+
"name": "fkcrt",
|
| 469 |
+
"path": "tasks/fkcrt"
|
| 470 |
+
},
|
| 471 |
+
{
|
| 472 |
+
"name": "factor-generation",
|
| 473 |
+
"path": "tasks/factor-generation"
|
| 474 |
+
},
|
| 475 |
+
{
|
| 476 |
+
"name": "falconer-all-dimensions",
|
| 477 |
+
"path": "tasks/falconer-all-dimensions"
|
| 478 |
+
},
|
| 479 |
+
{
|
| 480 |
+
"name": "filling-coefficient",
|
| 481 |
+
"path": "tasks/filling-coefficient"
|
| 482 |
+
},
|
| 483 |
+
{
|
| 484 |
+
"name": "finite-circle",
|
| 485 |
+
"path": "tasks/finite-circle"
|
| 486 |
+
},
|
| 487 |
+
{
|
| 488 |
+
"name": "finite-congruence-graph",
|
| 489 |
+
"path": "tasks/finite-congruence-graph"
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
"name": "finite-entropy-separation",
|
| 493 |
+
"path": "tasks/finite-entropy-separation"
|
| 494 |
+
},
|
| 495 |
+
{
|
| 496 |
+
"name": "finite-factor",
|
| 497 |
+
"path": "tasks/finite-factor"
|
| 498 |
+
},
|
| 499 |
+
{
|
| 500 |
+
"name": "finitistic-asymmetry",
|
| 501 |
+
"path": "tasks/finitistic-asymmetry"
|
| 502 |
+
},
|
| 503 |
+
{
|
| 504 |
+
"name": "fixed-clause-threshold",
|
| 505 |
+
"path": "tasks/fixed-clause-threshold"
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
"name": "forced-navier-stokes-computation",
|
| 509 |
+
"path": "tasks/forced-navier-stokes-computation"
|
| 510 |
+
},
|
| 511 |
+
{
|
| 512 |
+
"name": "forest-space",
|
| 513 |
+
"path": "tasks/forest-space"
|
| 514 |
+
},
|
| 515 |
+
{
|
| 516 |
+
"name": "formula-hitting",
|
| 517 |
+
"path": "tasks/formula-hitting"
|
| 518 |
+
},
|
| 519 |
+
{
|
| 520 |
+
"name": "foulkes-howe",
|
| 521 |
+
"path": "tasks/foulkes-howe"
|
| 522 |
+
},
|
| 523 |
+
{
|
| 524 |
+
"name": "four-row-permanent",
|
| 525 |
+
"path": "tasks/four-row-permanent"
|
| 526 |
+
},
|
| 527 |
+
{
|
| 528 |
+
"name": "free-ising",
|
| 529 |
+
"path": "tasks/free-ising"
|
| 530 |
+
},
|
| 531 |
+
{
|
| 532 |
+
"name": "free-uniform-spanning-forest",
|
| 533 |
+
"path": "tasks/free-uniform-spanning-forest"
|
| 534 |
+
},
|
| 535 |
+
{
|
| 536 |
+
"name": "gamma-passage",
|
| 537 |
+
"path": "tasks/gamma-passage"
|
| 538 |
+
},
|
| 539 |
+
{
|
| 540 |
+
"name": "gaussian-finite-entropy",
|
| 541 |
+
"path": "tasks/gaussian-finite-entropy"
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"name": "gaussian-information",
|
| 545 |
+
"path": "tasks/gaussian-information"
|
| 546 |
+
},
|
| 547 |
+
{
|
| 548 |
+
"name": "gaussian-moat",
|
| 549 |
+
"path": "tasks/gaussian-moat"
|
| 550 |
+
},
|
| 551 |
+
{
|
| 552 |
+
"name": "gaussian-propeller",
|
| 553 |
+
"path": "tasks/gaussian-propeller"
|
| 554 |
+
},
|
| 555 |
+
{
|
| 556 |
+
"name": "gaussian-replacement",
|
| 557 |
+
"path": "tasks/gaussian-replacement"
|
| 558 |
+
},
|
| 559 |
+
{
|
| 560 |
+
"name": "general-mahler",
|
| 561 |
+
"path": "tasks/general-mahler"
|
| 562 |
+
},
|
| 563 |
+
{
|
| 564 |
+
"name": "generalized-star-height",
|
| 565 |
+
"path": "tasks/generalized-star-height"
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"name": "gotsman-linial",
|
| 569 |
+
"path": "tasks/gotsman-linial"
|
| 570 |
+
},
|
| 571 |
+
{
|
| 572 |
+
"name": "graham-spherical",
|
| 573 |
+
"path": "tasks/graham-spherical"
|
| 574 |
+
},
|
| 575 |
+
{
|
| 576 |
+
"name": "grothendieck-elementary-expansion",
|
| 577 |
+
"path": "tasks/grothendieck-elementary-expansion"
|
| 578 |
+
},
|
| 579 |
+
{
|
| 580 |
+
"name": "group-ring-determinant",
|
| 581 |
+
"path": "tasks/group-ring-determinant"
|
| 582 |
+
},
|
| 583 |
+
{
|
| 584 |
+
"name": "hadamard-cube-fiber",
|
| 585 |
+
"path": "tasks/hadamard-cube-fiber"
|
| 586 |
+
},
|
| 587 |
+
{
|
| 588 |
+
"name": "halving-lines",
|
| 589 |
+
"path": "tasks/halving-lines"
|
| 590 |
+
},
|
| 591 |
+
{
|
| 592 |
+
"name": "hard-sphere",
|
| 593 |
+
"path": "tasks/hard-sphere"
|
| 594 |
+
},
|
| 595 |
+
{
|
| 596 |
+
"name": "harmonic-artin",
|
| 597 |
+
"path": "tasks/harmonic-artin"
|
| 598 |
+
},
|
| 599 |
+
{
|
| 600 |
+
"name": "harmonic-growth",
|
| 601 |
+
"path": "tasks/harmonic-growth"
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"name": "heilbronn-triangle",
|
| 605 |
+
"path": "tasks/heilbronn-triangle"
|
| 606 |
+
},
|
| 607 |
+
{
|
| 608 |
+
"name": "heisenberg",
|
| 609 |
+
"path": "tasks/heisenberg"
|
| 610 |
+
},
|
| 611 |
+
{
|
| 612 |
+
"name": "henon-emden",
|
| 613 |
+
"path": "tasks/henon-emden"
|
| 614 |
+
},
|
| 615 |
+
{
|
| 616 |
+
"name": "hilbert-crouzeix",
|
| 617 |
+
"path": "tasks/hilbert-crouzeix"
|
| 618 |
+
},
|
| 619 |
+
{
|
| 620 |
+
"name": "honeycomb-bridge-finiteness",
|
| 621 |
+
"path": "tasks/honeycomb-bridge-finiteness"
|
| 622 |
+
},
|
| 623 |
+
{
|
| 624 |
+
"name": "honeycomb-free-energy",
|
| 625 |
+
"path": "tasks/honeycomb-free-energy"
|
| 626 |
+
},
|
| 627 |
+
{
|
| 628 |
+
"name": "hot-spots",
|
| 629 |
+
"path": "tasks/hot-spots"
|
| 630 |
+
},
|
| 631 |
+
{
|
| 632 |
+
"name": "hyperbolic-cones",
|
| 633 |
+
"path": "tasks/hyperbolic-cones"
|
| 634 |
+
},
|
| 635 |
+
{
|
| 636 |
+
"name": "hyperbolic-obstruction",
|
| 637 |
+
"path": "tasks/hyperbolic-obstruction"
|
| 638 |
+
},
|
| 639 |
+
{
|
| 640 |
+
"name": "hyperinvariant-subspaces",
|
| 641 |
+
"path": "tasks/hyperinvariant-subspaces"
|
| 642 |
+
},
|
| 643 |
+
{
|
| 644 |
+
"name": "independent-products",
|
| 645 |
+
"path": "tasks/independent-products"
|
| 646 |
+
},
|
| 647 |
+
{
|
| 648 |
+
"name": "independent-sets",
|
| 649 |
+
"path": "tasks/independent-sets"
|
| 650 |
+
},
|
| 651 |
+
{
|
| 652 |
+
"name": "individual-strong-infiniteness",
|
| 653 |
+
"path": "tasks/individual-strong-infiniteness"
|
| 654 |
+
},
|
| 655 |
+
{
|
| 656 |
+
"name": "infinite-matroid",
|
| 657 |
+
"path": "tasks/infinite-matroid"
|
| 658 |
+
},
|
| 659 |
+
{
|
| 660 |
+
"name": "infinite-matroid-corollaries",
|
| 661 |
+
"path": "tasks/infinite-matroid-corollaries"
|
| 662 |
+
},
|
| 663 |
+
{
|
| 664 |
+
"name": "interpolated-factors",
|
| 665 |
+
"path": "tasks/interpolated-factors"
|
| 666 |
+
},
|
| 667 |
+
{
|
| 668 |
+
"name": "irrational-rotation",
|
| 669 |
+
"path": "tasks/irrational-rotation"
|
| 670 |
+
},
|
| 671 |
+
{
|
| 672 |
+
"name": "irrational-triangle-billiard",
|
| 673 |
+
"path": "tasks/irrational-triangle-billiard"
|
| 674 |
+
},
|
| 675 |
+
{
|
| 676 |
+
"name": "ising-finiteness",
|
| 677 |
+
"path": "tasks/ising-finiteness"
|
| 678 |
+
},
|
| 679 |
+
{
|
| 680 |
+
"name": "isometric-immersion",
|
| 681 |
+
"path": "tasks/isometric-immersion"
|
| 682 |
+
},
|
| 683 |
+
{
|
| 684 |
+
"name": "kl-invariance",
|
| 685 |
+
"path": "tasks/kl-invariance"
|
| 686 |
+
},
|
| 687 |
+
{
|
| 688 |
+
"name": "k-median-recovery",
|
| 689 |
+
"path": "tasks/k-median-recovery"
|
| 690 |
+
},
|
| 691 |
+
{
|
| 692 |
+
"name": "k-median-refined-recovery",
|
| 693 |
+
"path": "tasks/k-median-refined-recovery"
|
| 694 |
+
},
|
| 695 |
+
{
|
| 696 |
+
"name": "k-median-threshold",
|
| 697 |
+
"path": "tasks/k-median-threshold"
|
| 698 |
+
},
|
| 699 |
+
{
|
| 700 |
+
"name": "k-server",
|
| 701 |
+
"path": "tasks/k-server"
|
| 702 |
+
},
|
| 703 |
+
{
|
| 704 |
+
"name": "kadison-ringrose",
|
| 705 |
+
"path": "tasks/kadison-ringrose"
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
"name": "kadison-similarity",
|
| 709 |
+
"path": "tasks/kadison-similarity"
|
| 710 |
+
},
|
| 711 |
+
{
|
| 712 |
+
"name": "kahler-splitting",
|
| 713 |
+
"path": "tasks/kahler-splitting"
|
| 714 |
+
},
|
| 715 |
+
{
|
| 716 |
+
"name": "kaplansky-direct-finiteness",
|
| 717 |
+
"path": "tasks/kaplansky-direct-finiteness"
|
| 718 |
+
},
|
| 719 |
+
{
|
| 720 |
+
"name": "kaplansky-finitely-presented",
|
| 721 |
+
"path": "tasks/kaplansky-finitely-presented"
|
| 722 |
+
},
|
| 723 |
+
{
|
| 724 |
+
"name": "kaplansky-quasitrace",
|
| 725 |
+
"path": "tasks/kaplansky-quasitrace"
|
| 726 |
+
},
|
| 727 |
+
{
|
| 728 |
+
"name": "kaplansky-stable-finiteness",
|
| 729 |
+
"path": "tasks/kaplansky-stable-finiteness"
|
| 730 |
+
},
|
| 731 |
+
{
|
| 732 |
+
"name": "kervaire",
|
| 733 |
+
"path": "tasks/kervaire"
|
| 734 |
+
},
|
| 735 |
+
{
|
| 736 |
+
"name": "laughlin",
|
| 737 |
+
"path": "tasks/laughlin"
|
| 738 |
+
},
|
| 739 |
+
{
|
| 740 |
+
"name": "laughlin-fock",
|
| 741 |
+
"path": "tasks/laughlin-fock"
|
| 742 |
+
},
|
| 743 |
+
{
|
| 744 |
+
"name": "laughlin-gap",
|
| 745 |
+
"path": "tasks/laughlin-gap"
|
| 746 |
+
},
|
| 747 |
+
{
|
| 748 |
+
"name": "laughlin-planar",
|
| 749 |
+
"path": "tasks/laughlin-planar"
|
| 750 |
+
},
|
| 751 |
+
{
|
| 752 |
+
"name": "lieb-thirring",
|
| 753 |
+
"path": "tasks/lieb-thirring"
|
| 754 |
+
},
|
| 755 |
+
{
|
| 756 |
+
"name": "lipschitz-equivalence",
|
| 757 |
+
"path": "tasks/lipschitz-equivalence"
|
| 758 |
+
},
|
| 759 |
+
{
|
| 760 |
+
"name": "lipschitz-hilbert",
|
| 761 |
+
"path": "tasks/lipschitz-hilbert"
|
| 762 |
+
},
|
| 763 |
+
{
|
| 764 |
+
"name": "list-hadwiger",
|
| 765 |
+
"path": "tasks/list-hadwiger"
|
| 766 |
+
},
|
| 767 |
+
{
|
| 768 |
+
"name": "little-finitistic",
|
| 769 |
+
"path": "tasks/little-finitistic"
|
| 770 |
+
},
|
| 771 |
+
{
|
| 772 |
+
"name": "littlewood-finite-flatness",
|
| 773 |
+
"path": "tasks/littlewood-finite-flatness"
|
| 774 |
+
},
|
| 775 |
+
{
|
| 776 |
+
"name": "log-brunn-minkowski",
|
| 777 |
+
"path": "tasks/log-brunn-minkowski"
|
| 778 |
+
},
|
| 779 |
+
{
|
| 780 |
+
"name": "log-concave-query",
|
| 781 |
+
"path": "tasks/log-concave-query"
|
| 782 |
+
},
|
| 783 |
+
{
|
| 784 |
+
"name": "log-kodaira-fiber-negative",
|
| 785 |
+
"path": "tasks/log-kodaira-fiber-negative"
|
| 786 |
+
},
|
| 787 |
+
{
|
| 788 |
+
"name": "mahler-conjecture",
|
| 789 |
+
"path": "tasks/mahler-conjecture"
|
| 790 |
+
},
|
| 791 |
+
{
|
| 792 |
+
"name": "markov-type",
|
| 793 |
+
"path": "tasks/markov-type"
|
| 794 |
+
},
|
| 795 |
+
{
|
| 796 |
+
"name": "mass-action",
|
| 797 |
+
"path": "tasks/mass-action"
|
| 798 |
+
},
|
| 799 |
+
{
|
| 800 |
+
"name": "matching-affine-lift",
|
| 801 |
+
"path": "tasks/matching-affine-lift"
|
| 802 |
+
},
|
| 803 |
+
{
|
| 804 |
+
"name": "matching-entropy",
|
| 805 |
+
"path": "tasks/matching-entropy"
|
| 806 |
+
},
|
| 807 |
+
{
|
| 808 |
+
"name": "matching-entropy-bounds",
|
| 809 |
+
"path": "tasks/matching-entropy-bounds"
|
| 810 |
+
},
|
| 811 |
+
{
|
| 812 |
+
"name": "matching-fpras",
|
| 813 |
+
"path": "tasks/matching-fpras"
|
| 814 |
+
},
|
| 815 |
+
{
|
| 816 |
+
"name": "matching-psd",
|
| 817 |
+
"path": "tasks/matching-psd"
|
| 818 |
+
},
|
| 819 |
+
{
|
| 820 |
+
"name": "matrix-fields",
|
| 821 |
+
"path": "tasks/matrix-fields"
|
| 822 |
+
},
|
| 823 |
+
{
|
| 824 |
+
"name": "matrix-removal",
|
| 825 |
+
"path": "tasks/matrix-removal"
|
| 826 |
+
},
|
| 827 |
+
{
|
| 828 |
+
"name": "matroid-prophet",
|
| 829 |
+
"path": "tasks/matroid-prophet"
|
| 830 |
+
},
|
| 831 |
+
{
|
| 832 |
+
"name": "matroid-secretary",
|
| 833 |
+
"path": "tasks/matroid-secretary"
|
| 834 |
+
},
|
| 835 |
+
{
|
| 836 |
+
"name": "maximal-seshadri-constants",
|
| 837 |
+
"path": "tasks/maximal-seshadri-constants"
|
| 838 |
+
},
|
| 839 |
+
{
|
| 840 |
+
"name": "memory-precision",
|
| 841 |
+
"path": "tasks/memory-precision"
|
| 842 |
+
},
|
| 843 |
+
{
|
| 844 |
+
"name": "metric-entropy-duality",
|
| 845 |
+
"path": "tasks/metric-entropy-duality"
|
| 846 |
+
},
|
| 847 |
+
{
|
| 848 |
+
"name": "metric-k-median",
|
| 849 |
+
"path": "tasks/metric-k-median"
|
| 850 |
+
},
|
| 851 |
+
{
|
| 852 |
+
"name": "midpoint-lenses",
|
| 853 |
+
"path": "tasks/midpoint-lenses"
|
| 854 |
+
},
|
| 855 |
+
{
|
| 856 |
+
"name": "min-uncut",
|
| 857 |
+
"path": "tasks/min-uncut"
|
| 858 |
+
},
|
| 859 |
+
{
|
| 860 |
+
"name": "nagata",
|
| 861 |
+
"path": "tasks/nagata"
|
| 862 |
+
},
|
| 863 |
+
{
|
| 864 |
+
"name": "naimark",
|
| 865 |
+
"path": "tasks/naimark"
|
| 866 |
+
},
|
| 867 |
+
{
|
| 868 |
+
"name": "navier-stokes-alternating",
|
| 869 |
+
"path": "tasks/navier-stokes-alternating"
|
| 870 |
+
},
|
| 871 |
+
{
|
| 872 |
+
"name": "navier-stokes-velocity",
|
| 873 |
+
"path": "tasks/navier-stokes-velocity"
|
| 874 |
+
},
|
| 875 |
+
{
|
| 876 |
+
"name": "nodal-length",
|
| 877 |
+
"path": "tasks/nodal-length"
|
| 878 |
+
},
|
| 879 |
+
{
|
| 880 |
+
"name": "noiseless-regression",
|
| 881 |
+
"path": "tasks/noiseless-regression"
|
| 882 |
+
},
|
| 883 |
+
{
|
| 884 |
+
"name": "odd-kaplansky",
|
| 885 |
+
"path": "tasks/odd-kaplansky"
|
| 886 |
+
},
|
| 887 |
+
{
|
| 888 |
+
"name": "one-way-liveness",
|
| 889 |
+
"path": "tasks/one-way-liveness"
|
| 890 |
+
},
|
| 891 |
+
{
|
| 892 |
+
"name": "optimal-max-cut",
|
| 893 |
+
"path": "tasks/optimal-max-cut"
|
| 894 |
+
},
|
| 895 |
+
{
|
| 896 |
+
"name": "ordinary-elliott",
|
| 897 |
+
"path": "tasks/ordinary-elliott"
|
| 898 |
+
},
|
| 899 |
+
{
|
| 900 |
+
"name": "parity-lifts",
|
| 901 |
+
"path": "tasks/parity-lifts"
|
| 902 |
+
},
|
| 903 |
+
{
|
| 904 |
+
"name": "partial-permutation",
|
| 905 |
+
"path": "tasks/partial-permutation"
|
| 906 |
+
},
|
| 907 |
+
{
|
| 908 |
+
"name": "partition-consistency",
|
| 909 |
+
"path": "tasks/partition-consistency"
|
| 910 |
+
},
|
| 911 |
+
{
|
| 912 |
+
"name": "partition-principle",
|
| 913 |
+
"path": "tasks/partition-principle"
|
| 914 |
+
},
|
| 915 |
+
{
|
| 916 |
+
"name": "perceptron-free-energy",
|
| 917 |
+
"path": "tasks/perceptron-free-energy"
|
| 918 |
+
},
|
| 919 |
+
{
|
| 920 |
+
"name": "perfect-completeness",
|
| 921 |
+
"path": "tasks/perfect-completeness"
|
| 922 |
+
},
|
| 923 |
+
{
|
| 924 |
+
"name": "periodic-group",
|
| 925 |
+
"path": "tasks/periodic-group"
|
| 926 |
+
},
|
| 927 |
+
{
|
| 928 |
+
"name": "periodic-tiling-three",
|
| 929 |
+
"path": "tasks/periodic-tiling-three"
|
| 930 |
+
},
|
| 931 |
+
{
|
| 932 |
+
"name": "permanent-cubic",
|
| 933 |
+
"path": "tasks/permanent-cubic"
|
| 934 |
+
},
|
| 935 |
+
{
|
| 936 |
+
"name": "petty-projection-volume",
|
| 937 |
+
"path": "tasks/petty-projection-volume"
|
| 938 |
+
},
|
| 939 |
+
{
|
| 940 |
+
"name": "pi-exponent",
|
| 941 |
+
"path": "tasks/pi-exponent"
|
| 942 |
+
},
|
| 943 |
+
{
|
| 944 |
+
"name": "pinched-kahler",
|
| 945 |
+
"path": "tasks/pinched-kahler"
|
| 946 |
+
},
|
| 947 |
+
{
|
| 948 |
+
"name": "pinned-distances",
|
| 949 |
+
"path": "tasks/pinned-distances"
|
| 950 |
+
},
|
| 951 |
+
{
|
| 952 |
+
"name": "planar-anderson-spectrum",
|
| 953 |
+
"path": "tasks/planar-anderson-spectrum"
|
| 954 |
+
},
|
| 955 |
+
{
|
| 956 |
+
"name": "planar-falconer",
|
| 957 |
+
"path": "tasks/planar-falconer"
|
| 958 |
+
},
|
| 959 |
+
{
|
| 960 |
+
"name": "planar-first-passage",
|
| 961 |
+
"path": "tasks/planar-first-passage"
|
| 962 |
+
},
|
| 963 |
+
{
|
| 964 |
+
"name": "planar-l1",
|
| 965 |
+
"path": "tasks/planar-l1"
|
| 966 |
+
},
|
| 967 |
+
{
|
| 968 |
+
"name": "planar-unit-distances",
|
| 969 |
+
"path": "tasks/planar-unit-distances"
|
| 970 |
+
},
|
| 971 |
+
{
|
| 972 |
+
"name": "plane-coloring",
|
| 973 |
+
"path": "tasks/plane-coloring"
|
| 974 |
+
},
|
| 975 |
+
{
|
| 976 |
+
"name": "posterior-replicas",
|
| 977 |
+
"path": "tasks/posterior-replicas"
|
| 978 |
+
},
|
| 979 |
+
{
|
| 980 |
+
"name": "power-free-values",
|
| 981 |
+
"path": "tasks/power-free-values"
|
| 982 |
+
},
|
| 983 |
+
{
|
| 984 |
+
"name": "prime-gaps",
|
| 985 |
+
"path": "tasks/prime-gaps"
|
| 986 |
+
},
|
| 987 |
+
{
|
| 988 |
+
"name": "product-brown",
|
| 989 |
+
"path": "tasks/product-brown"
|
| 990 |
+
},
|
| 991 |
+
{
|
| 992 |
+
"name": "projection-counterexample",
|
| 993 |
+
"path": "tasks/projection-counterexample"
|
| 994 |
+
},
|
| 995 |
+
{
|
| 996 |
+
"name": "projection-moments",
|
| 997 |
+
"path": "tasks/projection-moments"
|
| 998 |
+
},
|
| 999 |
+
{
|
| 1000 |
+
"name": "projection-volume",
|
| 1001 |
+
"path": "tasks/projection-volume"
|
| 1002 |
+
},
|
| 1003 |
+
{
|
| 1004 |
+
"name": "qac-parity",
|
| 1005 |
+
"path": "tasks/qac-parity"
|
| 1006 |
+
},
|
| 1007 |
+
{
|
| 1008 |
+
"name": "quadric-bundles",
|
| 1009 |
+
"path": "tasks/quadric-bundles"
|
| 1010 |
+
},
|
| 1011 |
+
{
|
| 1012 |
+
"name": "quantitative-van-der-waerden",
|
| 1013 |
+
"path": "tasks/quantitative-van-der-waerden"
|
| 1014 |
+
},
|
| 1015 |
+
{
|
| 1016 |
+
"name": "quintic-lienard",
|
| 1017 |
+
"path": "tasks/quintic-lienard"
|
| 1018 |
+
},
|
| 1019 |
+
{
|
| 1020 |
+
"name": "radial-density-interval",
|
| 1021 |
+
"path": "tasks/radial-density-interval"
|
| 1022 |
+
},
|
| 1023 |
+
{
|
| 1024 |
+
"name": "radial-transition",
|
| 1025 |
+
"path": "tasks/radial-transition"
|
| 1026 |
+
},
|
| 1027 |
+
{
|
| 1028 |
+
"name": "randomized-mean-payoff",
|
| 1029 |
+
"path": "tasks/randomized-mean-payoff"
|
| 1030 |
+
},
|
| 1031 |
+
{
|
| 1032 |
+
"name": "rational-hitting",
|
| 1033 |
+
"path": "tasks/rational-hitting"
|
| 1034 |
+
},
|
| 1035 |
+
{
|
| 1036 |
+
"name": "real-l1-renorming",
|
| 1037 |
+
"path": "tasks/real-l1-renorming"
|
| 1038 |
+
},
|
| 1039 |
+
{
|
| 1040 |
+
"name": "recursive-potentials",
|
| 1041 |
+
"path": "tasks/recursive-potentials"
|
| 1042 |
+
},
|
| 1043 |
+
{
|
| 1044 |
+
"name": "reflexive-fixed-points",
|
| 1045 |
+
"path": "tasks/reflexive-fixed-points"
|
| 1046 |
+
},
|
| 1047 |
+
{
|
| 1048 |
+
"name": "regular-parity",
|
| 1049 |
+
"path": "tasks/regular-parity"
|
| 1050 |
+
},
|
| 1051 |
+
{
|
| 1052 |
+
"name": "relative-generation",
|
| 1053 |
+
"path": "tasks/relative-generation"
|
| 1054 |
+
},
|
| 1055 |
+
{
|
| 1056 |
+
"name": "rokhlin",
|
| 1057 |
+
"path": "tasks/rokhlin"
|
| 1058 |
+
},
|
| 1059 |
+
{
|
| 1060 |
+
"name": "ruled-covering",
|
| 1061 |
+
"path": "tasks/ruled-covering"
|
| 1062 |
+
},
|
| 1063 |
+
{
|
| 1064 |
+
"name": "ryser-covering",
|
| 1065 |
+
"path": "tasks/ryser-covering"
|
| 1066 |
+
},
|
| 1067 |
+
{
|
| 1068 |
+
"name": "ryser-odd-extensions",
|
| 1069 |
+
"path": "tasks/ryser-odd-extensions"
|
| 1070 |
+
},
|
| 1071 |
+
{
|
| 1072 |
+
"name": "sat-sharpness",
|
| 1073 |
+
"path": "tasks/sat-sharpness"
|
| 1074 |
+
},
|
| 1075 |
+
{
|
| 1076 |
+
"name": "sat-variance",
|
| 1077 |
+
"path": "tasks/sat-variance"
|
| 1078 |
+
},
|
| 1079 |
+
{
|
| 1080 |
+
"name": "sk-full-support",
|
| 1081 |
+
"path": "tasks/sk-full-support"
|
| 1082 |
+
},
|
| 1083 |
+
{
|
| 1084 |
+
"name": "sk-value",
|
| 1085 |
+
"path": "tasks/sk-value"
|
| 1086 |
+
},
|
| 1087 |
+
{
|
| 1088 |
+
"name": "sle-lower-positivity",
|
| 1089 |
+
"path": "tasks/sle-lower-positivity"
|
| 1090 |
+
},
|
| 1091 |
+
{
|
| 1092 |
+
"name": "saxl",
|
| 1093 |
+
"path": "tasks/saxl"
|
| 1094 |
+
},
|
| 1095 |
+
{
|
| 1096 |
+
"name": "second-kahn-kalai",
|
| 1097 |
+
"path": "tasks/second-kahn-kalai"
|
| 1098 |
+
},
|
| 1099 |
+
{
|
| 1100 |
+
"name": "self-similar",
|
| 1101 |
+
"path": "tasks/self-similar"
|
| 1102 |
+
},
|
| 1103 |
+
{
|
| 1104 |
+
"name": "self-similar-corollaries",
|
| 1105 |
+
"path": "tasks/self-similar-corollaries"
|
| 1106 |
+
},
|
| 1107 |
+
{
|
| 1108 |
+
"name": "sensitivity-separation",
|
| 1109 |
+
"path": "tasks/sensitivity-separation"
|
| 1110 |
+
},
|
| 1111 |
+
{
|
| 1112 |
+
"name": "separable-quotient-negative",
|
| 1113 |
+
"path": "tasks/separable-quotient-negative"
|
| 1114 |
+
},
|
| 1115 |
+
{
|
| 1116 |
+
"name": "seymour-second-neighborhood",
|
| 1117 |
+
"path": "tasks/seymour-second-neighborhood"
|
| 1118 |
+
},
|
| 1119 |
+
{
|
| 1120 |
+
"name": "sharp-cat0-filling",
|
| 1121 |
+
"path": "tasks/sharp-cat0-filling"
|
| 1122 |
+
},
|
| 1123 |
+
{
|
| 1124 |
+
"name": "sharp-threshold",
|
| 1125 |
+
"path": "tasks/sharp-threshold"
|
| 1126 |
+
},
|
| 1127 |
+
{
|
| 1128 |
+
"name": "short-egyptian-fractions",
|
| 1129 |
+
"path": "tasks/short-egyptian-fractions"
|
| 1130 |
+
},
|
| 1131 |
+
{
|
| 1132 |
+
"name": "sidorenko-counterexample",
|
| 1133 |
+
"path": "tasks/sidorenko-counterexample"
|
| 1134 |
+
},
|
| 1135 |
+
{
|
| 1136 |
+
"name": "signed-finite-band",
|
| 1137 |
+
"path": "tasks/signed-finite-band"
|
| 1138 |
+
},
|
| 1139 |
+
{
|
| 1140 |
+
"name": "signed-sweep-moment",
|
| 1141 |
+
"path": "tasks/signed-sweep-moment"
|
| 1142 |
+
},
|
| 1143 |
+
{
|
| 1144 |
+
"name": "single-fold",
|
| 1145 |
+
"path": "tasks/single-fold"
|
| 1146 |
+
},
|
| 1147 |
+
{
|
| 1148 |
+
"name": "single-lattice-covering",
|
| 1149 |
+
"path": "tasks/single-lattice-covering"
|
| 1150 |
+
},
|
| 1151 |
+
{
|
| 1152 |
+
"name": "singleton-loop-matching",
|
| 1153 |
+
"path": "tasks/singleton-loop-matching"
|
| 1154 |
+
},
|
| 1155 |
+
{
|
| 1156 |
+
"name": "smooth-initial-form",
|
| 1157 |
+
"path": "tasks/smooth-initial-form"
|
| 1158 |
+
},
|
| 1159 |
+
{
|
| 1160 |
+
"name": "smooth-obstruction",
|
| 1161 |
+
"path": "tasks/smooth-obstruction"
|
| 1162 |
+
},
|
| 1163 |
+
{
|
| 1164 |
+
"name": "soft-channel204",
|
| 1165 |
+
"path": "tasks/soft-channel204"
|
| 1166 |
+
},
|
| 1167 |
+
{
|
| 1168 |
+
"name": "solenoidal-sheet-programs",
|
| 1169 |
+
"path": "tasks/solenoidal-sheet-programs"
|
| 1170 |
+
},
|
| 1171 |
+
{
|
| 1172 |
+
"name": "spherical-field",
|
| 1173 |
+
"path": "tasks/spherical-field"
|
| 1174 |
+
},
|
| 1175 |
+
{
|
| 1176 |
+
"name": "split-tangent-integrability",
|
| 1177 |
+
"path": "tasks/split-tangent-integrability"
|
| 1178 |
+
},
|
| 1179 |
+
{
|
| 1180 |
+
"name": "square-difference",
|
| 1181 |
+
"path": "tasks/square-difference"
|
| 1182 |
+
},
|
| 1183 |
+
{
|
| 1184 |
+
"name": "square-root-degree",
|
| 1185 |
+
"path": "tasks/square-root-degree"
|
| 1186 |
+
},
|
| 1187 |
+
{
|
| 1188 |
+
"name": "standard-map-entropy",
|
| 1189 |
+
"path": "tasks/standard-map-entropy"
|
| 1190 |
+
},
|
| 1191 |
+
{
|
| 1192 |
+
"name": "standard-map-lyapunov",
|
| 1193 |
+
"path": "tasks/standard-map-lyapunov"
|
| 1194 |
+
},
|
| 1195 |
+
{
|
| 1196 |
+
"name": "steinitz-bergstrom",
|
| 1197 |
+
"path": "tasks/steinitz-bergstrom"
|
| 1198 |
+
},
|
| 1199 |
+
{
|
| 1200 |
+
"name": "strict-means",
|
| 1201 |
+
"path": "tasks/strict-means"
|
| 1202 |
+
},
|
| 1203 |
+
{
|
| 1204 |
+
"name": "strong-thin-tree",
|
| 1205 |
+
"path": "tasks/strong-thin-tree"
|
| 1206 |
+
},
|
| 1207 |
+
{
|
| 1208 |
+
"name": "strongly-rayleigh-dpp",
|
| 1209 |
+
"path": "tasks/strongly-rayleigh-dpp"
|
| 1210 |
+
},
|
| 1211 |
+
{
|
| 1212 |
+
"name": "structural-crouzeix",
|
| 1213 |
+
"path": "tasks/structural-crouzeix"
|
| 1214 |
+
},
|
| 1215 |
+
{
|
| 1216 |
+
"name": "subpolynomial-lp",
|
| 1217 |
+
"path": "tasks/subpolynomial-lp"
|
| 1218 |
+
},
|
| 1219 |
+
{
|
| 1220 |
+
"name": "subsphere-current",
|
| 1221 |
+
"path": "tasks/subsphere-current"
|
| 1222 |
+
},
|
| 1223 |
+
{
|
| 1224 |
+
"name": "superstring",
|
| 1225 |
+
"path": "tasks/superstring"
|
| 1226 |
+
},
|
| 1227 |
+
{
|
| 1228 |
+
"name": "switch-chain",
|
| 1229 |
+
"path": "tasks/switch-chain"
|
| 1230 |
+
},
|
| 1231 |
+
{
|
| 1232 |
+
"name": "symmetric-domains",
|
| 1233 |
+
"path": "tasks/symmetric-domains"
|
| 1234 |
+
},
|
| 1235 |
+
{
|
| 1236 |
+
"name": "symmetric-mahler-equality",
|
| 1237 |
+
"path": "tasks/symmetric-mahler-equality"
|
| 1238 |
+
},
|
| 1239 |
+
{
|
| 1240 |
+
"name": "symmetric-polar",
|
| 1241 |
+
"path": "tasks/symmetric-polar"
|
| 1242 |
+
},
|
| 1243 |
+
{
|
| 1244 |
+
"name": "tachikawa",
|
| 1245 |
+
"path": "tasks/tachikawa"
|
| 1246 |
+
},
|
| 1247 |
+
{
|
| 1248 |
+
"name": "talagrand-discrete-convexity",
|
| 1249 |
+
"path": "tasks/talagrand-discrete-convexity"
|
| 1250 |
+
},
|
| 1251 |
+
{
|
| 1252 |
+
"name": "talagrand-expectation-threshold",
|
| 1253 |
+
"path": "tasks/talagrand-expectation-threshold"
|
| 1254 |
+
},
|
| 1255 |
+
{
|
| 1256 |
+
"name": "thomason-model-structures",
|
| 1257 |
+
"path": "tasks/thomason-model-structures"
|
| 1258 |
+
},
|
| 1259 |
+
{
|
| 1260 |
+
"name": "thompson-nonamenability",
|
| 1261 |
+
"path": "tasks/thompson-nonamenability"
|
| 1262 |
+
},
|
| 1263 |
+
{
|
| 1264 |
+
"name": "thorp-first-reciprocal",
|
| 1265 |
+
"path": "tasks/thorp-first-reciprocal"
|
| 1266 |
+
},
|
| 1267 |
+
{
|
| 1268 |
+
"name": "thorp-remaining",
|
| 1269 |
+
"path": "tasks/thorp-remaining"
|
| 1270 |
+
},
|
| 1271 |
+
{
|
| 1272 |
+
"name": "thorp-routing",
|
| 1273 |
+
"path": "tasks/thorp-routing"
|
| 1274 |
+
},
|
| 1275 |
+
{
|
| 1276 |
+
"name": "thorp-weighted-compatibility",
|
| 1277 |
+
"path": "tasks/thorp-weighted-compatibility"
|
| 1278 |
+
},
|
| 1279 |
+
{
|
| 1280 |
+
"name": "three-machine",
|
| 1281 |
+
"path": "tasks/three-machine"
|
| 1282 |
+
},
|
| 1283 |
+
{
|
| 1284 |
+
"name": "three-state-supercritical",
|
| 1285 |
+
"path": "tasks/three-state-supercritical"
|
| 1286 |
+
},
|
| 1287 |
+
{
|
| 1288 |
+
"name": "three-state-tree-clauses",
|
| 1289 |
+
"path": "tasks/three-state-tree-clauses"
|
| 1290 |
+
},
|
| 1291 |
+
{
|
| 1292 |
+
"name": "three-torus",
|
| 1293 |
+
"path": "tasks/three-torus"
|
| 1294 |
+
},
|
| 1295 |
+
{
|
| 1296 |
+
"name": "tingley-sphere-isometry",
|
| 1297 |
+
"path": "tasks/tingley-sphere-isometry"
|
| 1298 |
+
},
|
| 1299 |
+
{
|
| 1300 |
+
"name": "torsion-free-hyperbolic",
|
| 1301 |
+
"path": "tasks/torsion-free-hyperbolic"
|
| 1302 |
+
},
|
| 1303 |
+
{
|
| 1304 |
+
"name": "torsion-free-zero-divisors",
|
| 1305 |
+
"path": "tasks/torsion-free-zero-divisors"
|
| 1306 |
+
},
|
| 1307 |
+
{
|
| 1308 |
+
"name": "trace-reconstruction",
|
| 1309 |
+
"path": "tasks/trace-reconstruction"
|
| 1310 |
+
},
|
| 1311 |
+
{
|
| 1312 |
+
"name": "tree-edit",
|
| 1313 |
+
"path": "tasks/tree-edit"
|
| 1314 |
+
},
|
| 1315 |
+
{
|
| 1316 |
+
"name": "triangle-face",
|
| 1317 |
+
"path": "tasks/triangle-face"
|
| 1318 |
+
},
|
| 1319 |
+
{
|
| 1320 |
+
"name": "triangle-removal",
|
| 1321 |
+
"path": "tasks/triangle-removal"
|
| 1322 |
+
},
|
| 1323 |
+
{
|
| 1324 |
+
"name": "triangular-covering",
|
| 1325 |
+
"path": "tasks/triangular-covering"
|
| 1326 |
+
},
|
| 1327 |
+
{
|
| 1328 |
+
"name": "triangular-energy",
|
| 1329 |
+
"path": "tasks/triangular-energy"
|
| 1330 |
+
},
|
| 1331 |
+
{
|
| 1332 |
+
"name": "triangular-gaussian",
|
| 1333 |
+
"path": "tasks/triangular-gaussian"
|
| 1334 |
+
},
|
| 1335 |
+
{
|
| 1336 |
+
"name": "triangular-hilbert",
|
| 1337 |
+
"path": "tasks/triangular-hilbert"
|
| 1338 |
+
},
|
| 1339 |
+
{
|
| 1340 |
+
"name": "truffet-counterexample",
|
| 1341 |
+
"path": "tasks/truffet-counterexample"
|
| 1342 |
+
},
|
| 1343 |
+
{
|
| 1344 |
+
"name": "two-way-complementation",
|
| 1345 |
+
"path": "tasks/two-way-complementation"
|
| 1346 |
+
},
|
| 1347 |
+
{
|
| 1348 |
+
"name": "two-way-determinization",
|
| 1349 |
+
"path": "tasks/two-way-determinization"
|
| 1350 |
+
},
|
| 1351 |
+
{
|
| 1352 |
+
"name": "type-system-normalization",
|
| 1353 |
+
"path": "tasks/type-system-normalization"
|
| 1354 |
+
},
|
| 1355 |
+
{
|
| 1356 |
+
"name": "uniform-commutator",
|
| 1357 |
+
"path": "tasks/uniform-commutator"
|
| 1358 |
+
},
|
| 1359 |
+
{
|
| 1360 |
+
"name": "uniform-gamma",
|
| 1361 |
+
"path": "tasks/uniform-gamma"
|
| 1362 |
+
},
|
| 1363 |
+
{
|
| 1364 |
+
"name": "uniform-k-server",
|
| 1365 |
+
"path": "tasks/uniform-k-server"
|
| 1366 |
+
},
|
| 1367 |
+
{
|
| 1368 |
+
"name": "uniform-sparsest-cut",
|
| 1369 |
+
"path": "tasks/uniform-sparsest-cut"
|
| 1370 |
+
},
|
| 1371 |
+
{
|
| 1372 |
+
"name": "unique-games-theorem",
|
| 1373 |
+
"path": "tasks/unique-games-theorem"
|
| 1374 |
+
},
|
| 1375 |
+
{
|
| 1376 |
+
"name": "universal-f-infinity",
|
| 1377 |
+
"path": "tasks/universal-f-infinity"
|
| 1378 |
+
},
|
| 1379 |
+
{
|
| 1380 |
+
"name": "variable-wl",
|
| 1381 |
+
"path": "tasks/variable-wl"
|
| 1382 |
+
},
|
| 1383 |
+
{
|
| 1384 |
+
"name": "velocity-hemisphere",
|
| 1385 |
+
"path": "tasks/velocity-hemisphere"
|
| 1386 |
+
},
|
| 1387 |
+
{
|
| 1388 |
+
"name": "vertex-algebra-net",
|
| 1389 |
+
"path": "tasks/vertex-algebra-net"
|
| 1390 |
+
},
|
| 1391 |
+
{
|
| 1392 |
+
"name": "vertex-cover",
|
| 1393 |
+
"path": "tasks/vertex-cover"
|
| 1394 |
+
},
|
| 1395 |
+
{
|
| 1396 |
+
"name": "vlasov-maxwell",
|
| 1397 |
+
"path": "tasks/vlasov-maxwell"
|
| 1398 |
+
},
|
| 1399 |
+
{
|
| 1400 |
+
"name": "wl-identification",
|
| 1401 |
+
"path": "tasks/wl-identification"
|
| 1402 |
+
},
|
| 1403 |
+
{
|
| 1404 |
+
"name": "weak-hessian",
|
| 1405 |
+
"path": "tasks/weak-hessian"
|
| 1406 |
+
},
|
| 1407 |
+
{
|
| 1408 |
+
"name": "weak-mtw-global-support",
|
| 1409 |
+
"path": "tasks/weak-mtw-global-support"
|
| 1410 |
+
},
|
| 1411 |
+
{
|
| 1412 |
+
"name": "weighted-sweep-moments",
|
| 1413 |
+
"path": "tasks/weighted-sweep-moments"
|
| 1414 |
+
},
|
| 1415 |
+
{
|
| 1416 |
+
"name": "weisfeiler-leman",
|
| 1417 |
+
"path": "tasks/weisfeiler-leman"
|
| 1418 |
+
},
|
| 1419 |
+
{
|
| 1420 |
+
"name": "witnessed-choice",
|
| 1421 |
+
"path": "tasks/witnessed-choice"
|
| 1422 |
+
},
|
| 1423 |
+
{
|
| 1424 |
+
"name": "yau-counterexample",
|
| 1425 |
+
"path": "tasks/yau-counterexample"
|
| 1426 |
+
}
|
| 1427 |
+
]
|
| 1428 |
+
}
|
| 1429 |
+
]
|
tasks/abhyankar-sathaye/environment/Dockerfile
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Shared by every openai/math task (agent and separate verifier). See lean_setup.sh.
|
| 2 |
+
FROM ubuntu:24.04
|
| 3 |
+
ENV ELAN_HOME=/opt/elan \
|
| 4 |
+
PATH=/opt/elan/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
| 5 |
+
LANG=C.UTF-8
|
| 6 |
+
COPY lean_setup.sh fetch_mathlib.sh lakefile.lean lake-manifest.json pack_submission.py /opt/build/
|
| 7 |
+
RUN bash /opt/build/lean_setup.sh
|
| 8 |
+
WORKDIR /workspace
|
tasks/abhyankar-sathaye/environment/fetch_mathlib.sh
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Unpack Mathlib's prebuilt cache in batches and truncate the files that importing Mathlib never
|
| 3 |
+
# reads (generated C and .ilean editor indexes), keeping their .hash files so Lake still sees every
|
| 4 |
+
# module as built. Lean + full Mathlib otherwise needs ~11 GB, more than a 10 GB sandbox disk.
|
| 5 |
+
set -euo pipefail
|
| 6 |
+
cd /opt/lean-env
|
| 7 |
+
trim() {
|
| 8 |
+
find .lake/packages -path '*/.lake/build/*' \( -name '*.c' -o -name '*.ilean' \) -size +0 -exec truncate -s 0 {} +
|
| 9 |
+
rm -rf "${HOME:-/root}/.cache/mathlib"
|
| 10 |
+
}
|
| 11 |
+
for dir in .lake/packages/mathlib/Mathlib/*/; do
|
| 12 |
+
name=$(basename "$dir")
|
| 13 |
+
echo "== Mathlib/$name"
|
| 14 |
+
lake exe cache get ".lake/packages/mathlib/Mathlib/$name" >/dev/null
|
| 15 |
+
trim
|
| 16 |
+
df -h / | tail -1
|
| 17 |
+
done
|
| 18 |
+
lake exe cache get
|
| 19 |
+
trim
|
tasks/abhyankar-sathaye/environment/lake-manifest.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "1.2.0",
|
| 3 |
+
"packagesDir": ".lake/packages",
|
| 4 |
+
"packages": [
|
| 5 |
+
{
|
| 6 |
+
"url": "https://github.com/leanprover-community/mathlib4.git",
|
| 7 |
+
"type": "git",
|
| 8 |
+
"subDir": null,
|
| 9 |
+
"scope": "",
|
| 10 |
+
"rev": "d13f23b723b8a846827a245b89c10fc7d3f11612",
|
| 11 |
+
"name": "mathlib",
|
| 12 |
+
"manifestFile": "lake-manifest.json",
|
| 13 |
+
"inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612",
|
| 14 |
+
"inherited": false,
|
| 15 |
+
"configFile": "lakefile.lean"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"url": "https://github.com/leanprover-community/plausible",
|
| 19 |
+
"type": "git",
|
| 20 |
+
"subDir": null,
|
| 21 |
+
"scope": "leanprover-community",
|
| 22 |
+
"rev": "118aa17ee84656b8bd727fef7c458ee8c833385c",
|
| 23 |
+
"name": "plausible",
|
| 24 |
+
"manifestFile": "lake-manifest.json",
|
| 25 |
+
"inputRev": "main",
|
| 26 |
+
"inherited": true,
|
| 27 |
+
"configFile": "lakefile.toml"
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"url": "https://github.com/leanprover-community/LeanSearchClient",
|
| 31 |
+
"type": "git",
|
| 32 |
+
"subDir": null,
|
| 33 |
+
"scope": "leanprover-community",
|
| 34 |
+
"rev": "ddf04cf3949fa556442341e87d47f9f6e6074707",
|
| 35 |
+
"name": "LeanSearchClient",
|
| 36 |
+
"manifestFile": "lake-manifest.json",
|
| 37 |
+
"inputRev": "main",
|
| 38 |
+
"inherited": true,
|
| 39 |
+
"configFile": "lakefile.toml"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"url": "https://github.com/leanprover-community/import-graph",
|
| 43 |
+
"type": "git",
|
| 44 |
+
"subDir": null,
|
| 45 |
+
"scope": "leanprover-community",
|
| 46 |
+
"rev": "e928b72544873815af278d38681b31c0293588e3",
|
| 47 |
+
"name": "importGraph",
|
| 48 |
+
"manifestFile": "lake-manifest.json",
|
| 49 |
+
"inputRev": "main",
|
| 50 |
+
"inherited": true,
|
| 51 |
+
"configFile": "lakefile.toml"
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"url": "https://github.com/leanprover-community/ProofWidgets4",
|
| 55 |
+
"type": "git",
|
| 56 |
+
"subDir": null,
|
| 57 |
+
"scope": "leanprover-community",
|
| 58 |
+
"rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5",
|
| 59 |
+
"name": "proofwidgets",
|
| 60 |
+
"manifestFile": "lake-manifest.json",
|
| 61 |
+
"inputRev": "main",
|
| 62 |
+
"inherited": true,
|
| 63 |
+
"configFile": "lakefile.lean"
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"url": "https://github.com/leanprover-community/aesop",
|
| 67 |
+
"type": "git",
|
| 68 |
+
"subDir": null,
|
| 69 |
+
"scope": "leanprover-community",
|
| 70 |
+
"rev": "355695d523e41d0554926416cba2a2b3544fbbc9",
|
| 71 |
+
"name": "aesop",
|
| 72 |
+
"manifestFile": "lake-manifest.json",
|
| 73 |
+
"inputRev": "master",
|
| 74 |
+
"inherited": true,
|
| 75 |
+
"configFile": "lakefile.toml"
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"url": "https://github.com/leanprover-community/quote4",
|
| 79 |
+
"type": "git",
|
| 80 |
+
"subDir": null,
|
| 81 |
+
"scope": "leanprover-community",
|
| 82 |
+
"rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259",
|
| 83 |
+
"name": "Qq",
|
| 84 |
+
"manifestFile": "lake-manifest.json",
|
| 85 |
+
"inputRev": "master",
|
| 86 |
+
"inherited": true,
|
| 87 |
+
"configFile": "lakefile.toml"
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"url": "https://github.com/leanprover-community/batteries",
|
| 91 |
+
"type": "git",
|
| 92 |
+
"subDir": null,
|
| 93 |
+
"scope": "leanprover-community",
|
| 94 |
+
"rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2",
|
| 95 |
+
"name": "batteries",
|
| 96 |
+
"manifestFile": "lake-manifest.json",
|
| 97 |
+
"inputRev": "main",
|
| 98 |
+
"inherited": true,
|
| 99 |
+
"configFile": "lakefile.toml"
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"url": "https://github.com/leanprover/lean4-cli",
|
| 103 |
+
"type": "git",
|
| 104 |
+
"subDir": null,
|
| 105 |
+
"scope": "leanprover",
|
| 106 |
+
"rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204",
|
| 107 |
+
"name": "Cli",
|
| 108 |
+
"manifestFile": "lake-manifest.json",
|
| 109 |
+
"inputRev": "v4.34.0",
|
| 110 |
+
"inherited": true,
|
| 111 |
+
"configFile": "lakefile.toml"
|
| 112 |
+
}
|
| 113 |
+
],
|
| 114 |
+
"name": "openai_math",
|
| 115 |
+
"lakeDir": ".lake"
|
| 116 |
+
}
|
tasks/abhyankar-sathaye/environment/lakefile.lean
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Lake
|
| 2 |
+
open Lake DSL
|
| 3 |
+
|
| 4 |
+
-- Mathlib at the commit openai/math pins. Agents write `Submission.lean` and `Submission/**.lean`.
|
| 5 |
+
package openai_math where
|
| 6 |
+
leanOptions := #[⟨`autoImplicit, false⟩]
|
| 7 |
+
|
| 8 |
+
require mathlib from git
|
| 9 |
+
"https://github.com/leanprover-community/mathlib4.git" @ "d13f23b723b8a846827a245b89c10fc7d3f11612"
|
| 10 |
+
|
| 11 |
+
-- `Submission` and every `Submission.*` module it imports.
|
| 12 |
+
lean_lib Submission
|
tasks/abhyankar-sathaye/environment/lean_setup.sh
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Builds the image shared by every openai/math task, for both the agent and the separate verifier:
|
| 3 |
+
# - Lean v4.34.1 and Mathlib d13f23b, the versions openai/math pins (Mathlib only, no OAI library)
|
| 4 |
+
# - Comparator, lean4export and landrun, used only by the verifier's grade.py
|
| 5 |
+
# - every challenge statement, at /opt/openai-math/challenges/<Name>.lean
|
| 6 |
+
# - /workspace, a Lake project where the agent writes Submission.lean
|
| 7 |
+
# All revisions are pinned. The openai/math library (the reference proofs) is never installed.
|
| 8 |
+
set -euxo pipefail
|
| 9 |
+
export DEBIAN_FRONTEND=noninteractive
|
| 10 |
+
|
| 11 |
+
LEAN_TOOLCHAIN=leanprover/lean4:v4.34.1
|
| 12 |
+
OPENAI_MATH_REV=adc7f1241b42e322a6451854ab7e4b4c146bf78a
|
| 13 |
+
COMPARATOR_REV=d03acab154d269c06e60e4de7e4cc85deebff94b # "bump toolchain to v4.34.0"; built with v4.34.1
|
| 14 |
+
LANDRUN_REV=811cfff51ceaf3d9843708aa6d22e9b84ccac8b4
|
| 15 |
+
GO_VERSION=1.24.7
|
| 16 |
+
|
| 17 |
+
apt-get update -qq
|
| 18 |
+
apt-get install -y -qq --no-install-recommends git curl ca-certificates build-essential xz-utils \
|
| 19 |
+
zstd python3 procps iproute2 iptables tmux >/dev/null
|
| 20 |
+
rm -rf /var/lib/apt/lists/*
|
| 21 |
+
git config --system --add safe.directory '*'
|
| 22 |
+
|
| 23 |
+
export ELAN_HOME=/opt/elan PATH=/opt/elan/bin:$PATH
|
| 24 |
+
curl -sSfL https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh \
|
| 25 |
+
| sh -s -- -y --default-toolchain "$LEAN_TOOLCHAIN" --no-modify-path
|
| 26 |
+
|
| 27 |
+
# --- Verifier tools, built before Mathlib so the build trees are gone before the big download ---
|
| 28 |
+
curl -sSfL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /tmp -xz
|
| 29 |
+
GOBIN=/usr/local/bin GOPATH=/tmp/gopath GOCACHE=/tmp/gocache \
|
| 30 |
+
/tmp/go/bin/go install "github.com/zouuup/landrun/cmd/landrun@${LANDRUN_REV}"
|
| 31 |
+
rm -rf /tmp/go /tmp/gopath /tmp/gocache
|
| 32 |
+
|
| 33 |
+
git clone -q https://github.com/leanprover/comparator.git /tmp/comparator
|
| 34 |
+
(
|
| 35 |
+
cd /tmp/comparator
|
| 36 |
+
git checkout -q "$COMPARATOR_REV"
|
| 37 |
+
# Comparator passes only PATH/HOME/LEAN_ABORT_ON_PANIC into its landrun sandbox. Also pass
|
| 38 |
+
# LEAN_NUM_THREADS: Lean sees every host CPU (64) rather than the sandbox's 4, so without it Lake
|
| 39 |
+
# starts one Mathlib-loaded `lean` per module and an 8 GB sandbox runs out of memory. It bounds
|
| 40 |
+
# parallelism only and does not affect what is checked.
|
| 41 |
+
sed -i 's/envPass := #\["PATH", "HOME", "LEAN_ABORT_ON_PANIC"\]/envPass := #["PATH", "HOME", "LEAN_ABORT_ON_PANIC", "LEAN_NUM_THREADS"]/; s/envPass := #\["PATH", "HOME", "LEAN_PATH", "LEAN_ABORT_ON_PANIC"\]/envPass := #["PATH", "HOME", "LEAN_PATH", "LEAN_ABORT_ON_PANIC", "LEAN_NUM_THREADS"]/' Main.lean
|
| 42 |
+
test "$(grep -c '"LEAN_NUM_THREADS"' Main.lean)" -eq 2
|
| 43 |
+
echo "$LEAN_TOOLCHAIN" > lean-toolchain
|
| 44 |
+
lake build lean4export comparator
|
| 45 |
+
install -m 0755 .lake/build/bin/comparator /usr/local/bin/comparator
|
| 46 |
+
install -m 0755 .lake/packages/lean4export/.lake/build/bin/lean4export /usr/local/bin/lean4export
|
| 47 |
+
)
|
| 48 |
+
rm -rf /tmp/comparator
|
| 49 |
+
|
| 50 |
+
# --- Lean project with Mathlib ---
|
| 51 |
+
# Packages are shallow clones at the manifest revisions, so Lake sees the right HEAD and never fetches.
|
| 52 |
+
mkdir -p /opt/lean-env/.lake/packages
|
| 53 |
+
cd /opt/lean-env
|
| 54 |
+
echo "$LEAN_TOOLCHAIN" > lean-toolchain
|
| 55 |
+
cp /opt/build/lakefile.lean /opt/build/lake-manifest.json .
|
| 56 |
+
python3 - <<'PY'
|
| 57 |
+
import json, subprocess
|
| 58 |
+
for p in json.load(open("lake-manifest.json"))["packages"]:
|
| 59 |
+
d = f".lake/packages/{p['name']}"
|
| 60 |
+
subprocess.run(["git", "init", "-q", d], check=True)
|
| 61 |
+
subprocess.run(["git", "-C", d, "remote", "add", "origin", p["url"]], check=True)
|
| 62 |
+
subprocess.run(["git", "-C", d, "fetch", "-q", "--depth", "1", "origin", p["rev"]], check=True)
|
| 63 |
+
subprocess.run(["git", "-C", d, "checkout", "-q", "FETCH_HEAD"], check=True)
|
| 64 |
+
PY
|
| 65 |
+
# Linking native executables (Comparator above, Mathlib's cache tool here) is the only use of the
|
| 66 |
+
# static libraries, LLVM and gcc; `lean` and `lake build` of a library need none of them. Dropping
|
| 67 |
+
# them before the Mathlib download keeps the build, and the image, under Daytona's 10 GB disk.
|
| 68 |
+
lake exe cache --help >/dev/null 2>&1 || true
|
| 69 |
+
find /opt/elan/toolchains/*/lib -name '*.a' -delete
|
| 70 |
+
rm -f /opt/elan/toolchains/*/lib/libLLVM* /opt/elan/toolchains/*/lib/libclang-cpp*
|
| 71 |
+
apt-get purge -y -qq $(dpkg-query -W -f '${binary:Package}\n' build-essential 'gcc-13*' 'g++-13*' \
|
| 72 |
+
'cpp-13*' 'libstdc++-13-dev*' 'libgcc-13-dev*' 2>/dev/null) >/dev/null || true
|
| 73 |
+
apt-get autoremove -y -qq >/dev/null || true
|
| 74 |
+
bash /opt/build/fetch_mathlib.sh
|
| 75 |
+
rm -f /opt/lean-env/.lake/packages/mathlib/.lake/build/bin/cache
|
| 76 |
+
|
| 77 |
+
# --- Challenge statements (public; the reference proofs are not fetched) ---
|
| 78 |
+
git init -q /tmp/oai && cd /tmp/oai
|
| 79 |
+
git remote add origin https://github.com/openai/math.git
|
| 80 |
+
git config core.sparseCheckout true
|
| 81 |
+
echo "lean/ComparatorChallenges/" > .git/info/sparse-checkout
|
| 82 |
+
git fetch -q --depth 1 --filter=blob:none origin "$OPENAI_MATH_REV"
|
| 83 |
+
git checkout -q FETCH_HEAD
|
| 84 |
+
mkdir -p /opt/openai-math/challenges
|
| 85 |
+
cp lean/ComparatorChallenges/*.lean /opt/openai-math/challenges/
|
| 86 |
+
cd / && rm -rf /tmp/oai
|
| 87 |
+
install -m 0755 /opt/build/pack_submission.py /opt/openai-math/pack_submission.py
|
| 88 |
+
|
| 89 |
+
# --- Agent workspace and the verifier's unprivileged user ---
|
| 90 |
+
mkdir -p /workspace/.lake
|
| 91 |
+
cp /opt/lean-env/lakefile.lean /opt/lean-env/lake-manifest.json /opt/lean-env/lean-toolchain /workspace/
|
| 92 |
+
ln -s /opt/lean-env/.lake/packages /workspace/.lake/packages
|
| 93 |
+
useradd --uid 2000 --create-home --shell /usr/sbin/nologin grader
|
| 94 |
+
mkdir -p /var/lib/oai-grade && chmod 0711 /var/lib/oai-grade
|
| 95 |
+
|
| 96 |
+
# Smoke test. The first build may rebuild a few dependency modules the cache lacks (they persist in
|
| 97 |
+
# the image); a second build must compile nothing but Submission, or agents would pay for it.
|
| 98 |
+
cd /workspace
|
| 99 |
+
printf 'import Mathlib\n\nexample : (2 : ℕ) + 2 = 4 := by norm_num\n' > Submission.lean
|
| 100 |
+
lake build Submission 2>&1 | grep -E 'Built|error' | grep -v 'Built Submission' | head -20 || true
|
| 101 |
+
echo '-- second build' >> Submission.lean
|
| 102 |
+
lake build Submission 2>&1 | tee /tmp/smoke.log
|
| 103 |
+
if grep 'Built' /tmp/smoke.log | grep -qv 'Built Submission'; then
|
| 104 |
+
echo "the prebuilt Mathlib is incomplete: a second build still compiled dependencies" >&2; exit 1
|
| 105 |
+
fi
|
| 106 |
+
rm -rf Submission.lean .lake/build /tmp/smoke.log
|
| 107 |
+
|
| 108 |
+
# Mathlib's cache tool unpacks files as 0600. The verifier builds as the unprivileged `grader` user,
|
| 109 |
+
# so everything must be world-readable (and stays root-owned, so not writable).
|
| 110 |
+
chmod -R a+rX /opt/elan /opt/lean-env /opt/openai-math
|
| 111 |
+
# Same smoke test as `grader`, in a scratch project like the one grade.py lays out.
|
| 112 |
+
smoke=$(mktemp -d /var/lib/oai-grade/smoke.XXXX)
|
| 113 |
+
cp /opt/lean-env/lakefile.lean /opt/lean-env/lake-manifest.json /opt/lean-env/lean-toolchain "$smoke/"
|
| 114 |
+
mkdir "$smoke/.lake" && ln -s /opt/lean-env/.lake/packages "$smoke/.lake/packages"
|
| 115 |
+
printf 'import Mathlib\n\nexample : (2 : ℕ) + 2 = 4 := by norm_num\n' > "$smoke/Submission.lean"
|
| 116 |
+
chmod 0755 "$smoke" && chown grader "$smoke/.lake"
|
| 117 |
+
(cd "$smoke" && runuser -u grader -- env -i PATH="$(echo /opt/elan/toolchains/*/bin):/usr/bin:/bin" HOME="$smoke" \
|
| 118 |
+
lake build Submission) 2>&1 | tee /tmp/smoke.log
|
| 119 |
+
if grep 'Built' /tmp/smoke.log | grep -qv 'Built Submission' || ! grep -q 'Build completed successfully' /tmp/smoke.log; then
|
| 120 |
+
echo "the grader user cannot build against the prebuilt Mathlib" >&2; exit 1
|
| 121 |
+
fi
|
| 122 |
+
rm -rf "$smoke" /tmp/smoke.log
|
| 123 |
+
|
| 124 |
+
rm -rf /opt/build /root/.cache
|
| 125 |
+
df -h / | tail -1
|
| 126 |
+
du -sh /opt/elan /opt/lean-env
|
tasks/abhyankar-sathaye/environment/pack_submission.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Pack the agent's proof into one file for the verifier.
|
| 3 |
+
|
| 4 |
+
Harbor runs this as a [[verifier.collect]] hook in the agent's sandbox after the agent finishes.
|
| 5 |
+
It clears /logs/artifacts and writes /logs/artifacts/submission.tar holding only regular
|
| 6 |
+
`Submission.lean` and `Submission/**.lean` files. Symlinks and other entries are skipped, never
|
| 7 |
+
followed, so only one plain file crosses to the verifier sandbox.
|
| 8 |
+
|
| 9 |
+
The agent's sandbox is untrusted, so the verifier re-checks every entry of the archive. This step
|
| 10 |
+
only keeps the transfer small and free of links.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
from __future__ import annotations
|
| 14 |
+
|
| 15 |
+
import os
|
| 16 |
+
import shutil
|
| 17 |
+
import stat
|
| 18 |
+
import tarfile
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
|
| 21 |
+
WORKSPACE = Path("/workspace")
|
| 22 |
+
OUT_DIR = Path("/logs/artifacts")
|
| 23 |
+
MAX_TOTAL_BYTES = 768 << 20
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def clear(directory: Path) -> None:
|
| 27 |
+
directory.mkdir(parents=True, exist_ok=True)
|
| 28 |
+
for entry in directory.iterdir():
|
| 29 |
+
if entry.is_dir() and not entry.is_symlink():
|
| 30 |
+
shutil.rmtree(entry)
|
| 31 |
+
else:
|
| 32 |
+
entry.unlink()
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def regular(path: Path) -> bool:
|
| 36 |
+
try:
|
| 37 |
+
return stat.S_ISREG(path.lstat().st_mode)
|
| 38 |
+
except OSError:
|
| 39 |
+
return False
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def main() -> None:
|
| 43 |
+
clear(OUT_DIR)
|
| 44 |
+
tmp = OUT_DIR / "submission.tar.part"
|
| 45 |
+
total = 0
|
| 46 |
+
with tarfile.open(tmp, "w", format=tarfile.PAX_FORMAT) as tar:
|
| 47 |
+
root = WORKSPACE / "Submission.lean"
|
| 48 |
+
if regular(root):
|
| 49 |
+
total += root.lstat().st_size
|
| 50 |
+
if total > MAX_TOTAL_BYTES:
|
| 51 |
+
raise SystemExit("submission exceeds the size limit")
|
| 52 |
+
tar.add(root, arcname="Submission.lean", recursive=False)
|
| 53 |
+
tree = WORKSPACE / "Submission"
|
| 54 |
+
if tree.is_dir() and not tree.is_symlink():
|
| 55 |
+
for dirpath, dirnames, filenames in os.walk(tree, followlinks=False):
|
| 56 |
+
dirnames[:] = [d for d in dirnames if not (Path(dirpath) / d).is_symlink()]
|
| 57 |
+
for name in sorted(filenames):
|
| 58 |
+
path = Path(dirpath) / name
|
| 59 |
+
if not name.endswith(".lean") or not regular(path):
|
| 60 |
+
continue
|
| 61 |
+
total += path.lstat().st_size
|
| 62 |
+
if total > MAX_TOTAL_BYTES:
|
| 63 |
+
raise SystemExit("submission exceeds the size limit")
|
| 64 |
+
tar.add(path, arcname=str(path.relative_to(WORKSPACE)), recursive=False)
|
| 65 |
+
tmp.rename(OUT_DIR / "submission.tar")
|
| 66 |
+
print(f"packed {total} bytes")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
if __name__ == "__main__":
|
| 70 |
+
main()
|
tasks/abhyankar-sathaye/instruction.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# openai/math challenge `AbhyankarSathaye` (family 049)
|
| 2 |
+
|
| 3 |
+
Prove the following result from OpenAI's [openai/math](https://github.com/openai/math) release in
|
| 4 |
+
Lean 4, with a proof the Lean kernel accepts.
|
| 5 |
+
|
| 6 |
+
Context: this statement belongs to family 049 of the release, *A stable-coordinate counterexample in four variables*
|
| 7 |
+
(Algebraic and complex geometry). The family as a whole: Constructs a polynomial in four complex variables that is not a coordinate but becomes one after adjoining a single variable, disproving the Stable Coordinate conjecture in four variables. Every fiber is affine three-space, yet none of its embeddings is rectifiable, also disproving the Abhyankar–Sathaye conjecture even when all fibers are affine spaces.
|
| 8 |
+
|
| 9 |
+
The challenge is `AbhyankarSathaye`, also at `/opt/openai-math/challenges/AbhyankarSathaye.lean`:
|
| 10 |
+
|
| 11 |
+
```lean
|
| 12 |
+
import Mathlib.Algebra.MvPolynomial.CommRing
|
| 13 |
+
import Mathlib.Basic.Complex.Basic
|
| 14 |
+
import Mathlib.RingTheory.Ideal.Quotient.Operations
|
| 15 |
+
|
| 16 |
+
namespace OAI
|
| 17 |
+
|
| 18 |
+
namespace AbhyankarSathaye
|
| 19 |
+
|
| 20 |
+
/-- In every dimension at least four, a polynomial can define affine space
|
| 21 |
+
without being a coordinate of the ambient polynomial ring. -/
|
| 22 |
+
theorem exists_noncoordinate_polynomial (n : ℕ) (hn : 4 ≤ n) :
|
| 23 |
+
∃ F : MvPolynomial (Fin n) ℂ,
|
| 24 |
+
Nonempty ((MvPolynomial (Fin n) ℂ ⧸ Ideal.span {F}) ≃ₐ[ℂ]
|
| 25 |
+
MvPolynomial (Fin (n - 1)) ℂ) ∧
|
| 26 |
+
¬ ∃ (equiv : MvPolynomial (Fin n) ℂ ≃ₐ[ℂ] MvPolynomial (Fin n) ℂ)
|
| 27 |
+
(index : Fin n), equiv (MvPolynomial.X index) = F := by
|
| 28 |
+
sorry
|
| 29 |
+
|
| 30 |
+
end AbhyankarSathaye
|
| 31 |
+
|
| 32 |
+
end OAI
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## What to submit
|
| 36 |
+
|
| 37 |
+
Write `/workspace/Submission.lean`. Start from a copy of the challenge:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
cp /opt/openai-math/challenges/AbhyankarSathaye.lean /workspace/Submission.lean
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
then replace every `sorry` with a proof. The file is graded on three things:
|
| 44 |
+
|
| 45 |
+
- **Same statements.** The theorem `OAI.AbhyankarSathaye.exists_noncoordinate_polynomial` must keep exactly the statement shown above: same names,
|
| 46 |
+
namespaces, binders and types. Every definition the statements use must stay exactly as written.
|
| 47 |
+
Change nothing except the proofs.
|
| 48 |
+
- **Standard axioms only.** Proofs may use only `propext`, `Quot.sound` and `Classical.choice`.
|
| 49 |
+
`sorry`, `admit`, new `axiom`s and `native_decide` (it introduces an axiom of its own) are rejected.
|
| 50 |
+
- **Keep the challenge's declarations as they are.** Put new lemmas and instances *after* the
|
| 51 |
+
definitions the statements use, or in a separate `Submission/*.lean` module. A declaration added
|
| 52 |
+
before them can change how they elaborate, and then they no longer match the challenge.
|
| 53 |
+
- **Kernel-checked.** The proofs are re-checked by the Lean kernel, not just the elaborator.
|
| 54 |
+
|
| 55 |
+
Long proofs can be split into modules under `/workspace/Submission/` (module names
|
| 56 |
+
`Submission.Foo`, `Submission.Foo.Bar`) imported from `Submission.lean`. Only `.lean` files at
|
| 57 |
+
those two paths are graded.
|
| 58 |
+
|
| 59 |
+
## Environment
|
| 60 |
+
|
| 61 |
+
- Lean `v4.34.1` and Mathlib at commit `d13f23b` are installed and prebuilt; `/workspace` is a
|
| 62 |
+
Lake project.
|
| 63 |
+
- The sandbox has 4 CPUs and 8 GB of memory; `LEAN_NUM_THREADS=3` keeps `lake build` to three
|
| 64 |
+
parallel jobs. Check your work with `cd /workspace && lake build Submission`. Add `#print axioms <name>` to see
|
| 65 |
+
which axioms a proof uses.
|
| 66 |
+
- There is no internet access. OpenAI's own proofs are not installed.
|
| 67 |
+
|
| 68 |
+
## Grading
|
| 69 |
+
|
| 70 |
+
When you finish, `Submission.lean` and `Submission/**.lean` are copied to a fresh machine and
|
| 71 |
+
checked with [Comparator](https://github.com/leanprover/comparator), the Lean FRO's proof checker.
|
| 72 |
+
The reward is 1 if Comparator accepts the proof and 0 otherwise. A partial proof scores 0.
|
tasks/abhyankar-sathaye/solution/closure.txt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Counterexample
|
| 2 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.CriticalPoint
|
| 3 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Fiber
|
| 4 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.FiberFormulas
|
| 5 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Identities
|
| 6 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Lifting
|
| 7 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.LiftingIdentities
|
| 8 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.LinearElimination
|
| 9 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.LinearPresentation
|
| 10 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.NonCoordinate
|
| 11 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Plane
|
| 12 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Presentation
|
| 13 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Quotient
|
| 14 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Reconstruction
|
| 15 |
+
OAI.AlgebraicGeometry.AbhyankarSathaye.Stabilization
|
tasks/abhyankar-sathaye/solution/reference.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Place openai/math's reference proof as a submission (used by the oracle's solve.sh).
|
| 3 |
+
|
| 4 |
+
Standalone: the adapter copies this file into every task's solution/ directory.
|
| 5 |
+
|
| 6 |
+
reference.py <openai-math lean dir> <closure.txt> <solution module> <workspace>
|
| 7 |
+
|
| 8 |
+
Each module in closure.txt (``OAI.A.B``) is copied from ``<lean>/OAI/A/B.lean`` to
|
| 9 |
+
``<workspace>/Submission/OAI/A/B.lean`` with ``import OAI.X`` rewritten to
|
| 10 |
+
``import Submission.OAI.X``; ``Submission.lean`` imports the solution module. Declaration names
|
| 11 |
+
are namespaces, not module paths, so the theorems keep the names the challenge expects.
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
from __future__ import annotations
|
| 15 |
+
|
| 16 |
+
import re
|
| 17 |
+
import sys
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
|
| 20 |
+
_IMPORT = re.compile(r"^(\s*(?:public\s+|private\s+)?(?:meta\s+)?import\s+(?:all\s+)?)(OAI(?:\.|\s|$))")
|
| 21 |
+
_HEADER_LINE = re.compile(r"^\s*(?:module\b|prelude\b|--|$)")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def rename_imports(text: str) -> str:
|
| 25 |
+
"""Rewrite ``import OAI...`` to ``import Submission.OAI...`` in the import header only."""
|
| 26 |
+
out, in_header, in_comment = [], True, False
|
| 27 |
+
for line in text.splitlines(keepends=True):
|
| 28 |
+
if in_header:
|
| 29 |
+
stripped = line.strip()
|
| 30 |
+
if in_comment:
|
| 31 |
+
in_comment = "-/" not in stripped
|
| 32 |
+
elif stripped.startswith("/-"):
|
| 33 |
+
in_comment = "-/" not in stripped[2:]
|
| 34 |
+
elif _IMPORT.match(line):
|
| 35 |
+
line = _IMPORT.sub(lambda m: m.group(1) + "Submission." + m.group(2), line, count=1)
|
| 36 |
+
elif not _HEADER_LINE.match(line) and not re.match(r"^\s*(?:public\s+|private\s+)?(?:meta\s+)?import\s", line):
|
| 37 |
+
in_header = False
|
| 38 |
+
out.append(line)
|
| 39 |
+
return "".join(out)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def module_path(root: Path, module: str) -> Path:
|
| 43 |
+
return root.joinpath(*module.split(".")).with_suffix(".lean")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def place(lean_dir: Path, modules: list[str], solution_module: str, workspace: Path) -> None:
|
| 47 |
+
for module in modules:
|
| 48 |
+
dst = module_path(workspace / "Submission", module)
|
| 49 |
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
| 50 |
+
dst.write_text(rename_imports(module_path(lean_dir, module).read_text(encoding="utf-8")), encoding="utf-8")
|
| 51 |
+
(workspace / "Submission.lean").write_text(f"import Submission.{solution_module}\n", encoding="utf-8")
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
lean_dir, closure_txt, solution_module, workspace = sys.argv[1:5]
|
| 56 |
+
modules = [m.strip() for m in Path(closure_txt).read_text().splitlines() if m.strip()]
|
| 57 |
+
place(Path(lean_dir), modules, solution_module, Path(workspace))
|
| 58 |
+
print(f"placed {len(modules)} reference modules for {solution_module}")
|
tasks/abhyankar-sathaye/solution/solve.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Oracle: submit openai/math's own proof of AbhyankarSathaye, i.e. module OAI.AlgebraicGeometry.AbhyankarSathaye.Counterexample and the
|
| 3 |
+
# 15 OAI modules it imports, placed under Submission/ (see reference.py).
|
| 4 |
+
set -euo pipefail
|
| 5 |
+
if [ -f /solution/reference.tar.gz ]; then
|
| 6 |
+
tar -xzf /solution/reference.tar.gz -C /workspace
|
| 7 |
+
else
|
| 8 |
+
# Fetch only those files at the pinned commit. The task blocks the network while the agent runs,
|
| 9 |
+
# so run the oracle with `harbor run ... --allow-agent-host github.com`.
|
| 10 |
+
tmp=$(mktemp -d)
|
| 11 |
+
git -C "$tmp" init -q
|
| 12 |
+
git -C "$tmp" remote add origin https://github.com/openai/math.git
|
| 13 |
+
git -C "$tmp" config core.sparseCheckout true
|
| 14 |
+
sed -e 's#\.#/#g' -e 's#^#/lean/#' -e 's#$#.lean#' /solution/closure.txt > "$tmp/.git/info/sparse-checkout"
|
| 15 |
+
git -C "$tmp" fetch -q --depth 1 --filter=blob:none origin adc7f1241b42e322a6451854ab7e4b4c146bf78a
|
| 16 |
+
git -C "$tmp" checkout -q FETCH_HEAD
|
| 17 |
+
python3 /solution/reference.py "$tmp/lean" /solution/closure.txt OAI.AlgebraicGeometry.AbhyankarSathaye.Counterexample /workspace
|
| 18 |
+
rm -rf "$tmp"
|
| 19 |
+
fi
|
| 20 |
+
echo "placed the reference proof of AbhyankarSathaye"
|
tasks/abhyankar-sathaye/task.toml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1.4"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
name = "openai-math/abhyankar-sathaye"
|
| 5 |
+
version = "1.0.0"
|
| 6 |
+
description = "Prove AbhyankarSathaye (openai/math family 049: A stable-coordinate counterexample in four variables) in Lean 4 with Mathlib; graded by Comparator in a separate sandbox."
|
| 7 |
+
keywords = ["lean4", "mathlib", "theorem-proving", "openai-math", "algebraic-and-complex-geometry"]
|
| 8 |
+
|
| 9 |
+
[metadata]
|
| 10 |
+
source = "https://github.com/openai/math"
|
| 11 |
+
source_commit = "adc7f1241b42e322a6451854ab7e4b4c146bf78a"
|
| 12 |
+
source_license = "Apache-2.0"
|
| 13 |
+
source_notice = "tests/Challenge.lean is lean/ComparatorChallenges/AbhyankarSathaye.lean from openai/math, (c) OpenAI, unchanged; see NOTICE at the dataset root"
|
| 14 |
+
challenge = "AbhyankarSathaye"
|
| 15 |
+
family = "049"
|
| 16 |
+
family_title = "A stable-coordinate counterexample in four variables"
|
| 17 |
+
subject = "Algebraic and complex geometry"
|
| 18 |
+
theorems = ["OAI.AbhyankarSathaye.exists_noncoordinate_polynomial"]
|
| 19 |
+
definition_holes = []
|
| 20 |
+
fixed_definitions = []
|
| 21 |
+
reference_module = "OAI.AlgebraicGeometry.AbhyankarSathaye.Counterexample"
|
| 22 |
+
reference_modules = 15
|
| 23 |
+
reference_lean_bytes = 55824
|
| 24 |
+
reference_requires_packages = []
|
| 25 |
+
oracle_result = "accepted"
|
| 26 |
+
oracle_grade_seconds = 463
|
| 27 |
+
difficulty = "research"
|
| 28 |
+
|
| 29 |
+
[agent]
|
| 30 |
+
timeout_sec = 14400
|
| 31 |
+
network_mode = "no-network"
|
| 32 |
+
|
| 33 |
+
[environment]
|
| 34 |
+
build_timeout_sec = 5400
|
| 35 |
+
cpus = 4
|
| 36 |
+
memory_mb = 8192
|
| 37 |
+
storage_mb = 10240
|
| 38 |
+
workdir = "/workspace"
|
| 39 |
+
# Lean sees all host CPUs rather than the sandbox's 4; this bounds `lake build` to 3 parallel jobs.
|
| 40 |
+
env = { LEAN_NUM_THREADS = "3" }
|
| 41 |
+
|
| 42 |
+
[verifier]
|
| 43 |
+
timeout_sec = 11750
|
| 44 |
+
environment_mode = "separate"
|
| 45 |
+
network_mode = "no-network"
|
| 46 |
+
|
| 47 |
+
[[verifier.collect]]
|
| 48 |
+
command = "python3 /opt/openai-math/pack_submission.py"
|
| 49 |
+
timeout_sec = 300
|
tasks/abhyankar-sathaye/tests/Challenge.lean
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.Algebra.MvPolynomial.CommRing
|
| 2 |
+
import Mathlib.Basic.Complex.Basic
|
| 3 |
+
import Mathlib.RingTheory.Ideal.Quotient.Operations
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
namespace AbhyankarSathaye
|
| 8 |
+
|
| 9 |
+
/-- In every dimension at least four, a polynomial can define affine space
|
| 10 |
+
without being a coordinate of the ambient polynomial ring. -/
|
| 11 |
+
theorem exists_noncoordinate_polynomial (n : ℕ) (hn : 4 ≤ n) :
|
| 12 |
+
∃ F : MvPolynomial (Fin n) ℂ,
|
| 13 |
+
Nonempty ((MvPolynomial (Fin n) ℂ ⧸ Ideal.span {F}) ≃ₐ[ℂ]
|
| 14 |
+
MvPolynomial (Fin (n - 1)) ℂ) ∧
|
| 15 |
+
¬ ∃ (equiv : MvPolynomial (Fin n) ℂ ≃ₐ[ℂ] MvPolynomial (Fin n) ℂ)
|
| 16 |
+
(index : Fin n), equiv (MvPolynomial.X index) = F := by
|
| 17 |
+
sorry
|
| 18 |
+
|
| 19 |
+
end AbhyankarSathaye
|
| 20 |
+
|
| 21 |
+
end OAI
|
tasks/abhyankar-sathaye/tests/grade.py
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Grade one openai/math challenge with Comparator.
|
| 3 |
+
|
| 4 |
+
This runs as root in a separate verifier sandbox that never executed agent code. The only input the
|
| 5 |
+
agent controls is /logs/artifacts/submission.tar. Everything else comes from /tests (this task's
|
| 6 |
+
trusted challenge and Comparator config) and from the image.
|
| 7 |
+
|
| 8 |
+
Steps:
|
| 9 |
+
1. Unpack submission.tar, accepting only regular `Submission.lean` / `Submission/**.lean` files.
|
| 10 |
+
2. Lay out a fresh Lake project: the trusted lakefile, Challenge.lean from /tests, the submission,
|
| 11 |
+
and the image's prebuilt Mathlib (root-owned, read-only to the grader).
|
| 12 |
+
3. Run `lake env comparator config.json` as the unprivileged `grader` user, with no network.
|
| 13 |
+
Comparator builds Challenge and Submission inside landrun, checks that every listed theorem
|
| 14 |
+
has exactly the challenge's statement, that only the permitted axioms are used, and replays
|
| 15 |
+
the proof through the Lean kernel.
|
| 16 |
+
4. Kill everything the grader started, then write the verdict.
|
| 17 |
+
|
| 18 |
+
reward.txt is 1 only when Comparator prints its success line and exits 0. A rejected or
|
| 19 |
+
non-compiling submission scores 0. A broken grading setup (the trusted Challenge fails to build,
|
| 20 |
+
the network block cannot be installed) writes no reward, so Harbor reports an error instead of a
|
| 21 |
+
score.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import json
|
| 27 |
+
import os
|
| 28 |
+
import pwd
|
| 29 |
+
import re
|
| 30 |
+
import shutil
|
| 31 |
+
import signal
|
| 32 |
+
import socket
|
| 33 |
+
import stat
|
| 34 |
+
import subprocess
|
| 35 |
+
import sys
|
| 36 |
+
import tarfile
|
| 37 |
+
import tempfile
|
| 38 |
+
import time
|
| 39 |
+
from pathlib import Path
|
| 40 |
+
|
| 41 |
+
TESTS = Path("/tests")
|
| 42 |
+
VERIFIER_DIR = Path("/logs/verifier")
|
| 43 |
+
SUBMISSION_TAR = Path("/logs/artifacts/submission.tar")
|
| 44 |
+
LEAN_ENV = Path("/opt/lean-env")
|
| 45 |
+
RUN_ROOT = Path("/var/lib/oai-grade")
|
| 46 |
+
GRADER = "grader"
|
| 47 |
+
SUCCESS_LINE = "Your solution is okay!"
|
| 48 |
+
GRADE_THREADS = "2"
|
| 49 |
+
# Lake and Comparator wording when a build process is killed for running out of memory.
|
| 50 |
+
OOM_MARKERS = ("Lean exited with code 137", "Child exited with 137")
|
| 51 |
+
|
| 52 |
+
MAX_FILES = 20_000
|
| 53 |
+
MAX_FILE_BYTES = 64 << 20
|
| 54 |
+
MAX_TOTAL_BYTES = 768 << 20
|
| 55 |
+
# Submission.lean, or Submission/A/B.lean where each component is a Lean identifier: it starts with
|
| 56 |
+
# a letter or `_` and continues with letters, digits (subscripts like `₁` included), `_`, `'`, `!`, `?`.
|
| 57 |
+
# Unicode is allowed because Lean identifiers allow it (openai/math has a module named `Kappa₁`).
|
| 58 |
+
_COMPONENT = r"[^\W\d][\w'!?]*"
|
| 59 |
+
MEMBER = re.compile(rf"^Submission(?:/{_COMPONENT})*\.lean$")
|
| 60 |
+
MEMBER_DIR = re.compile(rf"^Submission(?:/{_COMPONENT})*/?$")
|
| 61 |
+
|
| 62 |
+
LAKEFILE = """import Lake
|
| 63 |
+
open Lake DSL
|
| 64 |
+
|
| 65 |
+
package openai_math where
|
| 66 |
+
leanOptions := #[⟨`autoImplicit, false⟩]
|
| 67 |
+
|
| 68 |
+
require mathlib from git
|
| 69 |
+
"https://github.com/leanprover-community/mathlib4.git" @ "d13f23b723b8a846827a245b89c10fc7d3f11612"
|
| 70 |
+
|
| 71 |
+
lean_lib Challenge
|
| 72 |
+
|
| 73 |
+
-- `Submission` and every `Submission.*` module it imports.
|
| 74 |
+
lean_lib Submission
|
| 75 |
+
"""
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
class Rejected(Exception):
|
| 79 |
+
"""The submission is invalid: reward 0."""
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
class GradingError(Exception):
|
| 83 |
+
"""The grading setup is broken: no reward, so the trial shows as errored."""
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def toolchain_bin() -> Path:
|
| 87 |
+
bins = sorted(Path("/opt/elan/toolchains").glob("*/bin"))
|
| 88 |
+
if len(bins) != 1:
|
| 89 |
+
raise GradingError(f"expected one Lean toolchain, found {bins}")
|
| 90 |
+
return bins[0]
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def unpack_submission(dest: Path) -> dict:
|
| 94 |
+
"""Copy the submission's .lean files into ``dest``; reject anything else."""
|
| 95 |
+
try:
|
| 96 |
+
st = SUBMISSION_TAR.lstat()
|
| 97 |
+
except FileNotFoundError:
|
| 98 |
+
raise Rejected("no submission: /workspace/Submission.lean was not found after the agent finished")
|
| 99 |
+
if not SUBMISSION_TAR.is_file() or SUBMISSION_TAR.is_symlink() or st.st_size > MAX_TOTAL_BYTES + (64 << 20):
|
| 100 |
+
raise Rejected("submission archive is not a regular file of acceptable size")
|
| 101 |
+
|
| 102 |
+
files, total = [], 0
|
| 103 |
+
try:
|
| 104 |
+
with tarfile.open(SUBMISSION_TAR, "r:") as tar:
|
| 105 |
+
for count, member in enumerate(tar):
|
| 106 |
+
if count > MAX_FILES * 2:
|
| 107 |
+
raise Rejected(f"submission has more than {MAX_FILES} entries")
|
| 108 |
+
name = member.name.removeprefix("./")
|
| 109 |
+
if member.isdir():
|
| 110 |
+
if not MEMBER_DIR.match(name):
|
| 111 |
+
raise Rejected(f"unexpected directory in submission: {name!r}")
|
| 112 |
+
continue
|
| 113 |
+
if not member.isreg():
|
| 114 |
+
raise Rejected(f"only regular .lean files are accepted, got {name!r}")
|
| 115 |
+
if not MEMBER.match(name):
|
| 116 |
+
raise Rejected(f"unexpected file in submission: {name!r} (only Submission.lean and Submission/**.lean)")
|
| 117 |
+
if member.size > MAX_FILE_BYTES:
|
| 118 |
+
raise Rejected(f"{name} is larger than {MAX_FILE_BYTES >> 20} MB")
|
| 119 |
+
total += member.size
|
| 120 |
+
if total > MAX_TOTAL_BYTES or len(files) >= MAX_FILES:
|
| 121 |
+
raise Rejected("submission is too large")
|
| 122 |
+
data = tar.extractfile(member).read(MAX_FILE_BYTES + 1)
|
| 123 |
+
try:
|
| 124 |
+
data.decode("utf-8")
|
| 125 |
+
except UnicodeDecodeError:
|
| 126 |
+
raise Rejected(f"{name} is not valid UTF-8")
|
| 127 |
+
target = dest / name
|
| 128 |
+
if target.exists():
|
| 129 |
+
raise Rejected(f"duplicate entry {name!r}")
|
| 130 |
+
target.parent.mkdir(parents=True, exist_ok=True)
|
| 131 |
+
target.write_bytes(data)
|
| 132 |
+
target.chmod(0o644)
|
| 133 |
+
files.append(name)
|
| 134 |
+
except tarfile.TarError as exc:
|
| 135 |
+
raise Rejected(f"submission archive is unreadable: {exc}")
|
| 136 |
+
if "Submission.lean" not in files:
|
| 137 |
+
raise Rejected("no submission: /workspace/Submission.lean was not found after the agent finished")
|
| 138 |
+
for d in (dest / "Submission",):
|
| 139 |
+
if d.exists():
|
| 140 |
+
for p in [d, *d.rglob("*")]:
|
| 141 |
+
if p.is_dir():
|
| 142 |
+
p.chmod(0o755)
|
| 143 |
+
return {"files": len(files), "bytes": total}
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def write_project(run: Path, config: dict) -> None:
|
| 147 |
+
(run / "lakefile.lean").write_text(LAKEFILE)
|
| 148 |
+
shutil.copy(LEAN_ENV / "lake-manifest.json", run / "lake-manifest.json")
|
| 149 |
+
shutil.copy(LEAN_ENV / "lean-toolchain", run / "lean-toolchain")
|
| 150 |
+
shutil.copy(TESTS / "Challenge.lean", run / "Challenge.lean")
|
| 151 |
+
comparator_config = {
|
| 152 |
+
"challenge_module": "Challenge",
|
| 153 |
+
"solution_module": "Submission",
|
| 154 |
+
"theorem_names": config["theorem_names"],
|
| 155 |
+
"definition_names": config["definition_names"],
|
| 156 |
+
"permitted_axioms": config["permitted_axioms"],
|
| 157 |
+
"enable_nanoda": False,
|
| 158 |
+
}
|
| 159 |
+
(run / "config.json").write_text(json.dumps(comparator_config, indent=2))
|
| 160 |
+
lake = run / ".lake"
|
| 161 |
+
lake.mkdir()
|
| 162 |
+
(lake / "packages").symlink_to(LEAN_ENV / ".lake" / "packages")
|
| 163 |
+
for p in run.iterdir():
|
| 164 |
+
if p.name != ".lake":
|
| 165 |
+
os.chmod(p, 0o644 if p.is_file() else 0o755, follow_symlinks=False)
|
| 166 |
+
uid = pwd.getpwnam(GRADER).pw_uid
|
| 167 |
+
os.chown(lake, uid, uid)
|
| 168 |
+
os.chmod(run, 0o755)
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def fresh_run(task: dict) -> Path:
|
| 172 |
+
"""A new, empty Lake project for one grading attempt."""
|
| 173 |
+
run = Path(tempfile.mkdtemp(prefix="run.", dir=RUN_ROOT))
|
| 174 |
+
write_project(run, task["comparator"])
|
| 175 |
+
return run
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
def ensure_readable(roots: tuple[str, ...] = ("/opt/elan", str(LEAN_ENV))) -> int:
|
| 179 |
+
"""Make the prebuilt toolchain and packages readable by the grader (never writable).
|
| 180 |
+
|
| 181 |
+
The image already does this; this only repairs an image built without it. It must touch
|
| 182 |
+
nothing that is already right: these files live in the image's lower overlay layer, and a
|
| 183 |
+
`chmod` on one copies it whole into the sandbox's writable layer. A blanket `chmod -R` took
|
| 184 |
+
535 s and used 8.7 GB of the 10 GB working disk. This walk only reads metadata (lstat).
|
| 185 |
+
Returns the number of entries changed.
|
| 186 |
+
"""
|
| 187 |
+
changed = 0
|
| 188 |
+
for root in roots:
|
| 189 |
+
for dirpath, dirnames, filenames in os.walk(root, followlinks=False):
|
| 190 |
+
for name in [*dirnames, *filenames]:
|
| 191 |
+
path = os.path.join(dirpath, name)
|
| 192 |
+
st = os.lstat(path)
|
| 193 |
+
if stat.S_ISDIR(st.st_mode):
|
| 194 |
+
want = (st.st_mode | 0o555) & ~0o022
|
| 195 |
+
elif stat.S_ISREG(st.st_mode):
|
| 196 |
+
want = (st.st_mode | 0o444) & ~0o022
|
| 197 |
+
else:
|
| 198 |
+
continue
|
| 199 |
+
if stat.S_IMODE(st.st_mode) != stat.S_IMODE(want):
|
| 200 |
+
os.chmod(path, stat.S_IMODE(want))
|
| 201 |
+
changed += 1
|
| 202 |
+
return changed
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def block_grader_network() -> None:
|
| 206 |
+
"""Reject every socket the grader user opens, loopback included.
|
| 207 |
+
|
| 208 |
+
landrun already denies TCP to the sandboxed build. This rule also covers the grader's own
|
| 209 |
+
processes outside landrun and services listening inside the sandbox.
|
| 210 |
+
"""
|
| 211 |
+
uid = str(pwd.getpwnam(GRADER).pw_uid)
|
| 212 |
+
for tool in ("iptables", "ip6tables"):
|
| 213 |
+
rule = ["OUTPUT", "-m", "owner", "--uid-owner", uid, "-j", "REJECT"]
|
| 214 |
+
if subprocess.run([tool, "-C", *rule], capture_output=True).returncode == 0:
|
| 215 |
+
continue
|
| 216 |
+
res = subprocess.run([tool, "-I", *rule], capture_output=True, text=True)
|
| 217 |
+
if res.returncode != 0:
|
| 218 |
+
raise GradingError(f"cannot install the {tool} rule for {GRADER}: {res.stderr.strip()}")
|
| 219 |
+
probe = subprocess.run(
|
| 220 |
+
["runuser", "-u", GRADER, "--", sys.executable, "-c",
|
| 221 |
+
"import socket,sys\n"
|
| 222 |
+
"s=socket.socket(); s.settimeout(3)\n"
|
| 223 |
+
"sys.exit(0 if s.connect_ex(('127.0.0.1', 2280)) == 0 else 1)"],
|
| 224 |
+
capture_output=True,
|
| 225 |
+
)
|
| 226 |
+
if probe.returncode == 0:
|
| 227 |
+
raise GradingError("the grader user can still open loopback connections")
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
def kill_grader() -> None:
|
| 231 |
+
for _ in range(20):
|
| 232 |
+
subprocess.run(["pkill", "-9", "-u", GRADER], capture_output=True)
|
| 233 |
+
if subprocess.run(["pgrep", "-u", GRADER], capture_output=True).returncode != 0:
|
| 234 |
+
return
|
| 235 |
+
time.sleep(0.5)
|
| 236 |
+
raise GradingError("could not stop the grader's processes")
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
def out_of_memory(out: str) -> bool:
|
| 240 |
+
return any(m in out for m in OOM_MARKERS)
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
def run_comparator(run: Path, timeout_sec: int, threads: str = GRADE_THREADS) -> tuple[int | None, str]:
|
| 244 |
+
env = {
|
| 245 |
+
"PATH": f"{toolchain_bin()}:/usr/local/bin:/usr/bin:/bin",
|
| 246 |
+
"HOME": str(run),
|
| 247 |
+
"LANG": "C.UTF-8",
|
| 248 |
+
"LEAN_ABORT_ON_PANIC": "1",
|
| 249 |
+
# Lean sees every host CPU, not the sandbox's 4; bound Lake's parallel builds so a large
|
| 250 |
+
# proof fits in 8 GB. Needs the image's Comparator, which passes this into landrun.
|
| 251 |
+
"LEAN_NUM_THREADS": threads,
|
| 252 |
+
}
|
| 253 |
+
cmd = [
|
| 254 |
+
"runuser", "-u", GRADER, "--", "env", "-i", *(f"{k}={v}" for k, v in env.items()),
|
| 255 |
+
"lake", "env", "comparator", "config.json",
|
| 256 |
+
]
|
| 257 |
+
code, stdout, stderr = run_with_timeout(
|
| 258 |
+
cmd, cwd=run, timeout_sec=timeout_sec,
|
| 259 |
+
kill_extra=lambda: subprocess.run(["pkill", "-9", "-u", GRADER], capture_output=True),
|
| 260 |
+
)
|
| 261 |
+
return code, stdout + "\n--- stderr ---\n" + stderr
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
def run_with_timeout(cmd: list[str], cwd: Path, timeout_sec: int, kill_extra=None) -> tuple[int | None, str, str]:
|
| 265 |
+
"""Run ``cmd``; on timeout kill its whole process tree and return code None.
|
| 266 |
+
|
| 267 |
+
`timeout(1)` only signals its direct child, so Lean processes started by Lake under landrun
|
| 268 |
+
kept the output pipe open and the grader waited past Harbor's own limit. Here the command
|
| 269 |
+
gets its own session; on timeout its process group is killed, and ``kill_extra`` (every
|
| 270 |
+
process of the grader user) catches anything that left the group.
|
| 271 |
+
"""
|
| 272 |
+
proc = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
| 273 |
+
text=True, errors="replace", start_new_session=True)
|
| 274 |
+
try:
|
| 275 |
+
stdout, stderr = proc.communicate(timeout=timeout_sec)
|
| 276 |
+
return proc.returncode, stdout, stderr
|
| 277 |
+
except subprocess.TimeoutExpired:
|
| 278 |
+
try:
|
| 279 |
+
os.killpg(proc.pid, signal.SIGKILL)
|
| 280 |
+
except ProcessLookupError:
|
| 281 |
+
pass
|
| 282 |
+
if kill_extra:
|
| 283 |
+
kill_extra()
|
| 284 |
+
stdout, stderr = proc.communicate()
|
| 285 |
+
return None, stdout, stderr
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
def classify(code: int | None, out: str) -> tuple[int | None, str]:
|
| 289 |
+
"""Map Comparator's result to (reward, reason). reward None means a grading error."""
|
| 290 |
+
if code == 0 and SUCCESS_LINE in out:
|
| 291 |
+
return 1, "accepted: statements match, only permitted axioms, kernel replay passed"
|
| 292 |
+
if "Building Submission" not in out:
|
| 293 |
+
# Comparator stopped before it touched the submission: the trusted challenge or the
|
| 294 |
+
# toolchain is broken (or too slow), which says nothing about the agent's proof.
|
| 295 |
+
return None, ("timed out before the submission was built" if code is None
|
| 296 |
+
else "the trusted Challenge failed to build or export")
|
| 297 |
+
if code is None:
|
| 298 |
+
return 0, "timed out while building or checking the submission"
|
| 299 |
+
tail = [l for l in out.splitlines() if l.strip() and "has local changes" not in l][-25:]
|
| 300 |
+
if out_of_memory(out):
|
| 301 |
+
return 0, "rejected: the build was killed, most likely out of memory (8 GB) | " + " | ".join(tail)[-3000:]
|
| 302 |
+
return 0, "rejected: " + " | ".join(tail)[-4000:]
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
def main() -> int:
|
| 306 |
+
VERIFIER_DIR.mkdir(parents=True, exist_ok=True)
|
| 307 |
+
os.chmod(VERIFIER_DIR, 0o755)
|
| 308 |
+
for name in ("reward.txt", "reward.json"):
|
| 309 |
+
(VERIFIER_DIR / name).unlink(missing_ok=True)
|
| 310 |
+
|
| 311 |
+
task = json.loads((TESTS / "task.json").read_text())
|
| 312 |
+
details: dict = {"task": task["challenge"], "started_at": time.time()}
|
| 313 |
+
reward: int | None = None
|
| 314 |
+
try:
|
| 315 |
+
RUN_ROOT.mkdir(mode=0o711, parents=True, exist_ok=True)
|
| 316 |
+
deadline = time.time() + int(task["grade_timeout_sec"])
|
| 317 |
+
run = fresh_run(task)
|
| 318 |
+
details["permission_fixes"] = ensure_readable()
|
| 319 |
+
block_grader_network()
|
| 320 |
+
details["submission"] = unpack_submission(run)
|
| 321 |
+
code, out = run_comparator(run, int(deadline - time.time()))
|
| 322 |
+
log = out
|
| 323 |
+
kill_grader()
|
| 324 |
+
if code not in (0, None) and out_of_memory(out) and deadline - time.time() > 60:
|
| 325 |
+
# Two Lean processes in parallel can exceed 8 GB on a heavy module. Retry once with one,
|
| 326 |
+
# in a fresh directory: the first attempt's .lake was written by the submission's own
|
| 327 |
+
# build and must not be trusted for the challenge.
|
| 328 |
+
run = fresh_run(task)
|
| 329 |
+
unpack_submission(run)
|
| 330 |
+
code, out = run_comparator(run, int(deadline - time.time()), threads="1")
|
| 331 |
+
log += "\n\n=== retried with one Lean process after running out of memory ===\n\n" + out
|
| 332 |
+
kill_grader()
|
| 333 |
+
details["retried_single_thread"] = True
|
| 334 |
+
(VERIFIER_DIR / "comparator.log").write_text(log)
|
| 335 |
+
reward, details["reason"] = classify(code, out)
|
| 336 |
+
details["comparator_exit"] = code
|
| 337 |
+
except Rejected as exc:
|
| 338 |
+
reward, details["reason"] = 0, f"rejected: {exc}"
|
| 339 |
+
except GradingError as exc:
|
| 340 |
+
reward, details["reason"] = None, f"grading error: {exc}"
|
| 341 |
+
finally:
|
| 342 |
+
try:
|
| 343 |
+
kill_grader()
|
| 344 |
+
except GradingError as exc:
|
| 345 |
+
reward, details["reason"] = None, f"grading error: {exc}"
|
| 346 |
+
details["reward"] = reward
|
| 347 |
+
details["finished_at"] = time.time()
|
| 348 |
+
(VERIFIER_DIR / "grading.json").write_text(json.dumps(details, indent=2))
|
| 349 |
+
print(json.dumps(details, indent=2))
|
| 350 |
+
if reward is not None:
|
| 351 |
+
(VERIFIER_DIR / "reward.txt").write_text(f"{reward}\n")
|
| 352 |
+
return 0
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
if __name__ == "__main__":
|
| 356 |
+
sys.exit(main())
|
tasks/abhyankar-sathaye/tests/task.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"challenge": "AbhyankarSathaye",
|
| 3 |
+
"comparator": {
|
| 4 |
+
"theorem_names": [
|
| 5 |
+
"OAI.AbhyankarSathaye.exists_noncoordinate_polynomial"
|
| 6 |
+
],
|
| 7 |
+
"definition_names": [],
|
| 8 |
+
"permitted_axioms": [
|
| 9 |
+
"propext",
|
| 10 |
+
"Quot.sound",
|
| 11 |
+
"Classical.choice"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
"grade_timeout_sec": 10850
|
| 15 |
+
}
|
tasks/abhyankar-sathaye/tests/test.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Runs in the separate verifier sandbox, which never ran agent code. See grade.py.
|
| 3 |
+
exec python3 /tests/grade.py
|
tasks/affine-bernstein/environment/Dockerfile
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Shared by every openai/math task (agent and separate verifier). See lean_setup.sh.
|
| 2 |
+
FROM ubuntu:24.04
|
| 3 |
+
ENV ELAN_HOME=/opt/elan \
|
| 4 |
+
PATH=/opt/elan/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
| 5 |
+
LANG=C.UTF-8
|
| 6 |
+
COPY lean_setup.sh fetch_mathlib.sh lakefile.lean lake-manifest.json pack_submission.py /opt/build/
|
| 7 |
+
RUN bash /opt/build/lean_setup.sh
|
| 8 |
+
WORKDIR /workspace
|
tasks/affine-bernstein/environment/fetch_mathlib.sh
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Unpack Mathlib's prebuilt cache in batches and truncate the files that importing Mathlib never
|
| 3 |
+
# reads (generated C and .ilean editor indexes), keeping their .hash files so Lake still sees every
|
| 4 |
+
# module as built. Lean + full Mathlib otherwise needs ~11 GB, more than a 10 GB sandbox disk.
|
| 5 |
+
set -euo pipefail
|
| 6 |
+
cd /opt/lean-env
|
| 7 |
+
trim() {
|
| 8 |
+
find .lake/packages -path '*/.lake/build/*' \( -name '*.c' -o -name '*.ilean' \) -size +0 -exec truncate -s 0 {} +
|
| 9 |
+
rm -rf "${HOME:-/root}/.cache/mathlib"
|
| 10 |
+
}
|
| 11 |
+
for dir in .lake/packages/mathlib/Mathlib/*/; do
|
| 12 |
+
name=$(basename "$dir")
|
| 13 |
+
echo "== Mathlib/$name"
|
| 14 |
+
lake exe cache get ".lake/packages/mathlib/Mathlib/$name" >/dev/null
|
| 15 |
+
trim
|
| 16 |
+
df -h / | tail -1
|
| 17 |
+
done
|
| 18 |
+
lake exe cache get
|
| 19 |
+
trim
|