Word-RAM join node handler #
This module certifies joinNodeProg (along with the private loop joinFillProg). It combines left
and right child DP tables entrywise by projecting each left-bag assignment onto the right child bag
via radixProjProg, and has no dependency on BagOps, ConstraintScan, LeafIntro, or Forget.
Main definitions #
Cslib.Algorithms.WordRAM.TreeDecomposition.JoinNodeArgs,Cslib.Algorithms.WordRAM.TreeDecomposition.joinNodeProg:joinnode handler.
Main results #
Cslib.Algorithms.WordRAM.TreeDecomposition.joinNodeProg_spec,Cslib.Algorithms.WordRAM.TreeDecomposition.joinNodeProg_realizes: correctness and realization ofjoinNodeProg.
4. Join node handler (joinFillProg, joinNodeProg) #
Tuple equivalence encoding JoinNodeArgs into Word-RAM registers.
@[instance_reducible]
Combine two child DP tables entrywise via radixProjProg and write the descriptor for a
join node.
theorem Cslib.Algorithms.WordRAM.TreeDecomposition.joinNodeProg_spec {w F_lo : ℕ} (counting : Bool) (a : JoinNodeArgs) (hq : 0 < a.q) {left right : SimpleGraph.NiceTree ℕ} {cs : List (ConstraintTable a.q)} {vars : List ℕ} {s : DataStructure.Memory.State} (hleft : NodeDescAt F_lo counting a.q cs vars left a.dLeft s) (hright : NodeDescAt F_lo counting a.q cs vars right a.dRight s) (hdCur : a.dCur + 4 ≤ F_lo) (hFlo : F_lo ≤ s.frontier) (hfit_peak : WordRAM.Fits w (s.frontier + a.q ^ (Lean.TreeDecomposition.bagList left).length)) (hfit_cap : WordRAM.Fits w (if counting = true then a.q ^ activeForgetCount vars (left.join right) else 1)) :
have sEnd := (DataStructure.Memory.spec 0).clientState s (joinNodeProg a);
(DataStructure.Memory.spec w).ValidHistory s ((DataStructure.Memory.spec w).clientHistory s (joinNodeProg a)) ∧ sEnd.frontier ≤ s.frontier + a.q ^ (Lean.TreeDecomposition.bagList left).length ∧ WordRAM.Realization.FrameOutsideRange a.dCur (a.dCur + 4) s sEnd ∧ NodeDescAt F_lo counting a.q cs vars (left.join right) a.dCur sEnd ∧ WordRAM.Realization.memoryCost (joinNodeProg a) s ≤ 12 + a.q ^ (Lean.TreeDecomposition.bagList left).length * ((Lean.TreeDecomposition.bagList right).length * ((Lean.TreeDecomposition.bagList left).length + 1) + 3)
Memory validity, framing, NodeDescAt, and cost bound for joinNodeProg.
theorem Cslib.Algorithms.WordRAM.TreeDecomposition.joinNodeProg_realizes :
WordRAM.Realization.Realizes WordRAM.Basis.exact joinNodeProg WordRAM.Realization.WordEncoding.encode
WordRAM.Realization.WordEncoding.encode
(fun (w : ℕ) (a : JoinNodeArgs) (s : DataStructure.Memory.State) =>
0 < a.q ∧ WordRAM.Fits w 3 ∧ WordRAM.Fits w a.q ∧ WordRAM.Fits w (a.dLeft + 3) ∧ WordRAM.Fits w (a.dRight + 2) ∧ WordRAM.Fits w (a.dCur + 3) ∧ ∃ (F_lo : ℕ) (counting : Bool) (left : SimpleGraph.NiceTree ℕ) (right : SimpleGraph.NiceTree ℕ) (cs :
List (ConstraintTable a.q)) (vars : List ℕ),
NodeDescAt F_lo counting a.q cs vars left a.dLeft s ∧ NodeDescAt F_lo counting a.q cs vars right a.dRight s ∧ WordRAM.Fits w (a.q ^ (Lean.TreeDecomposition.bagList right).length) ∧ WordRAM.Fits w (s.frontier + a.q ^ (Lean.TreeDecomposition.bagList left).length) ∧ WordRAM.Fits w
(if counting = true then a.q ^ activeForgetCount vars (left.join right) else 1))
fun (x : JoinNodeArgs) (x_1 : DataStructure.Memory.State) => 0
Exact-basis Word-RAM realization certificate for joinNodeProg.