Encoding one block into the Fermat ring is defined
ProvedNLogN.encP_okLet stack GU start with a block of Gaussian integers blk (as items), and registers CR, CM, RW, FR hold , , and some integer . Then the block-encoding program encP is defined on this state (encP.ok M s; no undefined operation such as a division by zero or a type mismatch occurs).
Formalization Note. The machine layer: IState HS is a state with stacks of items (Item = integer or mark), an input position and an output; RM programs (straight-line register code RS, loops rep, conditionals, calls of the multiplication procedure through a MulSpec giving its domain and cost) have a functional semantics p.run s, a definedness predicate p.ok M s and a cost p.cost M s; Spec M p s s' c abbreviates p.ok M s ∧ p.run s = s' ∧ p.cost M s ≤ c. ints L / gints U push an integer list / a list of pairs as items (head = top); zsz z is the bit length of . MulBnd M m Φ says the multiplication procedure accepts all pairs of integers of bit length at cost . Register names (GU, CR, KB, XN, …) are fixed stack indices.
-- Harvey–van der Hoeven multitape-TM development (NLogN), generated by skeleton subtraction. import Definitions.Def_IntMul_HvdH_M_Defs4 set_option autoImplicit false set_option relaxedAutoImplicit false set_option maxHeartbeats 1000000 set_option linter.unusedSimpArgs false open NLogN open IntMul IntMul.HvdH IntMul.HvdH.Ref set_option maxHeartbeats 2000000
theorem NLogN.encP_ok (M : MulSpec) (s : IState HS) (P : ℕ) (blk : List (ℤ × ℤ))
(R LR LM LW LF : List Item)
(F : ℤ) (hU : s.G GU = gints blk ++ R) (hR : s.G CR = .int (2 ^ P) :: LR)
(hM : s.G CM = .int blk.length :: LM)
(hW : s.G RW = .int (2 ^ (2 * blk.length * P)) :: LW) (hF : s.G FR = .int F :: LF) :
encP.ok M s := by sorry