Lean statements · FlashProve

What an accepted proof shows: the statement, the model, the verifier

Statements and definitions of FlashProve's Lean library, explained in words next to their Lean code.

What the Lean verification establishes. The Lean library puts together the following items.

  • (1) Model. A formally defined integer quantization modelNextToken of the model being served, as a function from weights and a list of tokens to the next token (§2, Appendix C).
  • (2) IOP. An interactive oracle proof flashProve for the claim that given output tokens are this model's output on a given prompt, at committed weights. It is formalized as a holographic IOP (§3, Appendix A).
  • (3) Compilation. The BCS compilation compile (flashProve setup) of (2) in the random oracle model (§4).
  • (4) Security. Proofs that (3) is complete, sound and statistically zero knowledge in the random oracle model. Formally, these are the six theorems in Final statements, which hold for public files that form a public setup (A public setup).
  • (5) Hash function. A definition of BLAKE2b in Lean, and blake2bHash, the hash function on bit strings built from it (Appendix B).
  • (6) Fiat–Shamir verifier. leanVerifier, which the cards call the Lean verifier: the verifier of (3) with blake2bHash in place of the random oracle (its definition is in Final statements). Under the Fiat–Shamir heuristic it inherits the soundness proved in (4).
  • (7) Executable verifier. executableVerifier, a Lean function that can be run and is proved to return the verdict of leanVerifier (the theorem executableVerifier_eq_leanVerifier, also in Final statements).

Goals. FlashProve's code is cryptographic and was largely written by AI systems. Formal verification is meant to make its security independent of trust in that code. Items (1) to (4) specify the protocol in Lean and prove completeness, soundness and zero knowledge in the random oracle model (the precise forms are under “The statements, at a glance”, below). The following gaps remain.

  • The statements must say what is meant. Lean does not check this. A person has to read the statements and the definitions under them, and this page is for that.
  • The programs that run must implement (3). How this is addressed depends on the property.
    • Soundness depends on the verifier alone. Items (5) to (7) provide one that can be run. Nothing is proved about the faster C++ verifier.
    • Completeness concerns honest parties and can be tested: run a prover, then the verifier of (7) on its output (Running the verifier).
    • Zero knowledge depends on the prover alone. A prover program has to be audited against the honest prover of (3), which is a Lean definition that cannot be run and of which this page shows only part (§6).

In particular, a reader who only needs to trust the verifier has to:

  • read the definition Sound (§1) and the theorem sound of (4);
  • read the definitions of the compiler's verifier in (3) (§4.2, §4.3) and the definition (6);
  • read the theorem executableVerifier_eq_leanVerifier of (7);
  • skim the definitions of the model (1) and of BLAKE2b (5);
  • check the conditions on the public files (A public setup); the verifier does not test that they specify exact match.

That executableVerifier is then sound is a conclusion, not a theorem. By the theorem of (7) it returns the verdict of leanVerifier on the files of a public setup, and that leanVerifier is sound rests on the Fiat–Shamir heuristic of (6) and on assumptions listed in §11. The conclusion is about the Lean function executableVerifier; what a run of the command lean-verify adds to it is described in Running the verifier.

Checking the proofs yourself. To check the proofs, go to the directory lean/ of this repository and run lake exe cache get && LEAN_ABORT_ON_PANIC=1 lake build to compile and type-check the library. A build does not fail on an unfinished proof or on an added axiom. For these, and for a second check of every compiled module by Lean's kernel, run python3 -B scripts/check.py afterwards: it rebuilds the library in a scratch copy, replays it in the kernel and verifies that no declaration depends on an axiom other than Lean's standard ones (propext, Classical.choice, Quot.sound). On the machine used for this release (84 cores, 960 GiB of memory) the script took four and a half hours; lean/CHECKING.md gives the steps, the requirements and what a pass shows. For standard guidelines see the chapter “Validating a Lean Proof” of the Lean reference manual (lean-lang.org/doc/reference/latest/ValidatingProofs/). Lean's kernel is trusted, not proved correct, and the pinned version, 4.29.1, predates fixes for publicly known soundness bugs in the kernel (§11).

Further down

  • A public setup, in “What the theorems refer to”, lists the conditions. The library defines one public setup, namely the public files of a stored example with synthetic weights.
  • Running the verifier says what the command lean-verify evaluates, what is proved about it, where files are parsed, what is trusted, and what was run.
  • §4 opens with the definitions of the compiler's verifier.
  • Limits and gaps are listed in §11, lean/LIMITS.md and lean/GAPS.md. §11 also says what this page contains and what it does not show.
The statements, at a glance
Summaries. §1 and §6 state the properties for any argument system (the cards Sound, CompleteOn and ZeroKnowledgeOn); the six theorems state them for FlashProve, with the numbers given in §4.4, under "The numbers".
Soundness (§1)
Foranyone who relies on a proof
Given
  • a committer, which returns a commitment to weights (256 bits)
  • a prover, which returns a prompt, output tokens and a proof
  • together they make at most t queries to the hash function
Event
  • the verifier accepts
  • the output tokens are not those of the model with the weights that a fixed extractor reads from the commitment and the committer's hash queries, on the prompt
ThenPr[event] ≤ ε(t), over a hash function sampled uniformly at random and the committer's and the prover's coins
In LeanVerifiableInference.Sound
Completeness (§6.1)
Forthe provider
Given
  • weights
  • a request that can be served (CanServe), whose output tokens are the model's
Eventthe verifier rejects the honest proof
ThenPr[event] ≤ α
In LeanVerifiableInference.CompleteOn
Zero knowledge (§6.3)
Forthe provider
Given
  • weights
  • a malicious verifier with at most t queries to the hash function, which is given the commitment and up to N proofs
  • each request may depend on the verifier's view so far and on the weights; it can be served (CanServe), and its output tokens are the model's
Thenone simulator, fixed before the weights, that gets each request and nothing about the weights produces the verifier's view up to statistical distance ζ, for t and N up to two given numbers (in the theorem zeroKnowledgeOnCanServe: 2^64 hash queries and 688,127 replies)
Not covered
  • The simulator may depend on the three public files, and a fitted model's scale file is made from its weights: what these files reveal about the weights is not covered
  • Whether a request can be served depends on the weights, and that is not hidden
  • The statement by itself says nothing about a refused request: with refusedHandsOutNoProof it gives zero knowledge at every request, within the same bound, in which the simulator is told one bit for each request: served or refused (a request is refused if it is ill-formed, if the model has no result on it, or if its result is other tokens)
  • All that is not covered: §6.3
RemarkThe compiled system has no public parameters (PublicParameters := Unit, §4.3), so at its start the simulator is given nothing about the weights
In LeanVerifiableInference.ZeroKnowledgeOn
Card types
Statement
A Lean definition of type Prop: a sentence about an argument system.
Theorem
Proved in Lean.
Definition
A definition that the statements or the verifier are written in.

Final statements

Six theorems (the repository's other pages call them the six lines) and one definition, the Lean verifier, about one argument system, compile (flashProve setup). In each of them:

  • setup is a public setup (PublicSetup): three public files that meet four conditions (see A public setup below and FilesInUse in §4.4);
  • flashProve setup is the input of compile for these files.

Both are described on cards in the next section.

The six theorems:

TheoremSoundnessAtFullSide/Face/TheSixLines.lean:93
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 93–93
Given, then
  • a public setup setup (PublicSetup)
  • a cheating committer and prover with q hash queries in total make the verifier accept output tokens that are not the model's, at the weights that one extractor returns on the commitment and the committer's hash queries, with probability at most finalSoundnessError q, about q / 2^124 + 2^-101
theorem sound (setup : PublicSetup) : Sound (compile (flashProve setup)) finalSoundnessError
Not covered
  • finalSoundnessError q, about q / 2^124 + 2^-101, is a bound on the soundness error, not a security level.
  • Public files whose policy is not exact match (the verifier does not test whether it is); a provider that chooses its public files after seeing the hash function.
Remark

Soundness requires only FilesTaken (§4.4) and holds for every choice of honest provers and settings. This more general theorem has no card on this page (Johnson/Face/FinalSoundProof.lean:24; see the remark in §1); sound is proved by applying it to the setup's files. The public setup requires more because of the other theorems.

TheoremSoundness with bindingAtFullSide/Face/TheSixLines.lean:99–100
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 99–100
Given

a public setup setup (PublicSetup)

theorem soundAndBinding (setup : PublicSetup) :
Then

soundness and binding, with the same extractor and bound for both: the soundness clause also holds with error finalBindingError q, and the commitment cannot be opened to weights other than the extractor's, except with probability finalBindingError q, about q / 2^124 + 2^-100, where q bounds the total number of hash queries of whoever made the commitment and of the prover (in the soundness clause) or the opener (in the binding clause)

SoundAndBinding (compile (flashProve setup)) finalBindingError
Not covered
  • An opening consists of weights and one number for the committer's randomness. This covers fewer openings than arbitrary coins would: nothing is said about an opening in which the salts of the first table's leaves (the first table: §4.3) have a different public prefix or length. For a small coinBound, binding would say almost nothing: at 0 there is only one choice of coins. For the honest provers and settings of the six theorems, the bound excludes none of the committer's choices of coins: coinBound + 1 is the committer's whole range, and for the files of a public setup every pair of an encoding randomness of the first table and a member of the list of its salts is given by a number at most coinBound (a theorem: AtFullSide/Face/FinalBindingOpeningsAtHonestProversAndSettingsOf.lean:39). No value is given for coinBound.
  • The statement does not say whose weights the extractor outputs.
  • Nothing is said about two openings to the same weights, or about several commitments.
  • The commitment is computed from the first table's Merkle root, its out-of-domain sample and part of what is read from the public files (§4.3); it does not cover the offline proof, the copies or their link proofs.
  • Public files whose policy is not exact match (the verifier does not test whether it is); a provider that chooses its public files after seeing the hash function.
TheoremCompleteness, for requests that can be served and whose claimed output is the model'sAtFullSide/Face/TheSixLines.lean:106–108
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 106–108
Given

a public setup setup (PublicSetup)

theorem completeOnCanServe (setup : PublicSetup) :
Then

for all weights, at every request that can be served (CanServe) and whose output tokens are the model's,

CompleteOn (compile (flashProve setup)) (CanServe (settingsOfRead setup.readParameters))

the honest proof is rejected with probability at most 2^-40

finalCompletenessError
Not covered
  • Nothing is said about requests outside CanServe, including those where the model has no result, or about outputs that are not the model's.
  • Which requests can be served depends on the weights.
Remark

At a request outside CanServe, or whose output is not the model's, the honest prover's reply is the empty proof (refusedHandsOutNoProof).

TheoremZero knowledge, for requests that can be served and whose claimed output is the model'sAtFullSide/Face/TheSixLines.lean:122–127
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 122–127
Given

a public setup setup (PublicSetup)

theorem zeroKnowledgeOnCanServe (setup : PublicSetup) :
Exists

a bound error, a function of a number of hash queries and a number of replies

∃ error : ℕ → ℕ → ℝ≥0∞,
(1) Then

it is at most finalZeroKnowledgeError, 2^-154, for up to 2^64 hash queries and 688,127 replies

(∀ asked replies, asked ≤ finalVerifierQueries → replies ≤ finalReplyCount →
error asked replies ≤ finalZeroKnowledgeError) ∧
(2) Then

zero knowledge within this bound on the requests that can be served and whose output tokens are the model's, with its own simulator, which may depend on the public setup and in the experiment is given no part of the weights: only the largest number of proofs, the verifier's hash queries and each request's prompt and output tokens

ZeroKnowledgeOn (compile (flashProve setup))
(CanServe (settingsOfRead setup.readParameters)) error
Not covered
  • What the public files reveal about the weights is not counted: the simulator may depend on these files.
  • Whether a request can be served depends on the weights, and that is not hidden: the chooser of requests (§6.2) may know the weights and is the same in both experiments.
  • By itself, it says nothing about refused requests.
  • One request per proof and one commitment are covered, not batches.
Remark

With refusedHandsOutNoProof it implies zeroKnowledgeAtEveryRequest (§6.3) within the same bound, finalZeroKnowledgeError, where the simulator is given one bit per request: served or refused. Hence, for every well-formed request of its choice, a verifier learns whether the claimed output is the model's result (§6.3).

The error function is existentially quantified, not a named function: the statement says that there is one and that it is at most finalZeroKnowledgeError within the stated limits on queries and replies; ZeroKnowledgeOn takes it as an argument.

TheoremFor a refused request the honest prover returns only the empty proofAtFullSide/Face/TheSixLines.lean:134–138
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 134–138
Given

a public setup setup (PublicSetup)

theorem refusedHandsOutNoProof (setup : PublicSetup) :
Then

every reply that the prover can return

HandsOutNoProof (compile (flashProve setup))

at a refused request (a request is refused if it is ill-formed, if the model has no result on it, or if its result is other tokens)

(fun weights request =>
requestOutcome (settingsOfRead setup.readParameters) weights request = .refused)

is the empty proof

isNoProof
Not covered

That a refusal is justified: an empty proof proves nothing, and a prover can return it for a request that it could serve.

Remark

With zeroKnowledgeOnCanServe it implies zero knowledge for every request, where the simulator is given one bit per request: served or refused (§6.3). Full statement: §6.1.

TheoremThe stated number of replies, the columns that they open and the honest committer's and prover's hash queries fit within their budgetsAtFullSide/Face/TheSixLines.lean:144–148
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 144–148
Given

a public setup setup (PublicSetup)

theorem repliesFit (setup : PublicSetup) :
(1) Then

688,127 (finalReplyCount) is at most onlineRunsPerCopy setup, the number of runs of the online IOP that the honest settings assign to one copy

finalReplyCount ≤ onlineRunsPerCopy setup ∧
(2) Then

with that many runs, the columns opened by the proofs fit each table's budget (TableBudgetFits)

(∀ reading, TableBudgetFits ((flashProve setup).settings reading).furtherCopies
(onlineRunsPerCopy setup)) ∧
(3) Then

one run each of the honest sampler of commitment randomness, the honest committer and the honest prover together make at most 2^48 hash queries

WithinBudget (compile (flashProve setup)) honestQueryBudget
Not covered

The prover does not count replies, so nothing in it enforces the first two.

Remark

The theorems on zero knowledge hold for up to 688,127 replies. Each reply, including a refused reply (the empty proof), is counted as one run of the online IOP; the statements contain only the count (the Lean comment says "is one run").

onlineRunsPerCopy is also the numeric literal 688,127, so (1) compares two literals. (2) relates that number to a table: 62 + 688,127 · 64 columns do not exceed a copy's 44,040,191.

(1) and (2) are conditions on numbers used in the proof of zero knowledge, which is why this theorem is one of the six. Copies are described in §6.4.

In the theorems on soundness, binding, completeness and zero knowledge, the hash function is sampled at random. The honest committer and prover are Lean definitions, not programs.

The Lean verifier:

DefinitionThe Lean verifier: the compiled verifier with BLAKE2bAtFullSide/Face/TheSixLines.lean:155–157
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 155–157
Given

a public setup setup (PublicSetup), a commitment, a prompt, output tokens, a proof

def leanVerifier (setup : PublicSetup) :
Commitment → List Token → List Token → (compile (flashProve setup)).Proof → Bool :=
Value

the compiled verifier with each of its hash queries answered by blake2bHash, the hash function on bit strings built from BLAKE2b

(compile (flashProve setup)).accepts blake2bHash
Not covered
  • As a definition it cannot be run: parts of the verifier's term are defined by the axiom of choice, among them the one-to-one coding of its hash queries (lean/GAPS.md, 56).
  • The six theorems apply to a run only insofar as the run is proved to return this term's value. §5 describes what the command lean-verify runs and what is proved about it. In the Lean comment, "a second Lean text" means that executable form: a second implementation of the verifier in Lean.

As a definition, leanVerifier cannot be run: parts of the verifier's term are defined using the axiom of choice, including the injective encoding of its hash queries. We therefore provide a second, executable verifier written in Lean, executableVerifier, and prove its equality to leanVerifier.

TheoremThe executable verifier equals the Lean verifierAtFullSide/Face/ExecutableVerifierIsLeanVerifier.lean:47–50
In words
In Lean · AtFullSide/Face/ExecutableVerifierIsLeanVerifier.lean, lines 47–50
Given

a public setup (PublicSetup), a commitment, a prompt, output tokens and a parsed proof (FormBytes: five files from a parser outside Lean, and further tokens; elsewhere on this page: the proof as submitted)

theorem executableVerifier_eq_leanVerifier (setup : PublicSetup) (commitment : Commitment)
(prompt output : List Token) (proof : FlashProve.FormBytes) :
Then

on the setup's three public files and these inputs, executableVerifier returns a verdict (never none), and it equals that of leanVerifier

executableVerifier setup.files commitment prompt output proof =
some (leanVerifier setup commitment prompt output proof)
Not covered
  • The theorem applies only when the public files are those of a public setup (the argument setup.files). The command lean-verify does not enforce this: it does not reject public files that specify a policy other than exact match (A public setup).
  • The command lean-verify calls, one after another, the parts of the Lean function verdictOf. verdictOf parses the claim from the user's files (claimOf) and applies executableVerifier to it (verdictOf_eq_executableVerifier, proved by unfolding definitions). No theorem shows that claimOf implements the file format, and no theorem covers the parser outside Lean or the run itself. The other assumptions of a run are listed in Running the verifier.
Remark
  • This is an equation between values of deterministic Lean functions. It involves no random oracle and makes no security claim.
  • No theorem says that leanVerifier, executableVerifier or verdictOf is sound at BLAKE2b. Soundness is proved with the hash function sampled at random. That it carries over to leanVerifier at BLAKE2b is the Fiat–Shamir heuristic, an assumption.
  • Like leanVerifier, executableVerifier also uses the protocol's second, fixed hash function, which is not modelled as a random oracle (The second hash function).
  • The card of executableVerifier (§5) says what "executable" means.

What the theorems refer to

A public setup

A public setup consists of three public files (a parameter file, a layout file and a scale file) that satisfy four conditions (FilesInUse, §4.4):

  • They are in the verifier's scope. The layout file is the layout file of the stored full-size example. The parameter file agrees byte for byte with that example's parameter file, except for eight numbers: five numbers of the normalizations and the three numbers of the acceptance policy. The third condition below fixes the three policy numbers, so only the five numbers of the normalizations are free in the parameter file.
  • They parse without error.
  • They specify the exact-match policy: every output token must be the model's own choice (greedy decoding). The verifier does not check this condition.
  • They pass the test protocolDataWellFormed, which the verifier also performs: the protocol's data can be built from them without error, no list of rounds is empty, the data for the key and for the proof have the full-size depth, and the sizes lie within fixed limits.

The library defines one public setup, storedSetup (§4.4), as a Lean term. No theorem relates it to a file on disk; a program outside Lean compares it with the files of the shipped example.

Three definitions that the theorems use. A fourth, onlineRunsPerCopy, is in §6.4.

DefinitionThe public setup: three public filesAtFullSide/Face/TheSixLines.lean:69–75
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 69–75

Three public files that a user has in addition to the commitment, fixed before the hash function is sampled. They determine the model shape and the instance of the protocol; only the scale file and five numbers of the parameter file (parameters of the normalizations) are free.

structure PublicSetup where
Files

files: the parameter file, the layout file and the scale file

/-- The three public files. -/
files : PublicFiles

readParameters: what reading the files returns

/-- What the reader returns at them. -/
readParameters : Inst.Model.ScalesAndPolicy
Condition

the field inUse requires (FilesInUse, §4.4):

  • that the verifier takes them
  • that reading them returns readParameters
  • that their policy is exact match
  • that they pass the test protocolDataWellFormed: the protocol's data can be built from them without error, no list of rounds is empty, the data for the key and for the proof have the full-size depth, and the sizes are within fixed limits; the test is treated as a black box on this page
/-- They are in scope, read so, state exact match and pass the test. -/
inUse : FilesInUse files readParameters
Not covered

The files are not the PublicParameters of an argument system (§1), which compile sets to Unit. What the files reveal about the weights (a fitted model's scale file is derived from its weights) is not covered by the theorems on zero knowledge (§6.3).

For some valid choices of the quantization scales, the outputs of the value and up projections are all zero, so no layer changes the residual stream (checked by hand, not proved: the head of Cm/Rel2Idle.lean, on sIdle, to which the comment on weightsAreValid in VerifiableInference/ModelWeights.lean points); for public files that state such settings the theorems say little. A reader has to inspect the scale file.

Remark

storedSetup (below) is the only public setup that the library exhibits. That its files form a public setup is a theorem (filesInUse_stored). Its scale file is that of an example with synthetic weights (according to the head comment of Ladder/Stored.lean; no theorem).

Whoever commits writes the scale file.

DefinitionFlashProve at a public setup: the input to compileAtFullSide/Face/TheSixLines.lean:82–84
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 82–84

The input to compile: not a bare interactive oracle proof, but a record that contains the protocol with its layout into hash queries. There is one for each public setup: FlashProve is a family of protocols.

The protocol uses a second hash function, secondHashFunction, a fixed function that is not modelled as a random oracle (§5).

def flashProve (setup : PublicSetup) : Compilable :=
Value

flashProveAtFiles (§4.4) with its three arguments determined by the public setup:

  • the files
  • the model's settings read from them
flashProveAtFiles setup.files (settingsOfRead setup.readParameters)
  • the honest provers and settings
(honestProversAndSettings setup.files (settingsOfRead setup.readParameters))
Remark

The protocol is a linkable holographic IOP (§3):

  • an encoder and a decoder for the index (here: made from the weights)
  • an out-of-domain sample on each encoding
  • three IOPs, each meant to prove one statement:
    • offline: one encoding decodes
    • link: two encodings decode to the same index
    • online: a request's claim holds of the index that an encoding decodes to

Holographic IOPs and their compilation are defined in Fractal, ePrint 2019/1076 (§3).

DefinitionThe honest provers and settings, as a closed termAtFullSide/Face/HonestProversAndSettingsValue.lean:32
In words
In Lean · AtFullSide/Face/HonestProversAndSettingsValue.lean, lines 32–32

The honest provers and settings of the six theorems: a single closed term that gives, for every choice of public files and settings:

  • the three honest IOP provers
  • the honest committer's and prover's settings: what they choose in addition to the provers, including the public prefixes of their salts, how long a search for a nonce may run, and a fall-back instance

It contains no committer: compile constructs the honest committer.

It is a definition, not a program: it obtains the model's trace by a non-constructive choice.

The verifier reads none of it.

noncomputable def honestProversAndSettings : HonestProversAndSettings := honestProversAndSettingsOf thePartsAt
Not covered

A black box on this page: it depends on about 16,000 named declarations of this library, of which the page shows about five hundred.

Remark

The provers consist of parts (in Lean: senders), one for each step of the protocol. Where a function called by such a part refuses, the part sends a fixed default value and does not stop.

  • There are some two dozen such places, listed in E2E/TheHonestProverStatements.lean, section 3.
  • The statements are about the provers as defined, including these default values; it is not shown that they are never used.

The numbers in these theorems:

  • finalSoundnessError q = 16 (q + 1 + 2^23) / 2^128 + (q + 2^23 + 3)^2 / 2^256, about q / 2^124 + 2^-101
  • finalBindingError q: about q / 2^124 + 2^-100
  • finalCompletenessError = 2^-40
  • finalZeroKnowledgeError = 2^-154
  • finalVerifierQueries = 2^64
  • finalReplyCount = 688,127
  • honestQueryBudget = 2^48

§4.4 specifies whose hash queries q counts.

At the library's stored example of the public files, with no argument setup:

TheoremSoundness and binding, for the stored public filesAtFullSide/Face/TheSixLines.lean:252–253
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 252–253

The theorem soundAndBinding at storedSetup, the library's stored example of the three public files (a Lean value not tied to any file on disk): a closed statement, with no parameters.

theorem soundAndBinding_stored :
SoundAndBinding (compile (flashProve storedSetup)) finalBindingError
The stored public files, and the theorems on soundness, completeness and zero knowledge for them · 4 cards
DefinitionThe stored public files, as a public setupAtFullSide/Face/TheSixLines.lean:244
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 244–244

The library's stored full-size example of the three files (VerifierAndGoals.storedPublicFiles, a Lean value not tied to any file on disk), with what reading it returns, chosen non-constructively. It is not stated here that these are the released files.

def storedSetup : PublicSetup := ⟨storedPublicFiles, storedParameters, filesInUse_stored⟩
TheoremSoundness, for the stored public filesAtFullSide/Face/TheSixLines.lean:247
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 247–247

The theorem sound at storedSetup.

theorem sound_stored : Sound (compile (flashProve storedSetup)) finalSoundnessError
TheoremCompleteness, for the stored public filesAtFullSide/Face/TheSixLines.lean:258–260
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 258–260

The theorem completeOnCanServe at storedSetup.

theorem complete_stored :
CompleteOn (compile (flashProve storedSetup))
(CanServe (settingsOfRead storedSetup.readParameters)) finalCompletenessError
TheoremZero knowledge, for the stored public filesAtFullSide/Face/TheSixLines.lean:265–270
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 265–270

The theorem zeroKnowledgeOnCanServe at storedSetup.

theorem zeroKnowledge_stored :
∃ error : ℕ → ℕ → ℝ≥0∞,
(∀ asked replies, asked ≤ finalVerifierQueries → replies ≤ finalReplyCount →
error asked replies ≤ finalZeroKnowledgeError) ∧
ZeroKnowledgeOn (compile (flashProve storedSetup))
(CanServe (settingsOfRead storedSetup.readParameters)) error

1. Soundness

  • A committer outputs a commitment of 256 bits. The commitment, together with the committer's queries to the hash function and their answers, determines at most one choice of weights: a fixed extractor, a function that is not shown to be computable, outputs it from these.
  • Let t₁ bound the committer's queries, and consider any prover that runs afterwards and makes at most t₂ queries. Except with probability at most ε(t₁ + t₂), over the hash function and the random choices of the committer and the prover, the output tokens that the verifier accepts are the output of the model with these weights on the prompt. This bounds the probability of a false accept, not the conditional probability that an accepted output is false.
  • By a separate clause (§1.1), an opener with at most t₂ queries outputs an opening to other weights with probability at most ε(t₁ + t₂). The same weights can have many commitments, because the honest committer computes the commitment from the weights and its own randomness.

Randomized and deterministic algorithms, queries to the hash function, query logs and probabilities are those of the random oracle model (§8).

DefinitionAn argument system: the model, the honest committer, the honest prover, the verifierVerifiableInference/Statements.lean:36–59
In words
In Lean · VerifiableInference/Statements.lean, lines 36–59

a structure of four types and six functions

structure ArgumentSystem where
Types

what a commitment commits to: the weights of one model

/-- What a commitment commits to: the weights of one model. -/
Weights : Type

the public parameters: a part of the weights that the simulator is given at its start (§6.2), and the function that computes it; anything else that a simulator is given about the weights is a parameter of the statement (§6.3)

/-- What proofs may reveal of the weights (exactly: what `simulatedExperiment` hands to
`Simulator.start`, which makes the commitment from it). -/
PublicParameters : Type
/-- The part of the weights that proofs may reveal. -/
publicParameters : Weights → PublicParameters

the committer's randomness

/-- The committer's randomness. -/
CommitmentRandomness : Type

a proof

/-- A proof. -/
Proof : Type
Model

the model: a function mapping weights and a list of tokens to the next token, or to nothing if the model has no value on these tokens. It neither queries the hash function nor samples randomness.

/-- The model: the next token after the given tokens; `none` where the model has no value on
them. -/
nextToken : Weights → List Token → Option Token
Committer

the honest committer: it samples its randomness, computes the commitment to the weights under it, publishes the commitment and keeps the randomness

/-- The honest committer, first step: it samples its randomness. -/
sampleCommitmentRandomness : RandomizedAlgorithm CommitmentRandomness
/-- The honest committer, second step: the commitment to the weights under that randomness. -/
commit : Weights → CommitmentRandomness → DeterministicAlgorithm Commitment
Prover

the honest prover: computes a proof from the weights, the committer's randomness, a prompt and output tokens. It may sample randomness and query the hash function.

/-- The honest prover: from the weights, the committer's randomness, a prompt and output tokens, a
proof. -/
prove : Weights → CommitmentRandomness → List Token → List Token → RandomizedAlgorithm Proof
Verifier

the verifier: maps a commitment, a prompt, output tokens and a proof to a decision. It is deterministic (DeterministicAlgorithm) and accesses the hash function only through queries.

/-- The verifier: from a commitment, a prompt, output tokens and a proof, a decision. -/
verify : Commitment → List Token → List Token → Proof → DeterministicAlgorithm Bool
DefinitionThe output tokens are the model'sVerifiableInference/Statements.lean:69–72
In words
In Lean · VerifiableInference/Statements.lean, lines 69–72
Given

an argument system, weights, a prompt, output tokens

def ArgumentSystem.IsModelOutput (system : ArgumentSystem) (weights : system.Weights)
(prompt output : List Token) : Prop :=
Holds if

for every position of the output tokens:

∀ position (h : position < output.length),

the model's next token, after the prompt followed by the output tokens before that position, is the output token at that position

system.nextToken weights (prompt ++ output.take position) = some output[position]
Not covered

The empty output has no position to check, so it is the model's output for every prompt and all weights, and when the extractor outputs weights, Sound does not count its acceptance as a failure (§11).

StatementSoundness: accepted output tokens are those of the model with the extracted weightsVerifiableInference/Statements.lean:84–99
In words
In Lean · VerifiableInference/Statements.lean, lines 84–99
Given
  • an argument system system (the structure above)
  • a bound ε, a function of a number of queries to the hash function
def Sound (system : ArgumentSystem) (ε : ℕ → ℝ≥0∞) : Prop :=
Exists

one function extractor, mapping a commitment and a query log to weights or nothing

∃ extractor : Commitment → QueryLog → Option system.Weights,
For all

committer: a randomized algorithm that makes at most committerQueries queries to the hash function and returns a commitment and a state of arbitrary type, passed to the prover

∀ (committerQueries proverQueries : ℕ) (State : Type)
(committer : RandomizedAlgorithm (Commitment × State)),
committer.QueryBound committerQueries →

prover: a randomized algorithm that makes at most proverQueries queries, is given the state and returns a prompt, output tokens and a proof

∀ prover : State → RandomizedAlgorithm (List Token × List Token × system.Proof),
(∀ state, (prover state).QueryBound proverQueries) →
Run

The hash function is sampled uniformly at random. Then:

Prob (do

the committer runs; queryLog is the list of its queries with their answers

let ((commitment, state), queryLog) ← committer.withQueryLog

the prover runs

let (prompt, output, proof) ← prover state

the verifier of system decides

let accepted ← (system.verify commitment prompt output proof).toRandomized

result: what extractor outputs on the commitment and the query log; the prompt; the output tokens; the decision

pure (extractor commitment queryLog, prompt, output, accepted))
Event
  • the verifier accepts
  • extractor does not return weights for which the output tokens are the model's on the prompt (IsModelOutput, the card above)
{(extracted, prompt, output, accepted) |
accepted = true ∧
¬ ∃ weights, extracted = some weights ∧ system.IsModelOutput weights prompt output}
Then

Pr[event] ≤ ε(committerQueries + proverQueries)

≤ ε (committerQueries + proverQueries)

The theorem sound. For every public setup, the compiled argument system compile (flashProve setup), with the model settings read from the public files, satisfies Sound (above) with the error function finalSoundnessError.

Expanded. There is an extractor such that, for every committer with at most t₁ queries to the random oracle and every prover with at most t₂ queries, the following event has probability at most finalSoundnessError (t₁ + t₂): the verifier accepts output tokens that are not the model's output with the weights that the extractor outputs, given the commitment and the committer's queries.

  • The probability is taken over the random oracle and the coins of the two adversaries.
  • The prover chooses the prompt and the output tokens, and the committer passes its state to the prover.
  • If the extractor outputs no weights, every accepted proof counts toward this event.

Remark. The proof of sound uses sound_of_verify_at (Johnson/Goal/Skeleton/SoundOfVerifyAt.lean:69), the soundness theorem for verify, FlashProve's verifier. Its three hypotheses are the fields of FilesTaken. Soundness of compile at flashProveAtFiles follows from sound_of_verify_at for arbitrary honest provers and settings (Johnson/Face/FinalSoundProof.lean:24).

1.1 With a binding commitment

SoundAndBinding has a second clause, on openings of the commitment. An opening of a commitment to given weights is a pair of these weights and commitment randomness on which commit returns that commitment. The clause states the following. For every committer with at most committerQueries queries, and every opener with at most proverQueries queries that is given the committer's state, the probability that the opener outputs an opening of the committer's commitment to weights that the extractor does not output is at most ε(committerQueries + proverQueries).

SoundOpened is a statement without an extractor. SoundAndBinding with error ε implies SoundOpened with error 2 ε. The library proves SoundOpened for the compiled system, for public files that satisfy FilesInUse, with the bound 2 · finalBindingError (finalSoundOpened_value, AtFullSide/Face/FinalBindingAtTheValue.lean; no card on this page).

StatementSoundness with a binding commitmentVerifiableInference/Statements.lean:109–134
In words
In Lean · VerifiableInference/Statements.lean, lines 109–134
Given
  • an argument system system (§1)
  • a bound ε, a function of the number of queries to the hash function
def SoundAndBinding (system : ArgumentSystem) (ε : ℕ → ℝ≥0∞) : Prop :=
Exists

one function extractor, mapping a commitment and a query log to weights or nothing

∃ extractor : Commitment → QueryLog → Option system.Weights,
For all

committer: a randomized algorithm that makes at most committerQueries queries to the hash function and returns a commitment and a state of arbitrary type, passed to the next algorithm

∀ (committerQueries proverQueries : ℕ) (State : Type)
(committer : RandomizedAlgorithm (Commitment × State)),
committer.QueryBound committerQueries →
(1) For all

prover: a randomized algorithm that makes at most proverQueries queries, is given the state and returns a prompt, output tokens and a proof

(∀ prover : State → RandomizedAlgorithm (List Token × List Token × system.Proof),
(∀ state, (prover state).QueryBound proverQueries) →
Run

The hash function is sampled uniformly at random. Then:

Prob (do

the committer runs; queryLog is the list of its queries with their answers

let ((commitment, state), queryLog) ← committer.withQueryLog

the prover runs

let (prompt, output, proof) ← prover state

the verifier of system decides

let accepted ← (system.verify commitment prompt output proof).toRandomized

result: what extractor outputs on the commitment and the query log; the prompt; the output tokens; the decision

pure (extractor commitment queryLog, prompt, output, accepted))
Event
  • the verifier accepts
  • extractor does not return weights for which the output tokens are the model's on the prompt (IsModelOutput, §1)
{(extracted, prompt, output, accepted) |
accepted = true ∧
¬ ∃ weights, extracted = some weights ∧ system.IsModelOutput weights prompt output}
Then

Pr[event] ≤ ε(committerQueries + proverQueries)

≤ ε (committerQueries + proverQueries)) ∧
(2) For all

opener: a randomized algorithm that makes at most proverQueries queries, is given the state and returns weights and commitment randomness

(∀ opener : State → RandomizedAlgorithm (system.Weights × system.CommitmentRandomness),
(∀ state, (opener state).QueryBound proverQueries) →
Run

The hash function is sampled uniformly at random. Then:

Prob (do

the committer runs; its query log is recorded

let ((commitment, state), queryLog) ← committer.withQueryLog

the opener runs

let (weights, randomness) ← opener state

recomputed: the commitment to the opener's weights under the opener's randomness, as the honest committer computes it

let recomputed ← (system.commit weights randomness).toRandomized

result: the output of extractor; the committer's commitment; the opener's weights; recomputed

pure (extractor commitment queryLog, commitment, weights, recomputed))
Event
  • recomputed is the committer's commitment
  • extractor does not output the opener's weights
{(extracted, commitment, weights, recomputed) |
recomputed = commitment ∧ extracted ≠ some weights}
Then

Pr[event] ≤ ε(committerQueries + proverQueries)

≤ ε (committerQueries + proverQueries))

The theorem soundAndBinding. For every public setup, compile (flashProve setup) satisfies SoundAndBinding (above) with the error function finalBindingError. The two clauses share one extractor and one committer. In both clauses the bound is finalBindingError (t₁ + t₂), where t₁ bounds the committer's queries to the random oracle and t₂ those of the prover or the opener. For this system, the commitment randomness in an opening is a single number.

StatementSoundness for an opened commitmentVerifiableInference/Statements.lean:142–155
In words
In Lean · VerifiableInference/Statements.lean, lines 142–155
Given
  • an argument system system
  • a bound ε
def SoundOpened (system : ArgumentSystem) (ε : ℕ → ℝ≥0∞) : Prop :=
For all

adversary: one randomized algorithm that makes at most queries queries to the hash function and returns a commitment, weights with commitment randomness, a prompt, output tokens and a proof

∀ (queries : ℕ)
(adversary : RandomizedAlgorithm
(Commitment × (system.Weights × system.CommitmentRandomness) ×
(List Token × List Token × system.Proof))),
adversary.QueryBound queries →
Run

The hash function is sampled uniformly at random. Then:

the adversary runs

Prob (do
let (commitment, (weights, randomness), (prompt, output, proof)) ← adversary

recomputed: the commitment to the adversary's weights under its randomness, as the honest committer computes it

let recomputed ← (system.commit weights randomness).toRandomized

the verifier of system decides, given the adversary's commitment

let accepted ← (system.verify commitment prompt output proof).toRandomized

result: both commitments; the weights; the prompt; the output tokens; the decision

pure (commitment, recomputed, weights, prompt, output, accepted))
Event
  • recomputed is the adversary's commitment
  • the verifier accepts
  • the output tokens are not the model's on the prompt, for the adversary's weights
{(commitment, recomputed, weights, prompt, output, accepted) |
recomputed = commitment ∧ accepted = true ∧ ¬ system.IsModelOutput weights prompt output}
Then

Pr[event] ≤ ε(queries)

≤ ε queries
TheoremSoundness with a binding commitment implies soundnessVerifiableInference/Checks.lean:41–42
In words
In Lean · VerifiableInference/Checks.lean, lines 41–42
Given
  • an argument system system
  • a bound ε
  • SoundAndBinding system ε
theorem sound_of_soundAndBinding (system : ArgumentSystem) (ε : ℕ → ℝ≥0∞)
(h : SoundAndBinding system ε) :
Then

Sound system ε

Sound system ε
TheoremSoundness with a binding commitment implies soundness for an opened commitment, with 2 ε in place of εVerifiableInference/Checks.lean:48–50
In words
In Lean · VerifiableInference/Checks.lean, lines 48–50
Given
  • an argument system system
  • a bound ε
  • SoundAndBinding system ε
theorem soundOpened_of_soundAndBinding (system : ArgumentSystem) (ε : ℕ → ℝ≥0∞)
(h : SoundAndBinding system ε) :
Then

SoundOpened system, with the bound 2 ε(queries)

SoundOpened system (fun queries => 2 * ε queries)

2. The model

The model is a single function, the field nextToken of the argument system (§1).

  • Its inputs are weights and a list of tokens. The quantization parameters are fields of the model settings (Appendix C), and the model settings are not part of the weights.
  • It returns the next token, or nothing if the model is undefined on these tokens.
  • It does not query the hash function and uses no randomness.
  • The soundness statements refer to it only through IsModelOutput (§1).

FlashProve's model is defined in Appendix C.

3. The protocol

The verifier is compiled from a protocol, a linkable holographic IOP, which does not query the random oracle. Such a protocol has an encoder with a decoder, an out-of-domain sample on each encoding, and three interactive oracle proofs (IOPs): offline, link and online. The general definition follows; FlashProve's protocol is defined in Appendix A.

Credits, among them the paper that this protocol builds on: lean/CREDITS.md. The idea is public: holographic IOPs and their compilation to arguments in the random oracle model are defined in A. Chiesa, D. Ojha, N. Spooner, "Fractal: Post-Quantum and Transparent Recursive Proofs from Holography", ePrint 2019/1076 (eprint.iacr.org/2019/1076). This page's design, and its paragraph "Checking the proofs yourself", are modelled on veil.succinct.xyz (Succinct).

DefinitionThe type of protocols: an encoder, a decoder and three IOPsHiop/RecInterface.lean:111–139
In words
In Lean · Hiop/RecInterface.lean, lines 111–139

the library's definition of a linkable holographic IOP with an offline IOP and an out-of-domain sample on each encoding (HolographicProtocol), which the compiler takes as input. I: the indices (for FlashProve, what is committed: a matrix computed from the weights by the map indexOf, not the weights themselves). X: the instances (an instance is built from a request and further tokens)

structure HolographicProtocol (I X : Type) where
Encoder

the encoding's length wordLength and its alphabet Symbol: an encoding is an oracle string of wordLength symbols

wordLength : ℕ
Symbol : Type

the encoder's randomness EncodingRandomness (a finite, non-empty set) and the encoder encodeIndex, which maps an index and randomness to an encoding

EncodingRandomness : Type
[encodingRandomnessIsFinite : Fintype EncodingRandomness]
[encodingRandomnessIsNonempty : Nonempty EncodingRandomness]
encodeIndex : I → EncodingRandomness → (Fin wordLength → Symbol)
Out-of-domain sample

the out-of-domain seeds OutOfDomainSeed: a finite, non-empty set. The verifier samples a seed after an encoding is sent

/-- the record phase (an out-of-domain sample): the verifier's seed -/
OutOfDomainSeed : Type
[outOfDomainSeedIsFinite : Fintype OutOfDomainSeed]
[outOfDomainSeedIsNonempty : Nonempty OutOfDomainSeed]

the out-of-domain answers OutOfDomainAnswer

/-- the prover's answer -/
OutOfDomainAnswer : Type

the honest answer honestOutOfDomainAnswer, a function of an index, its encoding's randomness and a seed

/-- the honest answer -/
honestOutOfDomainAnswer : I → EncodingRandomness → OutOfDomainSeed → OutOfDomainAnswer

collision hasCollisionAt: a property of an oracle string and a seed

/-- the word has a collision at the seed -/
hasCollisionAt : (Fin wordLength → Symbol) → OutOfDomainSeed → Prop
Decoder

the decoder decodeIndex: maps an oracle string, a seed and an answer to an index or nothing

/-- the index decoder reads the word and its record -/
decodeIndex : (Fin wordLength → Symbol) → OutOfDomainSeed × OutOfDomainAnswer → Option I
Three IOPs

the offline IOP offline, on one encoding, meant to show that it decodes; its instance is that encoding's seed and answer

offline : InteractiveOracleProof (OutOfDomainSeed × OutOfDomainAnswer) (oneExternalString wordLength Symbol)

the link IOP link, on two encodings, meant to show that the second decodes to the same index as the first; its instance is both seeds and answers

link : InteractiveOracleProof ((OutOfDomainSeed × OutOfDomainAnswer) × (OutOfDomainSeed × OutOfDomainAnswer)) (twoExternalStrings wordLength Symbol)

the batch size maxBatchSize: the number of batch positions in one run of the online IOP. The Lean comments call a batch position a slot and a run a session

/-- the number of slots -/
maxBatchSize : ℕ

the online IOP onlineBatch, for a batch, on one encoding, meant to show that each request's claim holds for the index to which the encoding decodes. An instance: an element of X, the seed and the answer

onlineBatch : BatchInteractiveOracleProof (X × (OutOfDomainSeed × OutOfDomainAnswer)) (oneExternalString wordLength Symbol)
Honest provers

the honest provers of the offline IOP (honestOfflineProver), the link IOP (honestLinkProver) and the online IOP (honestOnlineBatchProver). Their private input is an index and, for each encoding, its randomness and its seed. For FlashProve, these three fields are set to fixed-message provers (Appendix A), which neither compile nor the verifier uses; the provers in the six theorems are those of honestProversAndSettings (§6.4)

honestOfflineProver : Honest offline (I × EncodingRandomness × OutOfDomainSeed)
honestLinkProver : Honest link (I × (EncodingRandomness × OutOfDomainSeed) × (EncodingRandomness × OutOfDomainSeed))
honestOnlineBatchProver : BatchHonestProver onlineBatch (I × EncodingRandomness × OutOfDomainSeed)
What is hashed when

the early part early of an instance: the first query of a Fiat–Shamir chain contains early x for the instance x (recomputeChain, §4.2)

early : X → X

the optional late round late: if present, the query of that round contains the whole instance

late : Option ℕ
DefinitionThe honest provers of a protocol's three interactive oracle proofsJohnson/Face/Protocol.lean:38–48
In words
In Lean · Johnson/Face/Protocol.lean, lines 38–48

the honest provers of the three IOPs of a protocol protocol (HolographicProtocol, the card above)

structure HonestProvers {Index Instance : Type} (protocol : HolographicProtocol Index Instance) where
Offline

the offline prover offlineProver. Its private input: the index, the encoding's randomness and the seed

/-- The offline prover: it holds the index, the encoding's randomness and the seed. -/
offlineProver : Honest protocol.offline
(Index × protocol.EncodingRandomness × protocol.OutOfDomainSeed)
Link

the link prover linkProver. Its private input: the index, and the randomness and the seed of both encodings

/-- The link prover: it holds the index, and the randomness and seed of both encodings. -/
linkProver : Honest protocol.link
(Index × (protocol.EncodingRandomness × protocol.OutOfDomainSeed) ×
(protocol.EncodingRandomness × protocol.OutOfDomainSeed))
Online

the online prover onlineProver, a prover for the IOP of one batch position (loc of onlineBatch). Its private input: the index, the randomness and the seed of the copy (§6.4), and the copy's number

/-- The online prover: it holds the index, the randomness and seed of the copy, and its number. -/
onlineProver : Honest protocol.onlineBatch.loc
(Index × protocol.EncodingRandomness × protocol.OutOfDomainSeed × ℕ)
DefinitionAn IOP with external oracle stringsIop/InteractiveOracleProof.lean:37–44
In words
In Lean · Iop/InteractiveOracleProof.lean, lines 37–44

an interactive oracle proof (IOP) with instances of type X and external oracle strings (oracle strings fixed before the first message) specified by E (ExtSpec)

structure InteractiveOracleProof (X : Type) (E : ExtSpec) where
Rounds

its rounds, in order (Shape)

shape : Shape

blinded: a flag for each position of the prover's oracle strings (used in InteractiveOracleProof.dview)

/-- is the oracle at this position blinded (hashed with a salt, never shown in full) (by type any
map `OPos shape → Bool`; it enters `InteractiveOracleProof.dview`) -/
blinded : OPos shape → Bool
Verifier

the positions the verifier reads in the external oracle strings, as a function of the instance and the challenges of all rounds

extReads : X → Rho shape → Finset E.Pos

the positions it reads in the prover's oracle strings, as a function of the instance, the challenges of all rounds and the parts of the prover's messages sent in the clear

reads : X → Rho shape → Plains shape → Finset (OPos shape)

its decision (accept or reject), as a function of the instance, the external oracle strings and the whole transcript

accept : X → E.Str → Tr shape → Bool
DefinitionA batch IOP: the IOP of one batch position, with its round markingIop/Batch.lean:289–291
In words
In Lean · Iop/Batch.lean, lines 289–291

a batch IOP, for a type X of instances and a specification E of the external oracle strings

structure BatchInteractiveOracleProof (X : Type) (E : ExtSpec) where

the IOP of one batch position

loc : InteractiveOracleProof X E

its round marking (RoundSplits): for each round, whether the verifier's message is shared, and how the prover's message splits into a shared part and the part of one batch position

ann : RoundSplits loc.shape
DefinitionA modelJohnson/Face/Protocol.lean:31–35
In words
In Lean · Johnson/Face/Protocol.lean, lines 31–35

a model in the form that the compiler takes: a type and a function. Sections 3 and 4 use nothing else from a model. For FlashProve: the integer model, printed in Appendix C

structure Model where

the type Weights: what a commitment commits to

/-- What is committed: the weights. -/
Weights : Type

the function nextToken, mapping weights and a list of tokens to the next token, or to nothing if the model has no value on these tokens

/-- The next token after the given tokens; none where the model has no value on them. -/
nextToken : Weights → List Token → Option Token

4. The compiler

This section presents the library's compiler. It consists of an inner and an outer compiler (§4.3).

The inner compiler. It is defined for every input of type InnerCompilerInput. Such an input consists of any protocol of type HolographicProtocol (§3) and further data written by hand for that protocol, including the layout of its rounds and openings in hash queries. innerSystem constructs an argument system from such an input, and innerCompiledVerifier is the verifier of that system.

The outer compiler, compile. It is defined for every input of type Compilable. Its verifier performs a test on the public files, parses the proof (the field parse of the proof format, §4.3), performs two readings of the public files (queries to the hash function at strings computed from them), and then runs innerCompiledVerifier. Its committer and prover are constructed from the honest provers in its input. compile is not a compiler for arbitrary IOPs: some fields of its input follow FlashProve's format, namely the two readings of the public files, a test on a first hash block, and the proof format.

The Lean code has three layers, listed here from the bottom up:

  • What is hashed (§4.1). The compiled verifier queries separate oracles, one for each purpose. They are implemented by the single random oracle, with domain separation. Each oracle string is replaced by Merkle roots.
  • The BCS transformation for one IOP (§4.2). The verifier's challenges are computed from answers of a Fiat–Shamir oracle, and the positions that the IOP's verifier reads are opened against the roots.
  • The whole verifier and the argument system (§4.3).

The outer compiler constructs the committer and the prover from the honest IOP provers in its input, whereas the inner compiler takes the committer and the prover as fields of its input. As a result, the protocol's structure (§3) and the compiler's input (§4.3) have fields, such as honest provers, that are not used to construct the compiled system; see the remark in §6.4.

The definitions of the compiler's verifier. These definitions are written for any protocol of the library's type (§3).

  • compiledVerifier first performs a scope test on the public files. It then performs three steps that depend on FlashProve's files and proof format: one parses the proof and two read the public files. It calls innerCompiledVerifier.
  • innerCompiledVerifier runs the next three definitions.
  • Arg.buildInstance rejects if no instance can be built from the request.
  • verifyDigestKey checks that the commitment equals the hash function's value at the encoding of the key in the proof (§4.3).
  • verifyAtKeyRoot builds the whole key from the proof and calls verifyAtFullKey.
  • verifyAtFullKey performs six checks: the number of the copy (§6.4), two seeds, and the verifiers of the three IOPs (offline, link, online).
  • verifyOneProtocol is the verifier of one IOP. Each of the last three checks of verifyAtFullKey calls it. The definitions that it calls have their own cards below it in §4.2.

4.1 What is hashed, and Merkle trees

This subsection shows how the compiled algorithms use the single hash function. None of its definitions mentions FlashProve. HashLayout is stated for any protocol of type HolographicProtocol (§3). typedOracleFamily, Check and hashTreeNode are stated for the batch protocol with a leaf body that typedOracleCarrier constructs from such a protocol. OracleCoding is stated for any family of oracles, and Opening for any alphabet.

DefinitionHow a protocol maps onto queries to one hash functionJohnson/Face/Compiler.lean:61–82
In words
In Lean · Johnson/Face/Compiler.lean, lines 61–82

the file's variables

variable {Index Instance : Type}

A hash layout for a protocol and the round markings of its offline and link IOPs specifies how the protocol is mapped to queries to one hash function.

structure HashLayout (protocol : HolographicProtocol Index Instance)
(offlineRoundMarks : RoundSplits protocol.offline.shape)
(linkRoundMarks : RoundSplits protocol.link.shape) where
Queries

the type of a leaf's body, LeafBody: what a leaf of a hash tree contains in addition to its salt

/-- What a leaf of a hash tree may hold beside a symbol. -/
LeafBody : Type

the query layout queryLayout: how rounds and openings are written into hash queries

/-- How rounds and openings are laid into hash queries. -/
queryLayout : QueryLayout 256 (typedOracleCarrier protocol LeafBody offlineRoundMarks linkRoundMarks)

the two nested queries that give a table's out-of-domain seed, and the stored copy's number, seedQueries

/-- The two nested queries that give a table's out-of-domain seed, and the stored copy's number. -/
seedQueries : OutOfDomainSampleQueryLayout 256 queryLayout.K protocol LeafBody offlineRoundMarks linkRoundMarks

how out-of-domain answers are written as a list of digests, answerCode

/-- How out-of-domain answers are written as a list of digests. -/
answerCode : protocol.OutOfDomainAnswer → List (Dig 256)

a fixed out-of-domain sample fixedSample, which fills both places for a sample in an online run's first query

/-- A fixed out-of-domain sample: it fills the two places for one in a session's first query. -/
fixedSample : protocol.Rec

the compiler's parameters, compilerParameters

/-- The compiler's numbers. -/
compilerParameters : Params
One hash function

the coding of all separate oracles into the one hash function, oracleCoding (OracleCoding, the next card)

/-- All typed oracles, coded into the one hash function. -/
oracleCoding :
OracleCoding (typedOracleFamily 256 queryLayout.K (typedOracleCarrier protocol LeafBody offlineRoundMarks linkRoundMarks)) 256
Commitment and instance

the code of a key, keyCode (a key may have none); where a key has a code, the commitment is the hash function's answer at this code

/-- The code of a key: the hash function's answer at it is the commitment. -/
keyCode : KeyRoot 256 protocol → Option ZKCP.Str

how the instance is built from a prompt with output tokens and further tokens from the proof, buildInstance

/-- The instance of a prompt with output tokens, and further tokens from the proof. -/
buildInstance : List Token × List Token → List Token → Option Instance
DefinitionAn implementation of separate oracles by a single random oracleRom/Family.lean:36–48
In words
In Lean · Rom/Family.lean, lines 36–48

for a family of separate oracles S and blocks of lam bits:

structure OracleCoding (S : OSpec) (lam : ℕ) where

for each oracle, the number of blocks in one answer

blocks : S.ι → ℕ

for each oracle, a bijection between its answers and sequences of that many blocks

rng : ∀ o, S.Rng o ≃ (Fin (blocks o) → Fin lam → Bool)

the bit string for an oracle, a query to it and the number of a block of its answer

code : (o : S.ι) → S.Dom o → Fin (blocks o) → List Bool

the decoding of a bit string: the oracle, the query and the number of the block

/-- Every bit string is the encoding of exactly one point: an oracle, a query and the index of a
hash block of the answer, so every query of an adversary to f belongs to a typed query. (An
auxiliary oracle on bit strings, `ON.other` of Compile/Oracles.lean and of
Compile/Batch/Oracles.lean, makes the encoding onto; the scheme with fresh coins never queries it,
the schemes with a seed derive their coins from it.) The inverse is data, so that the extractor
and the simulator over f use no choice either. -/
inv : List Bool → (Σ o, S.Dom o × Fin (blocks o))

decoding the bit string for an oracle, a query and a block returns the same three

inv_code : ∀ x : (Σ o, S.Dom o × Fin (blocks o)), inv (code x.1 x.2.1 x.2.2) = x

decoding a bit string and encoding the result returns the same bit string

code_inv : ∀ s : List Bool, code (inv s).1 (inv s).2.1 (inv s).2.2 = s
DefinitionThe family of separate oracles of the compiled scheme and of its analysisOnBytes/TypedOracleCompiler/Compile/Batch/Oracles.lean:232–235
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Oracles.lean, lines 232–235
Given

the type I of indices and the type X of instances

variable {I X : Type}

the length lam of a digest; the number K of blocks for a challenge

def typedOracleFamily (lam K : ℕ)

a protocol L with the three IOPs offline, L.link, onlineBatch

(L : BatchProtocolWithLeafBody I X) :
Value

a family of separate oracles (in the Lean names: typed oracles):

OSpec where

their names, one for each purpose (OracleName)

ι := OracleName

what a query to each of them contains (domOf)

Dom := domOf lam L

what each of them answers (rngOf)

Rng := rngOf lam K
DefinitionA Merkle opening of one position of an oracle stringCompile/Bcs.lean:30–33
In words
In Lean · Compile/Bcs.lean, lines 30–33

the file's variables; the structure takes none of them

variable {I X : Type} {lam K : ℕ}

a Merkle opening, for digests of lam bits and symbols in σ:

structure Opening (lam : ℕ) (σ : Type) where

the symbol

sym : σ

its salt

salt : Bits

its authentication path: a list of digests

path : List (Dig lam)
DefinitionOne Merkle opening to verify against a rootOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:289–294
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 289–294

the file's variables; of these, the structure uses the types I of indices and X of instances

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

one opening to verify:

structure Check (lam : ℕ) (L : BatchProtocolWithLeafBody I X) where

the leaf's hash input: a body and a salt (LeafIn)

inp : LeafIn L

the number of the leaf

j : ℕ

the authentication path

path : List (Dig lam)

the root

root : Dig lam

the depth of the tree

depth : ℕ
DefinitionAn inner node of a Merkle treeOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:303–304
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 303–304
Given

a protocol L; digests of lam bits; K blocks for a challenge

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

two digests

def hashTreeNode (a b : Dig lam) : TypedOracleComputation lam K L (Dig lam) :=
Value

one query to the oracle node, on the two digests as bit strings

askTypedOracle (L := L) (K := K) OracleName.node (List.ofFn a, List.ofFn b)

4.2 The BCS transformation: one IOP, verified with the hash function

The BCS transformation makes one IOP non-interactive. Each of the prover's oracle strings is replaced by the root of a Merkle tree. Each challenge of the verifier is computed from an answer of a Fiat–Shamir oracle, queried on what was fixed before that challenge.

One definition is used for all three IOPs of the protocol (§3).

DefinitionThe compiled verifier of one IOP, at one batch positionOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:672–683
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 672–683
Given

the file's variables: types I, X of indices and instances; numbers lam, K; a protocol L

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

the two salt lengths; t, selecting one of the three IOPs; the IOP Q

def verifyOneProtocol (sMT sFS : ℕ) (t : Tag) {Y : Type} {E : ExtSpec} (Q : BatchInteractiveOracleProof Y E)

its query layout wq; how its symbols are written into leaves, embS

(wq : ProtocolQueryLayout lam K Q) (embS : (p : OPos Q.loc.shape) → OSym Q.loc.shape p → Body L)

how parts sent in the clear (embP) and the instance (xin, which may give nothing) are written into queries

(embP : PlainPart Q.loc.shape Q.ann → PlainPart (shapeOf L t) (annOf L t)) (xin : Y → Option X)

how symbols of external oracle strings are written into leaves, embE; the depth depthReq of the Merkle tree over the batch

(embE : E.Sym → Body L) (depthReq : ℕ)

the list cms of digests, which the chain's queries contain and against whose entries the external oracle strings are opened; an instance x; a proof string π

(cms : List (Dig lam)) (x : Y) (π : OneProtocolProof lam Q) :
Value

an algorithm that queries the separate oracles and returns accept or reject

TypedOracleComputation lam K L Bool :=
Run

recompute the Fiat–Shamir chain of the proof string (recomputeChainOfProof, the next card, which calls recomputeChain)

(recomputeChainOfProof t Q wq embP xin cms x π).bind fun r =>

it returns nothing: reject

match r with
| none => pure false

it returns challenges, roots and a last phase:

| some (ρ, rts, ph) =>

if the proof string has the strict format (proofHasStrictFormat),

if proofHasStrictFormat sMT sFS Q wq depthReq x π ρ rts ph then

the decision of checkPrunedOpenings

checkPrunedOpenings Q wq embS embE depthReq cms x π ρ rts ph

else: reject

else pure false
Not covered

verifyOneProtocol does not constrain three things (see "Limits" at the head of its Lean file):

  • an accepted proof string remains accepted after any change to its field for the part sent in the clear of a component not sent in its round, and, if the chain has no first shared round, to rtreq (any digest) and slot (any number below 2^depthReq)
  • the root of a component under which the IOP's verifier opens nothing; it is not checked against anything, and it is a field of a query of its round: the Fiat–Shamir query or, for the batch position's root in the first shared round, the query to the oracle g, whose answer is the batch position's value (recomputeChain)
  • the digests in Merkle paths that the joint verification does not use (§4.2, under Merkle paths)

It is not proved that no other change turns an accepted proof string into another accepted one.

DefinitionRecomputation of the Fiat–Shamir chain of one proof stringOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:525–529
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 525–529
Given

the file's variables: types I, X of indices and instances; numbers lam, K; a protocol L

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

which of the three IOPs, t; the IOP Q; its query layout wq

def recomputeChainOfProof (t : Tag) {Y : Type} {E : ExtSpec} (Q : BatchInteractiveOracleProof Y E) (wq : ProtocolQueryLayout lam K Q)

how parts sent in the clear (embP) and the instance (xin, which may give nothing) are written into queries

(embP : PlainPart Q.loc.shape Q.ann → PlainPart (shapeOf L t) (annOf L t)) (xin : Y → Option X)

the list cms; an instance x; a proof string π

(cms : List (Dig lam)) (x : Y) (π : OneProtocolProof lam Q) :
Value

an algorithm that queries the separate oracles and returns either nothing or the challenges of the rounds of Q, the roots round by round, and the last phase

TypedOracleComputation lam K L (Option (Rho Q.loc.shape × RootsOfChain lam Q.loc.shape × Phase lam)) :=
Run

recomputeChain at t, cms and xin x, at the proof string's salt and at its root of the Merkle tree over the batch,

recomputeChain t cms (xin x) π.salt π.rtreq

at all rounds of Q, their round marking and their layout in the hash queries, at embP, from round number 0 and the phase first,

Q.loc.shape Q.ann wq.sh embP 0 .first

at the proof string's roots and its parts sent in the clear

π.roots π.plains
DefinitionThe strict format of a proof string for one IOPOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:658–668
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 658–668
Given

the file's variables: types I, X of indices and instances; numbers lam, K; a protocol L

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

the two lengths of salts: sMT for a leaf, sFS for a chain; the IOP Q

def proofHasStrictFormat (sMT sFS : ℕ) {Y : Type} {E : ExtSpec} (Q : BatchInteractiveOracleProof Y E)

its query layout wq; the depth depthReq of the Merkle tree over the batch; an instance x; a proof string π

(wq : ProtocolQueryLayout lam K Q) (depthReq : ℕ) (x : Y) (π : OneProtocolProof lam Q)

the chain's output: challenges ρ, roots rts and a last phase ph

(ρ : Rho Q.loc.shape)
(rts : RootsOfChain lam Q.loc.shape) (ph : Phase lam) :
Value

true or false; no query is made

Bool :=
Run

with equality of positions decided as specified by wq (decO, ext.dec), the value is true if and only if all seven of the following hold:

haveI := wq.decO
haveI := wq.ext.dec

the chain's salt has exactly sFS bits

decide (π.salt.length = sFS) &&

there are at most as many roots as the chain has taken (RootsOfChain.count)

decide (π.roots.length ≤ RootsOfChain.count Q.loc.shape rts) &&

in each tree over the prover's oracle strings, at every position of a leaf (strictSB): an opening is present only if the tree has a root and the position is read, and its salt has exactly sMT bits

strictSB sMT Q.loc.shape Q.ann wq.sh rts

a position is read if the IOP's verifier reads it at x, ρ and the parts sent in the clear (effPlains); the openings are π.opens

(fun p => decide (p ∈ Q.loc.reads x ρ (effPlains Q.loc.shape Q.ann rts π.plains))) π.opens &&

at every position that wq lists for the external oracle strings (strictExt): an opening of π.ext is present only if the IOP's verifier reads the position at x and ρ, and its salt has exactly sMT bits

strictExt sMT wq.ext (fun p => decide (p ∈ Q.loc.extReads x ρ)) π.ext &&

the number of the batch position is below 2^depthReq

decide (π.slot < 2 ^ depthReq) &&

the last phase has a batch position's value (slotVal: the chain has passed the first shared round), or the path in the Merkle tree over the batch is empty

(ph.slotVal.isSome || π.path.isEmpty) &&

it has one, or the bit string rsalt is empty

(ph.slotVal.isSome || π.rsalt.isEmpty)
Not covered
  • The two tests on openings range over the positions listed by the query layout (posAt0, posAtJ, ext.all). They cover every position if the layout is well-formed (WireRB.OKG, WireE.OK), which the theorems that use them assume.
  • If the chain has passed the first shared round, the length of rsalt is not tested, and no part of rsalt is compared with the field slot. Nevertheless, rsalt is not free to change: a different rsalt gives a different input of the leaf's hash (by reading; no theorem).
Remark

For each component of a round, effPlains returns its part sent in the clear, taken from the proof string if the component is sent and from a fixed message otherwise.

DefinitionAfter the chain: the checks of the openings, the check in the tree over the batch, and the IOP verifier's decisionOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:590–600
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 590–600
Given

the file's variables: types I, X of indices and instances; numbers lam, K; a protocol L

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

the IOP Q; its query layout wq

def checkPrunedOpenings {Y : Type} {E : ExtSpec} (Q : BatchInteractiveOracleProof Y E) (wq : ProtocolQueryLayout lam K Q)

how its symbols are written into leaves, embS; how symbols of external oracle strings are written into leaves, embE

(embS : (p : OPos Q.loc.shape) → OSym Q.loc.shape p → Body L) (embE : E.Sym → Body L)

the depth depthReq of the Merkle tree over the batch; the list cms; an instance x; a proof string π

(depthReq : ℕ) (cms : List (Dig lam)) (x : Y) (π : OneProtocolProof lam Q)

the chain's output: challenges ρ, roots rts and a last phase ph

(ρ : Rho Q.loc.shape)
(rts : RootsOfChain lam Q.loc.shape) (ph : Phase lam) :
Value

an algorithm that queries the separate oracles and returns accept or reject

TypedOracleComputation lam K L Bool :=
Run

the openings to verify, tree by tree (forestsOf): the trees over the prover's oracle strings, round by round, then the trees over the external oracle strings

match forestsOf Q wq embS embE cms x π ρ rts with

it returns a list Fs:

| some Fs =>

if there are at most wq.nOpen openings to verify,

if (flatF Fs).length ≤ wq.nOpen ∧

and each has a path of length equal to its tree's depth, a leaf number below 2^depth (wellFormed), and depth at most wq.maxDepth,

(flatF Fs).all (fun c => c.wellFormed && decide (c.depth ≤ wq.maxDepth)) then

the decision of afterF on Fs and the sibling digests needed by the joint verification, read from the paths (readsF)

afterF Q wq depthReq x π ρ rts ph Fs (readsF Fs)

else: reject

else pure false

an opening is missing: reject

| none => pure false
Not covered

Of the digests in the openings' paths, only those that the joint verification needs are used; the others are not checked against anything (§4.2, Merkle paths).

DefinitionThe openings to verify, tree by treeOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:557–567
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 557–567
Given

the file's variables: types I, X of indices and instances; numbers lam, K; a protocol L

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

the IOP Q; its query layout wq

def forestsOf {Y : Type} {E : ExtSpec} (Q : BatchInteractiveOracleProof Y E) (wq : ProtocolQueryLayout lam K Q)

how its symbols are written into leaves, embS

(embS : (p : OPos Q.loc.shape) → OSym Q.loc.shape p → Body L)

how symbols of external oracle strings are written into leaves, embE; the list cms; an instance x; a proof string π

(embE : E.Sym → Body L) (cms : List (Dig lam)) (x : Y) (π : OneProtocolProof lam Q)

from the chain's output: challenges ρ and roots rts

(ρ : Rho Q.loc.shape) (rts : RootsOfChain lam Q.loc.shape) :
Value

a list of Forest entries (each: openings to verify in trees of one depth), or nothing

Option (List (Forest lam L)) :=
Run

with equality of positions decided as specified by wq (decO, ext.dec):

haveI := wq.decO
haveI := wq.ext.dec

the trees over the prover's oracle strings, round by round (forestsB),

match forestsB Q.loc.shape Q.ann wq.sh embS rts

at the positions that the IOP's verifier reads at x, ρ and the parts sent in the clear (effPlains), with the openings π.opens;

(fun p => decide (p ∈ Q.loc.reads x ρ (effPlains Q.loc.shape Q.ann rts π.plains))) π.opens,

the trees over the external oracle strings (forestExt), under the roots cms, at the positions that it reads at x and ρ, with the openings π.ext

forestExt wq.ext embE cms (fun p => decide (p ∈ Q.loc.extReads x ρ)) π.ext with

both return a list: the first followed by the second

| some a, some b => some (a ++ b)

an opening is missing: nothing

| _, _ => none
Remark

forestsOf lists the openings to verify (Check, §4.1), at positions that the IOP's verifier reads:

  • in the prover's oracle strings (read at x, ρ and the parts sent in the clear): at every read position of a leaf, in each tree that has a depth and a root. Nothing more is checked where the depths or the roots end (the component is not sent, or has no further tree)
  • in the external oracle strings (read at x and ρ): at every read position listed in wq, against the entry of cms that the layout specifies (a default digest if cms has none)

Where the layout's pruning flag (pr0, prJ, pr) is set, the opened leaves are verified together; elsewhere each opening is verified along its own path.

DefinitionThe joint verification, the check in the tree over the batch, and the IOP verifier's decisionOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:577–583
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 577–583
Given

the file's variables: types I, X of indices and instances; numbers lam, K; a protocol L

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

the IOP Q; its query layout wq; the depth depthReq of the Merkle tree over the batch

def afterF {Y : Type} {E : ExtSpec} (Q : BatchInteractiveOracleProof Y E) (wq : ProtocolQueryLayout lam K Q) (depthReq : ℕ)

an instance x; a proof string π; the chain's output: challenges ρ, roots rts and a last phase ph

(x : Y) (π : OneProtocolProof lam Q) (ρ : Rho Q.loc.shape) (rts : RootsOfChain lam Q.loc.shape) (ph : Phase lam)

the openings Fs to verify, tree by tree; sibling digests s

(Fs : List (Forest lam L)) (s : List (Dig lam)) :
Value

an algorithm that queries the separate oracles and returns accept or reject

TypedOracleComputation lam K L Bool :=
Run

the joint verification of each entry of Fs, with the sibling digests s (runForests);

(runForests Fs s).bind fun ok =>

the check in the Merkle tree over the batch, if the chain has passed the first shared round (reqPart);

(reqPart depthReq π ph).bind fun okr =>

accept if both hold and the IOP's verifier accepts (Q.loc.accept) at x, at external oracle strings built from the symbols of π.ext,

pure (ok && okr && Q.loc.accept x (wq.ext.build fun p => (π.ext p).map Opening.sym)

and at a transcript made from the proof string and the challenges ρ (mkTr)

(mkTr Q.loc.shape Q.ann wq.sh rts π.plains ρ π.opens))
Remark

afterF accepts if all three hold:

  • runForests: the leaves are hashed; then, level by level, adjacent siblings are hashed together, and a node without its sibling is hashed with the next sibling digest; every node remaining after depth levels equals the root of its tree
  • reqPart: if the last phase contains a batch position's value c, the check in the Merkle tree over the batch (reqCheck) passes: π.path has length depthReq, π.slot is less than 2^depthReq, and hashing from the leaf (the hash of c followed by π.rsalt) up the path gives π.rtreq; if the last phase contains no such value, this condition holds
  • Q.loc.accept: the IOP verifier's decision on x, on external oracle strings built from the symbols of π.ext (wq.ext.build), and on a transcript built from the proof string (mkTr): the challenges ρ, the parts sent in the clear (effPlains), the opened symbols where there are any and the tree of their position has a root, and the fixed symbol 0 elsewhere
DefinitionA proof string for one IOP, at one batch positionOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:154–166
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 154–166

the file's variables: types I, X of indices and instances; numbers lam, K; a protocol L

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

a proof string for the IOP Q; digests have lam bits:

structure OneProtocolProof (lam : ℕ) {Y : Type} {E : ExtSpec} (Q : BatchInteractiveOracleProof Y E) where

the salt of the Fiat–Shamir chain

salt : Bits

the Merkle roots of the prover's oracle strings, in the order in which the chain takes them (recomputeChain)

roots : List (Dig lam)

for each round, the part of the prover's message that is sent in the clear

plains : Plains Q.loc.shape

for each position of the prover's oracle strings: an opening (Opening, §4.1), or nothing

opens : (p : OPos Q.loc.shape) → Option (Opening lam (OSym Q.loc.shape p))

the same for each position of the external oracle strings

ext : E.Pos → Option (Opening lam E.Sym)

the root of the Merkle tree over the batch

rtreq : Dig lam

the number of this batch position

slot : ℕ

its authentication path in that tree

path : List (Dig lam)

a bit string appended to the batch position's value (the answer c of g; see recomputeChain) in the input of its leaf in that tree

/-- what stands behind the slot value in the input of the request tree's leaf: the prover's free
choice. (In the programs' byte format that leaf is salted and holds its slot's number: a typing
of a proof file lays both in here.) -/
rsalt : Bits
DefinitionThe Fiat–Shamir chain: the verifier's challenges in all roundsOnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean:241–281
In words
In Lean · OnBytes/TypedOracleCompiler/Compile/Batch/Verifier.lean, lines 241–281
Given

the file's variables: types I, X of indices and instances; numbers lam, K; a protocol L

variable {I X : Type} {lam K : ℕ} {L : BatchProtocolWithLeafBody I X}

the IOP's tag t; a list of digests cms, contained in the first query and in the first shared round's Fiat–Shamir query

def recomputeChain (t : Tag) (cms : List (Dig lam))

the instance x, or nothing; the chain's salt; the root of the Merkle tree over the batch

(x : Option X) (salt : Bits) (rtreq : Dig lam) :

the rounds that remain; their round marking (which rounds are shared, and which part of a message belongs to which component);

(s : Shape) → (A : RoundSplits s) →

their layout in the hash queries

RoundsQueryLayout lam K s A →

how a part sent in the clear is written into a query; the number of the round

(PlainPart s A → PlainPart (shapeOf L t) (annOf L t)) → ℕ →

the phase that the chain has reached (Phase); the roots that remain; the parts sent in the clear

Phase lam → List (Dig lam) → Plains s →
Value

an algorithm that queries the separate oracles and returns

TypedOracleComputation lam K L

the challenges of these rounds, the roots round by round, and the last phase; or nothing

(Option (Rho s × RootsOfChain lam s × Phase lam))

no round remains: the current phase

| [], _, _, _, _, ph, _, _ => pure (some ((), (), ph))

otherwise, for the next round:

| _ :: s, (a, A), (w, W), embP, i, ph, rts, (pl, pls) =>

its marking and the phase determine the format of its query (actOf; Head: five formats);

match actOf cms

the first query contains the early part of the instance

(x.map L.early) salt a.kind ph with

one query, on this batch position's own component: take as many roots as that component has trees;

| some (.one h true next) =>
match takeRt w.depthJ.length rts with
| some (rt, rts') => do

query the Fiat–Shamir oracle of t

let ans ← askTypedOracle (L := L) (K := K) (OracleName.fb t)

on the round's number, the header (in the round L.late, with the whole instance if the header has a field for it), these roots,

(⟨i, h.withLate (lateInstancePart L i x), rt,

and the component's part sent in the clear;

embP (.inl (.inr (a.plain pl).2))⟩ : FbIn lam L t)

then the later rounds, from the chaining value in the answer;

let r ← recomputeChain t cms x salt rtreq s A W (fun z => embP (.inr z)) (i + 1)
(next (List.ofFn ans.2)) rts' pls

this round's challenge is computed from the answer's blocks (w.chal); the roots are recorded for the position's own component

pure (r.map fun z => ((w.chal ans.1, z.1), ((none, some rt), z.2.1), z.2.2))

a root is missing, or the component has more than maxRt trees: nothing

| none => pure none

one query, on the shared component: the same, without the instance, with that component's trees, roots and part sent in the clear

| some (.one h false next) =>
match takeRt w.depth0.length rts with
| some (rt, rts') => do
let ans ← askTypedOracle (L := L) (K := K) (OracleName.fb t)
(⟨i, h, rt, embP (.inl (.inl (a.plain pl).1))⟩ : FbIn lam L t)
let r ← recomputeChain t cms x salt rtreq s A W (fun z => embP (.inr z)) (i + 1)
(next (List.ofFn ans.2)) rts' pls
pure (r.map fun z => ((w.chal ans.1, z.1), ((some rt, none), z.2.1), z.2.2))
| none => pure none

the first shared round: take the roots of the position's own component, then those of the shared one;

| some (.join ρ) =>
match takeRt w.depthJ.length rts with
| some (rtj, rts1) =>
match takeRt w.depth0.length rts1 with
| some (rt0, rts') => do

query the oracle g of t: the answer c is the batch position's value;

let c ← askTypedOracle (L := L) (K := K) (OracleName.g t)

the query contains the round's number, the chaining value so far and the position's own component

(⟨i, ρ, rtj, embP (.inl (.inr (a.plain pl).2))⟩ : JoiningRoundQuery lam L t)

query the Fiat–Shamir oracle on the round's number, the list cms, the root of the Merkle tree over the batch, and the shared component;

let ans ← askTypedOracle (L := L) (K := K) (OracleName.fb t)
(⟨i, .f4 cms (List.ofFn rtreq), rt0,
embP (.inl (.inl (a.plain pl).1))⟩ : FbIn lam L t)

then the later rounds, which keep c; this round's challenge as above

let r ← recomputeChain t cms x salt rtreq s A W (fun z => embP (.inr z)) (i + 1)
(.shr (List.ofFn ans.2) c) rts' pls
pure (r.map fun z => ((w.chal ans.1, z.1), ((some rt0, some rtj), z.2.1), z.2.2))

a root of the shared component is missing, or it has too many trees: nothing

| none => pure none

the same for the position's own component

| none => pure none

no format is defined for this marking in this phase: nothing

| none => pure none

verifyOneProtocol calls three definitions, each with a card above:

  • recomputeChainOfProof, which calls recomputeChain on the parts of the proof string;
  • proofHasStrictFormat, which checks the format;
  • checkPrunedOpenings, which checks the openings, performs the check in the tree over the batch, and evaluates the IOP verifier's own decision.

checkPrunedOpenings calls forestsOf and afterF, each with a card above. Thus, in the Lean code on this page, a challenge can be traced from what is hashed to its value, then to the positions that the IOP's verifier reads for it (Q.loc.reads, Q.loc.extReads), and into the IOP verifier's decision (Q.loc.accept, at the transcript constructed by mkTr). Of the definitions that these three, forestsOf and afterF call in turn, recomputeChain has a card above. The others (including forestsB, forestExt, runForests, reqPart, mkTr, effPlains, strictSB, strictExt) have no card on this page. The Lean code of these eight is in §9.

Merkle paths. The Merkle path of each opening must have length equal to the depth of its tree. The joint verification reads only those digests in these paths that it needs: where two opened nodes are siblings, it reads the digest of neither. The other digests are not checked against anything. Neither proofHasStrictFormat nor checkPrunedOpenings rejects them, so a typed proof can be altered at these places and still be accepted. This is malleability of the proof string, not a gap in soundness: the bound of sound holds for arbitrary values of these entries (lean/GAPS.md, 14 and 66).

The structure used by verifyOneProtocol. verifyOneProtocol is stated for a smaller structure, which typedOracleCarrier constructs from a protocol of type HolographicProtocol. It keeps the protocol's shapes and types, but not its index or its provers. That structure has no card on this page either.

4.3 The verifier, and the compiled argument system

compile takes one record, Compilable. Its main fields are the public side (the protocol, its hash layout, two readings of the public files, and the model), the honest provers with their settings, and the format in which a proof is written.

It returns an argument system. The verifier of that system depends only on the public side and on the parser of the proof format.

DefinitionThe outer compilerJohnson/Face/Compiler.lean:382–384
In words
In Lean · Johnson/Face/Compiler.lean, lines 382–384
Given

the file's variables

compile takes one argument, input : Compilable, which the Lean code declares in a variable line above the definition.

  • Its input is not only an interactive oracle proof.
  • It takes a record of seven fields (Compilable), and the protocol is one of the twelve fields of the first, publicSide.
  • It is given a test on the public files, two readings of them, the layout of the rounds into hash queries, the parser of a proof, and the honest provers with their settings; it does not construct them.
variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}
variable (input : Compilable)

The outer compiler, which maps a Compilable to an argument system (ArgumentSystem). It places what FlashProve's files and proof format require before the inner verifier, and builds the honest committer and prover.

def compile : ArgumentSystem :=
Value
  • The system's next-token function is the model's nextToken.
  • The honest committer and prover are those of compiledSide (§6.4), built from the given honest provers.
systemOf input.publicSide.model.nextToken (compiledSide input)

The verifier is compiledVerifier at the public side and the parser: if that test passes, it runs that parser and those two readings, then innerCompiledVerifier (below); if not, it rejects.

(compiledVerifier input.publicSide input.format.parse)
Not covered

The six theorems concern only compile at flashProveAtFiles.

Remark

The system has no public parameters.

The committer:

  • encodes the index of the weights as a first table and as furtherCopies + 1 copies of it
  • builds a salted Merkle tree over each table, with its out-of-domain sample
  • adds the offline proof for the first table and a link proof for each copy
  • returns a commitment of 256 bits

The prover keeps no state:

  • it runs the committer again on the same randomness
  • then proves one request on one copy, sampled at random, using the online proof
DefinitionThe outer compiler's verifierJohnson/Face/Compiler.lean:337–347
In words
In Lean · Johnson/Face/Compiler.lean, lines 337–347

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}

The compiled verifier. Of compile's input it reads only the public side and the parser.

def compiledVerifier (side : PublicSide) {Form : Type}
Given

the parser parse, which computes a typed proof from a prompt, an output and a proof as submitted

(parse : List Token → List Token → Form → DeterministicAlgorithm
(TypedProof side.protocol side.offlineRoundSplits side.linkRoundSplits))

a commitment, a prompt, an output and a proof as submitted, form

(commitment : Commitment) (prompt output : List Token) (form : Form) :
Value

a deterministic algorithm that returns accept or reject

DeterministicAlgorithm Bool :=
Run

if the verifier takes these public files at all (filesInScope):

if side.filesInScope then

parse the proof as submitted;

VerifierAndGoals.andThen (parse prompt output form) fun proof =>

the first public reading: the digest of the public files, obtained by querying the hash function;

VerifierAndGoals.andThen side.filesDigest fun digest =>

the second public reading, at that digest;

VerifierAndGoals.andThen (side.furtherReading digest) fun further =>

the decision of innerCompiledVerifier (below) on the commitment, the prompt, the output and the typed proof, for the layout determined by the results of the two readings

innerCompiledVerifier (side.layoutAt digest further).input commitment prompt output proof

else: reject

else .done false

The next cards show what compiledVerifier runs after its scope test and its three steps, down to the verifier's own checks.

DefinitionThe inner compiler's verifierJohnson/Top/InnerCompiledVerifier.lean:128
In words
In Lean · Johnson/Top/InnerCompiledVerifier.lean, lines 128–128
Given

a record r of type InnerCompilerInput: a protocol with its hash layout

variable (r : InnerCompilerInput)
Value

the verifier of innerSystem r, the argument system that the library builds from r (its card and those of the intermediate definitions are in the folded section How an input becomes an argument system, below). It builds the instance from the prompt, the output and further tokens in the proof, checks the commitment against the key in the proof, and runs verifyAtKeyRoot (below)

def innerCompiledVerifier := (innerSystem r).verify
DefinitionThe separate oracles, answered by the one hash functionRom/Family.lean:75–79
In words
In Lean · Rom/Family.lean, lines 75–79
Given

the file's variables

variable {S : OSpec} {lam : ℕ} {α : Type}

Runs a scheme (A), which queries separate oracles, over the one hash function:

  • each query to one of them is encoded as strings by the coding given as an argument (m: OracleCoding, §4.1)
  • the answers are read back
def schemeOverOneHashFunction {I X W IVK ISK Pf : Type} (m : OracleCoding S lam) (A : Gen.Arg S I X W IVK ISK Pf) :

the result: a scheme of the same types that queries the one hash function

Gen.Arg (rom lam) I X W IVK ISK Pf where
Value

the committer of A, run in this way by overOne m (OComp.overOne, Rom/Family.lean:69, which has neither a card nor a row in §9)

C := fun i => (A.C i).overOne m

the prover of A, likewise

P := fun k b => (A.P k b).overOne m

the verifier of A, likewise

V := fun v x π => (A.V v x π).overOne m
DefinitionThe inner compiler's input: a protocol of type HolographicProtocol, with its layout into hash queries written alongside itJohnson/Top/InnerCompiledVerifier.lean:59–96
In words
In Lean · Johnson/Top/InnerCompiledVerifier.lean, lines 59–96

The inner compiler's input: a protocol with its hash layout. It has twenty fields. The verifier reads thirteen of them, and only the verifier's side of the protocol (innerCompiledVerifier_eq, Johnson/Top/InnerCompiledVerifierSide.lean:79); it reads neither the type of what is committed nor the last six. All fields except the protocol and its two types are written by hand alongside it.

structure InnerCompilerInput where
Types

the type of what is committed, Index; the verifier does not read it

/-- Indices. -/
Index : Type

the type of what a run of the online IOP proves, Instance

/-- Instances. -/
Instance : Type
The protocol

the protocol protocol: three IOPs with the encoder and the decoder of an index

/-- The protocol: three IOPs (offline, link, online), the encoder and decoder of an index, the
out-of-domain sample, and which part of an instance is named early and which late. -/
protocol : HolographicProtocol Index Instance
Its layout into hash queries

the type of a leaf's body, LeafBody: what a leaf of a hash tree contains in addition to its salt

/-- What a query's body may hold beside. -/
LeafBody : Type

which rounds of the offline IOP are shared by a batch, offlineRoundSplits

/-- The offline IOP's marks: which rounds are shared, which are a chain's own. -/
offlineRoundSplits : RoundSplits protocol.offline.shape

which rounds of the link IOP are shared by a batch, linkRoundSplits

/-- The link IOP's marks. -/
linkRoundSplits : RoundSplits protocol.link.shape

how rounds and openings are written into hash queries, queryLayout

/-- The wire of the protocol: how rounds and openings are laid into hash queries. -/
queryLayout : QueryLayout 256 (typedOracleCarrier protocol LeafBody offlineRoundSplits linkRoundSplits)

the two nested queries that give a table's out-of-domain seed, and the stored copy's number, seedQueries

/-- The wire of the out-of-domain sample: the seeds' two queries, the stored copy's number. -/
seedQueries : OutOfDomainSampleQueryLayout 256 queryLayout.K protocol LeafBody offlineRoundSplits linkRoundSplits

how out-of-domain answers are written as a list of digests, answerCode

/-- How an out-of-domain sample's answers are written as a list of digests. -/
answerCode : protocol.OutOfDomainAnswer → List (Dig 256)

a fixed out-of-domain sample fixedSample, written in both places for a sample in an online run's first query

/-- A fixed out-of-domain sample: it fills the two places for one in a run's first query. -/
fixedSample : protocol.Rec

the compiler's parameters, compilerParameters

compilerParameters : Params

the coding of all separate oracles into the one hash function, oracleCoding

/-- The typed oracles in one hash function. -/
oracleCoding : OracleCoding (typedOracleFamily 256 queryLayout.K (typedOracleCarrier protocol LeafBody offlineRoundSplits linkRoundSplits)) 256
Commitment and instance

the code of a key, keyCode (a key may have none); where a key has a code, the commitment is the hash function's answer at this code

/-- The code of a key: the hash function's answer at it is the commitment. -/
keyCode : KeyRoot 256 protocol → Option ZKCP.Str

how the instance is built from a prompt with output tokens and further tokens from the proof, buildInstance

/-- From a prompt with output tokens, and further tokens that the proof brings, an instance. -/
buildInstance : List Token × List Token → List Token → Option Instance
What no verifier reads

the model, nextToken

/-- The model. `innerCompiledVerifier` does not read it; the claim does. -/
nextToken : Index → List Token → Option Token

the prover's key, the committer and the prover (ProverKey, commit, prove)

/-- The honest side. Nothing is asked of these five, nor of the honest provers that `protocol` holds. -/
ProverKey : Type
commit : Index → Rom.OComp (typedOracleFamily 256 queryLayout.K (typedOracleCarrier protocol LeafBody offlineRoundSplits linkRoundSplits)) (KeyRoot 256 protocol × ProverKey)
prove : ProverKey → (b : List (Instance × Unit)) →
Rom.OComp (typedOracleFamily 256 queryLayout.K (typedOracleCarrier protocol LeafBody offlineRoundSplits linkRoundSplits)) (ZKCP.Gen.Slots (OfflineLinkOnlineProof 256 protocol offlineRoundSplits linkRoundSplits) b)

the bound on the committer's coins, coinBound

coinBound : ℕ

a fall-back proof, fallbackProof

fallbackProof : KeyRoot 256 protocol × OfflineLinkOnlineProof 256 protocol offlineRoundSplits linkRoundSplits
DefinitionBuilding the instance from the requestZKCP/BuildInstance.lean:52–60
In words
In Lean · ZKCP/BuildInstance.lean, lines 52–60
Given

the file's variables

variable {lam : ℕ} {I X X' Aux W PP IVK ISK Pf : Type}

Turns a scheme on instances of type X into a scheme on instances of another type X'. The compiler uses it with a prompt and output tokens as the new instance.

  • A: the inner scheme, on instances of type X
  • build: maps a new instance and a first part of a proof to an inner instance or nothing
def Arg.buildInstance (A : Arg lam I X W IVK ISK Pf) (build : X' → Aux → Option X)
  • aux: maps a new instance to a first part of a proof
  • π₀: a proof of the inner scheme
  • the result: a scheme on instances of type X'; a proof is a pair of a first part and a proof of the inner scheme
(aux : X' → Aux) (π₀ : Pf) : Arg lam I X' W IVK ISK (Aux × Pf) where
Committer

that of A

C := A.C
Prover

it builds the inner instance from the new instance x' and aux x'

P := fun secret x' w => match build x' (aux x') with

where one is built: aux x', then the proof of A's prover for it

| some x => (A.P secret x w).mapO fun π => (aux x', π)

where none is built: aux x', then π₀

| none => .pure (aux x', π₀)
Verifier

it builds the inner instance from x' and the first part of the proof

V := fun key x' proof => match build x' proof.1 with

where one is built: the decision of A's verifier on it and the second part of the proof

| some x => A.V key x proof.2

and rejects where none is built

| none => .pure false
DefinitionThe check of the key in the proof against the commitmentZKCP/DigestKey.lean:66–71
In words
In Lean · ZKCP/DigestKey.lean, lines 66–71

the file's variables

variable {lam : ℕ} {I X W IVK ISK Pf : Type}

Checks the key in the proof against the commitment.

def verifyDigestKey (V : IVK → X → Pf → OComp lam Bool) (enc : IVK → Option Str) :
Proof

a proof is a key with a proof for that key

Digest lam → X → IVK × Pf → OComp lam Bool := fun digest x proof =>
Value

the verifier queries the hash function at the key's code

match enc proof.1 with
| some code => .query code fun answer =>

it rejects unless the answer is the commitment, and then runs the inner verifier with that key

if answer = digest then V proof.1 x proof.2 else .pure false

it rejects a key without a code, and in that case makes no query

| none => .pure false
DefinitionThe verifier whose key is a root with its out-of-domain sampleJohnson/TypedOracleCompiler/RecCompile/FrontRootAns.lean:38–40
In words
In Lean · Johnson/TypedOracleCompiler/RecCompile/FrontRootAns.lean, lines 38–40
Given

layouts W (hash queries) and S (seeds' queries); how an answer is written as digests, cA; a fixed seed with its answer, r₀

variable {I X Wn : Type} {lam : ℕ} {L : HolographicProtocol I X} {Bd : Type} {aT : RoundSplits L.offline.shape}
{aL : RoundSplits L.link.shape}
variable (W : QueryLayout lam (typedOracleCarrier L Bd aT aL)) (S : OutOfDomainSampleQueryLayout lam W.K L Bd aT aL)
(cA : L.OutOfDomainAnswer → List (Dig lam)) (r₀ : L.Rec)

parameters p, a key k, an instance x, a proof π

def verifyAtKeyRoot (p : Params) (k : KeyRoot lam L) (x : X) (π : OfflineLinkOnlineProof lam L aT aL) :
Value

an algorithm that queries the separate oracles and returns accept or reject

TypedOracleComputation lam W.K (typedOracleCarrier L Bd aT aL) Bool :=

the decision of verifyAtFullKey (below),

verifyAtFullKey W S cA r₀ p

on the key completed from the proof (KeyRoot.full): its proof string for offline, and its one copy (a further encoding) as the list;

(k.full π)

on the instance, and on the rest of the proof (OfflineLinkOnlineProof.low): the place 0, the number, the proof string for onlineBatch

x π.low
DefinitionThe verifier rejects if a part is missing and otherwise makes six checks: the copy's number, two seeds and three IOPsJohnson/TypedOracleCompiler/RecCompile/CmsAns.lean:82–92
In words
In Lean · Johnson/TypedOracleCompiler/RecCompile/CmsAns.lean, lines 82–92
Given

layouts W (hash queries) and S (seeds' queries); how an answer is written as digests, cA; a fixed seed with its answer, r₀

variable {I X Wn : Type} {lam : ℕ} {L : HolographicProtocol I X} {Bd : Type} {aT : RoundSplits L.offline.shape}
{aL : RoundSplits L.link.shape}
variable (W : QueryLayout lam (typedOracleCarrier L Bd aT aL)) (S : OutOfDomainSampleQueryLayout lam W.K L Bd aT aL)
(cA : L.OutOfDomainAnswer → List (Dig lam)) (r₀ : L.Rec)

parameters p; a whole key v (FullKey): a root, its seed with its answer, a proof string for offline, a list of copies

def verifyAtFullKey (p : Params) (v : FullKey lam L aT aL)

an instance x; a proof π (RequestProof): a place in that list, a number, a proof string for onlineBatch

(x : X) (π : RequestProof lam L) :
Value

an algorithm that queries the separate oracles and returns accept or reject

TypedOracleComputation lam W.K (typedOracleCarrier L Bd aT aL) Bool :=

take the proof string for offline, the copy at the place π.leaf of the list, and the proof string for onlineBatch

match v.piT, v.links[π.leaf]?, π.piB with

all three are present, and the copy contains a proof string for L.link:

| some πT, some (cmj, recj, some πL), some πB =>
Run

the seed of the key's root is recomputed and compared (outOfDomainSeedIs)

(outOfDomainSeedIs W S v.cm v.rcd.1).bind fun s0 =>

so is the seed of the copy's root

(outOfDomainSeedIs W S cmj recj.1).bind fun sj =>

offline is verified on the key's root

(verifyOfflineProof W cA p v.cm v.rcd πT).bind fun a =>

L.link on the key's root and the copy's root

(verifyLinkProof W cA p v.cm cmj v.rcd recj πL).bind fun b =>

onlineBatch on the copy's root and the instance

(verifyOnlineProof W cA r₀ p cmj x recj πB).bind fun c =>
Accept if
  • the check S.num accepts on input the number π.copy and the parts of the proof string for onlineBatch sent in the clear
OComp.pure (S.num π.copy πB.plains
  • both seeds equal their recomputed values
  • the three verifiers accept
&& s0 && sj && a && b && c)

one of them is missing: reject

| _, _, _ => OComp.pure false
Not covered

The number π.copy tested by S.num is chosen freely by the prover: nothing relates it to the place π.leaf of the copy that is used (the Lean comment on the field copy of RequestProof).

DefinitionOne out-of-domain seed, recomputed and comparedJohnson/TypedOracleCompiler/RecCompile/Seeds.lean:118–123
In words
In Lean · Johnson/TypedOracleCompiler/RecCompile/Seeds.lean, lines 118–123
Given

the file's variables

variable {I X : Type} {lam : ℕ}
variable {L : HolographicProtocol I X} {Bd : Type} {aT : RoundSplits L.offline.shape} {aL : RoundSplits L.link.shape}
(W : QueryLayout lam (typedOracleCarrier L Bd aT aL)) (S : OutOfDomainSampleQueryLayout lam W.K L Bd aT aL)

Checks an out-of-domain seed.

  • cm: the table's root
  • s: an out-of-domain seed
def outOfDomainSeedIs (cm : Dig lam) (s : L.OutOfDomainSeed) : TypedOracleComputation lam W.K (typedOracleCarrier L Bd aT aL) Bool :=
Run

it asks the seed's two queries at the table's root: the first (seedQ0),

the second (seedQ1) at the chain value of the answer to the first,

(OComp.ask (S := typedOracleFamily lam W.K (typedOracleCarrier L Bd aT aL)) (OracleName.fb S.t)
(seedQ0 W S cm)).bind fun a0 =>
(OComp.ask (S := typedOracleFamily lam W.K (typedOracleCarrier L Bd aT aL)) (OracleName.fb S.t)
(seedQ1 W S (link (show FsAns lam W.K from a0)))).bind fun a1 =>

and compares the result with the seed in the key or the proof (s)

OComp.pure (@decide _ (S.decS (S.seed (show FsAns lam W.K from a1).1) s))
DefinitionThe offline IOP's verifierJohnson/TypedOracleCompiler/RecCompile/CmsAns.lean:61–64
In words
In Lean · Johnson/TypedOracleCompiler/RecCompile/CmsAns.lean, lines 61–64
Given

the file's variables

variable {I X Wn : Type} {lam : ℕ} {L : HolographicProtocol I X} {Bd : Type} {aT : RoundSplits L.offline.shape}
{aL : RoundSplits L.link.shape}
variable (W : QueryLayout lam (typedOracleCarrier L Bd aT aL)) (S : OutOfDomainSampleQueryLayout lam W.K L Bd aT aL)
(cA : L.OutOfDomainAnswer → List (Dig lam)) (r₀ : L.Rec)

the compiler's numbers p; a digest cm; an out-of-domain sample rec; a proof string π

def verifyOfflineProof (p : Params) (cm : Dig lam) (rec : L.Rec) (π : OneProtocolProof lam (batTC L aT)) :
Value

an algorithm that queries the separate oracles and returns accept or reject

TypedOracleComputation lam W.K (typedOracleCarrier L Bd aT aL) Bool :=

verifyOneProtocol at the offline IOP

verifyOneProtocol p.sMT p.sFS Tag.test (batTC L aT) (wTC W) W.embT id (fun _ => none) W.embE W.depthReqT

its chain is given the first table's root and its out-of-domain answers

(cmsTA cA cm rec.2) rec π
DefinitionThe link IOP's verifierJohnson/TypedOracleCompiler/RecCompile/LinkAns.lean:88–91
In words
In Lean · Johnson/TypedOracleCompiler/RecCompile/LinkAns.lean, lines 88–91
Given

the file's variables

variable {I X : Type} {lam : ℕ} {L : HolographicProtocol I X} {Bd : Type} {aT : RoundSplits L.offline.shape}
{aL : RoundSplits L.link.shape}
variable (W : QueryLayout lam (typedOracleCarrier L Bd aT aL)) (S : OutOfDomainSampleQueryLayout lam W.K L Bd aT aL)
(cA : L.OutOfDomainAnswer → List (Dig lam))

the compiler's parameters p; two digests cm, cm'; two out-of-domain samples rec, rec'; a proof string π

def verifyLinkProof (p : Params) (cm cm' : Dig lam) (rec rec' : L.Rec) (π : OneProtocolProof lam (batLC L aL)) :
Value

an algorithm that queries the separate oracles and returns accept or reject

TypedOracleComputation lam W.K (typedOracleCarrier L Bd aT aL) Bool :=

verifyOneProtocol at the link IOP

verifyOneProtocol p.sMT p.sFS Tag.link (batLC L aL) (wLC W) W.embL id (fun _ => none) W.embE W.depthReqL

its chain is given the roots and the out-of-domain answers of both tables

(cmsLA cA cm cm' rec.2 rec'.2) (rec, rec') π
DefinitionThe online IOP's verifierJohnson/TypedOracleCompiler/RecCompile/CmsAns.lean:71–74
In words
In Lean · Johnson/TypedOracleCompiler/RecCompile/CmsAns.lean, lines 71–74
Given

the file's variables

variable {I X Wn : Type} {lam : ℕ} {L : HolographicProtocol I X} {Bd : Type} {aT : RoundSplits L.offline.shape}
{aL : RoundSplits L.link.shape}
variable (W : QueryLayout lam (typedOracleCarrier L Bd aT aL)) (S : OutOfDomainSampleQueryLayout lam W.K L Bd aT aL)
(cA : L.OutOfDomainAnswer → List (Dig lam)) (r₀ : L.Rec)

the compiler's numbers p; a digest cm; an instance x; an out-of-domain sample rec; a proof string π

def verifyOnlineProof (p : Params) (cm : Dig lam) (x : X) (rec : L.Rec) (π : OneProtocolProof lam L.onlineBatch) :
Value

an algorithm that queries the separate oracles and returns accept or reject

TypedOracleComputation lam W.K (typedOracleCarrier L Bd aT aL) Bool :=
  • verifyOneProtocol for the online IOP
  • in the chain's queries, the instance is written as xinBA: the instance with one fixed out-of-domain sample r₀ (seed and answers) in each of the two places for a sample
verifyOneProtocol p.sMT p.sFS Tag.onl L.onlineBatch (wBC W) W.embB id (xinBA r₀) W.embE W.depthReq
  • its chain is given the copy's root twice, and the copy's out-of-domain answers
  • its instance is the pair (x, rec): the request's instance and the out-of-domain sample
(cmsBA cA cm rec.2) (x, rec) π
How an input becomes an argument system · 8 cards

The definitions in this folded section have at most a few lines each. They pass arguments from innerCompiledVerifier to Arg.buildInstance, verifyDigestKey and verifyAtKeyRoot. schemeOverOneHashFunction (above) does more: it implements the separate oracles of verifyAtKeyRoot by the single hash function (§4.1). ArgumentSystem.ofArgument presents the result as an argument system.

DefinitionThe inner compiler: the argument system made from an inputJohnson/Top/InnerCompiledVerifier.lean:124–125
In words
In Lean · Johnson/Top/InnerCompiledVerifier.lean, lines 124–125

the file's variables

variable (r : InnerCompilerInput)

The inner compiler, which maps an input to an argument system whose verifier is innerCompiledVerifier. The verifier is built from the protocol and its layout (verifyAtKeyRoot); the committer and the prover are built from the input's fields commit and prove.

def innerSystem : ArgumentSystem :=
Rec.tokenArgumentSystem (schemeOverOneHashFunction r.oracleCoding (schemeOverTypedOracles r)) r.keyCode r.coinBound r.buildInstance r.fallbackProof r.nextToken
DefinitionThe argument system on prompts and output tokensJohnson/Top/FrontEnc.lean:54–55
In words
In Lean · Johnson/Top/FrontEnc.lean, lines 54–55

the file's variables

variable {I X IVK ISK Pf : Type} (G : ZKCP.Gen.Arg (rom 256) I X Unit IVK ISK Pf)
(E : ZKCP.Gen.Extractor (rom 256) I X Unit IVK Pf) (enc : IVK → Option ZKCP.Str) (bound : ℕ)
(build : List Token × List Token → List Token → Option X) (π₀ : IVK × Pf)
(nextToken : I → List Token → Option Token)

ArgumentSystem.ofArgument applied to the scheme tokenScheme, the committer commitE and the model nextToken. The key's code enc is one of tokenArgumentSystem's parameters.

def tokenArgumentSystem : ArgumentSystem :=
ArgumentSystem.ofArgument (tokenScheme G enc bound build π₀) (commitE G enc bound) nextToken
DefinitionAn argument system made from a schemeVerifiableInference/OfArgument.lean:62–73
In words
In Lean · VerifiableInference/OfArgument.lean, lines 62–73
Given

the file's variables

variable {I Pf : Type} {bound : ℕ}
(A : ZKCP.Arg 256 I (List Token × List Token) Unit (ZKCP.Digest 256) (I × Fin (bound + 1)) Pf)
(commit : I → Fin (bound + 1) → ZKCP.OComp 256 (ZKCP.Digest 256))
(nextToken : I → List Token → Option Token)

Turns a scheme into an argument system. It uses the scheme's prover and verifier; the committer comes from the separate argument commit, not from the scheme.

def ArgumentSystem.ofArgument : ArgumentSystem where
Value

the weights are the scheme's indices

Weights := I

there are no public parameters

PublicParameters := Unit
publicParameters := fun _ => ()

the committer's randomness: a number from 0 to bound

CommitmentRandomness := Fin (bound + 1)

a proof: a proof of the scheme, Pf

Proof := Pf

the model is nextToken

nextToken := nextToken

the committer samples one number

sampleCommitmentRandomness := .sample bound fun coins => .done coins

then the committer makes the queries of commit

commit := fun weights coins => deterministicOf (commit weights coins)

the prover is the scheme's, with the weights and that number as its key

prove := fun weights coins prompt output => ofUpload (A.P (weights, coins) (prompt, output) ())

the verifier makes the queries of the scheme's verifier

verify := fun commitment prompt output proof =>
deterministicOf (A.V commitment (prompt, output) proof)
Remark
  • Where commit or the scheme's verifier samples a number, the algorithm here continues with 0.
  • The scheme's verifier samples nothing wherever the public reading samples nothing (LayoutsByPublicReading.noCoin_scheme, Johnson/Top/InnerCompiledVerifierByPublicReading.lean:469).
  • The verify defined here is deterministic by construction (deterministicOf, VerifiableInference/Deterministic.lean:21).
  • Of this system, the statements of the six theorems use only the verifier.
DefinitionThe scheme on prompts and output tokensJohnson/Top/FrontEnc.lean:42–44
In words
In Lean · Johnson/Top/FrontEnc.lean, lines 42–44

the file's variables

variable {I X IVK ISK Pf : Type} (G : ZKCP.Gen.Arg (rom 256) I X Unit IVK ISK Pf)
(E : ZKCP.Gen.Extractor (rom 256) I X Unit IVK Pf) (enc : IVK → Option ZKCP.Str) (bound : ℕ)
(build : List Token × List Token → List Token → Option X) (π₀ : IVK × Pf)
(nextToken : I → List Token → Option Token)

Applies three transformations to the scheme on typed instances, innermost first: the key's digest becomes the verifier's key (digestKeyScheme), the committer's random choices are sampled first (Arg.coinsFirst), and the instance is built from the prompt, the output tokens and further tokens in the proof (Arg.buildInstance).

def tokenScheme : ZKCP.Arg 256 I (List Token × List Token) Unit (ZKCP.Digest 256)
(I × Fin (bound + 1)) (List Token × (IVK × Pf)) :=
((digestKeyScheme G enc).coinsFirst bound).buildInstance build (fun _ => []) π₀
DefinitionThe scheme with the key's digest as the commitmentJohnson/Top/FrontEnc.lean:40
In words
In Lean · Johnson/Top/FrontEnc.lean, lines 40–40

the file's variables

variable {I X IVK ISK Pf : Type} (G : ZKCP.Gen.Arg (rom 256) I X Unit IVK ISK Pf)
(E : ZKCP.Gen.Extractor (rom 256) I X Unit IVK Pf) (enc : IVK → Option ZKCP.Str) (bound : ℕ)
(build : List Token × List Token → List Token → Option X) (π₀ : IVK × Pf)
(nextToken : I → List Token → Option Token)

Arg.digestKey applied to the scheme with one request per proof (oneOf): the commitment is the digest of the verifier's key.

def digestKeyScheme := (ZKCP.SpecialAny.oneOf G).digestKey enc
DefinitionA scheme whose verifier holds only a digest of its keyZKCP/DigestKey.lean:75–79
In words
In Lean · ZKCP/DigestKey.lean, lines 75–79

the file's variables

variable {lam : ℕ} {I X W IVK ISK Pf : Type}

Shortens the commitment: the committer publishes the hash of the verifier's key, each proof contains that key, and the verifier is verifyDigestKey.

def Arg.digestKey (A : Arg lam I X W IVK ISK Pf) (enc : IVK → Option Str) :
Arg lam I X W (Digest lam) (IVK × ISK) (IVK × Pf) where
C := fun i => (A.C i).bind fun keys => (keyDigest enc keys.1).mapO fun digest => (digest, keys)
P := fun keys x w => (A.P keys.2 x w).mapO fun proof => (keys.1, proof)
V := verifyDigestKey A.V enc
DefinitionThe committer's random choices, sampled firstZKCP/CoinsFirstArg.lean:59–64
In words
In Lean · ZKCP/CoinsFirstArg.lean, lines 59–64

the file's variables

variable {lam : ℕ} {I X W PP IVK ISK Pf : Type}

Makes the commitment randomness a single number that is sampled first, as an argument system requires. The verifier is unchanged. If the bound suffices for the committer, the verifier's key is distributed as before; for other bounds, nothing is claimed about how the two distributions compare.

def Arg.coinsFirst (A : Arg lam I X W IVK ISK Pf) (bound : ℕ) :
Arg lam I X W IVK (I × Fin (bound + 1)) Pf where
C := fun i => .sample bound fun coins =>
((A.C i).withCoins coins.val).mapO fun key => (key.1, (i, coins))
P := fun secret x w => ((A.C secret.1).withCoins secret.2.val).bind fun key => A.P key.2 x w
V := A.V
DefinitionThe input's scheme, over the separate oraclesJohnson/Top/InnerCompiledVerifier.lean:119–121
In words
In Lean · Johnson/Top/InnerCompiledVerifier.lean, lines 119–121

the file's variables

variable (r : InnerCompilerInput)

The input's scheme over the separate oracles. Its committer and prover are the input's fields commit and prove. Its verifier is verifyAtKeyRoot, whose key is a root with its out-of-domain sample.

def schemeOverTypedOracles : ZKCP.Gen.Arg (typedOracleFamily 256 r.queryLayout.K (typedOracleCarrier r.protocol r.LeafBody r.offlineRoundSplits r.linkRoundSplits)) r.Index r.Instance Unit
(KeyRoot 256 r.protocol) r.ProverKey (OfflineLinkOnlineProof 256 r.protocol r.offlineRoundSplits r.linkRoundSplits) :=
⟨r.commit, r.prove, verifyAtKeyRoot r.queryLayout r.seedQueries r.answerCode r.fixedSample r.compilerParameters⟩
The record Compilable and its parts · 5 cards
DefinitionWhat compile takesJohnson/Face/Compiler.lean:289–309
In words
In Lean · Johnson/Face/Compiler.lean, lines 289–309

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}

Everything that compile takes: one record with seven fields.

structure Compilable where
Public side

publicSide: the public side, including:

  • the protocol
  • the layouts of its hash queries
  • the model, which the verifier does not read
  • a test of whether the verifier takes the public files at all (if not, it rejects)
  • two public readings: the digest of the public files, which the verifier obtains from the hash function, and a second value that it reads after that
/-- The protocol, its layouts, the readings, the model. -/
publicSide : PublicSide
For the honest side

wiring:

  • the same layouts, as read by the committer and the prover, with a proof that they equal the verifier's
  • a default instance, used where a request cannot be turned into an instance
/-- The layouts as the committer and the prover read them. -/
wiring : CompilerWiring publicSide

provers: the honest provers of the protocol's three interactive oracle proofs

/-- The honest provers. -/
provers : HonestProvers publicSide.protocol

settings: what the honest committer and prover choose in addition to their three IOP provers, at each value of the family's public reading, including:

  • how many nonces a search may try
  • how many copies of the committed table there are
  • which public strings its salts begin with
/-- What the honest side chooses beside its provers, at each value of the public reading. -/
settings : (reading : wiring.family.D) → CompiledSettings (wiring.layoutAtReading reading) provers

firstBlockTest: a test on a query and the first hash block of its answer; the committer and the prover query the other blocks only if it passes (meant for nonce searches)

/-- The test on an answer's first hash block by which a search for a nonce decides whether to ask
the other blocks: a failed try costs one call. -/
firstBlockTest : (reading : wiring.family.D) → Rom.More (typedOracleFamily 256
(publicSide.layoutAt wiring.baseDigest wiring.baseFurther).input.queryLayout.K
(typedOracleCarrier (publicSide.layoutAt wiring.baseDigest wiring.baseFurther).input.protocol
(publicSide.layoutAt wiring.baseDigest wiring.baseFurther).input.LeafBody
(publicSide.layoutAt wiring.baseDigest wiring.baseFurther).input.offlineRoundSplits
(publicSide.layoutAt wiring.baseDigest wiring.baseFurther).input.linkRoundSplits)) 256

coinBound: the honest committer samples one number from 0 to this bound

/-- The honest committer samples one number from 0 to this. -/
coinBound : ℕ
Proof format

format: how a proof is written down and parsed

/-- The proof format. -/
format : ProofFormat publicSide.protocol publicSide.offlineRoundSplits publicSide.linkRoundSplits
Remark

The verifier that compile builds reads only publicSide and the parser in format.

DefinitionThe public side of what is compiled, for one set of public filesJohnson/Face/Compiler.lean:125–149
In words
In Lean · Johnson/Face/Compiler.lean, lines 125–149
Given

the file's variables

variable {Index Instance : Type}

The public side of what is compiled, for one set of public files.

structure PublicSide where
Fields

the type Index of the protocol's indices (what is committed)

/-- What is committed, as the protocol sees it. -/
Index : Type

the type Instance of the protocol's instances

/-- What a session proves. -/
Instance : Type

the protocol: protocol (HolographicProtocol, §3)

/-- The protocol. -/
protocol : HolographicProtocol Index Instance

which rounds of the offline IOP a batch shares: offlineRoundSplits

/-- Which rounds of the offline protocol are shared by a batch. -/
offlineRoundSplits : RoundSplits protocol.offline.shape

which rounds of the link IOP a batch shares: linkRoundSplits

/-- Which rounds of the link protocol are shared by a batch. -/
linkRoundSplits : RoundSplits protocol.link.shape

whether the verifier takes these files at all: filesInScope

/-- Whether the verifier takes these public files at all. -/
filesInScope : Bool

the first reading of the files, filesDigest: their digest, obtained from the hash function

/-- The first public reading: the digest of the public files, asked of the hash function. -/
filesDigest : DeterministicAlgorithm Digest

the type Further of what the second reading returns

/-- What the second public reading returns. -/
Further : Type

the second reading, furtherReading, which takes the digest as input

/-- The second public reading. -/
furtherReading : Digest → DeterministicAlgorithm Further

the layout in force, layoutAt, as a function of what the two readings return

/-- The layout in force, as a function of what the two readings returned. -/
layoutAt : Digest → Further → HashLayoutWithProverFields protocol offlineRoundSplits linkRoundSplits

the model: model

/-- The model. -/
model : Model

the map from weights to what is committed: indexOf

/-- From the weights, what the protocol commits to. -/
indexOf : model.Weights → Index
Remark

The verifier reads neither the model nor that map. Of the other fields, it does not read the type Index, reads only the verifier's side of the protocol, and does not read the six further fields of a layout shown on the next card (innerCompiledVerifier_eq, Johnson/Top/InnerCompiledVerifierSide.lean:79).

DefinitionA hash layout with six more fields that the verifier does not readJohnson/Face/Compiler.lean:85–97
In words
In Lean · Johnson/Face/Compiler.lean, lines 85–97
Given

the file's variables

variable {Index Instance : Type}

A hash layout (it extends HashLayout) with six more fields of the inner compiler's input (InnerCompilerInput), which the verifier does not read:

structure HashLayoutWithProverFields (protocol : HolographicProtocol Index Instance)
(offlineRoundMarks : RoundSplits protocol.offline.shape)
(linkRoundMarks : RoundSplits protocol.link.shape) extends
HashLayout protocol offlineRoundMarks linkRoundMarks where
Fields

nextToken: maps an index and tokens to a token or nothing

nextToken : Index → List Token → Option Token

ProverKey: a type

ProverKey : Type

commit: maps an index to an algorithm that may sample numbers, queries the separate oracles, and returns a key root and a ProverKey

commit : Index → OComp (typedOracleFamily 256 queryLayout.K
(typedOracleCarrier protocol LeafBody offlineRoundMarks linkRoundMarks)) (KeyRoot 256 protocol × ProverKey)

prove: maps a ProverKey and a batch of instances to an algorithm that may sample numbers, queries the separate oracles, and returns the batch's proofs (ZKCP.Gen.Slots)

prove : ProverKey → (batch : List (Instance × Unit)) → OComp (typedOracleFamily 256 queryLayout.K
(typedOracleCarrier protocol LeafBody offlineRoundMarks linkRoundMarks))
(ZKCP.Gen.Slots (OfflineLinkOnlineProof 256 protocol offlineRoundMarks linkRoundMarks) batch)

coinBound: a number

coinBound : ℕ

fallbackProof: a key root and a proof

fallbackProof : KeyRoot 256 protocol × OfflineLinkOnlineProof 256 protocol offlineRoundMarks linkRoundMarks
DefinitionThe layouts as read by the committer and the prover, and a proof that they equal the verifier'sJohnson/Face/Compiler.lean:155–167
In words
In Lean · Johnson/Face/Compiler.lean, lines 155–167
Given

the file's variables

variable {Index Instance : Type}

The layouts as read by the committer and the prover, for a public side side.

structure CompilerWiring (side : PublicSide) where
Fields

baseDigest, baseFurther: one fixed value for each of the two readings, used in the family's type

/-- Values of the two readings at which the family is typed. -/
baseDigest : Digest
/-- The same for the second reading. -/
baseFurther : side.Further

family: the layouts as one family, indexed by the value of the public reading

/-- The layouts as one family in one value of the public reading. -/
family : LayoutFamily (side.layoutAt baseDigest baseFurther).input

pair: maps the two readings' values to a value of the family's public reading (of type family.D)

/-- Where the two readings' values stand in the family's. -/
pair : Digest → side.Further → family.D

a proof (agree) that they are the verifier's: for all values of the two readings, the family at their pair equals the input of side.layoutAt at those values

/-- The verifier's layouts and the family are one wiring. -/
agree : ∀ digest further, family.at (pair digest further) = (side.layoutAt digest further).input

a default instance (fallbackInstance), used where a request cannot be turned into an instance

/-- The instance that stands where a request builds none. -/
fallbackInstance : side.Instance
DefinitionHow a proof is written downJohnson/Face/Compiler.lean:170–179
In words
In Lean · Johnson/Face/Compiler.lean, lines 170–179
Given

the file's variables

variable {Index Instance : Type}

The proof format: the type of a proof as submitted, a parser and a writer.

structure ProofFormat (protocol : HolographicProtocol Index Instance)
(offlineRoundMarks : RoundSplits protocol.offline.shape)
(linkRoundMarks : RoundSplits protocol.link.shape) where
Fields

Form: the type of a proof as submitted

/-- A written proof. -/
Form : Type

parse, the parser, part of the verifier: given a prompt, an output and any form, it returns a typed proof

/-- The parser, part of the verifier: from any form it returns some typed proof. -/
parse : List Token → List Token → Form →
DeterministicAlgorithm (TypedProof protocol offlineRoundMarks linkRoundMarks)

write, the writer, part of the honest prover: maps a typed proof to a form

/-- The writer, part of the honest prover. -/
write : TypedProof protocol offlineRoundMarks linkRoundMarks → Form
The expansion of compile · 2 cards
DefinitionThe argument system for a model, a CompiledSide and a verifierJohnson/Face/Compiler.lean:321–334
In words
In Lean · Johnson/Face/Compiler.lean, lines 321–334
Given

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}

types Weights and Form; a model, nextToken

def systemOf {Weights Form : Type} (nextToken : Weights → List Token → Option Token)

the four parts that the verifier does not read, side (CompiledSide, the next card)

(side : CompiledSide Weights Form)

a verifier, verifier

(verifier : Commitment → List Token → List Token → Form → DeterministicAlgorithm Bool) :
Value

The argument system made from these three:

ArgumentSystem where

the weights have type Weights

Weights := Weights

It has no public parameters.

PublicParameters := Unit
publicParameters := fun _ => ()

the commitment randomness is side's

CommitmentRandomness := side.Randomness

a proof is a Form

Proof := Form

the model is nextToken

nextToken := nextToken

the sampler, the committer and the prover are those of side

sampleCommitmentRandomness := side.sample
commit := side.commit
prove := side.prove

the verifier is verifier

verify := verifier
DefinitionThe four parts of an argument system that its verifier does not readJohnson/Face/Compiler.lean:314–318
In words
In Lean · Johnson/Face/Compiler.lean, lines 314–318

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}

The four parts of an argument system that its verifier does not read.

structure CompiledSide (Weights Form : Type) where
Randomness : Type
sample : RandomizedAlgorithm Randomness
commit : Weights → Randomness → DeterministicAlgorithm Commitment
prove : Weights → Randomness → List Token → List Token → RandomizedAlgorithm Form

The honest committer stores the weights as an encoded table, the first table, and answers requests from further encodings of it, called copies. Each copy has a link proof, which is meant to show that the copy decodes to the same index as the first table. The number of copies is a setting in honestProversAndSettings, which produces one copy (furtherCopies = 0).

The committer encodes the index as the first table, hashes that table into a Merkle tree, computes its out-of-domain sample and adds the offline proof. Each copy gets a link proof. The commitment has 256 bits. It is the hash function's answer on one bit string, the encoding of the key. The field keyCode of the hash layout computes this string from the key (the first table's Merkle root and its out-of-domain sample) and a part of what is read from the public files. The compiler does not fix which part. For FlashProve it is the digest of the files; this was found by reading the Lean code and is not stated by any theorem (lean/GAPS.md, 5).

The verifier takes the first table's root and out-of-domain sample from the proof, computes the same bit string, and compares the hash function's answer on it with the commitment.

It then recomputes the out-of-domain seeds of the first table and of the copy that the proof uses, and runs the compiled verifiers of the three IOPs: offline on the first table's root, link on both roots, and online on the copy's root and the request. Finally, it applies a test supplied by the hash layout (num) to the number that the proof gives for that copy and to the parts of the online proof that are sent in the clear. The compiler assumes nothing about this test.

Some rounds require proof of work. The prover must find a nonce for which the round's Fiat–Shamir answer passes a test on some of its bits, and the verifier rejects otherwise. In FlashProve's IOPs these bits are further bits of the round's challenge, and the IOP's verifier rejects unless all of them are 0 (Appendix A, The terms of this appendix, proof-of-work bits). The search for a nonce is called proof-of-work grinding; each failed attempt costs one hash query.

4.4 FlashProve

This section applies the compiler to one input, flashProveAtFiles, and states what is required of the result. compile (flashProve setup) is the compiled argument system: a committer, a prover and a verifier that query a random oracle. The six theorems (Final statements) are about compile at this input only.

finalSoundnessError q = 16 (q + 1 + 2^23) / 2^128 + (q + 2^23 + 3)^2 / 2^256. Here q counts the hash queries of the committer and the prover together, honest or adversarial (in sound, adversarial). finalBindingError is defined below, among the values substituted for the parameters. finalCompletenessError is 2^-40.

DefinitionFlashProve, with the public files, the model's settings, and the honest provers and settings as argumentsJohnson/Face/FinalStatement.lean:151–159
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 151–159
Given

The record that compile takes as input. Its arguments:

  • files: the public files
  • settings: the settings of the integer model
  • honest: the honest provers and settings
def flashProveAtFiles (files : PublicFiles) (settings : Settings) (honest : HonestProversAndSettingsAtFiles files settings) :

a Compilable (§4.3). flashProveAtFiles is the whole record that compile takes.

Compilable where
Value

publicSide and wiring contain the protocol, the model and the layout of the hash queries

publicSide := flashProvePublic files settings

the fallbackInstance in wiring is taken from the honest provers and settings

wiring := flashProveWiring files settings honest.fallbackInstance

provers and settings are taken from the honest provers and settings

provers := honest.provers
settings := honest.compiledSettings

firstBlockTest is the test on the first hash block of an answer that determines whether a nonce search queries the other blocks

firstBlockTest := flashFirstBlockTest files

coinBound is taken from the honest provers and settings

coinBound := honest.coinBound

format contains the parser and the writer of a proof's bytes

format := formatOf flashProveDescription files flashProveDescription.Form (flashProveDescription.parse files) (bytesWriter files)
Remark

Eight of the twelve fields of its public side are taken from another record in the library, the protocol's description FlashProve.flashProveDescription (Appendix A); the other four are the test on the public files, their digest, the model, and the map from weights to what is committed.

The protocol (§3) is a part of that description and a function of the public files; it is assembled from many parts (Appendix A, How FlashProve's description is assembled).

provers, settings, coinBound and the fallbackInstance inside wiring are taken from the honest provers and settings; the other fields depend only on the public files and the model's settings.

DefinitionConditions on the public files: in scope, read as parameters, exact matchJohnson/Face/FinalStatement.lean:240–243
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 240–243

Three conditions on the three public files (parameter, layout and scale file). The verifier tests only the first (filesInScope):

structure FilesTaken (files : PublicFiles) (parameters : Inst.Model.ScalesAndPolicy) : Prop where

inScope: the layout file is that of the stored full-size example, and the parameter file equals that example's byte for byte, except for eight numbers (five of the normalizations, three of the acceptance policy); the test also requires that the files are read without error and that 2^8 ≤ theta

inScope : InScope files = true

read: readFiles returns parameters

read : readFiles files = .ok parameters

exactMatch: the policy is exact match (the output must be the model's, token for token); the verifier does not test this

exactMatch : parameters.pol = Inst.Model.AcceptancePolicy.exact
Not covered

Thus the six theorems concern one model shape. The scale file and the five numbers of the normalizations are free, subject to what readFiles accepts. Exact match fixes the three numbers of the acceptance policy.

DefinitionThe public files from which the protocol can be builtJohnson/Face/FinalStatement.lean:246–248
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 246–248

The condition on the public files under which the six theorems hold:

structure FilesInUse (files : PublicFiles) (parameters : Inst.Model.ScalesAndPolicy) : Prop extends

FilesTaken (the card above), and

FilesTaken files parameters where

the test protocolDataWellFormed, which depends only on the three public files and is computed with the second hash function (§5): the protocol's data can be built from them without error, no list of rounds is empty, the data for the key and for the proof have the full-size depth, and the sizes are within fixed limits. The verifier also performs this test: the decisions of its three IOPs reject everything if it fails (theKeyGateAt, theLinkGateAt, theProofGateAt; see Appendix A, How FlashProve's description is assembled)

pass : protocolDataWellFormed (asDescriptionFiles files) = true
Remark

All six theorems assume FilesInUse, through PublicSetup; the proofs of sound and refusedHandsOutNoProof use only FilesTaken.

DefinitionThe bound in the zero-knowledge theorems: 2^-154AtFullSide/Face/ZeroKnowledgeNumber.lean:29
In words
In Lean · AtFullSide/Face/ZeroKnowledgeNumber.lean, lines 29–29

2^-154, the bound in the zero-knowledge theorems zeroKnowledgeOnCanServe and zeroKnowledgeAtEveryRequest. It is a statistical distance, for up to 688,127 replies and 2^64 hash queries; it is not a security level.

def finalZeroKnowledgeError : ℝ≥0∞ := (2⁻¹ : ℝ≥0∞) ^ 154
Remark

The proof gives the same statement for any error that is at least stepErrorAtTheStops = 2^-157 + 688,127 · 2^-174 (AtFullSide/E2E/TheCompiledStepFilled.lean:132).

TheoremThe stored full-size example satisfies FilesInUseAtFullSide/CompletenessAndZeroKnowledge/LinesAtStoredFiles.lean:39
In words
In Lean · AtFullSide/CompletenessAndZeroKnowledge/LinesAtStoredFiles.lean, lines 39–39

The library's stored full-size example of the three files (VerifierAndGoals.storedPublicFiles, a value written in Lean and not tied to any file on disk) satisfies FilesInUse.

theorem filesInUse_stored : FilesInUse storedPublicFiles storedParameters
Remark

So the hypothesis of the six theorems can be met.

The same verifier, defined from the public side only · 2 cards

The verifier of compile at flashProveAtFiles is finalVerifier, for arbitrary honest provers and settings (theorem compile_flashProve_verify).

DefinitionThe verifier of the final systemJohnson/Face/FinalStatement.lean:179–181
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 179–181

The verifier of the final system: compiledVerifier applied to FlashProve's public side and parser. Its two arguments are the public files and the model's settings (IntegerTransformer.Settings); it takes none of the honest provers and none of the honest committer's and prover's settings.

def finalVerifier (files : PublicFiles) (settings : Settings) :
Commitment → List Token → List Token → flashProveDescription.Form → DeterministicAlgorithm Bool :=
compiledVerifier (flashProvePublic files settings) (flashProveDescription.parse files)
TheoremThe verifier of the compiled FlashProve is the final verifierJohnson/Face/FinalStatement.lean:200–202
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 200–202

For all public files, all settings of the model and all honest provers and settings, the verifier of compile at flashProveAtFiles is finalVerifier at these files and settings.

theorem compile_flashProve_verify (files : PublicFiles) (settings : Settings)
(honest : HonestProversAndSettingsAtFiles files settings) :
(compile (flashProveAtFiles files settings honest)).verify = finalVerifier files settings
Remark

Hence the verifier does not depend on the honest provers and settings.

The values substituted for the parameters · 12 cards
DefinitionThe completeness error boundJohnson/Face/FinalStatement.lean:219
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 219–219

finalCompletenessError is the constant VerifierAndGoals.completenessErrorBound, which is (1/2)^40 = 2^-40. In the theorem completeOnCanServe it bounds the probability that the verifier rejects the honest prover's proof. A nonzero bound allows for the honest prover's searches for a proof-of-work nonce, which stop after a bounded number of tries.

abbrev finalCompletenessError : ℝ≥0∞ := completenessErrorBound
DefinitionThe soundness error boundJohnson/Face/FinalStatement.lean:225
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 225–225

The bound in the soundness theorem, as a function of the number of hash queries.

  • finalSoundnessError q is VerifierAndGoals.soundnessErrorInQueries q 1
  • with T = q + 1 + 2^23 it is 16 · T / 2^128 + (T + 2)^2 / 2^256, which is about q / 2^124 + 2^-101
  • q bounds the hash queries of the committer and the prover together
  • 1 is the allowance for the parser's queries
  • 2^23 (VerifierAndGoals.verifierQueryAllowance) is the allowance for the verifier's own queries
abbrev finalSoundnessError (queries : ℕ) : ℝ≥0∞ := soundnessErrorInQueries queries 1
DefinitionThe bound on bindingJohnson/Face/FinalStatement.lean:228
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 228–228

finalBindingError q is VerifierAndGoals.levelError q, the larger of VerifierAndGoals.soundnessErrorInQueries q (2^23) and VerifierAndGoals.bindingErrorInQueries q. The first is 16 · T / 2^128 + (T + 2)^2 / 2^256 at T = q + 2^23 + 2^23; the second is 16 · (q + 2^23) / 2^128 + (q + 2^48 + 2^23 + 2)^2 / 2^256, where 2^48 is VerifierAndGoals.honestBudget. The value is about q / 2^124 + 2^-100.

abbrev finalBindingError (queries : ℕ) : ℝ≥0∞ := levelError queries
DefinitionThe budget of hash queries of the honest sampler, committer and proverJohnson/Face/FinalStatement.lean:222
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 222–222

honestQueryBudget is the constant VerifierAndGoals.honestBudget, which is 2^48. The theorem repliesFit uses it through WithinBudget (§6.1): one run each of the honest sampler of commitment randomness, the honest committer and the honest prover may together make at most this many queries to the hash function.

abbrev honestQueryBudget : ℕ := honestBudget
DefinitionThe verifier's hash-query bound in zero knowledgeJohnson/Face/FinalStatement.lean:231
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 231–231

finalVerifierQueries is the constant VerifierAndGoals.queryBudget, which is 2^64. The theorems on zero knowledge bound the statistical distance only for verifiers that make at most this many hash queries.

abbrev finalVerifierQueries : ℕ := queryBudget
DefinitionThe bound on the number of replies under one commitment, in zero knowledgeJohnson/Face/FinalStatement.lean:234
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 234–234

finalReplyCount is the number 688127. The theorems on zero knowledge give their bound for up to this many replies under one commitment, and the theorem repliesFit shows that it is at most onlineRunsPerCopy. It is the largest s with 62 + s · 64 ≤ 44,040,191, the second inequality of TableBudgetFits. A reply to a refused request, which is the empty proof, also counts.

abbrev finalReplyCount : ℕ := 688127
DefinitionFlashProve's honest provers and settings, as a recordJohnson/Face/FinalStatement.lean:128–140
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 128–140

HonestProversAndSettingsAtFiles files settings collects what flashProveAtFiles needs for the honest committer and prover.

structure HonestProversAndSettingsAtFiles (files : PublicFiles) (settings : Settings) where
Fields

fallbackInstance, the instance used when no instance can be built from the request

/-- The instance that stands where a request builds none. -/
fallbackInstance : (flashProveDescription.C files).X

provers, the honest provers of the protocol (HonestProvers, §3)

/-- The honest provers. -/
provers : HonestProvers ((flashProveDescription.F files).withProvers (flashProveDescription.P files))

compiledSettings, the compiler's choices for the honest committer and prover (a CompiledSettings for each value of the public reading), such as the limits on the nonce searches and the number of copies of the committed table

/-- What the honest side chooses beside them, at each value of the public reading. -/
compiledSettings : (reading : (layoutsOfBuiltDescription flashProveData allZeroDigest [] files).D) →
CompiledSettings ((flashProveWiring files settings fallbackInstance).layoutAtReading reading)
provers

coinBound, where the honest committer samples one number from 0 to coinBound

/-- The honest committer samples one number from 0 to this. -/
coinBound : ℕ

onlineRunsPerCopy, the number of runs of the online IOP that the honest settings assign to one copy

/-- The sessions that one copy bears: a number that compile does not read. -/
onlineRunsPerCopy : ℕ
Remark
  • The verifier finalVerifier does not take this record as an argument.
  • compile does not read onlineRunsPerCopy; among the six theorems, only repliesFit mentions it.
DefinitionThe factor in the soundness errorLadder/Bits.lean:85
In words
In Lean · Ladder/Bits.lean, lines 85–85

The factor, 16, in the error bound soundnessErrorInQueries.

def errorFactorPerQuery : ℕ := 16
DefinitionThe term added to the adversary's and the parser's queries in the soundness errorLadder/Bits.lean:91
In words
In Lean · Ladder/Bits.lean, lines 91–91

The number that soundnessErrorInQueries adds to the adversary's and the parser's queries to account for the verifier's own queries. VerifierWithin (Ladder/Bits.lean:128, no card on this page) says what is counted and in which unit. The number is a choice; no statement other than VerifierWithin says that it is enough. The error of the theorem sound contains it, and sound has no hypothesis about it. In bindingErrorInQueries, where no verifier runs, it is slack.

def verifierQueryAllowance : ℕ := 2 ^ 23
DefinitionThe soundness errorLadder/Bits.lean:96–98
In words
In Lean · Ladder/Bits.lean, lines 96–98

The soundness error, where t bounds the adversary's queries and n the parser's: with T = t + n + verifierQueryAllowance it is errorFactorPerQuery · T / 2^128 + (T + 2)² / 2^256. That is 16 / 2^128, or 124 bits, for each query, and about 2^-101 at t = n = 0.

def soundnessErrorInQueries (t n : ℕ) : ℝ≥0∞ :=
((errorFactorPerQuery * (t + n + verifierQueryAllowance) : ℕ) : ℝ≥0∞) * (2 : ℝ≥0∞)⁻¹ ^ 128 +
(((t + n + verifierQueryAllowance + 2) ^ 2 : ℕ) : ℝ≥0∞) / 2 ^ 256
DefinitionThe binding errorLadder/Bits.lean:110–112
In words
In Lean · Ladder/Bits.lean, lines 110–112
Given

The binding error, where t bounds the committer's and the opener's queries together:

def bindingErrorInQueries (t : ℕ) : ℝ≥0∞ :=
Value

the linear term: errorFactorPerQuery · (t + verifierQueryAllowance) / 2^128

((errorFactorPerQuery * (t + verifierQueryAllowance) : ℕ) : ℝ≥0∞) * (2 : ℝ≥0∞)⁻¹ ^ 128 +

plus the square term: (t + honestBudget + verifierQueryAllowance + 2)² / 2^256

(((t + honestBudget + verifierQueryAllowance + 2) ^ 2 : ℕ) : ℝ≥0∞) / 2 ^ 256
Remark

At t = 0 this error is about 2^-101, and finalBindingError, the maximum of it and a soundness term, is about 2^-100.

The experiment in the second clause of SoundAndBinding runs the honest committer once more. That run's queries are not the adversary's; honestBudget accounts for them in the square term.

The bad event that such a run can cause is that one of its answers equals another answer or a value that the adversary wrote. A bound on only these events has the form 3 · (t + 2 q + 2)² / 2^256, where q bounds the queries of one run of the committer.

Wherever this error is less than 1, that bound is smaller than it because of the linear term, not the square term; without the linear term, the square term would have to take that form.

The linear term may also have to account for events that a committer can search for, such as a collision at a seed.

DefinitionThe larger of the soundness error and the binding errorLadder/PackageBits.lean:99
In words
In Lean · Ladder/PackageBits.lean, lines 99–99

The larger of the soundness error at 2^23 parser queries and the binding error.

def levelError (t : ℕ) : ℝ≥0∞ := max (soundnessErrorInQueries t verifierQueryAllowance) (bindingErrorInQueries t)

The numbers.

propertyboundat
SoundnessfinalSoundnessError q = 16 (q + 1 + 2^23) / 2^128 + (q + 2^23 + 3)^2 / 2^256, about q / 2^124 + 2^-101q hash queries by the committer and the prover together
BindingfinalBindingError q, about q / 2^124 + 2^-100q hash queries by the committer and the prover or opener together
CompletenessfinalCompletenessError = 2^-40one request that can be served and whose output tokens are the model's
Zero knowledgefinalZeroKnowledgeError = 2^-154, a statistical distanceup to 688,127 replies and 2^64 hash queries

Numerically, the soundness error is about 2^-100 at 2^23 hash queries, and about q / 2^124 above that (2^-60 at q = 2^64). The fixed term 2^-101 comes from the constant 2^23 in the formula, which accounts for the verifier's own hash queries. It is part of the bound as stated, and sound is proved without any hypothesis on these queries. None of these figures is a security level.

5. The explicit hash function

In the theorems on soundness, binding, completeness and zero knowledge, the hash function is sampled uniformly at random, so these are statements in the random oracle model. compile does not take the hash function as a parameter. A program uses one concrete hash function instead. leanVerifier uses blake2bHash, a function from bit strings to 256 bits built from BLAKE2b (Appendix B), in place of the random oracle.

The verifier instantiated with BLAKE2b
  • leanVerifier is the verifier of §4.3 with each of its queries answered by blake2bHash. finalVerifierProgram is defined for arbitrary public files, using only the public part of the compiler's input. At the files of a public setup it equals leanVerifier (leanVerifier_eq, below).
  • The argument form of leanVerifier is what this page calls the proof as submitted: a list of tokens and five byte strings. It is not the file that the prover writes. A program outside Lean splits the prover's files into the five byte strings. The tokens are the tokens of the request that follow the checked positions; they are read from the request file (formOf, Johnson/PVR/Program.lean:113).
  • verdictOf (card below) reads eleven files: the three public files; the user's three files, from which the commitment, the prompt and the output are parsed; and five parsed files, which are the five byte strings of form.
  • verdictOf uses its own definitions of several objects. This page names three of them:
    • the order of the steps (fastSteps, Johnson/Top/Fire/Code/VerifyVFastStepsD.lean:103);
    • the verifier of one file (verifyWholeX, OnBytes/Maker/LessWhole.lean:158; for the link, stagesWL, Johnson/RunOne/StrictLinkWL.lean:68);
    • how a typed query is answered from the hash function on bytes (famFQ, Johnson/PV/MFullQ.lean:55).
The Fiat–Shamir heuristic

The heuristic is the assumption that, in the theorems on soundness, binding, completeness and zero knowledge, blake2bHash may be treated as a function sampled uniformly at random (the random oracle model). For zero knowledge, the simulator also answers the hash queries in place of this function (§8). The heuristic is not a theorem and is not stated in Lean. It is an assumption about the hash function and this argument system together. It also carries one assumption about the second hash function: that blake2bHash behaves like a random function that is independent of it (below).

DefinitionThe executable verifier, with BLAKE2b in place of the random oracleAtFullSide/Face/ExecutableVerifierIsLeanVerifier.lean:40–43
In words
In Lean · AtFullSide/Face/ExecutableVerifierIsLeanVerifier.lean, lines 40–43
Given

three public files, a commitment, a prompt, output tokens and the parsed proof; it returns a verdict or nothing

def executableVerifier (files : PublicFiles) (commitment : Commitment) (prompt output : List Token)
(proof : FlashProve.FormBytes) : Option Bool :=
Value

the verdict (verdictThe) read off the executable form's run (rideThe), both with Fmt.oracle, the hash function on byte strings built from BLAKE2b (Appendix B)

PV.Ride.verdictThe files _root_.Fmt.oracle proof
(PV.Ride.rideThe files _root_.Fmt.oracle proof commitment prompt output)
Not covered

It is defined for all public files. It tests that they are in the verifier's scope, can be read and are well formed. It does not check that they specify the exact-match policy. leanVerifier is defined only for a public setup. It also uses the protocol's second, fixed hash function (§5).

Remark
  • Its type is Option Bool, but its value is never none. This follows from verdictThe_eq with Fmt.size_oracle; no theorem of the file states it.
  • "Executable" means that Lean compiles the definition of executableVerifier, which is not marked noncomputable. Lean's list of axioms for it also names the axiom of choice. Walks from the executable form's code (verdictThe, rideOf, letsThe), through definitions and never into a proof, made over Lean files that differ from this repository's, met no definition of the library that names the axiom of choice. The only definitions met that name it are two of Lean's core library (Classical.propDecidable, Classical.ofNonempty). So, as far as Lean's evaluator, compiler and runtime are trusted, no code that a run executes calls choice. This is not a theorem (lean/GAPS.md, 56).
TheoremverdictOf parses the claim and applies the executable verifierAtFullSide/Face/ExecutableVerifierIsLeanVerifier.lean:60–64
In words
In Lean · AtFullSide/Face/ExecutableVerifierIsLeanVerifier.lean, lines 60–64
Given

the bytes of the eleven files

theorem verdictOf_eq_executableVerifier (given : PV.Program.Given) :
Then

the verdict of verdictOf

PV.Program.verdictOf given =

is obtained as follows: claimOf parses the claim from the user's files; if it fails, there is no verdict; otherwise executableVerifier is applied to the public files, the claim and the parsed proof (formOf)

(PV.Program.claimOf given).bind fun claim =>
executableVerifier (PV.Program.pubOf given) claim.commitment claim.prompt claim.output
(PV.Program.formOf given claim)
Remark

It is proved by unfolding definitions (rfl).

TheoremThe same equality, stated for verdictOfAtFullSide/Face/ExecutableVerifierIsLeanVerifier.lean:69–74
In words
In Lean · AtFullSide/Face/ExecutableVerifierIsLeanVerifier.lean, lines 69–74
Given

a public setup, the bytes of the eleven files, and a claim

theorem verdictOf_eq_leanVerifier (setup : PublicSetup) (given : PV.Program.Given)
If

the three public files among them are those of the setup

(claim : PV.Program.Claim) (sameFiles : PV.Program.pubOf given = setup.files)

and claimOf parses that claim from the user's files

(reads : PV.Program.claimOf given = some claim) :
Then

verdictOf returns the verdict of leanVerifier on that claim and the parsed proof (formOf)

PV.Program.verdictOf given =
some (leanVerifier setup claim.commitment claim.prompt claim.output
(PV.Program.formOf given claim))
Not covered

The command lean-verify does not enforce the hypothesis sameFiles (see the card executableVerifier_eq_leanVerifier, Final statements).

TheoremIf the claim can be read, verdictOf returns the value of finalVerifierProgramJohnson/Face/ExecutableVerifier.lean:40–44
In words
In Lean · Johnson/Face/ExecutableVerifier.lean, lines 40–44
Given

whenever the commitment, the prompt and the output can be read from the user's three files

theorem verdictOf_eq_finalVerifierProgram (g : PV.Program.Given) (c : PV.Program.Claim)
(reads : PV.Program.claimOf g = some c) (settings : Settings) :
Then

the verdict of verdictOf

PV.Program.verdictOf g =

equals finalVerifierProgram applied to these; the two definitions agree

some (finalVerifierProgram (PV.Program.pubOf g) settings c.commitment c.prompt c.output
(PV.Program.formOf g c))
Not covered
  • Of the command's eleven files, three are the public files, three are the user's, and five are parsed files from an unverified parser outside Lean. For the soundness theorem, an incorrect parsed file is a choice of the prover: it can cause an honest proof to be rejected, but can do no more than a prover can.
  • No theorem states that claimOf splits the user's three files as the format specifies (lean/GAPS.md, 37).
  • The verifier does not test that the public files specify exact match; the theorem sound does not cover acceptance under another policy.
  • finalVerifierProgram equals leanVerifier only for a public setup's files (leanVerifier_eq, below); the theorem verdictOf_eq_leanVerifier (above) combines the two.
  • No theorem concerns the execution of the command, or compiled or interpreted code.
Remark

The command lean-verify calls the three parts of verdictOf (claimOf, stepsOf, verdictAt) in order and prints between the calls. verdictOf is an executable form of the Lean verifier: a second implementation in Lean that uses the same definitions of the protocol's data and decisions.

The same verifier instantiated with BLAKE2b, defined from the public side only · 2 cards
DefinitionThe final verifier with BLAKE2bJohnson/Face/FinalStatement.lean:351–353
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 351–353

The final verifier with each of its hash queries answered by blake2bHash, the hash function on bit strings built from BLAKE2b (Appendix B). By definition, finalVerifier is the verifier of compile applied to flashProveAtFiles (compile_flashProve_verify, §4.4, whose proof is rfl).

The argument form is the proof as submitted, a list of tokens and five byte strings.

def finalVerifierProgram (files : PublicFiles) (settings : Settings) (commitment : Commitment)
(prompt output : List Token) (form : flashProveDescription.Form) : Bool :=
(finalVerifier files settings commitment prompt output form).evaluate blake2bHash
TheoremThe Lean verifier is finalVerifierProgramAtFullSide/Face/TheSixLines.lean:161–165
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 161–165

For every public setup, commitment, prompt, output and proof form, leanVerifier equals finalVerifierProgram (§5) at the setup's files and the settings that they determine. This says nothing about a run of the executable form.

theorem leanVerifier_eq (setup : PublicSetup) (commitment : Commitment) (prompt output : List Token)
(form : flashProveDescription.Form) :
leanVerifier setup commitment prompt output form =
finalVerifierProgram setup.files (settingsOfRead setup.readParameters) commitment prompt
output form
Remark

finalVerifierProgram is the value that verdictOf_eq_finalVerifierProgram refers to.

DefinitionFrom bytes to verdictJohnson/PVR/Program.lean:125–126
In words
In Lean · Johnson/PVR/Program.lean, lines 125–126

The executable form's accept-or-reject verdict on given bytes, if any.

def verdictOf (g : Given) : Option Bool :=
(claimOf g).bind fun c => verdictAt g c (stepsOf g c)
DefinitionThe verifier's decision under a given hash functionVerifiableInference/Statements.lean:62–65
In words
In Lean · VerifiableInference/Statements.lean, lines 62–65
Given

an argument system, a hash function, a commitment, a prompt, output tokens, a proof

def ArgumentSystem.accepts (system : ArgumentSystem) (hash : Hash) (commitment : Commitment)
(prompt output : List Token)
(proof : system.Proof) : Bool :=
Value

the verifier's decision under that hash function: accept or reject

(system.verify commitment prompt output proof).evaluate hash
TheoremThe verifier step of the experiments returns that decisionVerifiableInference/Checks.lean:31–35
In words
In Lean · VerifiableInference/Checks.lean, lines 31–35
Given

an argument system, a hash function, a commitment, a prompt, output tokens, a proof

theorem ArgumentSystem.run_verify (system : ArgumentSystem) (hash : Hash) (commitment : Commitment)
(prompt output : List Token)
(proof : system.Proof) :
Then

under that hash function, the verifier step of an experiment returns system.accepts hash commitment prompt output proof with probability 1

((system.verify commitment prompt output proof).toRandomized).run hash
= PMF.pure (system.accepts hash commitment prompt output proof)

The second hash function

The IOP being compiled itself uses a second hash function, secondHashFunction. It is a fixed function, built from BLAKE2b's compression function with a number written into the block counter. It is part of FlashProve's description (Appendix A); the six theorems do not take it as a parameter. It is therefore part of the compiled verifier, and hence of leanVerifier.

  • Where it is used. According to the comments in the Lean code, it is applied, among other places, to the public files when the protocol's public part is computed, and to the request in the verifier's tests on the instance. It has other uses, not all of which are listed on this page. For example, the test protocolDataWellFormed, the extractor and the honest online prover are defined using it. Through protocolDataWellFormed it also appears in the hypothesis of the six theorems.
  • How the theorems treat it. It is not modelled as a random oracle: the theorems on soundness, binding, completeness and zero knowledge sample one hash function and keep this one fixed. They assume no property of it, not even collision resistance. They are proved for this one function. A soundness statement for an arbitrary function in its place (G7', Ladder.lean) is stated in the library but not proved. Each theorem holds for every request in its scope, and hence also for a request in that scope that an adversary chooses knowing this function.
  • What the heuristic assumes about it. In the theorems, queries to this function are not queries to the sampled function, and the sampled function is independent of it. The heuristic replaces the sampled function by blake2bHash, which is built from the same compression function. It therefore also assumes that blake2bHash behaves like a random function that is independent of the second hash function. This assumption is made outside Lean and is not a hypothesis of any theorem (lean/LIMITS.md, Assumption 2, second half).

Running the verifier

The command lean-verify evaluates the Lean function run, an IO wrapper that calls the three parts of verdictOf in turn (claimOf, stepsOf, verdictAt), with BLAKE2b as the hash function. The theorem verdictOf_at shows that these three parts compose to verdictOf. verdictOf parses the claim from the user's files and applies executableVerifier to it (verdictOf_eq_executableVerifier). The function verdictOf is a second implementation of the verifier in Lean. It uses the same definitions of the protocol's data and decisions, and has steps of its own (§5).

What is proved

The eight theorems of this list (executableVerifier_eq_leanVerifier, executableVerifier_eq_leanVerifier_stored, verdictOf_eq_executableVerifier, verdictOf_eq_leanVerifier, verdictOf_eq_finalVerifierProgram, leanVerifier_eq, verdictOf_map, verdictOf_none) are equations between values of deterministic Lean functions. None of them involves a random oracle or makes a security claim.

  • executableVerifier_eq_leanVerifier (Final statements): for every public setup, executableVerifier applied to the setup's public files returns the verdict of leanVerifier. executableVerifier_eq_leanVerifier_stored (no card on this page) is its instance at the stored public files.
  • verdictOf_eq_executableVerifier (card above): verdictOf parses the claim from the user's files and applies executableVerifier to the public files, the claim and the parsed proof. It is proved by unfolding definitions.
  • verdictOf_eq_leanVerifier (card above): the same fact as the first, stated for verdictOf. It therefore has two further hypotheses: the claim can be parsed, and the public files are those of the setup.
  • verdictOf_eq_finalVerifierProgram and leanVerifier_eq (cards above) relate verdictOf and leanVerifier to a common term, finalVerifierProgram (the compiled verifier evaluated with blake2bHash on given public files).
  • The theorem verdictOf_map (Johnson/PVR/ProgramTotal.lean; no card on this page). For arbitrary public files, whenever the commitment, the prompt and the output can be parsed from the user's files, verdictOf returns the verdict of VerifierAndGoals.verify (Ladder.lean; no card on this page) for FlashProve's description (flashProveDescription), which includes the second hash function, evaluated with BLAKE2b. VerifierAndGoals.verify is the verifier in the soundness theorem sound_of_verify_at, whose hypotheses are that the public files are in scope, parse, and specify exact match. It equals the compiled system's verify by compile_flashProve_verify_eq and theDescription_eq.
  • If the commitment, the prompt or the output cannot be parsed, verdictOf returns no verdict (verdictOf_none).

The agreement is not special to BLAKE2b: for every function O from byte strings to 32-byte strings, the executable form run with O returns the verdict of VerifierAndGoals.verify evaluated with hashOf O (PV.Ride.verdictThe_eq, Johnson/PVR/RideEveryHash.lean:116). Hence its decision satisfies SoundOfDecision, a restatement of Sound, with a sampled hash function, under the hypotheses and the bound of sound_of_verify_at (PV.Ride.sound_of_the_form_events_oOf, Johnson/PVR/SoundOfTheFormEvents.lean:264). Neither theorem has a card on this page, and neither gives soundness at the concrete hash function.

The security statements for the compiled system are stated with the hash function sampled at random. Soundness at BLAKE2b is therefore not a theorem (see the card executableVerifier_eq_leanVerifier, Final statements).

What is not proved
  • These theorems concern the Lean functions verdictOf, executableVerifier, finalVerifierProgram and leanVerifier, not the run of the command lean-verify. No theorem is about the command itself, which consists of a script, an IO wrapper in Lean (run), natively compiled helper code, and Lean's compiler, interpreter and runtime.
  • executableVerifier, and hence verdictOf, does not check every condition of a public setup. It tests that the public files are in the verifier's scope, can be read and are well formed; it does not check that they specify the exact-match policy. If the public files pass the scope test (InScope) but specify another policy, the verifier may accept, and sound does not apply. The serving scripts use such a policy, the tolerant policy.
  • The theorems on soundness, binding, completeness and zero knowledge are stated for a hash function sampled uniformly at random, whereas leanVerifier fixes it to blake2bHash. Hence no theorem bounds the probability that leanVerifier accepts a false claim, and no theorem shows that it accepts even one honest proof.
What is trusted, and where files are parsed
  • The script lean_verify.sh, the IO wrapper run, the natively compiled helper code, and Lean's compiler, interpreter and runtime are trusted.
  • A parser outside Lean, which is not verified, splits the prover's files into the five byte strings of the proof as submitted. For soundness, its output is treated as chosen by the prover: a wrongly parsed file can cause an honest proof to be rejected, but it gives a prover no additional power. Hence soundness does not depend on the parser; only the acceptance of honest proofs does.
  • The Lean function claimOf, with the functions that it calls, parses the user's three files into the commitment, the prompt, the output and the remaining tokens of the request. The first three form the claim, and the last is passed to the verifier as part of the proof. No theorem shows that claimOf implements the file format (lean/GAPS.md, 37).
  • The verifier's own parser, the field parse of the proof format (§4.3), is defined in Lean and maps the prompt, the output and the proof as submitted to a typed proof. The verifier calls it, so it is covered by sound.
What was run

These are tests, not theorems. All used synthetic weights. One Lean file, with one definition and four theorems, which nothing else imports, was added after the runs reported here and checked on its own (lean/CHECK-RESULTS.md). The runs executed the parts of verdictOf, not executableVerifier under that name.

  • With this repository's Lean files, the command accepted all 88 honest proofs. Of these, 86 used the exact-match policy and the stored setup's three public files, which were identified by checksums compared outside Lean; 2 used the tolerant policy. All 88 had been run before. None of them is known to have been generated by this repository's prover, and 3 were generated by test programs.
  • With this repository's Lean files, none of 71 invalid inputs (57 false proofs, 5 honest proofs paired with a false claim, 9 altered parameter files) was accepted: the Lean part of the command rejected 59, and the parser stopped 12 before they reached it.
  • One newly generated proof, which according to its builders was produced by this repository's prover, was also accepted, with the exact-match policy. It ran in a directory whose compiled files matched this repository's build before and after an earlier run; they were not checksummed after this run.
  • In a separate run, with Lean files that differ from this repository's and with the parsed files passed directly to the executable form, 17 proof files were altered without changing a true claim. Of these, 9 were accepted; for 2 of these 9 a rejection had been expected (lean/THEOREM.md, "Altered proof files that leave the claim untouched were accepted"; §11).
  • In none of these runs was a claim accepted that was false under the policy of its own public files.

6. The provider's side

For a provider who cares that the weights stay hidden. Three things to read:

  • the statement: ZeroKnowledgeOn (§6.3), with its two experiments (§6.2)
  • what is not hidden: one bit for each request (requestOutcome: served or refused, §6.1), and what the three public files reveal about the weights, which none of the six theorems covers, nor zeroKnowledgeAtEveryRequest (§6.3)
  • the two theorems zeroKnowledgeOnCanServe and refusedHandsOutNoProof, and what follows from them for every request (§6.3). They concern the honest committer and prover as Lean definitions, which compile constructs from honestProversAndSettings (a black box on this page). Nothing is proved about the programs.

Completeness and zero knowledge are statements about the honest committer and the honest prover. A reader who relies on proofs does not need them; the provider does.

Completeness and zero knowledge are stated for one commitment by the honest committer and one request per proof, with the prover's own coins fresh and uniform for each reply. In the completeness theorem the weights and the request are fixed before the hash function is sampled; a request chosen after seeing the commitment or the hash function is not covered. With honestProversAndSettings the committer makes one copy of the committed table (on copies, see §6.4). The theorems of this section say nothing about an honest committer that makes more copies.

6.1 Completeness

  • For one commitment and one request that can be served and whose output tokens are the model's, the honest proof is accepted, except with probability at most 2^-40.

A request can be served (CanServe) if its tokens are in the vocabulary, its output is not empty, and the model has a value on the whole window of 1,024 tokens. The completeness theorem says nothing about a request that cannot be served or whose output is not the model's. No theorem states that a request is served at a real model's weights (see the folded section below that begins Notes: two definitions).

StatementCompleteness on a stated set of requestsVerifiableInference/Steps.lean:21–31
In words
In Lean · VerifiableInference/Steps.lean, lines 21–31
Given
  • an argument system system
  • a set of requests domain: a condition on weights, a prompt and output tokens
  • a bound α
def CompleteOn (system : ArgumentSystem) (domain : system.Weights → List Token → List Token → Prop)
(α : ℝ≥0∞) : Prop :=
For all

all weights, prompts and output tokens

∀ (weights : system.Weights) (prompt output : List Token),

that are in domain and whose output tokens are the model's

domain weights prompt output → system.IsModelOutput weights prompt output →
Run

The hash function is sampled uniformly at random. Then:

Prob (do

the commitment randomness is sampled

let randomness ← system.sampleCommitmentRandomness

the honest committer commits to the weights

let commitment ← (system.commit weights randomness).toRandomized

the honest prover computes a proof for the prompt and the output tokens

let proof ← system.prove weights randomness prompt output

the verifier of system decides

(system.verify commitment prompt output proof).toRandomized)
Event

the honest committer and the honest prover are rejected

{accepted | accepted = false}
Then

Pr[event] ≤ α

≤ α
Not covered

The claim that there is a request whose output is the model's and that FlashProve's verifier rejects for every hash function, commitment and proof rests on an informal argument; no theorem states it.

Remark

A condition on the weights may be part of the system's type Weights.

CompleteOn is the plain completeness property (stated for every request whose output is the model's) with one added side condition on the requests. If there is such a request that the verifier rejects for every hash function, commitment and proof, then the plain property fails for every α below 1 (not_complete_of_rejected, VerifiableInference/NotComplete.lean:36).

Names

ArgumentSystem, IsModelOutput: §1; Prob: §8.

DefinitionThe requests that can be servedVerifiableInference/CanServe.lean:31–35
In words
In Lean · VerifiableInference/CanServe.lean, lines 31–35

Side conditions on a prompt and an output, in addition to "the output tokens are the model's":

def CanServe (settings : IntegerTransformer.Settings) (weights : ModelWeights settings)
(prompt output : List Nat) : Prop :=
Holds if
  • every token is in the vocabulary
  • the output is not empty
(∀ token ∈ prompt ++ output, token < settings.vocabulary) ∧ output ≠ [] ∧
  • the model has a value on the whole window of 1,024 tokens: the prompt followed by the output, padded with token 0 and truncated to 1,024 tokens
(modelNextToken settings weights
(IntegerModel.zeroFilledWindow prompt output)).isSome = true
Not covered
  • The last condition depends on the weights: a range condition of the integer program can fail at a position after the output. For a zero-filled window, no example is proved in which it fails only there while the output is the model's in the sense of §1. At the weights of the next point, the model has no value on any window.
  • For some weights, no prompt and output satisfy the three conditions (canServe_nowhere_atHaltingWeights, VerifiableInference/ModelGuardsAtReference.lean, at the settings of the reference table of scales, which are those that the stored public files give: settingsOfRead_full, Johnson/Goal/Files/FilesReadAtRef.lean:143).
  • On their own, the three conditions do not bound the lengths: an empty prompt can satisfy them. At valid settings, together with "the output tokens are the model's", they imply a non-empty prompt and at most 1,025 tokens in total (wellFormed_and_result_iff, VerifiableInference/WellFormedRequests.lean:48; a well-formed request has both). This definition's Lean comment says "by hand", but the theorem says more.
TheoremAt some weights no request can be servedVerifiableInference/ModelGuardsAtReference.lean:225–226
In words
In Lean · VerifiableInference/ModelGuardsAtReference.lean, lines 225–226

For the settings of the reference table of scales and the valid weights haltingWeights, no prompt and output satisfy CanServe.

theorem canServe_nowhere_atHaltingWeights (prompt output : List Token) :
¬ CanServe referenceSettings haltingWeights prompt output
Remark

At the index of haltingWeights no request is true (Cm.empty_language, Cm/RelTrueExp.lean).

The theorem completeOnCanServe, in full. For every public setup, compile (flashProve setup) satisfies CompleteOn (above) with CanServe and finalCompletenessError. That is:

  • for all weights and every request that can be served and whose output tokens are the model's,
  • when the honest committer commits and the honest prover proves,
  • the verifier rejects with probability at most 2^-40, over the random oracle and the coins of the honest committer and prover.

Remark. The library proves it equivalent to a second form, stated for well-formed requests whose result is the claimed output (finalComplete_iff_completeOn, Johnson/Face/Checks.lean:57); both terms are defined below.

Where the theorem says nothing. The theorem completeOnCanServe says nothing about a request whose result is none or tokens other than the claimed ones. For such a request requestOutcome is refused, and refusedHandsOutNoProof states that the prover's reply is the empty proof (noProofForm: a form all of whose parts are empty). None of the six theorems states that a refusal can be checked.

A well-formed request. A request (a prompt with a claimed output) is well formed (RequestForm) if every token is in the vocabulary, neither list is empty, and the two together have at most 1,025 tokens.

The model's result (requestResult, Appendix C) is obtained from one run of the model on a window of exactly 1,024 tokens: the prompt, the claimed output, then token 0 as often as needed, all truncated to 1,024 tokens (IntegerModel.zeroFilledWindow). If the request has 1,025 tokens, the last output token is outside the window: the run does not read it, and it is only compared with the run's choice at the window's last position.

  • The result is none if the model has no value on that window, including the padded positions.
  • Otherwise it is some of the tokens that the run chooses at the positions just before the output tokens.

The bit. requestOutcome assigns each request one of two values, served or refused. A request is refused if it is ill-formed, if the model has no result on it, or if the result differs from the claimed output. The bit depends on the weights and is not hidden: zeroKnowledgeAtEveryRequest gives it to the simulator. In that statement each reply shows the verifier nothing in addition to a proof.

At valid settings, a request is served if and only if it can be served and its output tokens are the model's (served_iff_canServe, VerifiableInference/AtEveryRequestGuards.lean:127).

DefinitionA requestVerifiableInference/AtEveryRequest.lean:33
In words
In Lean · VerifiableInference/AtEveryRequest.lean, lines 33–33

A Request is a pair of lists of tokens: the prompt, then the claimed output. Every such pair is a request; the conditions on it are in RequestForm (Appendix C).

abbrev Request : Type := List Token × List Token
DefinitionThe bit of a requestVerifiableInference/AtEveryRequest.lean:36–39
In words
In Lean · VerifiableInference/AtEveryRequest.lean, lines 36–39

The bit of a request: served or refused. Neither value carries any data, in particular no token.

inductive Outcome : Type where
| served : Outcome
| refused : Outcome
deriving DecidableEq
DefinitionThe bit, as a function of the weights and the requestVerifiableInference/RequestOutcome.lean:40–44
In words
In Lean · VerifiableInference/RequestOutcome.lean, lines 40–44

The function assigning each request its bit, which depends only on the settings, the weights and the request.

def requestOutcome (settings : IntegerTransformer.Settings) (weights : ModelWeights settings)
(request : Request) : Outcome :=
Value

served if the request is well formed

if RequestForm settings request.1 request.2 ∧

and the model's result on the request's window (requestResult, Appendix C) is the claimed output

requestResult settings weights request.1 request.2 = some request.2 then .served

refused otherwise; the same value is returned for an ill-formed request, a result of none, and a result of other tokens

else .refused
Not covered
  • The bit depends on the weights: for every well-formed request of its choice, a verifier learns whether the claimed output is the model's result (see §6.3).
  • A request whose output is the model's in the sense of §1 is refused if the model has no value at a later position in the window.
  • No statement bounds what many bits reveal together.
Remark

Whether a request is well formed depends on the model's settings and the request, not on the weights.

The simulator of zeroKnowledgeAtEveryRequest is given this bit (§6.3); in that statement each reply shows the verifier nothing in addition to a proof.

DefinitionThe prover outputs no proof at the specified requestsVerifiableInference/AtEveryRequestGuards.lean:62–67
In words
In Lean · VerifiableInference/AtEveryRequestGuards.lean, lines 62–67
Given
  • an argument system system (§1)
  • unserved: a predicate on the weights and a request; the statement applies where it holds
  • isNoProof: which proofs count as no proof
def HandsOutNoProof (system : ArgumentSystem) (unserved : system.Weights → Request → Prop)
(isNoProof : system.Proof → Prop) : Prop :=
For all

for all weights, values of the committer's randomness, requests, hash functions and proofs form

∀ (weights : system.Weights) (randomness : system.CommitmentRandomness) (request : Request)
(hash : Hash) (form : system.Proof),

at the requests satisfying unserved

unserved weights request →
Then

the system's prover outputs no proof: every value it can return satisfies isNoProof

(for a fixed hash function, the prover can return form if and only if the probability of form over the prover's own coins is not 0)

(system.prove weights randomness request.1 request.2).run hash form ≠ 0 → isNoProof form

The theorem refusedHandsOutNoProof, in full. The theorem concerns the output of the compiled prover. For every public setup,

  • for all weights, all commitment randomness, every request whose requestOutcome is refused, well-formed or not, and every hash function,
  • each reply that the prover returns with non-zero probability is the empty proof (noProofForm: a form all of whose parts are empty).

Not covered. A refusal is not checked: an empty proof proves nothing, and a prover can return it for a request that it could serve.

Remarks.

  • The condition is on every possible reply, so it has no error term.
  • The compiled verifier rejects the empty proof for every hash function and every public setup (rejectsEmptyProof).
  • The converse is not claimed: the reply to a served request can also be the empty proof. Among other cases, this happens when a search for a proof-of-work nonce (§4.3) fails, and when the compiled prover withholds a proof string because the run's verifier messages are in one of the honest provers' abort sets (Appendix A); one part of the online prover's abort set depends on its private input. The reply is empty if any of the three proof strings (offline, link, online) is missing. The simulator of zeroKnowledgeAtEveryRequest simulates a failed nonce search. It does not simulate the aborts that depend on the online prover's private input; their probability, at most 2^-174 for each reply, is counted in the bound 2^-154 (§4.4). In each of these cases the reply looks like the reply to a refused request.
  • refusedHandsOutNoProof is proved more generally, for public files that meet FilesTaken: finalRefusedHandsOutNoProof_value (AtFullSide/Face/TheFinalStatementOneBitHolds.lean:60).
DefinitionThe form that contains no proofJohnson/Face/FinalStatement.lean:109
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 109–109

The form that contains no proof: an empty list of tokens and five empty byte strings.

def noProofForm : FlashProve.FormBytes := ⟨[], .empty, .empty, .empty, .empty, .empty⟩
DefinitionA form contains no proofJohnson/Face/FinalStatement.lean:112
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 112–112

The form equals noProofForm, the form that contains no proof.

def isNoProof (form : FlashProve.FormBytes) : Prop := form = noProofForm
TheoremThe compiled verifier rejects the empty proofAtFullSide/Face/TheSixLines.lean:360–363
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 360–363
For all

for every hash function, public setup, commitment and request

theorem rejectsEmptyProof (setup : PublicSetup) (hash : Hash) (commitment : Commitment)
(prompt output : List Token) :
Then

the compiled verifier rejects the empty proof

((compile (flashProve setup)).verify commitment prompt output noProofForm).evaluate hash =
false
Not covered

An empty proof does not show that the request was refused.

Remark

Hence the empty proof is never accepted.

Proof

Proved for all public files and settings as rejectsNoProof_value (AtFullSide/CompletenessAndZeroKnowledge/RejectsTheEmptyForm.lean:77).

Names

Hash, evaluate: §8; noProofForm: above.

DefinitionA bound on the hash queries of the honest sampler, committer and proverVerifiableInference/AtEveryRequest.lean:61–68
In words
In Lean · VerifiableInference/AtEveryRequest.lean, lines 61–68

The honest sampler, committer and prover, run once each, make at most budget hash queries in total.

def WithinBudget (system : ArgumentSystem) (budget : ℕ) : Prop :=
Exists

there are three numbers

∃ sampling committing proving : ℕ,

whose sum is at most budget, such that

sampling + committing + proving ≤ budget ∧
Sampler

the sampler of commitment randomness makes at most sampling hash queries

system.sampleCommitmentRandomness.QueryBound sampling ∧
Committer

for all weights and all commitment randomness, the committer makes at most committing hash queries

(∀ weights randomness,
(system.commit weights randomness).toRandomized.QueryBound committing) ∧
Prover

for all weights, all commitment randomness, every prompt and all output tokens, the prover makes at most proving hash queries

(∀ weights randomness prompt output,
(system.prove weights randomness prompt output).QueryBound proving)
Notes: two definitions of "the model's output" · that the statement is not vacuous · 2 cards

Two definitions of "the model's output".

  • Soundness, CompleteOn and ZeroKnowledgeOn use IsModelOutput (§1), which runs the model on the prompt followed by each proper prefix of the output, without padding.
  • requestOutcome uses the model's result, computed by one run on the padded window; CanServe requires that this run has a value.

One direction is proved. At the settings given by public files (these settings pass settingsAreValid, the library's test on sizes and quantization ranges), if a request is well formed and its result is the claimed output, then each output token is the model's next token in the sense of §1 (from wellFormed_and_result_iff, VerifiableInference/WellFormedRequests.lean:48).

The other direction fails for the empty output, which is the model's in the sense of §1, while a request with empty output is not well formed. It may also fail for a well-formed request if the model has no value at the last output token's position or at a padded position: such a request would be refused although its output is the model's in the sense of §1. No theorem rules this out, except for weights that meet a condition stated in the library but not on this page. No example of this is proved.

Not vacuous. For every set of public files that meets FilesInUse (one exists: filesInUse_stored), some request is served at some weights (someRequestIsServedInUse, below). Those weights are artificial: all their layers are zero. No theorem states that a request is served at a real model's weights, and at the settings that the stored public files give there are weights at which no request can be served (canServe_nowhere_atHaltingWeights, above).

StatementFor the files of every public setup, some request is served for some weightsJohnson/Face/Checks.lean:37–39
In words
In Lean · Johnson/Face/Checks.lean, lines 37–39

For the files of every public setup, some request is served for some weights.

def SomeRequestIsServedInUse : Prop :=
∀ (files : PublicFiles) (parameters : Inst.Model.ScalesAndPolicy), FilesInUse files parameters →
SomeRequestIsServed (settingsOfRead parameters)
TheoremFor the files of every public setup, some request is served for some weightsJohnson/Face/Checks.lean:42
In words
In Lean · Johnson/Face/Checks.lean, lines 42–42

For any files in use, some request is served at some weights. For the existence of files in use, see filesInUse_stored above.

theorem someRequestIsServedInUse : SomeRequestIsServedInUse

6.2 The two experiments of zero knowledge

A malicious verifier is given the commitment and then proofs. The request for each proof is picked by a chooser: a function that maps the verifier's view so far to a request, or to nothing, in which case the experiment ends. In the real experiment, the hash function is sampled uniformly at random, and the honest committer and the honest prover run. In the simulated experiment, the simulator replaces all three; it is given each request and the information about the weights that the statement specifies.

This page has two definitions of a simulator, each with its own simulated experiment; the real experiment is the same for both.

  • Simulator is the general one: for each request it is given only the request. ZeroKnowledgeOn is stated with it.
  • AtEveryRequest.Simulator takes one more argument: the information it is given about each request. ZeroKnowledgeWhere, and hence the theorem zeroKnowledgeAtEveryRequest, is stated in terms of it. Its card is in a folded section in §6.3.
DefinitionA verifier's viewVerifiableInference/Statements.lean:179–183
In words
In Lean · VerifiableInference/Statements.lean, lines 179–183

a structure with four fields

structure View (Proof : Type) where

the commitment

commitment : Commitment

the proofs obtained so far, each with its prompt and output tokens

proofs : List ((List Token × List Token) × Proof)

the verifier's queries to the hash function with their answers

queryLog : QueryLog

the numbers that the verifier sampled

randomDraws : List ℕ
DefinitionA malicious verifierVerifiableInference/Statements.lean:192–197
In words
In Lean · VerifiableInference/Statements.lean, lines 192–197

a strategy, for a given type of proofs: one of

inductive MaliciousVerifier (Proof : Type) : Type

it stops

| stop : MaliciousVerifier Proof

it queries the hash function at a bit string and continues with the answer

| query (input : BitString) (next : Digest → MaliciousVerifier Proof) : MaliciousVerifier Proof

it samples a number from 0 to bound uniformly and continues with it

| sample (bound : ℕ) (next : Fin (bound + 1) → MaliciousVerifier Proof) : MaliciousVerifier Proof

it requests the next proof and continues with the prompt, the output tokens and the proof that it is given

| requestProof (next : List Token × List Token → Proof → MaliciousVerifier Proof) :
MaliciousVerifier Proof
DefinitionA malicious verifier makes at most a given number of queriesVerifiableInference/Statements.lean:200–205
In words
In Lean · VerifiableInference/Statements.lean, lines 200–205

for a malicious verifier and a number of queries

def MaliciousVerifier.QueryBound {Proof : Type} : MaliciousVerifier Proof → ℕ → Prop

stopped: true

| .stop, _ => True

a query, and the number is 0: false

| .query _ _, 0 => False

a query, and the number is at least 1: every continuation meets the bound reduced by 1

| .query _ next, queries + 1 => ∀ answer, (next answer).QueryBound queries

a sampling step: every continuation meets the same bound

| .sample _ next, queries => ∀ draw, (next draw).QueryBound queries

a request for a proof: every continuation meets the same bound

| .requestProof next, queries => ∀ request proof, (next request proof).QueryBound queries
DefinitionThe verifier's steps in the real experimentVerifiableInference/Statements.lean:211–231
In words
In Lean · VerifiableInference/Statements.lean, lines 211–231
Given

an argument system, the chooser, the weights and the committer's randomness; then the verifier's next step, the number of proofs that it may still request, and its view so far

def realSteps (system : ArgumentSystem) (chooser : View system.Proof → Option
(List Token × List Token))
(weights : system.Weights) (randomness : system.CommitmentRandomness) :
MaliciousVerifier system.Proof → ℕ → View system.Proof → RandomizedAlgorithm (View system.Proof)
Stop

the verifier stops: return the view

| .stop, _, view => pure view
Query

the verifier queries the hash function: the query and its answer are added to the view

| .query input next, remaining, view =>
.query input fun answer =>
realSteps system chooser weights randomness (next answer) remaining
{ view with queryLog := view.queryLog ++ [(input, answer)] }
Sample

the verifier samples a number: it is added to the view

| .sample bound next, remaining, view =>
.sample bound fun draw =>
realSteps system chooser weights randomness (next draw) remaining
{ view with randomDraws := view.randomDraws ++ [draw.val] }
Request

the verifier requests a proof and none remains: return the view

| .requestProof _, 0, view => pure view

otherwise the chooser is asked

| .requestProof next, remaining + 1, view =>
match chooser view with

it returns nothing: return the view

| none => pure view

it returns a prompt and output tokens: the honest prover generates a proof; all three are added to the view and given to the verifier

| some request =>
(system.prove weights randomness request.1 request.2).bind fun proof =>
realSteps system chooser weights randomness (next request proof) remaining
{ view with proofs := view.proofs ++ [(request, proof)] }
DefinitionThe real experimentVerifiableInference/Statements.lean:235–242
In words
In Lean · VerifiableInference/Statements.lean, lines 235–242
Given

an argument system, a verifier, a chooser, weights, the number of proofs

def realExperiment (system : ArgumentSystem) (verifier : Commitment → MaliciousVerifier
system.Proof)
(chooser : View system.Proof → Option (List Token × List Token))
(weights : system.Weights) (proofCount : ℕ) : RandomizedAlgorithm (View system.Proof) := do
Run

the honest committer samples its randomness

let randomness ← system.sampleCommitmentRandomness

and computes the commitment to the weights

let commitment ← (system.commit weights randomness).toRandomized

the verifier's steps (the card above), from a view containing only the commitment

realSteps system chooser weights randomness (verifier commitment) proofCount
⟨commitment, [], [], []⟩
DefinitionA simulator given, for each request, only the request itselfVerifiableInference/Statements.lean:248–252
In words
In Lean · VerifiableInference/Statements.lean, lines 248–252

A simulator consists of a type of states and three functions.

Apart from the arguments of these three functions, it is given neither the weights nor the committer's randomness.

Its running time is not bounded.

structure Simulator (PublicParameters Proof : Type) where
State

the state it keeps between steps; each function below may sample at random (PMF) and returns the new state (start returns the initial one)

State : Type
Start

it produces a commitment from the public parameters and the maximum number of proofs

start : PublicParameters → ℕ → PMF (Commitment × State)
Query

it answers the verifier's queries to the hash function

answerQuery : State → BitString → PMF (Digest × State)
Proof

it computes each proof from the prompt and the output tokens

simulateProof : State → List Token × List Token → PMF (Proof × State)
DefinitionThe simulated experiment after the commitment, for such a simulatorVerifiableInference/Statements.lean:256–276
In words
In Lean · VerifiableInference/Statements.lean, lines 256–276
Given

The same steps as realSteps, with the simulator in place of the hash function and the prover.

  • the simulator and the chooser
  • then the verifier's next step, the number of proofs that it may still request, its view so far and the simulator's state
def simulatedSteps {PublicParameters Proof : Type}
(simulator : Simulator PublicParameters Proof)
(chooser : View Proof → Option (List Token × List Token)) :
MaliciousVerifier Proof → ℕ → View Proof → simulator.State → PMF (View Proof)
Stop

the verifier stops: return the view

| .stop, _, view, _ => PMF.pure view
Query

the verifier queries the hash function: the simulator answers, and the query and its answer are added to the view

| .query input next, remaining, view, state =>
(simulator.answerQuery state input).bind fun answered =>
simulatedSteps simulator chooser (next answered.1) remaining
{ view with queryLog := view.queryLog ++ [(input, answered.1)] } answered.2
Sample

the verifier samples a number: it is added to the view

| .sample bound next, remaining, view, state =>
(PMF.uniformOfFintype (Fin (bound + 1))).bind fun draw =>
simulatedSteps simulator chooser (next draw) remaining
{ view with randomDraws := view.randomDraws ++ [draw.val] } state
Request

the verifier requests a proof and none remains: return the view

| .requestProof _, 0, view, _ => PMF.pure view

otherwise the chooser is asked

| .requestProof next, remaining + 1, view, state =>
match chooser view with

it returns nothing: return the view

| none => PMF.pure view

it returns a request: the simulator produces a proof from it; both are added to the view and given to the verifier

| some request =>
(simulator.simulateProof state request).bind fun simulated =>
simulatedSteps simulator chooser (next request simulated.1) remaining
{ view with proofs := view.proofs ++ [(request, simulated.1)] } simulated.2
DefinitionThe simulated experiment for such a simulatorVerifiableInference/Statements.lean:281–288
In words
In Lean · VerifiableInference/Statements.lean, lines 281–288
Given

an argument system, a simulator, a verifier, a chooser, weights, the number of proofs

def simulatedExperiment (system : ArgumentSystem)
(simulator : Simulator system.PublicParameters system.Proof)
(verifier : Commitment → MaliciousVerifier system.Proof)
(chooser : View system.Proof → Option (List Token × List Token))
(weights : system.Weights) (proofCount : ℕ) : PMF (View system.Proof) :=
Run

the simulator is given the public parameters of the weights and the largest number of proofs

and outputs the commitment

(simulator.start (system.publicParameters weights) proofCount).bind fun started =>

the simulated steps (the card above), from a view containing only the commitment

simulatedSteps simulator chooser (verifier started.1) proofCount ⟨started.1, [], [], []⟩
started.2
DefinitionStatistical distanceVerifiableInference/RandomOracleModel.lean:111–112
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 111–112
Given

two distributions on the same set, each given by its probabilities of events

def statisticalDistance {α : Type} (first second : Set α → ℝ≥0∞) : ℝ≥0∞ :=
Value

the supremum, over all events, of the absolute difference of the two probabilities

⨆ event : Set α, max (first event - second event) (second event - first event)
DefinitionEqual queries have equal answersVerifiableInference/Statements.lean:291–293
In words
In Lean · VerifiableInference/Statements.lean, lines 291–293
Given

a query log

def QueryLog.Consistent (queryLog : QueryLog) : Prop :=
Holds if

two entries with the same query have the same answer

∀ input answer answer', (input, answer) ∈ queryLog → (input, answer') ∈ queryLog → answer =
answer'

6.3 Zero knowledge

  • One simulator, fixed before the weights, produces the commitment, the replies and the hash answers. It may depend on the public files; it gets each request and the largest number of replies, and nothing about the weights.
  • At requests that can be served and whose output tokens are the model's, for one commitment, up to 688,127 replies and 2^64 hash queries, against any verifier, the view is within statistical distance 2^-154 of the real one.
  • At a refused request the reply is the empty proof. With that, the same holds at every request, with one bit revealed for each: served or refused.

The theorem zeroKnowledgeOnCanServe is stated in terms of ZeroKnowledgeOn, for the requests that can be served and whose output tokens are the model's. The compiled system has no public parameters (PublicParameters := Unit, §4.3), so the simulator is initially given nothing about the weights. It may depend on the three public files, and a fitted model's scale file is derived from its weights; what these files reveal about the weights is not covered. Whether a request can be served depends on the weights, and this is not hidden: the chooser of requests may know the weights and is the same in both experiments.

In the theorem zeroKnowledgeOnCanServe, 2^64 bounds the verifier's hash queries and 688,127 bounds the replies under one commitment. Within these limits the error is at most 2^-154 (finalZeroKnowledgeError).

StatementZero knowledge on a stated set of requestsVerifiableInference/MoreStatements.lean:151–167
In words
In Lean · VerifiableInference/MoreStatements.lean, lines 151–167
Given
  • an argument system system
  • a set of requests domain: a condition on weights, a prompt and output tokens
  • a bound ζ, a function of a number of queries to the hash function and a number of proofs
def ZeroKnowledgeOn (system : ArgumentSystem) (domain : system.Weights → List Token → List Token →
Prop) (ζ : ℕ → ℕ → ℝ≥0∞) : Prop :=
Exists

one simulator, which is given:

  • the public parameters of the weights
  • the largest number of proofs
  • each query of the verifier to the hash function, which it answers in the hash function's place
  • for each proof, the prompt and the output tokens
∃ simulator : Simulator system.PublicParameters system.Proof,
For all

all weights

∀ (weights : system.Weights)

chooser: it picks each prompt and output tokens from the verifier's view so far; it may know the weights and is the same in both experiments

(chooser : View system.Proof → Option (List Token × List Token)),

the prompts and output tokens it picks satisfy domain at the weights, and the output tokens are the model's

(∀ view prompt output, chooser view = some (prompt, output) → domain weights prompt output ∧
system.IsModelOutput weights prompt output) →

verifier: it is given the commitment and up to proofCount proofs

∀ (queries : ℕ) (verifier : Commitment → MaliciousVerifier system.Proof) (proofCount : ℕ),

it makes at most queries queries to the hash function

(∀ commitment, (verifier commitment).QueryBound queries) →
(1) Then

the statistical distance between

statisticalDistance

its view with the honest committer and prover

(Prob (realExperiment system verifier chooser weights proofCount))

and what the simulator produces

(eventProbability (simulatedExperiment system simulator verifier chooser weights
proofCount))

is at most ζ queries proofCount

≤ ζ queries proofCount
(2) Then

the simulator never gives two different answers to the same query

∧ eventProbability (simulatedExperiment system simulator verifier chooser weights
proofCount)
{view | ¬ view.queryLog.Consistent} = 0
Not covered
  • domain may depend on the weights; then whether a request meets it is not hidden.
  • The library does not prove the plain zero-knowledge property for any system. It is not expected to hold for FlashProve's system: what the honest prover does at a request that cannot be served reveals information about the weights.
Remark

It is the plain zero-knowledge property, for requests whose output is the model's, with one more condition on the requests; without it the two are equivalent (zeroKnowledge_iff_zeroKnowledgeOn, VerifiableInference/MoreStatements.lean:170).

Names

ArgumentSystem, IsModelOutput: §1; Simulator, MaliciousVerifier, realExperiment, the simulated experiment, statisticalDistance, Consistent: §6.2; Prob, eventProbability: §8.

At every request. On its own, the theorem zeroKnowledgeOnCanServe says nothing about a refused request. Together with refusedHandsOutNoProof, it implies zeroKnowledgeAtEveryRequest within the same bound, where the simulator is given one bit per request: served or refused. This bit depends on the weights and is not hidden.

TheoremZero knowledge at every request, with one bit revealed for eachAtFullSide/Face/TheSixLines.lean:235–238
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 235–238
Given

a public setup setup (PublicSetup)

theorem zeroKnowledgeAtEveryRequest (setup : PublicSetup) :
Then

a single simulator, which may depend on the public setup, simulates any verifier's view, for one commitment, at every request (fun _ => True: no condition on the request)

ZeroKnowledgeBelowWhere (compile (flashProve setup)) (fun _ => True)

where the simulator is given only one bit about the weights for each request (served or refused), for up to 688,127 replies and 2^64 hash queries,

(requestOutcome (settingsOfRead setup.readParameters)) finalVerifierQueries finalReplyCount

within statistical distance 2^-154

finalZeroKnowledgeError
Not covered

The bit itself is not hidden (the statement gives it to the simulator): for every well-formed request of its choice, a verifier learns whether the claimed output is the model's result. The full list of what is not covered is below.

Remark

It is not proved that this theorem recovers zeroKnowledgeOnCanServe.

Proof

A corollary of zeroKnowledgeOnCanServe and refusedHandsOutNoProof, by zeroKnowledgeAtEveryRequest_of_lines (in the folded section below).

Names

ZeroKnowledgeBelowWhere: in the folded section below; requestOutcome: §6.1; settingsOfRead: Appendix A; finalVerifierQueries, finalReplyCount, finalZeroKnowledgeError: §4.4.

The simulator is given the bit of every request: up to 688,127 bits, at requests that the verifier picks. Over many requests the bits reveal what the model outputs, and the statement does not bound what they jointly reveal about the weights. In this theorem, 688,127 bounds the number of replies under one commitment; a reply to a refused request, which is the empty proof, also counts.

The theorem zeroKnowledgeAtEveryRequest, in full. For each public setup there is one simulator, fixed before the weights, such that for

  • all weights,
  • every chooser of requests, well-formed or not, whatever the model's result on them, and
  • every verifier with at most 2^64 hash queries and at most 688,127 replies under one commitment:

(1) the statistical distance between the verifier's view with the honest committer and prover and the simulator's output is at most finalZeroKnowledgeError, 2^-154;

(2) the simulator never answers one hash query in two ways.

Remark. The theorem is stated as ZeroKnowledgeBelowWhere (in the folded section below) for compile (flashProve setup) itself: at each request, the verifier is given the request and the compiled prover's reply (a proof or the empty proof), and nothing else.

What the simulator is told. The simulator is given the maximum number of replies, each request and, of the weights, only one bit for each request: served or refused (requestOutcome, §6.1). A reply is what the compiled prover returns: a proof or the empty proof (noProofForm). The strength of the statement depends only on this function (requestOutcome): its value is the only function of the weights that the simulator is handed with a request.

What the bit reveals. The bit depends on the weights, and it is not hidden (the statement gives it to the simulator):

  • For every well-formed request of its choice, a verifier learns whether the claimed output is the model's result. It infers the bit from the reply: a refused request gets an empty proof, and so, with small probability, does a served one (see §6.1 for the cases).
  • Hence, over many adaptively chosen requests, it learns the model's outputs on inputs of its choice: trying each candidate token for a prompt reveals the model's next token from this bit alone, unless all are refused.
  • An output that is the model's in the sense of §1 is refused if the model has no value at a later position in the window.
  • No statement bounds what many bits reveal together.

Public parameters. The type of public parameters of compile (flashProve setup) is Unit, so this system has none. Hence, in the experiment, the simulator of zeroKnowledgeAtEveryRequest is given the bits and nothing else about the weights (it may depend on the public files).

What a refusal does not reveal. For a well-formed request, a refusal does not reveal whether the model has no result or a result other than the claimed output. This is hidden only from a verifier that makes few requests:

  • A request's window of 1,024 tokens can itself be sent as a prompt, with one more token as the claimed output, which the run does not read.
  • A verifier that tries every candidate for that token and is refused each time learns that the model has no result on that window, and one that is served once learns that it has one (argued from the definitions; no theorem states it).
  • Each such search uses up to 202,048 (the vocabulary size) of the 688,127 replies.

Not covered by either theorem:

  • more than 688,127 replies or 2^64 hash queries;
  • what many bits reveal together;
  • what the public files themselves reveal about the weights, what is published alongside the commitment, and timing;
  • coins that are not fresh and uniform, several requests in one proof, a second commitment, and public files whose policy is not exact match (§4.4);
  • the simulator's running time;
  • a hash query before the commitment, and weights or public files chosen after the hash function is sampled;
  • whether the prover outputs any proof at all (that is the subject of completeOnCanServe; on its own, the property in each of these two theorems is satisfied by a prover that outputs nothing (§11)).
The definitions used in the theorem for every request, and its derivation from the two theorems · 6 cards
TheoremThe two theorems imply zero knowledge at every requestAtFullSide/Face/TheSixLines.lean:213–225
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 213–225
Given

a public setup setup (PublicSetup)

theorem zeroKnowledgeAtEveryRequest_of_lines (setup : PublicSetup)

the statement of the theorem zeroKnowledgeOnCanServe

(onCanServe : ∃ error : ℕ → ℕ → ℝ≥0∞,
(∀ asked replies, asked ≤ finalVerifierQueries → replies ≤ finalReplyCount →
error asked replies ≤ finalZeroKnowledgeError) ∧
ZeroKnowledgeOn (compile (flashProve setup))
(CanServe (settingsOfRead setup.readParameters)) error)

the statement of the theorem refusedHandsOutNoProof

(refused : HandsOutNoProof (compile (flashProve setup))
(fun weights request =>
requestOutcome (settingsOfRead setup.readParameters) weights request = .refused)
isNoProof) :
Then

zero knowledge at every request

ZeroKnowledgeBelowWhere (compile (flashProve setup)) (fun _ => True)

where the simulator may depend on the public files and is otherwise told, of the weights, only one bit per request (served or refused), within the same bound

(requestOutcome (settingsOfRead setup.readParameters)) finalVerifierQueries finalReplyCount
finalZeroKnowledgeError
Remark

Its two hypotheses are these two statements verbatim.

Proof

By a general theorem that holds for every argument system (zeroKnowledgeFollowsFromOn, VerifiableInference/AtEveryRequestFollows.lean:509), with served_iff_canServe (VerifiableInference/AtEveryRequestGuards.lean:127) to pass from the requests that can be served to the served requests.

StatementZero knowledge for the requests that satisfy a hypothesis, with a uniform bound on the error for up to given numbers of queries and proofsVerifiableInference/AtEveryRequest.lean:146–150
In words
In Lean · VerifiableInference/AtEveryRequest.lean, lines 146–150
Given

ZeroKnowledgeWhere with one bound on the error:

  • system, hypothesis and told, as there
  • numbers queries and proofs, and the bound bar
def ZeroKnowledgeBelowWhere {Told : Type} (system : ArgumentSystem) (hypothesis : Request → Prop)
(told : system.Weights → Request → Told) (queries proofs : ℕ) (bar : ℝ≥0∞) : Prop :=
Exists

there is an error function

∃ error : ℕ → ℕ → ℝ≥0∞,
For all

that is at most bar for every number of hash queries up to queries and every number of proofs up to proofs

(∀ asked replies, asked ≤ queries → replies ≤ proofs → error asked replies ≤ bar) ∧
Then

and ZeroKnowledgeWhere holds with it

ZeroKnowledgeWhere system hypothesis told error
StatementZero knowledge for requests satisfying a hypothesisVerifiableInference/AtEveryRequest.lean:128–142
In words
In Lean · VerifiableInference/AtEveryRequest.lean, lines 128–142
Given
  • an argument system system (§1)
  • hypothesis: a predicate specifying which requests the statement is about
  • told: a function of the weights and the request, whose value the simulator is given
  • error: a bound, as a function of the number of queries to the hash function and the number of proofs
def ZeroKnowledgeWhere {Told : Type} (system : ArgumentSystem) (hypothesis : Request → Prop)
(told : system.Weights → Request → Told) (error : ℕ → ℕ → ℝ≥0∞) : Prop :=
Exists

There exists a simulator such that

∃ simulator : Simulator system.PublicParameters Told system.Proof,
For all

for all weights and every chooser

A chooser picks each request as a function of the verifier's view so far; it may depend on the weights and is the same in both experiments.

∀ (weights : system.Weights) (chooser : View system.Proof → Option Request),

that picks only requests that satisfy the hypothesis

(∀ view request, chooser view = some request → hypothesis request) →

all numbers queries and proofCount (the maximum number of proofs that the verifier receives) and every verifier

The verifier makes no queries before the commitment.

∀ (queries : ℕ) (verifier : Commitment → MaliciousVerifier system.Proof) (proofCount : ℕ),

with at most queries queries to the hash function

(∀ commitment, (verifier commitment).QueryBound queries) →
(1) Then

the statistical distance between

statisticalDistance

the verifier's view with the honest committer and prover

The real experiment is realExperiment (VerifiableInference/Statements.lean): the honest prover runs on every request that the chooser picks, and told is not among its arguments.

In the real experiment the hash function is sampled uniformly at random.

(Prob (realExperiment system verifier chooser weights proofCount))

and what the simulator produces

(eventProbability (simulatedExperiment system simulator told verifier chooser weights
proofCount))

is at most error queries proofCount

≤ error queries proofCount
(2) Then

and the simulator never gives two different answers to the same query

(the probability that a query in the view has two different answers is 0)

∧ eventProbability (simulatedExperiment system simulator told verifier chooser weights
proofCount)
{view | ¬ view.queryLog.Consistent} = 0
DefinitionA second simulator, given information about each requestVerifiableInference/AtEveryRequest.lean:76–80
In words
In Lean · VerifiableInference/AtEveryRequest.lean, lines 76–80

A second structure of that name, in the namespace AtEveryRequest: this simulator is also given information about each request. A simulator consists of a type of states and three functions.

Beyond what these three functions are given, it is given neither the weights nor the committer's randomness.

It is computationally unbounded.

structure Simulator (PublicParameters Told Proof : Type) where
State

its internal state; each function below may sample at random (PMF) and returns the updated state (start returns the initial one)

State : Type
Start

it produces a commitment from the public parameters and the maximum number of proofs

start : PublicParameters → ℕ → PMF (Commitment × State)
Query

it answers the verifier's queries to the hash function

answerQuery : State → BitString → PMF (Digest × State)
Proof

it produces each proof from the request and from what it is given about that request

simulateProof : State → Request → Told → PMF (Proof × State)
DefinitionThe simulated experiment after the commitmentVerifiableInference/AtEveryRequest.lean:85–105
In words
In Lean · VerifiableInference/AtEveryRequest.lean, lines 85–105
Given

The steps of realSteps (VerifiableInference/Statements.lean), with the simulator in place of the hash function and of the prover.

  • the simulator, told (what it is told about each request) and the chooser
  • then the verifier's next step, the number of proofs that it may still request, its view so far and the simulator's state
def simulatedSteps {PublicParameters Told Proof : Type}
(simulator : Simulator PublicParameters Told Proof) (told : Request → Told)
(chooser : View Proof → Option Request) :
MaliciousVerifier Proof → ℕ → View Proof → simulator.State → PMF (View Proof)
Stop

the verifier stops: return the view

| .stop, _, view, _ => PMF.pure view
Query

the verifier queries the hash function: the simulator answers, and the query and its answer are added to the view

| .query input next, remaining, view, state =>
(simulator.answerQuery state input).bind fun answered =>
simulatedSteps simulator told chooser (next answered.1) remaining
{ view with queryLog := view.queryLog ++ [(input, answered.1)] } answered.2
Sample

the verifier samples a number: it is added to the view

| .sample bound next, remaining, view, state =>
(PMF.uniformOfFintype (Fin (bound + 1))).bind fun draw =>
simulatedSteps simulator told chooser (next draw) remaining
{ view with randomDraws := view.randomDraws ++ [draw.val] } state
Request

the verifier requests a proof and none remains: return the view

| .requestProof _, 0, view, _ => PMF.pure view

otherwise the chooser is asked

| .requestProof next, remaining + 1, view, state =>
match chooser view with

it returns nothing: return the view

| none => PMF.pure view

it returns a request: the simulator produces a proof from the request and the value of told at that request; the request and the proof are added to the view and given to the verifier

| some request =>
(simulator.simulateProof state request (told request)).bind fun simulated =>
simulatedSteps simulator told chooser (next request simulated.1) remaining
{ view with proofs := view.proofs ++ [(request, simulated.1)] } simulated.2
DefinitionThe simulated experimentVerifiableInference/AtEveryRequest.lean:109–117
In words
In Lean · VerifiableInference/AtEveryRequest.lean, lines 109–117
Given

an argument system, a simulator, the function told, a verifier, a chooser, weights, the number of proofs

def simulatedExperiment {Told : Type} (system : ArgumentSystem)
(simulator : Simulator system.PublicParameters Told system.Proof)
(told : system.Weights → Request → Told)
(verifier : Commitment → MaliciousVerifier system.Proof)
(chooser : View system.Proof → Option Request)
(weights : system.Weights) (proofCount : ℕ) : PMF (View system.Proof) :=
Run

the simulator is given the public parameters of the weights and the largest number of proofs

and outputs the commitment

(simulator.start (system.publicParameters weights) proofCount).bind fun started =>

the simulated steps (the card above), from a view containing only the commitment

for each request, the simulator is given the value of told at the weights and that request

simulatedSteps simulator (told weights) chooser (verifier started.1) proofCount
⟨started.1, [], [], []⟩ started.2

6.4 The honest committer and the honest prover of the compiled argument system

The theorem repliesFit, in full. For every public setup, three numerical conditions hold:

  • (1) finalReplyCount (688,127) is at most onlineRunsPerCopy setup, whose value is also the numeric literal 688,127; so (1) compares two literals, and (2) is what relates this number to a table;
  • (2) for each table, the number of columns counted for the proofs is at most the limit of 44,040,191 (TableBudgetFits: 62 + (furtherCopies + 1) · 62 on the first committed table, 62 + onlineRunsPerCopy setup · 64 on a copy);
  • (3) one run each of the honest sampler of commitment randomness, the honest committer and the honest prover together make at most 2^48 hash queries (WithinBudget, §6.1).

A copy. The committed table of weights is stored encoded, with random masks, and each proof opens some of its columns. Informally, one encoding supports only a limited number of openings before its masks are used up. A copy is a further encoding of the same table, with a link proof (compile, §4.3): a proof of the link IOP, which is meant to show that the copy decodes to the same index as the first encoding.

Condition (1) requires that the number of replies be at most the number of runs that the honest settings assign to one copy, because the prover samples its copy at random and keeps no count; condition (2) states that this many runs fit in one copy.

DefinitionThe number of runs of the online IOP per copy in the honest settingsAtFullSide/Face/TheSixLines.lean:88–89
In words
In Lean · AtFullSide/Face/TheSixLines.lean, lines 88–89

The number of runs of the online IOP that the honest settings assign to one copy: the field onlineRunsPerCopy of HonestProversAndSettingsAtFiles, a number that compile does not read. Nothing in the prover counts them.

abbrev onlineRunsPerCopy (setup : PublicSetup) : ℕ :=
(honestProversAndSettings setup.files (settingsOfRead setup.readParameters)).onlineRunsPerCopy

compile (§4.3) constructs the honest committer and the honest prover from the three honest IOP provers in its input's field provers; for FlashProve these are the provers of honestProversAndSettings.

Remark. The protocol's record has fields for honest provers (honestOfflineProver, honestLinkProver, honestOnlineBatchProver), and the public side's layout has fields for a committer, a prover and the model's next-token function (commit, prove, nextToken). The compiled system is not constructed from these fields (their contents are described at the beginning of Appendix A):

  • its honest committer and prover take their three IOP provers from provers (honestSide);
  • its model is the public side's own (compile);
  • its verifier reads none of these fields (theorem innerCompiledVerifier_eq, Johnson/Top/InnerCompiledVerifierSide.lean:79, which has no card on this page).
The compiled side and the scheme · 2 cards
DefinitionThe honest committer and the honest proverJohnson/Face/Compiler.lean:373–379
In words
In Lean · Johnson/Face/Compiler.lean, lines 373–379

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}
variable (input : Compilable)

The honest committer and the honest prover of the compiled system. The committer samples one number from 0 to coinBound as its randomness and runs the committer of compiledScheme with it; the prover is given the weights, that number, a prompt and output tokens.

def compiledSide : CompiledSide input.publicSide.model.Weights input.format.Form where
Randomness := Fin (input.coinBound + 1)
sample := .sample input.coinBound fun coins => .done coins
commit := fun weights coins => deterministicOf
((((compiledScheme input).C weights).withCoins coins.val).mapO Prod.fst)
prove := fun weights coins prompt output => ofUpload
(((compiledScheme input).coinsFirst input.coinBound).P (weights, coins) (prompt, output) ())
DefinitionThe schemeJohnson/Face/Compiler.lean:354–369
In words
In Lean · Johnson/Face/Compiler.lean, lines 354–369
Given

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}
variable (input : Compilable)

The compiled scheme before it is brought into the form of an ArgumentSystem.

def compiledScheme : ZKCP.Arg 256 input.publicSide.model.Weights (List Token × List Token) Unit
Types

what is published is the 256-bit commitment

Commitment

the prover's key

(FullKey 256 input.publicSide.protocol input.publicSide.offlineRoundSplits
input.publicSide.linkRoundSplits ×
(input.wiring.family.D × Isk 256 input.publicSide.protocol
(input.publicSide.layoutAt input.wiring.baseDigest input.wiring.baseFurther).LeafBody
input.publicSide.offlineRoundSplits input.publicSide.linkRoundSplits))

a proof as submitted

input.format.Form :=
Value

the honest committer and prover, built from the provers

committerAndProverOverOneHash input.wiring.family
(fun reading => (honestSide (input.wiring.layoutAtReading reading) input.provers
(input.settings reading)).side)
input.firstBlockTest input.publicSide.indexOf input.wiring.fallbackInstance (fun id _ => id)

a proof contains:

  • the first table's root and out-of-domain sample
  • the number of the copy used, and that copy's root and out-of-domain sample
  • the offline proof and that copy's link proof (both made once, by the committer)
  • the online proof for this request
(fun key proof => input.format.write ([], (lowKey key, lowPrf key proof)))

with the compiled verifier

fun commitment request form =>
(compiledVerifier input.publicSide input.format.parse commitment request.1 request.2
form).toRandomized.toUpload

Not covered. The prover does not enforce these numbers: compile does not read onlineRunsPerCopy, and the compiled prover is stateless, samples its copy at random and does not count replies.

7. The roles

The table lists every party of the statements: its name, its Lean type, who chooses it, what it is given, what it returns, and what limits it. The model, the honest committer, the honest prover and the verifier are fields of the record ArgumentSystem; the hash function is sampled uniformly at random; the others are quantified in the statements.

RoleIn LeanChosen byIs givenReturnsLimit
hash functionHashsampled uniformly at random, in every probabilitya bit string256 bitsthe same answer to the same query
modelnextToken : Weights → List Token → Option Tokenthe argument systemweights; tokensthe next token, or nothinga function: no query, no randomness
honest committer

sampleCommitmentRandomness : RandomizedAlgorithm CommitmentRandomness

commit : Weights → CommitmentRandomness → DeterministicAlgorithm Commitment

the argument systemweightsits randomness, which it keeps; a commitment, which it publishesnone stated
honest proverprove : Weights → CommitmentRandomness → List Token → List Token → RandomizedAlgorithm Proofthe argument systemthe weights, the committer's randomness, a prompt, output tokensa proofnone stated
verifierverify : Commitment → List Token → List Token → Proof → DeterministicAlgorithm Boolthe argument systema commitment, a prompt, output tokens, a proofaccept or rejectdeterministic
committer, in §1committer : RandomizedAlgorithm (Commitment × State)arbitrary: for allnothinga commitment and a stateat most committerQueries queries
prover, in §1prover : State → RandomizedAlgorithm (List Token × List Token × system.Proof)arbitrary: for allthe committer's statea prompt, output tokens, a proofat most proverQueries queries
opener, in §1.1opener : State → RandomizedAlgorithm (system.Weights × system.CommitmentRandomness)arbitrary: for allthe committer's stateweights and commitment randomnessat most proverQueries queries
extractorextractor : Commitment → QueryLog → Option system.Weightsone for all committers: existsa commitment; the committer's query logweights, or nothinga function: no query, no randomness; no bound on running time
adversary, in the last form of §1.1adversary : RandomizedAlgorithm (Commitment × (system.Weights × system.CommitmentRandomness) × (List Token × List Token × system.Proof))arbitrary: for allnothinga commitment, weights with commitment randomness, a prompt, output tokens, a proofat most queries queries
malicious verifier, in §6.3verifier : Commitment → MaliciousVerifier system.Proofarbitrary: for all; not the verifier of the argument system

the commitment; then, for each proof that it requests, the request and the proof

in both theorems the proof is what the compiled prover returns: a proof or the empty proof

nothing; the experiment returns its viewat most queries queries in all; at most proofCount proofs
chooserchooser : View system.Proof → Option (List Token × List Token)

arbitrary: for all

  • in ZeroKnowledgeOn: among those that pick only requests that satisfy domain at the weights and whose output tokens are the model's; in the theorem zeroKnowledgeOnCanServe domain is CanServe
  • in the theorem zeroKnowledgeAtEveryRequest: every request, whether or not the claimed output is the model's result

the chooser may depend on the weights

the verifier's view so farthe next request, or nothinga function; the same in both experiments
simulatorsimulator : Simulator system.PublicParameters system.Proof

one for all weights, choosers and verifiers: exists

in the theorems on zero knowledge it may depend on the public files

the public parameters (in these theorems: none) and the largest number of proofs

then hash queries

then, for each proof, the request (in the theorem zeroKnowledgeAtEveryRequest also one bit, requestOutcome, at the weights and that request)

a commitment; answers; proofsno bound on running time; never two answers to one query

8. The model of hash functions

The model has one hash function, sampled uniformly at random among all functions from bit strings to 256 bits (the random oracle model). Every algorithm of the statements has query access to it; the statements bound the number of queries and, in zero knowledge, of replies, and nothing else. In the simulated experiment of zero knowledge the simulator answers the hash queries in the hash function's place.

Two types of algorithm, and where the hash function is sampled. RandomizedAlgorithm and DeterministicAlgorithm are both types of oracle algorithm: an algorithm of either type may query the hash function and continue with the answer, but neither fixes nor samples it. "Randomized" refers to the algorithm's own coins: a RandomizedAlgorithm may also sample random numbers of its own, whereas a DeterministicAlgorithm, the type of verify and of commit, may not. toRandomized views a deterministic algorithm as a step of an experiment and adds no randomness. In the statements on this page the hash function is sampled in Prob: the probability is taken over uniformHash, the uniform distribution on hash functions, and over the experiment's own random choices. evaluate instantiates the hash function with a concrete one, as in leanVerifier (§5).

The second hash function. FlashProve's second hash function is a different function: it is fixed, and it is part of the argument system. The model does not sample it. §5 states what the theorems assume about it (nothing) and what the Fiat–Shamir heuristic assumes about it.

DefinitionThe hash functionVerifiableInference/RandomOracleModel.lean:36
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 36–36

a function from bit strings (BitString) to 256 bits (Digest)

abbrev Hash : Type := BitString → Digest
DefinitionThe uniform distribution on hash functionsVerifiableInference/RandomOracleModel.lean:40–41
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 40–41

a probability measure on hash functions

def uniformHash : Measure Hash :=

the product measure: at each bit string a uniform value of 256 bits, independently of the others

Measure.infinitePi fun _ : BitString => (PMF.uniformOfFintype Digest).toMeasure
DefinitionA randomized algorithm that queries the hash functionVerifiableInference/RandomOracleModel.lean:51–54
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 51–54

an algorithm with a result in α: one of

inductive RandomizedAlgorithm (α : Type) : Type

it stops with a result

| done (result : α) : RandomizedAlgorithm α

it queries the hash function at a bit string and continues with the answer

| query (input : BitString) (next : Digest → RandomizedAlgorithm α) : RandomizedAlgorithm α

it samples a number from 0 to bound uniformly and continues with it

| sample (bound : ℕ) (next : Fin (bound + 1) → RandomizedAlgorithm α) : RandomizedAlgorithm α
DefinitionSequential composition of randomized algorithmsVerifiableInference/RandomOracleModel.lean:57–61
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 57–61
Given

a randomized algorithm, and a second one that depends on the first's result

def RandomizedAlgorithm.bind {α β : Type} : RandomizedAlgorithm α → (α → RandomizedAlgorithm β) →
RandomizedAlgorithm β

the first has stopped with a result: run the second on that result

| .done result, rest => rest result

the first makes a query: make it, and continue in the same way with the answer

| .query input next, rest => .query input fun answer => (next answer).bind rest

the first samples a number: sample it, and continue in the same way

| .sample bound next, rest => .sample bound fun draw => (next draw).bind rest
DefinitionThe notation for a sequence of stepsVerifiableInference/RandomOracleModel.lean:64–66
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 64–66

the notation do for randomized algorithms:

instance : Monad RandomizedAlgorithm where

pure: stop with a result

pure := RandomizedAlgorithm.done

←: one algorithm after another

bind := RandomizedAlgorithm.bind
DefinitionAt most a given number of queriesVerifiableInference/RandomOracleModel.lean:78–82
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 78–82

for an algorithm and a number of queries

def RandomizedAlgorithm.QueryBound {α : Type} : RandomizedAlgorithm α → ℕ → Prop

stopped: true

| .done _, _ => True

a query, and the number is 0: false

| .query _ _, 0 => False

a query, and the number n is at least 1: every continuation makes at most n − 1 queries

| .query _ next, queries + 1 => ∀ answer, (next answer).QueryBound queries

a sampling step: every continuation meets the same bound

| .sample _ next, queries => ∀ draw, (next draw).QueryBound queries
DefinitionAn algorithm with its query logVerifiableInference/RandomOracleModel.lean:89–94
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 89–94

the same algorithm, returning its result together with its query log (QueryLog): its queries with their answers, in order

def RandomizedAlgorithm.withQueryLog {α : Type} : RandomizedAlgorithm α → RandomizedAlgorithm
(α × QueryLog)

stopped: the empty log

| .done result => .done (result, [])

a query: the query with its answer, then the log of the continuation

| .query input next => .query input fun answer =>
(next answer).withQueryLog.bind fun rest => .done (rest.1, (input, answer) :: rest.2)

a sampling step: the log of the continuation

| .sample bound next => .sample bound fun draw => (next draw).withQueryLog
DefinitionThe output distribution of an algorithm under a fixed hash functionVerifiableInference/RandomOracleModel.lean:70–74
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 70–74

for a hash function hash: the distribution of the result

def RandomizedAlgorithm.run {α : Type} (hash : Hash) : RandomizedAlgorithm α → PMF α

stopped: the result, with probability 1

| .done result => PMF.pure result

a query: continue with the answer of hash

| .query input next => (next (hash input)).run hash

a sampling step: the average, over the bound + 1 numbers, of the continuations' distributions

| .sample bound next => (PMF.uniformOfFintype (Fin (bound + 1))).bind fun draw => (next draw).run
hash
DefinitionThe probability of an event under a distributionVerifiableInference/RandomOracleModel.lean:99–100
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 99–100
Given

a distribution and an event (a set of results)

def eventProbability {α : Type} (distribution : PMF α) (event : Set α) : ℝ≥0∞ :=
Value

the probability of the event

distribution.toOuterMeasure event
DefinitionProbability over the hash function and the algorithm's random choicesVerifiableInference/RandomOracleModel.lean:106–107
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 106–107
Given

an experiment (a randomized algorithm) and an event (a set of results)

def Prob {α : Type} (experiment : RandomizedAlgorithm α) (event : Set α) : ℝ≥0∞ :=
Value

the expectation, over a uniformly random hash function (uniformHash), of the probability that the result under that hash function is in the event (RandomizedAlgorithm.run, eventProbability)

∫⁻ hash, eventProbability (experiment.run hash) event ∂uniformHash
Remark

The random oracle model enters the statements through this definition, which samples the hash function once for the whole experiment.

DefinitionA deterministic algorithm that queries the hash functionVerifiableInference/RandomOracleModel.lean:119–121
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 119–121

an algorithm with a result in α: one of

inductive DeterministicAlgorithm (α : Type) : Type

it stops with a result

| done (result : α) : DeterministicAlgorithm α

it queries the hash function at a bit string and continues with the answer

| query (input : BitString) (next : Digest → DeterministicAlgorithm α) : DeterministicAlgorithm α
DefinitionThe result of a deterministic algorithm under a hash functionVerifiableInference/RandomOracleModel.lean:124–126
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 124–126
Given

a hash function

def DeterministicAlgorithm.evaluate {α : Type} (hash : Hash) : DeterministicAlgorithm α → α

stopped: the result

| .done result => result

a query: continue with the hash function's answer

| .query input next => (next (hash input)).evaluate hash
DefinitionA deterministic algorithm as a step of an experimentVerifiableInference/RandomOracleModel.lean:129–132
In words
In Lean · VerifiableInference/RandomOracleModel.lean, lines 129–132

converts a deterministic algorithm into a randomized algorithm (RandomizedAlgorithm) that samples nothing

def DeterministicAlgorithm.toRandomized {α : Type} : DeterministicAlgorithm α → RandomizedAlgorithm
α

stopped: return the result

| .done result => .done result

a query: make it, continue with the answer

| .query input next => .query input fun answer => (next answer).toRandomized

9. Definitions used on the cards

This section lists the definitions that are named in a card's Lean code and have no card of their own, arranged by folder. Each row gives the declaration's keyword, its name, the first sentence of its comment in the Lean file (if it has one) and the line number. These comments were written for the library's authors, and Lean does not check them. Click a name to read its Lean code.

The sub-protocols over codes (linear tests, lookups, folds), with the field and the statement on codes · 1 definition in 1 file
Gl/GlField.lean
abbrev:44
The model's relations: index, witness table, layer conditions · 1 definition in 1 file
Rel2Guards.lean
defthe scales of a table ScalesAndPolicy of Inst/Model/ProgTests.lean:32
Compiler from interactive oracle proofs to non-interactive arguments · 8 definitions in 4 files
Bcs.lean
defevery opening at a position of the list we.all is at a position that is read, and its salt has exactly sMT bits:39
Joined/Types.lean
structureWhat the joining round sends in the clear: the answers of the one record over the three chains, and the run's value of chain 2.:96
abbrevThe shape of the whole: front, chain 1, joining round, chain 2, seam, chain 3.:156
defthe front's prover message:194
defthe joining round's prover message:200
defthe seam's prover message:204
Oracles.lean
inductive:18
Star.lean
structure:28
Declared structure: what is public before any proof · 1 definition in 1 file
Declared.lean
defThe kind of the round of a name, or nothing if the format has no round of this name (R14.11).:259
The protocol as one object and its honest provers · 66 definitions in 26 files
BridgeCoins.lean
defThe enumeration of a finite, non-empty type.:94
defThe window's three numbers.:100
def:102
def:106
BridgeJoinAtFiles.lean
abbrevThe description built from (Zp, Np, cF).:302
FiveLeftSilent.lean
defThe letters of the laws on coins that go with it: ℓ free bits in a leaf's salt, behind a public start of zeros; ℓr bits in the string behind a slot's value.:200
HonestFamily.lean
defThe one honest prover whose private input ends with the number.:62
KeyArgumentsAt.lean
defA record that reads nothing, for fixedKeyParts' wit, which withSendingsAndLookups overwrites.:105
KeyBook.lean
defThe key file's book of coins.:444
KeyBookAtWritten.lean
defThe KeyPub of the written sizes: KeyPub.of (E2E/KeyBook.lean) at keyFull and at its number of answers to an OOD sample.:127
KeyBookHeldK1Jobs.lean
defA ride for the sending of the multiplicities: at message number 1, from 0, a fold's fresh table of 4 rounds, with h = 4; none at every other number.:125
defA ride for W's sending: at message number 1, from 0, a fold's fresh table of 5 rounds, with h = 1; none at every other number.:129
KeyFirstSends.lean
abbrevThe one-time chain's public values.:53
defLookup i's face.:66
defThe point of the claim on the keys of part p of lookup i, off the challenges heard: the key tree's last point, coordinate t with bit t of a key's number (keyClaims, K3Key.lean, turns the hearing's point round in the same way).:78
defThe batching's three numbers: "BAT-sigma" at the first of its rounds, "PSC epsilon" behind it, then the rounds of the column variables.:84
defThe number of the first message of W's sending: the index-mask message, the multiplicities' sending, and what the ranges' test sends.:103
defThe batching's numbers: the block's own.:123
KeyHalves.lean
defThe job at the test on G_u.:77
defThe job at the test on G_omega.:85
KeyHonest.lean
defThe committed table of a private input, by the configuration's encoder.:352
defOne value for the parameter J.:376
KeyLookups.lean
abbrevWhat both lookups read: one input, a half for each.:63
defThe two lookups' records, of a half's input.:71
abbrevHow points are read.:75
defThe first lookup's sums.:89
defThe second lookup's sums.:92
defLookup i at its place.:95
KeyPartsHalves.lean
defThe pair at the test on G_u, at the parts' own letters; withTestsOnUAndOmega lays it.:65
defThe pair at the test on G_omega, behind the guard, at the parts' own letters; withTestsOnUAndOmega lays it.:70
KeyPartsIdle.lean
defThe points of a lookup that reads nothing.:43
defA sending that sends nothing of its own.:47
defA batching's numbers that are idle.:51
KeyPile.lean
defThe rows rowOfPoint of all parts of all lookups, in the lookups' and the parts' order.:108
KeyPlaces.lean
defThe proximity test on the ranges' group.:135
defThe proximity test on the folded row's group.:161
defThe proximity test on Omega's group.:163
defThe proximity test on the own group.:171
KeyProtocolOverDescription.lean
defThe fields of a prover structure of a whole file's protocol, at another test and decision.:211
abbrevThe instance type of a key file's description: the table's key as the program writes it.:278
defThe test on the three plain parts at an instance of KeyInst: both copies of the answers are the key's list of answers; the copy's number is 0.:288
abbrevThe protocol over a key file's description at its own instance type, at the library's parameters.:302
KeyProver.lean
abbrevThe key file's instance: the key of a table.:62
abbrevWhat a half of the first or the second chain is handed: there is no trace.:65
abbrevWhat a half of the shared chain is handed.:68
defThe committer's coins for one table, field by field.:72
KeyProverSideOfOwnTest.lean
defThe job.:76
KeyRangesJob.lean
defThe verifier's state that the test is entered with, by replay: the description's own first fifteen sub-protocols over the rounds shown; where they do not return, the structure at the chain's first state.:71
defWhat is taken of the sending of the multiplicities.:138
KeyReaders.lean
defThe first coordinate of a cell; 0 outside the shape.:47
KeySendJobs.lean
defThe job of the index-mask message's sending: no table is sent along; data gives no entry.:121
defThe job of the sending of the lookups' own message, whose main rows hold the multiplicities, with what is sent along with it (ride).:128
defThe job of W's sending, with what is sent along with it (ride).:144
KeyShapeSharedFull.lean
defThe linear claim's parameters at the written sized key.:59
KeySharedThread.lean
abbrevThe linear claim's parameters at the key.:64
ObjectAtFiles.lean
abbrevThe configuration at Z: the table of scales and policy is what the library's reader returns at Z's policy file and its file of scales (the reference's where it refuses).:218
defThe three protocols at Z, with their proof of work in the rounds: the library's own, at the letters from which the verifier is compiled.:223
TiedAtFiles.lean
defWhat the front round sends: the answers, and the copy's number n.:318
defWhat the joining round sends: the answers, and the second chain's run value.:323
defWhat the seam sends: the third chain's run value.:328
defThe shared chain's first state, as a function of a key.:381
defThe committer's structure where the explicit input is the description's own instance.:394
defThe library's test on the proof file's three plain parts, read off the description's own instance: both copies of the answers are the entries of the key's array.:465
abbrevThe claims at Z.:492
abbrevThe pads' type, at the full size.:502
abbrevHow a matrix is held, at the full size.:507
The byte format's rules as functions on bytes · 15 definitions in 7 files
Plan.lean
structureThe plan of a chain.:109
Rules1.lean
def32 zero bytes:117
defcut to n bytes, or filled up with zero bytes:120
inductive:158
Rules23.lean
defthe digest length:154
defThe label.:157
defThe oracle's string of a hash.:175
defReading a string back: none outside the strings of the domain.:188
defthe strings on which a hash of the format is the oracle:199
defthe oracle outside the image: the hash under the reserved number, of the whole string:205
Rules4.lean
defThe rounds of the chain: the entry under the name RECORD is passed over.:154
defwhat is hashed for the configuration's digest:223
Rules5Fast.lean
defthe hash formatHash with the flat form of BLAKE2b under it:47
Rules6.lean
abbrevan element of the extension field, as its three coordinates:89
Rules6Draws.lean
defthe draws of a round's elements:55
Holographic interactive oracle proofs with an untrusted committer · 4 definitions in 2 files
RecConf.lean
abbrevthe oracle kind of the encoded index:136
abbreva record:138
defThe index decoder: none at a collision; none if the word does not decode with the record; none if the decoded message holds no index of the index set.:145
RecInterface.lean
abbrevA record: the seed and the answer.:148
The integer model and its relations on requests · 9 definitions in 3 files
Model/ProgTests.lean
structureThe scales of one layer in the settings.:86
Model/Program.lean
structure"exponent of the reciprocal; shift; constant" of a normalisation:71
defThe reference parameters.:122
structureAn instance is a request: T tokens, the announced token y, and the two numbers r, e.:469
Model/TablesData.lean
defSILU + 4,095: 32 blocks:19
defSIGM / 16: 32 blocks:54
defExp: 3 blocks (2,307 entries):89
defC + 4,096 in a layer whose rotary flag is on: 64 blocks:95
defS + 4,096 in a layer whose rotary flag is on: 64 blocks:162
The model in integer arithmetic, its window and its next token · 1 definition in 1 file
Arrays/OfIndex.lean
defThe settings of a table of scales: the sizes of the model and the table's numbers, but for the 72 that the model does not read (settingsArraysOf, IntegerModel/Arrays/OfTensors.lean).:51
Interactive oracle proofs: protocols, batches, the compiler's interface · 20 definitions in 4 files
Batch.lean
structureThe annotation of one round r of the local shape: its kind, and the splitting of a prover message of the local transcript into (m_0, m_j).:147
defA round in which only the shared part is sent: the slots send nothing.:193
defThe same rule of annotation in every round.:215
defLocal rounds only, and no shared prover message: an ordinary IOP.:220
defThe annotation of two shapes one after the other.:223
defThe shared verifier messages ρ_0.:244
defThe local verifier messages ρ_j of one slot.:249
defStrategies for the shared part: m_0 in every round; of the verifier messages only the shared ones are seen.:409
defStrategies for the part of one slot: m_j in every round; the verifier messages of τ_j are seen.:415
InteractiveOracleProof.lean
structureExternal strings: oracles that are fixed before the first message.:25
abbrevOne string of n symbols as external oracle.:140
abbrevTwo such strings, for Link: parent (left) and child (right).:143
Shape.lean
defFull transcripts.:83
defThe verifier's randomness of a whole execution.:88
defThe plain parts of all prover messages.:93
defPositions of all prover oracles.:98
defThe alphabet at a position.:103
defDeterministic prover strategies that end with a result in β (the prover's output, or its state for what follows).:109
Wire.lean
abbreva hash block (a digest or a chaining value): lam bits:17
structurean explicit enumeration of a finite non-empty type, from which the scheme samples:20
Interactive oracle reductions and their sequential composition · 2 definitions in 1 file
Ior.lean
abbrevNo oracle.:36
structureAn interactive oracle reduction of fixed shape: the data.:50
The protocol's description, the soundness theorem on verify, the compiler, and their lemmas · 541 definitions in 217 files
Bind/ForProver/Enc.lean
defThe encoded index's column at the position x, general in the shape: the column of the committer on bytes, read in the field; nothing from 2^a on.:72
defThe committer's shape of the verifier's shape of a committed table: the same six numbers.:79
Bind/ForProver/Rows.lean
defThe packing.:54
defA test with code: a message has room for its pads, and a matrix of the given number of rows, 2^kLo columns of it in a row of the table, has room before the pads.:76
CompletenessAndZeroKnowledge/FormatStarts.lean
abbrevThe two further run values of a file.:33
structureThe public rounds at which the chains change.:41
defThe tail behind a slot's value: the 64-bit index of its leaf, in a tree of depth proofDepth at the slot proofSlot, and in a tree of depth 0 elsewhere.:132
defThe proof file's slot: 0 in a tree of one leaf, else 1, so that it is told apart from the key's and the link's slot 0.:137
CompletenessAndZeroKnowledge/OneHashByFirstBlockTestFront.lean
defreadToldF as a ZKCP.Arg: one hash function, one request a call.:93
CompletenessAndZeroKnowledge/SendsAtTerm.lean
defWhat a coin of the arm fixes, and where the plain parts hold it.:59
CompletenessAndZeroKnowledge/TheSettings.lean
defConstant starts: no run value; every start is one string.:76
abbrevThe free bits of a leaf's salt: 320.:189
Desc/Block.lean
defA list of blocks as rows of the table of places: name, place, number of rounds.:484
defThe name of the first block of a list that fails its own test on the plan or is not shaped.:581
Desc/BookPlan.lean
defThe number of the round that sends root number n of a chain, both from 0.:209
defThe place of a tree that a round on the chain own opens: the chain that sent it, and its number in that chain's order of sending.:230
defEach place stands before the next.:239
Desc/ChainEnd.lean
abbrevA test as a list of named clauses.:73
defThe first failing clause's name, as a refusal.:77
defNothing is left untested, as two named clauses.:83
defThe round in which a chain is sealed.:89
defOn the plan: no count of claims is owed at the end: the last of the rounds that the blocks in front declare counts no claims.:93
Desc/Claim.lean
structureA claim: form + the runs = 0.:44
Desc/First/Att/K5AttentionKind.lean
structure:88
structureWhat K5 takes of the state, and what it lays back.:184
Desc/First/Base/DescState.lean
structureWhat a ground function reads of a chain's parameters: general: no chain's own shapes.:49
structureThe state that is carried.:95
Desc/First/Base/Ground.lean
abbrevA test: named clauses.:77
def:215
Desc/First/Batch/Kind.lean
structureThe numbers of a place of the kind.:55
structureThe part inside a state T; nothing where no segment is open.:83
defClaims made and added where the block stands.:159
Desc/First/Close/Closing.lean
defThe frame's closing of a link, whole.:210
Desc/First/Close/Kind.lean
structureThe numbers of a place of the kind.:34
defROUNDS.:53
structureWhat the kind reads and writes of the carried record: the rows owed; the walk's frame; the statement.:60
Desc/First/Driver/Chain.lean
defThe places of a list of kinds on the first chain.:127
defThe places of a segment's closing.:133
defThe protocol's order of a segment's claims: the three stretches in a row.:158
defThe same for what a segment's blocks do after the batching.:161
defThe block at a place, with that place written into its field place.:209
defThe one place whose decision may write the reply: that of the kind K7, which kindsBeforeBatching lays once, first in the head's segment.:242
Desc/First/Fork/MergeKind.lean
structureThe numbers of the merge's place at the head's link.:71
defROUNDS: the merge's entries of the plan.:87
defDECIDES.:143
defCLAIMS: the claim that the merge's sumcheck leaves.:160
Desc/First/K4/Block.lean
defThe plan's entries of K4's stretch, as K4's table makes them.:68
structureA place's public parameters.:71
defDECIDES.:95
defCLAIMS as a named run: the forms as a list, and the state with the ledger behind them.:108
defBEHIND THE BATCHING.:115
Desc/First/K8/AtS.lean
defThe seat at S.:22
Desc/First/K8/Hear.lean
structureThe numbers of a place.:71
structureWhat the kind asks of the carried record, and what it lays into it.:93
defAll matrices' columns together.:115
defEach matrix's first column; at the end the number of all columns.:118
def(t): the shapes of all tables, family by family, from entry 0 on.:131
defROUNDS.:135
Desc/First/K8/Whole.lean
structureThe numbers of a place, for both halves.:36
defA run at the part, as a run at the record.:41
Desc/First/Look/K3Key.lean
defThe face of a lookup with the public record S.:41
Desc/First/Look/K3Lookup.lean
structureWhere the carried record keeps what the kind reads and writes.:88
Desc/First/Look/K3LookupGeneral.lean
structureA lookup's public face: numbers, orders and one public function.:87
defThe three claims on the planes: what the leaves' sumcheck left, with the planes' value at its point; the planes' value at the bits' sumcheck's point is what that sumcheck has shown; the counts add up to the number of keys that are no padding.:273
structureA place's public parameters: numbers and public functions alone: NO ENTRY OF THE PLAN, no declared round.:329
defThe plan's entries of the place's rounds: the planner's own, of the numbers.:345
defThe tests on the plan alone: the face's; the planner makes the rounds (so its two bounds hold: the keys are fewer than 2 ^ planes; the counts' sum cannot wrap); the ledger has room; some oracle message is named as fixed before the first draw; every guest fits.:351
structureWhere the carried record keeps what the kind reads and writes (Seat, K3Lookup.lean, at HeardG).:357
defThe lookup's messages at a place.:369
defThe debt of that number in the ledger is not yet marked as paid.:374
Desc/First/Look/K3Runs.lean
def"join": the claim on the calls' key vectors.:68
Desc/First/Look/LookKind.lean
structureThe lookup's public parameters at a place: numbers and public tables alone: no entry of the plan, no declared round, no state.:42
structureA guest of the lookup: another kind's identity that is tested at coordinates of the key side's last point instead of at a point of its own.:89
Desc/First/Look/Via/Via.lean
defThe two public premises of the laws, as one test on the plan: the plan's entries are, but for the work bits, those that the hearing goes by; and each passes the strict reading's tests that read the entry alone.:57
defK3Lookup.lean's own decide, line for line, with the hearing alone exchanged.:63
Desc/First/State.lean
structureThe state that the first chain carries.:332
Desc/First/TailClaims/K8Claims.lean
defFor Block.claims.:64
defFor Block.after.:70
defFor Block.after, behind k8LsTail: the smallness test's sixteen tests on the sums, with the rows' weights set between them (testsP, SelfRows.lean).:77
Desc/K1/AtS.lean
defThe statement's part of S.:44
defThe debt of rows as this kind is handed it: a debt of no rows is no debt (the carried record's own reading: "none" and "some 0" answer alike: S.noneWaits).:50
Desc/K1/First.lean
defOn the plan alone.:69
defThe opening's decision on the walk's state of the calls and the statement's part.:76
defThe numbers of the first segment's opening.:104
Desc/K1/Own.lean
defThe sending's decision, behind roundsFit.:122
defTESTS ON THE PLAN ALONE: K1/Send.lean's, and every sampled message's pads fit their row.:150
defA segment's later moment around the sending: the walk's and the frame's own tests and writes.:162
Desc/K1/Send.lean
structureThe numbers of a place.:85
defAll messages of the place, in the order of sending.:99
structureA carried record with the channel's debt: the number of rows that the entry of the round closed before counts, until it has been compared.:160
Desc/K12/AtPlan.lean
def:36
Desc/K12/FixedBefore.lean
defEvery tree that a stage of the test opens was sent in front of the first draw of the stage that spends it.:72
Desc/K12/Frame.lean
structureThe numbers of a place at which a proximity test stands.:52
structureThe parts.:79
abbrevRounds, each with what Block.oracles says of it.:100
defA block without a round that asks one thing of the record.:109
defThe group's two codes and its tables' k and h are the stage's.:114
defThe test's name at a place: so that a refusal says which of a file's tests it is.:118
defThe rounds of a test: 1, then k + 3 for each stage but the last, then 2.:122
defThe stages from number j on: cur, then the stages behind it; l: the rounds still to be dealt.:125
Desc/K12/Join.lean
structureThe record inside a proximity test.:60
defThe front: the schedule as it lies in the record, then every claim that lies open on the group (Johnson/Desc/K12/Front.lean: frontE).:111
def:131
def:141
defThe last lines of csTest: csTest at parts whose switch only hands on what the switch before has returned.:158
Desc/K12/JoinGuarded.lean
defThe last part.:155
defGuard (z), in front of a part that draws positions.:194
defGuard (k), on the record that the batching leaves: the one claim has no kept form, and no member of the group's layout is kept.:202
defGuard (c), on the record in front of the batching: the group is in order, the layout is the statement's, and every row that the batching takes lies on its members' tables.:214
Desc/K12/Law/FirstCut.lean
def:47
def:65
Desc/K12/Law/FirstOk.lean
defThe test: every clause says yes.:169
Desc/K12/Law/PubOk.lean
defThe test: every public clause says yes.:197
Desc/K12/Plan/PlaceOfPlan.lean
structure:51
structure:60
defThe proof file's four places.:208
Desc/K12/Seat/Fill.lean
defThe shared chain's last block.:43
Desc/K12/Sizes.lean
defThe sizes of a proximity test's stages fit together.:74
Desc/K12/TestEntries.lean
defThe declared rounds of a proximity test, from the numbers of its place.:97
defFor each round, for each root that it sends: the log-length, the words of a symbol.:113
Desc/K12/TestOracles.lean
defFor each round, for each root that it sends: the oracle message beneath it.:72
defWhat must have been sent before the test's first draw.:79
Desc/K13/Kind.lean
structureThe numbers of the kind's places.:44
structureThe part inside a state T.:80
defThe part, or a refusal under a name.:88
def:103
Desc/K13/Text.lean
defThe batching.:124
Desc/K14/Blocks.lean
abbrevAn oracle message where it is sent, in the format's record.:76
structureThe place's public parameters.:79
defWhat the page's functions read of the parameters.:93
defThe kind's own rounds as entries of the plan, in order: "LIN point", "LOC", "LIN zeta", and "SPLIT" where there is a split.:115
defK1's parameters at one of the chain's two sendings.:119
defA refusal under the name of the first clause that is false, with "not met: " in front: a clause's name says what is asked, not what was found.:142
defA sending at this chain's state: K1's own block at the parameters Q.:151
defThe eight blocks; where the kind's rounds cannot be said, one block that fails its test on the plan: so a file's description can be made at every parameter, and refuses there.:201
defThe state in front of the first round: the codes and the instance's key; no message, no group, no tree.:213
defTHE TEST ON THE INSTANCE: every word of the key is below the field's prime, the seeds' and the record's; and the key names the item that READS names.:219
defWhat a later chain reads of this chain's end, as a Proof.SharedEnd; nothing unless all is tested.:247
Desc/K14/Text.lean
abbrevThe carried state: the statement and the book of trees (coarse: a common page's), and Lin.:88
defWhat goes out with o_u (the first mask of the test on G_u), and with o_omega (o_sp).:114
def:117
defPi_M is read at Q, the locations drawn in "LOC": all of them, from the first on; each location once, in increasing order (the format's general function makes that list).:134
defThe tests in front of (fold), as named clauses.:170
def(fold): omega_col at z_fd is what u gives at (psi_lo, z_fd), over the real rows of M alone: < eq(z_fd, .), omega_col > - < eq((psi_lo, z_fd), .), u > = 0.:178
defThe tests at "LIN point".:199
defThe tests in front of (rec_gamma).:206
defThe test in front of the joinings.:215
defThe tests at "SPLIT", behind "just one scalar is sent".:220
def"LIN point": the verifier sends psi_sh.:233
defo_u has gone out by a sending (K1).:244
defNo round: o_u joins G_u; (rec_gamma) goes there, once for each answer of the record.:250
def"LOC": the verifier sends the locations Q; the prover sends nothing.:261
defo_omega and o_sp have gone out in one prover's message by a sending (K1).:271
defNo round: o_omega has a tree to itself (each instance's own test opens it again) and joins G_omega; o_sp joins both groups.:277
def"LIN zeta": the verifier sends z_fd.:284
def"SPLIT": (fold) reads messages of two groups, and a test reads one.:292
Desc/K15/K15.lean
abbrevThe carried state.:76
defPi is read at Q_0, the first draws of "LINK"; Pi' at Q_1, the others.:103
def:127
def"LINK point": the verifier sends gamma.:134
defNo round: the first table's share, then the copy's.:157
def"LINK": the verifier sends the locations; the prover sends nothing.:172
def"LINK phi": the verifier sends phi; (eq_phi) goes to G.:180
Desc/K15/TypedP.lean
def:37
Desc/Key/Asks.lean
defThe tests that the laws ask: of what the program has read of the public files, the layout file, the planner's answer with the sendings, the description and its data.:62
Desc/Key/Chain1.lean
defThe trees that the declared rounds send in front of round r.:40
defThe trees that round r of D sends (0 where there is no such round).:44
defThe first round of the batching of the rows on the table: the first that is named "BAT-sigma" (the list's length where none is).:48
defThe first round of W's sending: the last round that is named "SEND seed" (0 where none is).:51
defWhat the ranges' test's seat reads of chain 1's state: the statement's record, the group's number and the message that holds the first fold's mask.:58
defWhat the seat writes back: the statement, the book and the count of roots; no count of rows is owed any more.:67
defThe part of the file's last test that looks at chain 1's last state: firstChainEnded; no ledger is open; all lookups are laid; the ranges' group is there; it and every group behind it but the last one have begun their tests and hold no open row.:76
defThe groups that each oracle message of a sending of chain 1 joins, message by message in the order of sending, off the tenants as told.:84
defThe numbers of chain 1's places outside its links: the two sendings 1 and 2, the batching 13, W's sending 14, the seal 15.:90
Desc/Key/Chains23.lean
defThe place's parameters out of the planner's chains, at the key.:47
defThe shared chain's front: a block without a round that asks them.:70
defWhat must be fixed before the shared point is drawn.:74
defThe two proximity tests (as tests of Johnson/Desc/K12/Seat/Fill.lean, at these places' numbers).:79
defThe parameters of the second part of the test on the table, at the key.:96
defThe proximity test on the own group, at its place's numbers.:101
Desc/Key/Desc.lean
defWhat the description is made of, out of the planner's answer and the sendings.:83
Desc/Key/FileOk.lean
structureWhat the description is made of.:47
defThe test "opened" on the description's own roots.:167
defThe tests on the plan that tie the chains, by name.:214
Desc/Key/Link.lean
abbrevA claim that a lookup leaves: one on hidden values alone (Aff), or one that reads the planes (PlaneClaim).:59
defThe lookups of the key's proof of the ranges, in order: the verifier program's own list (Wf.lookupsOf) at the one-time chain's public values.:66
abbrevChain 1's state: the statement, the book and the roots (ChainState), with the lookups' record.:100
defLookup i as a link.:180
defThe block "rng.0.rows"; it has no round.:196
Desc/Key/One.lean
def"idx.1.send".:165
def"msg.1.send".:174
def"batt.1.batt".:182
def"w.1.send".:191
def"seal".:217
Desc/Key/Places.lean
structureThe numbers of the three places.:75
defThe three places.:81
Desc/Key/Ranges.lean
defThe numbers of the ranges' test's place, from m: what the planner makes of the three public files, with the chains' sendings.:110
defThe test's parameters at the place's numbers.:154
defThe ranges' test at any state, with what the seat asks.:214
Desc/Key/Road.lean
defThe planner's whole answer and the sendings, from what the program has read of the public files, the layout file and the digest: the last two steps of Model.Verify.planned, in its order, and the list of the sendings, of which the key's three and the proof's three are kept; the fourth, the entry chain's, is made and dropped (the record has no field for it).:45
Desc/Key/Source.lean
defThe test on the instance alone: the key names the statement's item 0; its sizes fit the table's shape (Foldeq.lean, TableKey.fits); every word of it is below the prime; no seed of the record has the factor 0 (isZeroE: on words below the prime this says that the element is 0: Ext.lean:47-48).:389
Desc/Key/State.lean
defThe first state: the codes; no oracle message, no group, no tree (as the verifier program's Key.startOf).:69
defOf the chain's last state: the statement, the book of trees, the roots received and the rows on the table; behind the batching these are the one row that the claim gives.:89
Desc/Key/WantedFirst.lean
defThe first chain's rows of wanted.:63
defThe first chain's rows of owed.:74
Desc/Key/WantedLater.lean
defThe shared chain's rows of wanted.:76
defThe last chain's rows of wanted.:86
defThe shared chain's rows of owed.:95
defThe last chain's rows of owed.:103
Desc/Key/Xi.lean
structureThe instance of a key file's description.:22
Desc/Kinds/Head.lean
defThe verifier hears, and tests the rounds' shape alone.:87
defHanded to the lookup as values; they are not among the forms that must be 0: five keys, each summed at the lookup's point.:123
Desc/Kinds/HeadCaller.lean
defOne form a call: the call's key vector at its point.:46
Desc/Kinds/HeadCells.lean
defTo the merge: the sumcheck's second end value, UH at the challenges: under the weights of the top digit's key, logit t (win t) - logit t v at rH, as a claim on the committed weights Wh (SumOnMatrix: HeadParts.lean).:86
Desc/Kinds/HeadFrame.lean
abbrevThis kind in the format's list of kinds.:33
structureTHE PLACE'S PUBLIC PARAMETERS: numbers of the plan alone.:40
structureWHAT THE KIND ASKS OF THE CARRIED RECORD.:60
defDECIDES, of a hearing and its rounds as data: the hearing on the place's own rounds, read strictly; the rounds that batch rows ask for their rows themselves.:141
defCLAIMS, of named runs of forms and of the calls' key vectors: the first run also hands the key vectors to the seat (setKeyForms), WHICH HAS NO READER FOR THEM: the lookup's join, next in the link's order, takes the key vectors from callerKeys (HeadCaller.lean), which makes them itself.:165
defThe key vector of one call of the lookup, at the call's point: its padding's term, then its keys: the normalization's by HeadNorm.lean (the row has 21 digits of the head's behind the normalization's 99), the head's by the function handed in.:177
Desc/Kinds/HeadParts.lean
abbrevA public constant plus public coefficients on hidden scalars and on entries of committed vectors.:79
Desc/Kinds/ReplyKind.lean
structureTHE ONE SEAT: the element that was heard, if one was.:32
defDECIDES, each test under its name: one round; nothing has been heard yet; the round holds just one element and draws nothing; the element is a token of a vocabulary of V: one coordinate, below V.:44
Desc/Laid/AsksFirst.lean
defThe first test of a list that says no; each test stands with the words under which it refuses.:15
Desc/Laid/ProofAsks.lean
defThe tests that the laws ask, of the three public files, the description and its data; o: the format's second hash function, a letter, handed down from laidPOf, so that a test can make the public record of the three files anew without naming a hash.:95
Desc/Link/LinkDesc.lean
structureThe place's public parameters.:67
def:74
defThe same; nothing where the one message's trees cannot be laid (K1's page says no root there, and its test on the plan refuses).:103
defA refusal under the name of the first clause that is false.:107
defThe sending of o_0 and o_1: the kind K1's own block (Johnson/Desc/K1/Own.lean: sendOwn), laid at the link's record by Block.inside, as Johnson/Desc/K14/Blocks.lean lays it (sendAt).:119
defThe five blocks; where the rounds cannot be said, one block that fails its test on the plan.:159
defA block without a round at the chain's front: on the plan: the public shape's conditions.:164
defThe proximity test on G.:199
defThe state in front of the first round: the codes and the instance's two keys.:211
defThe test on one key.:216
Desc/Link/LinkOfFiles.lean
structure:33
Desc/Ok/PlanWritten/PublicAt.lean
defpublicOf (OnBytes/Model/VerifyPublic.lean) with the second hash function as the argument o.:125
defplannedAt (OnBytes/Tie/ChainsAtCfg.lean) with the second hash function as the argument o.:180
Desc/OnPlan/OkShare.lean
defA block's share, by its name in the shared chain's table of places.:81
Desc/ProofFile/Frames1.lean
defThe first chain.:163
defThe record FileDescription Inst.:202
Desc/ProofFile/Ground.lean
structurebuilt, first and W are computed from the public files alone.:21
Desc/ProofFile/Honest/AtGoalInput.lean
defThe frame's reader of it: that one table's, at every item of the statement.:82
Desc/ProofFile/Honest/AtPureFullIn.lean
defThe full-size trace and the index's matrix of digits, as a value of WiderIn.:74
Desc/ProofFile/Honest/AtPureSixKinds.lean
structureWhat the filling takes as an argument.:70
Desc/ProofFile/Honest/AtPureWiderAt.lean
structureWhat depends on the type of the index.:72
structureThe lists of K1 and of the four kinds that run long sumchecks, each from a reader of the index.:105
Desc/ProofFile/Honest/BookWhole.lean
defWhich masked sumchecks are merges: read off the kinds and the counts.:70
defA value that must be there.:97
defThe whole book: bookRaw, then the book's own tests.:154
Desc/ProofFile/Honest/Committer.lean
defThe library's external string.:109
Desc/ProofFile/Honest/ForKinds.lean
structureThe witness as all kinds read it: the cell of a committed matrix, by four arguments.:109
structureThe index as all kinds read it: the entry of the matrix of all committed weights' digits (docs/format/11-5-weights-in-the-table.md), by row and column.:114
structureOne stored table's pads and encoding randomness, as all kinds read them.:118
defn rounds in which the prover sends nothing.:176
Desc/ProofFile/Honest/Frame.lean
defThe item as a view shows it: an element as the words below the prime that represent it (OnBytes/Slice/Field.lean: ofF, ofE).:229
structureWhat the prover sends in one round.:249
structureA number of coins, for each of the two fields.:265
structureA part's address: a place, and the part's number, from 0, in the list of parts at that place (Placed.parts).:342
defCoins for each row of a table of addresses and counts.:348
structureAn entry of the book: coins that are sent ahead, or borrowed coins.:370
structureThe coins of one run, typed by the book: those of the shared chain's parts apart from the others.:410
defThe book's table for chain number ch, from 0.:433
defThe coins that chain number ch, from 0, may be given, by address: the first chain those of its own parts; the shared chain those of its own parts; the second chain those of all three.:444
structureWhat has been shown before a round, as far as a part is given it: the rounds as a view shows them, and where they are handed the opened columns.:549
structureThe prover's state.:593
abbrevThe coins that a part is given: its own; the blocks that it spends; the blocks that it carries.:634
structureA stated share: num of den.:648
defA part placed in a wider input and state, as Block.lift (Johnson/Desc/Block.lean) places a sub-protocol in a wider state: one definition, with type parameters of its own, can be used at many places.:702
abbrevA kind's honest side: from a place's public data to the prover's side there, as Kind (Johnson/Desc/Block.lean) is for the sub-protocol.:759
inductiveHow a chain's prover's sides are given their input.:830
defThe stored tables' columns as a view shows them: each element as the word below the prime that represents it (ofF, OnBytes/Slice/Field.lean).:889
structureAn error: its class, and words for the tests.:911
defAn error in words alone, as one of the class unfit.:916
defThe two stops, the first one first: an error of its class, or none.:937
defThe places of prover's sides at which the chain has no sub-protocol.:946
defA chain's rounds, sub-protocol by sub-protocol of the description's own flat list.:1023
structureA round as it was played.:1050
structureThe state of a chain's run between two rounds.:1064
defWhat a part is handed of it as Seen.:1080
structureWhat a round sends, before its challenge is heard.:1089
structureA column that is read: its key and position as groupsOf (Johnson/Desc/Block.lean) has them.:1154
defThe table behind a source, with its sender's place, in the first and in the shared chain: the chain's own tree of that number, from the played rounds.:1219
defThe same in the second chain: its own tree, or one taken over from the first chain (0) or the shared chain (1).:1225
defThe first chain's last round, as played, sends nothing and has the empty challenge.:1274
structureAll that run prepares before it plays: the two inputs, and the three chains' rounds, each with its move and its coins supplied.:1295
defThe tests of a run that read neither a challenge nor the instance.:1307
defThe shared chain's rounds, each with its move and its coins supplied, from its input and its own parts' coins.:1327
defThe state of the shared chain's run at its start, at its input.:1357
structureA lot's honest side: the prover's sides at the places of the lot of that name (Lot, LotCore.lean), from the public part and the segments' data.:1517
defThe first chain's prover's sides, lot by lot.:1523
defThe key at onlineDescription: the table's key in the instance's public part.:1538
Desc/ProofFile/Honest/K1/Law/WSideAtFill.lean
defwiderFillOwnCPUOW with W's lot behind its lots.:96
Desc/ProofFile/Honest/K1/LotNoPure.lean
defTHE SIDE AT THESE NUMBERS.:51
Desc/ProofFile/Honest/K1/Part.lean
structureWhat a caller says of its sending.:62
defThe part.:99
Desc/ProofFile/Honest/K11/ClaimsN.lean
defThe claims, with the three found off the public part and the ground.:75
Desc/ProofFile/Honest/K11/Part.lean
defThe lot's honest side: the half at the numbers at which the lot lays the kind's block (K11.parOf, Johnson/Desc/ProofFile/Lot/K11.lean).:133
Desc/ProofFile/Honest/K12/JobOne.lean
defThe job.:223
Desc/ProofFile/Honest/K12/JobShared.lean
defThe committed table's rows before encoding, as the sendings' halves read them: rowsOf at the two readers.:179
Desc/ProofFile/Honest/K12/Parts.lean
defThe first part: "BAT" and the first fold.:205
defThe second part: all the rest: for each stage but the last its switch, with the fold of every stage but the first before it; then the base case.:232
Desc/ProofFile/Honest/K12/Test.lean
structureWhat a caller supplies for its test.:102
Desc/ProofFile/Honest/K13/Part.lean
defThe place: behind the segments of the first chain.:105
abbrevHow the pile's rows are made: of the public instance and the challenges in front, and of nothing else: a parameter of the half.:118
defThe row, at the first chain's input.:127
defThe lot's honest side, under the lot's own name, at a proof file: the pile's filler is handed the public part and the segments' public data too.:139
Desc/ProofFile/Honest/K13/PileOfAnySize.lean
defA CLOSED TERM.:200
Desc/ProofFile/Honest/K14/Parts.lean
structureThe small input: row r of the committed table before encoding, at the place k, laid out as the folded row is: the message (pads among it) below ell, the random tail from tailFirst on.:75
defThe rows at the places that hold the matrix.:81
defThe rows, whole.:87
structureThe public data.:95
defThe kind's place at a piece of the shared chain.:106
defThe part at "SPLIT": one round, one element in the clear: scalarsPart (Honest/ForKinds.lean) at one scalar.:128
Desc/ProofFile/Honest/K14/Sendings.lean
defA sending with the round that holds its answers: one part of two rounds.:270
structureThe public data of the two sendings: the shared chain's own parameters, and the number, from 0, among the chain's rounds, of "LIN point".:286
def"send o_u".:291
def"send o_omega".:301
defA sending's place at a piece of the shared chain.:308
Desc/ProofFile/Honest/K14/Thread2Full.lean
defThe kind's public data at a plan: the plan's shape; the point is the chain's round number 0, zeta its round number 6.:109
Desc/ProofFile/Honest/K3/LotInst.lean
defThe lot's honest side at the proof file's own instance.:51
Desc/ProofFile/Honest/K3/Row.lean
structureHow the run's points are read: two letters of the row.:107
Desc/ProofFile/Honest/K3/RowOwned.lean
abbrevWhose message's coins a stage's two stretches are: the first stretch's owner, the second's.:53
defA lookup's row of parts, at a letter for the owners.:76
defThe key file's letter: the two end values of each part's last key level are the index-mask message's; every other stretch is the lookups' own message's.:171
Desc/ProofFile/Honest/K3/Stages.lean
structureThe summands of all stages: a letter of the row.:193
structureA lookup's public data at its place.:207
Desc/ProofFile/Honest/K5/Law/KeyOfK3.lean
defTHE READER OF THE KEY POINTS AT THE TEXT OF THE LOOKUP's HONEST SIDE.:53
Desc/ProofFile/Honest/K6/Part.lean
defThe lot's honest side: one half for each block that the lot seats, at that block's own place: one, or none where the lot seats none.:246
Desc/ProofFile/Honest/K6/Wit.lean
defThe small input, made of the prover's input through the two shared readers.:263
defTHE NAMED PUBLIC PREMISE: all of them say yes.:377
Desc/ProofFile/Honest/Record.lean
defThe first and the second chain's challenges, from the local verifier messages of the whole shape.:111
defThe shared chain's challenges, from the shared verifier messages.:118
defThe shared chain stops: from its own challenges alone.:129
defA first stop fires in the first or the second chain: from these chains' challenges alone.:134
defIn the first chain, or in the second, the first stop that fires is a second stop, at the input.:140
defThe protocol of the file's reduction, with its annotation.:155
Desc/ProofFile/Honest/RowData.lean
structureThe readers: all that the data of a message's main rows is computed from, beside the challenges: the witness, the index, and the stored tables' pads and encoding randomness, for each committed table, by the statement's item: a folded row holds the fold of a stored table's rows' messages, pads and random tails.:88
abbrevA filling may be a function of the public instance, which each caller applies to its own input's instance (Local.x, Honest/Frame.lean): so a message whose data depends on words of the request has a place, and no reader is given a fixed value for them.:112
Desc/ProofFile/Honest/Rule.lean
structureThe lists of one description's three chains, typed at that description's own states, claims and instance; and each chain's falls (Fall, Honest/Side.lean): most descriptions' chains have none.:116
Desc/ProofFile/Honest/SharedChainProverSides.lean
abbrevThe index committer's coins: for each item of the statement.:39
Desc/ProofFile/Honest/Strat.lean
defA round's typed message.:110
defA typed challenge as a Fmt.Drawn (what the format says was drawn), as the library's drawnSL reads it.:116
defThe slot's strategy over a shared chain: it sends nothing and hears the challenges.:148
defThe shared part's strategy over a local chain: it sends nothing and hears nothing.:165
defThe shared part's strategy over the last chain: it sends nothing and hears nothing.:181
Desc/ProofFile/Honest/StratC.lean
defNothing more is played, and the verifier is asked no more.:65
defA round added to the walk without anything being asked: for where even a halted walk's ChainProgress.heard returns an error (a column of a table that is not available).:71
defWhat a round sends: ChainProgress.say; the round's fixed substitute if that returns an error; none if there is no Step.:77
defThe slot's strategy over the last chain.:132
Desc/ProofFile/Honest/ThruK13.lean
defA filling read through.:43
Desc/ProofFile/Honest/Walk.lean
defThe substitute in the form in which a round's message is produced (Told), marked as made by no prover's side.:115
defThe second chain's start: rejected (none) if either earlier chain has been rejected, or if the description's start of the second chain rejects.:126
structureWhat a chain's reads are computed from: its number, from 0; the number in the label of its first own tree; the stored tables' columns; the table behind a source, among the chain's rounds produced so far.:134
defA chain's start.:181
defAfter a round's challenge: Step.hear.:197
Desc/ProofFile/LinkAt.lean
defThe first chain, from the public part and a seat.:31
defA fixed value in the place of the second hash function, where it is not read.:35
Desc/ProofFile/Lot/K11.lean
def:67
Desc/ProofFile/Lot/K12.lean
defThe lot: the proximity test's own block at «F:2».:31
Desc/ProofFile/Lot/K13.lean
defThe lot.:57
Desc/ProofFile/Lot/K13At4.lean
defThe second lot.:46
Desc/ProofFile/Lot/K13End.lean
defThe third lot.:48
Desc/ProofFile/Lot/K3.lean
def:72
Desc/ProofFile/Lot/K4.lean
defK4's lot, from the public part.:108
Desc/ProofFile/Lot/K5.lean
defK5's lot: the four runs stated: "first", "keys", "join", "second".:70
Desc/ProofFile/Lot/K8.lean
def:70
Desc/ProofFile/Lot/K9.lean
defKind K9's lot.:84
Desc/ProofFile/LotCore.lean
abbrevThe type of a claim.:44
structureA named table of blocks from one module.:83
structureThe whole shared chain.:137
structureThe whole second chain.:154
Desc/ProofFile/Lots/Later.lean
defThe shared chain's record.:19
defThe last chain's record.:22
Desc/ProofFile/Lots/PureLots.lean
defThe blocks that start and end each segment.:33
defK1's places.:36
defK2's places.:48
defK6 at "H:4" and K7 at "H:1".:51
Desc/ProofFile/OnlineDescription.lean
defThe blocks that the description is assembled from.:22
Desc/ProofFile/OnlineDescriptionFromBlockTables.lean
structureWhat a description is assembled from.:60
structureWhat the first chain is put together from.:76
defThe blocks at the places, in order; the first reason where one is missing.:89
defIt refuses if the places, the shape or the segments' records cannot be computed, in that order.:110
defWhat the first chain is put together from.:121
defWhat is wrong with the lots' blocks, in words; empty if nothing is.:188
defWhat is missing, in words; empty if nothing is.:256
Desc/ProofFile/OnlineDescriptionPublicPart.lean
defThe public part, from the three public files.:29
defThe way of computing the public part that onlineDescription uses.:34
Desc/ProofFile/Pub.lean
structureThe public part: all that the description takes from the three public files.:59
structureThe instance.:143
defThe segments' records for a request of zeros that covers its first position alone.:169
defThe first chain's first state: the public part's state before the first segment, with the request's words written into it.:178
abbrevThe type of a function that can stand for the second hash function (secondHashFunction, OnBytes/Hash/SecondHashFunction.lean): from a number and bytes to bytes.:188
structureWhich functions a description uses to compute the public part and the segments' records.:220
Desc/ProofFile/Told.lean
abbrevA tree with its tenants.:39
Desc/SeatGuard.lean
defThe like for a chain.:82
Desc/Third/Border.lean
defWhat the third chain takes of the shared chain's end, out of the program's record of it.:41
Desc/Third/Chain.lean
defThe third chain's last block.:39
defThe own test's block at its place in this chain.:43
Desc/Third/K14BatchLinearConstraintsSecondPart.lean
structureThe public parameters of K14's second part and of the chain's start.:62
defOmega is taken over from the shared chain's end o and joins the group own.:97
Desc/Third/State.lean
defThe shape does not split the row (Dot).:71
defIn front of the taking-over: this chain has received no root, and the one tree that is about to be taken over is the one that the number of the chain's first own tree counts.:78
structureThe third chain's carried state.:161
defThe same with a reason in words, out of the four things of the first chain's last state.:193
defThe last test: the test of every group has begun, and every sampled message is in a group: over the whole statement, the first chain's groups and messages too.:207
Desc/Third/TakenSources.lean
defThe sources of the trees that are taken over.:67
EntryRec/AtConf.lean
defThe configuration's fields but for the word length and the alphabet.:35
EntryRec/AtMaker.lean
structureThe entry file's part of three files, with its wire record: the number K of blocks but one of the three files' one wiring, at least a given number; the entry file's wire record at K + 1 blocks.:51
EntryRec/OkcFiles.lean
defA file's data with the stored table's depth laid as a.:54
Face/AtStoredFiles.lean
defWhat the stored files read as.:37
Face/ByteSettings.lean
defA value of 32 bytes for the link's run, which has no later chain: the link's entry has no test on it (Johnson/PV/EntryInOf.lean, laidOf).:134
defThe public rounds at which the chains change.:139
Face/Compiler.lean
abbrevThe library's family of layouts in one value of the public reading.:152
defThe three provers as the library's type of them.:182
defThe integer model at given settings.:393
Face/FinalStatement.lean
defThe writer of the three files, at the letters of one set of public files; where a proof string is missing, an empty form.:116
Face/NeverBuilt.lean
defToken 1.:28
Flat/Claims.lean
abbrevA matrix of the committed matrix's shape, over the extension field.:64
Flat/CodingCells.lean
defThe honest side at the claims on a matrix of cells: codingHonest at cellWords.:169
Flat/Dec/CountAtFrame.lean
defThe count at the full size, as a function of the three files' data and the two depths.:72
Flat/Dec/EntrySound.lean
defThe four tests on the numbers of the entry file's rounds' data, as one test: no round needs more than K blocks or has more than 64 bits of work; the number of a tree that a round opens is below 2 ^ 16; no tree is deeper than 63.:90
Flat/Dec/TwoLettersAt.lean
structureThe letters that the claim, the hypotheses and the bound name, and the verifier's text does not.:72
Flat/Dec/TwoSizesAt.lean
structureThe fields of an input, and of what the hypotheses name beside it, that are letters at this size.:52
Flat/InnerInputOfThreeProtocols.lean
structureThe fields of an input beside the object and the marks.:43
Flat/LedgerClaim.lean
defThe index that the matrix holds, if it holds one.:127
abbrevThe requests that the reader takes.:179
Flat/PolicyAtFrame.lean
defThe table of scales and policy that the reader returns at two files; the reference's where it refuses.:150
Flat/SettingsRead.lean
defThe settings off the two files' bytes, refused where a further model line of the parameter file (otherLinesOf) is not the reference's.:282
Flat/ThreeAtFiles.lean
defThe data of the two big files' protocols, made of a planner's answer.:88
Flat/ThreeFull.lean
defThe committed matrix's numbers at the reference shape: 3,076,096 rows; k_lo = 7.:114
defThe casts of the entries of an index, as a matrix of the reference shape.:141
FrontRoad/AtBuiltNamed.lean
defThe library's family layoutsByPublicReadingAtDescriptionOfFields at the parameters of descriptionOfDataOnBytes L.:40
FrontRoad/CoinsEnough.lean
defThe product of the sizes of all lists from which the committer samples.:185
FrontRoad/Front.lean
abbrevThe key of toldAt: the told part, then the whole key.:53
defThe instance that R.buildInstance makes from a prompt with output tokens and no further tokens; the default x₀ where R.buildInstance returns none.:82
G/RoundsOfPlan.lean
structureWhat the planner and sendsOf make of the three public files.:384
defOne file's declared rounds as written rounds.:422
G/Sends.lean
defThe sendings of the seven chains, from policy.txt, layout.txt and KL.bin.:118
Goal/Conditions/BindsAtThe.lean
defThe pair at which the told record's input is taken: zeros; no further digests.:99
defThe matrix of given weights.:128
Goal/Conditions/HomeAtWider.lean
structureAll that is not chosen here.:142
Goal/Conditions/HonestAtDescriptionDataAtFiles.lean
abbrevThe one test on first blocks at S's letters.:51
Goal/Conditions/HonestNumber.lean
defThe three files' caps: capAt: 2^(work + 6) - 1 at every round (63 where work is 0).:93
def:94
def:95
Goal/Conditions/WideDigits.lean
defAll pads with tails, by digits.:88
Goal/Conditions/WideOnto.lean
abbrevThe compiler's input at which the told record is taken.:66
Goal/Description/Extractor.lean
def:35
def:46
Goal/Description/Form0.lean
def:34
Goal/Description/Gates.lean
def:38
def:41
def:44
Goal/Description/Item.lean
def:24
def:27
Goal/Description/KeyFold.lean
def:76
Goal/Description/Live.lean
defThe bound on the compiled verifier's typed queries.:52
def:137
def:146
Goal/Description/Named.lean
def:38
def:45
def:50
Goal/Description/Plan.lean
defThe constant in the digest's place: 32 bytes of 1 (Johnson/Desc/TheCfg.lean).:36
def:56
Goal/Description/ProofFold.lean
def:75
Goal/Tie/DescriptionOfData.lean
defThe bytes of the request tree's salt, off the plan's values.:106
Goal/Tie/DescriptionOnBytes.lean
defWhat a run does in front of the term, as one function: it hashes nothing.:133
defTHE VALUE: D* AT THE PARSED FILES' BYTES.:145
Goal/Tie/DescriptionOnDecodedProof.lean
structureWhat a run hands the term.:137
defOne number that is no token of the vocabulary: the further tokens of the form that is laid where a decoder refuses.:148
HonestTrace/Places.lean
structureThe numbers that a shape or a place reads.:103
defThe numbers of the full-size example (examples/full-size/config/policy.txt), typed by hand.:591
LinkSim/AtHome/SpecHome.lean
abbrevThe link's private input at homeR b Z: the index, and for each of the two tables its randomness and its seed.:132
defThe two encodings of the index, one with each table's randomness.:137
defThe honest prover's data: the instance, the two encodings, and the polynomials of their rows (402653181: Spec.lean's terms).:142
LinkSim/AtText/SpecExact.lean
defThe honest prover: linkRec at the prover's algorithm's next-message function.:117
P5J/AtTerm.lean
abbrevThe seated description's own term.:54
P5J/MeansQ.lean
abbrevThe first chain's state.:103
PV/RunArgsFull.lean
defThree of the seven, from place i on.:54
defThe entry's chain's parameters' digest.:58
PVR/Program.lean
structureAll that one call hands over, as bytes.:56
structureWhat the user claims: the first three fields.:71
defThe claim, off the user's three files; none where one of them does not read.:102
defThe three public files.:110
defThe proof as VerifierAndGoals.verify takes it at VerifierAndGoals.atSecondHashFunction VerifierAndGoals.theDescription.:113
defThe executable form's run, at the format's hash.:117
defThe executable form's verdict, read off a run.:121
PVR/RideThe.lean
abbrevThe whole term that runs, as one constant: rideOf at letsThe.:54
defThe verdict at theDescription: that of verdictFrom, and reject where the public files are in scope and protocolDataWellFormed rejects them (theDescription_dead).:102
Prover/Link/LinkCoin.lean
defThe type.:333
defThe map.:340
Top/ArmsAtFiles.lean
defA fixed record, for files at which the planner refuses.:233
Top/EnumDigits.lean
defAll salts of s bits at each of the first 2^d places, by the digits of the number.:180
Top/Fire/Code/TieAtValues.lean
abbrevThe three files at the letters of the value that runs, THE THREE DECISIONS LETTERS.:84
defTHE T.:133
Top/Fire/Code/Vals/DvFull.lean
abbrevThe instance's type at the full size.:75
Top/Fire/Code/Vals/EntryFive.lean
abbrevthe rounds' data:93
abbrevthe two openings of stored tables, as the library's term has them:97
Top/Fire/Code/Vals/FastFull.lean
defThe shape of the proof file's binding tree, off the plan.:151
defThe salt's length in bytes, off the plan.:154
defThe number of blocks but one: PV.Front.KFull (a function of the data alone), and at least 139.:159
abbrev:388
defThe instance as the description's plain record wants it: the request file's bytes, the table's key out of the entry's record, the reply file's bytes.:429
Top/FrontEnc.lean
def:46
Top/H/TargetAtPolicy.lean
defThe record of claims at the requests that the program's reader takes, at a table of scales and policy.:67
Top/H0/L3/Frame.lean
structureWhat the frame's steps carry.:133
defA COMMITMENT: two rounds.:145
Top/H0/Tw/K2/SendL8.lean
def:25
Top/H0/Tw/K2C/Kind.lean
structureThe numbers of a place.:73
defTrue if the list increases strictly.:118
defDECIDES.:139
Top/InnerCompiledVerifierByPublicReading.lean
structureWhat of an input hangs on the public digests, as functions of them (Sd, cA, m); the type D of what the public reading gives; the public reading; the public strings Pt; the told part; the told code; and an honest side over the one hash function (ISK, commit, prove, π₀), of which nothing is asked.:189
defThe input at a fixed d: an InnerCompilerInput, of which innerCompiledVerifier_sound speaks.:214
TypedOracleCompiler/RecCompile/Carrier.lean
defThe carrier of the typed oracles: the object's word length, alphabet and three shapes, the session's annotation, the number of slots, what of an instance comes early and late; and three letters: the type of the body of a leaf, an annotation of Test's rounds and one of Link's.:48
defTest with an annotation of its rounds as local or shared: the key's protocol.:74
defLink with an annotation.:78
TypedOracleCompiler/RecCompile/Cms.lean
structureThe key.:94
structureA proof.:101
def:112
def:114
def:116
TypedOracleCompiler/RecCompile/CmsAns.lean
defthe list that the key's chain is handed: the root, then the record's answers:53
defthe list that a session's chain is handed: the root (twice), then the record's answers:56
defthe session's request: the instance, with a fixed record in the record's place:59
TypedOracleCompiler/RecCompile/FrontRoot.lean
defCms.lean's key, put together from the key and the proof.:59
defCms.lean's proof: the one link, the session's proof.:63
TypedOracleCompiler/RecCompile/LinkAns.lean
defthe list that a link's chain is handed: the two roots, then the answers of the two records:85
TypedOracleCompiler/RecCompile/Seeds.lean
structureThe wire of the record: the tag of the seeds' queries; what a table's name holds behind the root; the fixed plain parts of the two queries; how K digests give a seed; how a record is written as a list of digests; where a session's proof string holds the number of the stored copy.:69
defThe first query of a seed: the table's name, with the root first.:103
defThe second query of a seed: the chain value of the first answer.:107
WholeKey/CoinLaws.lean
defSalts of that form, the free bits running through E; no bits beyond the first m places.:66
defCoins of that form, the free bits running through E; outside the window a leaf's salt is the fixed string fill.:116
WholeKey/Defs.lean
structureThe honest side's letters.:183
structureThe prover's key: the index and the copies, in the order of the key's list.:296
defThe key that the compiled verifier verifyAtKeyRoot takes, out of the whole key: (root, OOD sample).:457
defThe typed proof that verifyAtKeyRoot takes, out of the whole key and a proof: the proof's number of the copy, the key's proof on the first table, the key's entry at the proof's place, the session's proof.:462
WholeKey/Premises.lean
structureThe scheme's honest side's letters, with the strategies given by the three protocols' honest sides.:86
defThe scheme's honest side made of them: the strategies are theirs, and a run's messages are withheld exactly on their abort sets (Plays.ofRecs, Johnson/WholeKey/OfRecs.lean).:129
structureThe letters of the laws on coins.:286
structureThe numbers of the statement.:337
The typed proof, the parser, the compiler's input, and further definitions on a description of the protocol · 3 definitions in 1 file
Ladder.lean
abbrevA typed proof: what innerCompiledVerifier takes from the prover's side at the protocols F: further tokens, a key and a proof.:339
abbrevThe compiler's input at the public files and at what the two public readings returned.:391
abbrevA parser: from the prompt, the output and a form, an algorithm with access to the hash function that returns a typed proof.:397
The stored public files, the parameter file's lines, and a statement on completeness for any description · 6 definitions in 1 file
Stored.lean
defThe parameter file's first 32 lines: most of the security settings.:32
defOf the 152 lines after the first 32: the 12 before the four lines eps1_lo, eps1_hi, eps2_lo, eps2_hi.:68
defThe 56 lines from there to the four lines MF, KF, epsF_lo, epsF_hi: further lines on the model and further settings of the proof (tau among them, a security setting).:84
defThe 14 lines from there to the acceptance policy's three lines.:143
defThe 59 lines after the acceptance policy's three lines.:161
defThe stored full-size example's three public files.:259
Lean functions on bytes that the cards use · 134 definitions in 53 files
Base.lean
structureAn element of the cubic extension field F[X] / (X^3 - 2): its three coordinates.:54
Desc/First/K4/Plain.lean
defCLAIMS, groups 1 to 12.:85
defCLAIMS, groups 2 to 12: for a link in which the lookup states its own claims as a run.:88
defCLAIMS, groups 14 and 15.:92
Desc/First/K4/Rounds.lean
defThe plans for which K4 is written: five limbs; routed experts; ll > 1; lNI ≠ 0; the second token sumcheck is not empty.:53
Desc/First/K4/Steps.lean
structureWhere in a state lie the things that K4's steps read and write.:66
Flat/EntryTerm.lean
abbrevA record at this size, in plain letters.:89
Flat/FilesAt.lean
defThe key file's test on the silent rounds' plain parts: the makers' own, at the copy's number 0.:155
defThe proof file's: both copies of the answers are ansL of the record; the copy's number is not tested.:161
defThe plain parts that stand where a silent round has sent nothing.:173
def:174
Flat/LinkSib.lean
defThe instance made of two records.:119
Flat/LinkSibAt.lean
abbrevThe rounds' data, written.:76
Flat/Object.lean
defThe proof file's protocol with its annotation.:41
structureHonest provers of the three protocols.:44
Flat/Silent.lean
defIn every round the fixed message; at the end b.:39
defThe shared part of the fixed messages.:44
defA slot's part of the fixed messages.:49
Flat/WireBlocks.lean
defThe number of blocks for the three files' one wire: the greatest of the three.:51
Hash/SecondHashFunction.lean
defLevels of the tree hash until one digest is left: the first level under num, the later ones under 11.:66
Iop/Foldeq.lean
structureWhat a verifier knows of a table besides its shape.:121
Iop/Ground.lean
abbrevA block: it changes what the verifier holds and returns a value, or fails under a name.:656
Iop/Lin.lean
defThe conditions on the shape with the codes that it names.:92
defRow (Dot): the row weights on Omega against W at the shared point psi.:156
defHow W is laid out in its oracle message.:184
defHow Omega is laid out in its oracle message.:187
defA row on the matrix (TensorRow, OnBytes/Iop/Batt.lean) as a claim of the test on the table.:366
Iop/Req.lean
defOracle messages of a link as they are announced.:296
K/Arm/SameSib.lean
defIts wire record: the five fields of wqX at the same letters.:52
Key/Ranges.lean
defThe matrix's size, from the shape of the test on the committed table.:55
Maker/ConfLetters.lean
structureA configuration's fields but for the word length and the alphabet.:26
defThe configuration: words of length 2 ^ a over SgX.:58
Maker/Files.lean
defThe plain data of three lists of rounds; of three empty lists where there are none.:96
defThe tests on three lists of rounds.:105
Maker/SilentParts.lean
structureWhat the front sends: the record's answers, and the number of the stored copy.:37
Maker/Trees.lean
structureA round's data, with a list of trees and the stored tables.:44
abbrev:62
abbrevThe shape of the rounds after the round in front.:70
abbrev:74
abbrev:77
abbrev:79
abbrev:82
Maker/Whole.lean
structureThe data of the three chains of a file.:68
defThe depth of the tree with the number j over the whole file.:94
defWhat the drawn positions of a chain ask for.:103
defEvery stored table's part of a round's draws has as many draws as it says.:115
defThe rounds of the file.:132
defA want as a position of the stored table.:149
defA want as a position of the prover's oracles.:154
defThe wants of the three chains, from the verifier's messages.:162
def:165
def:168
defEvery symbol read of the stored table carries the position at which it was read.:181
defA chain's view.:187
Maker/WholeOf.lean
defThe data of a whole file.:44
defEvery round of the three chains has at most 64 bits of work.:58
defNo tree that the three chains send is deeper than 63.:62
Model/Hide.lean
structureAn affine form in hidden values: those under slots, and entries of virtual rows.:116
Model/VerifyChains.lean
structureThe seven chains: what the planner has made, and the parameter bytes as read back.:63
Model/VerifyPublic.lean
structureAll that follows from the configuration files: the parameter file as read, and the layout and the plan of every sub-proof.:95
Params/Chains.lean
structureWhat the parameter bytes of a key's one-time chain hold.:72
structureWhat the parameter bytes of a proof's first chain hold.:178
structureThe three chains of a key.:245
structureThe three chains of a proof.:264
Params/EntryStagesRecord.lean
defA value typed for what the first 32 lines of the full-size parameter file of the setting "record with work" say.:64
defThe plan typed for an entry's chain.:171
Params/File.lean
defReads the parameter file.:328
Params/Items.lean
structureThe item "binding tree": the shape of the tree over the seals of a batch's requests (blocks/iop/lin.h).:180
Params/Setting.lean
structureWhat the derivation takes as given.:76
Proof/Tail.lean
structureWhat the block of a first chain returns.:78
Prover/FirstBlock.lean
defThe test of Rom/OverOneF.lean.:58
Slice/DecoderRec.lean
structureWhat a decoder of a stored table with a record is made of.:86
defThe format of a stored table with a record: as Sz.ix, with the sample map Z in the place of Sample.nil.:97
defThe decoder (the library's LdIx.dec, a constrained minimum): of ALL tables of full messages whose message parts have the record's answers at the record's seed, the one whose code words are nearest to the table, ties broken by a fixed order (ix.rank); its message parts, if it is within eM columns; else nothing.:117
defThe record does not single one out: at the seed ρ two members of the table's list WITH DIFFERENT MESSAGE PARTS (pads counted in; two that part in the random tails alone count as one) have the same answers (the library's LdIx.Coll).:125
defTwo decoded tables agree before the pads: in every row, at every entry before the cut.:138
Slice/Draws.lean
abbrevThe field with p = 2^64 - 2^32 + 1 elements and its cubic extension (X^3 = 2), as the library's theory has them.:43
abbrevSee GF.:45
Slice/FullRecLink.lean
defThe sizes at the typed parameters' radii (the planner's distances times the lengths, rounded down): 2,852,142,980 for the tables' decoder and both folds, 8,342,420 for a folded row's oracle message.:78
abbrevThe sample map recZ of one row, written after the programs': 402,653,184 entries, 29 coordinates, one answer.:82
Slice/FullRecSz.lean
defThe description of the chain by Params.entrySpecOf, at an empty statement.:183
Slice/KeyOfRec.lean
defThe program's key of a table with this record: the item 0; entry r * s + i of the array is the answer of the row with the number r under seed i; the seeds in their order.:62
Slice/RecordRead.lean
abbrevThe factors of a seed: the elements other than 0.:72
Three/Data.lean
defFrom three lists of rounds.:190
Tie/Pv/Plan/PlanKits.lean
defA text file from its lines, each ended by a line feed.:29
TypedOracleCompiler/Compile/Batch/Oracles.lean
inductive:101
def:112
defHere: the annotation of a protocol, by its tag: Test's and Link's are the interface's annT, annL.:119
defthe plain part of one component of the prover message of some round: α_0 (left) or α_j (right):132
structurethe input of a leaf of a tree over oracles: a body (here: of the type that the interface names; in the library: a symbol of an encoded index, or of a prover oracle with protocol and position, or padding); and a salt:139
defWhat of the instance x the query of round i holds beside what is in (F1): x itself in the round L.late, nothing elsewhere.:163
structure:175
structure(G): ρ ‖ rt ‖ α, with the slot's message of the joining round:183
def:189
def:199
TypedOracleCompiler/Compile/Batch/Rooted.lean
abbrevan answer of a Fiat-Shamir oracle: K hash blocks, from which the verifier message is made, and the chaining value:162
defthe chaining value of an answer, as a bit string:165
TypedOracleCompiler/Compile/Batch/Verifier.lean
abbrev:143
abbrev:144
inductivehow far the chain of a slot has come:182
defthe slot value, once the chain has passed the joining round:189
defKind and phase fix the format.:205
deffor each round: what the chain yields for the shared component, and for the slot's component:222
def:228
defThe roots of a component with n trees, from the list of roots: the first n of the list.:233
structureThe checks in some trees of one depth ("a forest"; mostly one tree): each check with the number of its tree; treeRoot t is the root of tree number t.:402
defall checks of a list of forests:416
def:418
defforest after forest; each takes from s as many digests as it needs:438
defthe checks of checksB, tree by tree: for each round the trees over the shared component, then the trees over the slot's; each whole or cut, as the flags pr0 and prJ of the wire say:457
defthe trees over the external oracles: one forest, whole or split, as the flag pr of the wire record says:489
def:508
defa transcript from the argument string: opened symbols where there are any and the tree of their position has a root, the fixed symbol 0 elsewhere:514
defthe check in the request tree, if the chain has joined:570
defhow many roots the chain has taken from the list:618
defthe same for both components of all rounds:642
TypedOracleCompiler/Iop/BatchWire.lean
structureHere: the interface of the library, and beside it the type of the body of a leaf of a tree over oracles (what a leaf holds beside its salt) and the annotations of Test and of Link.:77
def:157
structure:161
structure:171
TypedOracleCompiler/Run/PageRunFast.lean
defA function from bytes to bytes as one hash function on bit strings.:46
TypedOracleCompiler/Run/PlanQS.lean
abbrev:54
def:61
def:65
def:69
def:79
TypedOracleCompiler/Run/PlanQTypes.lean
structure:53
def:192
TypedOracleCompiler/Run/PlanQX.lean
defof these the stored ones: (which, position):184
defThe view:199
TypedOracleCompiler/Slice/EntryData.lean
defHow a table's answers in an instance are read as the decoder's answers: entry r * s + i is the answer of row r under seed i, read in the extension field; 0 beyond the end.:78
TypedOracleCompiler/Slice/KeysOfX.lean
defThe two keys that are written of an instance: of the first table's seeds and answers, with the item 0; of the copy's, with the item 1.:35
TypedOracleCompiler/StringsList.lean
defA symbol at a position, as a body: its leaf's own string; the empty string where its own tree's code writes nothing (a tree deeper than 63).:170
defA body read at a position: by the code of that position's own tree.:174
The random-oracle model: oracle algorithms, sampling, query costs · 7 definitions in 4 files
Defer.lean
abbrev:52
OComp.lean
inductiveAn oracle algorithm on a fixed input: a tree.:31
def:38
defone query, as an algorithm:48
OSpec.lean
structureA family of oracles: names, and for each name a domain and a finite, non-empty range.:23
defThe model of ZKCP/Defs.lean: one oracle {0,1}* → {0,1}^lam.:39
OverOneF.lean
abbrevThe test on an answer's first hash block: yes: the other blocks are asked too.:62
BLAKE2b; typed queries as the format's hashes; protocols from the format's plans · 16 definitions in 8 files
Blake2b/Hash.lean
defThe block of 128 bytes of a that begins at byte off, as sixteen words.:98
defThe state after blake2b_init_param on the blake2b_param that blake2b_init (for keylen = 0) or blake2b_init_key in blake2b-ref.c of the BLAKE2 reference source code package fills in.:170
CodingBits.lean
def:55
defA digest as 32 bytes.:58
LaxDom.lean
abbrevThe type of a hash function in the identity monad: number, tree, index, start, bytes.:81
PlanPull.lean
defChallenges as hash blocks: the choice of challenge types (PQ.CK) of the pulled form.:108
defThe wiring's function from hash blocks to a challenge: the first b of K blocks.:116
PlanQTypes.lean
structureThe kit of verifier's messages, that is, the choice of challenge types: for each entry and kind a finite, nonempty type, and the map to the format's record of what was drawn; at the entry e0 and the kind nothing there is exactly one verifier message (front).:154
abbrevthe view: Fmt/View.lean's record:261
PlanQX.lean
abbreva symbol: its position, its column:138
structurean external opening:141
def:183
TwinDefs.lean
defThe round of the skeleton r.:67
defThe shape of a list of skeletons of rounds.:72
structureThe skeleton of a batch protocol.:77
TwinKit.lean
defThe annotation "local rounds only".:50
Statements about argument systems, and the random-oracle model · 11 definitions in 8 files
AtEveryRequestGuards.lean
defAt these settings some request is served at some weights.:139
Bridge.lean
defAn algorithm of the library's type, as a RandomizedAlgorithm.:52
Checks.lean
defAn argument system whose verifier rejects everything.:139
Deterministic.lean
defThe deterministic algorithm that makes the queries of algorithm and continues with the number 0 wherever algorithm samples a number.:21
ModelGuardsAtReference.lean
defThe settings of the library's reference table of scales.:78
defMade-up valid weights at which a range condition of the program fails on every window of 1,024 tokens (haltW, Inst/Model/SanityRef.lean; the proof of Cm.empty_language, Cm/RelTrueExp.lean).:144
RandomOracleModel.lean
abbrevA bit string, of any finite length.:30
abbrevA value of the hash function: 256 bits.:33
abbrevA query log: the queries that an algorithm made to the hash function, each with its answer, in order.:86
RequestOfTokens.lean
defToken 0.:38
Statements.lean
abbrevA commitment to the weights of a model: 256 bits.:31
Definitions of doubly zero-knowledge commit-and-prove arguments, and what follows from them · 9 definitions in 4 files
Defs.lean
abbrev{0,1}^*: finite bit strings, the domain of the random oracle.:38
abbrev{0,1}^λ: bit strings of length exactly lam, the range of the random oracle.:41
inductiveAlgorithms that may query f.:64
structureAn argument ARG = (C, P, V) of three oracle algorithms.:166
DigestKey.lean
defThe algorithm that computes the digest of a key: one query, at the key's code.:58
Gen.lean
abbrevOne entry for each slot of the batch b: a list of the same length.:111
structureARG = (C, P, V) over the family S.:118
structure:169
SpecialAny.lean
defThe scheme of Defs.lean that G gives.:83

Short names in the Lean code

The Lean code uses short names for some types, fields and variables, such as I, lam, enc and Pub. The folded section below lists some of them with their meanings.

The names, one by one
  • Ans: the out-of-domain answers.
  • aT: the offline IOP's round marking (which rounds a batch shares).
  • Bd: the type of a leaf's body (what the leaf contains in addition to its salt).
  • Digest: an output of the hash function (256 bits).
  • early: the early part early x of an instance x, which the first query of a Fiat–Shamir chain contains (HolographicProtocol, §3).
  • enc: several meanings, including the encoder in ConfigurationWithOutOfDomainSample (it maps a message and randomness to an encoding) and, as an argument of verifyDigestKey, Arg.digestKey and Rec.tokenArgumentSystem, the code of a key; the commitment is the hash function's answer at this code.
  • Further: the return type of the second public reading.
  • honestOfflineProver, honestLinkProver, honestOnlineBatchProver: §6.4.
  • I: the indices (for FlashProve, the committed data, derived from the weights).
  • Inst: either the namespace and folder of the integer model's definitions, or the instance (request file bytes, table key, reply file bytes).
  • Isk: the prover's key (the index and the tables of its stored copies); it does not contain the first table.
  • lam: the length in bits of a digest; 256 in the six theorems.
  • late: the number of the late round, if there is one; the query of that round contains the whole instance (HolographicProtocol, §3).
  • lowKey: the whole key's root and out-of-domain sample, for the compiled verifier.
  • lowPrf: the whole key and a proof, written as the compiled verifier's typed proof.
  • n: the encoding's length.
  • N: the batch size (the number of batch positions in one run of the online IOP).
  • ofUpload: a ZKCP oracle algorithm rewritten as a RandomizedAlgorithm.
  • Pub: either three public files as bytes (parameter, layout and scale files), or what the description takes from the three public files.
  • Rec: the out-of-domain sample (also a namespace: Rec.tokenArgumentSystem).
  • Seed: the out-of-domain seeds.
  • Wn: the witness type of the relations.
  • X: the instances (an instance is built from a request and further tokens).
  • ZKCP.Arg (ZKCP: zero-knowledge commit-and-prove): an argument consisting of three oracle algorithms: committer C, prover P, verifier V.

10. Sources

  • Third-party material in the Lean files that this page prints: lean/CREDITS.md. The HTML template, style sheet and script of this page: lean/scripts/statements-html/shell/ORIGIN.txt.

11. Limits

  • lean/LIMITS.md: all limits of the statements, numbered. A card gives only those most relevant to it.
  • lean/GAPS.md: the gaps between these statements and the programs.
  • lean/CHECK-RESULTS.md: the axioms that Lean lists for each theorem (at most the three standard axioms).
  • lean/CREDITS.md: whose work the Lean files follow.
  • docs/model.md: the symbols in the comments of the integer model (Appendix C).
  • Counts of declarations. The statement of the theorem sound depends on about 17,000 named declarations of this library. The general parts are small: Sound depends on 28, the model on about 160, blake2bHash on about 130, compile on about 720. Three declarations, whose dependencies overlap, account for nearly all the rest: FlashProve's description (flashProveDescription, about 12,000), the test on the public files (protocolDataWellFormed, about 9,100) and the honest provers and settings (honestProversAndSettings, about 16,000).
  • What is counted. Only names written in this library's source are counted: definitions, theorems and structures, with their fields and constructors, but not names that Lean generates or names from Mathlib. For a definition, the names used in its type and its value are counted; for a theorem, those used in its statement; and so on, transitively. The counts are computed by a program from the compiled library's record of the constants that each declaration uses, and are rounded to two digits. Of the about 17,000 names counted for the theorem sound, about 11,000 have their own declaration line, and about 9,100 of these are declared with def.
How to read the three kinds of statement together
  • Each statement on its own is satisfied by a useless argument system: soundness by a verifier that rejects everything (see the theorem card below), completeness by one that accepts everything, zero knowledge by a prover that outputs nothing.
  • The bounds are part of the statements. ε, α and ζ bound three different experiments and should not be compared with one another.
  • ε, α and ζ take values from 0 to ∞. A bound that is 1 or more makes its statement trivial.
  • A theorem about an argument system states each bound as an explicit function, except for zero knowledge: that theorem states that such a function exists and is at most 2^-154 for at most 2^64 hash queries and at most 688,127 replies. A single value of ε or ζ should be quoted together with the numbers of queries and of proofs at which it is evaluated.
TheoremSoundness by itself is satisfied by a verifier that rejects everythingVerifiableInference/Checks.lean:181
In words
In Lean · VerifiableInference/Checks.lean, lines 181–181
Then

the argument system rejectAll, whose verifier rejects every proof, satisfies Sound with ε = 0

theorem rejectAll_sound : Sound rejectAll (fun _ => 0)
What the statements do not say
  • That a statement says what is meant. Lean checks that each theorem follows from the definitions that it names and, for each, the build reports no axiom beyond Lean's three standard ones; Lean does not check that these are the right definitions. That is read off the statements and the definitions under them. This page prints them for that, as far as it goes: three values are black boxes here (What this page does not show, below). The statements: sound, soundAndBinding, completeOnCanServe, zeroKnowledgeOnCanServe, refusedHandsOutNoProof, repliesFit, with the definition leanVerifier. These seven are this library's own wording of what is to be proved. So are the statements of soundness, completeness and zero knowledge as an IOP, which this page does not print (their files: lean/LIMITS.md, under "That a statement says what is meant").
  • That Lean's kernel, which checks the proofs, is free of bugs: it is trusted, not proved correct, as are the compilers, the operating system and the fetched packages. The pinned version of Lean, 4.29.1, predates the published fixes (from version 4.32.1 on) for soundness bugs in Lean's kernel and runtime and in the arbitrary-precision arithmetic library (GMP) that its Linux builds link against. No proof in this library is known to use such a bug; the proofs have not been searched for one, and the check script's word list and audit would not detect one. These pages do not report any check of the library with a later version of Lean. (lean/LIMITS.md, L45.) Lean's kernel has checked each of the six theorems with a larger thread stack than the default: the library that contains them is compiled with that setting, because with the default stack the kernel fails on some constants used by its theorems (lean/LIMITS.md, L69).
  • Fiat–Shamir. That a concrete hash function behaves as a uniformly random function (§5).
  • Second hash function. Technically, the IOP itself uses a second, fixed hash function, built from BLAKE2b's compression function. By the rules of the file format (docs/format/FORMAT.md, R15.3) it is used to digest public data (the scale file, lines of the parameter file, and the model's lookup tables, which the parameter file names by these digests) and the request. The theorems assume no property of it. The Fiat–Shamir heuristic then also assumes that blake2bHash behaves like a random function that is independent of it (The second hash function). None of these uses is essential to the protocol: the digest of the request is redundant, and the digests of public data can be made with the main hash function. The second hash function will be removed in a future version.
  • Exact match. That the public files specify the exact-match policy (the field exactMatch of FilesTaken, §4.4): the verifier does not check this, and the theorem sound applies only to such files (A public setup). The serving scripts use a different, tolerant policy, and the six theorems do not apply to it.
  • Intended files. That a commitment belongs to a single set of public files: no theorem ties a commitment to one set of public files or one policy. The user must therefore keep the intended public files together with the commitment.
  • Scales. That the model does anything at the settings that the public files specify: for some valid choices of the quantization scales, the outputs of the value and up projections are all zero, so no layer changes the residual stream (checked by hand, not proved; see the card PublicSetup). No theorem or test on this page determines which scale files have such scales.
  • Files fixed first. Anything about a provider that chooses its public files, or tries many, with access to the hash function: in the statements the files are fixed before the hash function is sampled. There is room to try many: the committer chooses the scale file, and five numbers of the parameter file are free, within what the parser of the files accepts (Judging the assumptions on the public files and on hash values).
  • Hash values treated alike. That the protocol treats all values of the hash function alike. Consider a protocol whose verifier accepts every request whenever one particular answer of the hash function has one particular value. A function sampled at random gives that value with probability 2^-256, so the protocol can still satisfy the statements. The value can be chosen to be the one that the concrete hash function gives; the verifier then accepts every request when instantiated with the concrete hash function (Judging the assumptions on the public files and on hash values).
  • Anything about running time. The bounds count queries to the hash function.
  • Anything about an adversary that queries the hash function in superposition: in the statements the committer, the prover and the malicious verifier query it classically, one bit string at a time (RandomizedAlgorithm, §8; MaliciousVerifier, §6.2).
  • That a program that runs on a machine computes ArgumentSystem.accepts, or that a prover program computes prove. These are facts about programs. The honest prover in these statements is a definition, not a program.
  • How the integer model relates to a model in floating-point arithmetic.
  • That the empty output is rejected: it has no position to check, so it is the model's output in the sense of §1 for every prompt and all weights, and when the extractor outputs weights, Sound does not count its acceptance as a failure.
  • A soundness bound for several proofs under one commitment: Sound concerns one proof. For N proofs submitted together, a union bound gives N times the error of one proof, evaluated at the number of hash queries of the whole list. For proofs checked one after another, no bound is stated.
  • Anything about several requests in one proof. The statement on zero knowledge concerns many replies under one commitment (§6.3).
  • Anything about a party that learns the committer's randomness or the weights by means other than the replies.
  • A bound on what the bits of many requests together reveal about the weights (§6.1, requestOutcome).
  • A security level: finalSoundnessError q, about q / 2^124 + 2^-101, is a bound on the soundness error, not a security level (see the card sound).
  • That the limit on the number of replies is respected: the prover does not count replies, so nothing in it enforces the number 688,127 in the theorems on zero knowledge (§6.4).
  • What the three public files reveal about the weights: the scale file of a fitted model is computed from its weights, and the theorems on zero knowledge do not cover this (§6.3).
  • That any public files other than one stored set form a public setup: the library proves this for one set (filesInUse_stored), whose scale file is that of an example with synthetic weights (according to the header of Ladder/Stored.lean, not a theorem).
  • That a proof cannot be altered: the joint verification reads only those digests in the Merkle paths that it needs, so a typed proof can be altered at the others and still be accepted; and it is not proved anywhere that an accepted proof string cannot be changed elsewhere into another accepted one. This is malleability of the proof string, not a gap in soundness (§4.2).
What this page does not show
  • What this page contains. Every statement, and every definition that the introduction asks a reader who checks only soundness to read. It does not show the definitions of three Lean terms, which it treats as black boxes: FlashProve's description, the test on the public files (protocolDataWellFormed) and the honest provers and settings (honestProversAndSettings). Their sizes are under “Counts of declarations” above.
  • The line noncomputable section. Many definitions on the cards are inside such a section, which no card shows, so a def on a card may be one that Lean does not compile. leanVerifier, flashProve, compile, compiledVerifier and finalVerifierProgram are inside one; verdictOf, whose three parts the command lean-verify evaluates, is not.
  • What the proof of sound depends on. Among other things, it uses theorems of coding theory from files that are adapted from others' work (lean/CREDITS.md). Nothing in these coding-theory files has a card here. The axioms that Lean lists for sound cover them, as they cover every file on which the proof depends.
  • Properties that the library states but does not prove for any object: G3'pol, G7', G7'bits and the six Package… statements (Ladder.lean, Ladder/Bits.lean, Ladder/Package.lean). None of them is used in the statements of the six theorems or in the definitions under these. The plain properties Complete and ZeroKnowledge are discussed in §6: ZeroKnowledge is not proved for any system, and Complete is proved only for a verifier that accepts everything (acceptAll_complete).

Judging the assumptions on the public files and on hash values

The assumptions Files fixed first and Hash values treated alike (above) can be judged only from the protocol's definitions. A reader can check the following.

  • Files fixed first. Is the digest of the public files, or their bytes, part of the query whose answer is the commitment and of every query from which the verifier samples a challenge (directly or through the instance)? Is any answer of the hash function compared with bytes of the public files?
  • Hash values treated alike. Do the definitions single out any value of the hash function, whether written out, referred to by name, or computed?

We have read FlashProve's own definitions with both questions in mind. The findings below come from reading the definitions, not from theorems.

  • Files fixed first. Their digest is the first input of every sequence of chained queries, and it is included in the encoding of the key, whose hash is the commitment. It is not part of the instance, which consists of the request only (a window of tokens, one further token and two positions; the online IOP adds the out-of-domain seed and answer of the copy, §6.4). For comparisons, see the next item.
  • Hash values treated alike. By reading and by counting occurrences, we found no place where an answer of the sampled hash function is compared with a stored digest or with bytes of the public files (lean/GAPS.md, 51). The compiler's verifier does compare such answers with the commitment and with digests in the proof (for example verifyDigestKey). The definitions used by verify do contain one explicit answer of the concrete hash function, namely a digest of the stored public files; as far as we can tell from reading, it is not used anywhere.

No attack is known, and neither point is settled by a theorem (lean/GAPS.md, 5 and 51).

Appendix A. FlashProve's protocol

This page prints 1,558 declarations. The statement of the theorem sound depends on about 17,000 named declarations of the library (counted as described in §11); the page prints those nearest to it, and the protocol's three IOPs, the compiler, BLAKE2b and the integer model. The rest are in the files, most of them under Johnson/Desc/, OnBytes/Model/, OnBytes/Params/, OnBytes/Iop/ and Inst/Model/.

A protocol is a linkable holographic IOP, from which the verifier is built. It makes no queries to the random oracle. It has an encoder that encodes an index, here the weights, as an oracle string, with a decoder; an out-of-domain sample on each encoding; and three interactive oracle proofs: offline, link and online.

An IOP is defined for a batch of instances: one prover serves them together, and each instance has its own verifier.

This appendix gives the three IOPs from which FlashProve.flashProveDescription is assembled. The first folded sections contain the Lean definitions nearest to the six theorems: the verifier's side, the public files, the honest provers and settings. Next are the terms of this appendix, a count of sub-protocols by kind, and each IOP, sub-protocol by sub-protocol. The last folded sections contain the protocol itself: the format in which an IOP is written, how a written IOP is run, the public checks on it, the two decisions, the three IOPs chain by chain, the kinds of sub-protocol, and the assembly.

This appendix shows the verifier's side of the protocol and, in the folds named here, the honest provers. The honest provers and settings of the six theorems are on the card honestProversAndSettings, in What the theorems refer to.

The fixed-message provers, the constant committer and the constant prover in this appendix supply fields of the protocol's record, which the types need and which neither compile nor the verifier reads. Fixed-message provers are provers that send the same messages whatever the weights, and so show nothing of them; at public files in use (FilesInUse, §4.4) the protocol's honest provers are different provers: only where a function that makes them refuses do they fall back on these. The constant committer is a committer that returns one constant whatever the weights, and so commits to nothing; the committer of the six theorems is a different committer: the one that compile makes (Johnson/Face/Compiler.lean), which encodes the weights and hashes the key. The constant prover returns empty strings.

A helper: andThen · 1 card
DefinitionRun one algorithm, then another on its resultLadder.lean:261–264
In words
In Lean · Ladder.lean, lines 261–264

Run one algorithm, then another on its result.

def andThen {α β : Type} :
DeterministicAlgorithm α → (α → DeterministicAlgorithm β) → DeterministicAlgorithm β
| .done a, f => f a
| .query s k, f => .query s fun d => andThen (k d) f
The public side that the verifier reads · 8 cards
DefinitionFlashProve's public side, at public files and settingsJohnson/Face/FinalStatement.lean:99–100
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 99–100

FlashProve's public side, obtained from the description FlashProve.flashProveDescription at the public files and settings, with the map from weights to indices. Its fields include the protocol, its round markings and whether the verifier takes these public files at all (filesInScope).

def flashProvePublic (files : PublicFiles) (settings : Settings) : PublicSide :=
ofDescription flashProveDescription files settings (backThe files settings)
DefinitionThe public side constructed from a description, public files Z, settings s and a map from weights to indicesJohnson/Face/Compiler.lean:417–430
In words
In Lean · Johnson/Face/Compiler.lean, lines 417–430

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}
variable (input : Compilable)

Constructs a public side from a description, public files, settings and a map from weights to indices.

def ofDescription (D : Description) (Z : PublicFiles) (s : Settings) (idx : ModelWeights s → (D.C Z).I) :
PublicSide where
Index := (D.C Z).I
Instance := (D.C Z).X
protocol := (D.F Z).withProvers (D.P Z)
offlineRoundSplits := (D.F Z).annT
linkRoundSplits := (D.F Z).annL
filesInScope := InScope Z
filesDigest := readConfig Z
Further := D.More
furtherReading := D.readMore Z
layoutAt := layoutOf D Z
model := integerModel s
indexOf := idx
DefinitionThe fields of the inner compiler's input given by a description, as a layoutJohnson/Face/Compiler.lean:398–414
In words
In Lean · Johnson/Face/Compiler.lean, lines 398–414

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}
variable (input : Compilable)

The layout consisting of the fields of the inner compiler's input that a description specifies.

def layoutOf (D : Description) (Z : PublicFiles) (c : Digest) (m : D.More) :
HashLayoutWithProverFields ((D.F Z).withProvers (D.P Z)) (D.F Z).annT (D.F Z).annL where
LeafBody := (D.T Z c m).Bd
queryLayout := (D.T Z c m).W
seedQueries := (D.T Z c m).Sd
answerCode := (D.T Z c m).cA
fixedSample := (D.T Z c m).r₀
compilerParameters := (D.T Z c m).p
oracleCoding := (D.T Z c m).m
keyCode := (D.T Z c m).enc
buildInstance := (D.T Z c m).build
nextToken := (D.T Z c m).nextToken
ProverKey := (D.T Z c m).ISK
commit := (D.T Z c m).commit
prove := (D.T Z c m).prove
coinBound := (D.T Z c m).bound
fallbackProof := (D.T Z c m).π₀
DefinitionA proof as the compiled verifier reads itJohnson/Face/Compiler.lean:55–58
In words
In Lean · Johnson/Face/Compiler.lean, lines 55–58

the file's variables

variable {Index Instance : Type}

A proof as the compiled verifier reads it: further tokens, a key and a proof.

abbrev TypedProof (protocol : HolographicProtocol Index Instance)
(offlineRoundMarks : RoundSplits protocol.offline.shape) (linkRoundMarks : RoundSplits protocol.link.shape) :
Type :=
List Token × (KeyRoot 256 protocol × OfflineLinkOnlineProof 256 protocol offlineRoundMarks linkRoundMarks)
DefinitionThree public files, as bytesLadder/Stored.lean:253–256
In words
In Lean · Ladder/Stored.lean, lines 253–256

Three public files, as bytes: the parameter file, the layout file and the scale file.

structure PublicFiles where
pol : ByteArray
lay : ByteArray
KL : ByteArray
DefinitionThe public files in scopeLadder.lean:307–312
In words
In Lean · Ladder.lean, lines 307–312

The public files that verify takes: it rejects on all others. The six theorems require more: FilesTaken requires that InScope is true (field inScope) and imposes further conditions.

def InScope (Z : PublicFiles) : Bool :=
Layout file

the layout file is that of the stored full-size example (Ladder/Stored.lean)

decide (Z.lay = storedPublicFiles.lay) &&
Reader

the reader (readFiles) accepts the three files

match readFiles Z with
| .ok pp =>
Parameter file

the parameter file equals that example's byte for byte, except for the eight free numbers (FreeLines), which are written as the reader read them; and 2^8 ≤ theta. Hence only the scale file and these eight numbers are free, within what the reader accepts. All security settings, the version line and the layout are fixed, so files of a changed format are out of scope.

decide (Z.pol = policyFile (freeLinesOf pp)) && decide (2 ^ 8 ≤ pp.pol.theta)
| .error _ => false
Remark

Policies that leave every counted token unconstrained remain in scope: (256, 256, 1) for requests with one counted token, and theta = C with cap = 1,024 for every request.

Why 2^8 ≤ theta: every token costs at least 2^8. For smaller theta, no output with a counted token meets the policy (theta < C), or the policy bounds little except the number of counted tokens (theta = C). ("Cost" and "counted token": see MeetsPolicy.)

DefinitionThe digest of the three public files, obtained by querying the hash functionLadder.lean:326
In words
In Lean · Ladder.lean, lines 326–326

The digest of the three public files, obtained by querying the hash function.

def readConfig (Z : PublicFiles) : DeterministicAlgorithm Digest := .query (configString Z) .done
DefinitionThe string hashed to obtain the digest of the three public filesLadder.lean:322–323
In words
In Lean · Ladder.lean, lines 322–323

The string that the format hashes to obtain the digest of the three public files: Fmt.oStr (Fmt/Rules23.lean) applied to their bytes with half 0, number 169, tree 0, index 2. Fmt.zero32 is the "start" argument of that call, not a digest.

def configString (Z : PublicFiles) : BitString :=
_root_.Run.bytesToBits (Fmt.oStr 0 169 0 2 Fmt.zero32 (Fmt.configBytes [Z.pol, Z.lay, Z.KL]))
The protocol's description · 6 cards
DefinitionThe description of FlashProve's protocolJohnson/Goal/Conditions/BindsAtThe.lean:102
In words
In Lean · Johnson/Goal/Conditions/BindsAtThe.lean, lines 102–102

The description of FlashProve's protocol. A black box on this page: it depends on about 12,000 named declarations of this library, of which the page shows a few hundred.

abbrev flashProveDescription : Description := descriptionOfDataOnBytes flashProveData
DefinitionThe description, with proofs in byte formJohnson/Goal/Tie/DescriptionOfData.lean:247
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 247–247

The description built from the data L at each set of public files (dataAtFiles), with proofs in the byte form FormBytes: the five byte strings of the parsed files, and the further tokens.

def descriptionOfDataOnBytes (L : DescriptionData) : Description := descriptionOnBytes (dataAtFiles L) L.f₀ L.honest
DefinitionThe library's values for all parameters of the descriptionJohnson/Goal/Description/Lay.lean:32
In words
In Lean · Johnson/Goal/Description/Lay.lean, lines 32–32

The library's values for all parameters of the description.

def flashProveData : FlashProve.DescriptionData := { flashProveDataNoExtractor with ext := theExtractor }
DefinitionThe same values, with an extractor that finds nothingJohnson/Goal/Description/Lay0.lean:49–69
In words
In Lean · Johnson/Goal/Description/Lay0.lean, lines 49–69

All parameters of flashProveData, with an extractor that finds nothing.

def flashProveDataNoExtractor : FlashProve.DescriptionData where
A := theClaims
E := theCoding
DK := theKeyData
DP := theProofData
runK := theKeyGate
runP := theProofGate
dec := theLinkGate
G := thePlan
it := theItem
P := theProvers
N := theNamed
ext := fun _ _ _ _ => none
honest := theHonest
hStar := fun _ _ _ _ _ => ByteArray.empty
d₀ := fun _ => false
f₀ := theForm0
hf₀ := theForm0_aux
live := protocolDataWellFormed
hlive := theLive_fit
Gd := theDeadPlan
DefinitionThe three public files, as one value of OnBytes.K.PubJohnson/Goal/Tie/ReadThruHead.lean:20
In words
In Lean · Johnson/Goal/Tie/ReadThruHead.lean, lines 20–20

The three public files, as one OnBytes.K.Pub value.

def asDescriptionFiles (Z : PublicFiles) : OnBytes.K.Pub := ⟨Z.pol, Z.lay, Z.KL⟩
DefinitionThe parsed files as they are stored on disk, and the further tokensJohnson/Goal/Tie/DescriptionOnBytes.lean:124–130
In words
In Lean · Johnson/Goal/Tie/DescriptionOnBytes.lean, lines 124–130

the file's variables

variable (S : (Z : PublicFiles) → DescriptionDataAtFiles (asDescriptionFiles Z)) {Form : Type} (Hn : CommitterAndProver Form)
(dec : ByteArray → Form → Option DecodedProof) (f₀ : DecodedProof)

The parsed files as they are stored on disk, and the further tokens.

structure FormBytes where
aux : List Token
kb : ByteArray
sb : ByteArray
leaf : ByteArray
seeds : ByteArray
pb : ByteArray
The type of an interactive oracle protocol · 3 cards
DefinitionOne roundIop/Shape.lean:55–69
In words
In Lean · Iop/Shape.lean, lines 55–69

the file's variables

elab "lazy_instance" : tactic => withMainContext do
let g ← getMainGoal
let t ← whnfR (← instantiateMVars (← g.getType))
let .forallE _ d b _ := t | throwError "lazy_instance: the goal is not a function type"
let inst ← synthInstance b
let v ← instantiateMVars (.lam `u d inst .default)
let n ← mkAuxDeclName `_lazy
let e ← mkAuxDefinition n (← inferType v) v (compile := false)
setReducibleAttribute n
try
withOptions (fun o => o.setBool `compiler.extract_closed false) do
compileDecls #[n] (logErrors := false)
catch _ => pure ()
g.assign e

One round: a prover message, consisting of an oracle part and a plain part that is read in full, followed by a challenge. The compiler (Compile/) takes only oracles that are strings. Linear oracles also fit the type, but no other file of this library mentions them.

structure Round where
Oracle part

the oracle part, an abstract type. For oracles that are strings, Orc = ∀ p, Sym p; for linear oracles, a vector. A message without oracles has Orc = Unit

Orc : Type

the queries p. For linear oracles, linear functionals. A message without oracles has Pos = Empty

Pos : Type

the answers to a query p

Sym : Pos → Type

how Orc is read by queries. For oracles that are strings, this is function application (see Round.IsPoint)

rd : Orc → (p : Pos) → Sym p
Plain part

the plain part. A message without a plain part has Plain = Unit

Plain : Type
Challenge

the challenge, uniform in the finite set Chal. A round without a challenge has Chal = Unit

Chal : Type
Fixed message

a fixed message of the right format: its oracle part and its plain part

/-- a fixed message of the right format: what is sent where there is no honest message, and after
a rejection of an earlier part, when the later rounds still take place (by convention) -/
dOrc : Orc
dPlain : Plain

the list of all challenges; Chal is not empty

/-- the list of all challenges, behind a function of `Unit`: compiled Lean is strict, and builds
the list only where this function is called -/
finChalT : Unit → Fintype Chal := by lazy_instance
[neChal : Nonempty Chal]
DefinitionA Shape is the list of a protocol's rounds, in orderIop/Shape.lean:80
In words
In Lean · Iop/Shape.lean, lines 80–80

the file's variables

elab "lazy_instance" : tactic => withMainContext do
let g ← getMainGoal
let t ← whnfR (← instantiateMVars (← g.getType))
let .forallE _ d b _ := t | throwError "lazy_instance: the goal is not a function type"
let inst ← synthInstance b
let v ← instantiateMVars (.lam `u d inst .default)
let n ← mkAuxDeclName `_lazy
let e ← mkAuxDefinition n (← inferType v) v (compile := false)
setReducibleAttribute n
try
withOptions (fun o => o.setBool `compiler.extract_closed false) do
compileDecls #[n] (logErrors := false)
catch _ => pure ()
g.assign e

The list of a protocol's rounds, in order.

abbrev Shape : Type 1 := List Round
DefinitionThe round marking of a list of roundsIop/Batch.lean:175–177
In words
In Lean · Iop/Batch.lean, lines 175–177

For each round, its kind (local or shared) and how its message splits into the shared part and one batch position's part.

def RoundSplits : Shape → Type 1
| [] => PUnit
| r :: s => RAnn r × RoundSplits s
The test on the public files · 1 card
DefinitionThe test protocolDataWellFormed on the public filesJohnson/Goal/Description/Live.lean:142
In words
In Lean · Johnson/Goal/Description/Live.lean, lines 142–142

The test on the public files: protocolDataWellFormedAt (folded section How FlashProve's description is assembled) instantiated with the second hash function. It is a black box on this page: it depends on about 9,100 named declarations of this library, of which the page shows about two hundred. If files in scope fail it, the verifier rejects everything. Soundness holds without it: the proof of sound uses FilesTaken alone.

def protocolDataWellFormed (Zk : OnBytes.K.Pub) : Bool := protocolDataWellFormedAt OnBytes.secondHashFunction Zk
The link IOP's one chain · 1 card
DefinitionThe link IOP's chainJohnson/Desc/Link/LinkDesc.lean:205–208
In words
In Lean · Johnson/Desc/Link/LinkDesc.lean, lines 205–208

The link IOP's chain. Its end (chainEnd) is given the rounds of exactly the sub-protocols in the field back.

def linkProtocolChain (P : P15) : Chain St Unit :=
let inFront := blocksOrV P ++ [testBlock P]
{ first := frontBlock P, front := [], links := []
back := inFront, last := chainEnd 1 7 false (inFront.flatMap (·.rounds)) fun d => untestedL d.st }
From the interactive protocol to hash queries · 3 cards
DefinitionThe inner compiler's input whose protocol is made of the three IOPsJohnson/Flat/InnerInputOfThreeProtocols.lean:66–86
In words
In Lean · Johnson/Flat/InnerInputOfThreeProtocols.lean, lines 66–86

The inner compiler's input whose protocol is made of the three IOPs: offline, link and online.

def innerInputOfThreeProtocols {C : ConfigurationWithOutOfDomainSample} (F : Files C) (P : F.Provers) (T : InnerCompilerInputFieldsOverThreeProtocols F P) : InnerCompilerInput where
Index := C.I
Instance := C.X
protocol := F.withProvers P
LeafBody := T.Bd
offlineRoundSplits := F.annT
linkRoundSplits := F.annL
queryLayout := T.W
seedQueries := T.Sd
answerCode := T.cA
fixedSample := T.r₀
compilerParameters := T.p
oracleCoding := T.m
keyCode := T.enc
buildInstance := T.build
nextToken := T.nextToken
ProverKey := T.ISK
commit := T.commit
prove := T.prove
coinBound := T.bound
fallbackProof := T.π₀
DefinitionThe first table's key: its root and its out-of-domain sampleJohnson/TypedOracleCompiler/RecCompile/FrontRoot.lean:43–45
In words
In Lean · Johnson/TypedOracleCompiler/RecCompile/FrontRoot.lean, lines 43–45

the file's variables

variable {I X Wn : Type} {lam : ℕ}

The key: the root of the first table, and its out-of-domain sample.

structure KeyRoot (lam : ℕ) (L : HolographicProtocol I X) where
cm : Dig lam
rcd : L.Rec
DefinitionA compiled proof: its copy number and the three IOPs' proofsJohnson/TypedOracleCompiler/RecCompile/FrontRoot.lean:49–54
In words
In Lean · Johnson/TypedOracleCompiler/RecCompile/FrontRoot.lean, lines 49–54

the file's variables

variable {I X Wn : Type} {lam : ℕ}

A proof consists of the number of the stored copy; the offline IOP's proof on the first table; a copy's root, its out-of-domain sample and the link IOP's proof; and the online IOP's proof; each of the three IOPs' proofs may be missing (an Option).

structure OfflineLinkOnlineProof (lam : ℕ) (L : HolographicProtocol I X) (aT : RoundSplits L.offline.shape) (aL : RoundSplits L.link.shape) where
/-- the number of the stored copy -/
copy : ℕ
piT : Option (OneProtocolProof lam (batTC L aT))
link : Dig lam × L.Rec × Option (OneProtocolProof lam (batLC L aL))
piB : Option (OneProtocolProof lam L.onlineBatch)
The proof-of-work test on challenges · 1 card
DefinitionThe test on first hash blocks for given public filesJohnson/Face/FinalStatement.lean:144–148
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 144–148

The test on first hash blocks for given public files: a nonce search queries the other blocks of a try only if its first block passes.

abbrev flashFirstBlockTest (files : PublicFiles) : (layoutsOfBuiltDescription flashProveData allZeroDigest [] files).D →
Rom.More (TypedOracleCompiler.Compile.Batch.typedOracleFamily 256 (flashProveDescription.input files allZeroDigest []).queryLayout.K
(TypedOracleCompiler.Compile.Batch.Cms.typedOracleCarrier (flashProveDescription.input files allZeroDigest []).protocol
(flashProveDescription.input files allZeroDigest []).LeafBody (flashProveDescription.input files allZeroDigest []).offlineRoundSplits (flashProveDescription.input files allZeroDigest []).linkRoundSplits)) 256 :=
fun _ => OnBytes.Prover.moreP (FlashProve.firstBlockTestAtDescriptionData (FlashProve.dataAtFiles flashProveData files) allZeroDigest [])
The public files: three files, their parser, and the parameters read from them · 5 cards
DefinitionThe reader of the public filesLadder.lean:270
In words
In Lean · Ladder.lean, lines 270–270

The reader of the public files returns the table of scales and the policy specified by the parameter file and the scale file. It rejects files that it cannot read, scales that are not valid, a policy that violates one of C < 2^32, theta ≤ C and cap ≤ 1,024 (both tested by Inst.Model.Lawful), and a parameter file in which a line about the model, other than its sizes and scales, differs from the reference model's. It does not read the layout file.

abbrev readFiles (Z : PublicFiles) : Except String Inst.Model.ScalesAndPolicy := settingsAtRef Z.pol Z.KL
DefinitionThe scales and the acceptance policyInst/Model/ProgTests.lean:111–117
In words
In Lean · Inst/Model/ProgTests.lean, lines 111–117

The settings: the scales of the 48 layers, the final normalization, and the three numbers of the acceptance policy.

structure ScalesAndPolicy where
w : Fin 48 → Words
nf : NormPar
/-- the clip C, the bound theta on the mean cost, the limit cap on the number of positions above
the clip -/
pol : AcceptancePolicy
deriving DecidableEq
DefinitionThe three numbers of the acceptance policyInst/Model/ProgramR.lean:76–79
In words
In Lean · Inst/Model/ProgramR.lean, lines 76–79

The three numbers of the acceptance policy: the clip, the bound on the mean cost, the limit on the number of positions above the clip.

structure AcceptancePolicy where
C : ℕ
theta : ℕ
cap : ℕ
DefinitionThe policy of exact matchInst/Model/ProgramR.lean:287
In words
In Lean · Inst/Model/ProgramR.lean, lines 287–287

The policy of exact match: C = θ = 2^8, cap = 0.

def AcceptancePolicy.exact : AcceptancePolicy := ⟨2 ^ 8, 2 ^ 8, 0⟩
DefinitionThe integer model's settings, computed from what the reader returnedLadder.lean:273–274
In words
In Lean · Ladder.lean, lines 273–274

The integer model's settings, computed from what the file reader returned.

abbrev settingsOfRead (pp : Inst.Model.ScalesAndPolicy) : IntegerTransformer.Settings :=
settingsOf (Cm.Scales.of pp)
The public files that the verifier takes, and the stored full-size example · 3 cards
DefinitionThe numbers of the parameter file that InScope leaves freeLadder/Stored.lean:226–234
In words
In Lean · Ladder/Stored.lean, lines 226–234

The numbers of the parameter file that InScope leaves free: the constants of the two normalizations of a layer and of the final normalization (eps1, eps2, epsF), the final normalization's exponent and shift (MF, KF), and the acceptance policy (C, theta, cap). Each of eps1, eps2 and epsF is written on two lines: _lo, the value modulo 2^32, and _hi, the quotient by 2^32.

structure FreeLines where
eps1 : Nat
eps2 : Nat
epsF : Nat
MF : Nat
KF : Nat
C : Nat
theta : Nat
cap : Nat
DefinitionThe eight free numbers of the parameter file, taken from the reader's outputLadder.lean:287–295
In words
In Lean · Ladder.lean, lines 287–295

The eight free numbers of the parameter file, taken from a value returned by readFiles, which writes eps1 and eps2 into the two normalizations of every layer; here they are read from the first layer.

def freeLinesOf (pp : Inst.Model.ScalesAndPolicy) : FreeLines where
eps1 := (pp.w 0).n1.eps.toNat
eps2 := (pp.w 0).n2.eps.toNat
epsF := pp.nf.eps.toNat
MF := pp.nf.M
KF := pp.nf.K
C := pp.pol.C
theta := pp.pol.theta
cap := pp.pol.cap
DefinitionThe stored example's parameter file with the free numbers set to the given valuesLadder/Stored.lean:241–248
In words
In Lean · Ladder/Stored.lean, lines 241–248

The stored example's parameter file with the eleven lines of the free numbers set to the given values, written in decimal.

def policyFile (v : FreeLines) : ByteArray :=
OnBytes.Tie.Pv.Plan.textOf lines32 ++
(behindA1 ++
s!"eps1_lo {v.eps1 % 2 ^ 32}\neps1_hi {v.eps1 / 2 ^ 32}\n" ++
s!"eps2_lo {v.eps2 % 2 ^ 32}\neps2_hi {v.eps2 / 2 ^ 32}\n" ++ behindA2 ++
s!"MF {v.MF}\nKF {v.KF}\n" ++
s!"epsF_lo {v.epsF % 2 ^ 32}\nepsF_hi {v.epsF / 2 ^ 32}\n" ++ behindA3 ++
s!"C {v.C}\ntheta {v.theta}\ncap {v.cap}\n" ++ behindB).toUTF8
The three public files as bytes · 1 card
DefinitionA description's three public files, as bytesOnBytes/K/Served.lean:39–42
In words
In Lean · OnBytes/K/Served.lean, lines 39–42

The three public files, as bytes: the parameter file (pol), the layout file (lay) and the scale file (KL).

structure Pub where
pol : ByteArray
lay : ByteArray
KL : ByteArray
The honest provers and settings: one closed term · 4 cards
DefinitionThe honest provers and settings at every set of public files and model settingsJohnson/Face/FinalStatement.lean:172
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 172–172

The honest provers and settings at every set of public files and model settings.

abbrev HonestProversAndSettings := (files : PublicFiles) → (settings : Settings) → HonestProversAndSettingsAtFiles files settings
DefinitionThe honest provers and settings, built from the honest proversAtFullSide/CompletenessAndZeroKnowledge/HonestProversAndSettingsOf.lean:60–61
In words
In Lean · AtFullSide/CompletenessAndZeroKnowledge/HonestProversAndSettingsOf.lean, lines 60–61

the file's variables

variable (parts : (files : PublicFiles) → Parts files)

The honest provers and settings: honestProversAndSettingsAtFiles applied to parts files and to compiledPartAtHonestProvers, what compilation adds to the honest provers.

def honestProversAndSettingsOf : HonestProversAndSettings := fun files settings =>
honestProversAndSettingsAtFiles files settings (parts files) (compiledPartAtHonestProvers parts files settings)
DefinitionFlashProve's honest provers and settings, built from the protocol's honest proversJohnson/Face/HonestProversWithCompiledPart.lean:53–59
In words
In Lean · Johnson/Face/HonestProversWithCompiledPart.lean, lines 53–59

FlashProve's honest provers and settings, built from the protocol's honest provers.

def honestProversAndSettingsAtFiles (files : PublicFiles) (settings : Settings) (parts : Parts files)
(compiled : CompiledPart files settings parts) : HonestProversAndSettingsAtFiles files settings where
fallbackInstance := neverBuiltRequest
provers := theProvers files settings parts
compiledSettings := compiled.compiledSettings
coinBound := compiled.coinBound
onlineRunsPerCopy := compiled.onlineRunsPerCopy
DefinitionThe fall-back requestJohnson/Face/NeverBuilt.lean:39–40
In words
In Lean · Johnson/Face/NeverBuilt.lean, lines 39–40

A fixed fall-back request, used when no instance can be built from the given request.

def neverBuiltRequest : Flat.Req :=
⟨neverBuiltInstance, ⟨Nat.zero_lt_one, fun _ => rfl⟩⟩
The honest provers, which refuse a request that is not served · 3 cards
DefinitionThe protocol's honest provers, which refuse when the request is not servedJohnson/Face/HonestProversWithCompiledPart.lean:35–39
In words
In Lean · Johnson/Face/HonestProversWithCompiledPart.lean, lines 35–39

The protocol's honest provers, which refuse when the request is not served.

def theProvers (files : PublicFiles) (settings : Settings) (parts : Parts files) :
HonestProvers ((flashProveDescription.F files).withProvers (flashProveDescription.P files)) :=
HonestProvers.refuseUnserved
⟨(honestProvers files parts).T, (honestProvers files parts).Lk, (honestProvers files parts).B⟩
(ServedAt files settings)
DefinitionThe same provers, except that the online prover withholds everything when the request is not servedJohnson/Face/Protocol.lean:64–73
In words
In Lean · Johnson/Face/Protocol.lean, lines 64–73

the file's variables

variable {Index Instance : Type} {protocol : HolographicProtocol Index Instance}

The same provers, except that for a request that is not served the online prover aborts whatever the verifier's messages are: it shows nothing. For a served request nothing changes.

def HonestProvers.refuseUnserved (provers : HonestProvers protocol)
(Served : Index → Instance → Prop) : HonestProvers protocol where
offlineProver := provers.offlineProver
linkProver := provers.linkProver
onlineProver :=
{ Coin := provers.onlineProver.Coin
ext := provers.onlineProver.ext
strat := provers.onlineProver.strat
Bad := provers.onlineProver.Bad
Hid := fun w y => {_ρ | ¬ Served w.1 y.1} ∪ provers.onlineProver.Hid w y }
DefinitionA served instanceJohnson/Face/NeverBuilt.lean:106–111
In words
In Lean · Johnson/Face/NeverBuilt.lean, lines 106–111

A served instance: for some weights with the given index, some prompt and output tokens form a request, the model's result on it is these output tokens, and the verifier's builder maps them to the instance.

def ServedAt (files : VerifierAndGoals.PublicFiles) (settings : IntegerTransformer.Settings)
(index : (FlashProve.flashProveDescription.C files).I) (instance_ : (FlashProve.flashProveDescription.C files).X) : Prop :=
∃ (weights : ModelWeights settings) (prompt output : List Token),
index = FlashProve.backThe files settings weights ∧ RequestForm settings prompt output ∧
requestResult settings weights prompt output = some output ∧
(FlashProve.flashProveDescription.input files FlashProve.allZeroDigest []).buildInstance (prompt, output) [] = some instance_
The three honest provers of the interactive protocol · 8 cards
DefinitionThe honest provers of the protocolE2E/TheHonestProver.lean:271–272
In words
In Lean · E2E/TheHonestProver.lean, lines 271–272

the file's variables

variable (files : PublicFiles)
variable {files}

The three provers, one for each IOP of the protocol: offlineProver, linkProver and onlineProver.

def honestProvers (files : PublicFiles) (parts : Parts files) : ThreeProvers (protocolAtFiles files) :=
proversOf (offlineProver parts) (linkProver files) (onlineProver files)
DefinitionThree honest provers, one for each IOP of the protocolJohnson/Prover/All/OfHonest.lean:69–72
In words
In Lean · Johnson/Prover/All/OfHonest.lean, lines 69–72

the file's variables

variable {I X : Type} {lam : ℕ}

The type of a triple of honest provers, one for each of the protocol's three IOPs. T is the offline prover (IOP offline), Lk the link prover, and B the online prover (the IOP of one batch position, onlineBatch.loc). The private input is the index with its encoding randomness and seed; the link prover has the randomness and seeds of both tables, and the online prover also has the copy's number (a copy is a further encoding of the index).

structure ThreeProvers (L : HolographicProtocol I X) where
T : Honest L.offline (I × L.EncodingRandomness × L.OutOfDomainSeed)
Lk : Honest L.link (I × (L.EncodingRandomness × L.OutOfDomainSeed) × (L.EncodingRandomness × L.OutOfDomainSeed))
B : Honest L.onlineBatch.loc (I × L.EncodingRandomness × L.OutOfDomainSeed × ℕ)
DefinitionThe protocol at the public filesE2E/BridgeJoinAtFiles.lean:287
In words
In Lean · E2E/BridgeJoinAtFiles.lean, lines 287–287

The protocol structure at the public files Z, with its three IOPs: offline, link, and onlineBatch (a batch of requests). It is the structure (flashProveDescription.F files).withProvers (flashProveDescription.P files) over which FlashProve's provers are defined. Its type HolographicProtocol is a holographic interactive oracle proof in which the party that encodes the index is not trusted, with an out-of-domain sample after each encoded index.

abbrev protocolAtFiles (Z : PublicFiles) := (filesAt Z).withProvers (dataAtFiles flashProveData Z).P
DefinitionThe offline honest proverE2E/TheHonestProver.lean:262–268
In words
In Lean · E2E/TheHonestProver.lean, lines 262–268

the file's variables

variable (files : PublicFiles)
variable {files}

If the public files yield a description, offlineProverWithEncodedTable with Parts.prover of that description; otherwise, the prover that sends the fixed messages.

def offlineProver (parts : Parts files) :
Honest (protocolAtFiles files).offline (FullSizeMatrix × (protocolAtFiles files).EncodingRandomness × (protocolAtFiles files).OutOfDomainSeed) :=
match offlineDescription files with
| .ok description =>
offlineProverWithEncodedTable files (keyFileDescription description.source description.numbers description.later) parts.book
(parts.prover description) runValueBytes runValueBytes (offlineStart description)
| .error _ => (filesAt files).fixedMessageProvers.hT
DefinitionThe link IOP's honest prover, at the number of the committer's coins minus oneE2E/TheHonestProver.lean:202
In words
In Lean · E2E/TheHonestProver.lean, lines 202–202

the file's variables

variable (files : PublicFiles)

The link's honest prover at committerCoinCountLessOne, the number of the committer's coins minus one.

abbrev linkProver := linkProverAtFiles committerCoinCountLessOne files
DefinitionThe online honest proversE2E/TheHonestProver.lean:193–199
In words
In Lean · E2E/TheHonestProver.lean, lines 193–199

the file's variables

variable (files : PublicFiles)

The online provers, one for each copy number, from the output of onlineMaker; if it, placesOfMade or onlineFirstChainAt fails, the provers that send the fixed messages.

def onlineProver : Family (protocolAtFiles files).onlineBatch.loc (FullSizeMatrix × (protocolAtFiles files).EncodingRandomness × (protocolAtFiles files).OutOfDomainSeed) :=
match onlineMaker files with
| .ok returned =>
match H2U.placesOfMade returned.Z.made, ProofFile.onlineFirstChainAt returned.Z with
| .ok places, .ok firstChain => onlineProverAt returned places firstChain
| _, _ => familyOf (filesAt files).fixedMessageProvers.hB.one
| .error _ => familyOf (filesAt files).fixedMessageProvers.hB.one
DefinitionThe arguments of the honest provers other than the public filesE2E/TheHonestProver.lean:238–250
In words
In Lean · E2E/TheHonestProver.lean, lines 238–250

the file's variables

variable (files : PublicFiles)

The arguments of honestProvers other than the public files, all of which belong to the offline prover: its coin counts, its two state types and the type LookupInput, its value senders of type KeyParts, and what its test on the ranges reads.

structure Parts where
/-- its book of coins -/
book : ProverCoinCounts
/-- what its sides pass on, and what its lookups are written at -/
SharedState : Type
OwnState : Type
LookupInput : Type
/-- its senders, but for the four proximity tests -/
senders : AtPublicFiles.KeyFile.KeyParts (Cz files).I ((Cz files).Pad × (Cz files).Rnd) SharedState OwnState
LookupInput
/-- what the test on the ranges reads -/
rangeEntry : Local (Cz files).I ((Cz files).Pad × (Cz files).Rnd) KeyInst Unit → Nat → Nat → GF
rangeGroups : List (List Nat)
DefinitionThe named value of the offline prover's arguments, for given public filesE2E/KeyArgumentsAt.lean:141–154
In words
In Lean · E2E/KeyArgumentsAt.lean, lines 141–154

the file's variables

variable {files : PublicFiles}
variable (files)

The value of Parts at given public files. If the files yield a description, the field senders is offlineSenders of that description and the list of groups rangeGroups is multiplicitiesGroups of its source; otherwise senders is fallbackSenders and rangeGroups is empty. The other fields do not depend on the description: book, the two states (both Unit), LookupInput and rangeEntry.

def thePartsAt : Parts files where
book := offlineProverCoinCounts
SharedState := Unit
OwnState := Unit
LookupInput := WitK
senders :=
match offlineDescription files with
| .ok description => offlineSenders description
| .error _ => fallbackSenders
rangeEntry := matrixEntryOf matrixReader
rangeGroups :=
match offlineDescription files with
| .ok description => multiplicitiesGroups description.source
| .error _ => []
The same provers, as named in the statements on the interactive protocol · 2 cards
DefinitionThe library's three provers as a value of HonestProversVerifiableInference/Final/CompilerTheorems.lean:75
In words
In Lean · VerifiableInference/Final/CompilerTheorems.lean, lines 75–75

the file's variables

variable {I X : Type}
variable {L : HolographicProtocol I X} {offlineRoundMarks : RoundSplits L.offline.shape} {linkRoundMarks : RoundSplits L.link.shape}

The library's three provers as a value of HonestProvers.

def HonestProvers.ofThreeProvers (Hs : ThreeProvers L) : HonestProvers L := ⟨Hs.T, Hs.Lk, Hs.B⟩
DefinitionThe number of the committer's coins, minus oneJohnson/Goal/Conditions/HomeAtWider.lean:353–354
In words
In Lean · Johnson/Goal/Conditions/HomeAtWider.lean, lines 353–354

the file's variables

variable {b : PublicFiles → ℕ} {Rand : Type} {B N : ℕ} (A : HomeArgs b Rand B N)
variable (gen : (Z : PublicFiles) → Rand → Digest → Digest → Fin (b Z + 1))

The number of the committer's coins, less one: the product of the sizes of the two enumerations riDigits and saltsDigits, less one.

def committerCoinCountLessOne (Z : PublicFiles) : ℕ :=
((riDigits Z).n + 1) * ((saltsDigits (R₀ Z).queryLayout.depth (R₀ Z).compilerParameters.sMT).n + 1) - 1
What compilation adds: one copy, the runs of the online IOP, the search limits · 11 cards
DefinitionWhat compilation adds to the honest provers, for given public files and settingsJohnson/Face/HonestProversWithCompiledPart.lean:42–50
In words
In Lean · Johnson/Face/HonestProversWithCompiledPart.lean, lines 42–50

What compilation adds to the honest provers, for given public files and settings.

structure CompiledPart (files : PublicFiles) (settings : Settings) (parts : Parts files) where
/-- What the honest side chooses beside the provers, at each value of the public reading. -/
compiledSettings : (reading : (layoutsOfBuiltDescription flashProveData allZeroDigest [] files).D) →
CompiledSettings ((flashProveWiring files settings neverBuiltRequest).layoutAtReading reading)
(theProvers files settings parts)
/-- The honest committer samples one number from 0 to this. -/
coinBound : ℕ
/-- The sessions that one copy bears. -/
onlineRunsPerCopy : ℕ
DefinitionWhat compilation adds at the honest proversAtFullSide/CompletenessAndZeroKnowledge/HonestProversAndSettingsOf.lean:50–57
In words
In Lean · AtFullSide/CompletenessAndZeroKnowledge/HonestProversAndSettingsOf.lean, lines 50–57

the file's variables

variable (parts : (files : PublicFiles) → Parts files)

What compilation adds at the honest provers.

def compiledPartAtHonestProvers (files : PublicFiles) (settings : Settings) : CompiledPart files settings (parts files) where
compiledSettings := theSettings files settings neverBuiltRequest (theProvers files settings (parts files))
((saltStartsAtHonestProvers files (parts files)).underRefusal (ServedAt files settings)) (writtenLimits files)
(flashProveRequestLeafSaltLayout files 40)
coinBound := theCoinBound files settings neverBuiltRequest (theProvers files settings (parts files))
((saltStartsAtHonestProvers files (parts files)).underRefusal (ServedAt files settings)) (writtenLimits files)
(flashProveRequestLeafSaltLayout files 40)
onlineRunsPerCopy := 688127
DefinitionWhat the honest committer and prover choose in addition to their three IOP proversJohnson/Face/Compiler.lean:193–218
In words
In Lean · Johnson/Face/Compiler.lean, lines 193–218
Given

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}

The settings that the honest committer and prover choose in addition to their three provers, given a hash layout layout and honest provers provers.

structure CompiledSettings (layout : HashLayout L offlineRoundMarks linkRoundMarks)
(provers : HonestProvers L) where
Fields

leafFiller: a leaf body of the layout

leafFiller : layout.LeafBody

searchLimitOffline, searchLimitLink, searchLimitOnline: in round i the search for a nonce may try limit(i) + 1 nonces

/-- in round i the search for a nonce may try searchLimit i + 1 nonces -/
searchLimitOffline : ℕ → ℕ
searchLimitLink : ℕ → ℕ
searchLimitOnline : ℕ → ℕ

furtherCopies: there are furtherCopies + 1 copies

/-- there are furtherCopies + 1 copies -/
furtherCopies : ℕ

copyNumber: the number of the copy at a position in the key's list; it is public

/-- the number of the copy at a place of the key's list: public -/
copyNumber : ℕ → ℕ

RunValues: strings determined by a prover's coins and also sent by the prover in the clear; wellFormed: a condition on them

RunValues : Type
wellFormed : RunValues → Prop

runValuesOffline, runValuesLink, runValuesOnline: these strings as functions of the coins of the offline, link and online prover, respectively

runValuesOffline : provers.offlineProver.Coin → RunValues
runValuesLink : provers.linkProver.Coin → RunValues
runValuesOnline : provers.onlineProver.Coin → RunValues

readOffline, readLink, readOnline: these strings as functions of the parts sent in the clear in the offline, link and online IOP, respectively

readOffline : Plains L.offline.shape → RunValues
readLink : Plains L.link.shape → RunValues
readOnline : Plains L.onlineBatch.loc.shape → RunValues

The public prefixes of a compiled run's salts (saltStartOffline, saltStartLink, saltStartOnline) are computed from them.

saltStartOffline : RunValues → ℕ → Bool → Bits → Bits
saltStartLink : RunValues → ℕ → Bool → Bits → Bits
saltStartOnline : RunValues → ℕ → Bool → Bits → Bits

slotTail: a bit string for each number; windowFiller: a bit string

slotTail : ℕ → Bits
windowFiller : Bits

coinNumbers (CoinNums): the public prefix of a table's salt, the free bits of a salt, paddings and batch positions

/-- the public start of a table's salt, the free bits of a salt, paddings and slots -/
coinNumbers : CoinNums layout.LeafBody
Remark

The verifier does not read any of these fields.

At zeroSaltStarts, RunValues is Unit and the prefixes are constants.

DefinitionThe protocol of FlashProve at public filesJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:173–174
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 173–174

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

The protocol of FlashProve at public files.

abbrev FlashProtocol (files : PublicFiles) : HolographicProtocol (flashProveDescription.C files).I (flashProveDescription.C files).X :=
(flashProveDescription.F files).withProvers (flashProveDescription.P files)
DefinitionA value of FlashProve's public readingJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:177
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 177–177

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

A value of FlashProve's public reading.

abbrev FlashReading (files : PublicFiles) : Type := (layoutsOfBuiltDescription flashProveData allZeroDigest [] files).D
DefinitionThe layout of FlashProve at a value of the public readingJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:180–183
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 180–183

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

The layout of FlashProve at a value of the public reading.

abbrev flashLayout (files : PublicFiles) (settings : Settings) (fallbackInstance : (flashProveDescription.C files).X)
(reading : FlashReading files) :
HashLayout (FlashProtocol files) (flashProveDescription.F files).annT (flashProveDescription.F files).annL :=
(flashProveWiring files settings fallbackInstance).layoutAtReading reading
DefinitionThe settings of FlashProveJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:202–208
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 202–208

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

The settings of FlashProve, for all public files, all values of the reading and any provers. There is one copy, numbered 0. The salts' prefixes, the search limits and the bits that follow a batch position's value are arguments of the definition. The prefix of a table's salts depends on the digest given by the reading.

def theSettings (files : PublicFiles) (settings : Settings) (fallbackInstance : (flashProveDescription.C files).X)
(provers : HonestProvers (FlashProtocol files)) (starts : SaltStarts provers)
(limits : SearchLimits) (slotSalts : RequestLeafSaltLayout) (reading : FlashReading files) :
CompiledSettings (flashLayout files settings fallbackInstance reading) provers :=
settingsOf (flashLayout files settings fallbackInstance reading) provers starts
(theLeafFiller files) limits 0 (fun _ => 0) slotSalts (baseCoinNumbers files slotSalts)
(slotSalts.tableStart ((layoutsOfBuiltDescription flashProveData allZeroDigest [] files).part reading))
DefinitionThe settings for any layout, given the salts' prefixesJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:130–153
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 130–153

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

The settings for any layout, given the salts' prefixes, the limits, the copies, the coin numbers and the public prefix of a table's salts. windowFiller has as many bits as the free part of a leaf's salt.

def settingsOf (layout : HashLayout L offlineRoundMarks linkRoundMarks)
(provers : HonestProvers L) (starts : SaltStarts provers) (leafFiller : layout.LeafBody)
(limits : SearchLimits) (furtherCopies : ℕ) (copyNumber : ℕ → ℕ) (slotSalts : RequestLeafSaltLayout)
(coins : CoinNums layout.LeafBody) (tableStart : Bits) : CompiledSettings layout provers where
leafFiller := leafFiller
searchLimitOffline := limits.offline
searchLimitLink := limits.link
searchLimitOnline := limits.online
furtherCopies := furtherCopies
copyNumber := copyNumber
RunValues := starts.RunValues
wellFormed := starts.wellFormed
runValuesOffline := starts.runValuesOffline
runValuesLink := starts.runValuesLink
runValuesOnline := starts.runValuesOnline
readOffline := starts.readOffline
readLink := starts.readLink
readOnline := starts.readOnline
saltStartOffline := starts.saltStartOffline
saltStartLink := starts.saltStartLink
saltStartOnline := starts.saltStartOnline
slotTail := slotSalts.tail
windowFiller := List.replicate coins.ℓ false
coinNumbers := { coins with pre₀ := tableStart }
DefinitionThe three search limitsJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:106–109
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 106–109

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

The three search limits: in round i a search may try limit(i) + 1 nonces.

structure SearchLimits where
offline : ℕ → ℕ
link : ℕ → ℕ
online : ℕ → ℕ
DefinitionThe search limits of FlashProveJohnson/CompletenessAndZeroKnowledge/OneHashByFirstBlockTestAtSettings.lean:29–30
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/OneHashByFirstBlockTestAtSettings.lean, lines 29–30

The search limits of FlashProve: 2 ^ (work + 6) tries in a round with work bits of proof of work.

def writtenLimits (files : PublicFiles) : SearchLimits :=
⟨capT (dataAtFiles flashProveData files), capL, capB (dataAtFiles flashProveData files)⟩
DefinitionThe bound on the honest committer's single sampled numberJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:216–222
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 216–222

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

The honest committer samples one number from 0 to this bound.

def theCoinBound (files : PublicFiles) (settings : Settings) (fallbackInstance : (flashProveDescription.C files).X)
(provers : HonestProvers (FlashProtocol files)) (starts : SaltStarts provers)
(limits : SearchLimits) (slotSalts : RequestLeafSaltLayout) : ℕ :=
coinsRange (honestSide (flashLayout files settings fallbackInstance
(baseReading files settings fallbackInstance)) provers
(theSettings files settings fallbackInstance provers starts limits slotSalts
(baseReading files settings fallbackInstance))).side - 1
The column budget · 2 cards
DefinitionThe proofs open no more columns of each table than its budgetJohnson/Face/FinalStatement.lean:312–319
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 312–319
Given

The proofs open no more columns of each table than its budget, the total number of its columns that may be read:

  • furtherCopies: the number of further copies
  • onlineRunsPerCopy: the number of runs of the online IOP on one copy
  • indexPrivacyNumbers onlineRunsPerCopy 0 0 0 0 0 0: the numbers of the next card; the six zeros are errors and measures, which this definition does not use
def TableBudgetFits (furtherCopies onlineRunsPerCopy : ℕ) : Prop :=
First table

on the first table, the bounds on the columns opened by the offline proof and by one link proof per copy: 62 + (furtherCopies + 1) · 62 is at most 44,040,191

(AtPublicFiles.Premises.indexPrivacyNumbers onlineRunsPerCopy 0 0 0 0 0 0).qT +
(furtherCopies + 1) * (AtPublicFiles.Premises.indexPrivacyNumbers onlineRunsPerCopy 0 0 0 0 0 0).qpar ≤
(AtPublicFiles.Premises.indexPrivacyNumbers onlineRunsPerCopy 0 0 0 0 0 0).b ∧
A copy

on a copy, the bounds on the columns opened by its link proof and by its online runs: 62 + onlineRunsPerCopy · 64 is at most 44,040,191

Of the links, only the one that made a copy has its columns counted on that copy.

(AtPublicFiles.Premises.indexPrivacyNumbers onlineRunsPerCopy 0 0 0 0 0 0).qch +
(AtPublicFiles.Premises.indexPrivacyNumbers onlineRunsPerCopy 0 0 0 0 0 0).s1 *
(AtPublicFiles.Premises.indexPrivacyNumbers onlineRunsPerCopy 0 0 0 0 0 0).qon ≤
(AtPublicFiles.Premises.indexPrivacyNumbers onlineRunsPerCopy 0 0 0 0 0 0).b
DefinitionThe limit on columns of one table, and the columns that each verifier readsE2E/PremisesAtFiles.lean:338–339
In words
In Lean · E2E/PremisesAtFiles.lean, lines 338–339

The numbers:

  • at most 44,040,191 columns of one table may be read in total
  • the offline IOP's verifier reads at most 62 columns, the link IOP's verifier at most 62 on the first table and at most 62 on the copy, and the online IOP's verifier at most 64 per request (proved for public files in scope: readsG_atFiles, one_atFiles)
  • no out-of-domain seed is excluded (the last field, the probability that a seed is outside the set that the theorem allows, is 0)
  • The arguments are the number of runs of the online IOP on one copy, the errors of the three simulators and three measures of the parts of the abort sets that may depend on the private input
def indexPrivacyNumbers (s1 : ℕ) (zT zL zO hT hL hO : ℝ≥0∞) : NumsW :=
⟨44040191, 62, 62, 62, 64, s1, zT, zL, zO, hT, hL, hO, 0⟩
The numbers · 3 cards
DefinitionThe maximum probability with which the honest committer and prover may failLadder.lean:239
In words
In Lean · Ladder.lean, lines 239–239

The honest committer and prover may fail with at most this probability. This allows for an honest proof-of-work search that aborts after a bounded number of attempts.

def completenessErrorBound : ℝ≥0∞ := (2 : ℝ≥0∞)⁻¹ ^ 40
DefinitionThe maximum number of hash queries that one run each of the honest sampler, committer and prover may make togetherLadder.lean:247
In words
In Lean · Ladder.lean, lines 247–247

The maximum number of hash queries that one run each of the honest sampler, committer and prover may make together. The value is a design choice.

  • RepliesFit imposes this bound, via WithinBudget, on the total for one run each of the sampler, the committer and the prover (one commitment and one request, not a batch)
  • in bindingErrorInQueries it accounts for one run of the committer
  • Statements of Ladder.lean that are not among the six theorems require it of commit and of D's own parser, for files in scope
  • Each query counts as one, regardless of its length; a typed query of the compiler counts as one query for each digest of its answer
def honestBudget : ℕ := 2 ^ 48
Definition2^64 hash queries, beyond which the zero-knowledge theorems give no boundLadder.lean:250
In words
In Lean · Ladder.lean, lines 250–250

2^64 hash queries. Beyond this number the zero-knowledge theorems give no bound. The statements of Ladder.lean with a constant upper bound on their error, which are not among the six theorems, say nothing about an adversary that makes more queries.

def queryBudget : ℕ := 2 ^ 64
FlashProve's parts · 4 cards
DefinitionFlashProve's layouts, and the instance used when no instance can be built from the requestJohnson/Face/FinalStatement.lean:103–106
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 103–106

FlashProve's value of CompilerWiring: the layouts as the committer and the prover read them, and the instance used when no instance can be built from the request.

def flashProveWiring (files : PublicFiles) (settings : Settings) (fallbackInstance : (flashProveDescription.C files).X) :
CompilerWiring (flashProvePublic files settings) :=
wiringOf flashProveDescription files settings (backThe files settings) allZeroDigest [] (layoutsOfBuiltDescription flashProveData allZeroDigest [] files)
Prod.mk (familyLaws_the files).eq fallbackInstance
DefinitionA CompilerWiring from a fall-back instance and a family of layouts that agrees with the description's inputJohnson/Face/Compiler.lean:433–442
In words
In Lean · Johnson/Face/Compiler.lean, lines 433–442

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}
variable (input : Compilable)

Constructs a CompilerWiring from a fall-back instance and a family of layouts that agrees with the description's input.

def wiringOf (D : Description) (Z : PublicFiles) (s : Settings) (idx : ModelWeights s → (D.C Z).I)
(c₀ : Digest) (m₀ : D.More) (T : LayoutsByPublicReading (D.input Z c₀ m₀)) (pair : Digest → D.More → T.D)
(agree : ∀ c m, T.at (pair c m) = D.input Z c m) (x₀ : (D.C Z).X) :
CompilerWiring (ofDescription D Z s idx) where
baseDigest := c₀
baseFurther := m₀
family := T
pair := pair
agree := agree
fallbackInstance := x₀
DefinitionThe writer of a proof as submittedJohnson/Face/FinalStatement.lean:123–125
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 123–125

The writer outputs a proof's files as they are stored on disk: five byte strings (kb, sb, leaf, seeds, pb) and the further tokens. If a proof string is missing, it outputs an empty form.

def bytesWriter (files : PublicFiles) :
TypedProof ((flashProveDescription.F files).withProvers (flashProveDescription.P files)) (flashProveDescription.F files).annT (flashProveDescription.F files).annL → flashProveDescription.Form :=
bytesWriterAt (FlashProve.dataAtFiles flashProveData files)
DefinitionThe proof format given by a writer and a parser of a descriptionJohnson/Face/Compiler.lean:445–448
In words
In Lean · Johnson/Face/Compiler.lean, lines 445–448

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}
variable (input : Compilable)

The proof format given by a writer and a parser of a description.

def formatOf (D : Description) (Z : PublicFiles) (Form : Type) (parse : Parser D Z Form)
(write : TypedProof ((D.F Z).withProvers (D.P Z)) (D.F Z).annT (D.F Z).annL → Form) :
ProofFormat ((D.F Z).withProvers (D.P Z)) (D.F Z).annT (D.F Z).annL :=
⟨Form, parse, write⟩
The three provers · 7 cards
DefinitionThe three honest provers, in the form used by the statements on the compiled argumentE2E/BridgePrivacy.lean:77–80
In words
In Lean · E2E/BridgePrivacy.lean, lines 77–80

the file's variables

variable {I X : Type} {lam : ℕ} {L : HolographicProtocol I X}

Puts the three provers into the structure ThreeProvers (folded section The three honest provers of the interactive protocol). The online prover is given as a family indexed by copy number, and is combined into one prover that reads the number.

def proversOf (hT : Honest L.offline (I × L.EncodingRandomness × L.OutOfDomainSeed))
(hL : Honest L.link (I × (L.EncodingRandomness × L.OutOfDomainSeed) × (L.EncodingRandomness × L.OutOfDomainSeed)))
(Fm : Family L.onlineBatch.loc (I × L.EncodingRandomness × L.OutOfDomainSeed)) : ThreeProvers L :=
⟨hT, hL, Fm.glue⟩
DefinitionThe matrices of the full-size shape over the extension fieldE2E/ObjectAtFiles.lean:126
In words
In Lean · E2E/ObjectAtFiles.lean, lines 126–126

The type of indices: the matrices of the full-size shape over the extension field.

abbrev FullSizeMatrix : Type := Cells (frS.toDecR frZ 402653181) numsRef
DefinitionAn honest prover of an IOPIop/InteractiveOracleProof.lean:62–73
In words
In Lean · Iop/InteractiveOracleProof.lean, lines 62–73

the file's variables

variable {X : Type} {E : ExtSpec}

An honest prover of an interactive oracle proof: its type of coins; the external strings associated with the private input; its strategy; the public part of its abort set, which depends only on the challenges; and the rest, which may depend on the private input and the instance.

structure Honest (Q : InteractiveOracleProof X E) (Wt : Type) where
Coin : Type
[finCoin : Fintype Coin]
[neCoin : Nonempty Coin]
/-- the external strings that belong to the private input -/
ext : Wt → E.Str
/-- its strategy; where it has no honest message it is meant to send fixed substitutes -/
strat : Wt → X → Coin → Strat Q.shape Unit
/-- the public part of the abort set: it depends on ρ only -/
Bad : Set (Rho Q.shape)
/-- the rest of the abort set, which may depend on the private input -/
Hid : Wt → X → Set (Rho Q.shape)
DefinitionAn honest prover of a batch IOPIop/Batch.lean:427–451
In words
In Lean · Iop/Batch.lean, lines 427–451

the file's variables

variable {X : Type} {E : ExtSpec}

The honest prover of a protocol with batch positions. A batch position is one entry of a batch (one request).

structure BatchHonestProver (Q : BatchInteractiveOracleProof X E) (Wt : Type) where
Coins

the shared part's coins

/-- the randomness of the shared part -/
Coin0 : Type

one batch position's coins

/-- the randomness of one slot -/
Coin : Type
[finCoin0 : Fintype Coin0]
[neCoin0 : Nonempty Coin0]
[finCoin : Fintype Coin]
[neCoin : Nonempty Coin]
External strings

the external strings

ext : Wt → E.Str
Strategies

the shared part's strategy

/-- m_0 from its inputs for the shared external oracles, the shared verifier messages and
randomness of its own -/
strat0 : Wt → Coin0 → SStrat Q.loc.shape Q.ann

one batch position's strategy

/-- m_j from these, x_j, the verifier messages of τ_j and the randomness of slot j; where it
cannot continue it is meant to send fixed substitutes -/
strat : Wt → Coin0 → X → Coin → LStrat Q.loc.shape Q.ann
Abort sets

the public abort set of one batch position

/-- the public bad set, a set of values of ρ_j -/
Bad : Set (RhoLo Q.loc.shape Q.ann)

the rest of the abort set of one batch position, which may depend on the private input and the instance

/-- the rest of the withheld set of a slot: Win(i, x_j), a set of values of ρ_j (as `Honest.Hid`,
Iop/InteractiveOracleProof.lean) -/
Hid : Wt → X → Set (RhoLo Q.loc.shape Q.ann)

a public test on the shared challenges; where it returns true, every batch position is withheld

/-- the public stop of the shared rounds: a test on the shared verifier messages ρ_0; where it
says true, every slot is withheld. (No default value: an honest side that forgot the field would
silently have no such stop.) -/
stop0 : RhoSh Q.loc.shape Q.ann → Bool
DefinitionA family of honest provers indexed by the copy numberE2E/HonestFamily.lean:40–47
In words
In Lean · E2E/HonestFamily.lean, lines 40–47

the file's variables

variable {Y : Type} {E : ExtSpec}

Like Iop.Honest, except that the external strings, the strategy and the rest of the abort set depend on the copy number; the type of coins and the public part of the abort set do not.

structure Family (Q : InteractiveOracleProof Y E) (Wt : Type) where
Coin : Type
[finCoin : Fintype Coin]
[neCoin : Nonempty Coin]
ext : ℕ → Wt → E.Str
strat : ℕ → Wt → Y → Coin → Strat Q.shape Unit
Bad : Set (Rho Q.shape)
Hid : ℕ → Wt → Y → Set (Rho Q.shape)
DefinitionProvers that send the fixed messagesOnBytes/Flat/Silent.lean:57–79
In words
In Lean · OnBytes/Flat/Silent.lean, lines 57–79

the file's variables

variable {C : ConfigurationWithOutOfDomainSample} (F : Files C)

Provers that send, in every round, the message fixed by the round's shape.

def fixedMessageProvers : F.Provers where
hT :=
{ Coin := Unit
ext := fun w => C.enc (C.hold w.1 w.2.1.1) w.2.1.2
strat := fun _ _ _ => OnBytes.Flat.silent _ ()
Bad := ∅
Hid := fun _ _ => ∅ }
hL :=
{ Coin := Unit
ext := fun w =>
(C.enc (C.hold w.1 w.2.1.1.1) w.2.1.1.2, C.enc (C.hold w.1 w.2.2.1.1) w.2.2.1.2)
strat := fun _ _ _ => OnBytes.Flat.silent _ ()
Bad := ∅
Hid := fun _ _ => ∅ }
hB :=
{ Coin0 := Unit
Coin := Unit
ext := fun w => C.enc (C.hold w.1 w.2.1.1) w.2.1.2
strat0 := fun _ _ => silent0 _ _
strat := fun _ _ _ _ => silentJ _ _
Bad := ∅
Hid := fun _ _ => ∅
stop0 := fun _ => false }
DefinitionThe same honest prover for every copy numberE2E/TheHonestProver.lean:67–75
In words
In Lean · E2E/TheHonestProver.lean, lines 67–75

The constant family: the given honest prover for every copy number.

def familyOf {Y Wt : Type} {E : ExtSpec} {protocol : InteractiveOracleProof Y E} (H : Honest protocol Wt) :
AtPublicFiles.Bridge.Family protocol Wt where
Coin := H.Coin
finCoin := H.finCoin
neCoin := H.neCoin
ext := fun _ => H.ext
strat := fun _ => H.strat
Bad := H.Bad
Hid := fun _ => H.Hid
The offline prover: the offline proof, on the committed table · 39 cards
DefinitionThe offline description's source, numbers and later places, from the three public filesE2E/TheHonestProver.lean:212–220
In words
In Lean · E2E/TheHonestProver.lean, lines 212–220

the file's variables

variable (files : PublicFiles)

Computes the offline IOP's description from the three public files, or returns an error, using the reader and the maker of that description.

def offlineDescription : Except String OfflineDescription := do
let read ←
VerifiableInference.PlanWritten.publicOfO OnBytes.secondHashFunction files.pol files.KL (some files.lay)
let made ←
VerifiableInference.Desc.Key.madeAt read files.lay VerifiableInference.Desc.Key.fixedDigest
let source ← VerifiableInference.Desc.Key.sourceOf made
let numbers ← VerifiableInference.Desc.Key.rangesNumbers made
let later ← VerifiableInference.Desc.Key.laterPlaces made
pure ⟨source, numbers, later⟩
DefinitionThe arguments from which the offline description is builtE2E/TheHonestProver.lean:205–208
In words
In Lean · E2E/TheHonestProver.lean, lines 205–208

the file's variables

variable (files : PublicFiles)

The arguments from which the offline IOP's description is built (those of keyFileDescription): source; numbers, the numbers of the place of the test on the ranges; later, the numbers of the places of the three later proximity tests.

structure OfflineDescription where
source : Source
numbers : H2U.PlaceNums
later : LaterPlaces
DefinitionThe offline IOP's description, given by the library's Key.descriptionFromSourceE2E/KeyProtocolOverDescription.lean:282–284
In words
In Lean · E2E/KeyProtocolOverDescription.lean, lines 282–284

The offline IOP's description: the verifier's protocol for the offline part, written as data.

abbrev keyFileDescription (X : VerifiableInference.Desc.Key.Source) (N : H2U.PlaceNums)
(P : VerifiableInference.Desc.Key.LaterPlaces) : FileDescription KeyInst :=
VerifiableInference.Desc.Key.descriptionFromSource X N P
DefinitionThe offline prover for a description, with the four proximity testsE2E/TheHonestProver.lean:255–258
In words
In Lean · E2E/TheHonestProver.lean, lines 255–258

the file's variables

variable (files : PublicFiles)
variable {files}

The offline prover for a description: keyProver applied to senders, with the four proximity tests set by withTests.

abbrev Parts.prover (parts : Parts files) (description : OfflineDescription) :=
AtPublicFiles.KeyFile.keyProver (AtPublicFiles.KeyLay.withTests parts.senders description.source description.numbers
description.later (offlineTestParametersOnU description.later) (offlineTestOnOmega description.later)
parts.rangeEntry parts.rangeGroups 0)
DefinitionThe offline IOP's honest prover, with each of its sides at its placeE2E/KeyProver.lean:123–140
In words
In Lean · E2E/KeyProver.lean, lines 123–140

the file's variables

variable {W₀ Rc X₀ X Wk : Type}

The offline prover, built from the fields of KeyParts.

def keyProver (K : KeyParts W₀ Rc X₀ X Wk) : Prover W₀ Rc KeyInst OnBytes.TableKey Unit X₀ X where
stored := K.stored
trace := fun _ _ => some ()
key := fun x => x.key
inRange := K.inRange
dummy := K.dummy
own₀ := K.own₀
ownShared₀ := K.ownShared₀
First chain

the first chain: the index-mask message, the multiplicities, two lookups, the test on the ranges, the batching, the message W

first :=
[K1.proverSideOfSending K.idx, K1.proverSideOfSending K.msg,
K3.proverSideOfLookupInChain (K3.keyOwners K.look0.face) K.reads K.jobs0 K.wit K.look0,
K3.proverSideOfLookupInChain (K3.keyOwners K.look1.face) K.reads K.jobs1 K.wit K.look1, K.rng,
K13.proverSideOfClaimCombination K.weights K.pile K.batt, K1.proverSideOfSending K.w]
Shared chain

the shared chain: its own rounds and two oracle messages, then two proximity tests

shared :=
sharedChainProverSidesInOrder (K14.proverSidesOfSharedRounds K.lin K.weights) (K14.proverSidesOfSharedSendings K.send K.weights fun c => randK14 (K.rand c))
++ [K.onU, K.onOmega]
Second chain

the second chain: one proximity test

second := [K.own]

what the second chain's sides are given at their start

meet := K.meet
Remark

In these folded sections the chains are named after their Lean fields first, shared and second. These are chains 1, 2 and 3 of the table of terms, so "the second chain" here is the table's third chain.

In a Lean name, K followed by a number denotes a kind of sub-protocol; the fifteen kinds are listed below in this appendix. The kinds here are oracle message with out-of-domain sample (K1; a "sending" in Lean names), product-tree lookup argument (K3), proximity test with linear constraints (K12), committed-table claim merge (K13; "the batching" in these folded sections) and committed-table claim reduction (K14; the shared chain's own rounds in these folded sections). The two sub-protocols of K14.proverSidesOfSharedSendings are of kind K1.

DefinitionThe twenty-five fields of the offline proverE2E/KeyProver.lean:75–111
In words
In Lean · E2E/KeyProver.lean, lines 75–111

The offline prover's arguments: 25 fields, among them the stored table's columns, the readers, the oracle messages, the lookups, the proximity tests, the batching and the shared chain's data.

structure KeyParts (W₀ Rc X₀ X Wk : Type) where
/-- the stored table's columns -/
stored : W₀ → Rc → Nat → Nat → Option (List Cb.Gl.F)
inRange : W₀ → Bool
dummy : W₀
own₀ : X
ownShared₀ : X₀
meet : X → State (In2 W₀ Rc) X₀ → X
/-- the index's reader -/
weights : W₀ → Weights
/-- the reader of the committer's coins -/
rand : Rc → TableRand
/-- the three sendings of the first chain -/
idx : K1.SendJob (In1 W₀ Rc) X
msg : K1.SendJob (In1 W₀ Rc) X
w : K1.SendJob (In1 W₀ Rc) X
/-- the two lookups: one reader of points; each lookup has a job of its own, because the two have
different faces and a job sees no face -/
reads : K3.Reads
jobs0 : K3.LookJobs Wk
jobs1 : K3.LookJobs Wk
wit : In1 W₀ Rc → Wk
look0 : K3.At
look1 : K3.At
/-- the proximity test on the ranges' group: A LETTER -/
rng : Placed (In1 W₀ Rc) (In1 W₀ Rc) X
/-- the batching -/
pile : K13.PileOf KeyInst
batt : VerifiableInference.Desc.K13.Where
/-- the shared chain's own rounds and its two sendings -/
lin : K14.Data
send : K14.SendPub
/-- the two proximity tests of the shared chain: LETTERS -/
onU : Placed Empty (In2 W₀ Rc) X₀
onOmega : Placed Empty (In2 W₀ Rc) X₀
/-- the proximity test of the second chain: A LETTER -/
own : Placed (In1 W₀ Rc) (In1 W₀ Rc) X
DefinitionThe prover's sides of the shared chain, in the order of their placesE2E/KeyProver.lean:117–120
In words
In Lean · E2E/KeyProver.lean, lines 117–120

the file's variables

variable {W₀ Rc X₀ X Wk : Type}

Arranges the sides of the shared chain's own rounds and of its two oracle messages in the order of their places; if the first list has fewer than two members or the second does not have exactly two, it concatenates them.

def sharedChainProverSidesInOrder (own send : List (Placed Empty (In2 W₀ Rc) X₀)) : List (Placed Empty (In2 W₀ Rc) X₀) :=
match own, send with
| p1 :: p4 :: rest, [s2, s5] => p1 :: s2 :: p4 :: s5 :: rest
| a, b => a ++ b
DefinitionThe offline prover's arguments with the four proximity tests in placeE2E/TheHonestProver.lean:94–100
In words
In Lean · E2E/TheHonestProver.lean, lines 94–100

the file's variables

variable {W₀ Rc X₀ X Wk : Type}

Sets the four proximity tests in senders: the test on the ranges, the tests on the groups U and Omega, and the test of the second chain.

def withTests (senders : KeyParts W₀ Rc X₀ X Wk) (source : Source) (numbers : H2U.PlaceNums)
(later : LaterPlaces) (placeU placeOmega : P12) (entry : Local W₀ Rc Xi Unit → Nat → Nat → GF)
(groups : List (List Nat)) (first : Nat) : KeyParts W₀ Rc X₀ X Wk :=
{ withTestsOnUAndOmega senders placeU placeOmega with
rng := proverSideOfProximityTest (rangesTestJob source numbers later entry groups first)
own := proverSideOfGuardedSending source numbers later senders.idx senders.w senders.send id
(askOf senders.send (fun w => senders.weights w.w₀) fun w => randK14 (senders.rand w.rc)) }
DefinitionThe data of the offline prover's proximity test on the rangesE2E/KeyRangesJob.lean:146–147
In words
In Lean · E2E/KeyRangesJob.lean, lines 146–147

the file's variables

variable {W₀ Rc X' : Type} (Xs : VerifiableInference.Desc.Key.Source) (N : H2U.PlaceNums)
(Pl : VerifiableInference.Desc.Key.LaterPlaces)
(entry : Local W₀ Rc Xi Unit → Nat → Nat → GF) (groups : List (List Nat)) (first : Nat)

The data of the offline prover's proximity test on the ranges: its parameters, what has been sent, and the state on entry.

def rangesTestJob : TestJob (Local W₀ Rc Xi Unit) X' :=
jobOne (rangesParams N) (sentRanges Xs entry groups first) (recRanges Xs N Pl)
DefinitionThe offline prover's side for the proximity test of the second chain, under a guardE2E/KeyProverSideOfOwnTest.lean:89–93
In words
In Lean · E2E/KeyProverSideOfOwnTest.lean, lines 89–93

the file's variables

variable {W₀ Rc Tr Y Wd : Type}

The offline prover's proximity test of the second chain, as a side, with a guard: each move returns an error if the field for the opened columns is absent (none).

def proverSideOfGuardedSending {V : Type} (X : Source) (N : H2U.PlaceNums) (Pl : LaterPlaces)
(JI JW : ProofFile.Honest.K1.SendJob Wd Y) (A : SendPub) (lift : Local W₀ Rc Xi Tr → Wd)
(ask : Local W₀ Rc Xi Tr → Ask) : Placed V (Local W₀ Rc Xi Tr) Y :=
(proverSideOfProximityTest (jobKWAt X N Pl JI JW A lift ask).toRun.toTest :
Placed V (Local W₀ Rc Xi Tr) Y).needsField
DefinitionThe offline prover's arguments with the two tests of the shared chain in placeE2E/KeyPartsHalves.lean:74–75
In words
In Lean · E2E/KeyPartsHalves.lean, lines 74–75

the file's variables

variable {W₀ Rc X₀ X Wk : Type}

Sets the fields onU and onOmega: the two tests of the shared chain.

def withTestsOnUAndOmega (K : KeyParts W₀ Rc X₀ X Wk) (pU pO : P12) : KeyParts W₀ Rc X₀ X Wk :=
{ K with onU := onUOf K pU, onOmega := onOmegaOf K pU pO }
DefinitionThe offline prover's side for the test on the group UE2E/KeyHalves.lean:94–98
In words
In Lean · E2E/KeyHalves.lean, lines 94–98

the file's variables

variable {W₀ Rc X : Type}

The offline prover's test on the group U, as a side.

def proverSideOfTestOnU (A : SendPub) (pU : P12) (bs : List (Block St Unit))
(st : W₀ → Rc → ℕ → ℕ → Option (List UInt64))
(weights : Common W₀ Rc TableKey → Weights) (rand : Common W₀ Rc TableKey → TableRand) :
Placed Empty (Common W₀ Rc TableKey) X :=
proverSideOfProximityTest (jobKU A pU bs st weights rand).toRun.toTest
DefinitionThe offline prover's side for the test on the group Omega, under a guardE2E/KeyHalves.lean:103–107
In words
In Lean · E2E/KeyHalves.lean, lines 103–107

the file's variables

variable {W₀ Rc X : Type}

The offline prover's test on the group Omega, as a side, with a guard: each move returns an error if the field for the opened columns is absent (none).

def proverSideOfTestOnOmega (A : SendPub) (pU pO : P12) (bs : List (Block St Unit))
(weights : Common W₀ Rc TableKey → Weights) (rand : Common W₀ Rc TableKey → TableRand) :
Placed Empty (Common W₀ Rc TableKey) X :=
(proverSideOfProximityTest (jobKO A pU pO bs weights rand).toRun.toTest :
Placed Empty (Common W₀ Rc TableKey) X).needsField
DefinitionThe parameters of the offline prover's test on the group UE2E/TheHonestProver.lean:229
In words
In Lean · E2E/TheHonestProver.lean, lines 229–229

the file's variables

variable (files : PublicFiles)

The parameters of the offline prover's test on the group U, at its place in the shared chain.

def offlineTestParametersOnU (later : LaterPlaces) : P12 := H2U.proximityTestParametersAt ⟨2, none, 9, .K12⟩ later.U
DefinitionThe parameters of the offline prover's test on the group OmegaE2E/TheHonestProver.lean:233–234
In words
In Lean · E2E/TheHonestProver.lean, lines 233–234

the file's variables

variable (files : PublicFiles)

The parameters of the offline prover's test on the group Omega, at its place in the shared chain, computed from the description's numbers for Omega, or from U's numbers if the description has none.

def offlineTestOnOmega (later : LaterPlaces) : P12 :=
H2U.proximityTestParametersAt ⟨2, none, 10, .K12⟩ (later.O.getD later.U)
DefinitionThe parameters of a proximity test at a placeJohnson/Desc/K12/AtPlan.lean:43–49
In words
In Lean · Johnson/Desc/K12/AtPlan.lean, lines 43–49

The numbers of a proximity test at a place, as the verifier's description reads them (P12: a proximity test's parameters). If the place's chain differs from the chain of the numbers, or the numbers yield no rounds, the value is noP12 at that place, in which all other numbers are 0, all lists are empty and both flags are false.

def proximityTestParametersAt (place : Place) (x : PlaceNums) : P12 :=
if place.chain != x.chain then noP12 place else
match testOracles5 x.nums x.firstGroup with
| some os =>
{ place := place, nums := x.nums, idx := x.idx, oracles := os,
before := beforeOf x.chain x.nums, answers := x.answers, early := x.early }
| none => noP12 place
DefinitionThe offline prover's arguments for a descriptionE2E/KeyArgumentsAt.lean:112–119
In words
In Lean · E2E/KeyArgumentsAt.lean, lines 112–119

the file's variables

variable {files : PublicFiles}

The value of KeyParts for a description: withSendingsAndLookups and then withStoredColumnsAndPlan, applied to the fixed value fixedKeyParts. These two and withTests, which is applied to this value later, overwrite all 25 fields.

def offlineSenders (description : OfflineDescription) :
KeyParts FullSizeMatrix (protocolAtFiles files).EncodingRandomness Unit Unit WitK :=
withStoredColumnsAndPlan description.source description.later
(withSendingsAndLookups
(fixedKeyParts (faceAt description.source 0) (keyBatt description.source) matrixInput.dummy () ()
idleRecord)
description.source description.numbers matrixReader matrixInput.inRange matrixInput.dummy)
matrixReader (tableCoins files)
DefinitionSixteen of the offline prover's fieldsE2E/KeyFifteen.lean:39–57
In words
In Lean · E2E/KeyFifteen.lean, lines 39–57

the file's variables

variable {W₀ Rc : Type}

Sets sixteen fields of KeyParts: the range test and its named index, the state passed on, the three oracle messages of the first chain, the two lookups with their data and witness, and the batching.

def withSendingsAndLookups (K' : KeyParts W₀ Rc Unit Unit WitK) (Xs : Source) (N : H2U.PlaceNums)
(f : W₀ → Weights) (inR : W₀ → Bool) (d : W₀) : KeyParts W₀ Rc Unit Unit WitK :=
{ K' with
inRange := inR
dummy := d
own₀ := ()
ownShared₀ := ()
meet := fun a _ => a
idx := indexMaskSending Xs
msg := multiplicitiesSending f Xs
w := batchedRowsSending f Xs N
reads := keyReads
jobs0 := keyJobs0 Xs
jobs1 := keyJobs1 Xs
wit := keyWit f Xs
look0 := lookOf Xs N 0
look1 := lookOf Xs N 1
pile := constraintRowsAtClaimPoints Xs N
batt := keyBatt Xs }
DefinitionThe data for sending the index-mask messageE2E/KeyFirstSends.lean:89–90
In words
In Lean · E2E/KeyFirstSends.lean, lines 89–90

the file's variables

variable {W₀ Rc X : Type}

The data for sending the index-mask message, which has no main row and contains only coins.

def indexMaskSending (Xs : Source) : SendJob (In1 W₀ Rc) X :=
idxJob (oneOf Xs) pieces (groupsTold Xs.Y.told.1 0 (rootsAt Xs.Y.D.1 0)) 0
DefinitionThe data for sending the multiplicities messageE2E/KeyFirstSends.lean:98–99
In words
In Lean · E2E/KeyFirstSends.lean, lines 98–99

the file's variables

variable {W₀ Rc X : Type}

The data for sending the multiplicities message: the bits of the number of times each row of each table occurs in the matrix. It reads the index.

def multiplicitiesSending (f : W₀ → Weights) (Xs : Source) : SendJob (In1 W₀ Rc) X :=
msgJob (matrixEntryOf f) (oneOf Xs) pieces (multiplicitiesGroups Xs) 1 rideMsg
DefinitionThe data for sending the message WE2E/KeyFirstSends.lean:111–115
In words
In Lean · E2E/KeyFirstSends.lean, lines 111–115

the file's variables

variable {W₀ Rc X : Type}

The data for sending the message W: the batching weights on the matrix's rows, times the matrix. It reads the index and the challenges received. If the shape has no message W, indexMaskSending is used instead.

def batchedRowsSending (f : W₀ → Weights) (Xs : Source) (N : H2U.PlaceNums) : SendJob (In1 W₀ Rc) X :=
(wJob (matrixEntryOf f) (oneOf Xs) pieces
(groupsTold Xs.Y.told.1 (rootsBefore Xs.Y.D.1 (lastSendRound Xs.Y.D.1))
(rootsAt Xs.Y.D.1 (lastSendRound Xs.Y.D.1)))
(firstW Xs) rideW (keyPoints Xs N) (battAt Xs N)).getD (indexMaskSending Xs)
DefinitionThe rows that the batching combinesE2E/KeyFirstSends.lean:119–120
In words
In Lean · E2E/KeyFirstSends.lean, lines 119–120

the file's variables

variable {W₀ Rc X : Type}

The rows on the matrix at the claims' points, which the batching combines. Their masks and targets are not the verifier's.

def constraintRowsAtClaimPoints (Xs : Source) (N : H2U.PlaceNums) : ProofFile.Honest.K13.PileOf KeyInst :=
fun _ ds => pileOf (Wf.matrixOf (oneOf Xs).lin) (oneOf Xs).ranges.lookups (keyPoints Xs N ds)
DefinitionFive more fields of the offline prover's argumentsE2E/KeyArgumentsAt.lean:68–78
In words
In Lean · E2E/KeyArgumentsAt.lean, lines 68–78

the file's variables

variable {Index Coins SharedState OwnState LookupInput : Type}

Sets five more fields. The stored table's columns are given by storedColumn: the encoding of the index's rows under the committer's coins, at sizes read from the public chains. The index's reader and the committer's coins are arguments; the coins are read at item 0. The public parameters of the shared chain's rounds and oracle messages (the fields lin and send) are computed from public data alone (parKey).

def withStoredColumnsAndPlan (source : Source) (later : LaterPlaces)
(senders : KeyParts Index Coins SharedState OwnState LookupInput)
(weights : Index → Weights) (coins : Coins → Nat → TableRand) :
KeyParts Index Coins SharedState OwnState LookupInput :=
{ senders with
stored := fun index coin item position =>
storedColumn source.chains (weights index) (coins coin) item position
weights := weights
rand := fun coin => coins coin 0
lin := planData (parKey source later)
send := ⟨parKey source later, 0⟩ }
DefinitionA column of the stored tableE2E/KeyArgumentsAt.lean:58–65
In words
In Lean · E2E/KeyArgumentsAt.lean, lines 58–65

the file's variables

variable {Index Coins SharedState OwnState LookupInput : Type}

A column of the stored table: at item 0, if the rows fit and the position is below the code's length 2^a, the encoding of the index's rows at the given position; otherwise nothing.

def storedColumn (chains : Chains) (weights : Weights) (coins : Nat → TableRand) (item position : Nat) :
Option (List Cb.Gl.F) :=
if item = 0 ∧ rowsFit (shapeOfIndex chains.made.sized.key.once.shape.fold.index)
chains.made.sized.key.once.shape.kLo chains.made.sized.key.once.shape.matrixRows = true then
encAt (shapeOfIndex chains.made.sized.key.once.shape.fold.index)
(entryAtF chains.made.sized.key.once.shape.kLo chains.made.sized.key.once.shape.matrixRows
(shapeOfIndex chains.made.sized.key.once.shape.fold.index).v weights.entry) (coins 0) position
else none
DefinitionThe index's readerE2E/KeyArgumentsAt.lean:99
In words
In Lean · E2E/KeyArgumentsAt.lean, lines 99–99

The index's reader: the weights are the first coordinates of the matrix's cells, and 0 outside its shape.

def matrixReader : FullSizeMatrix → Weights := fun matrix => ⟨AtPublicFiles.Key.cellsReader matrix⟩
DefinitionThe matrix read from a side's inputE2E/KeyFirstSends.lean:56
In words
In Lean · E2E/KeyFirstSends.lean, lines 56–56

the file's variables

variable {W₀ Rc X : Type}

The matrix read from a side's input.

def matrixEntryOf (f : W₀ → Weights) : In1 W₀ Rc → Nat → Nat → GF := fun t => (f t.w₀).entry
DefinitionThe groups of the multiplicities messageE2E/KeyFirstSends.lean:93–94
In words
In Lean · E2E/KeyFirstSends.lean, lines 93–94

the file's variables

variable {W₀ Rc X : Type}

The groups of the multiplicities message.

def multiplicitiesGroups (Xs : Source) : List (List Nat) :=
groupsTold Xs.Y.told.1 (rootsBefore Xs.Y.D.1 2) (rootsAt Xs.Y.D.1 2)
DefinitionThe offline prover's coin counts, at the written sizesE2E/KeyArgumentsAt.lean:93–96
In words
In Lean · E2E/KeyArgumentsAt.lean, lines 93–96

The offline prover's coin counts at the written sizes: the number of coins of each part. The value is empty if the public data at those sizes are not constructed.

def offlineProverCoinCounts : ProverCoinCounts :=
match fullPub with
| some publicData => keyBook publicData
| none => ⟨[], [], [], [], []⟩
DefinitionArguments that no prover readsE2E/KeyArgumentsAt.lean:133–135
In words
In Lean · E2E/KeyArgumentsAt.lean, lines 133–135

the file's variables

variable {files : PublicFiles}

The value of KeyParts for public files that yield no description, built with fixedKeyParts.

def fallbackSenders : KeyParts FullSizeMatrix (protocolAtFiles files).EncodingRandomness Unit Unit WitK :=
fixedKeyParts (VerifiableInference.Desc.K3.faceOfLkp default) AtPublicFiles.KeyPartsIdle.idleWhere
matrixInput.dummy () () idleRecord
DefinitionA fixed value of KeyPartsE2E/KeyPartsIdle.lean:55–81
In words
In Lean · E2E/KeyPartsIdle.lean, lines 55–81

the file's variables

variable {W₀ Rc X₀ X Wk : Type}

A value of KeyParts with fixed fields, built from its six arguments.

def fixedKeyParts (fc : VerifiableInference.Desc.K3.Face) (wh : VerifiableInference.Desc.K13.Where)
(d : W₀) (x₀ : X₀) (x : X) (wk : Wk) : KeyParts W₀ Rc X₀ X Wk where
stored := fun _ _ _ _ => none
inRange := fun _ => true
dummy := d
own₀ := x
ownShared₀ := x₀
meet := fun a _ => a
weights := fun _ => ⟨fun _ _ => 0⟩
rand := fun _ => ⟨fun _ _ => 0, fun _ _ => 0⟩
idx := idleSend
msg := idleSend
w := idleSend
reads := ⟨fun _ _ _ => idlePts, fun _ _ _ => []⟩
jobs0 := ⟨fun _ => ⟨fun _ _ _ => [], fun _ _ _ _ => [], fun _ _ _ => []⟩⟩
jobs1 := ⟨fun _ => ⟨fun _ _ _ => [], fun _ _ _ _ => [], fun _ _ _ => []⟩⟩
wit := fun _ => wk
look0 := ⟨⟨1, some 0, 2, .K3⟩, fc, 0⟩
look1 := ⟨⟨1, some 1, 2, .K3⟩, fc, 0⟩
rng := ⟨rngPlace, []⟩
pile := fun _ _ => []
batt := wh
lin := ⟨QK.S, 0, 6⟩
send := ⟨QK, 0⟩
onU := ⟨foldedTestPlace, []⟩
onOmega := ⟨omegaTestPlace, []⟩
own := ⟨ownTestPlace, []⟩
DefinitionThe offline prover, with the encoder's tableE2E/BridgePremWKey.lean:149–152
In words
In Lean · E2E/BridgePremWKey.lean, lines 149–152

the file's variables

variable (Z : PublicFiles) (Zp : ProofFile.Pub) (Np : H2U.Places4) (cF : Chain TS ProofFile.Cl)
{R₂ R₃ : Type} [Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃] (run₂ : R₂ → ByteArray)
(run₃ : R₃ → ByteArray) {Tr X₀ Xh : Type} (B : ProverCoinCounts)
(G : Sides (descZ Zp Np cF) B FullSizeMatrix (protocolAtFiles Z).EncodingRandomness TableKey Tr X₀ Xh)
(H : Prover FullSizeMatrix (protocolAtFiles Z).EncodingRandomness ProofFile.Inst TableKey Tr X₀ Xh)
(Fx : FileDescription KeyInst) {TrT X₀T XT Q₂ Q₃ : Type} (BT : ProverCoinCounts) [Fintype Q₂] [Nonempty Q₂]
[Fintype Q₃] [Inhabited Q₃]
(HT : Prover (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) KeyInst TableKey TrT X₀T XT)
(val₂ : Q₂ → ByteArray) (val₃ : Q₃ → ByteArray) (shT : TableKey → Fx.S₂)

The offline prover as an honest prover of the IOP offline at the public files, with its KeyAndJoiningRoundMessages and the encoder's table.

abbrev offlineProverWithEncodedTable :=
offlineProverInThreeProtocols Z Fx BT HT (keySeam (dataAtFiles flashProveData Z).A (relationsAndEncodingOfClaims _ (dataAtFiles flashProveData Z).E) val₂ val₃) shT
(tableOf (dataAtFiles flashProveData Z).A (relationsAndEncodingOfClaims _ (dataAtFiles flashProveData Z).E) (dataAtFiles flashProveData Z).DK)
(dataAtFiles flashProveData Z).P
DefinitionThe offline prover, with the type of the first prover of the protocol structure, for every PE2E/KeyHonest.lean:489–492
In words
In Lean · E2E/KeyHonest.lean, lines 489–492

the file's variables

variable (Z : PublicFiles) (Fx : FileDescription KeyInst) {Ky Tr X₀ X' R₂ R₃ : Type} (B : ProverCoinCounts)
(H : Prover (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) KeyInst Ky Tr X₀ X')
[Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃]
(J : R₂ → R₃ → KeyAndJoiningRoundMessages (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) (Cz Z).Seed KeyInst Ky
(OnBytes.Maker.FrontMsg (List OnBytes.E)) (Compile.Joined.JoinMsg (List OnBytes.E) ByteArray)
ByteArray)
(sh : Ky → Fx.S₂)
(ext : (Cz Z).I × ((Cz Z).Pad × (Cz Z).Rnd) × (Cz Z).Seed →
(Iop.oneExternalString (2 ^ ((dataAtFiles flashProveData Z).DK.at frS.P.T.a).a) _root_.Run.PQ.SgX).Str)

offlineProverAtFilesDecision, with the type of the first prover of the protocol structure.

def offlineProverInThreeProtocols (P : (filesAt Z).Provers) :
Honest ((filesAt Z).withProvers P).offline
((Cz Z).I × ((filesAt Z).withProvers P).EncodingRandomness × ((filesAt Z).withProvers P).OutOfDomainSeed) :=
offlineProverAtFilesDecision Z Fx B H J sh ext
DefinitionThe offline prover, with the type of an honest prover of the offline IOP at the public filesE2E/KeyHonest.lean:464–468
In words
In Lean · E2E/KeyHonest.lean, lines 464–468

the file's variables

variable (Z : PublicFiles) (Fx : FileDescription KeyInst) {Ky Tr X₀ X' R₂ R₃ : Type} (B : ProverCoinCounts)
(H : Prover (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) KeyInst Ky Tr X₀ X')
[Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃]
(J : R₂ → R₃ → KeyAndJoiningRoundMessages (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) (Cz Z).Seed KeyInst Ky
(OnBytes.Maker.FrontMsg (List OnBytes.E)) (Compile.Joined.JoinMsg (List OnBytes.E) ByteArray)
ByteArray)
(sh : Ky → Fx.S₂)
(ext : (Cz Z).I × ((Cz Z).Pad × (Cz Z).Rnd) × (Cz Z).Seed →
(Iop.oneExternalString (2 ^ ((dataAtFiles flashProveData Z).DK.at frS.P.T.a).a) _root_.Run.PQ.SgX).Str)

offlineOneInstanceProverAtFiles, with the type of an honest prover of the offline IOP at the public files.

def offlineProverAtFilesDecision : Honest (filesAt Z).key ((Cz Z).I × ((Cz Z).Pad × (Cz Z).Rnd) × (Cz Z).Seed) :=
atDecision (ckP .two) ((dataAtFiles flashProveData Z).DK.at frS.P.T.a)
(OnBytes.Flat.front₀ (dataAtFiles flashProveData Z).G.rec₀) (OnBytes.Flat.join₀ (dataAtFiles flashProveData Z).G.rec₀)
ByteArray.empty (fun x : RecFull => silKey (keyInstanceOfOutOfDomainSample x)) OnBytes.Flat.silK (Fx.pull keyInstanceOfOutOfDomainSample).run
(dataAtFiles flashProveData Z).runK (offlineOneInstanceProverAtFiles Z Fx B H J sh ext)
DefinitionThe offline IOP's single-run prover at the public files, over a descriptionE2E/KeyHonest.lean:457–459
In words
In Lean · E2E/KeyHonest.lean, lines 457–459

the file's variables

variable (Z : PublicFiles) (Fx : FileDescription KeyInst) {Ky Tr X₀ X' R₂ R₃ : Type} (B : ProverCoinCounts)
(H : Prover (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) KeyInst Ky Tr X₀ X')
[Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃]
(J : R₂ → R₃ → KeyAndJoiningRoundMessages (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) (Cz Z).Seed KeyInst Ky
(OnBytes.Maker.FrontMsg (List OnBytes.E)) (Compile.Joined.JoinMsg (List OnBytes.E) ByteArray)
ByteArray)
(sh : Ky → Fx.S₂)
(ext : (Cz Z).I × ((Cz Z).Pad × (Cz Z).Rnd) × (Cz Z).Seed →
(Iop.oneExternalString (2 ^ ((dataAtFiles flashProveData Z).DK.at frS.P.T.a).a) _root_.Run.PQ.SgX).Str)

offlineOneInstanceProver at the public files.

abbrev offlineOneInstanceProverAtFiles :=
offlineOneInstanceProver (dataAtFiles flashProveData Z).A (relationsAndEncodingOfClaims _ (dataAtFiles flashProveData Z).E) (dataAtFiles flashProveData Z).DK Fx
(dataAtFiles flashProveData Z).G.rec₀ B H J sh ext
DefinitionThe offline IOP's single-run prover (of offlineBatchProver), with its instances pulled back along keyInstanceOfOutOfDomainSampleE2E/KeyHonest.lean:205–209
In words
In Lean · E2E/KeyHonest.lean, lines 205–209

the file's variables

variable {X : Type} (A : (frS.toDecR frZ 402653181).Claims X)
(R : (frS.toDecR frZ 402653181).RelationsAndEncoding A) (DK DP : WholeD) (Fx : FileDescription KeyInst)
(runP : X × RecFull → View → View → View → Bool)
(ds : List TypedOracleCompiler.Run.PQ.RD) (xs : List XO) (dec : RecFull × RecFull → View → Bool)
(rK rP : RecFull) (depthReq : ℕ) (early : X → X) (salt : ℕ)
{Ky Tr X₀ X' R₂ R₃ : Type} (B : ProverCoinCounts)
(H : Prover (DecR.configurationOfStoredTable A R).I ((DecR.configurationOfStoredTable A R).Pad × (DecR.configurationOfStoredTable A R).Rnd) KeyInst Ky Tr X₀ X')
[Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃]
(J : R₂ → R₃ → KeyAndJoiningRoundMessages (DecR.configurationOfStoredTable A R).I ((DecR.configurationOfStoredTable A R).Pad × (DecR.configurationOfStoredTable A R).Rnd)
(DecR.configurationOfStoredTable A R).Seed KeyInst Ky (OnBytes.Maker.FrontMsg (List OnBytes.E))
(Compile.Joined.JoinMsg (List OnBytes.E) ByteArray) ByteArray)
(sh : Ky → Fx.S₂)
(ext : (DecR.configurationOfStoredTable A R).I × ((DecR.configurationOfStoredTable A R).Pad × (DecR.configurationOfStoredTable A R).Rnd) × (DecR.configurationOfStoredTable A R).Seed →
(Iop.oneExternalString (2 ^ (DK.at frS.P.T.a).a) _root_.Run.PQ.SgX).Str)

The single-run prover of offlineBatchProver with its instances pulled back along keyInstanceOfOutOfDomainSample.

def offlineOneInstanceProver :
Honest (reductionOfWholeFile (ckP .two) (DK.at frS.P.T.a) (OnBytes.Flat.front₀ rK) (OnBytes.Flat.join₀ rK)
ByteArray.empty (fun x : RecFull => silKey (keyInstanceOfOutOfDomainSample x)) (Fx.pull keyInstanceOfOutOfDomainSample).run).toInteractiveOracleProof
((DecR.configurationOfStoredTable A R).I × ((DecR.configurationOfStoredTable A R).Pad × (DecR.configurationOfStoredTable A R).Rnd) × (DecR.configurationOfStoredTable A R).Seed) :=
((offlineBatchProver A R DK Fx rK B H J sh ext).comap keyInstanceOfOutOfDomainSample id).one
DefinitionThe honest batch prover (honestBatchProverOfFile) over the offline IOP's description, at the description's own instance typeE2E/KeyHonest.lean:196–200
In words
In Lean · E2E/KeyHonest.lean, lines 196–200

the file's variables

variable {X : Type} (A : (frS.toDecR frZ 402653181).Claims X)
(R : (frS.toDecR frZ 402653181).RelationsAndEncoding A) (DK DP : WholeD) (Fx : FileDescription KeyInst)
(runP : X × RecFull → View → View → View → Bool)
(ds : List TypedOracleCompiler.Run.PQ.RD) (xs : List XO) (dec : RecFull × RecFull → View → Bool)
(rK rP : RecFull) (depthReq : ℕ) (early : X → X) (salt : ℕ)
{Ky Tr X₀ X' R₂ R₃ : Type} (B : ProverCoinCounts)
(H : Prover (DecR.configurationOfStoredTable A R).I ((DecR.configurationOfStoredTable A R).Pad × (DecR.configurationOfStoredTable A R).Rnd) KeyInst Ky Tr X₀ X')
[Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃]
(J : R₂ → R₃ → KeyAndJoiningRoundMessages (DecR.configurationOfStoredTable A R).I ((DecR.configurationOfStoredTable A R).Pad × (DecR.configurationOfStoredTable A R).Rnd)
(DecR.configurationOfStoredTable A R).Seed KeyInst Ky (OnBytes.Maker.FrontMsg (List OnBytes.E))
(Compile.Joined.JoinMsg (List OnBytes.E) ByteArray) ByteArray)
(sh : Ky → Fx.S₂)
(ext : (DecR.configurationOfStoredTable A R).I × ((DecR.configurationOfStoredTable A R).Pad × (DecR.configurationOfStoredTable A R).Rnd) × (DecR.configurationOfStoredTable A R).Seed →
(Iop.oneExternalString (2 ^ (DK.at frS.P.T.a).a) _root_.Run.PQ.SgX).Str)

honestBatchProverOfFile over the offline IOP's description.

abbrev offlineBatchProver :
BatchHonestProver (keyOverOwn DK Fx rK)
((DecR.configurationOfStoredTable A R).I × ((DecR.configurationOfStoredTable A R).Pad × (DecR.configurationOfStoredTable A R).Rnd) × (DecR.configurationOfStoredTable A R).Seed) :=
honestBatchProverOfFile (ckP .two) (DK.at frS.P.T.a) (OnBytes.Flat.front₀ rK) (OnBytes.Flat.join₀ rK)
ByteArray.empty Fx silKey B H J sh ext
DefinitionThe first state of the offline prover's shared chainE2E/TheHonestProver.lean:224–226
In words
In Lean · E2E/TheHonestProver.lean, lines 224–226

the file's variables

variable (files : PublicFiles)

The first state of the offline prover's shared chain, computed from the table's TableKey (its item number, out-of-domain seeds and answers).

def offlineStart (description : OfflineDescription) :
TableKey → (keyFileDescription description.source description.numbers description.later).S₂ :=
fun k => _root_.Desc.K14.first description.source.chains.made.sized.key.codes k
DefinitionA run valueE2E/TheHonestProver.lean:169
In words
In Lean · E2E/TheHonestProver.lean, lines 169–169

Thirty-two bytes that the prover sends in a plain round, in place of the hash that the file format has at the start of a chain.

abbrev RunValue : Type := Fin 32 → Fin 256
DefinitionA run value as bytesE2E/TheHonestProver.lean:177–178
In words
In Lean · E2E/TheHonestProver.lean, lines 177–178

A run value as a byte string.

def runValueBytes (v : RunValue) : ByteArray :=
⟨Array.ofFn fun i => (v i).val.toUInt8⟩
The link: from a further encoding to the first · 2 cards
DefinitionThe explicit honest prover of the linkE2E/BridgePremWLink.lean:160–161
In words
In Lean · E2E/BridgePremWLink.lean, lines 160–161

the file's variables

variable (c₀ : VerifiableInference.Digest) (m₀ : List (Iop.Dig 256)) (b : PublicFiles → ℕ) (Z : PublicFiles)

explicitLinkProver (next card), with its type stated for the link IOP of the structure at the public files Z.

abbrev linkProverAtFiles : Honest (protocolAtFiles Z).link (FullSizeMatrix × ((protocolAtFiles Z).EncodingRandomness × (protocolAtFiles Z).OutOfDomainSeed) × ((protocolAtFiles Z).EncodingRandomness × (protocolAtFiles Z).OutOfDomainSeed)) :=
explicitLinkProver b Z
DefinitionThe link IOP's honest prover, given by a next-message functionJohnson/LinkSim/AtHome/SpecHome.lean:152–155
In words
In Lean · Johnson/LinkSim/AtHome/SpecHome.lean, lines 152–155

The link IOP's honest prover, given by a next-message function (linkSide).

def explicitLinkProver (b : PublicFiles → ℕ) (Z : PublicFiles) :
Honest (linkProtocolOfRoundData (ckP .two) dsF frS.P.T.a xsF (dataAtFiles flashProveData Z).dec) (HomeWt b Z) :=

Coins: the type Kc, which coinsFull maps to the prover's free parameters. The first stage of the link IOP's proximity test samples 97 positions at the full size.

linkSide (ckP .two) dsF frS.P.T.a xsF (dataAtFiles flashProveData Z).dec frP frS 97 Kc coinsFull

External strings: the two encodings of the index, one under each table's randomness (homeExt). The prover's data: the instance, both encodings and the polynomials of their rows (homeIn).

(homeExt b Z) (homeIn b Z)
The online prover: the proof for a request · 17 cards
DefinitionThe online IOP's first chain, from the public partJohnson/Desc/ProofFile/LinkAt.lean:38
In words
In Lean · Johnson/Desc/ProofFile/LinkAt.lean, lines 38–38

The online IOP's first chain, computed from the public part, with the function that returns the empty byte string in place of the second hash function. The chain does not depend on this function.

def onlineFirstChainAt (Z : Pub) : Except String (Chain S Cl) := chainOfSeat Z (pureSeat emptySecondHashFunction Z)
DefinitionThe online provers for a value of type OnlineReturn, one for each copy numberE2E/TheHonestProver.lean:184–188
In words
In Lean · E2E/TheHonestProver.lean, lines 184–188

The online provers for a value of type OnlineReturn (the type of what onlineMaker returns), with the places and the first chain as arguments. The definition onlineProver passes the places and the first chain computed from the public part.

def onlineProverAt {files : PublicFiles} (returned : OnlineReturn files) (places : H2U.Places4)
(firstChain : Chain TS ProofFile.Cl) :
Family (protocolAtFiles files).onlineBatch.loc (FullSizeMatrix × (protocolAtFiles files).EncodingRandomness × (protocolAtFiles files).OutOfDomainSeed) :=
onlineProversOfCommitter files returned.Z places firstChain silInst runValueBytes runValueBytes returned.B
(dataAtFiles flashProveData files).P returned.H
DefinitionA family of online provers, along the library's instance map instanceAsPlainRecordE2E/BridgeTied.lean:131–136
In words
In Lean · E2E/BridgeTied.lean, lines 131–136

the file's variables

variable (Z : PublicFiles) (Zp : ProofFile.Pub) (Np : H2U.Places4) (cF : Chain TS ProofFile.Cl)
(silent : ProofFile.Inst → OnBytes.Maker.FrontMsg (List OnBytes.E) →
Compile.Joined.JoinMsg (List OnBytes.E) ByteArray → ByteArray → Bool)
{R₂ R₃ : Type} [Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃] (run₂ : R₂ → ByteArray)
(run₃ : R₃ → ByteArray) {Tr X₀ Xh : Type} (B : ProverCoinCounts)
(P : (filesAt Z).Provers)
(H : Prover FullSizeMatrix ((filesAt Z).withProvers P).EncodingRandomness ProofFile.Inst TableKey Tr X₀ Xh)

A family of online provers: onlineProversAlongInstanceMap instantiated with the library's instance map instanceAsPlainRecord, the online IOP's description (built with OnBytes.secondHashFunction), the prover structure (cmAlong …).proverAt 0 H, the committer's KeyAndJoiningRoundMessages with the copy number in the front round, and the committer's external string.

def onlineProversOfCommitter :=
onlineProversAlongInstanceMap Z (F0T OnBytes.secondHashFunction Zp Np cF) LPFD.Full.instanceAsPlainRecord silent B
((cmAlong (AZ Z) PadZ (holdZ Z)).proverAt 0 H)
(fun n r2 r3 => (cmAlong (AZ Z) PadZ (holdZ Z)).seam (frontAt (AZ Z) PadZ (holdZ Z) n r2 r3)
(joinAt (AZ Z) PadZ (holdZ Z) run₂ r2) (seamAt (AZ Z) PadZ (holdZ Z) run₃ r2 r3))
(shAt Zp Np cF) ((cmAlong (AZ Z) PadZ (holdZ Z)).ext ((dataAtFiles flashProveData Z).DP.at frS.P.T.a).a) P
DefinitionA family of online provers of the protocol for one request, pulled back along an instance mapE2E/BridgeAlong.lean:307–310
In words
In Lean · E2E/BridgeAlong.lean, lines 307–310

the file's variables

variable (Z : PublicFiles) {Xi : Type} (F : FileDescription Xi) (wr : XF × RecFull → Xi)
(silent : Xi → OnBytes.Maker.FrontMsg (List OnBytes.E) →
Compile.Joined.JoinMsg (List OnBytes.E) ByteArray → ByteArray → Bool)
{Ky Tr X₀ X' R₂ R₃ : Type} (B : ProverCoinCounts)
(H : Prover (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) Xi Ky Tr X₀ X')
[Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃]
(J : ℕ → R₂ → R₃ → KeyAndJoiningRoundMessages (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) (Cz Z).Seed Xi Ky
(OnBytes.Maker.FrontMsg (List OnBytes.E)) (Compile.Joined.JoinMsg (List OnBytes.E) ByteArray)
ByteArray)
(sh : Ky → F.S₂)
(ext : (Cz Z).I × ((Cz Z).Pad × (Cz Z).Rnd) × (Cz Z).Seed →
(Iop.oneExternalString (2 ^ ((dataAtFiles flashProveData Z).DP.at frS.P.T.a).a) _root_.Run.PQ.SgX).Str)
(P : (filesAt Z).Provers)

onlineProversAtOwnInstances, read along the instance map wr, as a family of the protocol for one request.

def onlineProversAlongInstanceMap :
Family ((filesAt Z).withProvers P).onlineBatch.loc
((Cz Z).I × ((filesAt Z).withProvers P).EncodingRandomness × ((filesAt Z).withProvers P).OutOfDomainSeed) :=
(onlineProversAtOwnInstances Z F silent B H J sh ext).re wr ((filesAt Z).withProvers P).onlineBatch.loc.accept id
DefinitionA family of online provers at the online IOP's round data and fixed plain partsE2E/BridgeAlong.lean:300–303
In words
In Lean · E2E/BridgeAlong.lean, lines 300–303

the file's variables

variable (Z : PublicFiles) {Xi : Type} (F : FileDescription Xi) (wr : XF × RecFull → Xi)
(silent : Xi → OnBytes.Maker.FrontMsg (List OnBytes.E) →
Compile.Joined.JoinMsg (List OnBytes.E) ByteArray → ByteArray → Bool)
{Ky Tr X₀ X' R₂ R₃ : Type} (B : ProverCoinCounts)
(H : Prover (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) Xi Ky Tr X₀ X')
[Fintype R₂] [Nonempty R₂] [Fintype R₃] [Inhabited R₃]
(J : ℕ → R₂ → R₃ → KeyAndJoiningRoundMessages (Cz Z).I ((Cz Z).Pad × (Cz Z).Rnd) (Cz Z).Seed Xi Ky
(OnBytes.Maker.FrontMsg (List OnBytes.E)) (Compile.Joined.JoinMsg (List OnBytes.E) ByteArray)
ByteArray)
(sh : Ky → F.S₂)
(ext : (Cz Z).I × ((Cz Z).Pad × (Cz Z).Rnd) × (Cz Z).Seed →
(Iop.oneExternalString (2 ^ ((dataAtFiles flashProveData Z).DP.at frS.P.T.a).a) _root_.Run.PQ.SgX).Str)
(P : (filesAt Z).Provers)

honestProversByCopyNumber with the online IOP's round data and fixed plain parts.

abbrev onlineProversAtOwnInstances :=
honestProversByCopyNumber (ckP .two) ((dataAtFiles flashProveData Z).DP.at frS.P.T.a)
(OnBytes.Flat.front₀ (dataAtFiles flashProveData Z).G.z₀.2) (OnBytes.Flat.join₀ (dataAtFiles flashProveData Z).G.z₀.2)
ByteArray.empty F silent B H J sh ext
DefinitionThe family of honest provers of honestBatchProverOfFile for one request, indexed by the copy number nE2E/BridgeAlong.lean:178–185
In words
In Lean · E2E/BridgeAlong.lean, lines 178–185

the file's variables

variable {Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 R₂ R₃ : Type} (C : CK) (D : WholeD) (tF : TF) (tJ : TJ)
(t3 : T3) (F : VerifiableInference.Desc.FileDescription Xi) (silent : Xi → TF → TJ → T3 → Bool)
(B : ProverCoinCounts) (H : Prover W₀ Rc Xi Ky Tr X₀ X) [Fintype R₂] [Nonempty R₂] [Fintype R₃]
[Inhabited R₃] (J : ℕ → R₂ → R₃ → KeyAndJoiningRoundMessages W₀ Rc Sd Xi Ky TF TJ T3) (sh : Ky → F.S₂)
(ext : W₀ × Rc × Sd → (Iop.oneExternalString (2 ^ D.a) SgX).Str)

The family of honest provers for one request, indexed by the copy number n. Member n is the single-run prover of honestBatchProverOfFile: its strategy and abort set Hid are written with J n, that copy's KeyAndJoiningRoundMessages for each value of R₂ and R₃; its coins and public abort set Bad are written with J 0.

def honestProversByCopyNumber : Family (batchOf C D tF tJ t3 F silent).loc (W₀ × Rc × Sd) where
Coin := (honestBatchProverOfFile C D tF tJ t3 F silent B H (J 0) sh ext).one.Coin
finCoin := (honestBatchProverOfFile C D tF tJ t3 F silent B H (J 0) sh ext).one.finCoin
neCoin := (honestBatchProverOfFile C D tF tJ t3 F silent B H (J 0) sh ext).one.neCoin
ext := fun _ => ext
strat := fun n => (honestBatchProverOfFile C D tF tJ t3 F silent B H (J n) sh ext).one.strat
Bad := (honestBatchProverOfFile C D tF tJ t3 F silent B H (J 0) sh ext).one.Bad
Hid := fun n => (honestBatchProverOfFile C D tF tJ t3 F silent B H (J n) sh ext).one.Hid
DefinitiononlineProverFromPublicFiles applied to onlineFilling and the three public filesE2E/TheHonestProver.lean:143–144
In words
In Lean · E2E/TheHonestProver.lean, lines 143–144

the file's variables

variable (files : VerifierAndGoals.PublicFiles)

onlineProverFromPublicFiles applied to the second hash function OnBytes.secondHashFunction, the three public files and onlineFilling.

abbrev onlineMaker : Except String (OnlineReturn files) :=
onlineProverFromPublicFiles OnBytes.secondHashFunction files.pol files.lay files.KL (onlineFilling files)
DefinitionThe function that builds the online prover from a value of OnlineProverPartsJohnson/Desc/ProofFile/Honest/AtPure.lean:101–123
In words
In Lean · Johnson/Desc/ProofFile/Honest/AtPure.lean, lines 101–123

the file's variables

variable {W₀ Rc Tr X₀ X : Type}

The function that builds the online prover from a value P of OnlineProverParts.

def onlineProverFromPublicFiles (o : SecondHashFunctionArgument) (pol lay KL : ByteArray) (P : OnlineProverParts W₀ Rc Tr X₀ X) :
Except String (OnlineProverWithDescription W₀ Rc Tr X₀ X) :=

it computes the public part Z, the segments' records G at a request of zeros (via blankBy), the description F and the coin counts B

(pubPlain o pol lay KL).bind fun Z =>
(due? "the blank ground" (blankBy pureRoad.links Z)).bind fun G =>
(onlineDescription o pol lay KL).bind fun F =>
(Johnson.G.sendsOf pol lay KL).bind fun cs =>
match cs with
| [_, _, _, _, p0, p1, p2] =>
(bookWhole F p0 p1 p2 (mergesByName F.first.blocksInOrder)).bind fun B =>

it evaluates the sides of P at Z and G, one list for each of the three chains; each side carries its own place

let first := firstOf Z G P.lots
let shared := P.shared Z G
let second := P.second Z G

one of its errors: a side's place is not in its chain

if !(strays F.first.blocksInOrder first).isEmpty || !(strays F.shared.blocksInOrder shared).isEmpty ||
!(strays F.second.blocksInOrder second).isEmpty then
.error "a half stands at no place of its chain"
else if !P.inRange P.dummy then .error "the dummy is not in range"
else
.ok
{ Z := Z, G := G, F := F, B := B, readers := P.readers Z, rows := P.rows Z G
H := { stored := P.enc Z, trace := P.trace Z, key := pureKey, inRange := P.inRange
dummy := P.dummy, own₀ := P.own₀, ownShared₀ := P.ownShared₀
first := first, shared := shared, second := second, meet := P.meet } }
| _ => .error "the list of sendings has not seven chains"
DefinitionThe honest prover at the online IOP's own descriptionJohnson/Desc/ProofFile/Honest/AtPure.lean:89–96
In words
In Lean · Johnson/Desc/ProofFile/Honest/AtPure.lean, lines 89–96

What onlineProverFromPublicFiles returns.

structure OnlineProverWithDescription (W₀ Rc Tr X₀ X : Type) where

the public part Z

Z : Pub

the segments' records at a request of zeros, computed from the public part: G, of type Ground

G : Ground

the description F

F : FileDescription Inst

the coin counts B

B : ProverCoinCounts

the prover H

H : Prover W₀ Rc Inst OnBytes.TableKey Tr X₀ X

its readers readers

readers : W₀ → Rc → Tr → Readers

the data of its rows rows

rows : RowDataOf Inst
DefinitionThe type of what onlineProverFromPublicFiles returns at onlineFilling when it returns no errorE2E/TheHonestProver.lean:139
In words
In Lean · E2E/TheHonestProver.lean, lines 139–139

the file's variables

variable (files : VerifierAndGoals.PublicFiles)

OnlineProverWithDescription at the types of onlineFilling.

abbrev OnlineReturn := OnlineProverWithDescription FullSizeMatrix (protocolAtFiles files).EncodingRandomness Cells Unit Unit
DefinitionThe value of OnlineProverParts for the online proverE2E/TheHonestProver.lean:133–135
In words
In Lean · E2E/TheHonestProver.lean, lines 133–135

the file's variables

variable (files : VerifierAndGoals.PublicFiles)

The value of OnlineProverParts for the online prover: onlineProverPartsInUse, instantiated at the matrices via matrixInput and at the structure's randomness via tableCoins.

abbrev onlineFilling : OnlineProverParts FullSizeMatrix (protocolAtFiles files).EncodingRandomness Cells Unit Unit :=
OnlineProverParts.through id (tableCoins files) matrixInput.dummy
(onlineProverPartsInUse matrixInput OnBytes.secondHashFunction OnBytes.HonestTrace.Sz.ref openHonest)
DefinitionThe parts of the honest prover that other modules supply, as fieldsJohnson/Desc/ProofFile/Honest/AtPure.lean:52–73
In words
In Lean · Johnson/Desc/ProofFile/Honest/AtPure.lean, lines 52–73

The fields from which onlineProverFromPublicFiles builds the online prover.

structure OnlineProverParts (W₀ Rc Tr X₀ X : Type) where

a request's trace trace

/-- a request's trace; `none` where there is none -/
trace : Pub → W₀ → Inst → Option Tr

the readers readers

/-- the readers by which all parts read the witness, the index and the stored tables' pads and
encoding randomness -/
readers : Pub → W₀ → Rc → Tr → Readers

the data of the main rows rows

/-- the data of the oracle messages' main rows: computed from the public part and the ground, as
the prover's sides are; a function of the public instance -/
rows : Pub → Ground → RowDataOf Inst

the range test inRange, and a named element dummy

/-- in range: a test on the index -/
inRange : W₀ → Bool
/-- a named element of the range -/
dummy : W₀

the encoded index's columns enc

/-- the encoded index's column: by the statement's item and the position -/
enc : Pub → W₀ → Rc → Nat → Nat → Option (List Cb.Gl.F)

what the parts pass on at the start of the first chain and of the shared chain: own₀, ownShared₀; what the second chain's sides are given at their start: meet

own₀ : X
ownShared₀ : X₀
meet : X → State (Common W₀ Rc OnBytes.TableKey) X₀ → X

each chain's sides: lots, shared and second

/-- the first chain's honest sides, lot by lot -/
lots : List (HLot (Local W₀ Rc Inst Tr) (Local W₀ Rc Inst Tr) X)
shared : Pub → Ground → List (Placed Empty (Common W₀ Rc OnBytes.TableKey) X₀)
second : Pub → Ground → List (Placed (Local W₀ Rc Inst Tr) (Local W₀ Rc Inst Tr) X)
DefinitionA value of OnlineProverParts, generic in the type of the private input W₀Johnson/Desc/ProofFile/Honest/K1/Law/WSideAtFill.lean:103–105
In words
In Lean · Johnson/Desc/ProofFile/Honest/K1/Law/WSideAtFill.lean, lines 103–105

the file's variables

variable {W₀ X : Type}

A value of OnlineProverParts, generic in the type W₀ of the private input. The prover's sides of the following are added, in order, to its other fields and sides: the sub-protocols that close a segment, the first chain's proximity test, the tests on the groups U and Omega, the second chain's proximity test, and the sub-protocol that sends the message W.

def onlineProverPartsInUse (I : WiderIn W₀) (o : SecondHashFunctionArgument) (S : OnBytes.HonestTrace.Sz) (O : OnlineProverArguments) :
OnlineProverParts W₀ IndexCommitterCoins Cells Unit Unit :=
widerFillOwnCPUOWM () (LongLots.plain o S O) I o S O
DefinitionFive lists of sides of the online proverJohnson/Desc/ProofFile/Honest/AtPureWiderAt.lean:113–120
In words
In Lean · Johnson/Desc/ProofFile/Honest/AtPureWiderAt.lean, lines 113–120

the file's variables

variable {W₀ : Type}

Five of the lists of sides in onlineProverPartsInUse, one for each of five kinds. No side reads or writes its own state.

def LongLots.plain {X : Type} (o : SecondHashFunctionArgument) (S : OnBytes.HonestTrace.Sz) (O : OnlineProverArguments) :
LongLots W₀ X :=

oracle message with out-of-domain sample (kind K1): k1

{ k1 := fun wt =>
K1.dataSideNo S (fun w : Local W₀ IndexCommitterCoins Inst Cells => ⟨w.x, ⟨w.trace, wt w.w₀, w.rc⟩⟩) o

product-tree lookup argument (kind K3): k3

k3 := fun wt => K3.theLotInst id wt

output-head sumchecks (kind K6): k6

k6 := fun wt => K6.headLot K6.headFitsB (K6.headWit' id wt)

output-head committed-table sumcheck (kind K11): k11

k11 := fun wt => K11.headMergeLot O.claims wt

committed-table claim merge (kind K13): k13

k13 := fun wt => K13.k13Lot wt O.pile }
DefinitionThe functions that onlineProverPartsInUse leaves open: claims, rows, key pointsJohnson/Desc/ProofFile/Honest/OpenHonest.lean:41–47
In words
In Lean · Johnson/Desc/ProofFile/Honest/OpenHonest.lean, lines 41–47

The functions that onlineProverPartsInUse leaves open.

def openHonest : OnlineProverArguments :=

claims: the claims on the weights (output-head committed-table sumcheck, kind K11)

{ claims := K11.headClaimsByPlace

pile: the rows combined by the committed-table claim merge (kind K13)

pile := K13.pileAnyK3

req returns a default value

req := fun _ => (default, #[])

keyOf reads the key points at a segment (attention-segment sumchecks, kind K5)

keyOf := K5.keyOfK3

cells returns nothing

cells := fun _ _ _ => none

enc returns nothing. onlineProverPartsInUse does not read req, cells or enc: at onlineFilling its trace comes from matrixInput and its encoded columns from encW

enc := fun _ _ _ _ _ => none }
DefinitionWhat onlineFilling reads from a matrixE2E/TheHonestProver.lean:115–120
In words
In Lean · E2E/TheHonestProver.lean, lines 115–120

What onlineFilling reads from a matrix.

def matrixInput : WiderIn FullSizeMatrix :=

its weights weights

{ weights := fun _ M => ⟨AtPublicFiles.Key.cellsReader M⟩

the trace at the index that the matrix represents: trace

trace := fun publicPart M ξ =>
(VerifiableInference.OnPublicFiles.Flat.indexOf M).bind fun i => fullIn.trace publicPart i ξ

the range test inRange: the matrix represents an index

inRange := fun M => (VerifiableInference.OnPublicFiles.Flat.indexOf M).isSome

a fixed matrix dummy; onlineProverFromPublicFiles tests whether it is in range

dummy := VerifiableInference.OnPublicFiles.Flat.matrixOf fullIn.dummy }
DefinitionThe committer's randomness, as the online prover reads itE2E/TheHonestProver.lean:126–127
In words
In Lean · E2E/TheHonestProver.lean, lines 126–127

The committer's randomness for a table, as read by the online prover at every item of the statement.

def tableCoins (files : VerifierAndGoals.PublicFiles) : (protocolAtFiles files).EncodingRandomness → IndexCommitterCoins :=
ProofFile.Honest.randOf (S := frS) (cut := 402653181)
From a prover to its strategies, down to a round's message · 16 cards
DefinitionThe honest prover of a written IOPJohnson/Desc/ProofFile/Honest/StratC.lean:202–214
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 202–214

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}

The honest prover of a written IOP, given coin counts B, a prover H and, for each pair of coins, a value J of type KeyAndJoiningRoundMessages.

noncomputable def honestBatchProverOfFile (C : CK) (D : WholeD) (tF : TF) (tJ : TJ) (t3 : T3) (F : FileDescription Xi)
(silent : Xi → TF → TJ → T3 → Bool) (B : ProverCoinCounts) (H : Prover W₀ Rc Xi Ky Tr X₀ X) [Fintype R2]
[Nonempty R2] [Fintype R3] [Inhabited R3] (J : R2 → R3 → KeyAndJoiningRoundMessages W₀ Rc Sd Xi Ky TF TJ T3)
(sh : Ky → F.S₂) (ext : W₀ × Rc × Sd → (Iop.oneExternalString (2 ^ D.a) _root_.Run.PQ.SgX).Str) :
Iop.BatchHonestProver (batchOf C D tF tJ t3 F silent) (W₀ × Rc × Sd) where
Coin0 := Purse B.shared × R2
Coin := (Purse B.first × Purse B.second) × R3
ext := ext

its two strategies: sharedPartStrategyTrackingVerifier and requestStrategyTrackingVerifier

strat0 := fun w c => sharedPartStrategyTrackingVerifier C D tF tJ t3 F B H (J c.2 default) sh w c.1
strat := fun w c₀ x c => requestStrategyTrackingVerifier C D tF tJ t3 F B H (J c₀.2 c.2) sh w c₀.1 x c.1

its abort sets, defined by the prover's abort conditions

Bad := {ρ | badB F H (drawsLo C D tF tJ t3 ρ) = true}
Hid := fun w x => {ρ | hidB F H w.1 w.2.1 x (drawsLo C D tF tJ t3 ρ) = true}
stop0 := fun ρ => stop0B F H (drawsSh C D tF tJ t3 ρ)
DefinitionWhat the shared chain's sides are given, and what the challenge-free round before each chain sendsJohnson/Desc/ProofFile/Honest/Strat.lean:190–198
In words
In Lean · Johnson/Desc/ProofFile/Honest/Strat.lean, lines 190–198

the file's variables

variable {Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y : Type}

The value key given to the prover's sides in the shared chain, and the messages sent in the challenge-free round before each chain.

structure KeyAndJoiningRoundMessages (W₀ Rc Sd Xi Ky TF TJ T3 : Type) where

the value key given to the prover's sides in the shared chain: keyOf

/-- the key that the prover's sides in the shared chain are given -/
keyOf : W₀ → Rc → Sd → Ky

the front round, before the first chain: front

/-- what the front round sends -/
front : W₀ → Rc → Sd → Xi → TF

the joining round, before the shared chain: join

/-- what the joining round sends -/
join : W₀ → Rc → Sd → TJ

the challenge-free round before the second chain: seam

/-- what the seam sends -/
seam : W₀ → Rc → Sd → Xi → T3
DefinitionThe shared part's strategyJohnson/Desc/ProofFile/Honest/StratC.lean:162–169
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 162–169

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}
variable (C : CK) (D : WholeD) (tF : TF) (tJ : TJ) (t3 : T3) (F : FileDescription Xi) (B : ProverCoinCounts)
(H : Prover W₀ Rc Xi Ky Tr X₀ X) (J : KeyAndJoiningRoundMessages W₀ Rc Sd Xi Ky TF TJ T3) (sh : Ky → F.S₂)

The shared part's strategy.

def sharedPartStrategyTrackingVerifier (w : W₀ × Rc × Sd) (c₀ : Purse B.shared) :
SStrat (chainsOf C D tF tJ t3).sh (chainsOf C D tF tJ t3).ann :=
let a := sharedChainStart F B H sh w.1 w.2.1 (J.keyOf w.1 w.2.1 w.2.2) c₀
((), fun (_ : Unit) =>

it sends nothing in the front round and the first chain

hushS C D.ds₁

it sends the joining round's plain part

((((), J.join w.1 w.2.1 w.2.2) : Unit × TJ), fun (_ : Unit) =>

it runs the shared chain, updating a ChainProgress after each round

sharedStrategyOverSharedChain C ⟨1, 0, H.storedWords w.1 w.2.1, treeOwn⟩ D.ds₂ a.1 a.2

it sends nothing in the challenge-free round before the second chain or in that chain (in these folded sections, "the second chain" is the chain of the Lean field second, the third chain in the table of terms)

((), fun (_ : Unit) => hushSEnd C D.ds₃)))
DefinitionA batch position's strategyJohnson/Desc/ProofFile/Honest/StratC.lean:173–193
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 173–193

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}
variable (C : CK) (D : WholeD) (tF : TF) (tJ : TJ) (t3 : T3) (F : FileDescription Xi) (B : ProverCoinCounts)
(H : Prover W₀ Rc Xi Ky Tr X₀ X) (J : KeyAndJoiningRoundMessages W₀ Rc Sd Xi Ky TF TJ T3) (sh : Ky → F.S₂)

A batch position's strategy.

def requestStrategyTrackingVerifier (w : W₀ × Rc × Sd) (c₀ : Purse B.shared) (x : Xi) (c : Purse B.first × Purse B.second) :
LStrat (chainsOf C D tF tJ t3).sh (chainsOf C D tF tJ t3).ann :=
let stored := H.storedWords w.1 w.2.1
let R := (ready F B H w.1 w.2.1 x ⟨c.1, c₀, c.2⟩).toOption
let a := sharedChainStart F B H sh w.1 w.2.1 (J.keyOf w.1 w.2.1 w.2.2) c₀
let L₁ : Lay := ⟨0, 0, stored, treeOwn⟩

it sends the front round's plain part

((((), J.front w.1 w.2.1 w.2.2 x) : Unit × TF), fun (_ : Unit) =>

it runs the first chain, updating a ChainProgress after each round

requestStrategyOverSeparateChain C L₁ D.ds₁ ((R.map (·.first)).getD [])
(chainStartOrHalted L₁ F.first.blocksInOrder (R.map fun R => R.start₁ H) (some (F.start₁ (F.pub x))) [])
fun left y₁ =>

it advances over the sealing round (the first chain's last round, named SEAL), in which it sends nothing; the progress halts unless the test sealQuiet passes

let y := advanceOverRounds L₁ left [⟨[], [], [], none⟩] y₁
let z₁ := if sealQuiet y.laid then y else y.halt
((), fun (_ : Unit) =>
hushL C D.ds₂ [] fun ds₂ =>

it advances over the shared chain to its end

let z₂ := advanceOverRounds ⟨1, 0, stored, treeOwn⟩ a.1 ds₂ a.2
let L₃ : Lay := ⟨2, F.lastChainFirstTreeNumber, stored, treeThird z₁.laid z₂.laid⟩

it sends the plain part of the challenge-free round before the second chain

((((), J.seam w.1 w.2.1 w.2.2 x) : Unit × T3),

it runs the second chain, updating a ChainProgress after each round

fun (_ : Unit) => speakLEndC C L₃ D.ds₃ ((R.map (·.second)).getD [])
(chainStartOrHalted L₃ F.second.blocksInOrder
(R.bind fun R => z₁.mid.bind fun m₁ => z₂.mid.map fun m₂ => R.start₃ H m₁ m₂)
(door₃ F x z₁.ver z₂.ver) (z₁.cols ++ z₂.cols)))))
DefinitionThe shared chain's progress at its startJohnson/Desc/ProofFile/Honest/StratC.lean:155–159
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 155–159

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}
variable (C : CK) (D : WholeD) (tF : TF) (tJ : TJ) (t3 : T3) (F : FileDescription Xi) (B : ProverCoinCounts)
(H : Prover W₀ Rc Xi Ky Tr X₀ X) (J : KeyAndJoiningRoundMessages W₀ Rc Sd Xi Ky TF TJ T3) (sh : Ky → F.S₂)

The shared chain's initial ChainProgress, with its Steps. It does not take an instance as an argument.

def sharedChainStart (w₀ : W₀) (rc : Rc) (ky : Ky) (c₀ : Purse B.shared) :
List (Step (Common W₀ Rc Ky) X₀) × ChainProgress F.S₂ F.Cl (Common W₀ Rc Ky) X₀ :=
let ss := (readyShared F B H w₀ rc ky c₀).toOption
(ss.getD [], chainStartOrHalted ⟨1, 0, H.storedWords w₀ rc, treeOwn⟩ F.shared.blocksInOrder
(ss.map fun _ => startShared H ⟨w₀, rc, ky⟩) (some (sh ky)) [])
DefinitionThe preparation of a runJohnson/Desc/ProofFile/Honest/Frame.lean:1342–1354
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 1342–1354

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

Prepares a run: it performs all of the run's tests that do not read a challenge and prepares the three chains' rounds. It returns an error if the request has no trace.

def ready (F : FileDescription Xi) (B : ProverCoinCounts) (H : Prover W₀ Rc Xi Ky Tr X₀ X) (w₀ : W₀) (rc : Rc) (x : Xi)
(c : Coins B) : Except Refusal (Ready W₀ Rc Xi Ky Tr X₀ X) :=
(readyTests F B H w₀).bind fun _ =>
match H.trace w₀ x with
| none => .error ⟨.noTrace, "the request has no trace"⟩
| some tr =>
let w : Local W₀ Rc Xi Tr := ⟨w₀, rc, x, tr⟩
let w' : Common W₀ Rc Ky := ⟨w₀, rc, H.key x⟩
(unfit (chainSteps B (B.rowsOf 0) (c.look 0) (Face.own.sees w) F.first.blocksInOrder H.first)).bind
fun m₁ =>
(sharedSteps F B H w' c.shared).bind fun m₂ =>
(unfit (chainSteps B (B.rowsOf 2) (c.look 2) (Face.own.sees w) F.second.blocksInOrder H.second)).map
fun m₃ => ⟨w, w', m₁, m₂, m₃⟩
DefinitionThe shared chain prepared without an instanceJohnson/Desc/ProofFile/Honest/Frame.lean:1334–1336
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 1334–1336

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

ready for the shared chain only, with a caller-supplied value of Ky and no instance.

def readyShared (F : FileDescription Xi) (B : ProverCoinCounts) (H : Prover W₀ Rc Xi Ky Tr X₀ X) (w₀ : W₀) (rc : Rc)
(ky : Ky) (c₀ : Purse B.shared) : Except Refusal (List (Step (Common W₀ Rc Ky) X₀)) :=
(readyTests F B H w₀).bind fun _ => sharedSteps F B H ⟨w₀, rc, ky⟩ c₀
DefinitionA chain's progress at its start, or haltedJohnson/Desc/ProofFile/Honest/StratC.lean:101–103
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 101–103

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}

The ChainProgress at a chain's start, or a halted ChainProgress if computing it returns an error.

def chainStartOrHalted (L : Lay) (bs : List (Block S Cl)) (m : Option (Mid W Y)) (v : Option S)
(front : List OpenedColumn) : ChainProgress S Cl W Y :=
((ChainProgress.start L bs m v front).toOption).getD ⟨none, none, none, [], [], [], bs, []⟩
DefinitionA batch position's strategy over a first or second chain that is followed by further roundsJohnson/Desc/ProofFile/Honest/StratC.lean:113–119
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 113–119

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}
variable (C : CK) {rest : Shape} {A : RoundSplits rest}

A batch position's strategy over a first or second chain, updating a ChainProgress after each round.

def requestStrategyOverSeparateChain (L : Lay) : (ds : List RDT) → List (Step W Y) → ChainProgress S Cl W Y →
(List (Step W Y) → ChainProgress S Cl W Y → LStrat rest A) →
LStrat (uLT C ds ++ rest) (Iop.RoundSplits.app (Iop.RoundSplits.allLocal (uLT C ds)) A)
| [], ss, z, k => k ss z
| d :: ds, ss, z, k =>
(msgOf C d (tellC z ss.head?), fun (c : (roundT C d).up.Chal) =>
requestStrategyOverSeparateChain L ds ss.tail (progressAfterChallenge L z ss.head? (drOf C d c)) k)
DefinitionThe shared part's strategy over a shared chainJohnson/Desc/ProofFile/Honest/StratC.lean:122–127
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 122–127

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}
variable (C : CK) {rest : Shape} {A : RoundSplits rest}

The shared part's strategy over the shared chain, updating a ChainProgress after each round.

def sharedStrategyOverSharedChain (L : Lay) : (ds : List RDT) → List (Step W Y) → ChainProgress S Cl W Y → SStrat rest A →
SStrat (uLT C ds ++ rest) (Iop.RoundSplits.app (Iop.RoundSplits.const (Iop.RAnn.ofShared .sh) (uLT C ds)) A)
| [], _, _, k => k
| d :: ds, ss, z, k =>
(msgOf C d (tellC z ss.head?), fun (c : (roundT C d).up.Chal) =>
sharedStrategyOverSharedChain L ds ss.tail (progressAfterChallenge L z ss.head? (drOf C d c)) k)
DefinitionA ChainProgress advanced over a list of stepsJohnson/Desc/ProofFile/Honest/StratC.lean:142–144
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 142–144

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}

Advances a ChainProgress over a list of Steps and a list of challenges, pair by pair, for the rounds that a batch position does not send itself. If the lists differ in length, it stops at the end of the shorter one and returns the ChainProgress as it is, without calling halt.

def advanceOverRounds (L : Lay) : List (Step W Y) → List Fmt.Drawn → ChainProgress S Cl W Y → ChainProgress S Cl W Y
| s :: ss, d :: ds, z => advanceOverRounds L ss ds (progressAfterChallenge L z (some s) d)
| _, _, z => z
DefinitionThe state of a chain after the round's challengeJohnson/Desc/ProofFile/Honest/StratC.lean:83–94
In words
In Lean · Johnson/Desc/ProofFile/Honest/StratC.lean, lines 83–94

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X Sd TF TJ T3 W Y R2 R3 : Type}

After a round's challenge, the round is added to the ChainProgress. If computing the message or adding the round returns an error, the ChainProgress halts but the round is still added. If there is no Step, it halts and no round is added.

def progressAfterChallenge (L : Lay) (z : ChainProgress S Cl W Y) (s : Option (Step W Y)) (d : Fmt.Drawn) : ChainProgress S Cl W Y :=
match s with
| none => z.halt
| some s =>
match z.say s with
| .error _ =>
((z.halt.heard L s (subTold s.decl s.oracles) d).toOption).getD
(z.push s (subTold s.decl s.oracles) d)
| .ok x =>
match z.heard L s x d with
| .ok z' => z'
| .error _ => ((z.halt.heard L s x d).toOption).getD (z.push s x d)
DefinitionThe state of a chain between two rounds, including the prover's and the verifier's statesJohnson/Desc/ProofFile/Honest/Walk.lean:141–157
In words
In Lean · Johnson/Desc/ProofFile/Honest/Walk.lean, lines 141–157

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X W Y : Type}

The state of a chain between two rounds. The Lean comments call such a state "the walk".

structure ChainProgress (S Cl W Y : Type) where

the prover's state mid. A ChainProgress has halted once mid and ver are none

/-- the state of the prover's run; `none` once nothing more is played -/
mid : Option (Mid W Y)

the verifier's state: ver

/-- the verifier's state after the last sub-protocol that has been asked; `none` once one has
rejected -/
ver : Option S

the place of the first sub-protocol that rejected: refused

/-- the place of the first sub-protocol that rejected -/
refused : Option Place

the rounds produced so far, what has been read, and the sub-protocols not yet asked: laid, reads, cols, todo, own

/-- all rounds produced so far -/
laid : List Played
/-- what the sub-protocols asked so far have read, and the columns -/
reads : List Read
cols : List OpenedColumn
/-- the sub-protocols not yet asked; the one that is being played comes first -/
todo : List (Block S Cl)
/-- that sub-protocol's rounds produced so far -/
own : List Played
DefinitionThe message of a round, or its fixed substituteJohnson/Desc/ProofFile/Honest/Walk.lean:189–192
In words
In Lean · Johnson/Desc/ProofFile/Honest/Walk.lean, lines 189–192

the file's variables

variable {S Cl Xi W₀ Rc Ky Tr X₀ X W Y : Type}

A round's message, or an error, given by Step.tell. If mid is none (after the verifier rejects, after ChainProgress.halt, or from a start that returned an error or lacked one of the two states), the message is the round's fixed substitute: zeros in the declared shape.

def ChainProgress.say (z : ChainProgress S Cl W Y) (s : Step W Y) : Except Refusal Told :=
match z.mid with
| some m => s.tell none m
| none => .ok (subTold s.decl s.oracles)
DefinitionOne round of a chain, as read in a prover's runJohnson/Desc/ProofFile/Honest/Frame.lean:922–933
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 922–933

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

One round of a chain.

structure Step (W X : Type) where

the sub-protocol's name name, the part's address addr, and what the sub-protocol declares for the round: decl, oracles

name : String
addr : Addr
decl : Fmt.DeclaredRound
oracles : List Oracle

if a prover's side is defined there, the two abort conditions bad and hid of the round's part

bad : List Fmt.Drawn → List Fmt.Drawn → Option String
hid : List Fmt.Drawn → List Fmt.Drawn → Option String

the round's number nth in its part, and whether it is the part's last round (last)

/-- the round's number in its part, from 0 -/
nth : Nat
/-- it is the last round of a part: after it the stops are asked once more -/
last : Bool

that side's move move

move : Option (Move Unit W X)
DefinitionA round's messageJohnson/Desc/ProofFile/Honest/Frame.lean:1102–1114
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 1102–1114

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

A round's message.

def Step.tell (s : Step W X) (back : Option Fmt.RoundView) (m : Mid W X) : Except Refusal Told :=

the two abort conditions are checked

match s.stop m.loc s.nth with
| some e => .error e
| none =>

the move computes the message; if there is no move, the message is the values of the stored run's round, or is empty

match s.move with
| some mv =>
match mv.say () m.shown m.st with
| .error e => .error ⟨.unfit, s.name ++ ": " ++ e⟩
| .ok x =>

its shape is compared with what the sub-protocol declares

if !x.fits s.decl s.oracles then
.error ⟨.unfit, s.name ++ ": the message has another shape than the sub-protocol states"⟩
else .ok ⟨x.vals.map Said.got, x.tables.map some, true⟩
| none => .ok ⟨(back.map (·.vals)).getD [], List.replicate s.decl.entry.roots none, false⟩
The components of a prover · 13 cards
DefinitionThe honest prover of a written IOP's three chainsJohnson/Desc/ProofFile/Honest/Frame.lean:859–885
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 859–885

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

A prover, given as lists of sides. In these folded sections the chains are named after their Lean fields: first, shared and second are chains 1, 2 and 3 of the table of terms, so "the second chain" here is the table's third chain.

structure Prover (W₀ Rc Xi Ky Tr X₀ X : Type) where
Input

the stored tables' columns stored

/-- the stored tables' columns, by the statement's item and the position, typed in the field, as a
table's symbol is; `Prover.storedWords` converts them to words; `none`: no column there:
`fillCols` then takes the stored run's column or returns an error -/
stored : W₀ → Rc → Nat → Nat → Option (List Cb.Gl.F)

a request's trace trace

/-- a request's trace: a function, which `ready` applies; `none` if there is none -/
trace : W₀ → Xi → Option Tr

a function key of the public instance; its value is what the shared chain's sides are given of the instance

/-- the key: what the prover's sides in the shared chain are given of the public instance: a
function, which `ready` applies. It is meant for the stored table's out-of-domain seeds and
answers. It is no part of Rc and no coin of a run. No type compares it with what `FileDescription.start₂`
reads -/
key : Xi → Ky

the range test inRange, and a named element dummy

/-- in range: a test on what all requests share. `run` applies it to w₀ -/
inRange : W₀ → Bool
/-- a named element of W₀: `readyTests` returns an error unless `inRange` is true of it, so a
prover that passes has a range that is not empty. No other function of this file reads it -/
dummy : W₀

what the parts pass on at the start of the first chain and of the shared chain: own₀, ownShared₀

/-- what the parts pass on, at the start of the first chain -/
own₀ : X
/-- the same at the start of the shared chain -/
ownShared₀ : X₀
Chains

the sides of the first, shared and second chains: first, shared, second

first : List (Placed (Local W₀ Rc Xi Tr) (Local W₀ Rc Xi Tr) X)
shared : List (Placed Empty (Common W₀ Rc Ky) X₀)
second : List (Placed (Local W₀ Rc Xi Tr) (Local W₀ Rc Xi Tr) X)

what the second chain's sides are given at their start: meet

/-- what the second chain's prover's sides are given at their start, from what the first chain's
passed on and from the shared chain's end, as `FileDescription.start₃` does for the verifier -/
meet : X → State (Common W₀ Rc Ky) X₀ → X
DefinitionThe input of a prover's side in the first or the second chain, with four componentsJohnson/Desc/ProofFile/Honest/Frame.lean:818–822
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 818–822

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

The input of a side of the first or second chain: the index, the stored tables' pads and encoding randomness, the public instance and the request's trace.

structure Local (W₀ Rc Xi Tr : Type) where
w₀ : W₀
rc : Rc
x : Xi
trace : Tr
DefinitionThe input of a prover's side in the shared chain, with three componentsJohnson/Desc/ProofFile/Honest/Frame.lean:810–813
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 810–813

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

What a side of the shared chain is given: the index, the stored tables' pads and encoding randomness, and a value key, which is what the shared chain may read of the public instance.

structure Common (W₀ Rc Ky : Type) where
w₀ : W₀
rc : Rc
key : Ky
DefinitionThe counts of a prover's coinsJohnson/Desc/ProofFile/Honest/Frame.lean:399–406
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 399–406

The counts of a prover's coins.

structure ProverCoinCounts where

for each chain, the parts with coins of their own and their counts: first, shared, second

first : List (Addr × Due)
shared : List (Addr × Due)
second : List (Addr × Due)

the entries ahead

ahead : List Ahead

for each place, the number of rounds of each of its parts: cuts

/-- a place, and each of its parts' numbers of rounds: `chainSteps` rejects a prover's side at a
place without a cut, and a list that is cut differently -/
cuts : List (Place × List Nat)
DefinitionThe prover's side of a sub-protocol, at its placeJohnson/Desc/ProofFile/Honest/Frame.lean:737–739
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 737–739

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

The prover's side of a sub-protocol: its place (its address, Place in the Lean code) and a list of parts.

structure Placed (V W X : Type) where
place : Place
parts : List (Part V W X)
DefinitionThe prover's side of consecutive roundsJohnson/Desc/ProofFile/Honest/Frame.lean:663–691
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 663–691

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

The prover's side of consecutive rounds.

structure Part (V W X : Type) where

the coins that it takes: takes, spends, carries

/-- its own coins -/
takes : Due
/-- the entries of the book with `once := true` that name it, in the book's order: their names and
their counts. `lend` compares both with the book -/
spends : List (String × Due)
/-- the entries with `once := false` that name it, in the book's order: their names and counts -/
carries : List (String × Due)

its two abort conditions bad and hid, which the Lean comments call stops

/-- the first stop, asked before each of the part's rounds and once more after its last: from the
challenges before the part (in the second chain: the first and the second chain's alone, without
the shared chain's: `Ready.start₃`), and the part's own so far. No coin and no input, by type. In
the first and the second chain it takes the place of the library's `Bad`, in the shared chain of
its `stop0` (`Iop.BatchHonestProver`, Iop/Batch.lean). No default -/
bad : List Fmt.Drawn → List Fmt.Drawn → Option String
/-- the second stop, asked as the first is, and given V too: in the first and the second chain V
is the prover's whole input, the index and the stored tables' pads and encoding randomness
included (`Face.own`). It takes the place of the library's `Hid`, which is the library's name for
a set of challenges and says nothing on a property. No coin of the run, by type. In the shared
chain V is `Empty`: there the library has no such field. No default -/
hid : V → List Fmt.Drawn → List Fmt.Drawn → Option String

for each abort condition, a stated number, which is not a bound: badShare, hidShare

/-- a stated number, no bound: the number stated for the share of the lists of
challenges at which the first stop stops the part. Nothing compares it with the stop: that the
share is at most this has to be proved by whoever relies on it. The library measures such sets as
probabilities over uniform challenges (`prB`, Hiop/RecInterface.lean). A part whose stop never
fires states 0 of 1. No default -/
badShare : Odds
/-- the same for the second stop, at every V. No default -/
hidShare : Odds

one move for each round: moves

moves : List (Move (Handed takes spends carries) W X)
DefinitionThe prover's side of one roundJohnson/Desc/ProofFile/Honest/Frame.lean:613–620
In words
In Lean · Johnson/Desc/ProofFile/Honest/Frame.lean, lines 613–620

the file's variables

variable {S Cl Xi V W X W₀ Rc Ky Tr X₀ G P C C' V' W' Y : Type}

The prover's side of one round.

structure Move (C W X : Type) where

the message say, computed from the coins, what has been shown and the state

/-- the message, from the coins, what has been shown, and the state. An error here is a fault of
the part's definition, not a stop: a stop is `Part.bad`'s or `Part.hid`'s -/
say : C → Seen → State W X → Except String Sending

what it passes on: hand

/-- what is passed on after the round's challenge, which the state already holds. It is given no
coin and nothing that was sent: so by type `own` is computed from the input and the challenges
alone -/
hand : State W X → X
DefinitionThe prover's side of an oracle message with out-of-domain sampleJohnson/Desc/ProofFile/Honest/K1/Part.lean:117
In words
In Lean · Johnson/Desc/ProofFile/Honest/K1/Part.lean, lines 117–117

the file's variables

variable {V W X : Type}

The prover's side of a sub-protocol of the kind "oracle message with out-of-domain sample", at its place: one part.

def proverSideOfSending (J : SendJob W X) : Placed V W X := ⟨J.P.place, [sendPart J]⟩
DefinitionThe prover's side of one lookupJohnson/Desc/ProofFile/Honest/K3/RowOwned.lean:84–87
In words
In Lean · Johnson/Desc/ProofFile/Honest/K3/RowOwned.lean, lines 84–87

the file's variables

variable {V W Pb V₁ W₁ X₁ : Type}

The prover's side of one lookup, at its place in a chain. Arguments: o, for each phase of the lookup, the two messages whose coins it uses; R, how the lookup's points are read off the challenges received so far; J, each phase's summands; wit, how the lookup's witness is read off the chain's witness; a, the place, the lookup's sizes and the number of rounds before the place.

def proverSideOfLookupInChain (o : Owners) (R : Reads) (J : LookJobs W) (wit : W₁ → W) (a : At) :
Placed V₁ W₁ X₁ :=

one part for each phase of the lookup, in the order of the rounds. A phase that has a masked sumcheck has that sumcheck's part; every other phase has a part that sends nothing

⟨a.place, (lookRowOwned (V := Unit) o R J a).map

the parts neither read nor change the state that the chain's parts pass on

(Part.lift (fun _ => ()) wit (fun _ => ()) fun x _ => x)⟩
DefinitionThe prover's side of a proximity testJohnson/Desc/ProofFile/Honest/K12/Parts.lean:242
In words
In Lean · Johnson/Desc/ProofFile/Honest/K12/Parts.lean, lines 242–242

the file's variables

variable {V W X C : Type}

The prover's side of a proximity test, at its place: its first part and the rest.

def proverSideOfProximityTest (J : TestJob W X) : Placed V W X := ⟨J.p.place, [firstPart J, restPart J]⟩
DefinitionThe prover's side of the committed-table claim mergeJohnson/Desc/ProofFile/Honest/K13/Part.lean:133–135
In words
In Lean · Johnson/Desc/ProofFile/Honest/K13/Part.lean, lines 133–135

the file's variables

variable {W₀ Rc Xi Tr X : Type}

The prover's side of the committed-table claim merge, at its place.

def proverSideOfClaimCombination (weights : W₀ → Weights) (pile : PileOf Xi) :
KindHalf Where (Local W₀ Rc Xi Tr) (Local W₀ Rc Xi Tr) X :=
fun p => ⟨k13Place p, k13Row weights pile p⟩
DefinitionThe prover's side of the shared chain's own roundsJohnson/Desc/ProofFile/Honest/K14/Parts.lean:136–140
In words
In Lean · Johnson/Desc/ProofFile/Honest/K14/Parts.lean, lines 136–140

the file's variables

variable {W₀ Rc Ky X Pb S Cl : Type}

The prover's side of the shared chain's own rounds, those of the committed-table claim reduction: places 1, 4 and 7, and place 8 where the shape splits.

def proverSidesOfSharedRounds (P : Data) (weights : W₀ → Weights) : List (Placed Empty (Common W₀ Rc Ky) X) :=
let lifted (p : Part Empty Ask Unit) : Part Empty (Common W₀ Rc Ky) X :=
p.lift (fun v => v) (fun c => ⟨entriesOf P.S (weights c.w₀)⟩) (fun _ => ()) fun x _ => x
[⟨place 1, [lifted quietPart]⟩, ⟨place 4, [lifted quietPart]⟩, ⟨place 7, [lifted quietPart]⟩] ++
if P.S.sharedSplitNeeded then [⟨place 8, [lifted (splitPart P)]⟩] else []
DefinitionThe prover's side of the shared chain's two oracle messagesJohnson/Desc/ProofFile/Honest/K14/Sendings.lean:312–318
In words
In Lean · Johnson/Desc/ProofFile/Honest/K14/Sendings.lean, lines 312–318

the file's variables

variable {W₀ Rc Ky X : Type}

The prover's side of the shared chain's two sub-protocols of the kind "oracle message with out-of-domain sample".

def proverSidesOfSharedSendings (A : SendPub) (weights : W₀ → Weights) (rand : Rc → TableRand) :
List (Placed Empty (Common W₀ Rc Ky) X) :=
let lifted (p : Part Empty Ask Unit) : Part Empty (Common W₀ Rc Ky) X :=
p.lift (fun v => v) (fun c => ⟨rowsOf A.P.S (weights c.w₀) (rand c.rc)⟩) (fun _ => ())
fun x _ => x
[⟨sendPlace 2, [lifted (sendingPart (jobU A))]⟩,
⟨sendPlace 5, [lifted (sendingPart (jobOmega A))]⟩]
The honest provers and settings at the compiled level · 2 cards
DefinitionThe fall-back request, as an instanceJohnson/Face/NeverBuilt.lean:31–36
In words
In Lean · Johnson/Face/NeverBuilt.lean, lines 31–36

The fixed instance used when a request is ill-formed and no instance can be built from it.

def neverBuiltInstance : Instance ppref where
prompt := fun position =>
if position.val = 1023 then tokenOne else IntegerModel.tokenZero
y := IntegerModel.tokenZero
rF := ⟨0, by decide⟩
eF := ⟨1, by decide⟩
DefinitionThe layout at a value of the public readingJohnson/Face/Compiler.lean:281–286
In words
In Lean · Johnson/Face/Compiler.lean, lines 281–286

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}

The layout at a value of the public reading: the seed's queries and the answers' code depend on the reading; the layout of queries does not.

@[reducible] def CompilerWiring.layoutAtReading {side : PublicSide} (wiring : CompilerWiring side)
(reading : wiring.family.D) :
HashLayout side.protocol side.offlineRoundSplits side.linkRoundSplits :=
{ (side.layoutAt wiring.baseDigest wiring.baseFurther).toHashLayout with
seedQueries := wiring.family.Sd reading
answerCode := wiring.family.cA reading }
The further choices of the honest committer and prover · 13 cards
DefinitionThe format's salt prefixes for honestProversAtFullSide/CompletenessAndZeroKnowledge/PlugAtTerm.lean:71–76
In words
In Lean · AtFullSide/CompletenessAndZeroKnowledge/PlugAtTerm.lean, lines 71–76

the file's variables

variable (files : PublicFiles) (parts : Parts files)
open Classical in

The format's salt prefixes for honestProvers. If honestProvers equals honestProversGivenDescriptions at some arguments, they are formatSaltStartsGivenDescriptions at these arguments, transported along that equality by saltStartsAlongEquation; otherwise they are zeroSaltStarts.

def saltStartsAtHonestProvers : SaltStarts (HonestProvers.ofThreeProvers (honestProvers files parts)) :=
if h : ∃ (description : OfflineDescription) (returned : OnlineReturn files) (places : H2U.Places4)
(firstChain : Chain TS ProofFile.Cl),
honestProvers files parts = honestProversGivenDescriptions files parts description returned places firstChain then
saltStartsAlongEquation files h.choose_spec.choose_spec.choose_spec.choose_spec (formatSaltStartsGivenDescriptions files parts _ _ _ _)
else zeroSaltStarts _
DefinitionThe format's salt prefixes at honestProversGivenDescriptionsAtFullSide/CompletenessAndZeroKnowledge/PlugAtTerm.lean:64–67
In words
In Lean · AtFullSide/CompletenessAndZeroKnowledge/PlugAtTerm.lean, lines 64–67

the file's variables

variable (files : PublicFiles) (parts : Parts files)

The format's salt prefixes for honestProversGivenDescriptions, with rounds flashRounds and link value linkRun.

abbrev formatSaltStartsGivenDescriptions (description : OfflineDescription) (returned : OnlineReturn files)
(places : H2U.Places4) (firstChain : Chain TS ProofFile.Cl) :
SaltStarts (HonestProvers.ofThreeProvers (honestProversGivenDescriptions files parts description returned places firstChain)) :=
armStarts files parts description returned places firstChain (flashRounds files) (linkRun, linkRun)
DefinitionTransport of salt prefixes along an equality of proversAtFullSide/CompletenessAndZeroKnowledge/PlugAtTerm.lean:54–55
In words
In Lean · AtFullSide/CompletenessAndZeroKnowledge/PlugAtTerm.lean, lines 54–55

the file's variables

variable (files : PublicFiles) (parts : Parts files)

Transports salt prefixes along an equality of provers.

def saltStartsAlongEquation {H H' : ThreeProvers (protocolAtFiles files)} (e : H = H') (s : SaltStarts (HonestProvers.ofThreeProvers H')) :
SaltStarts (HonestProvers.ofThreeProvers H) := e ▸ s
DefinitionThree provers from a description, a value of type OnlineReturn, places and a first chainJohnson/CompletenessAndZeroKnowledge/SendsAtTerm.lean:43–47
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/SendsAtTerm.lean, lines 43–47

the file's variables

variable (files : PublicFiles) (parts : Parts files) (description : OfflineDescription)
(returned : OnlineReturn files) (places : H2U.Places4) (firstChain : Chain TS ProofFile.Cl)

Three provers built from parts and from a description, a value of type OnlineReturn (the type of what onlineMaker returns), places and a first chain. They are the value of honestProvers when the public files yield the latter four.

abbrev honestProversGivenDescriptions : ThreeProvers (protocolAtFiles files) :=
proversOf
(offlineProverWithEncodedTable files (keyFileDescription description.source description.numbers description.later) parts.book
(parts.prover description) runValueBytes runValueBytes (offlineStart description))
(linkProver files) (onlineProverAt returned places firstChain)
DefinitionAll-zero salt prefixesJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:90–91
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 90–91

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

All-zero salt prefixes: every prefix is 256 zeros.

abbrev zeroSaltStarts (provers : HonestProvers L) : SaltStarts provers :=
constantStarts provers (List.replicate 256 false)
DefinitionOf the provers, the salt prefixes use only the types of coins, so they carry over to provers that refuseJohnson/CompletenessAndZeroKnowledge/ThePlug.lean:42–54
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/ThePlug.lean, lines 42–54

the file's variables

variable {Index Instance : Type} {protocol : _root_.Iop.HolographicProtocol Index Instance}
{provers : HonestProvers protocol}

Of the provers, the salt prefixes use only the types of coins, which refuseUnserved leaves unchanged, so they carry over to the provers that refuseUnserved returns.

def SaltStarts.underRefusal (starts : SaltStarts provers) (Served : Index → Instance → Prop) :
SaltStarts (provers.refuseUnserved Served) where
RunValues := starts.RunValues
wellFormed := starts.wellFormed
runValuesOffline := starts.runValuesOffline
runValuesLink := starts.runValuesLink
runValuesOnline := starts.runValuesOnline
readOffline := starts.readOffline
readLink := starts.readLink
readOnline := starts.readOnline
saltStartOffline := starts.saltStartOffline
saltStartLink := starts.saltStartLink
saltStartOnline := starts.saltStartOnline
DefinitionThe public prefixes of a compiled run's salts and the run values from which they are computedJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:45–56
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 45–56

the file's variables

variable {Index Instance : Type}

The public prefixes of a compiled run's salts (called starts in the Lean code), and the run values from which they are computed.

structure SaltStarts {protocol : HolographicProtocol Index Instance} (provers : HonestProvers protocol) where

the type of run values RunValues, with the condition wellFormed

RunValues : Type
wellFormed : RunValues → Prop

the run values determined by each prover's coins

runValuesOffline : provers.offlineProver.Coin → RunValues
runValuesLink : provers.linkProver.Coin → RunValues
runValuesOnline : provers.onlineProver.Coin → RunValues

the run values read off each IOP's plain parts

readOffline : Plains protocol.offline.shape → RunValues
readLink : Plains protocol.link.shape → RunValues
readOnline : Plains protocol.onlineBatch.loc.shape → RunValues

the public prefix of each IOP's salts, from the run values

saltStartOffline : RunValues → ℕ → Bool → Bits → Bits
saltStartLink : RunValues → ℕ → Bool → Bits → Bits
saltStartOnline : RunValues → ℕ → Bool → Bits → Bits
DefinitionThe format's layout of a request leaf's salt at FlashProveJohnson/CompletenessAndZeroKnowledge/FormatStarts.lean:184–185
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/FormatStarts.lean, lines 184–185

the file's variables

variable {Index Instance : Type} {L : HolographicProtocol Index Instance}
variable {provers : HonestProvers L} {rounds : FormatRounds}
{runsOffline : provers.offlineProver.Coin → FormatRuns} {runsOnline : provers.onlineProver.Coin → FormatRuns}
{linkRuns : FormatRuns} {readOffline : Plains L.offline.shape → FormatRuns}
{readOnline : Plains L.onlineBatch.loc.shape → FormatRuns}
variable (files : PublicFiles) (settings : Settings) (fallbackInstance : (flashProveDescription.C files).X)
(provers : HonestProvers (FlashProtocol files)) (limits : SearchLimits)
{rounds : FormatRounds} {runsOffline : provers.offlineProver.Coin → FormatRuns}
{runsOnline : provers.onlineProver.Coin → FormatRuns} {linkRuns : FormatRuns}
{readOffline : Plains (FlashProtocol files).offline.shape → FormatRuns}
{readOnline : Plains (FlashProtocol files).onlineBatch.loc.shape → FormatRuns}

formatRequestLeafSaltLayout at FlashProve.

abbrev flashProveRequestLeafSaltLayout (saltBytes : ℕ) : RequestLeafSaltLayout :=
formatRequestLeafSaltLayout saltBytes (flashProveDescription.input files allZeroDigest []).queryLayout.depthReq
DefinitionWhat follows a batch position's value, in the formatJohnson/CompletenessAndZeroKnowledge/FormatStarts.lean:161–163
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/FormatStarts.lean, lines 161–163

the file's variables

variable {Index Instance : Type} {L : HolographicProtocol Index Instance}
variable {provers : HonestProvers L} {rounds : FormatRounds}
{runsOffline : provers.offlineProver.Coin → FormatRuns} {runsOnline : provers.onlineProver.Coin → FormatRuns}
{linkRuns : FormatRuns} {readOffline : Plains L.offline.shape → FormatRuns}
{readOnline : Plains L.onlineBatch.loc.shape → FormatRuns}

What follows a batch position's value, in the format: saltBytes bytes of free bits, then the tail. The batch position is 0 in the offline IOP's and the link IOP's trees.

def formatRequestLeafSaltLayout (saltBytes proofDepth : ℕ) : RequestLeafSaltLayout :=
⟨8 * saltBytes, formatTail proofDepth (formatProofSlot proofDepth), 0, 0, formatProofSlot proofDepth,
fun digest => bytesToBits (_root_.Run.digToBytes digest)⟩
DefinitionWhat follows a batch position's value in a request tree's leafJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:114–122
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 114–122

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

What follows a batch position's value in a request tree's leaf: free bits, then a public tail.

structure RequestLeafSaltLayout where

the number of free bits freeBits. In the byte format: the 8 · saltBytes bits of the stored salt (OnBytes/Prover/Print/Carrier.lean, field rsalt), a value not written here

freeBits : ℕ

the public tail tail; in the byte format, the 64-bit index of the batch position's leaf

tail : ℕ → Bits

the public batch position of each of the three kinds of run

/-- the public slot of each of the three kinds of run -/
offlineSlot : ℕ
linkSlot : ℕ
onlineSlot : ℕ

the public prefix tableStart of a table's salts, at the digest that the public reading returns

/-- the public start of a table's salts, at the digest that the public reading gives -/
tableStart : Iop.Dig 256 → Bits
DefinitionThe body of a leaf beyond the word's length in FlashProve: the empty list of bitsJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:186
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 186–186

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

FlashProve's value of the field leafFiller (the body of the leaves beyond the word's length) is the empty list of bits.

def theLeafFiller (files : PublicFiles) : (flashProveDescription.input files allZeroDigest []).LeafBody := ([] : List Bool)
DefinitionThe numbers on coinsJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:192–197
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 192–197

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

The numbers on coins are those of the library at 320 free bits per leaf, with the three public batch positions, one for each kind of run.

def baseCoinNumbers (files : PublicFiles) (slotSalts : RequestLeafSaltLayout) : CoinNums (flashProveDescription.input files allZeroDigest []).LeafBody :=
{ AtPublicFiles.Premises.coinNums (flashProveDescription.input files allZeroDigest []) (theLeafFiller files) leafFreeBits
slotSalts.freeBits with
slotT := slotSalts.offlineSlot
slotL := slotSalts.linkSlot
slotB := slotSalts.onlineSlot }
DefinitionThe public reading at the all-zero digest and the empty listJohnson/CompletenessAndZeroKnowledge/TheSettings.lean:211–213
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/TheSettings.lean, lines 211–213

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape} {provers : HonestProvers L}

The public reading at the all-zero digest and the empty list.

abbrev baseReading (files : PublicFiles) (settings : Settings) (fallbackInstance : (flashProveDescription.C files).X) :
FlashReading files :=
(flashProveWiring files settings fallbackInstance).pair allZeroDigest []
How the compiler constructs the committer and the prover from the honest provers and settings · 2 cards
DefinitionThe record from which the compiler builds the honest committer and proverJohnson/Face/Compiler.lean:224–264
In words
In Lean · Johnson/Face/Compiler.lean, lines 224–264

the file's variables

variable {Index Instance : Type}
variable {L : HolographicProtocol Index Instance} {offlineRoundMarks : RoundSplits L.offline.shape}
{linkRoundMarks : RoundSplits L.link.shape}
open Classical in

The record from which the compiler builds the honest committer and prover. It is constructed from a layout, the honest provers and the settings s.

def honestSide (layout : HashLayout L offlineRoundMarks linkRoundMarks)
(provers : HonestProvers L) (s : CompiledSettings layout provers) :
AtRecs 256 L layout.LeafBody offlineRoundMarks linkRoundMarks where

the provers, unchanged

Hs := provers.toRecs

the compiled prover withholds on the provers' two abort sets; membership is decided by excluded middle

dc := ⟨fun _ _ _ => propDecidable _, fun _ _ _ => propDecidable _, fun _ _ _ => propDecidable _⟩

fields taken from the settings s, the protocol and the layout

b₀ := s.leafFiller
capT := s.searchLimitOffline
capL := s.searchLimitLink
capB := s.searchLimitOnline
M := s.furtherCopies
nm := s.copyNumber
RV := s.RunValues
okV := s.wellFormed
rvT := s.runValuesOffline
rvL := s.runValuesLink
rvB := s.runValuesOnline
startT := s.saltStartOffline
startL := s.saltStartLink
startB := s.saltStartOnline
pvT := s.readOffline
pvL := s.readLink
pvB := s.readOnline
rtail := s.slotTail
nR := winR (L := L)
nK := winK layout.queryLayout
nJ := winJ layout.queryLayout
fill := s.windowFiller

every finite type of coins is enumerated in full; salts and run coins have public prefixes and uniform free bits

ri := pickAll L.EncodingRandomness
sl := saltsPre s.coinNumbers.pre₀ (2 ^ layout.queryLayout.depth) s.coinNumbers.ℓ (pickAll _)
kT := pickAll provers.offlineProver.Coin
kL := pickAll provers.linkProver.Coin
kB := pickAll provers.onlineProver.Coin
coT := coinsPre (winR (L := L)) (winK layout.queryLayout) (winJ layout.queryLayout) layout.compilerParameters.sFS
s.coinNumbers.ℓ s.coinNumbers.ℓr
layout.queryLayout.depthReqT s.coinNumbers.padT s.coinNumbers.slotT s.windowFiller (pickAll _)
coL := coinsPre (winR (L := L)) (winK layout.queryLayout) (winJ layout.queryLayout) layout.compilerParameters.sFS
s.coinNumbers.ℓ s.coinNumbers.ℓr
layout.queryLayout.depthReqL s.coinNumbers.padL s.coinNumbers.slotL s.windowFiller (pickAll _)
coB := coinsPre (winR (L := L)) (winK layout.queryLayout) (winJ layout.queryLayout) layout.compilerParameters.sFS
s.coinNumbers.ℓ s.coinNumbers.ℓr
layout.queryLayout.depthReq s.coinNumbers.padB s.coinNumbers.slotB s.windowFiller (pickAll _)
DefinitionAn argument whose committer and prover query an answer's first hash block, and the other blocks where a test returns trueJohnson/CompletenessAndZeroKnowledge/OneHashByFirstBlockTestFront.lean:153–159
In words
In Lean · Johnson/CompletenessAndZeroKnowledge/OneHashByFirstBlockTestFront.lean, lines 153–159

the file's variables

variable {R : InnerCompilerInput} (T : LayoutsByPublicReading R) (h : T.D → HonestSide 256 R.protocol R.LeafBody R.offlineRoundSplits R.linkRoundSplits)
(more : (d : T.D) → More (typedOracleFamily 256 R.queryLayout.K (typedOracleCarrier R.protocol R.LeafBody R.offlineRoundSplits R.linkRoundSplits)) 256)
variable {T h more}
variable (T h more)
variable {J K' P' : Type} (idx : J → R.Index) (x₀ : R.Instance)
(κ : ZKCP.Digest 256 → FullKey 256 R.protocol R.offlineRoundSplits R.linkRoundSplits → K')
(ϖ : FullKey 256 R.protocol R.offlineRoundSplits R.linkRoundSplits → RequestProof 256 R.protocol → P')
(Vf : K' → List Token × List Token → P' → ZKCP.OComp 256 Bool)

A scheme of type ZKCP.Arg. Its committer and prover are built from those of readOneF: they query the first hash block of each answer, and the other blocks if the test more returns true on that first block. The committer then queries the hash function for the digest of the key's code (ZKCP.keyDigest). κ maps the key and ϖ the proof. Its verifier is Vf.

def committerAndProverOverOneHash : ZKCP.Arg 256 J (List Token × List Token) Unit K'
(FullKey 256 R.protocol R.offlineRoundSplits R.linkRoundSplits × (T.D × Isk 256 R.protocol R.LeafBody R.offlineRoundSplits R.linkRoundSplits)) P' where
C := fun w => ((readOneF T h more).C (idx w)).bind fun keys =>
(ZKCP.keyDigest (fun ck : KeyT R => T.encT (ck.1, lowKey ck.2)) keys.1).mapO fun dg =>
(κ dg keys.1.2, (keys.1.2, keys.2))
P := fun isk x' _ => ((readOneF T h more).P isk.2 (instOf R x₀ x') ()).mapO (ϖ isk.1)
V := Vf
The terms of this appendix

The protocol's objects.

termwhat it means in this appendixthe Lean's word
public filesThree byte strings, parameters of the whole argument system: the parameter file, the layout file and the scale file.VerifierAndGoals.PublicFiles (pol, lay, KL)
IOPA public-coin interactive oracle proof with a fixed list of rounds, an instance, and external oracle strings that are fixed before the first message. The queried positions are functions of the instance and the challenges (in the prover's oracle messages also of the messages' plain parts). By its type, the decision takes the whole transcript; that it depends on the oracles at the queried positions alone is a separate property, InteractiveOracleProof.IsLocal.Iop.InteractiveOracleProof
configurationWhat the three IOPs share: index and instance types, two relations Ryes and Rno (no field relates them; in this protocol they are the same), the encoding of an index as a word of n symbols, seeds and answers, and the index decoder.Hiop.ConfigurationWithOutOfDomainSample; here DecR.configurationOfStoredTable A R
pads(1) Of the configuration: a value of the type Pad that hold places in the message beside the index. (2) Of a tenant: the entries reserved for its answers (see "seed; answer").ConfigurationWithOutOfDomainSample.Pad, hold; Msg.pad
committed tableThe encoded index as an external oracle string: 2^a symbols, which the verifier queries by position; a is the table depth. What is encoded is a message of field elements, indexed by row and entry.stored table; encoded index; oneExternalString (2 ^ a) SgX, ConfigurationWithOutOfDomainSample.E0
out-of-domain sample(1) Of a committed table: seeds, each a point and a nonzero factor, and the answers of every row to each seed. It is part of the instance of each of the three IOPs. In this protocol: one seed, a point of 29 coordinates and a nonzero factor, and one answer for each of the table's 2^v rows. (2) Of a tenant whose flag sampled is set: the verifier samples seeds in the round that sends it, and the prover's next message contains the answers.(1) record; ConfigurationWithOutOfDomainSample.Rec = Seed × Ans; RecFull (2) SymbolComponent.sampled
the offline IOPInstance: one out-of-domain sample. Oracle: one committed table. Three chains.Files.key; key file
the link IOPInstance: two out-of-domain samples. Oracles: two committed tables. One chain. In the Lean: the entry file.Files.entry; entry file; HolographicProtocol.link
the online IOPA request's proof. Instance: a request and one out-of-domain sample. Oracle: one committed table. Three chains.Files.proof; proof file
requestThe instance type of the online IOP. It is not printed in this appendix.XF := Flat.Req
full parameter sizeThe library has two fixed sets of size parameters. This protocol uses the larger one.frS, frP, recordLines against srS, srP, smallRecordLines
statement(1) A top-level statement: one of the theorems' statements on the argument system, in the main part of this document. (2) A chain's statement, in the byte format: a list of items; a committed table's root is held by one of them, whose number is the table's item. (3) The trivial statement: what an interactive oracle reduction reduces to when nothing is left to prove.(2) statement, itemRoot (3) Unit, extNone

How an IOP is written.

termwhat it means in this appendixthe Lean's word
written IOPAn IOP written in the format that this appendix prints: a value of FileDescription (three chains) or OneChainFileDescription (one chain).description
chainA consecutive part of an IOP that has a verifier state and a view of its own. The three chains are the fields first, shared, second, here called first, second, third (chains 1, 2, 3). Addresses and before number them 1 to 3; tree sources and BookPlan number them 0 to 2.Chain
segmentA part of a chain in which sub-protocols state claims and one sub-protocol, batch, is handed the function that gathers them.Link
sub-protocolThe unit in which an IOP is written: some rounds, their oracle messages and queries, and a step of the verifier's decision.Block
kindA family of sub-protocols: fifteen, each with a plain name; in Lean their labels are K1 to K15. (In Lean, Fmt.Kind is another thing, here called the challenge kind: what a round's challenge consists of, read off the round's name by Fmt.kindOf.)KindName, Kind; Fmt.Kind
addressThe location of a sub-protocol: chain, segment, number, kind. ("Position" is reserved for a queried position.)Place
verifier stateThe value that the verifier's decision carries from one sub-protocol of a chain to the next.S; "the carried record"
claimA value of the type Cl that a sub-protocol states from the verifier state, to be gathered for its segment's sub-protocol batch. What a claim asserts depends on the written IOP.Cl; Block.claims
schedule; declared roundA chain's schedule lists for each round a name and eleven numbers. A declared round is such an entry together with the committed tables that the round queries, each at its share of the sampled positions, and the Merkle trees that it opens.plan, Fmt.Entry; Fmt.DeclaredRound
matrix entriesValues in {−1, 0, 1} that a round's challenge may hold beside field elements and positions.Drawn.trits, Entry.trits; challenge kind entries
oracle message; tenantAn oracle message is the data under one Merkle root: 2^logLength symbols of a fixed number of words. Its tenants are the data that share its symbols, each with a fixed number of main and mask words in every symbol. A tenant's groups are numbers; the definitions printed here only compare these lists, and only add up the counts of main and mask words.Oracle; SymbolComponent
tree, root, to openThe schedule counts each oracle message as one Merkle root in its round's message; the message's tree is that commitment in the compiled protocol. A committed table has a tree too. "A round opens a tree" means: the verifier queries that oracle at the positions sampled in the round.Entry.roots, DeclaredRound.opens, Shape
shape; column; key; widthA shape is what a round declares of a tree that it opens: depth a, width W, whether it is a committed table's, the tree number. A column is the symbol at one queried position: a key, which names the oracle, the position, and W 64-bit words, each a base-field element.Fmt.Shape; OpenedColumn
round's values; viewA round's values are the items of the prover's message, Merkle roots left out, and the sampled challenge. A view is what the decision sees of one chain: its rounds' values and the list of opened columns.Fmt.RoundView; Fmt.View
public check; file checkA public check is a Boolean that depends on public data alone (the written IOP, the public files, what the planner returns), not on the instance or a view. The file check is the Boolean fileOk that a written IOP has as a field."test on the plan"; planOk; fileOk

From a written IOP to the protocol.

termwhat it means in this appendixthe Lean's word
round dataFor each chain the typed list of rounds from which the IOP's list of rounds is formed, with the table depth.OnBytes.Maker.WholeD; for the link IOP a list of RD
table queriesFor the link IOP: which round queries which of the two committed tables, at which share of the round's positions.XO (round, which, from_, count)
challenge-free roundA round in which the prover sends a plain message, no oracle, and the verifier's challenge has one possible value.plainRound
proof-of-work bitsFurther bits of a round's challenge, as many as the schedule entry's work. The verifier rejects unless all are 0.GChal, GChal.pass; Entry.work
round marking; NA marking says of each round of an IOP whether it is shared. N is the batch size: the number of batch positions. Neither is read by the definitions of the format or of the interpreter.RoundSplits; Files.N
hash oracleThe hash function, to which an algorithm has query access only.DeterministicAlgorithm, .query
second hash functionA second hash function of the byte format. The general description (theDescription) takes it as a parameter o; atSecondHashFunction substitutes the concrete function OnBytes.secondHashFunction for o. The six theorems are stated after this substitution.VerifierAndGoals.SecondHashFunctionType; OnBytes.secondHashFunction
a proof as submitted; typed proofA proof as submitted is a value of the type Form: for this protocol a list of tokens and five byte strings. The parser turns it into a typed proof: further tokens and two values in the compiler's types (KeyRoot, OfflineLinkOnlineProof).Form, FormBytes; TypedProof
compilerThe construction that turns the three IOPs, packed as Iop.HolographicProtocol, and further data into the non-interactive verifier. It is not printed in this appendix.innerCompiledVerifier, innerInputOfThreeProtocols
planner; planner's valuesThe functions that compute the schedules and sizes from the public files, the second hash function and a value in the digest's place. They are not printed in this appendix. The planner's values are what they return in the type FilesParameters.Key.madeAt, plannedAtO, ProofFile.Plain.planned; G
public parameters; makerPublic parameters are values computed from the public files, or written as constants, on which a written IOP or a sub-protocol depends: sizes, codes, numbers of rounds, declared rounds. A maker is a function that builds a written IOP, with its round data and its decision, from the public files or from public parameters.Key.Source, H2U.PlaceNums, Key.LaterPlaces; ProofFile.Pub; P14, P15, K1.Par, P2, P12. Makers: keyDataAndDecisionOrRefusalAt, proofDataAndDecisionOrRefusalAt, linkAt and what they call
partsA value of DescriptionData, DescriptionDataAtFiles or DescriptionFields: the components from which a Description is built."letters"

Words of the sub-protocols.

termwhat it means in this appendixthe Lean's word
groupA set of tenants, opened with one main code and one mask code, on which a proximity test is run. Linear constraints are imposed on a group until its test begins.Statement.groups; newGroupP, joinP, addRowsP; SymbolComponent.groups
tested, untested groupA group is tested once a proximity test has begun on it, untested before. A chain's last sub-protocol rejects if a group is untested, or a sampled tenant is in no tested group; the first two chains leave out one group, which the third chain tests.inRun; untestedL, untestedButOwnL
linear constraintA linear equation on the entries of tenants, with coefficients that the verifier computes and a target value. It is imposed on a group (after a fold: on the group's folded rows) and not checked there; the group's proximity test takes it as input. (A claim, by contrast, is gathered for its segment's sub-protocol batch.)OnBytes.Row, GroupRow
seed; answerA seed is a sampled point z with a sampled nonzero factor β. A tenant's answer y to a seed is sent by the prover and gives the linear constraint ⟨eq(z, ·), g⟩ + β·⟨θ, pad⟩ = y, where g is the tenant's entries outside the pads, the pad is a few entries reserved for that answer, and ⟨θ, pad⟩ weights them by the powers of a fixed element θ. A tenant's seeds and answers are its out-of-domain sample.rounds "SEND seed", "SEND answer"; cutSeeds, sampleRow
masked sumcheckA sumcheck on H + ε·S: the prover first sends the sum μ of a mask polynomial H, then ε is sampled, and the running claim starts at μ + ε·(the claimed sum). In each round the prover sends the round's polynomial without the one coefficient that the running claim fixes, and a challenge is sampled. No equation is checked round by round; one claim or one linear constraint is left.rounds "PSC …", "FOLD …"; pscBeginAt, pscRound; complete, after, hear
batchingOne element x is sampled; each of a list of claims or linear constraints is multiplied by a power of x fixed by its number, and all are added into one.rounds "BAT", "BAT-sigma"; weightNext, addOne; batch; chiOf
claim on the committed tableA linear equation ⟨g ⊗ eq(ψ, ·), M⟩ + (a form in mask entries) = target on the matrix M that the table encodes.TensorRow, WsClaim
stageOne level of a proximity test, given by a main code, a mask code and three numbers k, h, t. Every stage but the last has a fold of 1 + k rounds and a code switch of 2 rounds.Fmt.M1.Stage
code switchTwo rounds: the prover sends new oracle messages and seeds are sampled; the prover sends the answers and positions are sampled. Earlier oracle messages of the chain are opened at these positions, and the opened values give linear constraints on the new tenants, imposed on a new group.K2.codeSwitchKind; the proximity test's "the switch"; switchBehind
sealed chainA chain whose last round is the round named SEAL.chainEnd … sealed; sealRound
adoptedAn oracle message of an earlier chain is adopted by a later one: it is entered in the later chain's verifier state under its own tree number and source. Rejected unless it has a tree to itself, has the declared shape, and was sampled in the earlier chain under the same shape and codes.takeOver; adoptP, elsewhereP
arrayA numbered datum of the layout. An oracle-message sub-protocol inside a segment marks the arrays in its list as committed.arrays : Option (List Nat); commitOne
rows folded at a point; foldA table's or a group's rows folded at a point γ: the one row Σ_r eq(r, γ)·row_r. A fold, which occurs at the close of a segment and in a proximity test, is a masked sumcheck of 1 + k rounds whose challenges form such a point. It takes one linear constraint on a group and leaves one linear constraint on the group's rows folded there, its kept tenants and two mask rows.weights, eqTable; rounds "FOLD epsilon", "FOLD round"; foldD
base caseThe two rounds that end a proximity test. The prover sends a value τ*, and λ is sampled; the prover sends in the clear the message and tail of w* + λ·w and of u* + λ·u (w, u: the last tenant's main and mask word; w*, u*: a masking tenant's), and t positions are sampled. The oracle message that contains both tenants is opened there. Checked: ⟨c, M0⟩ + ⟨d, M1⟩ = τ* + λ·τ (M0, M1: the two messages sent; c, d, τ: the linear constraint that is left), and at each position x the re-encoded symbol equals w*(x) + λ·w(x), and likewise for u, at x's place in the shorter word.rounds "BASE lambda", "BASE"; baseDecide, baseChecks
product treeOver 2^D leaves, the binary tree of their products. A claimed value of a level at a point z is moved one level down by a masked sumcheck whose summand is the product of the two children's values vL·vR, followed by one sampled element ξ: the next point is (ξ, r), the next claimed value (1 − ξ)·vL + ξ·vR.level, stepDown, run; round "LINE"
shiftIn a lookup argument: a field element (theta in the Lean code) that is sampled before the point α where the parameters say so; the padding values and the table's rows are functions of it.Face.shifted; round "LKP shift"
keyUsed in "key file" and as the first component of a column, and nowhere else: a committed table's TableKey is "its out-of-domain seeds and answers"; Product-tree lookup argument's keys are "looked-up values".
  • The terms sub-protocol, segment, chain, claim, linear constraint, group, oracle message, tenant, seed, answer, masked sumcheck, batching, fold, code switch, base case and public check are used as defined in the appendix's table of terms.
  • Number and address: the sub-protocol's number in its chain, counted from 0, and its address ⟨chain, segment or –, number there⟩.
  • Kind: there are fifteen kinds, each listed here by its plain name, followed by its label in the Lean type KindName and a Lean definition of that kind (for the last two, the list that contains its sub-protocols).
  • "none" marks a sub-protocol without a kind: a row of the fold's own text, that is, a segment's frame or a chain's end (Lean: frame).
  • Oracle message with out-of-domain sample (K1; VerifiableInference.Desc.K1.sendOwn): two rounds. The prover sends oracle messages and out-of-domain seeds are sampled; then the prover sends the answers.
  • Code switch between segments (K2; VerifiableInference.Desc.First.K2.codeSwitchKind): two rounds. The prover sends oracle messages and out-of-domain seeds are sampled; then the prover sends the answers, and positions are sampled at which listed oracle messages of the same chain are opened.
  • Product-tree lookup argument (K3; VerifiableInference.Desc.K3.lookupKind): rounds that send no oracle message; it states the lists of claims objects, planes and guests in the offline IOP's form, and objects and guests in its other form (VerifiableInference.Desc.K3.Law.blockVia).
  • Layer-segment sumchecks (K4; OnBytes.Desc.First.K4.block): the rounds specific to a segment of layers, in which no oracle message is sent or opened; they leave the lists of claims front and back and a check after the batching.
  • Attention-segment sumchecks (K5; VerifiableInference.Desc.First.Att.P.attentionKind): the rounds specific to an attention segment, which send no oracle message; it takes its lists of claims as an argument.
  • Output-head sumchecks (K6; VerifiableInference.Desc.Kinds.Head.kind): the rounds specific to the output head, which send and open no oracle message and leave the lists of claims norm, policy and logits, with join inserted after the first (VerifiableInference.Desc.Kinds.Head.kindWithJoin).
  • Next-token message (K7; VerifiableInference.Desc.Kinds.Reply.kind): one round in which the prover sends the next token as one element and nothing is sampled; the verifier rejects if an element was already stored or the element is not a token of the vocabulary.
  • Draw of the approximate range proof (K8; VerifiableInference.Desc.First.K8.whole): the smallness test, consisting of one round that samples a matrix with entries −1, 0 or 1 and sends no oracle message, one list of claims, and two steps after the segment's batching.
  • Segment claim batching (K9; VerifiableInference.Desc.K9.batch): a segment's batching; two further sub-protocols of this kind come just before and just after the segment-closing row fold.
  • Segment-closing row fold (K10; VerifiableInference.Desc.First.Close.kind): 2 + k rounds that close a segment: a batching of linear constraints of the segment's group, then a fold of 1 + k rounds; no oracle message is sent or opened.
  • Output-head committed-table sumcheck (K11; Johnson.Desc.First.ForkMerge.headClaimMergeKind): lk + 4 rounds in the head's segment: a batching challenge and a masked sumcheck on the head's one claim on the committed table, which leave one claim; no oracle message is sent or opened.
  • Proximity test with linear constraints (K12; VerifiableInference.Desc.K12.proximityTestKind): a batching round; for each stage except the last, a fold of 1 + k rounds and a code switch of 2 rounds; then a base case of 2 rounds.
  • Committed-table claim merge (K13; VerifiableInference.Desc.K13.claimCombinationBlock): 2 + kCol rounds after the segments: one sampled element batches the two or more claims left on the committed table, and a masked sumcheck reduces them to one; no oracle message is sent or opened.
  • Committed-table claim reduction (K14; Desc.K14.blocks): the test on the committed table. Six sub-protocols in the second chain, around two sub-protocols of the kind "oracle message with out-of-domain sample", sample two points and the positions at which the table is opened, impose linear constraints and assign tenants to groups. One sub-protocol in the third chain (VerifiableInference.Desc.Third.batchLinearConstraintsSecondPart), with no rounds, adopts an oracle message of the second chain and adds a linear constraint.
  • Two-table comparison steps (K15; Desc.K15.linkBlocksBeforeTest): the link IOP's steps on its two committed tables, around a sub-protocol of the kind "oracle message with out-of-domain sample". They are: a sampled point; one sub-protocol with no round on the two tables' out-of-domain samples; sampled positions, with the first table opened at the first columnsFirst of them and the second table at the next columnsFurther; and a further sampled value, from which one linear constraint is added to the group.
  • Names of the chains in Lean: in the structure of a written IOP, the fields first, shared and second are the first, second and third chain, respectively. Names of the IOPs in Lean: the offline IOP is the field key of Files and the field offline of Iop.HolographicProtocol; the link IOP is entry and link; the online IOP is proof and, with its round marking, onlineBatch. Comments in the Lean code call the three IOPs the key file, the entry file and the proof file, after the files that contain their proofs.
  • Rounds, oracle messages sent: for one sub-protocol and for the full-size public files. Each oracle message is one Merkle tree and can have several tenants. A dash means that no value is given.
  • The offline IOP has 35 sub-protocols, the link IOP 8 and the online IOP 374: 417 in total. By kind:
kindoffline IOPlink IOPonline IOPall
Oracle message with out-of-domain sample515460
Code switch between segments002525
Product-tree lookup argument205052
Layer-segment sumchecks001212
Attention-segment sumchecks001212
Output-head sumchecks0011
Next-token message0011
Draw of the approximate range proof002525
Segment claim batching007575
Segment-closing row fold002525
Output-head committed-table sumcheck0011
Proximity test with linear constraints4149
Committed-table claim merge1012
Committed-table claim reduction70714
Two-table comparison steps0404
none1628199
all358374417
The offline IOP, sub-protocol by sub-protocol
number in its chain, and addresskindwhat it doeshow oftenroundsoracle messages sent
0 ⟨1, –, 1⟩Oracle message with out-of-domain sampleThe prover sends an oracle message of mask entries; out-of-domain seeds are sampled and answered.12–
1 ⟨1, –, 2⟩Oracle message with out-of-domain sampleThe prover sends the oracle message that the lookups use; out-of-domain seeds are sampled and answered. A group is opened.12–
2, 8 ⟨1, i, 0⟩noneA lookup's segment starts. No round.20–
3, 9 ⟨1, i, 1⟩noneNo round. Fixes which entries of the two oracle messages above are the masks of the masked scalars of the lookup's rounds.20–
4, 10 ⟨1, i, 2⟩Product-tree lookup argumentLookup argument number i.29,581 and 9,220–
5, 11 ⟨1, i, 3⟩noneNo round, nothing sampled. It receives the segment's claims and turns them into linear constraints and claims on the looked-up values.20–
6, 12 ⟨1, i, 4⟩noneNo round; it checks nothing here.20–
7, 13 ⟨1, i, 5⟩noneThe segment ends. No round.20–
14 ⟨1, –, 4⟩noneNo round. All lookups' linear constraints are imposed on the group that the next test tests.10–
15 ⟨1, –, 5⟩Proximity test with linear constraintsProximity test on that group.123–
16 ⟨1, –, 13⟩Committed-table claim mergeThe lookups' claims on looked-up values become claims on the committed table; one sampled element and a masked sumcheck reduce these to one.120–
17 ⟨1, –, 14⟩Oracle message with out-of-domain sampleThe prover sends the chain's last oracle message; out-of-domain seeds are sampled and answered. A group is opened for it and one linear constraint imposed on it.12–
18 ⟨1, –, 15⟩noneThe chain's end: one round named SEAL in which nothing is sent or read; rejects if a count of claims is still outstanding, if a group other than the one that the third chain tests is untested, or if a sampled tenant outside that group is in no tested group.11–
0 ⟨2, –, 0⟩noneNo round. It contains public checks.10–
1 ⟨2, –, 1⟩Committed-table claim reductionThe verifier samples a point.11–
2 ⟨2, –, 2⟩Oracle message with out-of-domain sampleThe prover sends an oracle message whose tenants are the committed table's rows folded at part of that point, and a mask; out-of-domain seeds are sampled and answered.12–
3 ⟨2, –, 3⟩Committed-table claim reductionNo round. For each out-of-domain answer of the committed table, one linear constraint on the folded tenant.10–
4 ⟨2, –, 4⟩Committed-table claim reductionThe verifier samples positions; the committed table is opened there; one linear constraint on the folded tenant for each position.11–
5 ⟨2, –, 5⟩Oracle message with out-of-domain sampleThe prover sends two further oracle messages, the second a mask; out-of-domain seeds are sampled and answered.12–
6 ⟨2, –, 6⟩Committed-table claim reductionNo round. The new tenants are assigned to the two groups that the two proximity tests test.10–
7 ⟨2, –, 7⟩Committed-table claim reductionThe verifier samples a second point.11–
8 ⟨2, –, 8⟩Committed-table claim reductionThe prover sends one masked value; the linear constraint that equates the values of the two tenants at the two points is split into one constraint for each group.11–
9 ⟨2, –, 9⟩Proximity test with linear constraintsProximity test on the first group, with all linear constraints imposed on it.135–
10 ⟨2, –, 10⟩Proximity test with linear constraintsProximity test on the second group.124–
11 ⟨2, –, 11⟩noneThe chain's end: one round named SEAL in which nothing is sent or read; rejects if a group is untested or a sampled tenant is in no tested group.11–
0 ⟨3, –, 0⟩Committed-table claim reductionNo round. An oracle message of the second chain is adopted and joins the group that this chain's proximity test tests; one linear constraint on it and another tenant is added.10–
1 ⟨3, –, 1⟩noneNo round. Checks that every oracle message which the next test opens and this chain has not sent is declared as taken from the chain that sent it.10–
2 ⟨3, –, 2⟩Proximity test with linear constraintsProximity test on that group.130–
3 ⟨3, –, 3⟩noneThe chain's end, no round; rejects if a group is untested or a sampled tenant is in no tested group.10–

The numbers of rounds are given by L₁, L₂, L₃ and the theorem laid_rounds_in_scope. The addresses and kinds are given by the definitions Key.wantedFirst, Key.wantedShared, Key.wantedSecond and the theorem desc_lists.

The link IOP, sub-protocol by sub-protocol

The order and kinds are read off the definitions Desc.K15.linkBlocksBeforeTest and Desc.K15.linkProtocolChain. The numbers of rounds are obtained from these definitions and the written parameters Desc.K15.frP.

The online IOP, sub-protocol by sub-protocol

The first chain has 25 segments: numbers 0, 2, …, 22 treat layers, numbers 1, 3, …, 23 attention, and number 24 the head. An ordinary segment l has 14 sub-protocols, numbered 1 + 14·l + j, j = 0 … 13.

number in its chain, and addresskindwhat it doeshow oftenroundsoracle messages sent
0 ⟨1, –, 0⟩noneThe chain's first sub-protocol: no round, no check.100
1 + 14·l + 0 ⟨1, l, 0⟩, l = 0 … 23noneThe segment starts. No round. It contains the public check that the fixed order of claims names exactly the lists that the segment's sub-protocols state.2400
1 + 14·l + 1 ⟨1, l, 1⟩, l = 0Oracle message with out-of-domain sampleSegment 0 only. The prover sends the chain's first oracle messages; out-of-domain seeds are sampled and answered. The segment's group is opened.122
1 + 14·l + 1 ⟨1, l, 1⟩, l = 1 … 23Code switch between segmentsCode switch: the prover sends a new oracle message, with out-of-domain seeds and answers; earlier oracle messages are opened at sampled positions.2321
1 + 14·l + 2 ⟨1, l, 2⟩, l = 0 … 23Product-tree lookup argumentThe segment's first lookup argument.241,046 (l even), 984 (l odd)0
1 + 14·l + 3 ⟨1, l, 3⟩, l evenLayer-segment sumchecksEven l: the rounds specific to layers: sampled points, batching challenges, masked sumchecks.12170 (l = 0), 1680
1 + 14·l + 3 ⟨1, l, 3⟩, l oddAttention-segment sumchecksOdd l: the rounds specific to attention: prover scalars, sampled points, batching challenges, masked sumchecks.121620
1 + 14·l + 4 ⟨1, l, 4⟩, l = 0 … 23Oracle message with out-of-domain sampleThe prover sends an oracle message; out-of-domain seeds are sampled and answered.2421
1 + 14·l + 5 ⟨1, l, 5⟩, l = 0 … 23Draw of the approximate range proofThe verifier samples matrices with entries −1, 0, 1; the prover sends nothing.2410
1 + 14·l + 6 ⟨1, l, 6⟩, l = 0 … 23Oracle message with out-of-domain sampleThe prover sends an oracle message; out-of-domain seeds are sampled and answered.2421
1 + 14·l + 7 ⟨1, l, 7⟩, l = 0 … 23Product-tree lookup argumentThe segment's second lookup argument.24746 (l even), 716 (l odd)0
1 + 14·l + 8 ⟨1, l, 8⟩, l = 0 … 23Segment claim batchingBatching: one sampled element; all claims of the segment are added into one equation, weighted by its powers.2410
1 + 14·l + 9 ⟨1, l, 9⟩, l = 0 … 23noneNo round. The segment's checks on the batched equation, then the steps that its sub-protocols specify for the stage after the batching.2400
1 + 14·l + 10 ⟨1, l, 10⟩, l = 0 … 23Segment claim batchingNo round. The batched equation becomes one linear constraint on the segment's group.2400
1 + 14·l + 11 ⟨1, l, 11⟩, l = 0 … 23Segment-closing row foldOne sampled element batches the group's linear constraints; a masked sumcheck leaves one linear constraint on the group's folded rows.2410 (l even), 9 (l odd)0
1 + 14·l + 12 ⟨1, l, 12⟩, l = 0 … 23Segment claim batchingNo round, no check: the segment is marked as closed.2400
1 + 14·l + 13 ⟨1, l, 13⟩, l = 0 … 23noneThe segment ends. No round.2400
337 ⟨1, 24, 0⟩noneThe head's segment starts. No round.100
338 ⟨1, 24, 1⟩Next-token messageThe prover sends one field element, the next token; nothing is sampled.110
339 ⟨1, 24, 2⟩Code switch between segmentsCode switch, as in the other segments.121
340 ⟨1, 24, 3⟩Product-tree lookup argumentThe segment's first lookup argument.11,0800
341 ⟨1, 24, 4⟩Output-head sumchecksThe rounds specific to the head: sampled points, batching challenges, masked sumchecks.1820
342 ⟨1, 24, 5⟩Oracle message with out-of-domain sampleThe prover sends an oracle message; out-of-domain seeds are sampled and answered.121
343 ⟨1, 24, 6⟩Draw of the approximate range proofThe verifier samples matrices with entries −1, 0, 1.110
344 ⟨1, 24, 7⟩Oracle message with out-of-domain sampleThe prover sends an oracle message; out-of-domain seeds are sampled and answered.121
345 ⟨1, 24, 8⟩Product-tree lookup argumentThe segment's second lookup argument.17460
346 ⟨1, 24, 9⟩Output-head committed-table sumcheckA batching challenge and a masked sumcheck on the head's one claim on the committed table.1220
347 ⟨1, 24, 10⟩Segment claim batchingBatching of the segment's claims.110
348 ⟨1, 24, 11⟩noneNo round. Checks on the batched equation; steps after the batching.100
349 ⟨1, 24, 12⟩Segment claim batchingNo round. The batched equation becomes one linear constraint.100
350 ⟨1, 24, 13⟩Segment-closing row foldBatching of the group's constraints and masked sumcheck, as in the other segments.1100
351 ⟨1, 24, 14⟩Segment claim batchingNo round, no check: the segment is marked as closed.100
352 ⟨1, 24, 15⟩noneThe segment ends. No round.100
353 ⟨1, –, 1⟩Code switch between segmentsCode switch after the last segment.121
354 ⟨1, –, 2⟩Proximity test with linear constraintsProximity test.1335
355 ⟨1, –, 3⟩Committed-table claim mergeOne sampled element and a masked sumcheck reduce the pending claims on the committed table to one.1200
356 ⟨1, –, 4⟩Oracle message with out-of-domain sampleThe prover sends the chain's last oracle message; out-of-domain seeds are sampled and answered. One linear constraint is imposed on its group.121
357 ⟨1, –, 5⟩noneThe chain's end: one round named SEAL in which nothing is sent or read; rejects if a count of claims is still owed, if the group that the third chain tests is not the last group, if the chain's last oracle message is not in that group alone, if a group other than the one that the third chain tests is untested, or if a sampled tenant outside that group is in no tested group.110
0 ⟨2, –, 0⟩noneNo round. It contains public checks.100
1 ⟨2, –, 1⟩Committed-table claim reductionThe verifier samples a point.110
2 ⟨2, –, 2⟩Oracle message with out-of-domain sampleThe prover sends an oracle message whose tenants are the committed table's rows folded at part of that point, and a mask; out-of-domain seeds are sampled and answered.121
3 ⟨2, –, 3⟩Committed-table claim reductionNo round. For each out-of-domain answer of the committed table, one linear constraint on the folded tenant.100
4 ⟨2, –, 4⟩Committed-table claim reductionThe verifier samples positions; the committed table is opened there; one linear constraint on the folded tenant for each position.110
5 ⟨2, –, 5⟩Oracle message with out-of-domain sampleThe prover sends two further oracle messages, the second a mask; out-of-domain seeds are sampled and answered.122
6 ⟨2, –, 6⟩Committed-table claim reductionNo round. The new tenants are assigned to the two groups that the two proximity tests test.100
7 ⟨2, –, 7⟩Committed-table claim reductionThe verifier samples a second point.110
8 ⟨2, –, 8⟩Committed-table claim reductionThe prover sends one masked value; the linear constraint that equates the values of the two tenants at the two points is split into one constraint for each group.110
9 ⟨2, –, 9⟩Proximity test with linear constraintsProximity test on the first group, with all linear constraints imposed on it.1354
10 ⟨2, –, 10⟩Proximity test with linear constraintsProximity test on the second group.1244
11 ⟨2, –, 11⟩noneThe chain's end: one round named SEAL in which nothing is sent or read; rejects if a group is untested or a sampled tenant is in no tested group.110
0 ⟨3, –, 0⟩Committed-table claim reductionNo round. An oracle message of the second chain is adopted and joins the group that this chain's proximity test tests; one linear constraint on it and another tenant is added.100
1 ⟨3, –, 1⟩noneNo round. Checks that every oracle message which the next test opens and this chain has not sent is declared as taken from the chain that sent it.100
2 ⟨3, –, 2⟩Proximity test with linear constraintsProximity test on that group.1304
3 ⟨3, –, 3⟩noneThe chain's end, no round; rejects if a group is untested or a sampled tenant is in no tested group.100

The addresses, kinds, numbers of rounds and oracle messages sent are given by the values PlanWritten.cutFirstFull, PlanWritten.cutSharedFull, PlanWritten.cutSecondFull, with the theorems laidPOf_pins_scope and cut_of_row.

The format in which an IOP is written (one form with three chains, one with one chain) · 28 cards
DefinitionThe label of a sub-protocol's kindJohnson/Desc/Block.lean:51–55
In words
In Lean · Johnson/Desc/Block.lean, lines 51–55

The label of a sub-protocol's kind: one of the fifteen kinds K1 to K15, each with a plain name in Appendix A, or frame for a sub-protocol that does not belong to any kind, such as the start or end of a segment or the end of a chain.

inductive KindName where
| K1 | K2 | K3 | K4 | K5 | K6 | K7 | K8 | K9 | K10 | K11 | K12 | K13 | K14 | K15
/-- no kind: a row of the fold's own text (a link's frame; a chain's end) -/
| frame
deriving DecidableEq, Repr, Inhabited
DefinitionThe address of a sub-protocol within a file's IOPJohnson/Desc/Block.lean:58–66
In words
In Lean · Johnson/Desc/Block.lean, lines 58–66

The address of a sub-protocol within a file's IOP: its chain (1, 2 or 3), its segment's number if it belongs to a segment, its number within that segment or at the chain's end, and its kind.

structure Place where
/-- 1, 2 or 3 -/
chain : Nat
/-- `none`: in front of, or behind, the links -/
link : Option Nat
/-- its number inside the link, or at the chain's end -/
piece : Nat
kind : KindName
deriving DecidableEq, Repr, Inhabited
DefinitionOne schedule entryFmt/Plan.lean:81–106
In words
In Lean · Fmt/Plan.lean, lines 81–106

A schedule entry: a round's name and eleven numbers, including the numbers of proof-of-work bits, prover-message bytes, Merkle roots, sample answers, and sampled extension-field elements, positions and matrix entries.

structure Entry where
/-- the round's name -/
name : String
/-- how many rounds in a row are like this one (1 in every plan of a chain) -/
count : Nat := 1
/-- the bits of proof of work -/
work : Nat := 0
/-- the bytes of the prover's message that enter the query -/
msg : Nat := 0
/-- the roots among them -/
roots : Nat := 0
/-- the sample answers among them -/
answers : Nat := 0
/-- the elements of the extension field that are drawn -/
drawE : Nat := 0
/-- how many of these must not be 0 -/
drawNZ : Nat := 0
/-- the positions that are drawn -/
poss : Nat := 0
/-- positions are drawn below 2 ^ logN -/
logN : Nat := 0
/-- the matrix entries that are drawn -/
trits : Nat := 0
/-- for a round that batches rows: how many -/
rows : Nat := 0
deriving DecidableEq, Repr, Inhabited
DefinitionWhat a round declares about a tree that it opensFmt/Plan.lean:124–133
In words
In Lean · Fmt/Plan.lean, lines 124–133

The data that a round declares about a tree that it opens: the depth a (positions are taken modulo 2^a), the width W in base-field words, whether the tree is a committed table's tree, and the tree number.

structure Shape where
/-- the depth: main rows have length 2 ^ a (main rows: Fmt/Rules7.lean) -/
a : Nat
/-- a column is a list of W elements of the base field -/
W : Nat
/-- a stored tree (made once, read by many runs), or one that is made in a run -/
stored : Bool := false
/-- the tree's number -/
tree : Nat
deriving DecidableEq, Repr, Inhabited
DefinitionA committed table as a round queries itFmt/Rules8X.lean:110–120
In words
In Lean · Fmt/Rules8X.lean, lines 110–120

A committed table as queried in one round: its tree's shape, the length in bytes of a leaf's salt, the number item of the statement item that contains its root, and its share of the round's positions (count positions starting at number lo).

structure Stored where
sh : Shape
/-- the bytes of a leaf's salt in this table's tree: the table's own number (R13.10), not
`Plan.salt`; it is no field of `Shape` -/
salt : Nat
/-- the number, from 0, of the statement's item that holds the root -/
item : Nat
/-- its part of the round's draws: from the draw number lo on, count of them -/
lo : Nat
count : Nat
deriving DecidableEq, Inhabited
DefinitionA committed table's share of a round's sampled positionsFmt/Rules8X.lean:155
In words
In Lean · Fmt/Rules8X.lean, lines 155–155

A committed table's share of a round's sampled positions: up to count positions starting at number lo (from 0).

def partOf (t : Stored) (poss : List Nat) : List Nat := (poss.drop t.lo).take t.count
DefinitionThe position number after the last share, if the tables' shares are contiguous starting at position number iFmt/Rules8X.lean:136–138
In words
In Lean · Fmt/Rules8X.lean, lines 136–138

If the tables' shares follow one another without a gap, starting at position number i, the result is the number of the position after the last share; otherwise it is none.

def partsFrom : Nat → List Stored → Option Nat
| i, [] => some i
| i, t :: ts => if t.lo == i then partsFrom (i + t.count) ts else none
DefinitionTrue if a list of numbers is strictly increasingFmt/Rules8.lean:201–203
In words
In Lean · Fmt/Rules8.lean, lines 201–203

True if a list of numbers is strictly increasing.

def increasing : List Nat → Bool
| a :: b :: l => a < b && increasing (b :: l)
| _ => true
DefinitionThe key of a committed table's columns in a viewFmt/Rules8X.lean:157
In words
In Lean · Fmt/Rules8X.lean, lines 157–157

The key of a committed table's columns in a view: 2^16 plus the table's number.

def storedKey (which : Nat) : Nat := 2 ^ 16 + which
DefinitionInserts a number into a strictly increasing listFmt/Rules6.lean:118–120
In words
In Lean · Fmt/Rules6.lean, lines 118–120

Inserts a number into a strictly increasing list, unless it is already there.

def insertIntoIncreasingList (x : Nat) : List Nat → List Nat
| [] => [x]
| y :: l => if x < y then x :: y :: l else if x = y then y :: l else y :: insertIntoIncreasingList x l
DefinitionThe distinct entries of a list of numbers, in strictly increasing orderFmt/Rules6.lean:124
In words
In Lean · Fmt/Rules6.lean, lines 124–124

The distinct entries of a list of numbers, in strictly increasing order.

def listOf (l : List Nat) : List Nat := l.foldr insertIntoIncreasingList []
DefinitionThe type of an item in a prover's messageFmt/Rules8.lean:141–147
In words
In Lean · Fmt/Rules8.lean, lines 141–147

The sort of an item in a prover's message: base-field element, extension-field element, word, Merkle root, or sample answer.

inductive Item where
| f
| e
| word
| root
| answer
deriving DecidableEq, Repr, Inhabited
DefinitionA parsed item of a prover's messageFmt/Rules8.lean:157–163
In words
In Lean · Fmt/Rules8.lean, lines 157–163

An item of a prover's message as read: one 64-bit word (f, word), three words (e, answer), or a byte string (root).

inductive ItemValue where
| f (x : UInt64)
| e (x : UInt64 × UInt64 × UInt64)
| word (x : UInt64)
| root (d : ByteArray)
| answer (x : UInt64 × UInt64 × UInt64)
deriving DecidableEq, Inhabited
DefinitionThe values sampled as a round's challengeFmt/Rules6Round.lean:83–89
In words
In Lean · Fmt/Rules6Round.lean, lines 83–89

A round's challenge as sampled values: extension-field elements, positions, matrix entries, and an optional digest.

structure Drawn where
elems : List Ext
/-- the positions as they are drawn -/
poss : List Nat
trits : List Int
digest : Option ByteArray
deriving DecidableEq
DefinitionA round's valuesFmt/View.lean:35–37
In words
In Lean · Fmt/View.lean, lines 35–37

A round's values: the parsed items of the prover's message (in a view, without the Merkle roots) and the challenge.

structure RoundView where
vals : List ItemValue
drawn : Drawn
DefinitionThe decision's view of one chainFmt/View.lean:40–43
In words
In Lean · Fmt/View.lean, lines 40–43

The view of one chain that the verifier's decision receives: the values and challenges of its rounds, and the opened columns as triples (key, position, words).

structure View where
rounds : List RoundView
/-- Tree (by its number in the order of sending), position, column. -/
opened : List (Nat × Nat × List UInt64)
DefinitionAn opened columnJohnson/Desc/Step.lean:46
In words
In Lean · Johnson/Desc/Step.lean, lines 46–46

An opened column: key, position, and its list of 64-bit words.

abbrev OpenedColumn : Type := Nat × Nat × List UInt64
DefinitionNames the Merkle tree that a round opensDecl/Declared.lean:118–121
In words
In Lean · Decl/Declared.lean, lines 118–121

Identifies the Merkle tree that a round opens: the n-th tree whose root the round's own chain sends, or tree number sent of another chain in the same file. Trees are numbered from 0, and here chain is a list index starting at 0, so chain 0 is chain 1.

inductive TreeSource where
| own (n : Nat)
| taken (chain sent : Nat)
deriving DecidableEq, Repr, Inhabited
DefinitionOne declared roundDecl/Declared.lean:145–154
In words
In Lean · Decl/Declared.lean, lines 145–154

A declared round: its schedule entry; the committed tables it queries, each at its share of the round's sampled positions; and the other Merkle trees it opens at all positions, each with its shape and source.

structure DeclaredRound where
/-- the round's entry of the plan: its name and eleven words. Place: FORMAT.md 4.1, R4.3. -/
entry : Entry
/-- the stored trees that the round opens, in the order of the statement's items, each with its
part of the draws. Place: FORMAT.md 7.4, R8.7; 6.6, R7.19. -/
stored : List Stored := []
/-- the other trees that it opens, by increasing place in the chain's list.
Place: FORMAT.md 7.4, R8.7; 6.4, R7.13; 09-key-and-leaf-files.md 9.7, R13.12. -/
opens : List (Shape × TreeSource) := []
deriving DecidableEq, Inhabited
DefinitionOne tenant of an oracle message's symbolsJohnson/Desc/Oracle.lean:18–29
In words
In Lean · Johnson/Desc/Oracle.lean, lines 18–29

One tenant of an oracle message's symbols: its numbers of main and mask words per symbol, its field degree (1 or 3), whether it has an out-of-domain sample, and its group numbers.

structure SymbolComponent where
/-- its main words in a symbol -/
main : Nat
/-- its mask words in a symbol -/
mask : Nat
/-- the degree of its main rows: 1 (the base field) or 3 (the extension field) -/
degree : Nat
/-- whether it has an out-of-domain sample -/
sampled : Bool
/-- the groups that it belongs to -/
groups : List Nat
deriving DecidableEq, Repr, Inhabited
DefinitionThe declared shape of an oracle message where it is sentJohnson/Desc/Oracle.lean:32–39
In words
In Lean · Johnson/Desc/Oracle.lean, lines 32–39

The declared shape of an oracle message where it is sent: 2^logLength symbols, each of words base-field words, and the list of tenants that share a symbol.

structure Oracle where
/-- it has 2 ^ logLength symbols -/
logLength : Nat
/-- the words of one symbol -/
words : Nat
/-- who shares a symbol, in order: their words add up to `words` -/
tenants : List SymbolComponent
deriving DecidableEq, Repr, Inhabited
DefinitionOne sub-protocol over state SJohnson/Desc/Block.lean:69–101
In words
In Lean · Johnson/Desc/Block.lean, lines 69–101

One sub-protocol, for verifier state type S and claim type Cl

structure Block (S Cl : Type) where
Labels

the name name, which labels its rejections

/-- for a refusal's words -/
name : String

the address place

place : Place
Public check

the public check planOk

/-- TESTS ON THE PLAN ALONE: no view, no record -/
planOk : Bool
Rounds

the declared rounds rounds, each with the committed tables and trees that it queries

/-- ROUNDS, and with them READS: for each round its entry of the plan (its name; what the message
holds; what is drawn), and the parts of stored tables and the trees that are opened at the
positions drawn in it -/
rounds : List Fmt.DeclaredRound

the oracle messages oracles: for each round, the oracle message under each root that the round sends

/-- ROUNDS: for each round, for each root that it sends: the oracle message beneath it -/
oracles : List (List Oracle)

the oracle messages before that must have been sent and, if sampled, have had their sample answered before the sub-protocol's first challenge. Each is given by its chain (1, 2 or 3) and its number, from 0, in that chain's order of sending

/-- FIXED BEFORE THE DRAW: the oracle messages that must have been sent, and where they are
sampled have had their sample answered, before this block's first draw: (the chain: 1, 2 or 3; the
message's number in its chain's order of sending, from 0). IT IS THE BLOCK THAT DRAWS A CHALLENGE
THAT NAMES THE MESSAGES WHICH ANY TEST HOLDS AGAINST THAT CHALLENGE, also a later block's test.
A BLOCK THAT SENDS A SAMPLED MESSAGE DOES NOT NAME IT HERE FOR THE DRAW OF ITS OWN SEEDS: the
answers come behind the seeds, so the test would refuse an honest plan; inside one block the order
"root, then seeds, then answers" is that of its own rounds -/
before : List (Nat × Nat)
Functions

the decision decide, which takes the verifier state, its rounds' values and the answers to its queries (one list of positions with their words for each table or tree opened) and returns the next state or a rejection

/-- DECIDES: from the record, its own rounds as a view shows them (no root; no sealed digest),
and just the columns that it is owed, grouped as the openings are (one group for each stored part,
then each tree, of each round), each column with its position: the next record, or a refusal
under the name of the test that refused -/
decide : S → List Fmt.RoundView → List (List (Nat × List UInt64)) → Except String S

the named functions claims: each takes the number of claims its segment has gathered so far and the state, and returns further claims with the state, or a rejection

/-- CLAIMS: named runs: each from the number of claims that the link has gathered so far and the
record, which holds what was heard, to claims and the record behind them, or a refusal. THERE IS
NO DEFAULT: a kind that has none writes []; one that forgets its run does not compile -/
claims : List (String × (Nat → S → Except String (List Cl × S)))

the named functions after: each takes the state after batching and returns the state or a rejection

/-- BEHIND THE BATCHING: named runs of a second sort: tests on, and writings into, the batched
form as it stands in the record behind the adding: the record handed on, or a refusal. No default
either -/
after : List (String × (S → Except String S))
DefinitionA kind of sub-protocolJohnson/Desc/Block.lean:105
In words
In Lean · Johnson/Desc/Block.lean, lines 105–105

A kind of sub-protocol: a function from parameters of an arbitrary type P to a sub-protocol.

abbrev Kind (P S Cl : Type) : Type := P → Block S Cl
DefinitionA kind that takes a list of itemsJohnson/Desc/Block.lean:112
In words
In Lean · Johnson/Desc/Block.lean, lines 112–112

A kind that takes, besides its parameters, a list of items of an arbitrary type G.

abbrev KindWithGuestIdentities (P G S Cl : Type) : Type := P → List G → Block S Cl
DefinitionA chain of sub-protocolsJohnson/Desc/Block.lean:150–163
In words
In Lean · Johnson/Desc/Block.lean, lines 150–163

A chain of sub-protocols with a common verifier state type S and claim type Cl. Its parts run in the order listed below. The offline and online IOPs have three chains each, and the link IOP has one

structure Chain (S Cl : Type) where

the sub-protocol first

/-- the chain's front: its public tests, in a block without a round; or the chain's first working
block, if that has no round. A chain that has neither lays a quiet block here, and its maker says
so: three fronts need not be three sets of tests. It may be of the kind `frame`. Nothing asks that
it has no round -/
first : Block S Cl

the sub-protocols front

/-- what else stands in front of the links -/
front : List (Block S Cl)

the segments links

links : List (Link S Cl)

the sub-protocols back

/-- what else stands behind the links -/
back : List (Block S Cl)

the sub-protocol last, which ends the chain and, in a sealed chain, declares the round named SEAL

/-- the chain's end. Of a sealed chain it declares the sealing round; of an unsealed one it may be
without a round -/
last : Block S Cl
DefinitionA three-chain file's IOP for instances XiJohnson/Desc/Block.lean:168–212
In words
In Lean · Johnson/Desc/Block.lean, lines 168–212

The written IOP of a file with three chains, for instances of type Xi

structure FileDescription (Xi : Type) where
Types

the state types S₁, S₂, S₃ of chains 1, 2 and 3, and their common claim type Cl

S₁ : Type
S₂ : Type
S₃ : Type
Cl : Type
Schedule

the declared rounds plans of each chain

/-- THE PLAN's OWN DECLARED ROUNDS of the three chains, WHOLE: each round's entry, the stored
parts and the trees that it opens, each tree with its source: made of the public files where the
description is made (Johnson/G/RoundsOfPlan.lean: `declPOf` | `declKOf`) -/
plans : List Fmt.DeclaredRound × List Fmt.DeclaredRound × List Fmt.DeclaredRound

the committed table's depth tableDepth

/-- the stored table's depth, off the plan -/
tableDepth : Nat

the table wanted, intended to be computed from the schedule: the address and number of rounds of every sub-protocol of the three chains, in order. Sub-protocols joined by andThen share one row

/-- THE TABLE OF PLACES, OFF THE PLAN: for every block of the three flat lists, in their order,
its place and its number of rounds; a block without a round has a row too, with 0. IT IS WORTH ITS
FIELD ONLY IF IT IS MADE OF THE PUBLIC FILES BY ANOTHER FILE THAN THE ONE THAT WRITES THE BLOCKS,
INDEPENDENTLY OF IT: else `wantedOk` holds a list against itself. Blocks that are joined by
`andThen` have one row, with both blocks' rounds, at the joint's place: the first one's, unless
the maker stamps another. No default -/
wanted : List (Place × Nat)

the table owed, intended to be computed from the schedule: each row gives an address and the oracle messages that the sub-protocol there must name in before

/-- WHICH MESSAGES A BLOCK MUST NAME IN `before`, OFF THE PLAN: (the block's place, the messages
as in `before`). Made as `wanted` is, independently of the block's file. A ROW THAT NAMES
A MESSAGE OF AN EARLIER CHAIN THAN THE BLOCK's IS IDLE AS A TEST OF THE ORDER: `beforeOk` asks of
such a message only that it is sent (see the Limits). Blocks that are joined by `andThen` stand at
one place alone (the first one's, unless the maker stamps another): the table's maker must know
the joints. A block is held at its FIRST draw: a message that it sends itself behind that draw
cannot be owed by it. No default -/
owed : List (Place × List (Nat × Nat))
Checks

the Boolean check fileOk on the schedule that relates the chains to each other

/-- the tests on the plan that tie chains to each other -/
fileOk : Bool

the check okStart on the instance only

/-- the test on the instance alone -/
okStart : Xi → Bool
Instance

the type XiPub and the map pub to it: intended to be the instance without the claimed next token (its public part); the offline description takes pub := id

/-- the instance without what is asked of the proof (the next token) -/
XiPub : Type
pub : Xi → XiPub
Start states

the initial states start₁ and start₂ of chains 1 and 2, computed from that public part

/-- the first and the shared chain's first states: of the instance's public part alone -/
start₁ : XiPub → S₁
start₂ : XiPub → S₂

the initial state start₃ of chain 3, from that public part and the final states of chains 1 and 2; it may reject

/-- the second chain's first state: what it takes of the two earlier chains' ends; it may
refuse -/
start₃ : XiPub → S₁ → S₂ → Except String S₃
Chains

the chains first, shared and second: chains 1, 2 and 3

first : Chain S₁ Cl
shared : Chain S₂ Cl
second : Chain S₃ Cl
Final check

the final check fin on the instance and the three final states

/-- the last test: it is handed the instance and the three ends, and compares what was heard with
what is asked -/
fin : Xi → S₁ → S₂ → S₃ → Bool
DefinitionA one-chain file's IOP for instances XiJohnson/Desc/Link/OneChainFileDescription.lean:50–66
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 50–66

The written IOP of a file with one chain, for instances of type Xi

structure OneChainFileDescription (Xi : Type) where
Types

the state type S and the claim type Cl

S : Type
Cl : Type
Schedule

the declared rounds plan of the chain

/-- the plan's declared rounds of the chain, whole -/
plan : List Fmt.DeclaredRound

the committed tables' depth tableDepth

/-- the stored tables' depth -/
tableDepth : Nat

the number tables of committed tables that the file's statement contains, as its items 0, 1 and so on

/-- how many stored tables the file's statement holds: its items 0, 1, … -/
tables : Nat
Checks

the file's Boolean check fileOk on the schedule

/-- the file's own tests on the plan -/
fileOk : Bool

the check okStart on the instance

/-- the test on the instance -/
okStart : Xi → Bool
Chain

the function start, which maps the instance to the chain's initial state

start : Xi → S

the chain chain

chain : Chain S Cl
Final check

the final check fin on the instance and the chain's final state

/-- the last test -/
fin : Xi → S → Bool
Running a sub-protocol, a segment and a chain: one fold, used by all three IOPs · 24 cards
DefinitionTurns an optional value into a resultJohnson/Desc/Block.lean:220–222
In words
In Lean · Johnson/Desc/Block.lean, lines 220–222

the file's variables

variable {Xi S Cl : Type}

Turns an optional value into a result: the value if present, otherwise a rejection with the given name.

def named {α : Type} (name : String) : Option α → Except String α
| some x => .ok x
| none => .error name
DefinitionTurns a Boolean check into a resultJohnson/Desc/Block.lean:225
In words
In Lean · Johnson/Desc/Block.lean, lines 225–225

the file's variables

variable {Xi S Cl : Type}

Succeeds if the Boolean check is true; otherwise rejects with the given name.

def need (name : String) (b : Bool) : Except String Unit := if b then .ok () else .error name
DefinitionThe queries of declared roundsJohnson/Desc/Block.lean:232–241
In words
In Lean · Johnson/Desc/Block.lean, lines 232–241

the file's variables

variable {Xi S Cl : Type}

The queries of a list of declared rounds, given each round's sampled challenge: for each round in turn, one list for each committed table that it queries and then one for each other Merkle tree that it opens. Each list consists of triples (key, position, width).

def groupsOf (firstTree : Nat) :
List Fmt.DeclaredRound → List Fmt.Drawn → List (List (Nat × Nat × Nat))
| d :: ds, R :: Rs =>
Tables

A committed table is queried at its share of the round's sampled positions, each taken modulo 2 ^ a, where a is the depth. Fmt.listOf sorts the positions in increasing order and removes duplicates. The key is Fmt.storedKey of the table's number, and the width is W of the table.

(d.stored.map fun s =>
(Fmt.listOf ((Fmt.partOf s R.poss).map (· % 2 ^ s.sh.a))).map fun x =>
(Fmt.storedKey s.item, x, s.sh.W)) ++
Trees

A tree is queried at all of the round's sampled positions, taken modulo 2 ^ a and ordered in the same way. The key is the tree's number minus firstTree, truncated at 0, and the width is W of the tree.

(d.opens.map fun o =>
(Fmt.listOf (R.poss.map (· % 2 ^ o.1.a))).map fun x => (o.1.tree - firstTree, x, o.1.W)) ++
groupsOf firstTree ds Rs
End

The result ends when either input list ends.

| _, _ => []
DefinitionThe sort of a message item that was readJohnson/Desc/Block.lean:250–255
In words
In Lean · Johnson/Desc/Block.lean, lines 250–255

the file's variables

variable {Xi S Cl : Type}

The sort of a message item that was read: base-field element, extension-field element, word, root, or sample answer.

def itemOf : Fmt.ItemValue → Fmt.Item
| .f _ => .f
| .e _ => .e
| .word _ => .word
| .root _ => .root
| .answer _ => .answer
DefinitionChecks one round's sampled elements that must be nonzeroJohnson/Desc/Block.lean:265–267
In words
In Lean · Johnson/Desc/Block.lean, lines 265–267

the file's variables

variable {Xi S Cl : Type}

Checks, for one round, that each sampled element that the schedule entry marks as nonzero is not the triple of words (0, 0, 0). It fails if Fmt.kindOf does not recognize the round's name.

def drawsMarkedNonzeroHaveNonzeroWords (d : Fmt.DeclaredRound) (r : Fmt.RoundView) : Bool :=
(Fmt.kindOf d.entry.name).any fun k =>
((Fmt.dsElems d.entry k).zip r.drawn.elems).all fun x => x.1 != .elemNZ || x.2 != (0, 0, 0)
DefinitionChecks rounds' values against declared roundsJohnson/Desc/Block.lean:274–281
In words
In Lean · Johnson/Desc/Block.lean, lines 274–281

the file's variables

variable {Xi S Cl : Type}

Checks a list of round values against a list of declared rounds, pair by pair.

def roundsFit : List Fmt.DeclaredRound → List Fmt.RoundView → Bool
| d :: ds, r :: rs =>
Items

The sorts of the message items must equal the declared items with the Merkle roots left out, and the challenge must contain the declared number of extension-field elements.

r.vals.map itemOf == d.items.filter (· != .root) && r.drawn.elems.length == d.entry.drawE &&
Challenge

The challenge must contain the declared numbers of positions and matrix entries (trits).

r.drawn.poss.length == d.entry.poss && r.drawn.trits.length == d.entry.trits &&

Every position must be below 2 ^ logN.

r.drawn.poss.all (· < 2 ^ d.entry.logN) &&

Every matrix entry must be −1, 0 or 1, and drawsMarkedNonzeroHaveNonzeroWords must hold.

r.drawn.trits.all (fun t => t == -1 || t == 0 || t == 1) && drawsMarkedNonzeroHaveNonzeroWords d r && roundsFit ds rs
Lengths

The check fails if the two lists differ in length.

| [], [] => true
| _, _ => false
DefinitionSplits a list of opened columns into consecutive groups of the given lengthsJohnson/Desc/Block.lean:284–286
In words
In Lean · Johnson/Desc/Block.lean, lines 284–286

the file's variables

variable {Xi S Cl : Type}

Splits a list of opened columns into consecutive groups of the given lengths, keeping each column's position and words and dropping its key.

def regroup : List Nat → List OpenedColumn → List (List (Nat × List UInt64))
| n :: ns, cols => ((cols.take n).map fun c => (c.2.1, c.2.2)) :: regroup ns (cols.drop n)
| [], _ => []
DefinitionA round's values with the challenge's digest field set to noneJohnson/Desc/Block.lean:289
In words
In Lean · Johnson/Desc/Block.lean, lines 289–289

the file's variables

variable {Xi S Cl : Type}

A round's values with the challenge's field digest set to none. Rounds are passed to decide in this form.

def noDigest (r : Fmt.RoundView) : Fmt.RoundView := { r with drawn := { r.drawn with digest := none } }
DefinitionRuns one sub-protocolJohnson/Desc/Block.lean:296–304
In words
In Lean · Johnson/Desc/Block.lean, lines 296–304

the file's variables

variable {Xi S Cl : Type}

Runs one sub-protocol: checks its rounds by roundsFit, checks that the next opened columns match its queries in key, position and width, then calls decide. Returns the next state and how many columns it consumed.

def Block.step (firstTree : Nat) (b : Block S Cl) (s : S) (rs : List Fmt.RoundView) (cols : List OpenedColumn) :
Except String (S × Nat) := do
need "the rounds" (roundsFit b.rounds rs)
let groups := groupsOf firstTree b.rounds (rs.map (·.drawn))
let want := groups.flatMap id
let got := cols.take want.length
need "the columns" (got.map (fun c => (c.1, c.2.1, c.2.2.length)) == want)
let s' ← b.decide s (rs.map noDigest) (regroup (groups.map (·.length)) got)
pure (s', want.length)
DefinitionRuns one named claim function of a sub-protocol on the count of claims so far and the stateJohnson/Desc/Block.lean:391–399
In words
In Lean · Johnson/Desc/Block.lean, lines 391–399

the file's variables

variable {Xi S Cl : Type}

Looks up the claim function that o names (the index of a sub-protocol in bs, and a name) and runs it on the number of claims gathered so far and the state. It then runs the check each on o and on the claims and state that the function returned, appends those claims to the list and keeps that state. It rejects if there is no such function, or if the function or each rejects.

def claimsInStep (each : Nat × String → List Cl → S → Except String Unit) (bs : List (Block S Cl))
(x : List Cl × S) (o : Nat × String) : Except String (List Cl × S) :=
(named (o.2 ++ ": no such run") ((bs[o.1]?).bind fun b => b.claims.lookup o.2)).bind fun run =>
match run x.1.length x.2 with
| .ok y =>
match each o y.1 y.2 with
| .ok _ => .ok (x.1 ++ y.1, y.2)
| .error e => .error (o.2 ++ ": behind the run: " ++ e)
| .error e => .error (o.2 ++ ": " ++ e)
DefinitionRuns the claim functions named in the list orderJohnson/Desc/Block.lean:403–405
In words
In Lean · Johnson/Desc/Block.lean, lines 403–405

the file's variables

variable {Xi S Cl : Type}

Runs the claim functions listed in order in sequence with claimsInStep, starting from the empty list of claims. Returns all claims and the final state, or the first rejection.

def claimsInBy (each : Nat × String → List Cl → S → Except String Unit) (bs : List (Block S Cl))
(order : List (Nat × String)) (s : S) : Except String (List Cl × S) :=
order.foldl (fun acc o => acc.bind fun x => claimsInStep each bs x o) (.ok ([], s))
DefinitionRuns the after functions named in the list orderJohnson/Desc/Block.lean:414–419
In words
In Lean · Johnson/Desc/Block.lean, lines 414–419

the file's variables

variable {Xi S Cl : Type}

Runs the after functions listed in order, each on the state returned by the previous one. It rejects if one of them rejects or does not exist.

def afterIn (bs : List (Block S Cl)) (order : List (Nat × String)) (s : S) : Except String S :=
order.foldl (fun acc o => acc.bind fun x =>
(named (o.2 ++ ": no such run") ((bs[o.1]?).bind fun b => b.after.lookup o.2)).bind fun run =>
match run x with
| .ok y => .ok y
| .error e => .error (o.2 ++ ": " ++ e)) (.ok s)
DefinitionChecks two lists of names against each otherJohnson/Desc/Block.lean:423–424
In words
In Lean · Johnson/Desc/Block.lean, lines 423–424

the file's variables

variable {Xi S Cl : Type}

Checks two lists of names against each other: no name occurs twice in all, each name of all occurs exactly once in order, and order has no other name.

def namesOk (all order : List (Nat × String)) : Bool :=
all.all (fun r => all.count r == 1 && order.count r == 1) && order.all fun o => all.contains o
DefinitionPublic check: each claim function is listed exactly onceJohnson/Desc/Block.lean:428–429
In words
In Lean · Johnson/Desc/Block.lean, lines 428–429

the file's variables

variable {Xi S Cl : Type}

Public check: no sub-protocol has two claim functions with the same name, and order lists every claim function of the given sub-protocols exactly once, and nothing else.

def orderOk (bs : List (Block S Cl)) (order : List (Nat × String)) : Bool :=
namesOk (bs.zipIdx.flatMap fun b => b.1.claims.map fun c => (b.2, c.1)) order
DefinitionPublic check: each after function is listed exactly onceJohnson/Desc/Block.lean:432–433
In words
In Lean · Johnson/Desc/Block.lean, lines 432–433

the file's variables

variable {Xi S Cl : Type}

Public check: no sub-protocol has two after functions with the same name, and order lists every after function of the given sub-protocols exactly once, and nothing else.

def orderAfterOk (bs : List (Block S Cl)) (order : List (Nat × String)) : Bool :=
namesOk (bs.zipIdx.flatMap fun b => b.1.after.map fun c => (b.2, c.1)) order
DefinitionTrue if a sub-protocol has no claim function and no after functionJohnson/Desc/Block.lean:436
In words
In Lean · Johnson/Desc/Block.lean, lines 436–436

the file's variables

variable {Xi S Cl : Type}

True if a sub-protocol has no claim function and no after function.

def Block.hasNoClaimsAndNothingAfter (b : Block S Cl) : Bool := b.claims.isEmpty && b.after.isEmpty
DefinitionThe step of a segment directly after its batchJohnson/Desc/Block.lean:441–444
In words
In Lean · Johnson/Desc/Block.lean, lines 441–444

the file's variables

variable {Xi S Cl : Type}

The step of a segment directly after its batch: first the segment's tests on the state, then the after functions of the sub-protocols in hear, in the order orderAfter. It stops at the first rejection.

def Link.runBehind (L : Link S Cl) (s : S) : Except String S :=
match L.tests s with
| .ok _ => afterIn L.hear L.orderAfter s
| .error e => .error ("the tests behind the adding: " ++ e)
DefinitionA segment as a list of sub-protocolsJohnson/Desc/Block.lean:451–459
In words
In Lean · Johnson/Desc/Block.lean, lines 451–459

the file's variables

variable {Xi S Cl : Type}

Lists a segment's sub-protocols in order.

def Link.blocksInOrder (L : Link S Cl) : List (Block S Cl) :=
First

First, a roundlessBlock that runs lay.

{ roundlessBlock (L.name ++ ": laid") L.chain (some L.number) 0 L.lay with

Its public check planOk requires orderOk on order, orderAfterOk on orderAfter, and Block.hasNoClaimsAndNothingAfter of batch and of every sub-protocol of close.

planOk := orderOk L.hear L.order && orderAfterOk L.hear L.orderAfter &&
L.close.all Block.hasNoClaimsAndNothingAfter && (L.batch (claimsInBy L.each L.hear L.order)).hasNoClaimsAndNothingAfter } ::
Then

Then those of hear, and batch applied to the function that gathers the claims (claimsInBy).

L.hear ++ [L.batch (claimsInBy L.each L.hear L.order),

Then a roundlessBlock that runs runBehind, and those of close.

roundlessBlock (L.name ++ ": behind the batching") L.chain (some L.number) (L.hear.length + 2)
L.runBehind] ++ L.close ++
Last

Last, a roundlessBlock that runs clear.

[roundlessBlock (L.name ++ ": cleared") L.chain (some L.number) (L.hear.length + L.close.length + 3)
L.clear]
DefinitionA chain as a list of sub-protocolsJohnson/Desc/Block.lean:463–465
In words
In Lean · Johnson/Desc/Block.lean, lines 463–465

the file's variables

variable {Xi S Cl : Type}

Lists a chain's sub-protocols in order: first, those of front, those of each segment of links as listed by Link.blocksInOrder, those of back, and last. Each sub-protocol outside a segment has Block.hasNoClaimsAndNothingAfter added to its public check planOk, so it fails that check if it has a claim function or an after function.

def Chain.blocksInOrder (c : Chain S Cl) : List (Block S Cl) :=
let bare := fun b : Block S Cl => { b with planOk := b.planOk && b.hasNoClaimsAndNothingAfter }
bare c.first :: c.front.map bare ++ c.links.flatMap Link.blocksInOrder ++ c.back.map bare ++ [bare c.last]
DefinitionThe prime 2^64 − 2^32 + 1 as a 64-bit wordJohnson/Desc/Block.lean:677
In words
In Lean · Johnson/Desc/Block.lean, lines 677–677

the file's variables

variable {Xi S Cl : Type}

The prime 2^64 − 2^32 + 1 as a 64-bit word.

def fieldPrimeWord : UInt64 := 0xFFFFFFFF00000001
DefinitionChecks that each word of a view that encodes a field element is below the primeJohnson/Desc/Block.lean:681–691
In words
In Lean · Johnson/Desc/Block.lean, lines 681–691

the file's variables

variable {Xi S Cl : Type}

Checks that every 64-bit word that encodes a field element in a view (in prover messages, sampled elements and opened columns) is below the prime 2^64 − 2^32 + 1.

def viewWordsBelowPrime (v : Fmt.View) : Bool :=
(v.rounds.all fun r =>
(r.drawn.elems.all fun x => x.1 < fieldPrimeWord && x.2.1 < fieldPrimeWord && x.2.2 < fieldPrimeWord) &&
r.vals.all fun g =>
match g with
| .f x => x < fieldPrimeWord
| .e x => x.1 < fieldPrimeWord && x.2.1 < fieldPrimeWord && x.2.2 < fieldPrimeWord
| .answer x => x.1 < fieldPrimeWord && x.2.1 < fieldPrimeWord && x.2.2 < fieldPrimeWord
| .word _ => true
| .root _ => true) &&
v.opened.all fun o => o.2.2.all (· < fieldPrimeWord)
DefinitionRuns a list of sub-protocols in orderJohnson/Desc/Block.lean:696–704
In words
In Lean · Johnson/Desc/Block.lean, lines 696–704

the file's variables

variable {Xi S Cl : Type}

Runs a list of sub-protocols in order.

def foldBlocks (firstTree : Nat) : List (Block S Cl) → S → List Fmt.RoundView → List OpenedColumn →
Except String (S × List Fmt.RoundView × List OpenedColumn)
End

If no sub-protocol is left, the result is the final state and the remaining round values and columns.

| [], s, rs, cols => .ok (s, rs, cols)
| b :: l, s, rs, cols =>
Step

Each sub-protocol takes from the front of the list one round value for each round it declares.

let (mine, rest) := rs.splitAt b.rounds.length

It rejects if too few remain.

if mine.length ≠ b.rounds.length then .error (b.name ++ ": the stretch is short") else

Block.step then runs it on those values and the list of columns.

match b.step firstTree s mine cols with

The first rejection is the result.

| .error e => .error (b.name ++ ": " ++ e)

The columns that it used are dropped from the front of the list of columns.

| .ok (s', k) => foldBlocks firstTree l s' rest (cols.drop k)
DefinitionAppends one empty roundJohnson/Desc/Block.lean:707–708
In words
In Lean · Johnson/Desc/Block.lean, lines 707–708

the file's variables

variable {Xi S Cl : Type}

Appends one empty round (no message items, no challenge, no digest) to a view.

def withEmptySealRound (v : Fmt.View) : Fmt.View :=
{ v with rounds := v.rounds ++ [⟨[], ⟨[], [], [], none⟩⟩] }
DefinitionRuns one chain on its view from an initial state, using foldBlocksJohnson/Desc/Block.lean:711–718
In words
In Lean · Johnson/Desc/Block.lean, lines 711–718

the file's variables

variable {Xi S Cl : Type}

Runs one chain on its view from an initial state, using foldBlocks. It rejects if the chain has no sub-protocols, if a sub-protocol rejects, if too few rounds remain for a sub-protocol, or if a round or opened column is left over.

def chainAt (name : String) (firstTree : Nat) (bs : List (Block S Cl)) (s : S) (v : Fmt.View) :
Except String S :=
if bs.isEmpty then .error (name ++ ": it has no block") else
match foldBlocks firstTree bs s v.rounds v.opened with
| .ok (s', [], []) => .ok s'
| .ok (_, rs, cols) =>
.error (name ++ s!": left over: {rs.length} rounds, {cols.length} columns")
| .error e => .error (name ++ ": refused at " ++ e)
The public checks on a written IOP · 54 cards
DefinitionThe declared rounds of a file's three chainsJohnson/Desc/BookPlan.lean:131
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 131–131

The declared rounds of the three chains of a file: a triple with one list of Fmt.DeclaredRound for each chain.

abbrev DeclaredRoundsByChain : Type := List Fmt.DeclaredRound × List Fmt.DeclaredRound × List Fmt.DeclaredRound
DefinitionThe oracle messages that each chain sendsJohnson/Desc/BookPlan.lean:134
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 134–134

For each chain in order, the list of oracle messages that it sends, in the order of sending. The type does not fix the number of chains; the protocol has three. Lean lists are indexed from 0, so index 0 is chain 1.

abbrev SentOraclesByChain : Type := List (List Oracle)
DefinitionOne opening of a Merkle treeJohnson/Desc/BookPlan.lean:138–142
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 138–142

One opening of a Merkle tree: the chain that sent the tree, the tree's number on that chain, the shape that the opening round declares, and the logarithm of that round's range of positions.

structure Opening where
chain : Nat
sent : Nat
shape : Fmt.Shape
range : Nat
DefinitionAll openings of Merkle trees in the three chainsJohnson/Desc/BookPlan.lean:145–149
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 145–149

All openings of Merkle trees in the three chains, in order. Queries to committed tables are not among them.

def openings (D : DeclaredRoundsByChain) : List Opening :=
[D.1, D.2.1, D.2.2].zipIdx.flatMap fun c => c.1.flatMap fun d => d.opens.map fun o =>
match o.2 with
| .own n => ⟨c.2, n, o.1, d.entry.logN⟩
| .taken chain sent => ⟨chain, sent, o.1, d.entry.logN⟩
DefinitionThe declared oracle message for the tree of an openingJohnson/Desc/BookPlan.lean:151–152
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 151–152

The declared oracle message for an opening's tree, if the list of oracle messages contains one for the chain that sent the tree and the tree's number on that chain.

def rootOf (T : SentOraclesByChain) (o : Opening) : Option Oracle :=
(T[o.chain]?).bind (·[o.sent]?)
DefinitionApplies a condition to the tenants of an opened treeJohnson/Desc/BookPlan.lean:155–156
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 155–156

Evaluates a condition on the tenants of an opened tree; returns true if no oracle message is declared for that tree.

def onSymbolComponents (T : SentOraclesByChain) (o : Opening) (f : List SymbolComponent → Bool) : Bool :=
((rootOf T o).map fun r => f r.tenants).getD true
DefinitionClause: every oracle message has a tenant, and its tenants' words add up to the symbol's widthJohnson/Desc/BookPlan.lean:158–160
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 158–160

Clause: every oracle message has at least one tenant, and its tenants' main and mask words add up to the symbol's width.

def sum (T : SentOraclesByChain) : Bool :=
T.all fun c => c.all fun r =>
!r.tenants.isEmpty && r.tenants.foldl (fun n t => n + t.main + t.mask) 0 == r.words
DefinitionClause: every tenant has field degree 1 or 3Johnson/Desc/BookPlan.lean:162–164
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 162–164

Clause: every tenant has field degree 1 or 3, the number of its main words is a multiple of that degree, and the number of its mask words is a multiple of 3.

def rows (T : SentOraclesByChain) : Bool :=
T.all fun c => c.all fun r => r.tenants.all fun t =>
(t.degree == 1 || t.degree == 3) && t.main % t.degree == 0 && t.mask % 3 == 0
DefinitionClause: every opened tree has a declared oracle messageJohnson/Desc/BookPlan.lean:166–167
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 166–167

Clause: for every tree that is opened, an oracle message is declared.

def everyOpenedTreeIsListed (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : Bool :=
(openings D).all fun o => (rootOf T o).isSome
DefinitionClause: no opened tree is deeper than the logarithm of the range of sampled positionsJohnson/Desc/BookPlan.lean:169–170
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 169–170

Clause: no opened tree is deeper than the logarithm of the range from which the opening round samples positions.

def range (D : DeclaredRoundsByChain) : Bool :=
(openings D).all fun o => decide (o.shape.a ≤ o.range)
DefinitionClause: in an opened tree, all tenants with an out-of-domain sample have the same groupsJohnson/Desc/BookPlan.lean:172–176
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 172–176

Clause: in every opened tree, all tenants with an out-of-domain sample have the same list of groups.

def alike (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : Bool :=
(openings D).all fun o => onSymbolComponents T o fun l =>
match (l.filter (·.sampled)).map (·.groups) with
| [] => true
| a :: r => r.all (· == a)
DefinitionClause: in an opened tree with a tenant that has no out-of-domain sample, each tenant with one belongs to at most one groupJohnson/Desc/BookPlan.lean:178–180
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 178–180

Clause: if an opened tree has a tenant without an out-of-domain sample, each of its tenants with one belongs to at most one group.

def oneGroup (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : Bool :=
(openings D).all fun o => onSymbolComponents T o fun l =>
l.all (·.sampled) || (l.filter (·.sampled)).all fun t => decide (t.groups.length ≤ 1)
DefinitionClause: a tree with a tenant without an out-of-domain sample is opened at most onceJohnson/Desc/BookPlan.lean:182–185
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 182–185

Clause: a tree that has a tenant without an out-of-domain sample is opened at most once in the whole file.

def once (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : Bool :=
(openings D).all fun o => onSymbolComponents T o fun l =>
l.all (·.sampled) ||
decide (((openings D).filter fun p => p.chain == o.chain && p.sent == o.sent).length ≤ 1)
DefinitionThe number of tenants with an out-of-domain sample among the given oracle messagesJohnson/Desc/BookPlan.lean:188
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 188–188

The number of tenants with an out-of-domain sample among the given oracle messages.

def saySampled (os : List Oracle) : Nat := (os.flatMap (·.tenants)).countP (·.sampled)
DefinitionOne chain's rounds and tenants agree on the numbers of sample answersJohnson/Desc/BookPlan.lean:192–198
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 192–198

A check on one chain. It processes the rounds in order and maintains due, the number of sample answers that the next round must declare (answered initializes it to 0).

def answeredIn : List Fmt.DeclaredRound → List Oracle → Nat → Bool
End

After the last round, due must be 0, and no remaining oracle message may have a tenant with an out-of-domain sample.

| [], os, due => due == 0 && saySampled os == 0
| d :: l, os, due =>
Each round

k is the number of tenants with an out-of-domain sample among the oracle messages that the round sends.

let k := saySampled (os.take d.entry.roots)

The round's answers must equal due.

d.entry.answers == due &&

If k ≥ 1, the round must be of kind seeds and have drawNZ ≠ 0, where drawNZ counts the sampled field elements that must be nonzero.

(k == 0 || (d.entry.drawNZ != 0 && Fmt.kindOf d.entry.name == some .seeds)) &&

In every case, due for the next round is k · drawNZ, which is 0 if k = 0.

answeredIn l (os.drop d.entry.roots) (k * d.entry.drawNZ)
DefinitionClause: answeredIn holds on each of the three chainsJohnson/Desc/BookPlan.lean:200–201
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 200–201

Clause: answeredIn holds on each of the three chains, so the tenants' flags and the schedule's numbers of sample answers agree.

def answered (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : Bool :=
[D.1, D.2.1, D.2.2].zipIdx.all fun c => answeredIn c.1 ((T[c.2]?).getD []) 0
DefinitionClause: oracle messages are declared for exactly three chainsJohnson/Desc/BookPlan.lean:204–206
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 204–206

Clause: oracle messages are declared for exactly three chains, and each chain has as many as there are Merkle roots in its schedule entries.

def sentOraclesMatchEntries (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : Bool :=
T.length == 3 && [D.1, D.2.1, D.2.2].zipIdx.all fun c =>
((T[c.2]?).getD []).length == c.1.foldl (fun n d => n + d.entry.roots) 0
DefinitionTrue if the oracle message for a given chain and number has a tenant with an out-of-domain sampleJohnson/Desc/BookPlan.lean:215–216
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 215–216

True if the oracle message with the given chain and number has a tenant with an out-of-domain sample; false if no oracle message is declared for that chain and number.

def holdsSampled (T : SentOraclesByChain) (chain root : Nat) : Bool :=
((T[chain]?).bind (·[root]?)).any fun r => r.tenants.any (·.sampled)
DefinitionClause: a tree that a chain sends itself is opened no earlier than the round that sends itJohnson/Desc/BookPlan.lean:220–226
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 220–226

Clause: a condition on every opening of a tree in the three chains.

def inTime (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : Bool :=
[D.1, D.2.1, D.2.2].zipIdx.all fun c => c.1.zipIdx.all fun d => d.1.opens.all fun o =>
match o.2 with
Own tree

A chain may open a tree that it sends itself (.own) no earlier than the round that sends it, and only in a later round if the tree's oracle message has a tenant with an out-of-domain sample.

| .own n => (roundOfRoot c.1 n).any fun i =>
decide (i + (if holdsSampled T c.2 n then 1 else 0) ≤ d.2)
Other tree

Only the third chain may open a tree of another chain (.taken), and that tree must be one that the first or second chain sends.

| .taken chain sent => c.2 == 2 && decide (chain < 2) &&
(roundOfRoot (([D.1, D.2.1, D.2.2][chain]?).getD []) sent).isSome
DefinitionEach round of one chain declares its opened trees in strictly increasing orderJohnson/Desc/BookPlan.lean:244–245
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 244–245

For one chain: in every round the opened trees are declared in strictly increasing order of the pair (sending chain, number on that chain).

def inOrderIn (own : Nat) (ds : List Fmt.DeclaredRound) : Bool :=
ds.all fun d => risingPlaces (d.opens.map fun o => treePlace own o.2)
DefinitionClause: inOrderIn holds on each of the three chainsJohnson/Desc/BookPlan.lean:248
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 248–248

Clause: inOrderIn holds on each of the three chains, so no round opens the same tree twice.

def inOrder (D : DeclaredRoundsByChain) : Bool := inOrderIn 0 D.1 && inOrderIn 1 D.2.1 && inOrderIn 2 D.2.2
DefinitionThe eleven clauses on Merkle treesJohnson/Desc/BookPlan.lean:259–262
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 259–262

The eleven clauses on Merkle trees, their tenants and their openings, each with its name.

def clauses (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : List (String × Bool) :=
[("sum", sum T), ("rows", rows T), ("told", everyOpenedTreeIsListed D T), ("range", range D), ("alike", alike D T),
("oneGroup", oneGroup D T), ("once", once D T), ("answered", answered D T),
("allTold", sentOraclesMatchEntries D T), ("inTime", inTime D T), ("inOrder", inOrder D)]
DefinitionAll eleven clauses holdJohnson/Desc/BookPlan.lean:265
In words
In Lean · Johnson/Desc/BookPlan.lean, lines 265–265

True exactly when all eleven clauses in clauses hold for the declared rounds D and the oracle messages T.

def allClausesHold (D : DeclaredRoundsByChain) (T : SentOraclesByChain) : Bool := (clauses D T).all (·.2)
DefinitionThe declared rounds of the three chainsJohnson/Desc/Block.lean:478–481
In words
In Lean · Johnson/Desc/Block.lean, lines 478–481

the file's variables

variable {Xi S Cl : Type}

The declared rounds of the three chains, obtained by concatenating the rounds of each chain's sub-protocols in order.

def FileDescription.roundsDeclaredByBlocks (F : FileDescription Xi) :
List Fmt.DeclaredRound × List Fmt.DeclaredRound × List Fmt.DeclaredRound :=
(F.first.blocksInOrder.flatMap (·.rounds), F.shared.blocksInOrder.flatMap (·.rounds),
F.second.blocksInOrder.flatMap (·.rounds))
DefinitionThe table of all sub-protocols of the three chains in orderJohnson/Desc/Block.lean:488–489
In words
In Lean · Johnson/Desc/Block.lean, lines 488–489

the file's variables

variable {Xi S Cl : Type}

The table of all sub-protocols of the three chains in order: name, address and number of rounds.

def FileDescription.places (F : FileDescription Xi) : List (String × Place × Nat) :=
placesOf F.first.blocksInOrder ++ placesOf F.shared.blocksInOrder ++ placesOf F.second.blocksInOrder
DefinitionPublic check on one sub-protocolJohnson/Desc/Block.lean:494–498
In words
In Lean · Johnson/Desc/Block.lean, lines 494–498

the file's variables

variable {Xi S Cl : Type}

Public check on one sub-protocol: it lists one oracle message for each Merkle root of each round, each symbol's number of words is the sum of its tenants' numbers of words, and each tenant has field degree 1 or 3.

def Block.shaped (b : Block S Cl) : Bool :=
b.oracles.length == b.rounds.length &&
(b.rounds.zip b.oracles).all fun x => x.2.length == x.1.entry.roots &&
x.2.all fun o => (o.tenants.map fun t => t.main + t.mask).sum == o.words &&
o.tenants.all fun t => t.degree == 1 || t.degree == 3
DefinitionEvery opening in the file of a tree that a given chain sendsJohnson/Desc/Block.lean:502–507
In words
In Lean · Johnson/Desc/Block.lean, lines 502–507

the file's variables

variable {Xi S Cl : Type}

For one chain, every opening in the file of a tree that this chain sends: the tree's number in the chain, and the depth and width that the opening declares.

def openedOwn (D : List Fmt.DeclaredRound × List Fmt.DeclaredRound × List Fmt.DeclaredRound) (chain : Nat) :
List (Nat × Nat × Nat) :=
[D.1, D.2.1, D.2.2].zipIdx.flatMap fun c => (c.1.flatMap (·.opens)).filterMap fun o =>
match o.2 with
| .own n => if c.2 == chain then some (n, o.1.a, o.1.W) else none
| .taken ch sent => if ch == chain then some (sent, o.1.a, o.1.W) else none
DefinitionThe tree number of the third chain's first own treeJohnson/Desc/Block.lean:511–512
In words
In Lean · Johnson/Desc/Block.lean, lines 511–512

the file's variables

variable {Xi S Cl : Type}

The tree number (Shape.tree) of the third chain's first own tree: the number of Merkle roots that the first chain sends, plus 1, regardless of what the second chain sends.

def FileDescription.lastChainFirstTreeNumber (F : FileDescription Xi) : Nat :=
F.roundsDeclaredByBlocks.1.foldl (fun n r => n + r.entry.roots) 0 + 1
DefinitionPublic check on tree numbers in shapesJohnson/Desc/Block.lean:518–522
In words
In Lean · Johnson/Desc/Block.lean, lines 518–522

the file's variables

variable {Xi S Cl : Type}

Public check on the tree numbers in the declared shapes.

def FileDescription.labelsOk (F : FileDescription Xi) : Bool :=
[F.roundsDeclaredByBlocks.1, F.roundsDeclaredByBlocks.2.1, F.roundsDeclaredByBlocks.2.2].zipIdx.all fun c => (c.1.flatMap (·.opens)).all fun o =>
match o.2 with
Own tree

If a chain opens its own tree number n, Shape.tree must be n, or lastChainFirstTreeNumber + n on the third chain.

| .own n => o.1.tree == (if c.2 == 2 then F.lastChainFirstTreeNumber + n else n)
Other tree

Only the third chain may open a tree of another chain, which must be the first or the second; Shape.tree must be the tree's number on the chain that sends it.

| .taken ch sent => c.2 == 2 && decide (ch < 2) && o.1.tree == sent
DefinitionEvery sub-protocol of a list passes its own public check planOk and the check shapedJohnson/Desc/Block.lean:525
In words
In Lean · Johnson/Desc/Block.lean, lines 525–525

the file's variables

variable {Xi S Cl : Type}

Every sub-protocol of a list passes its own public check planOk and the check shaped.

def blocksOk (bs : List (Block S Cl)) : Bool := bs.all fun b => b.planOk && b.shaped
DefinitionLogarithmic length and symbol width of each oracle message sentJohnson/Desc/Block.lean:528–529
In words
In Lean · Johnson/Desc/Block.lean, lines 528–529

the file's variables

variable {Xi S Cl : Type}

For a chain's sub-protocols, the logarithmic length and symbol width of every oracle message they send, in the order of sending.

def sentOf (bs : List (Block S Cl)) : List (Nat × Nat) :=
bs.flatMap fun b => b.oracles.flatMap fun l => l.map fun o => (o.logLength, o.words)
DefinitionThe number of the round that sends a chain's n-th oracle messageJohnson/Desc/Block.lean:532–534
In words
In Lean · Johnson/Desc/Block.lean, lines 532–534

the file's variables

variable {Xi S Cl : Type}

The number of the round that sends a chain's n-th oracle message, if there is one, found by counting the Merkle roots in the schedule entries; both numbers start from 0. This is the same function as BookPlan.roundOfRoot.

def sendRound : List Fmt.DeclaredRound → Nat → Option Nat
| [], _ => none
| r :: l, n => if n < r.entry.roots then some 0 else (sendRound l (n - r.entry.roots)).map (· + 1)
DefinitionTrue if a round's challenge contains a field element, a position or a matrix entryJohnson/Desc/Block.lean:537
In words
In Lean · Johnson/Desc/Block.lean, lines 537–537

the file's variables

variable {Xi S Cl : Type}

True if a round's challenge has at least one field element, position or matrix entry.

def drawsAny (r : Fmt.DeclaredRound) : Bool := r.entry.drawE + r.entry.poss + r.entry.trits != 0
DefinitionOn one chain, every oracle message that a sub-protocol names as needed beforehand is sent no later than its first challengeJohnson/Desc/Block.lean:546–561
In words
In Lean · Johnson/Desc/Block.lean, lines 546–561

the file's variables

variable {Xi S Cl : Type}

A check on the sub-protocols of one chain. Here c is the chain's index (counted from 0) and from' is the number of the chain's rounds before the first sub-protocol in the list.

def beforeAt (D : List Fmt.DeclaredRound × List Fmt.DeclaredRound × List Fmt.DeclaredRound)
(O : List Oracle × List Oracle × List Oracle) (c : Nat) : Nat → List (Block S Cl) → Bool
| _, [] => true
| from', b :: l =>
Pairs

Each pair in a sub-protocol's before names a chain and a message number on it.

(b.before.all fun m =>
let ds := if m.1 == 1 then D.1 else if m.1 == 2 then D.2.1 else D.2.2
let os := if m.1 == 1 then O.1 else if m.1 == 2 then O.2.1 else O.2.2
Limit

On this chain, the limit is the round of the sub-protocol's first challenge (drawsAny) or, if it has no challenge, the round after its last one; on another chain, it is that chain's number of rounds.

let last := if m.1 == c + 1 then from' + b.rounds.findIdx drawsAny else ds.length
Sent

The message must be sent on the chain that the pair names.

match sendRound ds m.2 with
| none => false
| some i =>

That chain's number must be from 1 to c + 1, so it is this chain or a lower-numbered one. On this chain the message must be sent no later than the limit.

decide (1 ≤ m.1) && decide (m.1 ≤ c + 1) && decide (i ≤ last) &&
Answers

If the message has a tenant with an out-of-domain sample, some later round of the message's chain must have answers ≠ 0; if that chain is this one, that round must also be within the limit.

(!((os[m.2]?).any fun o => o.tenants.any (·.sampled)) ||
ds.zipIdx.any fun r =>
r.1.entry.answers != 0 && decide (i < r.2) && decide (r.2 ≤ last))) &&
beforeAt D O c (from' + b.rounds.length) l
DefinitionThe oracle messages that a chain's sub-protocols sendJohnson/Desc/Block.lean:564
In words
In Lean · Johnson/Desc/Block.lean, lines 564–564

the file's variables

variable {Xi S Cl : Type}

The oracle messages that a chain's sub-protocols send, in the order of sending.

def oraclesOf (bs : List (Block S Cl)) : List Oracle := bs.flatMap fun b => b.oracles.flatMap id
DefinitionPublic check on orderJohnson/Desc/Block.lean:567–570
In words
In Lean · Johnson/Desc/Block.lean, lines 567–570

the file's variables

variable {Xi S Cl : Type}

Public check on order: beforeAt holds on each of the three chains, for the rounds that the sub-protocols declare and the oracle messages that they list.

def FileDescription.beforeOk (F : FileDescription Xi) : Bool :=
let O := (oraclesOf F.first.blocksInOrder, oraclesOf F.shared.blocksInOrder, oraclesOf F.second.blocksInOrder)
beforeAt F.roundsDeclaredByBlocks O 0 0 F.first.blocksInOrder && beforeAt F.roundsDeclaredByBlocks O 1 0 F.shared.blocksInOrder &&
beforeAt F.roundsDeclaredByBlocks O 2 0 F.second.blocksInOrder
DefinitionThe three chains' oracle messagesJohnson/Desc/Block.lean:573–574
In words
In Lean · Johnson/Desc/Block.lean, lines 573–574

the file's variables

variable {Xi S Cl : Type}

The three chains' oracle messages, chain by chain, in the form that the checks of BookPlan take.

def FileDescription.roots (F : FileDescription Xi) : BookPlan.SentOraclesByChain :=
[oraclesOf F.first.blocksInOrder, oraclesOf F.shared.blocksInOrder, oraclesOf F.second.blocksInOrder]
DefinitionPublic check on Merkle treesJohnson/Desc/Block.lean:578
In words
In Lean · Johnson/Desc/Block.lean, lines 578–578

the file's variables

variable {Xi S Cl : Type}

Public check on Merkle trees: the eleven clauses of BookPlan.allClausesHold, on who may share a tree, when and how often a tree may be opened, and which prover messages carry out-of-domain sample answers.

def FileDescription.treeSharingOk (F : FileDescription Xi) : Bool := BookPlan.allClausesHold F.roundsDeclaredByBlocks F.roots
DefinitionPublic check on addressesJohnson/Desc/Block.lean:586–591
In words
In Lean · Johnson/Desc/Block.lean, lines 586–591

the file's variables

variable {Xi S Cl : Type}

Public check: each sub-protocol's address gives the chain in whose list it appears, and no two sub-protocols of the file have the same chain, segment and number.

def FileDescription.placesOk (F : FileDescription Xi) : Bool :=
let inChain := fun (n : Nat) (l : List (String × Place × Nat)) => l.all fun p => p.2.1.chain == n
let all := F.places.map fun p => (p.2.1.chain, p.2.1.link, p.2.1.piece)
inChain 1 (placesOf F.first.blocksInOrder) && inChain 2 (placesOf F.shared.blocksInOrder) &&
inChain 3 (placesOf F.second.blocksInOrder) &&
all.all fun x => all.count x == 1
DefinitionPer round: positions are sampled iff something is queriedJohnson/Desc/Block.lean:606–614
In words
In Lean · Johnson/Desc/Block.lean, lines 606–614

the file's variables

variable {Xi S Cl : Type}

A check on one declared round.

def readsFit (r : Fmt.DeclaredRound) : Bool :=
Positions

The round samples positions exactly when it queries a committed table or opens another Merkle tree.

((r.entry.poss != 0) == (!r.stored.isEmpty || !r.opens.isEmpty)) &&
Tables

It never does both, and the numbers of the committed tables are strictly increasing.

(r.stored.isEmpty ||
(r.opens.isEmpty && Fmt.increasing (r.stored.map (·.item)) &&

Their shares run from position 0 without a gap up to the number of sampled positions.

Fmt.partsFrom 0 r.stored == some r.entry.poss &&

Each share has at least one position. Each committed table's shape is marked as a committed table's tree, with tree number 0 and depth at most the round's logN, and its width W is from 1 to 2^24 − 1.

r.stored.all fun t =>
decide (1 ≤ t.count) && t.sh.stored && decide (t.sh.a ≤ r.entry.logN) &&
t.sh.tree == 0 && decide (1 ≤ t.sh.W) && decide (t.sh.W < 2 ^ 24))) &&
Trees

Each other tree's shape is not marked as a committed table's tree, and its width W is at least 1 and at most 2^24 − 1.

r.opens.all fun o => !o.1.stored && decide (1 ≤ o.1.W) && decide (o.1.W < 2 ^ 24)
DefinitionPublic check on each round's queriesJohnson/Desc/Block.lean:617–618
In words
In Lean · Johnson/Desc/Block.lean, lines 617–618

the file's variables

variable {Xi S Cl : Type}

Public check: readsFit holds at every round of the three chains.

def FileDescription.readsOk (F : FileDescription Xi) : Bool :=
(F.roundsDeclaredByBlocks.1 ++ F.roundsDeclaredByBlocks.2.1 ++ F.roundsDeclaredByBlocks.2.2).all readsFit
DefinitionPublic check on the first chain's last sub-protocolJohnson/Desc/Block.lean:623
In words
In Lean · Johnson/Desc/Block.lean, lines 623–623

the file's variables

variable {Xi S Cl : Type}

Public check: the last sub-protocol of the first chain declares at least one round.

def FileDescription.sealLast (F : FileDescription Xi) : Bool := !F.first.last.rounds.isEmpty
DefinitionPublic check that the declared shapes of oracle messages match those at their openings, and that every oracle message is openedJohnson/Desc/Block.lean:627–631
In words
In Lean · Johnson/Desc/Block.lean, lines 627–631

the file's variables

variable {Xi S Cl : Type}

Public check: the logarithmic length and symbol width declared where an oracle message is sent equal the depth and width declared at each of its openings, and every oracle message is opened at least once.

def FileDescription.sentFit (F : FileDescription Xi) : Bool :=
[sentOf F.first.blocksInOrder, sentOf F.shared.blocksInOrder, sentOf F.second.blocksInOrder].zipIdx.all fun c =>
let opened := openedOwn F.roundsDeclaredByBlocks c.2
opened.all (fun o => c.1[o.1]? == some (o.2.1, o.2.2)) &&
(List.range c.1.length).all fun n => opened.any fun o => o.1 == n
DefinitionConjunction of public checksJohnson/Desc/Block.lean:639–643
In words
In Lean · Johnson/Desc/Block.lean, lines 639–643

the file's variables

variable {Xi S Cl : Type}

The conjunction of these public checks: fileOk; every sub-protocol's own checks and its test shaped; the sub-protocols' rounds equal the declared rounds plans; every queried committed table has depth tableDepth; labelsOk, placesOk, beforeOk, treeSharingOk, readsOk and sentFit.

def FileDescription.planOkCore (F : FileDescription Xi) : Bool :=
F.fileOk && blocksOk F.first.blocksInOrder && blocksOk F.shared.blocksInOrder && blocksOk F.second.blocksInOrder &&
F.roundsDeclaredByBlocks.1 == F.plans.1 && F.roundsDeclaredByBlocks.2.1 == F.plans.2.1 && F.roundsDeclaredByBlocks.2.2 == F.plans.2.2 &&
(F.roundsDeclaredByBlocks.1 ++ F.roundsDeclaredByBlocks.2.1 ++ F.roundsDeclaredByBlocks.2.2).all (fun r => r.stored.all (·.sh.a == F.tableDepth)) &&
F.labelsOk && F.placesOk && F.beforeOk && F.treeSharingOk && F.readsOk && F.sentFit
DefinitionConjunction of public checks: planOkCore and sealLastJohnson/Desc/Block.lean:647
In words
In Lean · Johnson/Desc/Block.lean, lines 647–647

the file's variables

variable {Xi S Cl : Type}

planOkCore and sealLast: the public checks that run performs before reading the instance or a view.

def FileDescription.planOk (F : FileDescription Xi) : Bool := F.planOkCore && F.sealLast
DefinitionPublic check: the sub-protocols' addresses and numbers of rounds equal a given tableJohnson/Desc/Block.lean:656
In words
In Lean · Johnson/Desc/Block.lean, lines 656–656

the file's variables

variable {Xi S Cl : Type}

Public check: the addresses and numbers of rounds of all sub-protocols, in order, equal the table wanted. It is not part of planOk; of the three IOPs, it is called for the offline IOP, by Key.keyDataAndDecisionOfDescription.

def FileDescription.wantedOk (F : FileDescription Xi) : Bool := F.places.map (·.2) == F.wanted
DefinitionA list of sub-protocols as triplesJohnson/Desc/Block.lean:660–661
In words
In Lean · Johnson/Desc/Block.lean, lines 660–661

the file's variables

variable {Xi S Cl : Type}

For each sub-protocol in a list: its address, whether one of its rounds samples a challenge, and its list before.

def beforesOf (bs : List (Block S Cl)) : List (Place × Bool × List (Nat × Nat)) :=
bs.map fun b => (b.place, b.rounds.any drawsAny, b.before)
DefinitionPublic check: at each listed address, a sub-protocol samples a challenge and names the listed oracle messagesJohnson/Desc/Block.lean:670–672
In words
In Lean · Johnson/Desc/Block.lean, lines 670–672

the file's variables

variable {Xi S Cl : Type}

Public check: for each row of owed, some sub-protocol at the row's address samples a challenge and lists all the row's oracle messages in before. Not part of planOk; called only by Key.keyDataAndDecisionOfDescription, for the offline IOP.

def FileDescription.owedOk (F : FileDescription Xi) : Bool :=
let all := beforesOf F.first.blocksInOrder ++ beforesOf F.shared.blocksInOrder ++ beforesOf F.second.blocksInOrder
F.owed.all fun r => all.any fun b => b.1 == r.1 && b.2.1 && r.2.all b.2.2.contains
DefinitionA chain that does nothingJohnson/Desc/Link/OneChainFileDescription.lean:72–74
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 72–74

the file's variables

variable {Xi : Type}

A chain that does nothing: two sub-protocols with no rounds that leave the state unchanged.

def roundlessChain {Cl : Type} (n : Nat) : Chain Unit Cl :=
{ first := roundlessBlock "idle: first" n none 0 fun s => .ok s, front := [], links := [], back := []
last := roundlessBlock "idle: last" n none 1 fun s => .ok s }
DefinitionA one-chain written IOP as a three-chain one whose second and third chains do nothingJohnson/Desc/Link/OneChainFileDescription.lean:81–87
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 81–87

the file's variables

variable {Xi : Type}

A one-chain written IOP viewed as a three-chain one whose second and third chains do nothing. It is used to apply the three-chain public checks; no decision is run on it.

def OneChainFileDescription.asFile (F : OneChainFileDescription Xi) : FileDescription Xi :=
{ S₁ := F.S, S₂ := Unit, S₃ := Unit, Cl := F.Cl, plans := (F.plan, [], []), tableDepth :=
F.tableDepth
fileOk := F.fileOk, okStart := F.okStart, XiPub := Xi, pub := id, start₁ := F.start
start₂ := fun _ => (), start₃ := fun _ _ _ => .ok (), first := F.chain
wanted := [], owed := []
shared := roundlessChain 2, second := roundlessChain 3, fin := fun x s _ _ => F.fin x s }
DefinitionThe declared rounds of the chainJohnson/Desc/Link/OneChainFileDescription.lean:90
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 90–90

the file's variables

variable {Xi : Type}

The declared rounds of the one chain, obtained by concatenating the rounds of its sub-protocols in order.

def OneChainFileDescription.roundsDeclaredByBlocks (F : OneChainFileDescription Xi) : List Fmt.DeclaredRound := F.chain.blocksInOrder.flatMap (·.rounds)
DefinitionPublic check on committed tables' numbersJohnson/Desc/Link/OneChainFileDescription.lean:98–99
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 98–99

the file's variables

variable {Xi : Type}

Public check: every committed table that a round queries has a number below tables, the file's number of committed tables.

def OneChainFileDescription.storedOk (F : OneChainFileDescription Xi) : Bool :=
F.roundsDeclaredByBlocks.all fun r => r.stored.all fun s => decide (s.item < F.tables)
DefinitionThe public checks of a one-chain written IOP as a list of names with their valuesJohnson/Desc/Link/OneChainFileDescription.lean:103–111
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 103–111

the file's variables

variable {Xi : Type}

The list of names and values of the public checks of a one-chain written IOP, used to produce an error message.

def OneChainFileDescription.planClauses (F : OneChainFileDescription Xi) : List (String × Bool) :=
let G := F.asFile
[("fileOk", G.fileOk), ("the blocks' own tests, and shaped", blocksOk G.first.blocksInOrder),
("the blocks' declared rounds in a row are the plan's, whole", G.roundsDeclaredByBlocks.1 == G.plans.1),
("labelsOk", G.labelsOk), ("placesOk", G.placesOk), ("beforeOk", G.beforeOk),
("bookOk", G.treeSharingOk),
("readsOk", G.readsOk),
("FileDesc.planOkCore, whole", G.planOkCore),
("storedOk", F.storedOk)]
DefinitionThe public checks of a one-chain written IOPJohnson/Desc/Link/OneChainFileDescription.lean:114
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 114–114

the file's variables

variable {Xi : Type}

The public checks of a one-chain written IOP: FileDescription.planOkCore applied to asFile, and storedOk.

def OneChainFileDescription.planOk (F : OneChainFileDescription Xi) : Bool := F.asFile.planOkCore && F.storedOk
The two decisions, which run the chains: one for the offline and the online IOP, one for the link IOP · 8 cards
DefinitionThe error message of a written IOP's public checks, if anyJohnson/Desc/Block.lean:723–731
In words
In Lean · Johnson/Desc/Block.lean, lines 723–731

the file's variables

variable {Xi S Cl : Type}

none if planOk holds; otherwise an error message naming the first sub-protocol that fails its own public check or shaped, or else the first failing clause of BookPlan.clauses, if any.

def FileDescription.planWord (F : FileDescription Xi) : Option String :=
if F.planOk then none else
some ("the tests on the plan" ++
match (firstBad F.first.blocksInOrder).or ((firstBad F.shared.blocksInOrder).or (firstBad F.second.blocksInOrder)) with
| some n => ": " ++ n
| none => ": the file's" ++
match (BookPlan.clauses F.roundsDeclaredByBlocks F.roots).find? (!·.2) with
| some c => ": the book's " ++ c.1
| none => "")
DefinitionThe verifier's decision for three chainsJohnson/Desc/Block.lean:736–752
In words
In Lean · Johnson/Desc/Block.lean, lines 736–752

the file's variables

variable {Xi S Cl : Type}

The verifier's decision for three chains, in order: public checks, instance check, field-range checks, chain 1 on its view with an empty round appended, chain 2, chain 3 started from both final states, final check.

def runCore {S₁ S₂ S₃ : Type} (planWord : Option String) (okStart : Bool) (s₁ : S₁) (s₂ : S₂)
(start₃ : S₁ → S₂ → Except String S₃) (firstTree₃ : Nat) (b₁ : List (Block S₁ Cl))
(b₂ : List (Block S₂ Cl)) (b₃ : List (Block S₃ Cl)) (fin : S₁ → S₂ → S₃ → Bool)
(v₁ v₂ v₃ : Fmt.View) : Except String (S₁ × S₂ × S₃) := do
if let some w := planWord then throw w
need "the test on the instance" okStart
need "a word of the first view is not below the prime" (viewWordsBelowPrime v₁)
need "a word of the second view is not below the prime" (viewWordsBelowPrime v₂)
need "a word of the third view is not below the prime" (viewWordsBelowPrime v₃)
let e₁ ← chainAt "the first chain" 0 b₁ s₁ (withEmptySealRound v₁)
let e₂ ← chainAt "the shared chain" 0 b₂ s₂ v₂
let s₃ ← match start₃ e₁ e₂ with
| .ok s => pure s
| .error e => throw ("the second chain's start: " ++ e)
let e₃ ← chainAt "the second chain" firstTree₃ b₃ s₃ v₃
need "the ends fail the last test" (fin e₁ e₂ e₃)
pure (e₁, e₂, e₃)
DefinitionThe three chains' final states, or the reason for rejectionJohnson/Desc/Block.lean:760–763
In words
In Lean · Johnson/Desc/Block.lean, lines 760–763

the file's variables

variable {Xi S Cl : Type}

Applies runCore to the fields of a written IOP F, an instance x and three views. Returns the three chains' final states or the reason for rejection.

def FileDescription.runEnd (F : FileDescription Xi) (x : Xi) (v₁ v₂ v₃ : Fmt.View) :
Except String (F.S₁ × F.S₂ × F.S₃) :=
runCore F.planWord (F.okStart x) (F.start₁ (F.pub x)) (F.start₂ (F.pub x)) (F.start₃ (F.pub x))
F.lastChainFirstTreeNumber F.first.blocksInOrder F.shared.blocksInOrder F.second.blocksInOrder (F.fin x) v₁ v₂ v₃
DefinitionThe verifier's decision for a written IOP FJohnson/Desc/Block.lean:771–772
In words
In Lean · Johnson/Desc/Block.lean, lines 771–772

the file's variables

variable {Xi S Cl : Type}

The verifier's decision for a written IOP F: it accepts an instance and three views if and only if runEnd returns final states.

def FileDescription.run (F : FileDescription Xi) (x : Xi) (v₁ v₂ v₃ : Fmt.View) : Bool :=
(F.runEnd x v₁ v₂ v₃).isOk
DefinitionA written IOP for instances Xi, viewed as one for instances Xi'Johnson/Desc/Block.lean:781–800
In words
In Lean · Johnson/Desc/Block.lean, lines 781–800

the file's variables

variable {Xi S Cl : Type}

A written IOP for instances Xi, viewed as one for instances Xi' along a map from Xi' to Xi. Only the instance check, the public part of the instance and the final check change.

def FileDescription.pull {Xi' : Type} (f : Xi' → Xi) (F : FileDescription Xi) : FileDescription Xi' where
S₁ := F.S₁
S₂ := F.S₂
S₃ := F.S₃
Cl := F.Cl
plans := F.plans
tableDepth := F.tableDepth
wanted := F.wanted
owed := F.owed
fileOk := F.fileOk
okStart := fun x => F.okStart (f x)
XiPub := F.XiPub
pub := fun x => F.pub (f x)
start₁ := F.start₁
start₂ := F.start₂
start₃ := F.start₃
first := F.first
shared := F.shared
second := F.second
fin := fun x => F.fin (f x)
DefinitionThe error message of a one-chain written IOP's public checks, if anyJohnson/Desc/Link/OneChainFileDescription.lean:117–122
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 117–122

the file's variables

variable {Xi : Type}

none if planOk holds; otherwise an error message that names the first failing sub-protocol or, if there is none, the first failing check of planClauses.

def OneChainFileDescription.planWord (F : OneChainFileDescription Xi) : Option String :=
if F.planOk then none else
some ("the tests on the plan" ++
match firstBad F.chain.blocksInOrder with
| some n => ": " ++ n
| none => ": the file's: " ++ ((F.planClauses.find? (!·.2)).map (·.1)).getD "")
DefinitionThe verifier's decision for one chainJohnson/Desc/Link/OneChainFileDescription.lean:125–131
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 125–131

the file's variables

variable {Xi : Type}

The verifier's decision for one chain, in order: public checks, instance check, field-range check on the view, the chain by chainAt, final check. Returns the chain's final state or the reason for rejection.

def OneChainFileDescription.runEnd (F : OneChainFileDescription Xi) (x : Xi) (v : Fmt.View) : Except String F.S := do
if let some w := F.planWord then throw w
need "the test on the instance" (F.okStart x)
need "a word of the view is not below the prime" (viewWordsBelowPrime v)
let e ← chainAt "the chain" 0 F.chain.blocksInOrder (F.start x) v
need "the end fails the last test" (F.fin x e)
pure e
DefinitionThe verifier's decision for a one-chain written IOPJohnson/Desc/Link/OneChainFileDescription.lean:134
In words
In Lean · Johnson/Desc/Link/OneChainFileDescription.lean, lines 134–134

the file's variables

variable {Xi : Type}

The verifier's decision for a one-chain written IOP: it accepts an instance and one view if and only if runEnd returns a final state.

def OneChainFileDescription.run (F : OneChainFileDescription Xi) (x : Xi) (v : Fmt.View) : Bool := (F.runEnd x v).isOk
The three IOPs chain by chain · 25 cards
DefinitionThe written offline IOPJohnson/Desc/Key/Desc.lean:47–79
In words
In Lean · Johnson/Desc/Key/Desc.lean, lines 47–79

The written offline IOP, built from public parameters: a structure of three chains of sub-protocols with their initial verifier states, the declared rounds, the public checks, the check on the instance, and the final check.

def descriptionFromSource (X : Source) (N : H2U.PlaceNums) (P : LaterPlaces) : FileDescription Xi :=
let Z := X.Y
let c := X.chains
let z := c.made.sized.key
let c₁ := firstChain Z.k.oneTime Z.D.1 Z.told.1 X.set N
let c₂ : Chain _root_.Desc.K14.St Claim := (sharedChain c P).retype
let c₃ : Chain VerifiableInference.Desc.Third.S₃ Claim := (thirdChain c P).retype
let len {σ : Type} (x : Chain σ Claim) : Nat := (x.blocksInOrder.flatMap (·.rounds)).length
{ S₁ := FirstState, S₂ := _root_.Desc.K14.St, S₃ := VerifiableInference.Desc.Third.S₃, Cl := Claim
plans := Z.D
wanted := wantedFirst Z.k.oneTime ++ wantedShared Z.k.shared.lin ++ wantedSecond Z.k.shared.lin
owed := owedFirst Z.k.oneTime ++ owedShared Z.k.oneTime Z.k.shared.lin ++ owedSecond Z.k.oneTime
tableDepth := Z.k.shared.lin.fold.index.tree.a
fileOk := (fileClauses X N P (len c₁) (len c₂) (len c₃)).all (·.2) &&
openedInBlocks
[VerifiableInference.Desc.oraclesOf c₁.blocksInOrder, VerifiableInference.Desc.oraclesOf c₂.blocksInOrder,
VerifiableInference.Desc.oraclesOf c₃.blocksInOrder]
(c₁.blocksInOrder.flatMap (·.rounds), c₂.blocksInOrder.flatMap (·.rounds), c₃.blocksInOrder.flatMap (·.rounds))
okStart := fun x => instanceOk X.Y.k.shared.lin x &&
_root_.Desc.K14.okKey (sharedPar c []) x.key
XiPub := Xi, pub := id
start₁ := fun _ => chainStart Z.k.oneTime.codes {}
start₂ := fun x => _root_.Desc.K14.first z.codes x.key
start₃ := fun _ s₁ s₂ => do
let f := firstOf s₁
let l ← named "the first chain's end names no W" s₁.lin
let e₂ ← named "the shared chain's end: something is untested" (_root_.Desc.K14.ended s₂)
VerifiableInference.Desc.Third.start₃E z.codes z.once.shape f.1 f.2.1 f.2.2.1 l.w l.own
l.mask f.2.2.2 (VerifiableInference.Desc.Third.sharedOfEnd e₂)
first := c₁
shared := c₂
second := c₃
fin := fun _ s₁ _ s₃ => firstEndOk Z.k.oneTime s₁ && VerifiableInference.Desc.Third.fin₃ s₃ }
DefinitionThe offline IOP's first chainJohnson/Desc/Key/Chain1.lean:101–115
In words
In Lean · Johnson/Desc/Key/Chain1.lean, lines 101–115

The offline IOP's first chain: two sub-protocols that send oracle messages; a segment per lookup; the lookups' constraints imposed on one group; that group's proximity test; a batching of pending claims; optionally a third sub-protocol that sends oracle messages; the chain's last sub-protocol.

def firstChain (one : OneTime) (D : List Fmt.DeclaredRound) (told : List ProofFile.Root) (set : Setting)
(N : H2U.PlaceNums) : Chain FirstState Claim :=
let sent := rootsBefore D (batchRound D)
let first : Block FirstState Claim := sendIndexMasks one pieces (groupsTold told 0 (rootsAt D 0))
let front : List (Block FirstState Claim) :=
[sendOwnMessage one pieces (groupsTold told (rootsBefore D 2) (rootsAt D 2))]
let links := (lookupsOf one).zipIdx.map fun x => lookupLink one set x.2 x.1
let rng : Block FirstState Claim := rangesTest (enterRanges one) leaveRanges N
let back₀ : List (Block FirstState Claim) :=
[layRows one, rng, batchTableRows (·.keys) one pieces sent] ++
(sendW one pieces sent
(groupsTold told (rootsBefore D (lastSendRound D)) (rootsAt D (lastSendRound D)))).toList
let inFront : List (Block FirstState Claim) := first :: front ++ links.flatMap Link.blocksInOrder ++ back₀
{ first := first, front := front, links := links, back := back₀
last := firstChainEnd pieces (inFront.flatMap (·.rounds)) }
DefinitionThe offline IOP's second chainJohnson/Desc/Key/Chains23.lean:88–91
In words
In Lean · Johnson/Desc/Key/Chains23.lean, lines 88–91

The offline IOP's second chain: a sub-protocol without rounds that contains public checks, the eight sub-protocols of the test on the committed table, one or two proximity tests, and the chain's last sub-protocol.

def sharedChain (c : Model.Verify.Chains) (N : LaterPlaces) : Chain _root_.Desc.K14.St Unit :=
let inFront := _root_.Desc.K14.blocksOr (sharedPar c (beforeSharedPoint N)) ++ sharedTests N
{ first := sharedFront c, front := [], links := [], back := inFront, last :=
VerifiableInference.Desc.K12.Seat.last inFront }
DefinitionThe offline IOP's third chainJohnson/Desc/Key/Chains23.lean:107–108
In words
In Lean · Johnson/Desc/Key/Chains23.lean, lines 107–108

The offline IOP's third chain is the general third chain (card lastChainWithOwnTest) for the offline IOP's public parameters, with a proximity test at address ⟨3, –, 2⟩.

def thirdChain (c : Model.Verify.Chains) (N : LaterPlaces) : Chain S₃ Unit :=
VerifiableInference.Desc.Third.lastChainWithOwnTest (thirdPar c) (ownTest N)
DefinitionThe written online IOPJohnson/Desc/ProofFile/OnlineDescription.lean:29–31
In words
In Lean · Johnson/Desc/ProofFile/OnlineDescription.lean, lines 29–31

The written online IOP. It takes the second hash function and the bytes of the three public files as arguments and returns the structure of three chains or an error message.

def onlineDescription (o : SecondHashFunctionArgument) (pol lay KL : ByteArray) :
Except String (VerifiableInference.Desc.FileDescription Inst) :=
onlineDescriptionFromBlockTables o pureRoad onlineFirstChainBlockTables onlineSharedChain onlineLastChain pol lay KL
DefinitionThe written online IOP, with its parts as argumentsJohnson/Desc/ProofFile/OnlineDescriptionFromBlockTables.lean:325–330
In words
In Lean · Johnson/Desc/ProofFile/OnlineDescriptionFromBlockTables.lean, lines 325–330

The written online IOP as a function of its parts. It computes the public parameters from the three public files and the argument o, which represents the second hash function, then assembles the written IOP from given lists of sub-protocols and two given later chains; either step may return an error message.

def onlineDescriptionFromBlockTables (o : SecondHashFunctionArgument) (R : Road) (lots : Pub → List Lot)
(shared : Pub → Option SharedSeat) (second : Pub → Option SecondSeat)
(pol lay KL : ByteArray) : Except String (FileDescription Inst) :=
(R.pub o pol lay KL).bind fun Z =>
onlineDescriptionFromPublicPart Z { links := R.links, lots := lots Z, shared := shared Z, second := second Z
older := o }
DefinitionThe written online IOP from the public parameters and the given sub-protocolsJohnson/Desc/ProofFile/OnlineDescriptionFromBlockTables.lean:311–320
In words
In Lean · Johnson/Desc/ProofFile/OnlineDescriptionFromBlockTables.lean, lines 311–320

Takes the public parameters and the given sub-protocols. Returns an error message if baseOf returns one or, if anything is inconsistent or missing, an error message that lists it. Otherwise returns the result of onlineDescriptionAfterTests: the assembled written online IOP or a further error message.

def onlineDescriptionFromPublicPart (Z : Pub) (T : PureSeat) : Except String (FileDescription Inst) :=
(baseOf Z T).bind fun B =>
let faults := faultsAt T B
let P := partsAt T B
let lack := lackingAt T P
if !faults.isEmpty then
.error ("no description: the supplied blocks are inconsistent: " ++ "; ".intercalate faults)
else if !lack.isEmpty then
.error ("no description: nothing usable is supplied for: " ++ ", ".intercalate lack)
else onlineDescriptionAfterTests Z T P
DefinitionThe last step of the assemblyJohnson/Desc/ProofFile/OnlineDescriptionFromBlockTables.lean:299–306
In words
In Lean · Johnson/Desc/ProofFile/OnlineDescriptionFromBlockTables.lean, lines 299–306

The last step of the assembly. It arranges the given sub-protocols into the first chain, adds the two later chains and forms the written IOP's structure; it returns an error message if no usable sub-protocol is supplied at an address, if chainBy returns an error, or if a later chain is missing.

def onlineDescriptionAfterTests (Z : Pub) (T : PureSeat) (P : PureParts) : Except String (FileDescription Inst) :=
-- `Except.bind` is written out: `FileDescription` lives one universe higher than what is bound here.
P.base.bind fun base =>
(chainBy Z base P.frames P.road).bind fun c =>
match T.shared, T.second with
| some A, some B =>
.ok (fileDescBy T.older T.links Z A B (fun s => s) (startS Z) c)
| _, _ => .error "no description: nothing usable is supplied for: a later chain"
DefinitionThe lists of sub-protocols from which the online IOP's first chain is assembledJohnson/Desc/ProofFile/OnlineDescriptionBlocks.lean:39–43
In words
In Lean · Johnson/Desc/ProofFile/OnlineDescriptionBlocks.lean, lines 39–43

The fifteen lists of sub-protocols from which the online IOP's first chain is assembled, as a function of the public parameters. They cover the sub-protocols of no kind and of every kind except the committed-table claim reduction and the two-table comparison steps.

def onlineFirstChainBlockTables (Z : Pub) : List Lot :=
[framesLot Z, k1Pure Z, k2Pure Z, K3Lot.lot Z, k4Lot Z, H2K5.lotN Z, P1K8.lot Z,
k9Ninth Z, K11.lot Z, VerifiableInference.Desc.K12.lot Z,
VerifiableInference.Desc.K13.lot Z, VerifiableInference.Desc.K13.lot4 Z,
VerifiableInference.Desc.K13.lotEnd Z] ++ p4Pure Z
DefinitionThe online IOP's second chainJohnson/Desc/ProofFile/OnlineDescriptionBlocks.lean:46
In words
In Lean · Johnson/Desc/ProofFile/OnlineDescriptionBlocks.lean, lines 46–46

The online IOP's second chain in full, with its state type, initial state and checks, as a function of the public parameters; it returns nothing if the proximity tests' parameters cannot be computed.

def onlineSharedChain (Z : Pub) : Option SharedSeat := laterShared Z
DefinitionThe online IOP's third chainJohnson/Desc/ProofFile/OnlineDescriptionBlocks.lean:47
In words
In Lean · Johnson/Desc/ProofFile/OnlineDescriptionBlocks.lean, lines 47–47

The online IOP's third chain in full: its state type, its start function (which computes the initial state from the two earlier chains' final states, or rejects) and its final check. Its own public check is constantly true. It returns nothing if the proximity tests' parameters cannot be computed.

def onlineLastChain (Z : Pub) : Option SecondSeat := laterSecond Z
DefinitionThe three sorts of model partJohnson/Desc/First/Driver/Chain.lean:88–92
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 88–92

An enumeration of the three sorts of model part that a segment of the first chain treats: layers, attention and head.

inductive ModelPart where
| layers
| attention
| head
deriving DecidableEq, Repr
DefinitionThe kind of the sub-protocol specific to a segment's sortJohnson/Desc/First/Driver/Chain.lean:96–99
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 96–99

Maps a segment's sort to the kind of the sub-protocol that is specific to it: layer-segment sumchecks for layers, attention-segment sumchecks for attention, output-head sumchecks for the head.

def kindOfModelPart : ModelPart → KindName
| .layers => .K4
| .attention => .K5
| .head => .K6
DefinitionThe kinds of a segment's sub-protocols before its batchingJohnson/Desc/First/Driver/Chain.lean:105–108
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 105–108

The kinds of a segment's sub-protocols before its batching, in order.

def kindsBeforeBatching (sub : ModelPart) (first : Bool) : List KindName :=
Head

first in the head's segment: the next-token message

(if sub = .head then [.K7] else []) ++
All segments

code switch between segments (in the first segment: oracle message with out-of-domain sample), product-tree lookup argument, the kind specific to the segment's sort, oracle message with out-of-domain sample, sampling step of the approximate range proof, oracle message with out-of-domain sample, product-tree lookup argument

[if first then .K1 else .K2, .K3, kindOfModelPart sub, .K1, .K8, .K1, .K3] ++
Head

last in the head's segment: the output-head committed-table sumcheck

(if sub = .head then [.K11] else [])
DefinitionThe kinds of the sub-protocols after the last segmentJohnson/Desc/First/Driver/Chain.lean:113–114
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 113–114

The kinds of the sub-protocols after the last segment, in order, without the chain's last sub-protocol: code switch between segments, proximity test with linear constraints, committed-table claim merge (only if the flag is true), oracle message with out-of-domain sample.

def backKinds (several : Bool) : List KindName :=
[.K2, .K12] ++ (if several then [.K13] else []) ++ [.K1]
DefinitionThe kinds of the three sub-protocols that close a segmentJohnson/Desc/First/Driver/Chain.lean:119
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 119–119

The kinds of the three sub-protocols that close a segment, in order: segment claim batching, segment-closing row fold, segment claim batching. The first and third sub-protocols have no rounds. The three come after the segment's batching and the sub-protocol without a kind that follows it.

def closeKinds : List KindName := [.K9, .K10, .K9]
DefinitionThe first chain's partsJohnson/Desc/First/Driver/Chain.lean:182–204
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 182–204

The structure Blocks collects the parts from which the first chain is built.

structure Blocks (S Cl : Type) where
Sub-protocols

the sub-protocol at each address, if there is one, block

/-- the block at a place; `none` if there is no block for that place -/
block : Place → Option (Block S Cl)

the batching at each address, if there is one, batch

/-- the batching (K9) at a place; its argument reads the segment's claims off the state -/
batch : Place → Option ((S → Except String (List Cl × S)) → Block S Cl)
Steps

the steps on the verifier state at the start of a segment, lay, and at its end, clear; each returns a new state or an error

/-- what is done to the state where a segment starts (`lay`) and where it ends (`clear`) -/
lay : Nat → S → Except String S
clear : Nat → S → Except String S
Checks

a segment's checks after each of its lists of claims, each

/-- a segment's test after each of its lists of claims: it is handed the segment's number, the
entry of the order, that list's own claims, and the state after the list -/
each : Nat → Nat × String → List Cl → S → Except String Unit

a segment's checks on the state after its batching, tests

/-- a segment's tests on the state after its batching, asked before what its blocks do after the
batching; they cannot change the state -/
tests : Nat → S → Except String Unit

a comparison of two states, same

/-- Guard (see `firstChain`): the two states have the same reply: `same before after`. That
it compares the reply, and the whole of it, is the matter of whoever supplies it -/
same : S → S → Bool
Ends

the chain's first sub-protocol, first

/-- the chain's front, the chain's first block. Block.lean means the field for a chain's tests on
public data, in a block without a round; this file names no such test and asks none: a block that
asks nothing fits -/
first : Block S Cl

the chain's last sub-protocol, last

/-- the seal, the chain's last block: one round, the last entry of the plan -/
last : Block S Cl
DefinitionBuilds segment number l of a given sortJohnson/Desc/First/Driver/Chain.lean:217–225
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 217–225

the file's variables

variable {S Cl : Type}

Builds segment l of a given sort from the sub-protocols at the addresses determined by the lists of kinds, and fixes the order in which their claims are batched. Returns nothing if one of these sub-protocols is missing.

def linkAt (H : Blocks S Cl) (l : Nat) (sub : ModelPart) : Option (Link S Cl) := do
let ks := kindsBeforeBatching sub (l == 0)
let hear ← (addresses (some l) ks).mapM (blockAt H)
let a9 : Place := { chain := 1, link := some l, piece := ks.length + 1, kind := .K9 }
let batch ← H.batch a9
let close ← (closeAddresses l ks.length).mapM (blockAt H)
pure { name := s!"link {l}", chain := 1, number := l, lay := H.lay l, hear := hear,
order := orderOf sub, each := H.each l, orderAfter := orderAfterOf sub, tests := H.tests l,
batch := fun c => { batch c with place := a9 }, close := close, clear := H.clear l }
DefinitionBuilds the first chain from the list of the segments' sortsJohnson/Desc/First/Driver/Chain.lean:231–238
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 231–238

the file's variables

variable {S Cl : Type}

Builds the first chain from the list of the segments' sorts: the first sub-protocol, the segments, the sub-protocols after them, and the last sub-protocol. Returns nothing if the head is not the last segment, if it also occurs earlier in the list, or if a sub-protocol is missing.

def firstChainWithoutReplyGuard (H : Blocks S Cl) (links : List ModelPart) (several : Bool) : Option (Chain S Cl) := do
if !linksOk links then none
let ls ← links.zipIdx.mapM fun x => linkAt H x.2 x.1
let back ← (addresses none (backKinds several)).mapM (blockAt H)
let aS : Place := { chain := 1, link := none, piece := back.length + 1, kind := .frame }
let aF : Place := { chain := 1, link := none, piece := 0, kind := .frame }
pure { first := { H.first with place := aF }, front := [], links := ls, back := back,
last := { H.last with place := aS } }
DefinitionThe first chain as usedJohnson/Desc/First/Driver/Chain.lean:254–255
In words
In Lean · Johnson/Desc/First/Driver/Chain.lean, lines 254–255

the file's variables

variable {S Cl : Type}

The first chain as used: the chain of the card firstChainWithoutReplyGuard, with a check added after every step except the decision of the next-token message's sub-protocol. The check rejects a step if the given comparison of the states before and after it fails.

def firstChain (H : Blocks S Cl) (links : List ModelPart) (several : Bool) : Option (Chain S Cl) :=
(firstChainWithoutReplyGuard H links several).map (Chain.guarded H.same hearsReply)
DefinitionThe test on the committed tableJohnson/Desc/K14/Blocks.lean:167–197
In words
In Lean · Johnson/Desc/K14/Blocks.lean, lines 167–197

The test on the committed table, as eight sub-protocols in order, at addresses ⟨2, –, 1⟩ to ⟨2, –, 8⟩.

def blocks (P : P14) : Option (List (Block St Unit)) := do
let es := entries P
let p := P.par
let plain (n : String) (i : Nat) (kind : KindName) (first k : Nat) (oracles : List (List Sent))
(before : List (Nat × Nat)) (l : St → Clauses) (f : St → List Fmt.RoundView → Option St) :
Block St Unit :=
{ name := n, place := ⟨2, none, i, kind⟩, planOk := OkD.At.ofBlock n P.codes P.S
rounds := ((es.drop first).take k).map fun e => { entry := e }
oracles := oracles, before := before, decide := fun d rs _ => why (l d) (f d rs)
claims := [], after := [] }
let split1 := if P.S.sharedSplitNeeded then 1 else 0
let both := if P.S.sharedSplitNeeded then [(2, 1), (2, 2)] else [(2, 1)]
pure

number 1: the verifier samples a point

[{ plain "LIN point" 1 .K14 0 1 [[]] P.beforePoint (linPointL p) (linPoint p) with
planOk := OkD.At.ofBlock "LIN point" P.codes P.S && !P.beforePoint.isEmpty },

number 2: the prover sends an oracle message whose tenants are the table's rows folded at part of that point, and a mask

sendAt P "send o_u" (parK1 P 2 "o_u and the first mask" (← withU P.S)) es[0]? [[0], []]
(behindU p),

number 3: each out-of-domain answer of the table gives a linear constraint on the folded tenant

plain "(rec_gamma)" 3 .K14 0 0 [] [] (fun d => laysRecL p d.loc) (laysRec p),

number 4: the verifier samples positions, at which the table is opened

{ name := "LOC", place := ⟨2, none, 4, .K14⟩, planOk := OkD.At.ofBlock "LOC" P.codes P.S
rounds := ((es.drop 1).take 1).map fun e =>
{ entry := e, stored := [readsAtLoc P.S.fold P.item] }
oracles := [[]], before := [(2, 0)], decide := fun d rs gs => why [] (loc p d rs gs)
claims := [], after := [] },

number 5: the prover sends one or two further oracle messages

sendAt P "send o_omega" (parK1 P 5 "o_omega and o_sp" (withOmega P.S)) es[1]? [[1], [1, 0]]
(behindOmega p),

number 6: the tenants of these messages are assigned to groups

plain "joins" 6 .K14 0 0 [] [] joinsL (joins p),

number 7: the verifier samples a second point

plain "LIN zeta" 7 .K14 2 1 [[]] ((2, 0) :: both) (fun _ => []) linZeta,

number 8: it splits the linear constraint that equates the values of the two tenants at the two points into one constraint for each group, and has no round when there is only one group

plain "SPLIT" 8 .K14 3 split1 (List.replicate split1 []) (both.drop 1)
(fun d => foldL p.S d.loc ++
(((fold p.S d.loc (linLayOmega d.st.codes p.S)).map (splitL d)).getD []))
(split p)]
DefinitionThe third chainJohnson/Desc/Third/Chain.lean:48–51
In words
In Lean · Johnson/Desc/Third/Chain.lean, lines 48–51

The third chain consists of the second part of the test on the committed table, a check of the declared source of each oracle message taken from another chain, the given proximity test, and the chain's last sub-protocol.

def lastChainWithOwnTest {Cl : Type} (p : P₁₄) (own : Block S₃ Cl) : Chain S₃ Cl :=
let f : Block S₃ Cl := batchLinearConstraintsSecondPart p
let b : List (Block S₃ Cl) := [takenSources own, ownAt own]
{ first := f, front := [], links := [], back := b, last := end₃ (f :: b) }
DefinitionThe link IOP's five sub-protocols before its proximity testJohnson/Desc/Link/LinkDesc.lean:137–156
In words
In Lean · Johnson/Desc/Link/LinkDesc.lean, lines 137–156

The link IOP's five sub-protocols before its proximity test:

  • the verifier samples a point
  • the prover sends one oracle message with two tenants, the rows of each table folded at that point, and with a mask tenant if masksAhead is true
  • the out-of-domain answers give constraints
  • the verifier samples positions, and the first table is opened at the first columnsFirst of them and the copy at the next columnsFurther
  • the verifier samples a second point, and an equality constraint is added
def linkBlocksBeforeTest (P : P15) : Option (List (Block St Unit)) := do
let es ← entries P
let p := P.par
let plain (n : String) (i : Nat) (kind : KindName) (first k : Nat)
(oracles : List (List VerifiableInference.Desc.Oracle)) (before : List (Nat × Nat))
(l : St → Clauses)
(f : St → List Fmt.RoundView → Option St) : Block St Unit :=
{ name := n, place := ⟨1, none, i, kind⟩, planOk := true
rounds := ((es.drop first).take k).map fun e => { entry := e }
oracles := oracles, before := before, decide := fun d rs _ => why (l d) (f d rs)
claims := [], after := [] }
pure
[plain "LINK point" 1 .K15 0 1 [[]] [] (fun _ => []) (point p),
sendK1 P,
plain "(rec_gamma), twice" 3 .K15 0 0 [] [] (fun d => laysRecL p d.loc) (laysRec p),
{ name := "LINK", place := ⟨1, none, 4, .K15⟩, planOk := true
rounds := ((es.drop 3).take 1).map fun e => { entry := e, stored := readsAtLink P.S }
oracles := [[]], before := [(1, 0)], decide := fun d rs gs => why [] (link p d rs gs)
claims := [], after := [] },
plain "LINK phi" 5 .K15 4 1 [[]] [(1, 0)] (fun _ => []) (phi p)]
DefinitionThe written link IOPJohnson/Desc/Link/LinkDesc.lean:228–231
In words
In Lean · Johnson/Desc/Link/LinkDesc.lean, lines 228–231

The written link IOP (one chain), built from public parameters, declared rounds and a Boolean used as its public check fileOk. Instance: each committed table's out-of-domain seeds and answers. Its final check always accepts.

def linkDescriptionAt (P : P15) (plan : List Fmt.DeclaredRound) (ok : Bool) : OneChainFileDescription (TableKey × TableKey) :=
{ S := St, Cl := Unit, plan := plan, tableDepth := P.S.table.tree.a, tables := 2, fileOk := ok
okStart := fun x => okKey 0 x.1 && okKey 1 x.2
start := first P.codes, chain := linkProtocolChain P, fin := fun _ _ => true }
DefinitionThe link IOP's decisionJohnson/Desc/Link/LinkWritten.lean:50–58
In words
In Lean · Johnson/Desc/Link/LinkWritten.lean, lines 50–58

The link IOP's decision linkDecisionAtParameterFile maps the bytes of a parameter file to a function of the two out-of-domain samples and a view.

def linkDecisionAtParameterFile (pol : ByteArray) : RecFull × RecFull → PQ.View → Bool :=

the file's first lines are read

match readLines pol with
| .ok (l, _) =>

they are compared with recordLines, the first lines of the full-size parameter file

if l = recordLines then

linkAt is applied; it returns no error only if the public checks pass

match linkAt frP recordPlan with

if linkAt returns no error, the function runs the written link IOP; otherwise it rejects every input

| .ok L => fun rr V => L.F.run (keysOfX frS.P.v 29 1 (anT frS.P.v 1) (recX rr)) V
| .error _ => fun _ _ => false

if the first lines differ from recordLines or cannot be read, the function rejects every input

else fun _ _ => false
| .error _ => fun _ _ => false
The kinds of sub-protocol · 22 cards
DefinitionOracle message with out-of-domain sampleJohnson/Desc/K1/Own.lean:155–159
In words
In Lean · Johnson/Desc/K1/Own.lean, lines 155–159

the file's variables

variable {Cl : Type}

Oracle message with out-of-domain sample. In the first round the prover sends oracle messages and the verifier samples out-of-domain seeds. In the second round the prover sends the answers. Each answer becomes a linear constraint on the sampled tenant that it answers for.

def sendOwn (P : Par) : Block (Owing (DState (Array Nat))) Cl :=
{ name := "K1: a sending", place := P.place, planOk := planOkOwn P, rounds := rounds P
oracles := oracles P, before := before, claims := [], after := []
decide := fun s rs _ => (decideSend P s.owed s.held rs).map fun x =>
{ owed := none, held := { x.2 with loc := x.1 } } }
DefinitionOracle message with out-of-domain sample, inside a segmentJohnson/Desc/K1/Own.lean:179–192
In words
In Lean · Johnson/Desc/K1/Own.lean, lines 179–192

the file's variables

variable {Cl : Type}

Oracle message with out-of-domain sample, inside a segment. It checks that the state is at this segment and step and expects these messages, then runs the rounds and decision of sendOwn. The messages' tenants join the segment's group, and the listed arrays are marked as committed.

def commitOwn (P : Par) (link moment : Nat) (arrays : Option (List Nat)) :
Block (Owing (L3.St (DState Unit))) Cl :=
{ name := "K1: a commitment", place := P.place, planOk := planOkOwn P && arrays.isSome
rounds := rounds P, oracles := oracles P, before := before, claims := [], after := []
decide := fun s rs _ =>
let f := s.held.L.check.frame
-- on the carried record alone: it stands at this place, and announces what ROUNDS says
if f.link == link && f.moment == moment &&
ReqFrame.notices (f.atMoment f.moment) == P.sent then
match arrays with
| none => .error "K1: the plan names no arrays"
| some ts => (L3.commitStep (laterOwn P s.owed) ts s.held rs).map fun x =>
{ owed := none, held := x }
else .error "K1: the record does not stand at this place, or announces other messages" }
DefinitionOracle message with out-of-domain sample at the start of the first segmentJohnson/Desc/K1/First.lean:110–118
In words
In Lean · Johnson/Desc/K1/First.lean, lines 110–118

the file's variables

variable {Cl : Type}

Oracle message with out-of-domain sample at the start of the first segment: it opens that segment's group, then runs the rounds and decision of sendOwn on the chain's first oracle messages.

def firstSegmentOpening (q : Params.First) (gp : GPar) : Block S Cl :=
let P : Par := firstPar q gp
{ name := "K1: the first segment's opening", place := P.place
planOk := planOkOwn P && firstPlanOk q gp.samples
rounds := rounds P, oracles := oracles P, before := before, claims := [], after := []
decide := fun s rs _ => do
need "K1: a link is open" s.atBetween
let (c, d) ← firstOwn P (owedOf s) s.check (stateOf s ()) rs
pure { laid s d with check := c } }
DefinitionCode switch between segmentsJohnson/Top/H0/Tw/K2C/Kind.lean:169–179
In words
In Lean · Johnson/Top/H0/Tw/K2C/Kind.lean, lines 169–179

Code switch between segments: in its first round the prover sends oracle messages and the verifier samples out-of-domain seeds. In its second round the prover sends the answers and the verifier samples positions, at which the oracle messages of this chain listed in read are opened. The opened values yield linear constraints on the tenants of the messages sent in the first round.

def codeSwitchKind {Cl : Type} : Kind P2 S Cl := fun p =>
{ name := p.name, place := p.place
planOk :=
Decidable.decide (0 < p.positions) && p.sent.length == p.roots && increasing (p.read.map
(·.1)) && Decidable.decide (p.logN ≤ 32)
rounds := rounds p
oracles := [p.sent, []]
before := p.read.map fun r => (p.place.chain, r.1)
decide := decideWith _root_.Tw.K2.sendByL8 p
claims := []
after := [] }
DefinitionProduct-tree lookup argument, as used in the offline IOPJohnson/Desc/First/Look/K3LookupGeneral.lean:394–424
In words
In Lean · Johnson/Desc/First/Look/K3LookupGeneral.lean, lines 394–424

Product-tree lookup argument, in the offline IOP's form. At a sampled point, masked sumchecks along product trees relate the product over the looked-up values to that over the table's rows, with multiplicities given in bits. The claims on the parts' keys are left to the caller.

def lookupKind {S Cl : Type} (seat : SeatG S Cl) (before : List (Nat × Nat)) (bits : Nat)
(guests : List (First.Look.Guest S Cl)) (p : PG) : Block S Cl :=
{ name := p.name
place := ⟨p.chain, some p.link, p.piece, .K3⟩
planOk := p.planOk before bits guests
rounds := (p.entries.getD []).map fun e => { entry := e }
oracles := (p.entries.getD []).map fun _ => []
before := before
decide := fun s rs _ => do
let F ← named "K3: no ledger is open" (seat.fork s)
need "K3: rows are owed in front" (seat.owed s).noneWaits
need "K3: the ledger's count of slots" (F.next == p.first)
need "K3: the ledger's room" (F.ns == p.ns)
let x ← named "K3: the hearing" (hearG p F rs)
pure (seat.put s x.1 x.2)
claims :=
[("objects", fun _ s => do
let F ← named "K3 objects: no ledger is open" (seat.fork s)
let g ← named "K3 objects: nothing was heard" (seat.heard s)
pure (g.rows.toList.map seat.claim, seat.mark s (F.paid g.owedObjects))),
("planes", fun _ s => do
let F ← named "K3 planes: no ledger is open" (seat.fork s)
let g ← named "K3 planes: nothing was heard" (seat.heard s)
need "K3 planes: they are made once" (unpaidG F g.owedPlanes)
let x ← named "K3 planes: the leaves' claim" (planesG p.face g F [])
let l ← named "K3 planes: the caller's reader" (x.1.mapM (seat.claimP s))
pure (l, seat.mark s (x.2.1.paid g.owedPlanes))),
("guests", fun _ s =>
named "K3 guests: a guest refuses"
((guests.mapM fun (g : First.Look.Guest S Cl) => g.form s).map fun l => (l, s)))]
after := [] }
DefinitionProduct-tree lookup argument, as used in the online IOPJohnson/Desc/First/Look/Via/Via.lean:73–91
In words
In Lean · Johnson/Desc/First/Look/Via/Via.lean, lines 73–91

Product-tree lookup argument, as used in the online IOP: the same sequence of rounds as in card lookupKind, with one part of looked-up values, a sampled shift and 32-bit multiplicities. It outputs two lists of claims.

def blockVia {S Cl : Type} (seat : Seat S Cl) (piece : Nat) (laid : Array Nat)
(before : List (Nat × Nat)) :
KindWithGuestIdentities P (Guest S Cl) S Cl := fun p guests =>
{ name := p.name
place := ⟨1, some p.link, piece, .K3⟩
planOk := planOk p laid guests && fitsVia p
rounds := p.rounds
oracles := p.rounds.map fun _ => []
before := before
decide := fun s rs _ => decideVia seat p s rs
claims :=
[("objects", fun _ s => do
let F ← named "K3 objects: no sub-proof is open" (seat.fork s)
let g ← named "K3 objects: nothing was heard" (seat.heard s)
pure (g.rows.toList.map seat.claim, seat.mark s (F.paid g.owedObjects))),
("guests", fun _ s =>
named "K3 guests: a guest refuses"
((guests.mapM fun (g : Guest S Cl) => g.form s).map fun l => (l, s)))]
after := [] }
DefinitionLayer-segment sumchecksJohnson/Desc/First/K4/Block.lean:121–132
In words
In Lean · Johnson/Desc/First/K4/Block.lean, lines 121–132

the file's variables

variable {S : Type} (L : Seat S)

Layer-segment sumchecks, the rounds specific to a segment of layers: sampled points, batching challenges and masked sumchecks. No oracle message is sent or opened. It outputs two lists of linear claims and has a check after the batching.

def block : Kind Par S Aff := fun p =>
{ name := p.name
place := ⟨1, some p.link, p.piece, .K4⟩
planOk := covers p.P
rounds := (entries p.P p.hp p.g).map fun e => { entry := e }
oracles := (entries p.P p.hp p.g).map fun _ => []
before := p.before
decide := fun s rs _ => hearAt L p s rs
claims := [("front", fun _ s => runOf L "K4.claims-front"
((if p.k3Runs then formsFrontNoRows else formsFront) p.P p.g) s),
("back", fun _ s => runOf L "K4.claims-back" formsBack s)]
after := [("free-slot", freeSlot L p.hp)] }
DefinitionAttention-segment sumchecksJohnson/Desc/First/Att/K5AttentionKind.lean:199–209
In words
In Lean · Johnson/Desc/First/Att/K5AttentionKind.lean, lines 199–209

Attention-segment sumchecks, the rounds specific to an attention segment: prover scalars, sampled points, batching challenges and masked sumchecks. No oracle message is sent or opened. The lists of claims that it outputs are given by the parameter claims.

def attentionKind {S Cl : Type} (seat : Seat S) (claims : List (String × (Nat → S → Except String (List Cl × S)))) (p : Par) :
Block S Cl :=
{ name := s!"an attention segment's own rounds, segment {p.link}"
place := ⟨1, some p.link, p.piece, .K5⟩
planOk := planOk p
rounds := rounds p
oracles := (rounds p).map fun _ => []
before := p.before
decide := fun s rs _ => decide seat p s rs
claims := claims
after := [] }
DefinitionOutput-head sumchecksJohnson/Desc/Kinds/HeadKind.lean:25–33
In words
In Lean · Johnson/Desc/Kinds/HeadKind.lean, lines 25–33

the file's variables

variable {S : Type}

Output-head sumchecks, the rounds specific to the output head: sampled points, batching challenges and masked sumchecks. No oracle message is sent or opened. It outputs three lists of linear claims.

def kind {Cl : Type} (cl : Form → Cl) (L : Seat S) (link piece : Nat) : Kind Par S Cl := fun p =>
let rs := p.declare (let _ := p.sizes; rounds)
{ name := "the output head's own rounds", place := ⟨1, some link, piece, outputHead⟩
planOk := p.ok, rounds := rs, oracles := rs.map fun _ => [], before := p.before
decide := fun s v _ =>
decideBy (fun _ => rounds) (fun _ => hear) (fun _ _ => forTheMerge) p L s v
claims := runsBy ["norm", "policy", "logits"] (fun _ _ _ => claims)
(fun g _ _ => g.calls.map fun c => keyVector key c.1 c.2) cl p L
after := [] }
DefinitionOutput-head sumchecks as usedJohnson/Desc/Kinds/HeadCaller.lean:58–62
In words
In Lean · Johnson/Desc/Kinds/HeadCaller.lean, lines 58–62

the file's variables

variable {S : Type}

Output-head sumchecks as used: the sub-protocol of card Head.kind with a fourth list of linear claims, named join, inserted after the first.

def kindWithJoin {Cl : Type} (look : K3.Seat S Cl) (L : Seat S) (link piece : Nat) :
Kind Par S Cl := fun p =>
let b := kind look.claim L link piece p
{ b with claims := b.claims.take 1 ++ [("join", K3.joinRun look (callerKeys p L))] ++
b.claims.drop 1 }
DefinitionNext-token message: one roundJohnson/Desc/Kinds/ReplyBlock.lean:23–32
In words
In Lean · Johnson/Desc/Kinds/ReplyBlock.lean, lines 23–32

Next-token message: one round, in which the prover sends one field element, the next token, and the verifier samples nothing. Its public check is that the vocabulary size is at least 2. It rejects if an element was stored before or the element is not a base-field value below the vocabulary size.

def kind {S Cl : Type} (L : Seat S) (link piece : Nat) : Kind Nat S Cl := fun V =>
{ name := "the next token"
place := ⟨1, some link, piece, .K7⟩
planOk := 2 ≤ V
rounds := rounds
oracles := [[]]
before := []
decide := fun s rs _ => decideE V L s rs
claims := []
after := [] }
DefinitionDraw of the approximate range proofJohnson/Desc/First/K8/Hear.lean:138–169
In words
In Lean · Johnson/Desc/First/K8/Hear.lean, lines 138–169

Draw of the approximate range proof, the test that committed values are small: one round, in which the prover sends nothing and the verifier samples matrices with entries −1, 0 or 1. They are stored after three checks on the state (the list of parts is closed, no count of rows is owed, no matrix has been sampled yet) and checks of their sizes.

def approximateRangeProofDrawKind {S Cl : Type} (seat : Seat S) : Kind Par S Cl := fun p =>
{ name := "the smallness test: the draw of the matrix"
place := ⟨1, some p.link, p.piece, .K8⟩
planOk :=
!p.ks.isEmpty && columns p != 0 && p.tau != 0 && !p.matsIn.isEmpty && !p.readsIn.isEmpty &&
p.ms.length == p.ks.length && p.asks.all fun a => a.2.1 != 0 && a.2.2 != 0
rounds := [round p]
oracles := [[]]
before := (p.matsIn ++ p.readsIn).map fun n => (1, n)
decide := fun s rs _ =>
match rs with
| [r] =>
if !seat.closed s then .error "the smallness test: the list of parts is open"
else if !seat.nothingOwed s then .error "the smallness test: a count of rows is owed"
else if seat.drawn s then .error "the smallness test: the matrix is drawn already"
else if seat.matrices s != p.ks.length then
.error "the smallness test: the record expects another number of matrices than \
the place's list has"
else if seat.ks s != p.ks then
.error "the smallness test: the record's matrices have other numbers of columns than \
the place's list"
else if seat.ms s != p.ms then
.error "the smallness test: the record's matrices have other numbers of rows than \
the place's list"
else if seat.tau s != p.tau then
.error "the smallness test: the record has another number of combinations than the place"
else if seat.tabs s != tabs p then
.error "the smallness test: the closed list of parts has other shapes than the place's"
else seat.lay s r.drawn.trits.toArray (firstColumns p)
| _ => .error "the smallness test: the block was handed another number of rounds than one"
claims := []
after := [] }
DefinitionDraw of the approximate range proof, as usedJohnson/Desc/First/K8/Whole.lean:48–52
In words
In Lean · Johnson/Desc/First/K8/Whole.lean, lines 48–52

Draw of the approximate range proof, as used: the sub-protocol of the card approximateRangeProofDrawKind, together with one list of claims (K8.equations) and two steps after the segment's batching (K8.lsTail, K8.tests).

def whole : Kind ParW S Claim := fun p =>
{ approximateRangeProofDrawKind (Cl := Claim) atS p.toPar with
claims := k8Claims.map fun r => (r.1, fun front => atRecord (r.2 front))
after := [k8LsTail, k8Tests p.nU].map fun r =>
(r.1, fun s => (atRecord (fun q => (r.2 q).map fun q' => ((), q')) s).map (·.2)) }
DefinitionSegment claim batchingJohnson/Desc/First/Batch/Kind.lean:180–184
In words
In Lean · Johnson/Desc/First/Batch/Kind.lean, lines 180–184

the file's variables

variable {T Cl : Type}

Segment claim batching: one round, in which the verifier samples one field element. Every claim output by the segment's sub-protocols is added to one equation, weighted by a power of that element.

def batch (X : Lens T) (p : Where) (claims : T → Except String (List Claim × T)) : Block T Claim :=
{ drawAlone X p with
decide := fun t rs gs => do
let t₁ ← (drawAlone (Cl := Claim) X p).decide t rs gs
(adds (Cl := Claim) X p p.piece "the segment's" claims).decide t₁ [] [] }
DefinitionSegment-closing row fold, 2 + k roundsJohnson/Desc/First/Close/Kind.lean:66–76
In words
In Lean · Johnson/Desc/First/Close/Kind.lean, lines 66–76

Segment-closing row fold, 2 + k rounds. One sampled element batches all linear constraints on the segment's group; a masked sumcheck of 1 + k rounds leaves one constraint on its rows folded at its challenges.

def kind {Cl : Type} : Kind Par Rec Cl := fun P =>
{ name := s!"the closing of link {P.link}"
place := { chain := 1, link := some P.link, piece := P.piece, kind := .K10 }
planOk := decide (1 ≤ P.k) && decide (P.h ≤ P.k)
rounds := (entries P).map fun e => { entry := e }
oracles := (entries P).map fun _ => []
before := P.sent.map fun n => (1, n)
decide := fun s rs _ =>
(closeFrame s.owed s.frame s.st (entries P) rs).map fun x => ⟨none, x.1, x.2⟩
claims := []
after := [] }
DefinitionOutput-head committed-table sumcheck, lk + 4 roundsJohnson/Desc/First/Fork/MergeKind.lean:170–179
In words
In Lean · Johnson/Desc/First/Fork/MergeKind.lean, lines 170–179

Output-head committed-table sumcheck, lk + 4 rounds, in the head's segment: a batching challenge and a masked sumcheck on the head's single claim on the committed table. It outputs one linear claim.

def headClaimMergeKind : Kind HeadMergeP S Claim := fun P =>
{ name := "the merge of the claims on the weights"
place := ⟨1, some P.link, P.piece, .K11⟩
planOk := P.ncl == 1
rounds := (mergeEntries P.lay.lk 1 P.work).map fun e => { entry := e }
oracles := List.replicate (P.lay.lk + 4) []
before := (List.range P.sent).map fun n => (1, n)
decide := fun s rs _ => headMergeDecide P s rs
claims := [("the merge", headMergeClaim)]
after := [] }
DefinitionProximity test with linear constraintsJohnson/Desc/K12/Frame.lean:140–155
In words
In Lean · Johnson/Desc/K12/Frame.lean, lines 140–155

the file's variables

variable {T Cl : Type}

Proximity test with linear constraints, taking its parts as an argument. Rounds: a batching round; for each stage except the last, a fold (1 + k rounds) and a code switch (2); a base case (2).

def proximityTestKind (X : Parts T) : Kind P12 T Cl := fun p =>
match p.nums.stages, H2U.roundsOfNums p.nums, H2U.testOracles p.nums with
| first :: rest, some rs, some os =>
let l : Laid := rs.zip p.oracles
let b : Block T Cl := ((((X.front p).at "the front" p.place []).andThen "the front"
((X.bat p ((l.take 1).map (·.1))).at "the batching" p.place (l.take 1))).andThen
"the batching"
(asks "the group is not the first stage's" p.place fun t =>
(X.group t).any (firstFits first))).andThen "the test"
(stagesFrom X p 0 first rest (l.drop 1))
{ b with
name := nameAt p.place, place := p.place, before := p.before
planOk := sizesOk p.nums.stages p.answers && rs.length == roundsIn p.nums.stages &&
p.oracles.length == rs.length &&
p.oracles.map (·.map fun o => (o.logLength, o.words)) == os && b.planOk }
| _, _, _ => { asks (nameAt p.place) p.place (fun _ => false) with planOk := false }
DefinitionThe parts of the proximity test with linear constraintsJohnson/Desc/K12/JoinGuarded.lean:225–258
In words
In Lean · Johnson/Desc/K12/JoinGuarded.lean, lines 225–258

guardedProximityTestParts defines the parts that proximityTestKind takes as its argument, with further checks that cause rejection if they fail: (f) and (p) in the first part, (c), (k) and (g) in the batching, and (z) in every part that is given rounds. In the batching, one element is sampled. A fold is a masked sumcheck. In a code switch, the prover sends a new oracle message and earlier ones are opened at sampled positions. In the base case, the last message is sent in the clear in masked form and tested at sampled positions.

def guardedProximityTestParts : Parts T12 where
front := fun p =>
{ planOk := (frontJ p).planOk && H2K.FixedBefore.fixedOk p && H2K.First.cutOk p && p.early &&
p.answers == 1
decide := fun t rs gs => do
need "(f): the plan's count of roots in front of the test is not the record's"
(p.nums.free == t.roots)
let t' ← (frontJ p).decide t rs gs
need "(p): the record's codes or the place's rounds fail a public clause of the chain"
(H2K.Pub.pubOk p t'.st.codes)
pure t' }
bat := fun p cut => ranged cut
{ batJ p cut with
decide := fun t rs gs => do
need "(c): the group is not in order, or a batched row lies outside its members' tables"
(combOk t)
let t' ← (batJ p cut).decide t rs gs
need "(k): behind the batching the claim has a kept form, or the group a kept member"
(noKept t')
need "(g): the group's trees in the record are not those that the place's numbers declare"
(H2K.First.gpOk p t' && H2K.First.labelsOk p t')
pure t' }
fold := fun p j cur cut => ranged cut (foldJ p j cur cut)
switch := fun p j cur next last cut => ranged cut (switchJ p j cur next last cut)
batBehind := behindJ
base := fun p j cur cut => ranged cut (baseJ5 p j cur cut)
group := fun t =>
match t.pass, t.st.groups[t.g]? with
| .claim _ L, some G =>
match t.st.codes.base[G.code]?, t.st.codes.mask[G.maskCode]? with
| some c, some z => some (⟨c.logN, c.ell, c.r⟩, ⟨z.logN, z.ell, z.r⟩, L.k, L.h)
| _, _ => none
| _, _ => none
maskCame := fun t => t.mask.isSome
DefinitionCommitted-table claim merge, 2 + kCol roundsJohnson/Desc/K13/Kind.lean:125–138
In words
In Lean · Johnson/Desc/K13/Kind.lean, lines 125–138

the file's variables

variable {T Cl : Type}

Committed-table claim merge, 2 + kCol rounds. One sampled element batches the two or more pending claims on the committed table; a masked sumcheck reduces them to one. No oracle message is sent or opened.

def claimCombinationBlock (X : Lens T) (p : Where) : Block T Cl :=
{ name := "K13: the batching"
place := ⟨p.chain, none, p.piece, .K13⟩
planOk := decide (1 < p.rows)
rounds := battRounds p
oracles := List.replicate (2 + p.lin.kCol) []
before := (List.range p.sent).map fun n => (p.chain, n)
decide := fun t rs _ => do
let s ← X.part t
need "K13.batched-once" s.lin.isNone
let o ← batt s.owed p.lin.kCol p.rows s.pile s.indexMasks s.d rs
pure (X.set t { s with owed := none, lin := some { claim := memberClaim o.1 }, d := o.2 })
claims := []
after := [] }
DefinitionSecond part of the committed-table claim reductionJohnson/Desc/Third/K14BatchLinearConstraintsSecondPart.lean:116–132
In words
In Lean · Johnson/Desc/Third/K14BatchLinearConstraintsSecondPart.lean, lines 116–132

batchLinearConstraintsSecondPart is the second part of the committed-table claim reduction and has no rounds. It first makes three checks and rejects if one fails (their names in Lean: "the two ends are at hand"; "the shape does not split the row (Dot)"; "no root is received yet, and the first own tree's number counts just one tree more"). It then adopts the oracle message named in the second chain's final state, adds it to the group named in this chain's state, and adds a linear constraint on that message and another tenant to the same group. Each of these steps can also reject. Its public check is the conjunction of lengthsOk, linOk and plainArm.

def batchLinearConstraintsSecondPart {Cl : Type} (p : P₁₄) : Block S₃ Cl :=
{ name := "K14, second part", place := ⟨3, none, 0, .K14⟩
planOk := p.codes.lengthsOk && linOk p.codes p.S && plainArm p.S
rounds := [], oracles := [], before := []
decide := fun s _ _ => do
let x ← named "the two ends are at hand" s.loc.border
need "the shape does not split the row (Dot)" (plainArm p.S)
need "no root is received yet, and the first own tree's number counts just one tree more"
(firstStepB s.roots s.loc.firstTree s.book)
let a ← takeOver p.S s.loc.own x.shared (s.withCols [])
let dot ← named "the row (Dot) can be made"
(linDotRow p.S x.g x.shared.psi a.1 (linLayOmega a.2.st.codes p.S) s.loc.w
(linLayW a.2.st.codes p.S))
let b ← named "the row (Dot) is laid" (addRowP a.2 s.loc.own dot)
pure { st := b.st, book := b.book, roots := b.roots
loc := { s.loc with border := none, omega := a.1 } }
claims := [], after := [] }
DefinitionA sub-protocol with no rounds and no kindJohnson/Desc/Block.lean:378–383
In words
In Lean · Johnson/Desc/Block.lean, lines 378–383

the file's variables

variable {Xi S Cl : Type}

A sub-protocol without rounds and of no kind: nothing is sent, sampled or opened, and its decision is the given update of the verifier state, which may reject.

def roundlessBlock (name : String) (chain : Nat) (link : Option Nat) (piece : Nat)
(f : S → Except String S) : Block S Cl :=
{ name := name, place := ⟨chain, link, piece, .frame⟩, planOk := true, rounds := [], oracles := []
before := []
decide := fun s _ _ => f s
claims := [], after := [] }
DefinitionA chain's last sub-protocolJohnson/Desc/ChainEnd.lean:99–105
In words
In Lean · Johnson/Desc/ChainEnd.lean, lines 99–105

A chain's last sub-protocol. If the chain is sealed, it has one round, named SEAL, in which nothing is sent or read; otherwise it has none. Its public check is nothingOwedOnPlan on the rounds declared by the sub-protocols before it. It accepts if the given conditions on the verifier state hold.

def chainEnd {S Cl : Type} (chain piece : Nat) (sealed : Bool) (inFront : List Fmt.DeclaredRound)
(asks : S → Clauses) : Block S Cl :=
let rounds := if sealed then [sealRound] else []
{ name := "the end of chain " ++ toString chain, place := ⟨chain, none, piece, .frame⟩
planOk := nothingOwedOnPlan inFront, rounds := rounds, oracles := rounds.map fun _ => []
before := [], decide := fun s _ _ => (refuse (asks s)).map fun _ => s
claims := [], after := [] }
How FlashProve's description is assembled · 92 cards
DefinitionThe type of a function that can replace the byte format's second hash functionLadder.lean:331
In words
In Lean · Ladder.lean, lines 331–331

The type of a function that can replace the byte format's second hash function: it maps a number and a byte string to a byte string.

abbrev SecondHashFunctionType : Type := ℕ → ByteArray → ByteArray
DefinitionThe data that determine the argument systemLadder.lean:347–388
In words
In Lean · Ladder.lean, lines 347–388

The data that determine the argument system. These fields are functions of the public files: C (types, relation, encoding), the three IOPs F, the provers P, a hash-oracle algorithm readMore (also a function of the files' digest), the compiler data T (also a function of that digest and of the output of readMore), an extractor, the honest commit and prove, and the parser parse. The fields shown and the honest sample are not. There are also four types: More, Shown, Rand and Form.

structure Description where
/-- The types of indices and instances, the relation and the encoding. -/
C : PublicFiles → Hiop.ConfigurationWithOutOfDomainSample
/-- The protocols of the prover's three files: key file, entry file, proof file. -/
F : (Z : PublicFiles) → Files (C Z)
/-- Their honest provers. They stand in the types of keys and proofs (`F.withProvers P`); their values are
read neither by `innerCompiledVerifier` nor by any goal. -/
P : (Z : PublicFiles) → (F Z).Provers
/-- What the further public reading returns. -/
More : Type
/-- The further public reading: an algorithm with access to the hash function, from the public
files and their digest. -/
readMore : PublicFiles → Digest → DeterministicAlgorithm More
/-- The rest of what the compiler takes (see `InnerCompilerInputFieldsOverThreeProtocols`, Johnson/Flat/InnerInputOfThreeProtocols.lean), as a function
of the public files and of what the two public readings returned: among it how rounds and openings
are laid into queries, the coding of queries into the one hash function, the code of a key, and
how an instance is built from tokens. The goals let every field depend on the answers. -/
T : (Z : PublicFiles) → Digest → More → InnerCompilerInputFieldsOverThreeProtocols (F Z) (P Z)
/-- The extractor of `G8` and `G9` (and of `G8bits` and `G9bits`, Ladder/Bits.lean): one for all.
It sees the public files, the settings, the commitment and the committer's logged queries, and
nothing else: not the hash function, nor what the public readings returned. -/
extractor : PublicFiles → (s : IntegerTransformer.Settings) → Commitment → QueryLog →
Option (ModelWeights s)
/-- What a proof may reveal of the weights: its type. No goal here reads it. -/
Shown : Type
/-- What a proof may reveal of the weights. No goal here reads it. -/
shown : (s : IntegerTransformer.Settings) → ModelWeights s → Shown
/-- The honest committer's randomness: its type. -/
Rand : Type
/-- The honest committer samples its randomness. `G3'pol` reads it. -/
sample : RandomizedAlgorithm Rand
/-- The honest committer. `G3'pol` and `G9` read it. -/
commit : PublicFiles → (s : IntegerTransformer.Settings) → ModelWeights s → Rand →
DeterministicAlgorithm Commitment
/-- The form that the honest prover fills in. -/
Form : Type
/-- `D`'s own parser. `G3'pol` reads it. -/
parse : (Z : PublicFiles) → List Token → List Token → Form →
DeterministicAlgorithm (TypedProof (F Z) (P Z))
/-- The honest prover. `G3'pol` reads it. -/
prove : PublicFiles → (s : IntegerTransformer.Settings) → ModelWeights s → Rand → List Token →
List Token → RandomizedAlgorithm Form
DefinitionA configurationHiop/RecConf.lean:87–128
In words
In Lean · Hiop/RecConf.lean, lines 87–128

A configuration, without the conditions it must satisfy: types of indices, instances and cells; two relations Ryes, Rno on them; hold and enc, which encode an index with pads and randomness as n symbols; seeds, answers, a collision predicate and a decoder.

structure ConfigurationWithOutOfDomainSample where
I : Type
X : Type
Cells : Type
/-- the indexed relation and its relaxation -/
Ryes : I → X → Cells → Prop
Rno : I → X → Cells → Prop
/-- the encoded index: a word of n symbols -/
n : ℕ
Sg : Type
/-- the messages of an encoded index, pads included -/
Msg : Type
/-- the encoding randomness -/
Rnd : Type
[finRnd : Fintype Rnd]
[neRnd : Nonempty Rnd]
enc : Msg → Rnd → (Fin n → Sg)
/-- the pads: what the committer puts, uniformly, at fixed places off the layout (by type any
finite, non-empty type; it enters `hold`; among the clauses on it: `Props.held_hold`,
`Props.hides`) -/
Pad : Type
[finPad : Fintype Pad]
[nePad : Nonempty Pad]
/-- the message that holds an index, with these pads -/
hold : I → Pad → Msg
/-- the index that a message holds, if it is in the index set -/
held : Msg → Option I
/-- the record phase: seeds, answers -/
Seed : Type
[finSeed : Fintype Seed]
[neSeed : Nonempty Seed]
Ans : Type
/-- the answers of a message to a seed; the encoding randomness is not read -/
smp : Seed → Msg → Ans
/-- the word has a collision at the seed -/
coll : (Fin n → Sg) → Seed → Prop
/-- decoding with the record: a message (pads included), or none -/
dcd : (Fin n → Sg) → Seed × Ans → Option Msg
/-- the cells that the honest prover computes -/
trace : I → X → Cells
/-- a fixed value of cells, where there is nothing to extract from -/
cells0 : Cells
DefinitionBuilds a Description from parts L and a hash-oracle algorithm moreJohnson/Goal/Tie/DescriptionOfData.lean:250–251
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 250–251

Builds a Description from parts L and a hash-oracle algorithm more. If L.live rejects the public files, empty round data are used. A proof is submitted as bytes; if decoding fails, L.f₀ is used instead.

def descriptionOfDataWithReading (more : PublicFiles → Digest → DeterministicAlgorithm (List (Dig 256))) (L : DescriptionData) :
Description := descriptionOnBytesWithReading (dataAtFiles L) L.f₀ L.honest more
DefinitionParts from which a Description is builtJohnson/Goal/Tie/DescriptionOfData.lean:62–103
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 62–103

The parts from which a Description is built, most of them functions of the public files: the relation, the index encoding, the round data of the offline and online IOPs, three verifier decisions, the provers, the extractor, the honest committer and prover, a test live, the planner's values G and Gd, the further fields it, N, hStar, d₀ and f₀, and two proofs, hf₀ and hlive.

structure DescriptionData where
/-- THE CLAIMS: where the claim on the output lives (A.Rel) -/
A : OnBytes.K.Pub → (frS.toDecR frZ 402653181).Claims XF
/-- how an index is held -/
E : (Zk : OnBytes.K.Pub) → Coding (A Zk)
/-- the key file's rounds' data -/
DK : OnBytes.K.Pub → WholeD
/-- the proof file's -/
DP : OnBytes.K.Pub → WholeD
runK : OnBytes.K.Pub → RecFull → PQ.View → PQ.View → PQ.View → Bool
runP : OnBytes.K.Pub → XF × RecFull → PQ.View → PQ.View → PQ.View → Bool
/-- THE ENTRY FILE's DECISION -/
dec : OnBytes.K.Pub → RecFull × RecFull → PQ.View → Bool
/-- THE PLAN's VALUES that are laid where the test says yes -/
G : OnBytes.K.Pub → FilesParameters XF RecFull
/-- the statement's item "request" at an instance -/
it : OnBytes.K.Pub → XF → ByteArray
/-- the provers, at whatever data are laid -/
P : (Zk : OnBytes.K.Pub) → (G : FilesParameters XF RecFull) → (DK DP : WholeD) →
(FsAtR (A Zk) (E Zk) G DK DP (runK Zk) (runP Zk) (dec Zk)).Provers
/-- the named side -/
N : (Zk : OnBytes.K.Pub) → (G : FilesParameters XF RecFull) → (DK DP : WholeD) →
NamedSideOfFullD (A Zk) (E Zk) DK DP (runK Zk) (runP Zk) dsF xsF (dec Zk) G.rec₀ G.z₀.2 (sBG
G).logLeaves
G.early (saltG G) (P Zk G DK DP)
/-- the extractor -/
ext : OnBytes.K.Pub → (s : IntegerTransformer.Settings) → Commitment → QueryLog → Option
(ModelWeights s)
/-- the honest side, at the form of bytes -/
honest : CommitterAndProver FormBytes
hStar : HId
d₀ : Dig 256
f₀ : DecodedProof
/-- its further tokens are no tokens of the vocabulary: SO WHERE A DECODER REFUSES verify SAYS
no AT EVERY DescriptionData -/
hf₀ : f₀.aux = auxNo
/-- THE FAMILY's TEST AT THE PUBLIC FILES: where it says no, dataAtFiles lays empty data and Gd -/
live : OnBytes.K.Pub → Bool
/-- its yes gives tAt's three tests at the data that are laid -/
hlive : ∀ Zk, live Zk = true → roundsDataFit (DK Zk) (DP Zk) = true
/-- the G of the branch that refuses -/
Gd : OnBytes.K.Pub → FilesParameters XF RecFull
DefinitionRelation data on a decoded tableOnBytes/Slice/DecoderRec.lean:143–153
In words
In Lean · OnBytes/Slice/DecoderRec.lean, lines 143–153

the file's variables

variable (D : DecR)

Relation data on a decoded table, for instances in X: a type of matrices, the table's matrix, a range predicate, a relation Rel between matrix and instance, and a proof that the matrix depends only on entries below D.cut.

structure Claims (X : Type) where
/-- the matrices -/
Mat : Type
/-- the matrix of a decoded table -/
mat : (D.ix.Row × D.toDec.En → GE) → Mat
/-- its entries are in range -/
inRange : Mat → Prop
/-- the claim of an instance on the matrix -/
Rel : Mat → X → Prop
/-- the matrix reads no pad -/
mat_cut : ∀ u u', D.Agree u u' → mat u = mat u'
DefinitionHow an index is encodedOnBytes/Flat/FilesAt.lean:96–105
In words
In Lean · OnBytes/Flat/FilesAt.lean, lines 96–105

How an index is encoded: hold maps a matrix and pads to a message, enc encodes a message with randomness into 2^a symbols, and smp returns a message's answers to a seed.

structure Coding {D : DecR} {X : Type} (A : D.Claims X) where
Rnd : Type
[finRnd : Fintype Rnd]
[neRnd : Nonempty Rnd]
enc : (D.ix.Row × D.toDec.En → GE) → Rnd → (Fin (2 ^ D.T.a) → Run.PQ.SgX)
Pad : Type
[finPad : Fintype Pad]
[nePad : Nonempty Pad]
hold : A.Mat → Pad → (D.ix.Row × D.toDec.En → GE)
smp : D.Z.D → (D.ix.Row × D.toDec.En → GE) → (D.ix.Row × D.Z.S → GE)
DefinitionThe planner's valuesOnBytes/Flat/FilesAt.lean:127–137
In words
In Lean · OnBytes/Flat/FilesAt.lean, lines 127–137

The planner's values: parameters of the offline and online IOPs' chains, a function block of the instance, a sample rec₀, an instance–sample pair z₀, the batch depth depthReq, and a map early on instances.

structure FilesParameters (X R : Type) where
k : Params.KeyChains
c : Params.ProofChains
block : X → Blk Proof.FirstEnd
/-- the record at which the key file's dry runs are made -/
rec₀ : R
/-- the instance and the record at which the proof file's dry runs are made -/
z₀ : X × R
/-- the number of slots of a batch is 2 ^ depthReq -/
depthReq : ℕ
early : X → X
DefinitionThe parts at every choice of public files ZJohnson/Goal/Tie/DescriptionOfData.lean:152–154
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 152–154

For every choice of public files Z, the parts at Z: dataAtFilesFromRounds applied to the values of filesParametersOrDefault, keyRoundsOrEmpty and proofRoundsOrEmpty.

def dataAtFiles (L : DescriptionData) (Z : PublicFiles) : DescriptionDataAtFiles (asDescriptionFiles Z) :=
dataAtFilesFromRounds L (asDescriptionFiles Z) (L.filesParametersOrDefault (asDescriptionFiles Z)) (L.keyRoundsOrEmpty (asDescriptionFiles Z)) (L.proofRoundsOrEmpty (asDescriptionFiles Z)) (L.fit_of
(asDescriptionFiles Z))
DefinitionThe parts L evaluated at one choice of public filesJohnson/Goal/Tie/DescriptionOfData.lean:109–129
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 109–129

The parts L evaluated at one choice of public files, for given planner's values G and given round data that satisfy roundsDataFit.

def dataAtFilesFromRounds (L : DescriptionData) (Zk : OnBytes.K.Pub) (G : FilesParameters XF RecFull) (DK DP : WholeD) (h : roundsDataFit DK DP =
true) :
DescriptionDataAtFiles Zk where
G := G
A := L.A Zk
E := L.E Zk
DK := DK
DP := DP
runK := L.runK Zk
runP := L.runP Zk
dec := L.dec Zk
P := L.P Zk G DK DP
hStar := L.hStar
it := L.it Zk
sR := sROf G
hDK := ((fit3_iff DK DP).1 h).1
hDP := ((fit3_iff DK DP).1 h).2.1
hK := ((fit3_iff DK DP).1 h).2.2
N := L.N Zk G DK DP
d₀ := L.d₀
ext := L.ext Zk
DefinitionThe planner's values: L.G if L.live accepts the public files, otherwise L.GdJohnson/Goal/Tie/DescriptionOfData.lean:139
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 139–139

L.G at the public files if L.live accepts them, otherwise L.Gd.

def DescriptionData.filesParametersOrDefault (L : DescriptionData) (Zk : OnBytes.K.Pub) : FilesParameters XF RecFull := if L.live Zk then L.G Zk else L.Gd Zk
DefinitionThe offline IOP's round data L.DK if L.live accepts the public filesJohnson/Goal/Tie/DescriptionOfData.lean:141
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 141–141

The offline IOP's round data L.DK if L.live accepts the public files, otherwise the empty round data emptyRoundsData.

def DescriptionData.keyRoundsOrEmpty (L : DescriptionData) (Zk : OnBytes.K.Pub) : WholeD := if L.live Zk then L.DK Zk else emptyRoundsData
DefinitionThe online IOP's round data L.DP if L.live accepts the public filesJohnson/Goal/Tie/DescriptionOfData.lean:143
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 143–143

The online IOP's round data L.DP if L.live accepts the public files, otherwise the empty round data emptyRoundsData.

def DescriptionData.proofRoundsOrEmpty (L : DescriptionData) (Zk : OnBytes.K.Pub) : WholeD := if L.live Zk then L.DP Zk else emptyRoundsData
DefinitionRound data made from three empty lists of roundsJohnson/Goal/Tie/DescriptionOfData.lean:132
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 132–132

Round data made from three empty lists of rounds, at table depth 0.

def emptyRoundsData : WholeD := OnBytes.Maker.WholeD.of 0 (OnBytes.Three.Whole.of [] [] [])
DefinitionA check on the offline and online IOPs' round dataJohnson/Goal/Tie/DescriptionOfData.lean:52–53
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 52–53

A check on the round data of the offline and online IOPs: in every round except the first chain's sealing round, the challenge kind's number and the number of proof-of-work bits are below 256 (kindsAndWorkBelow256), and KF DK DP + 2 < 2^49.

def roundsDataFit (DK DP : WholeD) : Bool :=
kindsAndWorkBelow256 (DK.at frS.P.T.a) && kindsAndWorkBelow256 (DP.at frS.P.T.a) && decide (KF DK DP + 1 + 1 < 2 ^ 49)
DefinitionIn every round except the first chain's sealing round, the challenge kind's number and the number of proof-of-work bits are below 256OnBytes/Maker/Page/FitAt.lean:56–57
In words
In Lean · OnBytes/Maker/Page/FitAt.lean, lines 56–57

In every round of a file's three chains except the first chain's sealing round, the challenge kind's number and the number of proof-of-work bits are below 256.

def kindsAndWorkBelow256 (D : WholeD) : Bool :=
(D.ds₁ ++ D.ds₂ ++ D.ds₃).all fun d => decide (d.kind.num < 256) && decide (d.entry.work < 256)
DefinitionThe parts at one fixed choice of public filesJohnson/Goal/Tie/DescriptionOnDecodedProof.lean:44–69
In words
In Lean · Johnson/Goal/Tie/DescriptionOnDecodedProof.lean, lines 44–69

The parts at one fixed choice of public files: DescriptionData's fields without honest, f₀, live and Gd, a number sR, and proofs of the three conditions of roundsDataFit.

structure DescriptionDataAtFiles (Zk : OnBytes.K.Pub) where
/-- the plan's values: a field, so that a family can take `LPFD.Full.GF Zk` where its test says
yes
and values with both depths 0 where it does not -/
G : FilesParameters XF RecFull
A : (frS.toDecR frZ 402653181).Claims XF
E : Coding A
DK : WholeD
DP : WholeD
runK : RecFull → PQ.View → PQ.View → PQ.View → Bool
runP : XF × RecFull → PQ.View → PQ.View → PQ.View → Bool
/-- THE ENTRY FILE's DECISION: the third letter -/
dec : RecFull × RecFull → PQ.View → Bool
P : (FsAtR A E G DK DP runK runP dec).Provers
hStar : HId
/-- the statement's item "request" at an instance: a letter, so that no hash function is named
here -/
it : XF → ByteArray
sR : ℕ
hDK : kindsAndWorkBelow256 (DK.at frS.P.T.a) = true
hDP : kindsAndWorkBelow256 (DP.at frS.P.T.a) = true
hK : KF DK DP + 1 + 1 < 2 ^ 49
N : NamedSideOfFullD A E DK DP runK runP dsF xsF dec G.rec₀ G.z₀.2 (sBG G).logLeaves G.early
(saltG G) P
d₀ : Dig 256
ext : (s : IntegerTransformer.Settings) → Commitment → QueryLog → Option (ModelWeights s)
DefinitionThe parts at one fixed choice of public files, in the form that descriptionOfFieldsWithReading takesJohnson/Goal/Tie/DescriptionOnDecodedProof.lean:115–134
In words
In Lean · Johnson/Goal/Tie/DescriptionOnDecodedProof.lean, lines 115–134

the file's variables

variable {Zk : OnBytes.K.Pub}

The parts at one fixed choice of public files, in the form that descriptionOfFieldsWithReading takes. The link IOP's round data and its queries to the committed tables are the constants dsF and xsF, not fields.

def DescriptionDataAtFiles.toDescriptionFields (S : DescriptionDataAtFiles Zk) : DescriptionFields where
X := XF
A := S.A
E := S.E
DK := S.DK
DP := S.DP
runK := S.runK
runP := S.runP
ds := dsF
xs := xsF
dec := S.dec
rK := S.G.rec₀
rP := S.G.z₀.2
depthReq := (sBG S.G).logLeaves
early := S.G.early
salt := saltG S.G
K := KF S.DK S.DP
P := S.P
inputFieldsAtReadings := S.inputFieldsAtReadings
ext := S.ext
DefinitionThe compiler's further data as a function of a digest c and a list of digests mJohnson/Goal/Tie/DescriptionOnDecodedProof.lean:91–95
In words
In Lean · Johnson/Goal/Tie/DescriptionOnDecodedProof.lean, lines 91–95

the file's variables

variable {Zk : OnBytes.K.Pub}

The compiler's further data as a function of a digest c and a list of digests m, both converted to bytes and passed to inputFieldsAtReadingsAsBytes. In the verifier, c is the public files' digest and m is the output of readMore.

def DescriptionDataAtFiles.inputFieldsAtReadings (S : DescriptionDataAtFiles Zk) (c : Digest) (m : List (Dig 256)) :
InnerCompilerInputAndAnalysisFieldsAtFullSize S.A S.E S.DK S.DP S.runK S.runP dsF xsF S.dec S.G.rec₀ S.G.z₀.2 (sBG
S.G).logLeaves S.G.early
(saltG S.G) (KF S.DK S.DP) S.P :=
S.inputFieldsAtReadingsAsBytes (digToBytes c) (size_digToBytes c) (m.map digToBytes)
DefinitionThe compiler's further data at a 32-byte string c and a list of byte stringsJohnson/Goal/Tie/DescriptionOnDecodedProof.lean:74–80
In words
In Lean · Johnson/Goal/Tie/DescriptionOnDecodedProof.lean, lines 74–80

the file's variables

variable {Zk : OnBytes.K.Pub}

The compiler's further data for a 32-byte string c and a list of byte strings: tAt (not printed) applied to the parts' fields, c, and three values taken from the list.

def DescriptionDataAtFiles.inputFieldsAtReadingsAsBytes (S : DescriptionDataAtFiles Zk) (c : ByteArray) (hc : c.size = 32) (seven : List ByteArray) :
InnerCompilerInputAndAnalysisFieldsAtFullSize S.A S.E S.DK S.DP S.runK S.runP dsF xsF S.dec S.G.rec₀ S.G.z₀.2 (sBG
S.G).logLeaves S.G.early
(saltG S.G) (KF S.DK S.DP) S.P :=
tAt S.A S.E S.G c hc S.DK S.DP S.runK S.runP S.dec S.P S.hStar S.it S.sR
(PV.RunArgsF.pdLOf seven)
(PV.RunArgsF.pd3At seven 4) (PV.RunArgsF.pd3At seven 1) S.hDK S.hDP S.hK S.N S.d₀
DefinitionThe description with a proof submitted as bytesJohnson/Goal/Tie/DescriptionOnBytes.lean:148–149
In words
In Lean · Johnson/Goal/Tie/DescriptionOnBytes.lean, lines 148–149

the file's variables

variable (S : (Z : PublicFiles) → DescriptionDataAtFiles (asDescriptionFiles Z)) {Form : Type} (Hn : CommitterAndProver Form)
(dec : ByteArray → Form → Option DecodedProof) (f₀ : DecodedProof)
variable (Hb : CommitterAndProver FormBytes)

descriptionWithDecoderAndReading with submitted proofs of type FormBytes (a list of tokens and five byte strings) and decoder decodeD.

def descriptionOnBytesWithReading (more : PublicFiles → Digest → DeterministicAlgorithm (List (Dig 256))) : Description :=
descriptionWithDecoderAndReading S Hb decodeD f₀ more
DefinitionA description from parts, a decoder and a fallbackJohnson/Goal/Tie/DescriptionOnBytes.lean:72–73
In words
In Lean · Johnson/Goal/Tie/DescriptionOnBytes.lean, lines 72–73

the file's variables

variable (S : (Z : PublicFiles) → DescriptionDataAtFiles (asDescriptionFiles Z)) {Form : Type} (Hn : CommitterAndProver Form)
(dec : ByteArray → Form → Option DecodedProof) (f₀ : DecodedProof)

descriptionOfFieldsWithReading applied to the parts (S Z).toDescriptionFields, to the honest algorithms Hn with the parser that committerAndProverWithParser builds from the decoder dec and the fallback f₀, and to the argument more as the hash-oracle algorithm readMore.

def descriptionWithDecoderAndReading (more : PublicFiles → Digest → DeterministicAlgorithm (List (Dig 256))) : Description :=
descriptionOfFieldsWithReading (fun Z => (S Z).toDescriptionFields) (committerAndProverWithParser S Hn dec f₀) more
DefinitionThe honest algorithms Hn and the parser parserWithDecoderJohnson/Goal/Tie/DescriptionOnBytes.lean:58–66
In words
In Lean · Johnson/Goal/Tie/DescriptionOnBytes.lean, lines 58–66

the file's variables

variable (S : (Z : PublicFiles) → DescriptionDataAtFiles (asDescriptionFiles Z)) {Form : Type} (Hn : CommitterAndProver Form)
(dec : ByteArray → Form → Option DecodedProof) (f₀ : DecodedProof)

The honest algorithms Hn and the parser parserWithDecoder, in the form that descriptionOfFieldsWithReading takes.

def committerAndProverWithParser : CommitterProverFormAndParser fun Z => (S Z).toDescriptionFields where
Shown := Hn.Shown
shown := Hn.shown
Rand := Hn.Rand
sample := Hn.sample
commit := Hn.commit
Form := Form
parse := parserWithDecoder S dec f₀
prove := Hn.prove
DefinitionThe parser, which ignores the prompt and the outputJohnson/Goal/Tie/DescriptionOnBytes.lean:49–56
In words
In Lean · Johnson/Goal/Tie/DescriptionOnBytes.lean, lines 49–56

the file's variables

variable (S : (Z : PublicFiles) → DescriptionDataAtFiles (asDescriptionFiles Z)) {Form : Type} (Hn : CommitterAndProver Form)
(dec : ByteArray → Form → Option DecodedProof) (f₀ : DecodedProof)

The parser ignores the prompt and the output. It queries the hash oracle once for the public files' digest c, decodes the submitted proof given c, uses f₀ if decoding fails, and returns the typed proof.

def parserWithDecoder (Z : PublicFiles) (_ _ : List Token) (B : Form) : DeterministicAlgorithm
(TypedProof (threeProtocolsAtFullSize (S Z).toDescriptionFields.A (relationsAndEncodingOfClaims (S Z).toDescriptionFields.A (S Z).toDescriptionFields.E) (S Z).toDescriptionFields.DK (S
Z).toDescriptionFields.DP
(S Z).toDescriptionFields.runK (S Z).toDescriptionFields.runP (S Z).toDescriptionFields.ds (S Z).toDescriptionFields.xs (S Z).toDescriptionFields.dec (S
Z).toDescriptionFields.rK (S Z).toDescriptionFields.rP (S Z).toDescriptionFields.depthReq (S Z).toDescriptionFields.early
(S Z).toDescriptionFields.salt) (S Z).toDescriptionFields.P) :=
.query (configString Z) fun c =>
.done ((S Z).typedOf (digToBytes c) ((dec (digToBytes c) B).getD f₀))
DefinitionHonest committer and prover for a proof type FormJohnson/Goal/Tie/DescriptionOnBytes.lean:35–43
In words
In Lean · Johnson/Goal/Tie/DescriptionOnBytes.lean, lines 35–43

The honest committer and prover for a proof type Form: commit and prove, the committer's randomness Rand with its sampler, and a function shown from the weights to a type Shown.

structure CommitterAndProver (Form : Type) where
Shown : Type
shown : (s : IntegerTransformer.Settings) → ModelWeights s → Shown
Rand : Type
sample : RandomizedAlgorithm Rand
commit : PublicFiles → (s : IntegerTransformer.Settings) → ModelWeights s → Rand →
DeterministicAlgorithm Commitment
prove : PublicFiles → (s : IntegerTransformer.Settings) → ModelWeights s → Rand → List Token →
List Token → RandomizedAlgorithm Form
DefinitionDefines every field of Description from parts fr Z indexed by the public files ZJohnson/Goal/Tie/DescribeT.lean:80–97
In words
In Lean · Johnson/Goal/Tie/DescribeT.lean, lines 80–97

the file's variables

variable (fr : PublicFiles → DescriptionFields) (H : CommitterProverFormAndParser fr)

Defines every field of Description from parts fr Z indexed by the public files Z, the honest algorithms and parser H, and a hash-oracle algorithm more. The three IOPs are threeProtocolsAtFullSize at fr Z.

def descriptionOfFieldsWithReading (more : PublicFiles → Digest → DeterministicAlgorithm (List (Dig 256))) : Description where
C := fun Z => DecR.configurationOfStoredTable (fr Z).A (relationsAndEncodingOfClaims (fr Z).A (fr Z).E)
F := fun Z => threeProtocolsAtFullSize (fr Z).A (relationsAndEncodingOfClaims (fr Z).A (fr Z).E) (fr Z).DK (fr Z).DP (fr Z).runK
(fr Z).runP (fr Z).ds (fr Z).xs (fr Z).dec (fr Z).rK (fr Z).rP (fr Z).depthReq (fr Z).early (fr
Z).salt
P := fun Z => (fr Z).P
More := List (Dig 256)
readMore := more
T := fun Z c m => ((fr Z).inputFieldsAtReadings c m).letters
extractor := fun Z s => (fr Z).ext s
Shown := H.Shown
shown := H.shown
Rand := H.Rand
sample := H.sample
commit := H.commit
Form := H.Form
parse := H.parse
prove := H.prove
DefinitionThe parts that descriptionOfFieldsWithReading takes, for one choice of public filesJohnson/Goal/Tie/DescribeT.lean:37–59
In words
In Lean · Johnson/Goal/Tie/DescribeT.lean, lines 37–59

The parts that descriptionOfFieldsWithReading takes, for one choice of public files: relation, index encoding, the three IOPs' round data and decisions, provers, extractor, and the compiler's further data inputFieldsAtReadings.

structure DescriptionFields where
X : Type
A : (frS.toDecR frZ 402653181).Claims X
E : Coding A
DK : WholeD
DP : WholeD
runK : RecFull → PQ.View → PQ.View → PQ.View → Bool
runP : X × RecFull → PQ.View → PQ.View → PQ.View → Bool
/-- the entry file's written rounds, its openings' places, ITS DECISION: three letters of the
frame (Johnson/Flat/Dec/) -/
ds : List TypedOracleCompiler.Run.PQ.RD
xs : List _root_.Run.PQ.XO
dec : RecFull × RecFull → PQ.View → Bool
rK : RecFull
rP : RecFull
depthReq : ℕ
early : X → X
salt : ℕ
K : ℕ
P : (threeProtocolsAtFullSize A (relationsAndEncodingOfClaims A E) DK DP runK runP ds xs dec rK rP depthReq early salt).Provers
inputFieldsAtReadings : Digest → List (Dig 256) →
InnerCompilerInputAndAnalysisFieldsAtFullSize A E DK DP runK runP ds xs dec rK rP depthReq early salt K P
ext : (s : IntegerTransformer.Settings) → Commitment → QueryLog → Option (ModelWeights s)
DefinitionHonest committer and proverJohnson/Goal/Tie/DescribeT.lean:62–75
In words
In Lean · Johnson/Goal/Tie/DescribeT.lean, lines 62–75

The honest committer and prover, the type Form of submitted proofs, and the parser from Form to typed proofs, over a family of parts fr.

structure CommitterProverFormAndParser (fr : PublicFiles → DescriptionFields) where
Shown : Type
shown : (s : IntegerTransformer.Settings) → ModelWeights s → Shown
Rand : Type
sample : RandomizedAlgorithm Rand
commit : PublicFiles → (s : IntegerTransformer.Settings) → ModelWeights s → Rand →
DeterministicAlgorithm Commitment
Form : Type
parse : (Z : PublicFiles) → List Token → List Token → Form → DeterministicAlgorithm
(TypedProof (threeProtocolsAtFullSize (fr Z).A (relationsAndEncodingOfClaims (fr Z).A (fr Z).E) (fr Z).DK (fr Z).DP (fr Z).runK
(fr Z).runP (fr Z).ds (fr Z).xs (fr Z).dec (fr Z).rK (fr Z).rP (fr Z).depthReq (fr Z).early
(fr Z).salt) (fr Z).P)
prove : PublicFiles → (s : IntegerTransformer.Settings) → ModelWeights s → Rand → List Token →
List Token → RandomizedAlgorithm Form
DefinitionThe relation and the encoding for DecR.configurationOfStoredTableOnBytes/Flat/FilesAt.lean:113–123
In words
In Lean · OnBytes/Flat/FilesAt.lean, lines 113–123

The relation and the encoding for DecR.configurationOfStoredTable: Ryes and Rno both say that the matrix M is in range and A.Rel M x holds; Cells is trivial; encoding, pads and sampler come from E.

def relationsAndEncodingOfClaims {D : DecR} {X : Type} (A : D.Claims X) (E : Coding A) : D.RelationsAndEncoding A where
Cells := Unit
Ryes := fun M x _ => A.inRange M ∧ A.Rel M x
Rno := fun M x _ => A.inRange M ∧ A.Rel M x
Rnd := E.Rnd
enc := E.enc
Pad := E.Pad
hold := E.hold
smp := E.smp
trace := fun _ _ => ()
cells0 := ()
DefinitionThe data that DecR.configurationOfStoredTable takes in addition to D and AOnBytes/Slice/ConfOf.lean:44–68
In words
In Lean · OnBytes/Slice/ConfOf.lean, lines 44–68

the file's variables

variable (D : DecR) {X : Type} (A : D.Claims X)

The data that DecR.configurationOfStoredTable takes in addition to D and A: the two relations and the type Cells of their third argument, the encoding and its randomness, the pads, the message hold that contains an index with given pads, the sampler, a function trace into Cells, and a value cells0.

structure RelationsAndEncoding where
/-- the cells of a request -/
Cells : Type
/-- the exact relation and its relaxation -/
Ryes : A.Mat → X → Cells → Prop
/-- See `Ryes`. -/
Rno : A.Mat → X → Cells → Prop
/-- the encoding randomness -/
Rnd : Type
[finRnd : Fintype Rnd]
[neRnd : Nonempty Rnd]
/-- the encoding of a message -/
enc : (D.ix.Row × D.toDec.En → GE) → Rnd → (Fin (2 ^ D.T.a) → Run.PQ.SgX)
/-- the pads -/
Pad : Type
[finPad : Fintype Pad]
[nePad : Nonempty Pad]
/-- the message that holds an index, with these pads -/
hold : A.Mat → Pad → (D.ix.Row × D.toDec.En → GE)
/-- the answers of a message to a seed -/
smp : D.Z.D → (D.ix.Row × D.toDec.En → GE) → (D.ix.Row × D.Z.S → GE)
/-- the cells that the honest prover computes -/
trace : A.Mat → X → Cells
/-- a fixed value of cells -/
cells0 : Cells
DefinitionA committed table's configurationOnBytes/Slice/ConfOf.lean:76–96
In words
In Lean · OnBytes/Slice/ConfOf.lean, lines 76–96

the file's variables

variable (D : DecR) {X : Type} (A : D.Claims X)
variable {D}
open Classical in

A committed table's configuration: index type A.Mat, words of 2^a symbols; seeds, answers, collision predicate and decoder from D; relations and encoding from R. held returns a message's matrix exactly when that matrix is in range.

noncomputable def configurationOfStoredTable (R : D.RelationsAndEncoding A) : ConfigurationWithOutOfDomainSample where
I := A.Mat
X := X
Cells := R.Cells
Ryes := R.Ryes
Rno := R.Rno
n := 2 ^ D.T.a
Sg := Run.PQ.SgX
Msg := D.ix.Row × D.toDec.En → GE
Rnd := R.Rnd
enc := R.enc
Pad := R.Pad
hold := R.hold
held := fun u => if A.inRange (A.mat u) then some (A.mat u) else none
Seed := D.Z.D
Ans := D.ix.Row × D.Z.S → GE
smp := R.smp
coll := D.coll
dcd := D.dcd
trace := R.trace
cells0 := R.cells0
DefinitionThe three IOPs at the full parameter sizeJohnson/Flat/Dec/WiresAtSizes.lean:66–68
In words
In Lean · Johnson/Flat/Dec/WiresAtSizes.lean, lines 66–68

the file's variables

variable {X : Type} (A : (frS.toDecR frZ 402653181).Claims X)
(R : (frS.toDecR frZ 402653181).RelationsAndEncoding A) (DK DP : WholeD)
(runK : RecFull → PQ.View → PQ.View → PQ.View → Bool)
(runP : X × RecFull → PQ.View → PQ.View → PQ.View → Bool)
(ds : List TypedOracleCompiler.Run.PQ.RD) (xs : List _root_.Run.PQ.XO)
(dec : RecFull × RecFull → PQ.View → Bool) (rK rP : RecFull) (depthReq : ℕ)
(early : X → X) (salt : ℕ)

The three IOPs at the full parameter size: filesAt over the field of size 2^64 − 2^32 + 1, with N = 2^depthReq, late = none, and checks silK, silP on the challenge-free rounds.

@[reducible] def threeProtocolsAtFullSize : Files (DecR.configurationOfStoredTable A R) :=
filesAt A R .two DK DP (front₀ rK) (join₀ rK) ByteArray.empty (front₀ rP) (join₀ rP)
ByteArray.empty silK runK silP runP (linkProtocolAtFullSize ds xs dec salt) (2 ^ depthReq) early none
DefinitionThe three IOPs over a committed table's configurationJohnson/EntryRec/AtConf.lean:74–75
In words
In Lean · Johnson/EntryRec/AtConf.lean, lines 74–75

the file's variables

variable {D : DecR} {X : Type} (A : D.Claims X) (R : D.RelationsAndEncoding A)
variable (f : _root_.Fmt.Fld) (DK DP : WholeD)
{TFk TJk T3k TFp TJp T3p : Type} (tFk : TFk) (tJk : TJk) (t3k : T3k) (tFp : TFp) (tJp : TJp)
(t3p : T3p) (silK : (DecR.configurationOfStoredTable A R).Rec → TFk → TJk → T3k → Bool)
(runK : (DecR.configurationOfStoredTable A R).Rec → View → View → View → Bool)
(silP : X × (DecR.configurationOfStoredTable A R).Rec → TFp → TJp → T3p → Bool)
(runP : X × (DecR.configurationOfStoredTable A R).Rec → View → View → View → Bool)
(eL : LinkProtocolWithLeafCoding (DecR.configurationOfStoredTable A R).Rec D.T.a) (N : ℕ) (early : X → X) (late : Option ℕ)

filesOf applied to the fields of DecR.configurationOfStoredTable A R: index type A.Mat, tables of 2^a symbols, the seeds and answers of the out-of-domain sample, and the relation and encoding from R.

noncomputable def filesAt : Files (DecR.configurationOfStoredTable A R) :=
filesOf (lettersAt A R) f DK DP tFk tJk t3k tFp tJp t3p silK runK silP runP eL N early late
DefinitionAssembles a value of type FilesJohnson/EntryRec/AtFiles.lean:47–56
In words
In Lean · Johnson/EntryRec/AtFiles.lean, lines 47–56

the file's variables

variable {a : ℕ} (Kc : ConfLetters a) (f : _root_.Fmt.Fld) (DK DP : WholeD)
{TFk TJk T3k TFp TJp T3p : Type} (tFk : TFk) (tJk : TJk) (t3k : T3k) (tFp : TFp) (tJp : TJp)
(t3p : T3p) (silK : Kc.conf.Rec → TFk → TJk → T3k → Bool)
(runK : Kc.conf.Rec → View → View → View → Bool)
(silP : Kc.conf.X × Kc.conf.Rec → TFp → TJp → T3p → Bool)
(runP : Kc.conf.X × Kc.conf.Rec → View → View → View → Bool)
(eL : LinkProtocolWithLeafCoding Kc.conf.Rec a) (N : ℕ) (early : Kc.conf.X → Kc.conf.X) (late : Option ℕ)

Constructs a value of Files. The offline and online IOPs are reductionOfWholeFile applied to their round data (table depth set to a), checks and decisions, converted by toInteractiveOracleProof. The link IOP and its round marking come from eL.

@[reducible] def filesOf : Files Kc.conf where
key := (reductionOfWholeFile (ckP f) (DK.at a) tFk tJk t3k silK runK).toInteractiveOracleProof
entry := eL.QL
proof := (reductionOfWholeFile (ckP f) (DP.at a) tFp tJp t3p silP runP).toInteractiveOracleProof
N := N
annT := (chainsOf (ckP f) (DK.at a) tFk tJk t3k).ann
annL := eL.aL
ann := (chainsOf (ckP f) (DP.at a) tFp tJp t3p).ann
early := early
late := late
DefinitionThree public-coin IOPs over a configuration COnBytes/Flat/Frame.lean:28–46
In words
In Lean · OnBytes/Flat/Frame.lean, lines 28–46

Three public-coin IOPs over a configuration C. The offline IOP has an out-of-domain sample as its instance and the encoded index as its oracle. The link IOP has two of each. The online IOP has an element of type C.X together with a sample as its instance, and one encoded index as its oracle. The structure also contains N, the round markings, early and late.

structure Files (C : ConfigurationWithOutOfDomainSample) where
/-- the key file: on a record, over the encoded index -/
key : InteractiveOracleProof C.Rec C.E0
/-- the entry file: on two records, over two encoded indices -/
entry : InteractiveOracleProof (C.Rec × C.Rec) (twoExternalStrings C.n C.Sg)
/-- the proof file: on an instance and a record, over the encoded index -/
proof : InteractiveOracleProof (C.X × C.Rec) C.E0
/-- the number of slots -/
N : ℕ
/-- which rounds of the key file stand in its shared chain -/
annT : RoundSplits key.shape
/-- the same for the entry file -/
annL : RoundSplits entry.shape
/-- which rounds of the proof file are shared by a batch -/
ann : RoundSplits proof.shape
/-- the part of an instance that is fixed before the proof file's first round -/
early : C.X → C.X
/-- the round of the proof file behind which the rest of the instance is named, if there is one -/
late : Option ℕ
DefinitionCombines the three IOPsOnBytes/Flat/Object.lean:50–68
In words
In Lean · OnBytes/Flat/Object.lean, lines 50–68

the file's variables

variable {C : ConfigurationWithOutOfDomainSample} (F : Files C)

Combines the three IOPs, the provers, and the configuration's encoder, sampler and index decoder into a value of Iop.HolographicProtocol, which the compiler takes as input. Here offline and link are the offline and link IOPs, and onlineBatch is the online IOP with its round marking.

noncomputable def withProvers (P : F.Provers) : HolographicProtocol C.I C.X where
wordLength := C.n
Symbol := C.Sg
EncodingRandomness := C.Pad × C.Rnd
encodeIndex := fun i r => C.enc (C.hold i r.1) r.2
OutOfDomainSeed := C.Seed
OutOfDomainAnswer := C.Ans
honestOutOfDomainAnswer := fun i r s => C.smp s (C.hold i r.1)
hasCollisionAt := C.coll
decodeIndex := C.D
offline := F.key
link := F.entry
maxBatchSize := F.N
onlineBatch := F.batch
honestOfflineProver := P.hT
honestLinkProver := P.hL
honestOnlineBatchProver := P.hB
early := F.early
late := F.late
DefinitionA file's three chains as one interactive oracle reduction to the trivial statementOnBytes/Maker/Whole.lean:198–230
In words
In Lean · OnBytes/Maker/Whole.lean, lines 198–230

the file's variables

variable (C : CK) (D : WholeD) {TF TJ T3 : Type} (tF : TF) (tJ : TJ) (t3 : T3)

A file's three chains as one interactive oracle reduction to the trivial statement, with a challenge-free round before each chain. It accepts if and only if all proof-of-work bits are 0 and fullOf, carriesOf, silent and run accept.

@[reducible] def reductionOfWholeFile {Xi : Type} (silent : Xi → TF → TJ → T3 → Bool)
(run : Xi → View → View → View → Bool) :
IOR Xi (oneExternalString (2 ^ D.a) SgX) Unit extNone where
shape := (chainsOf C D tF tJ t3).sh
blinded := fun _ => true
extReads := fun ρ =>
((wants₁ C D tF tJ t3 ρ ++ (wants₂ C D tF tJ t3 ρ ++ wants₃ C D tF tJ t3 ρ)).filterMap
(extPosOf D)).toFinset
reads := fun ρ =>
((wants₁ C D tF tJ t3 ρ ++ (wants₂ C D tF tJ t3 ρ ++ wants₃ C D tF tJ t3 ρ)).filterMap
(ownPosOf C D tF tJ t3)).toFinset
out := fun x y τ =>
let τ₁ := (chainsOf C D tF tJ t3).tr₁ τ
let τ₂ := (chainsOf C D tF tJ t3).tr₂ τ
let τ₃ := (chainsOf C D tF tJ t3).tr₃ τ
let R₁ := drawnT C D.ds₁ (rhoT C D.ds₁ τ₁)
let R₂ := drawnT C D.ds₂ (rhoT C D.ds₂ τ₂)
let R₃ := drawnT C D.ds₃ (rhoT C D.ds₃ τ₃)
let w₁ := wantsOf D.a D.depth D.ds₁ R₁
let w₂ := wantsOf D.a D.depth D.ds₂ R₂
let w₃ := wantsOf D.a D.depth D.ds₃ R₃
if passT C D.ds₁ (rhoT C D.ds₁ τ₁) && passT C D.ds₂ (rhoT C D.ds₂ τ₂) &&
passT C D.ds₃ (rhoT C D.ds₃ τ₃) &&
fullOf D.ds₁ R₁ && fullOf D.ds₂ R₂ && fullOf D.ds₃ R₃ && carriesOf D y (w₁ ++ (w₂ ++ w₃)) &&
silent x ((chainsOf C D tF tJ t3).msgF τ).2 ((chainsOf C D tF tJ t3).msgJ τ).2
((chainsOf C D tF tJ t3).msg3 τ).2 &&
run x (viewOf C D y τ₁ τ₂ τ₃ (rvT C D.ds₁ τ₁) D.key₁ w₁)
(viewOf C D y τ₁ τ₂ τ₃ (rvT C D.ds₂ τ₂) D.key₂ w₂)
(viewOf C D y τ₁ τ₂ τ₃ (rvT C D.ds₃ τ₃) D.key₃ w₃) then some () else none
imp := fun _ _ => ()
srcE := fun _ _ => ∅
srcO := fun _ _ => ∅
tie := fun _ _ => ∅
DefinitionThe IOP defined by an interactive oracle reduction to the trivial statementIor/Ior.lean:112–117
In words
In Lean · Ior/Ior.lean, lines 112–117

the file's variables

variable {X₁ X₂ X₃ Xi Xo X : Type} {E₁ E₂ E₃ Ei Eo E : ExtSpec}

Views an interactive oracle reduction to the trivial statement as an IOP with the same rounds and queries. The IOP accepts if and only if the reduction returns an output.

def toInteractiveOracleProof (R : IOR X E Unit extNone) : InteractiveOracleProof X E where
shape := R.shape
blinded := R.blinded
extReads := fun _ ρ => R.extReads ρ
reads := fun _ ρ _ => R.reads ρ
accept := fun x y τ => (R.out x y τ).isSome
DefinitionThe part of linkProtocolWithWireAtFullSize that filesOf takesJohnson/Flat/Dec/WiresAtSizes.lean:52–53
In words
In Lean · Johnson/Flat/Dec/WiresAtSizes.lean, lines 52–53

The part of linkProtocolWithWireAtFullSize that filesOf takes, at K = 0: the link IOP, its round marking, and the two maps between oracle symbols and bit strings.

@[reducible] def linkProtocolAtFullSize (ds : List TypedOracleCompiler.Run.PQ.RD) (xs : List _root_.Run.PQ.XO) (dec : RecFull × RecFull → PQ.View → Bool)
(salt : ℕ) : LinkProtocolWithLeafCoding RecFull frS.P.T.a := (linkProtocolWithWireAtFullSize ds xs dec 0 salt).toLinkProtocolWithLeafCoding
DefinitionThe link IOP's data for filesOfJohnson/EntryRec/OkcFiles.lean:82–86
In words
In Lean · Johnson/EntryRec/OkcFiles.lean, lines 82–86

The link IOP's data for filesOf: the IOP, with instance type R × R over two oracle strings of 2^a symbols; its round marking; and two maps between oracle symbols and bit strings.

structure LinkProtocolWithLeafCoding (R : Type) (a : ℕ) where
QL : InteractiveOracleProof (R × R) (twoExternalStrings (2 ^ a) SgX)
aL : RoundSplits QL.shape
embL : (p : OPos QL.shape) → OSym QL.shape p → List Bool
prjL : (p : OPos QL.shape) → List Bool → Option (OSym QL.shape p)
DefinitionThe link IOP at the full parameter size with its encoding dataJohnson/Flat/Dec/WiresAtSizes.lean:45–48
In words
In Lean · Johnson/Flat/Dec/WiresAtSizes.lean, lines 45–48

The link IOP at the full parameter size with its encoding data, built by linkProtocolWithWireOfRoundData from round data ds, table queries xs and decision dec, with K 256-bit digests for a verifier message.

def linkProtocolWithWireAtFullSize (ds : List TypedOracleCompiler.Run.PQ.RD) (xs : List _root_.Run.PQ.XO) (dec : RecFull × RecFull → PQ.View → Bool)
(K salt : ℕ) : LinkProtocolWithLeafCodingAndQueryLayout RecFull frS.P.T.a 0 :=
linkProtocolWithWireOfRoundData (ckP .two) ds xs dec salt 0 K (Nat.zero_le K)
(chalP .two K)
DefinitionThe compiler's input for the link: the IOP linkProtocolOfRoundData, its round marking, two maps on symbols, K and encoding dataJohnson/Top/EntrySib.lean:62–71
In words
In Lean · Johnson/Top/EntrySib.lean, lines 62–71

The link IOP linkProtocolOfRoundData, the round marking allLo in which no round is shared, the two maps between oracle symbols and bit strings, the number K, and encoding data wL for the compiler.

def linkProtocolWithWireOfRoundData {a : ℕ} (C : CK) (ds : List TypedOracleCompiler.Run.PQ.RD) (xs : List XO) {R : Type}
(dec2 : R × R → View → Bool) (salt kmin K : ℕ) (hK : kmin ≤ K)
(chal : ∀ e k, (Fin K → Dig 256) → C.Ch e k) : LinkProtocolWithLeafCodingAndQueryLayout R a kmin where
QL := linkProtocolOfRoundData C ds a xs dec2
aL := _root_.Run.Twin.allLo (SOf C ds)
embL := TypedOracleCompiler.StringsList.embT salt C ds
prjL := TypedOracleCompiler.StringsList.prjT salt C ds
K := K
hK := hK
wL := sibW C ds a xs K chal dec2
DefinitionThe link IOP over two committed tablesOnBytes/Flat/LinkSib.lean:72
In words
In Lean · OnBytes/Flat/LinkSib.lean, lines 72–72

the file's variables

variable (C : CK) (ds : List PQ.RD) (a : ℕ) (xs : List XO) {X : Type} (dec : X → View → Bool)

The link IOP over two committed tables: linkSkeletonOfRoundData at round data ds, table depth a, table queries xs and decision dec, after the generic conversions .up and .loc (not printed).

abbrev linkProtocolOfRoundData : InteractiveOracleProof X (twoExternalStrings (2 ^ a) SgX) := (linkSkeletonOfRoundData C ds a xs dec).up.loc
DefinitionThe link IOP before the conversions .up and .locOnBytes/Flat/LinkSib.lean:63–69
In words
In Lean · OnBytes/Flat/LinkSib.lean, lines 63–69

the file's variables

variable (C : CK) (ds : List PQ.RD) (a : ℕ) (xs : List XO) {X : Type} (dec : X → View → Bool)

The link IOP before the conversions .up and .loc: rounds, queries and flags of skeletonOverBothExternalStrings. It accepts exactly when all proof-of-work bits are 0, everyOpeningHasItsDraws and symbolsCarryTheirPositions hold, and dec x accepts the view.

@[reducible] def linkSkeletonOfRoundData : Twin.PS X (twoExternalStrings (2 ^ a) SgX) where
S := SOf C ds
blinded := (skeletonOverBothExternalStrings C ds a xs fun _ => true).blinded
extReads := fun _ ρ => (skeletonOverBothExternalStrings C ds a xs fun _ => true).extReads () ρ
reads := fun _ ρ π => (skeletonOverBothExternalStrings C ds a xs fun _ => true).reads () ρ π
accept := fun x y τ => (skeletonOverBothExternalStrings C ds a xs (dec x)).accept () y τ
ann := _root_.Run.Twin.allLo (SOf C ds)
DefinitionAn IOP over two committed tablesOnBytes/TypedOracleCompiler/Run/PlanQX.lean:226–237
In words
In Lean · OnBytes/TypedOracleCompiler/Run/PlanQX.lean, lines 226–237

An IOP over two committed tables, with a trivial instance, before two conversions. It accepts if and only if all proof-of-work bits are 0, each table query has its full share of the sampled positions (everyOpeningHasItsDraws), each symbol queried in a table has its position as its first component (symbolsCarryTheirPositions), and dec accepts.

@[reducible] def skeletonOverBothExternalStrings (C : CK) (ds : List RD) (a : Nat) (xs : List XO) (dec : View → Bool) :
PS Unit (twoExternalStrings (2 ^ a) SgX) where
S := SOf C ds
blinded := fun _ => true
extReads := fun _ ρ => ((xWanted a ds xs (drawnSL C ds ρ.2)).filterMap (xPos (2 ^ a))).toFinset
reads := fun _ ρ _ =>
(((wanted ds (drawnSL C ds ρ.2)).filterMap fun nx =>
(posAtS C ds nx.1 nx.2).map fun p => (Sum.inr p : OPos (Twin.up (SOf C ds))))).toFinset
accept := fun _ y τ =>
passSL C ds (rhoSL C ds τ.2.2) && everyOpeningHasItsDraws xs (drawnSL C ds (rhoSL C ds τ.2.2)) &&
symbolsCarryTheirPositions a ds xs (drawnSL C ds (rhoSL C ds τ.2.2)) y && dec (viewX C ds a xs y τ.2.2)
ann := Twin.allLo (SOf C ds)
DefinitionTrue if every table query's round exists and its share contains count sampled positionsRun/PlanQX.lean:187–190
In words
In Lean · Run/PlanQX.lean, lines 187–190

True if every table query's round exists and its share contains count sampled positions.

def everyOpeningHasItsDraws (xs : List XO) (Ds : List _root_.Fmt.Drawn) : Bool :=
xs.all fun o => match Ds[o.round]? with
| none => false
| some D => (o.raw D).length == o.count
DefinitionTrue if every queried table position is below 2^a and the symbol read there has that position as its first componentOnBytes/TypedOracleCompiler/Run/PlanQX.lean:192–196
In words
In Lean · OnBytes/TypedOracleCompiler/Run/PlanQX.lean, lines 192–196

True if every queried table position is below 2^a and the symbol read there has that position as its first component.

def symbolsCarryTheirPositions (a : Nat) (ds : List RD) (xs : List XO)
(Ds : List _root_.Fmt.Drawn) (y : (twoExternalStrings (2 ^ a) SgX).Str) : Bool :=
(xWanted a ds xs Ds).all fun wx => match xPos (2 ^ a) wx with
| none => false
| some p => ((twoExternalStrings (2 ^ a) SgX).rd y p).1 == wx.2
DefinitionThis protocol's parts at oJohnson/Goal/Description/Lay.lean:30
In words
In Lean · Johnson/Goal/Description/Lay.lean, lines 30–30

This protocol's parts at o: flashProveDataNoExtractorAtHash o with its extractor field set to theExtractorAt o.

def flashProveDataAtSecondHash (o : VerifierAndGoals.SecondHashFunctionType) : FlashProve.DescriptionData := { flashProveDataNoExtractorAtHash o with ext := theExtractorAt o }
DefinitionThe parts of this protocol at o, with an extractor that returns nothingJohnson/Goal/Description/Lay0.lean:27–47
In words
In Lean · Johnson/Goal/Description/Lay0.lean, lines 27–47

This protocol's parts at o, field by field, with an extractor that returns nothing. Its provers send fixed messages; its honest committer and prover return fixed values.

def flashProveDataNoExtractorAtHash (o : VerifierAndGoals.SecondHashFunctionType) : FlashProve.DescriptionData where
A := theClaims
E := theCoding
DK := theKeyDataAt o
DP := theProofDataAt o
runK := theKeyGateAt o
runP := theProofGateAt o
dec := theLinkGateAt o
G := thePlanAt o
it := theItemAt o
P := theProversAt o
N := theNamedAt o
ext := fun _ _ _ _ => none
honest := theHonest
hStar := fun _ _ _ _ _ => ByteArray.empty
d₀ := fun _ => false
f₀ := theForm0
hf₀ := theForm0_aux
live := protocolDataWellFormedAt o
hlive := theLiveAt_fit o
Gd := theDeadPlanAt o
DefinitionThis protocol's relation data of type ClaimsJohnson/Goal/Description/Claims.lean:29–30
In words
In Lean · Johnson/Goal/Description/Claims.lean, lines 29–30

This protocol's relation data, of type Claims: claimsReqAt (not printed) applied to full-size constants and to the table that ppAtFiles reads from the parameter and scale files, or a fixed reference table if reading fails.

def theClaims (Zk : OnBytes.K.Pub) : (frS.toDecR frZ 402653181).Claims XF :=
claimsReqAt (frS.toDecR frZ 402653181) numsRef (ppAtFiles Zk.pol Zk.KL)
DefinitionThis protocol's index encoding of type CodingJohnson/Goal/Description/Coding.lean:30–31
In words
In Lean · Johnson/Goal/Description/Coding.lean, lines 30–31

This protocol's index encoding, of type Coding: codingCells (not printed) applied to the same constants and table as theClaims.

def theCoding (Zk : OnBytes.K.Pub) : Coding (theClaims Zk) :=
OnBytes.Flat.codingCells frS frZ 402653181 numsRef (ppAtFiles Zk.pol Zk.KL) Subtype.val
DefinitionThis protocol's proversJohnson/Goal/Description/Named.lean:33–36
In words
In Lean · Johnson/Goal/Description/Named.lean, lines 33–36

This protocol's provers: Files.fixedMessageProvers, which send every round's fixed default message.

def theProversAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) (G : FilesParameters XF RecFull) (DK DP : WholeD) :
(FsAtR (theClaims Zk) (theCoding Zk) G DK DP (theKeyGateAt o Zk) (theProofGateAt o Zk)
(theLinkGateAt o Zk)).Provers :=
Files.fixedMessageProvers _
DefinitionThe constant committer and prover in this protocol's recordJohnson/Goal/Description/Honest.lean:21
In words
In Lean · Johnson/Goal/Description/Honest.lean, lines 21–21

The constant committer and the constant prover, fixedCommitterAndProver. They supply fields of the protocol's record that the types require but that neither compile nor the verifier reads. The six theorems take their honest provers and settings from honestProversAndSettings.

def theHonest : FlashProve.CommitterAndProver FlashProve.FormBytes := FlashProve.fixedCommitterAndProver
DefinitionA constant committer and prover with trivial typesJohnson/Goal/Tie/DescriptionOfData.lean:191–198
In words
In Lean · Johnson/Goal/Tie/DescriptionOfData.lean, lines 191–198

A constant committer and prover with trivial types: commit returns the all-false commitment and prove an empty list of tokens with five empty byte strings; neither makes a query.

def fixedCommitterAndProver : CommitterAndProver FormBytes where
Shown := Unit
shown := fun _ _ => ()
Rand := Unit
sample := .done ()
commit := fun _ _ _ _ => .done fun _ => false
prove := fun _ _ _ _ _ _ => .done ⟨[], ByteArray.empty, ByteArray.empty, ByteArray.empty,
ByteArray.empty, ByteArray.empty⟩
DefinitionThe offline IOP's decision as used in the protocolJohnson/Goal/Description/Gates.lean:27–29
In words
In Lean · Johnson/Goal/Description/Gates.lean, lines 27–29

The offline IOP's decision as used in the protocol: theKeyRunAt, except that it rejects everything if protocolDataWellFormedAt rejects the public files.

def theKeyGateAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : RecFull → PQ.View → PQ.View → PQ.View →
Bool :=
gatedFileDecision (protocolDataWellFormedAt o Zk) (theKeyRunAt o Zk)
DefinitionThe online IOP's decision as used in the protocolJohnson/Goal/Description/Gates.lean:31–33
In words
In Lean · Johnson/Goal/Description/Gates.lean, lines 31–33

The online IOP's decision as used in the protocol: theProofRunAt, except that it rejects everything if protocolDataWellFormedAt rejects the public files.

def theProofGateAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : XF × RecFull → PQ.View → PQ.View →
PQ.View → Bool :=
gatedFileDecision (protocolDataWellFormedAt o Zk) (theProofRunAt o Zk)
DefinitionThe link IOP's decision as used in the protocolJohnson/Goal/Description/Gates.lean:35–36
In words
In Lean · Johnson/Goal/Description/Gates.lean, lines 35–36

The link IOP's decision as used in the protocol: linkDecisionAtFiles, except that it rejects everything if protocolDataWellFormedAt rejects the public files.

def theLinkGateAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : RecFull × RecFull → PQ.View → Bool :=
gatedLinkDecision (protocolDataWellFormedAt o Zk) (linkDecisionAtFiles Zk)
DefinitionA three-view decision guarded by a BooleanJohnson/Flat/Dec/ClosedAll.lean:99–100
In words
In Lean · Johnson/Flat/Dec/ClosedAll.lean, lines 99–100

A three-view decision guarded by a Boolean: it accepts exactly when live is true and run accepts.

def gatedFileDecision {α : Type} (live : Bool) (run : α → PQ.View → PQ.View → PQ.View → Bool) :
α → PQ.View → PQ.View → PQ.View → Bool := fun x v₁ v₂ v₃ => live && run x v₁ v₂ v₃
DefinitionA one-view decision guarded by a BooleanJohnson/Flat/Dec/ClosedAll.lean:103–104
In words
In Lean · Johnson/Flat/Dec/ClosedAll.lean, lines 103–104

The one-view decision that accepts exactly when live is true and dec accepts.

def gatedLinkDecision {α : Type} (live : Bool) (dec : α → PQ.View → Bool) : α → PQ.View → Bool :=
fun x v => live && dec x v
DefinitionThe test on the public filesJohnson/Goal/Description/Live.lean:69–78
In words
In Lean · Johnson/Goal/Description/Live.lean, lines 69–78

The test on the public files: the planner's values and the round data of the offline and online IOPs can all be computed, and dataWellFormedAtFullSizeDepth accepts them.

def protocolDataWellFormedAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : Bool :=
match filesParametersOrRefusalAt o Zk with
| .error _ => false
| .ok G =>
match keyDataAndDecisionOrRefusalAt o Zk with
| .error _ => false
| .ok K =>
match proofDataAndDecisionOrRefusalAt o Zk with
| .error _ => false
| .ok P => dataWellFormedAtFullSizeDepth G K.1 P.1
DefinitionThe offline and online IOPs' round data have the full-size committed table's depthJohnson/Goal/Description/Live.lean:66–67
In words
In Lean · Johnson/Goal/Description/Live.lean, lines 66–67

The offline and online IOPs' round data have the full-size committed table's depth, and dataWellFormedApartFromDepth holds.

def dataWellFormedAtFullSizeDepth (G : FilesParameters XF RecFull) (DK DP : WholeD) : Bool :=
DK.a == frS.P.T.a && DP.a == frS.P.T.a && dataWellFormedApartFromDepth G DK DP
DefinitionThe numeric conditions on the round data, and that no list of rounds is emptyJohnson/Goal/Description/Live.lean:62–63
In words
In Lean · Johnson/Goal/Description/Live.lean, lines 62–63

sizeNumbersFitAtPlan holds at KF and the bound 2^20 (eight numeric conditions on all three IOPs' round data and two depths of G, sizeNumbersFitAtFullSize), and none of the six lists of rounds is empty.

def dataWellFormedApartFromDepth (G : FilesParameters XF RecFull) (DK DP : WholeD) : Bool := sizeNumbersFitAtPlan KF theQueries G DK DP &&
listsFull DK DP
DefinitionThe eight numeric conditions at given round data and planner's valuesJohnson/Flat/Dec/ClosedAtPlan.lean:68–70
In words
In Lean · Johnson/Flat/Dec/ClosedAtPlan.lean, lines 68–70

the file's variables

variable {X R : Type} (KF : WholeD → WholeD → ℕ) (v : ℕ) (G : FilesParameters X R) (DK DP : WholeD)

sizeNumbersFitAtFullSize at K = KF DK DP, the bound v, two depths taken from G, the offline and online IOPs' round data, and the link IOP's constants dsFull and frD.xs.

def sizeNumbersFitAtPlan : Bool :=
sizeNumbersFitAtFullSize (KF DK DP) v G.c.first.binding.logLeaves G.k.oneTime.binding.logLeaves DK DP dsFull
frD.xs
DefinitionA conjunction of eight numeric conditions on the three IOPs' round dataJohnson/Flat/Dec/FailsClosed.lean:64–68
In words
In Lean · Johnson/Flat/Dec/FailsClosed.lean, lines 64–68

A conjunction of eight numeric conditions on the three IOPs' round data, the bounds K and v, and two depths. The functions that it calls are not printed.

def sizeNumbersFitAtFullSize (K v depthReq depthReqT : ℕ) (DK DP : WholeD)
(ds : List TypedOracleCompiler.Run.PQ.RD) (xs : List _root_.Run.PQ.XO) : Bool :=
decide (kThree .two DK [] DP ≤ K) && entryFitB K ds && DK.workFit && DK.depthFit &&
DP.workFit && DP.depthFit && decide (cntFrameFullD DK DP ds xs depthReq depthReqT ≤ v) &&
decide (K + 1 + 1 < 2 ^ 40)
DefinitionEach of the six lists of rounds is non-emptyJohnson/Goal/Description/Live.lean:57–59
In words
In Lean · Johnson/Goal/Description/Live.lean, lines 57–59

None of the six lists of rounds (three chains of the offline IOP, three of the online IOP) is empty.

def listsFull (DK DP : WholeD) : Bool :=
!([DK.ds₁.length, DK.ds₂.length, DK.ds₃.length, DP.ds₁.length, DP.ds₂.length, DP.ds₃.length].any
(· == 0))
DefinitionThe planner's values, or an errorJohnson/Goal/Description/Plan.lean:39–41
In words
In Lean · Johnson/Goal/Description/Plan.lean, lines 39–41

Given o and the public files, returns the planner's values of type FilesParameters, or an error. The planner runs with the constant fixedConfigurationDigest in place of the public files' digest.

def filesParametersOrRefusalAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : Except String (FilesParameters XF RecFull) :=
(VerifiableInference.PlanWritten.plannedAtO o Zk.pol Zk.KL (some Zk.lay) fixedConfigurationDigest).map
VerifiableInference.OnPublicFiles.bigReq
DefinitionThe value of filesParametersOrRefusalAtJohnson/Goal/Description/Plan.lean:43–46
In words
In Lean · Johnson/Goal/Description/Plan.lean, lines 43–46

The value of filesParametersOrRefusalAt, or a fixed default if it returns an error.

def thePlanAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : FilesParameters XF RecFull :=
match filesParametersOrRefusalAt o Zk with
| .ok G => G
| .error _ => OnBytes.K.ArmsAtFiles.bigStandFull
DefinitionThe offline IOP's verifier decisionJohnson/Goal/Description/KeyFold.lean:53–57
In words
In Lean · Johnson/Goal/Description/KeyFold.lean, lines 53–57

The offline IOP's verifier decision, a function from a committed table's out-of-domain sample and three views to a Boolean: the second component of keyDataAndDecisionOrRefusalAt, or, if that returns an error, the decision that rejects everything.

def theKeyRunAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : RecFull → PQ.View → PQ.View → PQ.View →
Bool :=
match keyDataAndDecisionOrRefusalAt o Zk with
| .ok p => p.2
| .error _ => fun _ _ _ _ => false
DefinitionThe offline IOP's round dataJohnson/Goal/Description/KeyFold.lean:48–51
In words
In Lean · Johnson/Goal/Description/KeyFold.lean, lines 48–51

The offline IOP's round data: the first component of keyDataAndDecisionOrRefusalAt, or, where that returns an error, the round data of three empty chains.

def theKeyDataAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : WholeD :=
match keyDataAndDecisionOrRefusalAt o Zk with
| .ok p => p.1
| .error _ => FlashProve.emptyRoundsData
DefinitionThe offline IOP's round data and decision, or an errorJohnson/Goal/Description/KeyFold.lean:43–46
In words
In Lean · Johnson/Goal/Description/KeyFold.lean, lines 43–46

Given o and the public files, returns the offline IOP's round data and verifier decision, or an error. publicOfO reads and checks the files, applying o; keyDataAndDecisionAtFixedDigest builds the written IOP and runs its public checks.

def keyDataAndDecisionOrRefusalAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) :
Except String (WholeD × (RecFull → PQ.View → PQ.View → PQ.View → Bool)) :=
(VerifiableInference.PlanWritten.publicOfO o Zk.pol Zk.KL (some Zk.lay)).bind fun X =>
VerifiableInference.Desc.Key.keyDataAndDecisionAtFixedDigest X Zk.lay
DefinitionThe offline IOP's round data and decision at the fixed digest, or an errorJohnson/Desc/Key/Slot.lean:146–148
In words
In Lean · Johnson/Desc/Key/Slot.lean, lines 146–148

keyDataAndDecisionAtDigest at the constant fixedDigest: the offline IOP's round data and decision from the parsed public files and the layout file, or an error.

def keyDataAndDecisionAtFixedDigest (X : _root_.OnBytes.Model.Verify.Public) (lay : _root_.ByteArray) :
_root_.VerifiableInference.Desc.Key.KeyDataAndDecisionOrRefusal :=
_root_.VerifiableInference.Desc.Key.keyDataAndDecisionAtDigest X lay _root_.VerifiableInference.Desc.Key.fixedDigest
DefinitionThe digest at which the written offline IOP is builtJohnson/Desc/Key/Slot.lean:142
In words
In Lean · Johnson/Desc/Key/Slot.lean, lines 142–142

The digest used to build the written offline IOP: the constant fixedConfigurationDigest.

def fixedDigest : _root_.ByteArray := _root_.VerifiableInference.Desc.fixedConfigurationDigest
DefinitionA constant: 32 bytes of value 1Johnson/Desc/TheCfg.lean:21
In words
In Lean · Johnson/Desc/TheCfg.lean, lines 21–21

A constant: 32 bytes of value 1. When the written offline and online IOPs and the planner's values are built, the planner receives it in place of the public files' digest.

def fixedConfigurationDigest : ByteArray := ⟨Array.replicate 32 1⟩
Remark

A reader who applies the tests in Judging the assumptions on the public files and on hash values encounters this constant. The protocol as Lean describes it is written with this constant in place of the digest; the true digest enters through the coding of the queries, the query for the out-of-domain seed and the commitment's code, as found by reading the Lean code, and no theorem says that every challenge depends on it (lean/GAPS.md, 5).

DefinitionRuns the planner madeAt on the parsed public filesJohnson/Desc/Key/Slot.lean:129–132
In words
In Lean · Johnson/Desc/Key/Slot.lean, lines 129–132

Runs the planner madeAt on the parsed public files, the layout file and a digest, then keyDataAndDecisionOfPlannerAnswer on its result.

def keyDataAndDecisionAtDigest (X : _root_.OnBytes.Model.Verify.Public) (lay cfg : _root_.ByteArray) :
_root_.VerifiableInference.Desc.Key.KeyDataAndDecisionOrRefusal :=
_root_.Except.bind (_root_.VerifiableInference.Desc.Key.madeAt X lay cfg)
(_root_.VerifiableInference.Desc.Key.keyDataAndDecisionOfPlannerAnswer X lay)
DefinitionBuilds the written offline IOP from the planner's resultJohnson/Desc/Key/Slot.lean:118–125
In words
In Lean · Johnson/Desc/Key/Slot.lean, lines 118–125

Builds the written offline IOP from the planner's result and computes its round data and decision with keyDataAndDecisionOfDescription; returns an error if either step fails or if one of the further public checks lawsAsk fails.

def keyDataAndDecisionOfPlannerAnswer (X : _root_.OnBytes.Model.Verify.Public) (lay : _root_.ByteArray)
(m : _root_.Johnson.G.OfPlan.Made) : _root_.VerifiableInference.Desc.Key.KeyDataAndDecisionOrRefusal :=
_root_.Except.bind (_root_.VerifiableInference.Desc.Key.descriptionFromPlan m) fun F =>
_root_.Except.bind (_root_.VerifiableInference.Desc.Key.keyDataAndDecisionOfDescription F) fun x =>
match _root_.List.find? (fun t => !t.2)
(_root_.VerifiableInference.Desc.Key.lawsAsk X lay m F x.1) with
| _root_.Option.some t => _root_.Except.error ("the key file's description: " ++ t.1)
| _root_.Option.none => _root_.Except.ok x
DefinitionThe written offline IOP built from the planner's resultJohnson/Desc/Key/Desc.lean:94–99
In words
In Lean · Johnson/Desc/Key/Desc.lean, lines 94–99

The written offline IOP descriptionFromSource X N P, whose three arguments are computed from the planner's result, or an error if one of them cannot be computed.

def descriptionFromPlan (m : Johnson.G.OfPlan.Made) : Except String (FileDescription Xi) :=
match sourceOf m, rangesNumbers m, laterPlaces m with
| .ok X, .ok N, .ok P => .ok (descriptionFromSource X N P)
| .error e, _, _ => .error e
| _, .error e, _ => .error e
| _, _, .error e => .error e
DefinitionThe round data and decision of the written offline IOP F, or an errorJohnson/Desc/Key/Slot.lean:98–113
In words
In Lean · Johnson/Desc/Key/Slot.lean, lines 98–113

Returns the round data F.data of the written offline IOP F and its decision F.run applied to the instance made from an out-of-domain sample, or an error if F.planWord reports a failure or if wantedOk, owedOk or F.data fails.

def keyDataAndDecisionOfDescription
(F : _root_.VerifiableInference.Desc.FileDescription _root_.VerifiableInference.Desc.Key.Xi) :
_root_.VerifiableInference.Desc.Key.KeyDataAndDecisionOrRefusal :=
match _root_.VerifiableInference.Desc.FileDescription.planWord F with
| _root_.Option.some w => _root_.Except.error ("the key file's description: " ++ w)
| _root_.Option.none =>
if !_root_.VerifiableInference.Desc.FileDescription.wantedOk F then
_root_.Except.error "the key file's description: its places are not the wanted ones"
else if !_root_.VerifiableInference.Desc.FileDescription.owedOk F then
_root_.Except.error "the key file's description: a drawing block does not name what is owed"
else
_root_.Except.map
(fun D => (D, _root_.VerifiableInference.Desc.FileDescription.run
(_root_.VerifiableInference.Desc.FileDescription.pull
_root_.VerifiableInference.Desc.Key.keyInstanceOfOutOfDomainSample F)))
(_root_.VerifiableInference.Desc.FileDescription.data F "key file")
DefinitionThe type of the makers' result for the offline IOPJohnson/Desc/Key/Slot.lean:91–93
In words
In Lean · Johnson/Desc/Key/Slot.lean, lines 91–93

The type of the makers' result for the offline IOP: an error message, or round data with a decision.

abbrev KeyDataAndDecisionOrRefusal : Type :=
_root_.Except _root_.String
(_root_.OnBytes.Maker.WholeD × _root_.VerifiableInference.Desc.Key.KeyRun)
DefinitionThe type of the offline IOP's decisionJohnson/Desc/Key/Slot.lean:87–88
In words
In Lean · Johnson/Desc/Key/Slot.lean, lines 87–88

The type of the offline IOP's decision: from an out-of-domain sample and three views to a Boolean.

abbrev KeyRun : Type :=
_root_.OnBytes.Flat.RecFull → _root_.Fmt.View → _root_.Fmt.View → _root_.Fmt.View → _root_.Bool
DefinitionThe offline IOP's instance as the written IOP takes itJohnson/Desc/Key/Slot.lean:83–84
In words
In Lean · Johnson/Desc/Key/Slot.lean, lines 83–84

The offline IOP's instance as the written IOP takes it, computed from a committed table's out-of-domain sample.

def keyInstanceOfOutOfDomainSample (rec : _root_.OnBytes.Flat.RecFull) : _root_.VerifiableInference.Desc.Key.Xi :=
⟨_root_.OnBytes.Slice.keyOf (fun β : _root_.OnBytes.Slice.NZ => β.val) rec⟩
DefinitionThe round data of a written IOPJohnson/Desc/BlockSlot.lean:60–64
In words
In Lean · Johnson/Desc/BlockSlot.lean, lines 60–64

the file's variables

variable {Xi : Type}

The round data of a written IOP, computed from its declared rounds F.roundsDeclaredByBlocks and its table depth; an error if the conversion or its checks fail.

def FileDescription.data (F : FileDescription Xi) (file : String) : Except String WholeD := do
let R ← writtenOf file F.roundsDeclaredByBlocks
unless okAt F.tableDepth (some R) do
throw (file ++ ": the makers' tests on the written rounds say no")
pure (WholeD.of F.tableDepth (wholeAt (some R)))
DefinitionThe online IOP's verifier decisionJohnson/Goal/Description/ProofFold.lean:52–56
In words
In Lean · Johnson/Goal/Description/ProofFold.lean, lines 52–56

The online IOP's verifier decision, a function from a request, a committed table's out-of-domain sample and three views to a Boolean: the second component of proofDataAndDecisionOrRefusalAt, or, if that returns an error, the decision that rejects everything.

def theProofRunAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : XF × RecFull → PQ.View → PQ.View →
PQ.View → Bool :=
match proofDataAndDecisionOrRefusalAt o Zk with
| .ok p => p.2
| .error _ => fun _ _ _ _ => false
DefinitionThe online IOP's round dataJohnson/Goal/Description/ProofFold.lean:47–50
In words
In Lean · Johnson/Goal/Description/ProofFold.lean, lines 47–50

The online IOP's round data: the first component of proofDataAndDecisionOrRefusalAt, or, where that returns an error, the round data of three empty chains.

def theProofDataAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) : WholeD :=
match proofDataAndDecisionOrRefusalAt o Zk with
| .ok p => p.1
| .error _ => FlashProve.emptyRoundsData
DefinitionThe online IOP's round data and decision, or an errorJohnson/Goal/Description/ProofFold.lean:43–45
In words
In Lean · Johnson/Goal/Description/ProofFold.lean, lines 43–45

Given o and the public files, returns the online IOP's round data and verifier decision, or an error. It builds the written online IOP and fails unless that IOP's public checks pass.

def proofDataAndDecisionOrRefusalAt (o : VerifierAndGoals.SecondHashFunctionType) (Zk : OnBytes.K.Pub) :
Except String (WholeD × (XF × RecFull → PQ.View → PQ.View → PQ.View → Bool)) :=
LPFD.Full.proofDataAndDecisionOfPublicFiles o Zk.pol Zk.lay Zk.KL
DefinitionBuilds the written online IOP from o and the public files with ProofFile.onlineDescriptionJohnson/Desc/Laid/ProofFull.lean:71–74
In words
In Lean · Johnson/Desc/Laid/ProofFull.lean, lines 71–74

Builds the written online IOP from o and the public files with ProofFile.onlineDescription, then computes its round data and decision with proofDataAndDecisionOfDescription; returns an error if either fails.

def proofDataAndDecisionOfPublicFiles (o : ProofFile.SecondHashFunctionArgument) (pol lay KL : ByteArray) : Except String (WholeD × RunPF) :=
match ProofFile.onlineDescription o pol lay KL with
| .error e => .error ("the proof file's description is not made: " ++ e)
| .ok F => proofDataAndDecisionOfDescription o pol lay KL F
DefinitionThe round data and decision of the written online IOP F, or an errorJohnson/Desc/Laid/ProofFull.lean:58–68
In words
In Lean · Johnson/Desc/Laid/ProofFull.lean, lines 58–68

Returns the round data F.data and the decision proofDecisionOfDescription F of the written online IOP F, or an error if F.planWord reports a failure, F.data fails, or one of the further public checks lawsAsk fails.

def proofDataAndDecisionOfDescription (o : ProofFile.SecondHashFunctionArgument) (pol lay KL : ByteArray) (F : FileDescription ProofFile.Inst) :
Except String (WholeD × RunPF) :=
match F.planWord with
| some w => .error ("the proof file's description: " ++ w)
| none =>
match F.data "proof file" with
| .error e => .error ("the proof file's description: its data: " ++ e)
| .ok D =>
match _root_.LPFD.firstNo (_root_.LPFD.lawsAsk o pol lay KL F D) with
| some t => .error ("the proof file's description: " ++ t.1)
| none => .ok (D, proofDecisionOfDescription F)
DefinitionThe online IOP's decisionJohnson/Desc/Laid/ProofFull.lean:55
In words
In Lean · Johnson/Desc/Laid/ProofFull.lean, lines 55–55

The online IOP's decision: F.run applied to the instance that instanceAsPlainRecord constructs from a request and an out-of-domain sample.

def proofDecisionOfDescription (F : FileDescription ProofFile.Inst) : RunPF := (F.pull instanceAsPlainRecord).run
DefinitionThe online IOP's instance as the written IOP takes itJohnson/Desc/Laid/ProofFull.lean:51–52
In words
In Lean · Johnson/Desc/Laid/ProofFull.lean, lines 51–52

The online IOP's instance as the written IOP takes it, computed from a request and a committed table's out-of-domain sample.

def instanceAsPlainRecord (z : XF × RecFull) : ProofFile.Inst :=
⟨⟨(instPartsOf z).1, (instPartsOf z).2.1⟩, (instPartsOf z).2.2⟩
DefinitionThe link IOP's verifier decisionJohnson/Goal/Description/LinkDec.lean:30–31
In words
In Lean · Johnson/Goal/Description/LinkDec.lean, lines 30–31

The link IOP's verifier decision on two out-of-domain samples and one view. It reads only the parameter file: if the file's first 32 lines equal fixed full-size lines, it is the written IOP's decision; otherwise it rejects everything.

def linkDecisionAtFiles (Zk : OnBytes.K.Pub) : RecFull × RecFull → PQ.View → Bool :=
_root_.Desc.K15.linkDecisionAtParameterFile Zk.pol
DefinitionThe written link IOP at PJohnson/Desc/Link/LinkWritten.lean:35–40
In words
In Lean · Johnson/Desc/Link/LinkWritten.lean, lines 35–40

linkAt P plan returns the written link IOP F at parameters P, built by linkDescriptionAt with linkDeclaredRounds P as its declared rounds and linkRoundsMatchPlan P plan as its public check, together with its round data and its table queries. It returns an error if F.planWord reports a failed public check or if the round data cannot be formed.

def linkAt (P : P15) (plan : Fmt.Plan) : Except String Link3 :=
let F := linkDescriptionAt P (linkDeclaredRounds P) (linkRoundsMatchPlan P plan)
match F.planWord, F.dsOf "entry file" with
| some w, _ => .error s!"entry file: {w}"
| _, .error e => .error e
| none, .ok ds => .ok ⟨F, ds, F.xsTyped⟩
DefinitionThe declared rounds of the link IOP's chain at parameters PJohnson/Desc/Link/LinkWritten.lean:31
In words
In Lean · Johnson/Desc/Link/LinkWritten.lean, lines 31–31

The declared rounds of the link IOP's chain at parameters P.

def linkDeclaredRounds (P : P15) : List Fmt.DeclaredRound := (linkProtocolChain P).blocksInOrder.flatMap (·.rounds)
DefinitionThe public check that the link IOP's declared rounds match the scheduleJohnson/Desc/Link/LinkWritten.lean:33
In words
In Lean · Johnson/Desc/Link/LinkWritten.lean, lines 33–33

Public check: the schedule entries of the link IOP's declared rounds equal the rounds of the given schedule.

def linkRoundsMatchPlan (P : P15) (plan : Fmt.Plan) : Bool := decide ((linkDeclaredRounds P).map (·.entry) = plan.rounds)

VerifierAndGoals.storedLines has no card on this page; it is in the Lean file Ladder/Stored.lean:237.

Appendix B. The two hash functions

(1) blake2bHash is the function that leanVerifier uses in place of the random oracle. It is not plain BLAKE2b; it is computed as follows:

  • the bit string is first written as bytes;
  • the bytes are parsed as one call to the format's hash, Fmt.formatHash (a number, a tree, an index, a start, bytes), and the output is 32 bytes of BLAKE2b of that call, with bytes 0 to 15 of the start as salt and bytes 16 to 31 as personalization;
  • every other string, and a call with half 1 under a number other than 162, is hashed whole under one reserved number.

(2) secondHashFunction is the fixed function in the protocol's description: BLAKE2b's compression function with a number and the input's length in 32-bit words (rounded down) in the high word of the counter. In the statements, (1) is sampled at random and (2) is fixed.

The definitions · 10 cards
DefinitionThe concrete hash function, built from BLAKE2bJohnson/Face/FinalStatement.lean:347
In words
In Lean · Johnson/Face/FinalStatement.lean, lines 347–347

The concrete hash function that replaces the random oracle when a proof is checked. It writes the bit string as bytes, applies Fmt.oracle to them, and returns 256 bits of the result (hashOf, the next card). Fmt.oracle first parses the bytes as a call of Fmt.formatHash (oParse), then applies BLAKE2b.

abbrev blake2bHash : Hash := hashOf _root_.Fmt.oracle
DefinitionThe hash function on bit strings induced by a function on bytesJohnson/Top/Fire/Code/FastFamProbe.lean:36
In words
In Lean · Johnson/Top/Fire/Code/FastFamProbe.lean, lines 36–36

The hash function on bit strings obtained from a function O from bytes to bytes: the input is written as bytes, O is applied, and the first 256 bits of the result are returned, padded with zeros if the result is shorter (gOf, OnBytes/TypedOracleCompiler/Run/PageRunFast.lean:46).

def hashOf (O : ByteArray → ByteArray) : Hash := fun s => TypedOracleCompiler.Run.PageRun.gOf O () s
DefinitionUnkeyed BLAKE2b with a salt and a personalizationFmt/Blake2b.lean:22–23
In words
In Lean · Fmt/Blake2b.lean, lines 22–23
Given

the digest's length in bytes dlen; a salt and a personalization; a message

@[irreducible] def blake2b (dlen : Nat) (salt pers msg : ByteArray) : ByteArray :=
Value

Run.Blake2b.blake2bSaltedPlain applied to them

Run.Blake2b.blake2bSaltedPlain salt pers msg dlen
DefinitionThe concrete hash function, on byte stringsFmt/Rules23.lean:208–215
In words
In Lean · Fmt/Rules23.lean, lines 208–215
Given

a byte string

def oracle (s : ByteArray) : ByteArray :=
Value

parse it as a half (0 or 1) and one call of Fmt.formatHash: a number, a tree, an index, a start and bytes (oParse)

match oParse s with

it is not such a call: Fmt.formatHash of the whole string, with number 177, tree 0, index 0 and an all-zero start (oOut)

| none => oOut s

it is one, and its half is 0 or its number is 162 (oUsed):

| some q =>
if oUsed q then

the digest of Fmt.formatHash for that call (next card);

let h := formatHash q.number q.tree q.index q.start q.bytes

its bytes 0 to 31 if the half is 0, otherwise bytes 32 to 63

if q.half == 0 then h.extract 0 32 else h.extract 32 64

else: as in the case where it is not such a call

else oOut s
DefinitionThe format's hash: BLAKE2b with a label, a salt and a personalizationFmt/Rules23.lean:170–172
In words
In Lean · Fmt/Rules23.lean, lines 170–172
Given

three numbers: number, tree, index; two byte strings: start, bytes

def formatHash (number tree index : Nat) (start bytes : ByteArray) : ByteArray :=
Value

blake2b, the library's unkeyed BLAKE2b, with a 64-byte digest if the number is 162 and a 32-byte digest otherwise (dlen);

blake2b (dlen number)

salt: bytes 0 to 15 of the start, which is truncated or padded with zeros to 32 bytes;

((fit 32 start).extract 0 16)

personalization: its bytes 16 to 31;

((fit 32 start).extract 16 32)

message: the label, then the bytes

(label number tree index ++ bytes)
DefinitionThe format's hash, in the form for compiled codeOnBytes/Hash/H.lean:31–32
In words
In Lean · OnBytes/Hash/H.lean, lines 31–32
Given

the arguments of Fmt.formatHash (the card above)

def formatHashFastForm (number tree index : Nat) (start bytes : ByteArray) : ByteArray :=
Value

Fmt.HF: the definition of Fmt.formatHash, with blake2bF in place of blake2b

Fmt.HF number tree index start bytes
TheoremEquality of the two forms of the format's hashOnBytes/Hash/HEq.lean:25
In words
In Lean · OnBytes/Hash/HEq.lean, lines 25–25
Then

formatHashFastForm and Fmt.formatHash are the same function

theorem formatHashFastForm_eq_formatHash : formatHashFastForm = Fmt.formatHash
DefinitionThe second hash function: BLAKE2b's compression function, with a number in the counterOnBytes/Hash/SecondHashFunction.lean:42–52
In words
In Lean · OnBytes/Hash/SecondHashFunction.lean, lines 42–52
Given

a number num; a byte string w

def secondHashFunctionState (num : Nat) (w : ByteArray) : Run.Blake2b.ChainingValue :=

n: the number of whole words of 32 bits in w

let n := w.size / 4

full: the number of blocks of 128 bytes before the last block

let full := (w.size + 127) / 128 - 1

the high word of the counter, in every call: num + 2^32 · n, modulo 2^64

let t1 := UInt64.ofNat (num + 4294967296 * n)
Run

for each of the full blocks in turn:

let S := Nat.fold full

apply BLAKE2b's compression function (Run.Blake2b.compress) to that block; the counter's low word is the number of bytes up to the block's end

(fun i _ S => Run.Blake2b.compress { S with t0 := UInt64.ofNat (128 * (i + 1)), t1 := t1 }
(Run.Blake2b.MessageBlock.ofBytes w (128 * i)))

starting from the first state of BLAKE2b with no key and 64 bytes of output

(Run.Blake2b.firstState 0 64)
Value

the compression function once more,

(Run.Blake2b.compress

with the last-block flag set and 4 · n as the low word of the counter,

(Run.Blake2b.setLastblock { S with t0 := UInt64.ofNat (4 * n), t1 := t1 })

on the last block; the eight chaining words of the resulting state

(Run.Blake2b.MessageBlock.ofBytes w (128 * full))).h
DefinitionThe second hash function, of a number and a byte stringOnBytes/Hash/SecondHashFunction.lean:56
In words
In Lean · OnBytes/Hash/SecondHashFunction.lean, lines 56–56
Given

a number num; a byte string w

def secondHashFunction (num : Nat) (w : ByteArray) : ByteArray :=
Value

the first 32 bytes of secondHashFunctionState num w (the card above)

(secondHashFunctionState num w).bytes 32
DefinitionThe second hash function's tree hash of a long byte stringOnBytes/Hash/SecondHashFunction.lean:77–78
In words
In Lean · OnBytes/Hash/SecondHashFunction.lean, lines 77–78
Given

a byte string w

def secondHashFunctionTree (w : ByteArray) : Option ByteArray :=
Value

if its length is not a multiple of 4 bytes or is less than 32 bytes: nothing

if w.size % 4 != 0 || w.size < 32 then none

otherwise, it is hashed level by level (secondHashFunctionTreeLevels), at least once, until 32 bytes remain; nothing if this takes more than 16 levels

else secondHashFunctionTreeLevels 16 10 w
BLAKE2b: the compression function, its constants and its schedule · 27 cards
DefinitionThe chaining value: eight 64-bit wordsRun/Blake2b/Compress.lean:46–55
In words
In Lean · Run/Blake2b/Compress.lean, lines 46–55

The BLAKE2b chaining value, one field per word.

structure ChainingValue where
h0 : UInt64
h1 : UInt64
h2 : UInt64
h3 : UInt64
h4 : UInt64
h5 : UInt64
h6 : UInt64
h7 : UInt64
deriving DecidableEq, Repr, Inhabited
DefinitionOne message block: sixteen 64-bit wordsRun/Blake2b/Compress.lean:60–77
In words
In Lean · Run/Blake2b/Compress.lean, lines 60–77

One BLAKE2b message block as sixteen words.

structure MessageBlock where
m0 : UInt64
m1 : UInt64
m2 : UInt64
m3 : UInt64
m4 : UInt64
m5 : UInt64
m6 : UInt64
m7 : UInt64
m8 : UInt64
m9 : UInt64
m10 : UInt64
m11 : UInt64
m12 : UInt64
m13 : UInt64
m14 : UInt64
m15 : UInt64
deriving DecidableEq, Repr, Inhabited
DefinitionThe work vector: sixteen 64-bit wordsRun/Blake2b/Compress.lean:80–96
In words
In Lean · Run/Blake2b/Compress.lean, lines 80–96

BLAKE2b's work vector of sixteen words.

structure WorkVector where
v0 : UInt64
v1 : UInt64
v2 : UInt64
v3 : UInt64
v4 : UInt64
v5 : UInt64
v6 : UInt64
v7 : UInt64
v8 : UInt64
v9 : UInt64
v10 : UInt64
v11 : UInt64
v12 : UInt64
v13 : UInt64
v14 : UInt64
v15 : UInt64
DefinitionThe four words that the function G changesRun/Blake2b/Compress.lean:100–104
In words
In Lean · Run/Blake2b/Compress.lean, lines 100–104

The four words that BLAKE2b's function G changes.

structure Quad where
a : UInt64
b : UInt64
c : UInt64
d : UInt64
DefinitionThe eight constants of BLAKE2b's initialization vectorRun/Blake2b/Compress.lean:108–112
In words
In Lean · Run/Blake2b/Compress.lean, lines 108–112

BLAKE2b's eight initial constants.

@[inline] def IV : ChainingValue :=
{ h0 := 0x6a09e667f3bcc908, h1 := 0xbb67ae8584caa73b,
h2 := 0x3c6ef372fe94f82b, h3 := 0xa54ff53a5f1d36f1,
h4 := 0x510e527fade682d1, h5 := 0x9b05688c2b3e6c1f,
h6 := 0x1f83d9abfb41bd6b, h7 := 0x5be0cd19137e2179 }
DefinitionA 64-bit word rotated right by c bitsRun/Blake2b/Compress.lean:116–117
In words
In Lean · Run/Blake2b/Compress.lean, lines 116–117

The 64-bit word w rotated right by c bits.

@[inline] def rotr64 (w c : UInt64) : UInt64 :=
(w >>> c) ||| (w <<< (64 - c))
DefinitionThe mixing function GRun/Blake2b/Compress.lean:123–132
In words
In Lean · Run/Blake2b/Compress.lean, lines 123–132

The mixing function: additions, exclusive-ors and rotations by 32, 24, 16 and 63 bits, on four words of the work vector and two message words.

@[inline] def G (s0 s1 a b c d : UInt64) : Quad :=
let a := a + b + s0
let d := rotr64 (d ^^^ a) 32
let c := c + d
let b := rotr64 (b ^^^ c) 24
let a := a + b + s1
let d := rotr64 (d ^^^ a) 16
let c := c + d
let b := rotr64 (b ^^^ c) 63
⟨a, b, c, d⟩
DefinitionOne round: eight calls of GRun/Blake2b/Compress.lean:138–147
In words
In Lean · Run/Blake2b/Compress.lean, lines 138–147

One round: eight calls of G, on the four columns and then the four diagonals of the work vector, with sixteen message words in the order that the caller gives.

@[inline] def ROUND (s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 : UInt64) (v : WorkVector) : WorkVector :=
let ⟨v0, v4, v8, v12⟩ := G s0 s1 v.v0 v.v4 v.v8 v.v12
let ⟨v1, v5, v9, v13⟩ := G s2 s3 v.v1 v.v5 v.v9 v.v13
let ⟨v2, v6, v10, v14⟩ := G s4 s5 v.v2 v.v6 v.v10 v.v14
let ⟨v3, v7, v11, v15⟩ := G s6 s7 v.v3 v.v7 v.v11 v.v15
let ⟨v0, v5, v10, v15⟩ := G s8 s9 v0 v5 v10 v15
let ⟨v1, v6, v11, v12⟩ := G s10 s11 v1 v6 v11 v12
let ⟨v2, v7, v8, v13⟩ := G s12 s13 v2 v7 v8 v13
let ⟨v3, v4, v9, v14⟩ := G s14 s15 v3 v4 v9 v14
⟨v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15⟩
DefinitionThe hashing stateRun/Blake2b/Compress.lean:155–161
In words
In Lean · Run/Blake2b/Compress.lean, lines 155–161

The hashing state: the chaining value, a two-word counter of the bytes processed, and two flag words. The first flag word marks the last block; the second is 0 in every state that the definitions of Hash.lean and Salted.lean produce from init0.

structure State where
h : ChainingValue
t0 : UInt64
t1 : UInt64
f0 : UInt64
f1 : UInt64
deriving DecidableEq, Repr, Inhabited
DefinitionThe compression functionRun/Blake2b/Compress.lean:168–213
In words
In Lean · Run/Blake2b/Compress.lean, lines 168–213

The compression function: the work vector from the state and the constants, twelve rounds, each with the message words in the order of its row of the schedule, and the new chaining value.

def compress (S : State) (m : MessageBlock) : State :=
let v : WorkVector :=
{ v0 := S.h.h0, v1 := S.h.h1, v2 := S.h.h2, v3 := S.h.h3,
v4 := S.h.h4, v5 := S.h.h5, v6 := S.h.h6, v7 := S.h.h7,
v8 := IV.h0,
v9 := IV.h1,
v10 := IV.h2,
v11 := IV.h3,
v12 := IV.h4 ^^^ S.t0,
v13 := IV.h5 ^^^ S.t1,
v14 := IV.h6 ^^^ S.f0,
v15 := IV.h7 ^^^ S.f1 }
let v := ROUND m.m0 m.m1 m.m2 m.m3 m.m4 m.m5 m.m6 m.m7
m.m8 m.m9 m.m10 m.m11 m.m12 m.m13 m.m14 m.m15 v
let v := ROUND m.m14 m.m10 m.m4 m.m8 m.m9 m.m15 m.m13 m.m6
m.m1 m.m12 m.m0 m.m2 m.m11 m.m7 m.m5 m.m3 v
let v := ROUND m.m11 m.m8 m.m12 m.m0 m.m5 m.m2 m.m15 m.m13
m.m10 m.m14 m.m3 m.m6 m.m7 m.m1 m.m9 m.m4 v
let v := ROUND m.m7 m.m9 m.m3 m.m1 m.m13 m.m12 m.m11 m.m14
m.m2 m.m6 m.m5 m.m10 m.m4 m.m0 m.m15 m.m8 v
let v := ROUND m.m9 m.m0 m.m5 m.m7 m.m2 m.m4 m.m10 m.m15
m.m14 m.m1 m.m11 m.m12 m.m6 m.m8 m.m3 m.m13 v
let v := ROUND m.m2 m.m12 m.m6 m.m10 m.m0 m.m11 m.m8 m.m3
m.m4 m.m13 m.m7 m.m5 m.m15 m.m14 m.m1 m.m9 v
let v := ROUND m.m12 m.m5 m.m1 m.m15 m.m14 m.m13 m.m4 m.m10
m.m0 m.m7 m.m6 m.m3 m.m9 m.m2 m.m8 m.m11 v
let v := ROUND m.m13 m.m11 m.m7 m.m14 m.m12 m.m1 m.m3 m.m9
m.m5 m.m0 m.m15 m.m4 m.m8 m.m6 m.m2 m.m10 v
let v := ROUND m.m6 m.m15 m.m14 m.m9 m.m11 m.m3 m.m0 m.m8
m.m12 m.m2 m.m13 m.m7 m.m1 m.m4 m.m10 m.m5 v
let v := ROUND m.m10 m.m2 m.m8 m.m4 m.m7 m.m6 m.m1 m.m5
m.m15 m.m11 m.m9 m.m14 m.m3 m.m12 m.m13 m.m0 v
let v := ROUND m.m0 m.m1 m.m2 m.m3 m.m4 m.m5 m.m6 m.m7
m.m8 m.m9 m.m10 m.m11 m.m12 m.m13 m.m14 m.m15 v
let v := ROUND m.m14 m.m10 m.m4 m.m8 m.m9 m.m15 m.m13 m.m6
m.m1 m.m12 m.m0 m.m2 m.m11 m.m7 m.m5 m.m3 v
{ S with
h :=
{ h0 := S.h.h0 ^^^ v.v0 ^^^ v.v8,
h1 := S.h.h1 ^^^ v.v1 ^^^ v.v9,
h2 := S.h.h2 ^^^ v.v2 ^^^ v.v10,
h3 := S.h.h3 ^^^ v.v3 ^^^ v.v11,
h4 := S.h.h4 ^^^ v.v4 ^^^ v.v12,
h5 := S.h.h5 ^^^ v.v5 ^^^ v.v13,
h6 := S.h.h6 ^^^ v.v6 ^^^ v.v14,
h7 := S.h.h7 ^^^ v.v7 ^^^ v.v15 } }
DefinitionA byte of an array as a word, or 0 if the index is out of rangeRun/Blake2b/Hash.lean:52–53
In words
In Lean · Run/Blake2b/Hash.lean, lines 52–53

Byte i as a 64-bit word, or 0 past the end.

@[inline] def byteOrZero (a : ByteArray) (i : Nat) : UInt64 :=
if h : i < a.size then a[i].toUInt64 else 0
DefinitionThe 64-bit word of eight little-endian bytesRun/Blake2b/Hash.lean:60–68
In words
In Lean · Run/Blake2b/Hash.lean, lines 60–68

The 64-bit little-endian word at offset k; missing bytes are read as 0.

def load64Plain (a : ByteArray) (k : Nat) : UInt64 :=
(byteOrZero a (k + 0) <<< 0) |||
(byteOrZero a (k + 1) <<< 8) |||
(byteOrZero a (k + 2) <<< 16) |||
(byteOrZero a (k + 3) <<< 24) |||
(byteOrZero a (k + 4) <<< 32) |||
(byteOrZero a (k + 5) <<< 40) |||
(byteOrZero a (k + 6) <<< 48) |||
(byteOrZero a (k + 7) <<< 56)
DefinitionThe 128 bytes at an offset as sixteen wordsRun/Blake2b/SaltedPlain.lean:26–42
In words
In Lean · Run/Blake2b/SaltedPlain.lean, lines 26–42

The 128 bytes at an offset as sixteen words, zero-padded.

def MessageBlock.ofBytesPlain (a : ByteArray) (off : Nat) : MessageBlock :=
{ m0 := load64Plain a (off + 8 * 0),
m1 := load64Plain a (off + 8 * 1),
m2 := load64Plain a (off + 8 * 2),
m3 := load64Plain a (off + 8 * 3),
m4 := load64Plain a (off + 8 * 4),
m5 := load64Plain a (off + 8 * 5),
m6 := load64Plain a (off + 8 * 6),
m7 := load64Plain a (off + 8 * 7),
m8 := load64Plain a (off + 8 * 8),
m9 := load64Plain a (off + 8 * 9),
m10 := load64Plain a (off + 8 * 10),
m11 := load64Plain a (off + 8 * 11),
m12 := load64Plain a (off + 8 * 12),
m13 := load64Plain a (off + 8 * 13),
m14 := load64Plain a (off + 8 * 14),
m15 := load64Plain a (off + 8 * 15) }
DefinitionThe state with its two-word counter increased by a numberRun/Blake2b/Hash.lean:121–123
In words
In Lean · Run/Blake2b/Hash.lean, lines 121–123

The state with a number added to its two-word counter, with carry.

@[inline] def incrementCounter (S : State) (inc : UInt64) : State :=
let t0 := S.t0 + inc
{ S with t0 := t0, t1 := S.t1 + (if t0 < inc then (1 : UInt64) else 0) }
DefinitionThe state with the next block marked as the last oneRun/Blake2b/Hash.lean:128–129
In words
In Lean · Run/Blake2b/Hash.lean, lines 128–129

The state with the next block marked as the last.

@[inline] def setLastblock (S : State) : State :=
{ S with f0 := 0xffffffffffffffff }
DefinitionThe state whose chaining value is the initialization vector and whose other words are all 0Run/Blake2b/Hash.lean:133–134
In words
In Lean · Run/Blake2b/Hash.lean, lines 133–134

The state whose chaining value is the initialization vector and whose other words are all 0.

@[inline] def init0 : State :=
{ h := IV, t0 := 0, t1 := 0, f0 := 0, f1 := 0 }
DefinitionThe state after the eight words of the parameter block are addedRun/Blake2b/Hash.lean:140–151
In words
In Lean · Run/Blake2b/Hash.lean, lines 140–151

The state after the eight words of the parameter block are XORed into the initialization vector.

@[inline] def initParam (p0 p1 p2 p3 p4 p5 p6 p7 : UInt64) : State :=
let S := init0
{ S with
h :=
{ h0 := S.h.h0 ^^^ p0,
h1 := S.h.h1 ^^^ p1,
h2 := S.h.h2 ^^^ p2,
h3 := S.h.h3 ^^^ p3,
h4 := S.h.h4 ^^^ p4,
h5 := S.h.h5 ^^^ p5,
h6 := S.h.h6 ^^^ p6,
h7 := S.h.h7 ^^^ p7 } }
DefinitionThe first word of the parameter block: output length, key length, fanout 1, depth 1Run/Blake2b/Hash.lean:159–163
In words
In Lean · Run/Blake2b/Hash.lean, lines 159–163

The first word of the parameter block: output length, key length, fanout 1, depth 1.

@[inline] def parameterBlockFirstWord (keylen outlen : Nat) : UInt64 :=
(outlen.toUInt64 <<< 0) |||
(keylen.toUInt64 <<< 8) |||
((1 : UInt64) <<< 16) |||
((1 : UInt64) <<< 24)
DefinitionThe first state, for an output length, a salt and a personalizationRun/Blake2b/SaltedPlain.lean:45–47
In words
In Lean · Run/Blake2b/SaltedPlain.lean, lines 45–47

The first state, for an output length, a salt and a personalization.

def firstStateSaltedPlain (outlen : Nat) (salt personal : ByteArray) : State :=
initParam (parameterBlockFirstWord 0 outlen) 0 0 0
(load64Plain salt 0) (load64Plain salt 8) (load64Plain personal 0) (load64Plain personal 8)
DefinitionThe state after a number of non-final blocksRun/Blake2b/Hash.lean:180–182
In words
In Lean · Run/Blake2b/Hash.lean, lines 180–182

The state after a number of blocks, none of them the last, are compressed: the counter is increased by 128 before each block.

@[specialize] def updateBlocks (blk : Nat → MessageBlock) : (n i : Nat) → State → State
| 0, _, S => S
| n + 1, i, S => updateBlocks blk n (i + 1) (compress (incrementCounter S 128) (blk i))
DefinitionThe state after the last block is compressedRun/Blake2b/Hash.lean:189–190
In words
In Lean · Run/Blake2b/Hash.lean, lines 189–190

The state after the last block is compressed: the counter is increased by the block's length, and the block is marked as the last.

@[inline] def finalBlock (S : State) (buf : MessageBlock) (buflen : Nat) : State :=
compress (setLastblock (incrementCounter S buflen.toUInt64)) buf
DefinitionThe state after a whole messageRun/Blake2b/Hash.lean:198–200
In words
In Lean · Run/Blake2b/Hash.lean, lines 198–200

The state after a whole message of inlen bytes.

@[specialize] def message (blk : Nat → MessageBlock) (inlen : Nat) (S : State) : State :=
let n := (inlen - 1) / 128
finalBlock (updateBlocks blk n 0 S) (blk n) (inlen - 128 * n)
DefinitionThe state after a whole message, starting from the first stateRun/Blake2b/SaltedPlain.lean:50–52
In words
In Lean · Run/Blake2b/SaltedPlain.lean, lines 50–52

The state after a whole message, starting from the first state.

def stateSaltedPlain (salt personal data : ByteArray) (outlen : Nat) : State :=
message (fun j => MessageBlock.ofBytesPlain data (128 * j)) data.size
(firstStateSaltedPlain outlen salt personal)
DefinitionAn array with the eight little-endian bytes of a word appendedRun/Blake2b/Hash.lean:224–232
In words
In Lean · Run/Blake2b/Hash.lean, lines 224–232

Appends the eight little-endian bytes of a word to an array.

@[inline] def store64 (o : ByteArray) (x : UInt64) : ByteArray :=
let o := o.push (x >>> 0).toUInt8
let o := o.push (x >>> 8).toUInt8
let o := o.push (x >>> 16).toUInt8
let o := o.push (x >>> 24).toUInt8
let o := o.push (x >>> 32).toUInt8
let o := o.push (x >>> 40).toUInt8
let o := o.push (x >>> 48).toUInt8
o.push (x >>> 56).toUInt8
DefinitionThe 64 bytes of the chaining valueRun/Blake2b/Hash.lean:237–246
In words
In Lean · Run/Blake2b/Hash.lean, lines 237–246

The state's eight words as 64 little-endian bytes.

def ChainingValue.bytes64 (s : ChainingValue) : ByteArray :=
let buffer := ByteArray.emptyWithCapacity 64
let buffer := store64 buffer s.h0
let buffer := store64 buffer s.h1
let buffer := store64 buffer s.h2
let buffer := store64 buffer s.h3
let buffer := store64 buffer s.h4
let buffer := store64 buffer s.h5
let buffer := store64 buffer s.h6
store64 buffer s.h7
DefinitionThe digest: a prefix of the chaining value's 64 bytesRun/Blake2b/Hash.lean:251–252
In words
In Lean · Run/Blake2b/Hash.lean, lines 251–252

The digest: the first outlen bytes of the state's 64 bytes.

def ChainingValue.bytes (s : ChainingValue) (outlen : Nat) : ByteArray :=
s.bytes64.extract 0 outlen
DefinitionBLAKE2b of a byte string with a salt and a personalization and no keyRun/Blake2b/SaltedPlain.lean:56–58
In words
In Lean · Run/Blake2b/SaltedPlain.lean, lines 56–58

BLAKE2b of a byte string with a salt, a personalization and no key. The result is the empty array if the output length is 0 or greater than 64.

def blake2bSaltedPlain (salt personal data : ByteArray) (outlen : Nat) : ByteArray :=
if outlen = 0 ∨ outlen > 64 then ByteArray.empty
else (stateSaltedPlain salt personal data outlen).h.bytes outlen

Appendix C. The integer model

This appendix presents the integer model, from the definitions named in CanServe and requestOutcome (modelNextToken, RequestForm, requestResult) down to arithmetic.

The cards. A card names the definitions that it uses. Each of these, except those of Lean's own library, has its own card in this appendix (the five packed arrays of numbers are named but not printed). The small auxiliary definitions (such as entry, tabulate, sumOver, roundShift, clamp) are in the last folded section.

Range conditions. A range condition is a bound outside which the model is undefined (allConditionsHold).

The files. The Lean code is in IntegerModel/Model.lean (725 lines), VerifiableInference/ModelWeights.lean and VerifiableInference/RequestResult.lean, with one definition from IntegerModel/Window.lean; the first card is from VerifiableInference/Statements.lean.

The comments in the Lean code. A short comment at the end of a Lean line, such as -- Vx or -- sigma, gives the symbol for that value in docs/model.md ("The integer model"); "section 7" in two comments refers to a section of that file. The numbers 1 to 8 in the comments of the range conditions enumerate these conditions. The definitions can be read without these comments.

A token · 1 card
DefinitionA tokenVerifiableInference/Statements.lean:28
In words
In Lean · VerifiableInference/Statements.lean, lines 28–28

A Token is a natural number.

abbrev Token : Type := ℕ
Remark

The type imposes no upper bound; RequestForm requires each token of a request to be less than settings.vocabulary.

The model's result on a request · 6 cards
DefinitionThe model's tokens on a request, or failureVerifiableInference/RequestResult.lean:68–74
In words
In Lean · VerifiableInference/RequestResult.lean, lines 68–74
Given

settings, weights at these settings (ModelWeights),

def requestResult (settings : Settings) (weights : ModelWeights settings)

a prompt and a claimed output

(prompt output : List Nat) : Option (List Nat) :=
Run

the model is run on one window of 1,024 tokens: the prompt, the claimed output, then zeros (zeroFilledWindow)

let window := IntegerModel.zeroFilledWindow prompt output
Value

if the model has a value on this window (modelNextToken returns some token):

if (modelNextToken settings weights window).isSome then

the choices of this run (trace, its field choices, one for each of the 1,024 positions)

let choices := (trace settings lookupTables weights.val window.toArray).choices.toList

the result is some list of these choices, starting at position prompt.length - 1 (0 for an empty prompt): as many as the claimed output has tokens, or fewer if the window ends first

some ((choices.drop (prompt.length - 1)).take output.length)

if the model has no value on this window (modelNextToken returns none), the result is none: failure

else none
Remark
  • The two lists are arbitrary: RequestForm is not tested here.
  • The range conditions are tested at all 1,024 positions, including the positions padded with zeros, so a failure can be caused by a position after the output.
  • The run reads the claimed output, so the result is a function of both lists.
DefinitionThe form of a requestVerifiableInference/RequestResult.lean:46–48
In words
In Lean · VerifiableInference/RequestResult.lean, lines 46–48
Given

settings, a prompt and an output

def RequestForm (settings : Settings) (prompt output : List Nat) : Prop :=
Holds if
  • every token of the prompt and of the output is below settings.vocabulary
  • neither list is empty
(∀ token ∈ prompt ++ output, token < settings.vocabulary) ∧ output ≠ [] ∧ prompt ≠ [] ∧
  • the two lists together have at most 1,025 tokens
prompt.length + output.length ≤ 1025
Remark
  • It depends only on the vocabulary size and the two lists, not on the weights or on settings.positions (the number 1,025 is a literal).
  • 1,025 is one more than the number of positions in the window (zeroFilledWindow), so the window does not contain the 1,025th token.
DefinitionThe window of 1,024 tokens: the prompt, the output, then zerosIntegerModel/Window.lean:13–14
In words
In Lean · IntegerModel/Window.lean, lines 13–14

zeroFilledWindow prompt output is the prompt, then the output, then zeros, truncated to exactly 1,024 tokens: (prompt ++ output ++ List.replicate 1024 0).take 1024.

def zeroFilledWindow (prompt output : List Nat) : List Nat :=
(prompt ++ output ++ List.replicate 1024 0).take 1024
DefinitionThe model at the fixed lookup tables: the next token, or nothingVerifiableInference/ModelWeights.lean:192–194
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 192–194
Given

settings, weights at these settings (ModelWeights), a list of tokens

def modelNextToken (settings : Settings) (weights : ModelWeights settings) (tokens : List Nat) :
Option Nat :=
Value

the output of the integer model (IntegerTransformer.model) on these settings, the library's lookup tables (lookupTables), these weights and these tokens: the next token, or nothing

model settings lookupTables weights.val tokens.toArray
DefinitionThe integer model: maps the tokens so far to the next token, or to nothingIntegerModel/Model.lean:719–723
In words
In Lean · IntegerModel/Model.lean, lines 719–723
Given

the settings s; five lookup tables (cosine, sine, exponential, SiLU, sigmoid); weights; the tokens so far

def model (s : Settings) (tables : Tables) (weights : Weights) (prompt : Array Nat) : Option Nat :=

if the arguments fit together (wellFormed), and there are from 1 to s.positions tokens, each below s.vocabulary (isPrompt):

if wellFormed s tables weights && isPrompt s prompt then

all values of the model, at every position (trace);

let values := trace s tables weights prompt
Value

if these values satisfy the range conditions (allConditionsHold): the choice at the last position

if allConditionsHold s values then some (values.choices.entry (prompt.size - 1))

in the other two cases: nothing

else none
else none
DefinitionThe test on the tokensIntegerModel/Model.lean:697–698
In words
In Lean · IntegerModel/Model.lean, lines 697–698
Given

the settings s; tokens, as numbers

def isPrompt (s : Settings) (prompt : Array Nat) : Bool :=
Holds if

there is at least one token, there are at most s.positions,

0 < prompt.size && prompt.size ≤ s.positions &&

and each is below s.vocabulary

prompt.all fun token => token < s.vocabulary
Weights, settings and tables: the types · 13 cards
DefinitionA vector of integersIntegerModel/Model.lean:116
In words
In Lean · IntegerModel/Model.lean, lines 116–116

An IntegerVector, or vector, is an array of unbounded integers (Int).

abbrev IntegerVector := Array Int
DefinitionA Matrix is an array of vectorsIntegerModel/Model.lean:120
In words
In Lean · IntegerModel/Model.lean, lines 120–120

A Matrix is an array of vectors, which are its rows.

abbrev Matrix := Array IntegerVector
DefinitionThe settings: sizes and scalesIntegerModel/Model.lean:211–227
In words
In Lean · IntegerModel/Model.lean, lines 211–227

the settings of the model:

structure Settings where
Sizes

the largest number of tokens (isPrompt)

positions : Nat -- T: the most tokens that a prompt can have

the number of layers (trace)

layers : Nat -- L

the number of entries of a row of the residual stream (attention, feedForward)

width : Nat -- d: the width of the residual stream

the number of query heads; the number of key and value heads; the number of entries of one head (attendHead)

queryHeads : Nat -- n_h
keyValueHeads : Nat -- n_g, which divides n_h
headDim : Nat -- dh, even

the hidden units of a feed-forward block; those of one expert; the number of routed experts (feedForward, routedExpert)

hidden : Nat -- f: the hidden units of a dense feed-forward block
expertHidden : Nat -- fe: the hidden units of one expert; f = 2 fe
experts : Nat -- NE: the number of routed experts; 0: every layer is dense

the number of tokens: a token is a number below it (isPrompt)

vocabulary : Nat -- V
Scales

an exponent: in a layer whose rotary is false every cosine is 2 to this power (projections)

rotaryScale : Nat -- cs: a layer without position encoding uses cosine 2^cs and sine 0

the offset, the exponent and the shift of the final normalization (trace, rmsNorm)

finalEps : Int -- epsF
finalBits : Nat -- MF
finalShift : Nat -- KF
Layers

for each layer, its settings (LayerSettings, next card)

perLayer : Array LayerSettings

the type has a default value

deriving Inhabited
DefinitionThe settings of one layer: exponents, shifts and offsetsIntegerModel/Model.lean:188–207
In words
In Lean · IntegerModel/Model.lean, lines 188–207

the settings of one layer:

structure LayerSettings where
Attention

the exponent, the shift and the offset of the normalization before attention (attention, rmsNorm)

attentionBits : Nat -- M1: the two exponents of the norm before attention
attentionShift : Nat -- K1
attentionEps : Int -- eps1

the shifts of queries, keys and values (projections)

queryShift : Nat -- kq
keyShift : Nat -- kk
valueShift : Nat -- kv

whether this layer reads the cosine and sine tables (projections)

rotary : Bool -- rp: does this layer encode positions?

the shift of a score's distance to the largest score (attendHead)

softmaxShift : Nat -- sh

the shift after the output matrix (attention)

outputShift : Nat -- ko
Feed-forward

the exponent, the shift and the offset of the normalization before the feed-forward block (feedForward)

feedForwardBits : Nat -- M2: the two exponents of the norm before the feed-forward block
feedForwardShift : Nat -- K2
feedForwardEps : Int -- eps2

the shifts after the gate, up and down matrices (feedForward)

gateShift : Nat -- kg
upShift : Nat -- ku
downShift : Nat -- kd

the shifts after the router's matrix and the chosen expert's gate and up matrices (routedExpert)

routerShift : Nat -- kr (these three: mixture-of-experts layers only)
routedGateShift : Nat -- kgR
routedUpShift : Nat -- kuR

the type has a default value

deriving Inhabited
DefinitionThe number of entries of all query heads togetherIntegerModel/Model.lean:230
In words
In Lean · IntegerModel/Model.lean, lines 230–230

s.queryWidth is queryHeads * headDim, the number of entries of all query heads together.

def Settings.queryWidth (s : Settings) : Nat := s.queryHeads * s.headDim
DefinitionThe number of entries of all key heads together, and of all value heads togetherIntegerModel/Model.lean:233
In words
In Lean · IntegerModel/Model.lean, lines 233–233

s.keyValueWidth is keyValueHeads * headDim, the number of entries of all key heads together, and of all value heads together.

def Settings.keyValueWidth (s : Settings) : Nat := s.keyValueHeads * s.headDim
DefinitionWhether a layer is a mixture-of-experts layerIntegerModel/Model.lean:237–238
In words
In Lean · IntegerModel/Model.lean, lines 237–238

s.isMixture l tests whether layer l is a mixture-of-experts layer: the number of routed experts is positive and l is odd.

def Settings.isMixture (s : Settings) (l : Nat) : Bool :=
s.experts > 0 && l % 2 == 1
DefinitionThe weightsIntegerModel/Model.lean:282–286
In words
In Lean · IntegerModel/Model.lean, lines 282–286

the weights:

structure Weights where

the embedding matrix: a row for each token (trace)

embedding : Matrix -- Emb, V x d

for each layer, its matrices (LayerWeights, next card)

perLayer : Array LayerWeights

the matrix that gives the logits (trace)

head : Matrix -- Wh, d x V

the type has a default value

deriving Inhabited
DefinitionThe weights of one layerIntegerModel/Model.lean:271–279
In words
In Lean · IntegerModel/Model.lean, lines 271–279

the weights of one layer:

structure LayerWeights where
Attention

the matrices for queries, keys and values (projections)

query : Matrix -- Wq, d x dq
key : Matrix -- Wk, d x dkv
value : Matrix -- Wv, d x dkv

the output matrix (attention)

output : Matrix -- Wo, dq x d
Feed-forward

the gate, up and down matrices (GatedWeights) of the block that every layer has (feedForward)

shared : GatedWeights -- the dense block (h = f), or the shared expert (h = fe)

the router's matrix (routedExpert)

router : Matrix -- Wr, d x NE (not read in a dense layer)

the gate, up and down matrices of each routed expert (routedExpert, feedForward)

routed : Array GatedWeights -- the NE routed experts, h = fe (not read in a dense layer)

the type has a default value

deriving Inhabited
DefinitionThe three weight matrices of one gated feed-forward blockIntegerModel/Model.lean:264–268
In words
In Lean · IntegerModel/Model.lean, lines 264–268

A GatedWeights consists of the three weight matrices of one gated feed-forward block: gate, up and down.

structure GatedWeights where
gate : Matrix -- Wg or Wgr_e, d x h
up : Matrix -- Wu or Wur_e, d x h
down : Matrix -- Wd or Wdr_e, h x d
deriving Inhabited
DefinitionThe type of the five lookup tables that the model readsIntegerModel/Model.lean:255–261
In words
In Lean · IntegerModel/Model.lean, lines 255–261

A Tables consists of the five lookup tables that the model reads:

structure Tables where

the cosine table

cosine : Matrix -- C(t, i), for position t and i < dh / 2: 2^cs times a cosine

the sine table

sine : Matrix -- S(t, i): 2^cs times a sine

the exponential table of the softmax

exponential : IntegerVector -- EX[u] for u < u0, the array's size: 2^expS times exp(-u / 2^rx); beyond, the model takes 0

the SiLU table

silu : KeyedTable -- Ts[c] for the keys -32,768 .. 32,767: 64 SiLU(c / 2^eg), cut to -smax .. smax

the sigmoid table

sigmoid : KeyedTable -- Sig[c], at least for the keys -16,384 .. 16,383: 65,536 times the sigmoid of c / 256
deriving Inhabited
DefinitionA lookup table whose keys are consecutive integersIntegerModel/Model.lean:242–245
In words
In Lean · IntegerModel/Model.lean, lines 242–245

A KeyedTable is a lookup table whose keys are consecutive integers starting at lowestKey, which may be negative; entries[0] belongs to the key lowestKey.

structure KeyedTable where
lowestKey : Int
entries : IntegerVector
deriving Inhabited
DefinitionThe entry of a lookup table at a keyIntegerModel/Model.lean:248–249
In words
In Lean · IntegerModel/Model.lean, lines 248–249

table.read key is the entry of table at key, or 0 if table has no entry at key.

def KeyedTable.read (table : KeyedTable) (key : Int) : Int :=
if table.lowestKey ≤ key then table.entries.entry (key - table.lowestKey).toNat else 0
All values of one run · 6 cards
DefinitionThe intermediate values of the model on given input tokensIntegerModel/Model.lean:565–572
In words
In Lean · IntegerModel/Model.lean, lines 565–572

A Trace contains the intermediate values of the model on given input tokens, from the embedded tokens to the logits and their argmax at each position.

structure Trace where
embedded : Matrix -- x^0
layer : Array Layer
last : Matrix -- x^L
finalNorm : Array Norm -- aF, by position, and the values on the way to it
logits : Matrix -- lam
choices : Array Nat -- by position: the first arg-max of lam_t
deriving Inhabited
DefinitionAll values of the integer model, at all positionsIntegerModel/Model.lean:576–583
In words
In Lean · IntegerModel/Model.lean, lines 576–583
Given

the four arguments of model: settings s, lookup tables, weights, tokens

def trace (s : Settings) (tables : Tables) (weights : Weights) (prompt : Array Nat) : Trace :=
Run

for each token, its row of the embedding matrix

let embedded := prompt.map fun token => weights.embedding.entry token

the s.layers layers, each applied to the output of the one below it (firstLayers, layer)

let layers := firstLayers s tables weights embedded s.layers

the output of the last layer (the embedded tokens, if there is no layer)

let last := streamAbove embedded layers

the final normalization of each of its rows (rmsNorm)

let finalNorm := last.map fun row => rmsNorm s.finalBits s.finalShift s.finalEps row

the logits: each normalized row times the matrix weights.head

let logits := finalNorm.map fun norm => product norm.out weights.head s.vocabulary

at each position, the least token with the largest logit (firstArgmax)

let choices := logits.map fun lam => firstArgmax (fun v => lam.entry v) s.vocabulary
Value

all of these, in one structure

{ embedded, layer := layers, last, finalNorm, logits, choices }
DefinitionThe first layers, each applied to the output of the one below itIntegerModel/Model.lean:557–562
In words
In Lean · IntegerModel/Model.lean, lines 557–562
Given

the settings; the lookup tables; all weights; the embedded tokens; a number

def firstLayers (s : Settings) (tables : Tables) (weights : Weights) (embedded : Matrix) :
Value

that many layers, with all their values:

Nat → Array Layer

for 0: none

| 0 => #[]

for l + 1: the first l layers,

| l + 1 =>
let below := firstLayers s tables weights embedded l

followed by layer l (layer),

below.push (layer s tables weights l

applied to the output of the last of them, or to the embedded tokens if there are none (streamAbove)

(streamAbove embedded below))
DefinitionThe residual stream after the given layersIntegerModel/Model.lean:551–554
In words
In Lean · IntegerModel/Model.lean, lines 551–554

streamAbove embedded below is the residual stream that leaves the last layer of the array below, or embedded if below is empty.

def streamAbove (embedded : Matrix) (below : Array Layer) : Matrix :=
match below.back? with
| some top => top.out
| none => embedded
DefinitionThe values of one layer at all positionsIntegerModel/Model.lean:535–540
In words
In Lean · IntegerModel/Model.lean, lines 535–540

A Layer contains the values of one layer at all positions:

structure Layer where

the residual stream that enters the layer

input : Matrix -- x, the stream that enters the layer

the Attention

attention : Attention

one FeedForward for each position

feedForward : Array FeedForward -- by position

the residual stream that leaves the layer

out : Matrix -- x'', the stream that leaves the layer
deriving Inhabited
DefinitionOne layer: attention, then the feed-forward block at each positionIntegerModel/Model.lean:543–547
In words
In Lean · IntegerModel/Model.lean, lines 543–547
Given

the settings s; the lookup tables; all weights; the number l of the layer; the residual stream x, one row for each position

def layer (s : Settings) (tables : Tables) (weights : Weights) (l : Nat) (x : Matrix) :
Value

the values of the layer at all positions (Layer):

Layer :=

attention (attention), with the settings and the weights of layer l, on x

let attended := attention s (s.perLayer.entry l) tables (weights.perLayer.entry l) x

on each row of its output, the feed-forward block (feedForward);

let fed := attended.out.map fun row =>

with routed experts if s.isMixture l: there are experts, and l is odd

feedForward s (s.perLayer.entry l) tables (weights.perLayer.entry l) (s.isMixture l) row

x, both results, and the layer's output: the outputs of the feed-forward block, row by row

{ input := x, attention := attended, feedForward := fed, out := fed.map fun ff => ff.out }
A layer: normalization · 2 cards
DefinitionThe values of one normalization of one vectorIntegerModel/Model.lean:291–297
In words
In Lean · IntegerModel/Model.lean, lines 291–297

A Norm contains the values of one normalization of one vector:

structure Norm where

the sum of squares

sumSquares : Int -- Vx

the integer square root of that sum plus the offset

root : Int -- sigma

the scaled reciprocal of the root

reciprocal : Int -- Rc

the quotient (the result before clamping)

quotient : IntegerVector -- w

the result out

out : IntegerVector -- nr, the result
deriving Inhabited
DefinitionThe normalization of one row of the residual streamIntegerModel/Model.lean:303–309
In words
In Lean · IntegerModel/Model.lean, lines 303–309
Given

an exponent bits, a shift, an offset eps; a vector x of integers

def rmsNorm (bits shift : Nat) (eps : Int) (x : IntegerVector) : Norm :=
Run

the sum of the squares of x's entries

let sumSquares := sumOver x.size fun k => x.entry k * x.entry k

the integer square root (integerSquareRoot) of that sum plus eps (of 0 if that is negative)

let root : Int := integerSquareRoot (sumSquares + eps).toNat

2 to the power bits, plus half of root, divided by root

let reciprocal := (2 ^ bits + root / 2) / root

each entry of x times reciprocal, divided by 2 to the power shift and rounded (roundShift)

let quotient := x.map fun xk => roundShift (xk * reciprocal) shift

each of these clamped to the interval from −2,047 to 2,047 (clamp, activationBound)

let out := quotient.map fun wk => clamp wk activationBound
Value

all five, in one structure (Norm)

{ sumSquares, root, reciprocal, quotient, out }
A layer: attention · 7 cards
DefinitionThe values of one layer's attention at all positionsIntegerModel/Model.lean:401–408
In words
In Lean · IntegerModel/Model.lean, lines 401–408

An Attention contains the values of one layer's attention at all positions; out is the residual stream after attention.

structure Attention where
norm : Array Norm -- a, and the values on the way to it
projected : Array Projections
heads : Array (Array Head) -- by position, then by query head
mixed : Matrix -- o: the heads' results side by side
addition : Matrix -- ad
out : Matrix -- x', the stream after attention
deriving Inhabited
DefinitionAttention of one layer, on the whole residual streamIntegerModel/Model.lean:413–422
In words
In Lean · IntegerModel/Model.lean, lines 413–422
Given

the settings s; the layer's settings p; the lookup tables; the layer's weights w; the residual stream x: one row for each position

def attention (s : Settings) (p : LayerSettings) (tables : Tables) (w : LayerWeights) (x : Matrix) :
Value

the values below, in one structure (Attention)

Attention :=
Run

the normalization of each row (rmsNorm), with the layer's exponent, shift and offset

let norm := x.map fun row => rmsNorm p.attentionBits p.attentionShift p.attentionEps row -- step 1

at each position t: queries, keys and values from the normalized row (projections)

let projected := tabulate x.size fun t => projections s p tables w t (norm.entry t).out -- steps 2, 3

at each position, for each query head: its attention (attendHead)

let heads := tabulate x.size fun i => tabulate s.queryHeads fun h => attendHead s p tables projected i h -- step 4

at each position: the heads' results concatenated, s.queryWidth entries

let mixed := tabulate x.size fun i => tabulate s.queryWidth fun j =>
((heads.entry i).entry (j / s.headDim)).out.entry (j % s.headDim)

each such row times the output matrix, each entry divided by 2 to the power p.outputShift and rounded

let addition := mixed.map fun o => (product o w.output s.width).map fun e => roundShift e p.outputShift -- step 5

at each position: the row of x plus that row (addVectors)

let out := tabulate x.size fun t => addVectors (x.entry t) (addition.entry t)
Value

all six

{ norm, projected, heads, mixed, addition, out }
DefinitionThe queries, keys and values of one positionIntegerModel/Model.lean:326–337
In words
In Lean · IntegerModel/Model.lean, lines 326–337

A Projections contains the queries, keys and values of one position in one layer, and the intermediate values from which they are computed.

structure Projections where
queryProducts : IntegerVector -- A[j] for j < dq; entry h dh + c belongs to entry c of query head h
keyProducts : IntegerVector -- A[dq + j] for j < dkv
rotatedQuery : IntegerVector -- p0 and p1 of the query heads
rotatedKey : IntegerVector -- p0 and p1 of the key heads
wideQuery : IntegerVector -- the wide values of the query heads
wideKey : IntegerVector -- the wide values of the key heads
query : IntegerVector -- q
key : IntegerVector -- k
wideValue : IntegerVector -- vw
value : IntegerVector -- v
deriving Inhabited
DefinitionQueries, keys and values at one positionIntegerModel/Model.lean:342–359
In words
In Lean · IntegerModel/Model.lean, lines 342–359
Given

the settings s; the layer's settings p; the lookup tables

def projections (s : Settings) (p : LayerSettings) (tables : Tables)

the layer's weights w; a position t; a vector a (in attention: the normalized row at t)

(w : LayerWeights) (t : Nat) (a : IntegerVector) :
Value

the values below, in one structure (Projections)

Projections :=
Run

the cosines: if p.rotary, row t of the cosine table; else s.headDim / 2 entries, each 2 to the power s.rotaryScale

let cosine :=
if p.rotary then tables.cosine.entry t else tabulate (s.headDim / 2) fun _ => 2 ^ s.rotaryScale

the sines: if p.rotary, row t of the sine table; else as many zeros

let sine := if p.rotary then tables.sine.entry t else tabulate (s.headDim / 2) fun _ => 0

a times the query matrix (product): s.queryWidth entries

let queryProducts := product a w.query s.queryWidth

a times the key matrix: s.keyValueWidth entries

let keyProducts := product a w.key s.keyValueWidth

both rotated by these cosines and sines, pair by pair within each head (rotate)

let rotatedQuery := rotate cosine sine s.headDim queryProducts
let rotatedKey := rotate cosine sine s.headDim keyProducts

each entry divided by 2 to the power p.queryShift (for keys: p.keyShift) and rounded (roundShift)

let wideQuery := rotatedQuery.map fun e => roundShift e p.queryShift
let wideKey := rotatedKey.map fun e => roundShift e p.keyShift

each entry clamped to the interval from −2,047 to 2,047 (clamp): the queries and the keys

let query := wideQuery.map fun e => clamp e activationBound
let key := wideKey.map fun e => clamp e activationBound

a times the value matrix, each entry divided by 2 to the power p.valueShift and rounded

let wideValue := (product a w.value s.keyValueWidth).map fun e => roundShift e p.valueShift

each entry clamped in the same way: the values

let value := wideValue.map fun e => clamp e activationBound
Value

all ten

{ queryProducts, keyProducts, rotatedQuery, rotatedKey, wideQuery, wideKey,
query, key, wideValue, value }
DefinitionThe rotary position embeddingIntegerModel/Model.lean:319–323
In words
In Lean · IntegerModel/Model.lean, lines 319–323

rotate applies the rotary position embedding: in each head of headDim entries of A (headDim even) it maps the entries (a, b) at 2i and 2i + 1 to (c * a - s * b, s * a + c * b), with c = cosine[i] and s = sine[i].

def rotate (cosine sine : IntegerVector) (headDim : Nat) (A : IntegerVector) : IntegerVector :=
tabulate A.size fun j =>
let i := (j % headDim) / 2
if j % 2 = 0 then cosine.entry i * A.entry j - sine.entry i * A.entry (j + 1) -- p0 = C A0 - S A1
else sine.entry i * A.entry (j - 1) + cosine.entry i * A.entry j -- p1 = S A0 + C A1
DefinitionThe values of one query head's attention at one positionIntegerModel/Model.lean:363–371
In words
In Lean · IntegerModel/Model.lean, lines 363–371

A Head contains the values of one query head's attention at one position:

structure Head where

the scores

scores : IntegerVector -- s_ij

the largest score

top : Int -- m_i

the scores' scaled distances to it

distances : IntegerVector -- u_ij

the exponentials

exponentials : IntegerVector -- e_ij

their total

total : Int -- Z_i

the weighted sum of the values

mix : IntegerVector -- acc_i[c]

the result out

out : IntegerVector -- o_i[h][c]
deriving Inhabited
DefinitionCausal attention of one query head at one positionIntegerModel/Model.lean:382–398
In words
In Lean · IntegerModel/Model.lean, lines 382–398
Given

the settings s; the layer's settings p; the lookup tables

def attendHead (s : Settings) (p : LayerSettings) (tables : Tables)

the queries, keys and values of all positions; a position i; a query head h

(projected : Array Projections) (i h : Nat) :
Value

the values below, in one structure (Head)

Head :=
Run

dh: the number of entries of one head

let dh := s.headDim

g: h divided by the number of query heads for each key and value head

let g := h / (s.queryHeads / s.keyValueHeads) -- the key and value head that query head h reads

for each position j from 0 to i: the inner product of head h's query at i and head g's key at j

let scores := tabulate (i + 1) fun j =>
sumOver dh fun c =>
(projected.entry i).query.entry (h * dh + c) * (projected.entry j).key.entry (g * dh + c)

the largest of these scores (maxUpTo)

let top := maxUpTo (fun j => scores.entry j) i

for each score: top minus the score, divided by 2 to the power p.softmaxShift

let distances := scores.map fun sj => (top - sj) / 2 ^ p.softmaxShift

for each distance, its exponential: the entry of the exponential table at that distance, or 0 if the distance is not less than the table's size

let exponentials := distances.map fun (u : Int) =>
if u < tables.exponential.size then tables.exponential.entry u.toNat else 0

the sum of these exponentials

let total := sumOver (i + 1) fun j => exponentials.entry j

for each entry c of a head: the sum over j of j's exponential times entry c of head g's value at j

let mix := tabulate dh fun c =>
sumOver (i + 1) fun j => exponentials.entry j * (projected.entry j).value.entry (g * dh + c)

each of these sums, doubled, plus total, divided by twice total

let out := mix.map fun acc => (2 * acc + total) / (2 * total)
Value

all seven

{ scores, top, distances, exponentials, total, mix, out }
A layer: feed-forward, router and experts · 8 cards
DefinitionThe values of one layer's feed-forward block at one positionIntegerModel/Model.lean:503–509
In words
In Lean · IntegerModel/Model.lean, lines 503–509

A FeedForward contains the values of one layer's feed-forward block at one position; out is the row that leaves the layer.

structure FeedForward where
norm : Norm -- m, and the values on the way to it
shared : HiddenUnits -- the dense block's f units, or the shared expert's fe units (the units j < fe of section 7)
routed : Routed -- the router and the routed expert; `noRoute` in a dense layer
addition : IntegerVector -- ad
out : IntegerVector -- x'', the stream that enters the next layer
deriving Inhabited
DefinitionThe feed-forward block of one layer, at one positionIntegerModel/Model.lean:514–530
In words
In Lean · IntegerModel/Model.lean, lines 514–530
Given

the settings s; the layer's settings p; the lookup tables; the layer's weights w

def feedForward (s : Settings) (p : LayerSettings) (tables : Tables) (w : LayerWeights)

whether the layer has routed experts, mixture; a row x of the residual stream

(mixture : Bool) (x : IntegerVector) :
Value

the values of the block at one position (FeedForward):

FeedForward :=

the normalization of x (rmsNorm), with the layer's exponent, shift and offset for it; m is its result

let norm := rmsNorm p.feedForwardBits p.feedForwardShift p.feedForwardEps x
let m := norm.out

with routed experts: the s.expertHidden hidden units of the shared block, evaluated on m;

if mixture then
let sharedUnits := hiddenUnits tables w.shared s.expertHidden p.gateShift p.upShift m

the router and the expert that it chooses (routedExpert), on m;

let route := routedExpert s p tables w m

for each of the s.width entries: the down projection of the shared block (downSum),

let addition := tabulate s.width fun k =>
roundShift (downSum sharedUnits w.shared.down k +

plus that of the chosen expert; the sum divided by 2^p.downShift and rounded

downSum route.units (w.routed.entry route.chosen).down k) p.downShift

these values; the block's output is x plus addition, entry by entry (addVectors)

{ norm, shared := sharedUnits, routed := route, addition, out := addVectors x addition }

without routed experts: the s.hidden hidden units of the single block, evaluated on m;

else
let sharedUnits := hiddenUnits tables w.shared s.hidden p.gateShift p.upShift m

for each entry: its down projection, divided by 2^p.downShift and rounded

let addition :=
tabulate s.width fun k => roundShift (downSum sharedUnits w.shared.down k) p.downShift

these values, with empty vectors for the router (noRoute); the output is x plus addition

{ norm, shared := sharedUnits, routed := noRoute, addition, out := addVectors x addition }
DefinitionThe values of one gated block's hidden unitsIntegerModel/Model.lean:428–436
In words
In Lean · IntegerModel/Model.lean, lines 428–436

A HiddenUnits contains, for each hidden unit of one gated feed-forward block:

structure HiddenUnits where

the gate value

wideGate : IntegerVector -- gw

its balanced low byte

lowByte : IntegerVector -- g0

its high part (gate value - low byte) / 256 before clamping

highPart : IntegerVector -- gh

its high part after clamping

clampedHigh : IntegerVector -- gc

the key into the SiLU table

key : IntegerVector -- 256 gc + g0, the key at which the SiLU table is read

the activation

activation : IntegerVector -- s

the up value

up : IntegerVector -- u
deriving Inhabited
DefinitionThe hidden units of one gated blockIntegerModel/Model.lean:442–451
In words
In Lean · IntegerModel/Model.lean, lines 442–451
Given

the lookup tables; the three matrices w of a gated block (GatedWeights)

def hiddenUnits (tables : Tables) (w : GatedWeights)

the number of hidden units hidden; two shifts gateShift, upShift; a vector z

(hidden gateShift upShift : Nat) (z : IntegerVector) :
Value

seven vectors, each with one entry for each hidden unit (HiddenUnits):

HiddenUnits :=

z times the matrix w.gate (product), each entry divided by 2^gateShift and rounded (roundShift)

let wideGate := (product z w.gate hidden).map fun e => roundShift e gateShift

the low byte of each entry: the number from −128 to 127 that differs from it by a multiple of 256 (balancedLowByte)

let lowByte := wideGate.map balancedLowByte

the high part: the entry minus its low byte, divided by 256

let highPart := tabulate hidden fun j => (wideGate.entry j - lowByte.entry j) / 256

the high part, clamped to the interval from −127 to 127 (clamp)

let clampedHigh := highPart.map fun gh => clamp gh 127

the key: 256 times the clamped high part, plus the low byte

let key := tabulate hidden fun j => 256 * clampedHigh.entry j + lowByte.entry j

the entry of the SiLU table at that key (KeyedTable.read)

let activation := key.map tables.silu.read

z times the matrix w.up, each entry divided by 2^upShift and rounded

let up := (product z w.up hidden).map fun e => roundShift e upShift

all seven, in one structure

{ wideGate, lowByte, highPart, clampedHigh, key, activation, up }
DefinitionOne entry of a block's down projection, before the rounding shiftIntegerModel/Model.lean:456–458
In words
In Lean · IntegerModel/Model.lean, lines 456–458

downSum units down k is entry k of a block's down projection before the rounding shift: the sum over the hidden units j of activation[j] * up[j] * down[j][k].

def downSum (units : HiddenUnits) (down : Matrix) (k : Nat) : Int :=
sumOver units.up.size fun j =>
units.activation.entry j * units.up.entry j * (down.entry j).entry k
DefinitionThe router's values at one positionIntegerModel/Model.lean:462–471
In words
In Lean · IntegerModel/Model.lean, lines 462–471

A Routed contains the router's values at one position:

structure Routed where

the logits before clamping

wide : IntegerVector -- lw

their values with the three low bits dropped (logit / 8, rounded down)

high : IntegerVector -- ly

these bits (logit % 8)

low : IntegerVector -- l3

the clamped logits

logits : IntegerVector -- lr

the chosen expert

chosen : Nat -- e*

its scale

scale : Int -- sc

the scaled input

input : IntegerVector -- xr

the chosen expert's hidden units

units : HiddenUnits -- the hidden units fe ≤ j < f of section 7
deriving Inhabited
DefinitionThe router, and the expert that it choosesIntegerModel/Model.lean:479–490
In words
In Lean · IntegerModel/Model.lean, lines 479–490
Given

the settings s; those of the layer p; the lookup tables; the layer's weights w; a vector m

def routedExpert (s : Settings) (p : LayerSettings) (tables : Tables) (w : LayerWeights) (m : IntegerVector) :
Value

the router's values, and the hidden units of one expert (Routed):

Routed :=

m times the matrix w.router, one entry for each expert, each divided by 2^p.routerShift and rounded

let wide := (product m w.router s.experts).map fun e => roundShift e p.routerShift

each entry divided by 8, rounded down;

let high := wide.map fun lw => lw / 8

and its remainder, from 0 to 7

let low := wide.map fun lw => lw % 8

the logits: the quotient, clamped to the interval from −2,047 to 2,047, times 8, plus the remainder

let logits := tabulate s.experts fun e => 8 * clamp (high.entry e) 2047 + low.entry e

the least expert with the largest logit (firstArgmax)

let chosen := firstArgmax (fun e => logits.entry e) s.experts

the entry of the sigmoid table at that logit

let scale := tables.sigmoid.read (logits.entry chosen)

each entry of m times scale, divided by 2^16 and rounded

let input := m.map fun mk => roundShift (scale * mk) 16

the hidden units (hiddenUnits) of the chosen expert's block, s.expertHidden of them, with the shifts p.routedGateShift and p.routedUpShift, on input

let units := hiddenUnits tables (w.routed.entry chosen)
s.expertHidden p.routedGateShift p.routedUpShift input

all eight, in one structure

{ wide, high, low, logits, chosen, scale, input, units }
DefinitionThe router's values in a dense layerIntegerModel/Model.lean:495–500
In words
In Lean · IntegerModel/Model.lean, lines 495–500

noRoute is the Routed value of a dense layer: every vector is empty, and chosen and scale are 0.

def noRoute : Routed :=
let noUnits : HiddenUnits :=
{ wideGate := #[], lowByte := #[], highPart := #[], clampedHigh := #[], key := #[],
activation := #[], up := #[] }
{ wide := #[], high := #[], low := #[], logits := #[], chosen := 0, scale := 0,
input := #[], units := noUnits }
The range conditions · 6 cards
DefinitionThe range conditions, at all positions and in all layersIntegerModel/Model.lean:625–630
In words
In Lean · IntegerModel/Model.lean, lines 625–630
Given

the settings s; all values of the model (Trace)

def allConditionsHold (s : Settings) (values : Trace) : Bool :=
Holds if

at every position t,

(List.range values.embedded.size).all fun t =>

in every layer l:

((List.range s.layers).all fun l =>

the conditions on attention hold (attentionOk): those on its normalization hold, and each entry of the queries, keys and values before clamping is in the range −32,768 to 32,767;

attentionOk (s.perLayer.entry l) (values.layer.entry l).attention t

the conditions on the feed-forward block hold (feedForwardOk): those on its normalization, on the shared and the routed hidden units, and on the router's quotients;

&& feedForwardOk (s.perLayer.entry l) ((values.layer.entry l).feedForward.entry t))

and the conditions on a normalization hold at the final normalization (normOk)

&& normOk s.finalEps (values.finalNorm.entry t)
DefinitionThe range conditions of one layer's attention at one positionIntegerModel/Model.lean:606–609
In words
In Lean · IntegerModel/Model.lean, lines 606–609

attentionOk p a t tests the range conditions of one layer's attention at position t: normOk of the normalization, and fits16 of the queries, keys and values before clamping.

def attentionOk (p : LayerSettings) (a : Attention) (t : Nat) : Bool :=
normOk p.attentionEps (a.norm.entry t)
&& fits16 (a.projected.entry t).wideQuery && fits16 (a.projected.entry t).wideKey -- 3: a wide query or key entry
&& fits16 (a.projected.entry t).wideValue -- 4: a wide value entry vw
DefinitionThe range conditions of a feed-forward block at one positionIntegerModel/Model.lean:618–621
In words
In Lean · IntegerModel/Model.lean, lines 618–621

feedForwardOk p ff tests the range conditions of a feed-forward block at one position: normOk, unitsOk applied to the shared and to the routed hidden units, and fits16 applied to the wide router logits (before clamping) with the three low bits dropped.

def feedForwardOk (p : LayerSettings) (ff : FeedForward) : Bool :=
normOk p.feedForwardEps ff.norm && unitsOk ff.shared
&& fits16 ff.routed.high -- 5: the high part ly of a wide router logit
&& unitsOk ff.routed.units
DefinitionThe range conditions of one normalizationIntegerModel/Model.lean:601–603
In words
In Lean · IntegerModel/Model.lean, lines 601–603

normOk eps n tests the range conditions of one normalization: the sum of squares plus eps is below 2^78, and the quotient passes fits16.

def normOk (eps : Int) (n : Norm) : Bool :=
n.sumSquares + eps < 2 ^ 78 -- 1: a norm's sum of squares, Vx + eps (and through it 8)
&& fits16 n.quotient -- 2: a norm's quotient w
DefinitionThe range conditions of one gated blockIntegerModel/Model.lean:612–614
In words
In Lean · IntegerModel/Model.lean, lines 612–614

unitsOk units tests the range conditions of one gated block: the high part of every gate value, before clamping, lies in the range from -16,384 to 16,383, and the up values pass fits16.

def unitsOk (units : HiddenUnits) : Bool :=
(units.highPart.all fun gh => -16384 ≤ gh && gh ≤ 16383) -- 6: the high part gh of a wide gate key
&& fits16 units.up -- 7: an up projection u
DefinitionThe test that every entry is a signed 16-bit integerIntegerModel/Model.lean:592–593
In words
In Lean · IntegerModel/Model.lean, lines 592–593

fits16 v tests whether every entry of v is a signed 16-bit number, from -32,768 to 32,767.

def fits16 (v : IntegerVector) : Bool :=
v.all fun e => -32768 ≤ e && e ≤ 32767
Which arrays are weights · 11 cards
DefinitionThe weights at given settingsVerifiableInference/ModelWeights.lean:183–184
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 183–184
Given

settings

def ModelWeights (settings : Settings) : Type :=
Value

the arrays of weights (Weights) that pass the test weightsAreValid at these settings

{ weights : Weights // weightsAreValid settings weights = true }
DefinitionThe validity test for weights at given settingsVerifiableInference/ModelWeights.lean:173–174
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 173–174

weightsAreValid settings weights tests wellFormed (applied to settings, lookupTables and weights) and weightsInRange.

def weightsAreValid (settings : Settings) (weights : Weights) : Bool :=
wellFormed settings lookupTables weights && weightsInRange settings weights
DefinitionThe test that the arguments fit togetherIntegerModel/Model.lean:680–693
In words
In Lean · IntegerModel/Model.lean, lines 680–693
Given

the settings s; the lookup tables; all weights

def wellFormed (s : Settings) (tables : Tables) (weights : Weights) : Bool :=
Holds if

the numbers of key-value heads and query heads are positive, and the first divides the second

0 < s.keyValueHeads && 0 < s.queryHeads && s.queryHeads % s.keyValueHeads == 0

the width of a head is positive and even; the vocabulary is not empty

&& 0 < s.headDim && s.headDim % 2 == 0 && 0 < s.vocabulary

there are no experts, or s.hidden is twice s.expertHidden

&& (s.experts == 0 || s.hidden == 2 * s.expertHidden)

the final normalization's offset and its shift are at least 1

&& 1 ≤ s.finalEps && 1 ≤ s.finalShift

the lookup tables for cosine and sine have s.positions rows, each of half a head's width

&& hasSize s.positions (s.headDim / 2) tables.cosine &&
hasSize s.positions (s.headDim / 2) tables.sine

the table for the exponential is not empty, its first entry is positive, and no entry is negative

&& 0 < tables.exponential.size && 0 < tables.exponential.entry 0 &&
(tables.exponential.all fun e => 0 ≤ e)

the table for SiLU has all keys from −32,768 to 32,767, and the table for the sigmoid has all keys from −16,384 to 16,383

&& tables.silu.covers (-32768) 32767 && tables.sigmoid.covers (-16384) 16383

the embedding matrix has s.vocabulary rows of s.width entries, and the matrix weights.head has s.width rows of s.vocabulary entries

&& hasSize s.vocabulary s.width weights.embedding && hasSize s.width s.vocabulary weights.head

there are settings and weights for exactly s.layers layers

&& s.perLayer.size == s.layers && weights.perLayer.size == s.layers

in each layer, the matrices that the layer reads have the sizes given by the settings, and the two offsets and the shifts passed to roundShift are at least 1 (layerWellFormed; softmaxShift is not tested)

&& (List.range s.layers).all fun l =>
layerWellFormed s (s.perLayer.entry l) (weights.perLayer.entry l) (s.isMixture l)
DefinitionThe test on one layer's sizes, offsets and shiftsIntegerModel/Model.lean:648–660
In words
In Lean · IntegerModel/Model.lean, lines 648–660
Given

the settings s; the layer's settings p; the layer's weights w; whether the layer has routed experts, mixture

def layerWellFormed (s : Settings) (p : LayerSettings) (w : LayerWeights) (mixture : Bool) : Bool :=
Holds if

the query, key, value and output matrices have the sizes that s gives

hasSize s.width s.queryWidth w.query && hasSize s.width s.keyValueWidth w.key
&& hasSize s.width s.keyValueWidth w.value && hasSize s.queryWidth s.width w.output

the layer's two offsets are at least 1

&& 1 ≤ p.attentionEps && 1 ≤ p.feedForwardEps

every shift passed to roundShift is at least 1 (the shifts of the router and the routed experts are treated below)

&& 1 ≤ p.attentionShift && 1 ≤ p.queryShift && 1 ≤ p.keyShift &&
1 ≤ p.valueShift && 1 ≤ p.outputShift
&& 1 ≤ p.feedForwardShift && 1 ≤ p.gateShift && 1 ≤ p.upShift && 1 ≤ p.downShift

the router and the routed experts are tested only if mixture is true; then the matrices of the shared block, the router and each of the s.experts routed experts have the sizes given by s,

&& (if mixture then
w.shared.hasSizes s.width s.expertHidden && hasSize s.width s.experts w.router
&& w.routed.size == s.experts &&
(w.routed.all fun expert => expert.hasSizes s.width s.expertHidden)

and their three shifts are at least 1

&& 1 ≤ p.routerShift && 1 ≤ p.routedGateShift && 1 ≤ p.routedUpShift

otherwise the matrices of the shared block have the sizes that s gives

else w.shared.hasSizes s.width s.hidden)
Remark

softmaxShift is not tested here; layerSettingsInRange in VerifiableInference/ModelWeights.lean requires 4 ≤ softmaxShift ≤ 12.

DefinitionThe test that a matrix has the given numbers of rows and columnsIntegerModel/Model.lean:635–636
In words
In Lean · IntegerModel/Model.lean, lines 635–636

hasSize rows columns W tests whether W has rows rows of columns entries each.

def hasSize (rows columns : Nat) (W : Matrix) : Bool :=
W.size == rows && W.all fun row => row.size == columns
DefinitionThe test on the sizes of a gated block's three matricesIntegerModel/Model.lean:639–640
In words
In Lean · IntegerModel/Model.lean, lines 639–640

w.hasSizes d h tests whether gate and up have d rows and h columns, and down has h rows and d columns.

def GatedWeights.hasSizes (d h : Nat) (w : GatedWeights) : Bool :=
hasSize d h w.gate && hasSize d h w.up && hasSize h d w.down
DefinitionThe test that a lookup table has an entry at every key in an intervalIntegerModel/Model.lean:643–644
In words
In Lean · IntegerModel/Model.lean, lines 643–644

table.covers low high tests, for low ≤ high, whether table has an entry at every key from low to high.

def KeyedTable.covers (table : KeyedTable) (low high : Int) : Bool :=
table.lowestKey ≤ low && high < table.lowestKey + table.entries.size
DefinitionThe range test for all weightsVerifiableInference/ModelWeights.lean:157–161
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 157–161
Given

settings; weights

def weightsInRange (settings : Settings) (weights : Weights) : Bool :=
Holds if

every embedding entry is in the range from -2,155,905,152 to 2,139,062,143 (four signed bytes in base 256)

entriesWithin (-2155905152) 2139062143 weights.embedding

every entry of head is in the range from -4,096 to 4,095

&& entriesWithin (-4096) 4095 weights.head

layerWeightsInRange holds for each of the 48 layers

&& (List.range 48).all fun layer =>
layerWeightsInRange (settings.isMixture layer) (weights.perLayer.entry layer)
DefinitionThe test on the ranges of one layer's weightsVerifiableInference/ModelWeights.lean:148–153
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 148–153

layerWeightsInRange mixture layer tests whether every weight of the layer is in the range from -4,096 to 4,095; in a dense layer the router matrix and the array of routed experts must be empty.

def layerWeightsInRange (mixture : Bool) (layer : LayerWeights) : Bool :=
entriesWithin (-4096) 4095 layer.query && entriesWithin (-4096) 4095 layer.key
&& entriesWithin (-4096) 4095 layer.value && entriesWithin (-4096) 4095 layer.output
&& gatedWithin layer.shared
&& (if mixture then entriesWithin (-4096) 4095 layer.router && layer.routed.all gatedWithin
else layer.router.size == 0 && layer.routed.size == 0)
DefinitionThe test whether a gated block's entries are signed 13-bit numbersVerifiableInference/ModelWeights.lean:142–144
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 142–144

gatedWithin block tests whether every entry of the block's three matrices is a signed 13-bit number, from -4,096 to 4,095.

def gatedWithin (block : GatedWeights) : Bool :=
entriesWithin (-4096) 4095 block.gate && entriesWithin (-4096) 4095 block.up
&& entriesWithin (-4096) 4095 block.down
DefinitionThe test whether every entry of a matrix lies in an intervalVerifiableInference/ModelWeights.lean:138–139
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 138–139

entriesWithin low high matrix tests whether every entry of matrix is in the range from low to high.

def entriesWithin (low high : Int) (matrix : Matrix) : Bool :=
matrix.all fun row => row.all fun entry => low ≤ entry && entry ≤ high
The five tables' values · 7 cards
DefinitionThe library's five lookup tablesVerifiableInference/ModelWeights.lean:65–70
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 65–70

lookupTables is the Tables value made of the five tables on the next cards, with lowest key -32,768 for SiLU and -16,384 for the sigmoid.

def lookupTables : Tables where
cosine := cosineTable
sine := sineTable
exponential := exponentialTable
silu := { lowestKey := -32768, entries := siluTable }
sigmoid := { lowestKey := -16384, entries := sigmoidTable }
DefinitionThe cosine tableVerifiableInference/ModelWeights.lean:34–36
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 34–36

cosineTable has 1,024 rows, one for each position, each with 64 entries, one for each pair of entries of a head. Entry pair of row position is entry 64 * position + pair of the packed array Inst.Model.Data.cos (packedEntry, 14 bits), minus 4,096, clamped to the interval from -4,096 to 4,096.

def cosineTable : Matrix :=
tabulate 1024 fun position => tabulate 64 fun pair =>
clamp ((packedEntry Inst.Model.Data.cos 14 (64 * position + pair) : Int) - 4096) 4096
DefinitionThe sine tableVerifiableInference/ModelWeights.lean:39–41
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 39–41

sineTable has the same size and is read in the same way from the packed array Inst.Model.Data.sin.

def sineTable : Matrix :=
tabulate 1024 fun position => tabulate 64 fun pair =>
clamp ((packedEntry Inst.Model.Data.sin 14 (64 * position + pair) : Int) - 4096) 4096
DefinitionThe exponential table of the softmaxVerifiableInference/ModelWeights.lean:45–46
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 45–46

exponentialTable, the exponential table of the softmax, has 2,307 entries. Entry distance is entry distance of the packed array Inst.Model.Data.exp (packedEntry, 13 bits), clamped to 1 .. 4,096.

def exponentialTable : IntegerVector :=
tabulate 2307 fun distance => max 1 (min (packedEntry Inst.Model.Data.exp 13 distance : Int) 4096)
Remark

Intended content: 4,096 times exp (-distance / 256), rounded to the nearest integer, from 4,096 down to 1.

DefinitionThe SiLU tableVerifiableInference/ModelWeights.lean:53–56
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 53–56

siluTable has 65,536 entries; entry index corresponds to the key index - 32768. The key is first clamped to -16,384 .. 16,383. The entry is then the entry of the packed array Inst.Model.Data.silu at the clamped key plus 16,384 (packedEntry, 13 bits), minus 4,095, clamped to -4,095 .. 4,095. Below and above these keys the table is constant.

def siluTable : IntegerVector :=
tabulate 65536 fun index =>
clamp ((packedEntry Inst.Model.Data.silu 13
(min (max ((index : Int) - 32768) (-16384)) 16383 + 16384).toNat : Int) - 4095) 4095
DefinitionThe sigmoid tableVerifiableInference/ModelWeights.lean:59–60
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 59–60

sigmoidTable has 32,768 entries. Entry index is 16 times the smaller of 4,096 and entry index of the packed array Inst.Model.Data.sigm (packedEntry, 13 bits).

def sigmoidTable : IntegerVector :=
tabulate 32768 fun index => 16 * min (packedEntry Inst.Model.Data.sigm 13 index : Int) 4096
DefinitionOne entry of a packed arrayVerifiableInference/ModelWeights.lean:30–31
In words
In Lean · VerifiableInference/ModelWeights.lean, lines 30–31

packedEntry packed bits index is entry index of an array of natural numbers, each of which packs 1,024 entries of bits bits, lowest bits first; beyond the array it is 0.

def packedEntry (packed : Array Nat) (bits index : Nat) : Nat :=
(packed.getD (index / 1024) 0 >>> (bits * (index % 1024))) % 2 ^ bits
Small arithmetic helpers · 12 cards
DefinitionAn entry of an array, or the default valueIntegerModel/Model.lean:103–104
In words
In Lean · IntegerModel/Model.lean, lines 103–104

v.entry k is entry k of the array v, counted from 0, or the element type's default value (0 for a number) if k is outside the array.

def Array.entry {α : Type} [Inhabited α] (v : Array α) (k : Nat) : α :=
v.getD k default
DefinitionThe array with given entriesIntegerModel/Model.lean:123–124
In words
In Lean · IntegerModel/Model.lean, lines 123–124

tabulate n f is the array of n entries whose entry i is f i.

def tabulate {α : Type} (n : Nat) (f : Nat → α) : Array α :=
Array.ofFn (n := n) fun i => f i.val
DefinitionA finite sumIntegerModel/Model.lean:127–129
In words
In Lean · IntegerModel/Model.lean, lines 127–129

sumOver n f is the sum f 0 + f 1 + ... + f (n - 1), which is 0 for n = 0.

def sumOver : Nat → (Nat → Int) → Int
| 0, _ => 0
| n + 1, f => sumOver n f + f n
DefinitionThe largest of finitely many valuesIntegerModel/Model.lean:132–134
In words
In Lean · IntegerModel/Model.lean, lines 132–134

maxUpTo f i is the largest of the i + 1 values f 0, ..., f i.

def maxUpTo (f : Nat → Int) : Nat → Int
| 0 => f 0
| i + 1 => max (maxUpTo f i) (f (i + 1))
DefinitionThe first argmaxIntegerModel/Model.lean:138–142
In words
In Lean · IntegerModel/Model.lean, lines 138–142

firstArgmax f n is the argmax of f over the indices below n, with ties going to the lowest index; it is 0 for n = 0.

def firstArgmax (f : Nat → Int) : Nat → Nat
| 0 => 0
| n + 1 =>
let best := firstArgmax f n
if f best < f n then n else best
DefinitionThe rounding shiftIntegerModel/Model.lean:147–148
In words
In Lean · IntegerModel/Model.lean, lines 147–148

roundShift a k, the rounding shift of a by k, is a / 2^k rounded to the nearest integer, ties upward, for k ≥ 1; it is a + 1 for k = 0.

def roundShift (a : Int) (k : Nat) : Int :=
(a + 2 ^ (k - 1)) / 2 ^ k
DefinitionClamping to a symmetric intervalIntegerModel/Model.lean:151–152
In words
In Lean · IntegerModel/Model.lean, lines 151–152

clamp a b is a clamped to the interval from -b to b, that is, min (max a (-b)) b.

def clamp (a b : Int) : Int :=
min (max a (-b)) b
DefinitionThe bound to which normalized rows, queries, keys and values are clampedIntegerModel/Model.lean:155
In words
In Lean · IntegerModel/Model.lean, lines 155–155

activationBound is 2,047 = 2^11 - 1, the bound to which normalized rows, queries, keys and values are clamped.

def activationBound : Int := 2047
DefinitionThe balanced low byteIntegerModel/Model.lean:159–160
In words
In Lean · IntegerModel/Model.lean, lines 159–160

balancedLowByte a, the balanced low byte of a, is the integer from -128 to 127 that is congruent to a modulo 256.

def balancedLowByte (a : Int) : Int :=
(a + 128) % 256 - 128
DefinitionThe integer square rootIntegerModel/Model.lean:165–171
In words
In Lean · IntegerModel/Model.lean, lines 165–171

integerSquareRoot a is the integer square root of the natural number a, the largest r with r * r ≤ a, computed by recursion on a / 4, rounded down.

def integerSquareRoot (a : Nat) : Nat :=
if a = 0 then 0
else
let r := 2 * integerSquareRoot (a / 4)
if (r + 1) * (r + 1) ≤ a then r + 1 else r
termination_by a
decreasing_by omega
DefinitionThe entrywise sum of two vectorsIntegerModel/Model.lean:174–175
In words
In Lean · IntegerModel/Model.lean, lines 174–175

addVectors x y is the entrywise sum of the vectors x and y, with as many entries as x.

def addVectors (x y : IntegerVector) : IntegerVector :=
tabulate x.size fun k => x.entry k + y.entry k
DefinitionThe vector-matrix productIntegerModel/Model.lean:179–180
In words
In Lean · IntegerModel/Model.lean, lines 179–180

product x W outputs is the vector-matrix product of x and W, with outputs entries: entry j is the sum over k of x[k] * W[k][j].

def product (x : IntegerVector) (W : Matrix) (outputs : Nat) : IntegerVector :=
tabulate outputs fun j => sumOver x.size fun k => x.entry k * (W.entry k).entry j
Appendix: index of every declaration embedded in this page (navigation only)

All 1,558 embedded declarations, searchable by name or file.

Click a Lean link to view the declaration here.