const fs=require('fs'), assert=require('assert/strict'); let cases=0, anchors=0, divergent=0; for(let n=1;n<=10;n++) { const column=Array.from({length:n},(_,i)=>i); for(let mask=1;mask<(1<mask&(1<!selected.has(id)); const reached=new Set(); for(const anchor of remainder) for(const after of [false,true]) { const rawGap=column.indexOf(anchor)+(after?1:0); const gap=column.slice(0,rawGap).filter(id=>!selected.has(id)).length; reached.add(gap); anchors++; assert.equal(gap,remainder.indexOf(anchor)+(after?1:0)); } if(remainder.length) assert.deepEqual([...reached].sort((a,b)=>a-b),Array.from({length:remainder.length+1},(_,i)=>i)); else assert.equal(selected.size,n); // Only one mathematical gap, all-selected no-op. for(const anchor of selected) for(const after of [false,true]) { const rawGap=column.indexOf(anchor)+(after?1:0); const gap=column.slice(0,rawGap).filter(id=>!selected.has(id)).length; const block=column.filter(id=>selected.has(id)); const normalized=[...remainder.slice(0,gap),...block,...remainder.slice(gap)]; if(normalized.some((id,i)=>id!==column[i]))divergent++; // Object policy intentionally preserves original order for selected anchors. // It need not form a contiguous block when this operation is a no-op. } cases++; } } const result={passed:true,method:'All nonempty subsets for column lengths 1..10, all unselected and selected Before/After anchors. Order-label equivariance makes separate ID permutations redundant for this reachability property.',cases,unselectedAnchors:anchors,selectedAnchorRawNormalizationDivergences:divergent,conclusion:'Every remainder gap is reachable via an unselected Before/After anchor. Selected-anchor no-op does not remove any possible changed result. Raw-gap and object-anchor policies remain distinct APIs; neither silently supersedes the other.',counterexample:{column:['a','b','c','d'],selected:['b','d'],drop:'Before d',rawGapResult:['a','c','b','d'],objectAnchorResult:['a','b','c','d'],equivalentUnselectedDrop:'After c'}}; fs.writeFileSync(__dirname+'/anchor-results.json',JSON.stringify(result,null,2)+'\n'); console.log(JSON.stringify(result,null,2));