RFC: Budget-free dependent Interface, cumulative CR18 Systems/Converters, and endomorphism Filters

Abierto
#504 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
12/100
Tipo de issue
Refactorización
Claridad
Necesita aclaración
Estado de actividad
Activo
Área
cryptography

Línea de trabajo

This is an architectural RFC, not a task: start by reading the v2 sketch of Interface, cumulative System A and two-sided Converter A B, then look at how the existing RandomSystems/Typed/ and RandomSystems/DDC/ layers use TypedSystem, IsDDCFrom and the global bound those types are meant to remove. Phase 0 is the gate — a single PR implementing the new core plus MonoidalCategory, ResourceTheory and CompatiblePseudoMetric instances, proving the interchange law on correlated System (B ⊗ D), keeping cc_normalize/cc_calc/cc_construct working unchanged, and checking endomorphism filter absorption. Done means those instances compile with only [propext, Classical.choice, Quot.sound]; only then do the later bridge and port phases (Commons/Definitions/, downstream sequence-cc) follow.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Background

Two early choices in RandomSystems force substantial Lean plumbing across the library and downstream consumers (e.g., sequence-cc):

  1. Flat port-tagged systems plus runtime subtype wrappers (TypedSystem, TypedGame): RandomSystem operates on untyped alphabets, encoding multi-port systems via Σ i : A.I, A.X i / Σ i : A.I, A.Y i. Preventing wrong-port replies required RepliesAtQueriedInterface (TypedSystem, ~55 files in RandomSystems/Typed/), and games added a second subtype (TypedGame, duplicating attachment, presentation, and ≡g/|≡ proofs).
  2. Global query bounds baked into Interface (domain, bound): Representing random systems via finitely-supported PDS distributions over complete functions List X →. Y forced a global query bound and [Fintype X] onto every Interface. Consequently, unbounded primitives (PRF, URF, URP, Sponge) splinter into incompatible q-indexed types, converters carry IsDDCFrom / MapsDomain certificates, and downstream code invents BoundedBytes, Limits, WorkInterface, and SeedInterface hacks.

In Maurer's Constructive Cryptography (CR18 / MR11 / MR16), every object is an extensional algebraic system in Type 0 with no query bounds forced on Interface or on information-theoretic distinguisher classes.

Proposed change

Adopt a budget-free, pure Maurer CR18 v2 core (introduced incrementally alongside v1 with a v2 → v1 truncation bridge, leaving Probability/, Commons/Schemes/, Commons/Tests/, and all cc_normalize/cc_calc/cc_construct/cc_substitute tactics untouched):

  1. Minimal dependent Interface:
    structure Interface where
      X : Type
      Y : X → Type
    
    Tensor is (A.X ⊕ B.X, fun | .inl a => A.Y a | .inr b => B.Y b) (abbrev combinators), unit 𝟙_ is Empty, with no I, domain, bound, or [Fintype X]. Eliminates TypedSystem, RepliesAtQueriedInterface, and BoundedBytes.
  2. Sub-probabilistic cumulative systems $P_R(y^i \mid x^i)$ in Type 0 (CR18 Def. 3.8):
    Represent System A directly by its cumulative mass Hist A → ℝ≥0 ($P([]) = 1$, $\sum_y P(h \cdot (x,y)) \le P(h)$), with Coe (∀ x, A.Y x) (System A) so plain functions coerce directly (sample k ←$ 𝒰[K]; F k without stateless/ofFunction). Step-kernels and ProbAutomaton are lightweight constructors; cumulative laws make System.ext plain funext, sample linear, and avoid Bayes normBelief division.
  3. Limits live in primitive bodies or explicit endomorphism filters $\varphi : A \to A$ (not in Interface or adversary classes $\mathcal{D}$):
    • Intrinsic limits (e.g., one-time key $\mathbf{K}$, single-use channel) live in that primitive's own body (mass $0$ / non-response past query $n$).
    • Unbounded primitives (PRF, PRP, URF, URP, Sponge, CBC) stay unbounded under one unbounded statistical pseudometric $\Delta$ (reserving $\mathcal{D}$ strictly for computational hardness).
    • External usage limits ($\varphi_q$, $\varphi_{\sigma,\ell}$, $\varphi_{\mathrm{pf}}$, $\varphi_{\mathrm{nr}}$) are true endomorphism filter converters $\varphi : A \to A$ (made possible by sub-probabilistic non-response, without A.withBot). Since $\varphi_q \cdot R$ and $\varphi_q \cdot S$ are silent past query $q$, $\Delta(\varphi_q \cdot R, \varphi_q \cdot S) = \Delta_q(\varphi_q \cdot R, \varphi_q \cdot S)$, and composition reduces to filter absorption ($\varphi_q \cdot \mathrm{CBC} \cdot \varphi_{bq} = \varphi_q \cdot \mathrm{CBC}$):
      $$\varphi_q \cdot \mathrm{CBC} \cdot \mathbf{P} = \varphi_q \cdot \mathrm{CBC} \cdot (\varphi_{bq} \cdot \mathbf{P}) \approx_{\varepsilon_1} \varphi_q \cdot \mathrm{CBC} \cdot (\varphi_{bq} \cdot \mathbf{F}) = \varphi_q \cdot \mathrm{CBC} \cdot \mathbf{F} \approx_{\varepsilon_2} \varphi_q \cdot \mathbf{R}.$$
  4. Two-sided cumulative converters $P_\alpha$ and distinguishers in Type 0:
    Define Converter A B extensionally as a two-sided cumulative system $P_\alpha$ with Maurer's bilinear attachment $P_{\alpha R}(h_{\text{out}}) = \sum_{h_{\text{in}}} P_\alpha(h_{\text{out}}, h_{\text{in}}) \cdot P_R(h_{\text{in}})$ — natively probabilistic (no SeedInterface), automatically acting on correlated System (B ⊗ C), giving ≫ associativity and ⊗ₘ interchange by Fubini, and keeping any inductive query-tree / do-syntax strictly as an internal constructor. Distinguishers are dual cumulative systems in Type 0.
  5. Games as a predicate, not TypedGame:
    Replace TypedGame with a [MonotoneMBO G] predicate on A.withMBO (Y' x := A.Y x × Bool), with G.visible = forgetMBO • G and liftMBO defined uniformly on all converters.
Acceptance criteria

Execute via phased coexistence (Path 2) (~10–14 PRs, estimated −20K to −23K net LOC in constructive-cryptography and −8.5K to −11K LOC in downstream sequence-cc), gated on Phase 0:

  1. Phase 0 (Architectural Gate — 1 PR):
    • Implement Interface, sub-probabilistic cumulative System A, two-sided cumulative Converter A B with bilinear attachment, and MonoidalCategory + ResourceTheory + CompatiblePseudoMetric instances for ConstructiveCryptography.
    • Prove the MonoidalCategory interchange law (α ▷ D) ≫ (A ◁ β) = (B ◁ β) ≫ (α ▷ C) on correlated System (B ⊗ D), verify cc_normalize / cc_calc / cc_construct work unmodified, and verify CR18 endomorphism filter absorption (φ_q' ≫ α ≫ φ_q = φ_q' ≫ α and φ_q ≫ φ_q = φ_q).
  2. Phase 1–2 (Core v2, Proof Engines & DSL):
    • Provide Coe for functions, ofStep/ProbAutomaton and internal tree/program constructors, MonotoneMBO + ≡g Fundamental Lemma, eagerURF = lazyURF bridge for [Fintype X], and non-dependent Hist (eval X Y) ≃ List (X × Y) helpers.
    • Port HCoefficient, RatioCost, RevealedHCoefficient, Coupling, UntilBad, SamplingDistance, and lightweight DSL/ notation.
    • Verify end-to-end adaptive URF/URP switching Δ (φ q • lazyURF X) (φ q • lazyURP X) ≤ q.choose 2 / |X| and CBC-MAC filter-absorption composition cleanly with zero axioms beyond [propext, Classical.choice, Quot.sound].
  3. Phase 3–4 (Bridge, Flagship Pilots & v1 Retirement):
    • Add v2 → v1 truncation bridge, port Commons/Definitions/ (PRF, CollisionBound, LazyPermutation, Indifferentiability, Sponge), validate on sequence-cc (eliminating WorkInterface, PublicPrimitive, PortRouting budgets, SeedInterface, and BoundedBytes), then retire RandomSystems/Typed/ and RandomSystems/DDC/.
Lenguaje dominante
Lean
Estrellas
3
Forks
0
Merge medio
1 d 2 h
PR fusionados (30 d)
159

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de trailofbits/constructive-cryptography

Todos los issues de trailofbits/constructive-cryptography

Issues similares

Más issues de Cryptography

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.