amphora commited on
Commit
1ca0407
·
verified ·
1 Parent(s): 77090dc

Initial release: 3,577 construct/optimize math RL tasks with deterministic graders

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. LICENSE.md +9 -0
  2. README.md +143 -0
  3. data/construct.parquet +3 -0
  4. data/optimize.parquet +3 -0
  5. families.csv +143 -0
  6. grade.py +41 -0
  7. graders/__pycache__/run.cpython-314.pyc +0 -0
  8. graders/ae_p10_kakeya_3d/__pycache__/check.cpython-314.pyc +0 -0
  9. graders/ae_p10_kakeya_3d/check.py +59 -0
  10. graders/ae_p16_gagliardo_nirenberg/__pycache__/check.cpython-314.pyc +0 -0
  11. graders/ae_p16_gagliardo_nirenberg/check.py +27 -0
  12. graders/ae_p17_young_convolution/__pycache__/check.cpython-314.pyc +0 -0
  13. graders/ae_p17_young_convolution/check.py +45 -0
  14. graders/ae_p18_hardy_littlewood_maximal/__pycache__/check.cpython-314.pyc +0 -0
  15. graders/ae_p18_hardy_littlewood_maximal/check.py +45 -0
  16. graders/ae_p1_ff_kakeya/__pycache__/check.cpython-314.pyc +0 -0
  17. graders/ae_p1_ff_kakeya/check.py +32 -0
  18. graders/ae_p1_ff_nikodym/__pycache__/check.cpython-314.pyc +0 -0
  19. graders/ae_p1_ff_nikodym/check.py +47 -0
  20. graders/ae_p24_de_bruijn_sharma/__pycache__/check.cpython-314.pyc +0 -0
  21. graders/ae_p24_de_bruijn_sharma/check.py +29 -0
  22. graders/ae_p29_block_stacking/__pycache__/check.cpython-314.pyc +0 -0
  23. graders/ae_p29_block_stacking/check.py +23 -0
  24. graders/ae_p30_arithmetic_kakeya/__pycache__/check.cpython-314.pyc +0 -0
  25. graders/ae_p30_arithmetic_kakeya/check.py +38 -0
  26. graders/ae_p31_furstenberg_sarkozy/__pycache__/check.cpython-314.pyc +0 -0
  27. graders/ae_p31_furstenberg_sarkozy/check.py +47 -0
  28. graders/ae_p32_spherical_designs/__pycache__/check.cpython-314.pyc +0 -0
  29. graders/ae_p32_spherical_designs/check.py +53 -0
  30. graders/ae_p35_cubes_in_cube/__pycache__/check.cpython-314.pyc +0 -0
  31. graders/ae_p35_cubes_in_cube/check.py +51 -0
  32. graders/ae_p37_turan_tetrahedron/__pycache__/check.cpython-314.pyc +0 -0
  33. graders/ae_p37_turan_tetrahedron/check.py +39 -0
  34. graders/ae_p38_factorial_factors/__pycache__/check.cpython-314.pyc +0 -0
  35. graders/ae_p38_factorial_factors/check.py +12 -0
  36. graders/ae_p39_beat_the_average/__pycache__/check.cpython-314.pyc +0 -0
  37. graders/ae_p39_beat_the_average/check.py +31 -0
  38. graders/ae_p40_erdos_discrepancy/__pycache__/check.cpython-314.pyc +0 -0
  39. graders/ae_p40_erdos_discrepancy/check.py +25 -0
  40. graders/ae_p41_sphere_max_volume/__pycache__/check.cpython-314.pyc +0 -0
  41. graders/ae_p41_sphere_max_volume/check.py +23 -0
  42. graders/ae_p42_sum_difference_i/__pycache__/check.cpython-314.pyc +0 -0
  43. graders/ae_p42_sum_difference_i/check.py +23 -0
  44. graders/ae_p43_sum_difference_ii/__pycache__/check.cpython-314.pyc +0 -0
  45. graders/ae_p43_sum_difference_ii/check.py +19 -0
  46. graders/ae_p44_sum_difference_iii/__pycache__/check.cpython-314.pyc +0 -0
  47. graders/ae_p44_sum_difference_iii/check.py +41 -0
  48. graders/ae_p45_sum_product_fp/__pycache__/check.cpython-314.pyc +0 -0
  49. graders/ae_p45_sum_product_fp/check.py +15 -0
  50. graders/ae_p52_erdos_squarefree/__pycache__/check.cpython-314.pyc +0 -0
LICENSE.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Licenses
2
+
3
+ This collection repackages tasks from several sources. Each row's `license` column gives the license of its source:
4
+
5
+ - MIT: RLVE-Gym, NPPC, EinsteinArena (platform and baselines)
6
+ - CC-BY-4.0: MathConstraint; AlphaEvolve repository of problems (materials)
7
+ - Apache-2.0: Reasoning Gym, FunSearch, AlphaEvolve repository of problems (code), Finch / Evolution Fine-Tuning (code)
8
+
9
+ Please attribute the original authors when using the corresponding tasks.
README.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: mixed-permissive
4
+ license_link: LICENSE.md
5
+ configs:
6
+ - config_name: construct
7
+ data_files: data/construct.parquet
8
+ - config_name: optimize
9
+ data_files: data/optimize.parquet
10
+ tags:
11
+ - math
12
+ - reinforcement-learning
13
+ - rl-environment
14
+ - verifiable-rewards
15
+ - harbor
16
+ size_categories:
17
+ - 1K<n<10K
18
+ ---
19
+
20
+ # MathConstructOptimize-Envs
21
+
22
+ **3,577 RL tasks in 142 families where the model must *construct a mathematical object*, graded by a deterministic checker.** There is no answer matching and no LLM judge in the reward path.
23
+
24
+ Most math RL data asks for a final number. Here the model has to produce the object itself: a colouring, a design, a counterexample, a point configuration, a polynomial. The checker accepts **any** valid object, not a stored answer. The collection has two subsets:
25
+
26
+ | subset | what the model does | reward | families | tasks |
27
+ |---|---|---|---|---|
28
+ | `construct` | produce any object satisfying stated conditions (a witness) | 1 if valid, else 0 | 80 | 3,464 |
29
+ | `optimize` | produce a valid object with the best objective it can (extremal constructions, bound improvement) | 0 if invalid; otherwise 0.1 + 0.9 × progress from a trivial baseline to the best known value | 62 | 113 |
30
+
31
+ The runnable sandboxed version (one [Harbor](https://github.com/laude-institute/harbor) task directory per row) is in
32
+ [`amphora/MathConstructOptimize-Envs-harbor`](https://huggingface.co/datasets/amphora/MathConstructOptimize-Envs-harbor).
33
+
34
+ ## Sources
35
+
36
+ Tasks are converted from existing generator suites and research-problem repositories. Each checker was re-implemented and hardened; see the list of upstream verifier bugs below.
37
+
38
+ | source | subset | tier | families | tasks |
39
+ |---|---|---|---|---|
40
+ | [RLVE-Gym](https://github.com/Zhiyuan-Zeng/RLVE) | construct | competition | 30 | 1,800 |
41
+ | [MathConstraint](https://github.com/vireshpati/Math-Constraint) | construct | competition | 33 | 875 |
42
+ | [NPPC](https://github.com/SMU-DIGA/nppc) | construct | competition | 8 | 480 |
43
+ | [Reasoning Gym](https://github.com/open-thought/reasoning-gym) | construct | competition | 3 | 180 |
44
+ | [AlphaEvolve repository of problems](https://github.com/google-deepmind/alphaevolve_repository_of_problems) | construct + optimize | research (mostly) | 27 | 187 |
45
+ | [EinsteinArena](https://einsteinarena.com) | optimize | research | 26 | 28 |
46
+ | [FunSearch](https://github.com/google-deepmind/funsearch) | optimize | research | 3 | 15 |
47
+ | [Finch / Evolution Fine-Tuning](https://github.com/Open-Galapagos/evolution-fine-tuning) (`erdos_*` tasks) | optimize | research / competition | 12 | 12 |
48
+
49
+ Construct generators have 4–6 difficulty levels × 10 seeds. Optimize tasks are single research problems, some at several sizes *n*. `families.csv` lists every family with its source, license, domain, `problem_key` and tags.
50
+
51
+ ## Row schema
52
+
53
+ | column | meaning |
54
+ |---|---|
55
+ | `task_id` | unique id |
56
+ | `subset`, `family`, `problem_key` | task contract, generator family, canonical math problem id (for cross-source dedupe) |
57
+ | `domain`, `tier`, `level` | math area, `competition` or `research`, difficulty level |
58
+ | `source`, `license` | upstream task and its license |
59
+ | `tags` | see below |
60
+ | `prompt` | full, self-contained task statement including the required JSON answer schema |
61
+ | `instance` | JSON string with the instance data the checker needs |
62
+ | `direction`, `baseline`, `best_known` | optimize only: objective direction, trivial-baseline score, best known score |
63
+ | `reference_answer`, `reference_reward` | a known valid answer (planted witness or published construction) and its reward; for SFT/debugging, not needed for grading |
64
+
65
+ ## Grading
66
+
67
+ ```python
68
+ from datasets import load_dataset
69
+ from huggingface_hub import snapshot_download
70
+ import sys, json
71
+
72
+ repo = snapshot_download("amphora/MathConstructOptimize-Envs", repo_type="dataset", allow_patterns=["grade.py", "graders/*"])
73
+ sys.path.insert(0, repo)
74
+ from grade import grade
75
+
76
+ ds = load_dataset("amphora/MathConstructOptimize-Envs", "construct", split="train")
77
+ row = ds[0]
78
+ reward, details = grade(row, json.loads(row["reference_answer"])) # -> 1.0, {"valid": True}
79
+ ```
80
+
81
+ Graders need Python ≥ 3.10 with numpy, scipy, sympy and networkx. Every check runs in under 60 s. Feasibility checks use exact integer or rational arithmetic wherever the problem allows.
82
+
83
+ The **optimize reward** is `0` for an invalid answer, else `0.1 + 0.9 · clip(progress, 0, 1)`. Progress is linear between `baseline` (a deliberately weak valid construction) and `best_known`. The kissing-number tasks use a log scale of the overlap loss instead. The 0.1 floor for validity keeps GRPO groups from being all-zero, because without it research-level tasks gave no signal in our pilot.
84
+
85
+ ## Tags
86
+
87
+ | tag | meaning |
88
+ |---|---|
89
+ | `agentic_trivial` | a solver (CP-SAT, z3, brute force) cracks the top level within seconds, so the task is useful single-turn but weak for sandboxed agents (2,368 tasks) |
90
+ | `np_search` | the task is essentially combinatorial search |
91
+ | `best_known_uncertain` | `best_known` comes from our own search or an uncited value |
92
+ | `ea_under_review` | EinsteinArena marks the problem as under review. We audited each one and included it only when we could make the check sound |
93
+ | `unique_answer` | the answer is unique, but it is still verified as a witness (e.g. by expanding a factorization) |
94
+ | `float_objective`, `exact_integer`, `exact_rational`, ... | how the objective is computed |
95
+
96
+ ## Reference pass rates (pilot, 66 tasks)
97
+
98
+ Pilot with 8 single-turn samples and 4 agentic attempts per task (Harbor `terminus-2`, no network):
99
+
100
+ | model / mode | trivial (≥0.9) | trainable | too hard (≤0.1) |
101
+ |---|---|---|---|
102
+ | gpt-oss-120b, single-turn | 23 | 23 | 20 |
103
+ | gpt-oss-120b, agentic | 33 | 19 | 13 |
104
+ | Qwen3-8B, single-turn | 13 | 15 | 38 |
105
+ | Qwen3-8B, agentic | 8 | 10 | 47 |
106
+
107
+ Pass rates vary a lot by model and mode, so filter for your policy. Difficulty levels are monotone within every generator family.
108
+
109
+ ## Upstream verifier bugs found and fixed
110
+
111
+ Re-implementing the checkers surfaced problems in the source verifiers that an RL policy could exploit:
112
+
113
+ - **Model output executed as code.** RLVE `integral` (`sympify`) and Reasoning Gym integration (`parse_expr`) evaluate the model's answer as Python, and they also accept an unevaluated `Integral(f, x)`. Our checkers parse through a whitelist syntax tree.
114
+ - **Empty answers accepted.** MathConstraint `verify()` lets the solver fill in any variable the answer omits, so `{}` passes.
115
+ - **Missing range, length or type checks.**
116
+ - NPPC 3-colouring accepts an all-distinct colouring.
117
+ - Clique and independent set accept a vertex repeated k times.
118
+ - Quadratic congruence accepts x = 0.
119
+ - Several verifiers accept floats or bools.
120
+ - **Floating-point feasibility checks.**
121
+ - EinsteinArena circle packing and circles-in-rectangle (the AlphaEvolve seed overlaps by about 1e-16).
122
+ - Heilbronn triangle containment (uses a rounded √3).
123
+ - Finch tolerances that allowed beating the proven 10/3 bound.
124
+ - AlphaEvolve p58 (Erdős–Szekeres): the published 33- and 65-point sets reported as having no convex 7- or 8-gon **do contain one** under exact arithmetic.
125
+ - **Checks that are wrong or too weak.**
126
+ - AlphaEvolve spherical designs: the pass test compares a negated error, so it always passes.
127
+ - AlphaEvolve 3D Kakeya ignores tubes that leave its Monte Carlo box.
128
+ - Arithmetic Kakeya "repairs" the submitted distribution before scoring it.
129
+ - The prime-number-theorem constraint was checked on random samples.
130
+ - The uncertainty-principle root scan could miss roots.
131
+ - **Wrong or unreachable targets.** Several Finch targets are above a provable maximum, below a known optimum, or infeasible.
132
+
133
+ ## Excluded
134
+
135
+ - AlphaEvolve problem 6: the notebook's functional differs from the one a construction-checker can certify.
136
+ - Problems with no checkable objective (proof-only or meta problems), or no recoverable construction or verifier.
137
+ - FunSearch corner-free sets (checker not released).
138
+ - Sources without a license.
139
+ - Duplicate problem and size pairs across sources (deduplicated by `problem_key`).
140
+
141
+ ## License
142
+
143
+ Each row carries the license of its source (`license` column): MIT (64 families), CC-BY-4.0 (59), Apache-2.0 (19). Attribution belongs to the original authors of each source listed above. Our packaging, checkers and generators are released under the same terms as the corresponding source.
data/construct.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38b3c90ab1e11b267d5ee2c92939dbeb6958ab6fb3464cec95a4ce828e0624a7
3
+ size 3195938
data/optimize.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3c912b1d13d289de6b85cc381ecb0f5d13b55d4ec8cc5b8df8e0ec6d0da171c
3
+ size 1949811
families.csv ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ family,subset,tier,domain,source,license,problem_key,n_tasks,tags
2
+ ae_p10_kakeya_3d,optimize,research,geometry,AlphaEvolve-Repository-of-Problems/10-3d-kakeya,CC-BY-4.0,kakeya_needle_3d_prisms,1,exact_piecewise_integration;float_objective
3
+ ae_p16_gagliardo_nirenberg,optimize,research,analysis,AlphaEvolve-Repository-of-Problems/16-gagliardo-nirenberg-special-case,CC-BY-4.0,nagy_gagliardo_nirenberg_sharp_constant,3,float_objective;known_optimum
4
+ ae_p17_young_convolution,optimize,research,analysis,AlphaEvolve-Repository-of-Problems/17-young-convolution,CC-BY-4.0,young_convolution_sharp_constant,3,float_objective;known_optimum
5
+ ae_p18_hardy_littlewood_maximal,optimize,research,analysis,AlphaEvolve-Repository-of-Problems/18-hardy-littlewood-maximal,CC-BY-4.0,centered_hardy_littlewood_weak11_constant_1d,1,exact_rational;known_optimum
6
+ ae_p1_ff_kakeya,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/1-finite-field-kakeya,CC-BY-4.0,finite_field_kakeya_min_size,10,exact_integer;finite_fields
7
+ ae_p1_ff_nikodym,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/1-finite-field-nikodym,CC-BY-4.0,finite_field_nikodym_min_size_d3,4,exact_integer;finite_fields
8
+ ae_p24_de_bruijn_sharma,optimize,research,analysis,AlphaEvolve-Repository-of-Problems/24-de-bruijn-sharma,CC-BY-4.0,de_bruijn_sharma_x_intercept,4,float_objective;polynomials
9
+ ae_p29_block_stacking,optimize,competition,analysis,AlphaEvolve-Repository-of-Problems/29-block-stacking,CC-BY-4.0,block_stacking_overhang_one_per_level,3,agentic_trivial;exact_rational;known_optimum
10
+ ae_p30_arithmetic_kakeya,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/30-arithmetic-kakeya,CC-BY-4.0,arithmetic_kakeya_entropy_sum_difference,2,additive_combinatorics;entropy;float_objective
11
+ ae_p31_furstenberg_sarkozy,optimize,research,number_theory,AlphaEvolve-Repository-of-Problems/31-furstenberg-sarkozy,CC-BY-4.0,furstenberg_sarkozy_modular_exponent,2,additive_combinatorics;exact_integer
12
+ ae_p32_spherical_designs,construct,research,discrete_geometry,AlphaEvolve-Repository-of-Problems/32-spherical-designs,CC-BY-4.0,spherical_t_design_s2,6,float_tolerance;numerical_design
13
+ ae_p35_cubes_in_cube,optimize,research,discrete_geometry,AlphaEvolve-Repository-of-Problems/35-packing-in-a-dilate,CC-BY-4.0,unit_cubes_in_smallest_cube_n11,1,float_objective;packing
14
+ ae_p37_turan_tetrahedron,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/37-hypergraph-turan-tetrahedron,CC-BY-4.0,turan_density_K4_3,1,blow_up;extremal_hypergraph
15
+ ae_p38_factorial_factors,construct,research,number_theory,AlphaEvolve-Repository-of-Problems/38-factoring-N-factorial,CC-BY-4.0,factorial_into_n_large_factors_A034258,60,agentic_trivial;exact_integer;ilp_friendly;np_search
16
+ ae_p39_beat_the_average,optimize,research,probability,AlphaEvolve-Repository-of-Problems/39-beat-the-average,CC-BY-4.0,beat_the_average_X1X2X3_lt_2X4,1,discrete_measure;float_objective
17
+ ae_p40_erdos_discrepancy,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/40-erdos-discrepancy,CC-BY-4.0,erdos_discrepancy_C2_max_length,1,exact_integer;np_search;sat_friendly
18
+ ae_p41_sphere_max_volume,optimize,research,discrete_geometry,AlphaEvolve-Repository-of-Problems/41-points-on-sphere-max-volume,CC-BY-4.0,max_volume_inscribed_polyhedron_n_vertices,7,float_objective
19
+ ae_p42_sum_difference_i,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/42-sum-difference-I,CC-BY-4.0,sum_difference_sumset_vs_diffset_exponent,1,additive_combinatorics;exact_integer
20
+ ae_p43_sum_difference_ii,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/43-sum-difference-II,CC-BY-4.0,sum_difference_diffset_vs_sumset_exponent,1,additive_combinatorics;exact_integer
21
+ ae_p44_sum_difference_iii,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/44-sum-difference-III,CC-BY-4.0,sum_difference_A_plus_B_vs_A_minus_B_exponent,1,additive_combinatorics;exact_integer
22
+ ae_p45_sum_product_fp,optimize,research,combinatorics,AlphaEvolve-Repository-of-Problems/45-sum-product-finite-field,Apache-2.0,finite_field_sum_product_sqrt_p,3,additive_combinatorics;exact_integer
23
+ ae_p52_erdos_squarefree,construct,research,number_theory,AlphaEvolve-Repository-of-Problems/52-erdos-squarefree,CC-BY-4.0,erdos_ab_plus_1_never_squarefree,50,exact_integer
24
+ ae_p54_touching_cylinders,construct,research,discrete_geometry,AlphaEvolve-Repository-of-Problems/54-pairwise-touching-cylinders,CC-BY-4.0,mutually_touching_infinite_cylinders,2,float_tolerance;nonlinear_system
25
+ ae_p58_happy_ending,construct,research,discrete_geometry,AlphaEvolve-Repository-of-Problems/58-erdos-szekeres-happy-ending,CC-BY-4.0,erdos_szekeres_no_convex_k_gon_2pow_k_minus_2,5,exact_integer;np_search
26
+ ae_p59_isosceles_free_grid,optimize,research,discrete_geometry,AlphaEvolve-Repository-of-Problems/59-no-isosceles-grid,CC-BY-4.0,isosceles_free_grid_subset,2,exact_integer;np_search
27
+ ae_p60_no5_on_sphere,optimize,research,discrete_geometry,AlphaEvolve-Repository-of-Problems/60-no-5-on-a-sphere,CC-BY-4.0,no_five_cospherical_grid_subset,6,exact_integer;np_search
28
+ ae_p65_imo2025_p6_tiling,construct,competition,combinatorics,AlphaEvolve-Repository-of-Problems/65-imo-2025-p6,CC-BY-4.0,imo2025_p6_min_tiles,6,exact_integer
29
+ ea_circle_packing_26,optimize,research,discrete_geometry,EinsteinArena/circle-packing,MIT,circle_packing_square_sum_radii_n26,1,exact_check;float_objective
30
+ ea_circles_rectangle_21,optimize,research,discrete_geometry,EinsteinArena/circles-rectangle,MIT,circles_in_rectangle_perimeter4_sum_radii_n21,1,exact_check;float_objective
31
+ ea_difference_bases,optimize,research,number_theory,EinsteinArena/difference-bases,MIT,difference_basis_ratio,1,exact_check
32
+ ea_edges_vs_triangles,optimize,research,combinatorics,EinsteinArena/edges-vs-triangles,MIT,edges_vs_triangles_density_curve,1,float_objective
33
+ ea_erdos_min_overlap,optimize,research,analysis,EinsteinArena/erdos-min-overlap,MIT,erdos_minimum_overlap_upper,1,float_objective
34
+ ea_first_autocorrelation,optimize,research,analysis,EinsteinArena/first-autocorrelation-inequality,MIT,first_autocorrelation_inequality_upper,1,float_objective
35
+ ea_flat_polynomials_70,optimize,research,analysis,EinsteinArena/flat-polynomials,MIT,flat_littlewood_polynomial_n70,1,float_objective
36
+ ea_hadamard_det_51,optimize,research,combinatorics,EinsteinArena/hadamard-det-51,MIT,hadamard_maxdet_n51,1,ea_under_review;exact_check
37
+ ea_heilbronn_triangle_11,optimize,research,discrete_geometry,EinsteinArena/heilbronn-triangles,MIT,heilbronn_triangle_n11,1,exact_check;float_objective
38
+ ea_kakeya_needle_128,optimize,research,geometry,EinsteinArena/kakeya-needle-128,MIT,kakeya_needle_triangles_n128,1,ea_under_review;exact_check
39
+ ea_kissing_number,optimize,research,discrete_geometry,"EinsteinArena/kissing-number-d11,-d11-605,-d12",MIT,kissing_number_overlap_loss,3,best_known_uncertain;exact_check
40
+ ea_min_distance_ratio_16,optimize,research,discrete_geometry,EinsteinArena/min-distance-ratio-2d,MIT,max_min_distance_ratio_2d_n16,1,float_objective
41
+ ea_no_three_in_line_75,optimize,research,discrete_geometry,EinsteinArena/no-three-in-line-75,MIT,no_three_in_line_n75,1,ea_under_review;exact_check
42
+ ea_prime_number_theorem,optimize,research,number_theory,EinsteinArena/prime-number-theorem,MIT,pnt_chebyshev_certificate,1,float_objective;range_limited_certificate
43
+ ea_ring_loading_15,optimize,research,combinatorics,EinsteinArena/ring-loading-15,MIT,ring_loading_m15,1,ea_under_review;exact_check
44
+ ea_second_autocorrelation,optimize,research,analysis,EinsteinArena/second-autocorrelation-inequality,MIT,second_autocorrelation_inequality_lower,1,float_objective
45
+ ea_shannon_c7_5,optimize,research,graph_theory,EinsteinArena/shannon-capacity-c7-5,MIT,independent_set_c7_strong_power5,1,ea_under_review;exact_check
46
+ ea_sidon_45_set,optimize,research,number_theory,EinsteinArena/sidon-45-set,MIT,sidon_subsets_of_45_sets,1,ea_under_review;exact_check
47
+ ea_snake_in_the_box_13,optimize,research,graph_theory,EinsteinArena/snake-in-the-box-13,MIT,snake_in_the_box_d13,1,ea_under_review;exact_check
48
+ ea_sorting_network_16,optimize,research,combinatorics,EinsteinArena/sorting-network-16,MIT,sorting_network_size_n16,1,ea_under_review;exact_check
49
+ ea_spencer_discrepancy,optimize,research,combinatorics,EinsteinArena/spencer-discrepancy,MIT,spencer_discrepancy_square_n_le20,1,ea_under_review;exact_check
50
+ ea_tammes,optimize,research,discrete_geometry,EinsteinArena/tammes-problem,MIT,tammes_n50,1,float_objective
51
+ ea_third_autocorrelation,optimize,research,analysis,EinsteinArena/third-autocorrelation-inequality,MIT,third_autocorrelation_inequality_upper,1,float_objective
52
+ ea_thomson_282,optimize,research,discrete_geometry,EinsteinArena/thomson-problem,MIT,thomson_problem_n282,1,float_objective
53
+ ea_two_deletion_code_16,optimize,research,coding_theory,EinsteinArena/two-deletion-code-16,MIT,two_deletion_code_n16,1,ea_under_review;exact_check
54
+ ea_uncertainty_principle,optimize,research,analysis,EinsteinArena/uncertainty-principle,MIT,plus1_uncertainty_principle_upper,1,high_precision
55
+ finch_3ap_diffs_40,optimize,research,combinatorics,Finch-EFT/skydiscover/erdos_1097_3ap_diffs_n40,Apache-2.0,erdos1097_3ap_differences_n40_m400,1,best_known_uncertain;exact_check;np_search
56
+ finch_4subset_3dist_16,optimize,research,discrete_geometry,Finch-EFT/skydiscover/erdos_659_4subset_3dist_construction,Apache-2.0,erdos659_4sets_3dist_n16,1,best_known_uncertain;exact_check;np_search
57
+ finch_flat_poly_32,optimize,research,analysis,Finch-EFT/skydiscover/erdos_flat_polynomials_n32,Apache-2.0,flat_littlewood_polynomial_n32,1,best_known_uncertain;float_objective;np_search
58
+ finch_heilbronn_disk_12,optimize,research,discrete_geometry,Finch-EFT/skydiscover/erdos_507_heilbronn_disk_n12,Apache-2.0,heilbronn_disk_n12,1,best_known_uncertain;exact_check;float_objective
59
+ finch_isosceles_free_grid_8,optimize,competition,discrete_geometry,Finch-EFT/skydiscover/erdos_isosceles_free_grid,Apache-2.0,isosceles_free_grid_subset,1,exact_check;exact_optimum_known;np_search
60
+ finch_lcm_chain_10000,optimize,competition,number_theory,Finch-EFT/skydiscover/erdos_440_lcm_density,Apache-2.0,erdos440_lcm_consecutive_x10000,1,exact_check;exact_optimum_known
61
+ finch_newman_200,optimize,research,number_theory,Finch-EFT/skydiscover/erdos_480_newman_density,Apache-2.0,erdos480_newman_finite_n200,1,best_known_uncertain;float_objective
62
+ finch_no4_concyclic_12,optimize,research,discrete_geometry,Finch-EFT/skydiscover/erdos_654_no_four_concyclic_distances,Apache-2.0,erdos654_no4_concyclic_n12,1,best_known_uncertain;exact_check;np_search
63
+ finch_sidon_pair_100,optimize,research,number_theory,Finch-EFT/skydiscover/erdos_43_sidon_pair,Apache-2.0,erdos43_sidon_pair_n100,1,best_known_uncertain;exact_check;np_search
64
+ finch_sidon_set_121,optimize,competition,number_theory,Finch-EFT/skydiscover/erdos_difference_bases_N121,Apache-2.0,max_sidon_set_0_120,1,exact_check;exact_optimum_known
65
+ finch_square_packing_12,optimize,research,discrete_geometry,Finch-EFT/skydiscover/erdos_106_square_packing,Apache-2.0,erdos106_squares_in_square_n12,1,exact_check
66
+ finch_udg_girth_30,optimize,research,graph_theory,Finch-EFT/skydiscover/erdos_705_unit_distance_high_girth,Apache-2.0,erdos705_udg_chi4_girth_n30,1,best_known_uncertain;exact_check
67
+ fs_admissible_set,optimize,research,combinatorics,FunSearch/admissible_set,Apache-2.0,admissible_set_constant_weight,2,integer_objective
68
+ fs_cap_set,optimize,research,combinatorics,FunSearch/cap_set,Apache-2.0,cap_set_f3n,6,integer_objective
69
+ fs_cycle_independent_set,optimize,research,graph_theory,FunSearch/cyclic_graphs,Apache-2.0,independent_set_strong_power_odd_cycle,7,integer_objective
70
+ mc_all_interval,construct,competition,combinatorics,MathConstraint/all_interval,CC-BY-4.0,all_interval_series,40,agentic_trivial
71
+ mc_antimagic_square,construct,competition,combinatorics,MathConstraint/antimagic_square,CC-BY-4.0,antimagic_square,6,np_search
72
+ mc_bibd,construct,competition,combinatorics,MathConstraint/bibd,CC-BY-4.0,bibd,28,np_search
73
+ mc_costas_array,construct,competition,combinatorics,MathConstraint/costas_array,CC-BY-4.0,costas_array,23,np_search
74
+ mc_debruijn,construct,competition,combinatorics,MathConstraint/debruijn,CC-BY-4.0,de_bruijn_sequence,22,agentic_trivial
75
+ mc_golomb,construct,competition,combinatorics,MathConstraint/golomb,CC-BY-4.0,golomb_ruler,18,np_search
76
+ mc_graceful_graph,construct,competition,graph_theory,MathConstraint/graceful_graph,CC-BY-4.0,graceful_labeling,17,np_search
77
+ mc_graph_k_coloring,construct,competition,graph_theory,MathConstraint/graph_k_coloring,CC-BY-4.0,graph_k_coloring,48,np_search
78
+ mc_hadamard,construct,competition,combinatorics,MathConstraint/hadamard,CC-BY-4.0,legendre_pair,30,np_search
79
+ mc_langford,construct,competition,combinatorics,MathConstraint/langford,CC-BY-4.0,langford_pairing,27,agentic_trivial;np_search
80
+ mc_low_autocorrelation,construct,competition,combinatorics,MathConstraint/low_autocorrelation,CC-BY-4.0,low_autocorrelation_binary_sequence,31,np_search
81
+ mc_magic_sequence,construct,competition,combinatorics,MathConstraint/magic_sequence,CC-BY-4.0,magic_sequence,30,agentic_trivial
82
+ mc_max_clique,construct,competition,graph_theory,MathConstraint/max_clique,CC-BY-4.0,graph_clique,55,np_search
83
+ mc_max_independent_set,construct,competition,graph_theory,MathConstraint/max_independent_set,CC-BY-4.0,graph_independent_set,60,np_search
84
+ mc_non_transitive_dice,construct,competition,probability,MathConstraint/non_transitive_dice,CC-BY-4.0,intransitive_dice,15,agentic_trivial;np_search
85
+ mc_number_partitioning,construct,competition,number_theory,MathConstraint/number_partitioning,CC-BY-4.0,equal_sum_partition_1_to_n,59,agentic_trivial
86
+ mc_ortholatin,construct,competition,combinatorics,MathConstraint/ortholatin,CC-BY-4.0,orthogonal_latin_squares,21,np_search
87
+ mc_pysms_chromatic_girth,construct,competition,graph_theory,MathConstraint/pysms_chromatic_girth,CC-BY-4.0,graph_existence_chromatic_girth,25,np_search
88
+ mc_pysms_clique_coloring,construct,competition,graph_theory,MathConstraint/pysms_clique_coloring,CC-BY-4.0,graph_existence_clique_coloring,16,np_search
89
+ mc_pysms_degree_bounds,construct,competition,graph_theory,MathConstraint/pysms_degree_bounds,CC-BY-4.0,graph_existence_degree_bounds,11,agentic_trivial;np_search
90
+ mc_pysms_girth_degree,construct,competition,graph_theory,MathConstraint/pysms_girth_degree,CC-BY-4.0,graph_existence_girth_degree,18,np_search
91
+ mc_pysms_graph_builder,construct,competition,graph_theory,MathConstraint/pysms_graph_builder,CC-BY-4.0,graph_existence_graph_builder,8,np_search
92
+ mc_pysms_independent_connectivity,construct,competition,graph_theory,MathConstraint/pysms_independent_connectivity,CC-BY-4.0,graph_existence_independent_connectivity,15,np_search
93
+ mc_pysms_min_connectivity,construct,competition,graph_theory,MathConstraint/pysms_min_connectivity,CC-BY-4.0,graph_existence_min_connectivity,12,agentic_trivial;np_search
94
+ mc_pysms_min_degree,construct,competition,graph_theory,MathConstraint/pysms_min_degree,CC-BY-4.0,graph_existence_min_degree,12,agentic_trivial;np_search
95
+ mc_pysms_min_girth,construct,competition,graph_theory,MathConstraint/pysms_min_girth,CC-BY-4.0,graph_existence_min_girth,13,agentic_trivial;np_search
96
+ mc_pysms_mtf,construct,competition,graph_theory,MathConstraint/pysms_mtf,CC-BY-4.0,maximal_triangle_free_graph,12,agentic_trivial;np_search
97
+ mc_pysms_num_edges_bounds,construct,competition,graph_theory,MathConstraint/pysms_num_edges_bounds,CC-BY-4.0,graph_existence_num_edges_bounds,12,agentic_trivial;np_search
98
+ mc_quasigroup_idempotent,construct,competition,algebra,MathConstraint/quasigroup_idempotent,CC-BY-4.0,idempotent_qg3_quasigroup,12,np_search
99
+ mc_ramsey,construct,competition,combinatorics,MathConstraint/ramsey,CC-BY-4.0,ramsey_two_colouring,54,np_search
100
+ mc_social_golfers,construct,competition,combinatorics,MathConstraint/social_golfers,CC-BY-4.0,social_golfer,23,np_search
101
+ mc_van_der_waerden,construct,competition,combinatorics,MathConstraint/van_der_waerden,CC-BY-4.0,van_der_waerden_colouring,42,np_search
102
+ mc_vertex_cover,construct,competition,graph_theory,MathConstraint/vertex_cover,CC-BY-4.0,graph_vertex_cover,60,np_search
103
+ nppc_bandwidth,construct,competition,graph_theory,NPPC/bandwidth,MIT,graph_bandwidth,60,agentic_trivial;np_search
104
+ nppc_clique,construct,competition,graph_theory,NPPC/clique,MIT,graph_clique,60,agentic_trivial;np_search
105
+ nppc_dominating_set,construct,competition,graph_theory,NPPC/dominating_set,MIT,graph_dominating_set,60,agentic_trivial;np_search
106
+ nppc_independent_set,construct,competition,graph_theory,NPPC/independent_set,MIT,graph_independent_set,60,agentic_trivial;np_search
107
+ nppc_quad_diophantine,construct,competition,number_theory,NPPC/quad_diop_equ,MIT,quadratic_diophantine_ax2_by_c,60,agentic_trivial;np_search
108
+ nppc_quadratic_congruence,construct,competition,number_theory,NPPC/quadratic_congruence,MIT,quadratic_congruence_bounded,60,agentic_trivial;np_search
109
+ nppc_three_coloring,construct,competition,graph_theory,NPPC/graph_three_colorability,MIT,graph_3_coloring,60,agentic_trivial;np_search
110
+ nppc_vertex_cover,construct,competition,graph_theory,NPPC/vertex_cover,MIT,graph_vertex_cover,60,agentic_trivial;np_search
111
+ rg_graph_color,construct,competition,graph_theory,ReasoningGym/graph_color,Apache-2.0,graph_k_coloring,60,agentic_trivial;np_search
112
+ rg_intermediate_integration,construct,competition,analysis,ReasoningGym/intermediate_integration,Apache-2.0,symbolic_antiderivative,60,symbolic
113
+ rg_simple_integration,construct,competition,analysis,ReasoningGym/simple_integration,Apache-2.0,symbolic_antiderivative_polynomial,60,symbolic
114
+ rlve_antiderivative,construct,competition,analysis,RLVE-Gym/integral,MIT,symbolic_antiderivative,60,
115
+ rlve_bezout_identity,construct,competition,number_theory,RLVE-Gym/bezout_identity,MIT,bezout_coefficients,60,agentic_trivial
116
+ rlve_construct_hack_interval,construct,competition,number_theory,RLVE-Gym/construct_hack_interval,MIT,cf468c_hack_interval,60,
117
+ rlve_crt,construct,competition,number_theory,RLVE-Gym/crt,MIT,generalized_crt,60,agentic_trivial
118
+ rlve_distinct_subset_sum_permutation,construct,competition,combinatorics,RLVE-Gym/distinct_array_permutation,MIT,cf892d_gluttony,60,agentic_trivial
119
+ rlve_even_degree_partition,construct,competition,graph_theory,RLVE-Gym/even_degree_graph_partitioning,MIT,gallai_even_partition,60,agentic_trivial
120
+ rlve_graph_isomorphism,construct,competition,graph_theory,RLVE-Gym/graph_isomorphism,MIT,graph_isomorphism,60,agentic_trivial;np_search
121
+ rlve_grid_parity_construction,construct,competition,algebra,RLVE-Gym/grid_parity_construction,MIT,lights_out_gf2,60,agentic_trivial
122
+ rlve_imp_party,construct,competition,graph_theory,RLVE-Gym/imp_party,MIT,poi_party_clique_3n,60,agentic_trivial
123
+ rlve_integer_linear_system,construct,competition,algebra,RLVE-Gym/gaussian_elimination,MIT,integer_linear_system,60,agentic_trivial
124
+ rlve_largest_convex_polygon,construct,competition,discrete_geometry,RLVE-Gym/largest_convex_polygon,MIT,largest_convex_subset,60,agentic_trivial
125
+ rlve_largest_rectangle,construct,competition,discrete_geometry,RLVE-Gym/largest_rectangle_among_points,MIT,largest_rectangle_in_point_set,60,agentic_trivial
126
+ rlve_matrix_permutation_equivalence,construct,competition,combinatorics,RLVE-Gym/matrix_permutation_equivalence,MIT,binary_matrix_permutation_equivalence,60,agentic_trivial;np_search
127
+ rlve_max_achromatic_coloring,construct,competition,graph_theory,RLVE-Gym/maximum_achromatic_number,MIT,achromatic_number,60,agentic_trivial;np_search
128
+ rlve_maximum_clique,construct,competition,graph_theory,RLVE-Gym/maximum_clique,MIT,maximum_clique,60,agentic_trivial;np_search
129
+ rlve_min_chromatic_number,construct,competition,graph_theory,RLVE-Gym/minimum_chromatic_number,MIT,graph_k_coloring_chromatic,60,agentic_trivial;np_search
130
+ rlve_min_harmonious_coloring,construct,competition,graph_theory,RLVE-Gym/minimum_harmonious_chromatic_number,MIT,harmonious_chromatic_number,60,agentic_trivial;np_search
131
+ rlve_pairwise_sums_recovery,construct,competition,combinatorics,RLVE-Gym/squ_squarks,MIT,poi_squarks_pairwise_sums,60,agentic_trivial
132
+ rlve_pan_solar_panels,construct,competition,number_theory,RLVE-Gym/pan_solar_panels,MIT,poi_solar_panels_max_gcd,60,agentic_trivial
133
+ rlve_polynomial_global_minimum,construct,competition,analysis,RLVE-Gym/polynomial_minimum,MIT,polynomial_global_minimum,60,agentic_trivial
134
+ rlve_polynomial_integer_roots,construct,competition,algebra,RLVE-Gym/polynomial_factorization,MIT,integer_root_factorization,60,agentic_trivial;unique_answer
135
+ rlve_polynomial_interpolation,construct,competition,algebra,RLVE-Gym/polynomial_interpolation,MIT,lagrange_interpolation_integer,60,agentic_trivial;unique_answer
136
+ rlve_prefix_product_permutation,construct,competition,number_theory,RLVE-Gym/prefix_product_mod_distinct_permutation,MIT,cf487c_prefix_product_sequence,60,
137
+ rlve_prefix_sum_permutation,construct,competition,number_theory,RLVE-Gym/prefix_sum_mod_distinct_permutation,MIT,prefix_sum_mod_distinct_permutation,60,
138
+ rlve_prime_graph_coloring,construct,competition,graph_theory,RLVE-Gym/prime_graph_minimum_chromatic_number,MIT,prime_distance_graph_coloring,60,agentic_trivial
139
+ rlve_recursive_sequence_sum,construct,competition,number_theory,RLVE-Gym/recursive_sequence_sum_construction,MIT,linear_recurrence_subset_sum,60,agentic_trivial
140
+ rlve_round_robin_scores,construct,competition,combinatorics,RLVE-Gym/round_robin,MIT,tournament_score_realisation_3_1_0,60,agentic_trivial
141
+ rlve_shortest_path_count,construct,competition,combinatorics,RLVE-Gym/shortest_path_count_construction,MIT,cf388b_shortest_path_count,60,
142
+ rlve_smallest_enclosing_circle,construct,competition,geometry,RLVE-Gym/smallest_circle,MIT,minimum_enclosing_circle,60,agentic_trivial
143
+ rlve_subgraph_isomorphism,construct,competition,graph_theory,RLVE-Gym/subgraph_isomorphism,MIT,induced_subgraph_isomorphism,60,agentic_trivial;np_search
grade.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Grade an answer for a row of the flat dataset, with no Docker and no LLM.
2
+
3
+ from grade import grade
4
+ reward, details = grade(row, answer_dict)
5
+
6
+ `row` is a dataset row (needs `family` and `instance`); `answer_dict` is the parsed JSON answer.
7
+ Construct tasks return 1.0 for any valid witness, else 0.0. Optimize tasks return 0 if invalid,
8
+ otherwise 0.1 + 0.9 * progress from a trivial baseline to the best known value (see graders/run.py).
9
+ Requires python>=3.10 with numpy, scipy, sympy, networkx.
10
+ """
11
+ import importlib.util
12
+ import json
13
+ import sys
14
+ from pathlib import Path
15
+
16
+ _HERE = Path(__file__).resolve().parent / "graders"
17
+ _cache = {}
18
+
19
+
20
+ def _load(name, path):
21
+ spec = importlib.util.spec_from_file_location(name, path)
22
+ mod = importlib.util.module_from_spec(spec)
23
+ sys.modules[name] = mod
24
+ spec.loader.exec_module(mod)
25
+ return mod
26
+
27
+
28
+ def _check_fn(family):
29
+ if family not in _cache:
30
+ if "run" not in sys.modules:
31
+ _load("run", _HERE / "run.py")
32
+ _cache[family] = _load(f"check_{family}", _HERE / family / "check.py").check
33
+ return _cache[family]
34
+
35
+
36
+ def grade(row, answer):
37
+ inst = row["instance"]
38
+ if isinstance(inst, str):
39
+ inst = json.loads(inst)
40
+ run = sys.modules.get("run") or _load("run", _HERE / "run.py")
41
+ return run.grade(inst, answer, _check_fn(row["family"]))
graders/__pycache__/run.cpython-314.pyc ADDED
Binary file (8 kB). View file
 
graders/ae_p10_kakeya_3d/__pycache__/check.cpython-314.pyc ADDED
Binary file (6.05 kB). View file
 
graders/ae_p10_kakeya_3d/check.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """3D Kakeya needle problem (AlphaEvolve problem 10): volume of a union of n^2 sheared square tubes.
2
+
3
+ Tube (i, j) (0 <= i, j < n, answer index k = i*n + j) has horizontal cross-section at height z in [0, 1]
4
+ [x_k + i z/n, x_k + i z/n + 1/n] x [y_k + j z/n, y_k + j z/n + 1/n].
5
+ The union's cross-sectional area A(z) is piecewise quadratic in z, with breakpoints only where two x-edges or two
6
+ y-edges cross; we integrate it exactly with Simpson's rule between consecutive breakpoints (float64 arithmetic).
7
+ Upstream (kakeya_needle_3d.ipynb) estimated the volume by Monte Carlo over a 2.5 x 2.5 x 1 box (which also
8
+ silently truncated tubes leaving that box); this deterministic computation replaces it.
9
+ """
10
+ import numpy as np
11
+
12
+ from run import Invalid, float_list
13
+
14
+
15
+ def _crossings(e0, sl):
16
+ d0 = e0[:, None] - e0[None, :]
17
+ ds = sl[None, :] - sl[:, None]
18
+ with np.errstate(divide="ignore", invalid="ignore"):
19
+ z = d0 / ds
20
+ z = z[(ds != 0) & np.isfinite(z)]
21
+ return z[(z > 0) & (z < 1)]
22
+
23
+
24
+ def _area(z, x, y, i, j, n):
25
+ lx = x + i * z / n
26
+ ly = y + j * z / n
27
+ xs = np.unique(np.concatenate([lx, lx + 1.0 / n]))
28
+ ys = np.unique(np.concatenate([ly, ly + 1.0 / n]))
29
+ a0, a1 = np.searchsorted(xs, lx), np.searchsorted(xs, lx + 1.0 / n)
30
+ b0, b1 = np.searchsorted(ys, ly), np.searchsorted(ys, ly + 1.0 / n)
31
+ D = np.zeros((len(xs) + 1, len(ys) + 1))
32
+ np.add.at(D, (a0, b0), 1)
33
+ np.add.at(D, (a1, b0), -1)
34
+ np.add.at(D, (a0, b1), -1)
35
+ np.add.at(D, (a1, b1), 1)
36
+ C = D.cumsum(0).cumsum(1)[:-2, :-2] > 0.5
37
+ return float((C * np.diff(xs)[:, None] * np.diff(ys)[None, :]).sum())
38
+
39
+
40
+ def volume(x, y, n):
41
+ k = np.arange(n * n)
42
+ i, j = (k // n).astype(float), (k % n).astype(float)
43
+ zb = np.concatenate([[0.0, 1.0],
44
+ _crossings(np.concatenate([x, x + 1.0 / n]), np.concatenate([i, i]) / n),
45
+ _crossings(np.concatenate([y, y + 1.0 / n]), np.concatenate([j, j]) / n)])
46
+ zb = np.unique(zb)
47
+ fa = np.array([_area(z, x, y, i, j, n) for z in zb])
48
+ mids = (zb[:-1] + zb[1:]) / 2
49
+ fm = np.array([_area(z, x, y, i, j, n) for z in mids])
50
+ return float(np.sum(np.diff(zb) * (fa[:-1] + 4 * fm + fa[1:]) / 6))
51
+
52
+
53
+ def check(inst, ans):
54
+ n = inst["n"]
55
+ x = np.array(float_list(ans.get("x"), n * n, "x"))
56
+ y = np.array(float_list(ans.get("y"), n * n, "y"))
57
+ if np.abs(x).max() > 100 or np.abs(y).max() > 100:
58
+ raise Invalid("offsets must satisfy |x|, |y| <= 100")
59
+ return volume(x, y, n), {}
graders/ae_p16_gagliardo_nirenberg/__pycache__/check.cpython-314.pyc ADDED
Binary file (2.86 kB). View file
 
graders/ae_p16_gagliardo_nirenberg/check.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Nagy / Gagliardo-Nirenberg quotient Q(f) = ||f||_p^{4p} / (||f||_2^{2(p+2)} ||f'||_2^{2(p-2)}), integer p.
2
+
3
+ f is the non-negative piecewise-linear function with f(0) = f(m+1) = 0 and f(k) = values[k-1] (unit spacing;
4
+ Q is invariant under dilation and scaling, and |f| has the same norms as f, so this is no restriction in the
5
+ limit). All three norms are integrated exactly (polynomials on each unit segment). Upstream
6
+ (classical_inequalities.ipynb) sampled a user-supplied callable on [-15, 15]; this closed form replaces it.
7
+ """
8
+ import numpy as np
9
+
10
+ from run import Invalid, float_list
11
+
12
+
13
+ def check(inst, ans):
14
+ p = inst["p"]
15
+ v = float_list(ans.get("values"), None, "values")
16
+ if not 1 <= len(v) <= inst["max_len"]:
17
+ raise Invalid(f"need 1 <= len(values) <= {inst['max_len']}")
18
+ f = np.array([0.0] + v + [0.0])
19
+ if f.min() < 0 or f.max() > 1e6 or f.max() <= 0:
20
+ raise Invalid("values must be non-negative, at most 1e6, and not all zero")
21
+ f = f / f.max()
22
+ c0, c1 = f[:-1], f[1:]
23
+ lp = sum(float(np.sum(c0 ** k * c1 ** (p - k))) for k in range(p + 1)) / (p + 1) # int f^p
24
+ l2 = float(np.sum(c0 * c0 + c0 * c1 + c1 * c1)) / 3 # int f^2
25
+ d2 = float(np.sum((c1 - c0) ** 2)) # int f'^2
26
+ q = lp ** 4 / (l2 ** (p + 2) * d2 ** (p - 2))
27
+ return q, {}
graders/ae_p17_young_convolution/__pycache__/check.cpython-314.pyc ADDED
Binary file (4.03 kB). View file
 
graders/ae_p17_young_convolution/check.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Young's convolution inequality quotient ||f*g||_r / (||f||_p ||g||_q) for non-negative step functions.
2
+
3
+ f = sum_i a_i 1_[i, i+1), g = sum_j b_j 1_[j, j+1); then f*g is piecewise linear with knot values
4
+ (f*g)(k) = sum_{i+j=k-1} a_i b_j, so all three norms are integrated exactly (up to float64 rounding).
5
+ Upstream (classical_inequalities.ipynb) used np.convolve(mode="same") on samples of user callables, which
6
+ truncates the convolution's support; this closed form replaces it.
7
+ """
8
+ import numpy as np
9
+
10
+ from run import Invalid, float_list
11
+
12
+
13
+ def _seg_power_integral(c0, c1, r):
14
+ """int_0^1 ((1-s) c0 + s c1)^r ds for non-negative c0, c1 (vectorised, cancellation-free)."""
15
+ hi, lo = np.maximum(c0, c1), np.minimum(c0, c1)
16
+ out = np.zeros_like(hi)
17
+ pos = hi > 0
18
+ t = lo[pos] / hi[pos]
19
+ with np.errstate(divide="ignore"):
20
+ u = np.log(t)
21
+ num, den = np.expm1((r + 1) * u), np.expm1(u)
22
+ ratio = np.where(u == 0, r + 1, num / np.where(u == 0, 1.0, den)) # (1 - t^{r+1}) / (1 - t)
23
+ out[pos] = hi[pos] ** r * ratio / (r + 1)
24
+ return out
25
+
26
+
27
+ def _vec(v, name, max_len):
28
+ a = np.array(float_list(v, None, name))
29
+ if not 1 <= len(a) <= max_len:
30
+ raise Invalid(f"need 1 <= len({name}) <= {max_len}")
31
+ if a.min() < 0 or a.max() > 1e6 or a.max() <= 0:
32
+ raise Invalid(f"{name}: entries must be in [0, 1e6] and not all zero")
33
+ return a / a.max()
34
+
35
+
36
+ def check(inst, ans):
37
+ p, q = inst["p"], inst["q"]
38
+ r = 1.0 / (1.0 / p + 1.0 / q - 1.0)
39
+ a = _vec(ans.get("f"), "f", inst["max_len"])
40
+ b = _vec(ans.get("g"), "g", inst["max_len"])
41
+ c = np.concatenate([[0.0], np.convolve(a, b), [0.0]])
42
+ conv_r = float(np.sum(_seg_power_integral(c[:-1], c[1:], r))) ** (1.0 / r)
43
+ fp = float(np.sum(a ** p)) ** (1.0 / p)
44
+ gq = float(np.sum(b ** q)) ** (1.0 / q)
45
+ return conv_r / (fp * gq), {"r": r}
graders/ae_p18_hardy_littlewood_maximal/__pycache__/check.cpython-314.pyc ADDED
Binary file (3.88 kB). View file
 
graders/ae_p18_hardy_littlewood_maximal/check.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Weak (1,1) constant of the centred Hardy-Littlewood maximal operator on R, via finite point-mass measures.
2
+
3
+ For mu = sum_i w_i delta_{a_i}, M mu(x) >= 1 iff x lies in some [a_j - S_ij/2, a_i + S_ij/2] (i <= j in sorted
4
+ order, S_ij = w_i + ... + w_j): the sup over h is attained when [x-h, x+h] just covers a contiguous block of
5
+ atoms. The level set is a finite union of intervals whose length is computed exactly in rationals.
6
+ (Upstream classical_inequalities.ipynb sampled functions on a grid; this exact formulation replaces it.)
7
+ """
8
+ from fractions import Fraction
9
+
10
+ from run import Invalid, float_list
11
+
12
+
13
+ def check(inst, ans):
14
+ a = float_list(ans.get("positions"), None, "positions")
15
+ w = float_list(ans.get("weights"), None, "weights")
16
+ n = len(a)
17
+ if not 1 <= n <= inst["max_atoms"] or len(w) != n:
18
+ raise Invalid(f"need 1 <= #atoms <= {inst['max_atoms']} and one weight per position")
19
+ if any(abs(x) > 1e6 for x in a) or any(not 1e-9 <= x <= 1e6 for x in w):
20
+ raise Invalid("positions must satisfy |a| <= 1e6 and weights must lie in [1e-9, 1e6]")
21
+ if len(set(a)) != n:
22
+ raise Invalid("positions must be distinct")
23
+ atoms = sorted(zip(map(Fraction, a), map(Fraction, w)))
24
+ pos = [p for p, _ in atoms]
25
+ cum = [Fraction(0)]
26
+ for _, x in atoms:
27
+ cum.append(cum[-1] + x)
28
+ iv = []
29
+ for i in range(n):
30
+ for j in range(i, n):
31
+ half = (cum[j + 1] - cum[i]) / 2
32
+ lo, hi = pos[j] - half, pos[i] + half
33
+ if lo <= hi:
34
+ iv.append((lo, hi))
35
+ iv.sort()
36
+ total = Fraction(0)
37
+ cl, cr = iv[0]
38
+ for lo, hi in iv[1:]:
39
+ if lo > cr:
40
+ total += cr - cl
41
+ cl, cr = lo, hi
42
+ elif hi > cr:
43
+ cr = hi
44
+ total += cr - cl
45
+ return float(total / cum[-1]), {"level_set_length": float(total), "mass": float(cum[-1])}
graders/ae_p1_ff_kakeya/__pycache__/check.cpython-314.pyc ADDED
Binary file (2.82 kB). View file
 
graders/ae_p1_ff_kakeya/check.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Finite-field Kakeya set in F_p^d: every direction contains a full line. Score = |K| (minimize).
2
+
3
+ Upstream (AlphaEvolve notebook `finite_field_kakeya.ipynb`) silently deduplicated points and only checked
4
+ d in {3, 4}; here duplicates, out-of-range or non-integer coordinates are rejected and every projective
5
+ direction (first non-zero coordinate = 1) is checked for any d.
6
+ """
7
+ import itertools
8
+
9
+ import numpy as np
10
+
11
+ from run import Invalid, int_list
12
+
13
+
14
+ def check(inst, ans):
15
+ p, d = inst["p"], inst["d"]
16
+ pts = ans.get("points")
17
+ if not isinstance(pts, list) or not pts:
18
+ raise Invalid("points must be a non-empty list")
19
+ if len(pts) > p ** d:
20
+ raise Invalid("more points than the whole space")
21
+ K = np.array([int_list(x, d, 0, p - 1, "point") for x in pts], dtype=np.int64)
22
+ w = p ** np.arange(d - 1, -1, -1, dtype=np.int64)
23
+ codes = K @ w
24
+ if len(np.unique(codes)) != len(codes):
25
+ raise Invalid("duplicate points")
26
+ for i in range(d): # directions v = (0,..,0,1,*,..,*) with the 1 in position i
27
+ for tail in itertools.product(range(p), repeat=d - 1 - i):
28
+ v = np.array([0] * i + [1] + list(tail), dtype=np.int64)
29
+ base = (K - K[:, i:i + 1] * v) % p # canonical point of the line through x with direction v
30
+ if np.bincount(base @ w, minlength=p ** d).max() < p:
31
+ raise Invalid(f"no full line in direction {v.tolist()}")
32
+ return len(pts), {"size": len(pts)}
graders/ae_p1_ff_nikodym/__pycache__/check.cpython-314.pyc ADDED
Binary file (3.85 kB). View file
 
graders/ae_p1_ff_nikodym/check.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Finite-field Nikodym set N in F_p^3, submitted as its complement. Score = |N| (minimize).
2
+
3
+ Every point x of F_p^3 needs a direction v != 0 with x + t v in N for all t != 0 (x itself may lie outside N).
4
+ Upstream (AlphaEvolve `finite_field_nikodym.ipynb`) deduplicated silently; here the complement list must be
5
+ duplicate-free and in range. All p^2 + p + 1 projective directions are checked, vectorised over all points.
6
+ """
7
+ import itertools
8
+
9
+ import numpy as np
10
+
11
+ from run import Invalid, int_list
12
+
13
+
14
+ def check(inst, ans):
15
+ p, d = inst["p"], 3
16
+ rem = ans.get("removed")
17
+ if not isinstance(rem, list):
18
+ raise Invalid("removed must be a list")
19
+ if len(rem) >= p ** d:
20
+ raise Invalid("cannot remove every point")
21
+ w = np.array([p * p, p, 1], dtype=np.int64)
22
+ R = np.array([int_list(x, d, 0, p - 1, "point") for x in rem], dtype=np.int64).reshape(-1, d)
23
+ codes_r = R @ w
24
+ if len(np.unique(codes_r)) != len(codes_r):
25
+ raise Invalid("duplicate removed points")
26
+ in_n = np.ones(p ** d, dtype=bool)
27
+ in_n[codes_r] = False
28
+ X = np.stack(np.unravel_index(np.arange(p ** d), (p,) * d), axis=1).astype(np.int64)
29
+ good = np.zeros(p ** d, dtype=bool)
30
+ need = p - 1 + in_n.astype(np.int64) # points of N on the line through x, other than x, must number p-1
31
+ done = False
32
+ for i in range(d):
33
+ for tail in itertools.product(range(p), repeat=d - 1 - i):
34
+ v = np.array([0] * i + [1] + list(tail), dtype=np.int64)
35
+ lid = ((X - X[:, i:i + 1] * v) % p) @ w
36
+ cnt = np.bincount(lid[in_n], minlength=p ** d)
37
+ good |= cnt[lid] == need
38
+ if good.all():
39
+ done = True
40
+ break
41
+ if done:
42
+ break
43
+ if not done:
44
+ x = np.flatnonzero(~good)[0]
45
+ raise Invalid(f"point {X[x].tolist()} lies on no punctured line inside N")
46
+ size = p ** d - len(rem)
47
+ return size, {"size": size}
graders/ae_p24_de_bruijn_sharma/__pycache__/check.cpython-314.pyc ADDED
Binary file (2.74 kB). View file
 
graders/ae_p24_de_bruijn_sharma/check.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """de Bruijn-Sharma problem, x-intercept: maximise sum |xi|^4 / sum |z|^4 over degree-n polynomials with
2
+ zeros summing to 0 (xi = critical points). Each polynomial P excludes all (alpha, 0) with alpha below its ratio.
3
+
4
+ Upstream (de_bruijn_sharma_problem.ipynb) rejected |sum z| > 1e-9 in absolute terms (not scale invariant) and
5
+ scored a region area; here the zero-sum condition is relative and the roots are re-centred before scoring.
6
+ Critical points come from numpy's companion-matrix eigenvalues (float64).
7
+ """
8
+ import numpy as np
9
+
10
+ from run import Invalid, float_matrix
11
+
12
+
13
+ def check(inst, ans):
14
+ n = inst["n"]
15
+ Z = np.array(float_matrix(ans.get("roots"), n, 2, "roots"))
16
+ z = Z[:, 0] + 1j * Z[:, 1]
17
+ if np.abs(z).max() > 1e3:
18
+ raise Invalid("roots must satisfy |z| <= 1000")
19
+ s1 = np.abs(z).sum()
20
+ if s1 < 1e-6:
21
+ raise Invalid("all roots are (nearly) zero")
22
+ if abs(z.sum()) > 1e-9 * s1:
23
+ raise Invalid("the roots must sum to zero (|sum z| <= 1e-9 * sum |z|)")
24
+ z = z - z.mean()
25
+ xi = np.roots(np.polyder(np.poly(z)))
26
+ if len(xi) != n - 1 or not np.all(np.isfinite(xi)):
27
+ raise Invalid("could not compute the critical points")
28
+ c4 = float(np.sum(np.abs(z) ** 4))
29
+ return float(np.sum(np.abs(xi) ** 4)) / c4, {}
graders/ae_p29_block_stacking/__pycache__/check.cpython-314.pyc ADDED
Binary file (1.77 kB). View file
 
graders/ae_p29_block_stacking/check.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Block stacking (overhang) problem, closed form of the constraints; checked in exact rational arithmetic.
2
+
3
+ Upstream (block_stacking_problem.ipynb) used a float tolerance of 100*eps on every constraint, which lets a
4
+ submission exceed the true optimum H_n/2 by accumulated slack; here all constraints are exact (non-strict).
5
+ """
6
+ from fractions import Fraction
7
+
8
+ from run import Invalid, float_list
9
+
10
+
11
+ def check(inst, ans):
12
+ n = inst["n"]
13
+ x = [Fraction(v) for v in float_list(ans.get("x"), n, "x")]
14
+ xs = [Fraction(0)] + x # x_0 = 0
15
+ for i in range(n):
16
+ if xs[i + 1] < xs[i]:
17
+ raise Invalid(f"need x_{i} <= x_{i + 1}")
18
+ tail = Fraction(0)
19
+ for i in range(n - 1, -1, -1): # tail = x_{i+1} + ... + x_n
20
+ tail += xs[i + 1]
21
+ if tail > (n - i) * (xs[i] + Fraction(1, 2)):
22
+ raise Invalid(f"stability constraint violated at i = {i}")
23
+ return float(xs[n]), {}
graders/ae_p30_arithmetic_kakeya/__pycache__/check.cpython-314.pyc ADDED
Binary file (3.68 kB). View file
 
graders/ae_p30_arithmetic_kakeya/check.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Arithmetic Kakeya / entropic sum-difference ratio H(X - Y) / max_r H(X + r Y) for an integer-valued (X, Y).
2
+
3
+ Upstream (arithmetic_kakeya_conjecture.ipynb) silently clipped negative entries, re-normalised, and "repaired"
4
+ colliding differences by moving probability mass (so the scored distribution was not the submitted one), and one
5
+ variant put the JOINT entropy in the numerator. Here the submitted distribution is scored as is.
6
+ """
7
+ import math
8
+ from collections import defaultdict
9
+
10
+ from run import Invalid, float_list, int_list
11
+
12
+
13
+ def _entropy(keys, p):
14
+ acc = defaultdict(float)
15
+ for k, v in zip(keys, p):
16
+ acc[k] += v
17
+ return -sum(v * math.log(v) for v in acc.values() if v > 0)
18
+
19
+
20
+ def check(inst, ans):
21
+ sup = ans.get("support")
22
+ if not isinstance(sup, list) or not 2 <= len(sup) <= inst["max_support"]:
23
+ raise Invalid(f"support must be a list of 2..{inst['max_support']} points")
24
+ pts = [tuple(int_list(s, 2, -10 ** 6, 10 ** 6, "support point")) for s in sup]
25
+ if len(set(pts)) != len(pts):
26
+ raise Invalid("support points must be distinct")
27
+ w = float_list(ans.get("weights"), len(pts), "weights")
28
+ if min(w) < 0 or max(w) > 1e300:
29
+ raise Invalid("weights must be non-negative")
30
+ tot = math.fsum(w)
31
+ if not tot > 0:
32
+ raise Invalid("weights must not all vanish")
33
+ p = [v / tot for v in w]
34
+ num = _entropy([x - y for x, y in pts], p)
35
+ den = max(_entropy([y if r == "inf" else x + r * y for x, y in pts], p) for r in inst["slopes"])
36
+ if den < 1e-12:
37
+ raise Invalid("degenerate distribution (all projections constant)")
38
+ return num / den, {"H_diff": num, "H_max": den}
graders/ae_p31_furstenberg_sarkozy/__pycache__/check.cpython-314.pyc ADDED
Binary file (3.31 kB). View file
 
graders/ae_p31_furstenberg_sarkozy/check.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Ruzsa-type modular construction for the Furstenberg-Sarkozy problem.
2
+
3
+ A subset A of Z/mZ (m square-free) with no two distinct elements differing by a non-zero k-th power residue
4
+ gives subsets of {1..N} with no k-th power differences of size N^{(k-1)/k + log|A|/(k log m)} (Ruzsa 1984).
5
+ Score = that exponent. Mirrors upstream `get_score` (furstenberg_sarkozy_problem.ipynb), which silently
6
+ reduced/deduplicated the list; here entries must be distinct residues in [0, m).
7
+ """
8
+ import math
9
+
10
+ import numpy as np
11
+
12
+ from run import Invalid, as_int, int_list
13
+
14
+
15
+ def squarefree(m):
16
+ d = 2
17
+ while d * d <= m:
18
+ if m % (d * d) == 0:
19
+ return False
20
+ d += 1
21
+ return True
22
+
23
+
24
+ def check(inst, ans):
25
+ k = inst["k"]
26
+ m = as_int(ans.get("m"), "m", 2, inst["max_m"])
27
+ if not squarefree(m):
28
+ raise Invalid("m must be square-free")
29
+ A = int_list(ans.get("residues"), None, 0, m - 1, "residues")
30
+ if not 1 <= len(A) <= inst["max_size"]:
31
+ raise Invalid(f"need 1 <= |A| <= {inst['max_size']}")
32
+ if len(set(A)) != len(A):
33
+ raise Invalid("duplicate residues")
34
+ y = np.arange(1, m, dtype=np.int64)
35
+ r = y % m
36
+ for _ in range(k - 1):
37
+ r = (r * y) % m
38
+ forb = np.zeros(m, dtype=bool)
39
+ forb[r] = True
40
+ forb[0] = False
41
+ a = np.array(A, dtype=np.int64)
42
+ diff = (a[:, None] - a[None, :]) % m
43
+ np.fill_diagonal(diff, 0)
44
+ if forb[diff].any():
45
+ i, j = np.argwhere(forb[diff])[0]
46
+ raise Invalid(f"{A[i]} - {A[j]} is a non-zero k-th power residue mod {m} (k = {k})")
47
+ return (k - 1) / k + math.log(len(A)) / (k * math.log(m)), {"m": m, "size": len(A)}
graders/ae_p32_spherical_designs/__pycache__/check.cpython-314.pyc ADDED
Binary file (5.14 kB). View file
 
graders/ae_p32_spherical_designs/check.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Spherical t-design with N points on S^2 (numerical, tolerance 1e-10 on every harmonic average).
2
+
3
+ Upstream (AlphaEvolve `spherical_t_designs.ipynb`) scored sum_k dim_k/C_k(1) * sum_{i,j} C_k(<x_i,x_j>), whose
4
+ pair sums cancel to ~1e-10 in float64 and can even go negative; its printed acceptance test
5
+ `calculate_design_score(...) < 1e-8` compares the NEGATED error and is therefore always true (bug). Here we
6
+ evaluate the point averages of an orthonormal real spherical-harmonic basis directly (no cancellation).
7
+ """
8
+ import numpy as np
9
+
10
+ from run import Invalid, float_matrix
11
+
12
+ TOL = 1e-10
13
+
14
+
15
+ def harmonics(X, t):
16
+ """Rows: real spherical harmonics Y_lm (1 <= l <= t) normalised so that their mean square on S^2 is 1."""
17
+ ct = np.clip(X[:, 2], -1.0, 1.0)
18
+ st = np.sqrt(np.maximum(0.0, 1.0 - ct * ct))
19
+ ph = np.arctan2(X[:, 1], X[:, 0])
20
+ P = {(0, 0): np.ones_like(ct)}
21
+ for m in range(1, t + 1):
22
+ P[(m, m)] = (np.sqrt(3.0) if m == 1 else np.sqrt((2 * m + 1) / (2 * m))) * st * P[(m - 1, m - 1)]
23
+ for m in range(0, t):
24
+ P[(m + 1, m)] = np.sqrt(2 * m + 3) * ct * P[(m, m)]
25
+ for m in range(0, t + 1):
26
+ for l in range(m + 2, t + 1):
27
+ a = np.sqrt((4 * l * l - 1) / (l * l - m * m))
28
+ b = np.sqrt(((l - 1) ** 2 - m * m) / (4 * (l - 1) ** 2 - 1))
29
+ P[(l, m)] = a * (ct * P[(l - 1, m)] - b * P[(l - 2, m)])
30
+ rows = []
31
+ for l in range(1, t + 1):
32
+ rows.append(P[(l, 0)])
33
+ for m in range(1, l + 1):
34
+ rows.append(P[(l, m)] * np.cos(m * ph))
35
+ rows.append(P[(l, m)] * np.sin(m * ph))
36
+ return np.array(rows)
37
+
38
+
39
+ def check(inst, ans):
40
+ t, n = inst["t"], inst["N"]
41
+ X = np.array(float_matrix(ans.get("points"), n, 3, "points"))
42
+ nr = np.linalg.norm(X, axis=1)
43
+ if nr.min() < 0.5 or nr.max() > 2.0:
44
+ raise Invalid("points must be (approximately) unit vectors")
45
+ X = X / nr[:, None]
46
+ G = X @ X.T
47
+ np.fill_diagonal(G, -1.0)
48
+ if G.max() > 1.0 - 1e-8:
49
+ raise Invalid("two points coincide (or nearly: distance < 1.4e-4)")
50
+ dev = np.abs(harmonics(X, t).mean(axis=1)).max()
51
+ if not dev <= TOL:
52
+ raise Invalid(f"not a {t}-design: some harmonic of degree <= {t} has point average {dev:.3e} > {TOL}")
53
+ return None, {"max_harmonic_average": float(dev)}
graders/ae_p35_cubes_in_cube/__pycache__/check.cpython-314.pyc ADDED
Binary file (4.92 kB). View file
 
graders/ae_p35_cubes_in_cube/check.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Packing n unit cubes (arbitrary orientation) in the smallest axis-aligned cube (AlphaEvolve problem 35).
2
+
3
+ Cube = centre + Euler angles in degrees, R = Rz(rz) Ry(ry) Rx(rx) (upstream convention). Disjoint interiors are
4
+ checked with the separating-axis theorem over the 15 candidate axes; projections may overlap by at most
5
+ inst["tol"] (floating-point slack). Score = largest side of the axis-aligned bounding box (minimize)."""
6
+ import itertools
7
+ import math
8
+
9
+ import numpy as np
10
+
11
+ from run import Invalid, float_matrix
12
+
13
+
14
+ def rot(rx, ry, rz):
15
+ x, y, z = map(math.radians, (rx, ry, rz))
16
+ cx, sx, cy, sy, cz, sz = math.cos(x), math.sin(x), math.cos(y), math.sin(y), math.cos(z), math.sin(z)
17
+ mx = np.array([[1, 0, 0], [0, cx, -sx], [0, sx, cx]])
18
+ my = np.array([[cy, 0, sy], [0, 1, 0], [-sy, 0, cy]])
19
+ mz = np.array([[cz, -sz, 0], [sz, cz, 0], [0, 0, 1]])
20
+ return mz @ my @ mx
21
+
22
+
23
+ LOCAL = np.array(list(itertools.product((-0.5, 0.5), repeat=3)))
24
+
25
+
26
+ def check(inst, ans):
27
+ n, tol = inst["n"], inst["tol"]
28
+ rows = float_matrix(ans.get("cubes"), n, 6, "cubes")
29
+ cubes = []
30
+ for r in rows:
31
+ if max(abs(v) for v in r[:3]) > 1e3 or max(abs(v) for v in r[3:]) > 1e4:
32
+ raise Invalid("coordinates or angles out of range")
33
+ m = rot(*r[3:])
34
+ cubes.append((m, LOCAL @ m.T + np.array(r[:3])))
35
+ for (m1, v1), (m2, v2) in itertools.combinations(cubes, 2):
36
+ axes = [m1[:, i] for i in range(3)] + [m2[:, i] for i in range(3)]
37
+ axes += [np.cross(m1[:, i], m2[:, j]) for i in range(3) for j in range(3)]
38
+ separated = False
39
+ for a in axes:
40
+ na = np.linalg.norm(a)
41
+ if na < 1e-9:
42
+ continue
43
+ a = a / na
44
+ p1, p2 = v1 @ a, v2 @ a
45
+ if min(p1.max(), p2.max()) - max(p1.min(), p2.min()) <= tol:
46
+ separated = True
47
+ break
48
+ if not separated:
49
+ raise Invalid("two cubes overlap")
50
+ allv = np.vstack([v for _, v in cubes])
51
+ return float((allv.max(0) - allv.min(0)).max()), {}
graders/ae_p37_turan_tetrahedron/__pycache__/check.cpython-314.pyc ADDED
Binary file (3.44 kB). View file
 
graders/ae_p37_turan_tetrahedron/check.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hypergraph Turan density of the tetrahedron K_4^(3) via weighted blow-up patterns (AlphaEvolve problem 37).
2
+
3
+ Upstream silently *deleted* edges to repair K4 copies; we instead reject any pattern whose blow-up contains a
4
+ K_4^(3), and check it exactly (combinatorial condition on 4-multisets of classes)."""
5
+ import itertools
6
+
7
+ from run import Invalid, float_list, int_list
8
+
9
+
10
+ def check(inst, ans):
11
+ w = float_list(ans.get("weights"), None, "weights")
12
+ k = len(w)
13
+ if not 1 <= k <= inst["max_classes"]:
14
+ raise Invalid(f"need 1..{inst['max_classes']} classes")
15
+ if any(x < 0 for x in w) or sum(w) <= 0:
16
+ raise Invalid("weights must be non-negative with positive sum")
17
+ edges = ans.get("edges")
18
+ if not isinstance(edges, list):
19
+ raise Invalid("edges must be a list")
20
+ es = set()
21
+ for e in edges:
22
+ int_list(e, 3, 0, k - 1, "edge")
23
+ if not (e[0] <= e[1] <= e[2]):
24
+ raise Invalid("each edge type must be sorted: [a, b, c] with a <= b <= c")
25
+ if e[0] == e[2]:
26
+ raise Invalid("edge type [a, a, a] is not allowed (its blow-up contains K_4^(3))")
27
+ if tuple(e) in es:
28
+ raise Invalid("duplicate edge type")
29
+ es.add(tuple(e))
30
+ for m in itertools.combinations_with_replacement(range(k), 4):
31
+ subs = {tuple(sorted(m[:i] + m[i + 1:])) for i in range(4)}
32
+ if subs <= es:
33
+ raise Invalid(f"blow-up contains a tetrahedron on classes {list(m)}")
34
+ t = sum(w)
35
+ p = [x / t for x in w]
36
+ dens = 0.0
37
+ for a, b, c in es:
38
+ dens += (6.0 if len({a, b, c}) == 3 else 3.0) * p[a] * p[b] * p[c]
39
+ return dens, {"classes": k, "edge_types": len(es)}
graders/ae_p38_factorial_factors/__pycache__/check.cpython-314.pyc ADDED
Binary file (1.03 kB). View file
 
graders/ae_p38_factorial_factors/check.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check."""
2
+ import math
3
+
4
+ from run import Invalid, int_list
5
+
6
+
7
+ def check(inst, ans):
8
+ n, t = inst["N"], inst["t"]
9
+ f = int_list(ans.get("factors"), n, t, None, "factors")
10
+ if math.prod(f) != math.factorial(n):
11
+ raise Invalid(f"the product of the factors is not {n}!")
12
+ return None, {"min_factor": min(f)}
graders/ae_p39_beat_the_average/__pycache__/check.cpython-314.pyc ADDED
Binary file (3.31 kB). View file
 
graders/ae_p39_beat_the_average/check.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Beat-the-average game (AlphaEvolve problem 39): maximize P[X1+X2+X3 < 2 X4] for iid X on the integers.
2
+
3
+ Sparse re-implementation of the upstream convolution score; ties (X1+X2+X3 = 2 X4) are decided exactly
4
+ because the support is integral."""
5
+ import numpy as np
6
+
7
+ from run import Invalid, float_list, int_list
8
+
9
+
10
+ def check(inst, ans):
11
+ s = ans.get("support")
12
+ w = ans.get("weights")
13
+ if not isinstance(s, list) or not (1 <= len(s) <= inst["max_support"]):
14
+ raise Invalid(f"support must be a list of 1..{inst['max_support']} integers")
15
+ int_list(s, None, 0, inst["max_value"], "support")
16
+ if len(set(s)) != len(s):
17
+ raise Invalid("support values must be distinct")
18
+ w = float_list(w, len(s), "weights")
19
+ if any(x < 0 for x in w) or sum(w) <= 1e-12:
20
+ raise Invalid("weights must be non-negative with positive sum")
21
+ x = np.array(s, dtype=np.int64)
22
+ p = np.array(w, dtype=np.float64)
23
+ p = p / p.sum()
24
+ z = np.add.outer(x, x).ravel() # X1 + X2
25
+ pz = np.multiply.outer(p, p).ravel()
26
+ order = np.argsort(z, kind="stable")
27
+ z, cz = z[order], np.concatenate([[0.0], np.cumsum(pz[order])])
28
+ t = (2 * x[None, :] - x[:, None]).ravel() # need X1+X2 < 2 X4 - X3; rows X3, cols X4
29
+ pt = np.multiply.outer(p, p).ravel()
30
+ prob = float(np.dot(pt, cz[np.searchsorted(z, t, side="left")]))
31
+ return prob, {"support_size": len(s)}
graders/ae_p40_erdos_discrepancy/__pycache__/check.cpython-314.pyc ADDED
Binary file (2.27 kB). View file
 
graders/ae_p40_erdos_discrepancy/check.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Erdos discrepancy problem, C = 2 (AlphaEvolve problem 40): longest +-1 sequence with discrepancy <= 2.
2
+
3
+ Upstream scored the longest good prefix (plus a fractional bonus); we require the whole submitted sequence to
4
+ have discrepancy <= C and score its length (exact integer check)."""
5
+ import numpy as np
6
+
7
+ from run import Invalid, int_list
8
+
9
+
10
+ def check(inst, ans):
11
+ x = ans.get("sequence")
12
+ if not isinstance(x, list) or not (1 <= len(x) <= inst["max_length"]):
13
+ raise Invalid(f"sequence must be a list of 1..{inst['max_length']} entries")
14
+ int_list(x, None, -1, 1, "sequence")
15
+ if 0 in x:
16
+ raise Invalid("entries must be +1 or -1")
17
+ a = np.array(x, dtype=np.int64)
18
+ n, c = len(x), inst["C"]
19
+ for d in range(1, n + 1):
20
+ ps = np.cumsum(a[d - 1::d])
21
+ m = int(np.abs(ps).max())
22
+ if m > c:
23
+ k = int(np.argmax(np.abs(ps) > c)) + 1
24
+ raise Invalid(f"|x_{d} + x_{2*d} + ... + x_{k*d}| = {abs(int(ps[k-1]))} > {c}")
25
+ return float(n), {"length": n}
graders/ae_p41_sphere_max_volume/__pycache__/check.cpython-314.pyc ADDED
Binary file (1.91 kB). View file
 
graders/ae_p41_sphere_max_volume/check.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """n points on the unit sphere maximizing the volume of their convex hull (AlphaEvolve problem 41).
2
+
3
+ Upstream bug fixed: the notebook summed |det|/6 of origin-pyramids over (QJ-joggled) hull facets, which
4
+ over-counts whenever the origin lies outside the hull (e.g. all points in one hemisphere). We use the exact
5
+ hull volume (scipy ConvexHull.volume) of the normalized points, without joggling."""
6
+ import numpy as np
7
+ from scipy.spatial import ConvexHull
8
+
9
+ from run import Invalid, float_matrix
10
+
11
+
12
+ def check(inst, ans):
13
+ n = inst["n"]
14
+ p = np.array(float_matrix(ans.get("points"), n, 3, "points"))
15
+ nr = np.linalg.norm(p, axis=1)
16
+ if (nr < 1e-9).any() or (nr > 1e9).any():
17
+ raise Invalid("every point needs a non-zero, finite norm (it is projected to the unit sphere)")
18
+ p = p / nr[:, None]
19
+ try:
20
+ v = ConvexHull(p).volume
21
+ except Exception as e: # degenerate (coplanar) input
22
+ raise Invalid(f"degenerate hull: {type(e).__name__}")
23
+ return float(v), {}
graders/ae_p42_sum_difference_i/__pycache__/check.cpython-314.pyc ADDED
Binary file (2.09 kB). View file
 
graders/ae_p42_sum_difference_i/check.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Sum-difference problem I (AlphaEvolve problem 42): maximize log(|A+A|/|A|) / log(|A-A|/|A|)."""
2
+ import math
3
+
4
+ import numpy as np
5
+
6
+ from run import Invalid, int_list
7
+
8
+
9
+ def sizes(ans, max_size, max_abs):
10
+ a = ans.get("A")
11
+ if not isinstance(a, list) or not (2 <= len(a) <= max_size):
12
+ raise Invalid(f"A must be a list of 2..{max_size} integers")
13
+ int_list(a, None, -max_abs, max_abs, "A")
14
+ if len(set(a)) != len(a):
15
+ raise Invalid("A must consist of distinct integers")
16
+ x = np.array(a, dtype=np.int64)
17
+ return len(a), int(np.unique(np.add.outer(x, x)).size), int(np.unique(np.subtract.outer(x, x)).size)
18
+
19
+
20
+ def check(inst, ans):
21
+ n, s, d = sizes(ans, inst["max_size"], inst["max_abs"])
22
+ # |A-A| >= 2|A|-1 > |A| for |A| >= 2, so the denominator is positive
23
+ return math.log(s / n) / math.log(d / n), {"size": n, "sumset": s, "diffset": d}
graders/ae_p43_sum_difference_ii/__pycache__/check.cpython-314.pyc ADDED
Binary file (1.92 kB). View file
 
graders/ae_p43_sum_difference_ii/check.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Sum-difference problem II (AlphaEvolve problem 43): maximize log|A-A| / log|A+A|."""
2
+ import math
3
+
4
+ import numpy as np
5
+
6
+ from run import Invalid, int_list
7
+
8
+
9
+ def check(inst, ans):
10
+ a = ans.get("A")
11
+ if not isinstance(a, list) or not (2 <= len(a) <= inst["max_size"]):
12
+ raise Invalid(f"A must be a list of 2..{inst['max_size']} integers")
13
+ int_list(a, None, -inst["max_abs"], inst["max_abs"], "A")
14
+ if len(set(a)) != len(a):
15
+ raise Invalid("A must consist of distinct integers")
16
+ x = np.array(a, dtype=np.int64)
17
+ s = int(np.unique(np.add.outer(x, x)).size)
18
+ d = int(np.unique(np.subtract.outer(x, x)).size)
19
+ return math.log(d) / math.log(s), {"size": len(a), "sumset": s, "diffset": d}
graders/ae_p44_sum_difference_iii/__pycache__/check.cpython-314.pyc ADDED
Binary file (2.91 kB). View file
 
graders/ae_p44_sum_difference_iii/check.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Sum-difference problem III (AlphaEvolve problem 44).
2
+
3
+ A set U of non-negative integers with min U = 0 gives the lower bound
4
+ C >= 1 + log(|U-U| / |U+U|) / log(2 max U + 1)
5
+ (AlphaEvolve's compute_lower_bound). Upstream checked |U-U| <= 2 max U + 1, which always holds when
6
+ U is inside [0, max U]; we check the hypotheses (integers, distinct, min 0) instead.
7
+ """
8
+ import math
9
+
10
+ import numpy as np
11
+
12
+ from run import Invalid, int_list
13
+
14
+
15
+ def check(inst, ans):
16
+ u = ans.get("U")
17
+ if not isinstance(u, list) or not (2 <= len(u) <= inst["max_size"]):
18
+ raise Invalid(f"U must be a list of 2..{inst['max_size']} integers")
19
+ int_list(u, None, 0, inst["max_value"], "U")
20
+ if min(u) != 0:
21
+ raise Invalid("U must contain 0 and be non-negative")
22
+ if len(set(u)) != len(u):
23
+ raise Invalid("U must consist of distinct integers")
24
+ x = np.array(sorted(u), dtype=np.int64)
25
+ m = int(x[-1])
26
+ # bitmap sweeps with a buffer of m+1 bytes: U-U is symmetric, so count non-negative differences;
27
+ # U+U lies in [0, 2m], handled as two windows [0, m] and [m+1, 2m] (x sorted -> contiguous slices)
28
+ buf = np.zeros(m + 1, dtype=bool)
29
+ for i, v in enumerate(x):
30
+ buf[v - x[:i + 1]] = True
31
+ d = 2 * int(buf.sum()) - 1
32
+ s = 0
33
+ for lo in (0, m + 1):
34
+ buf[:] = False
35
+ for v in x:
36
+ t = v + x
37
+ a, b = np.searchsorted(t, lo), np.searchsorted(t, lo + m, side="right")
38
+ buf[t[a:b] - lo] = True
39
+ s += int(buf.sum())
40
+ del buf
41
+ return 1.0 + math.log(d / s) / math.log(2 * m + 1), {"size": len(u), "max": m, "diffset": d, "sumset": s}
graders/ae_p45_sum_product_fp/__pycache__/check.cpython-314.pyc ADDED
Binary file (1.62 kB). View file
 
graders/ae_p45_sum_product_fp/check.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Finite-field sum-product problem (AlphaEvolve problem 45): minimize max(|X+X|, |X*X|) in F_p, |X| = floor(sqrt p)."""
2
+ import numpy as np
3
+
4
+ from run import Invalid, int_list
5
+
6
+
7
+ def check(inst, ans):
8
+ p, k = inst["p"], inst["k"]
9
+ x = int_list(ans.get("X"), k, 0, p - 1, "X")
10
+ if len(set(x)) != k:
11
+ raise Invalid("X must consist of distinct residues")
12
+ a = np.array(sorted(x), dtype=np.int64)
13
+ s = int(np.unique(np.add.outer(a, a) % p).size)
14
+ q = int(np.unique(np.multiply.outer(a, a) % p).size) # products < p^2 < 2^63
15
+ return float(max(s, q)), {"sumset": s, "productset": q}
graders/ae_p52_erdos_squarefree/__pycache__/check.cpython-314.pyc ADDED
Binary file (3.46 kB). View file