Documentation

ArkLib.ProofSystem.Binius.RingSwitching.Prelude

Ring-Switching IOP Prelude #

This module contains the core definitions and infrastructure for the ring-switching IOP, including tensor algebra operations, field extension handling, and basic protocol types.

Main Components #

  1. Tensor Algebra operations: Operations for handling tensor products between small field K and large field L, including embeddings φ₀ : L → L ⊗[K] L, φ₁ : L → L ⊗[K] L, and row/column decompositions with respect to a K-basis β.
  2. Protocol Types: Statement and witness types for each phase
  3. Security Definitions: Relations & Kstate for security analysis

Enhanced Tensor Algebra Operations #

Additional tensor algebra operations for the enhanced protocol specification. Based on the tensor algebra theory from Section 2.1.

@[reducible, inline]
abbrev Binius.RingSwitching.TensorAlgebra (K : Type u_1) (L : Type u_2) [Field K] [Field L] [Algebra K L] :
Type u_2

Tensor Algebra A = L ⊗_K L. Based on the spec, it's viewed as (2^κ)x(2^κ) arrays of K-elements. The imported TensorAlgebra file provides the leftAlgebra instances.

Instances For
    def Binius.RingSwitching.φ₀ (L : Type u_1) (K : Type u_2) [Field K] [Field L] [Algebra K L] :

    Column embedding φ₀: L → A as a ring homomorphism. φ₀(α) = α ⊗ 1, operates on columns.

    Instances For
      def Binius.RingSwitching.φ₁ (L : Type u_1) (K : Type u_2) [Field K] [Field L] [Algebra K L] :

      Row embedding φ₁: L → A as a ring homomorphism. φ₁(α) = 1 ⊗ α, operates on rows.

      Instances For
        noncomputable def Binius.RingSwitching.decompose_tensor_algebra_rows (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] {σ : Type u_1} (β : Module.Basis σ K L) (s_hat : TensorAlgebra K L) :
        σL

        Decompose ŝ into row components (ŝ =: Σ_{u ∈ {0,1}^κ} β_u ⊗ ŝ_u). This views L ⊗ L as a module over L (left action) and finds the coordinates of ŝ with respect to the basis lifted from β.

        Instances For
          noncomputable def Binius.RingSwitching.decompose_tensor_algebra_columns (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] {σ : Type u_1} (β : Module.Basis σ K L) (s_hat : TensorProduct K L L) :
          σL

          Decompose ŝ into column components (ŝ =: Σ_{v ∈ {0,1}^κ} ŝ_v ⊗ β_v). This views L ⊗ L as a module over L (right action) and finds the coordinates of ŝ with respect to the basis lifted from β.

          Instances For
            noncomputable def Binius.RingSwitching.packMLE (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (ℓ' : ) (h_l : = ℓ' + κ) (β : Module.Basis (Fin κFin 2) K L) (t : (BinaryBasefold.MultilinearPoly K )) :

            Definition 2.1 (MLE packing). Packs a small-field multilinear t into a large-field multilinear t' by reinterpreting chunks of 2^κ coefficients as single L-elements. For each w ∈ {0,1}^ℓ', the evaluation t'(w) is defined as: t'(w) := ∑_{v ∈ {0,1}^κ} t(v₀, ..., v_{κ-1}, w₀, ..., w_{ℓ'-1}) ⋅ β_v

            Instances For
              noncomputable def Binius.RingSwitching.unpackMLE (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (ℓ' : ) (h_l : = ℓ' + κ) (β : Module.Basis (Fin κFin 2) K L) (t' : (BinaryBasefold.MultilinearPoly L ℓ')) :

              Unpacking a Packed Multilinear Polynomial. Reverses the packing defined in packMLE. It reconstructs the small-field multilinear t from the large-field multilinear t'.

              The evaluation of t at a point (v, w) is recovered by taking the evaluation of t' at w, which is an element of L, and finding its v-th coordinate with respect to the basis β.

              Instances For

                Component-wise φ₁ embedding. Takes a polynomial t' with coefficients in L and embeds it into a polynomial with coefficients in the tensor algebra A by applying φ₁ to each coefficient. This is achieved by using MvPolynomial.map.

                Instances For

                  Enhanced Protocol Type Definitions (Interfaces between phases) #

                  We define the Statement and Witness types at the boundaries of each phase following the enhanced specification.

                  @[reducible, inline]
                  Instances For
                    structure Binius.RingSwitching.WitMLP (K : Type) [Field K] ( : ) :
                    Instances For
                      structure Binius.RingSwitching.BatchingWitIn (L : Type) [Field L] (K : Type) [Field K] (ℓ' : ) :
                      Instances For
                        • t_eval_point : Fin L
                        • original_claim : L
                        Instances For
                          Instances For
                            structure Binius.RingSwitching.SumcheckWitness (L : Type) [Field L] (ℓ' : ) (i : Fin (ℓ' + 1)) :
                            Instances For
                              structure Binius.RingSwitching.MLIOPCSStmt (L : Type) (ℓ' : ) :
                              • point : Fin ℓ'L
                              • evaluation : L
                              Instances For
                                def Binius.RingSwitching.MLPEvalRelation (L : Type) [Field L] (ℓ' : ) (ιₛᵢ : Type) (OStmtIn : ιₛᵢType) (input : (MLPEvalStatement L ℓ' × ((j : ιₛᵢ) → OStmtIn j)) × WitMLP L ℓ') :

                                Standard input relation for MLIOPCS: polynomial evaluation at point equals claimed evaluation

                                Instances For
                                  structure Binius.RingSwitching.AbstractOStmtIn (L : Type) [Field L] (ℓ' : ) :
                                  Instances For
                                    def Binius.RingSwitching.AbstractOStmtIn.toRelInput (L : Type) [Field L] (ℓ' : ) (aOStmtIn : AbstractOStmtIn L ℓ') :
                                    Set ((MLPEvalStatement L ℓ' × ((j : aOStmtIn.ιₛᵢ) → aOStmtIn.OStmtIn j)) × WitMLP L ℓ')
                                    Instances For
                                      Instances For
                                        @[implicit_reducible]
                                        instance Binius.RingSwitching.instOstmtMLIOPCS (L : Type) [Field L] (ℓ' : ) (aOStmtIn : AbstractOStmtIn L ℓ') (i : aOStmtIn.ιₛᵢ) :
                                        noncomputable def Binius.RingSwitching.embedded_MLP_eval (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (ℓ' : ) (h_l : = ℓ' + κ) (t' : (BinaryBasefold.MultilinearPoly L ℓ')) (r : Fin L) :

                                        Compute the tensor value ŝ := φ₁(t')(φ₀(r_κ), ..., φ₀(r_{ℓ-1}))

                                        Instances For
                                          noncomputable def Binius.RingSwitching.performCheckOriginalEvaluation (κ : ) (L : Type) [Field L] [DecidableEq L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (h_l : = ℓ' + κ) (s : L) (r : Fin L) (s_hat : TensorAlgebra K L) :

                                          Step 2 (V): Check 1: s ?= Σ_{v ∈ {0,1}^κ} eqTilde(v, r_{0..κ-1}) ⋅ ŝ_v.

                                          Instances For
                                            noncomputable def Binius.RingSwitching.compute_A_func (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (original_r_eval_suffix : Fin ℓ'L) (r''_batching : Fin κL) :
                                            (Fin ℓ'Fin 2)L

                                            Step 4a: For each w ∈ {0,1}^{ℓ'}, P decompose eq̃(r_κ, ..., r_{ℓ-1}, w_0, ..., w_{ℓ'-1}) =: Σ_{u ∈ {0,1}^κ} A_{w, u} ⋅ β_u. P define the function A: w ↦ Σ_{u ∈ {0,1}^κ} eq̃(u_0, ..., u_{κ-1}, r''_0, ..., r''_{κ-1}) ⋅ A_{w, u} on {0,1}^{ℓ'}.

                                            Instances For
                                              noncomputable def Binius.RingSwitching.compute_A_MLE (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (original_r_eval_suffix : Fin ℓ'L) (r''_batching : Fin κL) :

                                              Step 4b: P writes A(X_0, ..., X_{ℓ'-1}) for its multilinear extension of A_func.

                                              Instances For
                                                def Binius.RingSwitching.getEvaluationPointSuffix (κ : ) (L : Type) (ℓ' : ) (h_l : = ℓ' + κ) (r : Fin L) :
                                                Fin ℓ'L
                                                Instances For
                                                  noncomputable def Binius.RingSwitching.RingSwitching_SumcheckMultParam (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (h_l : = ℓ' + κ) :

                                                  Ring-Switching multiplier parameter for sumcheck, using A_MLE as the multiplier.

                                                  Instances For
                                                    noncomputable def Binius.RingSwitching.compute_s0 (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (s_hat : TensorAlgebra K L) (r''_batching : Fin κL) :
                                                    L

                                                    Step 5 (V): Compute s₀ := Σ_{u ∈ {0,1}^κ} eqTilde(u, r'') ⋅ ŝ_u, where ŝ_u is the row components of ŝ.

                                                    Instances For
                                                      noncomputable def Binius.RingSwitching.compute_final_eq_tensor (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (ℓ' : ) (h_l : = ℓ' + κ) (r : Fin L) (r' : Fin ℓ'L) :

                                                      Compute the tensor e := eq̃(φ₀(r_κ), ..., φ₀(r_{ℓ-1}), φ₁(r'_0), ..., φ₁(r'_{ℓ'-1}))

                                                      Instances For
                                                        noncomputable def Binius.RingSwitching.compute_final_eq_value (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (h_l : = ℓ' + κ) (r_eval : Fin L) (r'_challenges : Fin ℓ'L) (r''_batching : Fin κL) :
                                                        L

                                                        Decompose the final eq tensor e := Σ_{u ∈ {0,1}^κ} eq̃(u, r'') ⨂ e_u, where e_u is the row components of e. Then compute Σ_{u ∈ {0,1}^κ} eq̃(u_0, ..., u_{κ-1}, r''_0, ..., r''_{κ-1}) ⋅ e_u.

                                                        Instances For
                                                          def Binius.RingSwitching.witnessStructuralInvariant (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (h_l : = ℓ' + κ) {i : Fin (ℓ' + 1)} (stmt : BinaryBasefold.Statement (RingSwitchingBaseContext κ L K ) i) (wit : SumcheckWitness L ℓ' i) :

                                                          This condition ensures that the witness polynomial H has the correct structure A(...) * t'(...)

                                                          Instances For
                                                            def Binius.RingSwitching.masterKStateProp (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (h_l : = ℓ' + κ) {𝓑 : Fin 2 L} (aOStmtIn : AbstractOStmtIn L ℓ') (stmtIdx : Fin (ℓ' + 1)) (stmt : BinaryBasefold.Statement (RingSwitchingBaseContext κ L K ) stmtIdx) (oStmt : (j : aOStmtIn.ιₛᵢ) → aOStmtIn.OStmtIn j) (wit : SumcheckWitness L ℓ' stmtIdx) (localChecks : Prop := True) :
                                                            Instances For
                                                              def Binius.RingSwitching.sumcheckRoundRelationProp (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (h_l : = ℓ' + κ) {𝓑 : Fin 2 L} (aOStmtIn : AbstractOStmtIn L ℓ') (i : Fin (ℓ' + 1)) (stmt : BinaryBasefold.Statement (RingSwitchingBaseContext κ L K ) i) (oStmt : (j : aOStmtIn.ιₛᵢ) → aOStmtIn.OStmtIn j) (wit : SumcheckWitness L ℓ' i) :
                                                              Instances For
                                                                def Binius.RingSwitching.sumcheckRoundRelation (κ : ) (L : Type) [Field L] (K : Type) [Field K] [Algebra K L] (β : Module.Basis (Fin κFin 2) K L) (ℓ' : ) (h_l : = ℓ' + κ) {𝓑 : Fin 2 L} (aOStmtIn : AbstractOStmtIn L ℓ') (i : Fin (ℓ' + 1)) :
                                                                Set ((BinaryBasefold.Statement (RingSwitchingBaseContext κ L K ) i × ((j : aOStmtIn.ιₛᵢ) → aOStmtIn.OStmtIn j)) × SumcheckWitness L ℓ' i)

                                                                Input relation for single round: proper sumcheck statement

                                                                Instances For