Chronological edge-CSP forest search #
The executable forest-growing part of Algorithm 1, steps 1–5, of
[KKR18], arXiv:1602.03124v6, printed p. 10. A run stops at
exhaustion, augmentation, or the first blossom; contraction and recursive solving are separate.
The input is the existing positional CSP, Boolean occurrence labeling and relation evaluator.
Variable names need only decidable equality. No finite universe of variable names is scanned.
Expansion records are stored newest first. An expansion's timestamp is the number of older records, starting at zero rather than the paper's one. The scan order is constraint position then port position. Each newly added variable records its actual parent ports, so ancestry reconstruction is executable structural recursion through older records. The search itself recurses on the remaining incidence list: every continuation removes its chosen input port.
Step 4b compares the original constraint position, not the copied node. Meeting data retain
the partially expanded copy, both ancestral paths and the meeting ports. Meeting.prunedDAG
removes all outgoing arcs at that copy before inserting the second incoming arc, as required
by Lemma 34's moreover clause (printed p. 16).
This module defines the executable search and elementary scan/termination properties. The mathematical correctness of its returned events and exhaustion requires separate proofs.
Main definitions #
search: total deterministic forest-growing search.Meeting.prunedDAG: the terminal graph required by Lemma 34's moreover clause.Log.ancestry: actual parent-port reconstruction through older expansions.
One chronological expansion: its input port and the children discovered during its scan. The original constraint is the input port's constraint position.
- input : F.Occurrence
Actual unused incidence selected in step 2.
- outputs : List F.Occurrence
Actual output ports inserted by step 4a, in scan order.
Instances For
The ports and timestamp witnessing one variable's discovery.
- input : F.Occurrence
Port of the already visited variable that expanded this copied constraint.
- output : F.Occurrence
Port of the newly discovered variable.
- time : ℕ
Number of expansions preceding discovery.
Instances For
A root path together with its copied constraint timestamps, in traversal order.
The mathematical walk is the library's existing Walk.
- walk : F.Walk
The root-to-variable walk, forgetting timestamps.
One copy timestamp per step of the walk.
Instances For
Used positional ports, independent of their orientation and copy.
Instances For
Actual parent ports of a visited nonroot variable, found without choosing a witness.
Instances For
Follow parents through strictly older expansion records. An undiscovered variable has the length-zero path at itself; on a search event both requested variables are visited.
Instances For
Convert the executable log to the existing finite incidence DAG, retaining isolated roots. This is a representation conversion, not an invariant assertion.
Instances For
Step 4b: the variable's predecessor is a copy of the same original constraint. The timestamp of that predecessor need not be the current timestamp.
Instances For
Every reconstructed ancestry has length at most the number of expansions.
Every copy along a reconstructed ancestral path strictly predates the next expansion.
Inconsistent roots in positional incidence order, without a finite variable universe.
Instances For
Every inconsistent variable, and only an inconsistent variable, is an initial root.
The distinct same-constraint partners whose two-port flip is valid, in positional order. Testing global validity is equivalent to the source's local test when the base is valid.
Instances For
Exact feasible-partner scan specification.
Terminal scan data before augmentation or contraction. Both ancestry walks and their timestamps are retained, including shared copied constraints.
- roots : List V
Inconsistent variables initially inserted as isolated roots.
- older : Log F
Completed older expansions, newest first.
- current : Expansion F
Current expansion up to, but excluding, the meeting output.
- output : F.Occurrence
Feasible output already visited, with no predecessor at this original constraint.
Instances For
Root-to-input ancestry before inserting the current copy.
Instances For
Root-to-output ancestry before inserting the current copy. Step 4b ensures a terminal output was not newly discovered at the current copy.
Instances For
The forest at the instant the feasible already-visited output is encountered.
Instances For
Lemma 34's terminal graph: prune all current-copy children and add the meeting incoming arc. Newly discovered variables remain supported as isolated nodes.
Instances For
Candidate augmentation from step 4c: left ancestry, the two meeting ports, reversed right ancestry. Its validity needs the meeting-DAG argument, not reversal of an arbitrary f-walk.
Instances For
Result of one complete feasible-partner scan.
- continued {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} (outputs : List F.Occurrence) : ScanResult F
All feasible partners were either inserted or skipped by source step 4b.
- meeting {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} (outputs : List F.Occurrence) (output : F.Occurrence) : ScanResult F
First previously visited partner that is not skipped by source step 4b.
Instances For
Scan step 4 in positional order. outputs contains the children already inserted at
this copy; they participate in both the visited and same-original-parent tests.
Instances For
A forest-growing run stops at exhaustion or the first augmentation/blossom event. The event retains actual ancestor paths and positional local data for the contraction layer.
- exhausted {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} (log : Log F) : Result F
There is no unused incidence at any visited variable.
- augment {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} (meeting : Meeting F) : Result F
First meeting between different rooted trees.
- blossom {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} (meeting : Meeting F) : Result F
First meeting within one rooted tree.
Instances For
Run steps 2–5. The remaining incidence list is the termination measure; each continuation erases the selected input, regardless of any newly discovered children. The final filter only removes additional used ports. No unbounded fresh timestamp or variable-label scan is used.
Instances For
Fresh Algorithm 1 forest search. Preconditions about edge instances, validity and even delta-matroids belong to correctness theorems; the program itself is total on arbitrary CSPs.