Skip to content

feat(interop): Squirrel's rules for ∼, name renaming and encryption - #1211

Draft
dtumad wants to merge 16 commits into
Verified-zkEVM:mainfrom
dtumad:dtumad/squirrel-s2
Draft

dtumad wants to merge 16 commits into
Verified-zkEVM:mainfrom
dtumad:dtumad/squirrel-s2

Conversation

@dtumad

@dtumad dtumad commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Stacks on #1210 (the foundations of Interop/Squirrel), and through it on #1209, #1207 and #1208 and
on Verified-zkEVM/PolyFun#513 and Verified-zkEVM/PolyFun#514, whose Term.heads layer this PR uses. Review the three commits on top of
#1210's head.

What this establishes

Rules for ∼ without a cryptographic assumption (Interop.Squirrel.Rules.Equiv), each a
theorem about Valid for every model restriction and every class of machines, and a constructor of
Derivation:

  • Refl, Sym, Trans; G.Equiv:FA-App, FA-Fn, G.Equiv:FA-Adv and BC14's FA; Restr, Perm (any
    type-preserving reindexing of positions) and Dup; If; rewriting an entry under an overwhelming
    equality [t = t']; BC14's Eq1.
  • The case split, LICS23's G.Case-Study:ITE, with BC14's If1 as an instance:
    c, t, u⃗ ∼ c', s, v⃗ and c, t', u⃗ ∼ c', s', v⃗ give
    if c then t else t', u⃗ ∼ if c' then s else s', v⃗.

Each proof names its reductions. FA, If, Restr, Perm and Dup each name one machine whose advantage
against the premise equals the attacker's against the conclusion at every η (advantage_app,
advantage_rename, …). The case split names Machine.guard true and Machine.guard false, and at
every η the attacker's advantage is at most the sum of theirs (advantage_cons_cond_le, factor
one). Rewriting costs the probability that the two vectors differ (advantage_le_add_prEvent_ne).

Name renaming (Interop.Squirrel.Rules.Rename): a closed vector is indistinguishable from its
renaming along any bijection of names, in every model, since renaming permutes the coordinates of the
honest tape and every machine has advantage zero.

Encryption from one-time IND-CPA (Interop.Squirrel.Rules.Enc): BC14's EncCCA1 without
decryption, in left-or-right form,

pk(nk), enc(m₀; r, pk(nk)), u⃗ ∼ pk(nk), enc(m₁; r, pk(nk)), u⃗

for messages and a context with the public key free. The hypotheses of Valid.equiv_enc are:
distinct key and coin names that the messages and the context do not use (syntactic); equal message
lengths in every admitted model, BC14's guard EQL holding surely; and one-time IND-CPA
(AsymmEncAlg.IND_CPA_OneTime_Advantage at ProbCompRuntime.probComp) for the named reduction
EncSymbols.encReduction of each admitted machine. The reduction draws both tapes, runs the
attacker's machine on the public key, the challenge and the context (Machine.simulate), and is
admissible for the length leakage (IND_CPA_OneTime_Adversary.IsAdmissible). At every η the
attacker's advantage equals the reduction's IND-CPA advantage (EncSymbols.advantage_challenge);
the coupling is SampleableType.prEvent_uniformSample_prod_update_update.

Machines and the class. Machines gain handlers (Machine.handle), Machine.simulate, and the
constructions rename, app, fn, subst, branch and const with their run, read-bound and
query-bound lemmas, from which the reductions ite, guard and adv are built. AdvClass gains
the closure fields rename_mem, subst_mem, app_mem, fn_mem, branch_mem and const_mem; each
docstring names the rules it serves and its polynomial-time counterpart, and AdvClass.all meets
all of them.

Freshness through heads (Interop.Squirrel.Avoids). A term avoids a set of names when none of
its heads, in the sense of PolyFun's Term.heads, is one of them (FTerm.AvoidsNames). The
condition is a fold over the term, so it is decidable, and decide discharges the encryption rule's
side conditions on concrete instances (EncInstance.Syntactic). PolyFun's Term.denote_update_eq
gives that such a term ignores the honest-tape coordinates of those names, with no induction over
terms. No rule here needs a semantic freshness condition.

The design record gains the field-to-rule table, the new rules and the obligations L7 (the case
split), L16 (renaming), L17 (encryption) and L22 (freshness, now syntactic and decidable).

Checks that the hypotheses are satisfiable and needed

  • The one-time pad meets every hypothesis of the encryption rule against AdvClass.all; so does a
    pad that leaks lengths, which fails the unrestricted IND-CPA game
    (WorkedEnc.lpad_advantage_unequalAdv).
  • pk(k), enc(n; r), n ∼ pk(k), enc(zero; r), n is derived in one step, its side conditions by
    decide, with its soundness (WorkedEnc.workedDerivation_sound).
  • Countermodels: a scheme that leaks the message, a key name equal to the coin name, coins in the
    context and a reused one-bit pad each break a conclusion; decide rejects the two instances whose
    syntactic conditions fail. The case split without the condition beside each branch is unsound,
    and neither premise of If1 may be dropped.
  • Each closure field of AdvClass.all is checked at a machine built by its construction.

Gaps met along the way

  • Interop/Squirrel/Syntax.lean: decide got stuck at instDecidableEqTy.decEq in other modules.
    The auxiliary function that deriving DecidableEq generates is not exposed under the module
    system. The instance is derived inside an @[expose] public section.
  • Interop/Squirrel/Rules/Enc.lean: the decidability of the four side conditions together exceeded
    synthInstance.maxSize. Explicit instances (FTerm.decidableAvoidsNames,
    EncInstance.decidableSyntactic) keep each search small.

Evidence

At the head of this branch, in Interop/Squirrel:

  • LEAN_NUM_THREADS=4 lake build and lake test: success, no warnings.
  • The axiom sweep over the library's roots, as CI runs it: 831 declarations in 12 modules, no
    sorry and no nonstandard axiom.
  • python3 scripts/test-interop-subprojects.py, scripts/check-interop-isolation.sh,
    scripts/check-comment-fences.py, scripts/check-agent-docs.py, scripts/check-doc-names.py
    and scripts/check-expose-boundary.sh: pass.

dtumad and others added 16 commits November 21, 2026 13:06
… unqueried cache entries

`OracleComp.runLog ans oa` is the query log of the run of `oa` answered by the fixed answer
function `ans`, with its bind, query, map, simulation and agreement laws, in the new
`QueryTracking/RunLog.lean`. `tableQueryLog` is `runLog` against its table.

`IsQueryBoundP.simulateQ_of_step_le` multiplies a predicate-targeted bound by the per-query cost
of a handler; `IsQueryBoundP.simulateQ_of_step` and `IsQueryBoundP.simulateQ_of_step_le_total`
follow from it. Query logging keeps predicate-targeted bounds and query predicates, and
`AllQueriesSatisfy.map_run_simulateQ_eq_of_query_map_eq` restricts the state-projection law to the
queries a program may make. From it, a cached run, and a run in the random oracle model, of a
program that never queries outside `P` returns the same results from caches agreeing on `P`.

`simulateQ_pure_eq_evalWithAnswerFn` answers queries with `pure` of fixed answers in any lawful
monad, and replaces the `X →ₒ Y` case in `VectorCommitment`. `ProbabilityBounds` gains a list
union bound, an implication bound, an `absDiff` split along a third event and a simp lemma for a
two-step null event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…negligibility and uniform-table lemmas

One-time IND-CPA: the fixed-branch experiment `IND_CPA_OneTime_Experiment`, the equation
`IND_CPA_OneTime_Advantage_eq_boolDist` (the one-time form of
`IND_CPA_Advantage_eq_boolDist_LR`), and admissibility of an adversary for a leakage function.
GenericLift's step-adversary bridge is restated per branch through the new equation.

Negligibility: `negligible_const_iff`, `not_negligible_one`, `negligible_list_sum`,
`negligible_pow_of_lt_one`, `negligible_two_rpow_neg_mul`.

Uniform samples: `prEvent_uniformSample_mem_le`, and overwriting one or two table coordinates of
a uniform pair (`prEvent_uniformSample_prod_update`, `prEvent_uniformSample_prod_update_update`).

Random functions: `prEvent_iterate_collision_le`, collisions among the first `n` iterates of a
uniform function, from the fresh-query bound.

ToMathlib: `ENNReal.absDiff_add_add_le`, `Nat.pow_clog_le_mul_add_one`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the package files, `Interop/Rust/` and `Interop/Hax/` into the new sub-project directory
`Interop/Aeneas/`, beside `ITree.lean` and `WP.lean`: `Interop/Rust/` becomes
`Interop/Aeneas/Lift/` and `Interop/Hax/` becomes `Interop/Aeneas/Hax/`. Renames only; the next
commit updates module names, paths and the package configuration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each directory `Interop/<Sub>/` is a sub-project with its own Lake package, trusted base,
assumptions and implementations. `Interop/Aeneas` is the first: the hax and Aeneas bridges, which
all rest on Aeneas's `RustM`.

- Package: `Interop/Aeneas/lakefile.toml` reads sources from the repository root
  (`srcDir = "../.."`), shares the root's packages (`packagesDir = "../../.lake/packages"`) and
  requires VCVio at `../..`. The package is `VCVioInteropAeneas`, with the libraries
  `InteropAeneas` and `InteropAeneasHaxExtraction`; requires, pins and options are unchanged.
- Modules: `Interop.Rust.*` becomes `Interop.Aeneas.Lift.*` and `Interop.Hax.*` becomes
  `Interop.Aeneas.Hax.*`. Declaration names are unchanged. The crates' `hax.toml` files extract
  into the new paths, and the committed extractions import the new module names.
- CI: the Interop job is a matrix over every `Interop/<Sub>/lakefile.toml`, listed by
  `scripts/interop-subprojects.py`. Each entry builds, runs `lake test` when the package has a
  test driver, and sweeps the roots of its default libraries for axioms.
- Isolation: a module of `Interop/<A>/` imports `Interop.<B>.…` only when `A B` is listed in
  `scripts/interop_import_allowlist.txt`, which lists nothing.
- Docs: `Interop/README.md` indexes the sub-projects, states their shared rules and fixes the
  README template that `Interop/Aeneas/README.md` follows; the agent guides, the repository layout
  and the script comments describe the new layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pins PolyFun at e67f9516 in the root lakefile and both manifests. The commit is the head of
Verified-zkEVM/PolyFun#514 (signature sums, `CBVInterpretation`, block renamings), stacked on
Verified-zkEVM#513 (`Term.heads`), and it exists only on the fork https://github.com/dtumad/PolyFun, so the
pin names the fork's URL. It is provisional: this commit is replaced by a real pin bump to the
merged upstream commit once PolyFun Verified-zkEVM#513 and Verified-zkEVM#514 merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the sub-project `Interop/Squirrel`, a Lake package that requires only VCVio. It embeds the
higher-order CCSA logic of the Squirrel prover (LICS 2023, with the order bounds of CSF 2024 and
CCS 2026) deeply on PolyFun's scoped syntax:

- `Syntax`: simple types with labels, declarations, and local terms as one `ScopedSignature`;
- `Model`: models over a uniform attacker tape of model-chosen length and an honest tape with one
  bit block per name and index; the pointwise reading, β and local rewriting;
- `RandomVariable`: local terms as random variables, and locality by PolyFun's relational fold;
- `Machine`: machines as `OracleComp` programs over a tape interface and an input interface, their
  runs and denotations, the input projection, and read and query bounds;
- `Indist`: advantage, the class of admitted machines `AdvClass` (membership only), the class
  `AdvClass.all` of machines with polynomial read and query bounds, `adv` and `∼`;
- `Global`: global formulas as the sum of the local and global signatures, their semantics,
  validity of global and local sequents, and G.Axiom, G.Weak, G.Cut, G.L-∀̃, G.R-∀̃, L.ByGlob and
  G.ByLoc;
- `Rules.Local`: L.R-∀;
- `Derivation`: derivations of these rules as data, and `Derivation.sound`.

The signature sum, block renamings and environment lemmas come from PolyFun, the run and
query-bound lemmas from VCVio's query tracking, and `not_negligible_one` from its asymptotics.

The test library, the package's `testDriver`, checks that validity is not trivial (`[false]` and
`true ∼ false` are not valid in the trivial model), that read and query bounds count tape reads
and input queries respectively with negative cases, and one small derivation per structural rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds `Interop/Squirrel/README.md` in the index's seven sections (trusted base: nothing beyond
Lean; implementations covered: none yet), the sub-project's row in `Interop/README.md`, and the
design record `docs/design/interop-squirrel.md`: scope and status, syntax and models, machines,
the class of machines and how it grows, validity, the proof pattern, derivations as data, the
rules proved (the structural rules of LICS23 Fig. 7) and the obligations that concern this code
(L10–L15, L19).

The papers the development cites (BC14, SP21, LICS23, CSF24, CCS26) and the Squirrel repository
go into `REFERENCES.md`. AGENTS.md, README.md and the interop agent guide mention the
sub-project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l namespace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prove sound the rules about indistinguishability that need no
cryptographic assumption (Refl, Sym, Trans, FA-App, FA-Fn, FA-Adv,
Restr, Perm, Dup, If, the case split, BC14's If1, rewriting under an
overwhelming equality, Eq1), name renaming in every model, and BC14's
EncCCA1 without decryption from one-time IND-CPA through the named
reduction EncSymbols.encReduction, with the advantages equal at every η.

Machines gain handlers, simulate, and the constructions rename, app,
fn, subst, branch and const with their run, read-bound and query-bound
lemmas, and the reductions ite, guard and adv. AdvClass gains the
closure fields rename_mem, subst_mem, app_mem, fn_mem, branch_mem and
const_mem, which AdvClass.all meets.

Freshness is syntactic: a term avoids a set of names when none of its
heads is one of them (PolyFun's Term.heads). The condition is
decidable, and Term.denote_update_eq gives that such a term ignores the
honest-tape coordinates of those names. Derivation gains a constructor
per rule and the parameter enc for the encryption instances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Satisfiability models and countermodels for the new rules: the one-time
pad and a pad that leaks lengths meet every hypothesis of the encryption
rule; reused randomness, a key equal to the coin, coins in the context,
a scheme leaking the message and the case split without its condition
each break a conclusion. The worked derivation
pk(k), enc(n; r), n ∼ pk(k), enc(zero; r), n is checked with its
soundness, its syntactic side conditions discharged by decide. Each new
closure field is met by AdvClass.all at a machine built by its
construction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The design record gains the constructions, the field-to-rule table of
the class of machines, the proof pattern of the new rules, syntactic
freshness through heads, the encryption rule's place in derivations,
the new rows of the rules table, and the obligations L7 (the case
split), L16 (name renaming), L17 (encryption) and L22 (freshness). The
README lists what the new modules and checks prove.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

🤖 PR Summary

ℹ️ Some sections were omitted to fit GitHub's comment size limit.

ℹ️ This PR modifies 2 file(s) under ToMathlib/ — consider whether a corresponding upstream PR is needed.

Interop/Squirrel: Indistinguishability Rules, Name Renaming, Encryption

Architecture & Restructuring

  • Interop/ directory is now a multi-sub-project layout. Previously, Interop/ contained a single package (VCVioInterop) with Hax/ and Rust/ subdirectories. This PR restructures it into two independent Lake packages:
    • Interop/Aeneas/ (moved from Interop/Rust/ and Interop/Hax/)
    • Interop/Squirrel/ (new sub-project)
  • CI is per-sub-project. The monolithic interop job in .github/workflows/build.yml is replaced by a dynamically generated matrix of jobs, one per sub-project. A new script (scripts/interop-subprojects.py) discovers sub-projects and their axiom-sweep roots.
  • Import isolation between Interop/ sub-projects. A new allowlist (scripts/interop_import_allowlist.txt) and a checker in scripts/CheckImports.lean enforce that cross-sub-project imports are explicitly permitted. The isolation rules are updated in .github/workflows/interop-isolation.yml.
  • Interop/Aeneas/ paths updated. All scripts (scripts/validate.sh, scripts/regenerate-hax.sh, scripts/test-interop-isolation.py) are updated to reflect the new Interop/Aeneas/Hax/ and Interop/Aeneas/Lift/ paths.

Core Formalization in Interop/Squirrel/ (New Sub-Project)

Syntax, Semantics, Model

  • Syntax.lean: Defines simple types (Ty), labels, local operators, and smart constructors for LTerm.
  • Global.lean: Defines FTerm/Form, global operators, interpretation, and validity predicates (Valid, LValid). Proves the global calculus rules (LICS23 Fig. 7).
  • Model.lean: Defines the Model structure, label predicates, and the interpretation function interp.
  • RandomVariable.lean: Defines random variables (RV M τ) and connects evaluation to rvInterp.
  • Avoids.lean: Defines a syntactic freshness condition FTerm.AvoidsNames (decidable). Proves that a term that avoids a name set is unaffected by updates to those names in the honest tape. No semantic freshness is needed.

Machines

  • Machine.lean: Defines a free program over Model.Iface with handlers (Handler), resource bounds (ReadsBelow, QueryBound), and constructions (rename, app, fn, subst, branch, const, ite, guard, adv). All constructions have run lemmas and bound-preservation theorems.

Indistinguishability

  • Indist.lean: Defines C.Indist u v (LICS23's u~v), C.Adv X, and the AdvClass structure with closure fields (rename_mem, subst_mem, app_mem, fn_mem, branch_mem, const_mem). Provides Indist.refl, .symm, .trans, .app, .fn, .adv, .ite, .rename, .tail, .dup, .caseStudy, .if1, .of_negligible_ne. AdvClass.all is a machine class that satisfies all closure fields.

Rule Sets

  • Derivation.lean: Inductive type encoding derivations of global sequents, with a soundness theorem Derivation.sound.
  • Rules/Local.lean: Proves the local universal introduction rule (local_all).
  • Rules/Equiv.lean: Proves all structural equivalence rules requiring no cryptographic assumption: equiv_refl, equiv_symm, equiv_trans, equiv_app, equiv_fn, equiv_adv, equiv_tail, equiv_dup, equiv_rename, equiv_ite, equiv_caseStudy, equiv_if1, equiv_rewrite, equiv_eq_self. Each proof names its reductions; FA, If, Restr, Perm, and Dup each name one machine whose advantage against the premise equals the attacker's against the conclusion at every η. The case split gives an inequality (factor one).
  • Rules/Rename.lean: Proves Valid.equiv_renameNames: a closed vector is indistinguishable from its renaming along any bijection of names (advantage zero).
  • Rules/Enc.lean: Proves the encryption rule Valid.equiv_enc: for distinct key and coin names that the messages and context do not use (syntactic), equal message lengths in every admitted model, and one-time IND-CPA for the reduction EncSymbols.encReduction. The reduction is admissible for the length leakage. At every η, the attacker's advantage equals the reduction's IND-CPA advantage. The coupling uses SampleableType.prEvent_uniformSample_prod_update_update.

Tests

  • Test/Validity.lean: Tests on a trivial model.
  • Test/Structural.lean: Tests of derivation constructions.
  • Test/Constructions.lean: Tests of machine constructions and AdvClass.all closure.
  • Test/Bounds.lean: Tests of resource bounds.
  • Test/CaseStudy.lean: Tests of Valid.equiv_caseStudy and Valid.equiv_if1.
  • Test/TwoTimePad.lean: Countermodels showing encryption randomness must be fresh.
  • Test/EncExamples.lean: Tests on concrete encryption schemes (pad, leaky), positive and negative.
  • Test/WorkedEnc.lean: A worked derivation with workedDerivation_sound. decide discharges the side conditions.

VCVio Library Additions (Supporting and General)

Cryptographic Games

  • VCVio/CryptoFoundations/OneTime.lean: Defines IND_CPA_OneTime_Experiment and IND_CPA_OneTime_Adversary.IsAdmissible. Proves IND_CPA_OneTime_Advantage_eq_boolDist.
  • VCVio/CryptoFoundations/GenericLift.lean: Replaces IND_CPA_stepAdversary_game_eq_hybridBranch with evalDist_IND_CPA_OneTime_Experiment_stepAdversary.

Oracle Machinery & Query Tracking

  • VCVio/OracleComp/RunLog.lean (new): Defines runLog ans oa — the list of queries produced when oa runs. Provides runLog_pure, runLog_bind, runLog_query, runLog_query_bind, runLog_map, compatibility with withQueryLog, and query predicate lemmas. This is used to redefine tableQueryLog in FreshQuery.lean.
  • VCVio/OracleComp/FreshQuery.lean: tableQueryLog is redefined as runLog (QueryImpl.ofFn g) oa. Proofs are simplified using runLog_* theorems.
  • VCVio/OracleComp/CachingOracle.lean: Two lemmas about caching results with withCaching respecting predicates.
  • VCVio/OracleComp/Simulation.lean: Adds OracleSpec.fst_map_run_simulateQ_romImpl_eq_of_allQueriesSatisfy. Adds IsQueryBoundP.simulateQ_of_step_le. Removes IsTotalQueryBound.isQueryBoundP and isQueryBoundP_true_iff (now derived).
  • VCVio/OracleComp/Basic.lean (QueryTracking): Adds isQueryBoundP_bind_le, allQueriesSatisfy_map_iff, evalWithAnswerFn_eq_of_allQueriesSatisfy, IsTotalQueryBound.isQueryBoundP, isQueryBoundP_true_iff.
  • VCVio/OracleComp/Core.lean: Adds isQueryBoundP_withQueryLog_iff and allQueriesSatisfy_withQueryLog_iff.
  • VCVio/Lifting/VectorCommitment/Basic.lean: Removes locally defined simulateQ_pure_eq_evalWithAnswerFn; now uses the lemma from SimulateQ.lean.
  • VCVio/Lifting/SimulateQ.lean: Adds simulateQ_pure_eq_evalWithAnswerFn.

Cryptographic Proofs

  • VCVio/IterateCollision.lean (new): Defines iterateQuery. Proves prEvent_iterate_collision_le: probability that two iterates of a random function from the same start point collide within n steps is ≤ n * (n / |α|).
  • VCVio/Negligible.lean: Adds negligible_const_iff, not_negligible_one, negligible_list_sum, negligible_pow_of_lt_one, negligible_two_rpow_neg_mul.
  • VCVio/ProbabilityBounds.lean: Adds prEvent_exists_list_le, prEvent_le_prEvent_add_prEvent_of_imp, absDiff_prEvent_le_absDiff_prEvent_and_not_add, prEvent_bind_bind_false.
  • VCVio/Measure.lean: Adds theorems about uniform sampling with overwriting (prEvent_uniformSample_mem_le, prEvent_uniformSample_prod_update, prEvent_uniformSample_prod_update_update).

ToMathlib and Infrastructure

ToMathlib

  • ToMathlib/Data/ENNReal/AbsDiff.lean: Adds ENNReal.absDiff_add_add_le (subadditivity of absDiff over sums).
  • ToMathlib/Data/Nat/Log.lean (new): Provides pow_clog_le_mul_add_one (b n : ℕ) : b ^ clog b n ≤ b * n + 1.

Scripts

  • scripts/interop-subprojects.py: Discovers sub-projects and extracts axiom-sweep roots.
  • scripts/CheckImports.lean: Cross-sub-project import checker.
  • scripts/interop_import_allowlist.txt: Allowlist for cross-sub-project imports.
  • scripts/test-interop-subprojects.py: Test suite for the new script.
  • scripts/validate.sh: Includes scripts/test-interop-subprojects.py.
  • scripts/test-interop-isolation.py: Updated paths and added test_imports_between_interop_subprojects.

VCVioTest/ Additions (Tests Only)

  • VCVioTest/Negligible.lean: Tests of new negligible lemmas.
  • VCVioTest/AsymmEncOneTime.lean: One-time IND-CPA sanity checks with a clear scheme clear.
  • VCVioTest/RunLog.lean: Test suite for runLog, query bounds, probability bounds.
  • VCVioTest/RandomOracleIterateCollision.lean: Tightness checks for the iterate-collision bound.
  • VCVioTest/SampleableTypeUpdate.lean: Tests of uniform sampling and table coupling.
  • VCVioTest/AbsDiff.lean: Strict subadditivity example for ENNReal.absDiff.
  • VCVioTest/NatLog.lean: Tests for Nat.clog 2 bounds.

Discrepancy: The PR title (Squirrel's rules for ∼, name renaming and encryption) describes the new Interop/Squirrel/ sub-project and its rule files. The test files in VCVioTest/ exercise supporting APIs (IND-CPA, RunLog, iteration) but do not directly implement Squirrel's rules. The PR body was empty.

sorry/admit Status

No new sorry or admit placeholders are introduced in any file in this PR. All new proofs are complete. The axiom sweep over the Interop/Squirrel/ sub-project (831 declarations) reports no sorry and no nonstandard axiom.

Documentation

  • docs/: Updated design document for the new Interop/ sub-project layout.
  • README.md, AGENTS.md, REFERENCES.md: Updated to reflect the multi-sub-project structure, import isolation, and new references.
  • scripts/check-comment-fences.py, scripts/test-comment-fences.sh, scripts/AxiomSweep.lean: Comments updated for the sub-project structure.

Statistics

Metric Count
📝 Files Changed 152
✅ Lines Added 8122
❌ Lines Removed 567

Lean Declarations

✏️ Removed: 4 declaration(s)

VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/GenericLift.lean (1)

  • private lemma IND_CPA_stepAdversary_game_eq_hybridBranch [Inhabited M]

VCVio/CryptoFoundations/VectorCommitment/Basic.lean (1)

  • theorem simulateQ_pure_eq_evalWithAnswerFn {m : Type → Type v} [Monad m] [LawfulMonad m]

VCVio/OracleComp/QueryTracking/QueryBound/Simulation.lean (2)

  • lemma isQueryBoundP_true_iff (oa : OracleComp spec α) (n : ℕ) :
  • theorem IsTotalQueryBound.isQueryBoundP {oa : OracleComp spec α} {n : ℕ}
✏️ Added: 627 declaration(s)

Interop/Squirrel/Avoids.lean (12)

  • @[expose] def AvoidsNamesAt (N : ((a : Ty B) × (b : Ty B) × D.Name a b) → Prop)
  • @[expose] def FTerm.AvoidsNames (N : ((a : Ty B) × (b : Ty B) × D.Name a b) → Prop)
  • @[expose] def Vec.AvoidsNames (N : ((a : Ty B) × (b : Ty B) × D.Name a b) → Prop)
  • @[expose] def headName : (fullSig D).Head → Option ((a : Ty B) × (b : Ty B) × D.Name a b)
  • @[instance_reducible] def positionFintype (τs : List (Ty B)) :
  • instance AvoidsNamesAt.decidablePred (N : ((a : Ty B) × (b : Ty B) × D.Name a b) → Prop)
  • instance FTerm.decidableAvoidsNames (N : ((a : Ty B) × (b : Ty B) × D.Name a b) → Prop)
  • instance GlobalOp.instFintypeArg {k : Kind B} (o : GlobalOp B k) :
  • instance Vec.decidableAvoidsNames (N : ((a : Ty B) × (b : Ty B) × D.Name a b) → Prop)
  • private def positions : (τs : List (Ty B)) → List ((τ : Ty B) × ScopedVar τs τ)
  • private theorem mem_positions : ∀ {τs : List (Ty B)} (x : (τ : Ty B) × ScopedVar τs τ),
  • theorem FTerm.denote_update_eq_of_avoidsNames

Interop/Squirrel/Derivation.lean (1)

  • theorem Derivation.sound (R : Model D → Prop) (C : ∀ M : Model D, AdvClass M)

Interop/Squirrel/Global.lean (66)

  • @[expose, reducible] def fullSig (D : Decl B) : ScopedSignature (Kind B)
  • @[expose, reducible] def globalSig (B : Type) : ScopedSignature (Kind B) where
  • @[expose] def Form.Holds (M : Model D) (C : AdvClass M) {Γ : List (Kind B)} (F : Form D Γ)
  • @[expose] def LValid (R : Model D → Prop) (C : ∀ M : Model D, AdvClass M) {Γ : List (Kind B)}
  • @[expose] def Overwhelming (T : TapeModel) (φ : (η : ℕ) → T.Tape η → Bool) : Prop
  • @[expose] def RV.IsConst {M : Model D} {τ : Ty B} (X : RV M τ) : Prop
  • @[expose] def Ty.Same (carrier : B → ℕ → Set (List Bool)) :
  • @[expose] def Valid (R : Model D → Prop) (C : ∀ M : Model D, AdvClass M) {Γ : List (Kind B)}
  • @[expose] def adv {τs : List (Ty B)} {β : Ty B} (t : FTerm D Γ (Ty.arrows τs β))
  • @[expose] def all (τ : Ty B) (F : Form D (.loc τ :: Γ)) : Form D Γ
  • @[expose] def and (F G : Form D Γ) : Form D Γ
  • @[expose] def app (f : FTerm D Γ (.arrow a b)) (x : FTerm D Γ a) : FTerm D Γ b
  • @[expose] def att (f : D.Att) : FTerm D Γ (D.attTy f)
  • @[expose] def bot : Form D Γ
  • @[expose] def box (φ : FTerm D Γ .bool) : Form D Γ
  • @[expose] def conj : List (FTerm D Γ .bool) → FTerm D Γ .bool
  • @[expose] def const (t : FTerm D Γ τ) : Form D Γ
  • @[expose] def eq (t u : FTerm D Γ a) : FTerm D Γ .bool
  • @[expose] def equiv {τs : List (Ty B)} (u v : Vec D Γ τs)
  • @[expose] def ex (τ : Ty B) (F : Form D (.loc τ :: Γ)) : Form D Γ
  • @[expose] def ff : FTerm D Γ .bool
  • @[expose] def fn (f : D.Fn a) : FTerm D Γ a
  • @[expose] def imp (F G : Form D Γ) : Form D Γ
  • @[expose] def ite (c : FTerm D Γ .bool) (t e : FTerm D Γ a) : FTerm D Γ a
  • @[expose] def lam (body : FTerm D (.loc a :: Γ) b) : FTerm D Γ (.arrow a b)
  • @[expose] def name (n : D.Name a b) (i : FTerm D Γ a) : FTerm D Γ b
  • @[expose] def not (F : Form D Γ) : Form D Γ
  • @[expose] def ptGlobal (M : Model D) (η : ℕ) : Interpretation (globalSig B) (Kind.PtValue M η)
  • @[expose] def tt : FTerm D Γ .bool
  • @[expose] noncomputable def FTerm.evalAt (M : Model D) (η : ℕ) (ρ : M.Tape η) {σ τ : Ty B}
  • @[expose] noncomputable def Vec.rv (M : Model D) (C : AdvClass M) {τs : List (Ty B)}
  • @[expose] noncomputable def fullInterp (M : Model D) (C : AdvClass M) :
  • @[expose] noncomputable def globalInterp (M : Model D) (C : AdvClass M) :
  • @[simp] theorem FTerm.denote_all {a : Ty B} (φ : FTerm D (.loc a :: Γ) .bool) :
  • @[simp] theorem FTerm.denote_app {a b : Ty B} (f : FTerm D Γ (.arrow a b)) (x : FTerm D Γ a) :
  • @[simp] theorem FTerm.denote_att (f : D.Att) :
  • @[simp] theorem FTerm.denote_eq {a : Ty B} (t u : FTerm D Γ a) :
  • @[simp] theorem FTerm.denote_ff :
  • @[simp] theorem FTerm.denote_fn {τ : Ty B} (f : D.Fn τ) :
  • @[simp] theorem FTerm.denote_ite {a : Ty B} (c : FTerm D Γ .bool) (t e : FTerm D Γ a) :
  • @[simp] theorem FTerm.denote_name {a b : Ty B} (n : D.Name a b) (i : FTerm D Γ a) :
  • @[simp] theorem FTerm.denote_tt :
  • @[simp] theorem Vec.rv_cons {τ : Ty B} {τs : List (Ty B)} (t : FTerm D Γ τ) (u : Vec D Γ τs) :
  • abbrev FTerm (D : Decl B) (Γ : List (Kind B)) (τ : Ty B)
  • abbrev Form (D : Decl B) (Γ : List (Kind B))
  • abbrev Vec (D : Decl B) (Γ : List (Kind B)) (τs : List (Ty B))
  • theorem FTerm.denote_substOne_apply (M : Model D) (C : AdvClass M) {σ τ : Ty B}
  • theorem Form.holds_adv {τs : List (Ty B)} {β : Ty B} {t : FTerm D Γ (Ty.arrows τs β)}
  • theorem Form.holds_all {τ : Ty B} {F : Form D (.loc τ :: Γ)} :
  • theorem Form.holds_and {F G : Form D Γ} :
  • theorem Form.holds_box {φ : FTerm D Γ .bool} :
  • theorem Form.holds_equiv {τs : List (Ty B)} {u v : Vec D Γ τs} {h : Ty.IndistOrder τs} :
  • theorem Form.holds_ex {τ : Ty B} {F : Form D (.loc τ :: Γ)} :
  • theorem Form.holds_imp {F G : Form D Γ} :
  • theorem Form.holds_not {F : Form D Γ} : (Form.not F).Holds M C env ↔ ¬ F.Holds M C env
  • theorem Form.not_holds_bot : ¬ (Form.bot : Form D Γ).Holds M C env
  • theorem Overwhelming.mono {T : TapeModel} {φ ψ : (η : ℕ) → T.Tape η → Bool}
  • theorem all_left {τ : Ty B} {G : Form D (.loc τ :: Γ)} (t : FTerm D Γ τ)
  • theorem all_right {τ : Ty B} {G : Form D (.loc τ :: Γ)}
  • theorem ax (h : F ∈ Θ) : Valid R C Θ F
  • theorem byGlob {φ : FTerm D Γ .bool} (Γl : List (FTerm D Γ .bool))
  • theorem byLoc {φ : FTerm D Γ .bool} (h : LValid R C Θ [] φ) : Valid R C Θ (.box φ)
  • theorem cut (h₁ : Valid R C Θ F') (h₂ : Valid R C (F' :: Θ) F) : Valid R C Θ F
  • theorem denote_weaken_cons {V : Kind B → Type} (alg : Interpretation (fullSig D) V)
  • theorem eval_denote_fullInterp (M : Model D) (C : AdvClass M) (η : ℕ) (ρ : M.Tape η)
  • theorem weaken (h : Valid R C Θ F) (hΘ : Θ ⊆ Θ') : Valid R C Θ' F

Interop/Squirrel/Indist.lean (48)

  • @[expose] def Adv (C : AdvClass M) {β : Ty B} (X : RV M (Ty.arrows τs β)) : Prop
  • @[expose] def Indist (C : AdvClass M) (u v : VecRV M τs) : Prop
  • @[expose] def Vals.tail (e : Vals M η (τ :: τs)) : Vals M η τs
  • @[expose] def adv (g : AttackerFn M τ) (A : Distinguisher M (τ :: τs)) : Distinguisher M τs
  • @[expose] def all (M : Model D) : AdvClass M where
  • @[expose] def app (u : VecRV M (.arrow a b :: a :: τs)) : VecRV M (b :: τs)
  • @[expose] def cons (X : RV M τ) (u : VecRV M τs) : VecRV M (τ :: τs)
  • @[expose] def dup (u : VecRV M (τ :: τs)) : VecRV M (τ :: τ :: τs)
  • @[expose] def fn (f : D.Fn τ) (A : Distinguisher M (τ :: τs)) : Distinguisher M τs
  • @[expose] def guard (c : Bool) (A : Distinguisher M τs) : Distinguisher M (.bool :: τs)
  • @[expose] def ite (u : VecRV M (.bool :: a :: a :: τs)) : VecRV M (a :: τs)
  • @[expose] def rename {τs' : List (Ty B)} (r : Renaming τs' τs) (u : VecRV M τs) : VecRV M τs'
  • @[expose] def tail (u : VecRV M (τ :: τs)) : VecRV M τs
  • @[expose] noncomputable def advantage (A : Distinguisher M τs) (u v : VecRV M τs) (η : ℕ) :
  • abbrev VecRV (M : Model D) (τs : List (Ty B)) : Type
  • private theorem prEvent_cons_cond (A : Distinguisher M (a :: τs)) (b : RV M .bool)
  • theorem Indist.adv {τs₀ : List (Ty B)} {β : Ty B} {X : RV M (Ty.arrows τs₀ β)} (hX : C.Adv X)
  • theorem Indist.app (ha : a.IsGround) {u v : VecRV M (.arrow a b :: a :: τs)} (h : C.Indist u v) :
  • theorem Indist.caseStudy {b b' : RV M .bool} {x y x' y' : RV M a} {u v : VecRV M τs}
  • theorem Indist.dup {u v : VecRV M (τ :: τs)} (h : C.Indist u v) : C.Indist u.dup v.dup
  • theorem Indist.fn (f : D.Fn τ) (h : C.Indist u v) :
  • theorem Indist.if1 {b b' : RV M .bool} {x y z : RV M a} {u v : VecRV M τs}
  • theorem Indist.ite {u v : VecRV M (.bool :: a :: a :: τs)} (h : C.Indist u v) :
  • theorem Indist.of_negligible_ne {u' : VecRV M τs}
  • theorem Indist.refl (u : VecRV M τs) : C.Indist u u
  • theorem Indist.rename {τs' : List (Ty B)} (r : Renaming τs' τs) (h : C.Indist u v) :
  • theorem Indist.symm (h : C.Indist u v) : C.Indist v u
  • theorem Indist.tail {u v : VecRV M (τ :: τs)} (h : C.Indist u v) : C.Indist u.tail v.tail
  • theorem Indist.trans (h₁ : C.Indist u v) (h₂ : C.Indist v w) : C.Indist u w
  • theorem adv_mem {τs₀ : List (Ty B)} {β γ : Ty B} {A : Machine M (Ty.arrows τs₀ β :: τs) γ}
  • theorem advantage_adv (g : AttackerFn M τ) (A : Distinguisher M (τ :: τs)) (u v : VecRV M τs) :
  • theorem advantage_app (A : Distinguisher M (b :: τs)) (u v : VecRV M (.arrow a b :: a :: τs)) :
  • theorem advantage_cons_cond_le (A : Distinguisher M (a :: τs)) (b b' : RV M .bool)
  • theorem advantage_fn (f : D.Fn τ) (A : Distinguisher M (τ :: τs)) (u v : VecRV M τs) :
  • theorem advantage_ite (A : Distinguisher M (a :: τs)) (u v : VecRV M (.bool :: a :: a :: τs)) :
  • theorem advantage_le_add_prEvent_ne (A : Distinguisher M τs) (u u' v : VecRV M τs) (η : ℕ) :
  • theorem advantage_rename {τs' : List (Ty B)} (r : Renaming τs' τs) (A : Distinguisher M τs')
  • theorem all_mem_input (y : ScopedVar τs a) (ha : a.IsGround) :
  • theorem all_mem_of_readsBelow_zero {β : Ty B} {A : Machine M τs β}
  • theorem guard_mem (c : Bool) {A : Machine M τs .bool} (hA : C.mem A) : C.mem (A.guard c)
  • theorem ite_mem {β : Ty B} {A : Machine M (a :: τs) β} (hA : C.mem A) : C.mem A.ite
  • theorem test_adv {τs₀ : List (Ty B)} {β : Ty B} (A : Machine M (Ty.arrows τs₀ β :: τs) .bool)
  • theorem test_app (ha : a.IsGround) (A : Machine M (b :: τs) .bool) :
  • theorem test_fn (f : D.Fn τ) (A : Machine M (τ :: τs) .bool) : (A.fn f).test = A.test.fn f
  • theorem test_guard (c : Bool) (A : Machine M τs .bool) : (A.guard c).test = A.test.guard c
  • theorem test_input (y : ScopedVar τs .bool) :
  • theorem test_ite (A : Machine M (a :: τs) .bool) : A.ite.test = A.test.ite
  • theorem test_rename (r : Renaming τs τs') (A : Machine M τs .bool) :

Interop/Squirrel/Machine.lean (96)

  • @[expose, reducible] def Model.Iface (M : Model D) (η : ℕ) (τs : List (Ty B)) :
  • @[expose, reducible] def Model.inSpec (M : Model D) (η : ℕ) (τs : List (Ty B)) :
  • @[expose] def AdvMachine.eval (A : AdvMachine M τs β) : AttackerFn M (Ty.arrows τs β)
  • @[expose] def Handler.EvalsTo (H : Handler M η τs τs') (ρa : M.TapeA η) (e : Vals M η τs')
  • @[expose] def Handler.QueryBound (H : Handler M η τs τs') (k : ℕ) : Prop
  • @[expose] def Handler.ReadsBelow (H : Handler M η τs τs') (n : ℕ) : Prop
  • @[expose] def Handler.fwd (r : Renaming τs τs') : Handler M η τs τs'
  • @[expose] def Handler.impl (H : Handler M η τs τs') :
  • @[expose] def InputImpl.ofVals {m : Type → Type} [Pure m] (v : Vals M η τs) :
  • @[expose] def Machine.QueryBound (A : Machine M τs β) (q : ℕ → ℕ) : Prop
  • @[expose] def Machine.ReadsBelow (A : Machine M τs β) (b : ℕ → ℕ) : Prop
  • @[expose] def Machine.ask (q : M.InQuery η τs) :
  • @[expose] def Machine.handle (H : ∀ η, Handler M η τs τs') (A : Machine M τs β) :
  • @[expose] def Machine.read (i : ℕ) : OracleComp (M.Iface η τs) Bool
  • @[expose] def Machine.run (A : Machine M τs β) (η : ℕ) (ρa : M.TapeA η) (e : Vals M η τs) :
  • @[expose] def Machine.simulate {ι : Type} {spec : OracleSpec ι} (A : Machine M τs β) (η : ℕ)
  • @[expose] def Machine.test (A : Machine M τs .bool) : Distinguisher M τs
  • @[expose] def Model.answer (M : Model D) (ρa : M.TapeA η) (e : Vals M η τs) :
  • @[expose] def Model.answerIn {ι : Type} {spec : OracleSpec ι} (M : Model D) (ρa : M.TapeA η)
  • @[expose] def Model.tapeBelow (M : Model D) {η : ℕ} {τs : List (Ty B)} (n : ℕ) :
  • @[expose] def adv {τs₀ : List (Ty B)} (A : Machine M (Ty.arrows τs₀ β :: τs) γ)
  • @[expose] def app (ha : a.IsGround) (A : Machine M (b :: τs) β) :
  • @[expose] def branch (x y : Machine M τs β) : Machine M (.bool :: τs) β

…and 477 more not listed.


sorry Tracking

  • No sorrys were added, removed, or affected.

Coverage Notes

  • Additional-instructions analysis was skipped because the full diff exceeded the analysis size budget, and partial results would be misleading.

Last updated: 2026-11-22 00:34 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