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

Đang mở
#504 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
12/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Lĩnh vực
cryptography

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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/.
Ngôn ngữ chính
Lean
Star
3
Fork
0
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
159

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của trailofbits/constructive-cryptography

Tất cả issue của trailofbits/constructive-cryptography

Issue tương tự

Thêm issue về Cryptography

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.