diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..39736e0a3fb003f135860b8c585ff87b43ba8a64 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +--- +license: apache-2.0 +tags: +- library:harbor +- harbor +- math +- proofs +- evaluation +- agent-environment +--- +# IMO-ProofBench: Harbor tasks + +60 natural-language mathematical proof tasks adapted from Google DeepMind's [IMO-ProofBench v2](https://github.com/google-deepmind/superhuman/blob/8cea546c9c7209306b4d4ced7c5eacd51f23f928/imobench/proofbench_v2.csv), part of IMO-Bench. The data is from *Towards Robust Mathematical Reasoning* ([Luong et al., EMNLP 2025](https://aclanthology.org/2025.emnlp-main.1794/)). We convert each source row into a Harbor task and retain the original problem, reference solution and grading guidelines. No GradingBench rows are included. Copyright 2025 Google LLC. Upstream software is [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0); its other materials, including benchmark content, are [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The dataset card's Apache license tag refers to software; benchmark content remains CC BY 4.0. See [upstream license and citation](https://github.com/google-deepmind/superhuman/blob/main/imobench/README.md). + +| Category | Basic | Advanced | Total | +|---|---:|---:|---:| +| Algebra | 8 | 8 | 16 | +| Combinatorics | 8 | 8 | 16 | +| Geometry | 6 | 8 | 14 | +| Number theory | 8 | 6 | 14 | +| Total | 30 | 30 | 60 | + +Basic and Advanced are the groups in the problem IDs. The source `Level` is a separate difficulty label, retained as `difficulty` in references and manifests. Basic includes 8 pre-IMO, 14 IMO-easy, 8 IMO-medium; Advanced includes 10 each IMO-easy, IMO-medium and IMO-hard. + +## Running and grading + +Each `tasks/` contains a Harbor 1.4 task, an instruction, a reference oracle and an offline verifier. The solver must produce `/app/proof.md` using its own reasoning and local tools without web lookups or external models. The verifier reads a regular single-link UTF-8 file of at most 200,000 bytes, rejecting symlinks in the path, hard links and special files. At least 20 non-whitespace characters are required. `PROOF` and `VERIFIER_DIR` override paths for local testing. The verifier copies the submission and `reference.json` to the verifier directory, alongside `grade.json` and `reward.txt`. Missing, invalid or too-short proofs receive reward 0; structurally valid submissions receive reward 1 and status `submitted_for_judge`. Invalid files use status `missing`, while short or whitespace-only files use `empty`. + +**This reward measures submission validity only, not mathematical correctness.** An external rubric-guided LLM judge must evaluate the submitted proof against the reference solution and grading guidelines in `reference.json` and assign an IMO score from 0 to 7; report percentage as 100 × score / 7. No external judge is bundled, and an oracle pass demonstrates only structural validity. The reference solution is for evaluation and oracle testing and must not be exposed to the solver during an evaluation. + +`tasks/manifest.json` indexes all tasks; `subsets/basic_tasks.jsonl`, `advanced_tasks.jsonl`, and `all_tasks.jsonl` index 30, 30, and 60 tasks respectively. Each JSONL row includes its task path and metadata. + +For judge calibration, upstream [gradingbench.csv](https://github.com/google-deepmind/superhuman/blob/main/imobench/gradingbench.csv) contains 1,000 examples with columns `Grading ID`, `Problem ID`, `Problem`, `Solution`, `Grading guidelines`, `Response`, `Points`, `Reward`, and `Problem Source`. It is separate from this dataset and is not included as proof tasks. diff --git a/subsets/advanced_tasks.jsonl b/subsets/advanced_tasks.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..59be03e2520a9b5007c9091ecf8feb9ae6237dce --- /dev/null +++ b/subsets/advanced_tasks.jsonl @@ -0,0 +1,30 @@ +{"task_id": "pb-advanced-001", "path": "tasks/pb-advanced-001", "problem_id": "PB-Advanced-001", "level": "advanced", "difficulty": "IMO-easy", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-002", "path": "tasks/pb-advanced-002", "problem_id": "PB-Advanced-002", "level": "advanced", "difficulty": "IMO-medium", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-advanced-003", "path": "tasks/pb-advanced-003", "problem_id": "PB-Advanced-003", "level": "advanced", "difficulty": "IMO-hard", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-004", "path": "tasks/pb-advanced-004", "problem_id": "PB-Advanced-004", "level": "advanced", "difficulty": "IMO-easy", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-advanced-005", "path": "tasks/pb-advanced-005", "problem_id": "PB-Advanced-005", "level": "advanced", "difficulty": "IMO-medium", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-006", "path": "tasks/pb-advanced-006", "problem_id": "PB-Advanced-006", "level": "advanced", "difficulty": "IMO-hard", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-007", "path": "tasks/pb-advanced-007", "problem_id": "PB-Advanced-007", "level": "advanced", "difficulty": "IMO-easy", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-008", "path": "tasks/pb-advanced-008", "problem_id": "PB-Advanced-008", "level": "advanced", "difficulty": "IMO-medium", "category": "Number theory", "source": "Novel Problem"} +{"task_id": "pb-advanced-009", "path": "tasks/pb-advanced-009", "problem_id": "PB-Advanced-009", "level": "advanced", "difficulty": "IMO-hard", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-010", "path": "tasks/pb-advanced-010", "problem_id": "PB-Advanced-010", "level": "advanced", "difficulty": "IMO-medium", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-011", "path": "tasks/pb-advanced-011", "problem_id": "PB-Advanced-011", "level": "advanced", "difficulty": "IMO-medium", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-012", "path": "tasks/pb-advanced-012", "problem_id": "PB-Advanced-012", "level": "advanced", "difficulty": "IMO-hard", "category": "Number theory", "source": "Novel Problem"} +{"task_id": "pb-advanced-013", "path": "tasks/pb-advanced-013", "problem_id": "PB-Advanced-013", "level": "advanced", "difficulty": "IMO-easy", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-014", "path": "tasks/pb-advanced-014", "problem_id": "PB-Advanced-014", "level": "advanced", "difficulty": "IMO-medium", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-advanced-015", "path": "tasks/pb-advanced-015", "problem_id": "PB-Advanced-015", "level": "advanced", "difficulty": "IMO-hard", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-016", "path": "tasks/pb-advanced-016", "problem_id": "PB-Advanced-016", "level": "advanced", "difficulty": "IMO-easy", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-017", "path": "tasks/pb-advanced-017", "problem_id": "PB-Advanced-017", "level": "advanced", "difficulty": "IMO-easy", "category": "Number theory", "source": "Novel Problem"} +{"task_id": "pb-advanced-018", "path": "tasks/pb-advanced-018", "problem_id": "PB-Advanced-018", "level": "advanced", "difficulty": "IMO-hard", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-advanced-019", "path": "tasks/pb-advanced-019", "problem_id": "PB-Advanced-019", "level": "advanced", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) IMO 2024 P1"} +{"task_id": "pb-advanced-020", "path": "tasks/pb-advanced-020", "problem_id": "PB-Advanced-020", "level": "advanced", "difficulty": "IMO-medium", "category": "Number theory", "source": "(Modified) IMO 2024 P2"} +{"task_id": "pb-advanced-021", "path": "tasks/pb-advanced-021", "problem_id": "PB-Advanced-021", "level": "advanced", "difficulty": "IMO-hard", "category": "Combinatorics", "source": "(Modified) IMO 2024 P3"} +{"task_id": "pb-advanced-022", "path": "tasks/pb-advanced-022", "problem_id": "PB-Advanced-022", "level": "advanced", "difficulty": "IMO-easy", "category": "Geometry", "source": "(Modified) IMO 2024 P4"} +{"task_id": "pb-advanced-023", "path": "tasks/pb-advanced-023", "problem_id": "PB-Advanced-023", "level": "advanced", "difficulty": "IMO-medium", "category": "Combinatorics", "source": "(Modified) IMO 2024 P5"} +{"task_id": "pb-advanced-024", "path": "tasks/pb-advanced-024", "problem_id": "PB-Advanced-024", "level": "advanced", "difficulty": "IMO-hard", "category": "Algebra", "source": "(Modified) IMO 2024 P6"} +{"task_id": "pb-advanced-025", "path": "tasks/pb-advanced-025", "problem_id": "PB-Advanced-025", "level": "advanced", "difficulty": "IMO-easy", "category": "Number theory", "source": "USAMO 2025"} +{"task_id": "pb-advanced-026", "path": "tasks/pb-advanced-026", "problem_id": "PB-Advanced-026", "level": "advanced", "difficulty": "IMO-medium", "category": "Algebra", "source": "USAMO 2025"} +{"task_id": "pb-advanced-027", "path": "tasks/pb-advanced-027", "problem_id": "PB-Advanced-027", "level": "advanced", "difficulty": "IMO-hard", "category": "Combinatorics", "source": "USAMO 2025"} +{"task_id": "pb-advanced-028", "path": "tasks/pb-advanced-028", "problem_id": "PB-Advanced-028", "level": "advanced", "difficulty": "IMO-easy", "category": "Geometry", "source": "USAMO 2025"} +{"task_id": "pb-advanced-029", "path": "tasks/pb-advanced-029", "problem_id": "PB-Advanced-029", "level": "advanced", "difficulty": "IMO-medium", "category": "Number theory", "source": "USAMO 2025"} +{"task_id": "pb-advanced-030", "path": "tasks/pb-advanced-030", "problem_id": "PB-Advanced-030", "level": "advanced", "difficulty": "IMO-hard", "category": "Combinatorics", "source": "USAMO 2025"} diff --git a/subsets/all_tasks.jsonl b/subsets/all_tasks.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..1ded7ed1a790aa7df96f967ef44f3090ee8e5d27 --- /dev/null +++ b/subsets/all_tasks.jsonl @@ -0,0 +1,60 @@ +{"task_id": "pb-basic-001", "path": "tasks/pb-basic-001", "problem_id": "PB-Basic-001", "level": "basic", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) IMO 2019, P1"} +{"task_id": "pb-basic-002", "path": "tasks/pb-basic-002", "problem_id": "PB-Basic-002", "level": "basic", "difficulty": "pre-IMO", "category": "Algebra", "source": "(Modified) All-Russian MO 2013, Grade 11, P6"} +{"task_id": "pb-basic-003", "path": "tasks/pb-basic-003", "problem_id": "PB-Basic-003", "level": "basic", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) Balkan MO 2023, P1"} +{"task_id": "pb-basic-004", "path": "tasks/pb-basic-004", "problem_id": "PB-Basic-004", "level": "basic", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) VMO 2012, Day2 P3"} +{"task_id": "pb-basic-005", "path": "tasks/pb-basic-005", "problem_id": "PB-Basic-005", "level": "basic", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) ELMO 2023 Shortlist A1"} +{"task_id": "pb-basic-006", "path": "tasks/pb-basic-006", "problem_id": "PB-Basic-006", "level": "basic", "difficulty": "IMO-medium", "category": "Algebra", "source": "(Modified) ELMO 2023 Shortlist A3"} +{"task_id": "pb-basic-007", "path": "tasks/pb-basic-007", "problem_id": "PB-Basic-007", "level": "basic", "difficulty": "IMO-medium", "category": "Algebra", "source": "(Modified) Taiwan TST 2024, 3J Day2 P6"} +{"task_id": "pb-basic-008", "path": "tasks/pb-basic-008", "problem_id": "PB-Basic-008", "level": "basic", "difficulty": "pre-IMO", "category": "Algebra", "source": "(Modified) All-Russia MO 2002."} +{"task_id": "pb-basic-009", "path": "tasks/pb-basic-009", "problem_id": "PB-Basic-009", "level": "basic", "difficulty": "IMO-easy", "category": "Combinatorics", "source": "(Modified) ELMO 2013"} +{"task_id": "pb-basic-010", "path": "tasks/pb-basic-010", "problem_id": "PB-Basic-010", "level": "basic", "difficulty": "IMO-easy", "category": "Combinatorics", "source": "(Modified) Tournament of Towns, Fall 2022 Senior O-level, P3"} +{"task_id": "pb-basic-011", "path": "tasks/pb-basic-011", "problem_id": "PB-Basic-011", "level": "basic", "difficulty": "IMO-easy", "category": "Combinatorics", "source": "(Modified) Vietnam TST 2007 P5"} +{"task_id": "pb-basic-012", "path": "tasks/pb-basic-012", "problem_id": "PB-Basic-012", "level": "basic", "difficulty": "IMO-medium", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-basic-013", "path": "tasks/pb-basic-013", "problem_id": "PB-Basic-013", "level": "basic", "difficulty": "pre-IMO", "category": "Combinatorics", "source": "(Modified) USAMO 2001 P1"} +{"task_id": "pb-basic-014", "path": "tasks/pb-basic-014", "problem_id": "PB-Basic-014", "level": "basic", "difficulty": "pre-IMO", "category": "Combinatorics", "source": "(Modified) Balkan MO 1985 P4"} +{"task_id": "pb-basic-015", "path": "tasks/pb-basic-015", "problem_id": "PB-Basic-015", "level": "basic", "difficulty": "pre-IMO", "category": "Combinatorics", "source": "(Modified) 2020 USOJMO P1"} +{"task_id": "pb-basic-016", "path": "tasks/pb-basic-016", "problem_id": "PB-Basic-016", "level": "basic", "difficulty": "pre-IMO", "category": "Combinatorics", "source": "(Modified) USAMO 1994 Problem 2"} +{"task_id": "pb-basic-017", "path": "tasks/pb-basic-017", "problem_id": "PB-Basic-017", "level": "basic", "difficulty": "pre-IMO", "category": "Number theory", "source": "folklore"} +{"task_id": "pb-basic-018", "path": "tasks/pb-basic-018", "problem_id": "PB-Basic-018", "level": "basic", "difficulty": "pre-IMO", "category": "Number theory", "source": "(Modified) Polish MO 1965 P4"} +{"task_id": "pb-basic-019", "path": "tasks/pb-basic-019", "problem_id": "PB-Basic-019", "level": "basic", "difficulty": "IMO-easy", "category": "Number theory", "source": "(translated) 2003 Korea Winter Program Practice Test"} +{"task_id": "pb-basic-020", "path": "tasks/pb-basic-020", "problem_id": "PB-Basic-020", "level": "basic", "difficulty": "IMO-easy", "category": "Number theory", "source": "(Modified) Tuymaada 2013, Seniors, P6"} +{"task_id": "pb-basic-021", "path": "tasks/pb-basic-021", "problem_id": "PB-Basic-021", "level": "basic", "difficulty": "IMO-easy", "category": "Number theory", "source": "(Modified) ELMO 2015 P1"} +{"task_id": "pb-basic-022", "path": "tasks/pb-basic-022", "problem_id": "PB-Basic-022", "level": "basic", "difficulty": "IMO-easy", "category": "Number theory", "source": "(Modified) ELMO 2023 Shortlist N1"} +{"task_id": "pb-basic-023", "path": "tasks/pb-basic-023", "problem_id": "PB-Basic-023", "level": "basic", "difficulty": "IMO-medium", "category": "Number theory", "source": "(Modified) Vietnam TST 2019 P4"} +{"task_id": "pb-basic-024", "path": "tasks/pb-basic-024", "problem_id": "PB-Basic-024", "level": "basic", "difficulty": "IMO-medium", "category": "Number theory", "source": "(Modified) Serbia MO 2008, P1"} +{"task_id": "pb-basic-025", "path": "tasks/pb-basic-025", "problem_id": "PB-Basic-025", "level": "basic", "difficulty": "IMO-easy", "category": "Geometry", "source": "folklore"} +{"task_id": "pb-basic-026", "path": "tasks/pb-basic-026", "problem_id": "PB-Basic-026", "level": "basic", "difficulty": "IMO-medium", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-basic-027", "path": "tasks/pb-basic-027", "problem_id": "PB-Basic-027", "level": "basic", "difficulty": "IMO-easy", "category": "Geometry", "source": "(Modified) FKMO 2016 P1"} +{"task_id": "pb-basic-028", "path": "tasks/pb-basic-028", "problem_id": "PB-Basic-028", "level": "basic", "difficulty": "IMO-medium", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-basic-029", "path": "tasks/pb-basic-029", "problem_id": "PB-Basic-029", "level": "basic", "difficulty": "IMO-medium", "category": "Geometry", "source": "(modified) IMO Shortlist 2008 G5"} +{"task_id": "pb-basic-030", "path": "tasks/pb-basic-030", "problem_id": "PB-Basic-030", "level": "basic", "difficulty": "IMO-easy", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-001", "path": "tasks/pb-advanced-001", "problem_id": "PB-Advanced-001", "level": "advanced", "difficulty": "IMO-easy", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-002", "path": "tasks/pb-advanced-002", "problem_id": "PB-Advanced-002", "level": "advanced", "difficulty": "IMO-medium", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-advanced-003", "path": "tasks/pb-advanced-003", "problem_id": "PB-Advanced-003", "level": "advanced", "difficulty": "IMO-hard", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-004", "path": "tasks/pb-advanced-004", "problem_id": "PB-Advanced-004", "level": "advanced", "difficulty": "IMO-easy", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-advanced-005", "path": "tasks/pb-advanced-005", "problem_id": "PB-Advanced-005", "level": "advanced", "difficulty": "IMO-medium", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-006", "path": "tasks/pb-advanced-006", "problem_id": "PB-Advanced-006", "level": "advanced", "difficulty": "IMO-hard", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-007", "path": "tasks/pb-advanced-007", "problem_id": "PB-Advanced-007", "level": "advanced", "difficulty": "IMO-easy", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-008", "path": "tasks/pb-advanced-008", "problem_id": "PB-Advanced-008", "level": "advanced", "difficulty": "IMO-medium", "category": "Number theory", "source": "Novel Problem"} +{"task_id": "pb-advanced-009", "path": "tasks/pb-advanced-009", "problem_id": "PB-Advanced-009", "level": "advanced", "difficulty": "IMO-hard", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-010", "path": "tasks/pb-advanced-010", "problem_id": "PB-Advanced-010", "level": "advanced", "difficulty": "IMO-medium", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-011", "path": "tasks/pb-advanced-011", "problem_id": "PB-Advanced-011", "level": "advanced", "difficulty": "IMO-medium", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-012", "path": "tasks/pb-advanced-012", "problem_id": "PB-Advanced-012", "level": "advanced", "difficulty": "IMO-hard", "category": "Number theory", "source": "Novel Problem"} +{"task_id": "pb-advanced-013", "path": "tasks/pb-advanced-013", "problem_id": "PB-Advanced-013", "level": "advanced", "difficulty": "IMO-easy", "category": "Algebra", "source": "Novel Problem"} +{"task_id": "pb-advanced-014", "path": "tasks/pb-advanced-014", "problem_id": "PB-Advanced-014", "level": "advanced", "difficulty": "IMO-medium", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-advanced-015", "path": "tasks/pb-advanced-015", "problem_id": "PB-Advanced-015", "level": "advanced", "difficulty": "IMO-hard", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-016", "path": "tasks/pb-advanced-016", "problem_id": "PB-Advanced-016", "level": "advanced", "difficulty": "IMO-easy", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-advanced-017", "path": "tasks/pb-advanced-017", "problem_id": "PB-Advanced-017", "level": "advanced", "difficulty": "IMO-easy", "category": "Number theory", "source": "Novel Problem"} +{"task_id": "pb-advanced-018", "path": "tasks/pb-advanced-018", "problem_id": "PB-Advanced-018", "level": "advanced", "difficulty": "IMO-hard", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-advanced-019", "path": "tasks/pb-advanced-019", "problem_id": "PB-Advanced-019", "level": "advanced", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) IMO 2024 P1"} +{"task_id": "pb-advanced-020", "path": "tasks/pb-advanced-020", "problem_id": "PB-Advanced-020", "level": "advanced", "difficulty": "IMO-medium", "category": "Number theory", "source": "(Modified) IMO 2024 P2"} +{"task_id": "pb-advanced-021", "path": "tasks/pb-advanced-021", "problem_id": "PB-Advanced-021", "level": "advanced", "difficulty": "IMO-hard", "category": "Combinatorics", "source": "(Modified) IMO 2024 P3"} +{"task_id": "pb-advanced-022", "path": "tasks/pb-advanced-022", "problem_id": "PB-Advanced-022", "level": "advanced", "difficulty": "IMO-easy", "category": "Geometry", "source": "(Modified) IMO 2024 P4"} +{"task_id": "pb-advanced-023", "path": "tasks/pb-advanced-023", "problem_id": "PB-Advanced-023", "level": "advanced", "difficulty": "IMO-medium", "category": "Combinatorics", "source": "(Modified) IMO 2024 P5"} +{"task_id": "pb-advanced-024", "path": "tasks/pb-advanced-024", "problem_id": "PB-Advanced-024", "level": "advanced", "difficulty": "IMO-hard", "category": "Algebra", "source": "(Modified) IMO 2024 P6"} +{"task_id": "pb-advanced-025", "path": "tasks/pb-advanced-025", "problem_id": "PB-Advanced-025", "level": "advanced", "difficulty": "IMO-easy", "category": "Number theory", "source": "USAMO 2025"} +{"task_id": "pb-advanced-026", "path": "tasks/pb-advanced-026", "problem_id": "PB-Advanced-026", "level": "advanced", "difficulty": "IMO-medium", "category": "Algebra", "source": "USAMO 2025"} +{"task_id": "pb-advanced-027", "path": "tasks/pb-advanced-027", "problem_id": "PB-Advanced-027", "level": "advanced", "difficulty": "IMO-hard", "category": "Combinatorics", "source": "USAMO 2025"} +{"task_id": "pb-advanced-028", "path": "tasks/pb-advanced-028", "problem_id": "PB-Advanced-028", "level": "advanced", "difficulty": "IMO-easy", "category": "Geometry", "source": "USAMO 2025"} +{"task_id": "pb-advanced-029", "path": "tasks/pb-advanced-029", "problem_id": "PB-Advanced-029", "level": "advanced", "difficulty": "IMO-medium", "category": "Number theory", "source": "USAMO 2025"} +{"task_id": "pb-advanced-030", "path": "tasks/pb-advanced-030", "problem_id": "PB-Advanced-030", "level": "advanced", "difficulty": "IMO-hard", "category": "Combinatorics", "source": "USAMO 2025"} diff --git a/subsets/basic_tasks.jsonl b/subsets/basic_tasks.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..6b681ddae0bc5c370fc22a4b458ae91a540d9a8a --- /dev/null +++ b/subsets/basic_tasks.jsonl @@ -0,0 +1,30 @@ +{"task_id": "pb-basic-001", "path": "tasks/pb-basic-001", "problem_id": "PB-Basic-001", "level": "basic", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) IMO 2019, P1"} +{"task_id": "pb-basic-002", "path": "tasks/pb-basic-002", "problem_id": "PB-Basic-002", "level": "basic", "difficulty": "pre-IMO", "category": "Algebra", "source": "(Modified) All-Russian MO 2013, Grade 11, P6"} +{"task_id": "pb-basic-003", "path": "tasks/pb-basic-003", "problem_id": "PB-Basic-003", "level": "basic", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) Balkan MO 2023, P1"} +{"task_id": "pb-basic-004", "path": "tasks/pb-basic-004", "problem_id": "PB-Basic-004", "level": "basic", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) VMO 2012, Day2 P3"} +{"task_id": "pb-basic-005", "path": "tasks/pb-basic-005", "problem_id": "PB-Basic-005", "level": "basic", "difficulty": "IMO-easy", "category": "Algebra", "source": "(Modified) ELMO 2023 Shortlist A1"} +{"task_id": "pb-basic-006", "path": "tasks/pb-basic-006", "problem_id": "PB-Basic-006", "level": "basic", "difficulty": "IMO-medium", "category": "Algebra", "source": "(Modified) ELMO 2023 Shortlist A3"} +{"task_id": "pb-basic-007", "path": "tasks/pb-basic-007", "problem_id": "PB-Basic-007", "level": "basic", "difficulty": "IMO-medium", "category": "Algebra", "source": "(Modified) Taiwan TST 2024, 3J Day2 P6"} +{"task_id": "pb-basic-008", "path": "tasks/pb-basic-008", "problem_id": "PB-Basic-008", "level": "basic", "difficulty": "pre-IMO", "category": "Algebra", "source": "(Modified) All-Russia MO 2002."} +{"task_id": "pb-basic-009", "path": "tasks/pb-basic-009", "problem_id": "PB-Basic-009", "level": "basic", "difficulty": "IMO-easy", "category": "Combinatorics", "source": "(Modified) ELMO 2013"} +{"task_id": "pb-basic-010", "path": "tasks/pb-basic-010", "problem_id": "PB-Basic-010", "level": "basic", "difficulty": "IMO-easy", "category": "Combinatorics", "source": "(Modified) Tournament of Towns, Fall 2022 Senior O-level, P3"} +{"task_id": "pb-basic-011", "path": "tasks/pb-basic-011", "problem_id": "PB-Basic-011", "level": "basic", "difficulty": "IMO-easy", "category": "Combinatorics", "source": "(Modified) Vietnam TST 2007 P5"} +{"task_id": "pb-basic-012", "path": "tasks/pb-basic-012", "problem_id": "PB-Basic-012", "level": "basic", "difficulty": "IMO-medium", "category": "Combinatorics", "source": "Novel Problem"} +{"task_id": "pb-basic-013", "path": "tasks/pb-basic-013", "problem_id": "PB-Basic-013", "level": "basic", "difficulty": "pre-IMO", "category": "Combinatorics", "source": "(Modified) USAMO 2001 P1"} +{"task_id": "pb-basic-014", "path": "tasks/pb-basic-014", "problem_id": "PB-Basic-014", "level": "basic", "difficulty": "pre-IMO", "category": "Combinatorics", "source": "(Modified) Balkan MO 1985 P4"} +{"task_id": "pb-basic-015", "path": "tasks/pb-basic-015", "problem_id": "PB-Basic-015", "level": "basic", "difficulty": "pre-IMO", "category": "Combinatorics", "source": "(Modified) 2020 USOJMO P1"} +{"task_id": "pb-basic-016", "path": "tasks/pb-basic-016", "problem_id": "PB-Basic-016", "level": "basic", "difficulty": "pre-IMO", "category": "Combinatorics", "source": "(Modified) USAMO 1994 Problem 2"} +{"task_id": "pb-basic-017", "path": "tasks/pb-basic-017", "problem_id": "PB-Basic-017", "level": "basic", "difficulty": "pre-IMO", "category": "Number theory", "source": "folklore"} +{"task_id": "pb-basic-018", "path": "tasks/pb-basic-018", "problem_id": "PB-Basic-018", "level": "basic", "difficulty": "pre-IMO", "category": "Number theory", "source": "(Modified) Polish MO 1965 P4"} +{"task_id": "pb-basic-019", "path": "tasks/pb-basic-019", "problem_id": "PB-Basic-019", "level": "basic", "difficulty": "IMO-easy", "category": "Number theory", "source": "(translated) 2003 Korea Winter Program Practice Test"} +{"task_id": "pb-basic-020", "path": "tasks/pb-basic-020", "problem_id": "PB-Basic-020", "level": "basic", "difficulty": "IMO-easy", "category": "Number theory", "source": "(Modified) Tuymaada 2013, Seniors, P6"} +{"task_id": "pb-basic-021", "path": "tasks/pb-basic-021", "problem_id": "PB-Basic-021", "level": "basic", "difficulty": "IMO-easy", "category": "Number theory", "source": "(Modified) ELMO 2015 P1"} +{"task_id": "pb-basic-022", "path": "tasks/pb-basic-022", "problem_id": "PB-Basic-022", "level": "basic", "difficulty": "IMO-easy", "category": "Number theory", "source": "(Modified) ELMO 2023 Shortlist N1"} +{"task_id": "pb-basic-023", "path": "tasks/pb-basic-023", "problem_id": "PB-Basic-023", "level": "basic", "difficulty": "IMO-medium", "category": "Number theory", "source": "(Modified) Vietnam TST 2019 P4"} +{"task_id": "pb-basic-024", "path": "tasks/pb-basic-024", "problem_id": "PB-Basic-024", "level": "basic", "difficulty": "IMO-medium", "category": "Number theory", "source": "(Modified) Serbia MO 2008, P1"} +{"task_id": "pb-basic-025", "path": "tasks/pb-basic-025", "problem_id": "PB-Basic-025", "level": "basic", "difficulty": "IMO-easy", "category": "Geometry", "source": "folklore"} +{"task_id": "pb-basic-026", "path": "tasks/pb-basic-026", "problem_id": "PB-Basic-026", "level": "basic", "difficulty": "IMO-medium", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-basic-027", "path": "tasks/pb-basic-027", "problem_id": "PB-Basic-027", "level": "basic", "difficulty": "IMO-easy", "category": "Geometry", "source": "(Modified) FKMO 2016 P1"} +{"task_id": "pb-basic-028", "path": "tasks/pb-basic-028", "problem_id": "PB-Basic-028", "level": "basic", "difficulty": "IMO-medium", "category": "Geometry", "source": "Novel Problem"} +{"task_id": "pb-basic-029", "path": "tasks/pb-basic-029", "problem_id": "PB-Basic-029", "level": "basic", "difficulty": "IMO-medium", "category": "Geometry", "source": "(modified) IMO Shortlist 2008 G5"} +{"task_id": "pb-basic-030", "path": "tasks/pb-basic-030", "problem_id": "PB-Basic-030", "level": "basic", "difficulty": "IMO-easy", "category": "Geometry", "source": "Novel Problem"} diff --git a/tasks/manifest.json b/tasks/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..96c64069fc197d961192902a9e4d3fcadc49985e --- /dev/null +++ b/tasks/manifest.json @@ -0,0 +1,546 @@ +{ + "schema_version": "1.0", + "task_count": 60, + "tasks": [ + { + "task_id": "pb-basic-001", + "path": "tasks/pb-basic-001", + "problem_id": "PB-Basic-001", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Algebra", + "source": "(Modified) IMO 2019, P1" + }, + { + "task_id": "pb-basic-002", + "path": "tasks/pb-basic-002", + "problem_id": "PB-Basic-002", + "level": "basic", + "difficulty": "pre-IMO", + "category": "Algebra", + "source": "(Modified) All-Russian MO 2013, Grade 11, P6" + }, + { + "task_id": "pb-basic-003", + "path": "tasks/pb-basic-003", + "problem_id": "PB-Basic-003", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Algebra", + "source": "(Modified) Balkan MO 2023, P1" + }, + { + "task_id": "pb-basic-004", + "path": "tasks/pb-basic-004", + "problem_id": "PB-Basic-004", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Algebra", + "source": "(Modified) VMO 2012, Day2 P3" + }, + { + "task_id": "pb-basic-005", + "path": "tasks/pb-basic-005", + "problem_id": "PB-Basic-005", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Algebra", + "source": "(Modified) ELMO 2023 Shortlist A1" + }, + { + "task_id": "pb-basic-006", + "path": "tasks/pb-basic-006", + "problem_id": "PB-Basic-006", + "level": "basic", + "difficulty": "IMO-medium", + "category": "Algebra", + "source": "(Modified) ELMO 2023 Shortlist A3" + }, + { + "task_id": "pb-basic-007", + "path": "tasks/pb-basic-007", + "problem_id": "PB-Basic-007", + "level": "basic", + "difficulty": "IMO-medium", + "category": "Algebra", + "source": "(Modified) Taiwan TST 2024, 3J Day2 P6" + }, + { + "task_id": "pb-basic-008", + "path": "tasks/pb-basic-008", + "problem_id": "PB-Basic-008", + "level": "basic", + "difficulty": "pre-IMO", + "category": "Algebra", + "source": "(Modified) All-Russia MO 2002." + }, + { + "task_id": "pb-basic-009", + "path": "tasks/pb-basic-009", + "problem_id": "PB-Basic-009", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Combinatorics", + "source": "(Modified) ELMO 2013" + }, + { + "task_id": "pb-basic-010", + "path": "tasks/pb-basic-010", + "problem_id": "PB-Basic-010", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Combinatorics", + "source": "(Modified) Tournament of Towns, Fall 2022 Senior O-level, P3" + }, + { + "task_id": "pb-basic-011", + "path": "tasks/pb-basic-011", + "problem_id": "PB-Basic-011", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Combinatorics", + "source": "(Modified) Vietnam TST 2007 P5" + }, + { + "task_id": "pb-basic-012", + "path": "tasks/pb-basic-012", + "problem_id": "PB-Basic-012", + "level": "basic", + "difficulty": "IMO-medium", + "category": "Combinatorics", + "source": "Novel Problem" + }, + { + "task_id": "pb-basic-013", + "path": "tasks/pb-basic-013", + "problem_id": "PB-Basic-013", + "level": "basic", + "difficulty": "pre-IMO", + "category": "Combinatorics", + "source": "(Modified) USAMO 2001 P1" + }, + { + "task_id": "pb-basic-014", + "path": "tasks/pb-basic-014", + "problem_id": "PB-Basic-014", + "level": "basic", + "difficulty": "pre-IMO", + "category": "Combinatorics", + "source": "(Modified) Balkan MO 1985 P4" + }, + { + "task_id": "pb-basic-015", + "path": "tasks/pb-basic-015", + "problem_id": "PB-Basic-015", + "level": "basic", + "difficulty": "pre-IMO", + "category": "Combinatorics", + "source": "(Modified) 2020 USOJMO P1" + }, + { + "task_id": "pb-basic-016", + "path": "tasks/pb-basic-016", + "problem_id": "PB-Basic-016", + "level": "basic", + "difficulty": "pre-IMO", + "category": "Combinatorics", + "source": "(Modified) USAMO 1994 Problem 2" + }, + { + "task_id": "pb-basic-017", + "path": "tasks/pb-basic-017", + "problem_id": "PB-Basic-017", + "level": "basic", + "difficulty": "pre-IMO", + "category": "Number theory", + "source": "folklore" + }, + { + "task_id": "pb-basic-018", + "path": "tasks/pb-basic-018", + "problem_id": "PB-Basic-018", + "level": "basic", + "difficulty": "pre-IMO", + "category": "Number theory", + "source": "(Modified) Polish MO 1965 P4" + }, + { + "task_id": "pb-basic-019", + "path": "tasks/pb-basic-019", + "problem_id": "PB-Basic-019", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Number theory", + "source": "(translated) 2003 Korea Winter Program Practice Test" + }, + { + "task_id": "pb-basic-020", + "path": "tasks/pb-basic-020", + "problem_id": "PB-Basic-020", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Number theory", + "source": "(Modified) Tuymaada 2013, Seniors, P6" + }, + { + "task_id": "pb-basic-021", + "path": "tasks/pb-basic-021", + "problem_id": "PB-Basic-021", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Number theory", + "source": "(Modified) ELMO 2015 P1" + }, + { + "task_id": "pb-basic-022", + "path": "tasks/pb-basic-022", + "problem_id": "PB-Basic-022", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Number theory", + "source": "(Modified) ELMO 2023 Shortlist N1" + }, + { + "task_id": "pb-basic-023", + "path": "tasks/pb-basic-023", + "problem_id": "PB-Basic-023", + "level": "basic", + "difficulty": "IMO-medium", + "category": "Number theory", + "source": "(Modified) Vietnam TST 2019 P4" + }, + { + "task_id": "pb-basic-024", + "path": "tasks/pb-basic-024", + "problem_id": "PB-Basic-024", + "level": "basic", + "difficulty": "IMO-medium", + "category": "Number theory", + "source": "(Modified) Serbia MO 2008, P1" + }, + { + "task_id": "pb-basic-025", + "path": "tasks/pb-basic-025", + "problem_id": "PB-Basic-025", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Geometry", + "source": "folklore" + }, + { + "task_id": "pb-basic-026", + "path": "tasks/pb-basic-026", + "problem_id": "PB-Basic-026", + "level": "basic", + "difficulty": "IMO-medium", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-basic-027", + "path": "tasks/pb-basic-027", + "problem_id": "PB-Basic-027", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Geometry", + "source": "(Modified) FKMO 2016 P1" + }, + { + "task_id": "pb-basic-028", + "path": "tasks/pb-basic-028", + "problem_id": "PB-Basic-028", + "level": "basic", + "difficulty": "IMO-medium", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-basic-029", + "path": "tasks/pb-basic-029", + "problem_id": "PB-Basic-029", + "level": "basic", + "difficulty": "IMO-medium", + "category": "Geometry", + "source": "(modified) IMO Shortlist 2008 G5" + }, + { + "task_id": "pb-basic-030", + "path": "tasks/pb-basic-030", + "problem_id": "PB-Basic-030", + "level": "basic", + "difficulty": "IMO-easy", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-001", + "path": "tasks/pb-advanced-001", + "problem_id": "PB-Advanced-001", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Algebra", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-002", + "path": "tasks/pb-advanced-002", + "problem_id": "PB-Advanced-002", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Combinatorics", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-003", + "path": "tasks/pb-advanced-003", + "problem_id": "PB-Advanced-003", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-004", + "path": "tasks/pb-advanced-004", + "problem_id": "PB-Advanced-004", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Combinatorics", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-005", + "path": "tasks/pb-advanced-005", + "problem_id": "PB-Advanced-005", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-006", + "path": "tasks/pb-advanced-006", + "problem_id": "PB-Advanced-006", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Algebra", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-007", + "path": "tasks/pb-advanced-007", + "problem_id": "PB-Advanced-007", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Algebra", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-008", + "path": "tasks/pb-advanced-008", + "problem_id": "PB-Advanced-008", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Number theory", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-009", + "path": "tasks/pb-advanced-009", + "problem_id": "PB-Advanced-009", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-010", + "path": "tasks/pb-advanced-010", + "problem_id": "PB-Advanced-010", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-011", + "path": "tasks/pb-advanced-011", + "problem_id": "PB-Advanced-011", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Algebra", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-012", + "path": "tasks/pb-advanced-012", + "problem_id": "PB-Advanced-012", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Number theory", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-013", + "path": "tasks/pb-advanced-013", + "problem_id": "PB-Advanced-013", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Algebra", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-014", + "path": "tasks/pb-advanced-014", + "problem_id": "PB-Advanced-014", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Combinatorics", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-015", + "path": "tasks/pb-advanced-015", + "problem_id": "PB-Advanced-015", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-016", + "path": "tasks/pb-advanced-016", + "problem_id": "PB-Advanced-016", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Geometry", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-017", + "path": "tasks/pb-advanced-017", + "problem_id": "PB-Advanced-017", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Number theory", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-018", + "path": "tasks/pb-advanced-018", + "problem_id": "PB-Advanced-018", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Combinatorics", + "source": "Novel Problem" + }, + { + "task_id": "pb-advanced-019", + "path": "tasks/pb-advanced-019", + "problem_id": "PB-Advanced-019", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Algebra", + "source": "(Modified) IMO 2024 P1" + }, + { + "task_id": "pb-advanced-020", + "path": "tasks/pb-advanced-020", + "problem_id": "PB-Advanced-020", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Number theory", + "source": "(Modified) IMO 2024 P2" + }, + { + "task_id": "pb-advanced-021", + "path": "tasks/pb-advanced-021", + "problem_id": "PB-Advanced-021", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Combinatorics", + "source": "(Modified) IMO 2024 P3" + }, + { + "task_id": "pb-advanced-022", + "path": "tasks/pb-advanced-022", + "problem_id": "PB-Advanced-022", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Geometry", + "source": "(Modified) IMO 2024 P4" + }, + { + "task_id": "pb-advanced-023", + "path": "tasks/pb-advanced-023", + "problem_id": "PB-Advanced-023", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Combinatorics", + "source": "(Modified) IMO 2024 P5" + }, + { + "task_id": "pb-advanced-024", + "path": "tasks/pb-advanced-024", + "problem_id": "PB-Advanced-024", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Algebra", + "source": "(Modified) IMO 2024 P6" + }, + { + "task_id": "pb-advanced-025", + "path": "tasks/pb-advanced-025", + "problem_id": "PB-Advanced-025", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Number theory", + "source": "USAMO 2025" + }, + { + "task_id": "pb-advanced-026", + "path": "tasks/pb-advanced-026", + "problem_id": "PB-Advanced-026", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Algebra", + "source": "USAMO 2025" + }, + { + "task_id": "pb-advanced-027", + "path": "tasks/pb-advanced-027", + "problem_id": "PB-Advanced-027", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Combinatorics", + "source": "USAMO 2025" + }, + { + "task_id": "pb-advanced-028", + "path": "tasks/pb-advanced-028", + "problem_id": "PB-Advanced-028", + "level": "advanced", + "difficulty": "IMO-easy", + "category": "Geometry", + "source": "USAMO 2025" + }, + { + "task_id": "pb-advanced-029", + "path": "tasks/pb-advanced-029", + "problem_id": "PB-Advanced-029", + "level": "advanced", + "difficulty": "IMO-medium", + "category": "Number theory", + "source": "USAMO 2025" + }, + { + "task_id": "pb-advanced-030", + "path": "tasks/pb-advanced-030", + "problem_id": "PB-Advanced-030", + "level": "advanced", + "difficulty": "IMO-hard", + "category": "Combinatorics", + "source": "USAMO 2025" + } + ] +} diff --git a/tasks/pb-advanced-001/instruction.md b/tasks/pb-advanced-001/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..10b1ef5f87918219875adf3e9077576575bb620f --- /dev/null +++ b/tasks/pb-advanced-001/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-001 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +For a positive integer $n$, let $A_{n}$ be the number of perfect powers less than or equal to $n$. Here, a perfect power is a number that can be expressed in the form $a^{b}$, where $a$ is a positive integer and $b$ is an integer greater than or equal to 2. Prove that there are infinitely many $n$ such that $A_{n}$ divides $n+2024$. diff --git a/tasks/pb-advanced-001/solution/solve.sh b/tasks/pb-advanced-001/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e89c0815fa5401e5df05c30b7942e501baecb7aa --- /dev/null +++ b/tasks/pb-advanced-001/solution/solve.sh @@ -0,0 +1,89 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_c5a67279aaf3a012ed4c4637fbb1a168892e723639ab733188bad1492b6ee946' +Let's look at the following lemma using the intermediate value property. + + If a sequence of non-negative integers $\left(x_{n}\right)_{n=1}^{\infty}$ satisfies $x_{n+1}-x_{n} \in\{0,1\}$ and for any $M>0$, there exists a positive integer $n$ such that $\frac{n}{x_{n}}>M$, then there are infinitely many $n$ such that $\frac{n}{x_{n}}$ is a positive integer. + + First, let $k_{0}$ be the smallest $k$ such that $x_{k} \geq 1$. Now, we will prove that for any integer $m \geq k_{0}$, there exists an $n$ such that $\frac{n}{x_{n}}=m$. + + (1) There exists a positive integer $n$ such that $\frac{n}{x_{n}}>m$, and let $n_{0}$ be the smallest such $n$. Since $\frac{k_{0}}{x_{k_{0}}} \leq k_{0}$, we have $n_{0} \geq k_{0}+1$. + + (2) By the minimality of $n_{0}$ and $n_{0} \geq k_{0}+1$, we have $\frac{n_{0}-1}{x_{n_{0}-1}} \leq m$. If $\frac{n_{0}-1}{x_{n_{0}-1}}m$, we have $m x_{n_{0}}m x_{n_{0}}, + \] + + which leads to $x_{n_{0}-1}>x_{n_{0}}$. This contradicts the condition of the problem that $x_{n+1}-x_{n} \in\{0,1\}$. Therefore, we must have $\frac{n_{0}-1}{x_{n_{0}-1}}=m$, and the proof is complete. + + Therefore, for any integer $m \geq k_{0}$, there exists an $n$ such that $\frac{n}{x_{n}}=m$, and it is obvious that these values of $n$ are different for different $m$, so the proof is complete. \qed + + The following lemma is a Bernoulli-type inequality. + + For any integer $k \geq 2$, we have $2^{k} \geq \frac{k^{2}}{2}$. + + Since $k \geq 2$, by the binomial theorem, we have + + \[ + 2^{k} \geq 1+k+\binom{k}{2}=1+\frac{k}{2}+\frac{k^{2}}{2}>\frac{k^{2}-k}{2}, + \] + + so the proof is complete. $\qed$ + + Now, let's prove the main problem. + + Finding an upper bound for $A_{n}$ + + For a positive integer $a$ and $k \geq 2$, let a number of the form $a^{k}$ be called a $k$-th power. Then, for any $k$-th power $a^{k}$ to be less than or equal to $n$, we must have + + \[ + a^{k} \leq n \quad \Rightarrow \quad a \leq n^{\frac{1}{k}}, + \] + + so the number of $k$-th powers less than or equal to $n$ is less than or equal to $n^{\frac{1}{k}}$. + + If any $k$-th power other than 1 is less than or equal to $n$, then we must have $2^{k} \leq n$, so $k \leq \log _{2} n$. + + By (1) and (2) above, $A_{n}$ satisfies the following: + + \[ + A_{n} \leq \sum_{k=2}^{\left[\log _{2} n\right]} n^{\frac{1}{k}} \leq\left(\left[\log _{2} n\right]-1\right) n^{\frac{1}{2}}<\log _{2} n \cdot n^{\frac{1}{2}}. + \] + + Solving the problem using the lemma + + Now, let the sequence $\left(x_{n}\right)_{n=1}^{\infty}$ be defined as $x_{n}=0$ if $n \leq 2024$ and $x_{n}=A_{n-2024}$ for $n \geq 2025$. + + Since $A_{1}=1$ and $A_{n+1}-A_{n}$ is 1 if $n+1$ is a perfect power and 0 otherwise, $x_{n}$ satisfies $x_{n+1}-x_{n} \in\{0,1\}$ for any $n \geq 1$. + + By , we have $A_{2^{2 k}} \leq 2 k \cdot 2^{k}$, so by , we have + + \[ + \frac{2^{2 k}}{A_{2^{2 k}}} \geq \frac{2^{k}}{2 k} \geq \frac{k}{4}. + \] + + Since $A_{n}$ is an increasing sequence, we have $A_{n} \geq x_{n}$, so $\frac{n}{x_{n}} \geq \frac{n}{A_{n}}$. Combining these results gives + + \[ + \frac{2^{2 k}}{x_{2^{2 k}}} \geq \frac{2^{2 k}}{A_{2^{2 k}}} \geq \frac{k}{4}, + \] + + so for any $M>0$, there exists an $n$ such that $\frac{n}{x_{n}}>M$. + + By (1), (2), and above, there are infinitely many $n$ such that $x_{n} \mid n$. Therefore, there are also infinitely many $n$ such that + + \[ + \frac{n+2024}{A_{n}}=\frac{n+2024}{x_{n+2024}} + \] + + is a positive integer. +IMO_PROOF_c5a67279aaf3a012ed4c4637fbb1a168892e723639ab733188bad1492b6ee946 diff --git a/tasks/pb-advanced-001/task.toml b/tasks/pb-advanced-001/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..98b035ec10cfcda89527c583051e35ebfee8bd0c --- /dev/null +++ b/tasks/pb-advanced-001/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-001" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-001" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-001/tests/grade_task.py b/tasks/pb-advanced-001/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-001/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-001/tests/reference.json b/tasks/pb-advanced-001/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..d9cce1607af6f489a2a10f1b22bd9e024d2b4f75 --- /dev/null +++ b/tasks/pb-advanced-001/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "For a positive integer $n$, let $A_{n}$ be the number of perfect powers less than or equal to $n$. Here, a perfect power is a number that can be expressed in the form $a^{b}$, where $a$ is a positive integer and $b$ is an integer greater than or equal to 2. Prove that there are infinitely many $n$ such that $A_{n}$ divides $n+2024$.", + "solution": "Let's look at the following lemma using the intermediate value property.\n\n If a sequence of non-negative integers $\\left(x_{n}\\right)_{n=1}^{\\infty}$ satisfies $x_{n+1}-x_{n} \\in\\{0,1\\}$ and for any $M>0$, there exists a positive integer $n$ such that $\\frac{n}{x_{n}}>M$, then there are infinitely many $n$ such that $\\frac{n}{x_{n}}$ is a positive integer.\n\n First, let $k_{0}$ be the smallest $k$ such that $x_{k} \\geq 1$. Now, we will prove that for any integer $m \\geq k_{0}$, there exists an $n$ such that $\\frac{n}{x_{n}}=m$.\n\n (1) There exists a positive integer $n$ such that $\\frac{n}{x_{n}}>m$, and let $n_{0}$ be the smallest such $n$. Since $\\frac{k_{0}}{x_{k_{0}}} \\leq k_{0}$, we have $n_{0} \\geq k_{0}+1$.\n\n (2) By the minimality of $n_{0}$ and $n_{0} \\geq k_{0}+1$, we have $\\frac{n_{0}-1}{x_{n_{0}-1}} \\leq m$. If $\\frac{n_{0}-1}{x_{n_{0}-1}}m$, we have $m x_{n_{0}}m x_{n_{0}},\n \\]\n\n which leads to $x_{n_{0}-1}>x_{n_{0}}$. This contradicts the condition of the problem that $x_{n+1}-x_{n} \\in\\{0,1\\}$. Therefore, we must have $\\frac{n_{0}-1}{x_{n_{0}-1}}=m$, and the proof is complete.\n\n Therefore, for any integer $m \\geq k_{0}$, there exists an $n$ such that $\\frac{n}{x_{n}}=m$, and it is obvious that these values of $n$ are different for different $m$, so the proof is complete. \\qed\n\n The following lemma is a Bernoulli-type inequality.\n\n For any integer $k \\geq 2$, we have $2^{k} \\geq \\frac{k^{2}}{2}$.\n\n Since $k \\geq 2$, by the binomial theorem, we have\n\n \\[\n 2^{k} \\geq 1+k+\\binom{k}{2}=1+\\frac{k}{2}+\\frac{k^{2}}{2}>\\frac{k^{2}-k}{2},\n \\]\n\n so the proof is complete. $\\qed$\n\n Now, let's prove the main problem.\n\n Finding an upper bound for $A_{n}$\n\n For a positive integer $a$ and $k \\geq 2$, let a number of the form $a^{k}$ be called a $k$-th power. Then, for any $k$-th power $a^{k}$ to be less than or equal to $n$, we must have\n\n \\[\n a^{k} \\leq n \\quad \\Rightarrow \\quad a \\leq n^{\\frac{1}{k}},\n \\]\n\n so the number of $k$-th powers less than or equal to $n$ is less than or equal to $n^{\\frac{1}{k}}$.\n\n If any $k$-th power other than 1 is less than or equal to $n$, then we must have $2^{k} \\leq n$, so $k \\leq \\log _{2} n$.\n\n By (1) and (2) above, $A_{n}$ satisfies the following:\n\n \\[\n A_{n} \\leq \\sum_{k=2}^{\\left[\\log _{2} n\\right]} n^{\\frac{1}{k}} \\leq\\left(\\left[\\log _{2} n\\right]-1\\right) n^{\\frac{1}{2}}<\\log _{2} n \\cdot n^{\\frac{1}{2}}.\n \\]\n\n Solving the problem using the lemma\n\n Now, let the sequence $\\left(x_{n}\\right)_{n=1}^{\\infty}$ be defined as $x_{n}=0$ if $n \\leq 2024$ and $x_{n}=A_{n-2024}$ for $n \\geq 2025$.\n\n Since $A_{1}=1$ and $A_{n+1}-A_{n}$ is 1 if $n+1$ is a perfect power and 0 otherwise, $x_{n}$ satisfies $x_{n+1}-x_{n} \\in\\{0,1\\}$ for any $n \\geq 1$.\n\n By , we have $A_{2^{2 k}} \\leq 2 k \\cdot 2^{k}$, so by , we have\n\n \\[\n \\frac{2^{2 k}}{A_{2^{2 k}}} \\geq \\frac{2^{k}}{2 k} \\geq \\frac{k}{4}.\n \\]\n\n Since $A_{n}$ is an increasing sequence, we have $A_{n} \\geq x_{n}$, so $\\frac{n}{x_{n}} \\geq \\frac{n}{A_{n}}$. Combining these results gives\n\n \\[\n \\frac{2^{2 k}}{x_{2^{2 k}}} \\geq \\frac{2^{2 k}}{A_{2^{2 k}}} \\geq \\frac{k}{4},\n \\]\n\n so for any $M>0$, there exists an $n$ such that $\\frac{n}{x_{n}}>M$.\n\n By (1), (2), and above, there are infinitely many $n$ such that $x_{n} \\mid n$. Therefore, there are also infinitely many $n$ such that\n\n \\[\n \\frac{n+2024}{A_{n}}=\\frac{n+2024}{x_{n+2024}}\n \\]\n\n is a positive integer.", + "grading_guidelines": "(Partial)\n 1. Observed that $A_n$ is a slowly increasing sequence, and from there guessed that the sequence satisfied some property such as Lemma 1 of the given solution.\n(Almost)\n 1. Applied intermediate value property to get useful information, but couldn't complete the proof.", + "problem_id": "PB-Advanced-001", + "level": "advanced", + "category": "Algebra", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-advanced-001/tests/test.sh b/tasks/pb-advanced-001/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-001/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-002/instruction.md b/tasks/pb-advanced-002/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2550f384de03615da70989105c7de8d59b3c0fe5 --- /dev/null +++ b/tasks/pb-advanced-002/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-002 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +There are 120 students in DeepMind highschool, and each student `loves' some of the students. Here `love' is not always a mutual relationship; a student A may love B while B may not love A, and it is also possible that a student loves oneself. For the set $F$ of all $2^{120}$ subsets of the students, define the function $f: F \rightarrow F$ as the function that maps each $X \in F$ to the set of students loved by one or more students in $X$. For $A, B \in F$, $A$ and $B$ are said to have a 'lovely relationship' iff there exists a natural number $k$ such that $f^{k}(A)=B$. Now we want to select distinct elements $A_{1}, A_{2}, \cdots A_{t}$ from $F$ such that for any $1 \leq i "$PROOF" <<'IMO_PROOF_8c23379d2dbd8bab9f908bb30e1771c53dda798608434dee12cb5c4cacf36511' +To being with, we prove there must be some $A \in F$ such that $\left\{A_{1}, \cdots A_{t}\right\} \subset \cup_{i=0}^{\infty}\left\{f^{i}(A)\right\}$. Why is this? Consider a graph $H$ with $A_{1}, A_{2}, \cdots A_{t}$ as its vertices. If $f^{k}\left(A_{i}\right)=A_{j}$ for some $k$, draw a directed edge $A_{i} \rightarrow A_{j}$ to create a directed graph. This graph is a tournament. Now, if there is a vertex $A$ such that $d^{-}(A)=0$, then it holds directly. If not, then in this graph, the in-degree of any vertex is at least 1. This means the graph contains a cycle. Having a cycle means that for each element $A$ in the cycle, there is some $T$ such that $f^{T}(A)=A$. Therefore, for two vertices $A, B$ in the cycle, if $f^{i}(A)=B$, then $f^{T-i}(B)=A$. This means any two vertices in the cycle can reach each other via applications of $f$. Now, if we remove all but one vertex from the cycle and then use induction on the number of vertices, we can immediately find that there is a vertex $A$ such that $d^{+}(A)=t-1$. Thus, we can obtain our desired conclusion. + +Now, considering a directed graph $G$ whose vertices are the students and where an edge $i \rightarrow j$ is drawn if student $i$ loves student $j$, we need to find $\max_{A_0 \in F} \left| \{f^i(A_0) \mid i \in \mathbb{Z}_{\ge 0} \} \right|$. Now, in $G$, let's perform the following procedure: \begin{itemize} \item Pick any cycle in $G$ and call it $C_{1}$. \item Pick any cycle in $G-C_{1}$ (the graph after removing all vertices of $C_1$) and call it $C_{2}$. \item Repeat this procedure until no more cycles can be found. \end{itemize} As a result of this procedure, we will have disjoint cycles $C_{1}, C_{2}, \cdots, C_{m}$, and a graph $H$ (which is $G - \bigcup C_i$) that has no cycles. Let $a_i$ be the number of vertices in $C_i$, and let $|V(H)|=x$. Then $a_{1}+a_{2}+\cdots+a_{m}=n-x \leq n$ (where $n=120$). Let $L =c\operatorname{lcm}\left[a_{1}, a_{2}, \cdots, a_{m}\right]$, where $c$ is the smallest positive integer such that $L\ge n$. +\\Consider some nonempty $A \subset V(G)$. Now, if we define $T(k) = \bigcup_{j=1}^{m} (f^{k}(A) \cap C_{j})$, then since each $|f^{k}(A) \cap C_{j}|$ is non-decreasing, $|T(k)|$ is a non-decreasing function. Now let's look at $|T(L)|, \cdots, |T((2n+1)L)|$. Since $|T(k)| \leq |V(G)|=n$ and $|T(k)|$ is non-decreasing, there exists some $i$ such that $|T(iL)|=|T((i+1)L)|=|T((i+2)L)|$. At this point, by the definition of $L$, it must be that $T(iL) \subset T((i+1)L) \subset T((i+2)L)$, and therefore $T(iL)=T((i+1)L)=T((i+2)L)$. Therefore, for each $1 \leq r < L$, $T(iL+r)=T((i+1)L+r)$ also holds. +\\Now, if $f^{(i+2)L}(A) \neq f^{(i+1)L}(A)$, then there must be a $v_{0} \in f^{(i+2)L}(A) \triangle f^{(i+1)L}(A)$ (symmetric difference; $A \triangle B=(A-B) \cup (B-A)$), and in this case, $v_{0} \in H$ must hold. Therefore, there also exists $v_1 \in f^{(i+2)L-1}(A) \triangle f^{(i+1)L-1}(A)$ (from which $v_0$ is reached), and $v_2 \in \dots$, so we can keep finding $v_j$ such that there is a path $v_k \rightarrow \dots \rightarrow v_1 \rightarrow v_0$. If $v_1 , v_2, \cdots, v_{|V(H)|+1}$ are all in $H$, then some point should appear at least twice, which is a contradiction to the fact that $H$ has no cycles. Therefore, there exists some $k \le n$ such that $v_k \not \in H$, or equivalently $v_k \in \bigcup C_j$. However, since $v_k \in f^{(i+2)L -k} (A) \triangle f^{(i+1)L -k} (A)$ where $k \le n \le L$, this is a contradiction to the observation above that $T(iL+r)=T((i+1)L+r)$ for each $1\le r \le L$. + +Thus, $f^{(i+2)L}(A)=f^{(i+1)L}(A)$ and thus it follows that $\left\{f^{j}(A) \mid j \in \mathbb{Z}_{\ge 0}\right\}=\left\{f^{j}(A) \mid j \leq (i+1)L \right\}$. Since $i <2n$, we can conclude that $M(f) \leq 2nL$. +\\Now, $\operatorname{lcm}[a_1, a_2, \cdots, a_m] \leq 120 \cdot 60 \cdot 40 \cdot 30 \cdot 24 \cdot 20 \cdot 17 \cdot 15 \cdot 13 \cdot \operatorname{lcm}[1,2,3, \cdots, 12]<2^{60}$ so $L \le \max\{2^{60}, 2n\} = 2^{60}$ Since $2n=240<2^8$, $2nL < 2^8 \cdot 2^{60} = 2^{68}$. +IMO_PROOF_8c23379d2dbd8bab9f908bb30e1771c53dda798608434dee12cb5c4cacf36511 diff --git a/tasks/pb-advanced-002/task.toml b/tasks/pb-advanced-002/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..008b8ecc6dbe92d5ba47304d37abceec22685132 --- /dev/null +++ b/tasks/pb-advanced-002/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-002" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-002" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-002/tests/grade_task.py b/tasks/pb-advanced-002/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-002/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-002/tests/reference.json b/tasks/pb-advanced-002/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..1e232aa16926a83d8558044737b988725b479d53 --- /dev/null +++ b/tasks/pb-advanced-002/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "There are 120 students in DeepMind highschool, and each student `loves' some of the students. Here `love' is not always a mutual relationship; a student A may love B while B may not love A, and it is also possible that a student loves oneself. For the set $F$ of all $2^{120}$ subsets of the students, define the function $f: F \\rightarrow F$ as the function that maps each $X \\in F$ to the set of students loved by one or more students in $X$. For $A, B \\in F$, $A$ and $B$ are said to have a 'lovely relationship' iff there exists a natural number $k$ such that $f^{k}(A)=B$. Now we want to select distinct elements $A_{1}, A_{2}, \\cdots A_{t}$ from $F$ such that for any $1 \\leq i "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-003/instruction.md b/tasks/pb-advanced-003/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..03013affa3963b9ad1c3d0df0e626d3ac9424aac --- /dev/null +++ b/tasks/pb-advanced-003/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-003 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $ ABC $ be an acute triangle which is not an isosceles.Let $ I $ be the incenter and let $ \omega $ be the circumcircle of $ABC$. Let the intersections of lines $ AI $, $ BI $, and $ CI $ with $ BC $, $ CA $, and $ AB $ be $ D $, $ E $, and $ F $ respectively. Also, let $ \omega_A $ be the circle that lies inside $\angle BAC$, tangent to lines $ AB $ and $ AC $, and internally tangent to the circumcircle $ \omega $ at $ T_A $. Similarly, define $ T_B $ and $ T_C $ for points $ B $ and $ C $ respectively. Prove that there exist two points $ X $ and $ Y $ such that the circumcircles of triangles $ ADT_A $, $ BET_B $, and $ CFT_C $ all pass through $ X $ and $ Y $. diff --git a/tasks/pb-advanced-003/solution/solve.sh b/tasks/pb-advanced-003/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d68a9f6de6749713a3836f42d485ba42b27aff33 --- /dev/null +++ b/tasks/pb-advanced-003/solution/solve.sh @@ -0,0 +1,87 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_a314b74d2e11d6fd69b0bd10639fc1e084b086ac891f092ab5ee9d8a8c2ef221' +Let's define some points as follows: + \begin{enumerate} + \item Let $A_1$, $B_1$, and $C_1$ be the points of tangency of the incircle with sides $BC$, $CA$, and $AB$, respectively. + \item Let $N$ be the midpoint of arc $BC$. + \item Let $S_A$ be the intersection of line $NT_A$ and side $BC$ (if they are parallel, consider $S_A$ as the point at infinity). + \item Let $\Gamma_A$, $\Gamma_B$, and $\Gamma_C$ be the circumcircles of triangles $ADT$, $BET$, and $CFT$, respectively. + \end{enumerate} + + Finding a point on the radical axis of circles $\Gamma_A$, $\Gamma_B$, and $\Gamma_C$ + + By the well-known property of Mixtilinear circles, $AT_A$ is isogonal to the line joining the point of tangency of the excircle opposite to vertex $A$ and vertex $A$. + Similarly, consider the lines joining the points of tangency of the excircles opposite to vertices $B$ and $C$ with their respective vertices. It is well-known that these three lines intersect at a single point, the Nagel point. + Therefore, lines $AT_A$, $BT_B$, and $CT_C$ also intersect at a single point, which is the isogonal conjugate of the Nagel point. Let this point be $T$. + Clearly, $T$ lies on segments $AT_A$, $BT_B$, and $CT_C$, and is inside circles $\Gamma_A$, $\Gamma_B$, and $\Gamma_C$. + + Furthermore, by the power of a point theorem with respect to the circumcircle of triangle $ABC$, we have + \[AT \cdot TT_A = BT \cdot TT_B = CT \cdot TT_C.\] + Therefore, point $T$ has the same power with respect to circles $\Gamma_A$, $\Gamma_B$, and $\Gamma_C.$ + + Hence, to prove the statement, it is sufficient to find another point that has the same power with respect to circles $\Gamma_A$, $\Gamma_B$, and $\Gamma_C$. + + $(A, D, T_A, S_A)$ is cyclic + + $\angle ADS_A = \frac{\angle A}{2} + \angle C = \angle ACN = \angle A T_A SA$, so $(A, D, T_A, S_A)$ is cyclic. + + $\angle AIS_A = 90^\circ$ + + This is also a well-known property of Mixtilinear circles. By angle chasing, we can show that the circumcircles of triangles $BIC$ and $NIT_A$ are tangent to each other at point $I$. + Let's consider the radical axes of these three circles: + \begin{itemize} + \item The radical axis of the circumcircles of triangles $BIC$ and $NITA$ is the line passing through $I$ and perpendicular to $AI$. + \item The radical axis of the circumcircles of triangles $BIC$ and $ABC$ is $BC$. + \item The radical axis of the circumcircles of triangles $ABC$ and $NITA$ is $NT_A$. + \end{itemize} + Therefore, the intersection point $S_A$ of $BC$ and $NT_A$ satisfies $\angle AIS_A = 90^\circ$. + + Inversion with respect to the incircle of triangle $ABC$ + + Now, let's invert the figure with respect to the incircle $I$. In particular, let's pay attention to which circle $I$ maps to under this inversion. + Let $A'$, $B'$, and $C'$ be the images of points $A$, $B$, and $C$ under the inversion. Also, let $D'$ and $S_A'$ be the images of points $D$ and $S_A$ under the inversion. + + Let's investigate the properties of the inverted points. + Since $DA_1$ is tangent to the circle, $D'$ is the foot of the perpendicular from $A_1$ to $ID$. $A'$ is the midpoint of $B_1C_1$. Finally, since $SA_1$ is tangent to the circle, $S_A'$ is the foot of the perpendicular from $A_1$ to $IS_A$. + By the conclusion of Step 3, $A_1S_A'$ is parallel to $AI$. + By the observation from step 2, the inversion of the circumcircle of $ADT_A$ is the circumcircle of triangle $A'S_A'D'$. Similarly, the circumcircles of $B'S_B'E'$ and $C'S_C'F'$ are our desired circles. Let's prove that the three circumcircles pass through two common points. + + The circumcircles of triangles $A'S_A'D', B'S_B'E'$, and $C'S_C'F'$ pass through two common points + + Now, let's consider the figure with respect to triangle $A_1B_1C_1$. + + In triangle $A_1B_1C_1$, point $I$ is the circumcenter. Let $H_1$ be the foot of the perpendicular from $A_1$ to $B_1C_1$. + Then, points $A'$, $S_A'$, and $D'$ are constructed as follows: + \begin{itemize} + \item Point $A'$ is the midpoint of $B_1C_1$. + \item Point $D'$ is the intersection of the line parallel to $B_1C_1$ passing through $A_1$ and the perpendicular bisector of $B_1C_1$. + \item Point $S_A'$ is the foot of the perpendicular from $I$ to $AH_1$. + \end{itemize} + Through this construction, we can find that the circumcenter $O_A$ of triangle $A'S_A'D'$ lies on the perpendicular bisector of $A'D'$, which is the line $B'C'$. + Now, let's consider the point $O_A'$ which is the reflection of $O_A$ with respect to the midpoint of $B'C'$. + + $O_A'$ is the circumcenter of triangle $A_1IH_1$ + + Since $A'$, $B'$, $C'$, and $H_1$ lie on the nine-point circle of triangle $ABC$, these four points are concyclic. Therefore, quadrilateral $A'H_1 B'C'$ is an isosceles trapezoid, and points $A'$ and $H_1$ are symmetric with respect to the perpendicular bisector of line $B_1 C_1$. + Furthermore, $A_1$ and $D'$ are symmetric with respect to the perpendicular bisector of line $B'C'$. + Therefore, triangle $AIH_1$ is the reflection of triangle $A'S_A'D'$ across the perpendicular bisector of line $B'C'$, and the circumcenters $O_A$ and $O_A'$ are also symmetric with respect to each other. + + $O_A, O_B$, and $O_C$ are collinear + + Now, let's define $O_B, O_C, O_B'$, and $O_C'$ similarly, and show that $O_A, O_B$, and $O_C$ are collinear. + First, let's show that $O_A'$, $O_B'$, and $O_C'$ are collinear. It is sufficient to prove that the circumcircles of triangles $AIH_1$, $BIH_B$, and $C_1IH_C$ have a common radical axis. + On the other hand, the circumcenter $I$ of $ABC$ and the orthocenter $A_1H_A \cap B_1H_B \cap C_1H_C$ have the same power with respect to these three circumcircles. Therefore, these three circles have a common radical axis. Hence, the centers of these three circles, $O_A'$, $O_B'$, and $O_C'$, are collinear. + Now, by Menelaus' theorem, we have + \[\frac{C'O_A' \cdot B'O_C' \cdot A'O_B'}{O_A'B' \cdot O_C'A' \cdot O_B'C'} = 1\] + \[\frac{C'O_A \cdot B'O_C \cdot A'O_B}{O_AB' \cdot O_CA' \cdot O_BC'} = 1\] + Therefore, $O_A, O_B$, and $O_C$ are also collinear. + + Circles $\Gamma_A, \Gamma_B$, and $\Gamma_C$ have two common points + + Now, the circles $\Gamma_A, \Gamma_B$, and $\Gamma_C$ are inverted into circles. The centers of these three circles are collinear, as proven earlier. Therefore, these three circles either have a common radical axis or their radical axes are parallel. This property remains true before the inversion. + However, in Step 1, we found point $T$ that has the same power with respect to these three circles. Therefore, circles $\Gamma_A, \Gamma_B$, and $\Gamma_C$ have a common radical axis. + Furthermore, since point $T$ lies inside all three circles, this common radical axis intersects each circle at two distinct points. Therefore, the three circles have two common points. +IMO_PROOF_a314b74d2e11d6fd69b0bd10639fc1e084b086ac891f092ab5ee9d8a8c2ef221 diff --git a/tasks/pb-advanced-003/task.toml b/tasks/pb-advanced-003/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..23bfcf53e4b64c5e8dcb0a4b3705685df2361b1d --- /dev/null +++ b/tasks/pb-advanced-003/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-003" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-003" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-003/tests/grade_task.py b/tasks/pb-advanced-003/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-003/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-003/tests/reference.json b/tasks/pb-advanced-003/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..5e3f9afce0a6e8942d288eb0e6cdd22f9b818380 --- /dev/null +++ b/tasks/pb-advanced-003/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $ ABC $ be an acute triangle which is not an isosceles.Let $ I $ be the incenter and let $ \\omega $ be the circumcircle of $ABC$. Let the intersections of lines $ AI $, $ BI $, and $ CI $ with $ BC $, $ CA $, and $ AB $ be $ D $, $ E $, and $ F $ respectively. Also, let $ \\omega_A $ be the circle that lies inside $\\angle BAC$, tangent to lines $ AB $ and $ AC $, and internally tangent to the circumcircle $ \\omega $ at $ T_A $. Similarly, define $ T_B $ and $ T_C $ for points $ B $ and $ C $ respectively. Prove that there exist two points $ X $ and $ Y $ such that the circumcircles of triangles $ ADT_A $, $ BET_B $, and $ CFT_C $ all pass through $ X $ and $ Y $.", + "solution": "Let's define some points as follows:\n \\begin{enumerate}\n \\item Let $A_1$, $B_1$, and $C_1$ be the points of tangency of the incircle with sides $BC$, $CA$, and $AB$, respectively.\n \\item Let $N$ be the midpoint of arc $BC$.\n \\item Let $S_A$ be the intersection of line $NT_A$ and side $BC$ (if they are parallel, consider $S_A$ as the point at infinity).\n \\item Let $\\Gamma_A$, $\\Gamma_B$, and $\\Gamma_C$ be the circumcircles of triangles $ADT$, $BET$, and $CFT$, respectively.\n \\end{enumerate}\n\n Finding a point on the radical axis of circles $\\Gamma_A$, $\\Gamma_B$, and $\\Gamma_C$\n\n By the well-known property of Mixtilinear circles, $AT_A$ is isogonal to the line joining the point of tangency of the excircle opposite to vertex $A$ and vertex $A$.\n Similarly, consider the lines joining the points of tangency of the excircles opposite to vertices $B$ and $C$ with their respective vertices. It is well-known that these three lines intersect at a single point, the Nagel point.\n Therefore, lines $AT_A$, $BT_B$, and $CT_C$ also intersect at a single point, which is the isogonal conjugate of the Nagel point. Let this point be $T$.\n Clearly, $T$ lies on segments $AT_A$, $BT_B$, and $CT_C$, and is inside circles $\\Gamma_A$, $\\Gamma_B$, and $\\Gamma_C$.\n\n Furthermore, by the power of a point theorem with respect to the circumcircle of triangle $ABC$, we have\n \\[AT \\cdot TT_A = BT \\cdot TT_B = CT \\cdot TT_C.\\]\n Therefore, point $T$ has the same power with respect to circles $\\Gamma_A$, $\\Gamma_B$, and $\\Gamma_C.$\n\n Hence, to prove the statement, it is sufficient to find another point that has the same power with respect to circles $\\Gamma_A$, $\\Gamma_B$, and $\\Gamma_C$.\n\n $(A, D, T_A, S_A)$ is cyclic\n\n $\\angle ADS_A = \\frac{\\angle A}{2} + \\angle C = \\angle ACN = \\angle A T_A SA$, so $(A, D, T_A, S_A)$ is cyclic.\n\n $\\angle AIS_A = 90^\\circ$\n\n This is also a well-known property of Mixtilinear circles. By angle chasing, we can show that the circumcircles of triangles $BIC$ and $NIT_A$ are tangent to each other at point $I$.\n Let's consider the radical axes of these three circles:\n \\begin{itemize}\n \\item The radical axis of the circumcircles of triangles $BIC$ and $NITA$ is the line passing through $I$ and perpendicular to $AI$.\n \\item The radical axis of the circumcircles of triangles $BIC$ and $ABC$ is $BC$.\n \\item The radical axis of the circumcircles of triangles $ABC$ and $NITA$ is $NT_A$.\n \\end{itemize}\n Therefore, the intersection point $S_A$ of $BC$ and $NT_A$ satisfies $\\angle AIS_A = 90^\\circ$.\n\n Inversion with respect to the incircle of triangle $ABC$\n\n Now, let's invert the figure with respect to the incircle $I$. In particular, let's pay attention to which circle $I$ maps to under this inversion.\n Let $A'$, $B'$, and $C'$ be the images of points $A$, $B$, and $C$ under the inversion. Also, let $D'$ and $S_A'$ be the images of points $D$ and $S_A$ under the inversion.\n\n Let's investigate the properties of the inverted points.\n Since $DA_1$ is tangent to the circle, $D'$ is the foot of the perpendicular from $A_1$ to $ID$. $A'$ is the midpoint of $B_1C_1$. Finally, since $SA_1$ is tangent to the circle, $S_A'$ is the foot of the perpendicular from $A_1$ to $IS_A$.\n By the conclusion of Step 3, $A_1S_A'$ is parallel to $AI$.\n By the observation from step 2, the inversion of the circumcircle of $ADT_A$ is the circumcircle of triangle $A'S_A'D'$. Similarly, the circumcircles of $B'S_B'E'$ and $C'S_C'F'$ are our desired circles. Let's prove that the three circumcircles pass through two common points.\n\n The circumcircles of triangles $A'S_A'D', B'S_B'E'$, and $C'S_C'F'$ pass through two common points\n\n Now, let's consider the figure with respect to triangle $A_1B_1C_1$.\n\n In triangle $A_1B_1C_1$, point $I$ is the circumcenter. Let $H_1$ be the foot of the perpendicular from $A_1$ to $B_1C_1$.\n Then, points $A'$, $S_A'$, and $D'$ are constructed as follows:\n \\begin{itemize}\n \\item Point $A'$ is the midpoint of $B_1C_1$.\n \\item Point $D'$ is the intersection of the line parallel to $B_1C_1$ passing through $A_1$ and the perpendicular bisector of $B_1C_1$.\n \\item Point $S_A'$ is the foot of the perpendicular from $I$ to $AH_1$.\n \\end{itemize}\n Through this construction, we can find that the circumcenter $O_A$ of triangle $A'S_A'D'$ lies on the perpendicular bisector of $A'D'$, which is the line $B'C'$.\n Now, let's consider the point $O_A'$ which is the reflection of $O_A$ with respect to the midpoint of $B'C'$.\n\n $O_A'$ is the circumcenter of triangle $A_1IH_1$\n\n Since $A'$, $B'$, $C'$, and $H_1$ lie on the nine-point circle of triangle $ABC$, these four points are concyclic. Therefore, quadrilateral $A'H_1 B'C'$ is an isosceles trapezoid, and points $A'$ and $H_1$ are symmetric with respect to the perpendicular bisector of line $B_1 C_1$.\n Furthermore, $A_1$ and $D'$ are symmetric with respect to the perpendicular bisector of line $B'C'$.\n Therefore, triangle $AIH_1$ is the reflection of triangle $A'S_A'D'$ across the perpendicular bisector of line $B'C'$, and the circumcenters $O_A$ and $O_A'$ are also symmetric with respect to each other.\n\n $O_A, O_B$, and $O_C$ are collinear\n\n Now, let's define $O_B, O_C, O_B'$, and $O_C'$ similarly, and show that $O_A, O_B$, and $O_C$ are collinear.\n First, let's show that $O_A'$, $O_B'$, and $O_C'$ are collinear. It is sufficient to prove that the circumcircles of triangles $AIH_1$, $BIH_B$, and $C_1IH_C$ have a common radical axis.\n On the other hand, the circumcenter $I$ of $ABC$ and the orthocenter $A_1H_A \\cap B_1H_B \\cap C_1H_C$ have the same power with respect to these three circumcircles. Therefore, these three circles have a common radical axis. Hence, the centers of these three circles, $O_A'$, $O_B'$, and $O_C'$, are collinear.\n Now, by Menelaus' theorem, we have\n \\[\\frac{C'O_A' \\cdot B'O_C' \\cdot A'O_B'}{O_A'B' \\cdot O_C'A' \\cdot O_B'C'} = 1\\]\n \\[\\frac{C'O_A \\cdot B'O_C \\cdot A'O_B}{O_AB' \\cdot O_CA' \\cdot O_BC'} = 1\\]\n Therefore, $O_A, O_B$, and $O_C$ are also collinear.\n\n Circles $\\Gamma_A, \\Gamma_B$, and $\\Gamma_C$ have two common points\n\n Now, the circles $\\Gamma_A, \\Gamma_B$, and $\\Gamma_C$ are inverted into circles. The centers of these three circles are collinear, as proven earlier. Therefore, these three circles either have a common radical axis or their radical axes are parallel. This property remains true before the inversion.\n However, in Step 1, we found point $T$ that has the same power with respect to these three circles. Therefore, circles $\\Gamma_A, \\Gamma_B$, and $\\Gamma_C$ have a common radical axis.\n Furthermore, since point $T$ lies inside all three circles, this common radical axis intersects each circle at two distinct points. Therefore, the three circles have two common points.", + "grading_guidelines": "(Partial)\n 1. Showed that $AT_a$, $BT_b, CT_c$ are concurrent (there are many possible solutions).\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Advanced-003", + "level": "advanced", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": " " +} diff --git a/tasks/pb-advanced-003/tests/test.sh b/tasks/pb-advanced-003/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-003/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-004/instruction.md b/tasks/pb-advanced-004/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9c13670a07576e0b3546b3994eea1a9c91c69b5f --- /dev/null +++ b/tasks/pb-advanced-004/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-004 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +For a positive integer $n$, a convex $18n+2$-gon $P$ is divided into $18n$ triangles by drawing $18n-1$ diagonals. Prove that we can choose two of these diagonals such that the three parts of $P$ divided by these two diagonals each contain at least $3n$ and at most $9n$ triangles. diff --git a/tasks/pb-advanced-004/solution/solve.sh b/tasks/pb-advanced-004/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ce11d8a494825f897a15669577f8763addd56498 --- /dev/null +++ b/tasks/pb-advanced-004/solution/solve.sh @@ -0,0 +1,70 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_20544fc7bf1dbcc3b99035ee4a2bcbf472b1566085f9c5eb6df601462eb90d09' +First, let's look at the following well-known theorem. + + + For a graph $G$ with $n$ vertices, the following four statements are equivalent. Therefore, if one of them holds, $G$ is a tree. + + (A) $G$ is connected and has no cycles. + + (B) $G$ is connected and has $n-1$ edges. + + (C) $G$ has $n-1$ edges and no cycles. + + (D) There is exactly one path between any two vertices in $G$. + + The following lemma is a general fact about the division of trees. + + For a positive integer $k \geq 2$, if the degree of each vertex in a tree is at most $k$, then we can remove an edge from the tree so that both resulting connected components have size at least $\frac{n-1}{k}$. + + + + (1) Let $H_{e}, K_{e}$ be the two connected components obtained by removing an edge $e$ from the tree, and let $h_{e}, k_{e}$ be the number of vertices in the two components. (Of course, $h_{e}+k_{e}=n$.) Let $l=\{x, y\}$ be the edge for which $\min \left(h_{e}, k_{e}\right)$ is maximized. (If there are multiple such edges, choose one arbitrarily) + + (2) Assume for contradiction that the smaller component obtained by removing $l$ has size less than $\frac{n-1}{k}$. Without loss of generality, let this be the component containing $x$. Let this component be $A$. + + (3) Now, for any edge $e$ other than $l$ connected to vertex $y$, if we remove that edge instead of $l$, let $H_{e}$ be the component containing $l$ and $K_{e}$ be the other component. Then $H_{e}$ contains $A$, so it is larger than $A$. If the number of vertices in $H_{e}$ is less than or equal to the number of vertices in $K_{e}$, then it contradicts the maximality of $A$. Therefore, the number of vertices in $K_{e}$ must be less than the number of vertices in $H_{e}$. Therefore, by the maximality of $A$, the number of vertices in $K_{e}$ is less than or equal to the number of vertices in $A$, and therefore less than $\frac{n-1}{k}$. + + (4) Therefore, when we remove each edge adjacent to vertex $y$, each resulting connected component has less than $\frac{n-1}{k}$ vertices. Since the degree of vertex $y$ is at most $k$, there are at most $k$ such components, and therefore the number of vertices excluding $y$ is less than $\frac{n-1}{k} \times k=n-1$, which is a contradiction. + + Therefore, the proof is complete. \qed + + Now, let's prove the problem. First, let's look at the general properties of triangulation of a convex $n$-gon before looking at the convex $18n+2$-gon. + + Basic properties of triangulation of a convex polygon + + The sum of the interior angles of a convex $n$-gon is $(n-2) \pi$. Therefore, in order for triangles with an interior angle sum of $\pi$ to divide this sum, we need a total of $n-2$ triangles. Since each time we draw a diagonal, the division of the convex $n$-gon increases by one, we know that if we have divided a convex $n$-gon into $n-2$ triangles, we have drawn a total of $n-3$ diagonals. In summary, to triangulate a convex $n$-gon, we need to draw $n-3$ diagonals to divide it into $n-2$ triangles. + + If $n \geq 4$, then there are $n-2$ triangles, and each triangle cannot have all 3 sides as sides of the convex $n$-gon. Therefore, there must be at least 2 triangles that share 2 sides with the convex $n$-gon. + + Mapping triangulation of a convex polygon to a tree + + The problem of dividing a convex $n$-gon $P$ into triangles is directly related to trees. For convenience, assume $n \geq 4$. Let's consider the triangles as vertices and connect two vertices if the corresponding triangles share a side to draw a graph $G$. + + By , this graph has $n-2$ vertices and $n-3$ edges. (This is because each diagonal drawn during the division corresponds to one edge in $G$.) + + We can confirm that this graph $G$ is connected by mathematical induction. The case $n=4$ is trivial. Now, assume that $G$ is connected for triangulations of convex $n-1$-gons for $n \geq 5$, and consider a triangulation $T$ of a convex $n$-gon $P$. By (2) of , this triangulation includes a triangle $X$ that has two consecutive sides of $P$. + + The vertex corresponding to this triangle $X$ has degree 1 in graph $G$. Let $Y$ be the vertex connected to $X$. Now, the remaining part of the $n$-gon $P$ excluding triangle $X$ is an $n-1$-gon $P^{\prime}$, and if we remove triangle $X$ from triangulation $T$, the remaining part is $T^{\prime}$, which is a triangulation of $P^{\prime}$. Let $G^{\prime}$ be the graph for this triangulation. Clearly, $G^{\prime}$ is the graph obtained by removing vertex $X$ and edge $XY$ from $G$. By the inductive hypothesis, $G^{\prime}$ is connected, so the graph $G$ obtained by adding edge $XY$ to it is also connected. + + In conclusion, graph $G$ is a connected graph with $n-2$ vertices and $n-3$ edges. Therefore, by -(B), $G$ is a tree. + + Analysis of the problem situation + + According to the above analysis, we can see that the triangulation given in the problem corresponds to a tree $T$ with $18n$ vertices. It is very important that the degree of each vertex in this tree is at most 3. + + Choosing two diagonals to divide the convex $18n+2$-gon can be thought of as removing two edges from this tree to divide it into three connected components. The question is whether we can do this so that the size of each connected component is at least $3n-1$ and at most $8n+1$. + + Solving the problem + + First, the tree $T$ corresponding to the triangulation has $18n$ vertices, and the degree of each vertex is at most 3. Therefore, by Lemma, we can remove one edge to make the sizes of the two resulting components at least $6n-1$. + + Let $A$ be the component with fewer vertices and $B$ be the component with more vertices (if the sizes are the same, assign $A$ and $B$ arbitrarily). The number of vertices in $A$ is at least $6n-1$ and at most $9n$, and the number of vertices in $B$ is at least $9n$ and at most $12n+1$. + + Since $B$ is also a tree with degree at most 3, we can apply again to $B$. By removing one edge from $B$, we can divide it into $B_{1}, B_{2}$ so that the size of each component is at least $\frac{9n-1}{3}$ and at most $\frac{2(12 n+1)+1}{3}=8 n+1$. Therefore, the sizes of $B_{1}, B_{2}$ are at least $3n$ and at most $8n+1$. + + Therefore, we can divide it into $A, B_{1}, B_{2}$. +IMO_PROOF_20544fc7bf1dbcc3b99035ee4a2bcbf472b1566085f9c5eb6df601462eb90d09 diff --git a/tasks/pb-advanced-004/task.toml b/tasks/pb-advanced-004/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e7d43425f1c5e6ad89d0630c2958d5ccc6eaced5 --- /dev/null +++ b/tasks/pb-advanced-004/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-004" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-004" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-004/tests/grade_task.py b/tasks/pb-advanced-004/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-004/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-004/tests/reference.json b/tasks/pb-advanced-004/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..716e239d8ca3df636d95a1baa2a00a04fd4fe9a7 --- /dev/null +++ b/tasks/pb-advanced-004/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "For a positive integer $n$, a convex $18n+2$-gon $P$ is divided into $18n$ triangles by drawing $18n-1$ diagonals. Prove that we can choose two of these diagonals such that the three parts of $P$ divided by these two diagonals each contain at least $3n$ and at most $9n$ triangles.", + "solution": "First, let's look at the following well-known theorem.\n\n \n For a graph $G$ with $n$ vertices, the following four statements are equivalent. Therefore, if one of them holds, $G$ is a tree.\n\n (A) $G$ is connected and has no cycles.\n\n (B) $G$ is connected and has $n-1$ edges.\n\n (C) $G$ has $n-1$ edges and no cycles.\n\n (D) There is exactly one path between any two vertices in $G$.\n\n The following lemma is a general fact about the division of trees.\n\n For a positive integer $k \\geq 2$, if the degree of each vertex in a tree is at most $k$, then we can remove an edge from the tree so that both resulting connected components have size at least $\\frac{n-1}{k}$.\n\n \n\n (1) Let $H_{e}, K_{e}$ be the two connected components obtained by removing an edge $e$ from the tree, and let $h_{e}, k_{e}$ be the number of vertices in the two components. (Of course, $h_{e}+k_{e}=n$.) Let $l=\\{x, y\\}$ be the edge for which $\\min \\left(h_{e}, k_{e}\\right)$ is maximized. (If there are multiple such edges, choose one arbitrarily)\n\n (2) Assume for contradiction that the smaller component obtained by removing $l$ has size less than $\\frac{n-1}{k}$. Without loss of generality, let this be the component containing $x$. Let this component be $A$.\n\n (3) Now, for any edge $e$ other than $l$ connected to vertex $y$, if we remove that edge instead of $l$, let $H_{e}$ be the component containing $l$ and $K_{e}$ be the other component. Then $H_{e}$ contains $A$, so it is larger than $A$. If the number of vertices in $H_{e}$ is less than or equal to the number of vertices in $K_{e}$, then it contradicts the maximality of $A$. Therefore, the number of vertices in $K_{e}$ must be less than the number of vertices in $H_{e}$. Therefore, by the maximality of $A$, the number of vertices in $K_{e}$ is less than or equal to the number of vertices in $A$, and therefore less than $\\frac{n-1}{k}$.\n\n (4) Therefore, when we remove each edge adjacent to vertex $y$, each resulting connected component has less than $\\frac{n-1}{k}$ vertices. Since the degree of vertex $y$ is at most $k$, there are at most $k$ such components, and therefore the number of vertices excluding $y$ is less than $\\frac{n-1}{k} \\times k=n-1$, which is a contradiction.\n\n Therefore, the proof is complete. \\qed\n\n Now, let's prove the problem. First, let's look at the general properties of triangulation of a convex $n$-gon before looking at the convex $18n+2$-gon.\n\n Basic properties of triangulation of a convex polygon\n\n The sum of the interior angles of a convex $n$-gon is $(n-2) \\pi$. Therefore, in order for triangles with an interior angle sum of $\\pi$ to divide this sum, we need a total of $n-2$ triangles. Since each time we draw a diagonal, the division of the convex $n$-gon increases by one, we know that if we have divided a convex $n$-gon into $n-2$ triangles, we have drawn a total of $n-3$ diagonals. In summary, to triangulate a convex $n$-gon, we need to draw $n-3$ diagonals to divide it into $n-2$ triangles.\n\n If $n \\geq 4$, then there are $n-2$ triangles, and each triangle cannot have all 3 sides as sides of the convex $n$-gon. Therefore, there must be at least 2 triangles that share 2 sides with the convex $n$-gon.\n\n Mapping triangulation of a convex polygon to a tree\n\n The problem of dividing a convex $n$-gon $P$ into triangles is directly related to trees. For convenience, assume $n \\geq 4$. Let's consider the triangles as vertices and connect two vertices if the corresponding triangles share a side to draw a graph $G$.\n\n By , this graph has $n-2$ vertices and $n-3$ edges. (This is because each diagonal drawn during the division corresponds to one edge in $G$.)\n\n We can confirm that this graph $G$ is connected by mathematical induction. The case $n=4$ is trivial. Now, assume that $G$ is connected for triangulations of convex $n-1$-gons for $n \\geq 5$, and consider a triangulation $T$ of a convex $n$-gon $P$. By (2) of , this triangulation includes a triangle $X$ that has two consecutive sides of $P$.\n\n The vertex corresponding to this triangle $X$ has degree 1 in graph $G$. Let $Y$ be the vertex connected to $X$. Now, the remaining part of the $n$-gon $P$ excluding triangle $X$ is an $n-1$-gon $P^{\\prime}$, and if we remove triangle $X$ from triangulation $T$, the remaining part is $T^{\\prime}$, which is a triangulation of $P^{\\prime}$. Let $G^{\\prime}$ be the graph for this triangulation. Clearly, $G^{\\prime}$ is the graph obtained by removing vertex $X$ and edge $XY$ from $G$. By the inductive hypothesis, $G^{\\prime}$ is connected, so the graph $G$ obtained by adding edge $XY$ to it is also connected.\n\n In conclusion, graph $G$ is a connected graph with $n-2$ vertices and $n-3$ edges. Therefore, by -(B), $G$ is a tree.\n\n Analysis of the problem situation\n\n According to the above analysis, we can see that the triangulation given in the problem corresponds to a tree $T$ with $18n$ vertices. It is very important that the degree of each vertex in this tree is at most 3.\n\n Choosing two diagonals to divide the convex $18n+2$-gon can be thought of as removing two edges from this tree to divide it into three connected components. The question is whether we can do this so that the size of each connected component is at least $3n-1$ and at most $8n+1$.\n\n Solving the problem\n\n First, the tree $T$ corresponding to the triangulation has $18n$ vertices, and the degree of each vertex is at most 3. Therefore, by Lemma, we can remove one edge to make the sizes of the two resulting components at least $6n-1$.\n\n Let $A$ be the component with fewer vertices and $B$ be the component with more vertices (if the sizes are the same, assign $A$ and $B$ arbitrarily). The number of vertices in $A$ is at least $6n-1$ and at most $9n$, and the number of vertices in $B$ is at least $9n$ and at most $12n+1$.\n\n Since $B$ is also a tree with degree at most 3, we can apply again to $B$. By removing one edge from $B$, we can divide it into $B_{1}, B_{2}$ so that the size of each component is at least $\\frac{9n-1}{3}$ and at most $\\frac{2(12 n+1)+1}{3}=8 n+1$. Therefore, the sizes of $B_{1}, B_{2}$ are at least $3n$ and at most $8n+1$.\n\n Therefore, we can divide it into $A, B_{1}, B_{2}$.", + "grading_guidelines": "(Partial)\n 1. Found a first diagonal that cuts the polygon into at least $3n$ triangles, or attempted an argument where an unbalanced cut can be modified to create a more balanced cut.\n 2. Successfully connected the triangulation with a tree.\n(Almost)\n 1. Established first cut diagonal as and in the solution attempts to successively apply the argument again on one of the sides, but with errors (e.g. not fulfilling the same hypotheses as the original cut).", + "problem_id": "PB-Advanced-004", + "level": "advanced", + "category": "Combinatorics", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-advanced-004/tests/test.sh b/tasks/pb-advanced-004/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-004/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-005/instruction.md b/tasks/pb-advanced-005/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fb304349392965622e76a25fa6c133a3d574a289 --- /dev/null +++ b/tasks/pb-advanced-005/instruction.md @@ -0,0 +1,12 @@ +# PB-Advanced-005 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $\angle XYZ$ be an acute angle with $\angle XYZ \ne 60^\circ$, and let $A$ be a point inside $\angle XYZ$. Prove that there exists $D\ne A$ inside $\angle XYZ$ and $\theta\in (0,2\pi )$ satisfying the following condition: + + For points $B$ and $C$ on the rays $\overrightarrow{YX}$ and $\overrightarrow{YZ}$ respectively, then + \[ + \angle BAC = \angle XYZ \quad \implies \quad \angle BDC = \theta. + \] diff --git a/tasks/pb-advanced-005/solution/solve.sh b/tasks/pb-advanced-005/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a2a38a74e75788eb4b1c402413d511cf4e84287c --- /dev/null +++ b/tasks/pb-advanced-005/solution/solve.sh @@ -0,0 +1,163 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_d4f40b51788db8b9eaf14b80be654d948279ff726f029f7cd5a014470b97b856' +step 1: Construction of $D$ and $\theta$ + + step 1-1: Without loss of generality we may assume that $XA\perp YZ$ + and $ZA\perp YX$. + + step 1-2: Let $D$ be the circumcenter of $\triangle XYZ$. + + step 1-3: Let $\theta=180^{\circ}-2\angle XYZ$. + + \medskip{} + + step 2: We prove that if $\angle BAC=\angle XYZ$, then $\angle BDC=\theta$. + + \medskip{} + + step 3: Lemma. A point $K$ inside a convex quadrilateral $PQRS$ + has an isogonal conjugate with respect to the $PQRS$ if and only + if $\angle PKQ+\angle RKS=180^{\circ}$. + + \medskip{} + + step 4: Proof of Lemma. + + step 4-1: Let $H_{1},H_{2},H_{3},H_{4}$ be the feet of perpendicular + from $K$ onto $PQ,QR,RS,SP$, respectively. + + step 4-2: First assume that $K^{\prime}$ is the isogonal conjugate + of $K$ + + step 4-2-1: Let $H_{1}^{\prime},H_{2}^{\prime},H_{3}^{\prime},H_{4}^{\prime}$ + be the feet of perpendicular from $K^{\prime}$ onto $PQ,QR,RS,SP$, + respectively. + + step 4-2-2: We prove that $H_{1},H_{2},H_{1}^{\prime},H_{2}^{\prime}$ + are cyclic. + + step 4-2-2-1: We have $\angle KQH_{1}=\angle K^{\prime}QH_{2}^{\prime}$ + by assumption. + + step 4-2-2-2: We have $\angle KH_{1}Q=\angle K^{\prime}H_{2}^{\prime}Q=90^{\circ}$. + + step 4-2-2-3: By steps 4-2-2-1 and 4-2-2-2, we have $\triangle KQH_{1}\sim\triangle K^{\prime}QH_{2}^{\prime}$. + + step 4-2-2-4: Thus $QH_{1}:QH_{2}^{\prime}=KQ:K^{\prime}Q$. + + step 4-2-2-5: Similarly $QH_{1}^{\prime}:QH_{2}=KQ:K^{\prime}Q$. + + step 4-2-2-6: By steps 4-2-2-4 and 4-2-2-5, we have $QH_{1}\times QH_{1}^{\prime}=QH_{2}\times QH_{2}^{\prime}$. + + step 4-2-2-7: Hence $H_{1},H_{2},H_{1}^{\prime},H_{2}^{\prime}$ are + cyclic. + + step 4-2-3: Denote $M$ as the midpoint of $KK^{\prime}$. + + step 4-2-4: We prove that $H_{1},H_{1}^{\prime},H_{2},H_{2}^{\prime}$ + are equidistant to $M$. + + step 4-2-4-1: Let $N$ be the midpoint of $H_{1}H_{1}^{\prime}$. + + step 4-2-4-2: Since $H_{1}K\parallel H_{1}^{\prime}K^{\prime}$ and + both are perpendicular to $PQ$, we have $NM\perp PQ$. + + step 4-2-4-3: Hence $M$ lies on the perpendicular bisector of $H_{1}H_{1}^{\prime}$. + + step 4-2-4-4: Similarly $M$ lies on the perpendicular bisector of + $H_{2}H_{2}^{\prime}$. + + step 4-2-4-5: By steps 4-2-2, 4-2-4-3, 4-2-4-4 and the fact that $PQ$ + and $QR$ are not parallel, we have that the center should be $M$. + + step 4-2-5: Similarly $H_{2},H_{2}^{\prime},H_{3},H_{3}^{\prime}$ + are equidistant to $M$, and $H_{3},H_{3}^{\prime},H_{4},H_{4}^{\prime}$ + are equidistant to $M$. + + step 4-2-6: By steps 4-2-4 and 4-2-5, $H_{1},H_{1}^{\prime},H_{2},H_{2}^{\prime},H_{3},H_{3}^{\prime},H_{4},H_{4}^{\prime}$ + all lie on a circle centered at $M$. + + step 4-2-7: Since $\angle KH_{1}Q=\angle KH_{2}Q=90^{\circ}$, $K,H_{1},Q,H_{2}$ + are cyclic. + + step 4-2-8: Similarly $K,H_{2},R,H_{3}$ are cyclic. + + step 4-2-9: Similarly $K,H_{3},S,H_{4}$ are cyclic. + + step 4-2-10: Similarly $K,H_{4},P,H_{1}$ are cyclic. + + step 4-2-11: By steps 4-2-6, 4-2-7, 4-2-8, 4-2-9, and 4-2-10, we have + \begin{align*} + \angle PKQ+\angle RKS&=(\angle PKH_{1}+\angle QKH_{1})+(\angle RKH_{3}+\angle SKH_{3}) + &=\angle PH_{4}H_{1}+\angle QH_{2}H_{1}+\angle RH_{2}H_{3}+\angle SH_{4}H_{3} + &=360^{\circ}-(\angle H_{1}H_{2}H_{3}+\angle H_{3}H_{4}H_{1})=180^{\circ}. + \end{align*} + step 4-3: Assume $\angle PKQ+\angle RKS=180^{\circ}$. + + step 4-3-1: By the same logic as in step 4-2, $H_{1},H_{2},H_{3},H_{4}$ lie on a circle $\omega$. + + step 4-3-2: Let $O$ be the center of $\omega$. + + step 4-3-3: Denote $J_{1},J_{2},J_{3},J_{4}$as the second intersection + of $\omega$ and $PQ,QR,RS,SP$, respectively. + + step 4-3-4: Let $K^{\prime}$ be the reflection of $K$ with respect + to $O$. + + step 4-3-5: Let $N^{\prime}$ be the midpoint of $H_{1}J_{1}$. + + step 4-3-6: Since $KH_{1}\parallel ON^{\prime}$ and both are perpendicular + to $PQ$, we have $K^{\prime}J_{1}\perp PQ$. + + step 4-3-7: Similarly $K^{\prime}J_{2}\perp QR$. + + step 4-3-8: Hence $\angle PQK=\angle H_{1}QK=90^{\circ}-\angle H_{1}KQ=90^{\circ}-\angle H_{1}H_{2}Q=90^{\circ}-\angle J_{2}J_{1}Q=\angle RQK^{\prime}$. + + step 4-3-9: Similarly $K,K^{\prime}$ are isogonal with respect to + all four angles of $PQRS$. + + step 4-3-10: Thus $K^{\prime}$ is the isogonal conjugate of $K$ + with respect to $PQRS$.\medskip{} + + step 5: Now suppose $\angle BAC=\angle XYZ$. + + step 5-1: Since $\angle XYZ$ is acute, $\triangle XYZ$ is acute, + and $\angle XAY,\angle ZAY>90^{\circ}>\angle BAC$. + + step 5-2: Hence $\square BCZX$ is convex, and $K$ is inside of $\square BCZX$.\medskip{} + + step 6: We prove that $D$ is the isogonal conjugate of $A$ with + respect to $\square BCZX$. + + step 6-1: We have $\angle ZAX+\angle BAC=(180^{\circ}-\angle XYZ)+\angle XYZ=180^{\circ}$. + + step 6-2: Hence by Lemma and steps 5-2, 6-1, $A$ has an isogonal + conjugate with respect to $\square BCZX$. + + step 6-3: $A,D$ are isogonal conjugates with respect to $\triangle XYZ$ + as orthocenter and circumcenter. + + step 6-4: By step 6-3, $XA,XD$ are isogonal lines with respect to + $\angle BXZ$, and $ZA,ZD$ are isogonal lines with respect to $\angle CZX$. + + step 6-5: By steps 6-2, 6-4, and the fact that there is at most one + isogonal conjugate, we conclude that $D$ is indeed the isogonal conjugate. + + \medskip{} + + step 7: We prove that $\angle BDC=180^{\circ}-2\angle XYZ$. + + step 7-1: By step 6, $A$ is the isogonal conjugate of $D$ with respect + to $\square BCZX$. + + step 7-2: By Lemma, we have $\angle BDC+\angle XDZ=180^{\circ}$. + + step 7-3: Since $D$ is the circumcenter of $\triangle XYZ$, we have + $\angle XDZ=2\angle XYZ$. + + step 7-4: By step 7-2 and 7-3, we have $\angle BDC=180^{\circ}-2\angle XYZ$. + step 7-5: Since $\angle XYZ \ne 60^\circ$, we have $D\ne A$. +IMO_PROOF_d4f40b51788db8b9eaf14b80be654d948279ff726f029f7cd5a014470b97b856 diff --git a/tasks/pb-advanced-005/task.toml b/tasks/pb-advanced-005/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3e6caa2bd7eb707e3c692287075b9c1ba560a903 --- /dev/null +++ b/tasks/pb-advanced-005/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-005" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-005" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-005/tests/grade_task.py b/tasks/pb-advanced-005/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-005/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-005/tests/reference.json b/tasks/pb-advanced-005/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..490878ab9beb20f43e9644cce0ff7814f80a3f78 --- /dev/null +++ b/tasks/pb-advanced-005/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $\\angle XYZ$ be an acute angle with $\\angle XYZ \\ne 60^\\circ$, and let $A$ be a point inside $\\angle XYZ$. Prove that there exists $D\\ne A$ inside $\\angle XYZ$ and $\\theta\\in (0,2\\pi )$ satisfying the following condition:\n\n For points $B$ and $C$ on the rays $\\overrightarrow{YX}$ and $\\overrightarrow{YZ}$ respectively, then\n \\[\n \\angle BAC = \\angle XYZ \\quad \\implies \\quad \\angle BDC = \\theta.\n \\]", + "solution": "step 1: Construction of $D$ and $\\theta$\n\n step 1-1: Without loss of generality we may assume that $XA\\perp YZ$\n and $ZA\\perp YX$.\n\n step 1-2: Let $D$ be the circumcenter of $\\triangle XYZ$.\n\n step 1-3: Let $\\theta=180^{\\circ}-2\\angle XYZ$.\n\n \\medskip{}\n\n step 2: We prove that if $\\angle BAC=\\angle XYZ$, then $\\angle BDC=\\theta$.\n\n \\medskip{}\n\n step 3: Lemma. A point $K$ inside a convex quadrilateral $PQRS$\n has an isogonal conjugate with respect to the $PQRS$ if and only\n if $\\angle PKQ+\\angle RKS=180^{\\circ}$.\n\n \\medskip{}\n\n step 4: Proof of Lemma.\n\n step 4-1: Let $H_{1},H_{2},H_{3},H_{4}$ be the feet of perpendicular\n from $K$ onto $PQ,QR,RS,SP$, respectively.\n\n step 4-2: First assume that $K^{\\prime}$ is the isogonal conjugate\n of $K$\n\n step 4-2-1: Let $H_{1}^{\\prime},H_{2}^{\\prime},H_{3}^{\\prime},H_{4}^{\\prime}$\n be the feet of perpendicular from $K^{\\prime}$ onto $PQ,QR,RS,SP$,\n respectively.\n\n step 4-2-2: We prove that $H_{1},H_{2},H_{1}^{\\prime},H_{2}^{\\prime}$\n are cyclic.\n\n step 4-2-2-1: We have $\\angle KQH_{1}=\\angle K^{\\prime}QH_{2}^{\\prime}$\n by assumption.\n\n step 4-2-2-2: We have $\\angle KH_{1}Q=\\angle K^{\\prime}H_{2}^{\\prime}Q=90^{\\circ}$.\n\n step 4-2-2-3: By steps 4-2-2-1 and 4-2-2-2, we have $\\triangle KQH_{1}\\sim\\triangle K^{\\prime}QH_{2}^{\\prime}$.\n\n step 4-2-2-4: Thus $QH_{1}:QH_{2}^{\\prime}=KQ:K^{\\prime}Q$.\n\n step 4-2-2-5: Similarly $QH_{1}^{\\prime}:QH_{2}=KQ:K^{\\prime}Q$.\n\n step 4-2-2-6: By steps 4-2-2-4 and 4-2-2-5, we have $QH_{1}\\times QH_{1}^{\\prime}=QH_{2}\\times QH_{2}^{\\prime}$.\n\n step 4-2-2-7: Hence $H_{1},H_{2},H_{1}^{\\prime},H_{2}^{\\prime}$ are\n cyclic.\n\n step 4-2-3: Denote $M$ as the midpoint of $KK^{\\prime}$.\n\n step 4-2-4: We prove that $H_{1},H_{1}^{\\prime},H_{2},H_{2}^{\\prime}$\n are equidistant to $M$.\n\n step 4-2-4-1: Let $N$ be the midpoint of $H_{1}H_{1}^{\\prime}$.\n\n step 4-2-4-2: Since $H_{1}K\\parallel H_{1}^{\\prime}K^{\\prime}$ and\n both are perpendicular to $PQ$, we have $NM\\perp PQ$.\n\n step 4-2-4-3: Hence $M$ lies on the perpendicular bisector of $H_{1}H_{1}^{\\prime}$.\n\n step 4-2-4-4: Similarly $M$ lies on the perpendicular bisector of\n $H_{2}H_{2}^{\\prime}$.\n\n step 4-2-4-5: By steps 4-2-2, 4-2-4-3, 4-2-4-4 and the fact that $PQ$\n and $QR$ are not parallel, we have that the center should be $M$.\n\n step 4-2-5: Similarly $H_{2},H_{2}^{\\prime},H_{3},H_{3}^{\\prime}$\n are equidistant to $M$, and $H_{3},H_{3}^{\\prime},H_{4},H_{4}^{\\prime}$\n are equidistant to $M$.\n\n step 4-2-6: By steps 4-2-4 and 4-2-5, $H_{1},H_{1}^{\\prime},H_{2},H_{2}^{\\prime},H_{3},H_{3}^{\\prime},H_{4},H_{4}^{\\prime}$\n all lie on a circle centered at $M$.\n\n step 4-2-7: Since $\\angle KH_{1}Q=\\angle KH_{2}Q=90^{\\circ}$, $K,H_{1},Q,H_{2}$\n are cyclic.\n\n step 4-2-8: Similarly $K,H_{2},R,H_{3}$ are cyclic.\n\n step 4-2-9: Similarly $K,H_{3},S,H_{4}$ are cyclic.\n\n step 4-2-10: Similarly $K,H_{4},P,H_{1}$ are cyclic.\n\n step 4-2-11: By steps 4-2-6, 4-2-7, 4-2-8, 4-2-9, and 4-2-10, we have\n \\begin{align*}\n \\angle PKQ+\\angle RKS&=(\\angle PKH_{1}+\\angle QKH_{1})+(\\angle RKH_{3}+\\angle SKH_{3})\n &=\\angle PH_{4}H_{1}+\\angle QH_{2}H_{1}+\\angle RH_{2}H_{3}+\\angle SH_{4}H_{3}\n &=360^{\\circ}-(\\angle H_{1}H_{2}H_{3}+\\angle H_{3}H_{4}H_{1})=180^{\\circ}.\n \\end{align*}\n step 4-3: Assume $\\angle PKQ+\\angle RKS=180^{\\circ}$.\n\n step 4-3-1: By the same logic as in step 4-2, $H_{1},H_{2},H_{3},H_{4}$ lie on a circle $\\omega$.\n\n step 4-3-2: Let $O$ be the center of $\\omega$.\n\n step 4-3-3: Denote $J_{1},J_{2},J_{3},J_{4}$as the second intersection\n of $\\omega$ and $PQ,QR,RS,SP$, respectively.\n\n step 4-3-4: Let $K^{\\prime}$ be the reflection of $K$ with respect\n to $O$.\n\n step 4-3-5: Let $N^{\\prime}$ be the midpoint of $H_{1}J_{1}$.\n\n step 4-3-6: Since $KH_{1}\\parallel ON^{\\prime}$ and both are perpendicular\n to $PQ$, we have $K^{\\prime}J_{1}\\perp PQ$.\n\n step 4-3-7: Similarly $K^{\\prime}J_{2}\\perp QR$.\n\n step 4-3-8: Hence $\\angle PQK=\\angle H_{1}QK=90^{\\circ}-\\angle H_{1}KQ=90^{\\circ}-\\angle H_{1}H_{2}Q=90^{\\circ}-\\angle J_{2}J_{1}Q=\\angle RQK^{\\prime}$.\n\n step 4-3-9: Similarly $K,K^{\\prime}$ are isogonal with respect to\n all four angles of $PQRS$.\n\n step 4-3-10: Thus $K^{\\prime}$ is the isogonal conjugate of $K$\n with respect to $PQRS$.\\medskip{}\n\n step 5: Now suppose $\\angle BAC=\\angle XYZ$.\n\n step 5-1: Since $\\angle XYZ$ is acute, $\\triangle XYZ$ is acute,\n and $\\angle XAY,\\angle ZAY>90^{\\circ}>\\angle BAC$.\n\n step 5-2: Hence $\\square BCZX$ is convex, and $K$ is inside of $\\square BCZX$.\\medskip{}\n\n step 6: We prove that $D$ is the isogonal conjugate of $A$ with\n respect to $\\square BCZX$.\n\n step 6-1: We have $\\angle ZAX+\\angle BAC=(180^{\\circ}-\\angle XYZ)+\\angle XYZ=180^{\\circ}$.\n\n step 6-2: Hence by Lemma and steps 5-2, 6-1, $A$ has an isogonal\n conjugate with respect to $\\square BCZX$.\n\n step 6-3: $A,D$ are isogonal conjugates with respect to $\\triangle XYZ$\n as orthocenter and circumcenter.\n\n step 6-4: By step 6-3, $XA,XD$ are isogonal lines with respect to\n $\\angle BXZ$, and $ZA,ZD$ are isogonal lines with respect to $\\angle CZX$.\n\n step 6-5: By steps 6-2, 6-4, and the fact that there is at most one\n isogonal conjugate, we conclude that $D$ is indeed the isogonal conjugate.\n\n \\medskip{}\n\n step 7: We prove that $\\angle BDC=180^{\\circ}-2\\angle XYZ$.\n\n step 7-1: By step 6, $A$ is the isogonal conjugate of $D$ with respect\n to $\\square BCZX$.\n\n step 7-2: By Lemma, we have $\\angle BDC+\\angle XDZ=180^{\\circ}$.\n\n step 7-3: Since $D$ is the circumcenter of $\\triangle XYZ$, we have\n $\\angle XDZ=2\\angle XYZ$.\n\n step 7-4: By step 7-2 and 7-3, we have $\\angle BDC=180^{\\circ}-2\\angle XYZ$.\n step 7-5: Since $\\angle XYZ \\ne 60^\\circ$, we have $D\\ne A$.", + "grading_guidelines": "(Partial)\n 1. Constructed $D$ and found $\\theta$ correctly.\n 2. Found the necessary and sufficient conditions for the existence of isogonal conjugate in quadrilateral.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Advanced-005", + "level": "advanced", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": " " +} diff --git a/tasks/pb-advanced-005/tests/test.sh b/tasks/pb-advanced-005/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-005/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-006/instruction.md b/tasks/pb-advanced-006/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5c93004b2205bb40b4c980325275c9512675829a --- /dev/null +++ b/tasks/pb-advanced-006/instruction.md @@ -0,0 +1,12 @@ +# PB-Advanced-006 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Find all functions$f:\mathbb{Z}\rightarrow\mathbb{Z}$ + such that the equation + \[ + f(x-f(xy))=f(x)f(1-y) + \] + holds for all $x,y\in\mathbb{Z}$. diff --git a/tasks/pb-advanced-006/solution/solve.sh b/tasks/pb-advanced-006/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..9a57b2fd063fd06c314d5b9b8c94ddbc0d41e8dd --- /dev/null +++ b/tasks/pb-advanced-006/solution/solve.sh @@ -0,0 +1,145 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_763fd2531c3da0ca00ad910f3e70d7271b0ecfdaf99ff4dcb16a7857394d7ada' +Let $P(x,y)$ be the assertion $f(x-f(xy))=f(x)f(1-y)$. + + If $f$ is constant, $f\equiv0$ or $f\equiv1$. From now on we will + only consider non-constant functions. + + Claim 1 $f(f(x))=f(x)$ for all $x\in\mathbb{Z}$ + + Proof. $P(0,y):f(-f(0))=f(0)f(1-y)\Longrightarrow f(0)=0$ + + $P(x,0):f(x)=f(x)f(1)\Longrightarrow f(1)=1$ + + $P(1,y):f(1-f(y))=f(1-y)$ + + $P(1,1-y):f(1-f(1-y))=f(y)$ + + $P(1,1-f(y)):f(y)=f(1-f(1-y))=f(1-f(1-f(y)))=f(f(y))\Longrightarrow f(f(x))=f(x)\forall x\in\mathbb{Z}\blacksquare$ + + $\Longrightarrow P(x,1):f(x-f(x))=0$ + + Now consider $f(\mathbb{Z})$. + + Case 1 $f(\mathbb{Z})\subset\{-1,0,1\}$ + + Case 1.1. $f(\mathbb{Z})=\{0,1\}$ + + We have $f(x)=1\textbackslash \Longrightarrow f(x-1)=0\textbackslash \Longrightarrow + f(2-x)=1 \textbackslash \Longrightarrow f(1-x)=0$ and $f(1-x)=0 + \textbackslash \Longrightarrow f(x)=1$ + + \[ + \therefore f(x)=1\Longleftrightarrow f(x-1)=0\Longleftrightarrow f(2-x)=1\Longleftrightarrow f(1-x)=0 + \] + We can inductively prove that $f(x)=\begin{cases} + 0 & 2|x + + 1 & 2\nmid x + \end{cases}$ + + Case 1.2. $f(\mathbb{Z})=\{-1,0,1\}\Longrightarrow f(-1)=-1$ + + $P(1,x)$ and $P(-1,x)$ gives + + \begin{align*} + f(x)=1 & \Longrightarrow f(1-x)=0,f(x+1)=-f(-2) + + f(x)=0 & \Longrightarrow f(1-x)=1,f(x+1)=1 + + f(x)=-1 & \Longrightarrow f(1-x)=f(2),f(x+1)=0 + \end{align*} + It's easy to see that $f(-2)=1,f(2)=-1$, and using this, we can inductively + prove that $f(x)=\begin{cases} + 0 & 3|x + + 1 & 3|x-1 + + -1 & 3|x+1 + \end{cases}$ + + Case 2. $f(\mathbb{Z})$ is not a subset of $\{-1,0,1\}$ + + Case 2.1 $f(t)=1$ for some $2\mid t$ + + \[ + P(2,\frac{t}{2}):1=f(1)=f(2)f(1-\frac{t}{2}) + \] + + Case 2.1.1 : $f(2)=1\Longrightarrow P(2,1):1=f(2)f(0)=0$. Contradiction! + + Case 2.1.2 : $f(2)=-1\Longrightarrow f(-1)=-1,f(1-\frac{t}{2})=-1$ + + $P(-1,-x):f(-1-f(x))=-f(1+x)$ + + $P(-1,-f(x)):f(-1-f(x))=f(-1-f(f(x)))=-f(1+f(x))\Longrightarrow f(1+x)=f(1+f(x))...(*)$ + + Since $f(2)=-1$, so plugging this in $(*)$, we have + + \[ + f(2)=-1\Longrightarrow f(3)=0\Longrightarrow f(4)=1\Longrightarrow f(5)=-1\cdots + \] + We can prove inductively that$f(x)=\begin{cases} + 0 & 3|x + + 1 & 3|x-1 + + -1 & 3|x+1 + \end{cases}$ for all $x\in\mathbb{N}$. + + Plugging in $x=-1,y=-n(n\in\mathbb{N})$ gives $f(-1-n)=f(-1-f(n))=-f(1+n)$, + so we have $f(x)=\begin{cases} + 0 & 3|x + + 1 & 3|x-1 + + -1 & 3|x+1 + \end{cases}$for all $x$, so contradiction since $f(\mathbb{Z})\in\{-1,0,1\}$. + + Case 2.2 $f(t)=1\Longrightarrow2\nmid t$ + + Claim 2 $f(-1)=-1$ or $f(2)=0$ + + Proof. Assume that $f(2)\neq0$ + + We will prove that $f(t)=1\Longrightarrow f(1-t)=0$. $P(2,\frac{1-t}{2})$ + gives + + \[ + f(2)=f(2)f(\frac{t-3}{2})\Longrightarrow f(\frac{t-3}{2})=1 + \] + We repeat this, then we get $t\equiv1(mod2^{n})$ for all $n\Longrightarrow t=1$. + Note that + + \[ + f(-1)=c\Longrightarrow f(-1-c)=0\Longrightarrow f(c+2)=1 + \] + Hence we conclude that $c=-1$. + + Case 2.2.1. $f(2)=0\Longrightarrow f(-1)=1$ + + Define $n$ as the element of $f(\mathbb{Z})-\{-1,0,1\}$ which has + the smallest absolute value. Then we have + + \[ + f(x-f(xy))=n\Longrightarrow\{f(x),f(1-y)\}=\{1,n\}\text{ or }\{f(x),f(1-y)\}=\{-1,-n\}...(\star) + \] + . Also note that $P(-n,- 1):f(-n-f(n))=0$, where $f(n)=n$ by Claim 1. Thus by $x=n,y=-2$ $(\star)\Longrightarrow f(3)=1$. + Case 2.2.1. now becomes a repetition of Case 1.1, so contradiction! + + Case 2.2.2. $f(2)\neq0,f(-1)=-1,f(-2)=-f(2)$ + + Claim 3 $f(n)=t\Longrightarrow n=t\forall t\leq1$ + + Proof. We use induction on $t$. $t=1$ is already proven above. Assume + that $t$ works. + + If $f(n)=t-1\Longrightarrow f(1+n)=f(1+f(n))=f(t)\Longrightarrow n=t-1$, + so we're done. + + Use the same method to prove that $f(n)=n\forall n\leq1$, and $P(-1,n)(n>0)$ + gives $f(n+1)=-f(-n-1)=n+1$, so $f(n)=n$ for all $n\in\mathbb{Z}$. +IMO_PROOF_763fd2531c3da0ca00ad910f3e70d7271b0ecfdaf99ff4dcb16a7857394d7ada diff --git a/tasks/pb-advanced-006/task.toml b/tasks/pb-advanced-006/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7d1de5c90b41ff7c64c9af43a36dbf2a45a78aa6 --- /dev/null +++ b/tasks/pb-advanced-006/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-006" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-006" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-006/tests/grade_task.py b/tasks/pb-advanced-006/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-006/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-006/tests/reference.json b/tasks/pb-advanced-006/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..6503c1dbb82ff6b7955deabb18dbe76dbc3e1117 --- /dev/null +++ b/tasks/pb-advanced-006/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Find all functions$f:\\mathbb{Z}\\rightarrow\\mathbb{Z}$\n such that the equation\n \\[\n f(x-f(xy))=f(x)f(1-y)\n \\]\n holds for all $x,y\\in\\mathbb{Z}$.", + "solution": "Let $P(x,y)$ be the assertion $f(x-f(xy))=f(x)f(1-y)$.\n\n If $f$ is constant, $f\\equiv0$ or $f\\equiv1$. From now on we will\n only consider non-constant functions.\n\n Claim 1 $f(f(x))=f(x)$ for all $x\\in\\mathbb{Z}$\n\n Proof. $P(0,y):f(-f(0))=f(0)f(1-y)\\Longrightarrow f(0)=0$\n\n $P(x,0):f(x)=f(x)f(1)\\Longrightarrow f(1)=1$\n\n $P(1,y):f(1-f(y))=f(1-y)$\n\n $P(1,1-y):f(1-f(1-y))=f(y)$\n\n $P(1,1-f(y)):f(y)=f(1-f(1-y))=f(1-f(1-f(y)))=f(f(y))\\Longrightarrow f(f(x))=f(x)\\forall x\\in\\mathbb{Z}\\blacksquare$\n\n $\\Longrightarrow P(x,1):f(x-f(x))=0$\n\n Now consider $f(\\mathbb{Z})$.\n\n Case 1 $f(\\mathbb{Z})\\subset\\{-1,0,1\\}$\n\n Case 1.1. $f(\\mathbb{Z})=\\{0,1\\}$\n\n We have $f(x)=1\\textbackslash \\Longrightarrow f(x-1)=0\\textbackslash \\Longrightarrow\n f(2-x)=1 \\textbackslash \\Longrightarrow f(1-x)=0$ and $f(1-x)=0\n \\textbackslash \\Longrightarrow f(x)=1$\n\n \\[\n \\therefore f(x)=1\\Longleftrightarrow f(x-1)=0\\Longleftrightarrow f(2-x)=1\\Longleftrightarrow f(1-x)=0\n \\]\n We can inductively prove that $f(x)=\\begin{cases}\n 0 & 2|x\n\n 1 & 2\\nmid x\n \\end{cases}$\n\n Case 1.2. $f(\\mathbb{Z})=\\{-1,0,1\\}\\Longrightarrow f(-1)=-1$\n\n $P(1,x)$ and $P(-1,x)$ gives\n\n \\begin{align*}\n f(x)=1 & \\Longrightarrow f(1-x)=0,f(x+1)=-f(-2)\n\n f(x)=0 & \\Longrightarrow f(1-x)=1,f(x+1)=1\n\n f(x)=-1 & \\Longrightarrow f(1-x)=f(2),f(x+1)=0\n \\end{align*}\n It's easy to see that $f(-2)=1,f(2)=-1$, and using this, we can inductively\n prove that $f(x)=\\begin{cases}\n 0 & 3|x\n\n 1 & 3|x-1\n\n -1 & 3|x+1\n \\end{cases}$\n\n Case 2. $f(\\mathbb{Z})$ is not a subset of $\\{-1,0,1\\}$\n\n Case 2.1 $f(t)=1$ for some $2\\mid t$\n\n \\[\n P(2,\\frac{t}{2}):1=f(1)=f(2)f(1-\\frac{t}{2})\n \\]\n\n Case 2.1.1 : $f(2)=1\\Longrightarrow P(2,1):1=f(2)f(0)=0$. Contradiction!\n\n Case 2.1.2 : $f(2)=-1\\Longrightarrow f(-1)=-1,f(1-\\frac{t}{2})=-1$\n\n $P(-1,-x):f(-1-f(x))=-f(1+x)$\n\n $P(-1,-f(x)):f(-1-f(x))=f(-1-f(f(x)))=-f(1+f(x))\\Longrightarrow f(1+x)=f(1+f(x))...(*)$\n\n Since $f(2)=-1$, so plugging this in $(*)$, we have\n\n \\[\n f(2)=-1\\Longrightarrow f(3)=0\\Longrightarrow f(4)=1\\Longrightarrow f(5)=-1\\cdots\n \\]\n We can prove inductively that$f(x)=\\begin{cases}\n 0 & 3|x\n\n 1 & 3|x-1\n\n -1 & 3|x+1\n \\end{cases}$ for all $x\\in\\mathbb{N}$.\n\n Plugging in $x=-1,y=-n(n\\in\\mathbb{N})$ gives $f(-1-n)=f(-1-f(n))=-f(1+n)$,\n so we have $f(x)=\\begin{cases}\n 0 & 3|x\n\n 1 & 3|x-1\n\n -1 & 3|x+1\n \\end{cases}$for all $x$, so contradiction since $f(\\mathbb{Z})\\in\\{-1,0,1\\}$.\n\n Case 2.2 $f(t)=1\\Longrightarrow2\\nmid t$\n\n Claim 2 $f(-1)=-1$ or $f(2)=0$\n\n Proof. Assume that $f(2)\\neq0$\n\n We will prove that $f(t)=1\\Longrightarrow f(1-t)=0$. $P(2,\\frac{1-t}{2})$\n gives\n\n \\[\n f(2)=f(2)f(\\frac{t-3}{2})\\Longrightarrow f(\\frac{t-3}{2})=1\n \\]\n We repeat this, then we get $t\\equiv1(mod2^{n})$ for all $n\\Longrightarrow t=1$.\n Note that\n\n \\[\n f(-1)=c\\Longrightarrow f(-1-c)=0\\Longrightarrow f(c+2)=1\n \\]\n Hence we conclude that $c=-1$.\n\n Case 2.2.1. $f(2)=0\\Longrightarrow f(-1)=1$\n\n Define $n$ as the element of $f(\\mathbb{Z})-\\{-1,0,1\\}$ which has\n the smallest absolute value. Then we have\n\n \\[\n f(x-f(xy))=n\\Longrightarrow\\{f(x),f(1-y)\\}=\\{1,n\\}\\text{ or }\\{f(x),f(1-y)\\}=\\{-1,-n\\}...(\\star)\n \\]\n . Also note that $P(-n,- 1):f(-n-f(n))=0$, where $f(n)=n$ by Claim 1. Thus by $x=n,y=-2$ $(\\star)\\Longrightarrow f(3)=1$.\n Case 2.2.1. now becomes a repetition of Case 1.1, so contradiction!\n\n Case 2.2.2. $f(2)\\neq0,f(-1)=-1,f(-2)=-f(2)$\n\n Claim 3 $f(n)=t\\Longrightarrow n=t\\forall t\\leq1$\n\n Proof. We use induction on $t$. $t=1$ is already proven above. Assume\n that $t$ works.\n\n If $f(n)=t-1\\Longrightarrow f(1+n)=f(1+f(n))=f(t)\\Longrightarrow n=t-1$,\n so we're done.\n\n Use the same method to prove that $f(n)=n\\forall n\\leq1$, and $P(-1,n)(n>0)$\n gives $f(n+1)=-f(-n-1)=n+1$, so $f(n)=n$ for all $n\\in\\mathbb{Z}$.", + "grading_guidelines": "(Partial)\n 1. Proved $f(f(x))=f(x)$.\n 2. Handled the case where $f\\subseteq \\{-1, 0, 1\\}$.\n 3. Handled the case where $f\\not \\subset \\{-1, 0, 1\\}$.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Advanced-006", + "level": "advanced", + "category": "Algebra", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": "$f_{1}(x)\\equiv0$, $f_{2}(x)\\equiv1$,\n$f_{3}(x)\\equiv x$, $f_{4}(x)=\\begin{cases}\n0, & x=2n\\\\\n1, & x=2n+1\n\\end{cases}$, where $n\\in\\mathbb{Z}$, $f_{5}(x)=\\begin{cases}\n0, & x=3n\\\\\n1, & x=3n+1\\\\\n-1, & x=3n+2\n\\end{cases}$, where $n\\in\\mathbb{Z}$" +} diff --git a/tasks/pb-advanced-006/tests/test.sh b/tasks/pb-advanced-006/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-006/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-007/instruction.md b/tasks/pb-advanced-007/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e57f62cccf2ddb0fcd46ffcac66c737d6c903ec8 --- /dev/null +++ b/tasks/pb-advanced-007/instruction.md @@ -0,0 +1,13 @@ +# PB-Advanced-007 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Prove that there exist two real-coefficient polynomials $P(x)$ and $Q(x)$ satisfying the following condition: + + (Condition) The degree of the polynomial $P(x)$ is at least 2024, the degree of $Q(x)$ is at least 2, and for any real number $x$, the following holds: + + \[ + P(Q(x)-x-1)=Q(P(x)) + \] diff --git a/tasks/pb-advanced-007/solution/solve.sh b/tasks/pb-advanced-007/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ed1f1ab8015daaece96475d9e18e576029a5ba43 --- /dev/null +++ b/tasks/pb-advanced-007/solution/solve.sh @@ -0,0 +1,51 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_a9aad31a8bdf1311c6dc42d44c11086264b96b4610a037c6d6afa3a8fbd3831c' + Checking the possibility of recursive construction using induction + + Let's assume that two polynomials $P_{0}$ and $Q_{0}$ satisfy the polynomial equation given in the problem as follows: + + \[ + P_{0}\left(Q_{0}(x)-x-1\right)=Q_{0}\left(P_{0}(x)\right) + \] + + For a positive integer $n$, let's define the polynomial $P_{n}(x)$ recursively as follows: + + \[ + P_{n}(x)=P_{n-1}\left(Q_{0}(x)-x-1\right); n \geq 1 + \] + + Let's prove by mathematical induction that for any non-negative integer $n$, $(P_{n}, Q_{0})$ also satisfies the given polynomial equation. + + *(1)* First, we have already confirmed that the case $n=0$ holds. + + *(2)* Next, let's assume that the case $n=k$ holds, i.e., assume that $(P_{k}, Q_{0})$ is also a solution to the polynomial equation. Then, by the induction hypothesis and the recursive formula for $P_{n}$ defined above, we have + + \[ + P_{k+1}(x)=P_{k}\left(Q_{0}(x)-x-1\right)=Q_{0}\left(P_{k}(x)\right) + \] + + Now, substituting $x=Q_{0}(y)-y-1$, we get + + \[ + P_{k+1}\left(Q_{0}(y)-y-1\right)=Q_{0}\left(P_{k}\left(Q_{0}(y)-y-1\right)\right)=Q_{0}\left(P_{k+1}(y)\right) + \] + + Therefore, we can see that the proposition holds for the case $n=k+1$. + + Initialization + + As we saw in , if we find an initial solution $(P_{0}, Q_{0})$, we can continuously generate solutions. In particular, looking at the recursive formula for $P_{n}$, if the degree of $Q_{0}$ is at least 2, the degree of $P_{n}$ is twice the degree of $P_{n-1}$, which continuously increases. Therefore, by repeating this process, we can eventually make the degree of $P_{n}$ greater than 2024. + + Therefore, to find an initial solution, let's first try $P_{0}$ as a linear polynomial and $Q_{0}$ as a quadratic polynomial. It is easy to see that there are no possible cases. If both $P_{0}$ and $Q_{0}$ are quadratic polynomials, substituting $P_{0}(x)=ax^{2}+bx+c$, $Q_{0}(x)=ux^{2}+vx+w$ and using the method of undetermined coefficients, we find that + + \[ + P_{0}(x)=x^{2}+\frac{5}{2} x, \quad Q_{0}(x)=x^{2}+\frac{7}{2} x+\frac{3}{2} + \] + + is a solution to the polynomial equation $P_{0}\left(Q_{0}(x)-x-1\right)=Q_{0}\left(P_{0}(x)\right)$. + + Now, repeating based on this initial solution, $(P_{n}, Q_{0})$ is also a solution for any $n$, and in particular, the degree of $P_{11}$ is 2048, which is greater than 2024. +IMO_PROOF_a9aad31a8bdf1311c6dc42d44c11086264b96b4610a037c6d6afa3a8fbd3831c diff --git a/tasks/pb-advanced-007/task.toml b/tasks/pb-advanced-007/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..60a574f56b5920643e9f76d4ada4bca39cef6d32 --- /dev/null +++ b/tasks/pb-advanced-007/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-007" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-007" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-007/tests/grade_task.py b/tasks/pb-advanced-007/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-007/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-007/tests/reference.json b/tasks/pb-advanced-007/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..4b268f41d0a150d13d06274b544b685d0c02d593 --- /dev/null +++ b/tasks/pb-advanced-007/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Prove that there exist two real-coefficient polynomials $P(x)$ and $Q(x)$ satisfying the following condition:\n\n (Condition) The degree of the polynomial $P(x)$ is at least 2024, the degree of $Q(x)$ is at least 2, and for any real number $x$, the following holds:\n\n \\[\n P(Q(x)-x-1)=Q(P(x))\n \\]", + "solution": " Checking the possibility of recursive construction using induction\n\n Let's assume that two polynomials $P_{0}$ and $Q_{0}$ satisfy the polynomial equation given in the problem as follows:\n\n \\[\n P_{0}\\left(Q_{0}(x)-x-1\\right)=Q_{0}\\left(P_{0}(x)\\right)\n \\]\n\n For a positive integer $n$, let's define the polynomial $P_{n}(x)$ recursively as follows:\n\n \\[\n P_{n}(x)=P_{n-1}\\left(Q_{0}(x)-x-1\\right); n \\geq 1\n \\]\n\n Let's prove by mathematical induction that for any non-negative integer $n$, $(P_{n}, Q_{0})$ also satisfies the given polynomial equation.\n\n *(1)* First, we have already confirmed that the case $n=0$ holds.\n\n *(2)* Next, let's assume that the case $n=k$ holds, i.e., assume that $(P_{k}, Q_{0})$ is also a solution to the polynomial equation. Then, by the induction hypothesis and the recursive formula for $P_{n}$ defined above, we have\n\n \\[\n P_{k+1}(x)=P_{k}\\left(Q_{0}(x)-x-1\\right)=Q_{0}\\left(P_{k}(x)\\right)\n \\]\n\n Now, substituting $x=Q_{0}(y)-y-1$, we get\n\n \\[\n P_{k+1}\\left(Q_{0}(y)-y-1\\right)=Q_{0}\\left(P_{k}\\left(Q_{0}(y)-y-1\\right)\\right)=Q_{0}\\left(P_{k+1}(y)\\right)\n \\]\n\n Therefore, we can see that the proposition holds for the case $n=k+1$.\n\n Initialization\n\n As we saw in , if we find an initial solution $(P_{0}, Q_{0})$, we can continuously generate solutions. In particular, looking at the recursive formula for $P_{n}$, if the degree of $Q_{0}$ is at least 2, the degree of $P_{n}$ is twice the degree of $P_{n-1}$, which continuously increases. Therefore, by repeating this process, we can eventually make the degree of $P_{n}$ greater than 2024.\n\n Therefore, to find an initial solution, let's first try $P_{0}$ as a linear polynomial and $Q_{0}$ as a quadratic polynomial. It is easy to see that there are no possible cases. If both $P_{0}$ and $Q_{0}$ are quadratic polynomials, substituting $P_{0}(x)=ax^{2}+bx+c$, $Q_{0}(x)=ux^{2}+vx+w$ and using the method of undetermined coefficients, we find that\n\n \\[\n P_{0}(x)=x^{2}+\\frac{5}{2} x, \\quad Q_{0}(x)=x^{2}+\\frac{7}{2} x+\\frac{3}{2}\n \\]\n\n is a solution to the polynomial equation $P_{0}\\left(Q_{0}(x)-x-1\\right)=Q_{0}\\left(P_{0}(x)\\right)$.\n\n Now, repeating based on this initial solution, $(P_{n}, Q_{0})$ is also a solution for any $n$, and in particular, the degree of $P_{11}$ is 2048, which is greater than 2024.", + "grading_guidelines": "(Partial)\n 1. Found a non-constant solution $P$, $Q$ satisfies the equation.\n(Almost)\n 1. Described a contruction that enables us to increase the degree of the solutions, but did not fully verify.", + "problem_id": "PB-Advanced-007", + "level": "advanced", + "category": "Algebra", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-advanced-007/tests/test.sh b/tasks/pb-advanced-007/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-007/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-008/instruction.md b/tasks/pb-advanced-008/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..483d9ed29db2c395c660b9f3b305ed500d1249b0 --- /dev/null +++ b/tasks/pb-advanced-008/instruction.md @@ -0,0 +1,17 @@ +# PB-Advanced-008 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $\left\{F_{n}\right\}_{n \geq 1}$ be a sequence of integers satisfying $F_{1}=1$ and for $n \geq 2$, + \[ + F_{n}=n^{F_{n-1}}. + \] + For example, $F_3 = 3^2= 9$ and $F_4 = 4^9$. + + Prove that for any positive integers $a, c$ and integer $b$, there exists a positive integer $n$ such that the following expression is an integer: + + \[ + \frac{a^{F_{n}}+n-b}{c}. + \] diff --git a/tasks/pb-advanced-008/solution/solve.sh b/tasks/pb-advanced-008/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ffdf79e42a15cece61d3dd0a312d738602195548 --- /dev/null +++ b/tasks/pb-advanced-008/solution/solve.sh @@ -0,0 +1,110 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_25823c9e705bbb7180ed55319546730cc034932e770b777af059a80fc451705d' +First, let's prove the following Lemma, which is an extension of Euler's theorem. + + Given positive integers $n$ and $a$, there exists a positive integer $N$ such that for any positive integer $k \geq N$, $a^{k+\phi(n)} \equiv a^{k}(\bmod n)$ holds. + + Let $p_1, p_2, \cdots, p_t$ the common prime divisors of $n$ and $a$, and let $\max_{1\le i\le t} v_{p_i} (n) =M$. Then, if we set $N=M$, the conclusion holds. Let $n=p_n \times q_n$, $a=p_a \times q_a$, where $p_n$ and $p_a$ represents the $p_1, p_2, \cdots, p_t$ part of the prime factorization of $n, a$, respectively. Note that $p_n | (p_1 p_2 \cdots p_t )^M$, and that $(a, q_n) =1$. + + First, if $k \geq M$, then $a^{k+\phi(n)} \equiv a^{k} \equiv 0\left(\bmod p_n \right)$. Also, $\phi(n)=\phi\left(p_n \right) \cdot \phi(q_n)$, so + + \[ + a^{k+\phi(n)} \equiv a^{k+\phi\left(p_n\right) \cdot \phi(q_n)} \equiv a^{k}(\bmod q_m) + \] + + holds. Combining the two equations, we obtain $a^{k+\phi(n)} \equiv a^{k}(\bmod n)$, which completes the proof. $\qed$ + + Let's also prove the following Lemma about $F_{n}$. + + Given positive integers $n$ and $a$, there exists a positive integer $N$ such that for any positive integer $k \geq N$, $F_{k} \equiv F_{k+\Phi(n)}(\bmod n)$ holds. + + Here, $\Phi(n)$ is the least common multiple of $n, \phi(n), \phi^{(2)}(n), \ldots$. + + + + We will prove this by induction on $n$. + + (1) (Base case) If $n=1$, the statement holds trivially. + + (2) (Induction step) Assume that the statement holds for all positive integers less than $n$. + + By the induction hypothesis, there exists a positive integer $N$ such that for $k \geq N$, + + \[ + F_{k} \equiv F_{k+\Phi(\phi(n))}(\bmod \phi(n)) + \] + + holds. + + Now, consider the least common multiple of $\Phi(\phi(n))$ and $n$, which is $\Phi(n)$. Since $F_{k+1}=(k+1)^{F_{k}}$, by $, + + \[ + (k+\Phi(n)+1)^{F_{k+\Phi(n)}} \equiv(k+1)^{F_{k+\Phi(n)}} \equiv(k+1)^{F_{k}}(\bmod n) + \] + + holds for all sufficiently large $k$. Therefore, the statement also holds for $n$. $\qed$ + + Now, let's prove the original problem. + $ \operatorname{gcd}(\Phi(\phi(c)), c) Factorize $c$ into primes as $c=p_{1}^{e_{1}} \cdots p_{k}^{e_{k}}$. Also, let $p_{1}<\cdots0$. + + Then, $\phi(c)=p_{1}^{e_{1}-1} \cdots p_{k}^{e_{k}-1}\left(p_{1}-1\right) \cdots\left(p_{k}-1\right)$, and since $p_{i}-1$ is not a multiple of $p_{k}$, + + \[ + v_{p_{k}}(\phi(c)) Therefore, by induction, for all positive integers $r$, $v_{p_{k}}\left(\phi^{(r)}(c)\right) Applying strong induction on $c$ + + We will prove the problem by strong mathematical induction on $c$. + + If $c=1$, the statement holds for any positive integer $n$. + + Assume that the statement holds for $c=1, \ldots c-1$, and let's prove the statement for $c$. + + First, choose $n$ large enough so that + + \[ + a^{F_{n}} \equiv a^{F_n+\phi(c)}(\bmod c) + \] + + holds. By , $\operatorname{gcd}(c, \Phi(\phi(c))) By , among these solutions, for sufficiently large $n$, + + \[ + a^{F_{n}} \equiv a^{F_{n+\Phi(\phi(c))}}(\bmod c) + \] + + holds. Let this $n$ be $n_{0}$. + + Consider the following system of congruences for $n$: + + \[ + n \equiv n_{0}(\bmod \Phi(\phi(c))), a^{F_{n_{0}}}+n \equiv b(\bmod c) + \] + + This system of congruences has $n_{0}$ as a solution modulo $\operatorname{gcd}(c, \Phi(\phi(c)))$, so by the Chinese Remainder Theorem, there exists an $n$ that satisfies both congruences modulo $\operatorname{lcm}(\Phi(\phi(c)), c)$. For this $n$, + + \[ + a^{F_{n}}+n \equiv a^{F_{n_{0}}}+n \equiv b(\bmod c) + \] + + holds, so the desired equation holds, and therefore the induction hypothesis holds for $c$. + + By induction, for all $c$, there exist infinitely many $n$ that satisfy $a^{F_{n}}+n \equiv b(\bmod c)$. +IMO_PROOF_25823c9e705bbb7180ed55319546730cc034932e770b777af059a80fc451705d diff --git a/tasks/pb-advanced-008/task.toml b/tasks/pb-advanced-008/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2ea71e09235f6f435ad4ce0523688d32991b3ba2 --- /dev/null +++ b/tasks/pb-advanced-008/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-008" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-008" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-008/tests/grade_task.py b/tasks/pb-advanced-008/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-008/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-008/tests/reference.json b/tasks/pb-advanced-008/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..014b5f4d6b0eb7e067d8673f761d2c031c2b0f48 --- /dev/null +++ b/tasks/pb-advanced-008/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $\\left\\{F_{n}\\right\\}_{n \\geq 1}$ be a sequence of integers satisfying $F_{1}=1$ and for $n \\geq 2$,\n \\[\n F_{n}=n^{F_{n-1}}.\n \\]\n For example, $F_3 = 3^2= 9$ and $F_4 = 4^9$.\n\n Prove that for any positive integers $a, c$ and integer $b$, there exists a positive integer $n$ such that the following expression is an integer:\n\n \\[\n \\frac{a^{F_{n}}+n-b}{c}.\n \\]", + "solution": "First, let's prove the following Lemma, which is an extension of Euler's theorem.\n\n Given positive integers $n$ and $a$, there exists a positive integer $N$ such that for any positive integer $k \\geq N$, $a^{k+\\phi(n)} \\equiv a^{k}(\\bmod n)$ holds.\n\n Let $p_1, p_2, \\cdots, p_t$ the common prime divisors of $n$ and $a$, and let $\\max_{1\\le i\\le t} v_{p_i} (n) =M$. Then, if we set $N=M$, the conclusion holds. Let $n=p_n \\times q_n$, $a=p_a \\times q_a$, where $p_n$ and $p_a$ represents the $p_1, p_2, \\cdots, p_t$ part of the prime factorization of $n, a$, respectively. Note that $p_n | (p_1 p_2 \\cdots p_t )^M$, and that $(a, q_n) =1$.\n\n First, if $k \\geq M$, then $a^{k+\\phi(n)} \\equiv a^{k} \\equiv 0\\left(\\bmod p_n \\right)$. Also, $\\phi(n)=\\phi\\left(p_n \\right) \\cdot \\phi(q_n)$, so\n\n \\[\n a^{k+\\phi(n)} \\equiv a^{k+\\phi\\left(p_n\\right) \\cdot \\phi(q_n)} \\equiv a^{k}(\\bmod q_m)\n \\]\n\n holds. Combining the two equations, we obtain $a^{k+\\phi(n)} \\equiv a^{k}(\\bmod n)$, which completes the proof. $\\qed$\n\n Let's also prove the following Lemma about $F_{n}$.\n\n Given positive integers $n$ and $a$, there exists a positive integer $N$ such that for any positive integer $k \\geq N$, $F_{k} \\equiv F_{k+\\Phi(n)}(\\bmod n)$ holds.\n\n Here, $\\Phi(n)$ is the least common multiple of $n, \\phi(n), \\phi^{(2)}(n), \\ldots$.\n\n \n\n We will prove this by induction on $n$.\n\n (1) (Base case) If $n=1$, the statement holds trivially.\n\n (2) (Induction step) Assume that the statement holds for all positive integers less than $n$.\n\n By the induction hypothesis, there exists a positive integer $N$ such that for $k \\geq N$,\n\n \\[\n F_{k} \\equiv F_{k+\\Phi(\\phi(n))}(\\bmod \\phi(n))\n \\]\n\n holds.\n\n Now, consider the least common multiple of $\\Phi(\\phi(n))$ and $n$, which is $\\Phi(n)$. Since $F_{k+1}=(k+1)^{F_{k}}$, by $,\n\n \\[\n (k+\\Phi(n)+1)^{F_{k+\\Phi(n)}} \\equiv(k+1)^{F_{k+\\Phi(n)}} \\equiv(k+1)^{F_{k}}(\\bmod n)\n \\]\n\n holds for all sufficiently large $k$. Therefore, the statement also holds for $n$. $\\qed$\n\n Now, let's prove the original problem.\n $ \\operatorname{gcd}(\\Phi(\\phi(c)), c) Factorize $c$ into primes as $c=p_{1}^{e_{1}} \\cdots p_{k}^{e_{k}}$. Also, let $p_{1}<\\cdots0$.\n\n Then, $\\phi(c)=p_{1}^{e_{1}-1} \\cdots p_{k}^{e_{k}-1}\\left(p_{1}-1\\right) \\cdots\\left(p_{k}-1\\right)$, and since $p_{i}-1$ is not a multiple of $p_{k}$,\n\n \\[\n v_{p_{k}}(\\phi(c)) Therefore, by induction, for all positive integers $r$, $v_{p_{k}}\\left(\\phi^{(r)}(c)\\right) Applying strong induction on $c$\n\n We will prove the problem by strong mathematical induction on $c$.\n\n If $c=1$, the statement holds for any positive integer $n$.\n\n Assume that the statement holds for $c=1, \\ldots c-1$, and let's prove the statement for $c$.\n\n First, choose $n$ large enough so that\n\n \\[\n a^{F_{n}} \\equiv a^{F_n+\\phi(c)}(\\bmod c)\n \\]\n\n holds. By , $\\operatorname{gcd}(c, \\Phi(\\phi(c))) By , among these solutions, for sufficiently large $n$,\n\n \\[\n a^{F_{n}} \\equiv a^{F_{n+\\Phi(\\phi(c))}}(\\bmod c)\n \\]\n\n holds. Let this $n$ be $n_{0}$.\n\n Consider the following system of congruences for $n$:\n\n \\[\n n \\equiv n_{0}(\\bmod \\Phi(\\phi(c))), a^{F_{n_{0}}}+n \\equiv b(\\bmod c)\n \\]\n\n This system of congruences has $n_{0}$ as a solution modulo $\\operatorname{gcd}(c, \\Phi(\\phi(c)))$, so by the Chinese Remainder Theorem, there exists an $n$ that satisfies both congruences modulo $\\operatorname{lcm}(\\Phi(\\phi(c)), c)$. For this $n$,\n\n \\[\n a^{F_{n}}+n \\equiv a^{F_{n_{0}}}+n \\equiv b(\\bmod c)\n \\]\n\n holds, so the desired equation holds, and therefore the induction hypothesis holds for $c$.\n\n By induction, for all $c$, there exist infinitely many $n$ that satisfy $a^{F_{n}}+n \\equiv b(\\bmod c)$.", + "grading_guidelines": "(Partial)\n 1. Obtained a period of $F_n \\pmod c$.\n 2. Showed that the period is not a multiple of $n$.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Advanced-008", + "level": "advanced", + "category": "Number theory", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": " " +} diff --git a/tasks/pb-advanced-008/tests/test.sh b/tasks/pb-advanced-008/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-008/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-009/instruction.md b/tasks/pb-advanced-009/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b8d1007221aadb48971b433271d3b5810904d4b1 --- /dev/null +++ b/tasks/pb-advanced-009/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-009 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $H$ be the orthocenter of an acute-angled triangle $A B C$, and let $D, E, F$ be the feet of the altitudes from vertices $A, B, C$ to the opposite sides, respectively. Let $G$ be the midpoint of $B C$. Let $I, J$ be the feet of the perpendiculars from $B, C$ to $AG$, respectively. Let $K (\neq D)$ be the second intersection of the circumcircles of triangle $D I F$ and triangle $D J E$. Let $M$ be the midpoint of segment $A H$. Let $L$ be the foot of the perpendicular from $M$ to $A G$. Let $R (\neq G)$ be the second intersection of the circumcircle of triangle $A H G$ with $B C$. Let $S$ be the intersection of line $A H$ and $E F$. Let $N$ be the foot of the perpendicular from point $D$ to $R S$. Let $O$ be the midpoint of segment $D N$. Let line $D N$ intersect the circumcircle of triangle $D K L$ again at point $P (\neq D)$. Let $Q (\neq C)$ be the second intersection of the circumcircle of triangle $O C P$ and line $B C$. Prove that $A B=A Q$. diff --git a/tasks/pb-advanced-009/solution/solve.sh b/tasks/pb-advanced-009/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..dc616e533bbfa07b2746c1c894f5716a2fe874f9 --- /dev/null +++ b/tasks/pb-advanced-009/solution/solve.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_c853e91f1beeaf2169ac7d34ddd7aa840be121107c8cea463d7465ae81dfe3c0' + First, let $Z$ be the intersection of lines $E F$ and $B C$. From the harmonic relation $(Z D, B C)=-1$, we have $$D G \times D R=D H \times D A=D B \times D C=D Z \times D G,$$ which implies $D Z=D R$. Therefore $R S$ is the reflection of $E F$ with respect to $A H$. Now, let's invert the figure with respect to the circle centered at $D$ with radius $\sqrt{D B \times D C}$, and then reflect it across $A D$. Let the image of a point or figure $X$ after this transformation be denoted by $X^{\prime}$. It can be easily seen that $(A, H),(B, C),(Z, G),(E, F),(S, M)$ are pairs of corresponding points under this transformation. $I$ and $J$ are the intersections of $A G$ with $\odot(A D B)$ and $\odot(A D C)$ respectively, so $I^{\prime}=C H \cap \odot(D H Z)$ and $J^{\prime}=BH\cap \odot(D H Z)$. Also, $L=A G \cap \odot(D E F)$, so $L^{\prime}=\odot(D H Z) \cap E F$, which means $L'$ is the foot of the perpendicular from $H$ to $E F$. Let this point be $X$. Also, if we consider $A_{1}$, the reflection of $A$ across $G$, then $$A F \times A B=A H \times A D=2 A M \times A D=2 A L \times A G=A L \times A A_{1}$$ so $\left(B F L A_{1}\right)$ and $\left(C E L A_{1}\right)$ are sets of concyclic points. Therefore $A_{1}^{\prime}$ maps to $T \equiv \odot(C E X) \cap \odot(B F X)$. Meanwhile, since $A$ is the radical center of $\odot\left(B F L A_{1}\right), \odot\left(C E L A_{1}\right), \odot(B F E C)$, points $A, X, T$ are collinear. Furthermore, by the collinearity of $A, G, A_1$, $(H, Z, D, T)$ is a set of concyclic points. Therefore, $$ \angle X T C=\angle A E F=\angle A H F=\angle E H X=\angle J^{\prime} H X=\angle J^{\prime} T X $$ so $J^{\prime}, T, C$ are collinear. For similar reasons, $\left(I^{\prime}, T, B\right)$ are also collinear. Therefore, by Pappus's theorem, $B F \cap C E=A, C J^{\prime} \cap B I^{\prime}=T, F J^{\prime} \cap E I^{\prime}=Y$ are collinear. At this point, $K$ is mapped to $Y$ by the transformation, so the four points $H, K, L, D$ are concyclic. $H, K, L, D, A_1, P$ all lie on this circle. Therefore, after the transformation (inversion then reflection), $A, T, Y, X, P^{\prime}$ are all collinear. Now, let $U$ be the foot of the perpendicular from $D$ to $E F$, and let $V$ be the midpoint of $D U$. Then from the harmonic cross-ratio $$X(D U, V \infty)=(A H, S D)=-1$$ it can be seen that $V, X, A$ must be collinear. Therefore, $A, T, X, Y, V, P^{\prime}$ are all collinear. Therefore $V^{\prime}$ must lie on the circle passing through $H, K, L, D, A^{\prime}, P$. Since $V$ is the reflection of $O$ about $A H$, $D, O, V^{\prime}$ is collinear and so is $D, O, P$. Therefore, $P \equiv V^{\prime}$. Thus, from $$ D B \times D C=D O \times D P=D Q \times D C $$ we have $D B=D Q$. This means $A B=A Q$. +IMO_PROOF_c853e91f1beeaf2169ac7d34ddd7aa840be121107c8cea463d7465ae81dfe3c0 diff --git a/tasks/pb-advanced-009/task.toml b/tasks/pb-advanced-009/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..220aaafbbf626d51393081dfba79ac05a02542a9 --- /dev/null +++ b/tasks/pb-advanced-009/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-009" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-009" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-009/tests/grade_task.py b/tasks/pb-advanced-009/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-009/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-009/tests/reference.json b/tasks/pb-advanced-009/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..e413ce4514729dedbba11b35db3ee17d4ebdcfe0 --- /dev/null +++ b/tasks/pb-advanced-009/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $H$ be the orthocenter of an acute-angled triangle $A B C$, and let $D, E, F$ be the feet of the altitudes from vertices $A, B, C$ to the opposite sides, respectively. Let $G$ be the midpoint of $B C$. Let $I, J$ be the feet of the perpendiculars from $B, C$ to $AG$, respectively. Let $K (\\neq D)$ be the second intersection of the circumcircles of triangle $D I F$ and triangle $D J E$. Let $M$ be the midpoint of segment $A H$. Let $L$ be the foot of the perpendicular from $M$ to $A G$. Let $R (\\neq G)$ be the second intersection of the circumcircle of triangle $A H G$ with $B C$. Let $S$ be the intersection of line $A H$ and $E F$. Let $N$ be the foot of the perpendicular from point $D$ to $R S$. Let $O$ be the midpoint of segment $D N$. Let line $D N$ intersect the circumcircle of triangle $D K L$ again at point $P (\\neq D)$. Let $Q (\\neq C)$ be the second intersection of the circumcircle of triangle $O C P$ and line $B C$. Prove that $A B=A Q$. ", + "solution": " First, let $Z$ be the intersection of lines $E F$ and $B C$. From the harmonic relation $(Z D, B C)=-1$, we have $$D G \\times D R=D H \\times D A=D B \\times D C=D Z \\times D G,$$ which implies $D Z=D R$. Therefore $R S$ is the reflection of $E F$ with respect to $A H$. Now, let's invert the figure with respect to the circle centered at $D$ with radius $\\sqrt{D B \\times D C}$, and then reflect it across $A D$. Let the image of a point or figure $X$ after this transformation be denoted by $X^{\\prime}$. It can be easily seen that $(A, H),(B, C),(Z, G),(E, F),(S, M)$ are pairs of corresponding points under this transformation. $I$ and $J$ are the intersections of $A G$ with $\\odot(A D B)$ and $\\odot(A D C)$ respectively, so $I^{\\prime}=C H \\cap \\odot(D H Z)$ and $J^{\\prime}=BH\\cap \\odot(D H Z)$. Also, $L=A G \\cap \\odot(D E F)$, so $L^{\\prime}=\\odot(D H Z) \\cap E F$, which means $L'$ is the foot of the perpendicular from $H$ to $E F$. Let this point be $X$. Also, if we consider $A_{1}$, the reflection of $A$ across $G$, then $$A F \\times A B=A H \\times A D=2 A M \\times A D=2 A L \\times A G=A L \\times A A_{1}$$ so $\\left(B F L A_{1}\\right)$ and $\\left(C E L A_{1}\\right)$ are sets of concyclic points. Therefore $A_{1}^{\\prime}$ maps to $T \\equiv \\odot(C E X) \\cap \\odot(B F X)$. Meanwhile, since $A$ is the radical center of $\\odot\\left(B F L A_{1}\\right), \\odot\\left(C E L A_{1}\\right), \\odot(B F E C)$, points $A, X, T$ are collinear. Furthermore, by the collinearity of $A, G, A_1$, $(H, Z, D, T)$ is a set of concyclic points. Therefore, $$ \\angle X T C=\\angle A E F=\\angle A H F=\\angle E H X=\\angle J^{\\prime} H X=\\angle J^{\\prime} T X $$ so $J^{\\prime}, T, C$ are collinear. For similar reasons, $\\left(I^{\\prime}, T, B\\right)$ are also collinear. Therefore, by Pappus's theorem, $B F \\cap C E=A, C J^{\\prime} \\cap B I^{\\prime}=T, F J^{\\prime} \\cap E I^{\\prime}=Y$ are collinear. At this point, $K$ is mapped to $Y$ by the transformation, so the four points $H, K, L, D$ are concyclic. $H, K, L, D, A_1, P$ all lie on this circle. Therefore, after the transformation (inversion then reflection), $A, T, Y, X, P^{\\prime}$ are all collinear. Now, let $U$ be the foot of the perpendicular from $D$ to $E F$, and let $V$ be the midpoint of $D U$. Then from the harmonic cross-ratio $$X(D U, V \\infty)=(A H, S D)=-1$$ it can be seen that $V, X, A$ must be collinear. Therefore, $A, T, X, Y, V, P^{\\prime}$ are all collinear. Therefore $V^{\\prime}$ must lie on the circle passing through $H, K, L, D, A^{\\prime}, P$. Since $V$ is the reflection of $O$ about $A H$, $D, O, V^{\\prime}$ is collinear and so is $D, O, P$. Therefore, $P \\equiv V^{\\prime}$. Thus, from $$ D B \\times D C=D O \\times D P=D Q \\times D C $$ we have $D B=D Q$. This means $A B=A Q$.", + "grading_guidelines": "(Partial)\n 1. Observed $R$ and $Z$ are symmetric about $AD$, and $(A, H),(B, C),(Z, G),(E, F),(S, M)$ have inverse relationships respect to $D$.\n 2. Constructs the point $T$, or a similar point on the line $AT$.\n(Almost)\n 1. Observes $O, P$ are the corresponding points of inversion w.r.t. $D$ with radius $\\sqrt{D B \\times D C}$.", + "problem_id": "PB-Advanced-009", + "level": "advanced", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": " " +} diff --git a/tasks/pb-advanced-009/tests/test.sh b/tasks/pb-advanced-009/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-009/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-010/instruction.md b/tasks/pb-advanced-010/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ce5c73f7bdc410665304528fa63309da05c5d15b --- /dev/null +++ b/tasks/pb-advanced-010/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-010 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $O$ and $G$ be the circumcenter and centroid of a non-isosceles triangle $ABC$, respectively. Let $H$ be the foot of the perpendicular from $A$ to $BC$, and let $M$ be the midpoint of $BC$. For a point $X$ on the line $OG$, let the line $BX$ intersect $AC$ at $P$, and let the line $CX$ intersect $AB$ at $Q$. Let $H_1$ be the foot of the perpendicular from $P$ to the line $AB$, and let $K$ be the reflection of $A$ about $H_1$. Let $T$ be the intersection of the circumcircle of triangle $KPQ$ and the circumcircle of triangle $PHM$. Prove that as $X$ moves along the line $OG$, $T$ moves along a fixed circle. diff --git a/tasks/pb-advanced-010/solution/solve.sh b/tasks/pb-advanced-010/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..10f81d8d4dbcd1799b0fe202b19c33aeff4fb830 --- /dev/null +++ b/tasks/pb-advanced-010/solution/solve.sh @@ -0,0 +1,33 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_5306ad984d589909a92fee6c3ebbe52486b610cc27ef83798f4d6a45a315175e' +The most difficult part of this problem is to observe that $(B, T, P, C)$ are concyclic. If this holds, let $Y$ be the intersection of $TP$ and $BC$. Then $YH \cdot YM = YT \cdot YP = YB \cdot YC$, + which means that $Y$ is the point such that $(B, H, C, Y)$ is a harmonic division. This is a fixed point. Thus, $T$ lies on the inversion of $AC$ with respect to the circle centered at $Y$ with radius $\sqrt{YB \cdot YC}$. This is a fixed circle. + + \textbf{Claim:} $(B, T, P, C)$ are concyclic. This means that the circumcircles of $\triangle BPC$, $\triangle PHM$, and $\triangle KPQ$ are coaxial. We will use the following well-known Lemma: For two circles, the locus of points where the ratio of the powers with respect to the two circles is constant is a circle coaxial with the two circles. + Now, using the Lemma, we see that it suffices to show that: The ratio of the powers of $B$ and $C$ with respect to the circumcircles of $\triangle PHM$ and $\triangle KPQ$ are the same. + + 1) The ratio of powers of $B$ and $C$ with respect to the circumcircle of $\triangle PHM$ is $\frac{BH \cdot BM}{CH \cdot CM} = \frac{BH}{CH}$. + + 2) Let's compute the ratio of powers of $B$ and $C$ with respect to the circumcircle of $\triangle KPQ$. Let $H_2$ be the foot of the perpendicular from $Q$ to $AC$, and let $L$ be the reflection of $A$ across $H_2$. Since $\angle QKP = \angle QLP = 180^\circ - \angle A$, $(K, L, P, Q)$ are concyclic. The power of $B$ is $BK \cdot BQ$, and the power of $C$ is $CL \cdot CP$. We want to show that $\frac{CL \cdot CP}{BK \cdot BQ} = \frac{CH}{BH}$. + + Let $D, E$ be the intersection of the Euler line of $\triangle ABC$ with $AB, AC$ respectively. Let $R$ be the intersection of $AX$ and $BC$. + By Ceva's theorem, $\frac{CP}{BQ} = \frac{AP}{AQ} \times \frac{CR}{BR}$. $BK = BA - KA = BA - 2AP \cos A$, $CL = CA - LA = CA - 2AQ \cos A$. + Thus $\frac{CL \cdot CP}{BK \cdot BQ} = \frac{CA - 2AQ \cos A}{BA - 2AP \cos A} \times \frac{AP}{AQ} \times \frac{CR}{BR} = \frac{\frac{CA}{AQ} - 2 \cos A}{\frac{BA}{AP} - 2 \cos A} \times \frac{CR}{BR}$. + + Let $\frac{XE}{DX} = \lambda$. + $\frac{CR}{BR} = \frac{AC \sin \angle CAR}{AB \sin \angle BAR} = \frac{AC}{AB} \cdot \frac{AD}{AE} \cdot \frac{XE}{DX} = \frac{AC \cdot AD}{AB \cdot AE} \lambda$. + By Menelaus' theorem on $\triangle ADE$ and line $CXQ$, + $\frac{AQ}{QD} \cdot \frac{CE}{AC} \cdot \frac{DX}{EX} = 1$. Thus, $\frac{AQ}{QD} = \frac{AC}{CE} \lambda$, so $AQ = \frac{1}{1 + \frac{AC}{CE} \lambda} AD = \frac{AD}{1+\lambda \frac{AC}{CE}}.$ + Similarly, $AP = \frac{1}{1 + \frac{1}{\lambda} \frac{AB}{BD}} AE$. + Thus $\frac{CL \cdot CP}{BK \cdot BQ} = \frac{\frac{CA}{AQ} - 2 \cos A}{\frac{BA}{AP} - 2 \cos A} \times \frac{CR}{BR}$ has the form $\frac{(\text{linear in } \lambda)}{(\text{linear in } \lambda)}$. That is, if it is $\frac{CH}{BH}$ for two values of $\lambda$, then it is $\frac{CH}{BH}$ for all $\lambda$. + + Case 1) $X = H$. + In this case, $P, Q$ are the feet of the altitudes from $B, C$ respectively. Thus $KL \parallel BC$. Thus $\frac{CL \cdot CP}{BK \cdot BQ} = \frac{CH \cdot CB}{BH \cdot BC} = \frac{CH}{BH}$. + + Case 2) $X = G$. + In this case, $P, Q$ are the midpoints of $AC, AB$, and $K, L$ are the feet of altitudes from $C, B$ respectively. Thus $\frac{CL \cdot CP}{BK \cdot BQ} = \frac{CH \cdot \frac{CB}{2}}{BH \cdot \frac{BC}{2}} = \frac{CH}{BH}$. + Since $H \neq G$ due to scalene condition, we have two different values of $\lambda$, completing the proof. +IMO_PROOF_5306ad984d589909a92fee6c3ebbe52486b610cc27ef83798f4d6a45a315175e diff --git a/tasks/pb-advanced-010/task.toml b/tasks/pb-advanced-010/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..241d16d0c7e3e0203f45dd415b00bb3ebbb43675 --- /dev/null +++ b/tasks/pb-advanced-010/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-010" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-010" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-010/tests/grade_task.py b/tasks/pb-advanced-010/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-010/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-010/tests/reference.json b/tasks/pb-advanced-010/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..064e51995f7f9288fedfa287486ffa3942586709 --- /dev/null +++ b/tasks/pb-advanced-010/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $O$ and $G$ be the circumcenter and centroid of a non-isosceles triangle $ABC$, respectively. Let $H$ be the foot of the perpendicular from $A$ to $BC$, and let $M$ be the midpoint of $BC$. For a point $X$ on the line $OG$, let the line $BX$ intersect $AC$ at $P$, and let the line $CX$ intersect $AB$ at $Q$. Let $H_1$ be the foot of the perpendicular from $P$ to the line $AB$, and let $K$ be the reflection of $A$ about $H_1$. Let $T$ be the intersection of the circumcircle of triangle $KPQ$ and the circumcircle of triangle $PHM$. Prove that as $X$ moves along the line $OG$, $T$ moves along a fixed circle.", + "solution": "The most difficult part of this problem is to observe that $(B, T, P, C)$ are concyclic. If this holds, let $Y$ be the intersection of $TP$ and $BC$. Then $YH \\cdot YM = YT \\cdot YP = YB \\cdot YC$,\n which means that $Y$ is the point such that $(B, H, C, Y)$ is a harmonic division. This is a fixed point. Thus, $T$ lies on the inversion of $AC$ with respect to the circle centered at $Y$ with radius $\\sqrt{YB \\cdot YC}$. This is a fixed circle.\n\n \\textbf{Claim:} $(B, T, P, C)$ are concyclic. This means that the circumcircles of $\\triangle BPC$, $\\triangle PHM$, and $\\triangle KPQ$ are coaxial. We will use the following well-known Lemma: For two circles, the locus of points where the ratio of the powers with respect to the two circles is constant is a circle coaxial with the two circles.\n Now, using the Lemma, we see that it suffices to show that: The ratio of the powers of $B$ and $C$ with respect to the circumcircles of $\\triangle PHM$ and $\\triangle KPQ$ are the same.\n\n 1) The ratio of powers of $B$ and $C$ with respect to the circumcircle of $\\triangle PHM$ is $\\frac{BH \\cdot BM}{CH \\cdot CM} = \\frac{BH}{CH}$.\n\n 2) Let's compute the ratio of powers of $B$ and $C$ with respect to the circumcircle of $\\triangle KPQ$. Let $H_2$ be the foot of the perpendicular from $Q$ to $AC$, and let $L$ be the reflection of $A$ across $H_2$. Since $\\angle QKP = \\angle QLP = 180^\\circ - \\angle A$, $(K, L, P, Q)$ are concyclic. The power of $B$ is $BK \\cdot BQ$, and the power of $C$ is $CL \\cdot CP$. We want to show that $\\frac{CL \\cdot CP}{BK \\cdot BQ} = \\frac{CH}{BH}$.\n\n Let $D, E$ be the intersection of the Euler line of $\\triangle ABC$ with $AB, AC$ respectively. Let $R$ be the intersection of $AX$ and $BC$.\n By Ceva's theorem, $\\frac{CP}{BQ} = \\frac{AP}{AQ} \\times \\frac{CR}{BR}$. $BK = BA - KA = BA - 2AP \\cos A$, $CL = CA - LA = CA - 2AQ \\cos A$.\n Thus $\\frac{CL \\cdot CP}{BK \\cdot BQ} = \\frac{CA - 2AQ \\cos A}{BA - 2AP \\cos A} \\times \\frac{AP}{AQ} \\times \\frac{CR}{BR} = \\frac{\\frac{CA}{AQ} - 2 \\cos A}{\\frac{BA}{AP} - 2 \\cos A} \\times \\frac{CR}{BR}$.\n\n Let $\\frac{XE}{DX} = \\lambda$.\n $\\frac{CR}{BR} = \\frac{AC \\sin \\angle CAR}{AB \\sin \\angle BAR} = \\frac{AC}{AB} \\cdot \\frac{AD}{AE} \\cdot \\frac{XE}{DX} = \\frac{AC \\cdot AD}{AB \\cdot AE} \\lambda$.\n By Menelaus' theorem on $\\triangle ADE$ and line $CXQ$,\n $\\frac{AQ}{QD} \\cdot \\frac{CE}{AC} \\cdot \\frac{DX}{EX} = 1$. Thus, $\\frac{AQ}{QD} = \\frac{AC}{CE} \\lambda$, so $AQ = \\frac{1}{1 + \\frac{AC}{CE} \\lambda} AD = \\frac{AD}{1+\\lambda \\frac{AC}{CE}}.$\n Similarly, $AP = \\frac{1}{1 + \\frac{1}{\\lambda} \\frac{AB}{BD}} AE$.\n Thus $\\frac{CL \\cdot CP}{BK \\cdot BQ} = \\frac{\\frac{CA}{AQ} - 2 \\cos A}{\\frac{BA}{AP} - 2 \\cos A} \\times \\frac{CR}{BR}$ has the form $\\frac{(\\text{linear in } \\lambda)}{(\\text{linear in } \\lambda)}$. That is, if it is $\\frac{CH}{BH}$ for two values of $\\lambda$, then it is $\\frac{CH}{BH}$ for all $\\lambda$.\n\n Case 1) $X = H$.\n In this case, $P, Q$ are the feet of the altitudes from $B, C$ respectively. Thus $KL \\parallel BC$. Thus $\\frac{CL \\cdot CP}{BK \\cdot BQ} = \\frac{CH \\cdot CB}{BH \\cdot BC} = \\frac{CH}{BH}$.\n\n Case 2) $X = G$.\n In this case, $P, Q$ are the midpoints of $AC, AB$, and $K, L$ are the feet of altitudes from $C, B$ respectively. Thus $\\frac{CL \\cdot CP}{BK \\cdot BQ} = \\frac{CH \\cdot \\frac{CB}{2}}{BH \\cdot \\frac{BC}{2}} = \\frac{CH}{BH}$.\n Since $H \\neq G$ due to scalene condition, we have two different values of $\\lambda$, completing the proof.", + "grading_guidelines": "(Partial)\n 1. Proved that $B, T, P, C$ lie on a circle.\n 2. Observed that it suffices to show that the ratio of powers of $B$ and $C$ respect to the circumcircles of $\\triangle PHM$ and $\\triangle KPQ$ are the same.\n(Almost)\n 1. In addition to items 1 and 2 of (Partial), observed that it is enough to prove $2$ of (Partial) only for two different $X$.\n 2. Verification contains minor mistakes only.", + "problem_id": "PB-Advanced-010", + "level": "advanced", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": " " +} diff --git a/tasks/pb-advanced-010/tests/test.sh b/tasks/pb-advanced-010/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-010/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-011/instruction.md b/tasks/pb-advanced-011/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3d374372d1b74b72108ce67267f749f0b7d87dc4 --- /dev/null +++ b/tasks/pb-advanced-011/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-011 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Find all functions $f: \mathbb{R}^+ \to \mathbb{R}^+$ such that $$yf(yf(x)+1) = f(\frac{1}{x} + f(y))$$ for all $x, y \in \mathbb{R}^+$ diff --git a/tasks/pb-advanced-011/solution/solve.sh b/tasks/pb-advanced-011/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..91ff532bf900d2d4ee89f0850e30bca88a0cb363 --- /dev/null +++ b/tasks/pb-advanced-011/solution/solve.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_ef1ad86124bba1c591a87cdb9dd09bb879227a5fa9976c471bb7bcc2e1391f7a' + +Let $P(x,y)$ be the given assertion. +$$P(c+1, \frac{c}{f(c+1)}): \quad c= \frac{c}{f(c+1)} f(\frac{c}{f(c+1)} \times f(c+1)+1)= f(\frac{1}{c+1} + f(\frac{c}{f(c+1)}))$$, hence $f$ is surjective. \\ Now assume that $f(x) = f(b)$ for some $a>b>0$. Since $f$ is surjective, there exists some $t\in \mathbb{R}^+$ such that $f(t)=1$. comparing $P(a,t)$ and $f(b,t)$ gives $f(1+\frac{1}{a}) = f(1+\frac{1}{b})$. Again since $f$ is surjective, there exists some $t\in \mathbb{R}^+$ such that $f(t)=\frac{1}{ab}$. Comparing $P(s,a)$ and $P(s,b)$ gives $af(\frac{1}{b} +1) = b f(\frac{1}{a}+1)$, which is a contradiction. Therefore $f$ is injective. \\ +Now $P(x,1)$ implies $f(x) = \frac{1}{x}+c$, and by surjectivity, $c=0$, thus $f(x) = \frac{1}{x}$, which is indeed a solution. + +IMO_PROOF_ef1ad86124bba1c591a87cdb9dd09bb879227a5fa9976c471bb7bcc2e1391f7a diff --git a/tasks/pb-advanced-011/task.toml b/tasks/pb-advanced-011/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a7aac26a6ffba235b1d490dcf3209805e454a107 --- /dev/null +++ b/tasks/pb-advanced-011/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-011" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-011" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-011/tests/grade_task.py b/tasks/pb-advanced-011/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-011/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-011/tests/reference.json b/tasks/pb-advanced-011/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..9a6bd925184a03ce2e9e1d4a7fffb7a3d05df585 --- /dev/null +++ b/tasks/pb-advanced-011/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Find all functions $f: \\mathbb{R}^+ \\to \\mathbb{R}^+$ such that $$yf(yf(x)+1) = f(\\frac{1}{x} + f(y))$$ for all $x, y \\in \\mathbb{R}^+$", + "solution": "\nLet $P(x,y)$ be the given assertion.\n$$P(c+1, \\frac{c}{f(c+1)}): \\quad c= \\frac{c}{f(c+1)} f(\\frac{c}{f(c+1)} \\times f(c+1)+1)= f(\\frac{1}{c+1} + f(\\frac{c}{f(c+1)}))$$, hence $f$ is surjective. \\\\ Now assume that $f(x) = f(b)$ for some $a>b>0$. Since $f$ is surjective, there exists some $t\\in \\mathbb{R}^+$ such that $f(t)=1$. comparing $P(a,t)$ and $f(b,t)$ gives $f(1+\\frac{1}{a}) = f(1+\\frac{1}{b})$. Again since $f$ is surjective, there exists some $t\\in \\mathbb{R}^+$ such that $f(t)=\\frac{1}{ab}$. Comparing $P(s,a)$ and $P(s,b)$ gives $af(\\frac{1}{b} +1) = b f(\\frac{1}{a}+1)$, which is a contradiction. Therefore $f$ is injective. \\\\\nNow $P(x,1)$ implies $f(x) = \\frac{1}{x}+c$, and by surjectivity, $c=0$, thus $f(x) = \\frac{1}{x}$, which is indeed a solution.\n", + "grading_guidelines": "(Partial)\n 1. Considered $(x,y) = (c+1, \\frac{c}{f(c+1)})$.\n 2. Proved that $f$ is subjective.\n(Almost)\n 1. Proved that $f$ is injective.", + "problem_id": "PB-Advanced-011", + "level": "advanced", + "category": "Algebra", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "$f(x) = \\frac{1}{x}$" +} diff --git a/tasks/pb-advanced-011/tests/test.sh b/tasks/pb-advanced-011/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-011/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-012/instruction.md b/tasks/pb-advanced-012/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c6ca7dfcee1e9ef5b8d0be63dcf18c54e8e46870 --- /dev/null +++ b/tasks/pb-advanced-012/instruction.md @@ -0,0 +1,13 @@ +# PB-Advanced-012 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $p$ be a prime number and $a, b$ be positive integers such that + + \[ + p^{n}=a^{4}+b^{4} + \] + + for some integer $n \geq 2$. Prove that $n \geq 5$. diff --git a/tasks/pb-advanced-012/solution/solve.sh b/tasks/pb-advanced-012/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..105876c4c8421119bcac0d8d027151dd589a08ad --- /dev/null +++ b/tasks/pb-advanced-012/solution/solve.sh @@ -0,0 +1,189 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_88d5433497cac2a260d1247735d7f1270ff06e8a3e4bf6aef4905ddc1eaf84f7' +First, let's summarize the facts that are frequently used in Diophantine equations. We will omit the proofs of well-known facts. The following lemma characterizes Pythagorean triples and is used repeatedly. + + If $a, b, c$ are positive integers with $ab \neq 0$ satisfying $a^{2}+b^{2}=c^{2}$, then there exist positive integers $m \neq n$ and $k$ such that + + \[ + (a, b, c)=k\left(2 m n, m^{2}-n^{2}, m^{2}+n^{2}\right) \text { or } k\left(m^{2}-n^{2}, 2 m n, m^{2}+n^{2}\right). + \] + + In particular, if $a, b$ are relatively prime, then $k=1$ and $m$ and $n$ have different parity, and one of $a, b$ is odd and the other is even. The odd one is expressed as $m^{2}-n^{2}$ and the even one is expressed as $2mn$. Also, in this case, $c$ is always odd. + Omitted. \qed + If $p$ is a prime number or 1, and positive integers $x$ and relatively prime positive integers $a, b$ satisfy + + \[ + p a b=x^{2}, + \] + + then there exist positive integers $u, v$ such that $(a, b, x)=\left(p u^{2}, v^{2}, p u v\right)$ or $\left(u^{2}, p v^{2}, p u v\right)$. + Omitted. \qed + + If $a^{2}+b^{2}$ is a multiple of 4 for integers $a, b$, then both $a$ and $b$ are even. + + $a$ and $b$ must have the same parity, but the square of an odd number has a remainder of 1 when divided by 4, so if $a, b$ have the same parity as odd numbers, then $a^{2}+b^{2}$ has a remainder of 2 when divided by 4, so it cannot be a multiple of 4. \qed + + Now, let's proceed with the proof of the main problem using these facts. + There are no positive integers $x, y, z$ satisfying $x^{4}+y^{4}=z^{2}$. Therefore, $n$ is odd. + + Using proof by contradiction, assume that there exists a positive integer solution $x, y, z$. Among these solutions, choose the solution $(x, y, z)$ with the smallest $z$. If there is a prime number $q$ that divides two of $x, y, z$, then it must also divide the remaining number, and in this case, $\left(\frac{x}{q}, \frac{y}{q}, \frac{z}{q^{2}}\right)$ becomes a solution, contradicting the minimality of $z$. Therefore, this solution is pairwise relatively prime. + + Since $\left(x^{2}, y^{2}, z\right)$ is a Pythagorean triple, by , there exist relatively prime positive integers $u, v$ with different parity such that + + + \begin{equation*} + x^{2}=u^{2}-v^{2}, y^{2}=2 u v, z=u^{2}+v^{2} \tag{1.1} + \end{equation*} + + + We can assume that $u > v$ without loss of generality. Since $y^{2}=2 u v$ and $u, v$ are relatively prime, by , there exist positive integers $s, t$ such that $u=2 s^{2}, v=t^{2}$ or $u=s^{2}, v=2 t^{2}$. + + (Case 1) $u=2 s^{2}, v=t^{2}$ + + $x^{2}+t^{4}=4 s^{4}$. By , both $x$ and $t$ must be even, but from $x^{2}=u^{2}-v^{2}$, $x$ is odd, which is a contradiction. + + (Case 2) $u=s^{2}, v=2 t^{2}$ + + $x^{2}+4 t^{4}=s^{4}$ and since $t|v, v| y^{2}$, + + \[ + \operatorname{gcd}(x, t)|\operatorname{gcd}(x, v)| \operatorname{gcd}\left(x, y^{2}\right)=1. + \] + + Therefore, $x$ and $t^{2}$ are also relatively prime, and by , there exist relatively prime positive integers $q, r$ with different parity (since $x$ is odd by (1.1)) such that + + \[ + x=q^{2}-r^{2}, 2 t^{2}=2 q r, s^{2}=q^{2}+r^{2}. + \] + + Since $t^{2}=q r$, by , there exist positive integers $x', y'$ such that $q=x^{\prime 2}, r=y^{\prime 2}$, and thus by the above equation, $x^{\prime 4}+y^{\prime 4}=s^{2}$. Since + + \[ + s=\sqrt{u} \leq u If $p^{3}=a^{4}+b^{4}$, then there exist positive integers $x, y, z$ such that $x^{2}+3 y^{4}=z^{4}$. + + If $p \mid a$, then clearly $p \mid b$ must also hold, and vice versa. Therefore, $a, b$ are either both multiples of $p$ or not. However, if the former is the case, the right-hand side becomes a multiple of $p^{4}$, which is a contradiction, so $p$ is relatively prime to both $a$ and $b$. + + Therefore, $p$ is a divisor of the sum of squares, and since $(p, a)=(p, b)=1$, $p$ is a prime number of the form $4 k+1$, so it can be expressed in the form $p=c^{2}+d^{2}$. By Jacobi's theorem, there are only two ways (considering order) to express $p^{3}$ as the sum of perfect squares: + + \[ + (p c)^{2}+(p d)^{2} \text { and } \left(c\left(c^{2}-3 d^{2}\right)\right)^{2}+\left(d\left(3 c^{2}-d^{2}\right)\right)^{2}. + \] + + By (1), the first case cannot be expressed as $a^{4}+b^{4}$, so + + \[ + a^{2}=\left|c\left(c^{2}-3 d^{2}\right)\right|, \quad b^{2}=\left|d\left(3 c^{2}-d^{2}\right)\right| + \] + + (or vice versa, but we can ignore this case due to symmetry) must hold. Letting $C=|c|, D=|d|$, we have + + + \begin{equation*} + a^{2} b^{2}=C D \times\left|C^{2}-3 D^{2}\right| \times\left|3 C^{2}-D^{2}\right| \tag{1.2} + \end{equation*} + + + and $\operatorname{gcd}(C, D)=1$. Now, we divide into cases depending on whether $C D$ is a multiple of 3. + + (Case 1) If $3 \mid C D$ + + Without loss of generality, assume $3 \mid C$. Then, from + + \[ + \left(\frac{a b}{3}\right)^{2}=\frac{C}{3} \cdot D \cdot\left|3\left(\frac{C}{3}\right)^{2}-D^{2}\right| \cdot\left|3 C^{2}-D^{2}\right|, + \] + + since the four terms are pairwise relatively prime, there exist positive integers $e, f, g, h$ such that + + \[ + C=3 e^{2}, \quad D=f^{2},\left|3 e^{4}-f^{4}\right|=g^{2},\left|27 e^{4}-f^{4}\right|=h^{2}. + \] + + Then, by $\bmod 3$, we have $g^{2}+3 e^{4}=f^{4}$. + + (Case 2) If $3 \nmid CD$ + + From (1.2), since the four terms are pairwise relatively prime, there exist positive integers $e, f, g, h$ such that + + \[ + C=e^{2}, \quad D=f^{2},\left|e^{4}-3 f^{4}\right|=g^{2},\left|3 e^{4}-f^{4}\right|=h^{2}. + \] + + Similarly, by $\bmod 3$, we have $e^{4}-3 f^{4}=g^{2}$. + + Therefore, in both cases, there exists a positive integer solution to $x^{2}+3 y^{4}=z^{4}$. + + There are no positive integers $x, y, z$ satisfying $x^{2}+3 y^{4}=z^{4}$. + + Using proof by contradiction, assume that there exists a positive integer solution $x, y, z$. Among these solutions, choose the solution $(x, y, z)$ with the smallest $z$. If there is a prime number $q$ that divides two of $x, y, z$, then it must also divide the remaining number, and in this case, $\left(\frac{x}{q^{2}}, \frac{y}{q}, \frac{z}{q}\right)$ becomes a solution, contradicting the minimality of $z$. Therefore, this solution is pairwise relatively prime. + + Now, rewriting the equation as + + + \begin{equation*} + 3 y^{4}=\left(z^{2}-x\right)\left(z^{2}+x\right) \tag{1.3} + \end{equation*} + + + we can divide into two cases since $\operatorname{gcd}\left(z^{2}-x, z^{2}+x\right)=1$ or 2. + + (Case 1) If $x$ and $z$ have the same parity + + By , there exist relatively prime positive integers $u, v$ such that + + \[ + z^{2}-x=2 u^{2}, z^{2}+x=6 v^{2}, y^{2}=2 u v \quad \text { or } \quad z^{2}+x=2 u^{2}, z^{2}-x=6 v^{2}, y^{2}=2 u v. + \] + + In both cases, we have + + + \begin{equation*} + z^{2}=u^{2}+3 v^{2}, y^{2}=2 u v. \tag{1.4} + \end{equation*} + + + Since $y$ is even, one of $u, v$ must be even. + + If $u$ is even, then $v$ is odd, and then $z^{2}=u^{2}+3 v^{2} \equiv 3(\bmod 4)$, which is a contradiction. + + If $v$ is even, then by , there exist positive integers $s, t$ such that + + \[ + u=s^{2}, v=2 t^{2}, + \] + + and substituting this back into (1.4) gives $s^{4}+12 t^{4}=z^{2}$. Since both $s$ and $z$ are odd, this equation can be written as + + \[ + \frac{z+s^{2}}{2} \cdot \frac{z-s^{2}}{2}=3 t^{4}, + \] + + and since $\operatorname{gcd}\left(\frac{z+s^{2}}{2}, \frac{z-s^{2}}{2}\right)=1$, by , there exist relatively prime positive integers $q, r$ such that + + \[ + \frac{z+s^{2}}{2}=q^{4}, \frac{z-s^{2}}{2}=3 r^{4} \quad \text { or } \quad \frac{z+s^{2}}{2}=3 r^{4}, \frac{z-s^{2}}{2}=q^{4}. + \] + + In the second case, we have $s^{2}=3 r^{4}-q^{4}$, but since $q$ and $s$ cannot both be multiples of 3 (in this case, $r$ would also be a multiple of 3, leading to a contradiction), $s^{2}+q^{4}$ cannot be a multiple of 3, which is a contradiction. In the remaining case, we have $s^{2}=q^{4}-3 r^{4}$, but since $q \leq q^{4} = \frac{z+s^2}{2} < z$, this contradicts the minimality of $z$. + + (Case 2) If $x$ and $z$ have different parity + + In this case, by (1.3) and , there exist relatively prime positive integers $u, v$ such that + + \[ + z^{2}+x=u^{4}, z^{2}-x=3 v^{4}, y^{2}=u v \quad \text { or } \quad z^{2}-x=3 v^{4}, z^{2}+x=u^{4}, y^{2}=u v. + \] + + In both cases, we have $2 z^{2}=u^{4}+3 v^{4}$, but since $z$ and $u$ cannot both be multiples of 3, this leads to a contradiction modulo 3. + + Therefore, by , $n \neq 2,4$, and by , $n \neq 3$, so the proof is complete. +IMO_PROOF_88d5433497cac2a260d1247735d7f1270ff06e8a3e4bf6aef4905ddc1eaf84f7 diff --git a/tasks/pb-advanced-012/task.toml b/tasks/pb-advanced-012/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2692b13c6ccf8a76b78d3d432ca9aa3bfdafb180 --- /dev/null +++ b/tasks/pb-advanced-012/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-012" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-012" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-012/tests/grade_task.py b/tasks/pb-advanced-012/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-012/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-012/tests/reference.json b/tasks/pb-advanced-012/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..9c167430e3905d4a2659caae11c2418270ca95a9 --- /dev/null +++ b/tasks/pb-advanced-012/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $p$ be a prime number and $a, b$ be positive integers such that\n\n \\[\n p^{n}=a^{4}+b^{4}\n \\]\n\n for some integer $n \\geq 2$. Prove that $n \\geq 5$.", + "solution": "First, let's summarize the facts that are frequently used in Diophantine equations. We will omit the proofs of well-known facts. The following lemma characterizes Pythagorean triples and is used repeatedly.\n\n If $a, b, c$ are positive integers with $ab \\neq 0$ satisfying $a^{2}+b^{2}=c^{2}$, then there exist positive integers $m \\neq n$ and $k$ such that\n\n \\[\n (a, b, c)=k\\left(2 m n, m^{2}-n^{2}, m^{2}+n^{2}\\right) \\text { or } k\\left(m^{2}-n^{2}, 2 m n, m^{2}+n^{2}\\right).\n \\]\n\n In particular, if $a, b$ are relatively prime, then $k=1$ and $m$ and $n$ have different parity, and one of $a, b$ is odd and the other is even. The odd one is expressed as $m^{2}-n^{2}$ and the even one is expressed as $2mn$. Also, in this case, $c$ is always odd.\n Omitted. \\qed\n If $p$ is a prime number or 1, and positive integers $x$ and relatively prime positive integers $a, b$ satisfy\n\n \\[\n p a b=x^{2},\n \\]\n\n then there exist positive integers $u, v$ such that $(a, b, x)=\\left(p u^{2}, v^{2}, p u v\\right)$ or $\\left(u^{2}, p v^{2}, p u v\\right)$.\n Omitted. \\qed\n\n If $a^{2}+b^{2}$ is a multiple of 4 for integers $a, b$, then both $a$ and $b$ are even.\n\n $a$ and $b$ must have the same parity, but the square of an odd number has a remainder of 1 when divided by 4, so if $a, b$ have the same parity as odd numbers, then $a^{2}+b^{2}$ has a remainder of 2 when divided by 4, so it cannot be a multiple of 4. \\qed\n\n Now, let's proceed with the proof of the main problem using these facts.\n There are no positive integers $x, y, z$ satisfying $x^{4}+y^{4}=z^{2}$. Therefore, $n$ is odd.\n\n Using proof by contradiction, assume that there exists a positive integer solution $x, y, z$. Among these solutions, choose the solution $(x, y, z)$ with the smallest $z$. If there is a prime number $q$ that divides two of $x, y, z$, then it must also divide the remaining number, and in this case, $\\left(\\frac{x}{q}, \\frac{y}{q}, \\frac{z}{q^{2}}\\right)$ becomes a solution, contradicting the minimality of $z$. Therefore, this solution is pairwise relatively prime.\n\n Since $\\left(x^{2}, y^{2}, z\\right)$ is a Pythagorean triple, by , there exist relatively prime positive integers $u, v$ with different parity such that\n\n\n \\begin{equation*}\n x^{2}=u^{2}-v^{2}, y^{2}=2 u v, z=u^{2}+v^{2} \\tag{1.1}\n \\end{equation*}\n\n\n We can assume that $u > v$ without loss of generality. Since $y^{2}=2 u v$ and $u, v$ are relatively prime, by , there exist positive integers $s, t$ such that $u=2 s^{2}, v=t^{2}$ or $u=s^{2}, v=2 t^{2}$.\n\n (Case 1) $u=2 s^{2}, v=t^{2}$\n\n $x^{2}+t^{4}=4 s^{4}$. By , both $x$ and $t$ must be even, but from $x^{2}=u^{2}-v^{2}$, $x$ is odd, which is a contradiction.\n\n (Case 2) $u=s^{2}, v=2 t^{2}$\n\n $x^{2}+4 t^{4}=s^{4}$ and since $t|v, v| y^{2}$,\n\n \\[\n \\operatorname{gcd}(x, t)|\\operatorname{gcd}(x, v)| \\operatorname{gcd}\\left(x, y^{2}\\right)=1.\n \\]\n\n Therefore, $x$ and $t^{2}$ are also relatively prime, and by , there exist relatively prime positive integers $q, r$ with different parity (since $x$ is odd by (1.1)) such that\n\n \\[\n x=q^{2}-r^{2}, 2 t^{2}=2 q r, s^{2}=q^{2}+r^{2}.\n \\]\n\n Since $t^{2}=q r$, by , there exist positive integers $x', y'$ such that $q=x^{\\prime 2}, r=y^{\\prime 2}$, and thus by the above equation, $x^{\\prime 4}+y^{\\prime 4}=s^{2}$. Since\n\n \\[\n s=\\sqrt{u} \\leq u If $p^{3}=a^{4}+b^{4}$, then there exist positive integers $x, y, z$ such that $x^{2}+3 y^{4}=z^{4}$.\n\n If $p \\mid a$, then clearly $p \\mid b$ must also hold, and vice versa. Therefore, $a, b$ are either both multiples of $p$ or not. However, if the former is the case, the right-hand side becomes a multiple of $p^{4}$, which is a contradiction, so $p$ is relatively prime to both $a$ and $b$.\n\n Therefore, $p$ is a divisor of the sum of squares, and since $(p, a)=(p, b)=1$, $p$ is a prime number of the form $4 k+1$, so it can be expressed in the form $p=c^{2}+d^{2}$. By Jacobi's theorem, there are only two ways (considering order) to express $p^{3}$ as the sum of perfect squares:\n\n \\[\n (p c)^{2}+(p d)^{2} \\text { and } \\left(c\\left(c^{2}-3 d^{2}\\right)\\right)^{2}+\\left(d\\left(3 c^{2}-d^{2}\\right)\\right)^{2}.\n \\]\n\n By (1), the first case cannot be expressed as $a^{4}+b^{4}$, so\n\n \\[\n a^{2}=\\left|c\\left(c^{2}-3 d^{2}\\right)\\right|, \\quad b^{2}=\\left|d\\left(3 c^{2}-d^{2}\\right)\\right|\n \\]\n\n (or vice versa, but we can ignore this case due to symmetry) must hold. Letting $C=|c|, D=|d|$, we have\n\n\n \\begin{equation*}\n a^{2} b^{2}=C D \\times\\left|C^{2}-3 D^{2}\\right| \\times\\left|3 C^{2}-D^{2}\\right| \\tag{1.2}\n \\end{equation*}\n\n\n and $\\operatorname{gcd}(C, D)=1$. Now, we divide into cases depending on whether $C D$ is a multiple of 3.\n\n (Case 1) If $3 \\mid C D$\n\n Without loss of generality, assume $3 \\mid C$. Then, from\n\n \\[\n \\left(\\frac{a b}{3}\\right)^{2}=\\frac{C}{3} \\cdot D \\cdot\\left|3\\left(\\frac{C}{3}\\right)^{2}-D^{2}\\right| \\cdot\\left|3 C^{2}-D^{2}\\right|,\n \\]\n\n since the four terms are pairwise relatively prime, there exist positive integers $e, f, g, h$ such that\n\n \\[\n C=3 e^{2}, \\quad D=f^{2},\\left|3 e^{4}-f^{4}\\right|=g^{2},\\left|27 e^{4}-f^{4}\\right|=h^{2}.\n \\]\n\n Then, by $\\bmod 3$, we have $g^{2}+3 e^{4}=f^{4}$.\n\n (Case 2) If $3 \\nmid CD$\n\n From (1.2), since the four terms are pairwise relatively prime, there exist positive integers $e, f, g, h$ such that\n\n \\[\n C=e^{2}, \\quad D=f^{2},\\left|e^{4}-3 f^{4}\\right|=g^{2},\\left|3 e^{4}-f^{4}\\right|=h^{2}.\n \\]\n\n Similarly, by $\\bmod 3$, we have $e^{4}-3 f^{4}=g^{2}$.\n\n Therefore, in both cases, there exists a positive integer solution to $x^{2}+3 y^{4}=z^{4}$.\n\n There are no positive integers $x, y, z$ satisfying $x^{2}+3 y^{4}=z^{4}$.\n\n Using proof by contradiction, assume that there exists a positive integer solution $x, y, z$. Among these solutions, choose the solution $(x, y, z)$ with the smallest $z$. If there is a prime number $q$ that divides two of $x, y, z$, then it must also divide the remaining number, and in this case, $\\left(\\frac{x}{q^{2}}, \\frac{y}{q}, \\frac{z}{q}\\right)$ becomes a solution, contradicting the minimality of $z$. Therefore, this solution is pairwise relatively prime.\n\n Now, rewriting the equation as\n\n\n \\begin{equation*}\n 3 y^{4}=\\left(z^{2}-x\\right)\\left(z^{2}+x\\right) \\tag{1.3}\n \\end{equation*}\n\n\n we can divide into two cases since $\\operatorname{gcd}\\left(z^{2}-x, z^{2}+x\\right)=1$ or 2.\n\n (Case 1) If $x$ and $z$ have the same parity\n\n By , there exist relatively prime positive integers $u, v$ such that\n\n \\[\n z^{2}-x=2 u^{2}, z^{2}+x=6 v^{2}, y^{2}=2 u v \\quad \\text { or } \\quad z^{2}+x=2 u^{2}, z^{2}-x=6 v^{2}, y^{2}=2 u v.\n \\]\n\n In both cases, we have\n\n\n \\begin{equation*}\n z^{2}=u^{2}+3 v^{2}, y^{2}=2 u v. \\tag{1.4}\n \\end{equation*}\n\n\n Since $y$ is even, one of $u, v$ must be even.\n\n If $u$ is even, then $v$ is odd, and then $z^{2}=u^{2}+3 v^{2} \\equiv 3(\\bmod 4)$, which is a contradiction.\n\n If $v$ is even, then by , there exist positive integers $s, t$ such that\n\n \\[\n u=s^{2}, v=2 t^{2},\n \\]\n\n and substituting this back into (1.4) gives $s^{4}+12 t^{4}=z^{2}$. Since both $s$ and $z$ are odd, this equation can be written as\n\n \\[\n \\frac{z+s^{2}}{2} \\cdot \\frac{z-s^{2}}{2}=3 t^{4},\n \\]\n\n and since $\\operatorname{gcd}\\left(\\frac{z+s^{2}}{2}, \\frac{z-s^{2}}{2}\\right)=1$, by , there exist relatively prime positive integers $q, r$ such that\n\n \\[\n \\frac{z+s^{2}}{2}=q^{4}, \\frac{z-s^{2}}{2}=3 r^{4} \\quad \\text { or } \\quad \\frac{z+s^{2}}{2}=3 r^{4}, \\frac{z-s^{2}}{2}=q^{4}.\n \\]\n\n In the second case, we have $s^{2}=3 r^{4}-q^{4}$, but since $q$ and $s$ cannot both be multiples of 3 (in this case, $r$ would also be a multiple of 3, leading to a contradiction), $s^{2}+q^{4}$ cannot be a multiple of 3, which is a contradiction. In the remaining case, we have $s^{2}=q^{4}-3 r^{4}$, but since $q \\leq q^{4} = \\frac{z+s^2}{2} < z$, this contradicts the minimality of $z$.\n\n (Case 2) If $x$ and $z$ have different parity\n\n In this case, by (1.3) and , there exist relatively prime positive integers $u, v$ such that\n\n \\[\n z^{2}+x=u^{4}, z^{2}-x=3 v^{4}, y^{2}=u v \\quad \\text { or } \\quad z^{2}-x=3 v^{4}, z^{2}+x=u^{4}, y^{2}=u v.\n \\]\n\n In both cases, we have $2 z^{2}=u^{4}+3 v^{4}$, but since $z$ and $u$ cannot both be multiples of 3, this leads to a contradiction modulo 3.\n\n Therefore, by , $n \\neq 2,4$, and by , $n \\neq 3$, so the proof is complete.", + "grading_guidelines": "(Partial)\n 1. Observed and verified that $x^2=y^4+z^4$ has no nontrivial solution\n 2. Transformed the equation $p^3=a^4+b^4$ into $p=c^2+d^2, a^2=c(c^2-3d^2), b^2=d(3c^2-d^2)$\n(Almost)\n 1. Transformed the given equation to $x^2+3y^4=z^4$ or its equivalent form, but failed to prove that it has no nontrivial solution", + "problem_id": "PB-Advanced-012", + "level": "advanced", + "category": "Number theory", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": " " +} diff --git a/tasks/pb-advanced-012/tests/test.sh b/tasks/pb-advanced-012/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-012/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-013/instruction.md b/tasks/pb-advanced-013/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3c01908f3e9d21ab0049ed062951dbbbe1471873 --- /dev/null +++ b/tasks/pb-advanced-013/instruction.md @@ -0,0 +1,11 @@ +# PB-Advanced-013 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +For an integer $n \geq 2$, let $a_{1} \leq a_{2} \leq \cdots \leq a_{n}$ be positive real numbers satisfying $a_{1} a_{2} \cdots a_{n}=1$. For each $k=1,2, \cdots, n$, define $b_{k}=2^{k}\left(1+a_{k}^{2^{k}}\right)$. Prove that the following inequality holds: + + \[ + \frac{1}{2}-\frac{1}{2^{n+1}} \leq \frac{1}{b_{1}}+\frac{1}{b_{2}}+\cdots+\frac{1}{b_{n}} + \] diff --git a/tasks/pb-advanced-013/solution/solve.sh b/tasks/pb-advanced-013/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0e139ecf080d21eb8535a030c092241482de2cca --- /dev/null +++ b/tasks/pb-advanced-013/solution/solve.sh @@ -0,0 +1,54 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_42ed6b932497c627ac89ca68f45593393ff6cdf48edc9b388c9ff52163e24c38' +The following Lemma is often used in problems involving multiple variables or sequences. + + For positive real numbers $x, y$ satisfying $xy \geq 1$, the following inequality holds: + + \[ + \frac{1}{1+x}+\frac{1}{1+y} \geq \frac{2}{1+\sqrt{x y}} + \] + + The proof is a simple calculation. Multiplying both sides by $(1+\sqrt{x y})(1+x)(1+y)$, the given inequality simplifies to $(\sqrt{x y}-1)(\sqrt{x}-\sqrt{y})^{2} \geq 0$, which holds trivially under the condition $x y \geq 1$. Therefore, the inequality is proven.\qed + + Now, let's prove the main problem. We will prove by induction that the following inequality holds for each $k=n, n-1, \cdots, 1$: + + \begin{equation*} + \frac{1}{2^{n+1}}+\frac{1}{b_{n}}+\frac{1}{b_{n-1}}+\cdots+\frac{1}{b_{k}} \geq \frac{1}{2^{k-1}} \frac{1}{1+\left(a_{n} a_{n-1} \cdots a_{k}\right)^{2^{k-1}}} \tag{1.1} + \end{equation*} + + In particular, if this inequality holds for $k=1$, then the inequality in the problem is proven due to the condition $a_{1} a_{2} \cdots a_{n}=1$. + First, for $k=n$, since $a_{n} \geq 1$, we obtain the following by : + + \[ + \frac{1}{2^{n+1}}+\frac{1}{b_{n}}=\frac{1}{2^{n}}\left(\frac{1}{1+1}+\frac{1}{1+a_{n}^{2^{n}}}\right) \geq \frac{1}{2^{n-1}} \frac{1}{1+a_{n}^{2^{n-1}}} + \] + + Therefore, (1.1) holds. + + Next, let's prove that if (1.1) holds for $k=m$, then it also holds for $k=m-1$ (where $2 \leq m \leq n$). + + First, by the induction hypothesis, we obtain the following inequality: + + \[ + \frac{1}{2^{n+1}}+\frac{1}{b_{n}}+\frac{1}{b_{n-1}}+\cdots+\frac{1}{b_{m}}+\frac{1}{b_{m-1}} \geq \frac{1}{2^{m-1}}\left[\frac{1}{1+\left(a_{n} a_{n-1} \cdots a_{m}\right)^{2^{m-1}}}+\frac{1}{1+a_{m-1}^{2_{m-1}^{m}}}\right] + \] + + By the condition of the problem, + + \[ + \left(a_{n} a_{n-1} \cdots a_{m}\right)^{2^{m-1}} \cdot a_{m-1}^{2^{m-1}} \geq 1 + \] + + Therefore, by , + + \[ + \frac{1}{2^{m-1}}\left[\frac{1}{1+\left(a_{n} a_{n-1} \cdots a_{m}\right)^{2^{m-1}}}+\frac{1}{1+a_{m-1}^{2^{m-1}}}\right] \geq \frac{1}{2^{m-2}} \frac{1}{1+\left(a_{n} a_{n-1} \cdots a_{m} a_{m-1}\right)^{2^{m-2}}} + \] + + This confirms that inequality (1.1) also holds for $k=m-1$. + + In conclusion, by mathematical induction, (1.1) holds for $k=1$, completing the proof. +IMO_PROOF_42ed6b932497c627ac89ca68f45593393ff6cdf48edc9b388c9ff52163e24c38 diff --git a/tasks/pb-advanced-013/task.toml b/tasks/pb-advanced-013/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b039a9b3fd9557a13391e8d5ef727155c61a8514 --- /dev/null +++ b/tasks/pb-advanced-013/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-013" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-013" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-013/tests/grade_task.py b/tasks/pb-advanced-013/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-013/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-013/tests/reference.json b/tasks/pb-advanced-013/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..bc4ee721028fbe633bd6a6afc4541711ec0a8a7c --- /dev/null +++ b/tasks/pb-advanced-013/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "For an integer $n \\geq 2$, let $a_{1} \\leq a_{2} \\leq \\cdots \\leq a_{n}$ be positive real numbers satisfying $a_{1} a_{2} \\cdots a_{n}=1$. For each $k=1,2, \\cdots, n$, define $b_{k}=2^{k}\\left(1+a_{k}^{2^{k}}\\right)$. Prove that the following inequality holds:\n\n \\[\n \\frac{1}{2}-\\frac{1}{2^{n+1}} \\leq \\frac{1}{b_{1}}+\\frac{1}{b_{2}}+\\cdots+\\frac{1}{b_{n}}\n \\]", + "solution": "The following Lemma is often used in problems involving multiple variables or sequences.\n\n For positive real numbers $x, y$ satisfying $xy \\geq 1$, the following inequality holds:\n\n \\[\n \\frac{1}{1+x}+\\frac{1}{1+y} \\geq \\frac{2}{1+\\sqrt{x y}}\n \\]\n\n The proof is a simple calculation. Multiplying both sides by $(1+\\sqrt{x y})(1+x)(1+y)$, the given inequality simplifies to $(\\sqrt{x y}-1)(\\sqrt{x}-\\sqrt{y})^{2} \\geq 0$, which holds trivially under the condition $x y \\geq 1$. Therefore, the inequality is proven.\\qed\n\n Now, let's prove the main problem. We will prove by induction that the following inequality holds for each $k=n, n-1, \\cdots, 1$:\n\n \\begin{equation*}\n \\frac{1}{2^{n+1}}+\\frac{1}{b_{n}}+\\frac{1}{b_{n-1}}+\\cdots+\\frac{1}{b_{k}} \\geq \\frac{1}{2^{k-1}} \\frac{1}{1+\\left(a_{n} a_{n-1} \\cdots a_{k}\\right)^{2^{k-1}}} \\tag{1.1}\n \\end{equation*}\n\n In particular, if this inequality holds for $k=1$, then the inequality in the problem is proven due to the condition $a_{1} a_{2} \\cdots a_{n}=1$.\n First, for $k=n$, since $a_{n} \\geq 1$, we obtain the following by :\n\n \\[\n \\frac{1}{2^{n+1}}+\\frac{1}{b_{n}}=\\frac{1}{2^{n}}\\left(\\frac{1}{1+1}+\\frac{1}{1+a_{n}^{2^{n}}}\\right) \\geq \\frac{1}{2^{n-1}} \\frac{1}{1+a_{n}^{2^{n-1}}}\n \\]\n\n Therefore, (1.1) holds.\n\n Next, let's prove that if (1.1) holds for $k=m$, then it also holds for $k=m-1$ (where $2 \\leq m \\leq n$).\n\n First, by the induction hypothesis, we obtain the following inequality:\n\n \\[\n \\frac{1}{2^{n+1}}+\\frac{1}{b_{n}}+\\frac{1}{b_{n-1}}+\\cdots+\\frac{1}{b_{m}}+\\frac{1}{b_{m-1}} \\geq \\frac{1}{2^{m-1}}\\left[\\frac{1}{1+\\left(a_{n} a_{n-1} \\cdots a_{m}\\right)^{2^{m-1}}}+\\frac{1}{1+a_{m-1}^{2_{m-1}^{m}}}\\right]\n \\]\n\n By the condition of the problem,\n\n \\[\n \\left(a_{n} a_{n-1} \\cdots a_{m}\\right)^{2^{m-1}} \\cdot a_{m-1}^{2^{m-1}} \\geq 1\n \\]\n\n Therefore, by ,\n\n \\[\n \\frac{1}{2^{m-1}}\\left[\\frac{1}{1+\\left(a_{n} a_{n-1} \\cdots a_{m}\\right)^{2^{m-1}}}+\\frac{1}{1+a_{m-1}^{2^{m-1}}}\\right] \\geq \\frac{1}{2^{m-2}} \\frac{1}{1+\\left(a_{n} a_{n-1} \\cdots a_{m} a_{m-1}\\right)^{2^{m-2}}}\n \\]\n\n This confirms that inequality (1.1) also holds for $k=m-1$.\n\n In conclusion, by mathematical induction, (1.1) holds for $k=1$, completing the proof.", + "grading_guidelines": "(Partial)\n 1. Tried to apply induction in an appropriate direction.\n 2. Found any localization inequality, e.g., the one equivalent to the Lemma of solution.\n (Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Advanced-013", + "level": "advanced", + "category": "Algebra", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-advanced-013/tests/test.sh b/tasks/pb-advanced-013/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-013/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-014/instruction.md b/tasks/pb-advanced-014/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..73d26b9564f912953913b267ce3918eeb76f4f02 --- /dev/null +++ b/tasks/pb-advanced-014/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-014 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Two distinct positive integers \( a \) and \( b \) are written on a blackboard. At each step, you must choose one of the two operations — either adding 2 or multiplying by 3 — for each number separately, and apply the chosen operation to both numbers (possibly using different operations). You must apply an operation to both numbers every step. Find all pairs $(a, b)$ such that we can make the two numbers on the blackboard equal after a finite number of steps. diff --git a/tasks/pb-advanced-014/solution/solve.sh b/tasks/pb-advanced-014/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bbef1bb36e5d3f1b5cd039b2dcdf9191011a4636 --- /dev/null +++ b/tasks/pb-advanced-014/solution/solve.sh @@ -0,0 +1,56 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_d6d072e42f56f4d936889d3d49e613321b6dbc262b803d152ac81a2ca8343bd7' +The answer is that $a$ and $b$ are both even, or $a$ and $b$ are both odd and have the same remainder when divided by 4. + Finding an invariant + + Let's observe how the remainder when divided by 4 changes under the operations. First, for odd numbers, both operations change the remainder as follows: + + $1 \rightarrow 3,3 \rightarrow 1$ + + For even numbers, adding 2 changes the remainder as follows: + + \[ + 0 \rightarrow 2,2 \rightarrow 0 + \] + + and multiplying by 3 changes the remainder as follows: + \[ + 0 \rightarrow 0,2 \rightarrow 2 + \] + + + Finding impossible cases + + From the observation in , we can find conditions on $a$ and $b$ for which the conclusion of the problem does not hold. Let's consider the following two cases: + + (Case 1) $a$ and $b$ have different parity. + + Since the parity of the two numbers does not change under the operations, the two numbers cannot become equal. Therefore, the answer is impossible in this case. + + (Case 2) $a$ and $b$ are both odd and have different remainders when divided by 4. + + Since odd numbers change their remainders when divided by 4 under each operation, the remainders of the two numbers when divided by 4 will always be different, regardless of the operations. Therefore, the answer is impossible in this case. + + Now, let's prove that the answer is possible for $a$ and $b$ that do not satisfy (Case 1) and (Case 2). + + Showing that the operations exist for the remaining cases. + + The remaining cases are as follows: + + (Case 3) $a, b$ are both odd and have the same remainder when divided by 4. + + (Case 4) $a, b$ are both even. + + First, let's show that we can make $a \equiv b(\bmod 4)$ for both cases by applying operations to $a$ and $b$. In (Case 3), $a \equiv b(\bmod 4)$ is already satisfied. + + In (Case 4), if $a \neq b(\bmod 4)$, then by applying the operation of changing $a$ to $3a$ and $b$ to $b+2$, we can see that $3a \equiv b+2(\bmod 4)$. Therefore, we can make the two numbers congruent modulo 4. + + Now, let's write the two numbers with the same remainder when divided by 4 as $x$ and $x+4n$. Let's add 2 to $x$ for $k$ times and then multiply it by 3. On the other hand, let's multiply $x+4n$ by 3 and then add 2 to it for $k$ times. As a result of the operations, $x$ becomes $3(x+2k)$ and $x+4n$ becomes $3x+12n+2k$. + + Therefore, if we set $k=3n$, then the two numbers become equal. + + [Short answer] $a$ and $b$ are both even, or $a$ and $b$ are both odd and have the same remainder when divided by 4. +IMO_PROOF_d6d072e42f56f4d936889d3d49e613321b6dbc262b803d152ac81a2ca8343bd7 diff --git a/tasks/pb-advanced-014/task.toml b/tasks/pb-advanced-014/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..eafb22fd97d2f90e88fbce2d130415771aaa43a0 --- /dev/null +++ b/tasks/pb-advanced-014/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-014" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-014" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-014/tests/grade_task.py b/tasks/pb-advanced-014/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-014/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-014/tests/reference.json b/tasks/pb-advanced-014/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..ebddab62dbd9b6a2a4a189fb46b0d8832b5e73ee --- /dev/null +++ b/tasks/pb-advanced-014/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Two distinct positive integers \\( a \\) and \\( b \\) are written on a blackboard. At each step, you must choose one of the two operations — either adding 2 or multiplying by 3 — for each number separately, and apply the chosen operation to both numbers (possibly using different operations). You must apply an operation to both numbers every step. Find all pairs $(a, b)$ such that we can make the two numbers on the blackboard equal after a finite number of steps.", + "solution": "The answer is that $a$ and $b$ are both even, or $a$ and $b$ are both odd and have the same remainder when divided by 4.\n Finding an invariant\n\n Let's observe how the remainder when divided by 4 changes under the operations. First, for odd numbers, both operations change the remainder as follows:\n\n $1 \\rightarrow 3,3 \\rightarrow 1$\n\n For even numbers, adding 2 changes the remainder as follows:\n\n \\[\n 0 \\rightarrow 2,2 \\rightarrow 0\n \\]\n\n and multiplying by 3 changes the remainder as follows:\n \\[\n 0 \\rightarrow 0,2 \\rightarrow 2\n \\]\n\n\n Finding impossible cases\n\n From the observation in , we can find conditions on $a$ and $b$ for which the conclusion of the problem does not hold. Let's consider the following two cases:\n\n (Case 1) $a$ and $b$ have different parity.\n\n Since the parity of the two numbers does not change under the operations, the two numbers cannot become equal. Therefore, the answer is impossible in this case.\n\n (Case 2) $a$ and $b$ are both odd and have different remainders when divided by 4.\n\n Since odd numbers change their remainders when divided by 4 under each operation, the remainders of the two numbers when divided by 4 will always be different, regardless of the operations. Therefore, the answer is impossible in this case.\n\n Now, let's prove that the answer is possible for $a$ and $b$ that do not satisfy (Case 1) and (Case 2).\n\n Showing that the operations exist for the remaining cases.\n\n The remaining cases are as follows:\n\n (Case 3) $a, b$ are both odd and have the same remainder when divided by 4.\n\n (Case 4) $a, b$ are both even.\n\n First, let's show that we can make $a \\equiv b(\\bmod 4)$ for both cases by applying operations to $a$ and $b$. In (Case 3), $a \\equiv b(\\bmod 4)$ is already satisfied.\n\n In (Case 4), if $a \\neq b(\\bmod 4)$, then by applying the operation of changing $a$ to $3a$ and $b$ to $b+2$, we can see that $3a \\equiv b+2(\\bmod 4)$. Therefore, we can make the two numbers congruent modulo 4.\n\n Now, let's write the two numbers with the same remainder when divided by 4 as $x$ and $x+4n$. Let's add 2 to $x$ for $k$ times and then multiply it by 3. On the other hand, let's multiply $x+4n$ by 3 and then add 2 to it for $k$ times. As a result of the operations, $x$ becomes $3(x+2k)$ and $x+4n$ becomes $3x+12n+2k$.\n\n Therefore, if we set $k=3n$, then the two numbers become equal.\n\n [Short answer] $a$ and $b$ are both even, or $a$ and $b$ are both odd and have the same remainder when divided by 4.", + "grading_guidelines": "(Partial)\n 1. Found a correct invariant $\\pmod 4$.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Advanced-014", + "level": "advanced", + "category": "Combinatorics", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "$a$ and $b$ are both even, or $a$ and $b$ are both odd and have the same remainder when divided by 4." +} diff --git a/tasks/pb-advanced-014/tests/test.sh b/tasks/pb-advanced-014/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-014/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-015/instruction.md b/tasks/pb-advanced-015/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6dbd1d19fc5c6c119c904733de55514407607314 --- /dev/null +++ b/tasks/pb-advanced-015/instruction.md @@ -0,0 +1,8 @@ +# PB-Advanced-015 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Consider an acute triangle $ABC$ that is not isosceles. Let $H_0$, $E$, and $F$ be the feet of the perpendiculars dropped from vertices $A$, $B$, and $C$ to their opposite sides, respectively. Let $D$ be the point where the incircle of $\triangle ABC$ is tangent to side $ BC $. Denote the incenter and circumcenter of $\triangle ABC$ as $I$ and $O$, respectively. Let $K$ be the intersection of line $IO$ and line $BC$. Let $Q$ be the point where the ray $IH_0$ intersects the circumcircle of $\triangle ABC$ again. Let $X$ be the point where the line $ QD $ intersects the circumcircle of $\triangle ABC$ at a point other than $Q$. + Let $Y$ be the point where the circle that touches rays $AB$, $AC$, and is also externally tangent to the circumcircle of $\triangle ABC$, touches the circumcircle of $ \triangle ABC$. Prove that if segment $EF$ is tangent to the incircle of $ \triangle ABC$, then $X$, $Y$, and $K$ are collinear. diff --git a/tasks/pb-advanced-015/solution/solve.sh b/tasks/pb-advanced-015/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..9a0a7d892d69c5999d415e9ad0cfc3c576f00938 --- /dev/null +++ b/tasks/pb-advanced-015/solution/solve.sh @@ -0,0 +1,63 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_4c318e271019931a077b2b58f3862eba1e408603e02713d2f4562af2ab851219' +Let $W, V$ be the points where the incircle of $\triangle ABC$ tangent to $AB,AC$, respectively. + + The circumcircle of $\triangle A B C$, the circumcircle of $\triangle A V W$, and the circumcircle of $\triangle A E F$ meet at a point $P$ other than $A$. + + (1) Let $P(\neq A)$ be the intersection of the circumcircle of $\triangle A B C$ and the circumcircle of $\triangle A E F$. Then, $\triangle P E C \sim \triangle P F B(A A)$. + + (2) From the perspective of $\triangle A E F$, the incircle is the excircle, and since $\triangle A B C \sim \triangle A E F$, we have $\frac{F W}{E V}=\frac{B W}{C V}$. + + (3) Therefore, $\frac{B W}{F W}=\frac{C V}{E V}$, so $\triangle P E V \sim \triangle P F W(S A S)$, and by the inscribed angle theorem, we know that $A, V, W, P$ must lie on a circle. + + + Using radical axis + + (1) By considering the radical axis of the circumcircle of $\triangle A B C$, the circumcircle of $\triangle A E F$, and $(E, F, B, C)$, we see that $E F, A P, B C$ must be concurrent. Let this point be $R$. + + (2) By considering the radical axis of the circumcircle of $\triangle A B C$, the circumcircle of $\triangle I B C$, and the circumcircle of $\triangle A V W$, we see that $I R$ must be tangent to the circumcircle of $\triangle I B C$. + + + $Q$ is the point of tangency between the $A$-inmixtilinear circle of $\triangle A B C$ and the circumcircle. + + (1) $B, H_{0}, C, R$ are harmonic conjugates, so for the midpoint $M$ of $B C, R M \times R H_{0}=R B \times R C$. This is equal to $R I^{2}$ since $R I$ is tangent to the circumcircle of $\triangle I B C$. + + (2) Therefore, $I H_{0}$ is the symmedian of $\triangle I B C$. + + (3) Therefore, $Q$ must be the point of tangency between the $A$-inmixtilinear circle of $\triangle A B C$ and the circumcircle. + + + $V, H, W$ are collinear and $H V$ bisects $\angle E H C$. + + Since $\frac{H E}{H C}=\frac{E F}{B C}=\frac{E V}{C V}$(because $\triangle A B C \sim \triangle A E F$) $H V$ bisects $\angle E H C$. Similarly, $H W$ bisects $\angle F H B$, and therefore $V, H, W$ are collinear. + + + $K$ is the reflection of $D$ with respect to $M$. + + (1) Since $\frac{H B}{H C}=\frac{B W}{C V}=\frac{B D}{C D}, H D$ is the angle bisector of $\angle B H C$, and therefore $H D$ is perpendicular to $V W$. That is, $H D$ is parallel to $A I$. + + (2) Therefore, quadrilateral $A I D H$ is a parallelogram, and $A H=I D$. Therefore, $O M$ is half the length of the inradius. Therefore, $K$ is the reflection of $D$ with respect to $M$. + + + Finishing the proof + + (1) Let $l$ be the perpendicular bisector of $B C$. + + (2) By Step $3$, $X$ is the reflection of $A$ with respect to $l$. + + (3) By Step $5$ $K$ is the reflection of $D$ with respect to $l$. + + (4) Therefore, the intersection $Y$ of $X K$ and the circumcircle of $\triangle A B C$ is the reflection of the intersection of $A D$ and the circumcircle of $\triangle A B C$ with respect to $l$. This holds because this is the point of tangency between the $A$-exmixtilinear circle and the circumcircle of $\triangle A B C$. + [0pt] + + [Marking Scheme] + + (1) Circumcircles of $A B C, A V W$, and $A V W$ meet simultaneosly at a point $P$ other than $A$ : 2 points + + (2) $Q$ is the point of tangency between the circumcircle of $A B C$ and $A$-mixtilinear circle: 2 points + + (3) $K$ is the reflection of $D$ with respect to the midpoint $M$ of $B C: 2$ points +IMO_PROOF_4c318e271019931a077b2b58f3862eba1e408603e02713d2f4562af2ab851219 diff --git a/tasks/pb-advanced-015/task.toml b/tasks/pb-advanced-015/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b82e202e6d86a4b9006c87324ad27ccd5a5cebca --- /dev/null +++ b/tasks/pb-advanced-015/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-015" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-015" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-015/tests/grade_task.py b/tasks/pb-advanced-015/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-015/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-015/tests/reference.json b/tasks/pb-advanced-015/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..ea8c268e8248d50439b83bb58955b62d3cc87630 --- /dev/null +++ b/tasks/pb-advanced-015/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Consider an acute triangle $ABC$ that is not isosceles. Let $H_0$, $E$, and $F$ be the feet of the perpendiculars dropped from vertices $A$, $B$, and $C$ to their opposite sides, respectively. Let $D$ be the point where the incircle of $\\triangle ABC$ is tangent to side $ BC $. Denote the incenter and circumcenter of $\\triangle ABC$ as $I$ and $O$, respectively. Let $K$ be the intersection of line $IO$ and line $BC$. Let $Q$ be the point where the ray $IH_0$ intersects the circumcircle of $\\triangle ABC$ again. Let $X$ be the point where the line $ QD $ intersects the circumcircle of $\\triangle ABC$ at a point other than $Q$.\n Let $Y$ be the point where the circle that touches rays $AB$, $AC$, and is also externally tangent to the circumcircle of $\\triangle ABC$, touches the circumcircle of $ \\triangle ABC$. Prove that if segment $EF$ is tangent to the incircle of $ \\triangle ABC$, then $X$, $Y$, and $K$ are collinear.", + "solution": "Let $W, V$ be the points where the incircle of $\\triangle ABC$ tangent to $AB,AC$, respectively.\n\n The circumcircle of $\\triangle A B C$, the circumcircle of $\\triangle A V W$, and the circumcircle of $\\triangle A E F$ meet at a point $P$ other than $A$.\n\n (1) Let $P(\\neq A)$ be the intersection of the circumcircle of $\\triangle A B C$ and the circumcircle of $\\triangle A E F$. Then, $\\triangle P E C \\sim \\triangle P F B(A A)$.\n\n (2) From the perspective of $\\triangle A E F$, the incircle is the excircle, and since $\\triangle A B C \\sim \\triangle A E F$, we have $\\frac{F W}{E V}=\\frac{B W}{C V}$.\n\n (3) Therefore, $\\frac{B W}{F W}=\\frac{C V}{E V}$, so $\\triangle P E V \\sim \\triangle P F W(S A S)$, and by the inscribed angle theorem, we know that $A, V, W, P$ must lie on a circle.\n\n\n Using radical axis\n\n (1) By considering the radical axis of the circumcircle of $\\triangle A B C$, the circumcircle of $\\triangle A E F$, and $(E, F, B, C)$, we see that $E F, A P, B C$ must be concurrent. Let this point be $R$.\n\n (2) By considering the radical axis of the circumcircle of $\\triangle A B C$, the circumcircle of $\\triangle I B C$, and the circumcircle of $\\triangle A V W$, we see that $I R$ must be tangent to the circumcircle of $\\triangle I B C$.\n\n\n $Q$ is the point of tangency between the $A$-inmixtilinear circle of $\\triangle A B C$ and the circumcircle.\n\n (1) $B, H_{0}, C, R$ are harmonic conjugates, so for the midpoint $M$ of $B C, R M \\times R H_{0}=R B \\times R C$. This is equal to $R I^{2}$ since $R I$ is tangent to the circumcircle of $\\triangle I B C$.\n\n (2) Therefore, $I H_{0}$ is the symmedian of $\\triangle I B C$.\n\n (3) Therefore, $Q$ must be the point of tangency between the $A$-inmixtilinear circle of $\\triangle A B C$ and the circumcircle.\n\n\n $V, H, W$ are collinear and $H V$ bisects $\\angle E H C$.\n\n Since $\\frac{H E}{H C}=\\frac{E F}{B C}=\\frac{E V}{C V}$(because $\\triangle A B C \\sim \\triangle A E F$) $H V$ bisects $\\angle E H C$. Similarly, $H W$ bisects $\\angle F H B$, and therefore $V, H, W$ are collinear.\n\n\n $K$ is the reflection of $D$ with respect to $M$.\n\n (1) Since $\\frac{H B}{H C}=\\frac{B W}{C V}=\\frac{B D}{C D}, H D$ is the angle bisector of $\\angle B H C$, and therefore $H D$ is perpendicular to $V W$. That is, $H D$ is parallel to $A I$.\n\n (2) Therefore, quadrilateral $A I D H$ is a parallelogram, and $A H=I D$. Therefore, $O M$ is half the length of the inradius. Therefore, $K$ is the reflection of $D$ with respect to $M$.\n\n\n Finishing the proof\n\n (1) Let $l$ be the perpendicular bisector of $B C$.\n\n (2) By Step $3$, $X$ is the reflection of $A$ with respect to $l$.\n\n (3) By Step $5$ $K$ is the reflection of $D$ with respect to $l$.\n\n (4) Therefore, the intersection $Y$ of $X K$ and the circumcircle of $\\triangle A B C$ is the reflection of the intersection of $A D$ and the circumcircle of $\\triangle A B C$ with respect to $l$. This holds because this is the point of tangency between the $A$-exmixtilinear circle and the circumcircle of $\\triangle A B C$.\n [0pt]\n\n [Marking Scheme]\n\n (1) Circumcircles of $A B C, A V W$, and $A V W$ meet simultaneosly at a point $P$ other than $A$ : 2 points\n\n (2) $Q$ is the point of tangency between the circumcircle of $A B C$ and $A$-mixtilinear circle: 2 points\n\n (3) $K$ is the reflection of $D$ with respect to the midpoint $M$ of $B C: 2$ points", + "grading_guidelines": "(Partial)\n 1. Let $V, W$ be the points where the incircle of $\\triangle ABC$ tangent to $AB,AC$, respectively. Then, proved that circumcircles of $ABC$, $AVW$, and $AEF$ meet simultaneosly at a point $P$ other than $A$.\n(Almost)\n 1. Proved that $Q$ is the point of tangency between the circumcircle of $ABC$ and $A$-mixtilinear circle.\n 2. Proved that $K$ is the reflection of $D$ with respect to the midpoint $M$ of $BC$.", + "problem_id": "PB-Advanced-015", + "level": "advanced", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": " " +} diff --git a/tasks/pb-advanced-015/tests/test.sh b/tasks/pb-advanced-015/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-015/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-016/instruction.md b/tasks/pb-advanced-016/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5876ddddd9a946f854359c1b8b5591d31aaa1cea --- /dev/null +++ b/tasks/pb-advanced-016/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-016 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $ABC$ be a non-isosceles triangle with incenter $I$. Let line $BI$ intersect $AC$ at $E$, and line $CI$ intersect $AB$ at $F$. Two Points $U$ and $V$ are on segments $AB$ and $AC$ respectively, such that $AU = AE$ and $AV = AF$. Let the line passing through $I$ and perpendicular to $AI$ intersect line $BC$ at $L$. The circumcircle of $\triangle ILC$ intersects line $LU$ at $X$ (other than $L$), and the circumcircle of triangle $\triangle ILB$ intersects line $LV$ at $Y$ (other than $L$). Prove that if $P$ is the intersection of lines $YB$ and $XC$, then line $IP$ is parallel to line $XY$. diff --git a/tasks/pb-advanced-016/solution/solve.sh b/tasks/pb-advanced-016/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a9233921dd0d0985677396b8cc4eb34edf87c511 --- /dev/null +++ b/tasks/pb-advanced-016/solution/solve.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_2895793b62b4b452a53a6048bc83df96bb4f5841b338ab2413553d0d1c7517ea' +By symmetry, we assume that $AC>BC$. + + $U, V, L$ lie on a same line + + (1) Let $B^{\prime}$ be the point on $A C$ such that $A B=A B^{\prime}$ and $C^{\prime}$ be the point on $A B$ such that $A C=A C^{\prime}$. These points lie on the circumcircle of $\triangle I B C$. + + (2) By symmetry, $\left(B^{\prime}, I, U\right)$ and $\left(C^{\prime}, I, V\right)$ are collinear. + + (3) By Pascal's theorem on $B^{\prime} C B C^{\prime} I I, U, V, L$ lie on a same line. + + + $IPXY$ is an isosceles trapezoid + + Since $U, V, L$ are collinear, + + \[ + \angle I X Y=\angle I C B=\angle B I L=\angle B Y L=\angle P Y X + \] + + and similarly, $\angle I Y X=\angle P X Y$, so the statement holds. + + + Therefore, by , $I P$ and $X Y$ are parallel. +IMO_PROOF_2895793b62b4b452a53a6048bc83df96bb4f5841b338ab2413553d0d1c7517ea diff --git a/tasks/pb-advanced-016/task.toml b/tasks/pb-advanced-016/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..97879da53c0ff025a139770cf76c330faa21cbfb --- /dev/null +++ b/tasks/pb-advanced-016/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-016" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-016" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-016/tests/grade_task.py b/tasks/pb-advanced-016/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-016/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-016/tests/reference.json b/tasks/pb-advanced-016/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..6e6ba1814691c02b2dd2cdf31a09a5b203fdf2ce --- /dev/null +++ b/tasks/pb-advanced-016/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $ABC$ be a non-isosceles triangle with incenter $I$. Let line $BI$ intersect $AC$ at $E$, and line $CI$ intersect $AB$ at $F$. Two Points $U$ and $V$ are on segments $AB$ and $AC$ respectively, such that $AU = AE$ and $AV = AF$. Let the line passing through $I$ and perpendicular to $AI$ intersect line $BC$ at $L$. The circumcircle of $\\triangle ILC$ intersects line $LU$ at $X$ (other than $L$), and the circumcircle of triangle $\\triangle ILB$ intersects line $LV$ at $Y$ (other than $L$). Prove that if $P$ is the intersection of lines $YB$ and $XC$, then line $IP$ is parallel to line $XY$.", + "solution": "By symmetry, we assume that $AC>BC$.\n\n $U, V, L$ lie on a same line\n\n (1) Let $B^{\\prime}$ be the point on $A C$ such that $A B=A B^{\\prime}$ and $C^{\\prime}$ be the point on $A B$ such that $A C=A C^{\\prime}$. These points lie on the circumcircle of $\\triangle I B C$.\n\n (2) By symmetry, $\\left(B^{\\prime}, I, U\\right)$ and $\\left(C^{\\prime}, I, V\\right)$ are collinear.\n\n (3) By Pascal's theorem on $B^{\\prime} C B C^{\\prime} I I, U, V, L$ lie on a same line.\n\n\n $IPXY$ is an isosceles trapezoid\n\n Since $U, V, L$ are collinear,\n\n \\[\n \\angle I X Y=\\angle I C B=\\angle B I L=\\angle B Y L=\\angle P Y X\n \\]\n\n and similarly, $\\angle I Y X=\\angle P X Y$, so the statement holds.\n\n\n Therefore, by , $I P$ and $X Y$ are parallel.", + "grading_guidelines": "(Partial)\n 1. Proved that $U, V$, and $L$ lie on a same line.\n(Almost)\n 1. Made a minor mistake at the proof, or made a small gap.", + "problem_id": "PB-Advanced-016", + "level": "advanced", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-advanced-016/tests/test.sh b/tasks/pb-advanced-016/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-016/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-017/instruction.md b/tasks/pb-advanced-017/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..aff7952563105947a070dd2caae257af28eba7ff --- /dev/null +++ b/tasks/pb-advanced-017/instruction.md @@ -0,0 +1,13 @@ +# PB-Advanced-017 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $n$ be a positive integer that has a remainder of 6 when divided by 7. Let $d$ be any divisor of $n$. + +Define $c$ such that when the expression $\left(d+\frac{n}{d}\right)^{2}$ is divided by $n$, the remainder is $n-c$. + +What is the smallest possible value of $c$ among all $d$ and $n$ satisfying the conditions above? + +(Note that the remainder when a positive integer $a$ is divided by a positive integer $b$ is the value of $r$ in the expression $a=b q+r, 0 \leq r \leq b-1$.) diff --git a/tasks/pb-advanced-017/solution/solve.sh b/tasks/pb-advanced-017/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cadf55e1ac979803cd3439bdc822536a35803133 --- /dev/null +++ b/tasks/pb-advanced-017/solution/solve.sh @@ -0,0 +1,157 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_d83ac43e47551005bae8e8a8db4e644ee2ef7298fff4f215508cfba226863ff0' + Understanding the problem situation + + Let $d=a, \frac{n}{d}=b$, then $n=a b$. So if the remainder when $(a+b)^{2}$ is divided by $n$ is $n-c$ (where $c \geq 1$), then + + \[ + -c \equiv(a+b)^{2}=a^{2}+b^{2}+2 a b \equiv a^{2}+b^{2}(\bmod n) + \] + + which implies that $\frac{a^{2}+b^{2}+c}{a b}$ must be a positive integer. + + First, if $c=3$, then setting $a=4, b=19$ gives + + \[ + \frac{4^{2}+19^{2}+3}{4 \cdot 19}=5 + \] + + which is an integer. In fact, this corresponds to the case when $n=76, d=4$, and $\left(4+\frac{76}{4}\right)^{2}=529 \equiv -3(\bmod 76)$. + + Therefore, if $c \leq 2$, it is sufficient to prove that when $\frac{a^{2}+b^{2}+c}{a b}$ is a positive integer, $n$ cannot have remainder 6 when divided by $7$. Now, let's assume that $c$ is 1 or 2. + + Vieta jumping + + First, let's find the solutions when $a=b$. Then $\frac{2 a^{2}+c}{a^{2}}$ must be a positive integer, so $a^{2} \mid c$. Since $c$ is 1 or 2, we know that $a=1$. Therefore, $(a, b)=(1,1)$ is the only solution in this case. Now, let's find the solutions when $a \neq b$. By symmetry, we can assume $a We need to find pairs $(a, b)$ that satisfy the following for some positive integer $k$: + + + \begin{equation*} + \frac{a^{2}+b^{2}+c}{a b}=k \tag{1.1} + \end{equation*} + + + The above equation (1.1) can be rewritten as: + + \[ + a^{2}-k a b+b^{2}+c=0 + \] + + Now, if we view this equation as a quadratic equation in $b$, we can observe the following facts from the relationship between roots and coefficients: + + (1) The sum of the two roots is $k a$, so if a positive integer $b$ is a root, then the other root is $k a-b$, which is also an integer. + + (2) The product of the two roots is $a^{2}+c$, so if a positive integer $b$ is a root, then $\frac{a^{2}+c}{b}$ is also a root, and by (1), it is a positive integer solution. + + (2) Therefore, if $(a, b)$ is a solution to (1.1), then + + + \begin{equation*} + \left(a^{\prime}, b^{\prime}\right)=\left(\frac{a^{2}+c}{b}, a\right)=(k a-b, a) \tag{1.2} + \end{equation*} + + + defined as above is also a solution to (1.1). + + This process gives us a way to find another solution if we have a solution $(a, b)$. + + Applying the method of infinite descent + + Suppose $(a, b)$ is a solution to (1.1) with $a . + + Since we assumed $aa^{2}+2 \geq a^{2}+c + \] + + so $\frac{a^{2}+c}{b}, the sum of the two numbers forming the solution always decreases by at least 1. + + If $\frac{a^{2}+c}{b} again to the new solution $\left(a^{\prime}, b^{\prime}\right)=\left(\frac{a^{2}+c}{b}, a\right)$ to obtain another solution. However, by the result in (1) and the principle of infinite descent, this process cannot be repeated infinitely, and we will eventually reach a solution $(a, b)$ that satisfies $\frac{a^{2}+c}{b} \geq a$. + + Let's find what the final solution we must reach in (2) is. If $aa$ and $c+1=2or3$ so $b=c+1$. + + Therefore, this process ends when $(1, c+1)$ becomes $\left(\frac{1^{2}+c}{c+1}, 1\right)=(1,1)$. + + Summarizing the above discussion, if $(a, b)$ is a solution to (1.1) with $a is a new solution satisfying $a^{\prime} Reversing the descent process + + First, the value of $k$ in (1.1) does not change during the process described in . Therefore, the value of $k$ must be the same as the value at the endpoint $(a, b)=(1,1)$ of this process, so + + \[ + k=\frac{1^{2}+1^{2}+1}{c \cdot 1}=c+2 + \] + + must hold. + + Now, we know that any solution $(a, b)$ to (1.1) with $a . Therefore, by reversing this process, we can find all solutions $(a, b)$ to (1.1) with $a On the other hand, from (1), $k=c+2$, so looking at (1.2), we see that $\left(a^{\prime}, b^{\prime}\right)=((c+2) a-b, a)$. Therefore, + + \[ + (a, b)=\left(b^{\prime},(c+2) b^{\prime}-a^{\prime}\right) + \] + + holds. In other words, the process of mapping $(x, y) \mapsto(y,(c+2) y-x)$ is the reverse of the process where the solution descends in . + + Therefore, by (3), if we define the sequence $\left(x_{n}, y_{n}\right)_{n=1}^{\infty}$ as $\left(x_{1}, y_{1}\right)=(1,1)$ and + + \begin{equation} \tag{1.3} + \left\{\begin{array}{l} + x_{n+1}=y_{n} + + y_{n+1}=(c+2) y_{n}-x_{n} + \end{array}\right. + \end{equation} + + then this sequence describes the reverse of the process where the solution descends in , and by (2), these $\left(x_{n}, y_{n}\right)$ with $n \geq 2$ are all solutions to (1.1) with $a is + + \[ + \left(x_{k}, y_{k}\right) \rightarrow\left(x_{k-1}, y_{k-1}\right) \rightarrow \cdots \rightarrow\left(x_{1}, y_{1}\right)=(1,1) + \] + + + + (Case 1) When $c=1$, substituting the first equation of (1.3) into the second equation gives the recurrence relation + + \[ + y_{n+1}=3 y_{n}-y_{n-1} + \] + + and using $y_{1}=1, y_{2}=2$, we can see that this sequence repeats as $1,2,5,6,6,5,2,1,1,2$ modulo 7. Therefore, $x_n y_{n} = y_n y_{n-1}$ repeats as $2,3,2,1,2,3,2,1$ and thus cannot have remainder 6 when devided by $7$. + + (Case 2) When $c=2$, substituting the first equation of (1.3) into the second equation gives the recurrence relation + + \[ + y_{n+1}=4 y_{n}-y_{n-1} + \] + + and using $y_{1}=1, y_{2}=3$, we can see that this sequence repeats as $1,3,4,6,6,4,3,1,1,3$ modulo 7. Therefore, $x_n y_{n} = y_n y_{n-1}$ repeats as $3,5,3,1,3,5,3,1$ and thus cannot have remainder 6 when divided by $7$. + + In conclusion, when $c=1,2$, there is no case where $ab$ has remainder $6$ when divided by $7$ and $\frac{a^{2}+b^{2}+c}{a b}$ is an integer. Therefore, $c=3$ is the smallest possible value. +IMO_PROOF_d83ac43e47551005bae8e8a8db4e644ee2ef7298fff4f215508cfba226863ff0 diff --git a/tasks/pb-advanced-017/task.toml b/tasks/pb-advanced-017/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..66139bd0bb5ec1d2a2b8a9a498bf815d21c7d9b8 --- /dev/null +++ b/tasks/pb-advanced-017/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-017" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-017" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-017/tests/grade_task.py b/tasks/pb-advanced-017/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-017/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-017/tests/reference.json b/tasks/pb-advanced-017/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..82b255fc6a5d51746d4c4b87654255e6f9263620 --- /dev/null +++ b/tasks/pb-advanced-017/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $n$ be a positive integer that has a remainder of 6 when divided by 7. Let $d$ be any divisor of $n$.\n\nDefine $c$ such that when the expression $\\left(d+\\frac{n}{d}\\right)^{2}$ is divided by $n$, the remainder is $n-c$.\n\nWhat is the smallest possible value of $c$ among all $d$ and $n$ satisfying the conditions above?\n\n(Note that the remainder when a positive integer $a$ is divided by a positive integer $b$ is the value of $r$ in the expression $a=b q+r, 0 \\leq r \\leq b-1$.)", + "solution": " Understanding the problem situation\n\n Let $d=a, \\frac{n}{d}=b$, then $n=a b$. So if the remainder when $(a+b)^{2}$ is divided by $n$ is $n-c$ (where $c \\geq 1$), then\n\n \\[\n -c \\equiv(a+b)^{2}=a^{2}+b^{2}+2 a b \\equiv a^{2}+b^{2}(\\bmod n)\n \\]\n\n which implies that $\\frac{a^{2}+b^{2}+c}{a b}$ must be a positive integer.\n\n First, if $c=3$, then setting $a=4, b=19$ gives\n\n \\[\n \\frac{4^{2}+19^{2}+3}{4 \\cdot 19}=5\n \\]\n\n which is an integer. In fact, this corresponds to the case when $n=76, d=4$, and $\\left(4+\\frac{76}{4}\\right)^{2}=529 \\equiv -3(\\bmod 76)$.\n\n Therefore, if $c \\leq 2$, it is sufficient to prove that when $\\frac{a^{2}+b^{2}+c}{a b}$ is a positive integer, $n$ cannot have remainder 6 when divided by $7$. Now, let's assume that $c$ is 1 or 2.\n\n Vieta jumping\n\n First, let's find the solutions when $a=b$. Then $\\frac{2 a^{2}+c}{a^{2}}$ must be a positive integer, so $a^{2} \\mid c$. Since $c$ is 1 or 2, we know that $a=1$. Therefore, $(a, b)=(1,1)$ is the only solution in this case. Now, let's find the solutions when $a \\neq b$. By symmetry, we can assume $a We need to find pairs $(a, b)$ that satisfy the following for some positive integer $k$:\n\n\n \\begin{equation*}\n \\frac{a^{2}+b^{2}+c}{a b}=k \\tag{1.1}\n \\end{equation*}\n\n\n The above equation (1.1) can be rewritten as:\n\n \\[\n a^{2}-k a b+b^{2}+c=0\n \\]\n\n Now, if we view this equation as a quadratic equation in $b$, we can observe the following facts from the relationship between roots and coefficients:\n\n (1) The sum of the two roots is $k a$, so if a positive integer $b$ is a root, then the other root is $k a-b$, which is also an integer.\n\n (2) The product of the two roots is $a^{2}+c$, so if a positive integer $b$ is a root, then $\\frac{a^{2}+c}{b}$ is also a root, and by (1), it is a positive integer solution.\n\n (2) Therefore, if $(a, b)$ is a solution to (1.1), then\n\n\n \\begin{equation*}\n \\left(a^{\\prime}, b^{\\prime}\\right)=\\left(\\frac{a^{2}+c}{b}, a\\right)=(k a-b, a) \\tag{1.2}\n \\end{equation*}\n\n\n defined as above is also a solution to (1.1).\n\n This process gives us a way to find another solution if we have a solution $(a, b)$.\n\n Applying the method of infinite descent\n\n Suppose $(a, b)$ is a solution to (1.1) with $a .\n\n Since we assumed $aa^{2}+2 \\geq a^{2}+c\n \\]\n\n so $\\frac{a^{2}+c}{b}, the sum of the two numbers forming the solution always decreases by at least 1.\n\n If $\\frac{a^{2}+c}{b} again to the new solution $\\left(a^{\\prime}, b^{\\prime}\\right)=\\left(\\frac{a^{2}+c}{b}, a\\right)$ to obtain another solution. However, by the result in (1) and the principle of infinite descent, this process cannot be repeated infinitely, and we will eventually reach a solution $(a, b)$ that satisfies $\\frac{a^{2}+c}{b} \\geq a$.\n\n Let's find what the final solution we must reach in (2) is. If $aa$ and $c+1=2or3$ so $b=c+1$.\n\n Therefore, this process ends when $(1, c+1)$ becomes $\\left(\\frac{1^{2}+c}{c+1}, 1\\right)=(1,1)$.\n\n Summarizing the above discussion, if $(a, b)$ is a solution to (1.1) with $a is a new solution satisfying $a^{\\prime} Reversing the descent process\n\n First, the value of $k$ in (1.1) does not change during the process described in . Therefore, the value of $k$ must be the same as the value at the endpoint $(a, b)=(1,1)$ of this process, so\n\n \\[\n k=\\frac{1^{2}+1^{2}+1}{c \\cdot 1}=c+2\n \\]\n\n must hold.\n\n Now, we know that any solution $(a, b)$ to (1.1) with $a . Therefore, by reversing this process, we can find all solutions $(a, b)$ to (1.1) with $a On the other hand, from (1), $k=c+2$, so looking at (1.2), we see that $\\left(a^{\\prime}, b^{\\prime}\\right)=((c+2) a-b, a)$. Therefore,\n\n \\[\n (a, b)=\\left(b^{\\prime},(c+2) b^{\\prime}-a^{\\prime}\\right)\n \\]\n\n holds. In other words, the process of mapping $(x, y) \\mapsto(y,(c+2) y-x)$ is the reverse of the process where the solution descends in .\n\n Therefore, by (3), if we define the sequence $\\left(x_{n}, y_{n}\\right)_{n=1}^{\\infty}$ as $\\left(x_{1}, y_{1}\\right)=(1,1)$ and\n\n \\begin{equation} \\tag{1.3}\n \\left\\{\\begin{array}{l}\n x_{n+1}=y_{n}\n\n y_{n+1}=(c+2) y_{n}-x_{n}\n \\end{array}\\right.\n \\end{equation}\n\n then this sequence describes the reverse of the process where the solution descends in , and by (2), these $\\left(x_{n}, y_{n}\\right)$ with $n \\geq 2$ are all solutions to (1.1) with $a is\n\n \\[\n \\left(x_{k}, y_{k}\\right) \\rightarrow\\left(x_{k-1}, y_{k-1}\\right) \\rightarrow \\cdots \\rightarrow\\left(x_{1}, y_{1}\\right)=(1,1)\n \\]\n\n \n\n (Case 1) When $c=1$, substituting the first equation of (1.3) into the second equation gives the recurrence relation\n\n \\[\n y_{n+1}=3 y_{n}-y_{n-1}\n \\]\n\n and using $y_{1}=1, y_{2}=2$, we can see that this sequence repeats as $1,2,5,6,6,5,2,1,1,2$ modulo 7. Therefore, $x_n y_{n} = y_n y_{n-1}$ repeats as $2,3,2,1,2,3,2,1$ and thus cannot have remainder 6 when devided by $7$.\n\n (Case 2) When $c=2$, substituting the first equation of (1.3) into the second equation gives the recurrence relation\n\n \\[\n y_{n+1}=4 y_{n}-y_{n-1}\n \\]\n\n and using $y_{1}=1, y_{2}=3$, we can see that this sequence repeats as $1,3,4,6,6,4,3,1,1,3$ modulo 7. Therefore, $x_n y_{n} = y_n y_{n-1}$ repeats as $3,5,3,1,3,5,3,1$ and thus cannot have remainder 6 when divided by $7$.\n\n In conclusion, when $c=1,2$, there is no case where $ab$ has remainder $6$ when divided by $7$ and $\\frac{a^{2}+b^{2}+c}{a b}$ is an integer. Therefore, $c=3$ is the smallest possible value.", + "grading_guidelines": "(Partial)\n 1. Proved $c\\ge 3$.\n(Almost)\n 1. Applied infinite descent or equivalent strategy to prove $c=3$, but not completed.", + "problem_id": "PB-Advanced-017", + "level": "advanced", + "category": "Number theory", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "3" +} diff --git a/tasks/pb-advanced-017/tests/test.sh b/tasks/pb-advanced-017/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-017/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-018/instruction.md b/tasks/pb-advanced-018/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..948688f33ee51bc7f18162cce227d16e9e2f93d5 --- /dev/null +++ b/tasks/pb-advanced-018/instruction.md @@ -0,0 +1,17 @@ +# PB-Advanced-018 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +For given integers $n \ge 5$ and $k \ge 1$, we color each of the $n^2$ cells of an $n \times n$ grid using one of $k$ colors. If $q$ is the largest integer which is not larger than $\frac{n^2}{k}$, then, each of the $k$ colors must be used to color exactly $q$ or $q+1$ cells. A sequence of $n$ different cells $c_1, c_2, \ldots, c_n$ in the grid is called a \textit{snake} if it satisfies the following conditions simultaneously: + + \begin{enumerate} + \item[(a)] For each $1 \le i \le n-1$, two cells $c_i$ and $c_{i+1}$ are adjacent to their sides, + \item[(b)] For each $1 \le i \le n-1$, cell $c_i$ and cell $c_{i+1}$ are colored with different colors. + \end{enumerate} + Let $a(n)$ be the minimum $k$ such that a snake exists regardless of the method of coloring. Find a constant $L$ that satisfies the following inequality and prove it: + + \[ + |La(n)- n^2 | \le n +2 \sqrt n + 3 \;. + \] diff --git a/tasks/pb-advanced-018/solution/solve.sh b/tasks/pb-advanced-018/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..be1c288482d7ee28e3681ddd91da055433795bc8 --- /dev/null +++ b/tasks/pb-advanced-018/solution/solve.sh @@ -0,0 +1,81 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_cea0c2df075ed8246adc37d8bf574440c966b69f8b36db62bb793248d83659b7' +Let $(i, j)$ denote the cell in the $i$-th column from the left and the $j$-th row from the bottom. + + + For any $n \geq 5$, we can color the grid with $q=3$ and $r:= n^2 - kq \leq n+\lceil 2 \sqrt{n}\rceil+2$ so that it does not satisfy the conditions. From this, we can see that $a(n) \geq \frac{n^{2}- (n+2 \sqrt{n}+3)}{3}$. + + + (1) Let $m=\lceil\sqrt{n}\rceil-1$. + + + (2) For the following cells, color the $2 \times 2$ square with that cell as its bottom left corner with the same color. + + \[ + \{(i, j): i, j \in \mathbb{Z}, m|i, \quad m| j, \quad 1 \leq i, j \leq n-1\} + \] + + Color each $2 \times 2$ square with a different color. Let $A$ be the area colored in this way. + + + (3) In the remaining area excluding $A$, we can color the cells so that each color is used 3 times. For any $i$ such that $m \mid i$, color the cells $(x, y)$ with $x=i$ that do not belong to $A$ with the same color as the cell above it, and color the cells $(x, y)$ with $y=i$ that do not belong to $A$ with the same color as the cell to its right. Color the remaining cells arbitrarily, but make sure that each color appears 3 or 4 times. + + + (4) Since we can do this with $k=\left\lfloor\frac{n^{2}-|A|}{3}\right\rfloor, r \leq|A|+2$. + + + (5) From this, + \[ + |A|=\left\lfloor\frac{n-1}{m}\right\rfloor^{2}<\left(\frac{n-1}{\sqrt{n}-1}\right)^{2} If $k \geq \frac{n^{2}}{3}$, the conditions are satisfied. Therefore, $a(n) \leq\left\lceil\frac{n^{2}}{3}\right\rceil \leq \frac{n^{2}+2}{3}$. + + + (1) Consider the following graph: each cell is a vertex, and each cell is connected to the vertices of cells adjacent to it that have a different color. + + + (2) Consider the $4 n-4$ cells on the border of the given $n \times n$ grid. Now, let's prove the following claim. + + Claim. For any two vertices $x, y$ belonging to the same connected component $\Phi$ on the border, if there is no vertex in $\Phi$ when moving clockwise along the border from $x$ to $y$, then the vertex one step clockwise from $x$ and the vertex one step counterclockwise from $y$ belong to the same connected component. + + + (3) Let $z$ be the vertex one step clockwise from $x$ and $w$ be the vertex one step counterclockwise from $y$. Consider the boundary of the polygon formed by the cells in $\Phi$. This boundary consists of the perimeter edges of the given $n \times n$ grid or the edges shared by two adjacent cells within the $n \times n$ grid. The edge $l$ shared by $x$ and $z$ and the edge $m$ shared by $y$ and $w$ are both included in the boundary of this polygon. By the condition, on the boundary of this polygon, the line segments between $l$ and $m$ are all inside the $n \times n$ grid. + + + (4) Let these line segments between $l$ and $m$ be $a_{0}, a_{1}, \cdots, a_{k}$ in order ( $a_{0}=l, a_{k}=m$ ). Each $a_{i}$ lies on the boundary between a cell belonging to $\Phi$ and a cell not belonging to $\Phi$. That is, the two cells sharing $a_{i}$ must have the same color. We will show that the cells not belonging to $\Phi$ that share $a_{i}$ all belong to the same connected component. We will use induction to show that for $i=0, \cdots, s$, the cells not belonging to $\Phi$ that share $a_{i}$ all belong to the same connected component. + + + (5) Now, if $s=0$, it is trivial since there is only one cell. Therefore, using the inductive hypothesis, assume that the statement holds for $s-1$ and consider the case for $s$. + + + (Case 1) If $a_{s-1}$ and $a_{s}$ lie on the same line + + This is the case where for some $2 \times 2$ square and the line connecting the midpoints of two opposite sides, one side belongs to $\Phi$ and the opposite side does not. In this case, the coloring must be symmetric with respect to this line. Therefore, the two cells not belonging to $\Phi$ must also be connected by a line segment. + + + (Case 2) If $a_{s-1}$ and $a_{s}$ form a $90^{\circ}$ angle + + This means that for some $2 \times 2$ square, the two lines connecting its center to the midpoints of two consecutive sides are $a_{s-1}$ and $a_{s}$. These lines divide the $2 \times 2$ square into 1 cell and 3 cells. Place the centers of these cells on a new coordinate plane. Suppose they are divided into $(0,0)$ and $(1,0),(0,1),(1,1)$. Then $(0,0)$ and $(1,0),(0,1)$ must have the same color. Since each color is used at most 3 times, these are different from the color of $(1,1)$. Therefore, $(1,1)$ is connected to $(1,0)$ and $(0,1)$. That is, both sides of the division belong to the same connected component. + + + (6) Therefore, by mathematical induction, all cells not belonging to $\Phi$ that share $a_{i}$ are in the same connected component. This means that $z$ and $w$ are in the same connected component. This completes the proof of the Claim. + + + (7) Returning to the main proof, we will consider the vertices on the border. For two points $(x_1, y_1)$ and $(x_2, y_2)$, define the 'grid distance' as $|x_1 -x_2| +|y_1 - y_2|$. Let points $a$ and $b$ be the pair of points on the boarder that have the largest grid distance between them while being on the same connected component. + +(8) If the grid distance between $a$ and $b$ is larger or equal to $n-1$, then the path on the connected component that connects $a$ and $b$ is a desired \textit{snake} and we are done. + +(9) If the grid distance is smaller than $n-1$, then let the squares one step clockwise from $a$ and $b$ be $a_1$ and $b_1$, respectively, and the squares one step counterclockwise from $a$ and $b$ be $a_2$ and $b_2$, respectively. Now without loss of generality, we can say the grid distance between $a_1$ and $b_2$ is smaller than $n-1$. Now think of the path along the boundary connecting $a_2$ and $b_1$, not passing $a$ and $b$. The length of this path is at least $4n-4 -(n-1)-2 = 3n-5$, so if there is a square $c$ that is in the same connected component with $a$ and $b$, the grid distance between $(a,c)$ or $(b,c)$ is larger than $n-1$, thus a contradiction to maximality. However, if there are no squares in the path from $a_2$ to $b_1$ , by Claim $a_2$ and $b_1$ must be in the same connected component, which is agian a contradiction to the maximality of $(a,b)$. +IMO_PROOF_cea0c2df075ed8246adc37d8bf574440c966b69f8b36db62bb793248d83659b7 diff --git a/tasks/pb-advanced-018/task.toml b/tasks/pb-advanced-018/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..36fd2f13d56d8356e66d1bfefaae85d5ac2ed3e8 --- /dev/null +++ b/tasks/pb-advanced-018/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-018" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-018" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-018/tests/grade_task.py b/tasks/pb-advanced-018/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-018/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-018/tests/reference.json b/tasks/pb-advanced-018/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..9d119941acfe39599bbf58e4db7eb70e49f1caa3 --- /dev/null +++ b/tasks/pb-advanced-018/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "For given integers $n \\ge 5$ and $k \\ge 1$, we color each of the $n^2$ cells of an $n \\times n$ grid using one of $k$ colors. If $q$ is the largest integer which is not larger than $\\frac{n^2}{k}$, then, each of the $k$ colors must be used to color exactly $q$ or $q+1$ cells. A sequence of $n$ different cells $c_1, c_2, \\ldots, c_n$ in the grid is called a \\textit{snake} if it satisfies the following conditions simultaneously:\n\n \\begin{enumerate}\n \\item[(a)] For each $1 \\le i \\le n-1$, two cells $c_i$ and $c_{i+1}$ are adjacent to their sides,\n \\item[(b)] For each $1 \\le i \\le n-1$, cell $c_i$ and cell $c_{i+1}$ are colored with different colors.\n \\end{enumerate}\n Let $a(n)$ be the minimum $k$ such that a snake exists regardless of the method of coloring. Find a constant $L$ that satisfies the following inequality and prove it:\n\n \\[\n |La(n)- n^2 | \\le n +2 \\sqrt n + 3 \\;.\n \\]", + "solution": "Let $(i, j)$ denote the cell in the $i$-th column from the left and the $j$-th row from the bottom.\n\n\n For any $n \\geq 5$, we can color the grid with $q=3$ and $r:= n^2 - kq \\leq n+\\lceil 2 \\sqrt{n}\\rceil+2$ so that it does not satisfy the conditions. From this, we can see that $a(n) \\geq \\frac{n^{2}- (n+2 \\sqrt{n}+3)}{3}$.\n\n\n (1) Let $m=\\lceil\\sqrt{n}\\rceil-1$.\n\n\n (2) For the following cells, color the $2 \\times 2$ square with that cell as its bottom left corner with the same color.\n\n \\[\n \\{(i, j): i, j \\in \\mathbb{Z}, m|i, \\quad m| j, \\quad 1 \\leq i, j \\leq n-1\\}\n \\]\n\n Color each $2 \\times 2$ square with a different color. Let $A$ be the area colored in this way.\n\n\n (3) In the remaining area excluding $A$, we can color the cells so that each color is used 3 times. For any $i$ such that $m \\mid i$, color the cells $(x, y)$ with $x=i$ that do not belong to $A$ with the same color as the cell above it, and color the cells $(x, y)$ with $y=i$ that do not belong to $A$ with the same color as the cell to its right. Color the remaining cells arbitrarily, but make sure that each color appears 3 or 4 times.\n\n\n (4) Since we can do this with $k=\\left\\lfloor\\frac{n^{2}-|A|}{3}\\right\\rfloor, r \\leq|A|+2$.\n\n\n (5) From this,\n \\[\n |A|=\\left\\lfloor\\frac{n-1}{m}\\right\\rfloor^{2}<\\left(\\frac{n-1}{\\sqrt{n}-1}\\right)^{2} If $k \\geq \\frac{n^{2}}{3}$, the conditions are satisfied. Therefore, $a(n) \\leq\\left\\lceil\\frac{n^{2}}{3}\\right\\rceil \\leq \\frac{n^{2}+2}{3}$.\n\n\n (1) Consider the following graph: each cell is a vertex, and each cell is connected to the vertices of cells adjacent to it that have a different color.\n\n\n (2) Consider the $4 n-4$ cells on the border of the given $n \\times n$ grid. Now, let's prove the following claim.\n\n Claim. For any two vertices $x, y$ belonging to the same connected component $\\Phi$ on the border, if there is no vertex in $\\Phi$ when moving clockwise along the border from $x$ to $y$, then the vertex one step clockwise from $x$ and the vertex one step counterclockwise from $y$ belong to the same connected component.\n\n\n (3) Let $z$ be the vertex one step clockwise from $x$ and $w$ be the vertex one step counterclockwise from $y$. Consider the boundary of the polygon formed by the cells in $\\Phi$. This boundary consists of the perimeter edges of the given $n \\times n$ grid or the edges shared by two adjacent cells within the $n \\times n$ grid. The edge $l$ shared by $x$ and $z$ and the edge $m$ shared by $y$ and $w$ are both included in the boundary of this polygon. By the condition, on the boundary of this polygon, the line segments between $l$ and $m$ are all inside the $n \\times n$ grid.\n\n\n (4) Let these line segments between $l$ and $m$ be $a_{0}, a_{1}, \\cdots, a_{k}$ in order ( $a_{0}=l, a_{k}=m$ ). Each $a_{i}$ lies on the boundary between a cell belonging to $\\Phi$ and a cell not belonging to $\\Phi$. That is, the two cells sharing $a_{i}$ must have the same color. We will show that the cells not belonging to $\\Phi$ that share $a_{i}$ all belong to the same connected component. We will use induction to show that for $i=0, \\cdots, s$, the cells not belonging to $\\Phi$ that share $a_{i}$ all belong to the same connected component.\n\n\n (5) Now, if $s=0$, it is trivial since there is only one cell. Therefore, using the inductive hypothesis, assume that the statement holds for $s-1$ and consider the case for $s$.\n\n\n (Case 1) If $a_{s-1}$ and $a_{s}$ lie on the same line\n\n This is the case where for some $2 \\times 2$ square and the line connecting the midpoints of two opposite sides, one side belongs to $\\Phi$ and the opposite side does not. In this case, the coloring must be symmetric with respect to this line. Therefore, the two cells not belonging to $\\Phi$ must also be connected by a line segment.\n\n\n (Case 2) If $a_{s-1}$ and $a_{s}$ form a $90^{\\circ}$ angle\n\n This means that for some $2 \\times 2$ square, the two lines connecting its center to the midpoints of two consecutive sides are $a_{s-1}$ and $a_{s}$. These lines divide the $2 \\times 2$ square into 1 cell and 3 cells. Place the centers of these cells on a new coordinate plane. Suppose they are divided into $(0,0)$ and $(1,0),(0,1),(1,1)$. Then $(0,0)$ and $(1,0),(0,1)$ must have the same color. Since each color is used at most 3 times, these are different from the color of $(1,1)$. Therefore, $(1,1)$ is connected to $(1,0)$ and $(0,1)$. That is, both sides of the division belong to the same connected component.\n\n\n (6) Therefore, by mathematical induction, all cells not belonging to $\\Phi$ that share $a_{i}$ are in the same connected component. This means that $z$ and $w$ are in the same connected component. This completes the proof of the Claim.\n\n\n (7) Returning to the main proof, we will consider the vertices on the border. For two points $(x_1, y_1)$ and $(x_2, y_2)$, define the 'grid distance' as $|x_1 -x_2| +|y_1 - y_2|$. Let points $a$ and $b$ be the pair of points on the boarder that have the largest grid distance between them while being on the same connected component.\n\n(8) If the grid distance between $a$ and $b$ is larger or equal to $n-1$, then the path on the connected component that connects $a$ and $b$ is a desired \\textit{snake} and we are done.\n\n(9) If the grid distance is smaller than $n-1$, then let the squares one step clockwise from $a$ and $b$ be $a_1$ and $b_1$, respectively, and the squares one step counterclockwise from $a$ and $b$ be $a_2$ and $b_2$, respectively. Now without loss of generality, we can say the grid distance between $a_1$ and $b_2$ is smaller than $n-1$. Now think of the path along the boundary connecting $a_2$ and $b_1$, not passing $a$ and $b$. The length of this path is at least $4n-4 -(n-1)-2 = 3n-5$, so if there is a square $c$ that is in the same connected component with $a$ and $b$, the grid distance between $(a,c)$ or $(b,c)$ is larger than $n-1$, thus a contradiction to maximality. However, if there are no squares in the path from $a_2$ to $b_1$ , by Claim $a_2$ and $b_1$ must be in the same connected component, which is agian a contradiction to the maximality of $(a,b)$.", + "grading_guidelines": "(Partial)\n 1. Guessed $L=3$ and then explained the strategy of the proof (namely, explained how one can obtain lower and upper bound of $a(n)$ ).\n 2. Partitioned the given grid into squares of size of order $\\sqrt{n} \\times \\sqrt{n}$ or used a similar logic to determine a lower bound for $N a(n)$, but failed to meet the required lower bound as specified by the problem.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Advanced-018", + "level": "advanced", + "category": "Combinatorics", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": "3" +} diff --git a/tasks/pb-advanced-018/tests/test.sh b/tasks/pb-advanced-018/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-018/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-019/instruction.md b/tasks/pb-advanced-019/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2e2a1e033119fb77f58dbef6b04d33bf15985e20 --- /dev/null +++ b/tasks/pb-advanced-019/instruction.md @@ -0,0 +1,11 @@ +# PB-Advanced-019 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +For a real number $r$, let $A(r)$ denote the fractional part of $2r$ in its decimal representation. For a real number $r$ and a positive integer $n$, define $B(n,r)$ as + $$ + B(n,r)=\sum_{k=1}^n A(kr). + $$ + Find all positive real numbers $r$ such that $n(n+1)r - B(n,r)$ is a multiple of $n$ for all positive integers $n$. diff --git a/tasks/pb-advanced-019/solution/solve.sh b/tasks/pb-advanced-019/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..99b3c19dd796c683b462ede6534cf6f94094efed --- /dev/null +++ b/tasks/pb-advanced-019/solution/solve.sh @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_0ac40d9ab3f6c2a63b45c07c8a0b7ff5b5adde57e2e07d38a846709d2acb4742' +Let $r$ be a positive real number. Let $A(r)$ denote the fractional part of $2r$, so $A(r) = 2r - \lfloor 2r \rfloor$. We are given that $B(n,r) = \sum_{k=1}^n A(kr)$. We want to find all positive real numbers $r$ such that $n(n+1)r - B(n,r)$ is a multiple of $n$ for all positive integers $n$. + + We can rewrite the condition as + $$ + n(n+1)r - \sum_{k=1}^n (2kr - \lfloor 2kr \rfloor) = \sum_{k=1}^n \lfloor 2kr \rfloor \quad \text{is a multiple of } n. + $$ + Let $\alpha = 2r$. Then the condition becomes: $\sum_{k=1}^n \lfloor k\alpha \rfloor$ is a multiple of $n$ for all positive integers $n$. + + We prove that all even integers $\alpha$ satisfy the condition, and no other real number $\alpha$ does so. First we will show that + even integers satisfy the condition. If $\alpha=2m$ where $m$ is + an integer then + + \[ + \lfloor\alpha\rfloor+\lfloor2\alpha\rfloor+\cdots+\lfloor n\alpha\rfloor=2m+4m+\cdots+2mn=mn(n+1) + \] + + which is a multiple of $n$. Since $r > 0$, we must have $\alpha = 2r > 0$. So $\alpha$ must be a positive even integer. If $\alpha = 2m$ for some positive integer $m$, then $r = m$, which is a positive integer. + + Now we will show that they are the only real numbers satisfying the + conditions of the problem. Let $\alpha=k+\epsilon$ where $k$ is + an integer and $0\leqslant\epsilon<1$. Then the number + \[ + \begin{aligned}\lfloor\alpha\rfloor+\lfloor2\alpha\rfloor+\cdots+\lfloor n\alpha\rfloor & = \lfloor k+\epsilon \rfloor+\lfloor2(k+\epsilon)\rfloor+\cdots+\lfloor n(k+\epsilon)\rfloor + + & = k+\lfloor\epsilon\rfloor+2k+\lfloor2\epsilon\rfloor+\cdots+nk+\lfloor n\epsilon\rfloor + + & =\frac{kn(n+1)}{2}+\lfloor\epsilon\rfloor+\lfloor2\epsilon\rfloor+\cdots+\lfloor n\epsilon\rfloor + \end{aligned} + \] + has to be a multiple of $n$. We consider two cases based on the parity + of $k$. + + + \begin{itemize} + \item Case 1: \textbf{$k$ is even.} Then $\frac{kn(n+1)}{2}$ is always + a multiple of $n$. Thus + \[ + \lfloor\epsilon\rfloor+\lfloor2\epsilon\rfloor+\cdots+\lfloor n\epsilon\rfloor + \] + also has to be a multiple of $n$. We will prove that $\lfloor n\epsilon\rfloor=0$ + for every positive integer $n$ by strong induction. The base case + $n=1$ follows from the fact that $0\leqslant\epsilon<1$. Let us + suppose that $\lfloor m\epsilon\rfloor=0$ for every $1\leqslant m 0$, $\alpha = 2r > 0$. So $\alpha$ must be a positive even integer. This means $2r = 2m$ for some positive integer $m$. Therefore, $r=m$ must be a positive integer. + \item Case 2: \textbf{$k$ is odd.} We will prove that $\lfloor n\epsilon\rfloor=n-1$ + for every natural number $n$ by strong induction. The base case $n=1$ + again follows from the fact that $0\leqslant\epsilon<1$. Let us suppose + that $\lfloor m\epsilon\rfloor=m-1$ for every $1\leqslant m LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-019/tests/reference.json b/tasks/pb-advanced-019/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..828225cb2d75fd070a1b3580a499c48ca27a8ff1 --- /dev/null +++ b/tasks/pb-advanced-019/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "For a real number $r$, let $A(r)$ denote the fractional part of $2r$ in its decimal representation. For a real number $r$ and a positive integer $n$, define $B(n,r)$ as\n $$\n B(n,r)=\\sum_{k=1}^n A(kr).\n $$\n Find all positive real numbers $r$ such that $n(n+1)r - B(n,r)$ is a multiple of $n$ for all positive integers $n$.", + "solution": "Let $r$ be a positive real number. Let $A(r)$ denote the fractional part of $2r$, so $A(r) = 2r - \\lfloor 2r \\rfloor$. We are given that $B(n,r) = \\sum_{k=1}^n A(kr)$. We want to find all positive real numbers $r$ such that $n(n+1)r - B(n,r)$ is a multiple of $n$ for all positive integers $n$.\n\n We can rewrite the condition as\n $$\n n(n+1)r - \\sum_{k=1}^n (2kr - \\lfloor 2kr \\rfloor) = \\sum_{k=1}^n \\lfloor 2kr \\rfloor \\quad \\text{is a multiple of } n.\n $$\n Let $\\alpha = 2r$. Then the condition becomes: $\\sum_{k=1}^n \\lfloor k\\alpha \\rfloor$ is a multiple of $n$ for all positive integers $n$.\n\n We prove that all even integers $\\alpha$ satisfy the condition, and no other real number $\\alpha$ does so. First we will show that\n even integers satisfy the condition. If $\\alpha=2m$ where $m$ is\n an integer then\n\n \\[\n \\lfloor\\alpha\\rfloor+\\lfloor2\\alpha\\rfloor+\\cdots+\\lfloor n\\alpha\\rfloor=2m+4m+\\cdots+2mn=mn(n+1)\n \\]\n\n which is a multiple of $n$. Since $r > 0$, we must have $\\alpha = 2r > 0$. So $\\alpha$ must be a positive even integer. If $\\alpha = 2m$ for some positive integer $m$, then $r = m$, which is a positive integer.\n\n Now we will show that they are the only real numbers satisfying the\n conditions of the problem. Let $\\alpha=k+\\epsilon$ where $k$ is\n an integer and $0\\leqslant\\epsilon<1$. Then the number\n \\[\n \\begin{aligned}\\lfloor\\alpha\\rfloor+\\lfloor2\\alpha\\rfloor+\\cdots+\\lfloor n\\alpha\\rfloor & = \\lfloor k+\\epsilon \\rfloor+\\lfloor2(k+\\epsilon)\\rfloor+\\cdots+\\lfloor n(k+\\epsilon)\\rfloor\n\n & = k+\\lfloor\\epsilon\\rfloor+2k+\\lfloor2\\epsilon\\rfloor+\\cdots+nk+\\lfloor n\\epsilon\\rfloor\n\n & =\\frac{kn(n+1)}{2}+\\lfloor\\epsilon\\rfloor+\\lfloor2\\epsilon\\rfloor+\\cdots+\\lfloor n\\epsilon\\rfloor\n \\end{aligned}\n \\]\n has to be a multiple of $n$. We consider two cases based on the parity\n of $k$.\n\n\n \\begin{itemize}\n \\item Case 1: \\textbf{$k$ is even.} Then $\\frac{kn(n+1)}{2}$ is always\n a multiple of $n$. Thus\n \\[\n \\lfloor\\epsilon\\rfloor+\\lfloor2\\epsilon\\rfloor+\\cdots+\\lfloor n\\epsilon\\rfloor\n \\]\n also has to be a multiple of $n$. We will prove that $\\lfloor n\\epsilon\\rfloor=0$\n for every positive integer $n$ by strong induction. The base case\n $n=1$ follows from the fact that $0\\leqslant\\epsilon<1$. Let us\n suppose that $\\lfloor m\\epsilon\\rfloor=0$ for every $1\\leqslant m 0$, $\\alpha = 2r > 0$. So $\\alpha$ must be a positive even integer. This means $2r = 2m$ for some positive integer $m$. Therefore, $r=m$ must be a positive integer.\n \\item Case 2: \\textbf{$k$ is odd.} We will prove that $\\lfloor n\\epsilon\\rfloor=n-1$\n for every natural number $n$ by strong induction. The base case $n=1$\n again follows from the fact that $0\\leqslant\\epsilon<1$. Let us suppose\n that $\\lfloor m\\epsilon\\rfloor=m-1$ for every $1\\leqslant m "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-020/instruction.md b/tasks/pb-advanced-020/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a06b86d256334fd440f60d452678ea94d3244fea --- /dev/null +++ b/tasks/pb-advanced-020/instruction.md @@ -0,0 +1,11 @@ +# PB-Advanced-020 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +For given positive integers $x$ and $y$, we define a sequence $(a_n)_{n \ge 1}$ as + $$ + a_n = \gcd \left( x^n +y , \, (y-x)\left(\sum_{i=0}^{n-1} y^i x^{n-i-1} - 1\right) \right) + $$ + for all $n\in \mathbb{N}$. Find all pairs $(x,y)$ of positive integers such that the limit of the sequence $(a_n)$ exists. diff --git a/tasks/pb-advanced-020/solution/solve.sh b/tasks/pb-advanced-020/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..83df32f6764505c473361183f316730aaa03b5b0 --- /dev/null +++ b/tasks/pb-advanced-020/solution/solve.sh @@ -0,0 +1,58 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_15cef60a7f4c45f212560a601983366887ead8d7966834577ac0c461faf7f272' +To begin with, we can change the expression in the problem to + $\gcd \left( x^n +y , \, (y-x)\left(\sum_{i=0}^{n-1} y^i x^{n-i-1} - 1\right) \right) = \gcd \left( x^n +y , \, y^n - x^n -(y-x) \right) = \gcd(x^n +y , y^n +x)$. + Let the limit of the sequence $(a_n)$ exist and be equal to $g$. Then, for sufficiently large $n$, + + Lemma. If the limit of $a_n$ as $n \to \infty$ exists and is equal to $g$, then $g$ divides $2 \gcd(x, y)$. + + Proof. For sufficiently large $n$, we have $a_n = \gcd \left( x^n +y , \, y^n +x \right) = g$. + This implies that $g$ divides $x^n + y$ and $g$ divides $y^n +x$ for all $n \ge N$, for some positive integer $N$. + + Consider $n \ge N$. We have $x^n + y \equiv 0 \pmod{g}$ and $x^{n+1} + y \equiv 0 \pmod{g}$. + Multiplying the first congruence by $x$, we get $x^{n+1} + xy \equiv 0 \pmod{g}$. + Subtracting the second congruence from this, we have $(x^{n+1} + xy) - (x^{n+1} + y) \equiv 0 - 0 \pmod{g}$, which simplifies to $xy - y = y(x-1) \equiv 0 \pmod{g}$. + + Analogously, $x(y-1)$ is divisible by $g$. + Their difference $x-y$ is then divisible by $g$, so $g$ also divides + $x(y-1)+x(x-y)=x^2 -x$. All powers of $x$ are then congruent modulo + $g$, so $x+y\equiv x^{N}+y\equiv0(\bmod g)$. Then $2x=(x+y)+(x-y)$ + and $2y=(x+y)-(x-y)$ are both divisible by $g$, so $g\mid2\operatorname{gcd}(x,y)$. + On the other hand, it is clear that $\operatorname{gcd}(x,y)\mid g$, + thus proving the Lemma. + + Let $d=\operatorname{gcd}(x,y)$, and write $x=da$ and $y=db$ for + coprime positive integers $a$ and $b$. We have that + + \[ + \operatorname{gcd}\left((da)^{n}+db,(db)^{n}+da\right)=d\operatorname{gcd}\left(d^{n-1}a^{n}+b,d^{n-1}b^{n}+a\right) + \] + + so the Lemma tells us that + + \[ + \operatorname{gcd}\left(d^{n-1}a^{n}+b,d^{n-1}b^{n}+a\right)\leqslant2 + \] + + for all $n\geqslant N$. Defining $K=d^{2}ab+1$, note that $K$ is + coprime to each of $d,a$, and $b$. By Euler's theorem, for $n\equiv-1(\bmod\varphi(K))$ + we have that + + \[ + d^{n-1}a^{n}+b\equiv d^{-2}a^{-1}+b\equiv d^{-2}a^{-1}\left(1+d^{2}ab\right)\equiv 0\quad(\bmod K) + \] + + so $K\mid d^{n-1}a^{n}+b$. Analogously, we have that $K\mid d^{n-1}b^{n}+a$. + Taking such an $n$ which also satisfies $n\geqslant N$ gives us + that + + \[ + K\mid\operatorname{gcd}\left(d^{n-1}a^{n}+b,d^{n-1}b^{n}+a\right)\leqslant2 + \] + + This is only possible when $d=a=b=1$, which yields the only solution + $(x,y)=(1,1)$. Therefore, the only solution is $(x,y)=(1,1)$. +IMO_PROOF_15cef60a7f4c45f212560a601983366887ead8d7966834577ac0c461faf7f272 diff --git a/tasks/pb-advanced-020/task.toml b/tasks/pb-advanced-020/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f07b3510a93a08076b988c9ad1ee4914ec2fbc01 --- /dev/null +++ b/tasks/pb-advanced-020/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-020" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-020" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-020/tests/grade_task.py b/tasks/pb-advanced-020/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-020/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-020/tests/reference.json b/tasks/pb-advanced-020/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..9d00b827c217427dc1e03ca0291731c2be52725a --- /dev/null +++ b/tasks/pb-advanced-020/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "For given positive integers $x$ and $y$, we define a sequence $(a_n)_{n \\ge 1}$ as\n $$\n a_n = \\gcd \\left( x^n +y , \\, (y-x)\\left(\\sum_{i=0}^{n-1} y^i x^{n-i-1} - 1\\right) \\right)\n $$\n for all $n\\in \\mathbb{N}$. Find all pairs $(x,y)$ of positive integers such that the limit of the sequence $(a_n)$ exists.", + "solution": "To begin with, we can change the expression in the problem to\n $\\gcd \\left( x^n +y , \\, (y-x)\\left(\\sum_{i=0}^{n-1} y^i x^{n-i-1} - 1\\right) \\right) = \\gcd \\left( x^n +y , \\, y^n - x^n -(y-x) \\right) = \\gcd(x^n +y , y^n +x)$.\n Let the limit of the sequence $(a_n)$ exist and be equal to $g$. Then, for sufficiently large $n$,\n\n Lemma. If the limit of $a_n$ as $n \\to \\infty$ exists and is equal to $g$, then $g$ divides $2 \\gcd(x, y)$.\n\n Proof. For sufficiently large $n$, we have $a_n = \\gcd \\left( x^n +y , \\, y^n +x \\right) = g$.\n This implies that $g$ divides $x^n + y$ and $g$ divides $y^n +x$ for all $n \\ge N$, for some positive integer $N$.\n\n Consider $n \\ge N$. We have $x^n + y \\equiv 0 \\pmod{g}$ and $x^{n+1} + y \\equiv 0 \\pmod{g}$.\n Multiplying the first congruence by $x$, we get $x^{n+1} + xy \\equiv 0 \\pmod{g}$.\n Subtracting the second congruence from this, we have $(x^{n+1} + xy) - (x^{n+1} + y) \\equiv 0 - 0 \\pmod{g}$, which simplifies to $xy - y = y(x-1) \\equiv 0 \\pmod{g}$.\n\n Analogously, $x(y-1)$ is divisible by $g$.\n Their difference $x-y$ is then divisible by $g$, so $g$ also divides\n $x(y-1)+x(x-y)=x^2 -x$. All powers of $x$ are then congruent modulo\n $g$, so $x+y\\equiv x^{N}+y\\equiv0(\\bmod g)$. Then $2x=(x+y)+(x-y)$\n and $2y=(x+y)-(x-y)$ are both divisible by $g$, so $g\\mid2\\operatorname{gcd}(x,y)$.\n On the other hand, it is clear that $\\operatorname{gcd}(x,y)\\mid g$,\n thus proving the Lemma.\n\n Let $d=\\operatorname{gcd}(x,y)$, and write $x=da$ and $y=db$ for\n coprime positive integers $a$ and $b$. We have that\n\n \\[\n \\operatorname{gcd}\\left((da)^{n}+db,(db)^{n}+da\\right)=d\\operatorname{gcd}\\left(d^{n-1}a^{n}+b,d^{n-1}b^{n}+a\\right)\n \\]\n\n so the Lemma tells us that\n\n \\[\n \\operatorname{gcd}\\left(d^{n-1}a^{n}+b,d^{n-1}b^{n}+a\\right)\\leqslant2\n \\]\n\n for all $n\\geqslant N$. Defining $K=d^{2}ab+1$, note that $K$ is\n coprime to each of $d,a$, and $b$. By Euler's theorem, for $n\\equiv-1(\\bmod\\varphi(K))$\n we have that\n\n \\[\n d^{n-1}a^{n}+b\\equiv d^{-2}a^{-1}+b\\equiv d^{-2}a^{-1}\\left(1+d^{2}ab\\right)\\equiv 0\\quad(\\bmod K)\n \\]\n\n so $K\\mid d^{n-1}a^{n}+b$. Analogously, we have that $K\\mid d^{n-1}b^{n}+a$.\n Taking such an $n$ which also satisfies $n\\geqslant N$ gives us\n that\n\n \\[\n K\\mid\\operatorname{gcd}\\left(d^{n-1}a^{n}+b,d^{n-1}b^{n}+a\\right)\\leqslant2\n \\]\n\n This is only possible when $d=a=b=1$, which yields the only solution\n $(x,y)=(1,1)$. Therefore, the only solution is $(x,y)=(1,1)$.", + "grading_guidelines": "(Partial)\n 1. Considered a prime $p|xy+1$.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.\n 2. Omitted the case when $xy+1$ doesn't have an odd prime factor.", + "problem_id": "PB-Advanced-020", + "level": "advanced", + "category": "Number theory", + "source": "(Modified) IMO 2024 P2", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "(1,1)" +} diff --git a/tasks/pb-advanced-020/tests/test.sh b/tasks/pb-advanced-020/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-020/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-021/instruction.md b/tasks/pb-advanced-021/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5062f354fd5fe0b5c63818bac14f165b799a21a1 --- /dev/null +++ b/tasks/pb-advanced-021/instruction.md @@ -0,0 +1,27 @@ +# PB-Advanced-021 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Infinitely many boys and girls stand in a line alternatingly. For + a given positive integer $N$, they choose positive integers according + to the following rules: + + (1) The first $N$ people in the line choose any positive integers + they want. + + (2) For each $m>N$, the $m$-th person chooses the number that is + one more than the number of appearances of the number chosen by the + $(m-1)$-th person appears among the numbers chosen by the first $m-2$ + people. + + Let $b_{i}$ be the number chosen by the $i$-th boy, and $g_{i}$ + be the number chosen by the $i$-th girl. Prove that at least one + of the following holds: + + (i) There exists a sufficiently large integer $M$ such that $\{b_{n}\}_{n\ge M}$ + is a periodic sequence. + + (ii) There exists a sufficiently large integer $M$ such that $\{g_{n}\}_{n\ge M}$ + is a periodic sequence. diff --git a/tasks/pb-advanced-021/solution/solve.sh b/tasks/pb-advanced-021/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37548d90352498c976ec4a99f010b0664b1c95d7 --- /dev/null +++ b/tasks/pb-advanced-021/solution/solve.sh @@ -0,0 +1,125 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_bab2042480f4bd37783dbf3bd3a08d452eb37628a83f86995a27a7b7f1bdbfa8' +Let $N$ be the given positive integer. Let $s_{m}$ be the number + chosen by the $m$-th person in the line. For $m\ge N+1$, $s_{m}$ + is one more than the number of appearances of $s_{m-1}$ in the sequence + $s_{1},s_{2},\dots,s_{m-2}$. Let $b_{i}=s_{2i-1}$ be the number + chosen by the $i$-th boy, and $g_{i}=s_{2i}$ be the number chosen + by the $i$-th girl. We want to show that at least one of the sequences + $\{b_{n}\}_{n\ge M}$ or $\{g_{n}\}_{n\ge M}$ is periodic for some + sufficiently large integer $M$. + + + Let $M>\max\left(s_{1},\ldots,s_{2N}\right)$. We first prove that + some integer appears infinitely many times. If not, then the sequence + contains arbitrarily large integers. The first time each integer larger + than $M$ appears, it is followed by a 1 . So 1 appears infinitely + many times, which is a contradiction. + + + Now we prove that every integer $x\geq M$ appears at most $M-1$ + times. If not, consider the first time that any $x\geq M$ appears + for the $M^{\text{th }}$ time. Up to this point, each appearance + of $x$ is preceded by an integer which has appeared $x\geq M$ times. + So there must have been at least $M$ numbers that have already appeared + at least $M$ times before $x$ does, which is a contradiction. + + + Thus there are only finitely many numbers that appear infinitely many + times. Let the largest of these be $k$. Since $k$ appears infinitely + many times there must be infinitely many integers greater than $M$ + which appear at least $k$ times in the sequence, so each integer + $1,2,\ldots,k-1$ also appears infinitely many times. Since $k+1$ + doesn't appear infinitely often there must only be finitely many numbers + which appear more than $k$ times. Let the largest such number be + $l\geq k$. From here on we call an integer $x$ big if $x>l$, medium + if $l\geq x>k$ and small if $x\leq k$. To summarise, each small + number appears infinitely many times in the sequence, while each big + number appears at most $k$ times in the sequence. + + + Choose a large enough $N^{\prime}>2N$ such that $s_{N^{\prime}}$ + is small, and in $s_{1},\ldots,s_{N^{\prime}}$ : + \begin{enumerate} + \item every medium number has already made all of its appearances; + \item every small number has made more than $\max(k,N)$ appearances. + \end{enumerate} + Since every small number has appeared more than $k$ times, past this + point each small number must be followed by a big number. Also, by + definition each big number appears at most $k$ times, so it must + be followed by a small number. Hence the sequence alternates between + big and small numbers after $s_{N^{\prime}}$. + + + \textbf{Lemma 1. }Let $g$ be a big number that appears after $s_{N^{\prime}}$. + If $g$ is followed by the small number $h$, then $h$ equals the + amount of small numbers which have appeared at least $g$ times before + that point. + + + \emph{Proof. }By the definition of $N^{\prime}$, the small number + immediately preceding $g$ has appeared more than $\max(k,2N)$ times, + so $g>\max(k,2N)$. And since $g>2N$, the $g^{\text{th }}$ appearance + of every small number must occur after $s_{2N}$ and hence is followed + by $g$. Since there are $k$ small numbers and $g$ appears at most + $k$ times, $g$ must appear exactly $k$ times, always following + a small number after $s_{2N}$. Hence on the $h^{\text{th }}$ appearance + of $g$, exactly $h$ small numbers have appeared at least $g$ times + before that point. + + + Denote by $s_{[i,j]}$ the subsequence $s_{i},s_{i+1},\ldots,s_{j}$. + + + \textbf{Lemma 2. }Suppose that $i$ and $j$ satisfy the following + conditions: + + (a) $j>i>N^{\prime}+2$, + + (b) $s_{i}$ is small and $s_{i}=s_{j}$, + + (c) no small value appears more than once in $s_{[i,j-1]}$. + + Then $s_{i-2}$ is equal to some small number in $s_{[i,j-1]}$. + + + \emph{Proof. }Let $\mathcal{I}$ be the set of small numbers that + appear at least $s_{i-1}$ times in $s_{[1,i-1]}$. By Lemma 1, $s_{i}=|\mathcal{I}|$. + Similarly, let $\mathcal{J}$ be the set of small numbers that appear + at least $s_{j-1}$ times in $s_{[1,j-1]}$. Then by Lemma $1,s_{j}=|\mathcal{J}|$ + and hence by (b), $|\mathcal{I}|=|\mathcal{J}|$. Also by definition, + $s_{i-2}\in\mathcal{I}$ and $s_{j-2}\in\mathcal{J}$. + + + Suppose the small number $s_{j-2}$ is not in $\mathcal{I}$. This + means $s_{j-2}$ has appeared less than $s_{i-1}$ times in $s_{[1,i-1]}$. + By (c), $s_{j-2}$ has appeared at most $s_{i-1}$ times in $s_{[1,j-1]}$, + hence $s_{j-1}\leq s_{i-1}$. Combining with $s_{[1,i-1]}\subset s_{[1,j-1]}$, + this implies $\mathcal{I}\subseteq\mathcal{J}$. But since $s_{j-2}\in\mathcal{J}\backslash\mathcal{I}$, + this contradicts $|\mathcal{I}|=|\mathcal{J}|$. So $s_{j-2}\in\mathcal{I}$, + which means it has appeared at least $s_{i-1}$ times in $s_{[1,i-1]}$ + and one more time in $s_{[i,j-1]}$. Therefore $s_{j-1}>s_{i-1}$. + + + By (c), any small number appearing at least $s_{j-1}$ times in $s_{[1,j-1]}$ + has also appeared $s_{j-1}-1\geq$ $s_{i-1}$ times in $s_{[1,i-1]}$. + So $\mathcal{J}\subseteq\mathcal{I}$ and hence $\mathcal{I}=\mathcal{J}$. + Therefore, $s_{i-2}\in\mathcal{J}$, so it must appear at least $s_{j-1}-s_{i-1}=1$ + more time in $s_{[i,j-1]}$. + + + For each small number $s_{n}$ with $n>N^{\prime}+2$, let $p_{n}$ + be the smallest number such that $s_{n+p_{n}}=s_{i}$ is also small + for some $i$ with $n\leq in$, + Lemma 2 (with $j=n+p_{n}$ ) implies that $s_{i-2}$ appears again + before $s_{n+p_{n}}$, contradicting the minimality of $p_{n}$. So + $i=n$. Lemma 2 also implies that $p_{n}\geq p_{n-2}$. So $p_{n},p_{n+2},p_{n+4},\ldots$ + is a nondecreasing sequence bounded above by $2k$ (as there are only + $k$ small numbers). Therefore, $p_{n},p_{n+2},p_{n+4},\ldots$ is + eventually constant and the subsequence of small numbers is eventually + periodic with period at most $k$. +IMO_PROOF_bab2042480f4bd37783dbf3bd3a08d452eb37628a83f86995a27a7b7f1bdbfa8 diff --git a/tasks/pb-advanced-021/task.toml b/tasks/pb-advanced-021/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..352ec842c8f0e5ea3b7361bdb3551c7cc0cf2ad0 --- /dev/null +++ b/tasks/pb-advanced-021/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-021" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-021" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-021/tests/grade_task.py b/tasks/pb-advanced-021/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-021/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-021/tests/reference.json b/tasks/pb-advanced-021/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..eba8665b53814be721c65955d838b47938d39c36 --- /dev/null +++ b/tasks/pb-advanced-021/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Infinitely many boys and girls stand in a line alternatingly. For\n a given positive integer $N$, they choose positive integers according\n to the following rules:\n\n (1) The first $N$ people in the line choose any positive integers\n they want.\n\n (2) For each $m>N$, the $m$-th person chooses the number that is\n one more than the number of appearances of the number chosen by the\n $(m-1)$-th person appears among the numbers chosen by the first $m-2$\n people.\n\n Let $b_{i}$ be the number chosen by the $i$-th boy, and $g_{i}$\n be the number chosen by the $i$-th girl. Prove that at least one\n of the following holds:\n\n (i) There exists a sufficiently large integer $M$ such that $\\{b_{n}\\}_{n\\ge M}$\n is a periodic sequence.\n\n (ii) There exists a sufficiently large integer $M$ such that $\\{g_{n}\\}_{n\\ge M}$\n is a periodic sequence.", + "solution": "Let $N$ be the given positive integer. Let $s_{m}$ be the number\n chosen by the $m$-th person in the line. For $m\\ge N+1$, $s_{m}$\n is one more than the number of appearances of $s_{m-1}$ in the sequence\n $s_{1},s_{2},\\dots,s_{m-2}$. Let $b_{i}=s_{2i-1}$ be the number\n chosen by the $i$-th boy, and $g_{i}=s_{2i}$ be the number chosen\n by the $i$-th girl. We want to show that at least one of the sequences\n $\\{b_{n}\\}_{n\\ge M}$ or $\\{g_{n}\\}_{n\\ge M}$ is periodic for some\n sufficiently large integer $M$.\n\n\n Let $M>\\max\\left(s_{1},\\ldots,s_{2N}\\right)$. We first prove that\n some integer appears infinitely many times. If not, then the sequence\n contains arbitrarily large integers. The first time each integer larger\n than $M$ appears, it is followed by a 1 . So 1 appears infinitely\n many times, which is a contradiction.\n\n\n Now we prove that every integer $x\\geq M$ appears at most $M-1$\n times. If not, consider the first time that any $x\\geq M$ appears\n for the $M^{\\text{th }}$ time. Up to this point, each appearance\n of $x$ is preceded by an integer which has appeared $x\\geq M$ times.\n So there must have been at least $M$ numbers that have already appeared\n at least $M$ times before $x$ does, which is a contradiction.\n\n\n Thus there are only finitely many numbers that appear infinitely many\n times. Let the largest of these be $k$. Since $k$ appears infinitely\n many times there must be infinitely many integers greater than $M$\n which appear at least $k$ times in the sequence, so each integer\n $1,2,\\ldots,k-1$ also appears infinitely many times. Since $k+1$\n doesn't appear infinitely often there must only be finitely many numbers\n which appear more than $k$ times. Let the largest such number be\n $l\\geq k$. From here on we call an integer $x$ big if $x>l$, medium\n if $l\\geq x>k$ and small if $x\\leq k$. To summarise, each small\n number appears infinitely many times in the sequence, while each big\n number appears at most $k$ times in the sequence.\n\n\n Choose a large enough $N^{\\prime}>2N$ such that $s_{N^{\\prime}}$\n is small, and in $s_{1},\\ldots,s_{N^{\\prime}}$ :\n \\begin{enumerate}\n \\item every medium number has already made all of its appearances;\n \\item every small number has made more than $\\max(k,N)$ appearances.\n \\end{enumerate}\n Since every small number has appeared more than $k$ times, past this\n point each small number must be followed by a big number. Also, by\n definition each big number appears at most $k$ times, so it must\n be followed by a small number. Hence the sequence alternates between\n big and small numbers after $s_{N^{\\prime}}$.\n\n\n \\textbf{Lemma 1. }Let $g$ be a big number that appears after $s_{N^{\\prime}}$.\n If $g$ is followed by the small number $h$, then $h$ equals the\n amount of small numbers which have appeared at least $g$ times before\n that point.\n\n\n \\emph{Proof. }By the definition of $N^{\\prime}$, the small number\n immediately preceding $g$ has appeared more than $\\max(k,2N)$ times,\n so $g>\\max(k,2N)$. And since $g>2N$, the $g^{\\text{th }}$ appearance\n of every small number must occur after $s_{2N}$ and hence is followed\n by $g$. Since there are $k$ small numbers and $g$ appears at most\n $k$ times, $g$ must appear exactly $k$ times, always following\n a small number after $s_{2N}$. Hence on the $h^{\\text{th }}$ appearance\n of $g$, exactly $h$ small numbers have appeared at least $g$ times\n before that point.\n\n\n Denote by $s_{[i,j]}$ the subsequence $s_{i},s_{i+1},\\ldots,s_{j}$.\n\n\n \\textbf{Lemma 2. }Suppose that $i$ and $j$ satisfy the following\n conditions:\n\n (a) $j>i>N^{\\prime}+2$,\n\n (b) $s_{i}$ is small and $s_{i}=s_{j}$,\n\n (c) no small value appears more than once in $s_{[i,j-1]}$.\n\n Then $s_{i-2}$ is equal to some small number in $s_{[i,j-1]}$.\n\n\n \\emph{Proof. }Let $\\mathcal{I}$ be the set of small numbers that\n appear at least $s_{i-1}$ times in $s_{[1,i-1]}$. By Lemma 1, $s_{i}=|\\mathcal{I}|$.\n Similarly, let $\\mathcal{J}$ be the set of small numbers that appear\n at least $s_{j-1}$ times in $s_{[1,j-1]}$. Then by Lemma $1,s_{j}=|\\mathcal{J}|$\n and hence by (b), $|\\mathcal{I}|=|\\mathcal{J}|$. Also by definition,\n $s_{i-2}\\in\\mathcal{I}$ and $s_{j-2}\\in\\mathcal{J}$.\n\n\n Suppose the small number $s_{j-2}$ is not in $\\mathcal{I}$. This\n means $s_{j-2}$ has appeared less than $s_{i-1}$ times in $s_{[1,i-1]}$.\n By (c), $s_{j-2}$ has appeared at most $s_{i-1}$ times in $s_{[1,j-1]}$,\n hence $s_{j-1}\\leq s_{i-1}$. Combining with $s_{[1,i-1]}\\subset s_{[1,j-1]}$,\n this implies $\\mathcal{I}\\subseteq\\mathcal{J}$. But since $s_{j-2}\\in\\mathcal{J}\\backslash\\mathcal{I}$,\n this contradicts $|\\mathcal{I}|=|\\mathcal{J}|$. So $s_{j-2}\\in\\mathcal{I}$,\n which means it has appeared at least $s_{i-1}$ times in $s_{[1,i-1]}$\n and one more time in $s_{[i,j-1]}$. Therefore $s_{j-1}>s_{i-1}$.\n\n\n By (c), any small number appearing at least $s_{j-1}$ times in $s_{[1,j-1]}$\n has also appeared $s_{j-1}-1\\geq$ $s_{i-1}$ times in $s_{[1,i-1]}$.\n So $\\mathcal{J}\\subseteq\\mathcal{I}$ and hence $\\mathcal{I}=\\mathcal{J}$.\n Therefore, $s_{i-2}\\in\\mathcal{J}$, so it must appear at least $s_{j-1}-s_{i-1}=1$\n more time in $s_{[i,j-1]}$.\n\n\n For each small number $s_{n}$ with $n>N^{\\prime}+2$, let $p_{n}$\n be the smallest number such that $s_{n+p_{n}}=s_{i}$ is also small\n for some $i$ with $n\\leq in$,\n Lemma 2 (with $j=n+p_{n}$ ) implies that $s_{i-2}$ appears again\n before $s_{n+p_{n}}$, contradicting the minimality of $p_{n}$. So\n $i=n$. Lemma 2 also implies that $p_{n}\\geq p_{n-2}$. So $p_{n},p_{n+2},p_{n+4},\\ldots$\n is a nondecreasing sequence bounded above by $2k$ (as there are only\n $k$ small numbers). Therefore, $p_{n},p_{n+2},p_{n+4},\\ldots$ is\n eventually constant and the subsequence of small numbers is eventually\n periodic with period at most $k$.", + "grading_guidelines": "(Partial)\n 1. Proved that there are only finitely many integers that appear infinitely many times in $\\{b_{n}\\}\\cup\\{g_{n}\\}$.\n 2. Came up with multiple observations that may lead to the proof, but failed to rigorously combine them.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Advanced-021", + "level": "advanced", + "category": "Combinatorics", + "source": "(Modified) IMO 2024 P3", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": " " +} diff --git a/tasks/pb-advanced-021/tests/test.sh b/tasks/pb-advanced-021/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-021/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-022/instruction.md b/tasks/pb-advanced-022/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..518df630a5cf7a24725d39b8900ed3f84e9588d6 --- /dev/null +++ b/tasks/pb-advanced-022/instruction.md @@ -0,0 +1,16 @@ +# PB-Advanced-022 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Given a triangle $ABC$ with $AB "$PROOF" <<'IMO_PROOF_0a597d454cf179de26e43b26798893625fccc681f9625e0eeca7bea4793a4bcd' +Let $IB'$ intersect $CK$ at $Q$. + + + \textbf{Claim. }Triangle $CB'Q$ is similar to $\triangle AIB$ (and + $Q$ lies on circle $BIC$). + + + \emph{Proof.} Since the tangent at $B'$ to the incircle, distinct + from $BC$, is parallel to $AC$, and $B'I$ bisects the two tangents + from $B'$, + \[ + \angle CB'I=\frac{1}{2}\left(180^{\circ}-\angle ACB\right)=90^{\circ}-\frac{1}{2}\angle ACB. + \] + Using this, we get + \[ + \angle CQB'=\angle CB'I-\angle BCK=90^{\circ}-\frac{1}{2}\angle ACB-\angle BAK=90^{\circ}-\frac{1}{2}(\angle ACB+\angle BAC)=\frac{1}{2}\angle CBA + \] + Which is enough to show $Q$ lies on circle $BIC$. Combining this + with $\angle B'CQ=\angle BCK=$ $\angle BAI$ gives the similarity. + + Note that $K$ is the centre of circle $BIC$ so $K$ is the midpoint + of $CQ$. Since $N$ is the midpoint of $AB$, $K$ and $N$ are similar + points in the two triangles in the Claim so + \[ + \angle KB'C'=\angle KB'C=\angle AIN. + \] + + Similarly $\angle B'C'K=\angle MIA$ so + \[ + \angle MIN+\angle C'KB'=\angle MIA+\angle AIN+\angle C'KB'=\angle B'C'K+\angle KB'C'+\angle C'KB'=180^{\circ}. + \] +IMO_PROOF_0a597d454cf179de26e43b26798893625fccc681f9625e0eeca7bea4793a4bcd diff --git a/tasks/pb-advanced-022/task.toml b/tasks/pb-advanced-022/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..390c0b27fce7d93e95ad9ab7426ba6af7e54bdbe --- /dev/null +++ b/tasks/pb-advanced-022/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-022" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-022" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-022/tests/grade_task.py b/tasks/pb-advanced-022/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-022/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-022/tests/reference.json b/tasks/pb-advanced-022/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..cd99132f68208d8b4b2d5609887f8c3ac41efd20 --- /dev/null +++ b/tasks/pb-advanced-022/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Given a triangle $ABC$ with $AB "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-023/instruction.md b/tasks/pb-advanced-023/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..aed2cc7ff9067fcaa41dacf12292a65e17180dbf --- /dev/null +++ b/tasks/pb-advanced-023/instruction.md @@ -0,0 +1,7 @@ +# PB-Advanced-023 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +On a table of size $3002\times3001$, a stone is placed on the leftmost cell of the first row. James and Peter play a game on this table. Peter selects $3000$ cells, under the rule that he must choose one from each row except the first and last rows (i.e., the $1$st and $3002$th row), and there must be at most one selected cell in each column. James knows this rule too, but he doesn't know which cells Peter selected. The goal of James is to move the stone to the last row, avoiding the cells selected by Peter. The stone can only move to adjacent cells on the table. If the stone enters a cell selected by Peter, James receives a penalty of 1 point, and the stone returns to its initial position (i.e., the leftmost cell). Find the smallest positive integer $n$ such that there exists a method for James to achieve his goal before receiving a penalty of $n$ points. diff --git a/tasks/pb-advanced-023/solution/solve.sh b/tasks/pb-advanced-023/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..2598c67447fe40fa81bee8b34ab9eebbbd0aa2d8 --- /dev/null +++ b/tasks/pb-advanced-023/solution/solve.sh @@ -0,0 +1,91 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_85a806a07732e4e9e083622a5d1b7d0c78c4ce01581f1d31da5153e08d1db0f8' +First we demonstrate that there is no winning strategy if James has + 2 attempts. + + + Suppose that $(2,i)$ is the first cell in the second row that James + reaches on his first attempt. Peter could have selected this cell, + in which case James receives a penalty and returns to the initial + position, and he cannot have reached any other cells past the first + row. + + + Next, suppose that $(3,j)$ is the first cell in the third row that + James reaches on his second attempt. James must have moved to this + cell from $(2,j)$, so we know $j\neq i$. So it is possible that + Peter selected the cell $(3,j)$, in which case James also receives + a penalty and returns to the initial position on his second attempt. + Therefore James cannot guarantee to reach the last row in 2 attempts. + + + Next, we exhibit a strategy for $n=3$. On the first attempt, James + travels along the path + + \[ + (1,1)\rightarrow(2,1)\rightarrow(2,2)\rightarrow\cdots\rightarrow(2,3001). + \] + + This path meets every cell in the second row, so James will find the + selected cell in row 2, receive a penalty, and return to the initial + position. + + + If the selected cell in the second row is not on the edge of the board + (that is, it is in cell $(2,i)$ with $2\leq i\leq3000$ ), then James + takes the following two paths in his second and third attempts: + + \[ + \begin{aligned} & (1,1)\rightarrow\dots\rightarrow(1,i-1)\rightarrow(2,i-1)\rightarrow(3,i-1)\rightarrow(3,i)\rightarrow(4,i)\rightarrow\cdots\rightarrow(3002,i). + + & (1,1)\rightarrow\dots\rightarrow(1,i+1)\rightarrow(2,i+1)\rightarrow(3,i+1)\rightarrow(3,i)\rightarrow(4,i)\rightarrow\cdots\rightarrow(3002,i). + \end{aligned} + \] + + The only cells that Peter might have selected in either of these paths + are $(3,i-1)$ and $(3,i+1)$. At most one of these can have been + selected by Peter, so at least one of the two paths will be successful. + James starts each path from the initial position $(1,1)$, but he + knows where the selected cell in row 2 is, so he can navigate to $(1,i-1)$ + or $(1,i+1)$ directly. + + + If the selected cell in the second row is on the edge of the board, + without loss of generality we may assume it is in $(2,1)$. Then, + on the second attempt, James takes the following path: + + \[ + (1,1)\rightarrow(1,2)\rightarrow(2,2)\rightarrow(2,3)\rightarrow(3,3)\rightarrow\cdots\rightarrow(3000,3001)\rightarrow(3001,3001)\rightarrow(3002,3001). + \] + + If none of the cells on this path were selected by Peter, then James + wins. Otherwise, let $(i,j)$ be the first cell on which James encounters + a selected cell. We have that $j=i$ or $j=i+1$. Then, on the third + attempt, James takes the following path: + + \[ + \begin{aligned}(1,1)\rightarrow\dots\rightarrow(1,2) & \rightarrow(2,2)\rightarrow(2,3)\rightarrow(3,3)\rightarrow\cdots\rightarrow(i-2,i-1)\rightarrow(i-1,i-1) + + & \rightarrow(i,i-1)\rightarrow(i,i-2)\rightarrow\cdots\rightarrow(i,2)\rightarrow(i,1) + + & \rightarrow(i+1,1)\rightarrow\cdots\rightarrow(3001,1)\rightarrow(3002,1). + \end{aligned} + \] + + Now note that: + \begin{itemize} + \item The cells from $(1,2)$ to $(i-1,i-1)$ were not selected because + they were reached earlier than $(i,j)$ on the previous attempt. + \item The cells $(i,k)$ for $1\leq k\leq i-1$ were not selected because + there is only one selected cell in row $i$, and it lies in $(i,i)$ + or $(i,i+1)$. + \item The cells $(k,1)$ for $i\leq k\leq3002$ were not selected because + Peter selected at most one cell in column 1 (since there is one selected + cell per row from 2 to 3001), and it lies in $(2,1)$. + \end{itemize} + Therefore James will win on the third attempt. Therefore, the smallest + positive integer $n$ is $3$. +IMO_PROOF_85a806a07732e4e9e083622a5d1b7d0c78c4ce01581f1d31da5153e08d1db0f8 diff --git a/tasks/pb-advanced-023/task.toml b/tasks/pb-advanced-023/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7a6329b668dcd3cdd06b8354caf7166e85b2c4f0 --- /dev/null +++ b/tasks/pb-advanced-023/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-023" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-023" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-023/tests/grade_task.py b/tasks/pb-advanced-023/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-023/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-023/tests/reference.json b/tasks/pb-advanced-023/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..931f145de5d37d08f3d5955f93c8143cd760ec08 --- /dev/null +++ b/tasks/pb-advanced-023/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "On a table of size $3002\\times3001$, a stone is placed on the leftmost cell of the first row. James and Peter play a game on this table. Peter selects $3000$ cells, under the rule that he must choose one from each row except the first and last rows (i.e., the $1$st and $3002$th row), and there must be at most one selected cell in each column. James knows this rule too, but he doesn't know which cells Peter selected. The goal of James is to move the stone to the last row, avoiding the cells selected by Peter. The stone can only move to adjacent cells on the table. If the stone enters a cell selected by Peter, James receives a penalty of 1 point, and the stone returns to its initial position (i.e., the leftmost cell). Find the smallest positive integer $n$ such that there exists a method for James to achieve his goal before receiving a penalty of $n$ points.", + "solution": "First we demonstrate that there is no winning strategy if James has\n 2 attempts.\n\n\n Suppose that $(2,i)$ is the first cell in the second row that James\n reaches on his first attempt. Peter could have selected this cell,\n in which case James receives a penalty and returns to the initial\n position, and he cannot have reached any other cells past the first\n row.\n\n\n Next, suppose that $(3,j)$ is the first cell in the third row that\n James reaches on his second attempt. James must have moved to this\n cell from $(2,j)$, so we know $j\\neq i$. So it is possible that\n Peter selected the cell $(3,j)$, in which case James also receives\n a penalty and returns to the initial position on his second attempt.\n Therefore James cannot guarantee to reach the last row in 2 attempts.\n\n\n Next, we exhibit a strategy for $n=3$. On the first attempt, James\n travels along the path\n\n \\[\n (1,1)\\rightarrow(2,1)\\rightarrow(2,2)\\rightarrow\\cdots\\rightarrow(2,3001).\n \\]\n\n This path meets every cell in the second row, so James will find the\n selected cell in row 2, receive a penalty, and return to the initial\n position.\n\n\n If the selected cell in the second row is not on the edge of the board\n (that is, it is in cell $(2,i)$ with $2\\leq i\\leq3000$ ), then James\n takes the following two paths in his second and third attempts:\n\n \\[\n \\begin{aligned} & (1,1)\\rightarrow\\dots\\rightarrow(1,i-1)\\rightarrow(2,i-1)\\rightarrow(3,i-1)\\rightarrow(3,i)\\rightarrow(4,i)\\rightarrow\\cdots\\rightarrow(3002,i).\n\n & (1,1)\\rightarrow\\dots\\rightarrow(1,i+1)\\rightarrow(2,i+1)\\rightarrow(3,i+1)\\rightarrow(3,i)\\rightarrow(4,i)\\rightarrow\\cdots\\rightarrow(3002,i).\n \\end{aligned}\n \\]\n\n The only cells that Peter might have selected in either of these paths\n are $(3,i-1)$ and $(3,i+1)$. At most one of these can have been\n selected by Peter, so at least one of the two paths will be successful.\n James starts each path from the initial position $(1,1)$, but he\n knows where the selected cell in row 2 is, so he can navigate to $(1,i-1)$\n or $(1,i+1)$ directly.\n\n\n If the selected cell in the second row is on the edge of the board,\n without loss of generality we may assume it is in $(2,1)$. Then,\n on the second attempt, James takes the following path:\n\n \\[\n (1,1)\\rightarrow(1,2)\\rightarrow(2,2)\\rightarrow(2,3)\\rightarrow(3,3)\\rightarrow\\cdots\\rightarrow(3000,3001)\\rightarrow(3001,3001)\\rightarrow(3002,3001).\n \\]\n\n If none of the cells on this path were selected by Peter, then James\n wins. Otherwise, let $(i,j)$ be the first cell on which James encounters\n a selected cell. We have that $j=i$ or $j=i+1$. Then, on the third\n attempt, James takes the following path:\n\n \\[\n \\begin{aligned}(1,1)\\rightarrow\\dots\\rightarrow(1,2) & \\rightarrow(2,2)\\rightarrow(2,3)\\rightarrow(3,3)\\rightarrow\\cdots\\rightarrow(i-2,i-1)\\rightarrow(i-1,i-1)\n\n & \\rightarrow(i,i-1)\\rightarrow(i,i-2)\\rightarrow\\cdots\\rightarrow(i,2)\\rightarrow(i,1)\n\n & \\rightarrow(i+1,1)\\rightarrow\\cdots\\rightarrow(3001,1)\\rightarrow(3002,1).\n \\end{aligned}\n \\]\n\n Now note that:\n \\begin{itemize}\n \\item The cells from $(1,2)$ to $(i-1,i-1)$ were not selected because\n they were reached earlier than $(i,j)$ on the previous attempt.\n \\item The cells $(i,k)$ for $1\\leq k\\leq i-1$ were not selected because\n there is only one selected cell in row $i$, and it lies in $(i,i)$\n or $(i,i+1)$.\n \\item The cells $(k,1)$ for $i\\leq k\\leq3002$ were not selected because\n Peter selected at most one cell in column 1 (since there is one selected\n cell per row from 2 to 3001), and it lies in $(2,1)$.\n \\end{itemize}\n Therefore James will win on the third attempt. Therefore, the smallest\n positive integer $n$ is $3$.", + "grading_guidelines": "(Partial)\n 1. Proved that the answer is at least $3$.\n 2. Solved the case where the stone in the second row is not on the edge.\n(Almost)\n 1. Solved the case where the stone in the second row is on the edge.\n 2. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Advanced-023", + "level": "advanced", + "category": "Combinatorics", + "source": "(Modified) IMO 2024 P5", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "3" +} diff --git a/tasks/pb-advanced-023/tests/test.sh b/tasks/pb-advanced-023/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-023/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-024/instruction.md b/tasks/pb-advanced-024/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4a7fbb754e121466305446c50ccf1784d5181d20 --- /dev/null +++ b/tasks/pb-advanced-024/instruction.md @@ -0,0 +1,14 @@ +# PB-Advanced-024 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $P$ be a function from the set $\mathbb{Q}$ of rational numbers + to itself, and suppose that $P$ satisfies + \[ + (P(b-P(a))+a-P(b))(P(a+P(b-P(a)))-b)=0 + \] + for all rational numbers $a,b$. Prove that the set $\{P(a)+P(-a):a\in\mathbb{Q}\}$ + is a finite set, and find the maximum possible number of elements + in this set. diff --git a/tasks/pb-advanced-024/solution/solve.sh b/tasks/pb-advanced-024/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c68fa0a8376f65b041b26b5cc5a6392cd0f8e194 --- /dev/null +++ b/tasks/pb-advanced-024/solution/solve.sh @@ -0,0 +1,199 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_ee26824c2fbdd520a241050f4f2c64110513c538335c68aa59eb264b20a8fdca' +Let the given condition be + \[ + (P(b-P(a))+a-P(b))(P(a+P(b-P(a)))-b)=0\quad(*) + \] + for all $a,b\in\mathbb{Q}$. Let $y=b-P(a)$. Then $b=y+P(a)$. Substituting + this into $(*)$, we get + \[ + (P(y)+a-P(y+P(a)))(P(a+P(y))-(y+P(a)))=0. + \] + This must hold for all $a\in\mathbb{Q}$ and all $y$ in the image + of $b\mapsto b-P(a)$. Since $b$ can be any rational number, $y$ + can be any rational number (assuming $P(a)\in\mathbb{Q}$). Thus, + for all $a,y\in\mathbb{Q}$, we have + \[ + P(y+P(a))=P(y)+a\quad\text{or}\quad P(a+P(y))=y+P(a). + \] + Let's rewrite this by swapping variable names $a\to y$ and $y\to x$: + For all $x,y\in\mathbb{Q}$, + \[ + P(x+P(y))=P(x)+y\quad\text{or}\quad P(P(x)+y)=x+P(y).\quad(**) + \] + We want to find the maximum possible number of elements in the set + $S=\{P(a)+P(-a):a\in\mathbb{Q}\}$. Let $g(a)=P(a)+P(-a)$. We want + to find the maximum possible size of the image of $g$. + + + We begin by providing an example of a function $P$ for which there + are two values of $g(a)$. We take the function $P(x)=2\lfloor x\rfloor-x=\lfloor x\rfloor-\{x\}$. + First, we show that $P$ satisfies $(**)$. Given $x,y\in\mathbb{Q}$, + writing $f$ instead of $P$: If $\{x\}<\{y\}$, then $f(f(x)+y)=x+f(y)$. + This is the second case of $(**)$. If $\{x\}>\{y\}$, then $f(x+f(y))=f(x)+y$. + This is the first case of $(**)$. If $\{x\}=\{y\}$, then $f(x)+y=x+f(y)=N$ + (an integer). $f(N)=N$. So $f(x+f(y))=f(N)=N=f(x)+y$ and $f(f(x)+y)=f(N)=N=x+f(y)$. + Both cases of $(**)$ hold. In all cases, the relation $(**)$ is + satisfied, which is equivalent to the original condition $(*)$. + + + Finally, we compute $g(a)=P(a)+P(-a)$ for this function. $g(a)=(2\lfloor a\rfloor-a)+(2\lfloor-a\rfloor-(-a))=2(\lfloor a\rfloor+\lfloor-a\rfloor)$. + If $a$ is an integer, $\lfloor a\rfloor=a$ and $\lfloor-a\rfloor=-a$, + so $g(a)=2(a-a)=0$. If $a$ is not an integer, $\lfloor-a\rfloor=-\lfloor a\rfloor-1$, + so $g(a)=2(\lfloor a\rfloor-\lfloor a\rfloor-1)=-2$. The set of values + for $g(a)$ is $\{0,-2\}$. There are two values for $g(a)$. + + Now, we prove that there cannot be more than two values of $g(a).$ + Applying $(**)$ with $y=x$ tells us that $P(x+P(x))=P(x)+x$ or + $P(P(x)+x)=x+P(x)$. In either case, if we let $z=x+P(x)$, then $P(z)=z$. + So + \[ + P(x+P(x))=x+P(x)\qquad\tag{(1)} + \] + for all $x\in\mathbb{Q}$. + + + We begin with the following lemma. + + + \textbf{Lemma 1.} $P$ is a bijection, and satisfies + \[ + P(-P(-x))=x\qquad\tag{(2)} + \] + + \emph{Proof.} We first prove that $P$ is injective. Suppose that + $P(x_{1})=P(x_{2})=Y$. The condition $(**)$ applied to $(x_{1},x_{2})$ + gives $P(x_{1}+P(x_{2}))=P(x_{1})+x_{2}$ or $P(P(x_{1})+x_{2})=x_{1}+P(x_{2})$. + Substituting $P(x_{1})=P(x_{2})=Y$, this becomes $P(x_{1}+Y)=Y+x_{2}$ + or $P(Y+x_{2})=x_{1}+Y$. + + From (1), we know $P(x_{1}+P(x_{1}))=x_{1}+P(x_{1})$, i.e., $P(x_{1}+Y)=x_{1}+Y$. + Also from (1), $P(x_{2}+P(x_{2}))=x_{2}+P(x_{2})$, i.e., $P(x_{2}+Y)=x_{2}+Y$. + + Case A: $P(x_{1}+Y)=Y+x_{2}$ holds. Using $P(x_{1}+Y)=x_{1}+Y$, + we get $x_{1}+Y=Y+x_{2}$, which implies $x_{1}=x_{2}$. + + Case B: $P(Y+x_{2})=x_{1}+Y$ holds. Using $P(x_{2}+Y)=x_{2}+Y$, + we get $x_{2}+Y=x_{1}+Y$, which implies $x_{1}=x_{2}$. + + In both cases, $x_{1}=x_{2}$. So $P$ is injective. + + + Now, (1) with $x=0$ tells us that $P(0+P(0))=0+P(0)$, so $P(P(0))=P(0)$. + By injectivity, $P(0)=0$. + + Let $C(x,y)$: $P(x+P(y))=P(x)+y$ or $P(P(x)+y)=x+P(y)$. + + $C(x,-P(x))$: $P(x+P(-P(x)))=P(x)-P(x)=0$ or $P(P(x)-P(x))=x+P(-P(x))$. + + Case 1: $P(x+P(-P(x)))=0$. Since $P(0)=0$ and $P$ is injective, + $x+P(-P(x))=0$, so $P(-P(x))=-x$. + + Case 2: $P(0)=x+P(-P(x))$. Since $P(0)=0$, this gives $0=x+P(-P(x))$, + so $P(-P(x))=-x$. + + Both options yield $P(-P(x))=-x$. Replace $x$ with $-x$: $P(-P(-x))=-(-x)=x$. + This proves (2). + + + Finally, bijectivity follows immediately from (2). $P$ is injective. + For any $y\in\mathbb{Q}$, let $x=-P(-y)$. Then $P(x)=P(-P(-y))=y$. + So $P$ is surjective. + + + Since $P$ is bijective, it has an inverse, which we denote $P^{-1}$. + From (2), $P(-P(-x))=x$. Let $z=-P(-x)$. Then $P(z)=x$, so $z=P^{-1}(x)$. + Thus, $P^{-1}(x)=-P(-x)$. Rearranging gives $P(-x)=-P^{-1}(x)$. + We have $g(x)=P(x)+P(-x)=P(x)-P^{-1}(x)$. + + Suppose $g(x)=u$ and $g(y)=v$, where $u\neq v$ are both nonzero. + Define $x^{\prime}=P^{-1}(x)$ and $y^{\prime}=P^{-1}(y)$. By definition, + $P(x')=x$ and $P(y')=y$. We have $g(x)=P(x)-P^{-1}(x)=P(x)-x'=u$, + so $P(x)=x'+u$. Similarly, + \[ + g(y)=P(y)-P^{-1}(y)=P(y)-y'=v, + \] + so $P(y)=y'+v$. + + + Apply $(**)$ to $(x',y)$: + + \[ + P(x'+P(y))=P(x')+y\text{ or }P(P(x')+y)=x'+P(y). + \] + $P(x'+y'+v)=x+y$ or $P(x+y)=x'+y'+v$. (Let $A=x+y,B=x'+y'+v$. $P(B)=A$ + or $P(A)=B$.) + + + + Apply $(**)$ to $(x,y')$: + \[ + P(x+P(y'))=P(x)+y'\text{ or }P(P(x)+y')=x+P(y'). + \] + $P(x+y)=P(x)+y'=(x'+u)+y'$ or $P(x'+u+y')=x+y$. (Let $C=x'+y'+u$. + $P(A)=C$ or $P(C)=A$.) + + + We have the possibilities: + + (1a) $P(B)=A$ and (2a) $P(A)=C$. + + (1a) $P(B)=A$ and (2b) $P(C)=A$. Since $P$ is injective, $B=C$, + so $x'+y'+v=x'+y'+u$, which implies $u=v$. Contradiction. + + (1b) $P(A)=B$ and (2a) $P(A)=C$. Since $P(A)$ must be unique, $B=C$, + which implies $u=v$. Contradiction. + + (1b) $P(A)=B$ and (2b) $P(C)=A$. + + So we must have either ($P(B)=A$ and $P(A)=C$) or ($P(A)=B$ and + $P(C)=A$). + + + Case 1: $P(x'+y'+v)=x+y$ and $P(x+y)=x'+y'+u$. + + Case 2: $P(x+y)=x'+y'+v$ and $P(x'+y'+u)=x+y$. + + + Swapping $(x,u)$ with $(y,v)$ transforms Case 1 into Case 2 structure + and vice versa. So, without loss of generality, assume Case 2 holds: + $P(x+y)=x'+y'+v$ and $P(x'+y'+u)=x+y$. + + + Now consider $(**)$ applied to $(x+y,-x'-u)$. Let $A=x+y$ and $Z=-x'-u$. + Using $P(-z)=-P^{-1}(z)$, we have $P(-x'-u)=-P^{-1}(x'+u)$. From + $P(x)=x'+u$ we have $x=P^{-1}(x'+u)$. Therefore, $P(Z)=P(-x'-u)=-x$. + + Now $C(A,Z)$ gives: $P(A+P(Z))=P(A)+Z$ or $P(P(A)+Z)=A+P(Z)$. Substitute + $A=x+y$, $Z=-x'-u$, $P(Z)=-x$. And $P(A)=P(x+y)=x'+y'+v$ (using + Case 2). + + + Option 1: $P((x+y)+(-x))=P(x+y)+(-x'-u)$. $P(y)=(x'+y'+v)-x'-u=y'+v-u$. + + Option 2: $P(P(x+y)+Z)=A+P(Z)$. $P((x'+y'+v)+(-x'-u))=(x+y)+(-x)$. + $P(y'+v-u)=y$. + + + So we have $P(y)=y'+v-u$ or $P(y'+v-u)=y$. This means $y'+v-u$ + must be either $P(y)$ or $P^{-1}(y)$. We know $P(y)=y'+v$ and $P^{-1}(y)=y'$. + If $y'+v-u=P(y)=y'+v$, then $v-u=v$, which means $u=0$. This contradicts + our assumption $u\neq0$. If $y'+v-u=P^{-1}(y)=y'$, then $v-u=0$, + which means $u=v$. This contradicts our assumption $u\neq v$. + + + Both possibilities lead to a contradiction. Therefore, the initial + assumption that there exist distinct non-zero values $u,v$ for $g(x)$ + must be false. The set $S=\{g(a):a\in\mathbb{Q}\}$ can contain $g(0)=P(0)+P(0)=0$. + It can contain at most one non-zero value $u$. Thus, the set $S$ + must be a subset of $\{0,u\}$ for some $u\in\mathbb{Q}$. The maximum + possible number of elements in $S$ is $2$. + + + Since we found an example where the set of values is $\{0,-2\}$, + which has 2 elements, the maximum possible number of elements is exactly + 2. +IMO_PROOF_ee26824c2fbdd520a241050f4f2c64110513c538335c68aa59eb264b20a8fdca diff --git a/tasks/pb-advanced-024/task.toml b/tasks/pb-advanced-024/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bcb9e99e39d13bc70cd58f22c762ddc2469e402f --- /dev/null +++ b/tasks/pb-advanced-024/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-024" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-024" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-024/tests/grade_task.py b/tasks/pb-advanced-024/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-024/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-024/tests/reference.json b/tasks/pb-advanced-024/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..1b70dc74339fdaa09c6cf0f801e4ad1a1f5c3b32 --- /dev/null +++ b/tasks/pb-advanced-024/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $P$ be a function from the set $\\mathbb{Q}$ of rational numbers\n to itself, and suppose that $P$ satisfies\n \\[\n (P(b-P(a))+a-P(b))(P(a+P(b-P(a)))-b)=0\n \\]\n for all rational numbers $a,b$. Prove that the set $\\{P(a)+P(-a):a\\in\\mathbb{Q}\\}$\n is a finite set, and find the maximum possible number of elements\n in this set.", + "solution": "Let the given condition be\n \\[\n (P(b-P(a))+a-P(b))(P(a+P(b-P(a)))-b)=0\\quad(*)\n \\]\n for all $a,b\\in\\mathbb{Q}$. Let $y=b-P(a)$. Then $b=y+P(a)$. Substituting\n this into $(*)$, we get\n \\[\n (P(y)+a-P(y+P(a)))(P(a+P(y))-(y+P(a)))=0.\n \\]\n This must hold for all $a\\in\\mathbb{Q}$ and all $y$ in the image\n of $b\\mapsto b-P(a)$. Since $b$ can be any rational number, $y$\n can be any rational number (assuming $P(a)\\in\\mathbb{Q}$). Thus,\n for all $a,y\\in\\mathbb{Q}$, we have\n \\[\n P(y+P(a))=P(y)+a\\quad\\text{or}\\quad P(a+P(y))=y+P(a).\n \\]\n Let's rewrite this by swapping variable names $a\\to y$ and $y\\to x$:\n For all $x,y\\in\\mathbb{Q}$,\n \\[\n P(x+P(y))=P(x)+y\\quad\\text{or}\\quad P(P(x)+y)=x+P(y).\\quad(**)\n \\]\n We want to find the maximum possible number of elements in the set\n $S=\\{P(a)+P(-a):a\\in\\mathbb{Q}\\}$. Let $g(a)=P(a)+P(-a)$. We want\n to find the maximum possible size of the image of $g$.\n\n\n We begin by providing an example of a function $P$ for which there\n are two values of $g(a)$. We take the function $P(x)=2\\lfloor x\\rfloor-x=\\lfloor x\\rfloor-\\{x\\}$.\n First, we show that $P$ satisfies $(**)$. Given $x,y\\in\\mathbb{Q}$,\n writing $f$ instead of $P$: If $\\{x\\}<\\{y\\}$, then $f(f(x)+y)=x+f(y)$.\n This is the second case of $(**)$. If $\\{x\\}>\\{y\\}$, then $f(x+f(y))=f(x)+y$.\n This is the first case of $(**)$. If $\\{x\\}=\\{y\\}$, then $f(x)+y=x+f(y)=N$\n (an integer). $f(N)=N$. So $f(x+f(y))=f(N)=N=f(x)+y$ and $f(f(x)+y)=f(N)=N=x+f(y)$.\n Both cases of $(**)$ hold. In all cases, the relation $(**)$ is\n satisfied, which is equivalent to the original condition $(*)$.\n\n\n Finally, we compute $g(a)=P(a)+P(-a)$ for this function. $g(a)=(2\\lfloor a\\rfloor-a)+(2\\lfloor-a\\rfloor-(-a))=2(\\lfloor a\\rfloor+\\lfloor-a\\rfloor)$.\n If $a$ is an integer, $\\lfloor a\\rfloor=a$ and $\\lfloor-a\\rfloor=-a$,\n so $g(a)=2(a-a)=0$. If $a$ is not an integer, $\\lfloor-a\\rfloor=-\\lfloor a\\rfloor-1$,\n so $g(a)=2(\\lfloor a\\rfloor-\\lfloor a\\rfloor-1)=-2$. The set of values\n for $g(a)$ is $\\{0,-2\\}$. There are two values for $g(a)$.\n\n Now, we prove that there cannot be more than two values of $g(a).$\n Applying $(**)$ with $y=x$ tells us that $P(x+P(x))=P(x)+x$ or\n $P(P(x)+x)=x+P(x)$. In either case, if we let $z=x+P(x)$, then $P(z)=z$.\n So\n \\[\n P(x+P(x))=x+P(x)\\qquad\\tag{(1)}\n \\]\n for all $x\\in\\mathbb{Q}$.\n\n\n We begin with the following lemma.\n\n\n \\textbf{Lemma 1.} $P$ is a bijection, and satisfies\n \\[\n P(-P(-x))=x\\qquad\\tag{(2)}\n \\]\n\n \\emph{Proof.} We first prove that $P$ is injective. Suppose that\n $P(x_{1})=P(x_{2})=Y$. The condition $(**)$ applied to $(x_{1},x_{2})$\n gives $P(x_{1}+P(x_{2}))=P(x_{1})+x_{2}$ or $P(P(x_{1})+x_{2})=x_{1}+P(x_{2})$.\n Substituting $P(x_{1})=P(x_{2})=Y$, this becomes $P(x_{1}+Y)=Y+x_{2}$\n or $P(Y+x_{2})=x_{1}+Y$.\n\n From (1), we know $P(x_{1}+P(x_{1}))=x_{1}+P(x_{1})$, i.e., $P(x_{1}+Y)=x_{1}+Y$.\n Also from (1), $P(x_{2}+P(x_{2}))=x_{2}+P(x_{2})$, i.e., $P(x_{2}+Y)=x_{2}+Y$.\n\n Case A: $P(x_{1}+Y)=Y+x_{2}$ holds. Using $P(x_{1}+Y)=x_{1}+Y$,\n we get $x_{1}+Y=Y+x_{2}$, which implies $x_{1}=x_{2}$.\n\n Case B: $P(Y+x_{2})=x_{1}+Y$ holds. Using $P(x_{2}+Y)=x_{2}+Y$,\n we get $x_{2}+Y=x_{1}+Y$, which implies $x_{1}=x_{2}$.\n\n In both cases, $x_{1}=x_{2}$. So $P$ is injective.\n\n\n Now, (1) with $x=0$ tells us that $P(0+P(0))=0+P(0)$, so $P(P(0))=P(0)$.\n By injectivity, $P(0)=0$.\n\n Let $C(x,y)$: $P(x+P(y))=P(x)+y$ or $P(P(x)+y)=x+P(y)$.\n\n $C(x,-P(x))$: $P(x+P(-P(x)))=P(x)-P(x)=0$ or $P(P(x)-P(x))=x+P(-P(x))$.\n\n Case 1: $P(x+P(-P(x)))=0$. Since $P(0)=0$ and $P$ is injective,\n $x+P(-P(x))=0$, so $P(-P(x))=-x$.\n\n Case 2: $P(0)=x+P(-P(x))$. Since $P(0)=0$, this gives $0=x+P(-P(x))$,\n so $P(-P(x))=-x$.\n\n Both options yield $P(-P(x))=-x$. Replace $x$ with $-x$: $P(-P(-x))=-(-x)=x$.\n This proves (2).\n\n\n Finally, bijectivity follows immediately from (2). $P$ is injective.\n For any $y\\in\\mathbb{Q}$, let $x=-P(-y)$. Then $P(x)=P(-P(-y))=y$.\n So $P$ is surjective.\n\n\n Since $P$ is bijective, it has an inverse, which we denote $P^{-1}$.\n From (2), $P(-P(-x))=x$. Let $z=-P(-x)$. Then $P(z)=x$, so $z=P^{-1}(x)$.\n Thus, $P^{-1}(x)=-P(-x)$. Rearranging gives $P(-x)=-P^{-1}(x)$.\n We have $g(x)=P(x)+P(-x)=P(x)-P^{-1}(x)$.\n\n Suppose $g(x)=u$ and $g(y)=v$, where $u\\neq v$ are both nonzero.\n Define $x^{\\prime}=P^{-1}(x)$ and $y^{\\prime}=P^{-1}(y)$. By definition,\n $P(x')=x$ and $P(y')=y$. We have $g(x)=P(x)-P^{-1}(x)=P(x)-x'=u$,\n so $P(x)=x'+u$. Similarly,\n \\[\n g(y)=P(y)-P^{-1}(y)=P(y)-y'=v,\n \\]\n so $P(y)=y'+v$.\n\n\n Apply $(**)$ to $(x',y)$:\n\n \\[\n P(x'+P(y))=P(x')+y\\text{ or }P(P(x')+y)=x'+P(y).\n \\]\n $P(x'+y'+v)=x+y$ or $P(x+y)=x'+y'+v$. (Let $A=x+y,B=x'+y'+v$. $P(B)=A$\n or $P(A)=B$.)\n\n\n\n Apply $(**)$ to $(x,y')$:\n \\[\n P(x+P(y'))=P(x)+y'\\text{ or }P(P(x)+y')=x+P(y').\n \\]\n $P(x+y)=P(x)+y'=(x'+u)+y'$ or $P(x'+u+y')=x+y$. (Let $C=x'+y'+u$.\n $P(A)=C$ or $P(C)=A$.)\n\n\n We have the possibilities:\n\n (1a) $P(B)=A$ and (2a) $P(A)=C$.\n\n (1a) $P(B)=A$ and (2b) $P(C)=A$. Since $P$ is injective, $B=C$,\n so $x'+y'+v=x'+y'+u$, which implies $u=v$. Contradiction.\n\n (1b) $P(A)=B$ and (2a) $P(A)=C$. Since $P(A)$ must be unique, $B=C$,\n which implies $u=v$. Contradiction.\n\n (1b) $P(A)=B$ and (2b) $P(C)=A$.\n\n So we must have either ($P(B)=A$ and $P(A)=C$) or ($P(A)=B$ and\n $P(C)=A$).\n\n\n Case 1: $P(x'+y'+v)=x+y$ and $P(x+y)=x'+y'+u$.\n\n Case 2: $P(x+y)=x'+y'+v$ and $P(x'+y'+u)=x+y$.\n\n\n Swapping $(x,u)$ with $(y,v)$ transforms Case 1 into Case 2 structure\n and vice versa. So, without loss of generality, assume Case 2 holds:\n $P(x+y)=x'+y'+v$ and $P(x'+y'+u)=x+y$.\n\n\n Now consider $(**)$ applied to $(x+y,-x'-u)$. Let $A=x+y$ and $Z=-x'-u$.\n Using $P(-z)=-P^{-1}(z)$, we have $P(-x'-u)=-P^{-1}(x'+u)$. From\n $P(x)=x'+u$ we have $x=P^{-1}(x'+u)$. Therefore, $P(Z)=P(-x'-u)=-x$.\n\n Now $C(A,Z)$ gives: $P(A+P(Z))=P(A)+Z$ or $P(P(A)+Z)=A+P(Z)$. Substitute\n $A=x+y$, $Z=-x'-u$, $P(Z)=-x$. And $P(A)=P(x+y)=x'+y'+v$ (using\n Case 2).\n\n\n Option 1: $P((x+y)+(-x))=P(x+y)+(-x'-u)$. $P(y)=(x'+y'+v)-x'-u=y'+v-u$.\n\n Option 2: $P(P(x+y)+Z)=A+P(Z)$. $P((x'+y'+v)+(-x'-u))=(x+y)+(-x)$.\n $P(y'+v-u)=y$.\n\n\n So we have $P(y)=y'+v-u$ or $P(y'+v-u)=y$. This means $y'+v-u$\n must be either $P(y)$ or $P^{-1}(y)$. We know $P(y)=y'+v$ and $P^{-1}(y)=y'$.\n If $y'+v-u=P(y)=y'+v$, then $v-u=v$, which means $u=0$. This contradicts\n our assumption $u\\neq0$. If $y'+v-u=P^{-1}(y)=y'$, then $v-u=0$,\n which means $u=v$. This contradicts our assumption $u\\neq v$.\n\n\n Both possibilities lead to a contradiction. Therefore, the initial\n assumption that there exist distinct non-zero values $u,v$ for $g(x)$\n must be false. The set $S=\\{g(a):a\\in\\mathbb{Q}\\}$ can contain $g(0)=P(0)+P(0)=0$.\n It can contain at most one non-zero value $u$. Thus, the set $S$\n must be a subset of $\\{0,u\\}$ for some $u\\in\\mathbb{Q}$. The maximum\n possible number of elements in $S$ is $2$.\n\n\n Since we found an example where the set of values is $\\{0,-2\\}$,\n which has 2 elements, the maximum possible number of elements is exactly\n 2.", + "grading_guidelines": "(Partial)\n 1. Correctly guessed all the possible $P$.\n 2. Proved that $P$ is bijective.\n 3. Proved that $P(-P(x))=-x$.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Advanced-024", + "level": "advanced", + "category": "Algebra", + "source": "(Modified) IMO 2024 P6", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": "2" +} diff --git a/tasks/pb-advanced-024/tests/test.sh b/tasks/pb-advanced-024/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-024/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-025/instruction.md b/tasks/pb-advanced-025/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1cd19e6971decc2b72a5f26dd7b2a37e88515c4f --- /dev/null +++ b/tasks/pb-advanced-025/instruction.md @@ -0,0 +1,10 @@ +# PB-Advanced-025 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $k$ and $d$ be positive integers. Prove that there exists a + positive integer $N$ such that for every odd integer $n>N$, the + digits in the base-$2n$ representation of $n^{k}$ are all greater + than $d$. diff --git a/tasks/pb-advanced-025/solution/solve.sh b/tasks/pb-advanced-025/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4f3e4fbce79c0136084b869158174b1af6fd3e6c --- /dev/null +++ b/tasks/pb-advanced-025/solution/solve.sh @@ -0,0 +1,46 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_a7bdcfd076544d0d7f86c1fef01880fd3b61ada7b8e4b803ecacb5eb8b8d453f' +The problem actually doesn't have much to do with digits: the idea + is to pick any length $\ell\leq k$, and look at the rightmost $\ell$ + digits of $n^{k}$; that is, the remainder upon division by $(2n)^{\ell}$. + We compute it exactly: + + Claim - Let $n\geq1$ be an odd integer, and $k\geq\ell\geq1$ integers. + Then + + \[ + n^{k}\bmod(2n)^{l}=c(k,\ell)\cdot n^{l} + \] + + for some odd integer $1\leq c(k,\ell)\leq2^{\ell}-1$. + + Proof. This follows directly by the Chinese remainder theorem, with + $c(k,\ell)$ being the residue class of $n^{k-i}\left(\bmod2^{\ell}\right)$ + since $n$ is odd. In particular, for the $\ell$ th digit from the + right to be greater than $d$, it would be enough that + \[ + c(k,\ell)\cdot n^{\ell}\geq(d+1)\cdot(2n)^{\ell-1} + \] + But this inequality holds whenever $n\geq(d+1)\cdot2^{\ell-1}$. + + Putting this together by varying $\ell$, we find that for all odd + + \[ + n\geq(d+1)\cdot2^{k-1} + \] + + we have that + \begin{itemize} + \item $n^{k}$ has $k$ digits in base- $2n$; and + \item for each $\ell=1,\ldots,k$, the $\ell^{\text{th }}$ digit from the + right is at least $d+1$ + + so the problem is solved. + + Remark. Note it doesn't really matter that $c(k,i)$ is odd per se; + we only need that $c(k,i)\geq1$. + \end{itemize} +IMO_PROOF_a7bdcfd076544d0d7f86c1fef01880fd3b61ada7b8e4b803ecacb5eb8b8d453f diff --git a/tasks/pb-advanced-025/task.toml b/tasks/pb-advanced-025/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f131b01ec772be1bc8dd2ef35a684142047c3cd0 --- /dev/null +++ b/tasks/pb-advanced-025/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-025" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-025" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-025/tests/grade_task.py b/tasks/pb-advanced-025/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-025/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-025/tests/reference.json b/tasks/pb-advanced-025/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..7dc6c5195f701800c17a752b172591152fa7d2b5 --- /dev/null +++ b/tasks/pb-advanced-025/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $k$ and $d$ be positive integers. Prove that there exists a\n positive integer $N$ such that for every odd integer $n>N$, the\n digits in the base-$2n$ representation of $n^{k}$ are all greater\n than $d$.", + "solution": "The problem actually doesn't have much to do with digits: the idea\n is to pick any length $\\ell\\leq k$, and look at the rightmost $\\ell$\n digits of $n^{k}$; that is, the remainder upon division by $(2n)^{\\ell}$.\n We compute it exactly:\n\n Claim - Let $n\\geq1$ be an odd integer, and $k\\geq\\ell\\geq1$ integers.\n Then\n\n \\[\n n^{k}\\bmod(2n)^{l}=c(k,\\ell)\\cdot n^{l}\n \\]\n\n for some odd integer $1\\leq c(k,\\ell)\\leq2^{\\ell}-1$.\n\n Proof. This follows directly by the Chinese remainder theorem, with\n $c(k,\\ell)$ being the residue class of $n^{k-i}\\left(\\bmod2^{\\ell}\\right)$\n since $n$ is odd. In particular, for the $\\ell$ th digit from the\n right to be greater than $d$, it would be enough that\n \\[\n c(k,\\ell)\\cdot n^{\\ell}\\geq(d+1)\\cdot(2n)^{\\ell-1}\n \\]\n But this inequality holds whenever $n\\geq(d+1)\\cdot2^{\\ell-1}$.\n\n Putting this together by varying $\\ell$, we find that for all odd\n\n \\[\n n\\geq(d+1)\\cdot2^{k-1}\n \\]\n\n we have that\n \\begin{itemize}\n \\item $n^{k}$ has $k$ digits in base- $2n$; and\n \\item for each $\\ell=1,\\ldots,k$, the $\\ell^{\\text{th }}$ digit from the\n right is at least $d+1$\n\n so the problem is solved.\n\n Remark. Note it doesn't really matter that $c(k,i)$ is odd per se;\n we only need that $c(k,i)\\geq1$.\n \\end{itemize}", + "grading_guidelines": "(Partial)\n 1. Proved that $n^{k}$ has $k$ digits on base $2n$ representation for sufficiently large $n$.\n 2. Expressed the $i$th digit such as $\\lfloor\\frac{n^{k}}{(2n)^{i}}\\rfloor\\pmod{2n}$.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Advanced-025", + "level": "advanced", + "category": "Number theory", + "source": "USAMO 2025", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-advanced-025/tests/test.sh b/tasks/pb-advanced-025/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-025/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-026/instruction.md b/tasks/pb-advanced-026/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..451db6ebf807b45073aa27425990215a3674a6da --- /dev/null +++ b/tasks/pb-advanced-026/instruction.md @@ -0,0 +1,12 @@ +# PB-Advanced-026 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $n$ and $k$ be positive integers with $k "$PROOF" <<'IMO_PROOF_1b86e7fbeb90b9c3bc8089b1bd84fc5325e511a4b78dc431a15018fcc769b3a2' +Let $n>k\geq1$ be integers. Let $P(x)\in\mathbb{R}[x]$ be a polynomial + of degree $n$ with no repeated roots and $P(0)\neq0$. Suppose that + for any real numbers $a_{0},\ldots,a_{k}$ such that the polynomial + $a_{k}x^{k}+\cdots+a_{1}x+a_{0}$ divides $P(x)$, the product $a_{0}a_{1}\ldots a_{k}$ + is zero. Prove that $P(x)$ has a non-real root. + + + By considering any $k+1$ of the roots of $P$, we may as well assume + WLOG that $n=k+1$. Suppose that $P(x)=\left(x+r_{1}\right)\ldots\left(x+r_{n}\right)\in\mathbb{R}[x]$ + has $P(0)\neq0$. Then the problem hypothesis is that each of the + $n$ polynomials (of degree $n-1$ ) given by + + \[ + \begin{aligned}P_{1}(x) & =\left(x+r_{2}\right)\left(x+r_{3}\right)\left(x+r_{4}\right)\ldots\left(x+r_{n}\right) + + P_{2}(x) & =\left(x+r_{1}\right)\left(x+r_{3}\right)\left(x+r_{4}\right)\ldots\left(x+r_{n}\right) + + P_{3}(x) & =\left(x+r_{1}\right)\left(x+r_{2}\right)\left(x+r_{4}\right)\ldots\left(x+r_{n}\right) + + & \vdots + + P_{n}(x) & =\left(x+r_{1}\right)\left(x+r_{2}\right)\left(x+r_{3}\right)\ldots\left(x+r_{n-1}\right) + \end{aligned} + \] + + has at least one coefficient equal to zero. (Explicitly, $P_{i}(x)=\frac{P(x)}{x+r_{i}}$.) + We'll prove that at least one $r_{i}$ is not real. + + + Obviously the leading and constant coefficients of each $P_{i}$ are + nonzero, and there are $n-2$ other coefficients to choose between. + So by pigeonhole principle, we may assume, say, that $P_{1}$ and + $P_{2}$ share the position of a zero coefficient, say the $x^{k}$ + one, for some $1\leq k LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-026/tests/reference.json b/tasks/pb-advanced-026/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..ff3d3345a92fbefb9246bbcd0a875724568be692 --- /dev/null +++ b/tasks/pb-advanced-026/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $n$ and $k$ be positive integers with $kk\\geq1$ be integers. Let $P(x)\\in\\mathbb{R}[x]$ be a polynomial\n of degree $n$ with no repeated roots and $P(0)\\neq0$. Suppose that\n for any real numbers $a_{0},\\ldots,a_{k}$ such that the polynomial\n $a_{k}x^{k}+\\cdots+a_{1}x+a_{0}$ divides $P(x)$, the product $a_{0}a_{1}\\ldots a_{k}$\n is zero. Prove that $P(x)$ has a non-real root.\n\n\n By considering any $k+1$ of the roots of $P$, we may as well assume\n WLOG that $n=k+1$. Suppose that $P(x)=\\left(x+r_{1}\\right)\\ldots\\left(x+r_{n}\\right)\\in\\mathbb{R}[x]$\n has $P(0)\\neq0$. Then the problem hypothesis is that each of the\n $n$ polynomials (of degree $n-1$ ) given by\n\n \\[\n \\begin{aligned}P_{1}(x) & =\\left(x+r_{2}\\right)\\left(x+r_{3}\\right)\\left(x+r_{4}\\right)\\ldots\\left(x+r_{n}\\right)\n\n P_{2}(x) & =\\left(x+r_{1}\\right)\\left(x+r_{3}\\right)\\left(x+r_{4}\\right)\\ldots\\left(x+r_{n}\\right)\n\n P_{3}(x) & =\\left(x+r_{1}\\right)\\left(x+r_{2}\\right)\\left(x+r_{4}\\right)\\ldots\\left(x+r_{n}\\right)\n\n & \\vdots\n\n P_{n}(x) & =\\left(x+r_{1}\\right)\\left(x+r_{2}\\right)\\left(x+r_{3}\\right)\\ldots\\left(x+r_{n-1}\\right)\n \\end{aligned}\n \\]\n\n has at least one coefficient equal to zero. (Explicitly, $P_{i}(x)=\\frac{P(x)}{x+r_{i}}$.)\n We'll prove that at least one $r_{i}$ is not real.\n\n\n Obviously the leading and constant coefficients of each $P_{i}$ are\n nonzero, and there are $n-2$ other coefficients to choose between.\n So by pigeonhole principle, we may assume, say, that $P_{1}$ and\n $P_{2}$ share the position of a zero coefficient, say the $x^{k}$\n one, for some $1\\leq k "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-027/instruction.md b/tasks/pb-advanced-027/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..20b2b7ddbf81b5a98d7064e114106ee0fe0009cd --- /dev/null +++ b/tasks/pb-advanced-027/instruction.md @@ -0,0 +1,28 @@ +# PB-Advanced-027 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Alice the architect and Bob the builder play a game. First, Alice + chooses two points $P$ and $Q$ in the plane and a subset $S$ of + the plane, which are announced to Bob. Next, Bob marks infinitely + many points in the plane, designating each a city. He may not place + two cities within distance at most one unit of each other, and no + three cities he places may be collinear. Finally, roads are constructed + between the cities as follows: for each pair $A,B$ of cities, they + are connected with a road along the line segment $AB$ if and only + if the following condition holds: For every city $C$ distinct from + $A$ and $B$, there exists $R\in S$ such that $\triangle PQR$ is + directly similar to either $\triangle ABC$ or $\triangle BAC$. Alice + wins the game if + + \noindent (i) the resulting roads allow for travel between any pair + of cities via a finite sequence of roads and + + \noindent (ii) no two roads cross. + + \noindent Otherwise, Bob wins. Determine, with proof, which player + has a winning strategy. (Note: $\triangle UVW$ is directly similar + to $\triangle XYZ$ if there exists a sequence of rotations, translations, + and dilations sending $U$ to $X$, $V$ to $Y$, and $W$ to $Z$.) diff --git a/tasks/pb-advanced-027/solution/solve.sh b/tasks/pb-advanced-027/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..6ed5a6e6e53176a1109a32878d1edf84bdad376a --- /dev/null +++ b/tasks/pb-advanced-027/solution/solve.sh @@ -0,0 +1,48 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_b98da3c7dee65c2c5fde180c1cb4f8cd6dc365314e080e20e566fc5b6ab65946' +The answer is that Alice wins. Let's define a Bob-set $V$ to be + a set of points in the plane with no three collinear and with all + distances at least 1 . The point of the problem is to prove the following + fact. + + Claim - Given a Bob-set $V\subseteq\mathbb{R}^{2}$, consider the + Bob-graph with vertex set $V$ defined as follows: draw edge $ab$ + if and only if the disk with diameter $\overline{ab}$ contains no + other points of $V$ on or inside it. Then the Bob-graph is connected + and planar. + + Proving this claim shows that Alice wins since Alice can specify $\mathcal{S}$ + to be the set of points outside the disk of diameter $PQ$. + + We start with proving that every Bob-graph is connected. Assume for + contradiction the graph is disconnected. Let $p$ and $q$ be two + points in different connected components. Since $pq$ is not an edge, + there exists a third point $r$ inside the disk with diameter $\overline{pq}$. + + Hence, $r$ is in a different connected component from at least one + of $p$ or $q$ - let's say point $p$. Then we repeat the same argument + on the disk with diameter $\overline{pr}$ to find a new point $s$, + non-adjacent to either $p$ or $r$. See the figure below, where the + X'ed out dashed edges indicate points which are not only non-adjacent + but in different connected components. + + In this way we generate an infinite sequence of distances $\delta_{1},\delta_{2},\delta_{3},\ldots$ + among the non-edges in the picture above. By the "Pythagorean theorem" + (or really the inequality for it), we have + + \[ + \delta_{i}^{2}\leq\delta_{i-1}^{2}-1 + \] + + and this eventually generates a contradiction for large $i$, since + we get $0\leq\delta_{i}^{2}\leq\delta_{1}^{2}-(i-$ $1)$. + + Now we prove that every Bob-graph is planar. Assume for contradiction + that edges $ac$ and $bd$ meet, meaning $abcd$ is a convex quadrilateral. + WLOG assume $\angle bad\geq90^{\circ}$ (each quadrilateral has an + angle at least $90^{\circ}$ ). Then the disk with diameter $\overline{bd}$ + contains $a$, contradiction. +IMO_PROOF_b98da3c7dee65c2c5fde180c1cb4f8cd6dc365314e080e20e566fc5b6ab65946 diff --git a/tasks/pb-advanced-027/task.toml b/tasks/pb-advanced-027/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4bce1cf76ba3fd4f00d23d58bffaf367b659b719 --- /dev/null +++ b/tasks/pb-advanced-027/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-027" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-027" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-027/tests/grade_task.py b/tasks/pb-advanced-027/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-027/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-027/tests/reference.json b/tasks/pb-advanced-027/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..54a86f49a676f49e600a1e38e0cb5877f1e1e86b --- /dev/null +++ b/tasks/pb-advanced-027/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Alice the architect and Bob the builder play a game. First, Alice\n chooses two points $P$ and $Q$ in the plane and a subset $S$ of\n the plane, which are announced to Bob. Next, Bob marks infinitely\n many points in the plane, designating each a city. He may not place\n two cities within distance at most one unit of each other, and no\n three cities he places may be collinear. Finally, roads are constructed\n between the cities as follows: for each pair $A,B$ of cities, they\n are connected with a road along the line segment $AB$ if and only\n if the following condition holds: For every city $C$ distinct from\n $A$ and $B$, there exists $R\\in S$ such that $\\triangle PQR$ is\n directly similar to either $\\triangle ABC$ or $\\triangle BAC$. Alice\n wins the game if\n\n \\noindent (i) the resulting roads allow for travel between any pair\n of cities via a finite sequence of roads and\n\n \\noindent (ii) no two roads cross.\n\n \\noindent Otherwise, Bob wins. Determine, with proof, which player\n has a winning strategy. (Note: $\\triangle UVW$ is directly similar\n to $\\triangle XYZ$ if there exists a sequence of rotations, translations,\n and dilations sending $U$ to $X$, $V$ to $Y$, and $W$ to $Z$.)", + "solution": "The answer is that Alice wins. Let's define a Bob-set $V$ to be\n a set of points in the plane with no three collinear and with all\n distances at least 1 . The point of the problem is to prove the following\n fact.\n\n Claim - Given a Bob-set $V\\subseteq\\mathbb{R}^{2}$, consider the\n Bob-graph with vertex set $V$ defined as follows: draw edge $ab$\n if and only if the disk with diameter $\\overline{ab}$ contains no\n other points of $V$ on or inside it. Then the Bob-graph is connected\n and planar.\n\n Proving this claim shows that Alice wins since Alice can specify $\\mathcal{S}$\n to be the set of points outside the disk of diameter $PQ$.\n\n We start with proving that every Bob-graph is connected. Assume for\n contradiction the graph is disconnected. Let $p$ and $q$ be two\n points in different connected components. Since $pq$ is not an edge,\n there exists a third point $r$ inside the disk with diameter $\\overline{pq}$.\n\n Hence, $r$ is in a different connected component from at least one\n of $p$ or $q$ - let's say point $p$. Then we repeat the same argument\n on the disk with diameter $\\overline{pr}$ to find a new point $s$,\n non-adjacent to either $p$ or $r$. See the figure below, where the\n X'ed out dashed edges indicate points which are not only non-adjacent\n but in different connected components.\n\n In this way we generate an infinite sequence of distances $\\delta_{1},\\delta_{2},\\delta_{3},\\ldots$\n among the non-edges in the picture above. By the \"Pythagorean theorem\"\n (or really the inequality for it), we have\n\n \\[\n \\delta_{i}^{2}\\leq\\delta_{i-1}^{2}-1\n \\]\n\n and this eventually generates a contradiction for large $i$, since\n we get $0\\leq\\delta_{i}^{2}\\leq\\delta_{1}^{2}-(i-$ $1)$.\n\n Now we prove that every Bob-graph is planar. Assume for contradiction\n that edges $ac$ and $bd$ meet, meaning $abcd$ is a convex quadrilateral.\n WLOG assume $\\angle bad\\geq90^{\\circ}$ (each quadrilateral has an\n angle at least $90^{\\circ}$ ). Then the disk with diameter $\\overline{bd}$\n contains $a$, contradiction.", + "grading_guidelines": "(Partial)\n 1. Argued that Alice should take $S$ to be the exterior of the circle of diameter $PQ$.\n 2. Constructed $S$ as above and proved that the resulting graph is planar.\n(Almost)\n 1. Constructed $S$ as above and proved that the resulting graph is connected.\n 2. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Advanced-027", + "level": "advanced", + "category": "Combinatorics", + "source": "USAMO 2025", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": "Alice" +} diff --git a/tasks/pb-advanced-027/tests/test.sh b/tasks/pb-advanced-027/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-027/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-028/instruction.md b/tasks/pb-advanced-028/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..67f33edddd58a7f9babc3e56c6e95775026789f5 --- /dev/null +++ b/tasks/pb-advanced-028/instruction.md @@ -0,0 +1,11 @@ +# PB-Advanced-028 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $H$ be the orthocenter of acute triangle $ABC$, let $F$ be + the foot of the altitude from $C$ to $AB$, and let $P$ be the reflection + of $H$ across $BC$. Suppose that the circumcircle of triangle $AFP$ + intersects line $BC$ at two distinct points $X$ and $Y$. Prove + that $C$ is the midpoint of $XY$. diff --git a/tasks/pb-advanced-028/solution/solve.sh b/tasks/pb-advanced-028/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..18b9b4c0def935cf79ef5ed142fc6d315f8f21a7 --- /dev/null +++ b/tasks/pb-advanced-028/solution/solve.sh @@ -0,0 +1,31 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_af2fd0d09f68624f93418fe94d0bf01f7fdbc2070eec81ef18c5ab3389c2a52e' +Let $Q$ be the antipode of $B$ in the circumcircle of $ABC$. + + + \textbf{Claim.} $AHQC$ is a parallelogram, and $APCQ$ is an isosceles + trapezoid. + + + + \emph{Proof.} The claim follows from $\overline{AH}\perp\overline{BC}\perp\overline{CQ}$ + and $\overline{CF}\perp\overline{AB}\perp\overline{AQ}$. + + + Let $M$ be the midpoint of $\overline{QC}$. + + + \textbf{Claim.} Point $M$ is the circumcenter of $\triangle AFP$. + + + \emph{Proof.} It's clear that $MA=MP$ from the isosceles trapezoid + $APCQ$. As for $MA=MF$, let $N$ denote the midpoint of $\overline{AF}$; + then $\overline{MN}$ is a midline of the parallelogram, so $\overline{MN}\perp\overline{AF}$. + + + Since $\overline{CM}\perp\overline{BC}$ and $M$ is the center of + $(AFP)$, it follows $CX=CY$. +IMO_PROOF_af2fd0d09f68624f93418fe94d0bf01f7fdbc2070eec81ef18c5ab3389c2a52e diff --git a/tasks/pb-advanced-028/task.toml b/tasks/pb-advanced-028/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9a6ab7a2e08b4dc5829ca93e0348f81eeb91d2cf --- /dev/null +++ b/tasks/pb-advanced-028/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-028" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-028" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-028/tests/grade_task.py b/tasks/pb-advanced-028/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-028/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-028/tests/reference.json b/tasks/pb-advanced-028/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..d2540daf0e4d2b8503604fbcee312fd216a4c08e --- /dev/null +++ b/tasks/pb-advanced-028/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $H$ be the orthocenter of acute triangle $ABC$, let $F$ be\n the foot of the altitude from $C$ to $AB$, and let $P$ be the reflection\n of $H$ across $BC$. Suppose that the circumcircle of triangle $AFP$\n intersects line $BC$ at two distinct points $X$ and $Y$. Prove\n that $C$ is the midpoint of $XY$.", + "solution": "Let $Q$ be the antipode of $B$ in the circumcircle of $ABC$.\n\n\n \\textbf{Claim.} $AHQC$ is a parallelogram, and $APCQ$ is an isosceles\n trapezoid.\n\n\n\n \\emph{Proof.} The claim follows from $\\overline{AH}\\perp\\overline{BC}\\perp\\overline{CQ}$\n and $\\overline{CF}\\perp\\overline{AB}\\perp\\overline{AQ}$.\n\n\n Let $M$ be the midpoint of $\\overline{QC}$.\n\n\n \\textbf{Claim.} Point $M$ is the circumcenter of $\\triangle AFP$.\n\n\n \\emph{Proof.} It's clear that $MA=MP$ from the isosceles trapezoid\n $APCQ$. As for $MA=MF$, let $N$ denote the midpoint of $\\overline{AF}$;\n then $\\overline{MN}$ is a midline of the parallelogram, so $\\overline{MN}\\perp\\overline{AF}$.\n\n\n Since $\\overline{CM}\\perp\\overline{BC}$ and $M$ is the center of\n $(AFP)$, it follows $CX=CY$.", + "grading_guidelines": "(Partial)\n 1. Constructed an external point, including the antipode of $B$ w.r.t $(ABC)$ or the antipode of $A$ w.r.t $(AFP)$, that may lead to a solution.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Advanced-028", + "level": "advanced", + "category": "Geometry", + "source": "USAMO 2025", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-advanced-028/tests/test.sh b/tasks/pb-advanced-028/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-028/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-029/instruction.md b/tasks/pb-advanced-029/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0705d923fd51a65a5b2a562c9751d370df0943a9 --- /dev/null +++ b/tasks/pb-advanced-029/instruction.md @@ -0,0 +1,11 @@ +# PB-Advanced-029 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Determine, with proof, all positive integers $k$ such that + \[ + \frac{1}{n+1}\sum_{i=0}^{n}\binom{n}{i}^{k} + \] + is an integer for every positive integer $n$. diff --git a/tasks/pb-advanced-029/solution/solve.sh b/tasks/pb-advanced-029/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b82a346c78b965bb5cf3224bb4d11e1c1dc660d8 --- /dev/null +++ b/tasks/pb-advanced-029/solution/solve.sh @@ -0,0 +1,52 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_c19223cf31361df927259c3d652245785bc37d9bf6c6099a2297fa59884e421a' +The answer is all even $k$. Let's abbreviate $S(n):=\binom{n}{0}^{k}+\cdots+\binom{n}{n}^{k}$ + for the sum in the problem. + + + \textbf{Proof that even $k$ is necessary.} + + Choose $n=2$. We need $3\mid S(2)=2+2^{k}$, which requires $k$ + to be even. + + + \textbf{Proof that even $k$ is sufficient. } + + From now on we treat $k$ as fixed, and we let $p^{e}$ be a prime + fully dividing $n+1$. It is sufficient to prove that $S(n)$ is a + multiple of $p^{e}$ for each such $p^{e}$. The basic idea is to + reduce from $n+1$ to $(n+1)/p$ by an induction. We prove the following + lemma on each individual binomial coefficient. + + + \textbf{Lemma. }Suppose $p^{e}$ is a prime power which fully divides + $n+1$. Then + + \[ + \binom{n}{i}\equiv\pm\binom{\frac{n+1}{p}-1}{\lfloor i/p\rfloor}\quad\left(\bmod p^{e}\right) + \] + + \emph{Proof.} If we write + \[ + \binom{n}{i}=\prod_{1\leq j\leq i}\frac{n-(j-1)}{j} + \] + + then the fractions for $p\nmid j$ are all $\pm1\left(\bmod p^{e}\right)$. + So only considers those $j$ with $p\mid j$; in that case one obtains + the claimed $\binom{\frac{n+1}{p}-1}{\lfloor i/p\rfloor}$ exactly + (even without having to take modulo $p^{e}$). + + + From the lemma, it follows if $p^{e}$ is a prime power which fully + divides $n+1$, then + \[ + S(n)\equiv p\cdot S\left(\frac{n+1}{p}-1\right)\quad\left(\bmod p^{e}\right) + \] + + by grouping the $n+1$ terms (for $0\leq i\leq n$ ) into consecutive + ranges of length $p$ (by the value of $\lfloor i/p\rfloor$ ) and + the result follows by induction. +IMO_PROOF_c19223cf31361df927259c3d652245785bc37d9bf6c6099a2297fa59884e421a diff --git a/tasks/pb-advanced-029/task.toml b/tasks/pb-advanced-029/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5671faec87f0735719ce900727ffe82263fa023b --- /dev/null +++ b/tasks/pb-advanced-029/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-029" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-029" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-029/tests/grade_task.py b/tasks/pb-advanced-029/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-029/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-029/tests/reference.json b/tasks/pb-advanced-029/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..39b12a8873056113967f277fcbb783825f4c3118 --- /dev/null +++ b/tasks/pb-advanced-029/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Determine, with proof, all positive integers $k$ such that\n \\[\n \\frac{1}{n+1}\\sum_{i=0}^{n}\\binom{n}{i}^{k}\n \\]\n is an integer for every positive integer $n$.", + "solution": "The answer is all even $k$. Let's abbreviate $S(n):=\\binom{n}{0}^{k}+\\cdots+\\binom{n}{n}^{k}$\n for the sum in the problem.\n\n\n \\textbf{Proof that even $k$ is necessary.}\n\n Choose $n=2$. We need $3\\mid S(2)=2+2^{k}$, which requires $k$\n to be even.\n\n\n \\textbf{Proof that even $k$ is sufficient. }\n\n From now on we treat $k$ as fixed, and we let $p^{e}$ be a prime\n fully dividing $n+1$. It is sufficient to prove that $S(n)$ is a\n multiple of $p^{e}$ for each such $p^{e}$. The basic idea is to\n reduce from $n+1$ to $(n+1)/p$ by an induction. We prove the following\n lemma on each individual binomial coefficient.\n\n\n \\textbf{Lemma. }Suppose $p^{e}$ is a prime power which fully divides\n $n+1$. Then\n\n \\[\n \\binom{n}{i}\\equiv\\pm\\binom{\\frac{n+1}{p}-1}{\\lfloor i/p\\rfloor}\\quad\\left(\\bmod p^{e}\\right)\n \\]\n\n \\emph{Proof.} If we write\n \\[\n \\binom{n}{i}=\\prod_{1\\leq j\\leq i}\\frac{n-(j-1)}{j}\n \\]\n\n then the fractions for $p\\nmid j$ are all $\\pm1\\left(\\bmod p^{e}\\right)$.\n So only considers those $j$ with $p\\mid j$; in that case one obtains\n the claimed $\\binom{\\frac{n+1}{p}-1}{\\lfloor i/p\\rfloor}$ exactly\n (even without having to take modulo $p^{e}$).\n\n\n From the lemma, it follows if $p^{e}$ is a prime power which fully\n divides $n+1$, then\n \\[\n S(n)\\equiv p\\cdot S\\left(\\frac{n+1}{p}-1\\right)\\quad\\left(\\bmod p^{e}\\right)\n \\]\n\n by grouping the $n+1$ terms (for $0\\leq i\\leq n$ ) into consecutive\n ranges of length $p$ (by the value of $\\lfloor i/p\\rfloor$ ) and\n the result follows by induction.", + "grading_guidelines": "(Partial)\n 1. Proved that $k$ should be even.\n 2. Used the induction on $n+1$ and considered the equation for$\\frac{n+1}{p}$.\n 3. Stated the identity $n+1\\mid\\sum_{i=0}^{n}\\left((-1)^{i}\\binom{n}{i}\\right)^{k}$ without proof.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible, such as coming up with a proof that only works for odd primes.", + "problem_id": "PB-Advanced-029", + "level": "advanced", + "category": "Number theory", + "source": "USAMO 2025", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "All even integer $k$" +} diff --git a/tasks/pb-advanced-029/tests/test.sh b/tasks/pb-advanced-029/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-029/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-advanced-030/instruction.md b/tasks/pb-advanced-030/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..82e43a183414d07c3ff6624e1fe7a97bd7df3c7d --- /dev/null +++ b/tasks/pb-advanced-030/instruction.md @@ -0,0 +1,16 @@ +# PB-Advanced-030 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $m$ and $n$ be positive integers with $m\ge n$. There are + $m$ cupcakes of different flavors arranged around a circle and $n$ + people who like cupcakes. Each person assigns a non-negative real + number score to each cupcake, depending on how much they like the + cupcake. Suppose that for each person $P$, it is possible to partition + the circle of $m$ cupcakes into $n$ groups of consecutive cupcakes + so that the sum of $P$'s scores of the cupcakes in each group is + at least $1$. Prove that it is possible to distribute the $m$ cupcakes + to the $n$ people so that each person $P$ receives cupcakes of total + score at least $1$ with respect to $P$. diff --git a/tasks/pb-advanced-030/solution/solve.sh b/tasks/pb-advanced-030/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..9379d455569fb9b50d1097333cf3efcf8c4a2185 --- /dev/null +++ b/tasks/pb-advanced-030/solution/solve.sh @@ -0,0 +1,51 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_20833c87cd1f532e9d7a4274e354213c81825ebeda16e5f3d305534fd2def6f4' +Arbitrarily pick any one person - call her Pip - and her $n$ arcs. + The initial idea is to try to apply Hall's marriage lemma to match + the $n$ people with Pip's arcs (such that each such person is happy + with their matched arc). To that end, construct the obvious bipartite + graph $\mathfrak{G}$ between the people and the arcs for Pip. + + We now consider the following algorithm, which takes several steps. + \begin{itemize} + \item If a perfect matching of $\mathfrak{G}$ exists, we're done! + \item We're probably not that lucky. Per Hall's condition, this means there + is a bad set $\mathcal{B}_{1}$ of people, who are compatible with + fewer than $\left|\mathcal{B}_{1}\right|$ of the arcs. Then delete + $\mathcal{B}_{1}$ and the neighbors of $\mathcal{B}_{1}$, then try + to find a matching on the remaining graph. + \item If a matching exists now, terminate the algorithm. Otherwise, that + means there's another bad set $\mathcal{B}_{2}$ for the remaining + graph. We again delete $\mathcal{B}_{2}$ and the fewer than $\mathcal{B}_{2}$ + neighbors. + \item Repeat until some perfect matching $\mathcal{M}$ is possible in the + remaining graph, i.e. there are no more bad sets (and then terminate + once that occurs). + \end{itemize} + Since Pip is a universal vertex, it's impossible to delete Pip, so + the algorithm does indeed terminate with nonempty $\mathcal{M}$. + + We commit to assigning each of person in $\mathcal{M}$ their matched + arc (in particular if there are no bad sets at all, the problem is + already solved). Now we finish the problem by induction on $n$ (for + the remaining people) by simply deleting the arcs used up by $\mathcal{M}$. + + To see why this deletion-induction works, consider any particular + person Quinn not in $\mathcal{M}$. By definition, Quinn is not happy + with any of the $\operatorname{arcs}$ in $\mathcal{M}$. So when + an $\operatorname{arc}\mathcal{A}$ of $\mathcal{M}$ is deleted, + it had value less than 1 for Quinn so in particular it couldn't contain + entirely any of Quinn's arcs. Hence at most one endpoint among Quinn's + arcs was in the deleted $\operatorname{arc}\mathcal{A}$. When this + happens, this causes two arcs of Quinn to merge, and the merged value + is + + \[ + (\geq1)+(\geq1)-(\leq1)\quad\geq1 + \] + + meaning the induction is OK. +IMO_PROOF_20833c87cd1f532e9d7a4274e354213c81825ebeda16e5f3d305534fd2def6f4 diff --git a/tasks/pb-advanced-030/task.toml b/tasks/pb-advanced-030/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d0c8f631bb7ca7c91af652ed7a60c7681818185e --- /dev/null +++ b/tasks/pb-advanced-030/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-advanced-030" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Advanced-030" +level = "advanced" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-advanced-030/tests/grade_task.py b/tasks/pb-advanced-030/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-advanced-030/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-advanced-030/tests/reference.json b/tasks/pb-advanced-030/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..3ab9d11366f56f4bfc0f228e130da2368e9af1ec --- /dev/null +++ b/tasks/pb-advanced-030/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $m$ and $n$ be positive integers with $m\\ge n$. There are\n $m$ cupcakes of different flavors arranged around a circle and $n$\n people who like cupcakes. Each person assigns a non-negative real\n number score to each cupcake, depending on how much they like the\n cupcake. Suppose that for each person $P$, it is possible to partition\n the circle of $m$ cupcakes into $n$ groups of consecutive cupcakes\n so that the sum of $P$'s scores of the cupcakes in each group is\n at least $1$. Prove that it is possible to distribute the $m$ cupcakes\n to the $n$ people so that each person $P$ receives cupcakes of total\n score at least $1$ with respect to $P$.", + "solution": "Arbitrarily pick any one person - call her Pip - and her $n$ arcs.\n The initial idea is to try to apply Hall's marriage lemma to match\n the $n$ people with Pip's arcs (such that each such person is happy\n with their matched arc). To that end, construct the obvious bipartite\n graph $\\mathfrak{G}$ between the people and the arcs for Pip.\n\n We now consider the following algorithm, which takes several steps.\n \\begin{itemize}\n \\item If a perfect matching of $\\mathfrak{G}$ exists, we're done!\n \\item We're probably not that lucky. Per Hall's condition, this means there\n is a bad set $\\mathcal{B}_{1}$ of people, who are compatible with\n fewer than $\\left|\\mathcal{B}_{1}\\right|$ of the arcs. Then delete\n $\\mathcal{B}_{1}$ and the neighbors of $\\mathcal{B}_{1}$, then try\n to find a matching on the remaining graph.\n \\item If a matching exists now, terminate the algorithm. Otherwise, that\n means there's another bad set $\\mathcal{B}_{2}$ for the remaining\n graph. We again delete $\\mathcal{B}_{2}$ and the fewer than $\\mathcal{B}_{2}$\n neighbors.\n \\item Repeat until some perfect matching $\\mathcal{M}$ is possible in the\n remaining graph, i.e. there are no more bad sets (and then terminate\n once that occurs).\n \\end{itemize}\n Since Pip is a universal vertex, it's impossible to delete Pip, so\n the algorithm does indeed terminate with nonempty $\\mathcal{M}$.\n\n We commit to assigning each of person in $\\mathcal{M}$ their matched\n arc (in particular if there are no bad sets at all, the problem is\n already solved). Now we finish the problem by induction on $n$ (for\n the remaining people) by simply deleting the arcs used up by $\\mathcal{M}$.\n\n To see why this deletion-induction works, consider any particular\n person Quinn not in $\\mathcal{M}$. By definition, Quinn is not happy\n with any of the $\\operatorname{arcs}$ in $\\mathcal{M}$. So when\n an $\\operatorname{arc}\\mathcal{A}$ of $\\mathcal{M}$ is deleted,\n it had value less than 1 for Quinn so in particular it couldn't contain\n entirely any of Quinn's arcs. Hence at most one endpoint among Quinn's\n arcs was in the deleted $\\operatorname{arc}\\mathcal{A}$. When this\n happens, this causes two arcs of Quinn to merge, and the merged value\n is\n\n \\[\n (\\geq1)+(\\geq1)-(\\leq1)\\quad\\geq1\n \\]\n\n meaning the induction is OK.", + "grading_guidelines": "(Partial)\n 1. Observed that when an arc with scores smaller than $1$ to some person $X$ is deleted, the problem condition still holds for $X$.\n 2. Applied Hall's theorem to the arcs of a fixed person and the $n$ people.\n(Almost)\n 1. Found a perfect matching and uses induction, but didn't explain why the induction works.\n 2. Full proof, but didn't mention that there exists a nonempty set that satisfies Hall's condition.", + "problem_id": "PB-Advanced-030", + "level": "advanced", + "category": "Combinatorics", + "source": "USAMO 2025", + "max_score": 7, + "difficulty": "IMO-hard", + "short_answer": " " +} diff --git a/tasks/pb-advanced-030/tests/test.sh b/tasks/pb-advanced-030/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-advanced-030/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-001/instruction.md b/tasks/pb-basic-001/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b5f5b2f06827dcdbe8f26c00e969342f1fd6bda7 --- /dev/null +++ b/tasks/pb-basic-001/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-001 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Determine all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that, for all $x, y \in \mathbb{Z}$, we have \[ f(2x)+2f(y)=f(f(x+y)).\] diff --git a/tasks/pb-basic-001/solution/solve.sh b/tasks/pb-basic-001/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f3a58ff55db473facb350edb93b47f163fc051c8 --- /dev/null +++ b/tasks/pb-basic-001/solution/solve.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_e6d7c469d9bd78763301008c78856b71196d8504838e5b5f20bd29ef740b9f1a' +By taking $x = 0$, we get $f(0) + 2f(y) = f(f(y))$ for all $y\in \mathbb{Z}$. So, the problem becomes: + $$ f(2x) + 2f(y) = f(0) + 2f(x + y) $$ + Taking $x = 1$ for this one, we quickly obtain that $2(f(y+1) - f(y)) = f(2) - f(0) \Leftrightarrow f(y+1)-f(y) = (f(2)-f(0))/2$, so $f$ is linear, that is there exists $k,c$ such that $f(x) = kx+c$. Plug this back into the original equation, we see $f(x) = 2x+c$ and $f(x)=0$ are all possible solutions, and these indeed satisfy the given condition +IMO_PROOF_e6d7c469d9bd78763301008c78856b71196d8504838e5b5f20bd29ef740b9f1a diff --git a/tasks/pb-basic-001/task.toml b/tasks/pb-basic-001/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..87aa9bace283e1a0abdd4ff6de4ce951275628b2 --- /dev/null +++ b/tasks/pb-basic-001/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-001" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-001" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-001/tests/grade_task.py b/tasks/pb-basic-001/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-001/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-001/tests/reference.json b/tasks/pb-basic-001/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..0948d8e4236a8762d9dccc6f09d9de332afa486a --- /dev/null +++ b/tasks/pb-basic-001/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Determine all functions $f: \\mathbb{Z} \\rightarrow \\mathbb{Z}$ such that, for all $x, y \\in \\mathbb{Z}$, we have \\[ f(2x)+2f(y)=f(f(x+y)).\\]", + "solution": "By taking $x = 0$, we get $f(0) + 2f(y) = f(f(y))$ for all $y\\in \\mathbb{Z}$. So, the problem becomes:\n $$ f(2x) + 2f(y) = f(0) + 2f(x + y) $$\n Taking $x = 1$ for this one, we quickly obtain that $2(f(y+1) - f(y)) = f(2) - f(0) \\Leftrightarrow f(y+1)-f(y) = (f(2)-f(0))/2$, so $f$ is linear, that is there exists $k,c$ such that $f(x) = kx+c$. Plug this back into the original equation, we see $f(x) = 2x+c$ and $f(x)=0$ are all possible solutions, and these indeed satisfy the given condition", + "grading_guidelines": "(Partial)\n 1. Guessed the solution correctly\n 2. Proved $f(f(y)) = 2f(y) + f(0)$ and $f(2x) + 2f(0) = f(f(x))$\n(Almost)\n 1. Solved correctly, but did not check that the finding candidates are indeed the solutions to the given equation.", + "problem_id": "PB-Basic-001", + "level": "basic", + "category": "Algebra", + "source": "(Modified) IMO 2019, P1", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "$f(x) = 0$ and $f(x) = 2x + c$ for all integer $x$ and some constant $c$." +} diff --git a/tasks/pb-basic-001/tests/test.sh b/tasks/pb-basic-001/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-001/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-002/instruction.md b/tasks/pb-basic-002/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5a3a7ee3b68485b5200451025e2b321bd3138ad8 --- /dev/null +++ b/tasks/pb-basic-002/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-002 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Show that $x^2 + y^2 + z^2 + t^2 \ge xyzt$ for any positive real numbers $x, y, z, t$ that satisfy $2(x + y + z + t) \ge xyzt$. diff --git a/tasks/pb-basic-002/solution/solve.sh b/tasks/pb-basic-002/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5b62aa4059fe60a74d8bf77f0b906a41d1a332e1 --- /dev/null +++ b/tasks/pb-basic-002/solution/solve.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_e8da5f8fef2755f9cc890a1dc55114bf7f6d8c80cee54a81a6315a7b33774011' +Assume the contrary that $xyzt> x^2+y^2+z^2+t^2$. Using AM-GM, we have $xyzt> x^2+y^2+z^2+t^2 \geq 4\sqrt{xyzt}$, which means that $xyzt > 16$. From here, this implies $2(x+y+z+t) >16$ from the condition $2(x+y+z+t) \geq xyzt$. + However, from Cauchy-Scwarz, we have $x^2+y^2+z^2+t^2 \ge\frac{1}{4}(x+y+z+t)^2>2(x+y+z+t) \geq xyzt$. This is a contradiction. + + Therefore: $x^2+y^2+z^2+t^2\ge xyzt$. +IMO_PROOF_e8da5f8fef2755f9cc890a1dc55114bf7f6d8c80cee54a81a6315a7b33774011 diff --git a/tasks/pb-basic-002/task.toml b/tasks/pb-basic-002/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..771108ddea3033c105d361637294881b639267cd --- /dev/null +++ b/tasks/pb-basic-002/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-002" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-002" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-002/tests/grade_task.py b/tasks/pb-basic-002/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-002/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-002/tests/reference.json b/tasks/pb-basic-002/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..06343c98b32a9bee61bfb77e6c1bbcad1fbedfd7 --- /dev/null +++ b/tasks/pb-basic-002/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Show that $x^2 + y^2 + z^2 + t^2 \\ge xyzt$ for any positive real numbers $x, y, z, t$ that satisfy $2(x + y + z + t) \\ge xyzt$.", + "solution": "Assume the contrary that $xyzt> x^2+y^2+z^2+t^2$. Using AM-GM, we have $xyzt> x^2+y^2+z^2+t^2 \\geq 4\\sqrt{xyzt}$, which means that $xyzt > 16$. From here, this implies $2(x+y+z+t) >16$ from the condition $2(x+y+z+t) \\geq xyzt$.\n However, from Cauchy-Scwarz, we have $x^2+y^2+z^2+t^2 \\ge\\frac{1}{4}(x+y+z+t)^2>2(x+y+z+t) \\geq xyzt$. This is a contradiction.\n\n Therefore: $x^2+y^2+z^2+t^2\\ge xyzt$.", + "grading_guidelines": "(Partial)\n 1. Attempted the \"proof by contradiction\" and made a positive progress based on it.\n 2. Applied the AM-GM inequality correctly.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-002", + "level": "basic", + "category": "Algebra", + "source": "(Modified) All-Russian MO 2013, Grade 11, P6", + "max_score": 7, + "difficulty": "pre-IMO", + "short_answer": " " +} diff --git a/tasks/pb-basic-002/tests/test.sh b/tasks/pb-basic-002/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-002/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-003/instruction.md b/tasks/pb-basic-003/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f5109504b96162b96904a3c001a3b9e9f5daa8d3 --- /dev/null +++ b/tasks/pb-basic-003/instruction.md @@ -0,0 +1,8 @@ +# PB-Basic-003 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Find all functions $f\colon \mathbb{R} \rightarrow \mathbb{R}$ such that for all $a,b \in \mathbb{R}$, + \[ (b - a)f(f(a)) = a f(a + f(b)). \]" diff --git a/tasks/pb-basic-003/solution/solve.sh b/tasks/pb-basic-003/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb7f772c85db4e80bc2067003fd5e5d23921adaf --- /dev/null +++ b/tasks/pb-basic-003/solution/solve.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_1e4a8c99a55a3f90754e4d740d058bf6fd392ac6897e955daa646ad1c9001667' +Let $P(a,b)$ denote the given assertion. + $P(a,a) \implies f(a+f(a))=0$ + $P(0,b) \implies f(f(0))=0$ + $P(f(0),b) \implies f(0)f(f(0)+f(b))=(b-f(0))f(0)$ + + So $f(0)=0$ or $ f(f(0)+f(b))=(b-f(0))$ + + If $ f(f(0)+f(b))=(b-f(0))$, setting $b \rightarrow f(b)+b \implies f(b)=-b+f(0)$ and checking we see that $f(a)=-a+k$ truly satisfies the condition + Suppose now $f(0)=0$ + + $P(a,0) \implies f(f(a))=-f(a)$ + So $P(a,b)$ becomes $af(a+f(b))=(a-b)f(a)$ + So $P(a,f(b)+b)$ gives us $f(a)=0$ or $f(a)=-a$ + + Finally $f(a)=0, f(a)=-a+k$ where $k$ is a constant +IMO_PROOF_1e4a8c99a55a3f90754e4d740d058bf6fd392ac6897e955daa646ad1c9001667 diff --git a/tasks/pb-basic-003/task.toml b/tasks/pb-basic-003/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..450c7811c2b372a486ae4b0d10094f171f5bc189 --- /dev/null +++ b/tasks/pb-basic-003/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-003" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-003" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-003/tests/grade_task.py b/tasks/pb-basic-003/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-003/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-003/tests/reference.json b/tasks/pb-basic-003/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..008b9a6a9555132f41e0e33a0d70ecb4da79ab77 --- /dev/null +++ b/tasks/pb-basic-003/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Find all functions $f\\colon \\mathbb{R} \\rightarrow \\mathbb{R}$ such that for all $a,b \\in \\mathbb{R}$,\n \\[ (b - a)f(f(a)) = a f(a + f(b)). \\]\"", + "solution": "Let $P(a,b)$ denote the given assertion.\n $P(a,a) \\implies f(a+f(a))=0$\n $P(0,b) \\implies f(f(0))=0$\n $P(f(0),b) \\implies f(0)f(f(0)+f(b))=(b-f(0))f(0)$\n\n So $f(0)=0$ or $ f(f(0)+f(b))=(b-f(0))$\n\n If $ f(f(0)+f(b))=(b-f(0))$, setting $b \\rightarrow f(b)+b \\implies f(b)=-b+f(0)$ and checking we see that $f(a)=-a+k$ truly satisfies the condition\n Suppose now $f(0)=0$\n\n $P(a,0) \\implies f(f(a))=-f(a)$\n So $P(a,b)$ becomes $af(a+f(b))=(a-b)f(a)$\n So $P(a,f(b)+b)$ gives us $f(a)=0$ or $f(a)=-a$\n\n Finally $f(a)=0, f(a)=-a+k$ where $k$ is a constant", + "grading_guidelines": "(Partial)\n 1. Proved that either $f(0)=0$ or $f(x)=-x+k$ for some constant $k$\n(Almost)\n 1. Solved correctly by handling the case $f(0)=0$, but did not check that the candidates are indeed the solutions to given equation.", + "problem_id": "PB-Basic-003", + "level": "basic", + "category": "Algebra", + "source": "(Modified) Balkan MO 2023, P1", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "$f(x)=0, f(x)=-x+k$ where $k$ is a constant" +} diff --git a/tasks/pb-basic-003/tests/test.sh b/tasks/pb-basic-003/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-003/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-004/instruction.md b/tasks/pb-basic-004/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ccba0352daa27cf3afb5f4b2e967c87f4032cc9 --- /dev/null +++ b/tasks/pb-basic-004/instruction.md @@ -0,0 +1,9 @@ +# PB-Basic-004 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Find all strictly increasing functions $g:\mathbb{R} \to \mathbb{R}$ such that: + (a) $g$ is surjective + (b) $g(g(x))=g(x)+20x.$ diff --git a/tasks/pb-basic-004/solution/solve.sh b/tasks/pb-basic-004/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..77cb94e3236e19efb72dd48ee26b760ab14582db --- /dev/null +++ b/tasks/pb-basic-004/solution/solve.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_959a62cc69e0b6221d988ae3f1d8e652ab339dd8fecfc092c12238e4c23352dc' +Note that the function is bijective, so setting $x=0$ gives $g(0)=0$ and since it is strictly increasing, we further derive $g(x)>0$ for $x>0$ and $g(x)<0$ for $x<0$. + + Consider the sequence $u_0 = x, u_{n+1} = g(u_n)$, we have that $u_{n+1} = u_n + 20u_{n-1}$, which gives $u_n = a (-4)^n + b 5^n$ for some real number $a, b$. Moreover, since $g$ is a bijective, there exists a real number $r$ such that $u_{-1} = r$, and so the sequence is well-defined for negative integer $n$ by defining the sequence backward. And since the sequence is increasing, $u_0 > 0$ implies $u_n > 0$ for all integer $n$. + + We will show that $a = 0$, which implies $g(x) = u_1 = 5u_0 = 5x$. + + Indeed, assume that $a > 0$, if $u_0 = x > 0$ then we choose a sufficiently small odd negative integer $n$ such that $(-4/5)^n < -b/a$, this gives $u_n < 0$. However, since $g$ is increasing and $u_0 > 0$, we must have that $u_n > 0$, which is a contradiction. Similarly, if $u_0 = a+b < 0$ then we must have $b < 0$ given $a > 0$, and so for a sufficiently small negative even integer $n$, we have $(-4/5)^n > -b/a$, which gives $u_n > 0$, which is a contradiction. Thus, we must have $a \leq 0$. + + Similarly, we can show that $a < 0$ will lead to a contradiction, and so, we must have $a \geq 0$. + + Together, this implies that $a = 0$. Hence proved. +IMO_PROOF_959a62cc69e0b6221d988ae3f1d8e652ab339dd8fecfc092c12238e4c23352dc diff --git a/tasks/pb-basic-004/task.toml b/tasks/pb-basic-004/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4b27b299801f3e0ae3d96d1ba60f022041a4e6f3 --- /dev/null +++ b/tasks/pb-basic-004/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-004" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-004" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-004/tests/grade_task.py b/tasks/pb-basic-004/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-004/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-004/tests/reference.json b/tasks/pb-basic-004/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..00aea0240b2bb5372677eabf815f662123a6c9bd --- /dev/null +++ b/tasks/pb-basic-004/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Find all strictly increasing functions $g:\\mathbb{R} \\to \\mathbb{R}$ such that:\n (a) $g$ is surjective\n (b) $g(g(x))=g(x)+20x.$", + "solution": "Note that the function is bijective, so setting $x=0$ gives $g(0)=0$ and since it is strictly increasing, we further derive $g(x)>0$ for $x>0$ and $g(x)<0$ for $x<0$.\n\n Consider the sequence $u_0 = x, u_{n+1} = g(u_n)$, we have that $u_{n+1} = u_n + 20u_{n-1}$, which gives $u_n = a (-4)^n + b 5^n$ for some real number $a, b$. Moreover, since $g$ is a bijective, there exists a real number $r$ such that $u_{-1} = r$, and so the sequence is well-defined for negative integer $n$ by defining the sequence backward. And since the sequence is increasing, $u_0 > 0$ implies $u_n > 0$ for all integer $n$.\n\n We will show that $a = 0$, which implies $g(x) = u_1 = 5u_0 = 5x$.\n\n Indeed, assume that $a > 0$, if $u_0 = x > 0$ then we choose a sufficiently small odd negative integer $n$ such that $(-4/5)^n < -b/a$, this gives $u_n < 0$. However, since $g$ is increasing and $u_0 > 0$, we must have that $u_n > 0$, which is a contradiction. Similarly, if $u_0 = a+b < 0$ then we must have $b < 0$ given $a > 0$, and so for a sufficiently small negative even integer $n$, we have $(-4/5)^n > -b/a$, which gives $u_n > 0$, which is a contradiction. Thus, we must have $a \\leq 0$.\n\n Similarly, we can show that $a < 0$ will lead to a contradiction, and so, we must have $a \\geq 0$.\n\n Together, this implies that $a = 0$. Hence proved.", + "grading_guidelines": "(Partial)\n 1. Proved $g(0)=0$\n 2. Constructed the sequence $u_n =g^{(n)}(x)$ and the recurrence relation.\n(Almost)\n 1. Solved correctly, but did not check that the candidates are indeed the solutions to given equation.", + "problem_id": "PB-Basic-004", + "level": "basic", + "category": "Algebra", + "source": "(Modified) VMO 2012, Day2 P3", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "$g(x) = 5x$ for all x" +} diff --git a/tasks/pb-basic-004/tests/test.sh b/tasks/pb-basic-004/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-004/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-005/instruction.md b/tasks/pb-basic-005/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c58897278b681856115e7ce3bc5f01bb353ddce9 --- /dev/null +++ b/tasks/pb-basic-005/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-005 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $P$ be a polynomial with real coefficients whose leading coefficient is $1$. Suppose that for all nonzero real numbers $x$, we have $P(x) + P(1/x) = \frac{P(x + 1/x) + P(x - 1/x)}{2}$. Determine all possibilities for $P$. diff --git a/tasks/pb-basic-005/solution/solve.sh b/tasks/pb-basic-005/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..59f6e402e316bbeb76f8a6dde793047f5b944ea6 --- /dev/null +++ b/tasks/pb-basic-005/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_9614ffce4c61b26b1f009155d52fd573501158b436a3eb46f42044e23cfc4109' +Substitute $\frac{1}{x}$ in the place of $x$. Comparing with the original equation, one can see that $P(x-\frac{1}{x})=P(-x+\frac{1}{x})$ . This implies that $P$ is even. + + Suppose $\deg P\geq 6$. Let $P(x)= x^n + a x^{n-2} + b x^{n-4} +Q(x)$, where $\deg Q < n-4$. Comparing the coefficient of $x^{n-4}$ in the given condition, we have that $b = \frac{2\binom{n}{2}+2b}{2}$, which is a contradiction. Therefore, $\deg P \leq 4$. + + If $\deg P = 4$, let $P(x) = x^4 + ax^2 +b$. Comparing the constant term, we can conclude that $b=6$. The possible solutions are $P(x) = x^4 +a x^2 +6$ for all real numbers $a$. + + If $\deg P = 2$, let $P(x) = x^2 +a$. Comparing the constant term, we can conclude that $a=0$. The only possible solution is $P(x)=x^2$. + + Therefore, the possible solutions are $P(x)= x^4 +ax^2 +6$, $P(x)=x^2$ which satisfies the condition. +IMO_PROOF_9614ffce4c61b26b1f009155d52fd573501158b436a3eb46f42044e23cfc4109 diff --git a/tasks/pb-basic-005/task.toml b/tasks/pb-basic-005/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e07fe21d18c5eb337a610b2c42b2e8c46f59a6ad --- /dev/null +++ b/tasks/pb-basic-005/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-005" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-005" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-005/tests/grade_task.py b/tasks/pb-basic-005/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-005/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-005/tests/reference.json b/tasks/pb-basic-005/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..917193c908621eee7adce34563306579de30df88 --- /dev/null +++ b/tasks/pb-basic-005/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $P$ be a polynomial with real coefficients whose leading coefficient is $1$. Suppose that for all nonzero real numbers $x$, we have $P(x) + P(1/x) = \\frac{P(x + 1/x) + P(x - 1/x)}{2}$. Determine all possibilities for $P$.", + "solution": "Substitute $\\frac{1}{x}$ in the place of $x$. Comparing with the original equation, one can see that $P(x-\\frac{1}{x})=P(-x+\\frac{1}{x})$ . This implies that $P$ is even.\n\n Suppose $\\deg P\\geq 6$. Let $P(x)= x^n + a x^{n-2} + b x^{n-4} +Q(x)$, where $\\deg Q < n-4$. Comparing the coefficient of $x^{n-4}$ in the given condition, we have that $b = \\frac{2\\binom{n}{2}+2b}{2}$, which is a contradiction. Therefore, $\\deg P \\leq 4$.\n\n If $\\deg P = 4$, let $P(x) = x^4 + ax^2 +b$. Comparing the constant term, we can conclude that $b=6$. The possible solutions are $P(x) = x^4 +a x^2 +6$ for all real numbers $a$.\n\n If $\\deg P = 2$, let $P(x) = x^2 +a$. Comparing the constant term, we can conclude that $a=0$. The only possible solution is $P(x)=x^2$.\n\n Therefore, the possible solutions are $P(x)= x^4 +ax^2 +6$, $P(x)=x^2$ which satisfies the condition.", + "grading_guidelines": "(Partial)\n 1. Proved that $P$ is even.\n 2. Correctly identified all solutions.\n(Almost)\n 1. Proved $\\deg(P)\\le 4$, but did not conclude the proof.", + "problem_id": "PB-Basic-005", + "level": "basic", + "category": "Algebra", + "source": "(Modified) ELMO 2023 Shortlist A1", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "$P(x)= x^4 +ax^2 +6$, $P(x)=x^2$" +} diff --git a/tasks/pb-basic-005/tests/test.sh b/tasks/pb-basic-005/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-005/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-006/instruction.md b/tasks/pb-basic-006/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0139bb94628fb1eefa76ace81011f8d57734bb1b --- /dev/null +++ b/tasks/pb-basic-006/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-006 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Consider any infinite sequence of integers $c_0, c_1, c_2, \ldots $ such that $c_0 \neq 0$. Prove that for some integer $k \geq 0$, the polynomial $P(x) = \sum_{i = 0}^k c_i x^i$ has fewer than $k$ distinct real roots. diff --git a/tasks/pb-basic-006/solution/solve.sh b/tasks/pb-basic-006/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0e3ba598e122835cc23c8dc2287a72581a845d62 --- /dev/null +++ b/tasks/pb-basic-006/solution/solve.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_efb06b200a3c566e85c10e0b573679e8344c15ac772401aa6728ec42d72dfea1' +If there exists an integer $k>0$ such that $c_k = 0$, $P(x)=\sum_{i=0}^k c_i x^i$ has less than $k$ roots. So it suffices to see the cases where $c_k \ne 0$ for all integers $k>0$. Let's prove the following lemma: + If a polynomial $\sum_{i=0}^n a_i x^i$ has $n$ different real roots, $(\frac{a_{1}}{a_0})^2 - 2 \frac{a_{2}}{a_0} \geq n\sqrt[n]{\frac{a_n ^2}{a_0^2}}$ + + (Proof) The left hand side is the sum of squares of inverses of all roots. The right hand side is $n$ times the $n$th root of the product of square of inverses of roots. By AM-GM, we can see that the inequality holds. + + Going back to the main proof, let's assume that all $P(x)=\sum_{i=0}^k c_i x^i$ has exactly $k$ distinct real roots. + By the lemma, $\frac{c_{1}^2 - 2c_0 c_{2}}{\sqrt[n]{c_0^{2n-2}}} \geq n\sqrt[n]{c_n^2}$, which shows that $1\leq c_n^2 \leq (\frac{\frac{c_{1}^2 - 2c_0 c_{2}}{\sqrt[n]{c_0^{2n-2}}}}{n})^n$. We can easily see that the righthandside tends to $0$ as $n$ goes to infinity. It's a contradiction. +IMO_PROOF_efb06b200a3c566e85c10e0b573679e8344c15ac772401aa6728ec42d72dfea1 diff --git a/tasks/pb-basic-006/task.toml b/tasks/pb-basic-006/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b676b36e1d884bc0fe109f06cc622609b0c97c4a --- /dev/null +++ b/tasks/pb-basic-006/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-006" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-006" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-006/tests/grade_task.py b/tasks/pb-basic-006/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-006/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-006/tests/reference.json b/tasks/pb-basic-006/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..2fa28cd727266c94fb02070b62cecfd6ed401faf --- /dev/null +++ b/tasks/pb-basic-006/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Consider any infinite sequence of integers $c_0, c_1, c_2, \\ldots $ such that $c_0 \\neq 0$. Prove that for some integer $k \\geq 0$, the polynomial $P(x) = \\sum_{i = 0}^k c_i x^i$ has fewer than $k$ distinct real roots.", + "solution": "If there exists an integer $k>0$ such that $c_k = 0$, $P(x)=\\sum_{i=0}^k c_i x^i$ has less than $k$ roots. So it suffices to see the cases where $c_k \\ne 0$ for all integers $k>0$. Let's prove the following lemma:\n If a polynomial $\\sum_{i=0}^n a_i x^i$ has $n$ different real roots, $(\\frac{a_{1}}{a_0})^2 - 2 \\frac{a_{2}}{a_0} \\geq n\\sqrt[n]{\\frac{a_n ^2}{a_0^2}}$\n\n (Proof) The left hand side is the sum of squares of inverses of all roots. The right hand side is $n$ times the $n$th root of the product of square of inverses of roots. By AM-GM, we can see that the inequality holds.\n\n Going back to the main proof, let's assume that all $P(x)=\\sum_{i=0}^k c_i x^i$ has exactly $k$ distinct real roots.\n By the lemma, $\\frac{c_{1}^2 - 2c_0 c_{2}}{\\sqrt[n]{c_0^{2n-2}}} \\geq n\\sqrt[n]{c_n^2}$, which shows that $1\\leq c_n^2 \\leq (\\frac{\\frac{c_{1}^2 - 2c_0 c_{2}}{\\sqrt[n]{c_0^{2n-2}}}}{n})^n$. We can easily see that the righthandside tends to $0$ as $n$ goes to infinity. It's a contradiction.", + "grading_guidelines": "(Partial)\n 1. Derived a useful inequality of between $c_n$ based on Vieta's formula (along with the proof by contradiction).\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-006", + "level": "basic", + "category": "Algebra", + "source": "(Modified) ELMO 2023 Shortlist A3", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": " " +} diff --git a/tasks/pb-basic-006/tests/test.sh b/tasks/pb-basic-006/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-006/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-007/instruction.md b/tasks/pb-basic-007/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6dc913ece26c8886288ed878a2544b844da29d9e --- /dev/null +++ b/tasks/pb-basic-007/instruction.md @@ -0,0 +1,9 @@ +# PB-Basic-007 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Determine all positive integers $n$ and integer sequences $a_0, a_1,\ldots, a_n$ such that $a_n = 3$ and + \[f(a_{i-1}) = a_i\] + for all $i = 1,2,\ldots,n$, where $f(x) = a_n x^n + a_{n-1} x^{n-1} + \cdots + a_1 x + a_0$. diff --git a/tasks/pb-basic-007/solution/solve.sh b/tasks/pb-basic-007/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..86dd8fef42a49e6e19dec6d989ec4ba0b5e9e115 --- /dev/null +++ b/tasks/pb-basic-007/solution/solve.sh @@ -0,0 +1,65 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_1662e5516f5dbc92debb447c2e0a0da6f00ba833f6da043f0fb09093e86df4c6' +$n=2$ with $\left(a_{0}, a_{1}, a_{2}\right)=(-1,1,3)$. + + We provide a solution when we relax the condition $a_n=3$. When we add back the condition, the only solution is $n=2$ with $\left(a_{0}, a_{1}, a_{2}\right)=(-1,1,3)$. + + When relaxing the condition $a_n=3$, the short answers are $n=1$ with $\left(a_{0}, a_{1}\right)=(2,-2) ; n=2$ with $\left(a_{0}, a_{1}, a_{2}\right)=(-1,1,3)$; or $n$ even with $a_{0}=\cdots=a_{n}=-1$. + + It is clear that $a_{0} \neq 0$ as otherwise $a_{n}=0$. For any $k=1, \ldots, n+1$, let $I_{k}$ be the convex hull of $0, a_{0}, \ldots, a_{k-1}$. We will define $a_{-1}=0$ for convenience. + + We first show that $a_{k}$ is not in the interior of $I_{k}$. Otherwise, let $i, j \in\{-1,0, \ldots, k-$ $1\}$ be such that $a_{i}, a_{j}$ are the endpoints of $I_{k}$. Then as $a_{i}-a_{j} \mid f\left(a_{i}\right)-f\left(a_{j}\right)=$ $a_{i+1}-a_{j+1}$, we know that $a_{i+1}$ and $a_{j+1}$ are also the endpoints of $I_{k}$, and by continuing this argument we eventually get that $a_{k}$ is an endpoint of $I_{k}$, which is a contradiction. A consequence is that the endpoints of $I_{k}$ are $a_{k-2}$ and $a_{k-1}$ unless $a_{k-2}=a_{k-1}$. Now if $a_{i}=0$ for some $i>0$, then it is clear that the nonzero terms of $a_{0}, \ldots, a_{n}$ all have the same sign. Then $f\left(a_{i-1}\right)=0$ gives a contradiction if we take $i$ to be the smallest index with $a_{i}=0$. + + We first assume that $a_{n} \neq a_{0}$. If $\left|a_{i}\right|<2$ for any $i2$. It is easy to verify that the last four cases cannot occur by evaluating $f(1)$. Therefore we have $n=2, a_{0}=-a_{1} \in\{1,-1\}$, or $n=1, a_{0}= \pm 1$. In the first case, we have $a_{2}-a_{1}=f\left(a_{1}\right)-f\left(a_{0}\right)=2 a_{1}^{2}=2$ and so $a_{2}=a_{1}+2$. Therefore $a_{1}=f\left(a_{0}\right)=$ $\left(a_{0}+a_{1}+2\right)+a_{0} a_{1}=2-1=1$, and we get the solution $a_{0}, a_{1}, a_{2}=-1,1,3$. In the second case, we have $a_{1}=f\left(a_{0}\right)= \pm a_{1} \pm 1$, and we get no solution by parity. + + Now if $a_{n} \neq a_{0}$ and $a_{n}$ has the largest absolute value, pick $i\left|a_{k}\right|$ as $a_{k-1}$ and $a_{k}$ are the endpoints of $I_{k-1}$. We know that $a_{0} \mid a_{k-1}$ and $a_{0} \mid a_{k}$, and so $\left|a_{k-1}\right| \geqslant\left|a_{k}\right|+\left|a_{0}\right|$. As $a_{k-1} \mid f\left(a_{k-1}\right)-f(0)=a_{k}-a_{0}$, we have $\left|a_{k-1}\right| \leqslant\left|a_{k}-a_{0}\right|$ since $a_{k} \neq a_{0}$. This shows that $\left|a_{k}-a_{0}\right|=\left|a_{k}\right|+\left|a_{0}\right|=\left|a_{k-1}\right|$. As a consequence, we have $\left|a_{i}\right| \leqslant\left|a_{k}\right|+\left|a_{0}\right|$ for any $i$. Now we have + + \[ + \left|a_{k}\right|=\left|f\left(a_{k-1}\right)\right| \geqslant\left|a_{k}\right|\left(\left|a_{k-1}\right|^{n}-\left|a_{k-1}\right|^{n-1}-\cdots-1\right)-\left|a_{0}\right|\left(\left|a_{k-1}\right|^{n-1}+\cdots+1\right) . + \] + + Hence + + \[ + \frac{\left|a_{k}\right|}{\left|a_{0}\right|} \leqslant \frac{\left|a_{k-1}\right|^{n-1}+\cdots+1}{\left|a_{k-1}\right|^{n}-\left|a_{k-1}\right|^{n-1}-\cdots-1} . + \] + + Note that $\left|a_{k}\right| /\left|a_{0}\right|$ is a positive integer. If it is greater than 1 , then as $\left|a_{k-1}\right|=$ $\left|a_{k}\right|+\left|a_{0}\right| \geqslant 3$, we have + + \[ + \frac{\left|a_{k-1}\right|^{n-1}+\cdots+1}{\left|a_{k-1}\right|^{n}-\left|a_{k-1}\right|^{n-1}-\cdots-1} \leqslant \frac{3^{n-1}+\cdots+1}{3^{n}-3^{n-1}-\cdots-1}<1 + \] + + which is a contradiction. Therefore $\left|a_{k}\right|=\left|a_{0}\right|$, and so $a_{k}=-a_{0}$. This also shows that $a_{k-1}=2 a_{0}$, and by the inequality we see that $\left|a_{0}\right|=1$. With these constraints, we know that $a_{0}, \ldots, a_{n} \in\left\{a_{0},-a_{0}, 2 a_{0}\right\}$. By enumerating, we only have the possibilities $a_{0}, \ldots, a_{n}= \pm 1, \pm 2, \mp 1, \pm 2, \mp 1, \ldots, \pm 2, \mp 1$, or $a_{0}, \ldots, a_{n}= \pm 1, \mp 1, \pm 2, \mp 1, \ldots, \pm 2, \mp 1$, or $a_{0}, \ldots, a_{n}= \pm 1, \pm 2, \mp 1, \ldots, \mp 1$. For the first case, we have $n=2 t$ adn $2 a_{0}=a_{1}=$ $f\left(a_{0}\right)=-(t-1) a_{0}+2 t$, showing that $t=1, a_{0}=1$, and by plugging in $a_{1}$ we get a contradiction. For the second case, we have $n=2 t+1$ and $-a_{0}=a_{1}=f\left(a_{0}\right)=$ $(2 t+1) a_{0}-(t+1)$, which has no solutions. For the third case, if $a_{0}=1$ then we get $n=2$ and $a_{0}, a_{1}, a_{2}=1,2,-1$ by the equation $a_{1}=f\left(a_{0}\right)$, which is not a solution. Thus $a_{0}=-1$, and by plugging in $a_{0}$ we also get a contradiction. + + The remaining case is $a_{n}=a_{0}$. If $a_{n}=a_{n-1}$, then we must have $a_{0}=\cdots=a_{n}$. By plugging in $a_{0}$ we have $a_{0}^{n+1}+\cdots+a_{0}^{2}=0$, and so $a_{0}=-1$ and $n$ is even. Now assume that $a_{n} \neq a_{n-1}$. Then $a_{n}, a_{n-1}$ are the endpoints of $I_{n+1}$. Note that if $a_{n-2}=a_{n-1}$ + + then $a_{n}=a_{n-1}$, which is a contradiction. Therefore $a_{n-2}, a_{n-1}$ are also endpoints of $I_{n+1}$. By induction we may show that $a_{k}, a_{k-1}$ are the endpoints of $I_{k+1}$. As $a_{0} \neq 0$, we must have $a_{n}=a_{n-2}=\cdots=a_{0}$, and so $n$ is even. This shows that $a_{n-1}=\cdots=a_{1}$. Now we have + + \[ + a_{0}^{n+1}+a_{0}^{n-1} a_{1}+\cdots+a_{0}^{3}+a_{0} a_{1}+a_{0}=a_{1} + \] + + and + + \[ + a_{0} a_{1}^{n}+a_{1}^{n}+\cdots+a_{0} a_{1}^{2}+a_{1}^{2}+a_{0}=a_{0} + \] + + The latter can be rewritten as $\left(a_{0}+1\right)\left(a_{1}^{n-2}+a_{1}^{n-4}+\cdots+1\right)=0$. Therefore $a_{0}=-1$ or $a_{1}=-1$. If $a_{0}=-1$, then $-\left(a_{1}+1\right) n / 2-1=a_{1}$, or equivalently, $\left(a_{1}+1\right)(n+2)=0$. This shows that $a_{1}=-1$, which was already obtained above. If $a_{1}=-1$, then the first equation gives $a_{0}^{n+1}=-1$ and so $a_{0}=-1$ too. + + In conclusion, all the solutions are: $n=1$ with $\left(a_{0}, a_{1}\right)=(2,-2) ; n=2$ with $\left(a_{0}, a_{1}, a_{2}\right)=(-1,1,3)$; or $n$ even with $a_{0}=\cdots=a_{n}=-1$. +IMO_PROOF_1662e5516f5dbc92debb447c2e0a0da6f00ba833f6da043f0fb09093e86df4c6 diff --git a/tasks/pb-basic-007/task.toml b/tasks/pb-basic-007/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e10bc47ca58c98788dfe0f37b91469266fb7167b --- /dev/null +++ b/tasks/pb-basic-007/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-007" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-007" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-007/tests/grade_task.py b/tasks/pb-basic-007/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-007/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-007/tests/reference.json b/tasks/pb-basic-007/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..34bf0749b5ba9b0052b2e536da6c37f57b06e531 --- /dev/null +++ b/tasks/pb-basic-007/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Determine all positive integers $n$ and integer sequences $a_0, a_1,\\ldots, a_n$ such that $a_n = 3$ and\n \\[f(a_{i-1}) = a_i\\]\n for all $i = 1,2,\\ldots,n$, where $f(x) = a_n x^n + a_{n-1} x^{n-1} + \\cdots + a_1 x + a_0$.", + "solution": "$n=2$ with $\\left(a_{0}, a_{1}, a_{2}\\right)=(-1,1,3)$.\n\n We provide a solution when we relax the condition $a_n=3$. When we add back the condition, the only solution is $n=2$ with $\\left(a_{0}, a_{1}, a_{2}\\right)=(-1,1,3)$.\n\n When relaxing the condition $a_n=3$, the short answers are $n=1$ with $\\left(a_{0}, a_{1}\\right)=(2,-2) ; n=2$ with $\\left(a_{0}, a_{1}, a_{2}\\right)=(-1,1,3)$; or $n$ even with $a_{0}=\\cdots=a_{n}=-1$.\n\n It is clear that $a_{0} \\neq 0$ as otherwise $a_{n}=0$. For any $k=1, \\ldots, n+1$, let $I_{k}$ be the convex hull of $0, a_{0}, \\ldots, a_{k-1}$. We will define $a_{-1}=0$ for convenience.\n\n We first show that $a_{k}$ is not in the interior of $I_{k}$. Otherwise, let $i, j \\in\\{-1,0, \\ldots, k-$ $1\\}$ be such that $a_{i}, a_{j}$ are the endpoints of $I_{k}$. Then as $a_{i}-a_{j} \\mid f\\left(a_{i}\\right)-f\\left(a_{j}\\right)=$ $a_{i+1}-a_{j+1}$, we know that $a_{i+1}$ and $a_{j+1}$ are also the endpoints of $I_{k}$, and by continuing this argument we eventually get that $a_{k}$ is an endpoint of $I_{k}$, which is a contradiction. A consequence is that the endpoints of $I_{k}$ are $a_{k-2}$ and $a_{k-1}$ unless $a_{k-2}=a_{k-1}$. Now if $a_{i}=0$ for some $i>0$, then it is clear that the nonzero terms of $a_{0}, \\ldots, a_{n}$ all have the same sign. Then $f\\left(a_{i-1}\\right)=0$ gives a contradiction if we take $i$ to be the smallest index with $a_{i}=0$.\n\n We first assume that $a_{n} \\neq a_{0}$. If $\\left|a_{i}\\right|<2$ for any $i2$. It is easy to verify that the last four cases cannot occur by evaluating $f(1)$. Therefore we have $n=2, a_{0}=-a_{1} \\in\\{1,-1\\}$, or $n=1, a_{0}= \\pm 1$. In the first case, we have $a_{2}-a_{1}=f\\left(a_{1}\\right)-f\\left(a_{0}\\right)=2 a_{1}^{2}=2$ and so $a_{2}=a_{1}+2$. Therefore $a_{1}=f\\left(a_{0}\\right)=$ $\\left(a_{0}+a_{1}+2\\right)+a_{0} a_{1}=2-1=1$, and we get the solution $a_{0}, a_{1}, a_{2}=-1,1,3$. In the second case, we have $a_{1}=f\\left(a_{0}\\right)= \\pm a_{1} \\pm 1$, and we get no solution by parity.\n\n Now if $a_{n} \\neq a_{0}$ and $a_{n}$ has the largest absolute value, pick $i\\left|a_{k}\\right|$ as $a_{k-1}$ and $a_{k}$ are the endpoints of $I_{k-1}$. We know that $a_{0} \\mid a_{k-1}$ and $a_{0} \\mid a_{k}$, and so $\\left|a_{k-1}\\right| \\geqslant\\left|a_{k}\\right|+\\left|a_{0}\\right|$. As $a_{k-1} \\mid f\\left(a_{k-1}\\right)-f(0)=a_{k}-a_{0}$, we have $\\left|a_{k-1}\\right| \\leqslant\\left|a_{k}-a_{0}\\right|$ since $a_{k} \\neq a_{0}$. This shows that $\\left|a_{k}-a_{0}\\right|=\\left|a_{k}\\right|+\\left|a_{0}\\right|=\\left|a_{k-1}\\right|$. As a consequence, we have $\\left|a_{i}\\right| \\leqslant\\left|a_{k}\\right|+\\left|a_{0}\\right|$ for any $i$. Now we have\n\n \\[\n \\left|a_{k}\\right|=\\left|f\\left(a_{k-1}\\right)\\right| \\geqslant\\left|a_{k}\\right|\\left(\\left|a_{k-1}\\right|^{n}-\\left|a_{k-1}\\right|^{n-1}-\\cdots-1\\right)-\\left|a_{0}\\right|\\left(\\left|a_{k-1}\\right|^{n-1}+\\cdots+1\\right) .\n \\]\n\n Hence\n\n \\[\n \\frac{\\left|a_{k}\\right|}{\\left|a_{0}\\right|} \\leqslant \\frac{\\left|a_{k-1}\\right|^{n-1}+\\cdots+1}{\\left|a_{k-1}\\right|^{n}-\\left|a_{k-1}\\right|^{n-1}-\\cdots-1} .\n \\]\n\n Note that $\\left|a_{k}\\right| /\\left|a_{0}\\right|$ is a positive integer. If it is greater than 1 , then as $\\left|a_{k-1}\\right|=$ $\\left|a_{k}\\right|+\\left|a_{0}\\right| \\geqslant 3$, we have\n\n \\[\n \\frac{\\left|a_{k-1}\\right|^{n-1}+\\cdots+1}{\\left|a_{k-1}\\right|^{n}-\\left|a_{k-1}\\right|^{n-1}-\\cdots-1} \\leqslant \\frac{3^{n-1}+\\cdots+1}{3^{n}-3^{n-1}-\\cdots-1}<1\n \\]\n\n which is a contradiction. Therefore $\\left|a_{k}\\right|=\\left|a_{0}\\right|$, and so $a_{k}=-a_{0}$. This also shows that $a_{k-1}=2 a_{0}$, and by the inequality we see that $\\left|a_{0}\\right|=1$. With these constraints, we know that $a_{0}, \\ldots, a_{n} \\in\\left\\{a_{0},-a_{0}, 2 a_{0}\\right\\}$. By enumerating, we only have the possibilities $a_{0}, \\ldots, a_{n}= \\pm 1, \\pm 2, \\mp 1, \\pm 2, \\mp 1, \\ldots, \\pm 2, \\mp 1$, or $a_{0}, \\ldots, a_{n}= \\pm 1, \\mp 1, \\pm 2, \\mp 1, \\ldots, \\pm 2, \\mp 1$, or $a_{0}, \\ldots, a_{n}= \\pm 1, \\pm 2, \\mp 1, \\ldots, \\mp 1$. For the first case, we have $n=2 t$ adn $2 a_{0}=a_{1}=$ $f\\left(a_{0}\\right)=-(t-1) a_{0}+2 t$, showing that $t=1, a_{0}=1$, and by plugging in $a_{1}$ we get a contradiction. For the second case, we have $n=2 t+1$ and $-a_{0}=a_{1}=f\\left(a_{0}\\right)=$ $(2 t+1) a_{0}-(t+1)$, which has no solutions. For the third case, if $a_{0}=1$ then we get $n=2$ and $a_{0}, a_{1}, a_{2}=1,2,-1$ by the equation $a_{1}=f\\left(a_{0}\\right)$, which is not a solution. Thus $a_{0}=-1$, and by plugging in $a_{0}$ we also get a contradiction.\n\n The remaining case is $a_{n}=a_{0}$. If $a_{n}=a_{n-1}$, then we must have $a_{0}=\\cdots=a_{n}$. By plugging in $a_{0}$ we have $a_{0}^{n+1}+\\cdots+a_{0}^{2}=0$, and so $a_{0}=-1$ and $n$ is even. Now assume that $a_{n} \\neq a_{n-1}$. Then $a_{n}, a_{n-1}$ are the endpoints of $I_{n+1}$. Note that if $a_{n-2}=a_{n-1}$\n\n then $a_{n}=a_{n-1}$, which is a contradiction. Therefore $a_{n-2}, a_{n-1}$ are also endpoints of $I_{n+1}$. By induction we may show that $a_{k}, a_{k-1}$ are the endpoints of $I_{k+1}$. As $a_{0} \\neq 0$, we must have $a_{n}=a_{n-2}=\\cdots=a_{0}$, and so $n$ is even. This shows that $a_{n-1}=\\cdots=a_{1}$. Now we have\n\n \\[\n a_{0}^{n+1}+a_{0}^{n-1} a_{1}+\\cdots+a_{0}^{3}+a_{0} a_{1}+a_{0}=a_{1}\n \\]\n\n and\n\n \\[\n a_{0} a_{1}^{n}+a_{1}^{n}+\\cdots+a_{0} a_{1}^{2}+a_{1}^{2}+a_{0}=a_{0}\n \\]\n\n The latter can be rewritten as $\\left(a_{0}+1\\right)\\left(a_{1}^{n-2}+a_{1}^{n-4}+\\cdots+1\\right)=0$. Therefore $a_{0}=-1$ or $a_{1}=-1$. If $a_{0}=-1$, then $-\\left(a_{1}+1\\right) n / 2-1=a_{1}$, or equivalently, $\\left(a_{1}+1\\right)(n+2)=0$. This shows that $a_{1}=-1$, which was already obtained above. If $a_{1}=-1$, then the first equation gives $a_{0}^{n+1}=-1$ and so $a_{0}=-1$ too.\n\n In conclusion, all the solutions are: $n=1$ with $\\left(a_{0}, a_{1}\\right)=(2,-2) ; n=2$ with $\\left(a_{0}, a_{1}, a_{2}\\right)=(-1,1,3)$; or $n$ even with $a_{0}=\\cdots=a_{n}=-1$.", + "grading_guidelines": "(Incorrect)\n 1. We do not give partial credits for handling the cases when $n$ is small.\n(Partial)\n 1. Observed that $a_k$ should be greater or less than all $a_0, \\ldots, a_{k-1}$.\n 2. Dealt with the case $a_n = a_0$.\n 3. Any other useful observation regarding behavior of the sequnece $(a_i)$ which is useful in the possible solution.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-007", + "level": "basic", + "category": "Algebra", + "source": "(Modified) Taiwan TST 2024, 3J Day2 P6", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "$n=2$ with $\\left(a_{0}, a_{1}, a_{2}\\right)=(-1,1,3)$" +} diff --git a/tasks/pb-basic-007/tests/test.sh b/tasks/pb-basic-007/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-007/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-008/instruction.md b/tasks/pb-basic-008/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6e3c9ed540995e599796702f308d14a91929280d --- /dev/null +++ b/tasks/pb-basic-008/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-008 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $a,b,c$ be positive reals such that $a+b+c = 1$, prove that $\sqrt{a}+\sqrt{b}+\sqrt{c} \geq 3\sqrt{3}(ab+bc+ca)$. diff --git a/tasks/pb-basic-008/solution/solve.sh b/tasks/pb-basic-008/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0deb726404b004afb78ea7e847db10612a493fe --- /dev/null +++ b/tasks/pb-basic-008/solution/solve.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_ad671ff51b719ad08d069a872df41c8f8b089a5976e753f040ea64b9b784dfb8' +Renormalizing, we may suppose $a + b + c = 3$ and show $\sqrt{a}+\sqrt{b}+\sqrt{c} \geq ab+bc+ca$. Note that $\sqrt{a}+\sqrt{b}+\sqrt{c} \geq ab+bc+ca$ is equivalent to $2\sqrt{a}+2\sqrt{b}+2\sqrt{c} \geq 2ab+2bc+2ca \Leftrightarrow a^2+2\sqrt{a}+b^2+2\sqrt{b}+c^2+2\sqrt{c} \geq a^2+2ab+b^2+2bc+c^2+2ca = (a+b+c)^2$. The inequality is now equivalent to the inequality $a^2+2\sqrt{a}+b^2+2\sqrt{b}+c^2+2\sqrt{c} \geq 9$. Observe that from AM-GM, we have $a^2+\sqrt{a}+\sqrt{a} \geq 3a$. Similarly, we have $b^2+\sqrt{b}+\sqrt{b} \geq 3b$ and $c^2+\sqrt{c}+\sqrt{c} \geq 3c$. Adding these together, we have $a^2+2\sqrt{a}+b^2+2\sqrt{b}+c^2+2\sqrt{c} \geq 3(a+b+c) = 9$. Hence proved. +IMO_PROOF_ad671ff51b719ad08d069a872df41c8f8b089a5976e753f040ea64b9b784dfb8 diff --git a/tasks/pb-basic-008/task.toml b/tasks/pb-basic-008/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..edb2f487cc8d39f430a0acd7eafc2871309ce861 --- /dev/null +++ b/tasks/pb-basic-008/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-008" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-008" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-008/tests/grade_task.py b/tasks/pb-basic-008/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-008/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-008/tests/reference.json b/tasks/pb-basic-008/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..864186bf259c7c1a45faf3aa92f9c92dcaf051ad --- /dev/null +++ b/tasks/pb-basic-008/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $a,b,c$ be positive reals such that $a+b+c = 1$, prove that $\\sqrt{a}+\\sqrt{b}+\\sqrt{c} \\geq 3\\sqrt{3}(ab+bc+ca)$.", + "solution": "Renormalizing, we may suppose $a + b + c = 3$ and show $\\sqrt{a}+\\sqrt{b}+\\sqrt{c} \\geq ab+bc+ca$. Note that $\\sqrt{a}+\\sqrt{b}+\\sqrt{c} \\geq ab+bc+ca$ is equivalent to $2\\sqrt{a}+2\\sqrt{b}+2\\sqrt{c} \\geq 2ab+2bc+2ca \\Leftrightarrow a^2+2\\sqrt{a}+b^2+2\\sqrt{b}+c^2+2\\sqrt{c} \\geq a^2+2ab+b^2+2bc+c^2+2ca = (a+b+c)^2$. The inequality is now equivalent to the inequality $a^2+2\\sqrt{a}+b^2+2\\sqrt{b}+c^2+2\\sqrt{c} \\geq 9$. Observe that from AM-GM, we have $a^2+\\sqrt{a}+\\sqrt{a} \\geq 3a$. Similarly, we have $b^2+\\sqrt{b}+\\sqrt{b} \\geq 3b$ and $c^2+\\sqrt{c}+\\sqrt{c} \\geq 3c$. Adding these together, we have $a^2+2\\sqrt{a}+b^2+2\\sqrt{b}+c^2+2\\sqrt{c} \\geq 3(a+b+c) = 9$. Hence proved.", + "grading_guidelines": "(Partial)\n 1. Reduced the inequality to a more managable form so that one can complete the proof by applying one of the well-knnown inequalities (e.g., Cauchy-Schwarz, AM-GM, Muirhead, or Schur)\n(Almost)\n 1. Made a minor mistake when applying an inequality, or skipped rigorous justification for such a step.", + "problem_id": "PB-Basic-008", + "level": "basic", + "category": "Algebra", + "source": "(Modified) All-Russia MO 2002.", + "max_score": 7, + "difficulty": "pre-IMO", + "short_answer": " " +} diff --git a/tasks/pb-basic-008/tests/test.sh b/tasks/pb-basic-008/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-008/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-009/instruction.md b/tasks/pb-basic-009/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3e262e7bad4fbff559a5fc7b288ad3757391a8bc --- /dev/null +++ b/tasks/pb-basic-009/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-009 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $a_1,a_2,...,a_{18}$ be 18 real numbers, not necessarily distinct, with average $m$. Let $A$ denote the number of triples $1 \le i < j < k \le 18$ for which $a_i + a_j + a_k \ge 3m$. What is the minimum possible value of $A$? diff --git a/tasks/pb-basic-009/solution/solve.sh b/tasks/pb-basic-009/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..23306d4043aec005cc78bb1b48df14e7d63ef72a --- /dev/null +++ b/tasks/pb-basic-009/solution/solve.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_9d402d87386bcc57d6e799c2e7235c54c3eb7a6d3466ba66487e54443eb91c48' +I claim the answer is $136$. Take the construction $17, -1,...,-1,-1,-1,-1,-1,-1,-1,-1$, which clearly works. + Now I will show that this is the minimum. For any partition of $\{a_1, a_2, ..., a_{18}\}$ into six triplets, at least one triplet must satisfy that $a_i + a_j +a_k \ge 0$. + Therefore there are $\frac{18!}{(3!)^6 6!}$ partitions, and a fixed triplet is contatined in $\frac{15!}{(3!)^5 5!}$ partitions, so there are at least $\frac{18!}{(3!)^6 6!}/\frac{15!}{(3!)^5 5!} = 136$ partitions satisfying the condition. +IMO_PROOF_9d402d87386bcc57d6e799c2e7235c54c3eb7a6d3466ba66487e54443eb91c48 diff --git a/tasks/pb-basic-009/task.toml b/tasks/pb-basic-009/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..021a6d684f7f6b41cd6c6c4340f7f4a4cbce245e --- /dev/null +++ b/tasks/pb-basic-009/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-009" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-009" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-009/tests/grade_task.py b/tasks/pb-basic-009/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-009/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-009/tests/reference.json b/tasks/pb-basic-009/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..6c7be05782a444069b7ffabe83577765432444b8 --- /dev/null +++ b/tasks/pb-basic-009/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $a_1,a_2,...,a_{18}$ be 18 real numbers, not necessarily distinct, with average $m$. Let $A$ denote the number of triples $1 \\le i < j < k \\le 18$ for which $a_i + a_j + a_k \\ge 3m$. What is the minimum possible value of $A$?", + "solution": "I claim the answer is $136$. Take the construction $17, -1,...,-1,-1,-1,-1,-1,-1,-1,-1$, which clearly works.\n Now I will show that this is the minimum. For any partition of $\\{a_1, a_2, ..., a_{18}\\}$ into six triplets, at least one triplet must satisfy that $a_i + a_j +a_k \\ge 0$.\n Therefore there are $\\frac{18!}{(3!)^6 6!}$ partitions, and a fixed triplet is contatined in $\\frac{15!}{(3!)^5 5!}$ partitions, so there are at least $\\frac{18!}{(3!)^6 6!}/\\frac{15!}{(3!)^5 5!} = 136$ partitions satisfying the condition.", + "grading_guidelines": "(Partial)\n 1. Guessed the answer $136$, and constructed the equality case.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-009", + "level": "basic", + "category": "Combinatorics", + "source": "(Modified) ELMO 2013", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "$136$" +} diff --git a/tasks/pb-basic-009/tests/test.sh b/tasks/pb-basic-009/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-009/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-010/instruction.md b/tasks/pb-basic-010/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bee2f6c86055dcfdd02673a3ad4c8cc057780ee3 --- /dev/null +++ b/tasks/pb-basic-010/instruction.md @@ -0,0 +1,9 @@ +# PB-Basic-010 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +The numbers $\{ 1, 2, 3, \ldots , 2022 \}$ are partitioned into two sets $A$ and $B$ of size $1011$ each. Let $S_{AB}$ denote the set of all pairs $(a, b) \in A \times B$ where $a < b$, and let $S_{BA}$ denote the set of all pairs $(a, b) \in A \times B$ where $b < a$. + + Prove that $\sum_{(a, b) \in S_{AB}} (b - a) \neq \sum_{(a, b) \in S_{BA}} (a - b)$. diff --git a/tasks/pb-basic-010/solution/solve.sh b/tasks/pb-basic-010/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5aad421230fa3432e778c6b19e6231d3e377c3ad --- /dev/null +++ b/tasks/pb-basic-010/solution/solve.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_66bdc28500613c733898e74da7e52371bd2c9774f2a086ae1cf992b72dde0f1e' +Let $X = \sum_{(a, b) \in S_{AB}} (b - a)$, $Y=\sum_{(a, b) \in S_{BA}} (a -b)$ and $Z=X-Y$. We first analyze the case where all elements of $A$ are smaller than all elements of $B$. In that case, $S_{BA} = 0$, and + \[ X = \sum_{i = 1012}^{2022} \sum_{j = 1}^{1011} (i - j) = 1011 \cdot \left(\sum_{i = 1012}^{2022} i - \sum_{j = 1}^{1011} j \right) = 1011^3, \] + and so $Z = 1011^3$. + + Now, arrange the numbers $1$ to $2022$ on a line in increasing order from left to right, and consider how the quantity $Z$ changes if we swap the set of two adjacent numbers, where the left number is in $A$ and the right number is in $B$. Let $A_l$ and $B_l$ be the number of numbers from $A$ and $B$ to the left of this adjacent pair, and similarly let $A_r$ and $B_r$ be the number of numbers from $A$ and $B$ to the right of this adjacent pair, + + First think of how $X$ changes. By moving the number from $A$ one unit to the right, we decrease each $A$-$B$ segment of $B_r$ by one unit. By moving the number from $B$ one unit to the left, we shorten each $A$-$B$ segments of $A_l$ by one unit. Also, we eliminated the length-1 $A$-$B$ segment formed by the swapped points themselves. Thus, $X$ decreases by $B_r + A_l + 1$. + + Similarly, $Y$ increases by $A_r + B_l + 1$, after the swap. Thus, $Z$ decreases by $B_r + R_l + B_r + B_l + 2 = 2022$. + + Now, starting from the initial configuration where all the 1011 left-most points are $A$, we can reach any other configuration by a series of swaps of adjacent pairs, where the left number is $A$ and the right number is $B$. In the initial configuration, we have $Z = 1011^3$, and it decreases by $2022$ with each swap. Thus, $Z$ always remains an odd number, so it can never be zero. We conclude that $X \neq Y$. +IMO_PROOF_66bdc28500613c733898e74da7e52371bd2c9774f2a086ae1cf992b72dde0f1e diff --git a/tasks/pb-basic-010/task.toml b/tasks/pb-basic-010/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..309ec2fe5e7dcfab81c776236bf00bc18a250803 --- /dev/null +++ b/tasks/pb-basic-010/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-010" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-010" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-010/tests/grade_task.py b/tasks/pb-basic-010/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-010/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-010/tests/reference.json b/tasks/pb-basic-010/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..b1016ec7beec4b730e946b373acc399c136aff19 --- /dev/null +++ b/tasks/pb-basic-010/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "The numbers $\\{ 1, 2, 3, \\ldots , 2022 \\}$ are partitioned into two sets $A$ and $B$ of size $1011$ each. Let $S_{AB}$ denote the set of all pairs $(a, b) \\in A \\times B$ where $a < b$, and let $S_{BA}$ denote the set of all pairs $(a, b) \\in A \\times B$ where $b < a$.\n\n Prove that $\\sum_{(a, b) \\in S_{AB}} (b - a) \\neq \\sum_{(a, b) \\in S_{BA}} (a - b)$.", + "solution": "Let $X = \\sum_{(a, b) \\in S_{AB}} (b - a)$, $Y=\\sum_{(a, b) \\in S_{BA}} (a -b)$ and $Z=X-Y$. We first analyze the case where all elements of $A$ are smaller than all elements of $B$. In that case, $S_{BA} = 0$, and\n \\[ X = \\sum_{i = 1012}^{2022} \\sum_{j = 1}^{1011} (i - j) = 1011 \\cdot \\left(\\sum_{i = 1012}^{2022} i - \\sum_{j = 1}^{1011} j \\right) = 1011^3, \\]\n and so $Z = 1011^3$.\n\n Now, arrange the numbers $1$ to $2022$ on a line in increasing order from left to right, and consider how the quantity $Z$ changes if we swap the set of two adjacent numbers, where the left number is in $A$ and the right number is in $B$. Let $A_l$ and $B_l$ be the number of numbers from $A$ and $B$ to the left of this adjacent pair, and similarly let $A_r$ and $B_r$ be the number of numbers from $A$ and $B$ to the right of this adjacent pair,\n\n First think of how $X$ changes. By moving the number from $A$ one unit to the right, we decrease each $A$-$B$ segment of $B_r$ by one unit. By moving the number from $B$ one unit to the left, we shorten each $A$-$B$ segments of $A_l$ by one unit. Also, we eliminated the length-1 $A$-$B$ segment formed by the swapped points themselves. Thus, $X$ decreases by $B_r + A_l + 1$.\n\n Similarly, $Y$ increases by $A_r + B_l + 1$, after the swap. Thus, $Z$ decreases by $B_r + R_l + B_r + B_l + 2 = 2022$.\n\n Now, starting from the initial configuration where all the 1011 left-most points are $A$, we can reach any other configuration by a series of swaps of adjacent pairs, where the left number is $A$ and the right number is $B$. In the initial configuration, we have $Z = 1011^3$, and it decreases by $2022$ with each swap. Thus, $Z$ always remains an odd number, so it can never be zero. We conclude that $X \\neq Y$.", + "grading_guidelines": "(Partial)\n 1. Found and proved that the parity of the difference is invariant\n 2. Found an invariant equivalent to it and proved that it is indeed an invariant.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-010", + "level": "basic", + "category": "Combinatorics", + "source": "(Modified) Tournament of Towns, Fall 2022 Senior O-level, P3", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-basic-010/tests/test.sh b/tasks/pb-basic-010/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-010/tests/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Reward measures structural submission validity only, not mathematical correctness. +# External rubric-guided LLM judging against reference.json awards 0–7 points. +# Offline, isolated Python; PROOF and VERIFIER_DIR allow local verification. +set -eu +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export TESTS_DIR="$here" PROOF="${PROOF:-/app/proof.md}" VERIFIER_DIR="${VERIFIER_DIR:-/logs/verifier}" +mkdir -p "$VERIFIER_DIR" +printf '0\n' > "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-011/instruction.md b/tasks/pb-basic-011/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c87164b95a30d29987d83b450a8a1c6512a8bf88 --- /dev/null +++ b/tasks/pb-basic-011/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-011 + +Solve the following problem using your own reasoning and local tools. Do not use web lookups or external models. Write a complete, self-contained, rigorous mathematical proof to `/app/proof.md`; create `/app` if necessary. + +## Problem + +Let $A\subset \{1,2,\ldots,2000\}$, $|A|=1000$, such that $a$ does not divide $b$ for all distinct elements $a,b\in A$. For a set $X$ as above let us denote with $m_{X}$ the smallest element in $X$. Find $\min m_{A}$ (for all $A$ with the above properties). diff --git a/tasks/pb-basic-011/solution/solve.sh b/tasks/pb-basic-011/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f4287cf5f994a2549bf1ab38e0c23df2e8a01a91 --- /dev/null +++ b/tasks/pb-basic-011/solution/solve.sh @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_58ea012cb28f29c44bb48587d5bf81a74e1e7dc0a3719da6f1dd45191ec1c261' +Partition the set $\{ 1,2,3,\cdots ,2000\}$ into 1000 parts $P_{1}\cup P_{2}\cup P_{3}\cup \cdots \cup P_{1000}$ such that $P_{a}$ contains all numbers of the form $2^{b}(2a-1)$ where $b$ is a nonnegative integer. + + $A$ cannot have two elements from the same part (otherwise one would divide the other by a power of 2). So $A$ must have exactly one element from each part. + + Let $t_{a}$ be the element of $A$ contained in $P_{a}$. Then consider $t_{1},t_{2},t_{5},\cdots $, each being a product of a power of 3 and a power of 2. The highest power of 2 dividing $t_{1}$ must be strictly greater than the highest power of 2 dividing $t_{2}$ (otherwise $t_{1}$ divides $t_{2}$). Similarly, the highest powers of 2 dividing $t_{1},t_{2},t_{5},\cdots $ must be a strictly decreasing sequence. In particular, there are 7 numbers in the sequence, so $t_{1}$ must be at least $2^6=64$. In a similar manner, if $666<3^{b}(2a-1)<2000$, then $t_{a}\geq 2^{b}(2a-1)$. (Here we look at the numbers where the odd factors are $(2a-1)$ times a power of 3.) + + Suppose one of the $t_{a}$ is less than 64. Then we have + \[666<3^{b}(2a-1)\leq (3/2)^{b}t_{a}<64(3/2)^{b}\] + so that $b\geq 6$. However, this means either $a=1$ (we know $t_{1}\geq 64$) or $t_{a}\geq 3\cdot 2^{6}$, which is a contradiction. Therefore, every element must be at least 64. + + + We could attain a minimum by setting $t_{a}=2^{f(a)}(2a-1)$ where $f(a)$ satisfies $666<3^{f(a)}(2a-1)<2000$ if we can show it works. To do this, we must show that $t_{x}$ cannot divide $t_{y}$ for any $x\neq y$. Suppose there were such $x$ and $y$. Then + \[2^{u}(2x-1)|2^{v}(2y-1)\] + where $u=f(x)$ and $v=f(y)$. In particular, $u\leq v$ and $(2x-1)|(2y-1)$. + + In order to have $(2x-1)|(2y-1)$, we must have $2y-1\geq 3(2x-1)$, but this implies + \[3^{u+1}(2x-1) \ge 2001 >3^{v}(2y-1)\geq 3^{v+1}(2x-1)\] + and $u>v$, a contradiction! Therefore $\boxed{64}$ is the minimum. +IMO_PROOF_58ea012cb28f29c44bb48587d5bf81a74e1e7dc0a3719da6f1dd45191ec1c261 diff --git a/tasks/pb-basic-011/task.toml b/tasks/pb-basic-011/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4a60a6fdc6b9c4367f297727ad94778bf72bf654 --- /dev/null +++ b/tasks/pb-basic-011/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-011" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-011" +level = "basic" +[agent] +network_mode = "allowlist" +timeout_sec = 3600 +[environment] +docker_image = "docker.io/library/python:3.12-slim" +cpus = 1 +memory_mb = 2048 +[verifier] +network_mode = "allowlist" +timeout_sec = 180 diff --git a/tasks/pb-basic-011/tests/grade_task.py b/tasks/pb-basic-011/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-011/tests/grade_task.py @@ -0,0 +1,58 @@ +"""Offline structural validation only; external rubric judge assigns 0–7 points.""" +import json, os, stat +LIMIT = 200_000 + +def read_own(path): + """Reject links, special files, multiple hard links, and oversized files.""" + parts = os.path.abspath(path).split('/')[1:] + folder = os.open('/', os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, 'rb') as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError('not a regular file with one link') + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError('file exceeds 200000 bytes') + return data + +def write_new(path, data): + try: os.unlink(path) + except FileNotFoundError: pass + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, 'wb') as f: f.write(data) + +def main(): + out = os.environ['VERIFIER_DIR'] + os.makedirs(out, exist_ok=True) + write_new(os.path.join(out, 'reward.txt'), b'0\n') + proof_path = os.path.join(out, 'proof.md') + try: os.unlink(proof_path) + except FileNotFoundError: pass + reference = open(os.path.join(os.environ['TESTS_DIR'], 'reference.json'), 'rb').read() + json.loads(reference) + write_new(os.path.join(out, 'reference.json'), reference) + status, count, reason = 'missing', 0, 'proof unavailable or invalid' + try: + raw = read_own(os.environ['PROOF']) + proof = raw.decode('utf-8', 'strict') + count = len(proof) + write_new(proof_path, raw) + if sum(not c.isspace() for c in proof) < 20: + status, reason = 'empty', 'fewer than 20 non-whitespace characters' + else: + status, reason = 'submitted_for_judge', 'structurally valid submission' + except (OSError, ValueError, UnicodeError) as e: + reason = 'proof unavailable or invalid: ' + str(e)[:200] + result = {'status': status, 'char_count': count, 'requires_llm_judge': True, 'max_score': 7, 'reason': reason} + write_new(os.path.join(out, 'grade.json'), (json.dumps(result, ensure_ascii=False, indent=2)+'\n').encode()) + if status == 'submitted_for_judge': write_new(os.path.join(out, 'reward.txt'), b'1\n') + print(status, 'structural reward:', int(status == 'submitted_for_judge')) +if __name__ == '__main__': main() diff --git a/tasks/pb-basic-011/tests/reference.json b/tasks/pb-basic-011/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..b3719323c3f0e37a52388602ec85aca0bb2ae04f --- /dev/null +++ b/tasks/pb-basic-011/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $A\\subset \\{1,2,\\ldots,2000\\}$, $|A|=1000$, such that $a$ does not divide $b$ for all distinct elements $a,b\\in A$. For a set $X$ as above let us denote with $m_{X}$ the smallest element in $X$. Find $\\min m_{A}$ (for all $A$ with the above properties).", + "solution": "Partition the set $\\{ 1,2,3,\\cdots ,2000\\}$ into 1000 parts $P_{1}\\cup P_{2}\\cup P_{3}\\cup \\cdots \\cup P_{1000}$ such that $P_{a}$ contains all numbers of the form $2^{b}(2a-1)$ where $b$ is a nonnegative integer.\n\n $A$ cannot have two elements from the same part (otherwise one would divide the other by a power of 2). So $A$ must have exactly one element from each part.\n\n Let $t_{a}$ be the element of $A$ contained in $P_{a}$. Then consider $t_{1},t_{2},t_{5},\\cdots $, each being a product of a power of 3 and a power of 2. The highest power of 2 dividing $t_{1}$ must be strictly greater than the highest power of 2 dividing $t_{2}$ (otherwise $t_{1}$ divides $t_{2}$). Similarly, the highest powers of 2 dividing $t_{1},t_{2},t_{5},\\cdots $ must be a strictly decreasing sequence. In particular, there are 7 numbers in the sequence, so $t_{1}$ must be at least $2^6=64$. In a similar manner, if $666<3^{b}(2a-1)<2000$, then $t_{a}\\geq 2^{b}(2a-1)$. (Here we look at the numbers where the odd factors are $(2a-1)$ times a power of 3.)\n\n Suppose one of the $t_{a}$ is less than 64. Then we have\n \\[666<3^{b}(2a-1)\\leq (3/2)^{b}t_{a}<64(3/2)^{b}\\]\n so that $b\\geq 6$. However, this means either $a=1$ (we know $t_{1}\\geq 64$) or $t_{a}\\geq 3\\cdot 2^{6}$, which is a contradiction. Therefore, every element must be at least 64.\n\n\n We could attain a minimum by setting $t_{a}=2^{f(a)}(2a-1)$ where $f(a)$ satisfies $666<3^{f(a)}(2a-1)<2000$ if we can show it works. To do this, we must show that $t_{x}$ cannot divide $t_{y}$ for any $x\\neq y$. Suppose there were such $x$ and $y$. Then\n \\[2^{u}(2x-1)|2^{v}(2y-1)\\]\n where $u=f(x)$ and $v=f(y)$. In particular, $u\\leq v$ and $(2x-1)|(2y-1)$.\n\n In order to have $(2x-1)|(2y-1)$, we must have $2y-1\\geq 3(2x-1)$, but this implies\n \\[3^{u+1}(2x-1) \\ge 2001 >3^{v}(2y-1)\\geq 3^{v+1}(2x-1)\\]\n and $u>v$, a contradiction! Therefore $\\boxed{64}$ is the minimum.", + "grading_guidelines": "(Partial)\n 1. Constructed the example for the answer $64$.\n 2. Decomposed the set $\\{1,2,...,2000\\}$ as in the solution and analyzed intersections of $A$ and these decomposed subsets.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-011", + "level": "basic", + "category": "Combinatorics", + "source": "(Modified) Vietnam TST 2007 P5", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "$64$" +}