{"componentChunkName":"component---src-templates-post-js","path":"/blog/crypto-club-proof-by-contradiction","result":{"data":{"prevPost":{"html":"<p>You can write a differentially private mechanism that compiles, trains, converges, and prints a clean epsilon, and still guarantees nothing.</p>\n<p>I know because I wrote one. It was an adaptive clipping algorithm: instead of fixing the gradient clip bound by hand, it watched training and adjusted the bound on its own. It ran. It reported a small budget. It was not differentially private, and none of that was visible from the outside.</p>\n<p>This is a post about adaptive intelligence, the idea that a good algorithm tunes itself while it learns. Self-tuning is powerful. It is also the exact place privacy leaks, because tuning means looking at the data, and under differential privacy every look has a price.</p>\n<h2 id=\"the-one-rule-you-keep-breaking\" style=\"position:relative;\"><a href=\"#the-one-rule-you-keep-breaking\" aria-label=\"the one rule you keep breaking permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The one rule you keep breaking</h2>\n<p>Here is the rule. Every time your mechanism reads the private data to make a decision, it spends privacy budget, whether or not you wrote down the cost.</p>\n<p>Fixed DP-SGD obeys this without trying. The clip bound is a constant you chose in advance. The noise is a constant you chose in advance. The only thing that touches the data is the gradient, and that one access is exactly what the accountant charges you for.</p>\n<p>The moment your algorithm gets clever, it starts reading the data in new places. It sets the clip bound from the gradients it just saw. It scales the noise by how uncertain the model feels. Each of these is a fresh look at private data, and if the accountant does not know about it, that look is free to you and expensive to the people in your dataset.</p>\n<p>Five ways I have watched this go wrong. Click each one.</p>\n<div class=\"dpw\" id=\"defects\" data-initialised=\"false\">\n  <div class=\"dpw-card\" data-open=\"false\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">1</span> Setting the clip bound from the gradients</div>\n    <div class=\"dpw-card-body\">\n      <p class=\"dpw-leak\"><b>The move:</b> <code>C = mean(gradient_norms)</code>, so the bound tracks the data.</p>\n      <p><b>Why it leaks:</b> the clip bound is now a function of the private gradients. Anyone who sees C learns about them. The Gaussian mechanism assumes C was fixed before you looked.</p>\n      <p class=\"dpw-fix\"><b>The fix:</b> keep C constant, or estimate it through its own noisy sub-mechanism that pays budget.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">2</span> Scaling the noise by a data signal</div>\n    <div class=\"dpw-card-body\">\n      <p class=\"dpw-leak\"><b>The move:</b> <code>sigma = base * (1 + model_uncertainty)</code>.</p>\n      <p><b>Why it leaks:</b> the noise level itself now carries information. An observer reads the amount of noise and infers the signal that set it. Noise is supposed to hide the data, not encode it.</p>\n      <p class=\"dpw-fix\"><b>The fix:</b> sigma is a constant you pick to buy a target epsilon. It never depends on the data.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">3</span> Calibrating noise to the wrong sensitivity</div>\n    <div class=\"dpw-card-body\">\n      <p class=\"dpw-leak\"><b>The move:</b> give one group a larger clip bound, then size the noise to the smaller one.</p>\n      <p><b>Why it leaks:</b> sensitivity is the largest amount any one record can move the sum. If some records are clipped to a bigger bound, the noise must match that bigger bound. Size it to the smaller one and the larger-bound group is under-protected.</p>\n      <p class=\"dpw-fix\"><b>The fix:</b> calibrate noise to <code>max</code> over all per-group bounds, not the average and not the minimum.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">4</span> Adding up per-epoch epsilons</div>\n    <div class=\"dpw-card-body\">\n      <p class=\"dpw-leak\"><b>The move:</b> <code>epsilon_total = sum(epsilon_epoch)</code>.</p>\n      <p><b>Why it leaks:</b> naive summation is both loose and, once parameters adapt on the data, invalid. Each step's mechanism depends on choices made from earlier private data, so the steps are not the independent pieces the sum assumes.</p>\n      <p class=\"dpw-fix\"><b>The fix:</b> compose with a Renyi accountant that tracks the whole adaptive procedure, not a running total of unrelated numbers.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">5</span> A sub-mechanism that never pays</div>\n    <div class=\"dpw-card-body\">\n      <p class=\"dpw-leak\"><b>The move:</b> the adaptation reads the data to update a knob, but only the gradient release is accounted.</p>\n      <p><b>Why it leaks:</b> the knob is a second output computed from private data. It free-rides on the budget the gradients paid. Two releases, one bill.</p>\n      <p class=\"dpw-fix\"><b>The fix:</b> account for every release. The next section shows how to split one budget across both.</p>\n    </div>\n  </div>\n</div>\n<p>Defects one and two are the same disease: a knob set from the data with no entry in the ledger. Defect three is a calibration slip that any per-group scheme invites. Defect four is a composition shortcut. Defect five is the one people miss most, so it gets its own section.</p>\n<h2 id=\"two-mechanisms-one-accountant\" style=\"position:relative;\"><a href=\"#two-mechanisms-one-accountant\" aria-label=\"two mechanisms one accountant permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Two mechanisms, one accountant</h2>\n<p>Good adaptive clipping actually does the right thing. To tune the bound safely, it privately estimates how many gradients got clipped last step, then nudges the bound toward a target. That estimate is noisy on purpose, because it is a read of the data and has to be paid for.</p>\n<p>So every step releases two things. The noisy gradient sum, and the noisy clipped count. The standard privacy statement in most libraries accounts for one Gaussian mechanism, the gradients. Hand it your noise multiplier and it happily reports an epsilon that ignores the second release. The number is too good, and defect five is hiding inside it.</p>\n<p>The fix is to split one budget across both releases and account for the sum. Under Rényi composition, releasing two independent Gaussians combines cleanly:</p>\n<div class=\"dpw-formula\">&sigma;<sub>total</sub><sup>&minus;2</sup> &nbsp;=&nbsp; &sigma;<sub>grad</sub><sup>&minus;2</sup> &nbsp;+&nbsp; (2&#8201;&sigma;<sub>count</sub>)<sup>&minus;2</sup></div>\n<p>You pick the total you want to be charged for, hand a slice of it to the count, and the gradient noise grows a little to keep the books balanced. There is a real trap here. A popular default sets the count noise to records-per-round over twenty, which was tuned for federated rounds holding thousands of records. At a batch of thirty-two it demands more budget than exists and the split has no solution.</p>\n<p>Move the sliders. Watch the records-over-twenty default fall off a cliff, and watch the budget-share fix stay sane.</p>\n<div class=\"dpw\" id=\"budget\" data-initialised=\"false\">\n  <div class=\"dpw-controls dpw-grid\">\n    <label class=\"dpw-label\">Total noise multiplier &sigma;\n      <input type=\"range\" id=\"bs-sigma\" min=\"1\" max=\"8\" step=\"0.5\" value=\"4\" />\n      <span class=\"dpw-val\" id=\"bs-sigma-val\">4.0</span>\n    </label>\n    <label class=\"dpw-label\">Batch size (records per round)\n      <input type=\"range\" id=\"bs-batch\" min=\"0\" max=\"6\" step=\"1\" value=\"2\" />\n      <span class=\"dpw-val\" id=\"bs-batch-val\">32</span>\n    </label>\n    <label class=\"dpw-label\">Budget share to the count &rho;\n      <input type=\"range\" id=\"bs-rho\" min=\"0.01\" max=\"0.5\" step=\"0.01\" value=\"0.05\" />\n      <span class=\"dpw-val\" id=\"bs-rho-val\">0.05</span>\n    </label>\n  </div>\n  <div class=\"dpw-two\">\n    <div class=\"dpw-panel\">\n      <div class=\"dpw-panel-h\">records &divide; 20 default</div>\n      <div class=\"dpw-line\">count noise <b id=\"bs-def-count\">1.60</b></div>\n      <div class=\"dpw-line\">needs budget share <b id=\"bs-def-rho\">?</b></div>\n      <div class=\"dpw-verdict\" id=\"bs-def-verdict\">infeasible</div>\n    </div>\n    <div class=\"dpw-panel\">\n      <div class=\"dpw-panel-h\">budget-share fix</div>\n      <div class=\"dpw-line\">count noise <b id=\"bs-fix-count\">8.94</b></div>\n      <div class=\"dpw-line\">gradient noise <b id=\"bs-fix-grad\">4.10</b> <span class=\"dpw-inflate\" id=\"bs-fix-infl\">+2.6%</span></div>\n      <div class=\"dpw-verdict dpw-ok\" id=\"bs-fix-verdict\">feasible, recomposes to &sigma;</div>\n    </div>\n  </div>\n</div>\n<p>The right column always has a solution, because the budget share is bounded below one by construction. The left column blows up the moment the batch is small, which is precisely when you are doing on-device or memory-tight training. The fix costs almost nothing: a five percent slice for the count inflates the gradient noise by under three percent, and the composition still recomposes to the sigma you asked for.</p>\n<h2 id=\"the-checklist-i-use-now\" style=\"position:relative;\"><a href=\"#the-checklist-i-use-now\" aria-label=\"the checklist i use now permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The checklist I use now</h2>\n<p>Before I call anything differentially private, I ask four questions. Does every read of the private data have a line in the budget? Is the noise calibrated to the largest amount one record can move the output? Does the composition account for the whole adaptive procedure rather than a sum of parts? And does my split of the budget actually recompose to the total I claim?</p>\n<p>That last one is the cheapest insurance in the whole field. Derive the pieces, add them back up, and check that they equal the number you are about to publish. If they do not, you have found a leak before your reviewers did.</p>\n<p>Adaptive intelligence is worth the trouble. A mechanism that tunes its own clipping beats one you hand-tuned, and it does it while spending a fixed budget more wisely than a static schedule ever could. The catch is that self-tuning and privacy pull against each other, and the only way to have both is to pay for every look. Budget it, calibrate it, compose it, and check that it adds up. Then the number you print is the number you can defend.</p>\n<style>\n.dpw {\n  --ink: #1b2228; --ink2: #5b7085; --line: #dae4ed;\n  --maroon: #a72e2b; --maroon-d: #6a1d1b; --rose: #f2cdcc; --green: #3f8f5b;\n  border: 1px solid var(--line); border-radius: 6px; padding: 20px;\n  margin: 32px 0; background: #fff; font-family: 'Open Sans', sans-serif;\n}\n.dpw * { box-sizing: border-box; }\n.dpw-formula { text-align: center; font-family: 'Inconsolata', monospace; font-size: 20px;\n  color: #1b2228; margin: 22px 0; letter-spacing: .01em; }\n.dpw-formula sub { font-size: 12px; } .dpw-formula sup { font-size: 12px; }\n.dpw-card { border: 1px solid var(--line); border-radius: 5px; margin-bottom: 8px; overflow: hidden; }\n.dpw-card-head { padding: 12px 14px; cursor: pointer; font-family: 'Josefin Sans', sans-serif;\n  font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 10px; transition: background .15s; }\n.dpw-card-head:hover { background: #f4f7fa; }\n.dpw-card[data-open=true] .dpw-card-head { background: var(--maroon); color: #fff; }\n.dpw-card-n { display: inline-flex; align-items: center; justify-content: center;\n  width: 22px; height: 22px; border-radius: 50%; background: var(--rose); color: var(--maroon-d);\n  font-family: 'Inconsolata', monospace; font-size: 13px; font-weight: 700; flex: none; }\n.dpw-card[data-open=true] .dpw-card-n { background: #fff; color: var(--maroon); }\n.dpw-card-body { display: none; padding: 4px 16px 12px; font-size: 14px; color: var(--ink2); }\n.dpw-card[data-open=true] .dpw-card-body { display: block; }\n.dpw-card-body p { line-height: 22px; margin: 8px 0; }\n.dpw-card-body code { font-family: 'Inconsolata', monospace; background: #f4f7fa;\n  padding: 1px 5px; border-radius: 3px; color: var(--maroon-d); font-size: 13px; }\n.dpw-leak b { color: var(--maroon); } .dpw-fix b { color: var(--green); }\n.dpw-controls { margin-bottom: 14px; }\n.dpw-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 20px; }\n.dpw-label { display: block; font-size: 13px; color: var(--ink2); }\n.dpw-label input[type=range] { display: block; width: 100%; margin: 8px 0 0; accent-color: var(--maroon); }\n.dpw-val { color: var(--maroon-d); font-family: 'Inconsolata', monospace; font-weight: 700; }\n.dpw-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }\n.dpw-panel { border: 1px solid var(--line); border-radius: 5px; padding: 14px; }\n.dpw-panel-h { font-family: 'Josefin Sans', sans-serif; font-size: 13px; text-transform: uppercase;\n  letter-spacing: .04em; color: var(--ink2); margin-bottom: 10px; }\n.dpw-line { font-size: 14px; color: var(--ink2); margin: 6px 0; }\n.dpw-line b { font-family: 'Inconsolata', monospace; font-size: 17px; color: var(--ink); }\n.dpw-inflate { font-size: 12px; color: var(--ink2); }\n.dpw-verdict { margin-top: 10px; padding: 6px 10px; border-radius: 4px; font-size: 13px; font-weight: 700;\n  background: var(--rose); color: var(--maroon-d); text-align: center; }\n.dpw-verdict.dpw-ok { background: #dcefe3; color: var(--green); }\n@media (max-width: 480px) { .dpw-grid, .dpw-two { grid-template-columns: 1fr; } }\n@media (prefers-reduced-motion: reduce) { .dpw * { transition: none !important; } }\n</style>\n<script>\n(function () {\n  var root = document.getElementById('defects');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var cards = root.querySelectorAll('.dpw-card');\n  cards.forEach(function (card) {\n    var head = card.querySelector('.dpw-card-head');\n    on(head, 'click', function () {\n      var isOpen = card.getAttribute('data-open') === 'true';\n      cards.forEach(function (c) { c.setAttribute('data-open', 'false'); });\n      card.setAttribute('data-open', isOpen ? 'false' : 'true');\n    });\n  });\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('budget');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var BATCHES = [8, 16, 32, 64, 128, 256, 512];\n  var elSigma = root.querySelector('#bs-sigma'), elBatch = root.querySelector('#bs-batch'), elRho = root.querySelector('#bs-rho');\n  var vSigma = root.querySelector('#bs-sigma-val'), vBatch = root.querySelector('#bs-batch-val'), vRho = root.querySelector('#bs-rho-val');\n  var defCount = root.querySelector('#bs-def-count'), defRho = root.querySelector('#bs-def-rho'), defVerdict = root.querySelector('#bs-def-verdict');\n  var fixCount = root.querySelector('#bs-fix-count'), fixGrad = root.querySelector('#bs-fix-grad'), fixInfl = root.querySelector('#bs-fix-infl'), fixVerdict = root.querySelector('#bs-fix-verdict');\n\n  function render() {\n    var sigma = parseFloat(elSigma.value);\n    var B = BATCHES[parseInt(elBatch.value, 10)];\n    var rho = parseFloat(elRho.value);\n    vSigma.textContent = sigma.toFixed(1);\n    vBatch.textContent = B;\n    vRho.textContent = rho.toFixed(2);\n\n    // records / 20 default: count noise = B/20. Implied budget share\n    // rho = (2*count)^-2 / sigma^-2 = sigma^2 / (4 * count^2).\n    var defC = B / 20;\n    var impliedRho = (sigma * sigma) / (4 * defC * defC);\n    defCount.textContent = defC.toFixed(2);\n    if (impliedRho >= 1) {\n      defRho.textContent = '> 1';\n      defVerdict.textContent = 'infeasible: blows the whole budget';\n      defVerdict.className = 'dpw-verdict';\n    } else {\n      defRho.textContent = impliedRho.toFixed(2);\n      defVerdict.textContent = 'feasible at this batch';\n      defVerdict.className = 'dpw-verdict dpw-ok';\n    }\n\n    // budget-share fix: count noise = sigma / (2*sqrt(rho)),\n    // gradient noise = sigma / sqrt(1 - rho).\n    var fixC = sigma / (2 * Math.sqrt(rho));\n    var fixG = sigma / Math.sqrt(1 - rho);\n    var infl = (fixG / sigma - 1) * 100;\n    fixCount.textContent = fixC.toFixed(2);\n    fixGrad.textContent = fixG.toFixed(2);\n    fixInfl.textContent = '+' + infl.toFixed(1) + '%';\n    // round-trip: recompose sigma_total from the two pieces.\n    var recomposed = Math.pow(Math.pow(fixG, -2) + Math.pow(2 * fixC, -2), -0.5);\n    fixVerdict.textContent = 'recomposes to σ = ' + recomposed.toFixed(2);\n    fixVerdict.className = 'dpw-verdict dpw-ok';\n  }\n  on(elSigma, 'input', render);\n  on(elBatch, 'input', render);\n  on(elRho, 'input', render);\n  render();\n})();\n</script>","headings":[{"value":"The one rule you keep breaking","depth":2},{"value":"Two mechanisms, one accountant","depth":2},{"value":"The checklist I use now","depth":2}],"frontmatter":{"date_created":"2026-07-22","path":"/blog/building-a-dp-mechanism","tags":["Differential Privacy","Adaptive Intelligence","Efficiency and Adaptive Compute"],"title":"What It Takes To Build A Differentially Private Mechanism"}},"currPost":{"html":"<p>Last week we looked at one-way functions, and we clearly said that they follow two properties: easy to compute and hard to invert.</p>\n<p>If it's easy to compute, then we have a PPT algorithm C such that for all x, which is the input, which comes from a set of n-bit strings, the probability that this algorithm C, when given this input, produces a valid output for our function should be one.</p>\n<div class=\"dpw-formula\">Pr[ C(x) = f(x) ] = 1 &nbsp;&nbsp; for all x &isin; {0,1}<sup>n</sup></div>\n<p>The second thing, which is the more interesting one: a one-way function has to be hard to invert. We have an input coming from a set of n-bit strings, and when we pass this input into our function, we get y as our output. If we have an adversary who, given only the security parameter and the output, is able to produce a valid input x′ such that when we plug in this x′ we get back the original output, then for it to be hard to invert, this probability has to be negligible.</p>\n<div class=\"dpw-formula\">Pr[ f(x&prime;) = y &nbsp;:&nbsp; x &larr; {0,1}<sup>n</sup>, y = f(x), x&prime; &larr; A(1<sup>n</sup>, y) ] &le; negl(n)</div>\n<h2 id=\"the-adversary-is-bounded\" style=\"position:relative;\"><a href=\"#the-adversary-is-bounded\" aria-label=\"the adversary is bounded permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The adversary is bounded</h2>\n<p>PPT is a probabilistic polynomial time algorithm, and all we need to remember for now is that this is pretty much a polynomial function with a randomness tape. It has an infinite source of randomness.</p>\n<p>In cryptography, most of the definitions do assume that the adversary is bounded. We don't assume that they have infinite compute power or infinite time, because those are impractical. If the adversary were unbounded, only perfect security could protect against it, and perfect security has its own downsides. Something like the one-time pad is a perfectly secure algorithm, where even if an adversary has infinite time, infinite power, a supercomputer, they still can't break the algorithm. But there are many downsides to the one-time pad. So we don't assume that the adversary is unbounded. That's why we always define the adversary as an algorithm that's polynomially bounded with respect to the input.</p>\n<p>Informally, negligible is saying that the probability that any adversary can invert a function should be as good as random guessing. For example, if we have 10 numbers, 1, 2, 3, up to 10, and I picked 3, and I told you to guess what number I picked, the probability that you'll get it right is 1/10. Obviously, everyone can just randomly guess, and if they do break the algorithm in that case, it's not considered a bad thing, because it was still secure within this bound of negligible.</p>\n<p>The adversary also gets 1<sup>n</sup>, which is just n ones in a row. So the adversary does know the size of the input. That's public information.</p>\n<h2 id=\"multiplication-is-only-a-weak-one-way-function\" style=\"position:relative;\"><a href=\"#multiplication-is-only-a-weak-one-way-function\" aria-label=\"multiplication is only a weak one way function permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Multiplication is only a weak one-way function</h2>\n<p>A strong one-way function is one where the adversary only succeeds with negligible probability. A weak one-way function is one where the adversary may invert f on a significant fraction of inputs, but there is a noticeable set of inputs where the adversary cannot invert.</p>\n<p>We looked at this weak one-way function for just multiplication: integer factorization, where the input domain was any n-bit integer. If we have a function f which takes x and y, it just multiplies x and y, and let's call this N. Given N, can we find any x′ and y′ such that f(x′, y′) gives N again? It doesn't have to be the exact x. We have to find any valid input that satisfies this condition.</p>\n<p>If N is even, one factor is 2 and the other factor is N/2, and that satisfies our integer factorization. We found two valid factors that, once multiplied, give N.</p>\n<p>Here is that trick as an actual adversary. It divides N by 2, or by every prime up to a bound, and wins if anything divides. How much of the input space does it invert, and what happens when the inputs are only allowed to be primes?</p>\n<div class=\"dpw\" id=\"cc3-weak\">\n  <div class=\"dpw-toggle-row\">\n    <span class=\"dpw-toggle-cap\">Input domain</span>\n    <button class=\"dpw-toggle\" data-dom=\"any\" data-on=\"true\">any n-bit integers</button>\n    <button class=\"dpw-toggle\" data-dom=\"prime\" data-on=\"false\">n-bit primes only</button>\n  </div>\n  <div class=\"dpw-toggle-row\">\n    <span class=\"dpw-toggle-cap\">The adversary tries dividing by</span>\n    <button class=\"dpw-toggle\" data-b=\"2\" data-on=\"true\">just 2</button>\n    <button class=\"dpw-toggle\" data-b=\"100\" data-on=\"false\">primes &lt; 100</button>\n    <button class=\"dpw-toggle\" data-b=\"10000\" data-on=\"false\">primes &lt; 10,000</button>\n  </div>\n  <div class=\"dpw-controls\">\n    <label class=\"dpw-label\">Bits per factor, n &nbsp; <span class=\"dpw-val\" id=\"cc3-n\">20</span>\n      <input type=\"range\" id=\"cc3-nr\" min=\"4\" max=\"26\" step=\"1\" value=\"20\" />\n    </label>\n  </div>\n  <div class=\"dpw-readout\">\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-win\">&ndash;</span><span class=\"dpw-cap\">of inputs inverted</span></div>\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-lose\">&ndash;</span><span class=\"dpw-cap\">it cannot invert</span></div>\n  </div>\n  <div class=\"cc3-grid\" id=\"cc3-grid\" aria-label=\"One square per random input; filled squares were inverted\"></div>\n  <div class=\"dpw-verdict\" id=\"cc3-verdict\">&ndash;</div>\n  <div class=\"dpw-line\"><span id=\"cc3-ex\">&ndash;</span></div>\n  <div class=\"dpw-hint\">Each square is one random input (x, y), multiplied to N = x &middot; y. A filled square means the adversary found a valid x&prime;, y&prime; with x&prime; &middot; y&prime; = N. 400 fresh samples are drawn every time you change something.</div>\n</div>\n<p>On any integers, dividing by 2 alone wins about three times in four, whatever n is: N is odd only when x and y are both odd. On primes, the same adversary only wins while the primes are small enough to be on its list.</p>\n<h2 id=\"the-factoring-assumption\" style=\"position:relative;\"><a href=\"#the-factoring-assumption\" aria-label=\"the factoring assumption permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The factoring assumption</h2>\n<p>If our input domain is not any n-bit integer, but all n-bit prime numbers, then there is a widely believed assumption called the factoring assumption that kicks in. A lot of security is based on this assumption. If anyone is able to disprove this, then many things will break on the internet. There are several one-way functions and several assumptions that go with those one-way functions, and people just have not been able to disprove those assumptions yet, so we believe them to be true right now, but they may be broken in the future.</p>\n<p>I'm going to call the set which contains all n-bit prime numbers capital Π<sub>n</sub>. The factoring assumption states: we have two numbers, p, which comes from our set of all n-bit primes, and q, which also comes from the set of all n-bit primes. We multiply them to produce N, so p · q = N. If we give that N to an adversary, the probability that they can find factors that multiply to give N is, again, negligible. The larger they are, the harder it is.</p>\n<div class=\"dpw-formula\">Pr[ p&prime; &middot; q&prime; = N &nbsp;:&nbsp; p, q &larr; &Pi;<sub>n</sub>, N = p &middot; q, (p&prime;, q&prime;) &larr; A(N) ] &le; negl(n)</div>\n<p>So what we said so far is: if p and q are any integers, easy-ish to invert. If p and q are primes, very hard to invert.</p>\n<h2 id=\"the-proof\" style=\"position:relative;\"><a href=\"#the-proof\" aria-label=\"the proof permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The proof</h2>\n<p>Let's try to prove why this is true. I'm showing you a proof because most proofs in cryptography rely on this way of proving things, which is proving by contradiction. Initially, I found this also pretty confusing, but I think I'm starting to get the hang of it.</p>\n<ol>\n<li>Assume f is not a one-way function. If it's not a one-way function, that means the adversary can find p and q such that when they are multiplied, they give the original N, where N = f(p, q). It implies that this adversary is able to find a valid preimage with high probability. Remember, when we talk about an adversary, we're talking about an algorithm. The adversary is a probabilistic polynomial time algorithm.</li>\n<li>Construct B to violate the factoring assumption. This algorithm B uses A to break the factoring assumption. It takes in the output, which is the product of two primes, and invokes A on input N. The adversary A outputs p′ and q′. First of all, we don't even know if they're prime, so B checks if p′ and q′ are prime. This can be done pretty fast, in polynomial time. If you use something like Python, you can just call a function, but inside, they are using very fast algorithms to do a primality test. Then we also check if, when we multiply p′ and q′, we get N, which was given to B in the first place. If both of these are true, then output our factors p′, q′. If one is no or two is no, then just output something like fail.</li>\n<li>B runs in polynomial time. Primality testing is a polynomial time algorithm, and A is always a polynomially time-bounded algorithm. Both of these run in polynomial time; therefore, this whole algorithm runs in polynomial time. And the success probability of this algorithm B is at least the success probability of A, which we know is high. B is like a hollow function. It's just using A, with one more function.</li>\n<li>B is a polynomial algorithm which can find the factors of a number that is the product of two primes, with high probability, in polynomial time. That violates the factoring assumption, which shows that our initial assumption, that f is not a one-way function, is false. And since it's false, f must be a one-way function.</li>\n</ol>\n<p>You can see how this whole proof relied on the factoring assumption being true. We call these proofs by contradiction. We basically try to assume the opposite thing. Then we show what happens when the opposite thing is true. And then we look at our strongly believed assumptions, like in this case the factoring assumption, and we say: hey, wait a minute. If this was true, it violates the factoring assumption. So it must be false.</p>\n<h2 id=\"opening-the-input-space-back-up\" style=\"position:relative;\"><a href=\"#opening-the-input-space-back-up\" aria-label=\"opening the input space back up permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Opening the input space back up</h2>\n<p>What we've created is a strong one-way function, but it only works over this special input domain, which is primes. Very informally, what you could do is open up the input domain to all integers again, similar to our weak one-way function, and have an algorithm that runs a primality test on the inputs, which runs in polynomial time. If the inputs p, q are prime, then run the function f(p, q) = p · q. Otherwise, just output fail.</p>\n<p>We just added an extra layer. We allow the user to send in any numbers, but we're only going to actually do the multiplication if they are primes. The rest still remains true, because we know that if they are primes, then we have a proof that says that it is a one-way function.</p>\n<h2 id=\"weak-one-way-functions-are-not-useless\" style=\"position:relative;\"><a href=\"#weak-one-way-functions-are-not-useless\" aria-label=\"weak one way functions are not useless permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Weak one-way functions are not useless</h2>\n<p>There's a proof that says any weak one-way function can be converted into a strong one-way function. The person who showed this is Yao.</p>\n<p>Suppose you have your input x. Now you break the input into smaller chunks. This x becomes x<sub>1</sub>, x<sub>2</sub>, x<sub>3</sub>, and so on. The more chunks you can break it into, the better the security is. Assume that the adversary can invert, let's just say, 70% of the time. I'm making this up. Run the weak one-way function on the first chunk, second chunk, third chunk, and so on, until we have run the weak one-way function on all of x.</p>\n<p>Since we've broken it up into many chunks, they basically have to invert this successfully and this and this. It's not or, it's and. Even if they fail on a single piece of the input, security holds. Their success probability is the probability of inverting one chunk, raised to the power k, where k is how many chunks you split it into. In this case, it's 0.7<sup>k</sup>, and as we split it into more chunks, it drops and drops and drops until it also becomes negligible.</p>\n<div class=\"dpw-formula\">f&prime;(x<sub>1</sub>, x<sub>2</sub>, &hellip;, x<sub>k</sub>) = f(x<sub>1</sub>) &#124;&#124; f(x<sub>2</sub>) &#124;&#124; &hellip; &#124;&#124; f(x<sub>k</sub>) &nbsp;&nbsp;&rArr;&nbsp;&nbsp; Pr[invert f&prime;] = 0.7<sup>k</sup></div>\n<p>Someone asked how we can assume the function itself can be split up like that. x is from the input space. It's basically bits. You can keep it large so it can be split into chunks. The input is just a large n-bit binary string.</p>\n<p>So how many chunks does it take? Below, the adversary's chance on the whole input is put in the same terms as guessing a number I picked.</p>\n<div class=\"dpw\" id=\"cc3-yao\">\n  <div class=\"dpw-controls\">\n    <label class=\"dpw-label\">Adversary's success on one chunk &nbsp; <span class=\"dpw-val\" id=\"cc3-p\">70%</span>\n      <input type=\"range\" id=\"cc3-pr\" min=\"5\" max=\"99\" step=\"1\" value=\"70\" />\n    </label>\n    <label class=\"dpw-label\" style=\"margin-top:12px\">Number of chunks, k &nbsp; <span class=\"dpw-val\" id=\"cc3-k\">20</span>\n      <input type=\"range\" id=\"cc3-kr\" min=\"1\" max=\"400\" step=\"1\" value=\"20\" />\n    </label>\n  </div>\n  <svg id=\"cc3-svg\" viewBox=\"0 0 480 170\" class=\"dpw-svg\" role=\"img\" aria-label=\"Success probability on a log scale against the number of chunks\"></svg>\n  <div class=\"dpw-readout\">\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-pk\">&ndash;</span><span class=\"dpw-cap\">success on all <span class=\"dpw-var\">k</span> chunks</span></div>\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-guess\">&ndash;</span><span class=\"dpw-cap\">as good as guessing 1 in</span></div>\n    <div class=\"dpw-stat\"><span class=\"dpw-num\" id=\"cc3-need\">&ndash;</span><span class=\"dpw-cap\">chunks to reach 2<sup>&minus;128</sup></span></div>\n  </div>\n  <div class=\"dpw-verdict\" id=\"cc3-yv\">&ndash;</div>\n  <div class=\"dpw-hint\">The dashed lines mark 2<sup>&minus;80</sup> and 2<sup>&minus;128</sup>, two common thresholds for \"negligible\" in practice. The curve is a straight line on a log scale because each chunk multiplies the adversary's chance by the same factor.</div>\n</div>\n<p>At 70% per chunk, 249 chunks are enough to make the adversary's chance smaller than 2<sup>−128</sup>. Even an adversary that wins 99% of the time on one chunk is pushed under that line, it just takes about nine thousand chunks.</p>\n<h2 id=\"where-this-goes-next\" style=\"position:relative;\"><a href=\"#where-this-goes-next\" aria-label=\"where this goes next permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Where this goes next</h2>\n<p>To my knowledge, Bitcoin security does not rely on the factoring assumption. But there is this other one-way function that Bitcoin does use actively, and that's what this has all been leading up to: the discrete log problem. First you choose a prime p; the larger it is, the safer. Then you also choose a generator g in a special group, which is the multiplicative group. It's easy to calculate g<sup>x</sup> mod p, but given the generator, the prime, and y, which are all public information, finding an x such that g<sup>x</sup> = y mod p is hard.</p>\n<div class=\"dpw-formula\">easy: &nbsp; y = g<sup>x</sup> mod p &nbsp;&nbsp;&nbsp;&nbsp; hard: &nbsp; given (g, p, y), find x</div>\n<style>\n.dpw {\n  --ink: #1b2228; --ink2: #5b7085; --line: #dae4ed;\n  --maroon: #a72e2b; --maroon-d: #6a1d1b; --rose: #f2cdcc; --green: #3f8f5b; --slate: #8ba2b8;\n  border: 1px solid var(--line); border-radius: 6px; padding: 20px;\n  margin: 32px 0; background: #fff; font-family: 'Open Sans', sans-serif;\n}\n.dpw * { box-sizing: border-box; }\n/* index.scss sets font on every span directly; let class-less spans inherit from the widget instead */\n.dpw span:not([class]) { font-size: inherit; line-height: inherit; font-family: inherit; }\n.dpw-formula { text-align: center; font-family: 'Inconsolata', monospace; font-size: 17px;\n  color: #1b2228; margin: 22px 0; letter-spacing: .01em; line-height: 1.6; overflow-x: auto; }\n.dpw-formula sup, .dpw-formula sub { font-size: 11px; }\n.dpw-controls { margin-bottom: 14px; }\n.dpw-label { display: block; font-size: 13px; color: var(--ink2); }\n.dpw-label input[type=range] { display: block; width: 100%; margin: 8px 0 0; accent-color: var(--maroon); }\n.dpw-val { color: var(--maroon-d); font-family: 'Inconsolata', monospace; font-weight: 700; }\n.dpw-hint { font-size: 12px; color: var(--ink2); margin-top: 10px; font-style: italic; line-height: 1.55; }\n.dpw-svg { width: 100%; height: auto; display: block; margin: 6px 0 4px;\n  background: linear-gradient(180deg, #fbfcfe, #f4f7fa); border-radius: 4px; }\n.dpw-verdict { margin: 10px 0 4px; padding: 8px 12px; border-radius: 4px; font-size: 13px; font-weight: 700;\n  background: var(--rose); color: var(--maroon-d); text-align: center; font-family: 'Inconsolata', monospace; }\n.dpw-verdict.dpw-ok { background: #dcefe3; color: var(--green); }\n.dpw-readout { display: flex; gap: 24px; margin-top: 12px; flex-wrap: wrap; }\n.dpw-stat { display: flex; flex-direction: column; }\n.dpw-num { font-family: 'Josefin Sans', sans-serif; font-size: 23px; color: var(--maroon-d); line-height: 1.15; }\n.dpw-cap { font-size: 11px; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }\n/* variable names keep their case inside the upper-cased captions (k is a number, G is a point) */\n.dpw-cap .dpw-var { text-transform: none; font-size: inherit; line-height: inherit; font-family: inherit; }\n.dpw-cap sub, .dpw-cap sup { text-transform: none; }\n.dpw-toggle-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }\n.dpw-toggle-cap { width: 100%; margin-bottom: 3px; font-size: 12px; color: var(--ink2); }\n.dpw-toggle { font-family: 'Inconsolata', monospace; font-size: 12px; border: 1px solid var(--line);\n  background: #fff; color: var(--ink2); padding: 5px 9px; border-radius: 4px; cursor: pointer; transition: all .15s; }\n.dpw-toggle[data-on=true] { background: var(--maroon); color: #fff; border-color: var(--maroon); }\n.dpw-line { font-size: 13px; color: var(--ink2); margin: 9px 0; display: flex; justify-content: space-between;\n  align-items: baseline; gap: 10px; flex-wrap: wrap; font-family: 'Inconsolata', monospace; word-break: break-all; }\n.cc3-grid { display: grid; grid-template-columns: repeat(40, 1fr); gap: 2px; margin: 14px 0 6px; }\n.cc3-grid i { display: block; aspect-ratio: 1; border-radius: 1px; background: #eef3f7; }\n.cc3-grid i.cc3-w { background: var(--maroon); }\n@media (max-width: 520px) { .cc3-grid { grid-template-columns: repeat(20, 1fr); } .dpw-readout { gap: 16px; } }\n@media (prefers-reduced-motion: reduce) { .dpw * { transition: none !important; } }\n</style>\n<script>\n(function () {\n  var root = document.getElementById('cc3-weak');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var SMALL = [];\n  (function () { var s = new Uint8Array(10001); for (var i = 2; i <= 10000; i++) if (!s[i]) { SMALL.push(i); for (var j = i * i; j <= 10000; j += i) s[j] = 1; } })();\n  function isPrime(n) {\n    if (n < 2) return false;\n    for (var i = 0; i < SMALL.length && SMALL[i] * SMALL[i] <= n; i++) if (n % SMALL[i] === 0) return n === SMALL[i];\n    return true;\n  }\n  function randBits(n) { var lo = Math.pow(2, n - 1), hi = Math.pow(2, n); return lo + Math.floor(Math.random() * (hi - lo)); }\n  function randPrime(n) { for (;;) { var c = randBits(n); if (n > 2) c |= 1; if (isPrime(c)) return c; } }\n  function fmt(x) { return x.toLocaleString('en-US'); }\n\n  var dom = 'any', bound = 2, n = 20;\n  var grid = root.querySelector('#cc3-grid');\n\n  function run() {\n    var wins = 0, cells = [], example = null;\n    for (var t = 0; t < 400; t++) {\n      var x = dom === 'any' ? randBits(n) : randPrime(n);\n      var y = dom === 'any' ? randBits(n) : randPrime(n);\n      var N = x * y, found = 0;\n      for (var i = 0; i < SMALL.length && SMALL[i] <= bound && SMALL[i] < N; i++) {\n        if (N % SMALL[i] === 0) { found = SMALL[i]; break; }\n      }\n      if (found) { wins++; if (!example) example = [N, found]; }\n      cells.push(found ? 1 : 0);\n    }\n    var html = '';\n    for (var c = 0; c < cells.length; c++) html += cells[c] ? '<i class=\"cc3-w\"></i>' : '<i></i>';\n    grid.innerHTML = html;\n    var pct = Math.round(wins / 4);\n    root.querySelector('#cc3-win').textContent = pct + '%';\n    root.querySelector('#cc3-lose').textContent = (100 - pct) + '%';\n    var v = root.querySelector('#cc3-verdict');\n    if (pct >= 10) { v.className = 'dpw-verdict'; v.textContent = 'weak: the adversary inverts a significant fraction of inputs'; }\n    else if (wins > 0) { v.className = 'dpw-verdict'; v.textContent = 'a few small inputs still fall to the list of primes'; }\n    else { v.className = 'dpw-verdict dpw-ok'; v.textContent = 'inverted 0 of 400: on this domain the trick does nothing'; }\n    root.querySelector('#cc3-ex').textContent = example\n      ? 'e.g. N = ' + fmt(example[0]) + ' = ' + fmt(example[1]) + ' × ' + fmt(example[0] / example[1])\n      : 'no N in this sample had a factor on the list';\n  }\n\n  [].forEach.call(root.querySelectorAll('[data-dom]'), function (b) {\n    on(b, 'click', function () {\n      dom = b.getAttribute('data-dom');\n      [].forEach.call(root.querySelectorAll('[data-dom]'), function (o) { o.setAttribute('data-on', String(o === b)); });\n      run();\n    });\n  });\n  [].forEach.call(root.querySelectorAll('[data-b]'), function (b) {\n    on(b, 'click', function () {\n      bound = +b.getAttribute('data-b');\n      [].forEach.call(root.querySelectorAll('[data-b]'), function (o) { o.setAttribute('data-on', String(o === b)); });\n      run();\n    });\n  });\n  var nr = root.querySelector('#cc3-nr');\n  on(nr, 'input', function () { n = +nr.value; root.querySelector('#cc3-n').textContent = n; run(); });\n  run();\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('cc3-yao');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var SVG = 'http://www.w3.org/2000/svg', svg = root.querySelector('#cc3-svg');\n  var pr = root.querySelector('#cc3-pr'), kr = root.querySelector('#cc3-kr');\n  var W = 480, H = 170, X0 = 40, FS = 11, X1 = 470, Y0 = 12, Y1 = 150, KMAX = 400, LMIN = -160; // log2 axis 0 .. -160\n\n  function el(n, at, txt) { var e = document.createElementNS(SVG, n); for (var a in at) e.setAttribute(a, at[a]); if (txt !== undefined) e.textContent = txt; return e; }\n  function sx(k) { return X0 + (k / KMAX) * (X1 - X0); }\n  function sy(l2) { return Y0 + (Math.max(l2, LMIN) / LMIN) * (Y1 - Y0); }\n  function sci(l2) { // 2^l2 written as a power of ten\n    var l10 = l2 * Math.LOG10E * Math.LN2;\n    if (l10 > -3) return (Math.pow(10, l10) * 100).toFixed(l10 > -1 ? 1 : 2) + '%';\n    var e = Math.floor(l10), m = Math.pow(10, l10 - e);\n    return m.toFixed(1) + '×10' + sup(e);\n  }\n  function sup(e) { var m = { '-': '⁻', 0: '⁰', 1: '¹', 2: '²', 3: '³', 4: '⁴', 5: '⁵', 6: '⁶', 7: '⁷', 8: '⁸', 9: '⁹' }; return String(e).split('').map(function (c) { return m[c]; }).join(''); }\n  function big(l2) { // 1 / 2^l2 as a readable count\n    var l10 = -l2 * Math.LOG10E * Math.LN2;\n    if (l10 < 6) return Math.round(Math.pow(10, l10)).toLocaleString('en-US');\n    var e = Math.floor(l10); return (Math.pow(10, l10 - e)).toFixed(1) + '×10' + sup(e);\n  }\n\n  function draw() {\n    var p = +pr.value / 100, k = +kr.value, lp = Math.log2(p);\n    root.querySelector('#cc3-p').textContent = pr.value + '%';\n    root.querySelector('#cc3-k').textContent = k;\n    while (svg.firstChild) svg.removeChild(svg.firstChild);\n    var unitsPerPx = W / (svg.getBoundingClientRect().width || W);   // viewBox units per CSS pixel\n    FS = Math.min(20, 11 * unitsPerPx); X0 = Math.max(40, 3.4 * FS);\n    [[-80, '2⁻⁸⁰'], [-128, '2⁻¹²⁸']].forEach(function (t) {\n      svg.appendChild(el('line', { x1: X0, x2: X1, y1: sy(t[0]), y2: sy(t[0]), stroke: '#8ba2b8', 'stroke-dasharray': '4 4', 'stroke-width': 1 }));\n      svg.appendChild(el('text', { x: X0 - 4, y: sy(t[0]) + FS * 0.35, 'text-anchor': 'end', 'font-size': FS, fill: '#5b7085', 'font-family': 'Inconsolata, monospace' }, t[1]));\n    });\n    svg.appendChild(el('text', { x: X0 - 4, y: Y0 + FS * 0.35, 'text-anchor': 'end', 'font-size': FS, fill: '#5b7085', 'font-family': 'Inconsolata, monospace' }, '1'));\n    svg.appendChild(el('line', { x1: X0, x2: X0, y1: Y0, y2: Y1, stroke: '#dae4ed' }));\n    svg.appendChild(el('line', { x1: X0, x2: X1, y1: Y1, y2: Y1, stroke: '#dae4ed' }));\n    svg.appendChild(el('text', { x: X1, y: H - 4, 'text-anchor': 'end', 'font-size': FS, fill: '#5b7085', 'font-family': 'Inconsolata, monospace' }, 'chunks k → ' + KMAX));\n    var d = '';\n    for (var i = 0; i <= KMAX; i += 2) d += (i ? 'L' : 'M') + sx(i).toFixed(1) + ' ' + sy(i * lp).toFixed(1);\n    svg.appendChild(el('path', { d: d, fill: 'none', stroke: '#a72e2b', 'stroke-width': 2 }));\n    svg.appendChild(el('circle', { cx: sx(k), cy: sy(k * lp), r: 5, fill: '#6a1d1b' }));\n\n    var l2 = k * lp;\n    root.querySelector('#cc3-pk').textContent = sci(l2);\n    root.querySelector('#cc3-guess').textContent = big(l2);\n    root.querySelector('#cc3-need').textContent = Math.ceil(-128 / lp).toLocaleString('en-US');\n    var v = root.querySelector('#cc3-yv');\n    if (l2 <= -128) { v.className = 'dpw-verdict dpw-ok'; v.textContent = 'below 2⁻¹²⁸: negligible by any practical standard'; }\n    else if (l2 <= -80) { v.className = 'dpw-verdict dpw-ok'; v.textContent = 'below 2⁻⁸⁰: negligible for most purposes'; }\n    else { v.className = 'dpw-verdict'; v.textContent = 'not yet negligible: add more chunks'; }\n  }\n  on(pr, 'input', draw); on(kr, 'input', draw); on(window, 'resize', draw);\n  draw();\n})();\n</script>","headings":[{"value":"The adversary is bounded","depth":2},{"value":"Multiplication is only a weak one-way function","depth":2},{"value":"The factoring assumption","depth":2},{"value":"The proof","depth":2},{"value":"Opening the input space back up","depth":2},{"value":"Weak one-way functions are not useless","depth":2},{"value":"Where this goes next","depth":2}],"frontmatter":{"date_created":"2026-08-21","path":"/blog/crypto-club-proof-by-contradiction","tags":["Cryptography","Bitcoin"],"title":"Proving A Function Is One-Way By Assuming It Is Not"}},"nextPost":{"html":"<p>In December I argued that GPT-5's safe completions are not zero-knowledge, and I argued it on paper. The protocol leaks structural information about the withheld witness across turns, an adversary composes those leaks, and the simulation argument fails. I still think that is right.</p>\n<p>What I did not do was cost it. A protocol analysis that never touches a prover is cheap to write and easy to like, and I have since spent two months building the thing it was hand-waving at. So this post does the arithmetic.</p>\n<p>The short version is that the bill is payable, and it is a bill for the wrong item. Proving an inference does not fix the leak I found in December, and working out why took me longer than working out the price.</p>\n<h2 id=\"the-smallest-interesting-verifiable-claim\" style=\"position:relative;\"><a href=\"#the-smallest-interesting-verifiable-claim\" aria-label=\"the smallest interesting verifiable claim permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The smallest interesting verifiable claim</h2>\n<p>Here is my anchor, and it is measured rather than cited.</p>\n<p>A RISC Zero guest re-executes the correctness check on a satellite computation. It re-hashes a design matrix against its commitment, re-hashes the audited index set, then evaluates a relative normal-equation residual at 256 pixels using 64-bit floats, all of it in software because RISC-V has no hardware double. Nothing exotic. Two SHA-256 calls and about eighty-five thousand floating point operations.</p>\n<p>That costs 8,388,608 cycles.</p>\n<p>The decomposition is worth keeping, because it is the part people never publish. 7,813,860 of those are the guest's own work. 214,654 go to paging memory across segment boundaries and 360,094 are reserved overhead, so roughly seven percent of the trace is the machine rather than the program. The whole thing splits into 8 segments at 2<sup>20</sup> cycles each, and 8 segments is exactly the parallelism budget you have if you want to spread this across GPUs.</p>\n<p>Divide it out and the guest spends about 92 cycles per double-precision operation, hashing and input deserialisation included. That is the number I would hand someone who asked what soft-float costs in a zkVM, with the caveat that it is an upper bound because the SHA-256 calls and the 30,916-byte input read are folded into it.</p>\n<h2 id=\"what-you-buy-at-each-rung\" style=\"position:relative;\"><a href=\"#what-you-buy-at-each-rung\" aria-label=\"what you buy at each rung permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What you buy at each rung</h2>\n<p>The same 8.39 million cycles can be sold to you three ways, and the difference between them is the whole engineering story.</p>\n<div class=\"dpw\" id=\"ladder\" data-initialised=\"false\">\n  <svg id=\"ld-svg\" viewBox=\"0 0 480 200\" class=\"dpw-svg\" role=\"img\" aria-label=\"Receipt size, prove time and verify time for composite, succinct and Groth16 receipts\"></svg>\n  <div class=\"dpw-detail\" id=\"ld-detail\">\n    <div class=\"dpw-detail-h\">Hover a bar</div>\n    <div class=\"dpw-detail-b\">Bars are receipt size on a log scale. All three carry the identical 432-byte journal and the identical claim.</div>\n  </div>\n</div>\n<p>A composite receipt is the raw STARK. It took 3,006 seconds on an eight-core machine and weighs 2,251,496 bytes, which is fine for a file and useless for a chain.</p>\n<p>Recursion folds the segments together. 1,463 seconds on sixteen cores, 224,090 bytes, a tenfold shrink. It verifies locally in 20.13 milliseconds.</p>\n<p>The Groth16 wrap runs the recursion, then proves the recursive verifier inside a pairing-based SNARK. 2,618.7 seconds, a peak resident set of 9.61 GB, and the receipt collapses to 1,361 bytes. The seal that actually travels in the transaction is 260 bytes. It verifies in 5.06 milliseconds locally, or on Base Sepolia for 249,749 gas, which at the gas price and ETH spot I read on 24 August is $0.0042.</p>\n<p>So the compression is 1,654 times, and it is bought with roughly 44 minutes of CPU and ten gigabytes of memory. Everything after this post's midpoint is an argument about whether that trade scales.</p>\n<h2 id=\"the-number-i-refuse-to-publish\" style=\"position:relative;\"><a href=\"#the-number-i-refuse-to-publish\" aria-label=\"the number i refuse to publish permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The number I refuse to publish</h2>\n<p>The obvious next move is to divide. 8,388,608 cycles in 2,618.7 seconds is 3,203 cycles per second, and from there you can extrapolate anything you like.</p>\n<p>Do not do this, and I say that as the person who did it first and got 3.85 × 10<sup>7</sup> for prover overhead against native execution. That figure is real arithmetic on real measurements and it describes my benchmark rather than my prover. The native side of it is 78 microseconds of vectorised numpy. When the numerator is a fixed cost that a 43-minute pipeline pays whether it proves eight million cycles or eighty million, a ratio taken at the bottom of the curve tells you about the fixed cost and nothing about the marginal one.</p>\n<p>Every \"N times overhead\" claim in this field has the same defect unless the workload size is printed next to it. Mine included.</p>\n<p>So here is the shape of the honest uncertainty rather than a headline. Set the two things I have not measured and watch the answer move.</p>\n<div class=\"dpw\" id=\"extrap\" data-initialised=\"false\">\n  <div class=\"dpw-controls dpw-grid\">\n    <label class=\"dpw-label\">Model size\n      <input type=\"range\" id=\"ex-p\" min=\"0\" max=\"5\" step=\"1\" value=\"2\" />\n      <span class=\"dpw-val\" id=\"ex-p-val\">7B</span>\n    </label>\n    <label class=\"dpw-label\">Tokens generated\n      <input type=\"range\" id=\"ex-t\" min=\"0\" max=\"4\" step=\"1\" value=\"1\" />\n      <span class=\"dpw-val\" id=\"ex-t-val\">64</span>\n    </label>\n    <label class=\"dpw-label\">Cycles per arithmetic op\n      <input type=\"range\" id=\"ex-c\" min=\"0\" max=\"4\" step=\"1\" value=\"2\" />\n      <span class=\"dpw-val\" id=\"ex-c-val\">92</span>\n    </label>\n    <label class=\"dpw-label\">Prover throughput, cycles per second\n      <input type=\"range\" id=\"ex-r\" min=\"3\" max=\"8\" step=\"1\" value=\"5\" />\n      <span class=\"dpw-val\" id=\"ex-r-val\">100 K</span>\n    </label>\n  </div>\n  <div class=\"dpw-two\">\n    <div class=\"dpw-panel\">\n      <div class=\"dpw-panel-h\">defensible</div>\n      <div class=\"dpw-line\">arithmetic ops <b id=\"ex-ops\">896 B</b></div>\n      <div class=\"dpw-line\">guest cycles <b id=\"ex-cyc\">82 T</b></div>\n      <div class=\"dpw-line\">segments at 2<sup>20</sup> <b id=\"ex-seg\">79 M</b></div>\n    </div>\n    <div class=\"dpw-panel dpw-panel-warn\">\n      <div class=\"dpw-panel-h\">not defensible without a measurement</div>\n      <div class=\"dpw-line\">prove time <b id=\"ex-time\">26 years</b></div>\n      <div class=\"dpw-line\">across the plausible throughput range <b id=\"ex-band\">10 days to 2.6 K years</b></div>\n    </div>\n  </div>\n  <div class=\"dpw-hint\">The left column moves only on things I can count. The right column moves five orders of magnitude on an assumption nobody has measured for this workload, which is the point.</div>\n</div>\n<p>The left panel is arithmetic I will defend. A forward pass over a model with P parameters costs about 2P operations per generated token, the cycle-per-op figure is anchored to a real trace, and segment counts follow. The right panel swings by five orders of magnitude on a parameter I have not measured, and neither has anyone else for this exact guest. Publishing a point estimate from that would be inventing a number.</p>\n<p>There is also a real reason my 92 cycles is too pessimistic for this use. My guest does 64-bit soft float because InSAR residuals need it. Quantised inference does 8-bit integer arithmetic, which is dramatically cheaper in a zkVM and is why serious zkML work quantises before it does anything else. Slide the cycles-per-op control down and you can see how much of the answer that one decision owns.</p>\n<h2 id=\"what-is-actually-provable-about-a-refusal\" style=\"position:relative;\"><a href=\"#what-is-actually-provable-about-a-refusal\" aria-label=\"what is actually provable about a refusal permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is actually provable about a refusal</h2>\n<p>Costing the wrong statement is worse than not costing it, so before spending anything it is worth sorting the claims by whether a proof can carry them at all.</p>\n<div class=\"dpw\" id=\"claims\" data-initialised=\"false\">\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"yes\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">1</span> \"This output came from the weights committed as H\"<span class=\"dpw-badge dpw-yes\">provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> Y = M<sub>W</sub>(P), where SHA-256(W) = H is published in advance.</p>\n      <p><b>Why it works:</b> it is a deterministic function evaluation over committed data, which is exactly what a zkVM proves. Same shape as my satellite guest, larger by a factor you can read off the widget above.</p>\n      <p class=\"dpw-cost\"><b>Cost:</b> the entire inference, in-circuit. This is the expensive one and it is the one that carries all the weight.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"yes\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">2</span> \"The refusal classifier scored this below threshold\"<span class=\"dpw-badge dpw-yes\">provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> C<sub>&theta;</sub>(Y) &lt; &tau;, for a classifier committed as &theta; and a published threshold.</p>\n      <p><b>Why it works:</b> a small committed model over a short string. Cheap, possibly thousands of times cheaper than claim 1.</p>\n      <p class=\"dpw-cost\"><b>The trap:</b> on its own this proves nothing about the system. I can run an honest classifier over an output that came from a different model, or from no model. Claim 2 is only worth anything when it is bound to claim 1, which means paying for claim 1.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"yes\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">3</span> \"The system prompt in force was the one published\"<span class=\"dpw-badge dpw-yes\">provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> the prompt prefix hashes to a published digest, and the same bytes fed the inference.</p>\n      <p><b>Why it works:</b> a hash inside the same circuit as claim 1, at almost no extra cost. This is the cheapest genuinely useful thing on the list, and nobody ships it.</p>\n      <p class=\"dpw-cost\"><b>Cost:</b> a few thousand cycles on top of an inference you are already proving.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"no\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">4</span> \"This output is safe\"<span class=\"dpw-badge dpw-no\">not provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> Y is harmless.</p>\n      <p><b>Why it fails:</b> there is no committed object to evaluate. Harmlessness is not a function of the bytes, it is a function of the reader, their intent, and what they already know. A proof system needs a decidable predicate over committed inputs and this is not one. No cycle budget changes that.</p>\n      <p class=\"dpw-cost\"><b>What you can have instead:</b> claim 2, stated honestly, which is a proof about a classifier and not about the world.</p>\n    </div>\n  </div>\n  <div class=\"dpw-card\" data-open=\"false\" data-k=\"no\">\n    <div class=\"dpw-card-head\"><span class=\"dpw-card-n\">5</span> \"Nothing about the withheld knowledge leaked\"<span class=\"dpw-badge dpw-no\">not provable</span></div>\n    <div class=\"dpw-card-body\">\n      <p><b>The statement:</b> the transcript reveals nothing about the witness w the model declined to give up.</p>\n      <p><b>Why it fails:</b> this is the December result, and a proof makes it worse rather than better. Detail in the section below.</p>\n      <p class=\"dpw-cost\"><b>Cost:</b> not applicable. There is no price for this one.</p>\n    </div>\n  </div>\n</div>\n<p>Claims 1 through 3 compose into something worth having. Call it the Verified Refusal protocol and grade it the way I graded Π<sub>SafeCompletion</sub> in December.</p>\n<p><strong>Setup</strong>: The challenger commits to weights <strong>W</strong> as <strong>H</strong> = SHA-256(<strong>W</strong>), a classifier <strong>θ</strong>, a threshold <strong>τ</strong>, and a system prefix <strong>S</strong> with digest <strong>h</strong><sub>S</sub>.</p>\n<p><strong>Protocol</strong>: On prompt <strong>P</strong>, the prover publishes <strong>Y</strong> together with a proof <strong>π</strong> that <strong>Y</strong> = M<sub><strong>W</strong></sub>(<strong>S</strong> ‖ <strong>P</strong>) for the committed <strong>W</strong> and <strong>S</strong>, and that C<sub><strong>θ</strong></sub>(<strong>Y</strong>) &#x3C; <strong>τ</strong>.</p>\n<p><strong>Completeness</strong>: An honest operator running the committed weights under the committed prefix always produces an accepting proof. <strong>Perfect.</strong></p>\n<p><strong>Soundness</strong>: Substituting a different model, a different system prompt, or a different classifier breaks a commitment, and forging past it means finding a SHA-256 collision. The advantage of any probabilistic polynomial-time adversary is negligible in the security parameter. <strong>Perfect.</strong></p>\n<p><strong>Zero-knowledge</strong>: Against the weights, fine. The proof reveals nothing about <strong>W</strong> beyond what <strong>Y</strong> already reveals. Against the withheld witness <strong>w</strong>, it changes nothing whatsoever, and that is the finding.</p>\n<h2 id=\"proofs-give-integrity-and-the-leak-was-never-an-integrity-problem\" style=\"position:relative;\"><a href=\"#proofs-give-integrity-and-the-leak-was-never-an-integrity-problem\" aria-label=\"proofs give integrity and the leak was never an integrity problem permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Proofs give integrity, and the leak was never an integrity problem</h2>\n<p>The December analysis said Π<sub>SafeCompletion</sub> fails zero-knowledge under adaptive composition. The prover produces a sanitised abstraction ŷ that is computationally dependent on the structure of <strong>w</strong>, the adversary composes ŷ across turns, and reconstructs.</p>\n<p>Now add a proof and read it again. The proof establishes that ŷ was computed correctly by the committed model under the committed policy. Every leak the December post identified is in ŷ, which is published either way, so the proof does not remove a single bit of it. If anything it certifies the leak's provenance, which is a strange thing to hand an adversary. The transcript that reconstructs the witness is now a transcript with a receipt.</p>\n<p>Stated generally: a zero-knowledge proof of an inference protects the weights and the prover's private inputs. It does not protect anything that appears in the output, and in a safe-completions design the output is the deliverable. You cannot prove your way out of a leak that lives in the product.</p>\n<p>That is the opinion I would defend in a room. Verifiable inference is worth building and I am building toward it. It answers \"did the operator run the model they said they ran, under the policy they published\", which is a real question with real money attached, and today nobody can answer it. It does not answer \"is this model safe\", and the two get conflated in almost every pitch deck I have read this year, mine included until about three weeks ago.</p>\n<h2 id=\"what-i-would-actually-measure-next\" style=\"position:relative;\"><a href=\"#what-i-would-actually-measure-next\" aria-label=\"what i would actually measure next permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What I would actually measure next</h2>\n<p>I want to be plain about the boundary between what is measured here and what is not, since the widget above exists precisely to stop me blurring it.</p>\n<p>Measured: 8,388,608 cycles for a residual check at 256 samples, 8 segments, the three receipt sizes, three prove times on two machine sizes, 9.61 GB peak memory, 5.06 ms local verification, 249,749 gas on chain. Those come from committed artifacts and a live chain call, and anyone can rerun them.</p>\n<p>Not measured, and required before any of the extrapolation above becomes a claim: prover throughput in cycles per second at a workload large enough that fixed cost stops dominating, the cycle cost of quantised integer matrix multiplication in this specific zkVM, and how segment-parallel proving actually scales past the eight segments I have. Those are three benchmarks, not three papers, and the first one is a weekend.</p>\n<p>Until they exist, the honest form of the headline is that proving one small deterministic check costs eight million cycles and four tenths of a cent, that a language model forward pass is between four and eleven orders of magnitude larger in operations depending on the model and the length of the answer, and that converting the second fact into a dollar figure requires a measurement I do not have.</p>\n<p>The cheapest useful thing anyone could ship tomorrow is claim 3. Commit the system prompt, hash it into whatever proof you are already producing, and let people check that the policy in force was the policy you published. It costs a few thousand cycles. It would have made the December post much harder to write, because I would have been able to check what I was arguing about instead of inferring it from nine thousand words of transcript.</p>\n<style>\n.dpw {\n  --ink: #1b2228; --ink2: #5b7085; --line: #dae4ed;\n  --maroon: #a72e2b; --maroon-d: #6a1d1b; --rose: #f2cdcc; --green: #3f8f5b;\n  border: 1px solid var(--line); border-radius: 6px; padding: 20px;\n  margin: 32px 0; background: #fff; font-family: 'Open Sans', sans-serif;\n}\n.dpw * { box-sizing: border-box; }\n.dpw-svg { width: 100%; height: auto; display: block; margin: 6px 0 4px;\n  background: linear-gradient(180deg, #fbfcfe, #f4f7fa); border-radius: 4px; }\n.dpw-controls { margin-bottom: 14px; }\n.dpw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }\n.dpw-label { display: block; font-size: 13px; color: var(--ink2); }\n.dpw-label input[type=range] { display: block; width: 100%; margin: 8px 0 0; accent-color: var(--maroon); }\n.dpw-val { color: var(--maroon-d); font-family: 'Inconsolata', monospace; font-weight: 700; }\n.dpw-hint { font-size: 12px; color: var(--ink2); margin-top: 10px; font-style: italic; }\n.dpw-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }\n.dpw-panel { border: 1px solid var(--line); border-radius: 5px; padding: 14px; }\n.dpw-panel-warn { border-color: var(--rose); background: #fdf7f7; }\n.dpw-panel-h { font-family: 'Josefin Sans', sans-serif; font-size: 13px; text-transform: uppercase;\n  letter-spacing: .04em; color: var(--ink2); margin-bottom: 10px; }\n.dpw-panel-warn .dpw-panel-h { color: var(--maroon); }\n.dpw-line { font-size: 14px; color: var(--ink2); margin: 6px 0; }\n.dpw-line b { font-family: 'Inconsolata', monospace; font-size: 17px; color: var(--ink); }\n.dpw-line sup { font-size: 10px; }\n.dpw-detail { border: 1px solid var(--line); border-radius: 5px; padding: 12px 14px; margin-top: 12px; }\n.dpw-detail-h { font-family: 'Josefin Sans', sans-serif; font-size: 14px; color: var(--ink); margin-bottom: 6px; }\n.dpw-detail-b { font-size: 13px; color: var(--ink2); line-height: 21px; }\n.dpw-detail-b code { font-family: 'Inconsolata', monospace; font-size: 12px; background: #f4f7fa;\n  padding: 1px 5px; border-radius: 3px; color: var(--maroon-d); }\n.dpw-card { border: 1px solid var(--line); border-radius: 5px; margin-bottom: 8px; overflow: hidden; }\n.dpw-card-head { padding: 12px 14px; cursor: pointer; font-family: 'Josefin Sans', sans-serif;\n  font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 10px; transition: background .15s; }\n.dpw-card-head:hover { background: #f4f7fa; }\n.dpw-card[data-open=true] .dpw-card-head { background: var(--maroon); color: #fff; }\n.dpw-card-n { display: inline-flex; align-items: center; justify-content: center;\n  width: 22px; height: 22px; border-radius: 50%; background: var(--rose); color: var(--maroon-d);\n  font-family: 'Inconsolata', monospace; font-size: 13px; font-weight: 700; flex: none; }\n.dpw-card[data-open=true] .dpw-card-n { background: #fff; color: var(--maroon); }\n.dpw-badge { margin-left: auto; font-family: 'Inconsolata', monospace; font-size: 10px;\n  text-transform: uppercase; letter-spacing: .06em; padding: 3px 7px; border-radius: 3px; flex: none; }\n.dpw-yes { background: #dcefe3; color: var(--green); }\n.dpw-no { background: var(--rose); color: var(--maroon-d); }\n.dpw-card[data-open=true] .dpw-badge { background: rgba(255,255,255,.9); }\n.dpw-card-body { display: none; padding: 4px 16px 12px; font-size: 14px; color: var(--ink2); }\n.dpw-card[data-open=true] .dpw-card-body { display: block; }\n.dpw-card-body p { line-height: 22px; margin: 8px 0; }\n.dpw-card-body b { color: var(--ink); }\n.dpw-cost b { color: var(--maroon); }\n@media (max-width: 480px) {\n  .dpw-grid, .dpw-two { grid-template-columns: 1fr; }\n  .dpw-badge { display: none; }\n}\n@media (prefers-reduced-motion: reduce) { .dpw * { transition: none !important; } }\n</style>\n<script>\n(function () {\n  var root = document.getElementById('ladder');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var SVG = 'http://www.w3.org/2000/svg';\n  var svg = root.querySelector('#ld-svg');\n  // All measured on the 141/54 witness. Composite ran on 8 vCPU, the other two on 16.\n  var R = [\n    { n: 'composite', bytes: 2251496, prove: 3006.5, cpu: '8 vCPU', verify: null, c: '#dd9793',\n      d: 'The raw STARK, 8 segments unfolded. 3,006 seconds on eight cores. Fine as a file, far too large for a transaction, and there is no on-chain verifier that takes it.' },\n    { n: 'succinct', bytes: 224090, prove: 1463.2, cpu: '16 vCPU', verify: 20.13, c: '#c4635f',\n      d: 'Recursion folds the 8 segments into one. Ten times smaller and, on twice the cores, faster than the composite run it contains. Verifies locally in 20.13 ms.' },\n    { n: 'groth16', bytes: 1361, prove: 2618.7, cpu: '16 vCPU', verify: 5.06, c: '#a72e2b',\n      d: 'The recursive verifier proved inside a pairing SNARK, which needs a 3.62 GB proving key and a container. 1,361 bytes, of which the 260-byte seal is what travels. 5.06 ms locally, 249,749 gas on Base Sepolia, $0.0042.' }\n  ];\n  var P = { l: 74, r: 92, t: 26, b: 30 };\n  var LO = Math.log10(1000), HI = Math.log10(4000000);\n  function X(b) { return P.l + (Math.log10(b) - LO) / (HI - LO) * (480 - P.l - P.r); }\n  function el(n, at) { var e = document.createElementNS(SVG, n); for (var k in at) e.setAttribute(k, at[k]); return e; }\n  var hover = -1;\n\n  function draw() {\n    while (svg.firstChild) svg.removeChild(svg.firstChild);\n    [1e3, 1e4, 1e5, 1e6].forEach(function (t) {\n      svg.appendChild(el('line', { x1: X(t), y1: P.t - 6, x2: X(t), y2: 200 - P.b, stroke: '#dae4ed', 'stroke-width': 1 }));\n      var lb = el('text', { x: X(t), y: 200 - P.b + 14, 'text-anchor': 'middle', 'font-size': 9.5,\n        fill: '#94a6b8', 'font-family': 'Inconsolata, monospace' });\n      lb.textContent = t >= 1e6 ? '1 MB' : t >= 1e3 ? (t / 1e3) + ' KB' : t;\n      svg.appendChild(lb);\n    });\n    R.forEach(function (r, i) {\n      var y = P.t + i * 44;\n      var g = el('g', { cursor: 'pointer' });\n      g.appendChild(el('rect', { x: P.l, y: y, width: Math.max(X(r.bytes) - P.l, 2), height: 26, rx: 3,\n        fill: r.c, opacity: hover === -1 || hover === i ? 1 : 0.4 }));\n      g.appendChild(el('rect', { x: 0, y: y - 6, width: 480, height: 38, fill: 'transparent' }));\n      on(g, 'mouseenter', function () { if (hover === i) return; hover = i; draw(); detail(i); });\n      svg.appendChild(g);\n      var nm = el('text', { x: P.l - 8, y: y + 17, 'text-anchor': 'end', 'font-size': 12,\n        fill: '#1b2228', 'font-family': 'Josefin Sans, sans-serif' }); nm.textContent = r.n;\n      svg.appendChild(nm);\n      var vl = el('text', { x: X(r.bytes) + 7, y: y + 17, 'font-size': 10.5,\n        fill: '#5b7085', 'font-family': 'Inconsolata, monospace' });\n      vl.textContent = r.bytes.toLocaleString() + ' B';\n      svg.appendChild(vl);\n      var pv = el('text', { x: P.l + 6, y: y + 17, 'font-size': 10, fill: '#fff',\n        'font-family': 'Inconsolata, monospace' });\n      pv.textContent = Math.round(r.prove) + ' s';\n      if (X(r.bytes) - P.l > 60) svg.appendChild(pv);\n    });\n    var ax = el('text', { x: 240, y: 196, 'text-anchor': 'middle', 'font-size': 10.5, fill: '#5b7085' });\n    ax.textContent = 'receipt size, log scale. bar label is prove time.';\n    svg.appendChild(ax);\n  }\n  function detail(i) {\n    var d = root.querySelector('#ld-detail'), r = R[i];\n    d.querySelector('.dpw-detail-h').textContent =\n      r.n + ' · ' + r.bytes.toLocaleString() + ' bytes · ' + Math.round(r.prove) + ' s on ' + r.cpu +\n      (r.verify ? ' · verifies in ' + r.verify + ' ms' : '');\n    d.querySelector('.dpw-detail-b').textContent = r.d;\n  }\n  draw();\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('extrap');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var PARAMS = [[0.5e9, '0.5B'], [1.5e9, '1.5B'], [7e9, '7B'], [13e9, '13B'], [70e9, '70B'], [405e9, '405B']];\n  var TOKENS = [[1, '1'], [64, '64'], [256, '256'], [1024, '1,024'], [4096, '4,096']];\n  var CPO = [[1, '1 (int8, optimistic)'], [8, '8'], [92, '92 (measured, f64)'], [256, '256'], [1024, '1,024']];\n  var SEG = 1048576;\n\n  function fmtBig(v) {\n    var u = [[1e12, ' T'], [1e9, ' B'], [1e6, ' M'], [1e3, ' K']];\n    for (var i = 0; i < u.length; i++) if (v >= u[i][0]) return (v / u[i][0]).toFixed(v / u[i][0] < 10 ? 1 : 0) + u[i][1];\n    return v.toFixed(0);\n  }\n  function fmtTime(s) {\n    if (s < 60) return s.toFixed(1) + ' s';\n    if (s < 3600) return (s / 60).toFixed(1) + ' min';\n    if (s < 86400) return (s / 3600).toFixed(1) + ' hours';\n    if (s < 86400 * 365) return (s / 86400).toFixed(0) + ' days';\n    var y = s / (86400 * 365);\n    return y >= 1000 ? fmtBig(y) + ' years' : y.toFixed(0) + ' years';\n  }\n  function render() {\n    var p = PARAMS[+root.querySelector('#ex-p').value];\n    var t = TOKENS[+root.querySelector('#ex-t').value];\n    var c = CPO[+root.querySelector('#ex-c').value];\n    var rExp = +root.querySelector('#ex-r').value;\n    var rate = Math.pow(10, rExp);\n\n    root.querySelector('#ex-p-val').textContent = p[1];\n    root.querySelector('#ex-t-val').textContent = t[1];\n    root.querySelector('#ex-c-val').textContent = c[1];\n    root.querySelector('#ex-r-val').textContent = fmtBig(rate).trim();\n\n    var ops = 2 * p[0] * t[0];\n    var cyc = ops * c[0];\n    root.querySelector('#ex-ops').textContent = fmtBig(ops);\n    root.querySelector('#ex-cyc').textContent = fmtBig(cyc);\n    root.querySelector('#ex-seg').textContent = fmtBig(Math.ceil(cyc / SEG));\n    root.querySelector('#ex-time').textContent = fmtTime(cyc / rate);\n    root.querySelector('#ex-band').textContent =\n      fmtTime(cyc / 1e8) + ' to ' + fmtTime(cyc / 1e3);\n  }\n  ['#ex-p', '#ex-t', '#ex-c', '#ex-r'].forEach(function (id) {\n    on(root.querySelector(id), 'input', render);\n  });\n  render();\n})();\n</script>\n<script>\n(function () {\n  var root = document.getElementById('claims');\n  if (!root) return;\n  if (root._cleanup) root._cleanup();\n  var L = [];\n  function on(el, ev, fn) { if (!el) return; el.addEventListener(ev, fn); L.push([el, ev, fn]); }\n  root._cleanup = function () { L.forEach(function (x) { x[0].removeEventListener(x[1], x[2]); }); };\n\n  var cards = root.querySelectorAll('.dpw-card');\n  cards.forEach(function (card) {\n    on(card.querySelector('.dpw-card-head'), 'click', function () {\n      var open = card.getAttribute('data-open') === 'true';\n      cards.forEach(function (c) { c.setAttribute('data-open', 'false'); });\n      card.setAttribute('data-open', open ? 'false' : 'true');\n    });\n  });\n})();\n</script>","headings":[{"value":"The smallest interesting verifiable claim","depth":2},{"value":"What you buy at each rung","depth":2},{"value":"The number I refuse to publish","depth":2},{"value":"What is actually provable about a refusal","depth":2},{"value":"Proofs give integrity, and the leak was never an integrity problem","depth":2},{"value":"What I would actually measure next","depth":2}],"frontmatter":{"date_created":"2026-08-24","path":"/blog/cost-of-proving-llm-refusal","tags":["AI Safety","Zero Knowledge Proofs","Verifiable Computation"],"title":"What It Would Cost To Prove An LLM Refused Correctly"}}},"pageContext":{"prevPostPath":"/blog/building-a-dp-mechanism","currPostPath":"/blog/crypto-club-proof-by-contradiction","nextPostPath":"/blog/cost-of-proving-llm-refusal"}},"staticQueryHashes":[]}