Skip to content

feat(frontier): sync PolyFun and realize one-time pad and ElGamal security - #1206

Draft
dtumad wants to merge 6 commits into
Verified-zkEVM:mainfrom
dtumad:dtumad/frontier-security-pr
Draft

dtumad wants to merge 6 commits into
Verified-zkEVM:mainfrom
dtumad:dtumad/frontier-security-pr

Conversation

@dtumad

@dtumad dtumad commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Changes and package layout

This PR adds VCVioFrontier, an optional Lake package that connects VCVio security proofs to cslib-frontier’s probabilistic Turing machines. It proves perfect secrecy for a one-time pad machine and a concrete one-time IND-CPA bound for an implemented ElGamal scheme. This advances #906.

  • Stable VCVio and Interop/ use the same core PolyFun revision on Lean 4.36.0. Building on the return-predicate migration in chore(deps): pin PolyFun's inductive return predicate and retire the support workaround #1204, the one-time IND-CPA game now exposes its two fixed-challenge branches, and the ElGamal reduction factors out the choice, coin draw, and guess shared by its typed and encoded versions.
  • VCVioFrontier/ imports VCVio by path and adds PolyFunFrontier and cslib-frontier on Lean 4.36.0-rc2. Within it, OracleComp/ relates program and machine output laws, CryptoFoundations/ relates the security definitions, and Examples/ applies both. VCVioFrontierTest/ contains runnable examples. The package has its own manifest and CI build. Package configuration

Verified-zkEVM/PolyFun#510 supplies the scoped-term theory. Verified-zkEVM/PolyFun#511 adds the machine interpretation and is pinned here at 01547e78. The pin can move to the merged revision once both land. Stable lint and tests passed at c23778f1. The axiom sweeps checked 32,435 stable and 156 Frontier declarations and found no uses of sorry or nonstandard axioms. Clean Linux build of the nested package

How the definitions fit together

From an interface to a machine. A polynomial functor describes the available requests and the response type of each request. A VCVio OracleComp is a tree of those requests in CSLib’s PFunctor.FreeM. PolyFun handlers give the requests meaning. PPTProgram.substitute lets a request be implemented by another free program and uses handler composition to carry its polynomial-time proof through the substitution. For local computations, wordTerm_polyTime lifts bounds for primitive word operations to whole scoped terms. @SamuelSchlesinger polytime tactic from cslib-frontier supplies the primitive bounds. Handler substitution · Scoped terms and TM automation

From machine output to a VCVio game. Given a PPTProgram proof for a handler H and fixed bit encodings, MachineRealization.ofPPTProgram chooses one fair-coin multi-tape machine and a polynomial clock bounding every supported run. VCVio’s finite-choice ProbComp is definitionally equal to Cslib.ProbComp. The theorem evalDist_eq_toMeasure proves their evaluations agree. Together they give output_measure, which identifies the output of that same machine on the word encoding of a with VCVio’s measure of the handled program.

(M.output a).toMeasure = 𝒟[encoding <$> (program a).liftM H]

For Boolean games, boolDist_toMeasure_eq_advantage identifies the two distinguishing advantages. negligible_coe_iff then transfers negligibility of finite advantages, so secureAgainst_iff_indistinguishable preserves the choice of admissible adversaries. Probability semantics · Machine output · Security definitions

Guide to the examples

One-time pad

  1. Start with encryptWord. It requests one Boolean per message bit and XORs the answers with the message. With the tapeBits handler, message 010 and tape 1001 yield ciphertext 110 and leave 1 on the tape. Install fairBits on the same tree to obtain the randomized encryption experiment. Run the example
  2. Follow the scoped terms for key xor msg and key xor (key xor msg) to the encryption and round-trip machines. encryptMachine_uniform transports VCVio’s uniform-ciphertext theorem to machine output. encryptMachine_rows gives identical output laws for any two equal-width messages, and roundTripMachine_correct recovers the message using the same key. Machine theorems

ElGamal

  1. Start with the honest algorithms. Install fixed exponents to prove decryption recovers each encoded group element for every secret and nonce. Install Frontier’s bounded fair-coin sampler on the same programs to obtain the implemented scheme. wordScheme_efficient proves uniform polynomial time for key generation, encryption, and decryption when the group description is computable in polynomial time from the unary security parameter. Honest programs · Installed algorithms
  2. Follow the adversary through the reduction. AdversaryRealization connects VCVio’s typed adversary to two polynomial-time word procedures. The choice stage preserves the joint law of both messages and the saved state, accounting for the two games’ message order. The guess stage agrees on the encoded state and ciphertext. R.machine_output_openOracle then identifies the clocked machine’s output law with the encoded result of VCVio’s original reduction. Run the choose-and-guess example · Frontier DDH distinguisher · Machine correspondence
  3. Read R.implemented_advantage_le in VCVio’s one-time IND-CPA game. At parameter n, the advantage is at most 2 · AdvDDH + 4 / 2^n for this adversary’s own DDH distinguisher. The factor of two comes from the exact-exponent reduction. The bounded sampler contributes at most 2 / 2^n for each challenge bit. Uniform machine DDH for the prime-order family with the specified group description at each parameter gives negligible advantage for every word adversary realizing a typed adversary. Companion results cover strict-PPT bit-message adversaries and word messages checked by a polynomial-time guard that accepts only valid encodings. Pointwise bound and DDH corollary · Bit and guarded games

dtumad and others added 6 commits November 21, 2026 11:04
…roof

Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
…ity bound

Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

🤖 PR Summary

Mathematical Formalization: One-Time Pad and ElGamal Security

This PR adds the VCVioFrontier package, a new optional subproject that connects VCVio's probabilistic cryptographic games to uniform (multi-tape Turing machine) models via PolyFun. The core contribution is a complete formal proof of one-time IND-CPA security for the ElGamal encryption scheme, and a full worked example for the one-time pad, both realized as polynomial-time machines.

One-Time Pad (complete worked example)

  • Words.lean – Word-encoded bit-vector operations (encryptWord, roundTripWord, tapeBits). Theorems such as encryptWord_eq and encryptWord_rows prove ciphertext uniformity and independence from the plaintext – the fundamental perfect-secrecy property.
  • Machine.lean – Concrete Turing machine realizations (encryptMachine, roundTripMachine, xorMachine) built from PPT certificates. encryptMachine_uniform and encryptMachine_rows establish that machine output matches the probabilistic semantics exactly.
  • OneTimePad.lean (test) – Nine example blocks instantiate the above definitions and verify correctness for specific bit vectors, tape simulations, and round-trip decryption.

ElGamal IND-CPA Security Reduction

The main mathematical contribution is a modular proof that the one-time ElGamal advantage is bounded by 2·AdvDDH + 4/2^n.

  • Honest.lean – Defines the wordScheme (an AsymmEncAlg instance using bounded fair-coin sampling on word inputs). Theorems wordScheme_efficient (uniform PPT runtime), wordScheme_decrypt_encrypt (correctness), and wordGame_approximation (bounding the uniform-exponent game distance by 2/2^n). The bitGame and bitAdversary bridge to bit-valued messages.
  • HonestPrograms.lean – The actual FreeM programs (keygen, encrypt, decrypt) over a bounded exponent sampler, with proofs of polynomial-time realizability (keygen_realized, encrypt_realized, decrypt_realized).
  • Reduction.lean – A one-time ElGamal DDH reduction formalized as a three-request program (choose, coin, guess). Theorems ddhReduction_eq, eval_ddhReduction_fixedBits, reductionSource_realized, and ddhReduction_isPPT establish the reduction to the DDH assumption.
  • Security.lean – The main security theorem file. Defines AdversaryRealization (bundling a WordAdversary, PPT certificate, and encoding functions). Key theorems:
    • eval_reduction – typed DDH reduction equals compiled word reduction.
    • machine_output_openOracle – machine output equals encoded open reduction.
    • exists_halting_machine – a single finite-control PPT machine works at all parameters.
    • advantage_eq – IND-CPA advantage equals twice the DDH game advantage.
    • negligible_advantage – if point-setup DDH is hard, the typed adversary's advantage is negligible.
  • Bound.lean – Concrete bounds: wordGame_advantage_le (advantage ≤ 2·AdvDDH + 4/2^n), wordGame_secure (security under strict DDH), implementedAdversary_advantage (equality of advantages).
  • Transport.lean – eval_reductionBody shows that the reduction output is preserved under encoding/state translation.
  • Choice.lean – Translation between VCVio and Frontier message-order conventions (oneTimeChoice, encodeChoice, round-trip equivalence).
  • Basic.lean – Refactors oneTimeDDHReductionWith as an abstraction, with updates to IND_CPA_OneTime_DDHReduction_rand_half proof.
  • Generic.lean – Adds oneTimeDDHReductionWith to simplification in oneTimeDDHReduction_toOneTime_eq proof.
  • VCVioFrontier.lean – Top-level module re-exporting 12 submodules.

Core Security Statement (Bound.lean, lines ~133)

wordGame_advantage_le (adversary : WordAdversary) :
  |wordGame adversary - 1/2| ≤ 2 * AdvDDH adversary.distinguisher + 4 / 2^n

Both a bit-message result for strict-PPT adversaries and a word-message result guarded by a validity check are provided.

Adversary Implementation Example

  • State.lean (test) – Defines a concrete stateful two-stage adversary (typed, words) with a realization theorem providing the AdversaryRealization certificate. secure and implemented_secure prove its IND-CPA one-time advantage is negligible under DDH and under the bounded-coin scheme.
  • Branches.lean (test) – Summary unavailable, but the PR body references a regression test for a losing guess (incorrectGuessLoses).

Protocols / Soundness

  • Measure.lean – Bridges VCVio's finite-choice measures 𝒟 with CslibFrontier's PMF semantics. Theorems probComp_eq, evalDist_eq_toMeasure, eval_uniformSample, evalDist_fairBits and a noncomputable fairBits handler establish cross-library agreement.
  • Realization.lean – output_measure theorem linking machine semantics to VCVio's measure semantics via encoding embeddings.
  • OneTime.lean (VCVio core) – Adds IND_CPA_OneTime_branch and IND_CPA_OneTime_Advantage_eq_boolDist, proving that one-time IND-CPA advantage equals boolDist between fixed-bit games.

Infrastructure / CI

  • frontier.yml – New GitHub Actions workflow for VCVioFrontier: runs on push/PR for relevant paths. Steps: caching, check-pins.py, build both libraries, mk_all completeness check, axiomsweep regressions check.
  • interop-isolation.yml – Extended to run check-pins.py --root-only and test-pins.py from the VCVioFrontier scripts directory.
  • check-pins.py – New script: checks pin consistency between lakefile.toml and lake-manifest.json for all dependencies; enforces canonical PolyFun remote; guards against accidental resolution of optional deps in the root.
  • test-pins.py – Unit tests for check-pins.py covering comment-laden requires, stale manifests, mismatched fields.
  • lakefile.lean – Advances PolyFun pin from 713d885 to 01547e7 (same commit as VCVioFrontier's lakefile.toml).
  • CheckImports.lean – Skips .lake dirs; blocks CslibFrontier, PolyFunFrontier, VCVioFrontier imports in the verification project (isolation enforcement).
  • test-interop-isolation.py – Adds three new forbidden-import edges and a test verifying installed dependencies are exempt from isolation rules.
  • test-validation.py – Adds test_frontier_isolation_runs_in_the_default_pass for check-pins.py/test-pins.py execution.
  • validate.sh – Adds check-pins.py --root-only and test-pins.py to the validation pipeline.
  • lakefile.toml (VCVioFrontier) – New build config: local VCVio plus pinned PolyFun, PolyFunFrontier, cslib-frontier, cslib, mathlib. Two libraries (VCVioFrontier + VCVioFrontierTest) with warningAsError = true.

Documentation

  • README.md (project root) – Added bullet point describing the optional VCVioFrontier package.
  • README.md (VCVioFrontier) – Full documentation: one-time pad example (encryptWord, simulateQ, fairBits, oneTimePad.denote_coinOneTimePad_cipherGivenMsg_eq_uniform), ElGamal reduction (reductionSource, AdversaryRealization, R.implemented_advantage_le bound), and build instructions.
  • docs/design/computational-complexity.md – Updated to describe VCVioFrontier as the uniform machine model replacing the previous VCVioComplexity/VCVioCslib plans.
  • docs/design/repository-layout.md – Promoted VCVioFrontier/ from planned to top-level directory; revised prose describing the implemented uniform machine realizations.

Refactoring

  • Basic.lean – oneTimeDDHReductionBody refactored to use the new oneTimeDDHReductionWith abbreviation.

Notes


Statistics

Metric Count
📝 Files Changed 39
✅ Lines Added 2376
❌ Lines Removed 20

Lean Declarations

✏️ Added: 142 declaration(s)

Examples/ElGamal/Basic.lean (1)

  • abbrev oneTimeDDHReductionWith {m : Type → Type} [Monad m] {Choice : Type}

VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/OneTime.lean (2)

  • def IND_CPA_OneTime_branch (b : Bool) : OracleComp spec Bool
  • theorem IND_CPA_OneTime_Advantage_eq_boolDist {enc : AsymmEncAlg ProbComp M PK SK C}

VCVioFrontier/VCVioFrontier/CryptoFoundations/Asymptotics.lean (3)

  • theorem boolDist_toMeasure_eq_advantage (p q : PMF Bool) :
  • theorem negligible_coe_iff (f : ℕ → ℝ≥0) :
  • theorem secureAgainst_iff_indistinguishable {Adv : Type*} (left right : Adv → ℕ → Cslib.Crypto.Game)

VCVioFrontier/VCVioFrontier/Examples/ElGamal/Bound.lean (10)

  • @[expose] def implementedAdversary (F : PrimeOrderGroupFamily) (desc : ℕ → F.Desc)
  • @[expose] noncomputable def typedBranch (adv : TypedAdversary F desc) (b : Bool) (n : ℕ) :
  • private theorem perturbedRows (actual ideal : Bool → Measure Bool) (ε : ℝ≥0∞)
  • private theorem typedBranch_advantage (adv : TypedAdversary F desc) (n : ℕ) :
  • theorem AdversaryRealization.implemented_advantage_le (R : AdversaryRealization F desc adv)
  • theorem AdversaryRealization.typedBranch_eval (R : AdversaryRealization F desc adv)
  • theorem AdversaryRealization.wordGame_advantage_le (R : AdversaryRealization F desc adv) (n : ℕ) :
  • theorem AdversaryRealization.wordGame_secure (R : AdversaryRealization F desc adv)
  • theorem implementedAdversary_advantage (A : Encryption.WordAdversary) (n : ℕ) :
  • theorem implemented_secureAgainst (hDDH : F.DDH (fun n => PMF.pure (desc n))) :

VCVioFrontier/VCVioFrontier/Examples/ElGamal/Choice.lean (3)

  • @[expose] def encodeChoice {M W S : Type} (encode : M → W) (state : S → List Bool)
  • @[expose] def oneTimeChoice {M W : Type} (encode : M → W) (choice : ChoiceOut M) :
  • @[simp] theorem oneTimeChoice_encodeChoice {M W S : Type} (encode : M → W)

VCVioFrontier/VCVioFrontier/Examples/ElGamal/Honest.lean (16)

  • @[expose] noncomputable def bitAdversary (adv : Encryption.Adversary) (n : ℕ) :
  • @[expose] noncomputable def bitGame (adv : Encryption.Adversary) :
  • @[expose] noncomputable def wordGame (valid : ℕ → List Bool → List Bool → List Bool → Bool)
  • @[expose] noncomputable def wordScheme (n : ℕ) :
  • theorem bitAdversary_advantage (adv : Encryption.Adversary) (n : ℕ) :
  • theorem bitAdversary_secure (hDDH : F.DDH (fun k => PMF.pure (desc k)))
  • theorem bitGame_secure (hDDH : F.DDH (fun k => PMF.pure (desc k)))
  • theorem wordGame_approximation (valid : ℕ → List Bool → List Bool → List Bool → Bool)
  • theorem wordGame_measure_approximation (valid : ℕ → List Bool → List Bool → List Bool → Bool)
  • theorem wordGame_measure_negligible {valid : ℕ → List Bool → List Bool → List Bool → Bool}
  • theorem wordGame_negligible {valid : ℕ → List Bool → List Bool → List Bool → Bool}
  • theorem wordScheme_decrypt (n : ℕ) (sk ct : List Bool) :
  • theorem wordScheme_decrypt_encrypt (n : ℕ) (m : F.Carrier (desc n))
  • theorem wordScheme_efficient (hd : ComputableInPolyTime desc encUnary F.encDesc) :
  • theorem wordScheme_encrypt (n : ℕ) :
  • theorem wordScheme_keygen (n : ℕ) :

VCVioFrontier/VCVioFrontier/Examples/ElGamal/HonestPrograms.lean (18)

  • @[expose] def decrypt (n : ℕ) (sk ct : List Bool) : (signature F).FreeM (Option (List Bool))
  • @[expose] def encrypt (n : ℕ) (pk msg : List Bool) : (signature F).FreeM (List Bool)
  • @[expose] def exponent (n : ℕ) : (signature F).FreeM ℕ
  • @[expose] def fixedExponent (a : ℕ) : Handler Id (signature F)
  • @[expose] def keygen (n : ℕ) : (signature F).FreeM (List Bool × List Bool)
  • @[expose] noncomputable def sample : Handler Cslib.ProbComp (signature F)
  • abbrev signature
  • theorem decrypt_encrypt_fixedExponent (n a b : ℕ) (m : F.Carrier (desc n)) :
  • theorem decrypt_realized :
  • theorem encrypt_fixedExponent (n b : ℕ) (pk msg : List Bool) :
  • theorem encrypt_realized :
  • theorem exponent_realized :
  • theorem keygen_fixedExponent (n a : ℕ) :
  • theorem keygen_realized :
  • theorem liftM_decrypt (n : ℕ) (sk ct : List Bool) :
  • theorem liftM_encrypt (n : ℕ) (pk msg : List Bool) :
  • theorem liftM_exponent {m : Type → Type} [Monad m] [LawfulMonad m]
  • theorem liftM_keygen (n : ℕ) :

VCVioFrontier/VCVioFrontier/Examples/ElGamal/Reduction.lean (10)

  • @[expose] def challenge (x : F.DDHInput) (choice : Encryption.ChoiceOut (List Bool))
  • @[expose] def publicKey (x : F.DDHInput) : List Bool
  • @[expose] def reductionSource (x : F.DDHInput) : signature.FreeM Bool
  • @[expose] noncomputable def ddhReduction (adv : Encryption.WordAdversary) : F.DDHDistinguisher
  • @[expose] noncomputable def runRequest (adv : Encryption.WordAdversary) :
  • abbrev signature : PFunctor
  • theorem ddhReduction_eq (adv : Encryption.WordAdversary) (n : ℕ) (d : F.Desc)
  • theorem ddhReduction_isPPT {adv : Encryption.WordAdversary} (hA : adv.IsPPT) :
  • theorem eval_ddhReduction_fixedBits (adv : Encryption.WordAdversary) (n : ℕ) (d : F.Desc)
  • theorem reductionSource_realized {adv : Encryption.WordAdversary} (hA : adv.IsPPT) :

VCVioFrontier/VCVioFrontier/Examples/ElGamal/Security.lean (11)

  • @[instance_reducible] noncomputable def carrierSampler (d : F.Desc) :
  • abbrev TypedAdversary
  • noncomputable abbrev typedScheme (d : F.Desc)
  • noncomputable def AdversaryRealization.machine (R : AdversaryRealization F desc adv) :
  • theorem AdversaryRealization.advantage_eq (R : AdversaryRealization F desc adv) (n : ℕ) :
  • theorem AdversaryRealization.ddh_games (R : AdversaryRealization F desc adv) (n : ℕ) :
  • theorem AdversaryRealization.eval_openOracle (R : AdversaryRealization F desc adv) (n : ℕ)
  • theorem AdversaryRealization.eval_reduction (R : AdversaryRealization F desc adv) (n : ℕ)
  • theorem AdversaryRealization.exists_halting_machine (R : AdversaryRealization F desc adv) :
  • theorem AdversaryRealization.machine_output_openOracle (R : AdversaryRealization F desc adv)
  • theorem AdversaryRealization.negligible_advantage (R : AdversaryRealization F desc adv)

VCVioFrontier/VCVioFrontier/Examples/ElGamal/Transport.lean (1)

  • theorem eval_reductionBody {G St : Type} [AddCommGroup G]

VCVioFrontier/VCVioFrontier/Examples/OneTimePad/Machine.lean (18)

  • abbrev WordMachine {α : Type} (input : α ↪ List Bool)
  • noncomputable abbrev WordMachine.output {α : Type} {input : α ↪ List Bool} {p}
  • noncomputable def encryptMachine : WordMachine encBits encryptWord
  • noncomputable def roundTripMachine : WordMachine encBits roundTripWord
  • noncomputable def xorMachine :
  • private theorem fairCoin_liftM :
  • private theorem keyWords_sampleBits (n : ℕ) :
  • theorem WordMachine.agrees {α : Type} {input : α ↪ List Bool} {p}
  • theorem WordMachine.output_law {α : Type} {input : α ↪ List Bool} {p}
  • theorem encryptMachine_rows {n : ℕ} (m₀ m₁ : BitVec n) :
  • theorem encryptMachine_uniform (words : MeasurableSpace (List Bool)) {n : ℕ} (msg : BitVec n) :
  • theorem encryptWord_certificate :
  • theorem keyWords_certificate :
  • theorem keyWords_linear_machine (n : ℕ) :
  • theorem roundTripMachine_correct {n : ℕ} (msg : BitVec n) :
  • theorem roundTripWord_certificate :
  • theorem xorMachine_decrypt {n : ℕ} (k msg : BitVec n) :
  • theorem xorMachine_exact {n : ℕ} (k msg : BitVec n) :

VCVioFrontier/VCVioFrontier/Examples/OneTimePad/Words.lean (18)

  • @[expose] def encryptWord (msg : List Bool) : OracleComp coinSpec (List Bool)
  • @[expose] def keyWords (n : ℕ) : OracleComp coinSpec (List Bool)
  • @[expose] def roundTripWord (msg : List Bool) : OracleComp coinSpec (List Bool)
  • @[expose] def tapeBits : QueryImpl coinSpec (StateT (List Bool) Option)
  • @[expose] def word {n : ℕ} (w : BitVec n) : List Bool
  • @[simp] theorem length_word {n : ℕ} (w : BitVec n) : (word w).length = n
  • private theorem fairCoinAnswer_eq :
  • theorem encryptWord_eq {n : ℕ} (msg : BitVec n) :
  • theorem encryptWord_law (words : MeasurableSpace (List Bool)) {n : ℕ} (msg : BitVec n) :
  • theorem encryptWord_rows (words : MeasurableSpace (List Bool)) {n : ℕ} (m₀ m₁ : BitVec n) :
  • theorem encryptWord_tapeBits {n : ℕ} (key msg : BitVec n) (rest : List Bool) :
  • theorem keyWords_eq (n : ℕ) :
  • theorem keyWords_succ (n : ℕ) :
  • theorem keyWords_tapeBits (key rest : List Bool) :
  • theorem keyWords_zero : keyWords 0 = pure []
  • theorem roundTripWord_eq {n : ℕ} (msg : BitVec n) :
  • theorem roundTripWord_law (words : MeasurableSpace (List Bool)) {n : ℕ} (msg : BitVec n) :
  • theorem word_xor {n : ℕ} (key msg : BitVec n) :

VCVioFrontier/VCVioFrontier/OracleComp/Measure.lean (5)

  • @[expose] noncomputable def fairBits : QueryImpl coinSpec _root_.ProbComp
  • theorem evalDist_eq_toMeasure {α : Type} [MeasurableSpace α] (p : _root_.ProbComp α) :
  • theorem evalDist_fairBits {α : Type} [MeasurableSpace α] (p : OracleComp coinSpec α) :
  • theorem eval_uniformSample (α : Type) [Fintype α] [SampleableType α] :
  • theorem probComp_eq (α : Type) : _root_.ProbComp α = Cslib.ProbComp α

VCVioFrontier/VCVioFrontier/OracleComp/Realization.lean (1)

  • theorem output_measure (M : MachineRealization H input encoding program) (a : α)

VCVioFrontier/VCVioFrontierTest/Examples/ElGamal/Branches.lean (6)

  • @[expose] def choose : _root_.ProbComp (ℤ × ℤ × ℤ)
  • @[expose] def guess (st : ℤ) (ct : ℤ × ℤ) : _root_.ProbComp Bool
  • @[expose] noncomputable def wrongGuess (F : PrimeOrderGroupFamily) (d : F.Desc) :
  • theorem distinguishFirst : Cslib.ProbComp.eval (elGamalAsymmEnc.oneTimeDDHReductionBody
  • theorem distinguishSecond : Cslib.ProbComp.eval (elGamalAsymmEnc.oneTimeDDHReductionBody
  • theorem incorrectGuessLoses (F : PrimeOrderGroupFamily) (n : ℕ) (d : F.Desc) :

VCVioFrontier/VCVioFrontierTest/Examples/ElGamal/State.lean (7)

  • @[expose] noncomputable def typed : TypedAdversary F desc
  • @[expose] noncomputable def words : Encryption.WordAdversary where
  • example (n a b : ℕ) (rest : List ℕ) (m : F.Carrier (desc n)) :
  • noncomputable def realization (hd : ComputableInPolyTime desc encUnary F.encDesc) :
  • private def drawTape : PFunctor.Handler (StateM (List ℕ)) (Honest.signature F)
  • theorem implemented_secure (hd : ComputableInPolyTime desc encUnary F.encDesc)
  • theorem secure (hd : ComputableInPolyTime desc encUnary F.encDesc)

VCVioFrontier/VCVioFrontierTest/Examples/OneTimePad.lean (10)

  • example (msg : List Bool) : encryptMachine.output msg =
  • example : (simulateQ tapeBits (encryptWord [false, true, false])).run
  • example : (simulateQ tapeBits (encryptWord [false, true])).run [true] = none
  • example : encryptMachine.output [false] = encryptMachine.output [true]
  • example : roundTripMachine.output [] = PMF.pure []
  • example : word (1 : BitVec 3) = [true, false, false]
  • example : xorMachine.output ([true, false, false], [false, true, false]) =
  • example : xorMachine.output ([true, false, false], [true, true, false]) =
  • example {n : ℕ} (key msg : BitVec n) (suffix : List Bool) :
  • example {n : ℕ} (m₀ m₁ : BitVec n) :

VCVioFrontier/VCVioFrontierTest/Tactics.lean (2)

  • example : Cslib.Probability.IsPPTOn encBits encBool
  • example {S : StepClass} (Q : QuantitativeStepClass S) {α β : Type} (a : S.Str α) (b : S.Str β)

sorry Tracking

  • No sorrys were added, removed, or affected.

📋 **Additional Analysis**

Findings

This is a large, structured pull request that adds the optional VCVioFrontier nested package and makes supporting changes across the repository. Below are the findings organized by the topics from the deployment-supplied instructions.


1. File Headers and Attribution

  • New files: All new .lean files in VCVioFrontier/ start with the standard header, e.g., Copyright (c) 2026 Devon Tuma.... This is correct.
  • New workflow file (.github/workflows/frontier.yml) and new Python scripts in VCVioFrontier/scripts/ correctly lack the Lean header, which is appropriate.
  • Routine edits: The diff modifies existing files (README.md, Examples/ElGamal/Basic.lean, Examples/ElGamal/Generic.lean, lakefile.lean, lake-manifest.json, Interop/lake-manifest.json, docs/design/computational-complexity.md, docs/design/repository-layout.md, scripts/CheckImports.lean, scripts/test-interop-isolation.py, scripts/test-validation.py, scripts/validate.sh). These are routine edits or substantial additions (README.md, docs) but do not replace the file's original purpose. No attribution rewrite is needed.
  • No AI-attribution lines are present in any file.

No violations found.


2. Documentation Expectations (Module Docstrings, Declaration Docstrings, Prologue Layout)

New files in VCVioFrontier/:

  • Every new .lean source file has a module docstring (/-! ... -/). The docstrings provide a concise title and summary. This meets the requirements.
  • Public definitions and major theorems have declaration docstrings (/-- ... -/) in many but not all cases. For instance:
    • VCVioFrontier/Examples/ElGamal/Reduction.lean: reductionSource has a docstring; ddhReduction, runRequest etc. also have docstrings (via @[expose]). This is good.
    • VCVioFrontier/Examples/OneTimePad/Words.lean: word, keyWords, encryptWord have docstrings. keyWords_zero, keyWords_succ do not, but these are implementation lemmas. The instruction says "major theorems" should have docstrings; given the project's style, minor private lemmas or simple rewrites can be omitted.
  • Prologue layout: The new files follow the prescribed layout: copyright header, blank line, module, imports, blank line, module docstring. One minor deviation observed in a few files:
    • VCVioFrontier/VCVioFrontier/Examples/ElGamal/Bound.lean: After the module docstring, there is a blank line, then public section. There is an extra blank line before open .... This is not a violation of the prologue layout (which only governs the top of the file).
  • Section headers: The files use /-! ## Section title -/ docstring headers, e.g., in VCVioFrontier/VCVioFrontier/OracleComp/Measure.lean and elsewhere. No ASCII banners are present in the new files.

Existing files modified:

  • docs/design/computational-complexity.md and docs/design/repository-layout.md are markdown, not Lean files, so the docstring rules don't apply. They are updated appropriately.
  • Examples/ElGamal/Basic.lean: The new oneTimeDDHReductionWith and IND_CPA_OneTime_branch additions are not given declaration docstrings. The existing file already had docstrings for oneTimeDDHReductionBody. The new abbrev and def are additions to an existing file. While the instructions say "Public definitions and major theorems should have declaration docstrings," the new abbrev in particular is a routine factoring. This is a minor omission but not a hard failure; the existing docstring for oneTimeDDHReductionBody already covers the pattern.
  • VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/OneTime.lean: The new IND_CPA_OneTime_branch and its theorem have docstrings. Good.

Suggestion: Add a brief docstring to oneTimeDDHReductionWith in Examples/ElGamal/Basic.lean for consistency.


3. Module Scopes / Section Headers / public section / Meta Sections

  • New files: All new files use public section (not @[expose] public section). This matches the instruction for new files: "new files use plain public section and expose individual definitions with @[expose] when unfolding is part of their intended public API." Indeed, many definitions are marked @[expose], e.g., in VCVioFrontier/Examples/ElGamal/Reduction.lean: reductionSource, ddhReduction. This is correct.
  • VCVioFrontier/VCVioFrontier.lean is an umbrella module; it uses public import for new modules. It has a module line (as required). The module docstring is present.
  • No backward.privateInPublic or backward.proofsInPublic are used.
  • import all is not used in any new file.
  • LatticeCryptoTest.lean is intentionally curated: The diff does not touch it, but the instruction about it is noted; not relevant to this PR.

No violations found.


4. Style / Mathlib Naming Conventions / ASCII Banners / set_option Linter Suppressions

  • Naming: The new code generally follows Mathlib conventions (snake_case for terms of Prop, UpperCamelCase for types). Examples: oneTimeChoice, typedBranch, ddhReduction, AdversaryRealization, PrimeOrderGroupFamily. There are a few instances where a function name might be debatable (e.g., carrierSampler is a local instance; that's fine). No obvious violations.
  • Imports are at the top of each file.
  • variable lines: The new files use variable lines in scopes. No omit lines are present; the variable usage is moderate. Not an issue.
  • set_option / linter disabling: No set_option lines are present in new files. The repo autoImplicit = false is set in lakefile.toml for VCVioFrontier (applied globally). This is correct per instructions ("Keep repo-wide Lean options in lakefile.lean. Do not restate autoImplicit = false with per-file set_option lines.")
  • No ASCII banners in any new Lean file.

No violations found.


5. Toolchain / Dependency Bumps / Manifest Alignment

  • lean-toolchain: The root toolchain is unchanged (still leanprover/lean4:v4.36.0? The diff does not touch it). VCVioFrontier/lean-toolchain sets leanprover/lean4:v4.36.0-rc2. This is different from the root. The instructions about toolchain bumps say: "The toolchain and Mathlib move together, and the other pins follow them...lake update --keep-toolchain". Having a different toolchain for the nested package is explicitly described in VCVioFrontier/README.md as intentional ("The nested package selects PolyFunFrontier and cslib-frontier on their own Lean 4.36.0-rc2, CSLib and Mathlib pins.")
  • PolyFun revision: Both lake-manifest.json (root) and Interop/lake-manifest.json are updated from 713d8857 to 01547e783a20b7c3acee3137acf96d6c7fabbb7b. The VCVioFrontier/lake-manifest.json also pins that same revision for PolyFun and PolyFunFrontier. The Interop/lake-manifest.json entry for PolyFun is updated and marked inherited: true. This is correct.
  • Mathlib revision: The root lake-manifest.json is not changed for mathlib. VCVioFrontier/lake-manifest.json pins its own mathlib revision. This is expected for a separate package.
  • scripts/CheckImports.lean: Added a check to skip .lake directories and to reject imports from CslibFrontier, PolyFunFrontier, VCVioFrontier in core sources. This is correct for isolation.
  • scripts/test-interop-isolation.py: Updated to allow some frontier imports and to test that .lake packages outside the source tree are ignored.
  • scripts/test-validation.py: Added a test that the frontier isolation scripts run in the default pass.
  • scripts/validate.sh: Added calls to the frontier isolation scripts.

No violations found.


6. Python Tooling / uv / CI Script Checks

  • The diff adds VCVioFrontier/scripts/check-pins.py and VCVioFrontier/scripts/test-pins.py. These are called from CI and the validation pass. They use Python 3.12 (via uv run --no-project --python 3.12 ...). The scripts themselves have a __main__ guard and use standard library only (except tomllib which is standard in 3.11+; the script declares 3.11+). This is fine.
  • The script check-pins.py has a --root-only flag, which is used in interop-isolation.yml and validate.sh to check isolation without fetching packages. Good.
  • The new workflow frontier.yml uses uv 0.13.6 as required.

No violations found.


7. Pull Request Checks / Merge Queue / Axiom Sweep / sorry debt

  • No sorry is introduced in the diff. The lake exe axiomsweep is configured for the new package with its own baseline. No violations.
  • The new .github/workflows/frontier.yml is a separate CI for the frontier package. It does not affect the main merge queue. The instructions about merge queue and async merge API are not directly relevant to this diff; no violation.

8. Documentation Cross-References and Roadmap Alignment

  • README.md is updated to mention VCVioFrontier.
  • docs/design/computational-complexity.md and docs/design/repository-layout.md are updated to reflect that VCVioFrontier now holds the concrete machine model role, consistent with the roadmap described in repository-layout.md.
  • The new VCVioFrontier/README.md cross-references the relevant VCVio source files and a PolyFun commit. This matches the documentation expectations.

No violations found.


Summary of Minor Suggestion (not a violation)

  • Examples/ElGamal/Basic.lean: The new oneTimeDDHReductionWith definition is not given a docstring. Consider adding a brief one for consistency with the surrounding code.

Overall verdict: The pull request follows the contribution guidelines closely. No blocking violations or deviations from the style guide, documentation expectations, toolchain rules, or module scoping conventions were found.


📄 **Per-File Summaries**
  • .github/workflows/frontier.yml: Added a new GitHub Actions workflow .github/workflows/frontier.yml named "VCVioFrontier" that triggers on push to main, pull requests, and manual dispatch for changes in specific paths (e.g., VCVioFrontier/, VCVio/, ToMathlib/, Examples/, lakefile.lean, script dependencies). It runs on ubuntu-latest and includes steps to free disk space, set up uv, restore and save cached .lake/packages, run a Python script to check dependency pins (check-pins.py), build the VCVioFrontier and VCVioFrontierTest packages, verify module completeness via lake exe mk_all, and check axioms and sorry debt against a baseline (axiom_baseline.json) using the axiomsweep command. This workflow enforces a CI pipeline that caches dependencies for efficiency, fails on missing module declarations, and prevents regressions in axiom usage or unproven sorrys.
  • .github/workflows/interop-isolation.yml: The interop-isolation workflow step that runs Python and shell scripts now also executes two additional scripts from the VCVioFrontier directory: check-pins.py --root-only (which verifies pin configurations at the root level) and test-pins.py (which tests those pinned configurations). This extends the pipeline to catch pin‑related issues during CI.
  • Examples/ElGamal/Basic.lean: Added a new abbreviation oneTimeDDHReductionWith that abstracts the pattern of choosing, sampling a coin, and checking the guess, and refactored oneTimeDDHReductionBody to use it, replacing its previous manual monadic chaining. Updated the proof of lemma IND_CPA_OneTime_DDHReduction_rand_half to include oneTimeDDHReductionWith in its simpa block for rewriting. No sorry or admit were introduced.
  • Examples/ElGamal/Generic.lean: In the proof of oneTimeDDHReduction_toOneTime_eq, the simp only block was extended to include the new lemma oneTimeDDHReductionWith, which is now applied alongside the existing IND_CPA_OneTime_DDHReduction, oneTimeDDHReductionBody, and other definitions.
  • README.md: Added a new bullet point in the README.md describing the optional VCVioFrontier package, which connects VCVio's security games to probabilistic Turing machines via PolyFun's polynomial interfaces and free programs. This clarifies the project's build boundaries and staged consolidation by documenting the role of this linking component.
  • VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/OneTime.lean: This diff adds two new declarations to OneTime.lean: a helper function IND_CPA_OneTime_branch that runs the adversary's guess given a fixed challenge bit (encrypting choice.1 when b is true and choice.2.1 otherwise, retaining the message-selection state), and a theorem IND_CPA_OneTime_Advantage_eq_boolDist which proves that the one-time IND-CPA advantage equals the boolDist between the distributions of IND_CPA_OneTime_branch false and IND_CPA_OneTime_branch true. The proof rewrites IND_CPA_OneTime_Game into the form uniformSample Bool >>= (fun b => IND_CPA_OneTime_branch a b) and applies evalDist_boolBias_bind_uniformBool and boolDist_comm. No sorry or admit are introduced.
  • VCVioFrontier/README.md: This README introduces the VCVioFrontier package, which implements frontier-style polynomial-time realizability for two core cryptographic proofs in VCVio. It documents the one-time pad example, explaining the encryptWord tree, simulateQ fold, fairBits handler, WordMachine.agrees, and oneTimePad.denote_coinOneTimePad_cipherGivenMsg_eq_uniform theorem proving ciphertext uniformity. It then documents the ElGamal IND-CPA reduction, detailing the reductionSource tree, incorrectGuessLoses encoded run, AdversaryRealization machine correspondence, wordScheme_efficient certification, and R.implemented_advantage_le bound of 2 * AdvDDH + 4 / 2^n. The README also provides full build instructions for the nested package, including pin checks, axiom sweeps, and the specific mk_all command.
  • VCVioFrontier/VCVioFrontier.lean: This new file serves as the top-level module re-exporting the entire VCVioFrontier library. It publicly imports 12 submodules covering cryptographic foundations (Asymptotics), ElGamal security proofs (Bound, Choice, Honest, HonestPrograms, Reduction, Security, Transport), one-time pad examples (Machine, Words), and oracle computation machinery (Measure, Realization). The file is intentionally minimal — a pure aggregation point with no new theorems, definitions, or proofs, and it contains no sorry or admit declarations.
  • VCVioFrontier/VCVioFrontier/CryptoFoundations/Asymptotics.lean: Summary unavailable — AI generation failed.
  • VCVioFrontier/VCVioFrontier/Examples/ElGamal/Bound.lean: This new file introduces definitions and theorems bounding the one-time ElGamal CPA advantage for bounded fair-coin algorithms. It defines typedBranch (a fixed-bit game for a TypedAdversary) and implementedAdversary (an IND-CPA adversary built from a WordAdversary). Key theorems include typedBranch_eval, wordGame_advantage_le (bounding the word game advantage by 2 * DDH advantage + 4/2^n), wordGame_secure (security under strict DDH), implementedAdversary_advantage (equality of advantages), and implemented_secureAgainst (security against word adversaries that realize a typed adversary). No sorries or admits are present.
  • VCVioFrontier/VCVioFrontier/Examples/ElGamal/Choice.lean: This new file adds two exposed definitions and a simp theorem for translating between VCVio and Frontier conventions in the two-stage ElGamal proof. oneTimeChoice extracts the true-branch message, false-branch message, and state from a ChoiceOut M under an encoding function, using Frontier's ordering where ChoiceOut.msg₁ is the true branch. encodeChoice packs a pair of encoded messages and a state into Frontier's ChoiceOut W with reversed message order. The theorem oneTimeChoice_encodeChoice proves that applying oneTimeChoice with the identity encoding to the result of encodeChoice recovers the original encoded messages and state, establishing the round-trip equivalence.
  • VCVioFrontier/VCVioFrontier/Examples/ElGamal/Honest.lean: Added the file Honest.lean which defines the wordScheme as an instance of AsymmEncAlg for ElGamal encryption using bounded fair-coin exponent sampling on word inputs, along with theorems wordScheme_keygen, wordScheme_encrypt, wordScheme_decrypt equating its components to Frontier's algorithms, wordScheme_efficient proving uniform PPT runtime, and wordScheme_decrypt_encrypt establishing decryption correctness for encoded group elements. The wordGame and bitGame are defined to express CPA security: wordGame_approximation bounds the distinguishing advantage between the bounded scheme and the ideal uniform-exponent game by 2/2^n, and wordGame_negligible (resp. wordGame_measure_negligible) shows that under DDH the two distributions are negligibly close in the standard (resp. measure) semantics. The bitAdversary bridges bit-valued messages, and bitAdversary_advantage relates its IND-CPA advantage to the distance of the bit games. Finally, bitGame_secure and bitAdversary_secure prove that under DDH the bit-game and the IND-CPA advantage are negligible for all PPT adversaries.
  • VCVioFrontier/VCVioFrontier/Examples/ElGamal/HonestPrograms.lean: This new file implements honest ElGamal programs over a bounded exponent sampler within the VCVioFrontier project. It defines an exponent request signature signature as a monomial, a sample handler using Frontier's bounded fair-coin sampler, and the honest algorithms exponent, keygen, encrypt, and decrypt as FreeM programs. Proofs liftM_exponent, liftM_keygen, liftM_encrypt, and liftM_decrypt relate these programs to Frontier's probabilistic computations, while fixedExponent and associated theorems (keygen_fixedExponent, encrypt_fixedExponent, decrypt_encrypt_fixedExponent) verify correctness with fixed exponents. Finally, theorems exponent_realized, keygen_realized, encrypt_realized, and decrypt_realized establish polynomial-time realizability under a computability assumption on the group description family desc.
  • VCVioFrontier/VCVioFrontier/Examples/ElGamal/Reduction.lean: This file introduces a one-time ElGamal reduction formalized as a program with three requests (choose, coin, guess), defining the Request inductive type, the signature abbreviation, the runRequest handler, and helper functions publicKey, challenge, reductionSource, and ddhReduction. It proves an operational equation (ddhReduction_eq), an evaluation equality to a fixed-bit distinguisher (eval_ddhReduction_fixedBits), the PPT realizability of the source program (reductionSource_realized), and the PPT property of the resulting distinguisher (ddhReduction_isPPT). These theorems establish the reduction from ElGamal security to the DDH assumption.
  • VCVioFrontier/VCVioFrontier/Examples/ElGamal/Security.lean: This new file VCVioFrontier/Examples/ElGamal/Security.lean defines the main security theorems connecting VCVio's one-time ElGamal typed adversary to a uniform machine DDH assumption. It introduces the structure AdversaryRealization that bundles an Encryption.WordAdversary, a PPT certificate, and encoding functions state satisfying choose and guess laws that preserve the joint message/state and output laws respectively. Building on this, it defines machine as the compiled machine realization and proves eval_reduction (the typed DDH reduction equals the compiled word reduction), eval_openOracle (the open reduction with adversary and fair-coin handlers matches the word implementation), machine_output_openOracle (machine output equals the encoded open reduction), exists_halting_machine (a single finite-control PPT machine realizes the reduction at all parameters), ddh_games (real and random DDH experiments equal the respective games under point setup), advantage_eq (the IND-CPA advantage equals twice the DDH game advantage), and negligible_advantage (if the point-setup DDH problem is hard, the typed adversary's advantage is negligible). The file also declares a local instance carrierSampler and the abbreviations typedScheme and TypedAdversary. No sorry or admit are present.
  • VCVioFrontier/VCVioFrontier/Examples/ElGamal/Transport.lean: This new file introduces a theorem eval_reductionBody that proves an equality relating the evaluation of the original ElGamal one-time DDH reduction body with that of a transported version using encoded group elements, state, and operations. The theorem formalizes that under appropriate encoding and guessing consistency hypotheses, the output distribution of the reduction is preserved when the adversary's choices and guesses are translated via encode, state, add, and pair. No sorry or admit appear in this file.
  • VCVioFrontier/VCVioFrontier/Examples/OneTimePad/Machine.lean: Adds a new file VCVioFrontier/VCVioFrontier/Examples/OneTimePad/Machine.lean defining multi-tape Turing machine realizations for the one-time pad. It introduces the WordMachine abbreviation for machines that compute word programs via uniform fair-coin sampling, with theorems WordMachine.agrees and WordMachine.output_law linking machine output to the probabilistic semantics. Concrete machines encryptMachine, roundTripMachine, and xorMachine are constructed from PPTProgram certificates (encryptWord_certificate, roundTripWord_certificate, and wordXor_polyTime), and their correctness is established: xorMachine_exact gives bitwise XOR on BitVec, xorMachine_decrypt shows decryption, encryptMachine_uniform and encryptMachine_rows prove ciphertext uniformity and independence from plaintext, and roundTripMachine_correct proves the round-trip machine outputs the original message with certainty. No sorries or admits appear in the diff.
  • VCVioFrontier/VCVioFrontier/Examples/OneTimePad/Words.lean: This new file Words.lean defines word-encoded versions of one-time pad programs and proofs for the VCVio project. It introduces word to encode BitVec n as List Bool (least-significant bit first), along with theorems length_word and word_xor. It defines keyWords (key generation via oneTimePad.coinBitVec), encryptWord (XOR with a key of matching length), roundTripWord (double-XOR decryption), and tapeBits (a query implementation using a tape of coin responses). Key theorems include keyWords_tapeBits and encryptWord_tapeBits (establishing simulation with the tape handler), encryptWord_eq (relating encryption to the VCVio perfect secrecy experiment), roundTripWord_eq (showing decryption recovers the original message), and encryptWord_law, encryptWord_rows, and roundTripWord_law (proving the pushforward uniform distribution and correctness). No sorry or admit are present.
  • VCVioFrontier/VCVioFrontier/OracleComp/Measure.lean: This new file bridges VCVio's finite-choice probability measures with CslibFrontier's PMF-based semantics. It adds four theorems—probComp_eq (type equality), evalDist_eq_toMeasure (measure equality via toMeasure), eval_uniformSample (uniform sampler equates to uniform PMF), and evalDist_fairBits (coin-request simulation preserves measure)—and one noncomputable definition fairBits (a QueryImpl that returns uniform booleans). The file establishes that VCVio's 𝒟 and CslibFrontier's Cslib.ProbComp.eval agree on every measurable event, grounding cross-library reasoning about probabilistic programs.
  • VCVioFrontier/VCVioFrontier/OracleComp/Realization.lean: This new file adds the theorem output_measure in the PFunctor.FreeM.MachineRealization namespace, which states that for a machine realization M of a handled oracle program, the output measure matches VCVio's evaluation of the encoded, handled source program when mapped through the encoding embedding. The proof relies on rewriting with output, M.encoded_law, evalDist_eq_toMeasure, and Cslib.ProbComp.eval_map, establishing the connection between machine semantics and VCVio's measure semantics. The module declarations include a public import of PolyFunFrontier.PFunctor.Free.Realization and VCVioFrontier.OracleComp.Measure, and the file header indicates this is part of the Uniform machines for handled oracle programs section.
  • VCVioFrontier/VCVioFrontierTest/Examples/ElGamal/Branches.lean: Summary unavailable — AI generation failed.
  • VCVioFrontier/VCVioFrontierTest/Examples/ElGamal/State.lean: This new file defines stateful honest ElGamal operations and a two-stage adversary for a machine-grounded security proof. It adds a private drawTape handler that consumes the first element of a tape, and an example theorem verifying that under fixed-exponent key generation and encryption, decryption still recovers the original message. It exposes typed, a stateful adversary whose state is the carrier element, choosing messages (0, public key, public key) and distinguishing by comparing the second ciphertext component with the stored state. It also exposes words, an encoded (word-based) adversary using dropFrame and F.encode. The realization theorem provides a AdversaryRealization connecting words to typed, including efficiency proofs via polytime tactics and a state equivalence using F.encode_injective. Two security theorems secure and implemented_secure then prove that typed (and consequently words) yields negligible IND-CPA one-time advantage under DDH and for the implemented bounded-coin scheme, respectively. No sorry or admit are present.
  • VCVioFrontier/VCVioFrontierTest/Examples/OneTimePad.lean: Adds OneTimePad.lean, a new example file that instantiates the one‑time pad machine definitions from VCVioFrontier.Examples.OneTimePad.Machine. It provides nine example blocks, many using the lemmas encryptWord_tapeBits, WordMachine.agrees, encryptMachine_rows, roundTripMachine_correct, xorMachine_exact, and xorMachine_decrypt. The examples demonstrate: (1) deterministic tape simulation (simulateQ tapeBits) for specific bit vectors, showing that the run yields the expected ciphertext and consumes the correct suffix; (2) a generic {n : ℕ} version of the tape lemma for arbitrary key msg : BitVec n; (3) equivalence of encryptMachine.output to Cslib.ProbComp.eval of a fair‑coin simulation via WordMachine.agrees; (4) indistinguishability of ciphertexts (encryptMachine_rows m₀ m₁); (5) that an undersized tape returns none; (6) a concrete bit‑vector literal example (word (1 : BitVec 3) = [true, false, false]); (7) correctness of the round‑trip machine on the empty message; (8) equality of encryptMachine.output for two different one‑bit messages; and (9) two concrete xorMachine outputs (xorMachine_exact and xorMachine_decrypt).
  • VCVioFrontier/VCVioFrontierTest/Tactics.lean: 新增文件 VCVioFrontier/VCVioFrontierTest/Tactics.lean,包含两个 example,演示了 ppt 策略在VCVio和Frontier中的互操作性。第一个示例通过假设 h 使用显式定量实现(Q.PolyRealizer),第二个示例验证了均匀布尔分布(Cslib.ProbComp.uniform Bool)的PPT性质(Cslib.Probability.IsPPTOn)。这些示例确认了两个策略库可以协同工作。
  • VCVioFrontier/lakefile.toml: This new file configures the VCVioFrontier Lake build, setting defaultTargets and testDriver, and enabling Lean options such as pp.unicode.fun, experimental.vcgen, and weak.linter.mathlibStandardSet while disabling auto-implicit. It declares dependencies on the local VCVio package, pinned revisions of PolyFunFrontier and PolyFun (both at commit 01547e7), cslib-frontier (at 87063d8), cslib (at 98f9a62), and mathlib (at bbff295). Two Lean libraries (VCVioFrontier and VCVioFrontierTest) are defined, each compiled with warningAsError = true, with the test library using globs to include all VCVioFrontierTest.+ modules.
  • VCVioFrontier/scripts/check-pins.py: Added a new script check-pins.py to VCVioFrontier/scripts that provides two core functions: (1) checking the consistency of pinned dependency revisions (PolyFun, PolyFunFrontier, cslib-frontier, cslib, mathlib) between lakefile.toml and the resolved lake-manifest.json, including verifying that PolyFun and PolyFunFrontier originate from the same commit, that the canonical PolyFun repository URL and subdirectory are used, and that the lean-toolchain and nested lockfiles of Peer packages (PolyFunFrontier, cslib-frontier) match the root; and (2) syncing those pins from a given PolyFun commit by updating lakefile.toml and lean-toolchain, then running lake update. The check_root function also guards against accidental resolution of optional Frontier dependencies in the stable VCVio root and ensures that the Interop lockfile correctly inherits the PolyFun revision. This script is essential for maintaining reproducible and consistent dependency versions across the VCVioFrontier project and its upstream dependencies.
  • VCVioFrontier/scripts/test-pins.py: Added a new unit-test file VCVioFrontier/scripts/test-pins.py that exercises the check_root and check functions from check-pins.py without requiring Lake package downloads. The tests simulate various lakefile.lean and lake-manifest.json scenarios—including comment-laden requires, optional dependencies, stale manifest entries, and mismatched rev, url, subDir, or inherited fields—to verify that the dependency-isolation fixtures correctly reject invalid configurations and enforce the canonical PolyFun remote for VCVioFrontier and its peers. This establishes automated coverage for the locking and inheritance constraints that prevent accidental drift in the project's pinned dependency graph.
  • docs/design/computational-complexity.md: The "Implementation snapshot" section gains a new paragraph introducing the optional VCVioFrontier package, which connects a uniform probabilistic machine model to the one-time pad and ElGamal oracle programs and provides typed, encoded reductions. The description of the removed VCVioComplexity package is updated to state that the VCVioFrontier package now connects closed handled programs to the machine model, replacing the previously planned cslib-frontier-based nested package. The description of the removed VCVioCslib library is also updated to clarify that its former nonuniform P/poly interface is distinct from the strict uniform machine results in VCVioFrontier, rather than its role moving to a planned package.
  • docs/design/repository-layout.md: The documentation in docs/design/repository-layout.md was updated to reflect the promotion of VCVioFrontier/ from a planned nested package to an actual top-level directory entry in the repository layout table, noting it is a nested package on PolyFunFrontier's Lean, CSLib, and Mathlib pins. The prose section on optional backends was correspondingly revised to describe the now-implemented VCVioFrontier package: it provides uniform machine realizations and security for probabilistic programs, using PolyFunFrontier's interpretation of polynomial free programs as multi-tape Turing machines, while the VCVio package connects their output laws to its measure semantics for security experiments, with a cross-reference to the package's README.
  • lakefile.lean: The lakefile.lean update advances the pinned commit of the PolyFun dependency from 713d8857e49d20927c1447b3ba7397acc5537319 to 01547e783a20b7c3acee3137acf96d6c7fabbb7b. This moves the project onto a newer revision of the PolyFun library, which may supply additional lemmas, refactored definitions, or bug fixes relevant to the codebase's verification targets.
  • scripts/CheckImports.lean: In scripts/CheckImports.lean, the sources function now skips .lake directories during recursive file discovery, and the allowed function blocks imports from any module whose head component is CslibFrontier, PolyFunFrontier, or VCVioFrontier. This prevents the import checker from traversing build artifacts and restricts certain module dependencies from being used in the verification project.
  • scripts/test-interop-isolation.py: Added three new forbidden-import edges to the test_isolation test case, covering cross-boundary imports involving Interop/Hax/X.lean importing CslibFrontier.Crypto.Game, VCVio.lean importing PolyFunFrontier, and Examples/X.lean importing VCVioFrontier.OracleComp.Measure – expanding the isolation coverage to additional module interactions. Also added a new test test_installed_dependencies_are_outside_the_interop_source_tree that verifies a file under .lake/packages/ (an installed dependency) is allowed to import CslibFrontier.Crypto.Game without triggering the isolation check, establishing that the isolation rules do not apply to dependencies outside the interop source tree.
  • scripts/test-validation.py: A new test method test_frontier_isolation_runs_in_the_default_pass was added to ensure that scripts in a VCVioFrontier/scripts directory (specifically check-pins.py and test-pins.py) execute during the default validation pass. The test_comment_fences setup now creates these stub scripts and their parent directory, establishing the test fixture. This change extends the test suite to cover a previously untested validation pathway for a subproject.
  • scripts/validate.sh: Added two new validation steps to the CI pipeline: running VCVioFrontier/scripts/check-pins.py --root-only and VCVioFrontier/scripts/test-pins.py. These steps incorporate pin configuration checking and testing for the VCVioFrontier subproject, ensuring these checks are performed during validation.
  • 5 file(s) filtered as noise (lockfiles, generated, or trivial): Interop/lake-manifest.json, VCVioFrontier/.gitignore, VCVioFrontier/lake-manifest.json, VCVioFrontier/lean-toolchain, lake-manifest.json

Last updated: 2026-11-21 17:08 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant