@vela-science/canopus 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +67 -145
  3. package/capsules/erdos1056-k15/bin/linux-arm64/{10428801-10429000 → 10429201-10429400}/verifier +0 -0
  4. package/capsules/erdos1056-k15/bin/linux-x86_64/{10428801-10429000 → 10429201-10429400}/verifier +0 -0
  5. package/compatibility.json +25 -0
  6. package/dist/src/{receipt/map.d.ts → candidate/finalize.d.ts} +2 -9
  7. package/dist/src/candidate/finalize.js +71 -0
  8. package/dist/src/cli.js +89 -195
  9. package/dist/src/contracts/mission.d.ts +1 -13
  10. package/dist/src/contracts/mission.js +4 -42
  11. package/dist/src/contracts/validation.d.ts +1 -25
  12. package/dist/src/contracts/validation.js +1 -95
  13. package/dist/src/engines/codex-tools-native.js +2 -2
  14. package/dist/src/index.d.ts +5 -34
  15. package/dist/src/index.js +4 -34
  16. package/dist/src/mission/prepare.d.ts +10 -1
  17. package/dist/src/mission/prepare.js +29 -30
  18. package/dist/src/product/coverage.d.ts +17 -0
  19. package/dist/src/product/coverage.js +137 -0
  20. package/dist/src/product/doctor.d.ts +1 -2
  21. package/dist/src/product/doctor.js +29 -8
  22. package/dist/src/product/profile.js +8 -2
  23. package/dist/src/product/replay.js +11 -12
  24. package/dist/src/product/run.d.ts +5 -9
  25. package/dist/src/product/run.js +17 -81
  26. package/dist/src/product/submission.d.ts +40 -0
  27. package/dist/src/product/submission.js +217 -0
  28. package/dist/src/product/submit.d.ts +22 -0
  29. package/dist/src/product/submit.js +264 -0
  30. package/dist/src/product/version.d.ts +2 -2
  31. package/dist/src/product/version.js +27 -4
  32. package/dist/src/projection/current-run.d.ts +12 -0
  33. package/dist/src/projection/current-run.js +94 -0
  34. package/dist/src/projection/failure.d.ts +17 -7
  35. package/dist/src/projection/failure.js +43 -12
  36. package/dist/src/projection/retained-mission.d.ts +6 -0
  37. package/dist/src/projection/retained-mission.js +41 -0
  38. package/dist/src/projection/retained-run.d.ts +7 -0
  39. package/dist/src/projection/retained-run.js +50 -0
  40. package/dist/src/run.d.ts +43 -34
  41. package/dist/src/run.js +34 -397
  42. package/dist/src/util/canonical.d.ts +1 -5
  43. package/dist/src/util/canonical.js +1 -53
  44. package/dist/src/vela/cli.d.ts +7 -42
  45. package/dist/src/vela/cli.js +102 -475
  46. package/dist/src/vela/types.d.ts +3 -19
  47. package/dist/src/verifier/run.js +1 -1
  48. package/dist/src/workspace/prepare.d.ts +1 -1
  49. package/dist/src/workspace/prepare.js +15 -15
  50. package/docs/EVALUATION.md +142 -0
  51. package/docs/MISSIONS.md +42 -80
  52. package/docs/RUN_RECORD.md +77 -99
  53. package/docs/adr/0010-nonmutating-runs-and-explicit-submission.md +191 -0
  54. package/missions/erdos1056-k15-next/mission.draft.json +10 -8
  55. package/package.json +18 -15
  56. package/profiles/{erdos1056-k15-10428801-10429000.json → erdos1056-k15-10429201-10429400.json} +10 -10
  57. package/schemas/failure.v1.json +17 -0
  58. package/schemas/mission.v0.json +3 -4
  59. package/schemas/mission.v1.json +7 -28
  60. package/schemas/{run.v1.json → run.v2.json} +58 -116
  61. package/schemas/submission-bundle.v1.json +63 -0
  62. package/toolchain.lock.json +31 -0
  63. package/capsules/formal-erdos-505-test-dim-one/verifier +0 -105
  64. package/capsules/quantum-10-1-4/verifier.py +0 -152
  65. package/capsules/sidon-a24/bin/linux-arm64/verifier +0 -0
  66. package/capsules/sidon-a24/bin/linux-x86_64/verifier +0 -0
  67. package/dist/src/engines/codex-exec.d.ts +0 -17
  68. package/dist/src/engines/codex-exec.js +0 -136
  69. package/dist/src/engines/codex-tool-free.d.ts +0 -26
  70. package/dist/src/engines/codex-tool-free.js +0 -213
  71. package/dist/src/projection/diagnostic.d.ts +0 -12
  72. package/dist/src/projection/diagnostic.js +0 -61
  73. package/dist/src/projection/public-run.d.ts +0 -59
  74. package/dist/src/projection/public-run.js +0 -106
  75. package/dist/src/projection/publication.d.ts +0 -36
  76. package/dist/src/projection/publication.js +0 -47
  77. package/dist/src/projection/run.d.ts +0 -95
  78. package/dist/src/projection/run.js +0 -173
  79. package/dist/src/receipt/map.js +0 -168
  80. package/dist/src/repair/plan.d.ts +0 -2
  81. package/dist/src/repair/plan.js +0 -22
  82. package/dist/src/roles.d.ts +0 -2
  83. package/dist/src/roles.js +0 -9
  84. package/missions/formal-erdos-505-test-dim-one-gpt56/mission.draft.json +0 -40
  85. package/missions/quantum-10-1-4-retry/mission.draft.json +0 -40
  86. package/missions/sidon-a24-at-least-7194-gpt56/mission.draft.json +0 -42
  87. package/missions/sidon-a24-at-least-7194-gpt56-v2/mission.draft.json +0 -42
  88. package/missions/sidon-a24-at-least-7194-gpt56-v3/mission.draft.json +0 -42
  89. package/profiles/formal-erdos-505-test-dim-one-gpt56.json +0 -35
  90. package/profiles/quantum-10-1-4-stabilizer-retry.json +0 -35
  91. package/profiles/sidon-a24-at-least-7194-gpt56-v2.json +0 -35
  92. package/profiles/sidon-a24-at-least-7194-gpt56-v3.json +0 -35
  93. package/profiles/sidon-a24-at-least-7194-gpt56.json +0 -35
  94. package/schemas/canopus.public-run.v1.json +0 -116
@@ -1,29 +1,28 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://vela.science/schemas/canopus/run.v1.json",
4
- "title": "Canopus completed run v1",
5
- "description": "A non-authoritative completed-run record with worker observations, mechanical verifier observations, and caveats that remain standing after verification.",
3
+ "$id": "https://vela.science/schemas/canopus/run.v2.json",
4
+ "title": "Canopus nonmutating Run v2",
6
5
  "type": "object",
7
6
  "additionalProperties": false,
8
7
  "required": [
9
8
  "schema",
10
9
  "run_id",
11
10
  "status",
11
+ "effect",
12
12
  "authority",
13
13
  "external_gate_credit",
14
14
  "mission",
15
15
  "candidate",
16
- "observations",
17
16
  "verifier",
18
- "landing",
19
- "final_roots",
17
+ "submission",
20
18
  "reproduction",
21
19
  "budget"
22
20
  ],
23
21
  "properties": {
24
- "schema": { "const": "canopus.run.v1" },
22
+ "schema": { "const": "canopus.run.v2" },
25
23
  "run_id": { "type": "string", "minLength": 5, "maxLength": 128 },
26
24
  "status": { "const": "completed" },
25
+ "effect": { "const": "none" },
27
26
  "authority": { "const": "non_authoritative" },
28
27
  "external_gate_credit": { "const": false },
29
28
  "mission": {
@@ -47,30 +46,62 @@
47
46
  "claim": { "type": "string", "minLength": 1, "maxLength": 8192 },
48
47
  "artifacts": {
49
48
  "type": "array",
49
+ "minItems": 1,
50
50
  "maxItems": 10,
51
- "items": {
52
- "type": "object",
53
- "additionalProperties": false,
54
- "required": ["path", "kind", "digest", "bytes"],
55
- "properties": {
56
- "path": { "$ref": "#/$defs/relativePath" },
57
- "kind": { "type": "string", "minLength": 1, "maxLength": 128 },
58
- "digest": { "$ref": "#/$defs/sha256" },
59
- "bytes": { "type": "integer", "minimum": 0, "maximum": 1073741824 }
60
- }
61
- }
51
+ "items": { "$ref": "#/$defs/artifact" }
62
52
  },
63
- "caveats": { "$ref": "#/$defs/caveats" }
53
+ "caveats": {
54
+ "type": "array",
55
+ "minItems": 1,
56
+ "maxItems": 10,
57
+ "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
58
+ }
64
59
  }
65
60
  },
66
- "observations": {
61
+ "verifier": { "$ref": "#/$defs/verifier" },
62
+ "submission": { "type": "null" },
63
+ "reproduction": {
67
64
  "type": "object",
68
65
  "additionalProperties": false,
69
- "required": ["worker_observations", "verifier_observations", "standing_caveats"],
66
+ "required": ["matched", "roots", "verifier_status", "stdout_digest", "stderr_digest"],
70
67
  "properties": {
71
- "worker_observations": { "$ref": "#/$defs/observations" },
72
- "verifier_observations": { "$ref": "#/$defs/observations" },
73
- "standing_caveats": { "$ref": "#/$defs/observations" }
68
+ "matched": { "const": true },
69
+ "roots": { "$ref": "#/$defs/roots" },
70
+ "verifier_status": { "const": "passed" },
71
+ "stdout_digest": { "$ref": "#/$defs/sha256" },
72
+ "stderr_digest": { "$ref": "#/$defs/sha256" }
73
+ }
74
+ },
75
+ "budget": { "$ref": "#/$defs/budget" }
76
+ },
77
+ "$defs": {
78
+ "sha256": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
79
+ "gitObject": { "type": "string", "pattern": "^[0-9a-f]{40,64}$" },
80
+ "relativePath": {
81
+ "type": "string",
82
+ "minLength": 1,
83
+ "maxLength": 4096,
84
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
85
+ },
86
+ "roots": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": ["git_commit", "git_tree", "vela_repository"],
90
+ "properties": {
91
+ "git_commit": { "$ref": "#/$defs/gitObject" },
92
+ "git_tree": { "$ref": "#/$defs/gitObject" },
93
+ "vela_repository": { "$ref": "#/$defs/sha256" }
94
+ }
95
+ },
96
+ "artifact": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "required": ["path", "kind", "digest", "bytes"],
100
+ "properties": {
101
+ "path": { "$ref": "#/$defs/relativePath" },
102
+ "kind": { "type": "string", "minLength": 1, "maxLength": 128 },
103
+ "digest": { "$ref": "#/$defs/sha256" },
104
+ "bytes": { "type": "integer", "minimum": 1, "maximum": 1073741824 }
74
105
  }
75
106
  },
76
107
  "verifier": {
@@ -78,19 +109,12 @@
78
109
  "additionalProperties": false,
79
110
  "required": ["status", "sandbox", "record"],
80
111
  "properties": {
81
- "status": { "enum": ["passed", "failed", "error"] },
112
+ "status": { "const": "passed" },
82
113
  "sandbox": { "enum": ["macos_sandbox", "container_network_denied"] },
83
114
  "record": {
84
115
  "type": "object",
85
116
  "additionalProperties": false,
86
- "required": [
87
- "argv",
88
- "executable_digest",
89
- "exit_code",
90
- "stdout_digest",
91
- "stderr_digest",
92
- "duration_ms"
93
- ],
117
+ "required": ["argv", "executable_digest", "exit_code", "stdout_digest", "stderr_digest", "duration_ms"],
94
118
  "properties": {
95
119
  "argv": {
96
120
  "type": "array",
@@ -99,7 +123,7 @@
99
123
  "items": { "type": "string", "maxLength": 4096 }
100
124
  },
101
125
  "executable_digest": { "$ref": "#/$defs/sha256" },
102
- "exit_code": { "type": "integer", "minimum": -1, "maximum": 255 },
126
+ "exit_code": { "const": 0 },
103
127
  "stdout_digest": { "$ref": "#/$defs/sha256" },
104
128
  "stderr_digest": { "$ref": "#/$defs/sha256" },
105
129
  "duration_ms": { "type": "integer", "minimum": 0, "maximum": 3600000 }
@@ -107,51 +131,6 @@
107
131
  }
108
132
  }
109
133
  },
110
- "landing": {
111
- "type": "object",
112
- "additionalProperties": false,
113
- "required": [
114
- "operation_id",
115
- "receipt_root",
116
- "proposal_id",
117
- "route",
118
- "original_route",
119
- "accepted_event_delta",
120
- "publication_state"
121
- ],
122
- "properties": {
123
- "operation_id": { "type": "string", "minLength": 1, "maxLength": 256 },
124
- "receipt_root": { "$ref": "#/$defs/sha256" },
125
- "proposal_id": { "type": "string", "minLength": 1, "maxLength": 256 },
126
- "route": { "enum": ["permit", "defer", "exact_retry"] },
127
- "original_route": {
128
- "oneOf": [
129
- { "enum": ["permit", "defer"] },
130
- { "type": "null" }
131
- ]
132
- },
133
- "accepted_event_delta": {
134
- "oneOf": [
135
- { "type": "integer", "minimum": 0 },
136
- { "type": "null" }
137
- ]
138
- },
139
- "publication_state": { "type": "string", "minLength": 1, "maxLength": 4096 }
140
- }
141
- },
142
- "final_roots": { "$ref": "#/$defs/roots" },
143
- "reproduction": {
144
- "type": "object",
145
- "additionalProperties": false,
146
- "required": ["matched", "roots", "verifier_status", "stdout_digest", "stderr_digest"],
147
- "properties": {
148
- "matched": { "const": true },
149
- "roots": { "$ref": "#/$defs/roots" },
150
- "verifier_status": { "enum": ["passed", "failed", "error"] },
151
- "stdout_digest": { "$ref": "#/$defs/sha256" },
152
- "stderr_digest": { "$ref": "#/$defs/sha256" }
153
- }
154
- },
155
134
  "budget": {
156
135
  "type": "object",
157
136
  "additionalProperties": false,
@@ -173,43 +152,6 @@
173
152
  "attempts": { "$ref": "#/$defs/nonnegativeInteger" },
174
153
  "observed_tokens": { "$ref": "#/$defs/nonnegativeInteger" }
175
154
  }
176
- }
177
- },
178
- "$defs": {
179
- "sha256": {
180
- "type": "string",
181
- "pattern": "^sha256:[0-9a-f]{64}$"
182
- },
183
- "gitObject": {
184
- "type": "string",
185
- "pattern": "^[0-9a-f]{40,64}$"
186
- },
187
- "relativePath": {
188
- "type": "string",
189
- "minLength": 1,
190
- "maxLength": 4096,
191
- "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
192
- },
193
- "roots": {
194
- "type": "object",
195
- "additionalProperties": false,
196
- "required": ["git_commit", "git_tree", "vela_event_log", "vela_snapshot"],
197
- "properties": {
198
- "git_commit": { "$ref": "#/$defs/gitObject" },
199
- "git_tree": { "$ref": "#/$defs/gitObject" },
200
- "vela_event_log": { "$ref": "#/$defs/sha256" },
201
- "vela_snapshot": { "$ref": "#/$defs/sha256" }
202
- }
203
- },
204
- "observations": {
205
- "type": "array",
206
- "maxItems": 16,
207
- "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
208
- },
209
- "caveats": {
210
- "type": "array",
211
- "maxItems": 10,
212
- "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
213
155
  },
214
156
  "nonnegativeInteger": {
215
157
  "type": "integer",
@@ -0,0 +1,63 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://vela.science/schemas/canopus/submission-bundle.v1.json",
4
+ "title": "Canopus portable Submission bundle v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema",
9
+ "run_id",
10
+ "run_root",
11
+ "source",
12
+ "producer",
13
+ "submission_id",
14
+ "submission_root",
15
+ "identity_binding_id",
16
+ "artifacts"
17
+ ],
18
+ "properties": {
19
+ "schema": { "const": "canopus.submission-bundle.v1" },
20
+ "run_id": { "type": "string", "minLength": 5, "maxLength": 128 },
21
+ "run_root": { "$ref": "#/$defs/sha256" },
22
+ "source": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "required": ["git_commit", "git_tree", "vela_version", "vela_sha256"],
26
+ "properties": {
27
+ "git_commit": { "type": "string", "pattern": "^[0-9a-f]{40,64}$" },
28
+ "git_tree": { "type": "string", "pattern": "^[0-9a-f]{40,64}$" },
29
+ "vela_version": { "type": "string", "minLength": 1 },
30
+ "vela_sha256": { "$ref": "#/$defs/sha256" }
31
+ }
32
+ },
33
+ "producer": { "type": "string", "pattern": "^agent:.+$" },
34
+ "submission_id": { "type": "string", "pattern": "^vsb_[0-9a-f]{16}$" },
35
+ "submission_root": { "$ref": "#/$defs/sha256" },
36
+ "identity_binding_id": { "type": "string", "pattern": "^vib_[0-9a-f]{16}$" },
37
+ "artifacts": {
38
+ "type": "array",
39
+ "minItems": 1,
40
+ "maxItems": 10,
41
+ "items": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": ["source", "frontier_path", "digest", "bytes"],
45
+ "properties": {
46
+ "source": { "$ref": "#/$defs/relativePath" },
47
+ "frontier_path": { "$ref": "#/$defs/relativePath" },
48
+ "digest": { "$ref": "#/$defs/sha256" },
49
+ "bytes": { "type": "integer", "minimum": 1, "maximum": 1073741824 }
50
+ }
51
+ }
52
+ }
53
+ },
54
+ "$defs": {
55
+ "sha256": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
56
+ "relativePath": {
57
+ "type": "string",
58
+ "minLength": 1,
59
+ "maxLength": 4096,
60
+ "pattern": "^(?!/)(?!.*\\\\)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "schema": "canopus.toolchain-lock.v1",
3
+ "vela": {
4
+ "version": "0.940.9",
5
+ "tag": "v0.940.9",
6
+ "source_commit": "4de04a553f139911b3c061883f60d9734f73c0f2",
7
+ "release_base_url": "https://github.com/vela-science/vela/releases/download/v0.940.9",
8
+ "assets": {
9
+ "darwin-arm64": {
10
+ "archive": "vela-macos-aarch64.zip",
11
+ "archive_sha256": "0d9c139552e0d12cbb0f2e387897d3135652ec72757f8b9bf3ba8ae2fa2ca20f",
12
+ "binary_sha256": "8d5b8745efaa176d980371d7a6fad633ac53c1c5245e5feb7c4f98a12bc2c02f"
13
+ },
14
+ "linux-x64": {
15
+ "archive": "vela-linux-x86_64.tar.gz",
16
+ "archive_sha256": "fc21a58e10d2d6dc9b0b066250d864ecfa055ca044046194fe47d035931d5585",
17
+ "binary_sha256": "232b4c96b79014e6220a3557ef161b81616a911f6794be09dcea42299716509a"
18
+ },
19
+ "win32-x64": {
20
+ "archive": "vela-windows-x86_64.zip",
21
+ "archive_sha256": "cd2cec3815234aabf17d7466a63588b079aa404d5f0d6f491403d094331c8a32",
22
+ "binary_sha256": "47c85b5af0178ae3a49cf98b832048533bf7c404799c951f6725f03ed69eca5a"
23
+ }
24
+ }
25
+ },
26
+ "codex": {
27
+ "version": "0.145.0",
28
+ "linux_x64_tarball_sha256": "11239480f8e3efd1430f23bbe91c1a397856b8bbe6185ccbaee2382d25e03df2",
29
+ "linux_x64_binary_sha256": "a2a05dafaa1acb002a45eaec0a462de5b13694fcfcd7bc43305f14781ce7be14"
30
+ }
31
+ }
@@ -1,105 +0,0 @@
1
- #!/bin/sh
2
- set -eu
3
-
4
- if [ "$#" -ne 1 ]; then
5
- echo "usage: verifier <proof-term>" >&2
6
- exit 2
7
- fi
8
-
9
- proof=$1
10
- if [ ! -f "$proof" ] || [ -L "$proof" ]; then
11
- echo "proof artifact must be one regular file" >&2
12
- exit 2
13
- fi
14
-
15
- size=$(wc -c < "$proof" | tr -d ' ')
16
- if [ "$size" -eq 0 ] || [ "$size" -gt 131072 ]; then
17
- echo "proof artifact must contain 1..131072 bytes" >&2
18
- exit 2
19
- fi
20
-
21
- if [ "$(head -c 2 "$proof")" != "by" ]; then
22
- echo "proof artifact must begin with a Lean 'by' term" >&2
23
- exit 2
24
- fi
25
-
26
- if LC_ALL=C grep -Eq '(^|[^A-Za-z0-9_])(sorry|admit|axiom|unsafe)([^A-Za-z0-9_]|$)' "$proof"; then
27
- echo "proof artifact contains a forbidden trust-bypassing token" >&2
28
- exit 2
29
- fi
30
-
31
- toolchain=/home/lean/.elan/toolchains/leanprover--lean4---v4.27.0/bin
32
- project=/home/lean/mathlib
33
- if [ ! -x "$toolchain/lean" ]; then
34
- echo "frozen Lean 4.27.0 toolchain is unavailable" >&2
35
- exit 3
36
- fi
37
- if [ ! -f "$project/.lake/build/lib/lean/Mathlib/Analysis/InnerProductSpace/PiL2.olean" ] \
38
- || [ ! -f "$project/.lake/build/lib/lean/Mathlib/Topology/MetricSpace/Bounded.olean" ]; then
39
- echo "frozen minimal Mathlib modules are unavailable" >&2
40
- exit 3
41
- fi
42
-
43
- export PATH="$toolchain:/usr/local/bin:/usr/bin:/bin"
44
- export LC_ALL=C
45
- LEAN_PATH=$(
46
- find "$project" -type d -path '*/.lake/build/lib/lean' -print \
47
- | LC_ALL=C sort \
48
- | paste -sd ':' -
49
- )
50
- if [ -z "$LEAN_PATH" ]; then
51
- echo "frozen Mathlib module path is unavailable" >&2
52
- exit 3
53
- fi
54
- export LEAN_PATH
55
- cd "$project"
56
-
57
- set +e
58
- output=$(
59
- {
60
- printf '%s\n' \
61
- 'import Mathlib.Analysis.InnerProductSpace.PiL2' \
62
- 'import Mathlib.Topology.MetricSpace.Bounded' \
63
- '/-! # Frozen Canopus verification for Erdos 505, dimension one -/' \
64
- 'open Metric Set Classical' \
65
- 'namespace CanopusFormalErdos505' \
66
- 'theorem test_dim_one' \
67
- ' (S : Set (EuclideanSpace ℝ (Fin 1)))' \
68
- ' (hS : Bornology.IsBounded S) (hd : 0 < diam S) :' \
69
- ' ∃ (F : Fin 2 → Set (EuclideanSpace ℝ (Fin 1))),' \
70
- ' S ⊆ ⋃ i, F i ∧ ∀ i, diam (F i) < diam S :='
71
- cat "$proof"
72
- printf '%s\n' \
73
- '#print axioms CanopusFormalErdos505.test_dim_one' \
74
- 'end CanopusFormalErdos505'
75
- } | "$toolchain/lean" --stdin 2>&1
76
- )
77
- status=$?
78
- set -e
79
-
80
- printf '%s\n' "$output"
81
- if [ "$status" -ne 0 ]; then
82
- exit "$status"
83
- fi
84
- if printf '%s\n' "$output" | grep -Fq 'sorryAx'; then
85
- echo "kernel declaration depends on sorryAx" >&2
86
- exit 4
87
- fi
88
-
89
- axiom_line=$(printf '%s\n' "$output" | sed -n "s/^'CanopusFormalErdos505.test_dim_one' depends on axioms: \[\(.*\)\]$/\1/p")
90
- if [ -n "$axiom_line" ]; then
91
- for axiom in $(printf '%s' "$axiom_line" | tr ',' ' '); do
92
- case "$axiom" in
93
- propext|Classical.choice|Quot.sound) ;;
94
- *)
95
- echo "kernel declaration depends on forbidden axiom: $axiom" >&2
96
- exit 4
97
- ;;
98
- esac
99
- done
100
- elif ! printf '%s\n' "$output" | grep -Fq "'CanopusFormalErdos505.test_dim_one' does not depend on any axioms"; then
101
- echo "axiom audit output was missing or malformed" >&2
102
- exit 4
103
- fi
104
-
105
- echo "verified formal:erdos-505-test-dim-one with Lean 4.27.0"
@@ -1,152 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Verify one explicit [[10,1,d>=4]] stabilizer witness."""
3
-
4
- from __future__ import annotations
5
-
6
- import itertools
7
- import json
8
- import pathlib
9
- import sys
10
-
11
- SCHEMA = "canopus.quantum-stabilizer-witness.v1"
12
- TARGET = "quantum:[[10,1,4]]"
13
- N = 10
14
- K = 1
15
- EXPECTED_KEYS = {"schema", "target", "n", "k", "generators"}
16
-
17
-
18
- def fail(message: str) -> "NoReturn":
19
- print(f"quantum verifier: {message}", file=sys.stderr)
20
- raise SystemExit(1)
21
-
22
-
23
- def pauli_vector(pauli: str) -> int:
24
- if len(pauli) != N or any(symbol not in "IXYZ" for symbol in pauli):
25
- fail("each generator must be a length-10 string over I, X, Y, Z")
26
- vector = 0
27
- for qubit, symbol in enumerate(pauli):
28
- if symbol in "XY":
29
- vector |= 1 << qubit
30
- if symbol in "ZY":
31
- vector |= 1 << (N + qubit)
32
- return vector
33
-
34
-
35
- def symplectic(left: int, right: int) -> int:
36
- mask = (1 << N) - 1
37
- left_x, left_z = left & mask, left >> N
38
- right_x, right_z = right & mask, right >> N
39
- return ((left_x & right_z).bit_count() + (left_z & right_x).bit_count()) & 1
40
-
41
-
42
- def binary_rank(rows: list[int]) -> int:
43
- basis: dict[int, int] = {}
44
- for original in rows:
45
- row = original
46
- while row:
47
- pivot = row.bit_length() - 1
48
- if pivot in basis:
49
- row ^= basis[pivot]
50
- else:
51
- basis[pivot] = row
52
- break
53
- return len(basis)
54
-
55
-
56
- def stabilizer_span(generators: list[int]) -> set[int]:
57
- span = {0}
58
- for generator in generators:
59
- span.update(value ^ generator for value in tuple(span))
60
- return span
61
-
62
-
63
- def error_vector(positions: tuple[int, ...], symbols: tuple[str, ...]) -> int:
64
- vector = 0
65
- for qubit, symbol in zip(positions, symbols, strict=True):
66
- if symbol in "XY":
67
- vector |= 1 << qubit
68
- if symbol in "ZY":
69
- vector |= 1 << (N + qubit)
70
- return vector
71
-
72
-
73
- def main() -> None:
74
- if len(sys.argv) != 2:
75
- fail("usage: verifier.py WITNESS.json")
76
- witness_path = pathlib.Path(sys.argv[1])
77
- metadata = witness_path.lstat()
78
- if not witness_path.is_file() or witness_path.is_symlink() or metadata.st_size > 65_536:
79
- fail("witness must be one bounded regular file")
80
- with witness_path.open("rb") as source:
81
- raw = source.read(65_537)
82
- if len(raw) > 65_536:
83
- fail("witness exceeds 65536 bytes")
84
- try:
85
- witness = json.loads(raw)
86
- except (UnicodeDecodeError, json.JSONDecodeError) as error:
87
- fail(f"witness is not valid UTF-8 JSON: {error}")
88
- if not isinstance(witness, dict) or set(witness) != EXPECTED_KEYS:
89
- fail("witness fields must be exactly schema, target, n, k, generators")
90
- if witness["schema"] != SCHEMA or witness["target"] != TARGET:
91
- fail("witness schema or target is wrong")
92
- if type(witness["n"]) is not int or type(witness["k"]) is not int:
93
- fail("n and k must be integers")
94
- if witness["n"] != N or witness["k"] != K:
95
- fail("witness must declare n=10 and k=1")
96
- declared = witness["generators"]
97
- if not isinstance(declared, list) or len(declared) != N - K:
98
- fail("witness must contain exactly nine generators")
99
- if any(not isinstance(generator, str) for generator in declared):
100
- fail("every generator must be a string")
101
- if len(set(declared)) != len(declared):
102
- fail("generators must be distinct")
103
- generators = [pauli_vector(generator) for generator in declared]
104
- if any(generator == 0 for generator in generators):
105
- fail("identity is not a generator")
106
- for left, right in itertools.combinations(generators, 2):
107
- if symplectic(left, right) != 0:
108
- fail("generators do not commute")
109
- rank = binary_rank(generators)
110
- if rank != N - K:
111
- fail(f"generator rank is {rank}, expected nine")
112
- span = stabilizer_span(generators)
113
- if len(span) != 1 << (N - K):
114
- fail("stabilizer span has the wrong cardinality")
115
-
116
- tested = 0
117
- degenerate = 0
118
- for weight in range(1, 4):
119
- for positions in itertools.combinations(range(N), weight):
120
- for symbols in itertools.product("XYZ", repeat=weight):
121
- tested += 1
122
- error = error_vector(positions, symbols)
123
- if all(symplectic(error, generator) == 0 for generator in generators):
124
- if error not in span:
125
- fail(
126
- "found an undetectable non-stabilizer Pauli below weight four: "
127
- f"positions={positions}, symbols={''.join(symbols)}"
128
- )
129
- degenerate += 1
130
- if tested != 3_675:
131
- fail(f"internal enumeration count is {tested}, expected 3675")
132
- print(
133
- json.dumps(
134
- {
135
- "schema": "canopus.quantum-stabilizer-verification.v1",
136
- "target": TARGET,
137
- "n": N,
138
- "k": K,
139
- "rank": rank,
140
- "stabilizer_size": len(span),
141
- "errors_weight_1_to_3_tested": tested,
142
- "low_weight_stabilizers": degenerate,
143
- "distance_at_least": 4,
144
- },
145
- sort_keys=True,
146
- separators=(",", ":"),
147
- )
148
- )
149
-
150
-
151
- if __name__ == "__main__":
152
- main()
@@ -1,17 +0,0 @@
1
- import { type CommandRunner } from "../util/command.js";
2
- import type { Engine, EngineContext, EngineResult } from "./engine.js";
3
- export interface CodexEngineOptions {
4
- binary: string;
5
- expectedSha256: string;
6
- expectedVersion: string;
7
- model: string;
8
- authHome: string;
9
- outputSchema: string;
10
- runner?: CommandRunner;
11
- }
12
- export declare class CodexExecEngine implements Engine {
13
- #private;
14
- readonly name = "codex-exec";
15
- constructor(options: CodexEngineOptions);
16
- run(context: EngineContext): Promise<EngineResult>;
17
- }