Repository navigation
Conversation
… 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>
… dtumad/squirrel-s1
…o dtumad/squirrel-s1
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>
🤖 PR Summary
Interop/Squirrel: Indistinguishability Rules, Name Renaming, EncryptionArchitecture & Restructuring
Core Formalization in
|
| 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 envtheorem Form.not_holds_bot : ¬ (Form.bot : Form D Γ).Holds M C envtheorem 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 Θ Ftheorem 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 Θ Ftheorem 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)) : Typeprivate 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.duptheorem 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 utheorem 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 utheorem Indist.tail {u v : VecRV M (τ :: τs)} (h : C.Indist u v) : C.Indist u.tail v.tailtheorem Indist.trans (h₁ : C.Indist u v) (h₂ : C.Indist v w) : C.Indist u wtheorem 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.itetheorem 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 ftheorem test_guard (c : Bool) (A : Machine M τs .bool) : (A.guard c).test = A.test.guard ctheorem test_input (y : ScopedVar τs .bool) :theorem test_ite (A : Machine M (a :: τs) .bool) : A.ite.test = A.test.itetheorem 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.
Stacks on #1210 (the foundations of
Interop/Squirrel), and through it on #1209, #1207 and #1208 andon Verified-zkEVM/PolyFun#513 and Verified-zkEVM/PolyFun#514, whose
Term.headslayer 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 atheorem about
Validfor every model restriction and every class of machines, and a constructor ofDerivation:type-preserving reindexing of positions) and Dup; If; rewriting an entry under an overwhelming
equality
[t = t']; BC14's Eq1.c, t, u⃗ ∼ c', s, v⃗andc, t', u⃗ ∼ c', s', v⃗giveif 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 namesMachine.guard trueandMachine.guard false, and atevery
ηthe attacker's advantage is at most the sum of theirs (advantage_cons_cond_le, factorone). 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 itsrenaming 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 withoutdecryption, in left-or-right form,
for messages and a context with the public key free. The hypotheses of
Valid.equiv_encare: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
EQLholding surely; and one-time IND-CPA(
AsymmEncAlg.IND_CPA_OneTime_AdvantageatProbCompRuntime.probComp) for the named reductionEncSymbols.encReductionof each admitted machine. The reduction draws both tapes, runs theattacker's machine on the public key, the challenge and the context (
Machine.simulate), and isadmissible for the length leakage (
IND_CPA_OneTime_Adversary.IsAdmissible). At everyηtheattacker'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 theconstructions
rename,app,fn,subst,branchandconstwith their run, read-bound andquery-bound lemmas, from which the reductions
ite,guardandadvare built.AdvClassgainsthe closure fields
rename_mem,subst_mem,app_mem,fn_mem,branch_memandconst_mem; eachdocstring names the rules it serves and its polynomial-time counterpart, and
AdvClass.allmeetsall of them.
Freshness through heads (
Interop.Squirrel.Avoids). A term avoids a set of names when none ofits heads, in the sense of PolyFun's
Term.heads, is one of them (FTerm.AvoidsNames). Thecondition is a fold over the term, so it is decidable, and
decidedischarges the encryption rule'sside conditions on concrete instances (
EncInstance.Syntactic). PolyFun'sTerm.denote_update_eqgives 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
AdvClass.all; so does apad 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), nis derived in one step, its side conditions bydecide, with its soundness (WorkedEnc.workedDerivation_sound).context and a reused one-bit pad each break a conclusion;
deciderejects the two instances whosesyntactic conditions fail. The case split without the condition beside each branch is unsound,
and neither premise of If1 may be dropped.
AdvClass.allis checked at a machine built by its construction.Gaps met along the way
Interop/Squirrel/Syntax.lean:decidegot stuck atinstDecidableEqTy.decEqin other modules.The auxiliary function that
deriving DecidableEqgenerates is not exposed under the modulesystem. The instance is derived inside an
@[expose] public section.Interop/Squirrel/Rules/Enc.lean: the decidability of the four side conditions together exceededsynthInstance.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 buildandlake test: success, no warnings.sorryand 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.pyand
scripts/check-expose-boundary.sh: pass.