import json,math SLUG='synthesis-oracle-limits' def response(threshold,x):return int(x>=threshold) def identify(target,active): candidates=list(range(17));sizes=[17];queries=[] while len(candidates)>1: if active: x=min(range(16),key=lambda x:(max(sum(response(t,x)==y for t in candidates) for y in [0,1]),x)) else:x=len(queries) answer=response(target,x) candidates=[t for t in candidates if response(t,x)==answer] queries.append(x);sizes.append(len(candidates)) assert target in candidates return candidates[0],queries,sizes def optimum(n): dp=[0]*(n+1) for size in range(2,n+1):dp[size]=1+min(max(dp[k],dp[size-k]) for k in range(1,size)) return dp def run(): results=[(identify(t,True),identify(t,False)) for t in range(17)] optimal=optimum(64) inputs=[(x,y) for x in range(8) for y in range(8)] weak=[sum(max(x,y)+c>=x and max(x,y)+c>=y for x,y in inputs) for c in range(5)] strong=[sum(max(x,y)+c>=x and max(x,y)+c>=y and max(x,y)+c in (x,y) for x,y in inputs) for c in range(5)] r11=results[11] checks=[dict(name='Both query strategies identify every finite target',passed=all(a[0]==t and b[0]==t for t,(a,b) in enumerate(results)),cases=17,detail='All 17 thresholds over inputs 0..15, including constant endpoint hypotheses.'),dict(name='Version spaces shrink and retain the target',passed=all(all(b