diff --git a/tasks/pb-basic-011/tests/test.sh b/tasks/pb-basic-011/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-012/instruction.md b/tasks/pb-basic-012/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..de5e8753c99e88ba8f1485f07492f95a347440bb --- /dev/null +++ b/tasks/pb-basic-012/instruction.md @@ -0,0 +1,26 @@ +# PB-Basic-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 + +Consider a positive integer $n$. We define $f(n)$ as the number of pairs of paths on an $n \times n$ grid that: + + (1) Both paths start at $(0, 0)$ (bottom left corner) and end at $(n, n)$ (top right corner). + + (2) Both paths allow only right or up movements (one unit each). + + (3) The $y$ coordinate of the first path never exceeds the y coordinate of the second path at any timestep. + + For example, when $n = 2$, consider the following pair of paths: + + The first path: $(0,0) \rightarrow (1,0) \rightarrow (1,1) \rightarrow (2,1) \rightarrow (2,2)$ + The second path: $(0,0) \rightarrow (1,0) \rightarrow (2,0) \rightarrow (2,1) \rightarrow(2,2)$ + The example is invalid because after 2 steps, the y coordinate of the first path (1) is larger than the y coordinate of the second path (0). + + However, the following example is valid, + + The first path: $(0,0) \rightarrow (1,0) \rightarrow (2,0) \rightarrow (2,1) \rightarrow (2,2)$ + The second path: $(0,0) \rightarrow (1,0) \rightarrow (1,1) \rightarrow (2,1) \rightarrow (2,2)$ + + since the y coordinate of the first path is never larger than the second path. Find $f(10)$. diff --git a/tasks/pb-basic-012/solution/solve.sh b/tasks/pb-basic-012/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3c038c8dc82e328971e93e5aa6f1cd346a622d5f --- /dev/null +++ b/tasks/pb-basic-012/solution/solve.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_133d3fe55786fb9d1fb9d4008deb6e4f886e8977d43639df018b6c1c63debb2a' +If we move the second path up-left by one unit, the pair of paths corresponds to a pair of paths from (0,0) to (10,10) and from (-1,1) to (9,11) which are non-intersecting. The total number of path pairs is $\binom{20}{10}^2$. The number of intersecting pairs corresponds to the number of pair of paths from (0,0) to (9, 11) and paths from (-1, 1) to (10,10), because interchanging the two paths at the first intersection point gives a one-to-one correspondence, and thus equals $\binom{20}{9}^2$. Therefore there are $\binom{20}{10}^2 - \binom{20}{9}^2$ paths. +IMO_PROOF_133d3fe55786fb9d1fb9d4008deb6e4f886e8977d43639df018b6c1c63debb2a diff --git a/tasks/pb-basic-012/task.toml b/tasks/pb-basic-012/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..89cc0ee506d9fa9b9d1d526a10e097761dcf3149 --- /dev/null +++ b/tasks/pb-basic-012/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-012" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-012" +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-012/tests/grade_task.py b/tasks/pb-basic-012/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-012/tests/reference.json b/tasks/pb-basic-012/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..c6ad53b8cfbb8e9ab68e68aef661ca1bce94f97b --- /dev/null +++ b/tasks/pb-basic-012/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Consider a positive integer $n$. We define $f(n)$ as the number of pairs of paths on an $n \\times n$ grid that:\n\n (1) Both paths start at $(0, 0)$ (bottom left corner) and end at $(n, n)$ (top right corner).\n\n (2) Both paths allow only right or up movements (one unit each).\n\n (3) The $y$ coordinate of the first path never exceeds the y coordinate of the second path at any timestep.\n\n For example, when $n = 2$, consider the following pair of paths:\n\n The first path: $(0,0) \\rightarrow (1,0) \\rightarrow (1,1) \\rightarrow (2,1) \\rightarrow (2,2)$\n The second path: $(0,0) \\rightarrow (1,0) \\rightarrow (2,0) \\rightarrow (2,1) \\rightarrow(2,2)$\n The example is invalid because after 2 steps, the y coordinate of the first path (1) is larger than the y coordinate of the second path (0).\n\n However, the following example is valid,\n\n The first path: $(0,0) \\rightarrow (1,0) \\rightarrow (2,0) \\rightarrow (2,1) \\rightarrow (2,2)$\n The second path: $(0,0) \\rightarrow (1,0) \\rightarrow (1,1) \\rightarrow (2,1) \\rightarrow (2,2)$\n\n since the y coordinate of the first path is never larger than the second path. Find $f(10)$.", + "solution": "If we move the second path up-left by one unit, the pair of paths corresponds to a pair of paths from (0,0) to (10,10) and from (-1,1) to (9,11) which are non-intersecting. The total number of path pairs is $\\binom{20}{10}^2$. The number of intersecting pairs corresponds to the number of pair of paths from (0,0) to (9, 11) and paths from (-1, 1) to (10,10), because interchanging the two paths at the first intersection point gives a one-to-one correspondence, and thus equals $\\binom{20}{9}^2$. Therefore there are $\\binom{20}{10}^2 - \\binom{20}{9}^2$ paths.", + "grading_guidelines": "(Partial)\n 1. Came up with an idea of correcting shifting (shifting only one path by $+1$ in the $y$-coordinate) or found an equivalent idea with it.\n(Almost)\n 1. Made a minor mistake when counting.", + "problem_id": "PB-Basic-012", + "level": "basic", + "category": "Combinatorics", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "$\\binom{20}{10}^2 - \\binom{20}{9}^2$ " +} diff --git a/tasks/pb-basic-012/tests/test.sh b/tasks/pb-basic-012/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-013/instruction.md b/tasks/pb-basic-013/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7321cee0e42a0df2c721250b24e8d394bc97a0c7 --- /dev/null +++ b/tasks/pb-basic-013/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +Each of 8 boxes contains 6 balls. Each ball has been colored with one of 22 colors. If no two balls in the same box are the same color, prove that there are two colors that occur together in more than one box. diff --git a/tasks/pb-basic-013/solution/solve.sh b/tasks/pb-basic-013/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..11f4f8de5f35f187b5173af880fec6c11f00598b --- /dev/null +++ b/tasks/pb-basic-013/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_15c8b8ab464de13b112ed964b40d9cfc6b39ac48a66e7bac459b58ae1265063d' +Let’s say a color "connects" two boxes if it appears in both. We want to show there are two colors that connect the same pair of boxes. + + Let $c_i$ denote the number of balls with color $i$. Then, the total number of times a color connects two boxes is $N = \sum_{i=1}^{22} \binom{c_i}{2}$. We also know the total number of balls is $48$, so $\sum_{i=1}^{22} c_i = 48$. We now try to find the minimum possible value of $N$. + + To do this, we first analyze the quantity $X = \sum_{i=1}^{22} (c_i - 2)^2$. If at $|c_i - 2| >= 2$ for some $i$, then clearly $X \ge 4$. Otherwise, all the $c_i$ are 1, 2, or 3. Then, in order for them to sum to 48, at most 18 of them can be 2, so once again $X \ge 4$. We then have + + $4 \le X = 2N - 3 \sum_{i=1}^{22} c_i + 4 * 22 = 2N - 3 * 48 + 4 * 22 = 2N - 56$, + + so that $N \ge 30$. But note that there are only $\binom{8}{2} = 28$ pairs of boxes. Thus, by the pigeonhole principle, some two colors connect the same pair of boxes, as desired. +IMO_PROOF_15c8b8ab464de13b112ed964b40d9cfc6b39ac48a66e7bac459b58ae1265063d diff --git a/tasks/pb-basic-013/task.toml b/tasks/pb-basic-013/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d6421b2a62b2967dcda2e8fafdd27a63cb3c535b --- /dev/null +++ b/tasks/pb-basic-013/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-013" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-013" +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-013/tests/grade_task.py b/tasks/pb-basic-013/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-013/tests/reference.json b/tasks/pb-basic-013/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..8187154bff0bc7a235fe38ef1686d3ada5c65bcd --- /dev/null +++ b/tasks/pb-basic-013/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Each of 8 boxes contains 6 balls. Each ball has been colored with one of 22 colors. If no two balls in the same box are the same color, prove that there are two colors that occur together in more than one box.", + "solution": "Let’s say a color \"connects\" two boxes if it appears in both. We want to show there are two colors that connect the same pair of boxes.\n\n Let $c_i$ denote the number of balls with color $i$. Then, the total number of times a color connects two boxes is $N = \\sum_{i=1}^{22} \\binom{c_i}{2}$. We also know the total number of balls is $48$, so $\\sum_{i=1}^{22} c_i = 48$. We now try to find the minimum possible value of $N$.\n\n To do this, we first analyze the quantity $X = \\sum_{i=1}^{22} (c_i - 2)^2$. If at $|c_i - 2| >= 2$ for some $i$, then clearly $X \\ge 4$. Otherwise, all the $c_i$ are 1, 2, or 3. Then, in order for them to sum to 48, at most 18 of them can be 2, so once again $X \\ge 4$. We then have\n\n $4 \\le X = 2N - 3 \\sum_{i=1}^{22} c_i + 4 * 22 = 2N - 3 * 48 + 4 * 22 = 2N - 56$,\n\n so that $N \\ge 30$. But note that there are only $\\binom{8}{2} = 28$ pairs of boxes. Thus, by the pigeonhole principle, some two colors connect the same pair of boxes, as desired.", + "grading_guidelines": "(Partial)\n 1. Applied some double counting argument but did not progress further.\n(Almost)\n 1. Solved the problem with some mistakes (such as calculation mistakes).", + "problem_id": "PB-Basic-013", + "level": "basic", + "category": "Combinatorics", + "source": "(Modified) USAMO 2001 P1", + "max_score": 7, + "difficulty": "pre-IMO", + "short_answer": " " +} diff --git a/tasks/pb-basic-013/tests/test.sh b/tasks/pb-basic-013/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-014/instruction.md b/tasks/pb-basic-014/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e4f6dae913943b0bf5bc5f2dabc24e5a3076b38a --- /dev/null +++ b/tasks/pb-basic-014/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +In Shoreline Amphitheatre, 2024 Googlers each hold up to five flags of various colors. Any group of three Googlers will always have at least two people holding flags of the same color. Prove that one specific flag color is held by at least 200 Googlers. diff --git a/tasks/pb-basic-014/solution/solve.sh b/tasks/pb-basic-014/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5a9fa526277af188ae68778dde8d9e6b955e1876 --- /dev/null +++ b/tasks/pb-basic-014/solution/solve.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_670930ab666534527fd6ba7d838c7cc4696ffa1e709fc2b980c854f4318f9004' +Take any Googler. He holds at most 5 flags. If everyone holds at least one of those flags but not more than 199 people speak have each flag, then there are at most 1 + 5·198 = 991 Googlers. But there are 2024 Googlers, so we must be able to find someone who holds none of the 5 flags. He too has at most 5 flags, giving a total of 10 between the two Googlers selected. Now we are told that every other Googler holds at least one of these 10 flags. So if no more than 199 Googlers holds each flag, then there are at most 2 + 10·198 = 1982 Googlers. But there are 2024 Googlers, so one of the 10 flags must be held by 200 or more people. +IMO_PROOF_670930ab666534527fd6ba7d838c7cc4696ffa1e709fc2b980c854f4318f9004 diff --git a/tasks/pb-basic-014/task.toml b/tasks/pb-basic-014/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..21c99857b74e08b35dec4de0192df0026aa88ac5 --- /dev/null +++ b/tasks/pb-basic-014/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-014" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-014" +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-014/tests/grade_task.py b/tasks/pb-basic-014/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-014/tests/reference.json b/tasks/pb-basic-014/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..f557f673cca6c94235682a23c5d1b69eab4227c2 --- /dev/null +++ b/tasks/pb-basic-014/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "In Shoreline Amphitheatre, 2024 Googlers each hold up to five flags of various colors. Any group of three Googlers will always have at least two people holding flags of the same color. Prove that one specific flag color is held by at least 200 Googlers.", + "solution": "Take any Googler. He holds at most 5 flags. If everyone holds at least one of those flags but not more than 199 people speak have each flag, then there are at most 1 + 5·198 = 991 Googlers. But there are 2024 Googlers, so we must be able to find someone who holds none of the 5 flags. He too has at most 5 flags, giving a total of 10 between the two Googlers selected. Now we are told that every other Googler holds at least one of these 10 flags. So if no more than 199 Googlers holds each flag, then there are at most 2 + 10·198 = 1982 Googlers. But there are 2024 Googlers, so one of the 10 flags must be held by 200 or more people.", + "grading_guidelines": "(Partial)\n 1. Established that there is a pair of people not sharing a flag of the same color.\n (Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-014", + "level": "basic", + "category": "Combinatorics", + "source": "(Modified) Balkan MO 1985 P4", + "max_score": 7, + "difficulty": "pre-IMO", + "short_answer": " " +} diff --git a/tasks/pb-basic-014/tests/test.sh b/tasks/pb-basic-014/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-015/instruction.md b/tasks/pb-basic-015/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..67ea0b9a8b48439878bdc673a72781fbf5876ac6 --- /dev/null +++ b/tasks/pb-basic-015/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +Adrian is lining up $n \geq 2$ toy cars in a row. Each car has a width and length, and no two cars have the same width or length. Initially, the cars are arranged in increasing order of length from left to right. Adrian repeatedly does the following: he chooses some two adjacent cars where the left car is shorter in length and greater in width than the right car, and he swaps them. He keeps doing this until no further moves are possible. Prove that no matter how Adrian chooses his swaps, the procedure will eventually terminate, and in the end, the cars will be sorted in increasing order of width from left to right. diff --git a/tasks/pb-basic-015/solution/solve.sh b/tasks/pb-basic-015/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..deca88bbf3b3f8194ec308e5fda6a9e03f94a110 --- /dev/null +++ b/tasks/pb-basic-015/solution/solve.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_905fd4cb26979d414351be9b96213c52584afc264c07a7eb52815c94c2a81ee4' +Define an inversion to be a pair of cars where the one on the left is wider than the one on the right. Clearly, each move strictly decreases the number of inversions, so the procedure must terminate. + + Now, suppose for sake of contradiction that we can make no more moves, but the cars are not sorted in increasing order of width. Consider the smallest index $i$ such that car $i$ is wider than car $i + 1$. Since we cannot make any further swaps, it must also be the case that car $i$ is longer than book $i + 1$. This means that originally, car $i$ was to the right of car $i + 1$, and at some point they switched relative positions. However, this is not possible because the rules prevent us from ever swapping two books when one is both taller and wider than the other. +IMO_PROOF_905fd4cb26979d414351be9b96213c52584afc264c07a7eb52815c94c2a81ee4 diff --git a/tasks/pb-basic-015/task.toml b/tasks/pb-basic-015/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fbf7f2cb5febdc8222d1cbfe11835961a00f79b9 --- /dev/null +++ b/tasks/pb-basic-015/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-015" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-015" +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-015/tests/grade_task.py b/tasks/pb-basic-015/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-015/tests/reference.json b/tasks/pb-basic-015/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..51695a450439533f4d27397bde3318a879570c73 --- /dev/null +++ b/tasks/pb-basic-015/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Adrian is lining up $n \\geq 2$ toy cars in a row. Each car has a width and length, and no two cars have the same width or length. Initially, the cars are arranged in increasing order of length from left to right. Adrian repeatedly does the following: he chooses some two adjacent cars where the left car is shorter in length and greater in width than the right car, and he swaps them. He keeps doing this until no further moves are possible. Prove that no matter how Adrian chooses his swaps, the procedure will eventually terminate, and in the end, the cars will be sorted in increasing order of width from left to right.", + "solution": "Define an inversion to be a pair of cars where the one on the left is wider than the one on the right. Clearly, each move strictly decreases the number of inversions, so the procedure must terminate.\n\n Now, suppose for sake of contradiction that we can make no more moves, but the cars are not sorted in increasing order of width. Consider the smallest index $i$ such that car $i$ is wider than car $i + 1$. Since we cannot make any further swaps, it must also be the case that car $i$ is longer than book $i + 1$. This means that originally, car $i$ was to the right of car $i + 1$, and at some point they switched relative positions. However, this is not possible because the rules prevent us from ever swapping two books when one is both taller and wider than the other.", + "grading_guidelines": "(Partial)\n 1. Found an increasing quantity (e.g. the number of inversion according to the width or length)\n 2. Tried to use minimality argument by taking the first book not sorted by width.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-015", + "level": "basic", + "category": "Combinatorics", + "source": "(Modified) 2020 USOJMO P1", + "max_score": 7, + "difficulty": "pre-IMO", + "short_answer": " " +} diff --git a/tasks/pb-basic-015/tests/test.sh b/tasks/pb-basic-015/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-016/instruction.md b/tasks/pb-basic-016/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..baaca8229bb9daa7e746ccc7b7ac6c842479a54c --- /dev/null +++ b/tasks/pb-basic-016/instruction.md @@ -0,0 +1,9 @@ +# PB-Basic-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 + +101 stones are arranged in a circle, numbered 1 through 101 in order (so that stone 1 is next to stone 101). Each stone is painted either red, white, or blue. Initially, stone 101 is the only blue stone. Among the remaining stones, even-numbered stones are red, and odd-numbered stones are white. + +We perform a sequence of modifications to the coloring, where in each step, we may choose a stone and repaint it a different color, as long as we ensure that no two adjacent stones are ever the same color. Prove that it is not possible to eventually reach a state where again stone 101 is the only blue stone, but among the remaining stones, all even-numbered stones are white and all odd-numbered stones are red. diff --git a/tasks/pb-basic-016/solution/solve.sh b/tasks/pb-basic-016/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c6a57f5e857fd765530069ac31758c7ccc829557 --- /dev/null +++ b/tasks/pb-basic-016/solution/solve.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_a26399654be52ba0ffb8544a40186c12222e4ac40472531796bbc0390fa4a33e' +Let $A$ be the number of indices $i$ where $i$th stone is blue and $i+1$th stone is white (we define the order in mod 101). Similarly, let $C$ be the number of white stones followed by blue stones. In the initial state, we have $A = 1$ and $C = 0$, and in the final state, we have $A = 0$ and $C = 1$. + + We claim that $A - C$ is invariant. Indeed, consider all possible colorings of three consecutive stones, and let us enumerate what color the middle side can be changed to. Writing $R, W, B$ to represent red, white, and blue, we have the following possibilities: + \[ RBR \to RWR, \qquad RWR \to RBR, \] + \[ BWB \to BRB, \qquad BRB \to BWB, \] + \[ WBW \to WRW, \qquad WRW \to WBW. \] + In each case, we find that the quantity $A - C$ doesn't change. However, the initial state has $A - C = 1$, and the final state has $A - C = -1$, so it is not possible to reach the final state. +IMO_PROOF_a26399654be52ba0ffb8544a40186c12222e4ac40472531796bbc0390fa4a33e diff --git a/tasks/pb-basic-016/task.toml b/tasks/pb-basic-016/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d5faea4374d302058a6ce92cd303da9a7edfd1d1 --- /dev/null +++ b/tasks/pb-basic-016/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-016" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-016" +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-016/tests/grade_task.py b/tasks/pb-basic-016/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-016/tests/reference.json b/tasks/pb-basic-016/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..71b551dea682f4a77e89eb18ff0f2e127155a533 --- /dev/null +++ b/tasks/pb-basic-016/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "101 stones are arranged in a circle, numbered 1 through 101 in order (so that stone 1 is next to stone 101). Each stone is painted either red, white, or blue. Initially, stone 101 is the only blue stone. Among the remaining stones, even-numbered stones are red, and odd-numbered stones are white.\n\nWe perform a sequence of modifications to the coloring, where in each step, we may choose a stone and repaint it a different color, as long as we ensure that no two adjacent stones are ever the same color. Prove that it is not possible to eventually reach a state where again stone 101 is the only blue stone, but among the remaining stones, all even-numbered stones are white and all odd-numbered stones are red.", + "solution": "Let $A$ be the number of indices $i$ where $i$th stone is blue and $i+1$th stone is white (we define the order in mod 101). Similarly, let $C$ be the number of white stones followed by blue stones. In the initial state, we have $A = 1$ and $C = 0$, and in the final state, we have $A = 0$ and $C = 1$.\n\n We claim that $A - C$ is invariant. Indeed, consider all possible colorings of three consecutive stones, and let us enumerate what color the middle side can be changed to. Writing $R, W, B$ to represent red, white, and blue, we have the following possibilities:\n \\[ RBR \\to RWR, \\qquad RWR \\to RBR, \\]\n \\[ BWB \\to BRB, \\qquad BRB \\to BWB, \\]\n \\[ WBW \\to WRW, \\qquad WRW \\to WBW. \\]\n In each case, we find that the quantity $A - C$ doesn't change. However, the initial state has $A - C = 1$, and the final state has $A - C = -1$, so it is not possible to reach the final state.", + "grading_guidelines": "(Partial)\n 1. Analyzed all the possible cases for when a stone changes color in terms of its neighbors' colors.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-016", + "level": "basic", + "category": "Combinatorics", + "source": "(Modified) USAMO 1994 Problem 2", + "max_score": 7, + "difficulty": "pre-IMO", + "short_answer": " " +} diff --git a/tasks/pb-basic-016/tests/test.sh b/tasks/pb-basic-016/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-017/instruction.md b/tasks/pb-basic-017/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..846eb5c34faf8ac3833776b439be1f7e2612e00a --- /dev/null +++ b/tasks/pb-basic-017/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +Find all non-negative integer $n$ such that $A_n = 1 + 3^{20(n^2+n+1)} + 9^{14(n^2+n+1)}$ is a prime number. diff --git a/tasks/pb-basic-017/solution/solve.sh b/tasks/pb-basic-017/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0dd30b352e011b205e52c89e5fdda66167724739 --- /dev/null +++ b/tasks/pb-basic-017/solution/solve.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_af70f5b4e524915b3f1cd1fe86201b51c283b297e51cf861dad5858235257926' +Substitute $a = 3^{4(n^2+n+1)} \geq 81 \in Z^+$, we have $A_n = a^7 + a^5 + 1$. Observe that $a^7 + a^5 + 1 = (a^2+a+1)(a^5-a^4+a^3-a+1)$. Since $a \geq 81$, we have $a^2+a+1 > 1$ and $a^5-a^4+a^3-a+1 > 1$. Hence, $A_n$ is not a prime number for all $n \geq 0$. +IMO_PROOF_af70f5b4e524915b3f1cd1fe86201b51c283b297e51cf861dad5858235257926 diff --git a/tasks/pb-basic-017/task.toml b/tasks/pb-basic-017/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..58364486422c9f3600f27b9cd7d59cc8af6220d6 --- /dev/null +++ b/tasks/pb-basic-017/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-017" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-017" +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-017/tests/grade_task.py b/tasks/pb-basic-017/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-017/tests/reference.json b/tasks/pb-basic-017/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..d5f0b9c5f6b1477b32d5bce2e9ead9aa31afe185 --- /dev/null +++ b/tasks/pb-basic-017/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Find all non-negative integer $n$ such that $A_n = 1 + 3^{20(n^2+n+1)} + 9^{14(n^2+n+1)}$ is a prime number.", + "solution": "Substitute $a = 3^{4(n^2+n+1)} \\geq 81 \\in Z^+$, we have $A_n = a^7 + a^5 + 1$. Observe that $a^7 + a^5 + 1 = (a^2+a+1)(a^5-a^4+a^3-a+1)$. Since $a \\geq 81$, we have $a^2+a+1 > 1$ and $a^5-a^4+a^3-a+1 > 1$. Hence, $A_n$ is not a prime number for all $n \\geq 0$.", + "grading_guidelines": "(Partial)\n 1. Applied correct substitution to $x^7+x^5+1$ or $x^{14}+x^{10}+1$ or $x^{28}+x^{20}+1$\n(Almost)\n 1. Correctly applied substitution and factorization but with made minor mistakes.", + "problem_id": "PB-Basic-017", + "level": "basic", + "category": "Number theory", + "source": "folklore", + "max_score": 7, + "difficulty": "pre-IMO", + "short_answer": "There is no such $n$." +} diff --git a/tasks/pb-basic-017/tests/test.sh b/tasks/pb-basic-017/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-018/instruction.md b/tasks/pb-basic-018/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..948a892dcd040fc9b3f3f885a9a5425c5ce59a65 --- /dev/null +++ b/tasks/pb-basic-018/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +Let $x$ and $y$ be positive integers satisfying $2x^2 + x = 3y^2 + y$. Prove that $2x+2y+1$ is a perfect square. diff --git a/tasks/pb-basic-018/solution/solve.sh b/tasks/pb-basic-018/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1697fd10009513216bb7bfc29347d1d4b94c05a6 --- /dev/null +++ b/tasks/pb-basic-018/solution/solve.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_3ebc02426db3c6c46b48852a9bcf2281caff784d98ea26251096b3335a515c46' +Lemma: If $ab$ is a perfect square for coprime integers $a,b$ then they are perfect squares. + + Observe that $2x^2+x=3y^2+y$ is equivalent to $y^2 = 2x^2-2y^2+x-y = (x-y)(2x+2y+1)$. Let $d$ be the greatest common divisior of $x-y,2x+2y+1$, we have $d | x-y$ and $d | 2x+2y+1$. On the other hand, observe that $y^2 = (x-y)(2x+2y+1)$. Hence, we must have that $d^2 | y^2$, which implies $d | y$. Since $d | y$ and $d | x-y$, we have $d | x$. Furthermore, since $d | x, d | y, d | 2x+2y+1$, we have that $d | 1$ and thus, $d = 1$, meaning that $x-y,2x+2y+1$ are coprime integers. From the Lemma, we have that $x-y,2x+2y+1$ are perfect squares. Hence proved. +IMO_PROOF_3ebc02426db3c6c46b48852a9bcf2281caff784d98ea26251096b3335a515c46 diff --git a/tasks/pb-basic-018/task.toml b/tasks/pb-basic-018/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..691d92ed2998513de3d41faa17b508b1deecc7e3 --- /dev/null +++ b/tasks/pb-basic-018/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-018" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-018" +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-018/tests/grade_task.py b/tasks/pb-basic-018/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-018/tests/reference.json b/tasks/pb-basic-018/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..01d56f62db47f0af88edac281d2243e7f42ca6d4 --- /dev/null +++ b/tasks/pb-basic-018/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $x$ and $y$ be positive integers satisfying $2x^2 + x = 3y^2 + y$. Prove that $2x+2y+1$ is a perfect square.", + "solution": "Lemma: If $ab$ is a perfect square for coprime integers $a,b$ then they are perfect squares.\n\n Observe that $2x^2+x=3y^2+y$ is equivalent to $y^2 = 2x^2-2y^2+x-y = (x-y)(2x+2y+1)$. Let $d$ be the greatest common divisior of $x-y,2x+2y+1$, we have $d | x-y$ and $d | 2x+2y+1$. On the other hand, observe that $y^2 = (x-y)(2x+2y+1)$. Hence, we must have that $d^2 | y^2$, which implies $d | y$. Since $d | y$ and $d | x-y$, we have $d | x$. Furthermore, since $d | x, d | y, d | 2x+2y+1$, we have that $d | 1$ and thus, $d = 1$, meaning that $x-y,2x+2y+1$ are coprime integers. From the Lemma, we have that $x-y,2x+2y+1$ are perfect squares. Hence proved.", + "grading_guidelines": "(Partial)\n 1. Correctly factorized $(x-y)(2x+2y+1) = y^2$ but did not get other non-trivial results.\n(Almost)\n 1. Proved the problem but made minor mistakes or did not prove $d = 1$", + "problem_id": "PB-Basic-018", + "level": "basic", + "category": "Number theory", + "source": "(Modified) Polish MO 1965 P4", + "max_score": 7, + "difficulty": "pre-IMO", + "short_answer": " " +} diff --git a/tasks/pb-basic-018/tests/test.sh b/tasks/pb-basic-018/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-019/instruction.md b/tasks/pb-basic-019/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fd76eca96f1c1162626b82b275108ff3172c423e --- /dev/null +++ b/tasks/pb-basic-019/instruction.md @@ -0,0 +1,10 @@ +# PB-Basic-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 any positive integer $n$, let $\delta(n)$ be the largest odd divisor of $n$. Prove for any $N>0$ that we have + \[ + \left| \sum_{n=1}^N \frac{\delta(n)}{n}- \frac{2}{3}N \right| <1. + \] diff --git a/tasks/pb-basic-019/solution/solve.sh b/tasks/pb-basic-019/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a52dd4c0a837303661d753c78c7ea4256d61e7ac --- /dev/null +++ b/tasks/pb-basic-019/solution/solve.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_22341fbfa5b1be4d043f86519f346329f13786ede1e24f33d5ea0966194d0106' +Observe the following: If the greatest power of $2$ that divides $n$ is $2^k$, the greatest odd divisor dividing $n$ is $\frac{n}{2^k}$. + + Let $\sum_{n=1}^N \frac{\delta(n)}{n}$ be $S(N)$. + + Let the greatest power of $2$ smaller or equal to $N$ be $2^k$. Then, $2^k \leq N <2^{k+1}$ holds. Using the observation, we get the following equation: + $\sum_{n=1}^{2^k} \frac{\delta(n)}{n} = \sum_{i=0}^{k-1} \frac{2^{k-1-i}}{2^i} + \frac{1}{2^k} = 2^{k-1}(\frac{1-\frac{1}{4^{k}}}{\frac{3}{4}}) + \frac{1}{2^k}$ + + Now observe that for $2^k < n <2^{k+1}$, $\frac{\delta(n)}{n} = \frac{\delta(n-2^k)}{n-2^k}$. Therefore, we have that $S(N)= S(N-2^k)+ (\frac{2^{k+1}}{3})(1-\frac{1}{4^{k}}) + \frac{1}{2^k}$ + + Using this, we have that $S(N) - \frac{2N}{3} = S(N-2^k) - \frac{2(N-2^k)}{3} + \frac{1}{3\cdot 2^k}$ + + Therefore, $|S(N) - \frac{2N}{3}|\leq \sum_{k=0}^\infty \frac{1}{3\cdot 2^k} \leq 1$ +IMO_PROOF_22341fbfa5b1be4d043f86519f346329f13786ede1e24f33d5ea0966194d0106 diff --git a/tasks/pb-basic-019/task.toml b/tasks/pb-basic-019/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5fb9fda3119e5d8734984665f5e9d6fa6bd50080 --- /dev/null +++ b/tasks/pb-basic-019/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-019" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-019" +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-019/tests/grade_task.py b/tasks/pb-basic-019/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-019/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-019/tests/reference.json b/tasks/pb-basic-019/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..18d6784c4d57215cee8f71df808c0aa9fa6da4dd --- /dev/null +++ b/tasks/pb-basic-019/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "For any positive integer $n$, let $\\delta(n)$ be the largest odd divisor of $n$. Prove for any $N>0$ that we have\n \\[\n \\left| \\sum_{n=1}^N \\frac{\\delta(n)}{n}- \\frac{2}{3}N \\right| <1.\n \\]", + "solution": "Observe the following: If the greatest power of $2$ that divides $n$ is $2^k$, the greatest odd divisor dividing $n$ is $\\frac{n}{2^k}$.\n\n Let $\\sum_{n=1}^N \\frac{\\delta(n)}{n}$ be $S(N)$.\n\n Let the greatest power of $2$ smaller or equal to $N$ be $2^k$. Then, $2^k \\leq N <2^{k+1}$ holds. Using the observation, we get the following equation:\n $\\sum_{n=1}^{2^k} \\frac{\\delta(n)}{n} = \\sum_{i=0}^{k-1} \\frac{2^{k-1-i}}{2^i} + \\frac{1}{2^k} = 2^{k-1}(\\frac{1-\\frac{1}{4^{k}}}{\\frac{3}{4}}) + \\frac{1}{2^k}$\n\n Now observe that for $2^k < n <2^{k+1}$, $\\frac{\\delta(n)}{n} = \\frac{\\delta(n-2^k)}{n-2^k}$. Therefore, we have that $S(N)= S(N-2^k)+ (\\frac{2^{k+1}}{3})(1-\\frac{1}{4^{k}}) + \\frac{1}{2^k}$\n\n Using this, we have that $S(N) - \\frac{2N}{3} = S(N-2^k) - \\frac{2(N-2^k)}{3} + \\frac{1}{3\\cdot 2^k}$\n\n Therefore, $|S(N) - \\frac{2N}{3}|\\leq \\sum_{k=0}^\\infty \\frac{1}{3\\cdot 2^k} \\leq 1$", + "grading_guidelines": "(Partial)\n 1. Expressed $\\sum \\delta(n)/n$ as negative powers of 2's and attempted to rearrange the summation.\n(Almost)\n 1. Successfully rearranged the summation, and counted $2^{-k}$ correctly.", + "problem_id": "PB-Basic-019", + "level": "basic", + "category": "Number theory", + "source": "(translated) 2003 Korea Winter Program Practice Test", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-basic-019/tests/test.sh b/tasks/pb-basic-019/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-019/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-020/instruction.md b/tasks/pb-basic-020/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ff014b5061e9a598dc08fb908b13ea8d71941346 --- /dev/null +++ b/tasks/pb-basic-020/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +Find all pairs of primes $(a, b)$ such that $a^2 - ab - b^3 = 1$. diff --git a/tasks/pb-basic-020/solution/solve.sh b/tasks/pb-basic-020/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1f6c300aad6c639b378974e982961f571b355255 --- /dev/null +++ b/tasks/pb-basic-020/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_3bc7e52de729ccf276fbc3aaace749134e1f86090a0ee562d6dd3f754b3f7782' +Step 1. Lemma. If for a prime $p$, $p\equiv 2 \pmod{3}$, then $p$ cannot divide $q^2-q+1$ for any prime $q$. + Proof. Assume $p \mid q^2-q+1$ (so $p$ is odd); then $p \mid q^3+1$, so $q^3 \equiv -1 \pmod{p}$, thus $q^6 \equiv 1 \pmod{p}$. Let $\nu$ be the multiplicative order of $q$ modulo $p$; then $\nu \mid 6$, and $\nu \mid p-1$ (by Fermat's Little theorem). That forces $\nu = 2$ (since $\nu = 1$ means $q \equiv 1 \pmod{p}$, so $-1 \equiv q^3 \equiv 1 \pmod{p}$, forcing $p=2$, absurd), and so $q \equiv -1 \pmod{p}$. But then $0\equiv q^2-q+1 \equiv 1 + 1 + 1 = 3 \pmod{p}$, forcing $p=3$, absurd. + + Step 2. Easily $a>3$, then $a^2=ab+b^3+1>2b+b^3+1>2b+b^2+1=(b+1)^2$, hence $a>b+1$; but then from $a\mid b^3+1=(b+1)(b^2-b+1)$ follows that $a\mid b^2-b+1$, hence $a\equiv 1 \pmod{3}$. + + Step 3. If $b\equiv 1\pmod{3}$, then $1=a^2-ab-b^3 \equiv 1-1-1 = -1 \pmod{3}$, a contradiction. If $b\equiv 2\pmod{3}$, then $1=a^2 - ab - b^3 \equiv 1 - 2 + 1 = 0 \pmod{3}$, a contradiction again. Hence $b=3$ (the only moment where the primality of $b$ is actually used), and from this we easily get $a=7$. So $(a,b)=(7,3)$ is the only solution. +IMO_PROOF_3bc7e52de729ccf276fbc3aaace749134e1f86090a0ee562d6dd3f754b3f7782 diff --git a/tasks/pb-basic-020/task.toml b/tasks/pb-basic-020/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..42077632e49a3650ce46d8ac5f02f5021392bb97 --- /dev/null +++ b/tasks/pb-basic-020/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-020" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-020" +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-020/tests/grade_task.py b/tasks/pb-basic-020/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-020/tests/reference.json b/tasks/pb-basic-020/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..0d1f662a2369b556f64837c578c8d01cee979433 --- /dev/null +++ b/tasks/pb-basic-020/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Find all pairs of primes $(a, b)$ such that $a^2 - ab - b^3 = 1$.", + "solution": "Step 1. Lemma. If for a prime $p$, $p\\equiv 2 \\pmod{3}$, then $p$ cannot divide $q^2-q+1$ for any prime $q$.\n Proof. Assume $p \\mid q^2-q+1$ (so $p$ is odd); then $p \\mid q^3+1$, so $q^3 \\equiv -1 \\pmod{p}$, thus $q^6 \\equiv 1 \\pmod{p}$. Let $\\nu$ be the multiplicative order of $q$ modulo $p$; then $\\nu \\mid 6$, and $\\nu \\mid p-1$ (by Fermat's Little theorem). That forces $\\nu = 2$ (since $\\nu = 1$ means $q \\equiv 1 \\pmod{p}$, so $-1 \\equiv q^3 \\equiv 1 \\pmod{p}$, forcing $p=2$, absurd), and so $q \\equiv -1 \\pmod{p}$. But then $0\\equiv q^2-q+1 \\equiv 1 + 1 + 1 = 3 \\pmod{p}$, forcing $p=3$, absurd.\n\n Step 2. Easily $a>3$, then $a^2=ab+b^3+1>2b+b^3+1>2b+b^2+1=(b+1)^2$, hence $a>b+1$; but then from $a\\mid b^3+1=(b+1)(b^2-b+1)$ follows that $a\\mid b^2-b+1$, hence $a\\equiv 1 \\pmod{3}$.\n\n Step 3. If $b\\equiv 1\\pmod{3}$, then $1=a^2-ab-b^3 \\equiv 1-1-1 = -1 \\pmod{3}$, a contradiction. If $b\\equiv 2\\pmod{3}$, then $1=a^2 - ab - b^3 \\equiv 1 - 2 + 1 = 0 \\pmod{3}$, a contradiction again. Hence $b=3$ (the only moment where the primality of $b$ is actually used), and from this we easily get $a=7$. So $(a,b)=(7,3)$ is the only solution.", + "grading_guidelines": "(Partial)\n 1. Proved that $a$ should divide $b^2 - b+1$. Also partial points for proving that $a-2$ cannot be a multiple of $3$.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Basic-020", + "level": "basic", + "category": "Number theory", + "source": "(Modified) Tuymaada 2013, Seniors, P6", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "$(p,q) = (7,3)$" +} diff --git a/tasks/pb-basic-020/tests/test.sh b/tasks/pb-basic-020/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-021/instruction.md b/tasks/pb-basic-021/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d1040d610b2ccbc299738022fca3375bae418d82 --- /dev/null +++ b/tasks/pb-basic-021/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +Define the sequence $x_1 = 6$ and $x_n = 2^{x_{n-1}} + 2$ for all integers $n \ge 2$. Prove that $x_{n-1}$ divides $x_n$ for all integers $n \ge 2$. diff --git a/tasks/pb-basic-021/solution/solve.sh b/tasks/pb-basic-021/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..624a5b9c04f82edaed006cc6d93051baa263c018 --- /dev/null +++ b/tasks/pb-basic-021/solution/solve.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_b0175cc971e8820aa63dd40c66e9b7f1b7285bc7c38cc1c67b462a2ee970a1a7' +We will prove this using induction. Note that $x_{2}=2^{6}+2=66$ + which is divisible by $x_{1}$ and $x_{3}=2^{66}+2=2(2^{65}+1)$, + which is divisible by $2(2^{5}+1)=2^{6}+2=x_{2}$. + + + For $a,b\in\mathbb{N}$, it is well known that $2^{a}+1|2^{ab}+1$ + and $2^{a}-1|2^{ab}-1$ if $2\not|b$. + + + We will prove the result by induction. Note that $\nu_{2}(x_{i})=1$, + so $\frac{x_{n-1}}{x_{n-2}}$ is odd. Also, note that $x_{1}|x_{2}$, + as $2|6$, and $x_{2}|x_{3}$, as $6|66$. + + $x_{n}|x_{n+1}\Longleftrightarrow2^{x_{n-1}-1}+1|2^{x_{n}-1}+1\Longleftarrow x_{n-1}-1|x_{n}-1\Longleftrightarrow2^{x_{n-2}}+1|2^{x_{n-1}}+1\Longleftarrow x_{n-2}|x_{n-1}\text{ and that \ensuremath{\frac{x_{n-1}}{x_{n-2}}} is odd.}$ + Thus $x_{n-2}|x_{n-1}\implies x_{n}|x_{n+1}$, we can prove by induction + that $x_{i}|x_{i+1}$ for all $i\in\mathbb{N}$. +IMO_PROOF_b0175cc971e8820aa63dd40c66e9b7f1b7285bc7c38cc1c67b462a2ee970a1a7 diff --git a/tasks/pb-basic-021/task.toml b/tasks/pb-basic-021/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..63b26494fcdbe2a2c31bf2ef8f98709656a2f8a7 --- /dev/null +++ b/tasks/pb-basic-021/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-021" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-021" +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-021/tests/grade_task.py b/tasks/pb-basic-021/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-021/tests/reference.json b/tasks/pb-basic-021/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..9be227fac0ce0fc608f1732fa561c901155bc2b1 --- /dev/null +++ b/tasks/pb-basic-021/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Define the sequence $x_1 = 6$ and $x_n = 2^{x_{n-1}} + 2$ for all integers $n \\ge 2$. Prove that $x_{n-1}$ divides $x_n$ for all integers $n \\ge 2$.", + "solution": "We will prove this using induction. Note that $x_{2}=2^{6}+2=66$\n which is divisible by $x_{1}$ and $x_{3}=2^{66}+2=2(2^{65}+1)$,\n which is divisible by $2(2^{5}+1)=2^{6}+2=x_{2}$.\n\n\n For $a,b\\in\\mathbb{N}$, it is well known that $2^{a}+1|2^{ab}+1$\n and $2^{a}-1|2^{ab}-1$ if $2\\not|b$.\n\n\n We will prove the result by induction. Note that $\\nu_{2}(x_{i})=1$,\n so $\\frac{x_{n-1}}{x_{n-2}}$ is odd. Also, note that $x_{1}|x_{2}$,\n as $2|6$, and $x_{2}|x_{3}$, as $6|66$.\n\n $x_{n}|x_{n+1}\\Longleftrightarrow2^{x_{n-1}-1}+1|2^{x_{n}-1}+1\\Longleftarrow x_{n-1}-1|x_{n}-1\\Longleftrightarrow2^{x_{n-2}}+1|2^{x_{n-1}}+1\\Longleftarrow x_{n-2}|x_{n-1}\\text{ and that \\ensuremath{\\frac{x_{n-1}}{x_{n-2}}} is odd.}$\n Thus $x_{n-2}|x_{n-1}\\implies x_{n}|x_{n+1}$, we can prove by induction\n that $x_{i}|x_{i+1}$ for all $i\\in\\mathbb{N}$.", + "grading_guidelines": "(Partial)\n 1. Proved $x_{n-1}-1|x_{n}-1$.\n(Almost)\n 1. Solution is almost complete, but made minor mistakes which are not negligible.", + "problem_id": "PB-Basic-021", + "level": "basic", + "category": "Number theory", + "source": "(Modified) ELMO 2015 P1", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-basic-021/tests/test.sh b/tasks/pb-basic-021/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-022/instruction.md b/tasks/pb-basic-022/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9943c171ccfdb44d2350c9974f073156b121690d --- /dev/null +++ b/tasks/pb-basic-022/instruction.md @@ -0,0 +1,9 @@ +# PB-Basic-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 + +Let $S=\{0,1,2^{2024},3^{2024},\ldots\}$ be the set of all perfect + 2024-th powers. Find all polynomials $P$ with integer coefficients + such that $P(x)=s$ has an integer solution $x$ for every $s\in S$. diff --git a/tasks/pb-basic-022/solution/solve.sh b/tasks/pb-basic-022/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4056f599bef33427e4e3d92f1e70d0a1ee118c2c --- /dev/null +++ b/tasks/pb-basic-022/solution/solve.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_88f4d123bb4de7af98dc52cc35cdf7c94c2a6dcc73184ef23e250bc4abc71e68' +Since $0$ is in $S$, there exists an integer $c$ such that $P(c)=0$. + We can write $P(x)=(x-c)^{n}Q(x)$ for some positive integer $n$ + and integer coefficient polynomial $Q$ such that $Q(c)\ne0$. + + \noindent Pick a prime number $q$ bigger than $|Q(c)|,|Q(c+1)|,|Q(c-1)|$. + For every positive integer $m$, there exists an integer $a$ such + that $P(a)=q^{2024m}$. Then, $(a-c)$ is a power of $q$. + + \noindent If it is 1, it is a contradiction to the fact that $|Q(c+1)|,|Q(c-1)| 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-022/tests/reference.json b/tasks/pb-basic-022/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..5b926371a121693cd92d3c968d7e8014eb71ba6a --- /dev/null +++ b/tasks/pb-basic-022/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $S=\\{0,1,2^{2024},3^{2024},\\ldots\\}$ be the set of all perfect\n 2024-th powers. Find all polynomials $P$ with integer coefficients\n such that $P(x)=s$ has an integer solution $x$ for every $s\\in S$.", + "solution": "Since $0$ is in $S$, there exists an integer $c$ such that $P(c)=0$.\n We can write $P(x)=(x-c)^{n}Q(x)$ for some positive integer $n$\n and integer coefficient polynomial $Q$ such that $Q(c)\\ne0$.\n\n \\noindent Pick a prime number $q$ bigger than $|Q(c)|,|Q(c+1)|,|Q(c-1)|$.\n For every positive integer $m$, there exists an integer $a$ such\n that $P(a)=q^{2024m}$. Then, $(a-c)$ is a power of $q$.\n\n \\noindent If it is 1, it is a contradiction to the fact that $|Q(c+1)|,|Q(c-1)| "$VERIFIER_DIR/reward.txt" +python3 -I -S "$here/grade_task.py" diff --git a/tasks/pb-basic-023/instruction.md b/tasks/pb-basic-023/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..96466157c34a5567cdedbdfc2221c4cd1a2bc2c9 --- /dev/null +++ b/tasks/pb-basic-023/instruction.md @@ -0,0 +1,8 @@ +# PB-Basic-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 + +Suppose $a,b,c$ are positive integers such that $2^{a}+1=7^{b}+2^{c}$. + Find all possible values of $(a,b,c)$. diff --git a/tasks/pb-basic-023/solution/solve.sh b/tasks/pb-basic-023/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e7ffadab9450647b68fa76a58229324469f03f0e --- /dev/null +++ b/tasks/pb-basic-023/solution/solve.sh @@ -0,0 +1,82 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_4393d5c48aa4d550dc62db261ca201891f0c1235d787f441e21f615629b91bc9' +From the given equation, observe that $a>c$. The equation can be + rewritten as: + \[ + 2^{c}\left(2^{a-c}-1\right)=7^{b}-1. + \] + + We consider the following cases: + + + \textbf{Case 1: $b$ is odd} + + In this case, $7^{b}-1\equiv2\pmod 4$, so $2^{c}=2$, which implies + $c=1$. Substituting back into the equation, we have: + \[ + 2^{a}=7^{b}+1. + \] + + On the other hand, note that $7^{b}+1=8(7^{b-1}-7^{b-2}+\cdots+7+1)$. + If $b\ge3$ the second factor is an odd number greater than 1 which + cannot divide $2^{a}$, contradiction. Therefore we have $b=1$ and + $2^{a}=8$, so $a=3$. Hence, this case gives the solution $(a,b,c)=(3,1,1)$. + + + \textbf{Case 2: $b$ is even but not divisible by $4$} + + Let $b=4k+2$, where $k\in\mathbb{N}$. Then: + \[ + 7^{b}-1=7^{4k+2}-1=\left(7^{2k+1}-1\right)\left(7^{2k+1}+1\right). + \] + + Reasoning similarly to the previous case, we find that $7^{2k+1}-1$ + is divisible by $2$ but not by $4$, $7^{2k+1}+1$ is divisible by + $8$ but not by $16$. Therefore, $7^{b}-1$ is divisible by $16$ + but not by $32$, which implies $c=4$. Substituting back into the + equation, we have: + \[ + 2^{a}=7^{4k+2}+15. + \] + + Since $7^{4k+2}+15\equiv1\pmod 3$, it follows that $2^{a}\equiv1\pmod 3$. + Thus, $a$ is even. Let $a=2\ell$, where $\ell\in\mathbb{Z}^{+}$, + $\ell\geq2$ (since $x>z=4$). We can write: + \[ + 15=2^{2\ell}-7^{4k+2}=\left(2^{\ell}-7^{2k+1}\right)\left(2^{\ell}+7^{2k+1}\right). + \] + + From here we easily obtain $\ell=3$ and $k=0$ which gives $a=6$ + and $b=2$. Thus, this case gives the solution $(a,b,c)=(6,2,4)$. + + + \textbf{Case 3: $b$ is divisible by $4$} + + In this case, $7^{b}-1$ is divisible by $4^{2}=16$. Since $2^{a-c}-1$ + is divisible by $25$, $a-c$ is divisible by $\text{ord}_{25}(2)=20$. + Then, $2^{a-c}-1$ is divisible by 31. Additionally: + \[ + 2^{a-c}-1\text{ is divisible by }31\implies7^{b}-1\text{ is divisible by }31. + \] + + Note that $\text{ord}_{31}(7)=15$, so $b$ is divisible by $15$. + However, in this case $7^{b}-1$ is also divisible by $9$, implying + $a-c$ must be divisible by $6$ which implies that $2^{a-c}-1$ is + divisible by $7$. Then, we find: + \[ + 7^{b}-1\text{ is divisible by }7,\text{ leading to a contradiction.} + \] + + Hence, there are no solutions in this case. + + + \textbf{Conclusion} + + The two valid solutions are: + \[ + (a,b,c)=(3,1,1)\quad\text{and}\quad(a,b,c)=(6,2,4). + \] +IMO_PROOF_4393d5c48aa4d550dc62db261ca201891f0c1235d787f441e21f615629b91bc9 diff --git a/tasks/pb-basic-023/task.toml b/tasks/pb-basic-023/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c09041b2c58896a0350f27a63e260847dc66a823 --- /dev/null +++ b/tasks/pb-basic-023/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-023" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-023" +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-023/tests/grade_task.py b/tasks/pb-basic-023/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-023/tests/reference.json b/tasks/pb-basic-023/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..788740fa84fbe121cb7f8bdfe8a603fc8fdffb45 --- /dev/null +++ b/tasks/pb-basic-023/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Suppose $a,b,c$ are positive integers such that $2^{a}+1=7^{b}+2^{c}$.\n Find all possible values of $(a,b,c)$.", + "solution": "From the given equation, observe that $a>c$. The equation can be\n rewritten as:\n \\[\n 2^{c}\\left(2^{a-c}-1\\right)=7^{b}-1.\n \\]\n\n We consider the following cases:\n\n\n \\textbf{Case 1: $b$ is odd}\n\n In this case, $7^{b}-1\\equiv2\\pmod 4$, so $2^{c}=2$, which implies\n $c=1$. Substituting back into the equation, we have:\n \\[\n 2^{a}=7^{b}+1.\n \\]\n\n On the other hand, note that $7^{b}+1=8(7^{b-1}-7^{b-2}+\\cdots+7+1)$.\n If $b\\ge3$ the second factor is an odd number greater than 1 which\n cannot divide $2^{a}$, contradiction. Therefore we have $b=1$ and\n $2^{a}=8$, so $a=3$. Hence, this case gives the solution $(a,b,c)=(3,1,1)$.\n\n\n \\textbf{Case 2: $b$ is even but not divisible by $4$}\n\n Let $b=4k+2$, where $k\\in\\mathbb{N}$. Then:\n \\[\n 7^{b}-1=7^{4k+2}-1=\\left(7^{2k+1}-1\\right)\\left(7^{2k+1}+1\\right).\n \\]\n\n Reasoning similarly to the previous case, we find that $7^{2k+1}-1$\n is divisible by $2$ but not by $4$, $7^{2k+1}+1$ is divisible by\n $8$ but not by $16$. Therefore, $7^{b}-1$ is divisible by $16$\n but not by $32$, which implies $c=4$. Substituting back into the\n equation, we have:\n \\[\n 2^{a}=7^{4k+2}+15.\n \\]\n\n Since $7^{4k+2}+15\\equiv1\\pmod 3$, it follows that $2^{a}\\equiv1\\pmod 3$.\n Thus, $a$ is even. Let $a=2\\ell$, where $\\ell\\in\\mathbb{Z}^{+}$,\n $\\ell\\geq2$ (since $x>z=4$). We can write:\n \\[\n 15=2^{2\\ell}-7^{4k+2}=\\left(2^{\\ell}-7^{2k+1}\\right)\\left(2^{\\ell}+7^{2k+1}\\right).\n \\]\n\n From here we easily obtain $\\ell=3$ and $k=0$ which gives $a=6$\n and $b=2$. Thus, this case gives the solution $(a,b,c)=(6,2,4)$.\n\n\n \\textbf{Case 3: $b$ is divisible by $4$}\n\n In this case, $7^{b}-1$ is divisible by $4^{2}=16$. Since $2^{a-c}-1$\n is divisible by $25$, $a-c$ is divisible by $\\text{ord}_{25}(2)=20$.\n Then, $2^{a-c}-1$ is divisible by 31. Additionally:\n \\[\n 2^{a-c}-1\\text{ is divisible by }31\\implies7^{b}-1\\text{ is divisible by }31.\n \\]\n\n Note that $\\text{ord}_{31}(7)=15$, so $b$ is divisible by $15$.\n However, in this case $7^{b}-1$ is also divisible by $9$, implying\n $a-c$ must be divisible by $6$ which implies that $2^{a-c}-1$ is\n divisible by $7$. Then, we find:\n \\[\n 7^{b}-1\\text{ is divisible by }7,\\text{ leading to a contradiction.}\n \\]\n\n Hence, there are no solutions in this case.\n\n\n \\textbf{Conclusion}\n\n The two valid solutions are:\n \\[\n (a,b,c)=(3,1,1)\\quad\\text{and}\\quad(a,b,c)=(6,2,4).\n \\]", + "grading_guidelines": "(Partial)\n 1. Found all answers.\n 2. Handled the case of $b$ is odd and $2\\pmod 4$.\n(Almost)\n1. Verification contains minor mistakes only or missed a trivial case.", + "problem_id": "PB-Basic-023", + "level": "basic", + "category": "Number theory", + "source": "(Modified) Vietnam TST 2019 P4", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "$(a,b,c) =( 3,1,1) ,( 6,2,4)$." +} diff --git a/tasks/pb-basic-023/tests/test.sh b/tasks/pb-basic-023/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-024/instruction.md b/tasks/pb-basic-024/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e7a18da861e3c1023ef0cc00cd07824e5c0035c0 --- /dev/null +++ b/tasks/pb-basic-024/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +Find all non-negative integers $a,b,c$ such that $20^{a}+b^{4}=2024^{c}$ diff --git a/tasks/pb-basic-024/solution/solve.sh b/tasks/pb-basic-024/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d22b2895fb7d68f570ddbbf93564a04a2ea0884c --- /dev/null +++ b/tasks/pb-basic-024/solution/solve.sh @@ -0,0 +1,40 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_16087540df0968e6371b77787f32ca89238b593f9142bc3dbd96b81449774f41' +We state the following well-known lemma: If $p=4k+3$ is a prime + number for some positive integer $k$, and there exists integers $x,y$ + such that $x^{2}+y^{2}$ is divisible by $p$, then we have $x,y$ + are both divisible by $p$. + + We omit the proof of this lemma since it is a well-known result. + + Now, return to the main problem. It is obvious that $(a,b,c)=(0,0,0)$ + is a solution. Now, consider $c>0$, we have the following cases: + + + \textbf{Case 1: $a$ is even.} + + In this case, we have $a=2k$ for some non-negative integer $k$. + This gives $(20^{k})^{2}+(b^{2})^{2}$ is divisible by $2024$, which + is divisible by $11$. Since $11$ is a prime in the form of $4n+3$ + for some positive integer $n$, we must have that $20^{k},b^{2}$ + are all divisible by $11$, which is a contradiction since $\gcd(20,11)=1$. + Hence, $a$ cannot be even. + + + \textbf{Case 2: $a$ is odd.} + + In this case, we have $a,c\geq1$, and so $b$ must be even. Let $b=2^{t}q$ + for some non-negative integer $t,q$ where $q$ is odd, we have the + equation becomes $2^{2a}5^{a}+2^{4t}q^{4}=2^{3c}253^{c}$. Consider + quadratic residue modulo $11$, we have the LHS gives us $-5$ is + a quadratic residue modulo $11$. However, since $11$ has the form + $4n+3$ we have $-1$ is a quadratic nonresdue, while $5$ is a quadratic + residue modulo $11$ from the Law of Quadratic Reciprocity. Hence, + we have that $-5$ is a quadratic nonresidue modulo $11$, which a + contradiction. + + Hence, $(a,b,c)=(0,0,0)$ is the only solution. +IMO_PROOF_16087540df0968e6371b77787f32ca89238b593f9142bc3dbd96b81449774f41 diff --git a/tasks/pb-basic-024/task.toml b/tasks/pb-basic-024/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f6c6b29b879aa1437f91de959771e3f8b2570121 --- /dev/null +++ b/tasks/pb-basic-024/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-024" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-024" +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-024/tests/grade_task.py b/tasks/pb-basic-024/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-024/tests/reference.json b/tasks/pb-basic-024/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..4c0150f877a47b561dd1fe50d6d246b7ca657a60 --- /dev/null +++ b/tasks/pb-basic-024/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Find all non-negative integers $a,b,c$ such that $20^{a}+b^{4}=2024^{c}$", + "solution": "We state the following well-known lemma: If $p=4k+3$ is a prime\n number for some positive integer $k$, and there exists integers $x,y$\n such that $x^{2}+y^{2}$ is divisible by $p$, then we have $x,y$\n are both divisible by $p$.\n\n We omit the proof of this lemma since it is a well-known result.\n\n Now, return to the main problem. It is obvious that $(a,b,c)=(0,0,0)$\n is a solution. Now, consider $c>0$, we have the following cases:\n\n\n \\textbf{Case 1: $a$ is even.}\n\n In this case, we have $a=2k$ for some non-negative integer $k$.\n This gives $(20^{k})^{2}+(b^{2})^{2}$ is divisible by $2024$, which\n is divisible by $11$. Since $11$ is a prime in the form of $4n+3$\n for some positive integer $n$, we must have that $20^{k},b^{2}$\n are all divisible by $11$, which is a contradiction since $\\gcd(20,11)=1$.\n Hence, $a$ cannot be even.\n\n\n \\textbf{Case 2: $a$ is odd.}\n\n In this case, we have $a,c\\geq1$, and so $b$ must be even. Let $b=2^{t}q$\n for some non-negative integer $t,q$ where $q$ is odd, we have the\n equation becomes $2^{2a}5^{a}+2^{4t}q^{4}=2^{3c}253^{c}$. Consider\n quadratic residue modulo $11$, we have the LHS gives us $-5$ is\n a quadratic residue modulo $11$. However, since $11$ has the form\n $4n+3$ we have $-1$ is a quadratic nonresdue, while $5$ is a quadratic\n residue modulo $11$ from the Law of Quadratic Reciprocity. Hence,\n we have that $-5$ is a quadratic nonresidue modulo $11$, which a\n contradiction.\n\n Hence, $(a,b,c)=(0,0,0)$ is the only solution.", + "grading_guidelines": "(Partial)\n 1. Correctly analyzed either the $a$ is even case or $a$ is odd case but not both.\n(Almost)\n 1. Verification contains minor mistakes only or missed a trivial case.", + "problem_id": "PB-Basic-024", + "level": "basic", + "category": "Number theory", + "source": "(Modified) Serbia MO 2008, P1", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "$(a,b,c) = (0,0,0)$" +} diff --git a/tasks/pb-basic-024/tests/test.sh b/tasks/pb-basic-024/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-025/instruction.md b/tasks/pb-basic-025/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d9a66c4eedeb08ce3c3738e59c1e3f8f06235777 --- /dev/null +++ b/tasks/pb-basic-025/instruction.md @@ -0,0 +1,10 @@ +# PB-Basic-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 + +Given a triangle $XYZ$ with circumcenter $O$, the incircle of triangle + $XYZ$ has center $I$. Let $M,N$ on the sides $XY,XZ$ + respectively such that $YM=ZN=YZ$. If $\gamma$ is the angle created + by two lines $MN,OI$, what is $\frac{\gamma}{2}$ in terms of degree? diff --git a/tasks/pb-basic-025/solution/solve.sh b/tasks/pb-basic-025/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f5ab860b4ef85914e1c260bd95f2cee77be23b26 --- /dev/null +++ b/tasks/pb-basic-025/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_ed6d11b10bdd16ad529ad7d96a36b7790b2c33fcd65605408d26be7ded0b21c8' +Let the incircle of $XYZ$ meet the sides of $XYZ$ at points $D,E,F$. Let $G$ be the centroid of triangle $DEF$, it is well-known that + $I,G,O$ are collinear. Let $r$ be the inradius and $\vec{v}$ be + the unit vector perpendicular to $MN$ pointing outward, we have $YZ\vec{ID}+ZN\vec{IE}+YM\vec{IF}+rMN\vec{v}=\vec{0}$. + Since $YZ=YM=ZN=a$, we have $YZ\vec{ID}+ZN\vec{IE}+YM\vec{IF}+rMN\vec{v}=\vec{0}$ + is equivalent to $3a\vec{IG}=-rMN\vec{v}$, which implies that $IG$ + is parallel with $\vec{v}$. Since $\vec{v}$ is perpendicular to + $MN$, this implies that $MN$ is perpendicular to $IG$. Combining + this with the fact that $I,G,O$ is collinear, we have $\gamma=90^{\circ}$, + which means that $\frac{\gamma}{2}=45^{\circ}$. +IMO_PROOF_ed6d11b10bdd16ad529ad7d96a36b7790b2c33fcd65605408d26be7ded0b21c8 diff --git a/tasks/pb-basic-025/task.toml b/tasks/pb-basic-025/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cf2831ad699fa14441153bbafdde2eb35d9b9eb5 --- /dev/null +++ b/tasks/pb-basic-025/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-025" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-025" +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-025/tests/grade_task.py b/tasks/pb-basic-025/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-025/tests/reference.json b/tasks/pb-basic-025/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..c58f6447d609edebe1e8f4f3b105001f28d1f257 --- /dev/null +++ b/tasks/pb-basic-025/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Given a triangle $XYZ$ with circumcenter $O$, the incircle of triangle\n $XYZ$ has center $I$. Let $M,N$ on the sides $XY,XZ$\n respectively such that $YM=ZN=YZ$. If $\\gamma$ is the angle created\n by two lines $MN,OI$, what is $\\frac{\\gamma}{2}$ in terms of degree?", + "solution": "Let the incircle of $XYZ$ meet the sides of $XYZ$ at points $D,E,F$. Let $G$ be the centroid of triangle $DEF$, it is well-known that\n $I,G,O$ are collinear. Let $r$ be the inradius and $\\vec{v}$ be\n the unit vector perpendicular to $MN$ pointing outward, we have $YZ\\vec{ID}+ZN\\vec{IE}+YM\\vec{IF}+rMN\\vec{v}=\\vec{0}$.\n Since $YZ=YM=ZN=a$, we have $YZ\\vec{ID}+ZN\\vec{IE}+YM\\vec{IF}+rMN\\vec{v}=\\vec{0}$\n is equivalent to $3a\\vec{IG}=-rMN\\vec{v}$, which implies that $IG$\n is parallel with $\\vec{v}$. Since $\\vec{v}$ is perpendicular to\n $MN$, this implies that $MN$ is perpendicular to $IG$. Combining\n this with the fact that $I,G,O$ is collinear, we have $\\gamma=90^{\\circ}$,\n which means that $\\frac{\\gamma}{2}=45^{\\circ}$.", + "grading_guidelines": "(Partial)\n 1. Considered the point $G$, the centroid of the triangle formed by the points of tangency of the incircle and the sides of $XYZ$, and explained that $I,G,O$ is collinear.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Basic-025", + "level": "basic", + "category": "Geometry", + "source": "folklore", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": "45" +} diff --git a/tasks/pb-basic-025/tests/test.sh b/tasks/pb-basic-025/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-026/instruction.md b/tasks/pb-basic-026/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1a5ba6781dde21139ae80e5032c1584d2978c908 --- /dev/null +++ b/tasks/pb-basic-026/instruction.md @@ -0,0 +1,12 @@ +# PB-Basic-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 $\triangle ABC$ be an inscribed triangle in $(O)$ and circumscribed + around $(I)$. The incircle $(I)$ touches $BC,CA,AB$ at $D,E,F$, + respectively. Construct the circle $(W_{a})$ passing through $B,C$ + and tangent to $(I)$ at $X$, and let $D'$ be the reflection of + $D$ across $AI$. Define $Y,Z,E',F'$ similarly. Prove that the lines + $D'X,E'Y,F'Z$ are concurrent on the line $OI$. diff --git a/tasks/pb-basic-026/solution/solve.sh b/tasks/pb-basic-026/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..972400c45a8018ed3fc2b94d8e87cfd37986e93a --- /dev/null +++ b/tasks/pb-basic-026/solution/solve.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_641eed7b84a961cc7a5180ea62acc3d04fcd72eacd72ca53d6909345d7153aac' +Lemma: Let $ABC$ be an acute triangle with circumcircle $\Omega$. + Let $B_{0}$ be the midpoint of $AC$ and let $C_{0}$ be the midpoint + of $AB$. Let $D$ be the foot of the altitude from $A$ and let $G$ + be the centroid of the triangle $ABC$. Let $\omega$ be a circle + through $B_{0}$ and $C_{0}$ that is tangent to the circle $\Omega$ + at a point $X\not=A$. Prove that the points $D,G$ and $X$ are collinear. + + This is the well-known IMO Shortlist 2011 G4 problem, we omit the + proof here. + + Consider an inversion center $I$ with power $r^{2}$ where $r$ is + the inradius. This maps $B,C$ to the midpoint $M_{B},M_{C}$ of $DF,DE$ + respectively. Moreover, we have $DD'$ is parallel to $EF$. Let $G$ + be the centroid of $\triangle DEF$ and $H_{D}$ be the foot of $D$ + onto $EF$. We have $D',G,H_{D}$ are collinear from Thales Theorem, + and $X,G,H_{D}$ are collinear. And so, we have $XD'$ passes through + $G$. Similarly, we have $YE',ZF'$ passes through $G$ as well. Finally, + it is well-known that $I,G,O$ are collinear. And so, we have $D'X,E'Y,F'Z$ + are concurrent on the line $OI$. +IMO_PROOF_641eed7b84a961cc7a5180ea62acc3d04fcd72eacd72ca53d6909345d7153aac diff --git a/tasks/pb-basic-026/task.toml b/tasks/pb-basic-026/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1b9ca84a8db974b91bc564ab820663abf90ff8df --- /dev/null +++ b/tasks/pb-basic-026/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-026" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-026" +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-026/tests/grade_task.py b/tasks/pb-basic-026/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-026/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-026/tests/reference.json b/tasks/pb-basic-026/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..21dbb4fecdd77cb9c943f2a4fff782c753ab2a0c --- /dev/null +++ b/tasks/pb-basic-026/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $\\triangle ABC$ be an inscribed triangle in $(O)$ and circumscribed\n around $(I)$. The incircle $(I)$ touches $BC,CA,AB$ at $D,E,F$,\n respectively. Construct the circle $(W_{a})$ passing through $B,C$\n and tangent to $(I)$ at $X$, and let $D'$ be the reflection of\n $D$ across $AI$. Define $Y,Z,E',F'$ similarly. Prove that the lines\n $D'X,E'Y,F'Z$ are concurrent on the line $OI$.", + "solution": "Lemma: Let $ABC$ be an acute triangle with circumcircle $\\Omega$.\n Let $B_{0}$ be the midpoint of $AC$ and let $C_{0}$ be the midpoint\n of $AB$. Let $D$ be the foot of the altitude from $A$ and let $G$\n be the centroid of the triangle $ABC$. Let $\\omega$ be a circle\n through $B_{0}$ and $C_{0}$ that is tangent to the circle $\\Omega$\n at a point $X\\not=A$. Prove that the points $D,G$ and $X$ are collinear.\n\n This is the well-known IMO Shortlist 2011 G4 problem, we omit the\n proof here.\n\n Consider an inversion center $I$ with power $r^{2}$ where $r$ is\n the inradius. This maps $B,C$ to the midpoint $M_{B},M_{C}$ of $DF,DE$\n respectively. Moreover, we have $DD'$ is parallel to $EF$. Let $G$\n be the centroid of $\\triangle DEF$ and $H_{D}$ be the foot of $D$\n onto $EF$. We have $D',G,H_{D}$ are collinear from Thales Theorem,\n and $X,G,H_{D}$ are collinear. And so, we have $XD'$ passes through\n $G$. Similarly, we have $YE',ZF'$ passes through $G$ as well. Finally,\n it is well-known that $I,G,O$ are collinear. And so, we have $D'X,E'Y,F'Z$\n are concurrent on the line $OI$.", + "grading_guidelines": "(Partial)\n 1. Applied correct inversion and explain that $D',G,H_{D}$ is collinear, where $H_{D}$ is the foot of $D$ onto $EF$.\n 2. Obtained equivalent information without inversion.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Basic-026", + "level": "basic", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": " " +} diff --git a/tasks/pb-basic-026/tests/test.sh b/tasks/pb-basic-026/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-026/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-027/instruction.md b/tasks/pb-basic-027/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..edfdfc8a264e4b9b604c41b54d2ecda0dc802299 --- /dev/null +++ b/tasks/pb-basic-027/instruction.md @@ -0,0 +1,13 @@ +# PB-Basic-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 + +Given an acute triangle $ABC$, let $D$ and $E$ be the feet of + the altitudes from $B$ to $AC$ and $C$ to $AB$, respectively. + Let $E_{1}$ and $E_{2}$ be the reflections of $E$ with respect + to $AC$ and $BC$, respectively. If $X$ (not equal to $C$) is an + intersection point of the circumcircle of $\triangle CE_{1}E_{2}$ + and $AC$, and $O$ is the circumcenter of $\triangle CE_{1}E_{2}$, + prove that $XO$ is perpendicular to $DE$. diff --git a/tasks/pb-basic-027/solution/solve.sh b/tasks/pb-basic-027/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d06da14efd093cd4d826cb32d2954e6a47e88cd --- /dev/null +++ b/tasks/pb-basic-027/solution/solve.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_f7aef57e2c5e97348ffb13e76b90312e4b25a5a2f5bad9e47d8da4adf1e94922' +\textbf{Claim.} $X,E,E_{2}$ are colinear. + + + \noindent\emph{Proof. }Let $T$ be a intersection of $EE_{2}$ and + $AC$. Observe that $CE_{1}=CE=CE_{2}$ and $(B,C,E,E_{1},E_{2})$ + are cyclic. This gives $\angle E_{2}E_{1}C=\frac{1}{2}(180^{\circ}-2\angle C)=\angle E_{2}TC$, + so $(E_{2},T,C,E_{1})$ are cyclic. Thus, $T=X$, and we have $X,E,E_{2}$ + colinear. + + + Now, observe $\angle OXC=90-\angle XE_{2}C=90-\angle EE_{2}C=90-\angle ABC=90-\angle ADE=90-\angle XDE$. + Thus, $\angle OXC+\angle XDE=90^{\circ}$, and we have $XO\perp DE$ + as desired. +IMO_PROOF_f7aef57e2c5e97348ffb13e76b90312e4b25a5a2f5bad9e47d8da4adf1e94922 diff --git a/tasks/pb-basic-027/task.toml b/tasks/pb-basic-027/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..595054f234d1e61773f2c27ee511664b1c5a7e14 --- /dev/null +++ b/tasks/pb-basic-027/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-027" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-027" +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-027/tests/grade_task.py b/tasks/pb-basic-027/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-027/tests/reference.json b/tasks/pb-basic-027/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..553306978ee5c421e85552d3305b6d0c612b8f10 --- /dev/null +++ b/tasks/pb-basic-027/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Given an acute triangle $ABC$, let $D$ and $E$ be the feet of\n the altitudes from $B$ to $AC$ and $C$ to $AB$, respectively.\n Let $E_{1}$ and $E_{2}$ be the reflections of $E$ with respect\n to $AC$ and $BC$, respectively. If $X$ (not equal to $C$) is an\n intersection point of the circumcircle of $\\triangle CE_{1}E_{2}$\n and $AC$, and $O$ is the circumcenter of $\\triangle CE_{1}E_{2}$,\n prove that $XO$ is perpendicular to $DE$.", + "solution": "\\textbf{Claim.} $X,E,E_{2}$ are colinear.\n\n\n \\noindent\\emph{Proof. }Let $T$ be a intersection of $EE_{2}$ and\n $AC$. Observe that $CE_{1}=CE=CE_{2}$ and $(B,C,E,E_{1},E_{2})$\n are cyclic. This gives $\\angle E_{2}E_{1}C=\\frac{1}{2}(180^{\\circ}-2\\angle C)=\\angle E_{2}TC$,\n so $(E_{2},T,C,E_{1})$ are cyclic. Thus, $T=X$, and we have $X,E,E_{2}$\n colinear.\n\n\n Now, observe $\\angle OXC=90-\\angle XE_{2}C=90-\\angle EE_{2}C=90-\\angle ABC=90-\\angle ADE=90-\\angle XDE$.\n Thus, $\\angle OXC+\\angle XDE=90^{\\circ}$, and we have $XO\\perp DE$\n as desired.", + "grading_guidelines": "(Partial)\n 1. Proved that $X,E,E_{2}$ are colinear.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Basic-027", + "level": "basic", + "category": "Geometry", + "source": "(Modified) FKMO 2016 P1", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-basic-027/tests/test.sh b/tasks/pb-basic-027/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-028/instruction.md b/tasks/pb-basic-028/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..38a25d9648990b897240560504284841ae8678e4 --- /dev/null +++ b/tasks/pb-basic-028/instruction.md @@ -0,0 +1,11 @@ +# PB-Basic-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 + +In $\triangle ABC$ the altitudes $BE$ and $CF$ intersect at $H$. A circle $(W)$ is + externally tangent to the Euler circle $(E)$ of $\triangle ABC$ and also tangent + to the sides $AB$ and $AC$ at $X$ and $Y$, respectively, with + $(W)$ being closer to $A$ than the Euler circle. Let $I'$ be the + incenter of $\triangle AEF$. Prove that $AXI'Y$ is a rhombus. diff --git a/tasks/pb-basic-028/solution/solve.sh b/tasks/pb-basic-028/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8161316469331cbb1e1bb72fe4e97579493305cd --- /dev/null +++ b/tasks/pb-basic-028/solution/solve.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_dbad64fe6dfad8a0e4d6c3d0c19da15955195bc4b4ce538dd181477de939441d' +Consider the inversion centered at $A$ with power $\sqrt{\frac{1}{2} AE \times AC}$. Under + this inversion, the Euler circle remains unchanged, while $B$ and + $C$ are mapped to $B'$ and $C'$, which are the midpoints of $AF$ + and $AE$, respectively. + + + Observe that if $AXI'Y$ is a rhombus, then $(W)$ is the image of + the mixtilinear incircle of $\triangle AEF$ under a homothety centered + at $A$ with ratio $\frac{1}{2}$. The $A$-excircle of $\triangle ABC$, + which is tangent to $AB,AC$, and $BC$, is mapped to the circle $(V)$, + which is tangent to $AB,AC$, and $(AB'C')$, i.e., the mixtilinear + incircle of $\triangle AEF$. + + + It remains to prove that $(V)$ is tangent to the Euler circle, which + would imply that $(V)$ coincides with $(W)$. Indeed, by Feuerbach's + theorem, the $A$-excircle is externally tangent to $(E)$. Thus, + under the inversion, $(V)$ is also tangent to $(E)$, which implies + that $(V)$ coincides with $(W)$, as desired. +IMO_PROOF_dbad64fe6dfad8a0e4d6c3d0c19da15955195bc4b4ce538dd181477de939441d diff --git a/tasks/pb-basic-028/task.toml b/tasks/pb-basic-028/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b38b8b091e0f60305f9e7aab529abff5c2db1abc --- /dev/null +++ b/tasks/pb-basic-028/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-028" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-028" +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-028/tests/grade_task.py b/tasks/pb-basic-028/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-028/tests/reference.json b/tasks/pb-basic-028/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..9866f414816ef1221d27d3fa89cbbbc14292d443 --- /dev/null +++ b/tasks/pb-basic-028/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "In $\\triangle ABC$ the altitudes $BE$ and $CF$ intersect at $H$. A circle $(W)$ is\n externally tangent to the Euler circle $(E)$ of $\\triangle ABC$ and also tangent\n to the sides $AB$ and $AC$ at $X$ and $Y$, respectively, with\n $(W)$ being closer to $A$ than the Euler circle. Let $I'$ be the\n incenter of $\\triangle AEF$. Prove that $AXI'Y$ is a rhombus.", + "solution": "Consider the inversion centered at $A$ with power $\\sqrt{\\frac{1}{2} AE \\times AC}$. Under\n this inversion, the Euler circle remains unchanged, while $B$ and\n $C$ are mapped to $B'$ and $C'$, which are the midpoints of $AF$\n and $AE$, respectively.\n\n\n Observe that if $AXI'Y$ is a rhombus, then $(W)$ is the image of\n the mixtilinear incircle of $\\triangle AEF$ under a homothety centered\n at $A$ with ratio $\\frac{1}{2}$. The $A$-excircle of $\\triangle ABC$,\n which is tangent to $AB,AC$, and $BC$, is mapped to the circle $(V)$,\n which is tangent to $AB,AC$, and $(AB'C')$, i.e., the mixtilinear\n incircle of $\\triangle AEF$.\n\n\n It remains to prove that $(V)$ is tangent to the Euler circle, which\n would imply that $(V)$ coincides with $(W)$. Indeed, by Feuerbach's\n theorem, the $A$-excircle is externally tangent to $(E)$. Thus,\n under the inversion, $(V)$ is also tangent to $(E)$, which implies\n that $(V)$ coincides with $(W)$, as desired.", + "grading_guidelines": "(Partial)\n 1. Applied correct inversion and modified the goal to showing $(V)$ is tangent to the Euler circle.\n 2. Obtained equivalent information without inversion.\n(Almost)\n 1. Verification contains minor mistakes only.", + "problem_id": "PB-Basic-028", + "level": "basic", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": " " +} diff --git a/tasks/pb-basic-028/tests/test.sh b/tasks/pb-basic-028/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-029/instruction.md b/tasks/pb-basic-029/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5882d46fb240b7cc8ce9db969eb37ab2a5f91c2c --- /dev/null +++ b/tasks/pb-basic-029/instruction.md @@ -0,0 +1,13 @@ +# PB-Basic-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 + +Let $p$ and $n$ be integers with $0\le p\le n-2$. Consider a set + $S$ of $n$ lines in the plane such that no two of them are parallel + and no three have a common point. Denote by $I$ the set of intersections + of lines in $S$. Let $O$ be a point in the plane not lying on any + line of $S$. A point $X\in I$ is colored red if the open line segment + $OX$ intersects at most $p$ lines in $S$. What is the minimum number + of red points that is contained in $I$? diff --git a/tasks/pb-basic-029/solution/solve.sh b/tasks/pb-basic-029/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1a9233e12d0685f78d365d4cc4870ec655122703 --- /dev/null +++ b/tasks/pb-basic-029/solution/solve.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_b5e85aeeb35e1e54676761b393c2d39972d68043850c2caac65cef859c5acfef' +Let $\ell$ be the nearest to $O$ line from $L$ and $\ell\cap I=\left\{ X_{1},X_{2},...,X_{n-1}\right\} $ + with $|OX_{i}|\leq|OX_{i+1}|$ for every $i.$ + + Claim. Open segment $OX_{i}$ intersects at most $i-1$ line from + $S$. + + Proof. Suppose the contrary, so $OX_{i}$ intersects $i$ lines and + in particular it intersects line $\ell'$ such that $Y=\ell\cap\ell'\notin\bigcup_{t=1}^{i-1}\{X_{t}\}.$ + If $Z=OX_{i}\cap\ell'$ we get the contradiction with + \[ + |OY|\geq|OX_{i}|\implies\angle OYX_{i}<90^{\circ}\implies d(O,\ell')=|OY|\cdot\sin\angle OYZ<|OY|\cdot\sin\angle OYX_{i}=d(O,\ell)\text{ }\Box + \] + Now with fixed $n$ we apply induction by $p.$ By the claim $X_{1}$ + is always red, so the base case $p=0$ follows. Now consider problem + statement for $S\backslash\ell$ and $p=k,$ so there exist at least + $C_{p+2}^{2}$ red points. After backing $\ell$ to $L$ and increasing + $p$ to $p+1$ all red points are preserved and by claim all points + $X_{1},X_{2},...,X_{p+2}$ are red, so totally there are at least + $C_{p+3}^{2}$ red points. + + For the example construction, we take $X=(-1,-1)$ and $n$ lines + to be the lines connecting $(0,n-1-i)$ and $(i,0)$ for $0\le i\le n-1$. +IMO_PROOF_b5e85aeeb35e1e54676761b393c2d39972d68043850c2caac65cef859c5acfef diff --git a/tasks/pb-basic-029/task.toml b/tasks/pb-basic-029/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3e3bb31b8d63f14326e15bbf58bdcb2b66dc4180 --- /dev/null +++ b/tasks/pb-basic-029/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-029" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-029" +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-029/tests/grade_task.py b/tasks/pb-basic-029/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-029/tests/reference.json b/tasks/pb-basic-029/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..49ee56f97139b8541d7e3b7cec0e24a34b73e0a1 --- /dev/null +++ b/tasks/pb-basic-029/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Let $p$ and $n$ be integers with $0\\le p\\le n-2$. Consider a set\n $S$ of $n$ lines in the plane such that no two of them are parallel\n and no three have a common point. Denote by $I$ the set of intersections\n of lines in $S$. Let $O$ be a point in the plane not lying on any\n line of $S$. A point $X\\in I$ is colored red if the open line segment\n $OX$ intersects at most $p$ lines in $S$. What is the minimum number\n of red points that is contained in $I$?", + "solution": "Let $\\ell$ be the nearest to $O$ line from $L$ and $\\ell\\cap I=\\left\\{ X_{1},X_{2},...,X_{n-1}\\right\\} $\n with $|OX_{i}|\\leq|OX_{i+1}|$ for every $i.$\n\n Claim. Open segment $OX_{i}$ intersects at most $i-1$ line from\n $S$.\n\n Proof. Suppose the contrary, so $OX_{i}$ intersects $i$ lines and\n in particular it intersects line $\\ell'$ such that $Y=\\ell\\cap\\ell'\\notin\\bigcup_{t=1}^{i-1}\\{X_{t}\\}.$\n If $Z=OX_{i}\\cap\\ell'$ we get the contradiction with\n \\[\n |OY|\\geq|OX_{i}|\\implies\\angle OYX_{i}<90^{\\circ}\\implies d(O,\\ell')=|OY|\\cdot\\sin\\angle OYZ<|OY|\\cdot\\sin\\angle OYX_{i}=d(O,\\ell)\\text{ }\\Box\n \\]\n Now with fixed $n$ we apply induction by $p.$ By the claim $X_{1}$\n is always red, so the base case $p=0$ follows. Now consider problem\n statement for $S\\backslash\\ell$ and $p=k,$ so there exist at least\n $C_{p+2}^{2}$ red points. After backing $\\ell$ to $L$ and increasing\n $p$ to $p+1$ all red points are preserved and by claim all points\n $X_{1},X_{2},...,X_{p+2}$ are red, so totally there are at least\n $C_{p+3}^{2}$ red points.\n\n For the example construction, we take $X=(-1,-1)$ and $n$ lines\n to be the lines connecting $(0,n-1-i)$ and $(i,0)$ for $0\\le i\\le n-1$.", + "grading_guidelines": "(Partial)\n 1. Guessed the correct answer along with the optimal case construction.\n(Almost)\n 1. Verification contains minor mistakes only.\n 2. Proof is correct, but does not provided the optimal case construction.", + "problem_id": "PB-Basic-029", + "level": "basic", + "category": "Geometry", + "source": "(modified) IMO Shortlist 2008 G5", + "max_score": 7, + "difficulty": "IMO-medium", + "short_answer": "$\\frac{(p + 1)(p + 2)}{2}$" +} diff --git a/tasks/pb-basic-029/tests/test.sh b/tasks/pb-basic-029/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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-basic-030/instruction.md b/tasks/pb-basic-030/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..81530ff9231dab91c43f6e431e5757ab51d77979 --- /dev/null +++ b/tasks/pb-basic-030/instruction.md @@ -0,0 +1,7 @@ +# PB-Basic-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 + +Given a trapezoid $ABCD$ with $AB,CD$ as the two legs. Circle $(W_{1})$ passes through $A,B$, and $(W_{2})$ passes through $C,D$ so that they are tangent to each other. The inscribed angle on circle $W_1$ corresponding to the arc AB on the side opposite to C and D is alpha, and the inscribed angle on circle $W_2$ corresponding to the arc CD on the side opposite to A and B is beta. Construct $(W_{3})$ passing through $A,B$, $(W_{4})$ passing through $C,D$ such that the inscribed angle on circle W3 corresponding to the arc AB on the side opposite to C and D is $\beta$, and the inscribed angle on circle $W_4$ corresponding to the arc CD on the side opposite to A and B is b $\alpha$. Prove that $(W_{3}),(W_{4})$ are tangent to each other. diff --git a/tasks/pb-basic-030/solution/solve.sh b/tasks/pb-basic-030/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5a6ded0d04629188cc28f0e7c2fc8cae46d2390b --- /dev/null +++ b/tasks/pb-basic-030/solution/solve.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -eu +PROOF=${PROOF:-/app/proof.md} +mkdir -p "$(dirname -- "$PROOF")" +cat > "$PROOF" <<'IMO_PROOF_79bdceac5c2d6d22ed02c795b30b986ada71075b3f5ad6a2429d4709b290a51d' +If $AB,CD$ are parallel to each other then $(W_{1})$ maps to $(W_{4}),(W_{2})$ + maps to $(W_{3})$ via a reflection w.r.t. the center $O$ of the + parallelogram $ABCD$. + + If $AB,CD$ are not parallel to each other then let $X$ be the intersection + of $AB,CD$. Consider the inversion with power $XA.XC$ and then reflect + it w.r.t. to the internal bisector $\angle AXD$, we have $A\rightarrow C$, + $B\rightarrow D$ (1). Note that inversion preserves the angle between + the circles and the lines, and so $(W_{1})$ is mapped to $(W_{4})$ + since we have (1) and the angle between $(W_{1})$ and $AB$ is $\alpha$, + which is also the angle between $(W_{4})$ and $CD$. Similarly, we + have $(W_{2})$ is mapped to $(W_{3})$. Since $(W_{1})$ is tangent + to $(W_{2})$, we have $(W_{3})$ is tangent to $(W_{4})$. Hence + proved. +IMO_PROOF_79bdceac5c2d6d22ed02c795b30b986ada71075b3f5ad6a2429d4709b290a51d diff --git a/tasks/pb-basic-030/task.toml b/tasks/pb-basic-030/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a90ab2295f352c4212dd6dab4634ca8572d99c1b --- /dev/null +++ b/tasks/pb-basic-030/task.toml @@ -0,0 +1,20 @@ +schema_version = "1.4" +artifacts = ["/app/proof.md"] +[task] +name = "imo-proofbench/pb-basic-030" +version = "1.0.0" +description = "IMO-ProofBench mathematical proof task" +keywords = ["math", "proof", "imo"] +[metadata] +problem_id = "PB-Basic-030" +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-030/tests/grade_task.py b/tasks/pb-basic-030/tests/grade_task.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca83b5eace2d49f37e715b235faa046e7e66322 --- /dev/null +++ b/tasks/pb-basic-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-basic-030/tests/reference.json b/tasks/pb-basic-030/tests/reference.json new file mode 100644 index 0000000000000000000000000000000000000000..e5afa8c0950d6146483a00091eb0b870b60c94d5 --- /dev/null +++ b/tasks/pb-basic-030/tests/reference.json @@ -0,0 +1,12 @@ +{ + "problem": "Given a trapezoid $ABCD$ with $AB,CD$ as the two legs. Circle $(W_{1})$ passes through $A,B$, and $(W_{2})$ passes through $C,D$ so that they are tangent to each other. The inscribed angle on circle $W_1$ corresponding to the arc AB on the side opposite to C and D is alpha, and the inscribed angle on circle $W_2$ corresponding to the arc CD on the side opposite to A and B is beta. Construct $(W_{3})$ passing through $A,B$, $(W_{4})$ passing through $C,D$ such that the inscribed angle on circle W3 corresponding to the arc AB on the side opposite to C and D is $\\beta$, and the inscribed angle on circle $W_4$ corresponding to the arc CD on the side opposite to A and B is b $\\alpha$. Prove that $(W_{3}),(W_{4})$ are tangent to each other.", + "solution": "If $AB,CD$ are parallel to each other then $(W_{1})$ maps to $(W_{4}),(W_{2})$\n maps to $(W_{3})$ via a reflection w.r.t. the center $O$ of the\n parallelogram $ABCD$.\n\n If $AB,CD$ are not parallel to each other then let $X$ be the intersection\n of $AB,CD$. Consider the inversion with power $XA.XC$ and then reflect\n it w.r.t. to the internal bisector $\\angle AXD$, we have $A\\rightarrow C$,\n $B\\rightarrow D$ (1). Note that inversion preserves the angle between\n the circles and the lines, and so $(W_{1})$ is mapped to $(W_{4})$\n since we have (1) and the angle between $(W_{1})$ and $AB$ is $\\alpha$,\n which is also the angle between $(W_{4})$ and $CD$. Similarly, we\n have $(W_{2})$ is mapped to $(W_{3})$. Since $(W_{1})$ is tangent\n to $(W_{2})$, we have $(W_{3})$ is tangent to $(W_{4})$. Hence\n proved.", + "grading_guidelines": "(Partial)\n 1. Performed an inversion w.r.t. $AB\\cap CD$ and re-analyzed the given problem.\n(Almost)\n 1. Verification contains minor mistakes only.\n 2. Did not consider the case when $AB$ and $CD$ are parallel.", + "problem_id": "PB-Basic-030", + "level": "basic", + "category": "Geometry", + "source": "Novel Problem", + "max_score": 7, + "difficulty": "IMO-easy", + "short_answer": " " +} diff --git a/tasks/pb-basic-030/tests/test.sh b/tasks/pb-basic-030/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d1127f34b10138ec2f993696eafb1775ec248bb --- /dev/null +++ b/tasks/pb-basic-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"