Closing a long-key group produces its parse parent
ProvedExactPatternStream.ImplementationProof.close_parked_emitted_groupLet and have lengths with , over an alphabet of size . Fix the hierarchy seed and a word width , where is the integer logarithmic length used by the implementation. At a nonfinal level, choose an emitted group of either the pattern parse or the text parse. Its long-key projection has absorbed every child, its counter slots contain their accumulated values, and its header and registers encode the corresponding annotation. Assume the stipulated workspace, word and save-area bounds. If is that group’s next-level parent, the close block at entry reaches
Register 21 retains the caller’s padding count. The counter stack and annotation are ready for a fresh group, and the seed and header controls are retained. The block preserves the stream cursors and bounds every intermediate write by the specified projection, save, counter and register areas.
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open DynBrooks MachineProof PackedRAM HashProof CounterProof SoundProof CompletenessProof GroupReader
theorem ExactPatternStream.ImplementationProof.close_parked_emitted_group {σ w exponent base start save : ℕ} (P T : List (Fin σ)) (seed : Seeds σ P.length)
(hm : 1≤ P.length) (hmn : P.length≤ T.length) (short : T.length≤2*P.length)
(hn : 3≤ T.length) (alphabet : σ≤ T.length^exponent) (word : 2*(64*(exponent+1)+33)*ell T.length≤ w)
(j : ℕ) (live : j< topIndex (seededBuild P T seed)) (pre post : Program) (ω : ℕ→BitVec w)
(low : 60≤ save) (safe : save+48≤ base) :
let L:=lvl (seededBuild P T seed) j
let D:=lvl (seededBuild P T seed) (j+1)
let m:=P.length
let n:=T.length
let k:=kCnt σ m
let g:=L.c+2
let dt:=Nat.clog 2 g
let width:=slotBits k n
let bits:=levelBits σ m L.i
let len:=g*bits
let h:=countHashBits σ m L.i L.c
let rowSeed:=levelSeed seed L.i len
let row:=(List.ofFn rowSeed).map (fun z=>(z.1.val,z.2.val))
let u:=fun j : Fin bits=>(packedLabelWord w σ m L.i L.u).toNat.testBit j.val
let v:=fun j : Fin bits=>(packedLabelWord w σ m L.i L.v).toNat.testBit j.val
let Q:=pre++longCloseCode save pre.length++post
∀ (S : List ParseTree) (A : List Bool) (parents : List ParseTree),
(S=L.P ∧ A=L.AP ∧ parents=D.P) ∨ (S=L.T ∧ A=L.AT ∧ parents=D.T) →
∀ (idx : ℕ) (emitted : idx< parents.length),
let G:=counterChildLabels L S A idx
let pred:=G.foldl (alphaRead L.i L.u L.v) none
let vals:=payloadCounterInputs σ m L S A idx
let state:=vals.foldl (slotsRead k n) (emptySlotStack k n dt)
let slots:=state.1++[state.2]
let parent:=parents[idx]'emitted
∀ (rs rh : Fin h→Bool) (tr : TriggerState L.c) (rr t : Fin g) (done spare : Bool),
let front:=counterRecordPrefix h bits L.c rs rh u v tr rr t
let bank:=start+front.length
let root:=bank+dt*width
∀ (a : Config w) (x : Label), a.pc=pre.length → LongChildArgs a σ m L.i L.c base start x →
ChildProjectionFits w σ m L.i L.c base start → hashB σ m< len → childProjectionEnd σ m L.i L.c start≤ start+2*h →
ParkedChild a σ m L.i L.c base start row G → PadParameters w k base bank width dt a →
(a.mem 33).toNat=g → (a.mem 38).toNat=expBits σ m →
a.mem 44=MachineProof.bitWord w (counterAlphaFlags pred done spare 2) →
width+3≤ w → 2*max 1 g<2^w → root<2^w → base+root/w+1<2^w →
HeaderImage a base start (front++(counterFields width slots++List.ofFn (counterAlphaFlags pred done spare))) →
LongClosedResult (σ:=σ) (m:=m) (i:=L.i) (c:=L.c) (base:=base) (start:=start)
Q ω a pre.length save width dt k n bank root parent.label rs u v tr rr t done spare := by sorry