Round-six lemma `zipK`
ProvedNLogN.KIL.Sp.zipKAn auxiliary lemma of the round-six development, published as a separate node because its proof is long or shared.
The following holds (Lean statement, in the scope of module Solutions.KIL3Ops):
theorem NLogN.KIL.Sp.zipK {A Z O C : Fin HS} (hAZ : A ≠ Z) (hAO : A ≠ O) (hZO : Z ≠ O) (hAC : A ≠ C)
(hZC : Z ≠ C) (hOC : O ≠ C) (hA5 : A.val < 56) (hZ5 : Z.val < 56) (hO5 : O.val < 56)
(hC5 : C.val < 56) (s : IState HS) (f : Fin HS → List ℤ) (a b la lb : List ℤ)
(hfA : f A = a ++ la) (hfZ : f Z = b ++ lb) (hab : a.length = b.length)
(ha : Bits a) (hb : Bits b) (hfC : f C = []) (Bb : ℕ) (hB : zsz ((2 * 2 : ℕ) : ℤ) ≤ Bb)
(hn : zsz (a.length : ℤ) ≤ Bb) :
Sp (zipK A Z O C a.length) (encK s f)
(encK s (Function.update (Function.update (Function.update f A la) Z lb) O
((List.zipWith xr a b).reverse ++ f O))) (cZip a.length Bb)
Context. KIL3: generic stack operations on managed states
Element-wise loops used by the one-stack network: dupK (copy n integers to two stacks),
dropK (discard n integers), zeroK (push n zeros), zipK (pointwise addition mod 2 of two
stacks). All are stated on managed states encK s f.
Formalization Note. Part of the Lean formalization of the round-six κ-improvement (integer-multiplication-kappa campaign, target IntMul.Kappa.jain_round6_framework). The statement is copied verbatim from the Lean development; the platform node carries the same declaration name. Definitions it mentions live in the IntMul_Kappa_R6_Defs* bundles (on top of the published κ bundles IntMul_Kappa_K_Defs*).
-- Round-six κ development (integer-multiplication-kappa), generated by skeleton subtraction. import Definitions.Def_IntMul_Kappa_K_Defs33 import Definitions.Def_IntMul_Kappa_R6_Defs1 import Mathlib import Definitions.Def_IntMul_HvdH_M_Defs8 import Definitions.Def_IntMul_MultitapeModel set_option autoImplicit false set_option relaxedAutoImplicit false set_option maxHeartbeats 1000000 open NLogN NLogN.KIL open IntMul NLogN.RS AModel
theorem NLogN.KIL.Sp.zipK {A Z O C : Fin HS} (hAZ : A ≠ Z) (hAO : A ≠ O) (hZO : Z ≠ O) (hAC : A ≠ C)
(hZC : Z ≠ C) (hOC : O ≠ C) (hA5 : A.val < 56) (hZ5 : Z.val < 56) (hO5 : O.val < 56)
(hC5 : C.val < 56) (s : IState HS) (f : Fin HS → List ℤ) (a b la lb : List ℤ)
(hfA : f A = a ++ la) (hfZ : f Z = b ++ lb) (hab : a.length = b.length)
(ha : Bits a) (hb : Bits b) (hfC : f C = []) (Bb : ℕ) (hB : zsz ((2 * 2 : ℕ) : ℤ) ≤ Bb)
(hn : zsz (a.length : ℤ) ≤ Bb) :
Sp (zipK A Z O C a.length) (encK s f)
(encK s (Function.update (Function.update (Function.update f A la) Z lb) O
((List.zipWith xr a b).reverse ++ f O))) (cZip a.length Bb) := by sorry