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>
…FreshL CCS26's u ⊬ v and u ▷ v as global formulas derived from ∀̃/∃̃, adv, ⇒̃/∧̃ and [·], read as AdvClass.NonDed and AdvClass.Ded, with the order bound Ty.SecrecyOrder. Prove sound the rules of CCS26 Fig. 3 other than Rw-Oracle and Pc-Oracle (Neg1, Neg2, Ineq, Trans, WeakL, WeakR, and Rw-Equiv at Boolean or base types), u ▷ f(u) from adv(f), the deductions of inputs, honest symbols, applications and rewritten terms, and local validity with modus ponens under [·]. Each rule is an inequality at every η with its reduction named. FreshR holds for a closed vector that does not use the name (syntactic freshness through Term.heads) when the name's type is large. FreshL follows CCS26's argument without extending the model: the reduction AdvMachine.freshL draws the fresh name from bits of the attacker tape above a polynomial read bound, and long tapes (Model.LongTapes) give those bits; at every large η the two success probabilities are equal. Its terms read the attacker tape below a polynomial (FTerm.ReadsPoly, discharged structurally). Machines gain the equality test, tape shifts and the name sampler, with run, read-bound and query-bound lemmas, and the reductions deduce, AdvMachine.comp and AdvMachine.freshL. AdvClass gains input_mem, eqTest_mem, shift_mem, sampler_mem and readBound_mem, which AdvClass.all meets. Derivation gains a constructor per rule and the parameter R₀, the model restriction that FreshL and local validity assume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Satisfiability models and countermodels for the secrecy rules. The worked derivation h(h(k)) ⊬ n from adv(h) uses FreshR, ▷ from adv, Trans and WeakL, with its freshness condition discharged by decide, and holds in a model where msg is large. ⊬ is not transitive; Neg1, Neg2, Ineq, Rw-Equiv and WeakR are each used, with checks that a premise is needed; FreshR fails without large and FreshL without freshness. A model with tapes of 2^η bits has long tapes and meets every hypothesis of FreshL together with AdvClass.all, where a worked derivation ends with FreshL. FreshL fails without long tapes: in a model with an empty attacker tape, against the class generated by the closure fields, its premise holds and its conclusion fails while its other hypotheses hold. Each new closure field is met by AdvClass.all at a machine built by its construction, and the read bound of a shifted machine is tight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…vate The evaluations and bounds of the tape reads and input fetches that the sampler is built from, and the renaming lemmas of the deduce, comp and freshL reductions, are used only in Machine.lean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The design record gains the secrecy judgments as derived formulas with their order fragment, the equality test, tape shifts and the sampler among the constructions, the field-to-rule rows of eqTest_mem, input_mem, shift_mem, sampler_mem and readBound_mem, the model conditions large, long tapes and polynomial bit blocks, the proof pattern of the secrecy rules, FreshR and FreshL, the parameter R₀ of derivations, the new rows of the rules table and the checks, and the obligations L18 (the predicates as derived formulas), L20 (FreshL and CCS26's footnote 2), L21 (Rw-Equiv at ground types), L23 (long tapes) and L24 (read bounds), with L12's polynomial conditions, L19 and L22 brought up to date. The README lists what the new modules and checks prove. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bound Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k ▷ h k follows from the deductions of an honest symbol, an entry and an application, with no adv hypothesis; h(h(k)) ▷ k is derived in a model where h is the identity, by the entry, local validity twice, modus ponens under [·] and rewriting, and Neg2 refutes h(h(k)) ⊬ k there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR Summary
Mathematical Formalization
Proof Completion (no
|
| Metric | Count |
|---|---|
| 📝 Files Changed | 161 |
| ✅ Lines Added | 11251 |
| ❌ 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: 871 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 (51)
@[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 Model.PolyCoins (M : Model D) (τ : Ty B) : 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_of_readsBelow_zero {β : Ty B} {A : Machine M τs β}theorem comp_mem {β γ : Ty B} {k : AdvMachine M [β] γ} {f : AdvMachine M τs β} (hk : C.mem k)theorem deduce_mem {β : Ty B} (hβ : β.IsGround) {g : AdvMachine M τs β} (hg : C.mem g) :theorem freshL_mem (p : Polynomial ℕ) {β : Ty B} (hb : b.order ≤ 1) (hc : M.PolyCoins b)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 (134)
@[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 AttackerFn.comp (k : AttackerFn M (.arrow β γ)) (f : 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 η)
…and 721 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 01:26 UTC.
Stacks on #1211 (Squirrel's rules for
∼, name renaming and encryption), and through it on #1210,#1209, #1207 and #1208 and on Verified-zkEVM/PolyFun#513 and Verified-zkEVM/PolyFun#514. Review
the commits on top of #1211's head.
What this establishes
The secrecy judgments (
Interop.Squirrel.Secrecy). CCS26 (§3.1) definesu⃗ ⊬ vandu⃗ ▷ vfrom the global connectives, and they are derived formulas here, not constructors:
Form.nonDed u vis∀̃ f. adv(f) ⇒̃ [¬ (f(u⃗) = v)]andForm.ded u vis∃̃ f. adv(f) ∧̃ [f(u⃗) = v], withfcurried over the tuple. Both carryTy.SecrecyOrder(entries and right side of order at most one), from which
f'sadvbound follows(
Ty.SecrecyOrder.advOrder).Form.holds_nonDedandForm.holds_dedread them asAdvClass.NonDed(every admitted attacker machine computesvwith negligible probability) andAdvClass.Ded(some admitted machine computes it with overwhelming probability).The rules of CCS26 Fig. 3 other than Rw-Oracle and Pc-Oracle (
Interop.Squirrel.Rules.Secrecy),each a theorem about
Validand a constructor ofDerivation, with its reduction named and aninequality at every
η:ηValid.not_ded,Valid.not_nonDeddeduceAdv g u v + deduceErr g u v = 1Valid.box_not_eqPr[v = w] ≤ deduceAdv g u v + deduceErr g u w,gthe witness ofu⃗ ▷ wValid.ded_transdeduceErr (k.comp f) u w ≤ deduceErr f u v + deduceErr k [v] wValid.nonDed_weakLdeduceAdv g [v] w ≤ deduceAdv (g.comp f) u w + deduceErr f u vValid.nonDed_weakRdeduceAdv g u w ≤ deduceAdv (k.comp g) u v + deduceErr k [w] vValid.nonDed_rwEquivdeduceAdv g u₁ v₁ ≤ deduceAdv g u₂ v₂ + advantage (Machine.deduce g).test (u₁, v₁) (u₂, v₂)u⃗ ▷ f(u⃗)fromadv(f)Valid.ded_apps0AdvMachine.compruns one attacker machine on the output of another on the same tape, andMachine.deduceruns the attacker machine on the left part of a vector and tests its resultagainst the last entry; Rw-Equiv is stated at ground types because no machine tests equality at an
arrow type.
Deductions and local reasoning (
Interop.Squirrel.Rules.Deduce):u⃗ ▷ uᵢandu⃗ ▷ ffor anentry or honest symbol of order at most one (failure
0),u⃗ ▷ fandu⃗ ▷ tgiveu⃗ ▷ f t(failure at most the sum),
u⃗ ▷ vand[v = v']giveu⃗ ▷ v'(plusPr[v ≠ v']). Localreasoning is read semantically:
Valid.box_validconcludes[φ]for a local formula true at everytape of every admitted model, and
Valid.box_mpis modus ponens under[·].FreshR (
Interop.Squirrel.Rules.Fresh):u⃗ ⊬ n(i)for a closed vector that does not use thename
n(FTerm.AvoidsNames, the syntactic condition of #1211, checked bydecide) whenn'stype is labelled
large. At everyηevery attacker function, admitted or not, computesn(i)with probability at most the sampler's largest point probability, so at most
2^{-cη}(
deduceAdv_nameAt_le). The closed vector is needed: a free variable ranges over all randomvariables, which may read the name.
FTerm.AvoidsNames.freshAtturns the syntactic condition intothe random variable's independence from the name's coordinate (
Model.FreshAt).FreshL by CCS26's argument, without extending the model (
Interop.Squirrel.TapeBounds,Interop.Squirrel.Rules.FreshL). The reductionAdvMachine.freshLanswers the fresh name's inputof the attacker machine by the name's sampler run on the bits
[p(η), p(η) + coinLen η b)of theattacker tape (
Machine.shift,Machine.sampler), withpthe sum of the read bounds of themachine and of the terms. Wherever that block fits on the tape, swapping it with the name's
honest-tape coordinate is a bijection of the tapes, so the two success probabilities are equal
(
deduceAdv_freshL_eq); long tapes (Model.LongTapes) make that hold at every largeη.CCS26's footnote 2 instead extends the attacker tape in a new model and applies the premise there,
which needs the hypotheses
Θto hold in that model; here the premise is used in the model wherethe conclusion is evaluated.
Valid.nonDed_freshLtakes: long tapes and polynomial bit blocks forthe name's type (
Model.PolyCoins) on the model restriction; terms that read the attacker tapebelow a polynomial in every admitted model of
Θ(FTerm.ReadsPoly, discharged constructor byconstructor and from
advhypotheses); and closed terms that do not use the name.Machines and the class. Machines gain the equality test (
Machine.eqTest, computable throughthe decidable equality of Booleans and bitstrings,
Ty.decEqValue), tape shifts and the namesampler, with run, read-bound and query-bound lemmas, and the reductions
Machine.deduce,AdvMachine.compandAdvMachine.freshL.AdvClassgainsinput_mem,eqTest_mem,shift_mem,sampler_memandreadBound_mem, each docstring naming its rules and polynomial-time counterpart;AdvClass.allmeets all of them. The input projection is now a field, so the theoremAdvClass.all_mem_inputgives way to(AdvClass.all M).input_mem.Model.PolyCoinssits besideAdvClassinIndist.leanbecausesampler_memmentions it. The query bound and the guessingmachine stay out of the class until a rule uses them.
Derivations.
Derivationgains a constructor per rule and the parameterR₀, the modelrestriction its rules assume: FreshL's constructor asks
R₀for long tapes and polynomial bitblocks, and
boxValidfor a formula true in every model ofR₀.Derivation.soundholds overevery restriction contained in
R₀; the existing checks takeR₀to be every model.The design record gains the order fragment of
⊬and▷, the field-to-rule rows of the newfields, the model conditions, the proof pattern of the secrecy rules, FreshR and FreshL, the new
rules and checks, and the obligations L18 (the predicates as derived formulas), L20 (FreshL and the
gap in CCS26's footnote 2, App. C.2, p. 17), L21 (Rw-Equiv at ground types), L23 (long tapes) and
L24 (read bounds), with L12 (polynomial bit blocks and samplers, now stated as conditions), L19 and
L22 brought up to date.
Checks that the hypotheses are satisfiable and needed
h(h(k)) ⊬ nis derived fromadv(h)by FreshR,▷fromadv, Trans and WeakL, its freshnesscondition by
decide, and holds in a model wheremsgis large (SecrecyExamples.valid_worked).⊬is not transitive:n ⊬ mandm ⊬ nhold andn ⊬ nfails.check that a premise is needed. FreshR fails without
large(a Boolean name is guessed withprobability one half), and FreshL fails without freshness.
k ▷ h kfollows from the deductions alone, with noadvhypothesis, andh(h(k)) ▷ kisderived in a model where
his the identity, by the entry, local validity, modus ponens under[·]and rewriting (SecrecyExamples.rewriteDerivation_sound).2^ηbits, every hypothesis of FreshL holds againstAdvClass.all, and aworked derivation
h(h(a)), m ⊬ nends with FreshL (FreshLExamples.valid_freshLWorked); withnin place ofmthe conclusion fails.FreshLCountermodel.freshL_needs_longTapes): in a model with an emptyattacker tape, against the least class closed under the constructions of the closure fields, its
premise
[] ⊬ mholds and its conclusionn ⊬ mfails, while its other hypotheses hold. Theinvariant is that on inputs without
[true]no generated machine outputs[true].AdvClass.allat a machine built by its construction; the equalitytest tells
truefromfalse, and a shifted read's bound is tight.Gaps met along the way
Interop/Squirrel/Machine.lean(run_eqTest):simpdoes not rewrite the values underdecidewhen theDecidableinstance depends on them (Ty.decEqValue hβ x y). Fixed bydecide_eq_decideafter the rewrite.Interop/Squirrel/Rules/Fresh.lean(FTerm.AvoidsNames.freshAt):Function.updateon thereducible honest-tape type left
DecidableEq ?mstuck. Fixed by giving the codomain familyexplicitly.
Interop/Squirrel/Test/Constructions.lean:simulateQ_spec_querydoes not fire onMachine.readundersimulateQ (Machine.shiftImpl _), so a shifted read's queries cannot beread off syntactically. The tightness of its read bound is shown semantically instead, by two
tapes that differ only at bit
1; a lemmasimulateQ (shiftImpl n) (read i) = read (n + i)would allow the syntactic form.
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.