Documentation

CslibFrontier.Algorithms.WordRAM.ThreeSum.ChanHe.Padding

Initializing the four columns of a Chan–He node #

Main definitions #

Main results #

References #

This native program and its execution proof are original.

@[reducible, inline]

Packed output base.

@[reducible, inline]

Number of four-cell groups.

@[reducible, inline]

Padding word for column zero.

@[reducible, inline]

Padding word for column one.

@[reducible, inline]

Padding word for column two.

@[reducible, inline]

Padding word for column three.

@[reducible, inline]

Group cursor.

@[reducible, inline]

Temporary address.

@[reducible, inline]

Constant one.

@[reducible, inline]

Constant four.

A concrete four-word pattern, addressed by its residue modulo four.

def Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Padding.memory (mem : ℕ → ℕ) (dst p₀ p₁ p₂ p₃ k : ℕ) :
ℕ → ℕ

Initial memory with the first k groups overwritten, including all padding.

@[simp]
theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Padding.memory_zero (mem : ℕ → ℕ) (dst p₀ p₁ p₂ p₃ : ℕ) :
memory mem dst p₀ p₁ p₂ p₃ 0 = mem
theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Padding.memory_succ (mem : ℕ → ℕ) (dst p₀ p₁ p₂ p₃ k : ℕ) :
memory mem dst p₀ p₁ p₂ p₃ (k + 1) = Function.update (Function.update (Function.update (Function.update (memory mem dst p₀ p₁ p₂ p₃ k) (dst + 4 * k) p₀) (dst + 4 * k + 1) p₁) (dst + 4 * k + 2) p₂) (dst + 4 * k + 3) p₃

Four distinct stores make one complete group.

Every address, store and increment of a four-word group is charged.

Runtime pattern values and length, with fixed code and registers.

theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Padding.exec {w : ℕ} (x : WordRAM.Data 10) (h4 : WordRAM.Fits w 4) (hfit : WordRAM.Fits w (x.regs dst + 4 * x.regs len)) :
∃ (y : WordRAM.Data 10), WordRAM.ExecWithin w program x y (12 * x.regs len + 5) ∧ y.mem = memory x.mem (x.regs dst) (x.regs pad0) (x.regs pad1) (x.regs pad2) (x.regs pad3) (x.regs len) ∧ ∀ (i : Fin 10), ↑i < 6 → y.regs i = x.regs i

Initialize exactly 4N cells from arbitrary old memory.