Skip to content

Commit 6bb5dfb

Browse files
Merge branch 'main' into tr/ring-switching-subprotocol
2 parents 12e7717 + 388f929 commit 6bb5dfb

24 files changed

Lines changed: 1253 additions & 128 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
${{ runner.os }}-lean-docs-${{ hashFiles('lake-manifest.json') }}
8686
${{ runner.os }}-lean-docs-
8787
88-
- uses: actions/setup-python@v6
88+
- uses: actions/setup-python@v7
8989
with:
9090
python-version: "3.12"
9191

.github/workflows/docs-integrity.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v7
18-
- uses: actions/setup-python@v6
18+
- uses: actions/setup-python@v7
1919
with:
2020
python-version: "3.12"
2121
- name: Check docs integrity

.github/workflows/kb-generated.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fetch-depth: 0
3131
token: ${{ secrets.GITHUB_TOKEN }}
3232

33-
- uses: actions/setup-python@v6
33+
- uses: actions/setup-python@v7
3434
with:
3535
python-version: "3.12"
3636

ArkLib.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ import ArkLib.Data.CodingTheory.PolishchukSpielman.Resultant
8383
import ArkLib.Data.CodingTheory.Prelims
8484
import ArkLib.Data.CodingTheory.ProximityGap.AHIV22
8585
import ArkLib.Data.CodingTheory.ProximityGap.AHIV22Support
86+
import ArkLib.Data.CodingTheory.ProximityGap.AffineGenerator
8687
import ArkLib.Data.CodingTheory.ProximityGap.BCIKS20.AffineLines.BWMatrix
8788
import ArkLib.Data.CodingTheory.ProximityGap.BCIKS20.AffineLines.GoodCoeffs
8889
import ArkLib.Data.CodingTheory.ProximityGap.BCIKS20.AffineLines.JointAgreement
@@ -228,6 +229,7 @@ import ArkLib.OracleReduction.Security.CoordinateWiseSpecialSoundness.ScalarRoun
228229
import ArkLib.OracleReduction.Security.CoordinateWiseSpecialSoundness.SeqCompose
229230
import ArkLib.OracleReduction.Security.CoordinateWiseSpecialSoundness.SingleRound
230231
import ArkLib.OracleReduction.Security.Implications
232+
import ArkLib.OracleReduction.Security.RbrGame
231233
import ArkLib.OracleReduction.Security.Rewinding
232234
import ArkLib.OracleReduction.Security.RoundByRound
233235
import ArkLib.OracleReduction.Security.SpecialSoundness
@@ -308,6 +310,6 @@ import ArkLib.ToVCVio.EvalDist.Defs.Support
308310
import ArkLib.ToVCVio.EvalDist.Instances.OptionT
309311
import ArkLib.ToVCVio.OracleComp.Coercions.SubSpec
310312
import ArkLib.ToVCVio.OracleComp.EvalDist
313+
import ArkLib.ToVCVio.OracleComp.QueryTracking.LoggingOracle
311314
import ArkLib.ToVCVio.OracleComp.SimSemantics.SimulateQ
312-
import ArkLib.ToVCVio.ToMathlib.Control.StateT
313315
import ArkLib.ToVCVio.ToMathlib.Data.Vector.Basic

ArkLib/Commitments/Functional/KZG/Binding.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ lemma binding_game_ext_eq_binding_game {n : ℕ} {AuxState : Type} [SampleableTy
352352
= (fun a => (Groups.PowerSrs.generate (g₁ := g₁) (g₂ := g₂) n a,
353353
Groups.PowerSrs.generate (g₁ := g₁) (g₂ := g₂) n a))
354354
<$> (simulateQ randomOracle (Groups.sampleNonzeroZMod (p := p))).run' ∅ := by
355-
rw [← StateT.run'_map_comm, ← simulateQ_map]
355+
rw [← StateT.run'_map', ← simulateQ_map]
356356
rfl
357357
_ = (fun a => (Groups.PowerSrs.generate (g₁ := g₁) (g₂ := g₂) n a,
358358
Groups.PowerSrs.generate (g₁ := g₁) (g₂ := g₂) n a))
@@ -417,8 +417,8 @@ lemma binding_game_ext_eq_binding_game {n : ℕ} {AuxState : Type} [SampleableTy
417417
(f := id) (post := fun _ => proj)
418418
(hBody := by
419419
intro τ
420-
rw [← StateT.run'_map_comm (Option.map id),
421-
← StateT.run'_map_comm (Option.map proj)]
420+
rw [← StateT.run'_map' (f := Option.map id),
421+
← StateT.run'_map' (f := Option.map proj)]
422422
apply congrArg (fun mx : StateT unifSpec.QueryCache ProbComp
423423
(Option (BindingOutput (p := p) n)) => mx.run' ∅)
424424
dsimp only [bodyBase, bodyExt]

ArkLib/Commitments/Functional/KZG/FunctionBinding/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ lemma function_binding_game_ext_eq_function_binding_game {n L : ℕ} {AuxState :
241241
= (fun a => (Groups.PowerSrs.generate (g₁ := g₁) (g₂ := g₂) n a,
242242
Groups.PowerSrs.generate (g₁ := g₁) (g₂ := g₂) n a))
243243
<$> (simulateQ randomOracle (Groups.sampleNonzeroZMod (p := p))).run' ∅ := by
244-
rw [← StateT.run'_map_comm, ← simulateQ_map]
244+
rw [← StateT.run'_map', ← simulateQ_map]
245245
rfl
246246
_ = (fun a => (Groups.PowerSrs.generate (g₁ := g₁) (g₂ := g₂) n a,
247247
Groups.PowerSrs.generate (g₁ := g₁) (g₂ := g₂) n a))
@@ -251,7 +251,7 @@ lemma function_binding_game_ext_eq_function_binding_game {n L : ℕ} {AuxState :
251251
simp only [map_eq_bind_pure_comp, bind_assoc, pure_bind, Function.comp]
252252
congr 1
253253
funext τ
254-
rw [← map_eq_bind_pure_comp, ← StateT.run'_map_comm, ← simulateQ_map]
254+
rw [← map_eq_bind_pure_comp, ← StateT.run'_map', ← simulateQ_map]
255255
simp only [map_eq_bind_pure_comp, bind_assoc, pure_bind, Function.comp]
256256
congr 1
257257
funext x

ArkLib/Data/CodingTheory/Basic/LinearCode.lean

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,22 +255,29 @@ scoped macro_rules
255255

256256
/-- Let `c` be a word of length `ι`. For every finite `ι`-subset `T` , we define the projection of a
257257
word `c` to `T` as the word obtained by restricting the indexing set of `c` to `T`.
258-
We denote this by `c|[T]`.
259258
Definition 3.7 [BCGM25]. -/
260259
def projectedWord (c : ι → F) (T : Finset ι) : T → F := Set.restrict T c
261260

262-
notation:60 c "|[" T "]" => projectedWord c T
263-
264261
/-- Let `C` be a code of length `ι`. For every finite `ι`-subset `T`, we define the projected code
265-
`C|[T]` as the set of projected codewords `c|[T]`, for `c ∈ C`.
262+
as the set of projected codewords.
266263
Definition 3.7 [BCGM25]. -/
267264
def projectedCode (C : Set (ι → F)) (T : Finset ι) : Set (T → F) :=
268-
{w | ∃ c ∈ C, w = c|[T]}
265+
{w | ∃ c ∈ C, w = projectedWord c T}
266+
267+
open Submodule
268+
269+
/-- The projected code of a linear code, as a submodule of `T → F`.
270+
Definition 3.7 [BCGM25]. -/
271+
def projectedCodeSubmod [Field F] (LC : LinearCode ι F) (T : Finset ι) :
272+
Submodule F (T → F) := LC.map (LinearMap.funLeft F F (Subtype.val : T → ι))
269273

270-
notation:60 C "|[" T "]" => projectedCode C T
274+
/-- Membership in `projectedCodeSubmod` is membership in `projectedCode` of the underlying set. -/
275+
lemma mem_projectedCodeSubmod_iff [Field F] (LC : LinearCode ι F) (T : Finset ι)
276+
(w : T → F) : w ∈ projectedCodeSubmod LC T ↔ w ∈ projectedCode LC.carrier T :=
277+
Submodule.mem_map.trans <| exists_congr fun _ => and_congr_right fun _ => eq_comm
271278

272-
/-- Let `T` be a finite subset of `ι`. If every word in a collection lies in the projected code
273-
`C|[T]`, then so do all `F`-linear combinations of these. -/
279+
/-- Let `T` be a finite subset of `ι`. If every word in a collection lies in the projected code,
280+
then so do all `F`-linear combinations of these. -/
274281
lemma projectedCode_linearCombination [Field F] (LC : LinearCode ι F) (T : Finset ι) {α : Type}
275282
[Fintype α] (U : α → (ι → F)) (c : α → F)
276283
(hU : ∀ j, projectedWord (U j) T ∈ projectedCode LC.carrier T) :

ArkLib/Data/CodingTheory/Prelims.lean

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Mathlib.LinearAlgebra.AffineSpace.Pointwise
1010
import Mathlib.LinearAlgebra.AffineSpace.Combination
1111
import Mathlib.RingTheory.Henselian
1212

13+
1314
/-! # Coding-Theory Preliminaries -/
1415

1516
section TensorCombination
@@ -34,6 +35,7 @@ def multilinearCombine {ϑ : ℕ} {ι : Type*}
3435
(u : (Fin (2 ^ ϑ)) → ι → A) (r : Fin ϑ → F) : (ι → A) :=
3536
fun colIdx => ∑ rowIdx : Fin (2^ϑ), ((multilinearWeight r rowIdx) : F) • ((u rowIdx colIdx) : A)
3637
notation:20 r " |⨂| " u => multilinearCombine (u := u) (r := r)
38+
3739
end TensorCombination
3840
noncomputable section
3941

@@ -297,6 +299,29 @@ instance instNonemptyAffineSubspace_mk' {V : Type*} [AddCommGroup V] [Module F V
297299
(p : V) (direction : Submodule F V) : Nonempty (AffineSubspace.mk' p direction) :=
298300
nonempty_subtype.mpr ⟨p, AffineSubspace.self_mem_mk' p direction⟩
299301

302+
/-- The affine-space combination of codewords `U` at seed `x`:
303+
`U 0 + ∑ i, x i • U (i+1)`, i.e. `vecMul (1, x) U`. -/
304+
abbrev affineComb {s : ℕ} (U : Fin (s + 1) → (ι → F)) (x : Fin s → F) : ι → F :=
305+
Matrix.vecMul (Fin.cons 1 x) U
306+
307+
/-- The linear combination `∑ i, l i • U (i+1)` of the "direction" codewords. -/
308+
abbrev linComb {s : ℕ} (U : Fin (s + 1) → (ι → F)) (l : Fin s → F) : ι → F :=
309+
fun k => ∑ i, l i * U i.succ k
310+
311+
omit [Fintype ι] [DecidableEq F] [Fintype F] in
312+
/-- The affine combination along the line `x ↦ v + t • lam` in seed space. -/
313+
lemma affineComb_line {s : ℕ} (U : Fin (s + 1) → (ι → F)) (v lam : Fin s → F) (t : F) :
314+
affineComb U (v + t • lam) = affineComb U v + t • (linComb U lam) := by
315+
have hsplit : (Fin.cons 1 (v + t • lam) : Fin (s + 1) → F) =
316+
Fin.cons 1 v + t • (Fin.cons (0 : F) lam : Fin (s + 1) → F) := by
317+
ext i
318+
refine Fin.cases ?_ ?_ i <;> simp
319+
have hlin : Matrix.vecMul (Fin.cons (0 : F) lam : Fin (s + 1) → F) U = linComb U lam := by
320+
ext k
321+
simp [Matrix.vecMul, dotProduct, Fin.sum_univ_succ, linComb]
322+
change Matrix.vecMul (Fin.cons 1 (v + t • lam) : Fin (s + 1) → F) U = _
323+
rw [hsplit, Matrix.add_vecMul, Matrix.smul_vecMul, hlin]
324+
300325
end
301326
end Affine
302327

0 commit comments

Comments
 (0)