HvdH machine lemma Rsp.sapP_okc (The `sapL` slice program)
ProvedNLogN.Rsp.sapP_okcThe following holds (Lean statement, in the scope of module NLogN.HRspSap):
theorem NLogN.Rsp.sapP_okc (M : MulSpec) (mm Φ B : ℕ) (hM : MulBnd M mm Φ) (p s t α : ℕ) (s0 : IState HS)
(U : List (ℤ × ℤ)) (RU LKs LKa LKN LR LN LNR LNW RW RD : List Item)
(hs : 0 < s) (ht : 0 < t) (hst : s ≤ t) (hUl : U.length = s)
(hU : s0.G CU = gints U ++ RU) (hKs : s0.G Ks = .int (s : ℤ) :: LKs)
(hKa : s0.G Ka = .int (sOff s (HvdH.sWidth p α) : ℤ) :: LKa)
(hKN : s0.G KN = .int ((s + (2 * HvdH.sWidth p α + 1) : ℕ) : ℤ) :: LKN)
(hR : s0.G BR = .int (2 ^ (2 * p)) :: LR) (hN : s0.G BN = .int t :: LN)
(hNR : s0.G BNR = .int ((2 * HvdH.sWidth p α + 1 : ℕ) : ℤ) :: LNR)
(hNW : s0.G BNW = .int ((t * (2 * HvdH.sWidth p α + 1) : ℕ) : ℤ) :: LNW)
(hW : s0.G NLogN.Rsp.BW = ints (sTab p s t α).flatten ++ RW)
(hD : s0.G BD = ints ((sDel s t).map (Nat.cast : ℕ → ℤ)) ++ RD)
(hu : ∀ z ∈ U, zsz z.1 ≤ mm ∧ zsz z.2 ≤ mm)
(hWB : ∀ W ∈ sTab p s t α, ∀ y ∈ W, zsz y ≤ mm)
(hAcc : (2 * HvdH.sWidth p α + 2) * 2 ^ (2 * mm) ≤ 2 ^ B) (hmB : 2 * mm ≤ B)
(hLB : zsz ((s + (2 * HvdH.sWidth p α + 1) : ℕ) : ℤ) ≤ B) (hpB : 2 * p + 1 ≤ B)
(hnB : zsz ((t * (2 * HvdH.sWidth p α + 1) : ℕ) : ℤ) ≤ B) (htB : zsz (t : ℤ) ≤ B) :
sapP.ok M s0 ∧ sapP.cost M s0 ≤ gresCost s (2 * HvdH.sWidth p α + 1) t mm Φ B 1 ∧
∀ z ∈ HvdH.Ref.sapL p s t α U, zsz z.1 ≤ B ∧ zsz z.2 ≤ B
Context. The lemma belongs to the part The sapL slice program.
Formalization Note. This is a lemma of the Lean development NLogN, a multitape-Turing-machine implementation of the Harvey–van der Hoeven integer multiplication algorithm, used in the proof of NLogN.FIN.theorem_1_1_nlogn : IntMul.MulTimeBound fun n => n * Real.log n. All names refer to the definition bundles IntMul_HvdH_M_Defs1–IntMul_HvdH_M_Defs8 (namespace NLogN), built on the platform model Def_IntMul_MultitapeModel and the published reference Def_IntMul_HvdH_MachineRef. The machine layer: IState HS is a state of 64 item stacks; RM programs have a semantics p.run s, a definedness predicate p.ok M s and a cost p.cost M s relative to a multiplication spec M : MulSpec; zsz z is the bit length of .
-- Harvey–van der Hoeven multitape-TM development (NLogN), generated by skeleton subtraction. import Definitions.Def_IntMul_HvdH_M_Defs8 set_option autoImplicit false set_option relaxedAutoImplicit false set_option maxHeartbeats 1000000 set_option linter.unusedSimpArgs false open NLogN open NLogN.Rsp open IntMul NLogN RS
theorem NLogN.Rsp.sapP_okc (M : MulSpec) (mm Φ B : ℕ) (hM : MulBnd M mm Φ) (p s t α : ℕ) (s0 : IState HS)
(U : List (ℤ × ℤ)) (RU LKs LKa LKN LR LN LNR LNW RW RD : List Item)
(hs : 0 < s) (ht : 0 < t) (hst : s ≤ t) (hUl : U.length = s)
(hU : s0.G CU = gints U ++ RU) (hKs : s0.G Ks = .int (s : ℤ) :: LKs)
(hKa : s0.G Ka = .int (sOff s (HvdH.sWidth p α) : ℤ) :: LKa)
(hKN : s0.G KN = .int ((s + (2 * HvdH.sWidth p α + 1) : ℕ) : ℤ) :: LKN)
(hR : s0.G BR = .int (2 ^ (2 * p)) :: LR) (hN : s0.G BN = .int t :: LN)
(hNR : s0.G BNR = .int ((2 * HvdH.sWidth p α + 1 : ℕ) : ℤ) :: LNR)
(hNW : s0.G BNW = .int ((t * (2 * HvdH.sWidth p α + 1) : ℕ) : ℤ) :: LNW)
(hW : s0.G NLogN.Rsp.BW = ints (sTab p s t α).flatten ++ RW)
(hD : s0.G BD = ints ((sDel s t).map (Nat.cast : ℕ → ℤ)) ++ RD)
(hu : ∀ z ∈ U, zsz z.1 ≤ mm ∧ zsz z.2 ≤ mm)
(hWB : ∀ W ∈ sTab p s t α, ∀ y ∈ W, zsz y ≤ mm)
(hAcc : (2 * HvdH.sWidth p α + 2) * 2 ^ (2 * mm) ≤ 2 ^ B) (hmB : 2 * mm ≤ B)
(hLB : zsz ((s + (2 * HvdH.sWidth p α + 1) : ℕ) : ℤ) ≤ B) (hpB : 2 * p + 1 ≤ B)
(hnB : zsz ((t * (2 * HvdH.sWidth p α + 1) : ℕ) : ℤ) ≤ B) (htB : zsz (t : ℤ) ≤ B) :
sapP.ok M s0 ∧ sapP.cost M s0 ≤ gresCost s (2 * HvdH.sWidth p α + 1) t mm Φ B 1 ∧
∀ z ∈ HvdH.Ref.sapL p s t α U, zsz z.1 ≤ B ∧ zsz z.2 ≤ B := by sorry