Documentation

CslibFrontier.Crypto.Protocols.AnonymousToken.Conservation

Extracted credit conservation for single-issuer VOLE-ACT #

This module proves an extracted-model reduction step for credit conservation in single-issuer VOLE-ACT. The game, both parts of the argument and the reductions are original to this library. The source draft leaves the protocol's security reductions open ([ZPS26], Security Considerations / Proof status).

The protocol data follow the draft. A token certifies Tag(Com(nf, ctx, t, r), x) ([ZPS26], Overview and Protocol Specification / Parameters / Tag). Issuance certifies Tag(c, 0) for a commitment c to (nf, ctx, T) (Protocol Specification / Initial Issuance). A spend reveals nf, debits d and commits to the change state as c'; the issuer then certifies Tag(c', x') for a refund x' it grants. The spend relation checks that the input state was certified (V1), that c' opens to the change state (V2), and that t + x = t' + d over the integers (V3). The caller rejects a nullifier it has already recorded (Protocol Specification / Spending and Spend Response).

Here the commitment is any function com : Nullifier → Context → ℕ → Opening → Commitment, the tag is any tag : Commitment → ℕ → Target, and the certifier is any S : Signature.Scheme PK SK Target Sig. Targets use the two-stage encoder Credit.target com tag, and semantic notes reuse Credit.Note. The KP800 and MQ instantiations are the intended uses and are not formalized here. The game is a permissive modeling choice. It omits the range checks (V4, and T ≥ 1 at issuance), and every amount T, debit d and refund x' comes from the adversary's request. In the draft, T is agreed out of band and is the issuer's own input, and the issuer chooses x'. The bounds below hold for this game as stated. IssuerBridge (CslibFrontier/Crypto/Protocols/AnonymousToken/IssuerBridge.lean) transfers them without probability loss to a stateful, probabilistic draft-style issuer with issuer-agreed initial balances, issuer-chosen refunds, and range rejections.

In the extracted model, every request carries the witness that a knowledge extractor for its VOLEitH proof would output, next to its public statement, and the issuer checks the relation on that witness directly. The knowledge-extraction error of the VOLEitH proof system, zero-knowledge, random-oracle or ideal-permutation arguments for Tag and Com, Keccak, the UOV instantiation, multi-issuer selection and runtime bounds are all outside this module. The results are therefore a reduction step toward credit conservation, not a credit-conservation theorem for the unextracted protocol.

Part I (spentDebit_le_of_certified) is the deterministic accounting core. Take any list of requests, in any order, in which every spend satisfies the balance equation t + x = t' + d (V3), spent (ctx, nf) pairs are pairwise distinct, and every spend's input note is the output note of some request in the list. Then ∑ d ≤ ∑ T + ∑ x' in every context. Part I involves no commitment function, tag function or signature scheme, and no commitment-binding premise.

Part II is the adaptive game. extractedConservationExperiment runs the adversary against an issuer oracle built on ProbOracleComp.runLogWith. The issuer signs tag c 0 or tag c' x' from public data only and rejects a reused (ctx, nf) against its log. The adversary wins if, in a context it names at the end, debits exceed issued credit plus refunds. The explicit reduction noteForger simulates the issuer with a semantic signing oracle. When the adversary wins, Part I yields a spend whose input note was never certified, so noteForger wins Cslib.Crypto.AnonymousToken.extractedExperiment (extractedConservationExperiment_succProbability_le_extractedExperiment). Composing with extracted_succProbability_le bounds the game by the EUF-CMA success of targetForger plus the probability that the forger's run contains a target collision (bindingExperiment), each with coefficient one (extractedConservationExperiment_succProbability_le). As in Basic, the EUF-CMA term is for chosen targets, so it need not be small for a raw UOV map. For tag = Prod.mk, the target-collision term is in turn bounded by the binding game of a keyless Cslib.Crypto.Commitment.Scheme, one whose verifier, under every key, accepts exactly when com nf ctx t o = c (bindingExperiment_prod_mk_le_commitment). Keyed commitments, whose verifier depends on the key, are out of scope.

The totals here do not reuse Credit.Ledger. The ledger is a sequential state invariant, while Part I is a statement about an unordered transcript and does not depend on execution order.

Main definitions #

Main results #

References #

Requests, payloads, and acceptance checks #

structure Cslib.Crypto.AnonymousToken.Conservation.IssueRequest (Nullifier Context Opening Commitment : Type) :

An extracted issuance request (issue ctx T c with witness (nf, r)).

  • ctx : Context

    Issuance context ctx.

  • amount : ℕ

    Initial credited amount T.

  • commitment : Commitment

    Commitment c to (nullifier, ctx, amount) under opening.

  • nullifier : Nullifier

    Extracted nullifier nf.

  • opening : Opening

    Extracted opening randomness r.

@[instance_reducible]
instance Cslib.Crypto.AnonymousToken.Conservation.instDecidableEqIssueRequest {Nullifier✝ Context✝ Opening✝ Commitment✝ : Type} [DecidableEq Nullifier✝] [DecidableEq Context✝] [DecidableEq Opening✝] [DecidableEq Commitment✝] :
DecidableEq (IssueRequest Nullifier✝ Context✝ Opening✝ Commitment✝)
def Cslib.Crypto.AnonymousToken.Conservation.instDecidableEqIssueRequest.decEq {Nullifier✝ Context✝ Opening✝ Commitment✝ : Type} [DecidableEq Nullifier✝] [DecidableEq Context✝] [DecidableEq Opening✝] [DecidableEq Commitment✝] (x✝ x✝¹ : IssueRequest Nullifier✝ Context✝ Opening✝ Commitment✝) :
Decidable (x✝ = x✝¹)
structure Cslib.Crypto.AnonymousToken.Conservation.SpendRequest (Nullifier Context Opening Commitment Sig : Type) :

An extracted spend request (spend ctx nf d x' c' with witness (t, r, x, s, nf', t', r')).

  • ctx : Context

    Issuance context ctx shared by input and change tokens.

  • nullifier : Nullifier

    Revealed nullifier nf of the spent token.

  • debit : ℕ

    Amount d debited by this spend.

  • refund : ℕ

    Refund x' granted by the issuer on the change token.

  • changeCommitment : Commitment

    Commitment c' to the change token.

  • oldCredit : ℕ

    Extracted committed balance t of the input token.

  • oldOpening : Opening

    Extracted opening randomness r of the input token.

  • oldRefund : ℕ

    Extracted prior refund x carried by the input token.

  • signature : Sig

    Extracted certification signature s on Credit.target com tag inputNote oldOpening.

  • newNullifier : Nullifier

    Extracted nullifier nf' of the change token.

  • newCredit : ℕ

    Extracted committed balance t' of the change token.

  • newOpening : Opening

    Extracted opening randomness r' of the change token.

@[instance_reducible]
instance Cslib.Crypto.AnonymousToken.Conservation.instDecidableEqSpendRequest {Nullifier✝ Context✝ Opening✝ Commitment✝ Sig✝ : Type} [DecidableEq Nullifier✝] [DecidableEq Context✝] [DecidableEq Opening✝] [DecidableEq Commitment✝] [DecidableEq Sig✝] :
DecidableEq (SpendRequest Nullifier✝ Context✝ Opening✝ Commitment✝ Sig✝)
def Cslib.Crypto.AnonymousToken.Conservation.instDecidableEqSpendRequest.decEq {Nullifier✝ Context✝ Opening✝ Commitment✝ Sig✝ : Type} [DecidableEq Nullifier✝] [DecidableEq Context✝] [DecidableEq Opening✝] [DecidableEq Commitment✝] [DecidableEq Sig✝] (x✝ x✝¹ : SpendRequest Nullifier✝ Context✝ Opening✝ Commitment✝ Sig✝) :
Decidable (x✝ = x✝¹)
inductive Cslib.Crypto.AnonymousToken.Conservation.Request (Nullifier Context Opening Commitment Sig : Type) :

An adversary request to the extracted single-issuer VOLE-ACT oracle.

  • issue {Nullifier Context Opening Commitment Sig : Type} (req : IssueRequest Nullifier Context Opening Commitment) : Request Nullifier Context Opening Commitment Sig

    Issuance request issue ctx T c with extracted witness (nf, r).

  • spend {Nullifier Context Opening Commitment Sig : Type} (req : SpendRequest Nullifier Context Opening Commitment Sig) : Request Nullifier Context Opening Commitment Sig

    Spend request spend ctx nf d x' c' with extracted witness (t, r, x, s, nf', t', r').

@[instance_reducible]
instance Cslib.Crypto.AnonymousToken.Conservation.instDecidableEqRequest {Nullifier✝ Context✝ Opening✝ Commitment✝ Sig✝ : Type} [DecidableEq Nullifier✝] [DecidableEq Context✝] [DecidableEq Opening✝] [DecidableEq Commitment✝] [DecidableEq Sig✝] :
DecidableEq (Request Nullifier✝ Context✝ Opening✝ Commitment✝ Sig✝)
def Cslib.Crypto.AnonymousToken.Conservation.instDecidableEqRequest.decEq {Nullifier✝ Context✝ Opening✝ Commitment✝ Sig✝ : Type} [DecidableEq Nullifier✝] [DecidableEq Context✝] [DecidableEq Opening✝] [DecidableEq Commitment✝] [DecidableEq Sig✝] (x✝ x✝¹ : Request Nullifier✝ Context✝ Opening✝ Commitment✝ Sig✝) :
Decidable (x✝ = x✝¹)
def Cslib.Crypto.AnonymousToken.Conservation.Request.ctx {Nullifier Context Opening Commitment Sig : Type} :
Request Nullifier Context Opening Commitment Sig → Context

The issuance context targeted by a request.

def Cslib.Crypto.AnonymousToken.Conservation.Request.signedMessage {Nullifier Context Opening Commitment Target Sig : Type} (tag : Commitment → ℕ → Target) :
Request Nullifier Context Opening Commitment Sig → Target

The target message signed by the real issuer when req is accepted: tag c 0 for issuance, tag c' x' for spend. Notice this depends only on the public commitment and refund.

def Cslib.Crypto.AnonymousToken.Conservation.SpendRequest.inputNote {Nullifier Context Opening Commitment Sig : Type} (req : SpendRequest Nullifier Context Opening Commitment Sig) :
Credit.Note Nullifier Context

The semantic input Credit.Note consumed by a spend request.

def Cslib.Crypto.AnonymousToken.Conservation.SpendRequest.inputPayload {Nullifier Context Opening Commitment Sig : Type} (req : SpendRequest Nullifier Context Opening Commitment Sig) :
Payload (Credit.Note Nullifier Context) Opening

The semantic input payload (inputNote, oldOpening) certified by req.signature.

def Cslib.Crypto.AnonymousToken.Conservation.Request.outputPayload {Nullifier Context Opening Commitment Sig : Type} :
Request Nullifier Context Opening Commitment Sig → Payload (Credit.Note Nullifier Context) Opening

The semantic output payload created by an accepted request: (⟨nf, ctx, T, 0⟩, r) for issuance and (⟨nf', ctx, t', x'⟩, r') for spend.

def Cslib.Crypto.AnonymousToken.Conservation.acceptLocal {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (pk : PK) :
Request Nullifier Context Opening Commitment Sig → Bool

Per-request validity checks, independent of prior spent nullifiers: for issuance, com nf ctx T r = c; for spend, (V1) verification on Credit.target com tag inputNote oldOpening, (V2) change commitment opening com nf' ctx t' r' = c', and (V3) natural-number balance conservation t + x = t' + d (no modular wraparound). The draft's (V4) range bounds are omitted here and enforced in Cslib.Crypto.AnonymousToken.IssuerBridge (acceptDraftIssue, acceptDraftSpendPre).

def Cslib.Crypto.AnonymousToken.Conservation.hasSpentNullifier {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) (ctx : Context) (nf : Nullifier) :

Whether (ctx, nf) already appears as the spent nullifier of an accepted spend in reqs. The draft keeps nullifier records per issuer key and issuance context ([ZPS26], Protocol Specification / Spend Response); with the single issuer key here, that scope is (ctx, nf).

def Cslib.Crypto.AnonymousToken.Conservation.acceptRequest {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (pk : PK) (accepted : List (Request Nullifier Context Opening Commitment Sig)) :
Request Nullifier Context Opening Commitment Sig → Bool

Full issuer acceptance check for req given pk and accepted prefix accepted.

def Cslib.Crypto.AnonymousToken.Conservation.validTraceFrom {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (pk : PK) :
List (Request Nullifier Context Opening Commitment Sig) → List (Request Nullifier Context Opening Commitment Sig) → Bool

Check that an oldest-first request trace reqs is sequentially accepted starting from the already-accepted prefix accepted.

@[reducible, inline]
abbrev Cslib.Crypto.AnonymousToken.Conservation.validTrace {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (pk : PK) (reqs : List (Request Nullifier Context Opening Commitment Sig)) :

Check that an oldest-first request trace reqs is sequentially accepted from empty history.

def Cslib.Crypto.AnonymousToken.Conservation.spends {Nullifier Context Opening Commitment Sig : Type} (reqs : List (Request Nullifier Context Opening Commitment Sig)) :
List (SpendRequest Nullifier Context Opening Commitment Sig)

All spend requests in reqs, preserving order.

def Cslib.Crypto.AnonymousToken.Conservation.issuesIn {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) (ctx : Context) :
List (IssueRequest Nullifier Context Opening Commitment)

All issuance requests in reqs targeting context ctx.

def Cslib.Crypto.AnonymousToken.Conservation.spendsIn {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) (ctx : Context) :
List (SpendRequest Nullifier Context Opening Commitment Sig)

All spend requests in reqs targeting context ctx.

def Cslib.Crypto.AnonymousToken.Conservation.issuedAmount {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) (ctx : Context) :

Total issued credit ∑ T across accepted issuances in context ctx.

def Cslib.Crypto.AnonymousToken.Conservation.spentDebit {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) (ctx : Context) :

Total debited credit ∑ d across accepted spends in context ctx.

def Cslib.Crypto.AnonymousToken.Conservation.grantedRefund {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) (ctx : Context) :

Total granted refunds ∑ x' across accepted spends in context ctx.

def Cslib.Crypto.AnonymousToken.Conservation.findNoteForgery {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) :
Option (Token (Credit.Note Nullifier Context) Opening Sig)

Search reqs for the first spend whose input Credit.Note never appears as an output note of any request in reqs, returning the semantic forgery witness ⟨s.inputPayload, s.signature⟩.

Part I: Deterministic accounting core #

theorem Cslib.Crypto.AnonymousToken.Conservation.acceptLocal_of_validTrace {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] {com : Nullifier → Context → ℕ → Opening → Commitment} {tag : Commitment → ℕ → Target} {S : Signature.Scheme PK SK Target Sig} {pk : PK} {reqs : List (Request Nullifier Context Opening Commitment Sig)} (h : validTrace com tag S pk reqs = true) (r : Request Nullifier Context Opening Commitment Sig) :
r ∈ reqs → acceptLocal com tag S pk r = true

Every request in a validTrace satisfies its local check (acceptLocal).

theorem Cslib.Crypto.AnonymousToken.Conservation.nodup_spends_of_validTrace {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] {com : Nullifier → Context → ℕ → Opening → Commitment} {tag : Commitment → ℕ → Target} {S : Signature.Scheme PK SK Target Sig} {pk : PK} {reqs : List (Request Nullifier Context Opening Commitment Sig)} (h : validTrace com tag S pk reqs = true) :
(List.map (fun (s : SpendRequest Nullifier Context Opening Commitment Sig) => (s.ctx, s.nullifier)) (spends reqs)).Nodup

Spend (ctx, nullifier) pairs are pairwise distinct across a validTrace.

theorem Cslib.Crypto.AnonymousToken.Conservation.balance_of_validTrace {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] {com : Nullifier → Context → ℕ → Opening → Commitment} {tag : Commitment → ℕ → Target} {S : Signature.Scheme PK SK Target Sig} {pk : PK} {reqs : List (Request Nullifier Context Opening Commitment Sig)} (h : validTrace com tag S pk reqs = true) (s : SpendRequest Nullifier Context Opening Commitment Sig) :

Every spend in a trace accepted by validTrace satisfies the (V3) balance equation, the first premise of spentDebit_le_of_certified.

theorem Cslib.Crypto.AnonymousToken.Conservation.spentDebit_le_of_certified {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) (hbalance : ∀ s ∈ spends reqs, s.oldCredit + s.oldRefund = s.newCredit + s.debit) (hnodup : (List.map (fun (s : SpendRequest Nullifier Context Opening Commitment Sig) => (s.ctx, s.nullifier)) (spends reqs)).Nodup) (hcertified : ∀ s ∈ spends reqs, s.inputNote ∈ List.map (fun (r : Request Nullifier Context Opening Commitment Sig) => r.outputPayload.message) reqs) (ctx : Context) :
spentDebit reqs ctx ≤ issuedAmount reqs ctx + grantedRefund reqs ctx

Extracted-model accounting step, original to this library: for any request list reqs (in any order) in which every spend satisfies the balance equation t + x = t' + d (the (V3) check of acceptLocal), spent (ctx, nullifier) pairs are pairwise distinct, and every spend's semantic input Credit.Note matches some request's output Credit.Note, total debited credit in every context ctx is at most total issued credit plus total granted refunds in ctx. This step is deterministic. No commitment, tag, signature, or opening check enters it, so it needs no commitment-binding or signature premise.

theorem Cslib.Crypto.AnonymousToken.Conservation.findNoteForgery_eq_none_iff {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] (reqs : List (Request Nullifier Context Opening Commitment Sig)) :
findNoteForgery reqs = none ↔ ∀ s ∈ spends reqs, s.inputNote ∈ List.map (fun (r : Request Nullifier Context Opening Commitment Sig) => r.outputPayload.message) reqs

findNoteForgery reqs = none iff every spend in reqs uses a certified input note.

theorem Cslib.Crypto.AnonymousToken.Conservation.findNoteForgery_eq_some {Nullifier Context Opening Commitment Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] {reqs : List (Request Nullifier Context Opening Commitment Sig)} {tok : Token (Credit.Note Nullifier Context) Opening Sig} (h : findNoteForgery reqs = some tok) :
∃ s ∈ spends reqs, tok = { payload := s.inputPayload, signature := s.signature } ∧ s.inputNote ∉ List.map (fun (r : Request Nullifier Context Opening Commitment Sig) => r.outputPayload.message) reqs

If findNoteForgery reqs = some tok, then tok is the payload/signature pair of some spend in reqs whose input note never appeared among the output notes in reqs.

Part II: Adaptive game, reduction to AnonymousToken, and probability bound #

def Cslib.Crypto.AnonymousToken.Conservation.extractedIssuerOracle {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (keys : PK × SK) (log : List (Request Nullifier Context Opening Commitment Sig × Option Sig)) (req : Request Nullifier Context Opening Commitment Sig) :

The log-reading issuer oracle passed to ProbOracleComp.runLogWith: if req is accepted given pk and the previously logged accepted requests, return some (some <$> S.sign sk (req.signedMessage tag)); otherwise return none, in which case runLogWith answers default (here none : Option Sig) and does not log the request.

@[reducible, inline]
abbrev Cslib.Crypto.AnonymousToken.Conservation.ExtractedAdversary (Nullifier Context Opening Commitment PK Sig : Type) :

An adaptive adversary in the extracted VOLE-ACT credit-conservation game: given pk, it queries the extracted issuer oracle and outputs the context ctx* it claims is violated.

structure Cslib.Crypto.AnonymousToken.Conservation.ExtractedConservationExecution (Nullifier Context Opening Commitment PK Sig : Type) :

The public key, target context, and accepted transcript of a credit-conservation run.

  • publicKey : PK

    Public verification key sampled by the experiment.

  • targetCtx : Context

    Target context ctx* output by the adversary.

  • log : List (Request Nullifier Context Opening Commitment Sig × Option Sig)

    Accepted requests paired with their issued some σ replies, oldest first.

def Cslib.Crypto.AnonymousToken.Conservation.runExtractedConservation {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) :
ProbComp (ExtractedConservationExecution Nullifier Context Opening Commitment PK Sig)

Execute A against the extracted VOLE-ACT issuer.

def Cslib.Crypto.AnonymousToken.Conservation.extractedConservationAccept {Nullifier Context Opening Commitment PK Sig : Type} [DecidableEq Context] (run : ExtractedConservationExecution Nullifier Context Opening Commitment PK Sig) :

Acceptance predicate of the credit-conservation game: under run.targetCtx, total spend debits strictly exceed total issued credit plus total granted refunds.

def Cslib.Crypto.AnonymousToken.Conservation.extractedConservationExperiment {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) :

The extracted VOLE-ACT credit-conservation experiment, original to this library (the source draft states no security game): the adversary submits requests whose witnesses are given in the clear, and wins if the accepted transcript overspends run.targetCtx. The error of extracting those witnesses from VOLEitH proofs is outside this model.

def Cslib.Crypto.AnonymousToken.Conservation.noteForgerHandler {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (pk : PK) (req : Request Nullifier Context Opening Commitment Sig) :
StateT (List (Request Nullifier Context Opening Commitment Sig)) (ProbOracleComp fun (x : Payload (Credit.Note Nullifier Context) Opening) => Sig) (Option Sig)

Stateful simulation handler used by noteForger: forwards each accepted request's req.outputPayload to the external semantic signing oracle once while recording accepted requests; rejected requests make no oracle query and return none.

def Cslib.Crypto.AnonymousToken.Conservation.noteForger {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] [Inhabited Sig] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) :
ExtractedForger PK (Credit.Note Nullifier Context) Opening Sig

Explicit semantic-forgery reduction noteForger from ExtractedAdversary to ExtractedForger PK (Credit.Note Nullifier Context) Opening Sig: simulates the VOLE-ACT issuer via noteForgerHandler and outputs the first spend whose input Credit.Note never appeared among accepted output notes. The Inhabited instances only supply a default token for the branch where no such spend exists; there the conservation game is lost by spentDebit_le_of_certified, so the default does not affect the bound.

theorem Cslib.Crypto.AnonymousToken.Conservation.noteForger_queryBound {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] [Inhabited Sig] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) (pk : PK) {q : ℕ} (hA : (A pk).IsQueryBounded q) :
(noteForger com tag S A pk).IsQueryBounded q

noteForger makes at most q semantic-signing queries whenever A makes at most q issuer requests. No runtime bound or fair-coin efficiency follows from this oracle-call bound alone.

theorem Cslib.Crypto.AnonymousToken.Conservation.runExtractedConservation_log_length_le {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) {q : ℕ} (hA : ∀ (pk : PK), (A pk).IsQueryBounded q) {run : ExtractedConservationExecution Nullifier Context Opening Commitment PK Sig} (hrun : run ∈ (runExtractedConservation com tag S A).eval.support) :
run.log.length ≤ q

A q-query adversary logs at most q accepted requests in runExtractedConservation.

theorem Cslib.Crypto.AnonymousToken.Conservation.extractedConservationExperiment_succProbability_le_extractedExperiment {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] [Inhabited Sig] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) :

Extracted-model reduction step, original to this library; it couples the credit-conservation game to Cslib.Crypto.AnonymousToken.extractedExperiment. Any adversary winning the extracted VOLE-ACT credit-conservation game yields a winning semantic forgery via noteForger with at least the same probability.

theorem Cslib.Crypto.AnonymousToken.Conservation.extractedConservationExperiment_succProbability_le {Nullifier Context Opening Commitment Target PK SK Sig : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] [DecidableEq Target] [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] [Inhabited Sig] (com : Nullifier → Context → ℕ → Opening → Commitment) (tag : Commitment → ℕ → Target) (S : Signature.Scheme PK SK Target Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) :

Extracted-model reduction step, original to this library; this is not a credit-conservation theorem for the unextracted protocol. Every winning adversary against the extracted credit-conservation game yields either a target existential forgery via targetForger (Credit.target com tag) (noteForger com tag S A) or a target collision in the forger's run, measured by bindingExperiment S (Credit.target com tag) (noteForger com tag S A); both terms have coefficient one. For tag = Prod.mk the second term is bounded by commitment binding in bindingExperiment_prod_mk_le_commitment. The error of extracting witnesses from VOLEitH proofs is outside this model.

With Target = Commitment × ℕ and tag := Prod.mk, the identity encoding of (c, x) that abstracts the draft's Tag step, a valid target binding witness for Credit.target com Prod.mk is equivalent to equal refunds, distinct (nullifier, ctx, credit) triples, and equal com evaluations.

def Cslib.Crypto.AnonymousToken.Conservation.noteBindingCollision {Nullifier Context Opening Commitment : Type} (com : Nullifier → Context → ℕ → Opening → Commitment) (w : BindingWitness (Credit.Note Nullifier Context) Opening) :
Crypto.Commitment.BindingCollision (Nullifier × Context × ℕ) Commitment Opening

Convert a binding witness for Credit.target com Prod.mk into a commitment binding collision over (nullifier, context, credit) triples.

def Cslib.Crypto.AnonymousToken.Conservation.noteBindingCollisionOrTrivial {Nullifier Context Opening Commitment : Type} [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] (com : Nullifier → Context → ℕ → Opening → Commitment) :
Option (BindingWitness (Credit.Note Nullifier Context) Opening) → Crypto.Commitment.BindingCollision (Nullifier × Context × ℕ) Commitment Opening

noteBindingCollision on a found witness. With no witness it returns a trivial pair that opens com default default 0 default twice to the same message, which is never a collision.

def Cslib.Crypto.AnonymousToken.Conservation.commitmentBindingReduction {Nullifier Context Opening Commitment PK SK Sig K : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] [Inhabited Sig] (com : Nullifier → Context → ℕ → Opening → Commitment) (S : Signature.Scheme PK SK (Commitment × ℕ) Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) :
K → ProbComp (Crypto.Commitment.BindingCollision (Nullifier × Context × ℕ) Commitment Opening)

Extracted-model reduction step, original to this library: runs bindingReduction for Credit.target com Prod.mk on noteForger, ignoring the commitment key. A witness with payloads (⟨nf₀, ctx₀, t₀, _⟩, r₀) and (⟨nf₁, ctx₁, t₁, _⟩, r₁) becomes the pair of openings of com nf₀ ctx₀ t₀ r₀ to (nf₀, ctx₀, t₀) under r₀ and to (nf₁, ctx₁, t₁) under r₁. With no witness, the output opens com default default 0 default twice to the same message, which is never a collision.

theorem Cslib.Crypto.AnonymousToken.Conservation.commitmentBindingReduction_eq {Nullifier Context Opening Commitment PK SK Sig K : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] [Inhabited Sig] (com : Nullifier → Context → ℕ → Opening → Commitment) (S : Signature.Scheme PK SK (Commitment × ℕ) Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) (k : K) :

Unfolding specification for commitmentBindingReduction at any key k.

theorem Cslib.Crypto.AnonymousToken.Conservation.bindingExperiment_prod_mk_le_commitment {Nullifier Context Opening Commitment PK SK Sig K : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] [Inhabited Sig] (com : Nullifier → Context → ℕ → Opening → Commitment) (CS : Crypto.Commitment.Scheme K (Nullifier × Context × ℕ) Commitment Opening) (hverify : ∀ (k : K) (nf : Nullifier) (ctx : Context) (t : ℕ) (c : Commitment) (o : Opening), CS.verify k (nf, ctx, t) c o = decide (com nf ctx t o = c)) (S : Signature.Scheme PK SK (Commitment × ℕ) Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) :

Extracted-model reduction step, original to this library: the target-binding success probability of noteForger under Credit.target com Prod.mk is at most the commitment-binding success probability of commitmentBindingReduction against a keyless scheme CS, one whose verifier accepts exactly when com nf ctx t o = c under every key (hverify). The reduction ignores the commitment key, so keyed commitments are out of scope.

theorem Cslib.Crypto.AnonymousToken.Conservation.extractedConservationExperiment_succProbability_le_prod_mk {Nullifier Context Opening Commitment PK SK Sig K : Type} [DecidableEq Nullifier] [DecidableEq Context] [DecidableEq Commitment] [Inhabited Nullifier] [Inhabited Context] [Inhabited Opening] [Inhabited Sig] (com : Nullifier → Context → ℕ → Opening → Commitment) (CS : Crypto.Commitment.Scheme K (Nullifier × Context × ℕ) Commitment Opening) (hverify : ∀ (k : K) (nf : Nullifier) (ctx : Context) (t : ℕ) (c : Commitment) (o : Opening), CS.verify k (nf, ctx, t) c o = decide (com nf ctx t o = c)) (S : Signature.Scheme PK SK (Commitment × ℕ) Sig) (A : ExtractedAdversary Nullifier Context Opening Commitment PK Sig) :

Extracted-model reduction step, original to this library: at tag = Prod.mk, any adversary winning the extracted credit-conservation game yields either a target forgery via targetForger or a commitment binding collision via commitmentBindingReduction, for a keyless scheme CS whose verifier accepts exactly when com nf ctx t o = c under every key (hverify).