Documentation

Complexity.Algorithms.WordRAM.ThreeSum.ChanHe.TraversalModel

A bounded worklist for the exact Chan–He recursion #

The worklist expands the existing ChanHe.nodes in its existing preorder. Empty triples and zero fuel are popped without emitting an instance. Three children replace one set each by its existing heavy subset, in the order used by the finite reduction.

This is the mathematical invariant for the native traversal, not a native execution contract. In particular, expanding a worklist entry here does not discharge a native modulus or node call. The stack bound counts pending entries, including empty and zero-fuel entries. Those entries still require charged native pop and branch instructions.

Main definitions #

Main results #

These worklist invariants are original. They reuse the finite recursion of [CH20].

One pending call of the existing finite recursion.

  • fuel : ℕ

    Remaining recursion levels.

  • sets : Fin 3 → Finset ℤ

    The three mathematical sets represented by the native descriptor.

Instances For

    The exact existing preorder associated with one pending call.

    Instances For

      The exact existing modulus and three sets of a nonempty call.

      Instances For
        @[reducible, inline]

        Whether a call is skipped because one of its sets is empty.

        Instances For

          The three children, with exactly the mathematical reduction's order and heavy sets.

          Instances For

            The sequence still to be emitted from a top-first worklist.

            Instances For

              One pop, followed either by a skip or by one emission and three children.

              Instances For
                theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Traversal.Math.output_step (Q : Finset ℕ) (Λ : ℕ) (t : Task) (ts : List Task) :
                output Q Λ (t :: ts) = (step Q Λ t ts).2.toList ++ output Q Λ (step Q Λ t ts).1

                One worklist transition preserves the exact output list, including order and skipped calls.

                Number of transitions for the full ternary tree, counting its zero-fuel leaves.

                Instances For

                  Every pending entry costs at least one pop/skip transition.

                  Closed form without a truncated quotient.

                  The sum of the transition budgets of all pending entries.

                  Instances For

                    One transition spends at least one unit, including the empty and zero-fuel cases.

                    Each entry's fuel plus the pending suffix gives a bound measured from the stack bottom.

                    Instances For

                      A single root of fuel f satisfies the stack invariant.

                      The explicit stack requires at most 2f+1 entries, even with zero-fuel entries present.

                      theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Traversal.Math.bounded_step {f : ℕ} (Q : Finset ℕ) (Λ : ℕ) (t : Task) (ts : List Task) (h : Bounded f (t :: ts)) :
                      Bounded f (step Q Λ t ts).1

                      A native pop/skip or three-child push preserves the same fixed stack capacity.