zorch.lnp.range¶
The approximate range proof — ‖(s1, m)‖₂ is small (eprint 2022/284,
§2.4 and §5.1, Fig. 9).
The first layer here that proves something about the size of a witness rather than about an algebraic relation it satisfies, and so the first one a folding scheme or a verifiable-encryption consumer can actually use. It is also the last layer built directly on Π_eval^(2): Fig. 10 composes this with a caller's own relations, and §5 composes it again into exact ℓ2/ℓ∞ bounds.
Why a projection. s = (s1, m) has d·(m1 + ℓ) integer coefficients,
and revealing them is out of the question. Lemma 2.9 says a random
R ← Bin_1^{256 × d(m1+ℓ)} shrinks any ⃗s to 256 integers R⃗s whose
norm still bounds ‖⃗s‖ — up to a constant, and only in one direction,
which is exactly what "approximate" names: from ‖R⃗s + ⃗y‖ small the
verifier concludes ‖⃗s‖ ≤ 2√(256/26)·t·γ·√337·β, a factor ~189 above the
true bound. The counterpart is that the whole statement costs 256 revealed
integers regardless of how long the witness is.
Why a mask, and why a sign. R⃗s still leaks ⃗s, so the prover
commits a Gaussian y ~ D_{s3}^{256/d} before seeing R and reveals
⃗z = b·R⃗s + ⃗y instead. The secret sign b ∈ {−1, 1} makes ⃗z bimodal,
which lets Rej0 reach the same repetition rate at a much smaller s3 than
Rej1 would (masking.BimodalMasking holds that argument). The sign is not
free: the verifier has to be told b is a sign without being told which,
and that is where most of this module's statement comes from.
What is handed to Π_eval^(2). Everything, in one shot. The layer below proves that quadratic functions of the σ-lift vanish, either as ring elements or in their constant coefficient alone, so all three obligations are written in that vocabulary (eq. 42–45):
F_i(x) = z_i − b·T(⃗r_i, ⃗s) − y_ifori ∈ [256]— the well-formedness of the revealed projection.T(eq. 16) puts an integer inner product in a constant coefficient, so eachF_iis one evaluation. It is quadratic, not linear, becauseband⃗sare both committed.G_j(x) = T(⃗δ_j, b)forj ∈ [1, d)— thej-th coefficient ofb, which vanishes exactly whenbis an integer. Also evaluations.f(x) = b² − 1— the one relation, vanishing as a ring element. Withbalready known integral,b² = 1over the fieldZ_qleavesb ∈ {−1, 1}.
F_i's constant coefficient only factors as b·⟨⃗r_i, ⃗s⟩ because b is a
constant polynomial — which is what the G_j establish. Dropping them
would not fail a round-trip; it would silently prove a statement about a
different quantity, so they are load-bearing rather than hygiene.
Message layout. y and b are committed in the BDLOP half beside the
caller's m (Fig. 9's B2 and b1 rows), so what the layer below opens
is m‖y‖b, and what it appends on top of that is its own garbage. The
scheme therefore carries ℓ + 256/d + 1 + λ messages, and each layer
carves its share off the end — the same "build it over the extended
scheme" contract GarbageMasking states, one level up.
The caller's m arrives as signed integers rather than as a ring stack,
unlike every other layer here, and that is deliberate: m is half of the
vector whose norm is the statement, so its balanced representatives are
the object being bounded. Taking a ring stack would mean reconstructing
them, and which centred reconstruction a bound reads is a pinned choice in
this codebase (zorch/commit/ajtai.py), not a detail to re-decide here.
Fiat-Shamir shape: the prover absorbs (t_y, t_b) and receives R, then
absorbs ⃗z before the inner proof runs, so the statement Π_eval^(2) is
given is bound to the transcript that produced it. R is not on the wire —
the verifier re-derives it, which is what checks it.
RangeProof
dataclass
¶
The Fig. 9 wire: the two extra commitments, the revealed projection, and the Π_eval^(2) proof of its well-formedness.
R is absent for the reason every challenge in this package is absent —
it is Fiat-Shamir output and the verifier re-derives it from (t_mask,
t_sign). ⃗z is not derivable and is the whole point of the protocol,
so it is sent, as signed integers over unreduced ℤ: its norm is the
statement, and a mod-q representative would not have one.
Source code in zorch/lnp/range.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
ApproximateRange ¶
Fig. 9 prove/verify over an AbdlopQuadraticEval.
Built over the eval layer rather than beside it, because the projection
statement is not provable on its own: F_i, G_j and f are what a
verifier checks, and only Π_eval^(2) can check them together against one
commitment. This layer's own contribution is the (b, y, R, ⃗z) round
and the norm gate on ⃗z.
The scheme it needs. evaluation must already be built over a
scheme whose BDLOP half carries ℓ + 256/d + 1 + λ messages; self.ell
is what is left for the caller after this layer's mask and sign and the
layer below's garbage. A scheme sized for the caller's m alone fails
here rather than silently proving a statement about a shorter witness.
What is proven, and what is not. A verifying proof says
‖(s1, m)‖₂ ≤ 2√(256/26)·t·γ·√337·β for the β the caller derived
mask_std from — a bound roughly 189β, not β. Anything needing the
tight bound composes this with §5's exact proof; this layer is where
that composition gets its "no wraparound mod q" premise.
Commit-and-prove, not zero-knowledge over a reusable commitment — §3.2,
inherited from the layer below and made stronger here, since this layer
appends y and b to the message on every run.
Source code in zorch/lnp/range.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
prove ¶
prove(
a1: np.ndarray,
a2: np.ndarray,
b: np.ndarray,
b_mask: np.ndarray,
b_sign: np.ndarray,
bg: np.ndarray,
b_quad: np.ndarray,
s1: np.ndarray,
s2: np.ndarray,
message: np.ndarray,
rng: np.random.Generator,
transcript: ByteTranscript,
) -> tuple[RangeProof, ByteTranscript]
One non-interactive proof that ‖(s1, m)‖₂ is within the bound
masking was parameterised for.
b_mask and b_sign are Fig. 9's B2 and b1, the BDLOP rows the
mask and the sign are committed under — distinct from the message's
b, from bg, and from Fig. 6's b_quad. s1, s2 and message
are signed integer arrays: the first two as everywhere in this
package, the third because it is half of the vector being bounded.
Source code in zorch/lnp/range.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
verify ¶
verify(
a1: np.ndarray,
a2: np.ndarray,
b: np.ndarray,
b_mask: np.ndarray,
b_sign: np.ndarray,
bg: np.ndarray,
b_quad: np.ndarray,
t_a: np.ndarray,
t_b: np.ndarray,
proof: RangeProof,
transcript: ByteTranscript,
) -> tuple[bool, ByteTranscript]
Fig. 9's two checks: ‖⃗z‖₂ is within the Prop. 5.1 bound, and
the Π_eval^(2) proof of the statement ⃗z induces verifies.
t_b is the caller's commitment to m alone; the mask and sign
commitments arrive on the proof and are appended here, in the order
the message was built.
Source code in zorch/lnp/range.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |