Documentation

CslibFrontier.DataStructure.PriorityQueue.FibonacciHeap.Native.Cascade

Native cascading-cut source #

The native body reuses the existing cut certificate. Its parent subtraction is a charged pure step, not free call wiring. The source equality preserves the original stop and mark branches. The body domain concerns reached memory; a complete decrease-key certificate is separate.

Main definitions #

Main results #

The marked branch uses the existing cut's actual intermediate-state domain. All other arithmetic overflow obligations remain part of the original admissible source history.

The same original cascading-cut source step, without an added source-history hypothesis. Its intrinsic admissibility premise supplies fitting values for the mark/count writes.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.cascadeStepSafe_of_cascading {n K w base : ℕ} {s : IndexedMinPQ.State n} {mem : Memory.State} {v m z : Fin n} {ts : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (halloc : (layout n base).Inv mem) (h : Cascading n K s (view n ((layout n base).abs mem)) v m (some z) ts) (hz : z ∈ WordRAM.FibonacciHeap.forestNodes ts) :
cascadeStepSafe w ![n, base, ↑z] mem

The existing forest supplies the actual cut domain whenever the body reaches its cut branch. No additional numeric parent or subtraction hypothesis is assumed.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.cascade_whileSafe {n K w base fuel : ℕ} {s : IndexedMinPQ.State n} {mem : Memory.State} {v m z : Fin n} {ts : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (halloc : (layout n base).Inv mem) (h : Cascading n K s (view n ((layout n base).abs mem)) v m (some z) ts) (hv : ∃ T ∈ ts, T.root = v) (hzv : ∀ T ∈ ts, z ∈ T.nodes → T.root ≠ v) (hz : z ∈ WordRAM.FibonacciHeap.forestNodes ts) (hfuel : (view n ((layout n base).abs mem)).numMarked < fuel) (hvalid : (Memory.spec w).ValidHistory mem ((Memory.spec w).clientHistory mem (WordRAM.Realization.boundedWhile (fun (x : Unit) (a : Option ℕ) => WordRAM.Realization.optionWords a 0 ≠ 0) (fun (a : Unit × Option ℕ) => DataStructure.link ((layout n base).methods 0) (cascadeStep (WordRAM.Realization.optionWords a.2 1))) () fuel (some ↑z)))) :

The original marked-node rank justifies the source cascade's finite while cutoff. The valid-history premise is the certificate's intrinsic source admissibility condition, not an extra heap model. All body domains are required at the actual reached memories.

The native cascade's loop domain: every reached body has its genuine cut domain and the original cutoff does not truncate a continuing branch.

The complete original cascade, compiled with the shared native while rule. The cutoff is only a proof bound: the emitted loop tests the pending tag and never executes a fuel counter.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.cascadeSafe_of_cascading {n K w base : ℕ} {s : IndexedMinPQ.State n} {mem : Memory.State} {v m z : Fin n} {ts : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (halloc : (layout n base).Inv mem) (h : Cascading n K s (view n ((layout n base).abs mem)) v m (some z) ts) (hv : ∃ T ∈ ts, T.root = v) (hzv : ∀ T ∈ ts, z ∈ T.nodes → T.root ≠ v) (hz : z ∈ WordRAM.FibonacciHeap.forestNodes ts) :
cascadeSafe w ![n, base, ↑z] mem

The original source proof supplies admissible history as well as the marked-node fuel bound. Thus the native while domain follows from the existing forest and allocation invariant.